@sixb/server 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/auth/public-routes.d.ts.map +1 -1
  2. package/dist/auth/run-token.d.ts +28 -0
  3. package/dist/auth/run-token.d.ts.map +1 -0
  4. package/dist/auth/scope.d.ts +11 -13
  5. package/dist/auth/scope.d.ts.map +1 -1
  6. package/dist/index.js +3240 -3042
  7. package/dist/index.js.map +29 -27
  8. package/dist/registerRoutes.d.ts.map +1 -1
  9. package/dist/routes/agent-approval-gate.d.ts +7 -4
  10. package/dist/routes/agent-approval-gate.d.ts.map +1 -1
  11. package/dist/routes/agent-approvals.d.ts +4 -1
  12. package/dist/routes/agent-approvals.d.ts.map +1 -1
  13. package/dist/routes/agent-computers.d.ts +134 -0
  14. package/dist/routes/agent-computers.d.ts.map +1 -0
  15. package/dist/routes/agent-runners.d.ts +74 -0
  16. package/dist/routes/agent-runners.d.ts.map +1 -0
  17. package/dist/routes/agents.d.ts +28 -0
  18. package/dist/routes/agents.d.ts.map +1 -1
  19. package/dist/routes/artifacts.d.ts +5 -28
  20. package/dist/routes/artifacts.d.ts.map +1 -1
  21. package/dist/routes/auth.d.ts +1 -1
  22. package/dist/routes/datasets.d.ts.map +1 -1
  23. package/dist/routes/observed-agent-threads.d.ts +3 -0
  24. package/dist/routes/observed-agent-threads.d.ts.map +1 -1
  25. package/dist/routes/pipelines.d.ts.map +1 -1
  26. package/dist/routes/projections.d.ts +2 -0
  27. package/dist/routes/projections.d.ts.map +1 -1
  28. package/dist/routes/shared-access.d.ts +2 -2
  29. package/dist/routes/syncs.d.ts +34 -34
  30. package/dist/routes/syncs.d.ts.map +1 -1
  31. package/dist/routes/users.d.ts +1 -0
  32. package/dist/routes/users.d.ts.map +1 -1
  33. package/dist/routes/workflows.d.ts +4 -4
  34. package/dist/schemas/agents.d.ts +79 -1
  35. package/dist/schemas/agents.d.ts.map +1 -1
  36. package/dist/schemas/auth.d.ts +2 -2
  37. package/dist/schemas/projections.d.ts +14 -0
  38. package/dist/schemas/projections.d.ts.map +1 -1
  39. package/dist/schemas/shared-access.d.ts +2 -2
  40. package/dist/schemas/syncs.d.ts +24 -24
  41. package/dist/schemas/users.d.ts +8 -0
  42. package/dist/schemas/users.d.ts.map +1 -1
  43. package/dist/server.d.ts +1 -0
  44. package/dist/server.d.ts.map +1 -1
  45. package/package.json +5 -5
  46. package/src/auth/public-routes.ts +0 -6
  47. package/src/auth/run-token.ts +327 -0
  48. package/src/auth/scope.ts +16 -37
  49. package/src/registerRoutes.ts +4 -2
  50. package/src/routes/agent-approval-gate.ts +40 -14
  51. package/src/routes/agent-approvals.ts +1 -1
  52. package/src/routes/agent-computers.ts +126 -0
  53. package/src/routes/agent-runners.ts +181 -0
  54. package/src/routes/agents.ts +7 -2
  55. package/src/routes/artifacts.ts +55 -11
  56. package/src/routes/datasets.ts +5 -0
  57. package/src/routes/pipelines.ts +5 -0
  58. package/src/routes/syncs.ts +4 -0
  59. package/src/routes/users.ts +15 -2
  60. package/src/schemas/agents.ts +16 -1
  61. package/src/schemas/artifacts.ts +1 -1
  62. package/src/schemas/projections.ts +2 -0
  63. package/src/schemas/users.ts +6 -0
  64. package/src/server.ts +35 -13
  65. package/dist/routes/agent-api-gateway.d.ts +0 -4
  66. package/dist/routes/agent-api-gateway.d.ts.map +0 -1
  67. package/src/routes/agent-api-gateway.ts +0 -404
@@ -1 +1 @@
1
- {"version":3,"file":"projections.d.ts","sourceRoot":"","sources":["../../src/schemas/projections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,oBAAoB,4CAA0C,CAAA;AAC3E,eAAO,MAAM,yBAAyB,oFAOpC,CAAA;AA0DF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI1C,CAAA"}
@@ -21,14 +21,14 @@ export declare const SharedAccessSessionResponseSchema: z.ZodObject<{
21
21
  csrfToken: z.ZodString;
22
22
  }, "strip", z.ZodTypeAny, {
23
23
  grantId: string;
24
- csrfToken: string;
25
24
  expiresAt: string;
25
+ csrfToken: string;
26
26
  destinationPath: string;
27
27
  absoluteExpiresAt: string;
28
28
  }, {
29
29
  grantId: string;
30
- csrfToken: string;
31
30
  expiresAt: string;
31
+ csrfToken: string;
32
32
  destinationPath: string;
33
33
  absoluteExpiresAt: string;
34
34
  }>;
@@ -293,23 +293,6 @@ export declare const SyncSchema: z.ZodObject<{
293
293
  type: string;
294
294
  };
295
295
  mode: "append" | "merge" | "snapshot";
296
- target: {
297
- kind: "dataset";
298
- dataset: {
299
- id: string;
300
- schema: {
301
- columns: {
302
- type: "string" | "boolean" | "date" | "int64" | "fileRef" | "json" | "decimal" | "timestamp" | "float64";
303
- name: string;
304
- nullable?: boolean | undefined;
305
- }[];
306
- };
307
- description?: string | undefined;
308
- primaryKey?: string | string[] | undefined;
309
- sequenceBy?: string | undefined;
310
- partitionBy?: string[] | undefined;
311
- };
312
- };
313
296
  triggers: {
314
297
  type: "schedule";
315
298
  scheduleId: string;
@@ -333,13 +316,6 @@ export declare const SyncSchema: z.ZodObject<{
333
316
  commitMessage?: string | undefined;
334
317
  rowsRead?: number | undefined;
335
318
  } | null;
336
- }, {
337
- id: string;
338
- connector: {
339
- id: string;
340
- type: string;
341
- };
342
- mode: "append" | "merge" | "snapshot";
343
319
  target: {
344
320
  kind: "dataset";
345
321
  dataset: {
@@ -357,6 +333,13 @@ export declare const SyncSchema: z.ZodObject<{
357
333
  partitionBy?: string[] | undefined;
358
334
  };
359
335
  };
336
+ }, {
337
+ id: string;
338
+ connector: {
339
+ id: string;
340
+ type: string;
341
+ };
342
+ mode: "append" | "merge" | "snapshot";
360
343
  triggers: {
361
344
  type: "schedule";
362
345
  scheduleId: string;
@@ -380,6 +363,23 @@ export declare const SyncSchema: z.ZodObject<{
380
363
  commitMessage?: string | undefined;
381
364
  rowsRead?: number | undefined;
382
365
  } | null;
366
+ target: {
367
+ kind: "dataset";
368
+ dataset: {
369
+ id: string;
370
+ schema: {
371
+ columns: {
372
+ type: "string" | "boolean" | "date" | "int64" | "fileRef" | "json" | "decimal" | "timestamp" | "float64";
373
+ name: string;
374
+ nullable?: boolean | undefined;
375
+ }[];
376
+ };
377
+ description?: string | undefined;
378
+ primaryKey?: string | string[] | undefined;
379
+ sequenceBy?: string | undefined;
380
+ partitionBy?: string[] | undefined;
381
+ };
382
+ };
383
383
  }>;
384
384
  export declare const SyncRunListResponseSchema: z.ZodObject<{
385
385
  runs: z.ZodArray<z.ZodObject<{
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  export declare const MAX_USERS_PAGE_LIMIT = 200;
3
3
  export declare const MAX_USERS_SEARCH_LENGTH = 200;
4
+ export declare const MAX_USER_EMAIL_LENGTH = 320;
4
5
  export declare const ListUsersQuerySchema: z.ZodObject<{
5
6
  /** Which members to list. Defaults to `active`. */
6
7
  status: z.ZodOptional<z.ZodEnum<["active", "suspended", "all"]>>;
@@ -8,13 +9,20 @@ export declare const ListUsersQuerySchema: z.ZodObject<{
8
9
  search: z.ZodOptional<z.ZodString>;
9
10
  limit: z.ZodOptional<z.ZodNumber>;
10
11
  offset: z.ZodOptional<z.ZodNumber>;
12
+ /**
13
+ * The member with exactly this email, ignoring case, suspended or not: a page of at most one.
14
+ * Takes no other option.
15
+ */
16
+ email: z.ZodOptional<z.ZodString>;
11
17
  }, "strip", z.ZodTypeAny, {
12
18
  status?: "active" | "all" | "suspended" | undefined;
19
+ email?: string | undefined;
13
20
  search?: string | undefined;
14
21
  limit?: number | undefined;
15
22
  offset?: number | undefined;
16
23
  }, {
17
24
  status?: "active" | "all" | "suspended" | undefined;
25
+ email?: string | undefined;
18
26
  search?: string | undefined;
19
27
  limit?: number | undefined;
20
28
  offset?: number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/schemas/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,oBAAoB,MAAM,CAAA;AACvC,eAAO,MAAM,uBAAuB,MAAM,CAAA;AAE1C,eAAO,MAAM,oBAAoB;IAC/B,mDAAmD;;IAEnD,8DAA8D;;;;;;;;;;;;;;EAI9D,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIlC,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAA"}
1
+ {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/schemas/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,oBAAoB,MAAM,CAAA;AACvC,eAAO,MAAM,uBAAuB,MAAM,CAAA;AAC1C,eAAO,MAAM,qBAAqB,MAAM,CAAA;AAExC,eAAO,MAAM,oBAAoB;IAC/B,mDAAmD;;IAEnD,8DAA8D;;;;IAI9D;;;OAGG;;;;;;;;;;;;;;EAEH,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIlC,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAA"}
package/dist/server.d.ts CHANGED
@@ -35,6 +35,7 @@ export declare class SixbServer {
35
35
  private app;
36
36
  private bunServer;
37
37
  private maintenance;
38
+ private stopSweeper;
38
39
  constructor(options: SixbServerOptions);
39
40
  getHost(): SixbHostView;
40
41
  /** The port the server listens on once started, so `port: 0` reports the one it bound. */
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA6B,YAAY,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;IAClC,OAAO,CAAC,SAAS,CAA4C;IAC7D,OAAO,CAAC,WAAW,CAAyC;IAC5D,OAAO,CAAC,WAAW,CAA4B;gBAEnC,OAAO,EAAE,iBAAiB;IAqBtC,OAAO,IAAI,YAAY;IAIvB,0FAA0F;IAC1F,OAAO,IAAI,MAAM;IAIjB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,kBAAkB;IAIxD,0BAA0B,CACxB,OAAO,EAAE,UAAU,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAClD,KAAK,EAAE,UAAU,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,GAC/C,UAAU,CAAC,0BAA0B,CAAC;IAIzC,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAIlD,gCAAgC,CAC9B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,2BAA2B,GACjC,6BAA6B;IAIhC,mBAAmB,IAAI,4BAA4B;IAInD,iBAAiB,IAAI,yBAAyB,GAAG,SAAS;IAI1D,sBAAsB,IAAI,uBAAuB;IAI3C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA4CtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAiB5B;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0P/C;AAqED,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sixb/server",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "HTTP and WebSocket API server for Sixb",
5
5
  "keywords": [
6
6
  "sixb",
@@ -38,14 +38,14 @@
38
38
  "zod-to-json-schema": "^3.24.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@sixb/core": "0.1.25"
41
+ "@sixb/core": "0.1.26"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@sixb/auth-magic-link": "0.1.7",
45
45
  "@sixb/auth-oidc": "0.1.7",
46
- "@sixb/cli-core": "0.1.9",
47
- "@sixb/core": "0.1.25",
48
- "@sixb/sqlite": "0.1.25",
46
+ "@sixb/cli-core": "0.1.10",
47
+ "@sixb/core": "0.1.26",
48
+ "@sixb/sqlite": "0.1.26",
49
49
  "@types/bun": "latest",
50
50
  "typescript": "^5.7.0"
51
51
  },
@@ -1,4 +1,3 @@
1
- import { AGENT_API_GATEWAY_PREFIX } from "@sixb/core/internal/agents"
2
1
  import { ARTIFACT_FRAME_ROUTE_PREFIX } from "@sixb/core/internal/artifacts/frames"
3
2
  import { isCsrfExemptMethod } from "@sixb/core/internal/auth"
4
3
  import { FILE_DOWNLOAD_ROUTE_PREFIX } from "@sixb/core/internal/blob-storage"
@@ -58,11 +57,6 @@ export function isPublicRoute(pathname: string, method: string): boolean {
58
57
  return true
59
58
  }
60
59
 
61
- // The gateway authenticates each request with the run's own execution token.
62
- if (pathname.startsWith(`${AGENT_API_GATEWAY_PREFIX}/`)) {
63
- return true
64
- }
65
-
66
60
  // A signed download URL is read by services that cannot hold a session, such as a social network
67
61
  // fetching media to publish. The signed token in the path is the credential.
68
62
  if (
@@ -0,0 +1,327 @@
1
+ import type { SixbHostView } from "@sixb/core"
2
+ import {
3
+ type AgentRunExecutionScope,
4
+ AgentRunScopeError,
5
+ agentRunTokenRunId,
6
+ findAgentApiRoute,
7
+ isAgentRunToken,
8
+ isAllowedAgentApiRequest,
9
+ isValidAgentRunToken,
10
+ resolveAgentRunExecutionScope,
11
+ } from "@sixb/core/internal/agents"
12
+ import { normalizeRoutePath, pathSegmentsFor } from "@sixb/core/internal/http"
13
+ import type {
14
+ AgentRunRecord,
15
+ ConversationAgentRunRecord,
16
+ SubagentRunRecord,
17
+ WorkflowAgentNodeRunRecord,
18
+ } from "@sixb/core/storage"
19
+ import { gateAgentApiCall } from "../routes/agent-approval-gate"
20
+ import { readRequestBodyWithLimit } from "../utils/request-body"
21
+ import type { AgentRunRequestExecution, RequestAuthState } from "./scope"
22
+
23
+ // An Agent's commands call the API with their run's token, as `Authorization: Bearer`. The token
24
+ // opens only the routes `SIXB_API_ROUTES` marks `agentApi`, and each request runs inside the run's
25
+ // own execution, restored from server-side records: what it starts is a child of the run and keeps
26
+ // the run's requester, whatever the request's headers say. What a run may do there depends on its
27
+ // kind, and on its conversation's approval mode, as decided below.
28
+
29
+ /** What a run-token request is allowed as, or the answer that refuses or holds it. */
30
+ export type RunTokenDecision =
31
+ | { readonly kind: "deny"; readonly response: Response }
32
+ | { readonly kind: "allow"; readonly state: RunTokenAuthState }
33
+
34
+ export interface RunTokenAuthState {
35
+ readonly runExecution: AgentRunRequestExecution
36
+ readonly agentRun?: AgentRunRecord
37
+ readonly agentExecution: NonNullable<RequestAuthState["agentExecution"]>
38
+ }
39
+
40
+ /** The run token a request carries, if any: any other credential is not this boundary's. */
41
+ export function requestRunToken(request: Request): string | undefined {
42
+ const authorization = request.headers.get("authorization")
43
+ const token = authorization?.match(/^Bearer\s+(\S+)$/i)?.[1]
44
+ return token !== undefined && isAgentRunToken(token) ? token : undefined
45
+ }
46
+
47
+ /** The most of a call's body the approval gate reads, from a copy its route still reads whole. */
48
+ const MAX_GATED_BODY_BYTES = 1_000_000
49
+
50
+ /**
51
+ * Admit a run-token request, before its route parses it: its route, its run, the rules of the
52
+ * run's kind, and the approval its call needs.
53
+ */
54
+ export async function resolveRunTokenRequest(input: {
55
+ readonly host: SixbHostView
56
+ readonly request: Request
57
+ readonly token: string
58
+ }): Promise<RunTokenDecision> {
59
+ const { host, request } = input
60
+ const method = request.method.toUpperCase()
61
+ const path = normalizeRoutePath(new URL(request.url).pathname)
62
+ if (!isAllowedAgentApiRequest(method, path)) {
63
+ return deny(403, `A run token cannot call ${method} ${path}.`)
64
+ }
65
+
66
+ const resolved = await resolveRunState(host, input.token)
67
+ if (resolved.kind === "deny") return resolved
68
+ const { state, run } = resolved
69
+
70
+ const refused = await runPolicyRefusal(host, { method, path, state, run })
71
+ if (refused) return refused
72
+
73
+ // The run's approval mode decides, never the model: a held call does not reach its route.
74
+ const gate = await gateAgentApiCall({
75
+ host,
76
+ method,
77
+ upstreamPath: path,
78
+ readBody: () =>
79
+ readRequestBodyWithLimit(
80
+ request.clone(),
81
+ MAX_GATED_BODY_BYTES,
82
+ "The request body exceeds 1MB, the most a call that may need approval can send."
83
+ ),
84
+ contentType: request.headers.get("content-type"),
85
+ run,
86
+ agentExecution: state.agentExecution,
87
+ runExecution: state.runExecution,
88
+ signal: request.signal,
89
+ })
90
+ if (gate.kind === "answer") return { kind: "deny", response: gate.response }
91
+
92
+ return { kind: "allow", state }
93
+ }
94
+
95
+ /**
96
+ * What a run of each kind may not do, whatever its requester's grants allow:
97
+ * - a workflow step or a child starts no workflow;
98
+ * - a workflow step has no memory: a conversation's notes must not change a fixed assignment;
99
+ * - a workflow step publishes no artifact: it has no conversation to publish into;
100
+ * - a child reads its conversation's memory but saves none, and changes nothing once its parent's
101
+ * turn has ended;
102
+ * - a shared conversation reaches only the project's memory, whoever sends the turn.
103
+ */
104
+ async function runPolicyRefusal(
105
+ host: SixbHostView,
106
+ input: {
107
+ readonly method: string
108
+ readonly path: string
109
+ readonly state: RunTokenAuthState
110
+ readonly run: AgentRunRecord | WorkflowAgentNodeRunRecord
111
+ }
112
+ ): Promise<RunTokenDecision | undefined> {
113
+ const { method, path, state, run } = input
114
+ const { kind } = state.agentExecution
115
+
116
+ if (kind !== "conversation" && method === "POST" && matchesWorkflowRunStart(path)) {
117
+ return deny(
118
+ 409,
119
+ kind === "workflow"
120
+ ? "Workflow agent nodes cannot start another workflow run."
121
+ : "Child agents cannot start a workflow run."
122
+ )
123
+ }
124
+ if (kind === "workflow" && matchesAgentMemory(path)) {
125
+ return deny(403, "Workflow agent nodes have no Agent memory.")
126
+ }
127
+ if (kind === "workflow" && findAgentApiRoute(method, path)?.effect === "artifact") {
128
+ return deny(403, "Workflow agent nodes publish no artifacts: they have no conversation.")
129
+ }
130
+ if ("kind" in run && run.kind === "subagent" && !(await parentRunActive(host, run))) {
131
+ return deny(409, "The child agent's parent run has ended or been stopped.")
132
+ }
133
+ if (kind === "subagent" && method !== "GET" && matchesAgentMemory(path)) {
134
+ return deny(403, "Child agents cannot save Agent memory.")
135
+ }
136
+ // Anything but the project's exact path is refused, as a route parameter is percent-decoded.
137
+ if (
138
+ state.agentRun?.kind === "conversation" &&
139
+ matchesAgentMemory(path) &&
140
+ pathSegmentsFor(path)[2] !== "project" &&
141
+ (await hasParticipants(host, state.agentRun))
142
+ ) {
143
+ return deny(
144
+ 403,
145
+ "A shared conversation reaches only the project's memory. Save nothing about one person here."
146
+ )
147
+ }
148
+ return undefined
149
+ }
150
+
151
+ async function resolveRunState(
152
+ host: SixbHostView,
153
+ token: string
154
+ ): Promise<
155
+ | { readonly kind: "deny"; readonly response: Response }
156
+ | {
157
+ readonly kind: "allow"
158
+ readonly state: RunTokenAuthState
159
+ readonly run: AgentRunRecord | WorkflowAgentNodeRunRecord
160
+ }
161
+ > {
162
+ const agentStorage = host.storage.agents
163
+ const workflowRuns = host.storage.workflowRuns
164
+ if (!agentStorage && !workflowRuns) {
165
+ // 501, not 403: nothing about the caller is being refused — neither storage role that could
166
+ // hold an agent run is configured, so no request can ever succeed here.
167
+ return deny(501, "Run tokens are not available: this runtime stores no agent runs.")
168
+ }
169
+
170
+ const runId = agentRunTokenRunId(token)
171
+ const storedAgentRun = runId
172
+ ? await agentStorage?.runs.getById({ projectId: host.id, id: runId })
173
+ : undefined
174
+ const workflowRun =
175
+ runId && !storedAgentRun
176
+ ? await workflowRuns?.agentNodes.getByNodeRunId({ projectId: host.id, nodeRunId: runId })
177
+ : undefined
178
+ const runState = toRunState(storedAgentRun ?? null, workflowRun ?? null)
179
+ if (
180
+ !runId ||
181
+ !runState ||
182
+ runState.run.status !== "running" ||
183
+ ("cancelRequestedAt" in runState.run && runState.run.cancelRequestedAt) ||
184
+ !runState.run.execution ||
185
+ runState.run.execution.queueLeaseExpiresAt.getTime() <= Date.now() ||
186
+ !isValidAgentRunToken({
187
+ projectId: host.id,
188
+ runId,
189
+ executionToken: runState.run.execution.token,
190
+ token,
191
+ })
192
+ ) {
193
+ return deny(403, "The run token is not valid: its run has ended, moved or been stopped.")
194
+ }
195
+
196
+ let scope: AgentRunExecutionScope
197
+ try {
198
+ scope = await resolveAgentRunExecutionScope(host, {
199
+ runId: runState.runId,
200
+ executionId: runState.run.executionId,
201
+ authority:
202
+ runState.authority === "managed"
203
+ ? { type: "managed", actorId: runState.actorId }
204
+ : { type: "inherited" },
205
+ })
206
+ } catch (error) {
207
+ if (!(error instanceof AgentRunScopeError)) throw error
208
+ return scopeErrorResponse(error)
209
+ }
210
+
211
+ // Authority is the record's current grants, resolved on every request when it is admitted; a
212
+ // request admitted before the run ends finishes under it, like an in-process tool call.
213
+ return {
214
+ kind: "allow",
215
+ state: {
216
+ runExecution: { ...scope, attempt: runState.run.attempt },
217
+ agentExecution: runState.agentExecution,
218
+ ...(runState.agentRun === undefined ? {} : { agentRun: runState.agentRun }),
219
+ },
220
+ run: runState.run,
221
+ }
222
+ }
223
+
224
+ type RunState = {
225
+ readonly run: AgentRunRecord | WorkflowAgentNodeRunRecord
226
+ readonly runId: string
227
+ readonly agentExecution: NonNullable<RequestAuthState["agentExecution"]>
228
+ readonly agentRun?: ConversationAgentRunRecord
229
+ } & (
230
+ | { readonly authority: "inherited" }
231
+ | { readonly authority: "managed"; readonly actorId: string }
232
+ )
233
+
234
+ function toRunState(
235
+ storedRun: AgentRunRecord | null,
236
+ workflowRun: WorkflowAgentNodeRunRecord | null
237
+ ): RunState | null {
238
+ // Admission checks the request's token against this one: it is the execution the request acts in.
239
+ const executionToken = storedRun?.execution?.token ?? ""
240
+ if (storedRun?.kind === "subagent") {
241
+ return {
242
+ run: storedRun,
243
+ runId: storedRun.id,
244
+ agentExecution: {
245
+ kind: "subagent",
246
+ runId: storedRun.id,
247
+ parentRunId: storedRun.parentRunId,
248
+ executionToken,
249
+ },
250
+ authority: "inherited",
251
+ }
252
+ }
253
+
254
+ if (storedRun?.kind === "conversation") {
255
+ return {
256
+ run: storedRun,
257
+ runId: storedRun.id,
258
+ agentExecution: { kind: "conversation", runId: storedRun.id, executionToken },
259
+ agentRun: storedRun,
260
+ authority: "inherited",
261
+ }
262
+ }
263
+
264
+ if (!workflowRun) return null
265
+ return {
266
+ run: workflowRun,
267
+ runId: workflowRun.nodeRunId,
268
+ agentExecution: { kind: "workflow", nodeRunId: workflowRun.nodeRunId },
269
+ authority: "managed",
270
+ actorId: workflowRun.actorId,
271
+ }
272
+ }
273
+
274
+ function scopeErrorResponse(
275
+ error: AgentRunScopeError
276
+ ): RunTokenDecision & { readonly kind: "deny" } {
277
+ switch (error.code) {
278
+ case "execution_unavailable":
279
+ return deny(403, "Agent run execution is not available.")
280
+ case "auth_unavailable":
281
+ return deny(
282
+ 501,
283
+ "Run tokens are not available: authenticated agent access is not configured."
284
+ )
285
+ case "authority_invalid":
286
+ return deny(403, "Agent run execution authority is not valid.")
287
+ }
288
+ }
289
+
290
+ async function parentRunActive(host: SixbHostView, run: SubagentRunRecord): Promise<boolean> {
291
+ const parent = await host.storage.agents?.runs.getById({
292
+ projectId: host.id,
293
+ id: run.parentRunId,
294
+ })
295
+ return (parent?.status === "queued" || parent?.status === "running") && !parent.cancelRequestedAt
296
+ }
297
+
298
+ function matchesAgentMemory(pathname: string): boolean {
299
+ const segments = pathSegmentsFor(pathname)
300
+ return segments[0] === "api" && segments[1] === "agent-memory"
301
+ }
302
+
303
+ /** Anyone added to the run's thread, even one who cannot read it now, as the worker counts them. */
304
+ async function hasParticipants(
305
+ host: SixbHostView,
306
+ run: ConversationAgentRunRecord
307
+ ): Promise<boolean> {
308
+ const participants = await host.storage.agents?.threads.listParticipants({
309
+ projectId: run.projectId,
310
+ threadIds: [run.threadId],
311
+ })
312
+ return (participants?.length ?? 0) > 0
313
+ }
314
+
315
+ function matchesWorkflowRunStart(pathname: string): boolean {
316
+ const segments = pathSegmentsFor(pathname)
317
+ return (
318
+ segments.length === 4 &&
319
+ segments[0] === "api" &&
320
+ segments[1] === "workflows" &&
321
+ segments[3] === "runs"
322
+ )
323
+ }
324
+
325
+ function deny(status: number, message: string): RunTokenDecision & { readonly kind: "deny" } {
326
+ return { kind: "deny", response: Response.json({ error: message }, { status }) }
327
+ }
package/src/auth/scope.ts CHANGED
@@ -2,11 +2,7 @@ import { type Principal, SYSTEM_PRINCIPAL } from "@sixb/core"
2
2
  import { type AgentExecutionAuthorization, agentServiceAccountId } from "@sixb/core/internal/agents"
3
3
  import type { AuthenticatedRequestAuthSession } from "@sixb/core/internal/auth"
4
4
  import type { Sixb } from "@sixb/core/internal/request-execution"
5
- import type {
6
- AgentRunRecord,
7
- ConversationAgentRunRecord,
8
- ExecutionRecord,
9
- } from "@sixb/core/storage"
5
+ import type { ConversationAgentRunRecord, ExecutionRecord } from "@sixb/core/storage"
10
6
  import type { ServerAuthGuardDecision } from "./guard"
11
7
 
12
8
  /**
@@ -17,17 +13,25 @@ import type { ServerAuthGuardDecision } from "./guard"
17
13
  */
18
14
  export interface RequestAuthState {
19
15
  readonly sixb: Sixb | null
20
- /** Present for requests proxied through the run-scoped agent API gateway. */
16
+ /** Present for a conversation run's run-token requests. */
21
17
  readonly agentRun?: ConversationAgentRunRecord
22
- /** Identifies which kind of active agent execution owns a gateway request. */
18
+ /**
19
+ * Identifies which kind of active agent execution owns a run-token request. A run's carries the
20
+ * execution token the request was admitted under, which fences what it writes.
21
+ */
23
22
  readonly agentExecution?:
24
- | { readonly kind: "conversation"; readonly runId: string }
25
- | { readonly kind: "subagent"; readonly runId: string; readonly parentRunId: string }
23
+ | { readonly kind: "conversation"; readonly runId: string; readonly executionToken: string }
24
+ | {
25
+ readonly kind: "subagent"
26
+ readonly runId: string
27
+ readonly parentRunId: string
28
+ readonly executionToken: string
29
+ }
26
30
  | { readonly kind: "workflow"; readonly nodeRunId: string }
27
31
  }
28
32
 
29
- /** The agent run execution a gateway request runs inside, read from server-side records only. */
30
- export interface AgentGatewayRunExecution {
33
+ /** The agent run execution a run-token request runs inside, read from server-side records only. */
34
+ export interface AgentRunRequestExecution {
31
35
  readonly execution: ExecutionRecord
32
36
  readonly actorId?: string
33
37
  readonly runId: string
@@ -35,31 +39,6 @@ export interface AgentGatewayRunExecution {
35
39
  readonly authorization: AgentExecutionAuthorization
36
40
  }
37
41
 
38
- export interface InternalRequestAuthState {
39
- readonly runExecution: AgentGatewayRunExecution
40
- readonly agentRun?: AgentRunRecord
41
- readonly agentExecution?: RequestAuthState["agentExecution"]
42
- }
43
-
44
- const internalRequestAuthState = new WeakMap<Request, InternalRequestAuthState>()
45
-
46
- export function registerInternalRequestAuthState(
47
- request: Request,
48
- authState: InternalRequestAuthState
49
- ): void {
50
- internalRequestAuthState.set(request, authState)
51
- }
52
-
53
- export function consumeInternalRequestAuthState(
54
- request: Request
55
- ): InternalRequestAuthState | undefined {
56
- const authState = internalRequestAuthState.get(request)
57
- if (authState) {
58
- internalRequestAuthState.delete(request)
59
- }
60
- return authState
61
- }
62
-
63
42
  /**
64
43
  * Read the derived auth state from a route handler's context.
65
44
  *
@@ -100,7 +79,7 @@ export function requestActor(sixb: Pick<Sixb, "execution">): Principal {
100
79
 
101
80
  /**
102
81
  * The caller the auth guard resolved for this request. Null on public routes, for shared-access and
103
- * agent-gateway requests, and when auth is disabled.
82
+ * run-token requests, and when auth is disabled.
104
83
  */
105
84
  export function requestCaller(context: unknown): AuthenticatedRequestAuthSession | null {
106
85
  const auth = (context as { readonly auth?: ServerAuthGuardDecision }).auth