An open-source, faster Devin alternative
TypeScript
managed-agents: set aside, a column on the session row (work-tracking 3.8)
Igor Zalutski via Computer22c0eb444c33
diff --git a/cloudflare-workers/api-edge/src/computer_api.test.ts b/cloudflare-workers/api-edge/src/computer_api.test.tsindex 4927fc86..4f3c62c9 100644--- a/cloudflare-workers/api-edge/src/computer_api.test.ts+++ b/cloudflare-workers/api-edge/src/computer_api.test.ts@@ -223,6 +223,8 @@ describe("computer API allowlist", () => {["GET", "/computer/sessions/cs_01h"],["PATCH", "/computer/sessions/cs_01h"],["GET", "/computer/sessions/cs_01h/capabilities"],+ ["PUT", "/computer/sessions/cs_01h/aside"],+ ["DELETE", "/computer/sessions/cs_01h/aside"],["POST", "/computer/sessions/cs_01h/interrupt"],["POST", "/computer/sessions/cs_01h/compact"],["POST", "/computer/sessions/cs_01h/suspend"],@@ -258,6 +260,7 @@ describe("computer API allowlist", () => {["POST", "/computer/keys/sync"],["POST", "/computer/keys/revoke"],["DELETE", "/computer/sessions/cs_01h"],+ ["POST", "/computer/sessions/cs_01h/aside"],["PUT", "/computer/sessions/cs_01h/workspace/file"],["POST", "/computer/sessions/cs_01h/turns/tn_1"],["GET", "/computer/sessions/../me"],@@ -1065,6 +1068,7 @@ describe("computer API telemetry: one edge.request per call", () => {"/computer/sessions",`/computer/sessions/${SID}`,`/computer/sessions/${SID}/capabilities`,+ `/computer/sessions/${SID}/aside`,`/computer/sessions/${SID}/interrupt`,`/computer/sessions/${SID}/turns/tn_1/cancel`,`/computer/sessions/${SID}/events`,@@ -1078,7 +1082,7 @@ describe("computer API telemetry: one edge.request per call", () => {"/computer/nope",].map(computerApiRouteFamily),).toEqual([- "me", "tickets", "sessions", "sessions", "sessions", "control", "turns", "events", "asks",+ "me", "tickets", "sessions", "sessions", "sessions", "sessions", "control", "turns", "events", "asks","subagents", "secrets", "secrets", "secrets", "secrets", "workspace", "other",]);});diff --git a/cloudflare-workers/api-edge/src/computer_api.ts b/cloudflare-workers/api-edge/src/computer_api.tsindex f6a6acb2..56aa6d77 100644--- a/cloudflare-workers/api-edge/src/computer_api.ts+++ b/cloudflare-workers/api-edge/src/computer_api.ts@@ -41,6 +41,8 @@ const COMPUTER_API_ROUTES: ReadonlyArray<{methods: new Set(["GET"]),pattern: route(`/sessions/${SEG}/capabilities`),},+ // Set aside (docs/api/sessions.mdx).+ { methods: new Set(["PUT", "DELETE"]), pattern: route(`/sessions/${SEG}/aside`) },{methods: new Set(["POST"]),pattern: route(`/sessions/${SEG}/(?:interrupt|compact|suspend|resume)`),diff --git a/cloudflare-workers/api-edge/src/computer_telemetry.ts b/cloudflare-workers/api-edge/src/computer_telemetry.tsindex 864e77b3..04968c03 100644--- a/cloudflare-workers/api-edge/src/computer_telemetry.ts+++ b/cloudflare-workers/api-edge/src/computer_telemetry.ts@@ -67,6 +67,7 @@ export function computerApiRouteFamily(suffix: string): string {if (parts.length <= 3) return "sessions";switch (third) {case "capabilities":+ case "aside":return "sessions";case "interrupt":case "compact":diff --git a/docs/api/overview.mdx b/docs/api/overview.mdxindex 03d7cca8..0c0c8b8e 100644--- a/docs/api/overview.mdx+++ b/docs/api/overview.mdx@@ -50,7 +50,7 @@ A credential without a scope list has every scope.| Scope | Operations || --- | --- || `sessions:read` | `sessions.attach`, `sessions.get`, `turns.get`, `events.list`, `asks.list`, `asks.get`, `subagents.list`, `subagents.get`, `subagents.stop`, file listing and download |-| `sessions:write` | `turns.send`, `turns.cancel`, `sessions.update`, `sessions.interrupt`, `sessions.compact`, `sessions.suspend`, `sessions.resume`, file upload |+| `sessions:write` | `turns.send`, `turns.cancel`, `sessions.update`, `sessions.interrupt`, `sessions.compact`, `sessions.suspend`, `sessions.resume`, setting a session aside, file upload || `asks:answer` | `asks.answer`, `asks.dismiss` || `terminals` | `terminals.open`, `terminals.resize`, `terminals.eof`, `terminals.close` |@@ -62,6 +62,7 @@ A scope may also name sessions (`sessionIds`), be read-only (`readOnly`) and exp| Credential expired or revoked | Its connections close with `4001` || Caller is not the session's owner and not on its member list | `session_not_found` on every operation. A null member list means the whole organization || Terminal opened by someone other than the owner or an admin | `forbidden`, `reason: "terminal_owner_only"` |+| Session set aside by someone other than its owner | `forbidden`, `reason: "aside_owner_only"` |## Session journaldiff --git a/docs/api/sessions.mdx b/docs/api/sessions.mdxindex 8ef66464..0995ebb9 100644--- a/docs/api/sessions.mdx+++ b/docs/api/sessions.mdx@@ -72,6 +72,21 @@ Every field is optional ([API schema](/reference/api-schema#operations)). `id` i| `session.updated` event | `changes` maps each changed field to `{from, to}`. A metadata key is `metadata.<key>` || Model the harness does not accept | `invalid_request` with `field: "model"`. The session stays on its model |+## Set aside++Triage lists the asks waiting on you. Setting a session aside moves its ask out of that list until something newer needs you. HTTP only: `PUT /sessions/{id}/aside` sets it, `DELETE /sessions/{id}/aside` brings it back. Both return the session.++```json+{"ref":"toolu_01AbCdEf"}+```++| Item | Rule |+| --- | --- |+| `ref` | The id of the ask being set aside: the session's oldest open ask |+| `aside` | True while `ref` is still the session's oldest open ask. Once that ask closes, `aside` is false again, with no `DELETE` |+| Caller | The session's owner, with `sessions:write`. Anyone else: `403 forbidden` with `reason: "aside_owner_only"` |+| Events | None. Setting a session aside does not change `lastActiveAt` |+## Compact`sessions.compact` (`POST /sessions/{id}/compact`) queues a compaction as a turn and returns the same result as `turns.send`.diff --git a/docs/reference/api-schema.mdx b/docs/reference/api-schema.mdxindex 868077e2..27f79f0d 100644--- a/docs/reference/api-schema.mdx+++ b/docs/reference/api-schema.mdx@@ -43,6 +43,8 @@ On an HTTP route, path parameters replace `sessionId`, `turnId`, `askId` and `suCreating a session is HTTP only: `POST /sessions` with `CreateSessionBody`: `id?`, `input?`, `title?` (up to 200 characters), `model?`, `effort?`, `speed?`, `mode?`, `metadata?`.+Setting a session aside is HTTP only: `PUT /sessions/{id}/aside` with `ref` (1 to 255 characters), and `DELETE /sessions/{id}/aside`. Both return `session`. See [Sessions](/api/sessions#set-aside).+### Routes outside the schemaThe relay (`computer/src/wire/`) serves these. The API routes for workspace files are `/sessions/{id}/workspace/files`, `/file` and `/archive`; `opc push` and `opc pull` call `/archive`. See [Files](/api/files).@@ -142,7 +144,7 @@ Sent only on a WebSocket attached with `deltas: true`; see [Events](/api/events#| Object | Fields || --- | --- |-| Session | `id` (`cs_` and 16 characters), `title`, `status` (`starting`, `running`, `waiting`, `idle`, `suspended`), `archived`, `owner` (Person), `origin` (Origin), `settings` (`model`, `effort`, `mode`, `speed`), `metadata`, `activeTurnId`, `queued` (Turn list), `asks` (Ask list), `subagents` (Subagent list), `lastTurn` (TurnSummary or null), `lastText`, `context` (`usedTokens`, `windowTokens`), `lastSeq`, `logEpoch`, `epochStartSeq`, `createdAt`, `lastActiveAt`, `syncedAt`, `urls.dashboard` |+| Session | `id` (`cs_` and 16 characters), `title`, `status` (`starting`, `running`, `waiting`, `idle`, `suspended`), `archived`, `aside`, `owner` (Person), `origin` (Origin), `settings` (`model`, `effort`, `mode`, `speed`), `metadata`, `activeTurnId`, `queued` (Turn list), `asks` (Ask list), `subagents` (Subagent list), `lastTurn` (TurnSummary or null), `lastText`, `context` (`usedTokens`, `windowTokens`), `lastSeq`, `logEpoch`, `epochStartSeq`, `createdAt`, `lastActiveAt`, `syncedAt`, `urls.dashboard` || Person | `id`, `name`, `email` || Origin | `type` (`slack`, `opc`, `dashboard`, `api`), `client`, `slack` (`teamId`, `channelId`, `channelName`, `threadTs`, `url`) or null || Actor | `id`, `name`, `via` (`slack`, `opc`, `dashboard`, `api`), `client` |@@ -180,7 +182,7 @@ An error body is `code`, `message`, and optionally `status`, `retryable`, `reque| Conflict | `id_conflict`, `idempotency_conflict`, `ask_closed`, `session_busy`, `turn_not_cancellable`, `queue_full`, `cursor_ahead`, `path_exists`, `subagent_ended`, `too_far_behind`, `too_many_attached`, `too_many_terminals`, `feature_unavailable`, `computer_not_set_up` || Retry later | `rate_limited`, `unavailable`, `computer_unavailable`, `internal` |-`forbidden` carries a `reason`: `missing_scope`, `read_only` or `terminal_owner_only`.+`forbidden` carries a `reason`: `missing_scope`, `read_only`, `terminal_owner_only` or `aside_owner_only`.## Relay limitsdiff --git a/services/managed-agents/src/computer/api-http.ts b/services/managed-agents/src/computer/api-http.tsindex 1321885b..e972abd9 100644--- a/services/managed-agents/src/computer/api-http.ts+++ b/services/managed-agents/src/computer/api-http.ts@@ -69,6 +69,9 @@ export function matchApiRoute(method: string, suffix: string): Route | null {if (is("PATCH", 2)) return { op: "patch", sessionId };const r = p[2];if (is("GET", 3) && r === "capabilities") return { op: "capabilities", sessionId };+ // Set aside (work-tracking 3.8): the Computer DO's own column, never the writer.+ if (is("PUT", 3) && r === "aside") return { op: "aside.set", sessionId };+ if (is("DELETE", 3) && r === "aside") return { op: "aside.clear", sessionId };if (is("POST", 3) && (r === "interrupt" || r === "compact" || r === "suspend" || r === "resume")) return { op: `sessions.${r}`, sessionId };if (r === "turns") {if (is("POST", 3)) return { op: "turns.send", sessionId };@@ -236,7 +239,7 @@ export async function routeComputerApi(/** The closed route families of `httpapi.request` and `edge.request` (the catalog's list). */export function routeFamily(op: string): string {- if (op === "list" || op === "create" || op === "get" || op === "patch" || op === "capabilities") return "sessions";+ if (op === "list" || op === "create" || op === "get" || op === "patch" || op === "capabilities" || op.startsWith("aside.")) return "sessions";if (op.startsWith("sessions.")) return "control";if (op === "events.list") return "events";if (op.startsWith("turns.")) return "turns";@@ -249,6 +252,7 @@ export function routeFamily(op: string): string {const OPS = new Set(["me", "ticket", "secrets", "secrets.list", "secrets.events", "secrets.put", "secrets.delete", "list", "create", "get", "patch", "capabilities",+ "aside.set", "aside.clear","sessions.interrupt", "sessions.compact", "sessions.suspend", "sessions.resume","turns.send", "turns.list", "turns.get", "turns.cancel", "events.list","asks.list", "asks.get", "asks.answer", "asks.dismiss", "subagents.list", "subagents.get", "subagents.stop",@@ -378,7 +382,7 @@ async function routeApi(if (route.op === "capabilities" && !route.sessionId) return out.send(200, { capabilities: capabilities() });if (route.op === "list") return call({ op: "list", query: [...query.entries()] });- const needsBody = request.method === "POST" || request.method === "PATCH";+ const needsBody = request.method === "POST" || request.method === "PATCH" || request.method === "PUT";let body: unknown;if (needsBody) {const parsed = await bodyOf(request);@@ -401,6 +405,8 @@ async function routeApi(return call({ op: "get", sessionId, ...(minSeq !== undefined ? { minSeq } : {}) });}if (route.op === "patch") return call({ op: "patch", sessionId, body, ...(idem ? { idempotencyKey: idem } : {}) });+ if (route.op === "aside.set") return call({ op: "aside.set", sessionId, body });+ if (route.op === "aside.clear") return call({ op: "aside.clear", sessionId });// Writes to the session's writer.if (needsBody) {diff --git a/services/managed-agents/src/computer/api-types.ts b/services/managed-agents/src/computer/api-types.tsindex f44d5357..d14bd5b6 100644--- a/services/managed-agents/src/computer/api-types.ts+++ b/services/managed-agents/src/computer/api-types.ts@@ -164,6 +164,8 @@ export interface Session {title: string;status: SessionStatus;archived: boolean;+ /** Set aside by its owner from triage: true while the stored ref is the oldest open ask's id. */+ aside: boolean;owner: Person;origin: Origin;settings: SessionSettings;diff --git a/services/managed-agents/src/computer/sessions-api.ts b/services/managed-agents/src/computer/sessions-api.tsindex d6b2bd35..ed69d6a8 100644--- a/services/managed-agents/src/computer/sessions-api.ts+++ b/services/managed-agents/src/computer/sessions-api.ts@@ -17,7 +17,7 @@import type { ApiTelemetry } from "./telemetry/api.js";import type { AssertedApiKey } from "../edge/auth.js";-import type { ApiScope, LogSummary, Origin, Person, Session, SessionStatus } from "./api-types.js";+import type { ApiScope, Ask, LogSummary, Origin, Person, Session, SessionStatus } from "./api-types.js";import { DEFAULT_MODE, MODELS, capabilities, checkSettings } from "./capabilities.js";import { type ComputerEdgeEnv, DEFAULT_WIRE_URL } from "./config.js";import { sha256Hex } from "./crypto.js";@@ -96,6 +96,8 @@ export type ApiOp =| { op: "access"; sessionId: string }| { op: "call"; sessionId: string; method: WriteMethod; params: Record<string, unknown>; idempotencyKey?: string }| { op: "patch"; sessionId: string; body: unknown; idempotencyKey?: string }+ | { op: "aside.set"; sessionId: string; body: unknown }+ | { op: "aside.clear"; sessionId: string }| { op: "ticket"; body: unknown };export interface ApiErrorReply {@@ -162,6 +164,7 @@ export interface ApiRow {subagents: number;createHash: string | null;activeTurnId: string | null;+ asideRef: string | null;}const ROW_SELECT = `SELECT runner_key AS key, session_id AS sessionId, team_id AS teamId, channel_id AS channelId,@@ -170,7 +173,7 @@ const ROW_SELECT = `SELECT runner_key AS key, session_id AS sessionId, team_id Aorigin_client AS originClient, last_seq AS lastSeq, log_epoch AS logEpoch, epoch_start_seq AS epochStartSeq,summary, api_status AS apiStatus, archived, metadata, created_at AS createdAt, updated_at AS updatedAt,last_active_at AS lastActiveAt, synced_at AS syncedAt, subagents, create_hash AS createHash,- active_turn_id AS activeTurnId FROM sessions`;+ active_turn_id AS activeTurnId, aside_ref AS asideRef FROM sessions`;/** Columns work 084 adds to `sessions` (lifecycle.ts's pattern: added when missing). */const COLUMNS: Array<[string, string]> = [@@ -194,6 +197,7 @@ const COLUMNS: Array<[string, string]> = [["subagents", "INTEGER NOT NULL DEFAULT 0"],["create_hash", "TEXT"],["active_turn_id", "TEXT"],+ ["aside_ref", "TEXT"],];export interface SessionsApiDeps {@@ -320,6 +324,7 @@ export class ComputerSessionsApi {title: row.title,status,archived: row.archived === 1,+ aside: row.asideRef !== null && row.asideRef === attentionRef(summary?.asks ?? []),owner,origin,settings: summary?.settings@@ -342,8 +347,10 @@ export class ComputerSessionsApi {urls: { dashboard: null },};if (!fresh) return base;- // The writer's own view is newer than the row; the row owns who, where, archive and labels.- return { ...base, ...fresh, id: base.id, owner, origin, archived: base.archived, metadata: base.metadata, urls: base.urls };+ // The writer's own view is newer than the row; the row owns who, where, archive, aside and labels.+ const asks = fresh.asks ?? base.asks;+ const aside = row.asideRef !== null && row.asideRef === attentionRef(asks);+ return { ...base, ...fresh, id: base.id, owner, origin, archived: base.archived, aside, metadata: base.metadata, urls: base.urls };}/** The runner's spec for a session: an API one (`kind: "api"`) or a Slack thread. */@@ -411,6 +418,9 @@ export class ComputerSessionsApi {return this.call(caller, op.sessionId, op.method, op.params, op.idempotencyKey);case "patch":return this.patch(caller, op.sessionId, op.body, op.idempotencyKey);+ case "aside.set":+ case "aside.clear":+ return this.aside(caller, op);case "ticket":return this.ticket(caller, op.body);}@@ -672,6 +682,28 @@ export class ComputerSessionsApi {return { status: 200, body: { session: this.compose(this.row(sessionId)!, fresh), seq } };}+ /**+ * Set aside (work-tracking 3.8): the owner parks the session's current ask in triage. Only the+ * row's column: no journal event, no host call, last activity unmoved. A newer ask has another+ * ref, so the session comes back by itself.+ */+ private aside(caller: ApiCaller, op: Extract<ApiOp, { op: "aside.set" | "aside.clear" }>): ApiReply {+ const row = this.visible(caller, op.sessionId);+ if (!row) return notFound();+ if (row.ownerUserId !== caller.member) {+ return { status: 403, error: { code: "forbidden", message: "Only the session's owner can set it aside.", reason: "aside_owner_only" } };+ }+ let ref: string | null = null;+ if (op.op === "aside.set") {+ const input = op.body;+ const value = input && typeof input === "object" && !Array.isArray(input) ? (input as Record<string, unknown>).ref : undefined;+ if (typeof value !== "string" || !/^[\x21-\x7e]{1,255}$/.test(value)) return invalid("ref", "ref is the id of what is set aside: 1 to 255 printable characters.");+ ref = value;+ }+ this.deps.sql.exec("UPDATE sessions SET aside_ref = ? WHERE session_id = ?", ref, op.sessionId);+ return { status: 200, body: { session: this.compose(this.row(op.sessionId)!) } };+ }+private async ticket(caller: ApiCaller, body: unknown): Promise<ApiReply> {const began = performance.now();const facts: { sessions?: number; keyWritten?: boolean } = {};@@ -1560,6 +1592,16 @@ function hostLost(): CalvinApiError {return { code: "computer_unavailable", message: "The computer did not answer. Retry.", status: 503, retryable: true, retryAfterMs: RETRY_COMPUTER_MS };}+/**+ * What needs the person now, as one ref: the oldest open ask's id, or null. Set aside compares+ * against it. Work-tracking step 4 replaces it with `attention.ref`.+ */+export function attentionRef(asks: readonly Ask[]): string | null {+ let oldest: Ask | null = null;+ for (const a of asks) if (a.status === "open" && (!oldest || a.createdAt < oldest.createdAt)) oldest = a;+ return oldest?.id ?? null;+}+function notFound(): ApiReply {return { status: 404, error: { code: "session_not_found", message: "No such session." } };}diff --git a/services/managed-agents/test/computer-sessions-api.test.ts b/services/managed-agents/test/computer-sessions-api.test.tsindex d48ee66e..7c7e83c5 100644--- a/services/managed-agents/test/computer-sessions-api.test.ts+++ b/services/managed-agents/test/computer-sessions-api.test.ts@@ -1,7 +1,7 @@import { describe, expect, it, vi } from "vitest";-import type { ApiEvent, LogSummary } from "../src/computer/api-types.js";-import { matchApiRoute, writeParams } from "../src/computer/api-http.js";+import type { ApiEvent, Ask, LogSummary } from "../src/computer/api-types.js";+import { type ComputerApiStub, matchApiRoute, routeComputerApi, writeParams } from "../src/computer/api-http.js";import { computerApiEnabled, GATED_PROTOCOL } from "../src/computer/api-gate.js";import { ComputerKeys } from "../src/computer/keys.js";import type { CalvinGatewayToHost, CalvinPerson } from "../src/computer/protocol.js";@@ -20,6 +20,7 @@ import {} from "../src/computer/sessions-api.js";import { ApiTelemetry } from "../src/computer/telemetry/api.js";import { createTelemetry } from "../src/computer/telemetry/emitter.js";+import type { RequestIdentity } from "../src/edge/auth.js";import { sqlStorage } from "./fixtures/computer-sql.js";/**@@ -517,6 +518,68 @@ describe("writes", () => {});});+describe("set aside (work-tracking 3.8)", () => {+ const ask = (id: string, createdAt: string, status: Ask["status"] = "open"): Ask => ({+ id, sessionId: SID, turnId: "tn_1", kind: "question", status, createdAt, closedAt: null, closedBy: null,+ answer: null, approval: null, question: { questions: [] }, secret: null,+ });++ it("the owner's ref on the row: aside while it is the oldest open ask; no event, no host, last activity unmoved", async () => {+ const f = fixture();+ await created(f);+ const get = async () => ((await f.api.handle(caller(), { op: "get", sessionId: SID })).body as { session: { aside: boolean; lastActiveAt: string } }).session;+ f.api.applySummary(SID, summary(SID, 0, 1, { status: "waiting", asks: [ask("ak_new", "2026-11-19T10:05:00.000Z"), ask("ak_old", "2026-11-19T10:00:00.000Z")] }));+ const before = await get();+ expect(before.aside).toBe(false);+ f.state.protocol = null; // the host is not needed+ const sent = f.frames("api").length;+ const put = (ref: unknown, member = OWNER) => f.api.handle(caller(member), { op: "aside.set", sessionId: SID, body: { ref } });+ expect(await put("ak_old")).toMatchObject({ status: 200, body: { session: { aside: true } } });+ expect(f.api.row(SID)!.asideRef).toBe("ak_old");+ expect((await get()).lastActiveAt).toBe(before.lastActiveAt);+ expect(f.api.row(SID)!.lastSeq).toBe(0);+ expect(f.frames("api")).toHaveLength(sent);+ // Another ref is not the current one.+ expect(await put("ak_new")).toMatchObject({ status: 200, body: { session: { aside: false } } });+ await put("ak_old");+ // The ask is answered: the newer one is current, so the session is back by itself.+ f.api.applySummary(SID, summary(SID, 1, 1, { status: "waiting", asks: [ask("ak_new", "2026-11-19T10:05:00.000Z"), ask("ak_old", "2026-11-19T10:00:00.000Z", "answered")] }));+ expect((await get()).aside).toBe(false);+ expect(await f.api.handle(caller(), { op: "aside.clear", sessionId: SID })).toMatchObject({ status: 200, body: { session: { aside: false } } });+ expect(f.api.row(SID)!.asideRef).toBeNull();+ });++ it("only the owner; a ref is required; an unseen session is 404", async () => {+ const f = fixture();+ await created(f);+ expect(await f.api.handle(caller(MO), { op: "aside.set", sessionId: SID, body: { ref: "ak_1" } })).toMatchObject({ status: 403, error: { code: "forbidden", reason: "aside_owner_only" } });+ expect(await f.api.handle(caller(MO), { op: "aside.clear", sessionId: SID })).toMatchObject({ status: 403 });+ for (const body of [{}, { ref: "" }, { ref: 1 }, null, [], { ref: "a b" }]) {+ expect(await f.api.handle(caller(), { op: "aside.set", sessionId: SID, body })).toMatchObject({ status: 400, error: { code: "invalid_request", field: "ref" } });+ }+ expect(await f.api.handle(caller(), { op: "aside.set", sessionId: "cs_0000000000000000", body: { ref: "ak_1" } })).toMatchObject({ status: 404, error: { code: "session_not_found" } });+ expect(f.api.row(SID)!.asideRef).toBeNull();+ });++ it("HTTP: PUT and DELETE reach the Computer DO with sessions:write, never the writer", async () => {+ const seen: unknown[] = [];+ const stub: ComputerApiStub = { computerApi: vi.fn(async (_a, _c, op) => (seen.push(op), { status: 200, body: {} })) };+ const person = { kind: "user", organizationId: "org_1", userId: "user_1", role: "member" } as RequestIdentity;+ const reader = { ...person, apiKey: { id: "key_1", hash: "a".repeat(64), name: "r", kind: "user" as const, expiresAt: null, createdAt: null, scopes: ["sessions:read"] } } as RequestIdentity;+ const go = (identity: RequestIdentity, method: string, body?: string) =>+ routeComputerApi(new Request(`https://blue.test/v1/computer/sessions/${SID}/aside`, { method, ...(body ? { body } : {}) }), {} as never, identity, "org_1", stub, `/sessions/${SID}/aside`);+ expect((await go(person, "PUT", '{"ref":"ak_1"}')).status).toBe(200);+ expect((await go(person, "DELETE")).status).toBe(200);+ expect((await go(person, "PUT", "not json")).status).toBe(400);+ expect((await go(reader, "PUT", '{"ref":"ak_1"}')).status).toBe(403);+ expect(seen.filter((op) => (op as { op: string }).op !== "access")).toEqual([+ { op: "aside.set", sessionId: SID, body: { ref: "ak_1" } },+ { op: "aside.clear", sessionId: SID },+ ]);+ expect(matchApiRoute("POST", `/sessions/${SID}/aside`)).toBeNull();+ });+});+describe("visibility and lists", () => {it("API sessions are visible to every member; a Slack session only to its linked owner", async () => {const f = fixture();