stitchkit 0.103.0 → 0.103.2

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 (87) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/agent-runtime/browser-control-contract.d.ts +1118 -0
  3. package/dist/agent-runtime/browser-control-contract.d.ts.map +1 -0
  4. package/dist/agent-runtime/browser-controller.d.ts +31 -0
  5. package/dist/agent-runtime/browser-controller.d.ts.map +1 -0
  6. package/dist/agent-runtime/harness-control.d.ts.map +1 -1
  7. package/dist/agent-runtime/harness-realtime.d.ts +25 -0
  8. package/dist/agent-runtime/harness-realtime.d.ts.map +1 -0
  9. package/dist/agent-runtime/harness-tools.d.ts +11 -0
  10. package/dist/agent-runtime/harness-tools.d.ts.map +1 -0
  11. package/dist/agent-runtime/react.d.ts +4 -0
  12. package/dist/agent-runtime/react.d.ts.map +1 -0
  13. package/dist/agent-runtime/run-assertions.d.ts +63 -0
  14. package/dist/agent-runtime/run-assertions.d.ts.map +1 -0
  15. package/dist/entrypoints/agent-runtime/browser.d.ts +2 -0
  16. package/dist/entrypoints/agent-runtime/browser.d.ts.map +1 -1
  17. package/dist/entrypoints/agent-runtime/browser.js +235 -0
  18. package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
  19. package/dist/entrypoints/agent-runtime/harness-tools.d.ts +2 -0
  20. package/dist/entrypoints/agent-runtime/harness-tools.d.ts.map +1 -0
  21. package/dist/entrypoints/agent-runtime/harness-tools.js +32 -0
  22. package/dist/entrypoints/agent-runtime/harness.js +13 -228
  23. package/dist/entrypoints/agent-runtime/react.d.ts +2 -0
  24. package/dist/entrypoints/agent-runtime/react.d.ts.map +1 -0
  25. package/dist/entrypoints/agent-runtime/react.js +8 -0
  26. package/dist/entrypoints/agent-runtime/realtime.d.ts +2 -0
  27. package/dist/entrypoints/agent-runtime/realtime.d.ts.map +1 -0
  28. package/dist/entrypoints/agent-runtime/realtime.js +159 -0
  29. package/dist/entrypoints/agent-runtime/sandbox.js +3 -3
  30. package/dist/entrypoints/agent-runtime/testing.d.ts +1 -0
  31. package/dist/entrypoints/agent-runtime/testing.d.ts.map +1 -1
  32. package/dist/entrypoints/agent-runtime/testing.js +67 -2
  33. package/dist/entrypoints/agent-runtime.js +25 -20
  34. package/dist/entrypoints/cli.js +8 -8
  35. package/dist/entrypoints/index.js +15 -226
  36. package/dist/entrypoints/node.js +7 -5
  37. package/dist/entrypoints/observability.js +2 -2
  38. package/dist/entrypoints/react.js +2 -2
  39. package/dist/entrypoints/remote.js +3 -3
  40. package/dist/entrypoints/server.js +10 -8
  41. package/dist/entrypoints/testing.js +4 -4
  42. package/dist/entrypoints/tools/connections.js +2 -2
  43. package/dist/entrypoints/tools/invoker.js +6 -6
  44. package/dist/entrypoints/tools.js +25 -36
  45. package/dist/entrypoints/tracking.js +2 -2
  46. package/dist/{index-d82d3xg4.js → index-0c419yx7.js} +1 -1
  47. package/dist/{index-c6aagrbd.js → index-1br6gwhf.js} +4 -4
  48. package/dist/{index-xkhk5d6g.js → index-1khy8y7n.js} +5 -48
  49. package/dist/index-20yvtn9a.js +38 -0
  50. package/dist/{index-a9pd417t.js → index-5vyd0fkb.js} +1 -34
  51. package/dist/{index-r1z0rd9c.js → index-7n68nmc6.js} +1 -1
  52. package/dist/{index-zs4ms3th.js → index-90ppdx3q.js} +7 -30
  53. package/dist/{index-djjhhgjk.js → index-a4ajxwmb.js} +1 -1
  54. package/dist/index-c9d05kvt.js +11 -0
  55. package/dist/{index-ewbaywk5.js → index-dnn9z96q.js} +3 -3
  56. package/dist/index-jn9g8xdt.js +246 -0
  57. package/dist/index-kmpzj1cq.js +48 -0
  58. package/dist/{index-dvwj1f43.js → index-m2xqkv55.js} +2 -2
  59. package/dist/{index-m9fndta6.js → index-n2gre124.js} +3 -3
  60. package/dist/index-nggfa2yn.js +34 -0
  61. package/dist/{index-m79yr938.js → index-pw99k9h5.js} +1 -10
  62. package/dist/index-qapzv4p5.js +54 -0
  63. package/dist/index-r34mvse1.js +225 -0
  64. package/dist/{index-n9tyz8z3.js → index-r956rndn.js} +2 -2
  65. package/dist/index-srs8hj9c.js +10 -0
  66. package/dist/{index-jzczzcsb.js → index-tgzhq07n.js} +1 -1
  67. package/dist/index-vgkbcnkc.js +29 -0
  68. package/dist/{index-7z9ym7t8.js → index-x87j7csh.js} +35 -14
  69. package/dist/{index-3ct7hhq6.js → index-xwq9j1sf.js} +6 -56
  70. package/dist/{index-hby4qhax.js → index-yex7eg1v.js} +4 -10
  71. package/dist/{index-1h6gtdrj.js → index-ygkka6zn.js} +1 -1
  72. package/dist/index-ze1eph1k.js +20 -0
  73. package/dist/tools/schema/flatten-join.d.ts +1 -1
  74. package/dist/tools/schema/flatten-join.d.ts.map +1 -1
  75. package/dist/tools/schema/flatten.d.ts.map +1 -1
  76. package/llms/agent-runtime-browser.txt +26 -0
  77. package/llms/agent-runtime-harness-tools.txt +25 -0
  78. package/llms/agent-runtime-harness.txt +140 -1
  79. package/llms/agent-runtime-react.txt +21 -0
  80. package/llms/agent-runtime-realtime.txt +30 -0
  81. package/llms/agent-runtime-testing.txt +6 -0
  82. package/llms/stitchkit.txt +5 -1
  83. package/llms/tools.3.txt +1 -1
  84. package/llms/tools.txt +19 -1
  85. package/llms-full.txt +229 -3
  86. package/llms.txt +9 -5
  87. package/package.json +13 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-control-contract.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/browser-control-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,wFAAwF;AACxF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAWpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,4BAA4B;;QAEjB,IAAI;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGP,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { type RealtimeClientTransport } from '../browser/realtime-client.js';
2
+ import { type AgentBrowserRequest } from './browser-control-contract.js';
3
+ import { type AgentControlResponse, type AgentControlView } from './control-schema.js';
4
+ export interface AgentControllerConfig {
5
+ transport: RealtimeClientTransport;
6
+ conversationId: string;
7
+ access: 'observe' | 'control';
8
+ timeoutMs?: number;
9
+ maxBufferedEvents?: number;
10
+ maxBufferedBytes?: number;
11
+ maxPendingRequests?: number;
12
+ }
13
+ export interface AgentControllerState {
14
+ status: 'connecting' | 'ready' | 'disconnected' | 'error' | 'closed';
15
+ view: AgentControlView;
16
+ error?: {
17
+ code: string;
18
+ message: string;
19
+ };
20
+ }
21
+ export type AgentBrowserCommand<T extends AgentBrowserRequest = AgentBrowserRequest> = T extends unknown ? Omit<T, 'schemaVersion' | 'requestId' | 'conversationId'> : never;
22
+ export interface AgentController {
23
+ getSnapshot(): AgentControllerState;
24
+ subscribe(listener: () => void): () => void;
25
+ request(command: AgentBrowserCommand): Promise<AgentControlResponse>;
26
+ /** Release this attachment; the supplied transport and remote runtime remain application-owned. */
27
+ close(): Promise<void>;
28
+ }
29
+ /** One conversation over the existing realtime client; no transport or agent-loop ownership. */
30
+ export declare function createAgentController(config: AgentControllerConfig): AgentController;
31
+ //# sourceMappingURL=browser-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-controller.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/browser-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EAItB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,qBAAqB;IACpC,S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C;IACnE,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,KAAK,EAAE;QACb,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,oBAAoB,EAAE;YAAE,IAAI,EAAE,OAAO,CAAA;SAAE,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1F,qFAAqF;QACrF,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,oBAAoB,EAAE;YAAE,IAAI,EAAE,iBAAiB,CAAA;SAAE,CAAC,GAAG,IAAI,CAAC;KACxF,GAAG,6BAA6B,CAAC;IAClC,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,+BAA+B;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iFAAiF;IACjF,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAkHD,wBAAgB,+BAA+B,CAAC,OAAO,EACrD,OAAO,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACtC,MAAM,GAAE,+BAAoC,GAC3C,yBAAyB,CAsL3B"}
@@ -0,0 +1,25 @@
1
+ import { type RealtimeServerHandle } from '../server/realtime.js';
2
+ import { type AgentBrowserRequest } from './browser-control-contract.js';
3
+ import type { HeadlessAgentHarness } from './harness-contract.js';
4
+ import { type AgentHarnessControlServerConfig } from './harness-control.js';
5
+ export interface AgentHarnessRealtimeConfig<IDENTITY, CONTEXT> extends AgentHarnessControlServerConfig {
6
+ /** Verify identity, conversation access and user-supplied file/metadata policy on EVERY call. */
7
+ authorize(input: {
8
+ identity: IDENTITY;
9
+ request: AgentBrowserRequest;
10
+ signal: AbortSignal;
11
+ }): {
12
+ context: CONTEXT;
13
+ } | null | Promise<{
14
+ context: CONTEXT;
15
+ } | null>;
16
+ /** Server-only diagnostic; raw authorization errors are never sent to a browser. */
17
+ onError?(error: unknown): void;
18
+ maxPendingRequests?: number;
19
+ authorizationTimeoutMs?: number;
20
+ }
21
+ /** Bind the canonical control server to an existing, application-owned Socket.IO server. */
22
+ export declare function bindAgentHarnessRealtime<CONTEXT, IDENTITY>(harness: HeadlessAgentHarness<CONTEXT>, handle: RealtimeServerHandle<IDENTITY>, config: AgentHarnessRealtimeConfig<IDENTITY, CONTEXT>): {
23
+ close(): void;
24
+ };
25
+ //# sourceMappingURL=harness-realtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness-realtime.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/harness-realtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EACL,KAAK,+BAA+B,EAErC,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,0BAA0B,CAAC,QAAQ,EAAE,OAAO,CAC3D,SAAQ,+BAA+B;IACvC,iGAAiG;IACjG,SAAS,CAAC,KAAK,EAAE;QACf,QAAQ,EAAE,QAAQ,CAAC;QACnB,OAAO,EAAE,mBAAmB,CAAC;QAC7B,MAAM,EAAE,WAAW,CAAC;KACrB,GAAG;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACvE,oFAAoF;IACpF,OAAO,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,4FAA4F;AAC5F,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,QAAQ,EACxD,OAAO,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACtC,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EACtC,MAAM,EAAE,0BAA0B,CAAC,QAAQ,EAAE,OAAO,CAAC,GACpD;IAAE,KAAK,IAAI,IAAI,CAAA;CAAE,CA6InB"}
@@ -0,0 +1,11 @@
1
+ import type { ToolSet } from 'ai';
2
+ import type { ServiceDef } from '../server/types.js';
3
+ import { type AgentMountConfig } from '../tools/agent.js';
4
+ import type { AgentRuntimeRunContext } from './runtime.js';
5
+ /** Full mount configuration, resolved from the validated context of each run. */
6
+ export interface AgentHarnessToolsConfig extends AgentMountConfig {
7
+ services: ServiceDef | ServiceDef[];
8
+ }
9
+ /** Mount through the existing tool runner, always retaining the run's execution fence. */
10
+ export declare function createAgentHarnessTools<CONTEXT>(resolve: (run: AgentRuntimeRunContext<CONTEXT>) => AgentHarnessToolsConfig | Promise<AgentHarnessToolsConfig>): (run: AgentRuntimeRunContext<CONTEXT>) => Promise<ToolSet>;
11
+ //# sourceMappingURL=harness-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness-tools.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/harness-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,KAAK,gBAAgB,EAAc,MAAM,gBAAgB,CAAC;AAEnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExD,iFAAiF;AACjF,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D,QAAQ,EAAE,UAAU,GAAG,UAAU,EAAE,CAAC;CACrC;AAED,0FAA0F;AAC1F,wBAAgB,uBAAuB,CAAC,OAAO,EAC7C,OAAO,EAAE,CACP,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,KACjC,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC,GAC9D,CAAC,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAQ5D"}
@@ -0,0 +1,4 @@
1
+ import type { AgentController, AgentControllerState } from './browser-controller.js';
2
+ /** Observe an application-owned controller; unmount never closes a shared connection or agent. */
3
+ export declare function useAgent(controller: AgentController): AgentControllerState;
4
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAElF,kGAAkG;AAClG,wBAAgB,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,oBAAoB,CAM1E"}
@@ -0,0 +1,63 @@
1
+ import { type AgentSnapshot } from './schemas.js';
2
+ /** Assertions inspect durable evidence for exactly one run, independent of a test framework. */
3
+ export declare function inspectAgentRun(rawSnapshot: AgentSnapshot, runId: string): {
4
+ run: {
5
+ schemaVersion: 1;
6
+ id: string;
7
+ conversationId: string;
8
+ inputMessageIds: string[];
9
+ assistantMessageId: string;
10
+ state: "abandoned" | "cancelled" | "completed" | "failed" | "interrupt_requested" | "interrupted" | "queued" | "running" | "superseded";
11
+ revision: number;
12
+ queuePriority?: "interrupt-next" | undefined;
13
+ executionSequence?: number | undefined;
14
+ ownerId?: string | undefined;
15
+ fencingToken?: number | undefined;
16
+ terminalReason?: "abandoned" | "absorbed" | "cancelled" | "context_overflow" | "interrupted" | "output_rejected" | "policy_stop" | "provider_failure" | "provider_stop" | "runtime_failure" | "shutdown" | "storage_conflict" | "success" | "superseded" | "timeout" | undefined;
17
+ terminalPolicyName?: string | undefined;
18
+ absorbedIntoRunId?: string | undefined;
19
+ usage?: {
20
+ inputTokens: {
21
+ value?: number | undefined;
22
+ provenance: "computed" | "estimated" | "provider-reported" | "unavailable";
23
+ };
24
+ outputTokens: {
25
+ value?: number | undefined;
26
+ provenance: "computed" | "estimated" | "provider-reported" | "unavailable";
27
+ };
28
+ reasoningTokens?: {
29
+ value?: number | undefined;
30
+ provenance: "computed" | "estimated" | "provider-reported" | "unavailable";
31
+ } | undefined;
32
+ cacheReadTokens?: {
33
+ value?: number | undefined;
34
+ provenance: "computed" | "estimated" | "provider-reported" | "unavailable";
35
+ } | undefined;
36
+ cacheWriteTokens?: {
37
+ value?: number | undefined;
38
+ provenance: "computed" | "estimated" | "provider-reported" | "unavailable";
39
+ } | undefined;
40
+ cost?: {
41
+ value?: number | undefined;
42
+ currency?: string | undefined;
43
+ provenance: "computed" | "estimated" | "provider-reported" | "unavailable";
44
+ } | undefined;
45
+ } | undefined;
46
+ lastOperation?: {
47
+ operationId: string;
48
+ kind: "compaction" | "model-request";
49
+ phase: "cancelled" | "completed" | "failed" | "first-output" | "started";
50
+ step?: number | undefined;
51
+ startedAt: string;
52
+ firstOutputAt?: string | undefined;
53
+ finishedAt?: string | undefined;
54
+ } | undefined;
55
+ createdAt: string;
56
+ updatedAt: string;
57
+ };
58
+ completed(): void;
59
+ calledTool(name: string): void;
60
+ notCalledTool(name: string): void;
61
+ toolSucceeded(name: string): void;
62
+ };
63
+ //# sourceMappingURL=run-assertions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-assertions.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/run-assertions.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,aAAa,EAAuB,MAAM,WAAW,CAAC;AA8BnF,gGAAgG;AAChG,wBAAgB,eAAe,CAAC,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAsCpD,MAAM;wBAGH,MAAM;wBAGN,MAAM;EAgB7B"}
@@ -1,4 +1,6 @@
1
1
  /** Browser-safe canonical records and delivery cursor — no runtime execution or sinks. */
2
+ export { type AgentBrowserRequest, AgentBrowserRequestSchema, agentControlRealtimeContract, } from '../../agent-runtime/browser-control-contract.js';
3
+ export { type AgentBrowserCommand, type AgentController, type AgentControllerConfig, type AgentControllerState, createAgentController, } from '../../agent-runtime/browser-controller.js';
2
4
  export * from '../../agent-runtime/control-schema.js';
3
5
  export * from '../../agent-runtime/event-schema.js';
4
6
  export * from '../../agent-runtime/schemas.js';
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/agent-runtime/browser.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAE1F,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/agent-runtime/browser.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAE1F,OAAO,EACL,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,qBAAqB,GACtB,MAAM,wCAAwC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC"}
@@ -1,3 +1,4 @@
1
+ import"../../index-814xpr6d.js";
1
2
  import {
2
3
  AgentRecordIdSchema2,
3
4
  AgentRecordVersionSchema2,
@@ -62,10 +63,242 @@ import {
62
63
  reduceAgentControlSnapshot2,
63
64
  reduceAgentControlEvent2
64
65
  } from "../../index-n5yqxd3d.js";
66
+ import {
67
+ AgentBrowserRequestSchema2,
68
+ agentControlRealtimeContract2
69
+ } from "../../index-20yvtn9a.js";
70
+ import"../../index-n53mswt3.js";
71
+ import"../../index-pw99k9h5.js";
72
+ import"../../index-4s0fep5q.js";
73
+ import {
74
+ bindRealtimeClient2
75
+ } from "../../index-r34mvse1.js";
76
+ // src/agent-runtime/browser-controller.ts
77
+ function refreshed(view, snapshot) {
78
+ const current = view.conversations[snapshot.conversationId];
79
+ if (Math.max(current?.snapshot?.version ?? 0, view.cursor.conversations[snapshot.conversationId]?.snapshotVersion ?? 0) > snapshot.version)
80
+ return view;
81
+ const next = reduceAgentControlSnapshot2(view, snapshot);
82
+ const transientByRun = Object.fromEntries(Object.entries(current?.transientByRun ?? {}).filter(([id]) => snapshot.runs.some((run) => run.id === id && ["running", "interrupt_requested"].includes(run.state))));
83
+ return {
84
+ ...next,
85
+ conversations: {
86
+ ...next.conversations,
87
+ [snapshot.conversationId]: { snapshot, resyncRequired: false, transientByRun }
88
+ }
89
+ };
90
+ }
91
+ function createAgentController(config) {
92
+ return new ConversationController(config);
93
+ }
94
+
95
+ class ConversationController {
96
+ config;
97
+ client;
98
+ timeoutMs;
99
+ maxEvents;
100
+ maxBytes;
101
+ maxPending;
102
+ state = {
103
+ status: "connecting",
104
+ view: createAgentControlView2()
105
+ };
106
+ listeners = new Set;
107
+ generation = 0;
108
+ closed = false;
109
+ busy = false;
110
+ buffered = [];
111
+ bufferedBytes = 0;
112
+ overflowed = false;
113
+ refreshScheduled = false;
114
+ refreshAttempts = 0;
115
+ tail = Promise.resolve();
116
+ pending = new Set;
117
+ offDelivery;
118
+ offConnection;
119
+ constructor(config) {
120
+ this.config = config;
121
+ this.client = bindRealtimeClient2(agentControlRealtimeContract2, config.transport);
122
+ this.timeoutMs = config.timeoutMs ?? 1e4;
123
+ this.maxEvents = config.maxBufferedEvents ?? 256;
124
+ this.maxBytes = config.maxBufferedBytes ?? 1048576;
125
+ this.maxPending = config.maxPendingRequests ?? 32;
126
+ for (const [name, value] of Object.entries({
127
+ timeoutMs: this.timeoutMs,
128
+ maxEvents: this.maxEvents,
129
+ maxBytes: this.maxBytes,
130
+ maxPending: this.maxPending
131
+ })) {
132
+ if (!Number.isSafeInteger(value) || value < 1)
133
+ throw new TypeError(`${name} must be a positive safe integer`);
134
+ }
135
+ if (!config.conversationId)
136
+ throw new TypeError("conversationId must not be empty");
137
+ this.offDelivery = this.client.on("agent:delivery", (delivery) => this.receive(delivery));
138
+ this.offConnection = this.client.onConnectionChange((connected) => this.changed(connected));
139
+ this.changed(this.client.connected);
140
+ }
141
+ getSnapshot = () => this.state;
142
+ subscribe = (listener) => {
143
+ this.listeners.add(listener);
144
+ return () => {
145
+ this.listeners.delete(listener);
146
+ };
147
+ };
148
+ update(next) {
149
+ this.state = next;
150
+ for (const listener of this.listeners)
151
+ listener();
152
+ }
153
+ failure(code, message) {
154
+ this.update({ ...this.state, status: "error", error: { code, message } });
155
+ }
156
+ apply(delivery) {
157
+ if (delivery.type === "event") {
158
+ this.update({
159
+ ...this.state,
160
+ view: reduceAgentControlEvent2(this.state.view, delivery.event)
161
+ });
162
+ } else {
163
+ this.failure("EVENT_OVERFLOW", "Reconnect the transport to restore agent state");
164
+ }
165
+ }
166
+ scheduleRefresh() {
167
+ if (this.refreshScheduled || this.busy || this.pending.size >= this.maxPending || this.state.status !== "ready" || !this.state.view.conversations[this.config.conversationId]?.resyncRequired)
168
+ return;
169
+ this.refreshScheduled = true;
170
+ queueMicrotask(() => {
171
+ this.refreshScheduled = false;
172
+ if (!this.closed && this.state.status === "ready") {
173
+ if (++this.refreshAttempts > 3) {
174
+ this.failure("RESYNC_EXHAUSTED", "Snapshot did not catch up; refresh explicitly to retry");
175
+ return;
176
+ }
177
+ this.request({ operation: "snapshot" }).catch(() => {});
178
+ }
179
+ });
180
+ }
181
+ async execute(command, epoch) {
182
+ if (this.closed || epoch !== this.generation || !this.client.connected)
183
+ throw new Error("Agent controller is disconnected");
184
+ this.busy = true;
185
+ const requestId = crypto.randomUUID();
186
+ try {
187
+ const response = await this.client.request("agent:control", {
188
+ ...command,
189
+ schemaVersion: 1,
190
+ requestId,
191
+ conversationId: this.config.conversationId
192
+ }, { timeoutMs: this.timeoutMs });
193
+ if (this.closed || epoch !== this.generation)
194
+ throw new Error("Agent controller connection changed");
195
+ if (response.requestId !== requestId)
196
+ throw new Error("Agent control acknowledgement identity mismatch");
197
+ if (response.outcome === "error") {
198
+ this.failure(response.error.code, response.error.message);
199
+ return response;
200
+ }
201
+ if (response.snapshot) {
202
+ if (response.snapshot.conversationId !== this.config.conversationId)
203
+ throw new Error("Agent snapshot conversation mismatch");
204
+ this.update({ status: "ready", view: refreshed(this.state.view, response.snapshot) });
205
+ if (!this.state.view.conversations[this.config.conversationId]?.resyncRequired)
206
+ this.refreshAttempts = 0;
207
+ }
208
+ if (command.operation === "detach")
209
+ this.update({ ...this.state, status: "disconnected" });
210
+ return response;
211
+ } catch (error) {
212
+ if (!this.closed && epoch === this.generation)
213
+ this.failure("CONTROL_REQUEST_FAILED", error instanceof Error ? error.message : "Agent request failed");
214
+ throw error;
215
+ } finally {
216
+ if (epoch === this.generation) {
217
+ this.busy = false;
218
+ const deliveries = this.buffered;
219
+ this.buffered = [];
220
+ this.bufferedBytes = 0;
221
+ for (const delivery of deliveries)
222
+ this.apply(delivery);
223
+ if (this.overflowed) {
224
+ this.overflowed = false;
225
+ this.failure("EVENT_OVERFLOW", "Refresh agent state before continuing");
226
+ }
227
+ }
228
+ }
229
+ }
230
+ request(command) {
231
+ if (this.closed || this.pending.size >= this.maxPending)
232
+ return Promise.reject(new Error(this.closed ? "Agent controller is closed" : "Agent request capacity exceeded"));
233
+ const entry = {};
234
+ this.pending.add(entry);
235
+ const epoch = this.generation;
236
+ const result = this.tail.then(() => this.execute(command, epoch)).finally(() => {
237
+ this.pending.delete(entry);
238
+ this.scheduleRefresh();
239
+ });
240
+ this.tail = result.catch(() => {});
241
+ return result;
242
+ }
243
+ receive(delivery) {
244
+ const conversationId = delivery.type === "event" ? delivery.event.conversationId : delivery.conversationId;
245
+ if (this.closed || conversationId !== this.config.conversationId)
246
+ return;
247
+ if (this.busy) {
248
+ const bytes = new TextEncoder().encode(JSON.stringify(delivery)).byteLength;
249
+ if (this.overflowed || this.buffered.length >= this.maxEvents || this.bufferedBytes + bytes > this.maxBytes) {
250
+ this.overflowed = true;
251
+ this.buffered = [];
252
+ this.bufferedBytes = 0;
253
+ } else {
254
+ this.buffered.push(delivery);
255
+ this.bufferedBytes += bytes;
256
+ }
257
+ } else {
258
+ this.apply(delivery);
259
+ this.scheduleRefresh();
260
+ }
261
+ }
262
+ changed(connected) {
263
+ this.generation += 1;
264
+ this.busy = false;
265
+ this.buffered = [];
266
+ this.bufferedBytes = 0;
267
+ this.overflowed = false;
268
+ this.refreshAttempts = 0;
269
+ this.tail = Promise.resolve();
270
+ this.update({
271
+ status: connected ? "connecting" : "disconnected",
272
+ view: createAgentControlView2()
273
+ });
274
+ if (connected)
275
+ this.request({ operation: "attach", access: this.config.access }).catch(() => {});
276
+ }
277
+ async close() {
278
+ if (this.closed)
279
+ return;
280
+ this.closed = true;
281
+ this.generation += 1;
282
+ this.offDelivery();
283
+ this.offConnection();
284
+ this.update({ ...this.state, status: "closed" });
285
+ if (this.client.connected) {
286
+ const response = await this.client.request("agent:control", {
287
+ schemaVersion: 1,
288
+ requestId: crypto.randomUUID(),
289
+ operation: "detach",
290
+ conversationId: this.config.conversationId
291
+ }, { timeoutMs: this.timeoutMs });
292
+ if (response.outcome === "error" && !["CONNECTION_CLOSED", "ACCESS_DENIED"].includes(response.error.code))
293
+ throw new Error(`Agent detach failed: ${response.error.code}`);
294
+ }
295
+ }
296
+ }
65
297
  export {
66
298
  AgentAdmissionEventSchema2 as AgentAdmissionEventSchema,
67
299
  AgentAssistantPlaceholderSchema2 as AgentAssistantPlaceholderSchema,
68
300
  AgentAttemptResetEventSchema2 as AgentAttemptResetEventSchema,
301
+ AgentBrowserRequestSchema2 as AgentBrowserRequestSchema,
69
302
  AgentCheckpointEventSchema2 as AgentCheckpointEventSchema,
70
303
  AgentControlDeliverySchema2 as AgentControlDeliverySchema,
71
304
  AgentControlPartSchema2 as AgentControlPartSchema,
@@ -116,8 +349,10 @@ export {
116
349
  AgentUsageValueSchema2 as AgentUsageValueSchema,
117
350
  advanceAgentMultiSessionCursor2 as advanceAgentMultiSessionCursor,
118
351
  advanceAgentRuntimeEventCursor2 as advanceAgentRuntimeEventCursor,
352
+ agentControlRealtimeContract2 as agentControlRealtimeContract,
119
353
  agentDurableEventId2 as agentDurableEventId,
120
354
  createAgentControlView2 as createAgentControlView,
355
+ createAgentController,
121
356
  reduceAgentControlEvent2 as reduceAgentControlEvent,
122
357
  reduceAgentControlSnapshot2 as reduceAgentControlSnapshot,
123
358
  runStateForTerminalReason2 as runStateForTerminalReason
@@ -1,5 +1,5 @@
1
1
  import"../../index-ct75c3at.js";
2
- import"../../index-7z9ym7t8.js";
2
+ import"../../index-x87j7csh.js";
3
3
  import"../../index-n53mswt3.js";
4
4
  import"../../index-b2bz0kdm.js";
5
5
  import {
@@ -7,9 +7,9 @@ import {
7
7
  AgentCodingToolAuthorizationSchema2,
8
8
  AgentCodingToolPathAuthorizationSchema2,
9
9
  createAgentCodingTools2
10
- } from "../../index-djjhhgjk.js";
10
+ } from "../../index-a4ajxwmb.js";
11
11
  import"../../index-ahvsksw5.js";
12
- import"../../index-jzczzcsb.js";
12
+ import"../../index-tgzhq07n.js";
13
13
  export {
14
14
  AgentCodingToolAuthorizationSchema2 as AgentCodingToolAuthorizationSchema,
15
15
  AgentCodingToolLimitsSchema2 as AgentCodingToolLimitsSchema,
@@ -0,0 +1,2 @@
1
+ export { type AgentHarnessToolsConfig, createAgentHarnessTools, } from '../../agent-runtime/harness-tools.js';
2
+ //# sourceMappingURL=harness-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness-tools.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/agent-runtime/harness-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,uBAAuB,EAC5B,uBAAuB,GACxB,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import"../../index-nggfa2yn.js";
2
+ import"../../index-n53mswt3.js";
3
+ import"../../index-b2bz0kdm.js";
4
+ import"../../index-yex7eg1v.js";
5
+ import"../../index-9pw0a51a.js";
6
+ import"../../index-ct75c3at.js";
7
+ import"../../index-x87j7csh.js";
8
+ import"../../index-m2xqkv55.js";
9
+ import"../../index-r956rndn.js";
10
+ import {
11
+ mountAgent2
12
+ } from "../../index-1khy8y7n.js";
13
+ import {
14
+ composeToolLifecycle2
15
+ } from "../../index-ze1eph1k.js";
16
+ import"../../index-dnn9z96q.js";
17
+ import"../../index-7n68nmc6.js";
18
+ import"../../index-tgzhq07n.js";
19
+
20
+ // src/agent-runtime/harness-tools.ts
21
+ function createAgentHarnessTools(resolve) {
22
+ return async (run) => {
23
+ const { services, lifecycle, ...config } = await resolve(run);
24
+ return mountAgent2(services, {
25
+ ...config,
26
+ lifecycle: composeToolLifecycle2(lifecycle, run.toolFenceLifecycle)
27
+ });
28
+ };
29
+ }
30
+ export {
31
+ createAgentHarnessTools
32
+ };