stitchkit 0.88.0 → 0.90.0
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.
- package/CHANGELOG.md +182 -0
- package/dist/agent-runtime/child-blocking.d.ts +17 -0
- package/dist/agent-runtime/child-blocking.d.ts.map +1 -0
- package/dist/agent-runtime/child-budget-policy.d.ts +23 -0
- package/dist/agent-runtime/child-budget-policy.d.ts.map +1 -0
- package/dist/agent-runtime/children-contract.d.ts +155 -0
- package/dist/agent-runtime/children-contract.d.ts.map +1 -0
- package/dist/agent-runtime/children.d.ts +4 -99
- package/dist/agent-runtime/children.d.ts.map +1 -1
- package/dist/agent-runtime/coding-shell-process.d.ts +33 -0
- package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -0
- package/dist/agent-runtime/coding-tool-contract.d.ts +18 -0
- package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-files.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-utf8.d.ts +28 -0
- package/dist/agent-runtime/coding-tool-utf8.d.ts.map +1 -0
- package/dist/agent-runtime/contained-files.d.ts +20 -0
- package/dist/agent-runtime/contained-files.d.ts.map +1 -1
- package/dist/agent-runtime/durability-contract.d.ts +176 -0
- package/dist/agent-runtime/durability-contract.d.ts.map +1 -0
- package/dist/agent-runtime/durability-json.d.ts +3 -0
- package/dist/agent-runtime/durability-json.d.ts.map +1 -0
- package/dist/agent-runtime/durability-ledger.d.ts +16 -0
- package/dist/agent-runtime/durability-ledger.d.ts.map +1 -0
- package/dist/agent-runtime/durability-scheduler.d.ts +29 -0
- package/dist/agent-runtime/durability-scheduler.d.ts.map +1 -0
- package/dist/agent-runtime/durability.d.ts +14 -0
- package/dist/agent-runtime/durability.d.ts.map +1 -0
- package/dist/agent-runtime/event-search.d.ts.map +1 -1
- package/dist/agent-runtime/harness-contract.d.ts +37 -0
- package/dist/agent-runtime/harness-contract.d.ts.map +1 -1
- package/dist/agent-runtime/harness.d.ts +8 -0
- package/dist/agent-runtime/harness.d.ts.map +1 -1
- package/dist/agent-runtime/prompt.d.ts +23 -0
- package/dist/agent-runtime/prompt.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/runtime-internals.d.ts +4 -0
- package/dist/agent-runtime/runtime-internals.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +13 -0
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-broker.d.ts +7 -0
- package/dist/agent-runtime/sandbox-broker.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-bubblewrap-args.d.ts +9 -0
- package/dist/agent-runtime/sandbox-bubblewrap-args.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-bubblewrap-storage.d.ts +22 -0
- package/dist/agent-runtime/sandbox-bubblewrap-storage.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-bubblewrap.d.ts +14 -0
- package/dist/agent-runtime/sandbox-bubblewrap.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-coding-adapter.d.ts +15 -0
- package/dist/agent-runtime/sandbox-coding-adapter.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-coding.d.ts +15 -0
- package/dist/agent-runtime/sandbox-coding.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-contract.d.ts +93 -0
- package/dist/agent-runtime/sandbox-contract.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-process-owner.d.ts +11 -0
- package/dist/agent-runtime/sandbox-process-owner.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-process.d.ts +8 -0
- package/dist/agent-runtime/sandbox-process.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-session.d.ts +5 -0
- package/dist/agent-runtime/sandbox-session.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox.d.ts +19 -0
- package/dist/agent-runtime/sandbox.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite-purge.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver.d.ts +127 -0
- package/dist/agent-runtime/store-driver.d.ts.map +1 -1
- package/dist/agent-runtime/store-events.d.ts +104 -0
- package/dist/agent-runtime/store-events.d.ts.map +1 -1
- package/dist/agent-runtime/store-migrations/v2-to-v3.d.ts +14 -0
- package/dist/agent-runtime/store-migrations/v2-to-v3.d.ts.map +1 -0
- package/dist/agent-runtime/store.d.ts +115 -0
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/agent-runtime-coding-tools.js +11 -1247
- package/dist/agent-runtime-harness.d.ts +1 -1
- package/dist/agent-runtime-harness.d.ts.map +1 -1
- package/dist/agent-runtime-harness.js +65 -15
- package/dist/agent-runtime-openrouter.d.ts +3 -12
- package/dist/agent-runtime-openrouter.d.ts.map +1 -1
- package/dist/agent-runtime-openrouter.js +10 -7
- package/dist/agent-runtime-sandbox.d.ts +5 -0
- package/dist/agent-runtime-sandbox.d.ts.map +1 -0
- package/dist/agent-runtime-sandbox.js +797 -0
- package/dist/agent-runtime-sqlite-bun.js +3 -3
- package/dist/agent-runtime-sqlite-node.js +3 -3
- package/dist/agent-runtime.d.ts +5 -4
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +259 -65
- package/dist/application/watch-hub.d.ts +24 -2
- package/dist/application/watch-hub.d.ts.map +1 -1
- package/dist/application.js +127 -37
- package/dist/cli.js +8 -8
- package/dist/index-2na0qrfn.js +214 -0
- package/dist/{index-rcgsnrr6.js → index-31jw8fjq.js} +3 -3
- package/dist/{index-9hw9eq48.js → index-7601qfg1.js} +14 -14
- package/dist/{index-3xnq72rz.js → index-7rkhw9ec.js} +14 -1
- package/dist/{index-0vfdh685.js → index-8c3a7m4g.js} +1 -1
- package/dist/{index-t7gh5w3v.js → index-bn2cjajt.js} +27 -6
- package/dist/index-cp20z0n6.js +1351 -0
- package/dist/{index-qp3vshvc.js → index-fadnxwna.js} +87 -5
- package/dist/{index-v1qk37y9.js → index-hrbajay7.js} +106 -4
- package/dist/{index-p86mxmpp.js → index-hw2chdvy.js} +646 -43
- package/dist/{index-0ydchz76.js → index-mnm4qp0p.js} +5 -5
- package/dist/{index-1szetq6f.js → index-q3ve2d1k.js} +30 -8
- package/dist/{index-6krwcdcf.js → index-zwkgfq1s.js} +95 -85
- package/dist/{index-wn9cb82y.js → index-zyvby92n.js} +12 -9
- package/dist/index.js +13 -13
- package/dist/live/watch-client.d.ts +2 -1
- package/dist/live/watch-client.d.ts.map +1 -1
- package/dist/live/watch-contract.d.ts +70 -4
- package/dist/live/watch-contract.d.ts.map +1 -1
- package/dist/live/watch-delta.d.ts +110 -0
- package/dist/live/watch-delta.d.ts.map +1 -0
- package/dist/live.d.ts +2 -1
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +56 -4
- package/dist/observability/changes.d.ts +55 -0
- package/dist/observability/changes.d.ts.map +1 -0
- package/dist/observability/index.d.ts +2 -0
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +127 -0
- package/dist/observability/spool.d.ts +53 -0
- package/dist/observability/spool.d.ts.map +1 -0
- package/dist/server/index.js +9 -9
- package/dist/testing/agent-store-conformance.d.ts.map +1 -1
- package/dist/testing.js +57 -23
- package/dist/tool-invoker.js +6 -6
- package/dist/tools/agent.d.ts +6 -0
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/connections/define.d.ts +6 -0
- package/dist/tools/connections/define.d.ts.map +1 -0
- package/dist/tools/connections/errors.d.ts +50 -0
- package/dist/tools/connections/errors.d.ts.map +1 -0
- package/dist/tools/connections/http.d.ts +3 -0
- package/dist/tools/connections/http.d.ts.map +1 -0
- package/dist/tools/connections/index.d.ts +19 -0
- package/dist/tools/connections/index.d.ts.map +1 -0
- package/dist/tools/connections/index.js +1047 -0
- package/dist/tools/connections/instance.d.ts +3 -0
- package/dist/tools/connections/instance.d.ts.map +1 -0
- package/dist/tools/connections/json-rpc.d.ts +8 -0
- package/dist/tools/connections/json-rpc.d.ts.map +1 -0
- package/dist/tools/connections/limits.d.ts +36 -0
- package/dist/tools/connections/limits.d.ts.map +1 -0
- package/dist/tools/connections/mcp-client.d.ts +44 -0
- package/dist/tools/connections/mcp-client.d.ts.map +1 -0
- package/dist/tools/connections/mcp.d.ts +5 -0
- package/dist/tools/connections/mcp.d.ts.map +1 -0
- package/dist/tools/connections/mount.d.ts +12 -0
- package/dist/tools/connections/mount.d.ts.map +1 -0
- package/dist/tools/connections/openapi-document.d.ts +4 -0
- package/dist/tools/connections/openapi-document.d.ts.map +1 -0
- package/dist/tools/connections/openapi.d.ts +5 -0
- package/dist/tools/connections/openapi.d.ts.map +1 -0
- package/dist/tools/connections/runtime.d.ts +29 -0
- package/dist/tools/connections/runtime.d.ts.map +1 -0
- package/dist/tools/connections/schema-budget.d.ts +8 -0
- package/dist/tools/connections/schema-budget.d.ts.map +1 -0
- package/dist/tools/connections/sse-frames.d.ts +7 -0
- package/dist/tools/connections/sse-frames.d.ts.map +1 -0
- package/dist/tools/connections/sse-session.d.ts +26 -0
- package/dist/tools/connections/sse-session.d.ts.map +1 -0
- package/dist/tools/connections/ssrf.d.ts +15 -0
- package/dist/tools/connections/ssrf.d.ts.map +1 -0
- package/dist/tools/connections/types.d.ts +60 -0
- package/dist/tools/connections/types.d.ts.map +1 -0
- package/dist/tools/durability-context.d.ts +7 -0
- package/dist/tools/durability-context.d.ts.map +1 -0
- package/dist/tools/execute.d.ts +2 -0
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/registry.d.ts +38 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/runtime-tool.d.ts +4 -0
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools.d.ts +1 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +83 -26
- package/llms-full.txt +386 -16
- package/llms.txt +1 -0
- package/package.json +9 -1
- package/dist/index-dre2ywck.js +0 -48
- package/dist/{index-evcnmsc3.js → index-t7fkyxcr.js} +3 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Character-boundary arithmetic for byte-bounded windows.
|
|
3
|
+
*
|
|
4
|
+
* A window cut at `offset + maxBytes` lands wherever the bytes fall, and the
|
|
5
|
+
* cut regularly lands inside a multi-byte character — Russian text makes that
|
|
6
|
+
* the common case, not the exception. A fatal `TextDecoder` refuses such a
|
|
7
|
+
* slice, so a bounded read of a perfectly valid file answered
|
|
8
|
+
* `INTERNAL_SERVER_ERROR` for some offsets and succeeded for others. The window
|
|
9
|
+
* is aligned here, before any decoder sees it.
|
|
10
|
+
*
|
|
11
|
+
* The alignment never returns an empty window for a non-empty read: when the
|
|
12
|
+
* requested end falls inside a sequence, it extends to that sequence's last
|
|
13
|
+
* byte, provided the caller supplied those bytes. Without the extension a
|
|
14
|
+
* window smaller than one character would make no progress and the reader would
|
|
15
|
+
* loop on the same offset — a silent hang where the old code at least refused.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The largest `end' <= start + limit` that ends on a character boundary.
|
|
19
|
+
*
|
|
20
|
+
* When the byte before the cut begins a sequence that runs past it, `end` moves
|
|
21
|
+
* back to that sequence's lead — or forward to its final byte when the buffer
|
|
22
|
+
* holds it. A sequence truncated at the end of the buffer is left for the fatal
|
|
23
|
+
* decoder to refuse, so a genuinely broken file still names its cause.
|
|
24
|
+
*/
|
|
25
|
+
export declare function utf8AlignedEnd(data: Uint8Array, start: number, limit: number): number;
|
|
26
|
+
/** The smallest `start' >= start` that begins on a character boundary. */
|
|
27
|
+
export declare function utf8AlignedStart(data: Uint8Array, start: number, end: number): number;
|
|
28
|
+
//# sourceMappingURL=coding-tool-utf8.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-tool-utf8.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-utf8.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAWH;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAYrF;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAIrF"}
|
|
@@ -13,7 +13,20 @@ export interface ContainedFileScan {
|
|
|
13
13
|
truncated: boolean;
|
|
14
14
|
skippedDirectories: number;
|
|
15
15
|
skippedSymlinks: number;
|
|
16
|
+
/**
|
|
17
|
+
* Entries the host's `authorizePath` rejected while walking. A denied path
|
|
18
|
+
* used to disappear from every listing exactly like an absent one; naming
|
|
19
|
+
* them is what lets a caller tell "the host refused this" from "there is
|
|
20
|
+
* nothing here". Only the name and kind are carried — never content.
|
|
21
|
+
*/
|
|
22
|
+
denied: readonly {
|
|
23
|
+
relative: string;
|
|
24
|
+
kind: ContainedEntryKind;
|
|
25
|
+
}[];
|
|
26
|
+
/** The `denied` list hit its cap; there are more refusals than named. */
|
|
27
|
+
deniedTruncated: boolean;
|
|
16
28
|
}
|
|
29
|
+
export type ContainedEntryKind = 'file' | 'directory' | 'symlink' | 'other';
|
|
17
30
|
export interface ContainedFileHandle {
|
|
18
31
|
readonly fd: number;
|
|
19
32
|
close(): Promise<void>;
|
|
@@ -38,6 +51,12 @@ export declare function listContainedDirectory(root: string, relative: string, m
|
|
|
38
51
|
bytes?: number;
|
|
39
52
|
}[];
|
|
40
53
|
truncated: boolean;
|
|
54
|
+
/** Direct children the host's policy refused, capped at `maxEntries`. */
|
|
55
|
+
denied: {
|
|
56
|
+
name: string;
|
|
57
|
+
kind: ContainedEntryKind;
|
|
58
|
+
}[];
|
|
59
|
+
deniedTruncated: boolean;
|
|
41
60
|
}>;
|
|
42
61
|
export interface ContainedParent {
|
|
43
62
|
handle: ContainedFileHandle;
|
|
@@ -93,6 +112,7 @@ export declare function scanContainedFiles(input: {
|
|
|
93
112
|
readMaxBytes?: number;
|
|
94
113
|
skipUnreadable?: boolean;
|
|
95
114
|
excludeDirectory?: (relative: string) => boolean;
|
|
115
|
+
includeFile?: (relative: string) => boolean;
|
|
96
116
|
authorizePath?: (relative: string, kind: 'file' | 'directory' | 'symlink' | 'other') => boolean | Promise<boolean>;
|
|
97
117
|
}): Promise<ContainedFileScan>;
|
|
98
118
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contained-files.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/contained-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,KAAK,EAEX,MAAM,SAAS,CAAC;AAejB,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"contained-files.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/contained-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,KAAK,EAEX,MAAM,SAAS,CAAC;AAejB,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE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,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IACjD,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAC5C,aAAa,CAAC,EAAE,CACd,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,KAC7C,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA8F7B"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { AgentStoreEventEnvelope, AgentStoreEventPage, AppendAgentStoreEvent, ReadAgentStoreEvents } from './store-events.js';
|
|
3
|
+
/**
|
|
4
|
+
* The durable ledger a local step implementation needs.
|
|
5
|
+
*
|
|
6
|
+
* Narrower than `AgentRuntimeStore` on purpose: durability owns no records of
|
|
7
|
+
* its own, it reads and appends the conversation's canonical event log, so a
|
|
8
|
+
* store that already satisfies this slice can back it without the rest of the
|
|
9
|
+
* runtime.
|
|
10
|
+
*
|
|
11
|
+
* A park (`sleep`/`waitFor`) is recorded the same way a step result is: as an
|
|
12
|
+
* ordinary event in this ledger. The local scheduler waits in-process, and a
|
|
13
|
+
* reconstruction resumes from the records that survived a restart.
|
|
14
|
+
*/
|
|
15
|
+
export interface StepDurabilityLedger {
|
|
16
|
+
appendEvent(input: AppendAgentStoreEvent): Promise<AgentStoreEventEnvelope>;
|
|
17
|
+
readEvents(input: ReadAgentStoreEvents): Promise<AgentStoreEventPage>;
|
|
18
|
+
}
|
|
19
|
+
/** Event kind carrying one recorded step result in the canonical ledger. */
|
|
20
|
+
export declare const DURABILITY_STEP_EVENT_KIND = "durability/step";
|
|
21
|
+
/** Event kind recording that a run parked on time or on an external event. */
|
|
22
|
+
export declare const DURABILITY_PARK_EVENT_KIND = "durability/park";
|
|
23
|
+
/** Event kind recording an external event delivered to a parked wait. */
|
|
24
|
+
export declare const DURABILITY_EVENT_EVENT_KIND = "durability/event";
|
|
25
|
+
export declare const StepEventPayloadSchema: z.ZodObject<{
|
|
26
|
+
runId: z.ZodString;
|
|
27
|
+
stepName: z.ZodString;
|
|
28
|
+
encoded: z.ZodString;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export declare const ParkEventPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
31
|
+
runId: z.ZodString;
|
|
32
|
+
kind: z.ZodLiteral<"sleep">;
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
deadline: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
36
|
+
runId: z.ZodString;
|
|
37
|
+
kind: z.ZodLiteral<"wait">;
|
|
38
|
+
event: z.ZodString;
|
|
39
|
+
id: z.ZodString;
|
|
40
|
+
}, z.core.$strip>], "kind">;
|
|
41
|
+
export declare const DeliveredEventPayloadSchema: z.ZodObject<{
|
|
42
|
+
runId: z.ZodString;
|
|
43
|
+
event: z.ZodString;
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
encoded: z.ZodString;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type ParkEventPayload = z.infer<typeof ParkEventPayloadSchema>;
|
|
48
|
+
export type StepEventPayload = z.infer<typeof StepEventPayloadSchema>;
|
|
49
|
+
/**
|
|
50
|
+
* The time source a park uses.
|
|
51
|
+
*
|
|
52
|
+
* `now` is the wall clock the durable sleep deadline is stamped from and
|
|
53
|
+
* re-evaluated against, so a reconstructed park resumes from the recorded
|
|
54
|
+
* value. A test replaces the pair with a manual clock to advance time without
|
|
55
|
+
* waiting in real time.
|
|
56
|
+
*/
|
|
57
|
+
export interface DurabilityClock {
|
|
58
|
+
now(): number;
|
|
59
|
+
schedule(callback: () => void, delayMs: number): {
|
|
60
|
+
cancel(): void;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface LocalStepDurabilityOptions {
|
|
64
|
+
store: StepDurabilityLedger;
|
|
65
|
+
conversationId: string;
|
|
66
|
+
runId: string;
|
|
67
|
+
signal?: AbortSignal;
|
|
68
|
+
/** Host-owned notification for ledger writes made by another process. */
|
|
69
|
+
subscribe?(wake: () => void): () => void;
|
|
70
|
+
/**
|
|
71
|
+
* Injectable time source for `sleep`. Defaults to the wall clock and
|
|
72
|
+
* `setTimeout`; a test passes a manual clock so advancing time
|
|
73
|
+
* deterministically resumes a park without waiting in real time.
|
|
74
|
+
*/
|
|
75
|
+
clock?: {
|
|
76
|
+
now(): number;
|
|
77
|
+
schedule(callback: () => void, delayMs: number): {
|
|
78
|
+
cancel(): void;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export interface StepRunOptions {
|
|
83
|
+
/** Aborting refuses to *start* a body and releases a park; it never removes a record already written. */
|
|
84
|
+
signal?: AbortSignal;
|
|
85
|
+
}
|
|
86
|
+
export interface LocalStepDurability {
|
|
87
|
+
/**
|
|
88
|
+
* Run `name` once and durably record its JSON result.
|
|
89
|
+
*
|
|
90
|
+
* The first execution runs `body` and appends the result to the ledger. A
|
|
91
|
+
* replay — a fresh process, or a second durability object built over the same
|
|
92
|
+
* store — decodes the record and returns it without calling `body` again.
|
|
93
|
+
*/
|
|
94
|
+
step<T extends z.infer<ReturnType<typeof z.json>>>(name: string, body: () => T | Promise<T>, options?: StepRunOptions): Promise<T>;
|
|
95
|
+
/** The decoded result of an already-recorded step, or `undefined` if none. */
|
|
96
|
+
readRecordedStep(name: string): Promise<unknown | undefined>;
|
|
97
|
+
/** Whether `name` has a recorded result. */
|
|
98
|
+
hasRecordedStep(name: string): Promise<boolean>;
|
|
99
|
+
/**
|
|
100
|
+
* Wait on a lightweight local timer for `seconds`, retaining a durable deadline.
|
|
101
|
+
*
|
|
102
|
+
* The first call records a park with an absolute deadline; a replay whose
|
|
103
|
+
* deadline has passed returns immediately, one before it waits out the
|
|
104
|
+
* remainder. `name` is the park's identity within the run and must be stable
|
|
105
|
+
* across replays. It defaults to the duration, so a caller that parks twice
|
|
106
|
+
* for the same length must pass distinct names.
|
|
107
|
+
*/
|
|
108
|
+
sleep(input: {
|
|
109
|
+
seconds: number;
|
|
110
|
+
name?: string;
|
|
111
|
+
}, options?: StepRunOptions): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Park the run until an external event `{ event, id }` is delivered.
|
|
114
|
+
*
|
|
115
|
+
* Resolves with the delivered payload. A waiter that starts after delivery
|
|
116
|
+
* returns immediately, as does a reconstruction that finds the delivery in
|
|
117
|
+
* the ledger.
|
|
118
|
+
*/
|
|
119
|
+
waitFor<T = unknown>(input: {
|
|
120
|
+
event: string;
|
|
121
|
+
id: string;
|
|
122
|
+
}, options?: StepRunOptions): Promise<T>;
|
|
123
|
+
/**
|
|
124
|
+
* Durably record an external event and wake any waiter for it.
|
|
125
|
+
*
|
|
126
|
+
* The record is append-only and survives a restart: reconstruction finds it
|
|
127
|
+
* and a `waitFor` for the same key resolves without a second delivery.
|
|
128
|
+
*/
|
|
129
|
+
deliver(input: {
|
|
130
|
+
event: string;
|
|
131
|
+
id: string;
|
|
132
|
+
payload?: unknown;
|
|
133
|
+
}): Promise<void>;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The record for `name` cannot be trusted.
|
|
137
|
+
*
|
|
138
|
+
* Thrown instead of re-running `body`: a body is arbitrary and often effectful,
|
|
139
|
+
* and a record that cannot be decoded is evidence the ledger is not what this
|
|
140
|
+
* run wrote, never evidence the step never ran.
|
|
141
|
+
*/
|
|
142
|
+
export declare class StepResultDecodeError extends Error {
|
|
143
|
+
constructor(message: string, options?: {
|
|
144
|
+
cause?: unknown;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/** A step body returned a value that cannot be represented as JSON. */
|
|
148
|
+
export declare class StepResultNotSerializableError extends Error {
|
|
149
|
+
constructor(stepName: string, cause: unknown);
|
|
150
|
+
}
|
|
151
|
+
/** The caller aborted before the step body was started. No record was written. */
|
|
152
|
+
export declare class StepAbortedError extends Error {
|
|
153
|
+
constructor(stepName: string);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* A park or delivered-event record cannot be trusted.
|
|
157
|
+
*
|
|
158
|
+
* Thrown instead of parking on a record whose shape is not ours: an
|
|
159
|
+
* undecodable park is evidence the ledger is not what this run wrote, never
|
|
160
|
+
* evidence the park never happened.
|
|
161
|
+
*/
|
|
162
|
+
export declare class ParkRecordDecodeError extends Error {
|
|
163
|
+
constructor(message: string, options?: {
|
|
164
|
+
cause?: unknown;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* A sleeping or waiting park was aborted before it was satisfied.
|
|
169
|
+
*
|
|
170
|
+
* No record is removed: the park stays in the ledger, so a later replay
|
|
171
|
+
* resumes from the same durable state instead of starting a new park.
|
|
172
|
+
*/
|
|
173
|
+
export declare class ParkAbortedError extends Error {
|
|
174
|
+
constructor(park: string);
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=durability-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durability-contract.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/durability-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC5E,UAAU,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACvE;AAED,4EAA4E;AAC5E,eAAO,MAAM,0BAA0B,oBAA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,KAAK,EAAE,OAAO,EAK3C;CACF;AAED,kFAAkF;AAClF,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,QAAQ,EAAE,MAAM,EAG3B;CACF;AAED;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAGzD;CACF;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,IAAI,EAAE,MAAM,EAGvB;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durability-json.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/durability-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoCxB,eAAO,MAAM,iBAAiB,qCAG7B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ParkEventPayload, type StepDurabilityLedger } from './durability-contract.js';
|
|
2
|
+
export declare function stepKey(conversationId: string, runId: string, stepName: string): string;
|
|
3
|
+
export declare function sleepParkKey(conversationId: string, runId: string, name: string): string;
|
|
4
|
+
export declare function waitParkKey(conversationId: string, runId: string, event: string, id: string): string;
|
|
5
|
+
export declare function parkEventKey(conversationId: string, payload: ParkEventPayload): string;
|
|
6
|
+
export declare function encodeStepResult(stepName: string, value: unknown): string;
|
|
7
|
+
export declare function encodeDeliveredPayload(event: string, id: string, payload: unknown): string;
|
|
8
|
+
export interface DurabilityLedgerView {
|
|
9
|
+
readonly steps: Map<string, unknown>;
|
|
10
|
+
readonly parks: Map<string, ParkEventPayload>;
|
|
11
|
+
readonly deliveries: Map<string, unknown>;
|
|
12
|
+
nextSeq: number;
|
|
13
|
+
}
|
|
14
|
+
/** Read every `durability/*` record in the conversation, keyed by durable key. */
|
|
15
|
+
export declare function readDurabilityLedger(store: StepDurabilityLedger, conversationId: string, view: DurabilityLedgerView): Promise<DurabilityLedgerView>;
|
|
16
|
+
//# sourceMappingURL=durability-ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durability-ledger.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/durability-ledger.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,gBAAgB,EAGrB,KAAK,oBAAoB,EAK1B,MAAM,uBAAuB,CAAC;AAG/B,wBAAgB,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvF;AAED,wBAAgB,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAExF;AAED,wBAAgB,WAAW,CACzB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,GACT,MAAM,CAER;AAED,wBAAgB,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAItF;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAWzE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAa1F;AAmED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC9C,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,kFAAkF;AAClF,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,oBAAoB,EAC3B,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CAsC/B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type DurabilityClock, type StepDurabilityLedger } from './durability-contract.js';
|
|
2
|
+
export declare const systemClock: DurabilityClock;
|
|
3
|
+
/**
|
|
4
|
+
* In-flight steps of one process, keyed by the full durable key and removed as
|
|
5
|
+
* soon as they settle.
|
|
6
|
+
*
|
|
7
|
+
* It is module-level rather than per-object so two durability objects built over
|
|
8
|
+
* the same store in one process cannot both start an effectful body. It cannot
|
|
9
|
+
* span processes: a second process is fenced by the run lease the runtime
|
|
10
|
+
* already holds, not by this map, and that is the boundary this local slice
|
|
11
|
+
* draws.
|
|
12
|
+
*/
|
|
13
|
+
export interface InFlightDurability {
|
|
14
|
+
steps: Map<string, Promise<unknown>>;
|
|
15
|
+
parks: Map<string, Promise<unknown>>;
|
|
16
|
+
waiters: Map<string, Set<() => void>>;
|
|
17
|
+
}
|
|
18
|
+
export declare const stores: WeakMap<StepDurabilityLedger, InFlightDurability>;
|
|
19
|
+
export declare function notifyWaiters(parkWaiters: InFlightDurability['waiters'], key: string): void;
|
|
20
|
+
export declare function waitForDeadline(clock: DurabilityClock, deadline: number, park: string, signal?: AbortSignal): Promise<void>;
|
|
21
|
+
interface ParkWaiter {
|
|
22
|
+
/** `'woke'` when a delivery notifies this park, `'aborted'` when the signal fires. */
|
|
23
|
+
readonly outcome: Promise<'woke' | 'aborted'>;
|
|
24
|
+
/** Remove this waiter from the registry; idempotent. */
|
|
25
|
+
cancel(): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function createParkWaiter(parkWaiters: InFlightDurability['waiters'], key: string, signal?: AbortSignal): ParkWaiter;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=durability-scheduler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durability-scheduler.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/durability-scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAC/B,eAAO,MAAM,WAAW,EAAE,eAOzB,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACrC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACrC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;CACvC;AACD,eAAO,MAAM,MAAM,mDAA0D,CAAC;AAE9E,wBAAgB,aAAa,CAAC,WAAW,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAI3F;AA2BD,wBAAsB,eAAe,CACnC,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,UAAU,UAAU;IAClB,sFAAsF;IACtF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC9C,wDAAwD;IACxD,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAC1C,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,WAAW,GACnB,UAAU,CA2BZ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type LocalStepDurability, type LocalStepDurabilityOptions } from './durability-contract.js';
|
|
2
|
+
export type { LocalStepDurability, LocalStepDurabilityOptions, StepDurabilityLedger, StepRunOptions, } from './durability-contract.js';
|
|
3
|
+
export { DURABILITY_STEP_EVENT_KIND, ParkAbortedError, ParkRecordDecodeError, StepAbortedError, StepResultDecodeError, StepResultNotSerializableError, } from './durability-contract.js';
|
|
4
|
+
/**
|
|
5
|
+
* A local step-durability port over an `AgentRuntimeStore`.
|
|
6
|
+
*
|
|
7
|
+
* Replaying is reading the ledger: nothing is kept between instances, so a
|
|
8
|
+
* fresh object over the same store resumes from the records that survived a
|
|
9
|
+
* process restart. Completed records are append-only — there is no deletion
|
|
10
|
+
* path — so cancellation cannot remove one, and a park that completed is never
|
|
11
|
+
* created a second time.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createLocalStepDurability(options: LocalStepDurabilityOptions): LocalStepDurability;
|
|
14
|
+
//# sourceMappingURL=durability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/durability.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAKhC,MAAM,uBAAuB,CAAC;AAkB/B,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,EACpB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,uBAAuB,CAAC;AAmB/B;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,GAClC,mBAAmB,CAqNrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-search.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/event-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,oBAAoB,CAAC;AAEtE,eAAO,MAAM,4BAA4B;;;;;kBAO9B,CAAC;AAEZ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"event-search.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/event-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,oBAAoB,CAAC;AAEtE,eAAO,MAAM,4BAA4B;;;;;kBAO9B,CAAC;AAEZ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AA0BlF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,QAAQ,EAAE,cAAc,CAAC;IACzB,qBAAqB,CAAC,CAAC,OAAO,EAAE;QAC9B,wBAAwB,EAAE,MAAM,CAAC;QACjC,oBAAoB,EAAE,MAAM,CAAC;KAC9B,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAChC,aACwB;IACrB,wBAAwB,EAAE,MAAM,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,KAAG,OAAO,CAAC,SAAS,sBAAsB,EAAE,CAAC,CAkE/C"}
|
|
@@ -124,12 +124,21 @@ export interface HeadlessAgentHarnessConfig<CONTEXT, TOOLS extends ToolSet> exte
|
|
|
124
124
|
contextWindow: number;
|
|
125
125
|
}): AgentPromptBudget | Promise<AgentPromptBudget>;
|
|
126
126
|
estimateResourceTokens?(text: string): AgentTokenCount | Promise<AgentTokenCount>;
|
|
127
|
+
/** Parent-owned children expose requests through pendingApprovals only, not presentation events/snapshots. */
|
|
128
|
+
blockingPresentation?: 'local' | 'parent';
|
|
127
129
|
limits?: Partial<AgentHarnessLimits>;
|
|
128
130
|
onProfile?(event: AgentHarnessProfileEvent): void | Promise<void>;
|
|
129
131
|
onProfileError?(input: {
|
|
130
132
|
event: AgentHarnessProfileEvent;
|
|
131
133
|
error: unknown;
|
|
132
134
|
}): void | Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Response-time authorization. It runs before a decision is written and may
|
|
137
|
+
* reject a responder without dropping the pending request, so a later valid
|
|
138
|
+
* responder can still answer. Absent means the signed request alone
|
|
139
|
+
* authorizes the response, exactly as before. → ADR 0177
|
|
140
|
+
*/
|
|
141
|
+
authorizeApprovalResponse?(input: AgentHarnessApprovalAuthorization): AgentHarnessApprovalAuthorizationResult | Promise<AgentHarnessApprovalAuthorizationResult>;
|
|
133
142
|
}
|
|
134
143
|
export interface HeadlessAgentHarness<CONTEXT> extends AgentRuntime<CONTEXT> {
|
|
135
144
|
snapshot(conversationId: string): Promise<AgentSnapshot>;
|
|
@@ -155,6 +164,34 @@ export interface AgentHarnessApprovalDecision<_CONTEXT = unknown> {
|
|
|
155
164
|
context: unknown;
|
|
156
165
|
metadata?: unknown;
|
|
157
166
|
}
|
|
167
|
+
/** One pending request as the response-time policy sees it. */
|
|
168
|
+
export interface AgentHarnessApprovalRequest {
|
|
169
|
+
approvalId: string;
|
|
170
|
+
callId: string;
|
|
171
|
+
toolName: string;
|
|
172
|
+
input: unknown;
|
|
173
|
+
}
|
|
174
|
+
export interface AgentHarnessApprovalAuthorization {
|
|
175
|
+
/**
|
|
176
|
+
* The identity the caller supplies for this decision. The harness does not
|
|
177
|
+
* authenticate it — the application wires its verified session principal
|
|
178
|
+
* here — but it is what the policy judges, never a field from the request body.
|
|
179
|
+
*/
|
|
180
|
+
responder: unknown;
|
|
181
|
+
conversationId: string;
|
|
182
|
+
request: AgentHarnessApprovalRequest;
|
|
183
|
+
approved: boolean;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* A response-time decision. `rejected` judges the responder, not the approval:
|
|
187
|
+
* the request stays pending and another responder may still answer it.
|
|
188
|
+
*/
|
|
189
|
+
export type AgentHarnessApprovalAuthorizationResult = {
|
|
190
|
+
status: 'allowed';
|
|
191
|
+
} | {
|
|
192
|
+
status: 'rejected';
|
|
193
|
+
reason: string;
|
|
194
|
+
};
|
|
158
195
|
export interface HarnessPromptProfile {
|
|
159
196
|
conversationId: string;
|
|
160
197
|
model: AgentResolvedModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-contract.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/harness-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAA8B,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAC1F,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEzD,eAAO,MAAM,8BAA8B;;;;EAA+C,CAAC;AAE3F,eAAO,MAAM,0BAA0B;;;;;;;;;kBAO5B,CAAC;AAEZ,eAAO,MAAM,oCAAoC;;;;;;;kBAMtC,CAAC;AAEZ,eAAO,MAAM,wBAAwB;;;;kBAM1B,CAAC;AAEZ,eAAO,MAAM,iCAAiC;;;;;;;;kBAE5C,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAWhC,CAAC;AAEZ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC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
import { type HeadlessAgentHarness, type HeadlessAgentHarnessConfig } from './harness-contract.js';
|
|
3
3
|
export * from './harness-contract.js';
|
|
4
4
|
export * from './harness-file-resources.js';
|
|
5
|
+
/**
|
|
6
|
+
* The response-time policy refused this responder. The pending request is left
|
|
7
|
+
* in place, so a different responder may still answer it. → ADR 0177
|
|
8
|
+
*/
|
|
9
|
+
export declare class AgentHarnessApprovalRejectedError extends Error {
|
|
10
|
+
readonly reason: string;
|
|
11
|
+
constructor(reason: string);
|
|
12
|
+
}
|
|
5
13
|
/**
|
|
6
14
|
* Compose the public AgentRuntime into a resource-aware process-local harness.
|
|
7
15
|
* The caller still owns supervision, model/provider policy, permissions and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/harness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAElC,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAChC,MAAM,oBAAoB,CAAC;AAU5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/harness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAElC,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAChC,MAAM,oBAAoB,CAAC;AAU5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AAEzC;;;GAGG;AACH,qBAAa,iCAAkC,SAAQ,KAAK;IAC1D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,YAAY,MAAM,EAAE,MAAM,EAIzB;CACF;AAcD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,KAAK,SAAS,OAAO,EACvE,MAAM,EAAE,0BAA0B,CAAC,OAAO,EAAE,KAAK,CAAC,GACjD,oBAAoB,CAAC,OAAO,CAAC,CA4P/B;AAED,cAAc,mBAAmB,CAAC"}
|
|
@@ -24,10 +24,19 @@ export type AgentTokenCount = z.infer<typeof AgentTokenCountSchema>;
|
|
|
24
24
|
export interface AgentPromptSectionContext<CONTEXT> {
|
|
25
25
|
context: CONTEXT;
|
|
26
26
|
signal: AbortSignal;
|
|
27
|
+
event: 'session.started' | 'turn.started';
|
|
27
28
|
}
|
|
28
29
|
export interface AgentPromptSection<CONTEXT> {
|
|
29
30
|
name: string;
|
|
30
31
|
stability: 'stable' | 'dynamic';
|
|
32
|
+
/**
|
|
33
|
+
* Authority of this section. `system` (default) is framework policy: it stays
|
|
34
|
+
* outside history and is rebuilt on every call. `user` is context an
|
|
35
|
+
* application, a provider or a memory produced — it reaches the model as
|
|
36
|
+
* ordinary user history, ahead of the durable conversation, never as system
|
|
37
|
+
* authority. → ADR 0178
|
|
38
|
+
*/
|
|
39
|
+
role?: 'system' | 'user';
|
|
31
40
|
render(input: AgentPromptSectionContext<CONTEXT>): string | Promise<string>;
|
|
32
41
|
estimateTokens?(text: string): AgentTokenCount | Promise<AgentTokenCount>;
|
|
33
42
|
}
|
|
@@ -43,9 +52,22 @@ export interface ComposedAgentPrompt {
|
|
|
43
52
|
sections: readonly {
|
|
44
53
|
name: string;
|
|
45
54
|
stability: 'stable' | 'dynamic';
|
|
55
|
+
role: 'system' | 'user';
|
|
56
|
+
text: string;
|
|
57
|
+
}[];
|
|
58
|
+
/**
|
|
59
|
+
* User-role sections, in declaration order. They are carried to the model as
|
|
60
|
+
* user history before the durable conversation, so `instructions` never
|
|
61
|
+
* contains them. Blank sections materialize nothing.
|
|
62
|
+
*/
|
|
63
|
+
userInstructions?: readonly {
|
|
64
|
+
name: string;
|
|
46
65
|
text: string;
|
|
47
66
|
}[];
|
|
48
67
|
instructionTokens: AgentTokenCount;
|
|
68
|
+
userInstructionTokens?: AgentTokenCount;
|
|
69
|
+
/** Reconcile the reservation after the runtime atomically seeds durable history. */
|
|
70
|
+
finalizeSeed?(inserted: boolean): Pick<ComposedAgentPrompt, 'contextDecision' | 'availableHistoryTokens'>;
|
|
49
71
|
availableHistoryTokens?: number;
|
|
50
72
|
contextDecision: 'fits' | 'requires-compaction' | 'oversized' | 'unavailable';
|
|
51
73
|
}
|
|
@@ -75,6 +97,7 @@ export declare function selectAgentHistory(options: SelectAgentHistoryOptions):
|
|
|
75
97
|
export interface ComposeAgentPromptOptions<CONTEXT> {
|
|
76
98
|
context: CONTEXT;
|
|
77
99
|
signal: AbortSignal;
|
|
100
|
+
event?: 'session.started' | 'turn.started';
|
|
78
101
|
budget?: AgentPromptBudget;
|
|
79
102
|
historyTokens?: AgentTokenCount;
|
|
80
103
|
oversizePolicy?: 'reject' | 'compact';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,YAAY,EAAyB,MAAM,WAAW,CAAC;AACrE,OAAO,EACL,KAAK,0BAA0B,EAGhC,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;iBAQhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,MAAM,WAAW,yBAAyB,CAAC,OAAO;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACvC,OAAO,EAAE,C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sB,kBAAkB,CACtC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CAkHnC;AAED,MAAM,WAAW,yBAAyB,CAAC,OAAO;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,CAAC,EAAE,iBAAiB,GAAG,cAAc,CAAC;IAC3C,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,cAAc,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACtC,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAChF,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC5E;AAMD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,kBAAkB,CAAC,OAAO,CAAC,EAAE,aACnE,yBAAyB,CAAC,OAAO,CAAC,KAAG,OAAO,CAAC,mBAAmB,CAAC,CAwIzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-execution.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/run-execution.ts"],"names":[],"mappings":"AAEA,OAAO,EAQL,KAAK,OAAO,EACb,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"run-execution.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/run-execution.ts"],"names":[],"mappings":"AAEA,OAAO,EAQL,KAAK,OAAO,EACb,MAAM,IAAI,CAAC;AAQZ,OAAO,EAAE,KAAK,iBAAiB,EAAuB,MAAM,UAAU,CAAC;AAEvE,OAAO,KAAK,EAAwB,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAShF,OAAO,KAAK,EAAqB,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAcvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAKL,KAAK,QAAQ,EAOd,MAAM,WAAW,CAAC;AA+EnB,8DAA8D;AAC9D,MAAM,WAAW,uBAAuB,CAAC,OAAO,EAAE,KAAK,SAAS,OAAO;IACrE,MAAM,EAAE,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3C,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,IAAI,MAAM,CAAC;IACrB,GAAG,IAAI,IAAI,CAAC;IACZ,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;CACpC;AA0DD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,KAAK,SAAS,OAAO,EAC9D,YAAY,EAAE,uBAAuB,CAAC,OAAO,EAAE,KAAK,CAAC,WAcb;IACtC,WAAW,EAAE,QAAQ,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IACpB,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAC;IACZ,gFAAgF;IAChF,UAAU,CAAC,IAAI,IAAI,CAAC;CACrB,KAAG,OAAO,CAAC,kBAAkB,CAAC,CAw8ChC"}
|
|
@@ -79,6 +79,10 @@ export declare function normalizeSdkUsage(value: LanguageModelUsage): AgentUsage
|
|
|
79
79
|
export declare function createIdleDeadline(parent: AbortSignal, timeoutMs: number | undefined): {
|
|
80
80
|
signal: AbortSignal;
|
|
81
81
|
touch: () => void;
|
|
82
|
+
start: () => void;
|
|
83
|
+
stop: () => void;
|
|
84
|
+
suspend: () => void;
|
|
85
|
+
resume: () => void;
|
|
82
86
|
dispose: () => void;
|
|
83
87
|
};
|
|
84
88
|
//# sourceMappingURL=runtime-internals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-internals.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/runtime-internals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,KAAK,gBAAgB,EAGrB,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AAGnB;;;;;GAKG;AAEH,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAI1E;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAG5E;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO;;;;cAI9C;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS;;;EAKhF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAQxE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,mBAAmB,CAK5E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU,CAuDpF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,UAAU,GAAG,SAAS,GAClC,UAAU,CAiBZ;AAED;;;;;;;;;GASG;AACH,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AAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU,CAuDpF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,UAAU,GAAG,SAAS,GAClC,UAAU,CAiBZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAYrE;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,IAAI,UAAU,CAUzC;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,GAAG,UAAU,CAmBvE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS;;iBAEhE,IAAI;;;;;;EAgDxB"}
|
|
@@ -4,6 +4,7 @@ import type { ToolLifecycle } from '../tools/execute.js';
|
|
|
4
4
|
import type { AgentChildManager } from './children.js';
|
|
5
5
|
import type { AgentCompactionResult } from './compaction.js';
|
|
6
6
|
import { type AgentInputPolicy, type AgentSessionCloseOptions, type AgentSessionCloseResult, type AgentStopReason } from './coordinator.js';
|
|
7
|
+
import type { LocalStepDurability } from './durability.js';
|
|
7
8
|
import { type AgentRuntimeEvent, type AgentRuntimePublisher } from './events.js';
|
|
8
9
|
import type { AgentHistoryProjectionOptions } from './history.js';
|
|
9
10
|
import type { AgentResolvedModel } from './models.js';
|
|
@@ -134,6 +135,15 @@ export type AgentRuntimePrepareStep<CONTEXT, TOOLS extends ToolSet = ToolSet> =
|
|
|
134
135
|
export interface AgentRuntimeConfig<CONTEXT, TOOLS extends ToolSet = ToolSet> {
|
|
135
136
|
protocol: AgentRuntimeProtocolInput<CONTEXT>;
|
|
136
137
|
store: AgentRuntimeStore;
|
|
138
|
+
/** Tool-call durability; the host retains process placement and cross-process run leases. */
|
|
139
|
+
durability?: true | ((input: {
|
|
140
|
+
store: AgentRuntimeStore;
|
|
141
|
+
conversationId: string;
|
|
142
|
+
runId: string;
|
|
143
|
+
toolName: string;
|
|
144
|
+
toolCallId: string;
|
|
145
|
+
signal?: AbortSignal;
|
|
146
|
+
}) => LocalStepDurability);
|
|
137
147
|
models: {
|
|
138
148
|
preflight?(input: {
|
|
139
149
|
context: CONTEXT;
|
|
@@ -149,6 +159,7 @@ export interface AgentRuntimeConfig<CONTEXT, TOOLS extends ToolSet = ToolSet> {
|
|
|
149
159
|
prompt(input: {
|
|
150
160
|
context: CONTEXT;
|
|
151
161
|
signal: AbortSignal;
|
|
162
|
+
event: 'session.started' | 'turn.started';
|
|
152
163
|
model: AgentResolvedModel;
|
|
153
164
|
snapshot: AgentSnapshot;
|
|
154
165
|
}): ComposedAgentPrompt | Promise<ComposedAgentPrompt>;
|
|
@@ -164,6 +175,8 @@ export interface AgentRuntimeConfig<CONTEXT, TOOLS extends ToolSet = ToolSet> {
|
|
|
164
175
|
/**
|
|
165
176
|
* How long the provider stream may produce nothing before the run is ended
|
|
166
177
|
* as `timeout`. Default 60 000; `null` disables it.
|
|
178
|
+
* Starts at the provider-call boundary and pauses during local tool execution.
|
|
179
|
+
* Preparation and approval waiting are outside this clock; tool deadlines are host-owned.
|
|
167
180
|
*
|
|
168
181
|
* There used to be no default, so a hung provider held the conversation's
|
|
169
182
|
* lane forever — the guide states the consequence itself ("a hung
|