@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":"public-routes.d.ts","sourceRoot":"","sources":["../../src/auth/public-routes.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,WAAW,CAAA;AAErE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;IAC9B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAA;CAChC;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAwB3D;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAgHvE"}
1
+ {"version":3,"file":"public-routes.d.ts","sourceRoot":"","sources":["../../src/auth/public-routes.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,WAAW,CAAA;AAErE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;IAC9B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAA;CAChC;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAwB3D;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CA2GvE"}
@@ -0,0 +1,28 @@
1
+ import type { SixbHostView } from "@sixb/core";
2
+ import type { AgentRunRecord } from "@sixb/core/storage";
3
+ import type { AgentRunRequestExecution, RequestAuthState } from "./scope";
4
+ /** What a run-token request is allowed as, or the answer that refuses or holds it. */
5
+ export type RunTokenDecision = {
6
+ readonly kind: "deny";
7
+ readonly response: Response;
8
+ } | {
9
+ readonly kind: "allow";
10
+ readonly state: RunTokenAuthState;
11
+ };
12
+ export interface RunTokenAuthState {
13
+ readonly runExecution: AgentRunRequestExecution;
14
+ readonly agentRun?: AgentRunRecord;
15
+ readonly agentExecution: NonNullable<RequestAuthState["agentExecution"]>;
16
+ }
17
+ /** The run token a request carries, if any: any other credential is not this boundary's. */
18
+ export declare function requestRunToken(request: Request): string | undefined;
19
+ /**
20
+ * Admit a run-token request, before its route parses it: its route, its run, the rules of the
21
+ * run's kind, and the approval its call needs.
22
+ */
23
+ export declare function resolveRunTokenRequest(input: {
24
+ readonly host: SixbHostView;
25
+ readonly request: Request;
26
+ readonly token: string;
27
+ }): Promise<RunTokenDecision>;
28
+ //# sourceMappingURL=run-token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-token.d.ts","sourceRoot":"","sources":["../../src/auth/run-token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAY9C,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,oBAAoB,CAAA;AAG3B,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAQzE,sFAAsF;AACtF,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GACtD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,CAAA;AAEjE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,YAAY,EAAE,wBAAwB,CAAA;IAC/C,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAA;IAClC,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,CAAA;CACzE;AAED,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIpE;AAKD;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,KAAK,EAAE;IAClD,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAmC5B"}
@@ -2,7 +2,7 @@ import { type Principal } from "@sixb/core";
2
2
  import { type AgentExecutionAuthorization } 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 { AgentRunRecord, ConversationAgentRunRecord, ExecutionRecord } from "@sixb/core/storage";
5
+ import type { ConversationAgentRunRecord, ExecutionRecord } from "@sixb/core/storage";
6
6
  /**
7
7
  * Per-request authorization state attached by the server's auth derive.
8
8
  *
@@ -11,36 +11,34 @@ import type { AgentRunRecord, ConversationAgentRunRecord, ExecutionRecord } from
11
11
  */
12
12
  export interface RequestAuthState {
13
13
  readonly sixb: Sixb | null;
14
- /** Present for requests proxied through the run-scoped agent API gateway. */
14
+ /** Present for a conversation run's run-token requests. */
15
15
  readonly agentRun?: ConversationAgentRunRecord;
16
- /** Identifies which kind of active agent execution owns a gateway request. */
16
+ /**
17
+ * Identifies which kind of active agent execution owns a run-token request. A run's carries the
18
+ * execution token the request was admitted under, which fences what it writes.
19
+ */
17
20
  readonly agentExecution?: {
18
21
  readonly kind: "conversation";
19
22
  readonly runId: string;
23
+ readonly executionToken: string;
20
24
  } | {
21
25
  readonly kind: "subagent";
22
26
  readonly runId: string;
23
27
  readonly parentRunId: string;
28
+ readonly executionToken: string;
24
29
  } | {
25
30
  readonly kind: "workflow";
26
31
  readonly nodeRunId: string;
27
32
  };
28
33
  }
29
- /** The agent run execution a gateway request runs inside, read from server-side records only. */
30
- export interface AgentGatewayRunExecution {
34
+ /** The agent run execution a run-token request runs inside, read from server-side records only. */
35
+ export interface AgentRunRequestExecution {
31
36
  readonly execution: ExecutionRecord;
32
37
  readonly actorId?: string;
33
38
  readonly runId: string;
34
39
  readonly attempt: number;
35
40
  readonly authorization: AgentExecutionAuthorization;
36
41
  }
37
- export interface InternalRequestAuthState {
38
- readonly runExecution: AgentGatewayRunExecution;
39
- readonly agentRun?: AgentRunRecord;
40
- readonly agentExecution?: RequestAuthState["agentExecution"];
41
- }
42
- export declare function registerInternalRequestAuthState(request: Request, authState: InternalRequestAuthState): void;
43
- export declare function consumeInternalRequestAuthState(request: Request): InternalRequestAuthState | undefined;
44
42
  /**
45
43
  * Read the derived auth state from a route handler's context.
46
44
  *
@@ -58,7 +56,7 @@ export declare function requireRequestSixb(context: unknown): Sixb;
58
56
  export declare function requestActor(sixb: Pick<Sixb, "execution">): Principal;
59
57
  /**
60
58
  * The caller the auth guard resolved for this request. Null on public routes, for shared-access and
61
- * agent-gateway requests, and when auth is disabled.
59
+ * run-token requests, and when auth is disabled.
62
60
  */
63
61
  export declare function requestCaller(context: unknown): AuthenticatedRequestAuthSession | null;
64
62
  //# sourceMappingURL=scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/auth/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,YAAY,CAAA;AAC7D,OAAO,EAAE,KAAK,2BAA2B,EAAyB,MAAM,4BAA4B,CAAA;AACpG,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC/E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAA;AACjE,OAAO,KAAK,EACV,cAAc,EACd,0BAA0B,EAC1B,eAAe,EAChB,MAAM,oBAAoB,CAAA;AAG3B;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,CAAC,EAAE,0BAA0B,CAAA;IAC9C,8EAA8E;IAC9E,QAAQ,CAAC,cAAc,CAAC,EACpB;QAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GACzD;QAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GACnF;QAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,CAAC,SAAS,E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