@tangle-network/agent-app 0.45.3 → 0.45.5
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.
package/dist/sandbox/index.d.ts
CHANGED
|
@@ -261,6 +261,81 @@ 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
|
+
* Read a sandbox provisioning failure without leaking what it carries.
|
|
266
|
+
*
|
|
267
|
+
* Provisioning errors arrive as deep `cause` chains from the sandbox API, the
|
|
268
|
+
* runtime sidecar, and the app's own vault code, and they routinely carry
|
|
269
|
+
* bearer tokens and signed URLs in their messages. Every app on this shell
|
|
270
|
+
* needs the same three things from one: a redacted shape it can log, a
|
|
271
|
+
* classification it can act on, and a sentence it can show a person. Before
|
|
272
|
+
* this module each app either wrote its own or — far more often — wrote none,
|
|
273
|
+
* and surfaced the raw error or a generic apology.
|
|
274
|
+
*
|
|
275
|
+
* The classifiers are deliberately narrow. `isSandboxApiSandboxMissingFailure`
|
|
276
|
+
* does not fire on a 404 from inside a live box; `isSandboxHostCapacityFailure`
|
|
277
|
+
* does not fire on capacity wording from any origin but the sandbox API. A
|
|
278
|
+
* classifier that over-matches turns a transient failure into a box deletion.
|
|
279
|
+
*/
|
|
280
|
+
/** Error code an app raises when a stopped box's egress proxy must be rebuilt
|
|
281
|
+
* before the box can be reused. Declared here so the classifier below stands
|
|
282
|
+
* alone; apps that model this failure re-export the same literal. */
|
|
283
|
+
declare const EGRESS_PROXY_RECOVERY_REQUIRED = "EGRESS_PROXY_RECOVERY_REQUIRED";
|
|
284
|
+
interface SafeSandboxErrorCause {
|
|
285
|
+
name?: string;
|
|
286
|
+
message?: string;
|
|
287
|
+
code?: string | number;
|
|
288
|
+
status?: string | number;
|
|
289
|
+
phase?: string;
|
|
290
|
+
endpoint?: string;
|
|
291
|
+
origin?: string;
|
|
292
|
+
retryAfterMs?: number;
|
|
293
|
+
sidecarVersion?: string;
|
|
294
|
+
containerImage?: string;
|
|
295
|
+
}
|
|
296
|
+
interface SafeSandboxErrorDiagnostics {
|
|
297
|
+
message: string;
|
|
298
|
+
causes: SafeSandboxErrorCause[];
|
|
299
|
+
truncated: boolean;
|
|
300
|
+
truncatedAtDepth?: number;
|
|
301
|
+
cycle: boolean;
|
|
302
|
+
}
|
|
303
|
+
declare function serializeSandboxProvisioningError(error: unknown, options?: {
|
|
304
|
+
maxDepth?: number;
|
|
305
|
+
}): SafeSandboxErrorDiagnostics;
|
|
306
|
+
declare function formatSandboxProvisioningSupportDetails(diagnostics: SafeSandboxErrorDiagnostics): string;
|
|
307
|
+
declare function isSandboxAuthFailure(diagnostics: SafeSandboxErrorDiagnostics): boolean;
|
|
308
|
+
declare function isSandboxApiBearerAuthFailure(diagnostics: SafeSandboxErrorDiagnostics): boolean;
|
|
309
|
+
/**
|
|
310
|
+
* True when the sandbox API answered 404 for a specific sandbox resource — the
|
|
311
|
+
* box behind a persisted sandbox id no longer exists.
|
|
312
|
+
*
|
|
313
|
+
* A sandbox id is a cache of where a workspace's box lives, not the workspace's
|
|
314
|
+
* identity: the platform reaps, suspends, and loses boxes as ordinary lifecycle
|
|
315
|
+
* events. Callers use this to discard the dead id and provision a replacement,
|
|
316
|
+
* so the match is deliberately narrow — a 404 from the runtime sidecar
|
|
317
|
+
* (`/runtime/...`, a missing file or session inside a live box) is NOT this.
|
|
318
|
+
*/
|
|
319
|
+
declare function isSandboxApiSandboxMissingFailure(diagnostics: SafeSandboxErrorDiagnostics): boolean;
|
|
320
|
+
/**
|
|
321
|
+
* True when a resume failed because the host the box is pinned to cannot seat
|
|
322
|
+
* it — the host's slot budget is exhausted, not the box's fault and not
|
|
323
|
+
* something waiting fixes.
|
|
324
|
+
*
|
|
325
|
+
* A box lives on one host. When that host fills, every future resume for every
|
|
326
|
+
* box on it fails identically and permanently, so a workspace whose box landed
|
|
327
|
+
* on a full host is bricked until it is placed somewhere else. Callers use this
|
|
328
|
+
* the same way they use {@link isSandboxApiSandboxMissingFailure}: discard the
|
|
329
|
+
* dead id and provision a replacement, which the orchestrator is free to place
|
|
330
|
+
* on a host with room. The workspace itself is preserved — it lives in the
|
|
331
|
+
* Vault, not in the box's filesystem.
|
|
332
|
+
*
|
|
333
|
+
* Matched on the message because the sandbox API returns a generic
|
|
334
|
+
* `SERVER_ERROR` for it; a dedicated code upstream would replace this.
|
|
335
|
+
*/
|
|
336
|
+
declare function isSandboxHostCapacityFailure(diagnostics: SafeSandboxErrorDiagnostics): boolean;
|
|
337
|
+
declare function formatSandboxProvisioningUserMessage(diagnostics: SafeSandboxErrorDiagnostics): string;
|
|
338
|
+
|
|
264
339
|
/** Define the shape of a workspace sandbox instance including its connection details and status. */
|
|
265
340
|
interface WorkspaceSandboxInstanceLike {
|
|
266
341
|
id: string;
|
|
@@ -900,6 +975,7 @@ interface SandboxRuntimeConfig {
|
|
|
900
975
|
livenessProbe?: LivenessProbeConfig;
|
|
901
976
|
webTerminalEnabled?: boolean;
|
|
902
977
|
resumeStopped?: boolean;
|
|
978
|
+
replaceUnbringableBox?: boolean;
|
|
903
979
|
recoverStoppedSandbox?: (failure: StoppedSandboxResumeFailure) => Promise<Outcome<StoppedSandboxResumeRecovery | null>>;
|
|
904
980
|
backendModelAtCreate?: boolean;
|
|
905
981
|
deferProfileFiles?: boolean;
|
|
@@ -997,6 +1073,7 @@ declare class SandboxEgressPolicyMismatchError extends Error {
|
|
|
997
1073
|
readonly desiredPolicy: EgressPolicy;
|
|
998
1074
|
constructor(stage: SandboxExistingBoxStage, boxName: string, currentPolicy: EgressPolicy, currentSource: SandboxEgressPolicySource, desiredPolicy: EgressPolicy);
|
|
999
1075
|
}
|
|
1076
|
+
|
|
1000
1077
|
/** Represent an error thrown when sandbox runtime authentication refresh fails for a specific stage and name */
|
|
1001
1078
|
declare class SandboxRuntimeAuthRefreshError extends Error {
|
|
1002
1079
|
constructor(stage: SandboxExistingBoxStage, name: string, detail: string, cause?: unknown);
|
|
@@ -1286,4 +1363,4 @@ declare function isTerminalPromptEvent(event: unknown): boolean;
|
|
|
1286
1363
|
/** Resolve the interactive question text from a structured event or return null if none found */
|
|
1287
1364
|
declare function detectInteractiveQuestion(event: unknown): string | null;
|
|
1288
1365
|
|
|
1289
|
-
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 };
|
|
1366
|
+
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_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, 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, formatSandboxProvisioningSupportDetails, formatSandboxProvisioningUserMessage, getClient, isSandboxApiBearerAuthFailure, isSandboxApiSandboxMissingFailure, isSandboxAuthFailure, isSandboxHostCapacityFailure, isTerminalPromptEvent, mergeExtraMcp, mergeHistoryIntoParts, mintSandboxScopedToken, peekWorkspaceSandbox, readSandboxBinaryBytes, readSecret, requireTransportableModel, resetClientCache, resolveModel, resolveModelSelection, resolveSandboxClientCredentials, runSandboxPrompt, runSandboxToolPathSetup, sandboxToolBinDir, sandboxToolPath, sandboxToolRootDir, secretStoreFromClient, serializeSandboxProvisioningError, shellQuote, splitDeferredProfileFiles, statSandboxFileSize, storeSecret, streamSandboxPrompt, syncSandboxMemberAdd, syncSandboxMemberRemove, syncSandboxMemberRole, writeProfileFilesToBox };
|
package/dist/sandbox/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
DEFAULT_PREWARM_CLAIM_TABLE,
|
|
3
3
|
DEFAULT_SANDBOX_RESOURCES,
|
|
4
4
|
DEFAULT_SIDECAR_PROCESS_PATTERN,
|
|
5
|
+
EGRESS_PROXY_RECOVERY_REQUIRED,
|
|
5
6
|
ENV_TOTAL_MAX_BYTES,
|
|
6
7
|
ENV_VALUE_MAX_BYTES,
|
|
7
8
|
PREWARM_CLAIM_TABLE_DDL,
|
|
@@ -28,7 +29,13 @@ import {
|
|
|
28
29
|
driveSandboxTurn,
|
|
29
30
|
ensureWorkspaceSandbox,
|
|
30
31
|
flattenHistory,
|
|
32
|
+
formatSandboxProvisioningSupportDetails,
|
|
33
|
+
formatSandboxProvisioningUserMessage,
|
|
31
34
|
getClient,
|
|
35
|
+
isSandboxApiBearerAuthFailure,
|
|
36
|
+
isSandboxApiSandboxMissingFailure,
|
|
37
|
+
isSandboxAuthFailure,
|
|
38
|
+
isSandboxHostCapacityFailure,
|
|
32
39
|
isTerminalPromptEvent,
|
|
33
40
|
mergeExtraMcp,
|
|
34
41
|
mergeHistoryIntoParts,
|
|
@@ -47,6 +54,7 @@ import {
|
|
|
47
54
|
sandboxToolPath,
|
|
48
55
|
sandboxToolRootDir,
|
|
49
56
|
secretStoreFromClient,
|
|
57
|
+
serializeSandboxProvisioningError,
|
|
50
58
|
shellQuote,
|
|
51
59
|
splitDeferredProfileFiles,
|
|
52
60
|
statSandboxFileSize,
|
|
@@ -56,7 +64,7 @@ import {
|
|
|
56
64
|
syncSandboxMemberRemove,
|
|
57
65
|
syncSandboxMemberRole,
|
|
58
66
|
writeProfileFilesToBox
|
|
59
|
-
} from "../chunk-
|
|
67
|
+
} from "../chunk-QGHQ2IRC.js";
|
|
60
68
|
import "../chunk-LWSJK546.js";
|
|
61
69
|
import "../chunk-73F3CKVK.js";
|
|
62
70
|
import "../chunk-ITCINLSU.js";
|
|
@@ -68,6 +76,7 @@ export {
|
|
|
68
76
|
DEFAULT_PREWARM_CLAIM_TABLE,
|
|
69
77
|
DEFAULT_SANDBOX_RESOURCES,
|
|
70
78
|
DEFAULT_SIDECAR_PROCESS_PATTERN,
|
|
79
|
+
EGRESS_PROXY_RECOVERY_REQUIRED,
|
|
71
80
|
ENV_TOTAL_MAX_BYTES,
|
|
72
81
|
ENV_VALUE_MAX_BYTES,
|
|
73
82
|
PREWARM_CLAIM_TABLE_DDL,
|
|
@@ -94,7 +103,13 @@ export {
|
|
|
94
103
|
driveSandboxTurn,
|
|
95
104
|
ensureWorkspaceSandbox,
|
|
96
105
|
flattenHistory,
|
|
106
|
+
formatSandboxProvisioningSupportDetails,
|
|
107
|
+
formatSandboxProvisioningUserMessage,
|
|
97
108
|
getClient,
|
|
109
|
+
isSandboxApiBearerAuthFailure,
|
|
110
|
+
isSandboxApiSandboxMissingFailure,
|
|
111
|
+
isSandboxAuthFailure,
|
|
112
|
+
isSandboxHostCapacityFailure,
|
|
98
113
|
isTerminalPromptEvent,
|
|
99
114
|
mergeExtraMcp,
|
|
100
115
|
mergeHistoryIntoParts,
|
|
@@ -113,6 +128,7 @@ export {
|
|
|
113
128
|
sandboxToolPath,
|
|
114
129
|
sandboxToolRootDir,
|
|
115
130
|
secretStoreFromClient,
|
|
131
|
+
serializeSandboxProvisioningError,
|
|
116
132
|
shellQuote,
|
|
117
133
|
splitDeferredProfileFiles,
|
|
118
134
|
statSandboxFileSize,
|
package/package.json
CHANGED