Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions src/workspace/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ import {
memberSchema,
modelCatalogSchema,
type ProviderFamily,
pendingApprovalsSchema,
preferencesSchema,
providerAvailabilitySchema,
queueSchema,
runnableFamilies,
type SessionDraft,
type SessionInput,
Expand Down Expand Up @@ -369,31 +367,6 @@ export class WorkspaceClient {
);
}

/** Messages waiting for their turn, in queue order. */
async queue(
sessionId: string,
signal?: AbortSignal,
): Promise<SessionInput[]> {
const queue = await this.read(
`/api/sessions/${encodeURIComponent(sessionId)}/queue`,
queueSchema,
signal,
);
return queue.messages;
}

async pendingApprovals(
sessionId: string,
signal?: AbortSignal,
): Promise<Invocation[]> {
const pending = await this.read(
`/api/sessions/${encodeURIComponent(sessionId)}/pending-approvals`,
pendingApprovalsSchema,
signal,
);
return pending.invocations;
}

async decide(
invocationId: string,
decision: Decision,
Expand Down
9 changes: 0 additions & 9 deletions src/workspace/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,6 @@ export const historyPageSchema = z.object({

export type HistoryPage = z.infer<typeof historyPageSchema>;

export const queueSchema = z.object({
queuedCount: z.number(),
messages: z.array(inputSchema),
});

export const pendingApprovalsSchema = z.object({
invocations: z.array(invocationSchema),
});

export const modelSchema = z.object({
id: z.string(),
label: z.string(),
Expand Down
6 changes: 1 addition & 5 deletions tests/workspace/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,11 @@ test("archive and restore wait for Leverage to apply them, and report a refusal"
await rejects(readOnly.archive(SESSION, signal), /Only writers/);
});

test("reads approvals, the queue and the model catalog, and sends a decision", async () => {
test("reads the model catalog and sends a decision", async () => {
const f = fixture();
const api = f.client();
const pending = invocation();
f.approvals.push(pending);
expect((await api.pendingApprovals(SESSION)).map((one) => one.id)).toEqual([
pending.id,
]);
const decided = await api.decide(pending.id, {
action: "approve",
approvalScope: "session",
Expand All @@ -237,7 +234,6 @@ test("reads approvals, the queue and the model catalog, and sends a decision", a
action: "approve",
approvalScope: "session",
});
expect(await api.queue(SESSION)).toEqual([]);
expect((await api.models()).map((one) => one.id)).toEqual(["hosted-model"]);
});

Expand Down
21 changes: 1 addition & 20 deletions tests/workspace/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ export function workspaceFixture(extra?: Extra) {
"logs/run.txt": "run 1 ok",
} as Record<string, string>,
nativeMessages: [] as SessionInput[],
queue: [] as SessionInput[],
catalog: [hostedModel] as HostedModel[],
preferences: {} as Record<string, unknown>,
};
Expand Down Expand Up @@ -331,14 +330,6 @@ export function workspaceFixture(extra?: Extra) {
oldestTranscriptSeq: page[0]?.transcriptSeq ?? null,
});
}
if (path.endsWith("/queue")) {
return Response.json({
sessionId: id,
queuedCount: state.queue.length,
queueHold: null,
messages: state.queue,
});
}
if (path.endsWith("/files/resources")) {
return Response.json({
basis: "active_runtime",
Expand Down Expand Up @@ -474,13 +465,6 @@ export function workspaceFixture(extra?: Extra) {
],
});
}
if (path.endsWith("/pending-approvals")) {
return Response.json({
invocations: approvals.filter(
(one) => one.state === "pending_approval",
),
});
}
if (path.endsWith("/read")) {
return Response.json({ readState: {} });
}
Expand Down Expand Up @@ -633,10 +617,7 @@ export function workspaceFixture(extra?: Extra) {
// Taking a message back withdraws it, which empties the inbox.
case "session.queue.cancel": {
const uuid = String(frame.uuid);
const taken = [...state.queue, ...state.nativeMessages].find(
(one) => one.uuid === uuid,
);
state.queue = state.queue.filter((one) => one.uuid !== uuid);
const taken = state.nativeMessages.find((one) => one.uuid === uuid);
state.nativeMessages = state.nativeMessages.filter(
(one) => one.uuid !== uuid,
);
Expand Down
Loading