@tangle-network/agent-app 0.63.59 → 0.63.60

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.
@@ -6,7 +6,8 @@
6
6
  * the recorded cursor.
7
7
  */
8
8
  import type { Outcome } from '../../sandbox/outcome';
9
- import { type SandboxVaultSyncConfig } from './sandbox-sync';
9
+ import { type VaultBoxSyncSkip } from './box-state';
10
+ import { type SandboxVaultSyncConfig, type SandboxVaultSyncStageObserver } from './sandbox-sync';
10
11
  export interface VaultHydrationFileSystem {
11
12
  exists(path: string): Promise<boolean>;
12
13
  writeMany(files: Array<{
@@ -46,6 +47,13 @@ export interface VaultHydrationStats {
46
47
  processedHeads: number;
47
48
  /** True when the coordinator's record proved the box current and nothing was listed or written. */
48
49
  inSync?: boolean;
50
+ /** Files the box refused for their size (`skipOversizeFiles`): absent from the box and its baseline. */
51
+ skipped: VaultBoxSyncSkip[];
52
+ /** Set when the copy budget ran out: heads not on the box yet, and whether later pages were not examined. */
53
+ deferred: {
54
+ pendingPaths: string[];
55
+ morePages: boolean;
56
+ } | null;
49
57
  }
50
58
  export interface VaultHydrationOptions {
51
59
  /** Paths a reconciliation parked as conflicts; hydration leaves both copies alone. */
@@ -54,6 +62,19 @@ export interface VaultHydrationOptions {
54
62
  appliedPaths?: ReadonlySet<string>;
55
63
  /** May still be in flight (the Vault-loss probe): hydrate awaits it only to compare heads. */
56
64
  pathsMissingFromBox?: ReadonlySet<string> | Promise<ReadonlySet<string>>;
65
+ /** False when the caller makes the warm-path decision and records the sync itself: hydration then neither skips nor records. */
66
+ recordSync?: boolean;
67
+ /**
68
+ * A copy that may span calls. Hydration spends `remainingChars` (Vault
69
+ * characters read; past it, it records what it wrote and returns `deferred`)
70
+ * and appends every Vault path it writes, so a caller that retries on a new
71
+ * box keeps one budget and can finish what the first attempt wrote.
72
+ */
73
+ progress?: {
74
+ remainingChars: number;
75
+ writtenPaths: string[];
76
+ };
77
+ onStage?: SandboxVaultSyncStageObserver;
57
78
  }
58
79
  /** Hydrate every live Vault head into the box, page by page, until the listing ends. */
59
80
  export declare function hydrateSandboxVault(config: SandboxVaultSyncConfig, box: VaultHydrationBox, workspaceId: string, options?: VaultHydrationOptions): Promise<Outcome<VaultHydrationStats>>;
@@ -1,6 +1,6 @@
1
1
  import { type SandboxExecChannel } from '../../sandbox/binary-read';
2
- import type { VaultMutationConflict } from './revisions';
3
- import { type SandboxVaultPathRejection, type SandboxVaultSyncChange, type SandboxVaultSyncConfig, type SandboxVaultSyncProgress } from './sandbox-sync';
2
+ import type { VaultMutationConflict, VaultWriteProvenance } from './revisions';
3
+ import { type SandboxVaultPathRejection, type SandboxVaultSyncChange, type SandboxVaultSyncConfig, type SandboxVaultSyncProgress, type SandboxVaultSyncStageObserver } from './sandbox-sync';
4
4
  /** The box calls reconciliation makes; a `@tangle-network/sandbox` instance satisfies it. */
5
5
  export interface VaultReconcileBox extends SandboxExecChannel {
6
6
  id: string;
@@ -20,10 +20,12 @@ export interface SandboxVaultSyncResult {
20
20
  pathsMissingFromBox: string[];
21
21
  operationId: string | null;
22
22
  changes: SandboxVaultSyncChange[];
23
+ /** Box changes the Vault already holds (another path committed the same bytes); recorded without a commit. */
24
+ convergedChanges?: SandboxVaultSyncChange[];
23
25
  appliedPaths: string[];
24
26
  conflicts: VaultMutationConflict[];
25
27
  progress: SandboxVaultSyncProgress;
26
- blockedReason?: 'filesystem_incarnation_missing' | 'filesystem_incarnation_not_ready' | 'vault_directory_missing' | 'sandbox_deletion_denied';
28
+ blockedReason?: 'filesystem_incarnation_missing' | 'filesystem_incarnation_not_ready' | 'vault_directory_missing' | 'sandbox_deletion_denied' | 'mass_deletion_guard';
27
29
  baselineResetReason?: 'baseline_missing' | 'filesystem_incarnation_changed';
28
30
  }
29
31
  /**
@@ -41,6 +43,12 @@ export declare function assertSandboxVaultReconciliation(workspaceId: string, re
41
43
  export interface SandboxVaultSyncOptions {
42
44
  sessionId?: string;
43
45
  operationId?: string;
46
+ /** Attribution the commits carry. */
47
+ provenance?: VaultWriteProvenance;
48
+ /** Refuse, before any commit, a box file the Vault has no live head for (a retained mirror that must not promote unknown bytes). */
49
+ canonicalPathsOnly?: boolean;
50
+ onPhase?: (phase: 'baseline-read' | 'manifest' | 'canonical-heads' | 'file-reads' | 'head-reads' | 'plan-changes' | 'staged' | 'mutate' | 'baseline-write' | 'box-sync-invalidate') => void;
51
+ onStage?: SandboxVaultSyncStageObserver;
44
52
  onStaged?: (checkpoint: {
45
53
  operationId: string;
46
54
  changes: SandboxVaultSyncChange[];
@@ -1,12 +1,16 @@
1
+ import { type VaultDeletionPolicy } from '../server';
1
2
  import type { VaultHeadState, VaultMutationRequest, VaultMutationResult, VaultSandboxBaseline } from './revisions';
2
3
  import type { VaultFrontmatterCodec, VaultHeadListOptions, VaultHeadListPage } from './store';
3
4
  import type { VaultBoxStateView, VaultBoxSyncRecord } from './box-state';
5
+ import type { VaultHydrationBox } from './sandbox-hydrate';
4
6
  /** The store calls the sync engine makes; `createVaultStore` returns all of them. */
5
7
  export interface SandboxVaultSyncStore {
6
8
  codec: VaultFrontmatterCodec;
7
9
  listVaultHeadPage(workspaceId: string, options?: VaultHeadListOptions): Promise<VaultHeadListPage>;
8
10
  readVaultFileState(workspaceId: string, filePath: string): Promise<VaultHeadState>;
9
11
  commitVaultMutation(request: VaultMutationRequest): Promise<VaultMutationResult>;
12
+ /** The committed revision at or before `headRevision` whose content hash is `contentHash`, or null. */
13
+ findVaultRevisionWithContent(workspaceId: string, path: string, headRevision: string, contentHash: string): Promise<string | null>;
10
14
  readVaultSandboxBaseline(workspaceId: string, sandboxId: string): Promise<VaultSandboxBaseline | null>;
11
15
  writeVaultSandboxBaseline(baseline: VaultSandboxBaseline): Promise<void>;
12
16
  readVaultBoxState(workspaceId: string): Promise<VaultBoxStateView | null>;
@@ -26,7 +30,29 @@ export interface SandboxVaultSyncConfig {
26
30
  * box re-hydrates on its next turn. Defaults to `SANDBOX_VAULT_SYNC_CONTRACT`.
27
31
  */
28
32
  contract?: string;
33
+ /**
34
+ * How a box may delete Vault files. `'rename-only'` (the default) commits a
35
+ * delete only as half of a same-content rename. `guard` commits any delete
36
+ * unless the batch trips `assessVaultDeletionBatch` (an empty scan, every
37
+ * file, or most of a large Vault), which withholds every delete of the pass.
38
+ */
39
+ deletes?: 'rename-only' | {
40
+ guard: VaultDeletionPolicy;
41
+ };
42
+ /** Root-relative directories that hold no Vault files, such as a private session tree; reconcile never scans them. */
43
+ excludeDirs?: readonly string[];
44
+ /** Writes one request's text files to the box; defaults to `box.fs.writeMany`. */
45
+ writeText?: (box: VaultHydrationBox, files: Array<{
46
+ path: string;
47
+ content: string;
48
+ }>) => Promise<void>;
49
+ /** Leave a file with no baseline entry in place when the box already holds its exact bytes (a box restored from a snapshot). */
50
+ skipFilesAlreadyOnBox?: boolean;
51
+ /** Leave a file the box refuses for its size off the box and report it in `skipped`, instead of failing hydration. */
52
+ skipOversizeFiles?: boolean;
29
53
  }
54
+ /** A sync stage's timing, for product telemetry. */
55
+ export type SandboxVaultSyncStageObserver = (stage: 'baseline_read' | 'head_list' | 'kv_read' | 'sandbox_write' | 'baseline_write' | 'reconcile_scan' | 'reconcile_import', startedAt: number, detail?: Record<string, number>) => void;
30
56
  /** The engine's own hydration contract; a product appends its own when its box layout changes. */
31
57
  export declare const SANDBOX_VAULT_SYNC_CONTRACT = "agent-app-sandbox-vault-sync-v1";
32
58
  /** The body prefix of a Vault document whose remainder is base64-encoded binary bytes. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.63.59",
3
+ "version": "0.63.60",
4
4
  "packageManager": "pnpm@11.28.8",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [
@@ -805,9 +805,9 @@
805
805
  "@tangle-network/agent-runtime": "0.350.2",
806
806
  "@tangle-network/brand": "1.27.1",
807
807
  "@tangle-network/browser-agent-driver": "0.37.0",
808
- "@tangle-network/hub-sdk": "0.33.3",
809
- "@tangle-network/sandbox": "0.69.10",
810
- "@tangle-network/sandbox-ui": "0.139.0",
808
+ "@tangle-network/hub-sdk": "0.33.4",
809
+ "@tangle-network/sandbox": "0.69.11",
810
+ "@tangle-network/sandbox-ui": "0.139.1",
811
811
  "@tangle-network/tcloud": "0.8.5",
812
812
  "@tangle-network/ui": "11.44.1",
813
813
  "@testing-library/dom": "^10.4.2",
@@ -1008,7 +1008,7 @@
1008
1008
  }
1009
1009
  },
1010
1010
  "dependencies": {
1011
- "@tangle-network/charts": "0.21.11",
1011
+ "@tangle-network/charts": "0.21.13",
1012
1012
  "proper-lockfile": "4.1.2"
1013
1013
  }
1014
1014
  }