stitchkit 0.124.5 → 0.126.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 (107) hide show
  1. package/CHANGELOG.md +99 -1
  2. package/dist/agent-runtime/branch-contract.d.ts +5 -0
  3. package/dist/agent-runtime/branch-contract.d.ts.map +1 -1
  4. package/dist/agent-runtime/branch-identities.d.ts +18 -0
  5. package/dist/agent-runtime/branch-identities.d.ts.map +1 -1
  6. package/dist/agent-runtime/branch-messages.d.ts +9 -2
  7. package/dist/agent-runtime/branch-messages.d.ts.map +1 -1
  8. package/dist/agent-runtime/branch-provider.d.ts.map +1 -1
  9. package/dist/agent-runtime/branch-source.d.ts +1 -1
  10. package/dist/agent-runtime/branch-source.d.ts.map +1 -1
  11. package/dist/agent-runtime/store-branch.d.ts.map +1 -1
  12. package/dist/agent-runtime/store-conformance-branch.d.ts.map +1 -1
  13. package/dist/application/watch-hub-core.d.ts +2 -1
  14. package/dist/application/watch-hub-core.d.ts.map +1 -1
  15. package/dist/application/watch-hub-source.d.ts +2 -0
  16. package/dist/application/watch-hub-source.d.ts.map +1 -1
  17. package/dist/application/watch-hub.d.ts +20 -1
  18. package/dist/application/watch-hub.d.ts.map +1 -1
  19. package/dist/entrypoints/agent-runtime/coding-tools.js +4 -4
  20. package/dist/entrypoints/agent-runtime/harness.js +4 -4
  21. package/dist/entrypoints/agent-runtime/sandbox.js +4 -4
  22. package/dist/entrypoints/agent-runtime/sqlite/bun.js +6 -6
  23. package/dist/entrypoints/agent-runtime/sqlite/node.js +6 -6
  24. package/dist/entrypoints/agent-runtime/testing.js +33 -9
  25. package/dist/entrypoints/agent-runtime.js +12 -12
  26. package/dist/entrypoints/application.d.ts +1 -1
  27. package/dist/entrypoints/application.d.ts.map +1 -1
  28. package/dist/entrypoints/application.js +55 -8
  29. package/dist/entrypoints/bin/upgrade-cli.js +2 -0
  30. package/dist/entrypoints/cli.js +6 -6
  31. package/dist/entrypoints/files/packaging.js +2 -2
  32. package/dist/entrypoints/node.js +2 -1
  33. package/dist/entrypoints/process.js +2 -2
  34. package/dist/entrypoints/server.d.ts +1 -1
  35. package/dist/entrypoints/server.d.ts.map +1 -1
  36. package/dist/entrypoints/server.js +7 -7
  37. package/dist/entrypoints/testing.js +1 -1
  38. package/dist/entrypoints/tools/agent.js +6 -6
  39. package/dist/entrypoints/tools/connections.js +2 -2
  40. package/dist/entrypoints/tools/invoker.js +4 -4
  41. package/dist/entrypoints/tools/mcp.js +8 -6
  42. package/dist/entrypoints/tools/toolkit.js +10 -8
  43. package/dist/entrypoints/tools.js +11 -11
  44. package/dist/{index-gbj964dt.js → index-103dp7fz.js} +54 -31
  45. package/dist/{index-cm07qz01.js → index-1v3k5zgx.js} +1 -1
  46. package/dist/{index-3n8k175r.js → index-48acz7z0.js} +5 -5
  47. package/dist/{index-6fmg17bg.js → index-4efxzrht.js} +2 -2
  48. package/dist/{index-en2xqhty.js → index-57ppvpw0.js} +1 -1
  49. package/dist/{index-x68eyh6y.js → index-7cn66qdk.js} +2 -2
  50. package/dist/{index-7q05ag0z.js → index-7zksb1ty.js} +1 -1
  51. package/dist/{index-xaem29dc.js → index-a3z56mtn.js} +1 -1
  52. package/dist/{index-568w258r.js → index-a6w6mwda.js} +1 -1
  53. package/dist/{index-z2z67tnv.js → index-cvjddnvd.js} +3 -3
  54. package/dist/{index-afc3mtah.js → index-ft2wvst5.js} +101 -32
  55. package/dist/{index-gdqawggb.js → index-jjvr9f15.js} +14 -0
  56. package/dist/{index-q7s1yr9g.js → index-kxff9e9w.js} +3 -3
  57. package/dist/{index-r7v5xz0g.js → index-m0wsfmrc.js} +1 -1
  58. package/dist/{index-pq7rkwkk.js → index-m200b8hs.js} +65 -12
  59. package/dist/{index-2ds89z96.js → index-n6hvd1r2.js} +4 -4
  60. package/dist/{index-p9saezh1.js → index-pa9bhefy.js} +1 -1
  61. package/dist/{index-p1mwqkgh.js → index-v7rbjatr.js} +122 -113
  62. package/dist/{index-rk7m4j7r.js → index-x2d51zay.js} +9 -10
  63. package/dist/{index-1wz4y15d.js → index-x2rvpbtj.js} +1 -1
  64. package/dist/internal/coalesced-task.d.ts +14 -2
  65. package/dist/internal/coalesced-task.d.ts.map +1 -1
  66. package/dist/internal/upgrade-affects.d.ts.map +1 -1
  67. package/dist/process/group-settlement.d.ts +2 -0
  68. package/dist/process/group-settlement.d.ts.map +1 -1
  69. package/dist/server/context.d.ts +2 -2
  70. package/dist/server/context.d.ts.map +1 -1
  71. package/dist/server/create.d.ts.map +1 -1
  72. package/dist/server/error-dispatch.d.ts +2 -0
  73. package/dist/server/error-dispatch.d.ts.map +1 -1
  74. package/dist/server/handler-state.d.ts +3 -0
  75. package/dist/server/handler-state.d.ts.map +1 -1
  76. package/dist/server/middleware/cors.d.ts +48 -3
  77. package/dist/server/middleware/cors.d.ts.map +1 -1
  78. package/dist/server/types.d.ts +8 -2
  79. package/dist/server/types.d.ts.map +1 -1
  80. package/dist/tools/cli/args-route.d.ts +10 -1
  81. package/dist/tools/cli/args-route.d.ts.map +1 -1
  82. package/dist/tools/cli/args.d.ts.map +1 -1
  83. package/dist/tools/cli/command-shape.d.ts +4 -0
  84. package/dist/tools/cli/command-shape.d.ts.map +1 -1
  85. package/dist/tools/cli/managed-surface.d.ts.map +1 -1
  86. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  87. package/dist/tools/cli/session.d.ts +1 -1
  88. package/dist/tools/cli/session.d.ts.map +1 -1
  89. package/dist/tools/cli/stream-surface.d.ts +6 -1
  90. package/dist/tools/cli/stream-surface.d.ts.map +1 -1
  91. package/dist/tools/internal/surface-projector.d.ts +2 -0
  92. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  93. package/llms/agent-runtime.2.txt +30 -0
  94. package/llms/agent-runtime.4.txt +1 -1
  95. package/llms/application.3.txt +9 -3
  96. package/llms/cli.2.txt +1 -1
  97. package/llms/cli.txt +27 -0
  98. package/llms/live.txt +28 -1
  99. package/llms/server.3.txt +2 -1
  100. package/llms/server.5.txt +3 -1
  101. package/llms/server.txt +44 -1
  102. package/llms/stitchkit.txt +3 -3
  103. package/llms/{upgrading-0.106.0-0.124.0.txt → upgrading-0.106.0-0.126.0.txt} +65 -3
  104. package/llms/upgrading.txt +1 -1
  105. package/llms-full.txt +210 -12
  106. package/llms.txt +6 -6
  107. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -15,6 +15,104 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.126.0] - 2026-11-21
19
+
20
+ ### ⚠️ Breaking changes
21
+
22
+ **Who must act:** every server that passes `read` to `createWatchHub`
23
+ ([migration](docs/guide/upgrading.md#watch-read-request)), and authors of a hand-written
24
+ agent store that branches on its own and runs the conformance kit
25
+ ([migration](docs/guide/upgrading.md#branch-conformance-application-files)).
26
+
27
+ - `stitchkit/application` `createWatchHub` passes `read` one request object
28
+ with a per-read `signal`. A shared read kept running after its last subscriber
29
+ left, and a subscriber arriving before it settled received its stale answer as
30
+ current. The signal aborts when the last subscriber leaves or the hub closes;
31
+ an aborted read's outcome is dropped without an `unavailable` state, a log line
32
+ or backoff, and the next read of the key starts after it settles.
33
+ `read: (operation, args, scope) => …` → `read: ({ operation, args, scope, signal }) => …`.
34
+ → ADR 0297
35
+ **Affects:** `stitchkit/application` createWatchHub(read), WatchHubConfig(read)
36
+ - `stitchkit/agent-runtime/testing` `runAgentStoreConformance` checks
37
+ application-owned file parts when a store implements `branchConversation`: a
38
+ declared `applicationFiles` reference must reach the branch under its destination
39
+ reference, and an undeclared one must refuse before any write. A hand-written store
40
+ that branches on its own must accept the new field; stores built on the shipped
41
+ planner pass unchanged. See the
42
+ [migration](docs/guide/upgrading.md#branch-conformance-application-files). → ADR 0298
43
+ **Affects:** `stitchkit/agent-runtime/testing` runAgentStoreConformance
44
+
45
+ ### Added
46
+
47
+ - `stitchkit/server` decides CORS per request origin. `cors.origin` may be a
48
+ function answering each exact origin with `{ credentials: true }`,
49
+ `{ credentials: false }` or `false`, sync or async, so a server can allow
50
+ partner pages without cookies beside its own pages with them. The answer is
51
+ reached once per request and used by every exit, every response varies by
52
+ `Origin`, and a failing or malformed answer grants nothing and runs nothing.
53
+ A `safelistedBody` text body is read only from an origin granted with
54
+ credentials. Types `CorsOriginPolicy` and `CorsOriginDecision`. → ADR 0299
55
+
56
+ ### Fixed
57
+
58
+ - `stitchkit/application` `createWatchHub` keeps the pause after a failed read
59
+ across subscriber churn. A subscriber that left and returned while the source
60
+ was down got a new read at once, at the rate of its reconnects instead of the
61
+ backoff. The pause now belongs to the key: the returning subscriber is told the
62
+ known state and waits out the rest, an abandoned read does not reset the count,
63
+ and a failed key is kept until its pause ends. → ADR 0297
64
+ **Affects:** `stitchkit/application` behaviour
65
+ - `stitchkit/agent-runtime` `branchConversation` takes `applicationKeys`. A
66
+ conversation whose tool output or message metadata held the application's own
67
+ `messageId`, `reference` or another name the runtime reserves for its
68
+ references could not be branched at all. Declared names cross as data; a
69
+ declared key whose value names a source identity still refuses, and the order
70
+ of `applicationKeys` and `applicationFiles` no longer changes the request
71
+ fingerprint. → ADR 0298
72
+ **Affects:** `stitchkit/agent-runtime` BranchAgentConversationInputSchema, BranchAgentConversationInput; `stitchkit/agent-runtime` behaviour
73
+ - `stitchkit/process` confirms a stopped process group with the kernel before
74
+ taking a process-table snapshot. Every stop of a group spawned `ps` once, which
75
+ took about 30 ms on an idle host and outlasted a short cleanup budget on a busy
76
+ one, failing the command with `COMMAND_CLEANUP` after its work had succeeded.
77
+ **Affects:** `stitchkit/process` behaviour; `stitchkit/agent-runtime/coding-tools` behaviour
78
+ - `stitchkit/agent-runtime` branches and restores conversations whose file parts
79
+ reference files the application stores. Every file part was read as a runtime
80
+ spill, so an uploaded image refused the whole branch with `Branch contains a
81
+ foreign or missing spill reference`. `branchConversation` takes
82
+ `applicationFiles`, each `{ reference, destinationReference }` naming the
83
+ reference the host already granted the destination; an undeclared file part
84
+ still refuses, now with `Branch contains a foreign or missing file reference`.
85
+ → ADR 0298
86
+ **Affects:** `stitchkit/agent-runtime` BranchAgentConversationInputSchema, BranchAgentConversationInput; `stitchkit/agent-runtime` behaviour
87
+
88
+ ## [0.125.0] - 2026-11-19
89
+
90
+ ### ⚠️ Breaking changes
91
+
92
+ **Who must act:** CLI authors who named a command after a framework option, and callers who
93
+ place framework flags before a native command in a CLI with a managed command factory and no
94
+ default command. See the [migration](docs/guide/upgrading.md#cli-framework-option-command-names).
95
+
96
+ - `stitchkit/cli` reserves framework option spellings as shell command names.
97
+ A declared command such as `--quiet` could otherwise make an existing script
98
+ run a different handler. Rename it and update its callers:
99
+ `app --quiet inspect` → `app quiet-mode inspect`. In a CLI with a managed
100
+ factory and no default command, put a native command first:
101
+ `app --quiet whoami` → `app whoami --quiet`. The former order now reports
102
+ the ambiguity before a handler or factory runs. → ADR 0296
103
+ **Affects:** `stitchkit/cli` createCli, routeCliArgv
104
+
105
+ ### Fixed
106
+
107
+ - `stitchkit/cli` accepts framework flags before an explicit command on CLIs
108
+ without a default command. For a static CLI, `app --quiet status --json`
109
+ and `app status --quiet --json` run the same command with the same settings.
110
+ A command name or application option between `--dry-run` and a positional
111
+ `false` keeps the preview active, including on CLIs with a default.
112
+ On a named command, `--schema false` and `--help false` now allow execution
113
+ just like their inline forms.
114
+ **Affects:** `stitchkit/cli` routeCliArgv, createCli
115
+
18
116
  ## [0.124.5] - 2026-11-19
19
117
 
20
118
  ### Fixed
@@ -520,7 +618,7 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
520
618
  Every filesystem tool pins root before either policy; an ordinary command enters its pinned
521
619
  cwd through the descriptor's `/proc` link on Linux and through an isolated fchdir guard on
522
620
  macOS. Symlink cwd descendants refuse; custom sandbox launchers own cwd capture.
523
- **Affects:** `stitchkit/agent-runtime/coding-tools` createAgentCodingTools, AgentCodingToolLimitsSchema, AgentCodingToolLimits, behaviour
621
+ **Affects:** `stitchkit/agent-runtime/coding-tools` createAgentCodingTools, AgentCodingToolLimitsSchema, AgentCodingToolLimits; `stitchkit/agent-runtime/coding-tools` behaviour
524
622
 
525
623
  ### Fixed
526
624
 
@@ -57,6 +57,11 @@ export declare const BranchAgentConversationInputSchema: z.ZodObject<{
57
57
  args: z.ZodArray<z.ZodString>;
58
58
  cwd: z.ZodString;
59
59
  }, z.core.$strict>], "operation">>;
60
+ applicationFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
61
+ reference: z.ZodString;
62
+ destinationReference: z.ZodString;
63
+ }, z.core.$strict>>>;
64
+ applicationKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
65
  }, z.core.$strict>;
61
66
  export type BranchAgentConversationInput = z.infer<typeof BranchAgentConversationInputSchema>;
62
67
  export declare const AgentConversationBranchReceiptSchema: z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"branch-contract.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/branch-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAuBpC,CAAC;AAEZ,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAE9F,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;kBActC,CAAC;AAEZ,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,oCAAoC,CAC5C,CAAC;AAEF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;kBAKrC,CAAC;AAEZ,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,mCAAmC,CAC3C,CAAC"}
1
+ {"version":3,"file":"branch-contract.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/branch-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoCxB,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAqCpC,CAAC;AAEZ,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAE9F,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;kBActC,CAAC;AAEZ,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,oCAAoC,CAC5C,CAAC;AAEF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;kBAKrC,CAAC;AAEZ,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,mCAAmC,CAC3C,CAAC"}
@@ -8,9 +8,27 @@ export declare class BranchIdentities {
8
8
  readonly sourceConversationId: string;
9
9
  private readonly definitions;
10
10
  private readonly references;
11
+ private readonly applicationFiles;
12
+ private readonly applicationKeys;
11
13
  constructor(conversationId: string, requestKey: string, sourceConversationId: string);
12
14
  define(kind: IdentityKind, source: string): string;
13
15
  reference(kind: IdentityKind, source: string): string;
16
+ /**
17
+ * Declare file part references the application owns, after the archive's
18
+ * spills: one reference has one owner, so a declared reference that is also a
19
+ * spill refuses rather than choosing between them.
20
+ */
21
+ declareApplicationFiles(files: readonly {
22
+ reference: string;
23
+ destinationReference: string;
24
+ }[]): void;
25
+ /** Keys the host declares as its own data inside application JSON. */
26
+ declareApplicationKeys(keys: readonly string[]): void;
27
+ isApplicationKey(key: string): boolean;
28
+ /** Whether `value` names something of the source conversation: itself or any identity it defines. */
29
+ isSourceIdentity(value: string): boolean;
30
+ /** A file part's reference in the destination: its spill's, or the declared application one. */
31
+ fileReference(source: string): string;
14
32
  referenced(kind: IdentityKind): ReadonlySet<string>;
15
33
  collectMessage(message: AgentMessage): void;
16
34
  collectRun(run: AgentRun): void;
@@ -1 +1 @@
1
- {"version":3,"file":"branch-identities.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/branch-identities.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,KAAK,YAAY,GACb,KAAK,GACL,SAAS,GACT,MAAM,GACN,UAAU,GACV,WAAW,GACX,OAAO,GACP,OAAO,GACP,OAAO,GACP,KAAK,GACL,UAAU,GACV,OAAO,CAAC;AAEZ,mGAAmG;AACnG,qBAAa,gBAAgB;IAIzB,QAAQ,CAAC,cAAc,EAAE,MAAM;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,QAAQ,CAAC,oBAAoB,EAAE,MAAM;IALvC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgD;IAC5E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAwC;IACnE,YACW,cAAc,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAC1B,oBAAoB,EAAE,MAAM,EACnC;IACJ,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUjD;IACD,SAAS,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAOpD;IACD,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,CAElD;IACD,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAM1C;IACD,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAI9B;IACD,gBAAgB,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI,CAuBhD;CACF"}
1
+ {"version":3,"file":"branch-identities.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/branch-identities.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,C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,EAAE,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,CAElD;IACD,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAM1C;IACD,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAI9B;IACD,gBAAgB,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI,CAuBhD;CACF"}
@@ -1,8 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  import type { BranchIdentities } from './branch-identities.js';
3
3
  import type { AgentMessage, AgentRun } from './schemas.js';
4
- /** Application JSON is data, never an undocumented runtime reference codec. */
5
- export declare function branchOpaqueJson(value: z.infer<ReturnType<typeof z.json>>): typeof value;
4
+ /**
5
+ * Application JSON is data, never an undocumented runtime reference codec.
6
+ *
7
+ * A key named like a runtime reference refuses the branch: the value cannot be
8
+ * rekeyed, and carried as it is it would name the source. A host that uses such
9
+ * a name for data of its own declares the key in `applicationKeys`; even then a
10
+ * value that names an identity of the source conversation refuses.
11
+ */
12
+ export declare function branchOpaqueJson(ids: BranchIdentities, value: z.infer<ReturnType<typeof z.json>>): typeof value;
6
13
  export declare function branchToolJson(ids: BranchIdentities, name: string, value: z.infer<ReturnType<typeof z.json>>, output: boolean): string | number | boolean | z.JSONType[] | {
7
14
  [key: string]: z.JSONType;
8
15
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"branch-messages.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/branch-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,KAAK,EAAE,YAAY,EAAoB,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1E,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,KAAK,CAo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M,EAC5B,OAAO,EAAE,YAAY,GACpB,YAAY,CAad;AAED,wBAAgB,SAAS,CACvB,GAAG,EAAE,gBAAgB,EACrB,oBAAoB,EAAE,MAAM,EAC5B,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,OAAO,GACf,QAAQ,CAsBV"}
@@ -1 +1 @@
1
- {"version":3,"file":"branch-provider.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/branch-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAmB5D,qGAAqG;AACrG,qBAAa,cAAc;IAEb,OAAO,CAAC,QAAQ,CAAC,GAAG;IADhC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,YAA6B,GAAG,EAAE,gBAAgB,EAAI;IACtD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAkG1D;CACF"}
1
+ {"version":3,"file":"branch-provider.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/branch-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAoB5D,qGAAqG;AACrG,qBAAa,cAAc;IAEb,OAAO,CAAC,QAAQ,CAAC,GAAG;IADhC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,YAA6B,GAAG,EAAE,gBAAgB,EAAI;IACtD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAqG1D;CACF"}
@@ -12,5 +12,5 @@ export interface BranchSource {
12
12
  digest: string;
13
13
  }
14
14
  /** Validate the complete archive before selecting a prefix; a truncated tail never looks complete. */
15
- export declare function prepareBranchSource(bytes: Uint8Array, source: BranchAgentConversationInput['source']): BranchSource;
15
+ export declare function prepareBranchSource(bytes: Uint8Array, { source, applicationFiles, applicationKeys, }: Pick<BranchAgentConversationInput, 'source' | 'applicationFiles' | 'applicationKeys'>): BranchSource;
16
16
  //# sourceMappingURL=branch-source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"branch-source.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/branch-source.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAGtE,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,iBAAiB,CAAC;AASxE,wBAAgB,UAAU,CAA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AG,iBAAiB,CAAC,GACvF,YAAY,CAoGd"}
@@ -1 +1 @@
1
- {"version":3,"file":"store-branch.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/store-branch.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EAElC,MAAM,mBAAmB,CAAC;AAO3B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAmBvE,8EAA8E;AAC9E,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,EAClC,GAAG,EAAE,4BAA4B,GAChC,OAAO,CAAC,6BAA6B,CAAC,CAoJxC"}
1
+ {"version":3,"file":"store-branch.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/store-branch.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EAElC,MAAM,mBAAmB,CAAC;AAO3B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAmBvE,8EAA8E;AAC9E,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,EAClC,GAAG,EAAE,4BAA4B,GAChC,OAAO,CAAC,6BAA6B,CAAC,CA+JxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"store-conformance-branch.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/store-conformance-branch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjD,mFAAmF;AACnF,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,iBAmFjB"}
1
+ {"version":3,"file":"store-conformance-branch.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/store-conformance-branch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjD,mFAAmF;AACnF,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,iBAsHjB"}
@@ -3,6 +3,7 @@
3
3
  * retry, the frames each subscriber is sent — whole values or differences
4
4
  * against what it holds — and the release of a source nobody watches.
5
5
  */
6
+ import { ABANDONED_PASS } from '../internal/coalesced-task.js';
6
7
  import { type WatchKey, type WatchStateFrame } from '../live/watch-contract.js';
7
8
  import type { AttachedWatcher, WatchAdmissionScope, WatchHubConfig, WatchOperation, WatchSubscriber } from './watch-hub.js';
8
9
  import { type Source } from './watch-hub-source.js';
@@ -37,7 +38,7 @@ export declare class WatchHubCore {
37
38
  announceState(source: Source, state: WatchStateFrame): void;
38
39
  deliver(source: Source, subscriber: WatchSubscriber): boolean;
39
40
  publish(source: Source, value: unknown, fingerprint: string): void;
40
- readSource(source: Source): Promise<void>;
41
+ readSource(source: Source): Promise<typeof ABANDONED_PASS | undefined>;
41
42
  readFailed(source: Source, error: unknown): void;
42
43
  acquire(operation: WatchOperation, routed: WatchKey, args: unknown, scope?: string): Source;
43
44
  release(source: Source): void;
@@ -1 +1 @@
1
- {"version":3,"file":"watch-hub-core.d.ts","sourceRoot":"","sources":["../../src/application/watch-hub-core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAkB,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,eAAe,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAKL,KAAK,MAAM,EAEZ,MAAM,oBAAoB,CAAC;AAI5B;;;;GAIG;AACH,qBAAa,YAAY;IAWX,QAAQ,CAAC,MAAM,EAAE,cAAc;IAV3C,QAAQ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AE,eAAe,GAAG,OAAO,CAQ5D;IAED,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAcjE;IAEK,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,cAAc,GAAG,SAAS,CAAC,CA8B3E;IAED,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAgB/C;IAED,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAyC1F;IAED,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAkC5B;IAED;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAQxE;IAED,MAAM,CAAC,UAAU,EAAE,eAAe,EAAE,KAAK,CAAC,EAAE,mBAAmB,GAAG,eAAe,CAoHhF;IAED,KAAK,IAAI,IAAI,CA0CZ;CACF"}
@@ -52,6 +52,8 @@ export interface Source {
52
52
  readonly task: CoalescedTask;
53
53
  state: WatchStateFrame;
54
54
  release?: ReturnType<typeof setTimeout>;
55
+ /** The read in flight, aborted when nobody waits for it any more. */
56
+ reading?: AbortController;
55
57
  }
56
58
  /**
57
59
  * Remember the value a subscriber may still be holding, under the byte ceiling.
@@ -1 +1 @@
1
- {"version":3,"file":"watch-hub-source.d.ts","sourceRoot":"","sources":["../../src/application/watch-hub-source.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EACV,SAAS,EACT,QAAQ,EACR,eAAe,EACf,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,cAAc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vD"}
@@ -73,6 +73,25 @@ export interface WatchAdmissionScope {
73
73
  readonly key: string;
74
74
  readonly signal: AbortSignal;
75
75
  }
76
+ /** One read the hub asks the application to perform. */
77
+ export interface WatchReadRequest {
78
+ readonly operation: WatchOperation;
79
+ readonly args: unknown;
80
+ /** The server-verified admission scope the read is shared within (`WatchAdmissionScope.key`). */
81
+ readonly scope?: string;
82
+ /**
83
+ * Aborted when nobody waits for this read any more: the key's last
84
+ * subscriber left, or the hub closed. Each read gets its own signal, so a
85
+ * later read of the same key is never born cancelled.
86
+ *
87
+ * Cancellation is not a failure. Whatever the read settles with after the
88
+ * abort — a value or an error — is dropped: it is not published, not
89
+ * announced as `unavailable`, not logged and not retried with backoff. A read
90
+ * that ignores the signal is still the only read of its key until it
91
+ * settles; the hub starts the next one after it, never beside it.
92
+ */
93
+ readonly signal: AbortSignal;
94
+ }
76
95
  export interface WatchHubConfig {
77
96
  readonly reconcileIntervalMs?: number;
78
97
  readonly maxSources?: number;
@@ -93,7 +112,7 @@ export interface WatchHubConfig {
93
112
  * user". Then every subscriber to that key receives whatever the first read
94
113
  * happened to resolve. Do not; put the identity in the arguments.
95
114
  */
96
- read(operation: WatchOperation, args: unknown, scope?: string): Promise<unknown>;
115
+ read(request: WatchReadRequest): Promise<unknown>;
97
116
  /** Whether an operation may be watched at all. Refusal is answered in words. */
98
117
  watchable(operation: WatchOperation): boolean;
99
118
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"watch-hub.d.ts","sourceRoot":"","sources":["../../src/application/watch-hub.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EACV,SAAS,EACT,QAAQ,EACR,eAAe,EACf,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAGhC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k7m4j7r.js";
3
+ import"../../index-x2d51zay.js";
4
4
  import"../../index-ndjzbt2v.js";
5
5
  import {
6
6
  AgentCodingToolLimitsSchema2,
7
7
  AgentCodingToolAuthorizationSchema2,
8
8
  AgentCodingToolPathAuthorizationSchema2,
9
9
  createAgentCodingTools2
10
- } from "../../index-6fmg17bg.js";
10
+ } from "../../index-4efxzrht.js";
11
11
  import"../../index-sqc6ezrb.js";
12
12
  import"../../index-0ndz5r8z.js";
13
- import"../../index-gdqawggb.js";
13
+ import"../../index-jjvr9f15.js";
14
14
  import"../../index-kffm4r8w.js";
15
15
  import"../../index-fa53vygr.js";
16
16
  import"../../index-ww3gss55.js";
17
- import"../../index-r7v5xz0g.js";
17
+ import"../../index-m0wsfmrc.js";
18
18
  export {
19
19
  AgentCodingToolAuthorizationSchema2 as AgentCodingToolAuthorizationSchema,
20
20
  AgentCodingToolLimitsSchema2 as AgentCodingToolLimitsSchema,
@@ -5,15 +5,15 @@ import"../../index-8kzct1d6.js";
5
5
  import {
6
6
  composeAgentPrompt2,
7
7
  createAgentRuntime2
8
- } from "../../index-cm07qz01.js";
8
+ } from "../../index-1v3k5zgx.js";
9
9
  import"../../index-qaet40b2.js";
10
10
  import"../../index-hs76yzt7.js";
11
11
  import"../../index-ndjzbt2v.js";
12
12
  import"../../index-dsa676h8.js";
13
13
  import"../../index-t8jz0e20.js";
14
14
  import"../../index-5dmk54h9.js";
15
- import"../../index-rk7m4j7r.js";
16
- import"../../index-1wz4y15d.js";
15
+ import"../../index-x2d51zay.js";
16
+ import"../../index-x2rvpbtj.js";
17
17
  import"../../index-snef22zr.js";
18
18
  import"../../index-zyc64nbh.js";
19
19
  import"../../index-egg0yp2j.js";
@@ -31,7 +31,7 @@ import {
31
31
  import"../../index-ww3gss55.js";
32
32
  import {
33
33
  defineRuntimeTool2
34
- } from "../../index-r7v5xz0g.js";
34
+ } from "../../index-m0wsfmrc.js";
35
35
 
36
36
  // src/agent-runtime/harness-contract.ts
37
37
  import { z } from "zod";
@@ -3,11 +3,11 @@ import {
3
3
  missingSandboxRestrictions2,
4
4
  codingRefusal,
5
5
  createAgentCodingTools2
6
- } from "../../index-6fmg17bg.js";
6
+ } from "../../index-4efxzrht.js";
7
7
  import"../../index-sqc6ezrb.js";
8
8
  import"../../index-yt1gg11x.js";
9
9
  import"../../index-5dmk54h9.js";
10
- import"../../index-rk7m4j7r.js";
10
+ import"../../index-x2d51zay.js";
11
11
  import"../../index-ndjzbt2v.js";
12
12
  import {
13
13
  COMMAND_CLEANUP_TIMEOUT_MS,
@@ -18,14 +18,14 @@ import {
18
18
  nativeCommandOwner,
19
19
  terminateOwnedGroup,
20
20
  startNativeCommand
21
- } from "../../index-gdqawggb.js";
21
+ } from "../../index-jjvr9f15.js";
22
22
  import {
23
23
  bindUnixSocket2
24
24
  } from "../../index-drcjjhy1.js";
25
25
  import"../../index-kffm4r8w.js";
26
26
  import"../../index-fa53vygr.js";
27
27
  import"../../index-ww3gss55.js";
28
- import"../../index-r7v5xz0g.js";
28
+ import"../../index-m0wsfmrc.js";
29
29
  import {
30
30
  errnoOf
31
31
  } from "../../index-jj9228tt.js";
@@ -1,25 +1,25 @@
1
1
  import"../../../index-egg0yp2j.js";
2
- import"../../../index-afc3mtah.js";
2
+ import"../../../index-ft2wvst5.js";
3
3
  import"../../../index-8kzct1d6.js";
4
4
  import {
5
5
  initializeAgentRuntimeSqlite2,
6
6
  createSqliteAgentRuntimeStore2
7
- } from "../../../index-en2xqhty.js";
7
+ } from "../../../index-57ppvpw0.js";
8
8
  import"../../../index-kqnd6a85.js";
9
9
  import"../../../index-m8ddk770.js";
10
- import"../../../index-6fmg17bg.js";
10
+ import"../../../index-4efxzrht.js";
11
11
  import"../../../index-yt1gg11x.js";
12
12
  import"../../../index-5dmk54h9.js";
13
- import"../../../index-rk7m4j7r.js";
13
+ import"../../../index-x2d51zay.js";
14
14
  import"../../../index-ndjzbt2v.js";
15
15
  import"../../../index-sqc6ezrb.js";
16
16
  import"../../../index-0ndz5r8z.js";
17
- import"../../../index-gdqawggb.js";
17
+ import"../../../index-jjvr9f15.js";
18
18
  import"../../../index-snef22zr.js";
19
19
  import"../../../index-kffm4r8w.js";
20
20
  import"../../../index-fa53vygr.js";
21
21
  import"../../../index-ww3gss55.js";
22
- import"../../../index-r7v5xz0g.js";
22
+ import"../../../index-m0wsfmrc.js";
23
23
 
24
24
  // src/agent-runtime/sqlite-bun.ts
25
25
  import { Database } from "bun:sqlite";
@@ -1,25 +1,25 @@
1
1
  import"../../../index-egg0yp2j.js";
2
- import"../../../index-afc3mtah.js";
2
+ import"../../../index-ft2wvst5.js";
3
3
  import"../../../index-8kzct1d6.js";
4
4
  import {
5
5
  initializeAgentRuntimeSqlite2,
6
6
  createSqliteAgentRuntimeStore2
7
- } from "../../../index-en2xqhty.js";
7
+ } from "../../../index-57ppvpw0.js";
8
8
  import"../../../index-kqnd6a85.js";
9
9
  import"../../../index-m8ddk770.js";
10
- import"../../../index-6fmg17bg.js";
10
+ import"../../../index-4efxzrht.js";
11
11
  import"../../../index-yt1gg11x.js";
12
12
  import"../../../index-5dmk54h9.js";
13
- import"../../../index-rk7m4j7r.js";
13
+ import"../../../index-x2d51zay.js";
14
14
  import"../../../index-ndjzbt2v.js";
15
15
  import"../../../index-sqc6ezrb.js";
16
16
  import"../../../index-0ndz5r8z.js";
17
- import"../../../index-gdqawggb.js";
17
+ import"../../../index-jjvr9f15.js";
18
18
  import"../../../index-snef22zr.js";
19
19
  import"../../../index-kffm4r8w.js";
20
20
  import"../../../index-fa53vygr.js";
21
21
  import"../../../index-ww3gss55.js";
22
- import"../../../index-r7v5xz0g.js";
22
+ import"../../../index-m0wsfmrc.js";
23
23
 
24
24
  // src/agent-runtime/sqlite-node.ts
25
25
  import { DatabaseSync } from "node:sqlite";
@@ -10,23 +10,23 @@ import {
10
10
  advanceToolChronology
11
11
  } from "../../index-egg0yp2j.js";
12
12
  import"../../index-m8ddk770.js";
13
- import"../../index-6fmg17bg.js";
14
- import"../../index-afc3mtah.js";
13
+ import"../../index-4efxzrht.js";
14
+ import"../../index-ft2wvst5.js";
15
15
  import"../../index-yt1gg11x.js";
16
16
  import"../../index-5dmk54h9.js";
17
- import"../../index-rk7m4j7r.js";
17
+ import"../../index-x2d51zay.js";
18
18
  import"../../index-ndjzbt2v.js";
19
19
  import"../../index-sqc6ezrb.js";
20
20
  import"../../index-0ndz5r8z.js";
21
- import"../../index-gdqawggb.js";
21
+ import"../../index-jjvr9f15.js";
22
22
  import"../../index-snef22zr.js";
23
23
  import {
24
24
  createMemoryAgentRuntimeStore2
25
- } from "../../index-p9saezh1.js";
25
+ } from "../../index-pa9bhefy.js";
26
26
  import"../../index-kffm4r8w.js";
27
27
  import"../../index-fa53vygr.js";
28
28
  import"../../index-ww3gss55.js";
29
- import"../../index-r7v5xz0g.js";
29
+ import"../../index-m0wsfmrc.js";
30
30
  import {
31
31
  assertPositiveSafeInteger
32
32
  } from "../../index-0s4xebbg.js";
@@ -269,7 +269,14 @@ function requireOutcome(actual, expected) {
269
269
  async function branchConformance(store, source, destination, restored) {
270
270
  if (!store.branchConversation)
271
271
  return;
272
- const input = userMessage(source, `${source}-input`);
272
+ const attachment = `attachments/${source}/image.png`;
273
+ const input = AgentMessageSchema2.parse({
274
+ ...userMessage(source, `${source}-input`),
275
+ parts: [
276
+ { type: "text", text: "see the image" },
277
+ { type: "file", mediaType: "image/png", reference: attachment }
278
+ ]
279
+ });
273
280
  const run = queuedRun(source, input.id, `${source}-run`);
274
281
  requireOutcome(await store.acceptInputAndAssignRun({ idempotencyKey: "branch-input", input, run }), "applied");
275
282
  requireOutcome(await store.acquireRun({
@@ -298,8 +305,16 @@ async function branchConformance(store, source, destination, restored) {
298
305
  const request = {
299
306
  requestKey: "branch-conformance",
300
307
  destinationConversationId: destination,
301
- source: { kind: "conversation", conversationId: source, throughRunId: run.id }
308
+ source: { kind: "conversation", conversationId: source, throughRunId: run.id },
309
+ applicationFiles: [
310
+ { reference: attachment, destinationReference: `attachments/${destination}/image.png` }
311
+ ]
302
312
  };
313
+ const undeclared = await store.branchConversation({ ...request, applicationFiles: [] }).then(() => "created", () => "refused");
314
+ if (undeclared !== "refused")
315
+ throw new Error("Branch conformance: an undeclared application file reference was not refused");
316
+ if ((await store.loadSnapshot(destination)).version !== 0)
317
+ throw new Error("Branch conformance: a refused branch wrote its destination");
303
318
  const created = await store.branchConversation(request);
304
319
  requireOutcome(created, "created");
305
320
  const duplicate = await store.branchConversation(request);
@@ -309,6 +324,9 @@ async function branchConformance(store, source, destination, restored) {
309
324
  const snapshot = await store.loadSnapshot(destination);
310
325
  if (snapshot.messages.length !== 2 || snapshot.runs.length !== 1 || snapshot.runs[0]?.id === run.id || snapshot.runs[0]?.ownerId !== undefined || snapshot.runs[0]?.fencingToken !== undefined)
311
326
  throw new Error("Branch conformance: identity or authority was inherited");
327
+ const copiedFile = snapshot.messages.flatMap((message) => message.parts).find((part) => part.type === "file");
328
+ if (copiedFile?.type !== "file" || copiedFile.reference !== `attachments/${destination}/image.png`)
329
+ throw new Error("Branch conformance: a declared application file kept the source address");
312
330
  if (Buffer.compare(before, await store.exportConversation(source)) !== 0)
313
331
  throw new Error("Branch conformance: source changed");
314
332
  const archived = await store.exportConversation(destination);
@@ -318,7 +336,13 @@ async function branchConformance(store, source, destination, restored) {
318
336
  requireOutcome(await store.branchConversation({
319
337
  requestKey: "restore-conformance",
320
338
  destinationConversationId: restored,
321
- source: { kind: "archive", bytes: archived }
339
+ source: { kind: "archive", bytes: archived },
340
+ applicationFiles: [
341
+ {
342
+ reference: `attachments/${destination}/image.png`,
343
+ destinationReference: `attachments/${restored}/image.png`
344
+ }
345
+ ]
322
346
  }), "created");
323
347
  const nextInput = userMessage(restored, `${restored}-next-input`);
324
348
  requireOutcome(await store.acceptInputAndAssignRun({