@tangle-network/agent-app 0.45.4 → 0.45.6

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.
@@ -261,6 +261,277 @@ declare function statSandboxFileSize(box: SandboxExecChannel, absolutePath: stri
261
261
  * mismatch is reported, never returned as a short buffer. */
262
262
  declare function readSandboxBinaryBytes(box: SandboxExecChannel, absolutePath: string, expectedSize: number, options?: SandboxExecOptions): Promise<SandboxFileBytesOutcome>;
263
263
 
264
+ /**
265
+ * What an app does after the platform hands back a sandbox it cannot use.
266
+ *
267
+ * `replaceUnbringableBox` (see `./index`) decides whether to abandon a dead box.
268
+ * This decides everything around that: which box key the next attempt uses,
269
+ * whether the old box's snapshot is safe to restore from, whether an owner has
270
+ * to confirm the loss first, and what the person waiting is told. It is
271
+ * bookkeeping, not I/O — the app supplies storage through
272
+ * {@link WorkspaceSandboxRecoveryStore}.
273
+ *
274
+ * ── Why the tables ──────────────────────────────────────────────────────────
275
+ * Every fact about an action or a code lives in ACTIONS/CODES below, and the
276
+ * types are DERIVED from those tables. That is deliberate, and it is the whole
277
+ * reliability argument for this module.
278
+ *
279
+ * The hand-maintained alternative — a union type plus a separate `x === 'a' ||
280
+ * x === 'b' || …` list per question — silently drops anything not on the list.
281
+ * A recovery recorded under an unlisted action is written to storage, read
282
+ * back, discarded as malformed, and the workspace re-provisions the box it just
283
+ * abandoned. Nothing throws. The fix looks correct, ships, and does nothing.
284
+ * That failure was hit twice inside one change before this module existed.
285
+ *
286
+ * With the tables, adding an action or code is a compile error until every
287
+ * question about it is answered. There is no list to forget.
288
+ */
289
+ /** The box exists and still holds unsnapshotted state, so discarding it is an
290
+ * owner's decision, not the runtime's. */
291
+ declare const EGRESS_PROXY_RECOVERY_REQUIRED = "EGRESS_PROXY_RECOVERY_REQUIRED";
292
+ declare const EGRESS_PROXY_RECOVERY_PHASE = "egress_proxy_recovery";
293
+ /** The platform no longer has the box. Nothing to confirm, delete, or restore. */
294
+ declare const WORKSPACE_SANDBOX_MISSING = "WORKSPACE_SANDBOX_MISSING";
295
+ /** The box exists but its host has no free slot, so it can never be resumed
296
+ * where it is. A replacement can be placed on a host with room. */
297
+ declare const WORKSPACE_SANDBOX_HOST_EXHAUSTED = "WORKSPACE_SANDBOX_HOST_EXHAUSTED";
298
+ /** The platform ran its own recovery, failed, and asked for a replacement.
299
+ * Covers every way a box ends up unbringable with no more specific cause. */
300
+ declare const WORKSPACE_SANDBOX_UNRECOVERABLE = "WORKSPACE_SANDBOX_UNRECOVERABLE";
301
+ declare const WORKSPACE_SANDBOX_SNAPSHOT_MAX_AGE_MS: number;
302
+ /**
303
+ * Every recovery cause, and the one thing the runtime must know about each:
304
+ * whether the box it names can still be read from.
305
+ *
306
+ * `snapshotUsable: false` is not a preference. A snapshot is addressed by the
307
+ * sandbox it was taken from, so when that sandbox cannot be started the restore
308
+ * fails exactly the way the resume did — and an app that tried it would turn a
309
+ * recoverable workspace into a stuck one.
310
+ */
311
+ declare const CODES: {
312
+ readonly EGRESS_PROXY_RECOVERY_REQUIRED: {
313
+ readonly snapshotUsable: true;
314
+ };
315
+ readonly WORKSPACE_SANDBOX_MISSING: {
316
+ readonly snapshotUsable: false;
317
+ };
318
+ readonly WORKSPACE_SANDBOX_HOST_EXHAUSTED: {
319
+ readonly snapshotUsable: false;
320
+ };
321
+ readonly WORKSPACE_SANDBOX_UNRECOVERABLE: {
322
+ readonly snapshotUsable: false;
323
+ };
324
+ };
325
+ type WorkspaceSandboxRecoveryCode = keyof typeof CODES;
326
+ /**
327
+ * Every recovery action, and whether it means a replacement box has been
328
+ * CHOSEN — the single question that decides which box key the next provisioning
329
+ * attempt uses.
330
+ *
331
+ * `replacementChosen: false` covers the states where a key may be recorded but
332
+ * must not be used yet: an owner has been asked and has not answered, or has
333
+ * answered no. Handing back a key in those states replaces a box the owner
334
+ * declined to lose.
335
+ */
336
+ declare const ACTIONS: {
337
+ readonly confirmation_required: {
338
+ readonly replacementChosen: false;
339
+ };
340
+ readonly deletion_declined: {
341
+ readonly replacementChosen: false;
342
+ };
343
+ readonly replacement_authorized: {
344
+ readonly replacementChosen: false;
345
+ };
346
+ readonly snapshot_replacement_authorized: {
347
+ readonly replacementChosen: false;
348
+ };
349
+ readonly replacement_started: {
350
+ readonly replacementChosen: true;
351
+ };
352
+ readonly replacement_completed: {
353
+ readonly replacementChosen: true;
354
+ };
355
+ readonly snapshot_replacement_started: {
356
+ readonly replacementChosen: true;
357
+ };
358
+ readonly snapshot_restore_failed: {
359
+ readonly replacementChosen: true;
360
+ };
361
+ readonly snapshot_replacement_completed: {
362
+ readonly replacementChosen: true;
363
+ };
364
+ readonly missing_replacement_started: {
365
+ readonly replacementChosen: true;
366
+ };
367
+ readonly missing_replacement_completed: {
368
+ readonly replacementChosen: true;
369
+ };
370
+ readonly unrecoverable_replacement_started: {
371
+ readonly replacementChosen: true;
372
+ };
373
+ readonly unrecoverable_replacement_completed: {
374
+ readonly replacementChosen: true;
375
+ };
376
+ };
377
+ type WorkspaceSandboxRecoveryAction = keyof typeof ACTIONS;
378
+ type WorkspaceSandboxSnapshotAvailability = 'available' | 'missing' | 'stale';
379
+ type WorkspaceSandboxSnapshotFreshness = 'fresh' | 'stale' | 'unknown';
380
+ /** A snapshot the app took of a box, addressed by the box it came from. */
381
+ interface WorkspaceSandboxSnapshot {
382
+ fromSandboxId: string;
383
+ createdAt: string;
384
+ [key: string]: unknown;
385
+ }
386
+ interface WorkspaceSandboxSnapshotAssessment {
387
+ availability: WorkspaceSandboxSnapshotAvailability;
388
+ freshness: WorkspaceSandboxSnapshotFreshness;
389
+ snapshot?: WorkspaceSandboxSnapshot;
390
+ }
391
+ interface WorkspaceSandboxRecoveryState {
392
+ code: WorkspaceSandboxRecoveryCode;
393
+ sandboxId: string;
394
+ detectedAt: string;
395
+ snapshot: WorkspaceSandboxSnapshotAssessment;
396
+ action: WorkspaceSandboxRecoveryAction;
397
+ replacementBoxKey?: string;
398
+ replacementSandboxId?: string;
399
+ confirmedAt?: string;
400
+ }
401
+ type WorkspaceSandboxRecoveryDecision = 'replace' | 'decline';
402
+ /** Raised when chat cannot continue until an owner decides about the box. */
403
+ declare class WorkspaceSandboxRecoveryRequiredError extends Error {
404
+ readonly code = "EGRESS_PROXY_RECOVERY_REQUIRED";
405
+ readonly status = 409;
406
+ readonly phase = "egress_proxy_recovery";
407
+ readonly recovery: WorkspaceSandboxRecoveryState;
408
+ constructor(recovery: WorkspaceSandboxRecoveryState, cause: Error);
409
+ }
410
+ declare function isEgressProxyRecoveryRequiredError(error: unknown): boolean;
411
+ declare function isWorkspaceSandboxSnapshotRestoreError(error: unknown): boolean;
412
+ /**
413
+ * Judge a snapshot against the box being replaced.
414
+ *
415
+ * Fresh means BOTH that it came from this exact sandbox and that it is inside
416
+ * the age bound — a snapshot from a different box restores someone else's
417
+ * filesystem, which is worse than starting empty.
418
+ */
419
+ declare function assessWorkspaceSandboxSnapshot(snapshot: WorkspaceSandboxSnapshot | undefined, sandboxId: string, now?: number): WorkspaceSandboxSnapshotAssessment;
420
+ declare function isWorkspaceSandboxRecoveryAction(value: unknown): value is WorkspaceSandboxRecoveryAction;
421
+ declare function isWorkspaceSandboxRecoveryCode(value: unknown): value is WorkspaceSandboxRecoveryCode;
422
+ declare function isWorkspaceSandboxRecoveryState(value: unknown): value is WorkspaceSandboxRecoveryState;
423
+ declare function workspaceSandboxRecoveryFromError(error: unknown): WorkspaceSandboxRecoveryState | undefined;
424
+ /** What to tell the person waiting. Never names the product, so an app can
425
+ * surface it verbatim. */
426
+ declare function workspaceSandboxRecoveryMessage(recovery: WorkspaceSandboxRecoveryState): string;
427
+ declare function workspaceSandboxRecoveryRecommendedActions(recovery: WorkspaceSandboxRecoveryState): string[];
428
+ /** Flat key/value shape for a log line — no nesting, no secrets. */
429
+ declare function workspaceSandboxRecoveryDiagnostic(recovery: WorkspaceSandboxRecoveryState): Record<string, string | undefined>;
430
+ /**
431
+ * The box key the next provisioning attempt should use, or undefined to keep
432
+ * using the workspace's own key.
433
+ *
434
+ * Reads {@link ACTIONS} rather than a hand-kept list, because the failure mode
435
+ * of a hand-kept list here is invisible: the key is recorded, silently ignored,
436
+ * and provisioning goes back to the box the app just decided to abandon.
437
+ */
438
+ declare function preferredWorkspaceSandboxRecoveryBoxKey(recovery: WorkspaceSandboxRecoveryState | undefined): string | undefined;
439
+ /** Whether the replacement should be restored from the old box's snapshot. */
440
+ declare function shouldRestoreWorkspaceSandboxRecovery(recovery: WorkspaceSandboxRecoveryState | undefined): boolean;
441
+ /**
442
+ * Where an app keeps recovery state. One row per workspace, last write wins —
443
+ * a recovery is a current situation, not a history.
444
+ */
445
+ interface WorkspaceSandboxRecoveryStore {
446
+ read: (workspaceId: string) => Promise<WorkspaceSandboxRecoveryState | undefined>;
447
+ write: (workspaceId: string, recovery: WorkspaceSandboxRecoveryState) => Promise<void>;
448
+ }
449
+ interface WorkspaceSandboxRecoveryManager {
450
+ read: (workspaceId: string) => Promise<WorkspaceSandboxRecoveryState | undefined>;
451
+ record: (workspaceId: string, recovery: WorkspaceSandboxRecoveryState) => Promise<void>;
452
+ /** Record an owner's decision. Returns undefined when the stored recovery does
453
+ * not name this sandbox — a decision about a box that has already been
454
+ * replaced must not resurrect it. */
455
+ decide: (args: {
456
+ workspaceId: string;
457
+ sandboxId: string;
458
+ decision: WorkspaceSandboxRecoveryDecision;
459
+ replacementBoxKey?: string;
460
+ }) => Promise<WorkspaceSandboxRecoveryState | undefined>;
461
+ /** Mark a replacement finished and name the box that took over. */
462
+ complete: (args: {
463
+ workspaceId: string;
464
+ replacementSandboxId: string;
465
+ }) => Promise<WorkspaceSandboxRecoveryState | undefined>;
466
+ }
467
+ /**
468
+ * Bind the recovery bookkeeping to an app's storage.
469
+ *
470
+ * The app owns persistence — a D1 column, a KV key, a Postgres row — and
471
+ * nothing else. Every rule about which action means what stays here, so it
472
+ * cannot drift between apps.
473
+ */
474
+ declare function createWorkspaceSandboxRecoveryManager(store: WorkspaceSandboxRecoveryStore): WorkspaceSandboxRecoveryManager;
475
+ /** Every declared action, for exhaustiveness tests in apps and here. */
476
+ declare const WORKSPACE_SANDBOX_RECOVERY_ACTIONS: readonly WorkspaceSandboxRecoveryAction[];
477
+ /** Every declared cause. */
478
+ declare const WORKSPACE_SANDBOX_RECOVERY_CODES: readonly WorkspaceSandboxRecoveryCode[];
479
+
480
+ interface SafeSandboxErrorCause {
481
+ name?: string;
482
+ message?: string;
483
+ code?: string | number;
484
+ status?: string | number;
485
+ phase?: string;
486
+ endpoint?: string;
487
+ origin?: string;
488
+ retryAfterMs?: number;
489
+ sidecarVersion?: string;
490
+ containerImage?: string;
491
+ }
492
+ interface SafeSandboxErrorDiagnostics {
493
+ message: string;
494
+ causes: SafeSandboxErrorCause[];
495
+ truncated: boolean;
496
+ truncatedAtDepth?: number;
497
+ cycle: boolean;
498
+ }
499
+ declare function serializeSandboxProvisioningError(error: unknown, options?: {
500
+ maxDepth?: number;
501
+ }): SafeSandboxErrorDiagnostics;
502
+ declare function formatSandboxProvisioningSupportDetails(diagnostics: SafeSandboxErrorDiagnostics): string;
503
+ declare function isSandboxAuthFailure(diagnostics: SafeSandboxErrorDiagnostics): boolean;
504
+ declare function isSandboxApiBearerAuthFailure(diagnostics: SafeSandboxErrorDiagnostics): boolean;
505
+ /**
506
+ * True when the sandbox API answered 404 for a specific sandbox resource — the
507
+ * box behind a persisted sandbox id no longer exists.
508
+ *
509
+ * A sandbox id is a cache of where a workspace's box lives, not the workspace's
510
+ * identity: the platform reaps, suspends, and loses boxes as ordinary lifecycle
511
+ * events. Callers use this to discard the dead id and provision a replacement,
512
+ * so the match is deliberately narrow — a 404 from the runtime sidecar
513
+ * (`/runtime/...`, a missing file or session inside a live box) is NOT this.
514
+ */
515
+ declare function isSandboxApiSandboxMissingFailure(diagnostics: SafeSandboxErrorDiagnostics): boolean;
516
+ /**
517
+ * True when a resume failed because the host the box is pinned to cannot seat
518
+ * it — the host's slot budget is exhausted, not the box's fault and not
519
+ * something waiting fixes.
520
+ *
521
+ * A box lives on one host. When that host fills, every future resume for every
522
+ * box on it fails identically and permanently, so a workspace whose box landed
523
+ * on a full host is bricked until it is placed somewhere else. Callers use this
524
+ * the same way they use {@link isSandboxApiSandboxMissingFailure}: discard the
525
+ * dead id and provision a replacement, which the orchestrator is free to place
526
+ * on a host with room. The workspace itself is preserved — it lives in the
527
+ * Vault, not in the box's filesystem.
528
+ *
529
+ * Matched on the message because the sandbox API returns a generic
530
+ * `SERVER_ERROR` for it; a dedicated code upstream would replace this.
531
+ */
532
+ declare function isSandboxHostCapacityFailure(diagnostics: SafeSandboxErrorDiagnostics): boolean;
533
+ declare function formatSandboxProvisioningUserMessage(diagnostics: SafeSandboxErrorDiagnostics): string;
534
+
264
535
  /** Define the shape of a workspace sandbox instance including its connection details and status. */
265
536
  interface WorkspaceSandboxInstanceLike {
266
537
  id: string;
@@ -998,6 +1269,7 @@ declare class SandboxEgressPolicyMismatchError extends Error {
998
1269
  readonly desiredPolicy: EgressPolicy;
999
1270
  constructor(stage: SandboxExistingBoxStage, boxName: string, currentPolicy: EgressPolicy, currentSource: SandboxEgressPolicySource, desiredPolicy: EgressPolicy);
1000
1271
  }
1272
+
1001
1273
  /** Represent an error thrown when sandbox runtime authentication refresh fails for a specific stage and name */
1002
1274
  declare class SandboxRuntimeAuthRefreshError extends Error {
1003
1275
  constructor(stage: SandboxExistingBoxStage, name: string, detail: string, cause?: unknown);
@@ -1287,4 +1559,4 @@ declare function isTerminalPromptEvent(event: unknown): boolean;
1287
1559
  /** Resolve the interactive question text from a structured event or return null if none found */
1288
1560
  declare function detectInteractiveQuestion(event: unknown): string | null;
1289
1561
 
1290
- export { type AppToolDescriptor, type BuildAppToolMcpServersOptions, type BuildSandboxToolFileMountsOptions, type D1PrewarmClaimStoreOptions, DEFAULT_PREWARM_CLAIM_TABLE, DEFAULT_SANDBOX_RESOURCES, DEFAULT_SIDECAR_PROCESS_PATTERN, type DriveSandboxTurnOptions, ENV_TOTAL_MAX_BYTES, ENV_VALUE_MAX_BYTES, type EnsureWorkspaceSandboxOptions, type LivenessProbeConfig, type MemberSyncSeam, type ModelSelection, type ModelSelectionError, type ModelSelectionFailure, type ModelSelectionSource, type Outcome, PREWARM_CLAIM_TABLE_DDL, PROVISION_PAYLOAD_MAX_BYTES, type PeekWorkspaceSandboxOutcome, type PrewarmClaimD1Like, type PrewarmClaimStore, type PrewarmDecision, type PrewarmEvent, type PrewarmOutcome, type PrewarmResult, type ProfileComposeOptions, type PromptInputPart, type ProviderResolutionConfig, type ProvisionPayloadSections, type ProvisionProfileSection, type ResolveSandboxClientCredentialsOptions, type ResolvedModel, type SandboxBuildContext, type SandboxClientCredentials, type SandboxCredentialEnvironment, SandboxEgressPolicyMismatchError, type SandboxEgressPolicySource, type SandboxExecChannel, type SandboxExecOptions, type SandboxExistingBoxStage, type SandboxFileBytesOutcome, type SandboxFileSizeOutcome, SandboxModelResolutionError, type SandboxPermissionLevel, type SandboxPrewarmScope, type SandboxPrewarmer, type SandboxPrewarmerOptions, type SandboxReadiness, SandboxRecoveryFailedError, type SandboxRecoveryPhase, type SandboxResourceConfig, type SandboxRestoreSpec, SandboxRuntimeAuthRefreshError, type SandboxRuntimeConfig, type SandboxScope, type SandboxStepTransition, type SandboxTerminalConnectionRouteOptions, type SandboxToolPathOptions, type SandboxToolSpec, type ScopedTokenResult, type SecretStore, type StoppedSandboxResumeFailure, type StoppedSandboxResumeRecovery, type StreamSandboxPromptOptions, type TerminalConnectionBoxLike, type WorkspaceSandboxEnsureContext, type WorkspaceSandboxInstanceLike, type WorkspaceSandboxManager, type WorkspaceSandboxManagerOptions, type WriteProfileFilesOptions, assertEnvWithinLimits, assertProvisionPayloadWithinCap, attachReasoningEffort, buildAppToolMcpServers, buildSandboxToolFileMounts, buildSandboxToolPathSetupScript, classifySeveredStream, collectSandboxPromptText, createD1PrewarmClaimStore, createSandboxPrewarmer, createSandboxTerminalConnectionRoute, createWorkspaceSandboxManager, deferredCorpusHash, deleteSecret, detectInteractiveQuestion, driveSandboxTurn, ensureWorkspaceSandbox, flattenHistory, getClient, isTerminalPromptEvent, mergeExtraMcp, mergeHistoryIntoParts, mintSandboxScopedToken, peekWorkspaceSandbox, readSandboxBinaryBytes, readSecret, requireTransportableModel, resetClientCache, resolveModel, resolveModelSelection, resolveSandboxClientCredentials, runSandboxPrompt, runSandboxToolPathSetup, sandboxToolBinDir, sandboxToolPath, sandboxToolRootDir, secretStoreFromClient, shellQuote, splitDeferredProfileFiles, statSandboxFileSize, storeSecret, streamSandboxPrompt, syncSandboxMemberAdd, syncSandboxMemberRemove, syncSandboxMemberRole, writeProfileFilesToBox };
1562
+ export { type AppToolDescriptor, type BuildAppToolMcpServersOptions, type BuildSandboxToolFileMountsOptions, type D1PrewarmClaimStoreOptions, DEFAULT_PREWARM_CLAIM_TABLE, DEFAULT_SANDBOX_RESOURCES, DEFAULT_SIDECAR_PROCESS_PATTERN, type DriveSandboxTurnOptions, EGRESS_PROXY_RECOVERY_PHASE, EGRESS_PROXY_RECOVERY_REQUIRED, ENV_TOTAL_MAX_BYTES, ENV_VALUE_MAX_BYTES, type EnsureWorkspaceSandboxOptions, type LivenessProbeConfig, type MemberSyncSeam, type ModelSelection, type ModelSelectionError, type ModelSelectionFailure, type ModelSelectionSource, type Outcome, PREWARM_CLAIM_TABLE_DDL, PROVISION_PAYLOAD_MAX_BYTES, type PeekWorkspaceSandboxOutcome, type PrewarmClaimD1Like, type PrewarmClaimStore, type PrewarmDecision, type PrewarmEvent, type PrewarmOutcome, type PrewarmResult, type ProfileComposeOptions, type PromptInputPart, type ProviderResolutionConfig, type ProvisionPayloadSections, type ProvisionProfileSection, type ResolveSandboxClientCredentialsOptions, type ResolvedModel, type SafeSandboxErrorCause, type SafeSandboxErrorDiagnostics, type SandboxBuildContext, type SandboxClientCredentials, type SandboxCredentialEnvironment, SandboxEgressPolicyMismatchError, type SandboxEgressPolicySource, type SandboxExecChannel, type SandboxExecOptions, type SandboxExistingBoxStage, type SandboxFileBytesOutcome, type SandboxFileSizeOutcome, SandboxModelResolutionError, type SandboxPermissionLevel, type SandboxPrewarmScope, type SandboxPrewarmer, type SandboxPrewarmerOptions, type SandboxReadiness, SandboxRecoveryFailedError, type SandboxRecoveryPhase, type SandboxResourceConfig, type SandboxRestoreSpec, SandboxRuntimeAuthRefreshError, type SandboxRuntimeConfig, type SandboxScope, type SandboxStepTransition, type SandboxTerminalConnectionRouteOptions, type SandboxToolPathOptions, type SandboxToolSpec, type ScopedTokenResult, type SecretStore, type StoppedSandboxResumeFailure, type StoppedSandboxResumeRecovery, type StreamSandboxPromptOptions, type TerminalConnectionBoxLike, WORKSPACE_SANDBOX_HOST_EXHAUSTED, WORKSPACE_SANDBOX_MISSING, WORKSPACE_SANDBOX_RECOVERY_ACTIONS, WORKSPACE_SANDBOX_RECOVERY_CODES, WORKSPACE_SANDBOX_SNAPSHOT_MAX_AGE_MS, WORKSPACE_SANDBOX_UNRECOVERABLE, type WorkspaceSandboxEnsureContext, type WorkspaceSandboxInstanceLike, type WorkspaceSandboxManager, type WorkspaceSandboxManagerOptions, type WorkspaceSandboxRecoveryAction, type WorkspaceSandboxRecoveryCode, type WorkspaceSandboxRecoveryDecision, type WorkspaceSandboxRecoveryManager, WorkspaceSandboxRecoveryRequiredError, type WorkspaceSandboxRecoveryState, type WorkspaceSandboxRecoveryStore, type WorkspaceSandboxSnapshot, type WorkspaceSandboxSnapshotAssessment, type WorkspaceSandboxSnapshotAvailability, type WorkspaceSandboxSnapshotFreshness, type WriteProfileFilesOptions, assertEnvWithinLimits, assertProvisionPayloadWithinCap, assessWorkspaceSandboxSnapshot, attachReasoningEffort, buildAppToolMcpServers, buildSandboxToolFileMounts, buildSandboxToolPathSetupScript, classifySeveredStream, collectSandboxPromptText, createD1PrewarmClaimStore, createSandboxPrewarmer, createSandboxTerminalConnectionRoute, createWorkspaceSandboxManager, createWorkspaceSandboxRecoveryManager, deferredCorpusHash, deleteSecret, detectInteractiveQuestion, driveSandboxTurn, ensureWorkspaceSandbox, flattenHistory, formatSandboxProvisioningSupportDetails, formatSandboxProvisioningUserMessage, getClient, isEgressProxyRecoveryRequiredError, isSandboxApiBearerAuthFailure, isSandboxApiSandboxMissingFailure, isSandboxAuthFailure, isSandboxHostCapacityFailure, isTerminalPromptEvent, isWorkspaceSandboxRecoveryAction, isWorkspaceSandboxRecoveryCode, isWorkspaceSandboxRecoveryState, isWorkspaceSandboxSnapshotRestoreError, mergeExtraMcp, mergeHistoryIntoParts, mintSandboxScopedToken, peekWorkspaceSandbox, preferredWorkspaceSandboxRecoveryBoxKey, readSandboxBinaryBytes, readSecret, requireTransportableModel, resetClientCache, resolveModel, resolveModelSelection, resolveSandboxClientCredentials, runSandboxPrompt, runSandboxToolPathSetup, sandboxToolBinDir, sandboxToolPath, sandboxToolRootDir, secretStoreFromClient, serializeSandboxProvisioningError, shellQuote, shouldRestoreWorkspaceSandboxRecovery, splitDeferredProfileFiles, statSandboxFileSize, storeSecret, streamSandboxPrompt, syncSandboxMemberAdd, syncSandboxMemberRemove, syncSandboxMemberRole, workspaceSandboxRecoveryDiagnostic, workspaceSandboxRecoveryFromError, workspaceSandboxRecoveryMessage, workspaceSandboxRecoveryRecommendedActions, writeProfileFilesToBox };
@@ -2,6 +2,8 @@ import {
2
2
  DEFAULT_PREWARM_CLAIM_TABLE,
3
3
  DEFAULT_SANDBOX_RESOURCES,
4
4
  DEFAULT_SIDECAR_PROCESS_PATTERN,
5
+ EGRESS_PROXY_RECOVERY_PHASE,
6
+ EGRESS_PROXY_RECOVERY_REQUIRED,
5
7
  ENV_TOTAL_MAX_BYTES,
6
8
  ENV_VALUE_MAX_BYTES,
7
9
  PREWARM_CLAIM_TABLE_DDL,
@@ -10,8 +12,16 @@ import {
10
12
  SandboxModelResolutionError,
11
13
  SandboxRecoveryFailedError,
12
14
  SandboxRuntimeAuthRefreshError,
15
+ WORKSPACE_SANDBOX_HOST_EXHAUSTED,
16
+ WORKSPACE_SANDBOX_MISSING,
17
+ WORKSPACE_SANDBOX_RECOVERY_ACTIONS,
18
+ WORKSPACE_SANDBOX_RECOVERY_CODES,
19
+ WORKSPACE_SANDBOX_SNAPSHOT_MAX_AGE_MS,
20
+ WORKSPACE_SANDBOX_UNRECOVERABLE,
21
+ WorkspaceSandboxRecoveryRequiredError,
13
22
  assertEnvWithinLimits,
14
23
  assertProvisionPayloadWithinCap,
24
+ assessWorkspaceSandboxSnapshot,
15
25
  attachReasoningEffort,
16
26
  buildAppToolMcpServers,
17
27
  buildSandboxToolFileMounts,
@@ -22,18 +32,31 @@ import {
22
32
  createSandboxPrewarmer,
23
33
  createSandboxTerminalConnectionRoute,
24
34
  createWorkspaceSandboxManager,
35
+ createWorkspaceSandboxRecoveryManager,
25
36
  deferredCorpusHash,
26
37
  deleteSecret,
27
38
  detectInteractiveQuestion,
28
39
  driveSandboxTurn,
29
40
  ensureWorkspaceSandbox,
30
41
  flattenHistory,
42
+ formatSandboxProvisioningSupportDetails,
43
+ formatSandboxProvisioningUserMessage,
31
44
  getClient,
45
+ isEgressProxyRecoveryRequiredError,
46
+ isSandboxApiBearerAuthFailure,
47
+ isSandboxApiSandboxMissingFailure,
48
+ isSandboxAuthFailure,
49
+ isSandboxHostCapacityFailure,
32
50
  isTerminalPromptEvent,
51
+ isWorkspaceSandboxRecoveryAction,
52
+ isWorkspaceSandboxRecoveryCode,
53
+ isWorkspaceSandboxRecoveryState,
54
+ isWorkspaceSandboxSnapshotRestoreError,
33
55
  mergeExtraMcp,
34
56
  mergeHistoryIntoParts,
35
57
  mintSandboxScopedToken,
36
58
  peekWorkspaceSandbox,
59
+ preferredWorkspaceSandboxRecoveryBoxKey,
37
60
  readSandboxBinaryBytes,
38
61
  readSecret,
39
62
  requireTransportableModel,
@@ -47,7 +70,9 @@ import {
47
70
  sandboxToolPath,
48
71
  sandboxToolRootDir,
49
72
  secretStoreFromClient,
73
+ serializeSandboxProvisioningError,
50
74
  shellQuote,
75
+ shouldRestoreWorkspaceSandboxRecovery,
51
76
  splitDeferredProfileFiles,
52
77
  statSandboxFileSize,
53
78
  storeSecret,
@@ -55,8 +80,12 @@ import {
55
80
  syncSandboxMemberAdd,
56
81
  syncSandboxMemberRemove,
57
82
  syncSandboxMemberRole,
83
+ workspaceSandboxRecoveryDiagnostic,
84
+ workspaceSandboxRecoveryFromError,
85
+ workspaceSandboxRecoveryMessage,
86
+ workspaceSandboxRecoveryRecommendedActions,
58
87
  writeProfileFilesToBox
59
- } from "../chunk-CS6MJDIM.js";
88
+ } from "../chunk-4XNCMUVI.js";
60
89
  import "../chunk-LWSJK546.js";
61
90
  import "../chunk-73F3CKVK.js";
62
91
  import "../chunk-ITCINLSU.js";
@@ -68,6 +97,8 @@ export {
68
97
  DEFAULT_PREWARM_CLAIM_TABLE,
69
98
  DEFAULT_SANDBOX_RESOURCES,
70
99
  DEFAULT_SIDECAR_PROCESS_PATTERN,
100
+ EGRESS_PROXY_RECOVERY_PHASE,
101
+ EGRESS_PROXY_RECOVERY_REQUIRED,
71
102
  ENV_TOTAL_MAX_BYTES,
72
103
  ENV_VALUE_MAX_BYTES,
73
104
  PREWARM_CLAIM_TABLE_DDL,
@@ -76,8 +107,16 @@ export {
76
107
  SandboxModelResolutionError,
77
108
  SandboxRecoveryFailedError,
78
109
  SandboxRuntimeAuthRefreshError,
110
+ WORKSPACE_SANDBOX_HOST_EXHAUSTED,
111
+ WORKSPACE_SANDBOX_MISSING,
112
+ WORKSPACE_SANDBOX_RECOVERY_ACTIONS,
113
+ WORKSPACE_SANDBOX_RECOVERY_CODES,
114
+ WORKSPACE_SANDBOX_SNAPSHOT_MAX_AGE_MS,
115
+ WORKSPACE_SANDBOX_UNRECOVERABLE,
116
+ WorkspaceSandboxRecoveryRequiredError,
79
117
  assertEnvWithinLimits,
80
118
  assertProvisionPayloadWithinCap,
119
+ assessWorkspaceSandboxSnapshot,
81
120
  attachReasoningEffort,
82
121
  buildAppToolMcpServers,
83
122
  buildSandboxToolFileMounts,
@@ -88,18 +127,31 @@ export {
88
127
  createSandboxPrewarmer,
89
128
  createSandboxTerminalConnectionRoute,
90
129
  createWorkspaceSandboxManager,
130
+ createWorkspaceSandboxRecoveryManager,
91
131
  deferredCorpusHash,
92
132
  deleteSecret,
93
133
  detectInteractiveQuestion,
94
134
  driveSandboxTurn,
95
135
  ensureWorkspaceSandbox,
96
136
  flattenHistory,
137
+ formatSandboxProvisioningSupportDetails,
138
+ formatSandboxProvisioningUserMessage,
97
139
  getClient,
140
+ isEgressProxyRecoveryRequiredError,
141
+ isSandboxApiBearerAuthFailure,
142
+ isSandboxApiSandboxMissingFailure,
143
+ isSandboxAuthFailure,
144
+ isSandboxHostCapacityFailure,
98
145
  isTerminalPromptEvent,
146
+ isWorkspaceSandboxRecoveryAction,
147
+ isWorkspaceSandboxRecoveryCode,
148
+ isWorkspaceSandboxRecoveryState,
149
+ isWorkspaceSandboxSnapshotRestoreError,
99
150
  mergeExtraMcp,
100
151
  mergeHistoryIntoParts,
101
152
  mintSandboxScopedToken,
102
153
  peekWorkspaceSandbox,
154
+ preferredWorkspaceSandboxRecoveryBoxKey,
103
155
  readSandboxBinaryBytes,
104
156
  readSecret,
105
157
  requireTransportableModel,
@@ -113,7 +165,9 @@ export {
113
165
  sandboxToolPath,
114
166
  sandboxToolRootDir,
115
167
  secretStoreFromClient,
168
+ serializeSandboxProvisioningError,
116
169
  shellQuote,
170
+ shouldRestoreWorkspaceSandboxRecovery,
117
171
  splitDeferredProfileFiles,
118
172
  statSandboxFileSize,
119
173
  storeSecret,
@@ -121,6 +175,10 @@ export {
121
175
  syncSandboxMemberAdd,
122
176
  syncSandboxMemberRemove,
123
177
  syncSandboxMemberRole,
178
+ workspaceSandboxRecoveryDiagnostic,
179
+ workspaceSandboxRecoveryFromError,
180
+ workspaceSandboxRecoveryMessage,
181
+ workspaceSandboxRecoveryRecommendedActions,
124
182
  writeProfileFilesToBox
125
183
  };
126
184
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.45.4",
3
+ "version": "0.45.6",
4
4
  "packageManager": "pnpm@11.17.0",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [