stitchkit 0.98.2 → 0.100.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.
Files changed (143) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/dist/agent-runtime/contained-darwin.d.ts +0 -17
  3. package/dist/agent-runtime/contained-darwin.d.ts.map +1 -1
  4. package/dist/agent-runtime/contained-write.d.ts.map +1 -1
  5. package/dist/agent-runtime/invocation-attempt.d.ts +22 -0
  6. package/dist/agent-runtime/invocation-attempt.d.ts.map +1 -0
  7. package/dist/agent-runtime/invocation-failure.d.ts +6 -0
  8. package/dist/agent-runtime/invocation-failure.d.ts.map +1 -0
  9. package/dist/agent-runtime/invocation-payload.d.ts +18 -0
  10. package/dist/agent-runtime/invocation-payload.d.ts.map +1 -0
  11. package/dist/agent-runtime/invocation-read.d.ts +131 -0
  12. package/dist/agent-runtime/invocation-read.d.ts.map +1 -0
  13. package/dist/agent-runtime/invocation-schema.d.ts +378 -0
  14. package/dist/agent-runtime/invocation-schema.d.ts.map +1 -0
  15. package/dist/agent-runtime/invocations.d.ts +46 -0
  16. package/dist/agent-runtime/invocations.d.ts.map +1 -0
  17. package/dist/agent-runtime/run-acquisition.d.ts.map +1 -1
  18. package/dist/agent-runtime/run-execution-state.d.ts +4 -2
  19. package/dist/agent-runtime/run-execution-state.d.ts.map +1 -1
  20. package/dist/agent-runtime/run-execution.d.ts.map +1 -1
  21. package/dist/agent-runtime/run-failure.d.ts.map +1 -1
  22. package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -1
  23. package/dist/agent-runtime/run-operation-lifecycle.d.ts +2 -2
  24. package/dist/agent-runtime/run-operation-lifecycle.d.ts.map +1 -1
  25. package/dist/agent-runtime/run-provider-ledger.d.ts +1 -0
  26. package/dist/agent-runtime/run-provider-ledger.d.ts.map +1 -1
  27. package/dist/agent-runtime/runtime.d.ts +11 -0
  28. package/dist/agent-runtime/runtime.d.ts.map +1 -1
  29. package/dist/agent-runtime/store-create.d.ts.map +1 -1
  30. package/dist/agent-runtime/store-event-once.d.ts +29 -0
  31. package/dist/agent-runtime/store-event-once.d.ts.map +1 -0
  32. package/dist/agent-runtime/store.d.ts +5 -0
  33. package/dist/agent-runtime/store.d.ts.map +1 -1
  34. package/dist/application/change-subscription.d.ts +36 -0
  35. package/dist/application/change-subscription.d.ts.map +1 -0
  36. package/dist/application/diagnostic-journal-contract.d.ts +3 -6
  37. package/dist/application/diagnostic-journal-contract.d.ts.map +1 -1
  38. package/dist/application/notification-delivery.d.ts +32 -0
  39. package/dist/application/notification-delivery.d.ts.map +1 -0
  40. package/dist/application/notification-outbox-state.d.ts +37 -0
  41. package/dist/application/notification-outbox-state.d.ts.map +1 -0
  42. package/dist/application/notification-outbox.d.ts +7 -1
  43. package/dist/application/notification-outbox.d.ts.map +1 -1
  44. package/dist/application/watch-hub-core.d.ts +10 -15
  45. package/dist/application/watch-hub-core.d.ts.map +1 -1
  46. package/dist/application/watch-hub.d.ts +10 -2
  47. package/dist/application/watch-hub.d.ts.map +1 -1
  48. package/dist/browser/session-credentials.d.ts +20 -0
  49. package/dist/browser/session-credentials.d.ts.map +1 -0
  50. package/dist/browser/session.d.ts +31 -0
  51. package/dist/browser/session.d.ts.map +1 -0
  52. package/dist/durability/events.d.ts +6 -0
  53. package/dist/durability/events.d.ts.map +1 -1
  54. package/dist/entrypoints/agent-runtime/coding-tools.js +5 -4
  55. package/dist/entrypoints/agent-runtime/harness.js +8 -6
  56. package/dist/entrypoints/agent-runtime/sandbox.js +5 -4
  57. package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
  58. package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
  59. package/dist/entrypoints/agent-runtime/testing.js +3 -3
  60. package/dist/entrypoints/agent-runtime.d.ts +3 -0
  61. package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
  62. package/dist/entrypoints/agent-runtime.js +21 -10
  63. package/dist/entrypoints/application/diagnostic-journal.js +2 -1
  64. package/dist/entrypoints/application.d.ts +3 -1
  65. package/dist/entrypoints/application.d.ts.map +1 -1
  66. package/dist/entrypoints/application.js +629 -189
  67. package/dist/entrypoints/cli.js +6 -6
  68. package/dist/entrypoints/files.js +2 -1
  69. package/dist/entrypoints/index.d.ts +2 -0
  70. package/dist/entrypoints/index.d.ts.map +1 -1
  71. package/dist/entrypoints/index.js +172 -0
  72. package/dist/entrypoints/live.js +68 -13
  73. package/dist/entrypoints/react.d.ts +1 -1
  74. package/dist/entrypoints/react.d.ts.map +1 -1
  75. package/dist/entrypoints/react.js +59 -16
  76. package/dist/entrypoints/testing.js +1 -1
  77. package/dist/entrypoints/tools/connections.js +2 -2
  78. package/dist/entrypoints/tools/invoker.js +4 -4
  79. package/dist/entrypoints/tools.js +8 -8
  80. package/dist/{index-wsm5w4ee.js → index-0b1cnze2.js} +35 -3
  81. package/dist/{index-np4m8hd3.js → index-0r0fbk7z.js} +9 -7
  82. package/dist/{index-p9sh0xx4.js → index-5p2m7we1.js} +3 -3
  83. package/dist/{index-55hkhm67.js → index-8qt2m66q.js} +1 -1
  84. package/dist/{index-hmp4800j.js → index-9t3dffv2.js} +3 -3
  85. package/dist/{index-khtgb21r.js → index-bm5rx7n6.js} +2 -2
  86. package/dist/{index-gxrt5h6v.js → index-cyktc4bp.js} +3 -0
  87. package/dist/{index-xw3s75nj.js → index-d8m8zpd8.js} +1 -1
  88. package/dist/{index-px2gm2jp.js → index-fhwqwxe0.js} +17 -55
  89. package/dist/{index-het2he5g.js → index-gw8bmyaj.js} +5 -3
  90. package/dist/{index-8p52kd5p.js → index-js7gqrb1.js} +96 -14
  91. package/dist/{index-wt743f7f.js → index-k6gpggb9.js} +2 -1
  92. package/dist/index-q3pyb9n0.js +22 -0
  93. package/dist/{index-f1nb70ae.js → index-r066jx76.js} +4 -4
  94. package/dist/{index-sp1tzwnb.js → index-s84he4v7.js} +2 -2
  95. package/dist/{index-863ea9jb.js → index-sh3s86na.js} +3 -3
  96. package/dist/{index-nts4a2br.js → index-xwhjjw2x.js} +879 -280
  97. package/dist/{index-1m2thnq0.js → index-y9qn426m.js} +2 -2
  98. package/dist/index-zjjyynm3.js +42 -0
  99. package/dist/internal/coalesced-task.d.ts +15 -0
  100. package/dist/internal/coalesced-task.d.ts.map +1 -0
  101. package/dist/internal/darwin-binding.d.ts +19 -0
  102. package/dist/internal/darwin-binding.d.ts.map +1 -0
  103. package/dist/internal/exclusive-lock.d.ts +20 -7
  104. package/dist/internal/exclusive-lock.d.ts.map +1 -1
  105. package/dist/internal/mutation-queue.d.ts +4 -0
  106. package/dist/internal/mutation-queue.d.ts.map +1 -0
  107. package/dist/internal/process-identity.d.ts +1 -1
  108. package/dist/internal/process-identity.d.ts.map +1 -1
  109. package/dist/internal/process-instance.d.ts +26 -0
  110. package/dist/internal/process-instance.d.ts.map +1 -0
  111. package/dist/live/watch-client-state.d.ts +71 -0
  112. package/dist/live/watch-client-state.d.ts.map +1 -0
  113. package/dist/live/watch-client.d.ts +5 -1
  114. package/dist/live/watch-client.d.ts.map +1 -1
  115. package/dist/live/watch-contract.d.ts +12 -0
  116. package/dist/live/watch-contract.d.ts.map +1 -1
  117. package/dist/react/cache-bridge.d.ts +10 -0
  118. package/dist/react/cache-bridge.d.ts.map +1 -1
  119. package/dist/tools/schema/flatten-join.d.ts.map +1 -1
  120. package/llms/agent-runtime.2.txt +94 -0
  121. package/llms/agent-runtime.3.txt +24 -0
  122. package/llms/application.2.txt +68 -2
  123. package/llms/application.txt +32 -2
  124. package/llms/files.txt +1 -1
  125. package/llms/live.txt +7 -0
  126. package/llms/react.txt +8 -0
  127. package/llms/server.3.txt +35 -0
  128. package/llms/stitchkit.2.txt +41 -0
  129. package/llms/stitchkit.3.txt +22 -0
  130. package/llms/stitchkit.txt +3 -3
  131. package/llms/tools.txt +9 -8
  132. package/llms/upgrading-0.37.0.txt +176 -0
  133. package/llms/{upgrading-0.37.0-0.58.0.txt → upgrading-0.44.0-0.60.0.txt} +229 -169
  134. package/llms/{upgrading-0.59.0-0.71.0.txt → upgrading-0.61.0-0.73.0.txt} +122 -229
  135. package/llms/{upgrading-0.72.0-0.98.0.txt → upgrading-0.74.0-0.100.0.txt} +96 -122
  136. package/llms/upgrading.txt +4 -3
  137. package/llms-full.txt +431 -14
  138. package/llms.txt +11 -10
  139. package/native/darwin-arm64.node +0 -0
  140. package/native/darwin-x64.node +0 -0
  141. package/package.json +1 -1
  142. package/dist/agent-runtime/run-mutation-queue.d.ts +0 -21
  143. package/dist/agent-runtime/run-mutation-queue.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -15,6 +15,69 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.100.0] — 2026-09-28
19
+
20
+ ### ⚠️ Breaking changes
21
+
22
+ - `stitchkit/application`, `stitchkit/live` — watched reads now enforce finite
23
+ capacity by default: 1024 hub sources, 1024 hub subscribers, 1024 client keys
24
+ and 128 listeners per key. Excess admission is refused instead of retaining
25
+ unbounded state. Before: `createWatchHub({ read, watchable })` admitted an
26
+ unlimited number of hub sources/subscribers. After, for a larger workload:
27
+ `createWatchHub({ read, watchable, maxSources: 4096, maxSubscribers: 4096 })`.
28
+ Set `maxKeys` and `maxListenersPerKey` on `createWatchClient` when needed.
29
+ See ADR 0208 and the 0.100.0 migration in `docs/guide/upgrading.md`.
30
+
31
+ **Who must act:** watch consumers whose hub or client exceeds these defaults.
32
+ Choose explicit finite limits for the expected workload. Other consumers may
33
+ keep their existing configuration; new session and delivery APIs are opt-in.
34
+
35
+ ### Added
36
+
37
+ - `stitchkit` — `createSessionScope` fences requests and final delivery by login
38
+ lifetime; `createSessionCredentials` coordinates refresh and credential writes.
39
+ - `stitchkit/application` — managed change subscriptions with bounded keys,
40
+ reconnect and periodic reconciliation; watch admission scopes and capacity limits;
41
+ optional outbox action checkpoints and a separate projection receipt.
42
+ - `stitchkit/live`, `stitchkit/react` — session-scoped watch instances and explicit
43
+ watched-handle/cache bindings. Hub reconciliation can repair lost hints without
44
+ reconnect. Existing non-session watches and single-send outboxes remain supported.
45
+
46
+ - `stitchkit/agent-runtime` — public `createModelInvocationLedger` for plain text
47
+ completions and shared agent provider receipts, with atomic idempotent admission,
48
+ verified caller context, explicit fallback attempts, transport correlation IDs,
49
+ provenance-aware usage and encrypted payload artifacts in the existing store.
50
+ Opt in with the runtime `invocations` option. See ADR 0206 and the
51
+ [migration example](docs/guide/agent-runtime.md#plain-completions-and-shared-invocation-receipts).
52
+
53
+ ### Fixed
54
+
55
+ - `stitchkit/files`, `stitchkit/application` — exclusive locks and journal reclaim
56
+ guards identify the owning boot and process lifetime, so a PID reused after a
57
+ crash or reboot no longer impersonates an abandoned owner. Linux uses proc
58
+ start ticks and namespaces; macOS uses the packaged native kernel probe.
59
+ Unknown identity refuses takeover. Legacy records retain conservative PID
60
+ checks and require operator recovery when a live PID has been reused. See ADR 0210.
61
+
62
+ ## [0.99.0] — 2026-09-27
63
+
64
+ ### ⚠️ Breaking changes
65
+
66
+ - `stitchkit/tools` — `flattenUnionInput` preserves object properties and typed
67
+ array items when discriminated-union variants share a field with different
68
+ structures. Flat mode no longer guarantees the absence of nested `anyOf`.
69
+ Before: a collided object/array field was `{ type: ['object', 'array'] }`.
70
+ After: `{ anyOf: [{ type: 'object', properties: ... }, { type: 'array', items: ... }] }`.
71
+ The containing union stays an object and the original contract still validates
72
+ execution. Schema consumers must traverse these nested alternatives; no
73
+ contract changes or global flatten opt-out are needed. This avoids provider
74
+ rejection of array schemas with missing `items`. See
75
+ [ADR 0205](docs/decisions/0205-flat-tool-collisions-retain-structural-alternatives.md).
76
+
77
+ **Who must act:** users of `flattenUnionInput: true` whose schema walkers,
78
+ snapshots or provider restrictions assume no nested `anyOf`. Other consumers
79
+ only update the dependency; runtime input validation is unchanged.
80
+
18
81
  ## [0.98.2] — 2026-09-27
19
82
 
20
83
  ### Fixed
@@ -5,27 +5,10 @@
5
5
  */
6
6
  import { type Stats } from 'node:fs';
7
7
  import type { ContainedFileHandle } from './contained-files.js';
8
- export interface DarwinEntry {
9
- name: string;
10
- mode: number;
11
- size: number;
12
- }
13
- export interface DarwinBinding {
14
- openDirectoryAt(directory: number, name: string): number;
15
- openFileAt(directory: number, name: string): number;
16
- createFileAt(directory: number, name: string, mode: number): number;
17
- createDirectoryAt(directory: number, name: string, mode: number): boolean;
18
- statAt(directory: number, name: string): Omit<DarwinEntry, 'name'> | null;
19
- listAt(directory: number): readonly DarwinEntry[];
20
- renameAt(directory: number, source: string, target: string): void;
21
- unlinkAt(directory: number, name: string): void;
22
- }
23
8
  export declare const FILE_TYPE_DIRECTORY = 16384;
24
9
  export declare const FILE_TYPE_REGULAR = 32768;
25
10
  export declare const FILE_TYPE_SYMLINK = 40960;
26
11
  export declare function modeIs(mode: number, type: number): boolean;
27
- export declare function hasFunctions(value: unknown, names: readonly string[]): boolean;
28
- export declare function loadDarwinBinding(): DarwinBinding;
29
12
  export declare class NumericFileHandle implements ContainedFileHandle {
30
13
  readonly fd: number;
31
14
  constructor(fd: number);
@@ -1 +1 @@
1
- {"version":3,"file":"contained-darwin.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/contained-darwin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAKL,KAAK,KAAK,EACX,MAAM,SAAS,CAAC;AAKjB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACzD,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACpD,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACpE,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1E,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAC1E,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,WAAW,EAAE,CAAC;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAClE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACjD;AAGD,eAAO,MAAM,mBAAmB,QAAW,CAAC;AAC5C,eAAO,MAAM,iBAAiB,QAAW,CAAC;AAC1C,eAAO,MAAM,iBAAiB,QAAW,CAAC;AAE1C,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAM9E;AAID,wBAAgB,iBAAiB,IAAI,aAAa,CA+BjD;AAED,qBAAa,iBAAkB,YAAW,mBAAmB;IAC/C,QAAQ,CAAC,EAAE,EAAE,MAAM;IAA/B,YAAqB,EAAE,EAAE,MAAM,EAAI;IAEnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAIrB;IAED,IAAI,CACF,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAMhC;IAED,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,CAIrB;CACF"}
1
+ {"version":3,"file":"contained-darwin.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/contained-darwin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAA2D,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,eAAO,MAAM,mBAAmB,QAAW,CAAC;AAC5C,eAAO,MAAM,iBAAiB,QAAW,CAAC;AAC1C,eAAO,MAAM,iBAAiB,QAAW,CAAC;AAE1C,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,qBAAa,iBAAkB,YAAW,mBAAmB;IAC/C,QAAQ,CAAC,EAAE,EAAE,MAAM;IAA/B,YAAqB,EAAE,EAAE,MAAM,EAAI;IAEnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAIrB;IAED,IAAI,CACF,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAMhC;IAED,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,CAIrB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"contained-write.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/contained-write.ts"],"names":[],"mappings":"AAUA,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,mBAAmB,CAAC;AAsD3B,0FAA0F;AAC1F,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,IAAI,CAAC,CAsChB"}
1
+ {"version":3,"file":"contained-write.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/contained-write.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,mBAAmB,CAAC;AAsD3B,0FAA0F;AAC1F,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,IAAI,CAAC,CAsChB"}
@@ -0,0 +1,22 @@
1
+ import { type LanguageModel } from 'ai';
2
+ import type { z } from 'zod';
3
+ import type { createInvocationPayloads } from './invocation-payload.js';
4
+ import type { InvocationProcessSchema, ModelInvocationAttemptContext, ModelInvocationRecord } from './invocation-schema.js';
5
+ import type { AgentResolvedModel } from './models.js';
6
+ /** Available inside the provider's fetch/transport; no time/model-name correlation. */
7
+ export declare function currentModelInvocationAttempt(): ModelInvocationAttemptContext | undefined;
8
+ export interface InvocationAttemptWriter {
9
+ identity: {
10
+ conversationId: string;
11
+ invocationId: string;
12
+ operationId: string;
13
+ runId?: string;
14
+ };
15
+ process: z.infer<typeof InvocationProcessSchema>;
16
+ payloads: ReturnType<typeof createInvocationPayloads>;
17
+ append(record: ModelInvocationRecord): Promise<void>;
18
+ onAttempt?(context: ModelInvocationAttemptContext): void | Promise<void>;
19
+ }
20
+ /** The single audited provider boundary, used by completion and the existing agent loop. */
21
+ export declare function wrapInvocationModel(writer: InvocationAttemptWriter, selected: AgentResolvedModel, step: number, model?: LanguageModel): LanguageModel;
22
+ //# sourceMappingURL=invocation-attempt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invocation-attempt.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/invocation-attempt.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAmD,MAAM,IAAI,CAAC;AACzF,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,KAAK,EACV,uBAAuB,EACvB,6BAA6B,EAC7B,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AASnD,uFAAuF;AACvF,wBAAgB,6BAA6B,IAAI,6BAA6B,GAAG,SAAS,CAGzF;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE;QACR,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;IACjD,QAAQ,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;IACtD,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,SAAS,CAAC,CAAC,OAAO,EAAE,6BAA6B,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1E;AAED,4FAA4F;AAC5F,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,uBAAuB,EAC/B,QAAQ,EAAE,kBAAkB,EAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,aAA8B,GACpC,aAAa,CAsLf"}
@@ -0,0 +1,6 @@
1
+ /** Receipt/storage/audit refusals belong to the runtime, never to the upstream provider. */
2
+ export declare class InvocationReceiptError extends Error {
3
+ constructor(cause: unknown);
4
+ }
5
+ export declare function invocationAudit<T>(work: () => Promise<T>): Promise<T>;
6
+ //# sourceMappingURL=invocation-failure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invocation-failure.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/invocation-failure.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,KAAK,EAAE,OAAO,EAGzB;CACF;AACD,wBAAsB,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAM3E"}
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import type { AgentRuntimeStore } from './store.js';
3
+ /** Serialize SDK payloads at the typed external boundary, retaining binary bytes privately. */
4
+ export declare function invocationJson(value: unknown): z.JSONType;
5
+ export declare function invocationHash(value: unknown): string;
6
+ export declare function createInvocationPayloads(store: AgentRuntimeStore, key: Uint8Array, maxBytes: number): {
7
+ write(identity: {
8
+ conversationId: string;
9
+ invocationId: string;
10
+ operationId: string;
11
+ runId?: string;
12
+ }, value: unknown): Promise<{
13
+ artifactId: `${string}-${string}-${string}-${string}-${string}`;
14
+ sha256: string;
15
+ }>;
16
+ decrypt(conversationId: string, value: unknown): z.JSONType;
17
+ };
18
+ //# sourceMappingURL=invocation-payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invocation-payload.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/invocation-payload.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,+FAA+F;AAC/F,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,cAc5C;AACD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIrD;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,iBAAiB,EACxB,GAAG,EAAE,UAAU,EACf,QAAQ,EAAE,MAAM;IAMR,KAAK,WACC;QACR,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,SACM,OAAO;;;;IA+BhB,OAAO,iBAAiB,MAAM,SAAS,OAAO;EAgCjD"}
@@ -0,0 +1,131 @@
1
+ import { z } from 'zod';
2
+ import type { createInvocationPayloads } from './invocation-payload.js';
3
+ import type { AgentRuntimeStore } from './store.js';
4
+ export declare const InvocationReadInputSchema: z.ZodObject<{
5
+ conversationId: z.ZodString;
6
+ fromSeq: z.ZodOptional<z.ZodInt>;
7
+ limit: z.ZodInt;
8
+ }, z.core.$strict>;
9
+ export declare function readInvocationRecords(store: AgentRuntimeStore, input: z.infer<typeof InvocationReadInputSchema>): Promise<{
10
+ items: {
11
+ seq: number;
12
+ occurredAt: string;
13
+ record: {
14
+ conversationId: string;
15
+ invocationId: string;
16
+ operationId: string;
17
+ runId?: string | undefined;
18
+ type: "invocation/started";
19
+ mode: "agent" | "completion";
20
+ trace: {
21
+ operationId: string;
22
+ purpose: string;
23
+ project: string;
24
+ parent?: {
25
+ traceId: string;
26
+ invocationId?: string | undefined;
27
+ } | undefined;
28
+ experiment?: string | undefined;
29
+ case?: string | undefined;
30
+ profile?: string | undefined;
31
+ };
32
+ caller: {
33
+ subject: string;
34
+ };
35
+ executingProcess: {
36
+ instanceId: string;
37
+ pid: number;
38
+ hostname: string;
39
+ };
40
+ fingerprint: string;
41
+ requested: {
42
+ models: string[];
43
+ payloadSha256: string;
44
+ };
45
+ } | {
46
+ conversationId: string;
47
+ invocationId: string;
48
+ operationId: string;
49
+ runId?: string | undefined;
50
+ attemptId: string;
51
+ step: number;
52
+ type: "provider/request";
53
+ requested: {
54
+ modelId: string;
55
+ provider: string;
56
+ };
57
+ executingProcess: {
58
+ instanceId: string;
59
+ pid: number;
60
+ hostname: string;
61
+ };
62
+ sent: {
63
+ modelId: string;
64
+ provider: string;
65
+ payloadSha256: string;
66
+ artifactId: string;
67
+ tools: number;
68
+ };
69
+ } | {
70
+ conversationId: string;
71
+ invocationId: string;
72
+ operationId: string;
73
+ runId?: string | undefined;
74
+ attemptId: string;
75
+ step: number;
76
+ type: "provider/response";
77
+ status: "cancelled" | "failed" | "succeeded";
78
+ effective: {
79
+ provider: string | null;
80
+ modelId: string | null;
81
+ responseId: string | null;
82
+ };
83
+ usage: {
84
+ inputTokens: {
85
+ value?: number | undefined;
86
+ provenance: "computed" | "estimated" | "provider-reported" | "unavailable";
87
+ };
88
+ outputTokens: {
89
+ value?: number | undefined;
90
+ provenance: "computed" | "estimated" | "provider-reported" | "unavailable";
91
+ };
92
+ reasoningTokens?: {
93
+ value?: number | undefined;
94
+ provenance: "computed" | "estimated" | "provider-reported" | "unavailable";
95
+ } | undefined;
96
+ cacheReadTokens?: {
97
+ value?: number | undefined;
98
+ provenance: "computed" | "estimated" | "provider-reported" | "unavailable";
99
+ } | undefined;
100
+ cacheWriteTokens?: {
101
+ value?: number | undefined;
102
+ provenance: "computed" | "estimated" | "provider-reported" | "unavailable";
103
+ } | undefined;
104
+ cost?: {
105
+ value?: number | undefined;
106
+ currency?: string | undefined;
107
+ provenance: "computed" | "estimated" | "provider-reported" | "unavailable";
108
+ } | undefined;
109
+ };
110
+ artifactId: string;
111
+ payloadSha256: string;
112
+ } | {
113
+ conversationId: string;
114
+ invocationId: string;
115
+ operationId: string;
116
+ runId?: string | undefined;
117
+ type: "invocation/finished";
118
+ failure?: {
119
+ artifactId: string;
120
+ payloadSha256: string;
121
+ } | undefined;
122
+ status: "cancelled" | "failed" | "succeeded";
123
+ };
124
+ }[];
125
+ nextSeq?: number | undefined;
126
+ }>;
127
+ export declare function readInvocationPayload(store: AgentRuntimeStore, payloads: ReturnType<typeof createInvocationPayloads>, input: {
128
+ conversationId: string;
129
+ artifactId: string;
130
+ }): Promise<z.JSONType>;
131
+ //# sourceMappingURL=invocation-read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invocation-read.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/invocation-read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,eAAO,MAAM,yBAAyB;;;;kBAM3B,CAAC;AAEZ,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BjD;AAED,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,EACrD,KAAK,EAAE;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,uBAkBtD"}