@tangle-network/agent-app 0.63.44 → 0.63.46

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 (63) hide show
  1. package/dist/{DesignCanvas-VKZ7Y3JU.js → DesignCanvas-Q65UV4D5.js} +3 -2
  2. package/dist/{DesignCanvasEditor-3V53YLLZ.js → DesignCanvasEditor-THEFESEX.js} +3 -2
  3. package/dist/app-auth/index.js +2 -1
  4. package/dist/app-auth/index.js.map +1 -1
  5. package/dist/chat-routes/index.js +10 -8
  6. package/dist/chat-routes/index.js.map +1 -1
  7. package/dist/chat-routes/route-storage.d.ts +1 -0
  8. package/dist/chat-routes/turn-ownership.d.ts +1 -1
  9. package/dist/chat-routes/turn-route-contracts.d.ts +2 -0
  10. package/dist/{chunk-ZGGEYYEQ.js → chunk-4E2MUVGL.js} +3 -3
  11. package/dist/chunk-5VE4IDSU.js +75 -0
  12. package/dist/chunk-5VE4IDSU.js.map +1 -0
  13. package/dist/{chunk-CTREXL3O.js → chunk-67CSI5PU.js} +2 -65
  14. package/dist/chunk-67CSI5PU.js.map +1 -0
  15. package/dist/{chunk-DPTNKH22.js → chunk-H6BRJU5M.js} +1 -73
  16. package/dist/chunk-H6BRJU5M.js.map +1 -0
  17. package/dist/{chunk-XTQLZG6M.js → chunk-HHIEHETJ.js} +3 -3
  18. package/dist/{chunk-RZMQ2J5P.js → chunk-IMFJMFHK.js} +14 -27
  19. package/dist/chunk-IMFJMFHK.js.map +1 -0
  20. package/dist/chunk-INW4FSID.js +66 -0
  21. package/dist/chunk-INW4FSID.js.map +1 -0
  22. package/dist/{chunk-N5RWYR5N.js → chunk-ZTGITMYQ.js} +10 -1
  23. package/dist/chunk-ZTGITMYQ.js.map +1 -0
  24. package/dist/design-canvas/index.js +2 -1
  25. package/dist/design-canvas/index.js.map +1 -1
  26. package/dist/design-canvas-react/engine.js +2 -1
  27. package/dist/design-canvas-react/index.js +3 -2
  28. package/dist/design-canvas-react/index.js.map +1 -1
  29. package/dist/design-canvas-react/lazy.js +1 -1
  30. package/dist/platform/index.js +2 -1
  31. package/dist/platform/index.js.map +1 -1
  32. package/dist/preset-cloudflare/index.js +1 -1
  33. package/dist/public-consultation/index.js +7 -5
  34. package/dist/public-consultation/index.js.map +1 -1
  35. package/dist/sandbox/index.js +8 -6
  36. package/dist/sequences/index.js +2 -1
  37. package/dist/sequences/index.js.map +1 -1
  38. package/dist/skills-placement/box.js +4 -2
  39. package/dist/skills-placement/box.js.map +1 -1
  40. package/dist/turn-stream/adapters.d.ts +6 -6
  41. package/dist/turn-stream/core.d.ts +1 -0
  42. package/dist/turn-stream/index.js +7 -3
  43. package/dist/turn-stream/index.js.map +1 -1
  44. package/dist/vault/store/box-state.d.ts +125 -0
  45. package/dist/vault/store/coordinator.d.ts +9 -1
  46. package/dist/vault/store/index.d.ts +4 -0
  47. package/dist/vault/store/index.js +1227 -4
  48. package/dist/vault/store/index.js.map +1 -1
  49. package/dist/vault/store/sandbox-engine.d.ts +19 -0
  50. package/dist/vault/store/sandbox-hydrate.d.ts +59 -0
  51. package/dist/vault/store/sandbox-reconcile.d.ts +55 -0
  52. package/dist/vault/store/sandbox-sync.d.ts +37 -1
  53. package/dist/vault/store/store.d.ts +10 -1
  54. package/dist/web/index.js +7 -5
  55. package/package.json +1 -1
  56. package/dist/chunk-CTREXL3O.js.map +0 -1
  57. package/dist/chunk-DPTNKH22.js.map +0 -1
  58. package/dist/chunk-N5RWYR5N.js.map +0 -1
  59. package/dist/chunk-RZMQ2J5P.js.map +0 -1
  60. /package/dist/{DesignCanvas-VKZ7Y3JU.js.map → DesignCanvas-Q65UV4D5.js.map} +0 -0
  61. /package/dist/{DesignCanvasEditor-3V53YLLZ.js.map → DesignCanvasEditor-THEFESEX.js.map} +0 -0
  62. /package/dist/{chunk-ZGGEYYEQ.js.map → chunk-4E2MUVGL.js.map} +0 -0
  63. /package/dist/{chunk-XTQLZG6M.js.map → chunk-HHIEHETJ.js.map} +0 -0
@@ -0,0 +1,125 @@
1
+ /**
2
+ * What the workspace Vault coordinator knows about its box's copy of the Vault.
3
+ *
4
+ * Every chat turn used to re-prove that the box holds the Vault: read the
5
+ * baseline, list every head, diff, commit the baseline again, and `test -f`
6
+ * the bootstrap marker. On an unchanged Vault that was about 2 s of GTM's warm
7
+ * path (sandbox.vault.hydration p50 1211 ms, n=943; loss probe 387 ms, n=954;
8
+ * bootstrap 332 ms, n=952; 2026-10-09..11). This record lets a turn skip that
9
+ * work when nothing it would act on has changed.
10
+ *
11
+ * The workspace DO is the only writer of Vault heads (`/vault/mutate`), so it
12
+ * can count them. `generation` moves after every mutation that did not come
13
+ * from the synced box's own reconcile, and `inFlight` is set while one is being
14
+ * applied. A complete hydration records `sync` with the generation it read
15
+ * before it listed the heads; a later turn trusts it only while the generation
16
+ * is the same, no mutation is in flight, and the box is the same sandbox and
17
+ * filesystem incarnation. Anything else, including a failed read of this
18
+ * record, takes the full hydration path.
19
+ *
20
+ * Each record also names the contract it was written under: a sync names the
21
+ * hydration contract, and a bootstrap record names the marker it confirmed. A
22
+ * turn trusts a record only under its own contract, so a release that changes
23
+ * what hydration writes, or bumps the bootstrap marker, reaches every box on
24
+ * its next turn instead of waiting for the box to be recreated.
25
+ */
26
+ export declare const VAULT_BOX_STATE_KEY = "vaultBoxState";
27
+ export declare const VAULT_BOX_STATE_SCHEMA = "vault-box-state-v1";
28
+ /** A mutation in flight longer than this cannot still be running: its request
29
+ * died with the object. Reading the state then moves the generation, so the
30
+ * next hydration records against a value no partial write predates. */
31
+ export declare const VAULT_BOX_MUTATION_STALE_MS: number;
32
+ /** A Vault file that hydration left off the box for its size; the agent reads it through the Vault API. */
33
+ export interface VaultBoxSyncSkip {
34
+ path: string;
35
+ reason: 'too_large';
36
+ detail: string;
37
+ }
38
+ /** A hydration that left more files off the box than this records no sync. */
39
+ export declare const VAULT_BOX_SYNC_MAX_SKIPS = 50;
40
+ /** The box and filesystem whose Vault copy a complete hydration proved current. */
41
+ export interface VaultBoxSync {
42
+ sandboxId: string;
43
+ filesystemIncarnationId: string;
44
+ /** The hydration contract the copy was written under (the sync engine's `contract`). */
45
+ contract: string;
46
+ /** The generation read before that hydration listed the heads. */
47
+ generation: number;
48
+ /** What that hydration left off the box, so a turn that skips hydration still tells the agent. */
49
+ skipped: VaultBoxSyncSkip[];
50
+ syncedAt: string;
51
+ }
52
+ /** The box and filesystem whose product bootstrap marker was confirmed. */
53
+ export interface SandboxBootstrapRecord {
54
+ sandboxId: string;
55
+ filesystemIncarnationId: string;
56
+ /** The bootstrap marker the box confirmed. */
57
+ marker: string;
58
+ at: string;
59
+ }
60
+ export interface StoredVaultBoxState {
61
+ schema: typeof VAULT_BOX_STATE_SCHEMA;
62
+ generation: number;
63
+ inFlight: {
64
+ operationId: string;
65
+ startedAt: number;
66
+ } | null;
67
+ sync: VaultBoxSync | null;
68
+ bootstrap: SandboxBootstrapRecord | null;
69
+ }
70
+ /** What a turn reads. */
71
+ export interface VaultBoxStateView {
72
+ generation: number;
73
+ inFlight: boolean;
74
+ sync: VaultBoxSync | null;
75
+ bootstrap: SandboxBootstrapRecord | null;
76
+ }
77
+ export interface VaultBoxIdentity {
78
+ sandboxId: string;
79
+ filesystemIncarnationId: string;
80
+ }
81
+ /** What a complete hydration asks the coordinator to record. */
82
+ export interface VaultBoxSyncRecord extends VaultBoxIdentity {
83
+ contract: string;
84
+ generation: number;
85
+ skipped: readonly VaultBoxSyncSkip[];
86
+ }
87
+ /** What a confirmed bootstrap asks the coordinator to record. */
88
+ export interface SandboxBootstrapConfirmation extends VaultBoxIdentity {
89
+ marker: string;
90
+ }
91
+ export declare function emptyVaultBoxState(): StoredVaultBoxState;
92
+ /**
93
+ * The stored state, or a fresh one. A value that does not parse starts over at
94
+ * a generation above anything it could have held, so no sync recorded against
95
+ * the unreadable value can match.
96
+ */
97
+ export declare function parseVaultBoxState(value: unknown): StoredVaultBoxState;
98
+ /**
99
+ * Whether a mutation leaves the synced box's copy current without moving the
100
+ * generation: only the reconcile of that same box writes what the box already
101
+ * holds. Every other writer (the app, a tool, another box) moves it.
102
+ */
103
+ export declare function isSyncedBoxWriter(state: StoredVaultBoxState, writer: {
104
+ kind?: unknown;
105
+ id?: unknown;
106
+ } | undefined): boolean;
107
+ export declare function withMutationStarted(state: StoredVaultBoxState, operationId: string, now: number): StoredVaultBoxState;
108
+ /** Runs whether the mutation applied, conflicted or threw: any of them may have reached KV. */
109
+ export declare function withMutationFinished(state: StoredVaultBoxState): StoredVaultBoxState;
110
+ /** A reconcile that left the box and the Vault apart. The generation moves too, so a
111
+ * hydration that started before it cannot record a sync after it. */
112
+ export declare function withSyncInvalidated(state: StoredVaultBoxState): StoredVaultBoxState;
113
+ export declare function withSync(state: StoredVaultBoxState, sync: VaultBoxSync): StoredVaultBoxState;
114
+ export declare function withBootstrap(state: StoredVaultBoxState, bootstrap: SandboxBootstrapRecord): StoredVaultBoxState;
115
+ /** Clears an in-flight marker whose request cannot still be running, moving the generation. */
116
+ export declare function healStaleMutation(state: StoredVaultBoxState, now: number): StoredVaultBoxState | null;
117
+ export declare function viewOfVaultBoxState(state: StoredVaultBoxState): VaultBoxStateView;
118
+ /** Parses a view returned by the coordinator; anything else is unknown (null). */
119
+ export declare function parseVaultBoxStateView(value: unknown): VaultBoxStateView | null;
120
+ /** The skips a sync may carry, or null when the value is not a bounded list of them. */
121
+ export declare function parseVaultBoxSyncSkips(value: unknown): VaultBoxSyncSkip[] | null;
122
+ /** Whether a complete hydration of this exact box, under this contract, saw the Vault as it is now. */
123
+ export declare function vaultBoxInSync(view: VaultBoxStateView | null, box: VaultBoxIdentity, contract: string): boolean;
124
+ /** Whether this exact box's filesystem already holds the product bootstrap this marker names. */
125
+ export declare function sandboxBootstrapRecorded(view: VaultBoxStateView | null, box: VaultBoxIdentity, marker: string): boolean;
@@ -14,7 +14,8 @@
14
14
  */
15
15
  import type { KVStore } from '../../store';
16
16
  import { VaultPathError } from './paths';
17
- import { VaultReadConvergenceError, type VaultHeadState, type VaultMutationPolicy, type VaultMutationRequest, type VaultMutationResult, type VaultVisibilityFence } from './revisions';
17
+ import { VaultReadConvergenceError, type VaultHeadState, type VaultMutationPolicy, type VaultMutationRequest, type VaultMutationResult, type VaultSandboxBaseline, type VaultVisibilityFence } from './revisions';
18
+ import { type StoredVaultBoxState } from './box-state';
18
19
  /** The Durable Object storage calls the coordinator makes; Cloudflare's storage satisfies it. */
19
20
  export interface VaultCoordinatorStorage {
20
21
  get<T>(key: string): Promise<T | undefined>;
@@ -60,5 +61,12 @@ export declare function createVaultCoordinator(options: VaultCoordinatorOptions)
60
61
  handleVaultHeadGet: (request: Request) => Promise<Response>;
61
62
  handleVaultHeadList: (request: Request) => Promise<Response>;
62
63
  handleVaultMutation: (request: Request) => Promise<Response>;
64
+ readVaultSandboxBaseline: (sandboxId: string) => Promise<VaultSandboxBaseline | null>;
65
+ writeVaultSandboxBaseline: (baseline: VaultSandboxBaseline) => Promise<void>;
66
+ handleVaultBaselineGet: (request: Request) => Promise<Response>;
67
+ handleVaultBaselineSet: (request: Request) => Promise<Response>;
68
+ readVaultBoxState: () => Promise<StoredVaultBoxState>;
69
+ updateVaultBoxState: (change: (state: StoredVaultBoxState) => StoredVaultBoxState) => Promise<StoredVaultBoxState>;
70
+ handle: (request: Request) => Promise<Response | null>;
63
71
  };
64
72
  export type VaultCoordinator = ReturnType<typeof createVaultCoordinator>;
@@ -10,3 +10,7 @@ export * from './tree';
10
10
  export * from './store';
11
11
  export * from './coordinator';
12
12
  export * from './sandbox-sync';
13
+ export * from './box-state';
14
+ export * from './sandbox-hydrate';
15
+ export * from './sandbox-reconcile';
16
+ export * from './sandbox-engine';