@tangle-network/agent-app 0.61.3 → 0.62.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.
- package/dist/{DesignCanvas-L6J72JQ2.js → DesignCanvas-IQKYAEC4.js} +3 -2
- package/dist/{DesignCanvasEditor-QFQD63MR.js → DesignCanvasEditor-O7OCZTGC.js} +5 -4
- package/dist/{TimelineEditor-7KBPJQLT.js → TimelineEditor-VB2UJ34D.js} +4 -2
- package/dist/VaultPane-AYW7CO33.js +8 -0
- package/dist/agent-profiles/d1.js +1 -1
- package/dist/agent-profiles/index.d.ts +0 -82
- package/dist/agent-profiles/index.js +1 -21
- package/dist/agent-profiles/self-management.d.ts +0 -55
- package/dist/alerting/index.d.ts +1 -1
- package/dist/alerting/index.js +1 -3
- package/dist/alerting/slack.d.ts +6 -79
- package/dist/app-auth/drizzle.d.ts +17 -271
- package/dist/app-auth/drizzle.js +6 -2
- package/dist/app-auth/drizzle.js.map +1 -1
- package/dist/app-auth/index.js +3 -3
- package/dist/assets/types.d.ts +2 -1
- package/dist/assistant/AssistantPanel.d.ts +1 -1
- package/dist/assistant/index.js +635 -392
- package/dist/assistant/index.js.map +1 -1
- package/dist/billing/identity-locks.d.ts +5 -0
- package/dist/billing/index.js +1 -1
- package/dist/brand-extraction/index.js.map +1 -1
- package/dist/brand-extraction/types.d.ts +2 -1
- package/dist/chat-react/index.js +6 -5
- package/dist/chat-routes/attachment-write-safety.d.ts +4 -0
- package/dist/chat-routes/draft-persistence.d.ts +2 -14
- package/dist/chat-routes/index.d.ts +1 -0
- package/dist/chat-routes/index.js +853 -773
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/sandbox-model-source.d.ts +20 -0
- package/dist/chat-routes/stored-attachments.d.ts +18 -0
- package/dist/chat-routes/turn-admission.d.ts +1 -1
- package/dist/chat-routes/turn-execution.d.ts +2 -2
- package/dist/chat-routes/turn-route-contracts.d.ts +3 -29
- package/dist/chat-store/core.d.ts +19 -1
- package/dist/chat-store/index.js.map +1 -1
- package/dist/chat-store/store.d.ts +3 -29
- package/dist/{chunk-ATQQCG4I.js → chunk-2VJLLRVV.js} +2 -2
- package/dist/{chunk-R4X5474U.js → chunk-52SDU43B.js} +12 -27
- package/dist/chunk-52SDU43B.js.map +1 -0
- package/dist/{chunk-MDRH3SDA.js → chunk-54YIL7WM.js} +3 -3
- package/dist/{chunk-6QJ3GB3A.js → chunk-5GSZGTPJ.js} +2 -2
- package/dist/{chunk-5IM2CLYX.js → chunk-6JEDSKFH.js} +232 -218
- package/dist/chunk-6JEDSKFH.js.map +1 -0
- package/dist/{chunk-6PRQ45QE.js → chunk-6OG4244Y.js} +1 -1
- package/dist/chunk-6OG4244Y.js.map +1 -0
- package/dist/{chunk-ZDPUC6CM.js → chunk-6ZVSMA4T.js} +3 -3
- package/dist/{chunk-TXUAGSFR.js → chunk-76MPX7JQ.js} +47 -1
- package/dist/chunk-76MPX7JQ.js.map +1 -0
- package/dist/{chunk-BOQ4HVVH.js → chunk-7ISHKBAD.js} +61 -52
- package/dist/chunk-7ISHKBAD.js.map +1 -0
- package/dist/chunk-7PULOECS.js +22 -0
- package/dist/chunk-7PULOECS.js.map +1 -0
- package/dist/{chunk-KJODHPWM.js → chunk-CPVGRQ43.js} +511 -339
- package/dist/chunk-CPVGRQ43.js.map +1 -0
- package/dist/{chunk-LO6VQ35O.js → chunk-CQZVJVME.js} +2 -2
- package/dist/{chunk-Y43PXON2.js → chunk-EFQUAWWF.js} +577 -546
- package/dist/chunk-EFQUAWWF.js.map +1 -0
- package/dist/{chunk-FPNZMIAW.js → chunk-ELX5YITO.js} +1 -1
- package/dist/chunk-ELX5YITO.js.map +1 -0
- package/dist/chunk-FGAROAUF.js +19 -0
- package/dist/chunk-FGAROAUF.js.map +1 -0
- package/dist/{chunk-HN6MZ2XL.js → chunk-FTNGGR37.js} +641 -466
- package/dist/chunk-FTNGGR37.js.map +1 -0
- package/dist/{chunk-G4F2NWZH.js → chunk-FZ3ZFVAC.js} +4 -4
- package/dist/{chunk-UCCSJX64.js → chunk-GIEUZBQQ.js} +1112 -644
- package/dist/chunk-GIEUZBQQ.js.map +1 -0
- package/dist/{chunk-MEKOWH5E.js → chunk-IVBREL7A.js} +785 -526
- package/dist/chunk-IVBREL7A.js.map +1 -0
- package/dist/{chunk-WSEXFTN4.js → chunk-JBXNU5WD.js} +26 -26
- package/dist/chunk-JBXNU5WD.js.map +1 -0
- package/dist/{chunk-F2VX6TTJ.js → chunk-JRCZHDRG.js} +2 -41
- package/dist/chunk-JRCZHDRG.js.map +1 -0
- package/dist/{chunk-LXYQOOXU.js → chunk-JRW6LCIA.js} +552 -302
- package/dist/chunk-JRW6LCIA.js.map +1 -0
- package/dist/{chunk-TVPH5T4F.js → chunk-KS4I7KVC.js} +16 -22
- package/dist/{chunk-TVPH5T4F.js.map → chunk-KS4I7KVC.js.map} +1 -1
- package/dist/{chunk-J2BBYVGF.js → chunk-MRZP65DZ.js} +1 -117
- package/dist/chunk-MRZP65DZ.js.map +1 -0
- package/dist/{chunk-4ZSLX3LY.js → chunk-OODZCBSM.js} +1 -1
- package/dist/chunk-OODZCBSM.js.map +1 -0
- package/dist/chunk-P4RRC4AO.js +47 -0
- package/dist/chunk-P4RRC4AO.js.map +1 -0
- package/dist/{chunk-ORQD4AUO.js → chunk-PCAY23GS.js} +1 -6
- package/dist/chunk-PCAY23GS.js.map +1 -0
- package/dist/{chunk-NMZUW6VJ.js → chunk-PEJ5OP5B.js} +3 -3
- package/dist/chunk-PEJ5OP5B.js.map +1 -0
- package/dist/{chunk-NHYRIM4I.js → chunk-PIPNDZ6H.js} +304 -194
- package/dist/chunk-PIPNDZ6H.js.map +1 -0
- package/dist/{chunk-DJIN3YUJ.js → chunk-TCJ4TMOW.js} +83 -47
- package/dist/{chunk-DJIN3YUJ.js.map → chunk-TCJ4TMOW.js.map} +1 -1
- package/dist/chunk-UHSUY6H6.js +79 -0
- package/dist/chunk-UHSUY6H6.js.map +1 -0
- package/dist/{chunk-PDD5A43Y.js → chunk-UTL6TEN6.js} +3 -3
- package/dist/{chunk-VJBFCNAU.js → chunk-UW2DKTEM.js} +123 -130
- package/dist/chunk-UW2DKTEM.js.map +1 -0
- package/dist/{chunk-S27DKRI6.js → chunk-VDYEVCQQ.js} +2 -2
- package/dist/{chunk-UFQM46NV.js → chunk-VK3F4N4U.js} +2 -2
- package/dist/{chunk-6ZIC6OG5.js → chunk-VYBTQK25.js} +126 -122
- package/dist/chunk-VYBTQK25.js.map +1 -0
- package/dist/{chunk-RL3Z747H.js → chunk-W2BV2XOC.js} +1491 -700
- package/dist/chunk-W2BV2XOC.js.map +1 -0
- package/dist/{chunk-FUZETA6Z.js → chunk-X6SZGQTK.js} +2 -2
- package/dist/{chunk-CD2LQXY6.js → chunk-XOHE6SKU.js} +14 -16
- package/dist/{chunk-CD2LQXY6.js.map → chunk-XOHE6SKU.js.map} +1 -1
- package/dist/{chunk-ZBB5KQ6B.js → chunk-Y3GO6SG3.js} +73 -66
- package/dist/chunk-Y3GO6SG3.js.map +1 -0
- package/dist/chunk-ZAMHLXNS.js +56 -0
- package/dist/chunk-ZAMHLXNS.js.map +1 -0
- package/dist/{chunk-RHFN7TUV.js → chunk-ZDHCV462.js} +47 -44
- package/dist/{chunk-RHFN7TUV.js.map → chunk-ZDHCV462.js.map} +1 -1
- package/dist/chunk-ZOS3D26Z.js +72 -0
- package/dist/chunk-ZOS3D26Z.js.map +1 -0
- package/dist/design-canvas/index.js +32 -32
- package/dist/design-canvas/index.js.map +1 -1
- package/dist/design-canvas-react/components/DesignCanvas.d.ts +1 -1
- package/dist/design-canvas-react/components/Workspace.d.ts +1 -1
- package/dist/design-canvas-react/components/glyphs.d.ts +31 -40
- package/dist/design-canvas-react/components/transform-math.d.ts +0 -8
- package/dist/design-canvas-react/components/use-workspace-keyboard.d.ts +2 -2
- package/dist/design-canvas-react/contracts.d.ts +2 -2
- package/dist/design-canvas-react/engine.js +1 -1
- package/dist/design-canvas-react/index.js +9 -7
- package/dist/design-canvas-react/index.js.map +1 -1
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/eval/calibration.d.ts +1 -38
- package/dist/eval/index.d.ts +2 -4
- package/dist/eval/index.js +0 -84
- package/dist/eval/index.js.map +1 -1
- package/dist/harness/index.d.ts +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/harness/session-selection.d.ts +2 -2
- package/dist/hub-approvals/index.js +1 -1
- package/dist/hub-approvals/result.d.ts +1 -1
- package/dist/hub-approvals-react/index.js +4 -4
- package/dist/hub-approvals-react/index.js.map +1 -1
- package/dist/hub-approvals-react/parts.d.ts +1 -1
- package/dist/launch-invariants/cli.js +4 -4
- package/dist/launch-invariants/index.js +3 -3
- package/dist/launch-invariants/testing.js +4 -4
- package/dist/legibility/cli.js +1 -1
- package/dist/legibility/index.js +1 -1
- package/dist/{mention-editor-B23OMFT2.js → mention-editor-4BKBMWIK.js} +83 -57
- package/dist/mention-editor-4BKBMWIK.js.map +1 -0
- package/dist/missions/index.js +144 -137
- package/dist/missions/index.js.map +1 -1
- package/dist/operator/index.js +1 -1
- package/dist/peer-floors/check.js +1 -1
- package/dist/peer-floors/cli.js +6 -14
- package/dist/peer-floors/cli.js.map +1 -1
- package/dist/peer-floors/source-entries.d.ts +6 -0
- package/dist/platform/index.js +10 -10
- package/dist/preset-cloudflare/index.js +1 -1
- package/dist/profile/index.d.ts +0 -1
- package/dist/profile/index.js +1 -422
- package/dist/profile/index.js.map +1 -1
- package/dist/profile-editor/server.d.ts +0 -1
- package/dist/profile-editor/server.js +0 -1
- package/dist/profile-editor/server.js.map +1 -1
- package/dist/public-consultation/index.d.ts +2 -2
- package/dist/public-consultation/index.js +6 -6
- package/dist/record/drizzle.js +156 -148
- package/dist/record/drizzle.js.map +1 -1
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/router-turn.js +3 -3
- package/dist/sandbox/box-health.d.ts +1 -1
- package/dist/sandbox/index.js +5 -5
- package/dist/sequences/drizzle.js +5 -15
- package/dist/sequences/drizzle.js.map +1 -1
- package/dist/sequences/index.d.ts +1 -0
- package/dist/sequences/index.js +18 -14
- package/dist/sequences/index.js.map +1 -1
- package/dist/sequences/row-mapping.d.ts +7 -0
- package/dist/sequences-react/components/TimelineEditor.d.ts +0 -40
- package/dist/sequences-react/components/TimelineHistory.d.ts +31 -0
- package/dist/sequences-react/components/glyphs.d.ts +12 -21
- package/dist/sequences-react/components/index.d.ts +0 -2
- package/dist/sequences-react/components/interaction-math.d.ts +3 -3
- package/dist/sequences-react/contracts.d.ts +1 -1
- package/dist/sequences-react/engine/snap.d.ts +2 -2
- package/dist/sequences-react/index.js +4 -4
- package/dist/sequences-react/index.js.map +1 -1
- package/dist/settings-react/index.js +13 -30
- package/dist/settings-react/index.js.map +1 -1
- package/dist/settings-react/timezone-picker.d.ts +0 -6
- package/dist/signoff/browser-budget.d.ts +6 -1
- package/dist/signoff/cli.d.ts +0 -7
- package/dist/signoff/cli.js +1 -2
- package/dist/signoff/cli.js.map +1 -1
- package/dist/signoff/index.js +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +5 -25
- package/dist/skills/marketplace.d.ts +1 -75
- package/dist/skills-placement/box.js +3 -4
- package/dist/skills-placement/box.js.map +1 -1
- package/dist/skills-placement/index.js +3 -4
- package/dist/spend/cli-args.d.ts +1 -1
- package/dist/spend/cli.js +3 -3
- package/dist/spend/cli.js.map +1 -1
- package/dist/spend/index.js +1 -1
- package/dist/stories/design-canvas/fixtures.d.ts +1 -14
- package/dist/stream/index.js +17 -17
- package/dist/studio/generation.d.ts +1 -1
- package/dist/studio/index.js +1 -1
- package/dist/studio-react/index.js +353 -184
- package/dist/studio-react/index.js.map +1 -1
- package/dist/studio-react/studio-composer.d.ts +1 -5
- package/dist/studio-react/studio-history-screen.d.ts +1 -1
- package/dist/teams/invitations-api.d.ts +3 -3
- package/dist/teams/invitations-api.js +74 -72
- package/dist/teams/invitations-api.js.map +1 -1
- package/dist/teams/member-sync.d.ts +2 -0
- package/dist/teams/members-api.d.ts +2 -2
- package/dist/teams/members-api.js +1 -1
- package/dist/teams-react/index.js +28 -45
- package/dist/teams-react/index.js.map +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/mcp-arguments.d.ts +1 -1
- package/dist/trace/index.d.ts +1 -18
- package/dist/trace/index.js +1 -36
- package/dist/trace/index.js.map +1 -1
- package/dist/trace/mission-flow.d.ts +1 -59
- package/dist/turn-health/index.d.ts +1 -1
- package/dist/turn-health/index.js +2 -2
- package/dist/turn-health/sink.d.ts +2 -1
- package/dist/turn-trace/index.js +2 -4
- package/dist/turn-trace/recorder.d.ts +0 -2
- package/dist/vault/VaultPane.d.ts +0 -20
- package/dist/vault/VaultPaneOperations.d.ts +318 -0
- package/dist/vault/index.js +2 -1
- package/dist/vault/index.js.map +1 -1
- package/dist/vault/lazy.js +1 -1
- package/dist/web-react/agent-profile-editor.d.ts +1 -2
- package/dist/web-react/agent-profile-editor.js +6 -5
- package/dist/web-react/chat-composer.d.ts +1 -1
- package/dist/web-react/durable-plan-flow.d.ts +6 -1
- package/dist/web-react/editor-glyphs.d.ts +12 -0
- package/dist/web-react/focus-navigation.d.ts +12 -0
- package/dist/web-react/history-controls.d.ts +37 -0
- package/dist/web-react/index.js +36 -34
- package/dist/web-react/interaction-question-card.d.ts +1 -1
- package/dist/web-react/record-grid-writes.d.ts +31 -0
- package/dist/web-react/record-grid.d.ts +1 -48
- package/dist/web-react/session-history-panel.d.ts +1 -9
- package/dist/web-react/use-document-dark.d.ts +1 -0
- package/dist/workspace-export/engine.d.ts +1 -6
- package/dist/workspace-export/index.js +198 -185
- package/dist/workspace-export/index.js.map +1 -1
- package/dist/workspace-export/routes.d.ts +1 -1
- package/dist/workspace-react/index.js +9 -8
- package/dist/workspace-react/index.js.map +1 -1
- package/package.json +7 -17
- package/dist/VaultPane-RXL3WLA2.js +0 -7
- package/dist/agent-profiles/reaper.d.ts +0 -31
- package/dist/agent-profiles/reaper.js +0 -29
- package/dist/agent-profiles/reaper.js.map +0 -1
- package/dist/chunk-4ZSLX3LY.js.map +0 -1
- package/dist/chunk-5IM2CLYX.js.map +0 -1
- package/dist/chunk-6OSJNJA2.js +0 -251
- package/dist/chunk-6OSJNJA2.js.map +0 -1
- package/dist/chunk-6PRQ45QE.js.map +0 -1
- package/dist/chunk-6ZIC6OG5.js.map +0 -1
- package/dist/chunk-BDEBQ4WO.js +0 -38
- package/dist/chunk-BDEBQ4WO.js.map +0 -1
- package/dist/chunk-BOQ4HVVH.js.map +0 -1
- package/dist/chunk-F2VX6TTJ.js.map +0 -1
- package/dist/chunk-FPNZMIAW.js.map +0 -1
- package/dist/chunk-HN6MZ2XL.js.map +0 -1
- package/dist/chunk-J2BBYVGF.js.map +0 -1
- package/dist/chunk-KJODHPWM.js.map +0 -1
- package/dist/chunk-LTWJYNEC.js +0 -100
- package/dist/chunk-LTWJYNEC.js.map +0 -1
- package/dist/chunk-LXYQOOXU.js.map +0 -1
- package/dist/chunk-MEKOWH5E.js.map +0 -1
- package/dist/chunk-NHYRIM4I.js.map +0 -1
- package/dist/chunk-NMZUW6VJ.js.map +0 -1
- package/dist/chunk-ORQD4AUO.js.map +0 -1
- package/dist/chunk-R4X5474U.js.map +0 -1
- package/dist/chunk-RL3Z747H.js.map +0 -1
- package/dist/chunk-TXUAGSFR.js.map +0 -1
- package/dist/chunk-UCCSJX64.js.map +0 -1
- package/dist/chunk-VJBFCNAU.js.map +0 -1
- package/dist/chunk-WSEXFTN4.js.map +0 -1
- package/dist/chunk-Y43PXON2.js.map +0 -1
- package/dist/chunk-ZBB5KQ6B.js.map +0 -1
- package/dist/eval/parity.d.ts +0 -74
- package/dist/mention-editor-B23OMFT2.js.map +0 -1
- package/dist/profile/humanizer-skill.d.ts +0 -23
- package/dist/profile/humanizer-skill.vendored.d.ts +0 -4
- package/dist/sequences-react/components/BrandMark.d.ts +0 -10
- package/dist/skills/marketplace-drizzle.d.ts +0 -121
- package/dist/skills/marketplace-drizzle.js +0 -34
- package/dist/skills/marketplace-drizzle.js.map +0 -1
- package/dist/teams-react/components/BrandMark.d.ts +0 -10
- /package/dist/{DesignCanvas-L6J72JQ2.js.map → DesignCanvas-IQKYAEC4.js.map} +0 -0
- /package/dist/{DesignCanvasEditor-QFQD63MR.js.map → DesignCanvasEditor-O7OCZTGC.js.map} +0 -0
- /package/dist/{TimelineEditor-7KBPJQLT.js.map → TimelineEditor-VB2UJ34D.js.map} +0 -0
- /package/dist/{VaultPane-RXL3WLA2.js.map → VaultPane-AYW7CO33.js.map} +0 -0
- /package/dist/{chunk-ATQQCG4I.js.map → chunk-2VJLLRVV.js.map} +0 -0
- /package/dist/{chunk-MDRH3SDA.js.map → chunk-54YIL7WM.js.map} +0 -0
- /package/dist/{chunk-6QJ3GB3A.js.map → chunk-5GSZGTPJ.js.map} +0 -0
- /package/dist/{chunk-ZDPUC6CM.js.map → chunk-6ZVSMA4T.js.map} +0 -0
- /package/dist/{chunk-LO6VQ35O.js.map → chunk-CQZVJVME.js.map} +0 -0
- /package/dist/{chunk-G4F2NWZH.js.map → chunk-FZ3ZFVAC.js.map} +0 -0
- /package/dist/{chunk-PDD5A43Y.js.map → chunk-UTL6TEN6.js.map} +0 -0
- /package/dist/{chunk-S27DKRI6.js.map → chunk-VDYEVCQQ.js.map} +0 -0
- /package/dist/{chunk-UFQM46NV.js.map → chunk-VK3F4N4U.js.map} +0 -0
- /package/dist/{chunk-FUZETA6Z.js.map → chunk-X6SZGQTK.js.map} +0 -0
|
@@ -18,14 +18,14 @@ import {
|
|
|
18
18
|
} from "./chunk-6A7MYOUI.js";
|
|
19
19
|
import {
|
|
20
20
|
nextCallIndex
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-VK3F4N4U.js";
|
|
22
22
|
import {
|
|
23
23
|
resolveTangleExecutionEnvironment,
|
|
24
24
|
trimOrNull
|
|
25
25
|
} from "./chunk-D6UJEOZQ.js";
|
|
26
26
|
import {
|
|
27
27
|
formatServerTiming
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-PCAY23GS.js";
|
|
29
29
|
import {
|
|
30
30
|
fail,
|
|
31
31
|
isRuntimeAuthRefreshDenied,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
DEFAULT_HARNESS,
|
|
40
40
|
assertHarnessModelCompatible,
|
|
41
41
|
isHarness
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-ELX5YITO.js";
|
|
43
43
|
|
|
44
44
|
// src/sandbox/prompt-trace.ts
|
|
45
45
|
var asRec = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -2434,22 +2434,51 @@ async function assertExistingBoxEgress(box, desired, migrate, stage, name, prefe
|
|
|
2434
2434
|
}
|
|
2435
2435
|
|
|
2436
2436
|
// src/sandbox/box-health.ts
|
|
2437
|
-
|
|
2437
|
+
function plannedHostRestart(error) {
|
|
2438
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2439
|
+
for (let depth = 0; error && typeof error === "object" && depth < 8 && !seen.has(error); depth++) {
|
|
2440
|
+
seen.add(error);
|
|
2441
|
+
const cause = error;
|
|
2442
|
+
if (cause.code === "HOST_AGENT_RESTARTING" && cause.status === 503) return true;
|
|
2443
|
+
error = cause.cause;
|
|
2444
|
+
}
|
|
2445
|
+
return false;
|
|
2446
|
+
}
|
|
2447
|
+
async function readDuringPlannedHostRestart(read, deadline) {
|
|
2448
|
+
let waited = false;
|
|
2449
|
+
for (; ; ) {
|
|
2450
|
+
try {
|
|
2451
|
+
return { value: await read(), waited };
|
|
2452
|
+
} catch (error) {
|
|
2453
|
+
if (!plannedHostRestart(error)) throw error;
|
|
2454
|
+
const hint = error.retryAfterMs;
|
|
2455
|
+
const delay = typeof hint === "number" && Number.isFinite(hint) && hint > 0 ? hint : sandboxTransientBackoffMs(1);
|
|
2456
|
+
if (Date.now() + delay >= deadline) throw error;
|
|
2457
|
+
waited = true;
|
|
2458
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
async function isBoxAlive(box, probe, deadline) {
|
|
2438
2463
|
if (!probe) return ok(void 0);
|
|
2439
2464
|
try {
|
|
2440
|
-
const alive = await
|
|
2465
|
+
const { value: alive } = await readDuringPlannedHostRestart(
|
|
2466
|
+
() => box.exec("echo alive", { timeoutMs: probe.execTimeoutMs ?? 5e3 }),
|
|
2467
|
+
deadline
|
|
2468
|
+
);
|
|
2441
2469
|
if (alive.exitCode !== 0 || alive.stdout.trim() !== "alive") {
|
|
2442
2470
|
return fail(new Error("alive check did not return a successful alive marker"));
|
|
2443
2471
|
}
|
|
2444
2472
|
return ok(void 0);
|
|
2445
2473
|
} catch (cause) {
|
|
2474
|
+
if (plannedHostRestart(cause)) throw cause;
|
|
2446
2475
|
return fail(new Error("alive check failed", { cause }));
|
|
2447
2476
|
}
|
|
2448
2477
|
}
|
|
2449
2478
|
function hasRecentLivenessVerification(box, probe, now = Date.now()) {
|
|
2450
2479
|
return isRecent(checksFor(box)?.alive, probe.cacheTtlMs ?? TRUSTED_REUSE_TTL_MS, now);
|
|
2451
2480
|
}
|
|
2452
|
-
async function isReusableBox(box, probe) {
|
|
2481
|
+
async function isReusableBox(box, probe, restartTimeoutMs = probe?.execTimeoutMs ?? 5e3) {
|
|
2453
2482
|
if (sandboxEdgeFailed(box) || !sandboxRuntimeUrl(box)) {
|
|
2454
2483
|
forgetBox(box.id);
|
|
2455
2484
|
return fail(new Error(sandboxEdgeFailed(box) ? "runtime edge readiness failed" : "runtime URL is missing"));
|
|
@@ -2459,7 +2488,7 @@ async function isReusableBox(box, probe) {
|
|
|
2459
2488
|
trustedBoxes.add(box);
|
|
2460
2489
|
return ok(void 0);
|
|
2461
2490
|
}
|
|
2462
|
-
const alive = await isBoxAlive(box, probe);
|
|
2491
|
+
const alive = await isBoxAlive(box, probe, Date.now() + restartTimeoutMs);
|
|
2463
2492
|
if (alive.succeeded) recordCheck(box, { alive: Date.now() });
|
|
2464
2493
|
else forgetBox(box.id);
|
|
2465
2494
|
return alive;
|
|
@@ -2519,18 +2548,21 @@ function resumeEnvRequiredKeys(cause) {
|
|
|
2519
2548
|
if (code !== "RESUME_ENV_REQUIRED" || !Array.isArray(missingEnvKeys)) return void 0;
|
|
2520
2549
|
return missingEnvKeys.filter((key) => typeof key === "string");
|
|
2521
2550
|
}
|
|
2522
|
-
async function runningSessionCount(box) {
|
|
2551
|
+
async function runningSessionCount(box, deadline) {
|
|
2523
2552
|
try {
|
|
2524
|
-
const sessions = await box.sessions();
|
|
2525
|
-
return sessions.filter(
|
|
2553
|
+
const { value: sessions, waited } = await readDuringPlannedHostRestart(() => box.sessions(), deadline);
|
|
2554
|
+
return { waited, running: sessions.filter(
|
|
2526
2555
|
({ info }) => info.status === "running" || Boolean(info.activeExecutionId) || info.status === "queued" && Boolean(info.latestExecutionId)
|
|
2527
|
-
).length;
|
|
2528
|
-
} catch {
|
|
2529
|
-
|
|
2556
|
+
).length };
|
|
2557
|
+
} catch (error) {
|
|
2558
|
+
if (plannedHostRestart(error)) throw error;
|
|
2559
|
+
return { waited: false };
|
|
2530
2560
|
}
|
|
2531
2561
|
}
|
|
2532
2562
|
async function recoverUnresponsiveBox(client, box, probe, stage, name, resumeTimeout, runtimeEnv, onProgress) {
|
|
2533
|
-
const
|
|
2563
|
+
const deadline = Date.now() + resumeTimeout;
|
|
2564
|
+
const { running, waited } = await runningSessionCount(box, deadline);
|
|
2565
|
+
if (waited && (await isReusableBox(box, probe, Math.max(1, deadline - Date.now()))).succeeded) return box;
|
|
2534
2566
|
if (running) {
|
|
2535
2567
|
if (sandboxRuntimeUrl(box) && !sandboxEdgeFailed(box)) return box;
|
|
2536
2568
|
throw new SandboxBoxBusyError(
|
|
@@ -2562,7 +2594,7 @@ async function recoverUnresponsiveBox(client, box, probe, stage, name, resumeTim
|
|
|
2562
2594
|
);
|
|
2563
2595
|
}
|
|
2564
2596
|
const recovered = await refreshRuntimeConnection(client, resumed.value);
|
|
2565
|
-
const reusable = await isReusableBox(recovered, probe);
|
|
2597
|
+
const reusable = await isReusableBox(recovered, probe, resumeTimeout);
|
|
2566
2598
|
if (!reusable.succeeded) {
|
|
2567
2599
|
throw new SandboxRecoveryFailedError(
|
|
2568
2600
|
stage,
|
|
@@ -2651,7 +2683,7 @@ async function provisionWorkspaceSandbox(shell, options, gate, reuseOnly) {
|
|
|
2651
2683
|
]);
|
|
2652
2684
|
if (envResult.status === "rejected") throw envResult.reason;
|
|
2653
2685
|
await prefetch.decided;
|
|
2654
|
-
const
|
|
2686
|
+
const runtimeEnv = envResult.value;
|
|
2655
2687
|
const refusal = { refused: false };
|
|
2656
2688
|
const gateBeforeUse = async () => {
|
|
2657
2689
|
try {
|
|
@@ -2665,9 +2697,9 @@ async function provisionWorkspaceSandbox(shell, options, gate, reuseOnly) {
|
|
|
2665
2697
|
try {
|
|
2666
2698
|
if (readyResult.status === "rejected") throw readyResult.reason;
|
|
2667
2699
|
const ready = readyResult.value;
|
|
2668
|
-
if ((await measure("liveness", () => isReusableBox(ready, shell.livenessProbe))).succeeded) {
|
|
2700
|
+
if ((await measure("liveness", () => isReusableBox(ready, shell.livenessProbe, resumeTimeout))).succeeded) {
|
|
2669
2701
|
if (!trustedBoxes.has(ready)) await gateBeforeUse();
|
|
2670
|
-
const finalBox = await measure("finalize", () => finalizeExistingBox(shell, client, ready, "reused", name, workspaceId, userId, harness, scope,
|
|
2702
|
+
const finalBox = await measure("finalize", () => finalizeExistingBox(shell, client, ready, "reused", name, workspaceId, userId, harness, scope, runtimeEnv, prefetch));
|
|
2671
2703
|
if (trustedBoxes.has(ready)) trustedBoxes.add(finalBox);
|
|
2672
2704
|
return rememberRunningBox(name, finalBox);
|
|
2673
2705
|
}
|
|
@@ -2680,10 +2712,10 @@ async function provisionWorkspaceSandbox(shell, options, gate, reuseOnly) {
|
|
|
2680
2712
|
"reused",
|
|
2681
2713
|
name,
|
|
2682
2714
|
resumeTimeout,
|
|
2683
|
-
|
|
2715
|
+
runtimeEnv,
|
|
2684
2716
|
onProgress
|
|
2685
2717
|
);
|
|
2686
|
-
return rememberRunningBox(name, await finalizeExistingBox(shell, client, recovered, "reused", name, workspaceId, userId, harness, scope,
|
|
2718
|
+
return rememberRunningBox(name, await finalizeExistingBox(shell, client, recovered, "reused", name, workspaceId, userId, harness, scope, runtimeEnv));
|
|
2687
2719
|
} catch (cause) {
|
|
2688
2720
|
if (refusal.refused) throw refusal.error;
|
|
2689
2721
|
if (reuseOnly) return void 0;
|
|
@@ -2718,8 +2750,8 @@ async function provisionWorkspaceSandbox(shell, options, gate, reuseOnly) {
|
|
|
2718
2750
|
if (!stopped.succeeded) throw stopped.error;
|
|
2719
2751
|
if (stopped.value) {
|
|
2720
2752
|
const stoppedBox = stopped.value;
|
|
2721
|
-
const
|
|
2722
|
-
const resumed = await measure("resume", () => resumeStoppedBox(stoppedBox, resumeTimeout,
|
|
2753
|
+
const runtimeEnv = await measure("runtime_env", () => resolveWorkspaceRuntimeEnv(shell, scope));
|
|
2754
|
+
const resumed = await measure("resume", () => resumeStoppedBox(stoppedBox, resumeTimeout, runtimeEnv, onProgress));
|
|
2723
2755
|
if (!resumed.succeeded) {
|
|
2724
2756
|
const recovery = await requestSandboxReplacement(
|
|
2725
2757
|
shell.recoverStoppedSandbox,
|
|
@@ -2731,8 +2763,8 @@ async function provisionWorkspaceSandbox(shell, options, gate, reuseOnly) {
|
|
|
2731
2763
|
} else {
|
|
2732
2764
|
try {
|
|
2733
2765
|
const box2 = await refreshRuntimeConnection(client, resumed.value);
|
|
2734
|
-
if ((await isReusableBox(box2, shell.livenessProbe)).succeeded) {
|
|
2735
|
-
return rememberRunningBox(name, await finalizeExistingBox(shell, client, box2, "resumed", name, workspaceId, userId, harness, scope,
|
|
2766
|
+
if ((await isReusableBox(box2, shell.livenessProbe, resumeTimeout)).succeeded) {
|
|
2767
|
+
return rememberRunningBox(name, await finalizeExistingBox(shell, client, box2, "resumed", name, workspaceId, userId, harness, scope, runtimeEnv));
|
|
2736
2768
|
}
|
|
2737
2769
|
const recovered = await recoverUnresponsiveBox(
|
|
2738
2770
|
client,
|
|
@@ -2741,10 +2773,10 @@ async function provisionWorkspaceSandbox(shell, options, gate, reuseOnly) {
|
|
|
2741
2773
|
"resumed",
|
|
2742
2774
|
name,
|
|
2743
2775
|
resumeTimeout,
|
|
2744
|
-
|
|
2776
|
+
runtimeEnv,
|
|
2745
2777
|
onProgress
|
|
2746
2778
|
);
|
|
2747
|
-
return rememberRunningBox(name, await finalizeExistingBox(shell, client, recovered, "resumed", name, workspaceId, userId, harness, scope,
|
|
2779
|
+
return rememberRunningBox(name, await finalizeExistingBox(shell, client, recovered, "resumed", name, workspaceId, userId, harness, scope, runtimeEnv));
|
|
2748
2780
|
} catch (cause) {
|
|
2749
2781
|
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
2750
2782
|
const recovery = await requestMissingSandboxReplacement(shell, {
|
|
@@ -2760,6 +2792,29 @@ async function provisionWorkspaceSandbox(shell, options, gate, reuseOnly) {
|
|
|
2760
2792
|
}
|
|
2761
2793
|
}
|
|
2762
2794
|
}
|
|
2795
|
+
const { payload, deferredFiles } = await prepareWorkspacePayload(shell, workspaceId, userId, scope, harness, name, recoveryRestore, resources, billingOwnerId);
|
|
2796
|
+
let box = await measure("create", () => client.create(payload));
|
|
2797
|
+
await measure("wait_running", () => box.waitFor("running", {
|
|
2798
|
+
timeoutMs: shell.provisionTimeoutMs ?? DEFAULT_PROVISION_TIMEOUT_MS,
|
|
2799
|
+
...onProgress ? { onProgress } : {}
|
|
2800
|
+
}));
|
|
2801
|
+
box = await measure("refresh_connection", () => refreshRuntimeConnection(client, box));
|
|
2802
|
+
if (deferredFiles.length > 0) {
|
|
2803
|
+
const written = await writeProfileFilesToBox(box, deferredFiles);
|
|
2804
|
+
if (!written.succeeded) {
|
|
2805
|
+
throw deferredProfileWriteFailed("new", name, written.error);
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
if (shell.bootstrap) {
|
|
2809
|
+
const bootstrap = shell.bootstrap.bind(shell);
|
|
2810
|
+
const boot = await measure("bootstrap", () => bootstrap(box, scope));
|
|
2811
|
+
if (!boot.succeeded) {
|
|
2812
|
+
throw new Error(`bootstrap failed on new box ${name}`, { cause: boot.error });
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
return rememberRunningBox(name, box);
|
|
2816
|
+
}
|
|
2817
|
+
async function prepareWorkspacePayload(shell, workspaceId, userId, scope, harness, name, recoveryRestore, resources, billingOwnerId) {
|
|
2763
2818
|
const connectedIntegrationIds = await shell.connectedIntegrationIds(workspaceId);
|
|
2764
2819
|
const buildCtx = {
|
|
2765
2820
|
workspaceId,
|
|
@@ -2829,26 +2884,7 @@ async function provisionWorkspaceSandbox(shell, options, gate, reuseOnly) {
|
|
|
2829
2884
|
SHELL_PROMPT_BUDGET_HINT
|
|
2830
2885
|
);
|
|
2831
2886
|
assertProvisionPayloadWithinCap(payload ?? {});
|
|
2832
|
-
|
|
2833
|
-
await measure("wait_running", () => box.waitFor("running", {
|
|
2834
|
-
timeoutMs: shell.provisionTimeoutMs ?? DEFAULT_PROVISION_TIMEOUT_MS,
|
|
2835
|
-
...onProgress ? { onProgress } : {}
|
|
2836
|
-
}));
|
|
2837
|
-
box = await measure("refresh_connection", () => refreshRuntimeConnection(client, box));
|
|
2838
|
-
if (deferredFiles.length > 0) {
|
|
2839
|
-
const written = await writeProfileFilesToBox(box, deferredFiles);
|
|
2840
|
-
if (!written.succeeded) {
|
|
2841
|
-
throw deferredProfileWriteFailed("new", name, written.error);
|
|
2842
|
-
}
|
|
2843
|
-
}
|
|
2844
|
-
if (shell.bootstrap) {
|
|
2845
|
-
const bootstrap = shell.bootstrap.bind(shell);
|
|
2846
|
-
const boot = await measure("bootstrap", () => bootstrap(box, scope));
|
|
2847
|
-
if (!boot.succeeded) {
|
|
2848
|
-
throw new Error(`bootstrap failed on new box ${name}`, { cause: boot.error });
|
|
2849
|
-
}
|
|
2850
|
-
}
|
|
2851
|
-
return rememberRunningBox(name, box);
|
|
2887
|
+
return { payload, deferredFiles };
|
|
2852
2888
|
}
|
|
2853
2889
|
|
|
2854
2890
|
// src/sandbox/workspace-claim.ts
|
|
@@ -3662,4 +3698,4 @@ export {
|
|
|
3662
3698
|
deleteSecret,
|
|
3663
3699
|
mintSandboxScopedToken
|
|
3664
3700
|
};
|
|
3665
|
-
//# sourceMappingURL=chunk-
|
|
3701
|
+
//# sourceMappingURL=chunk-TCJ4TMOW.js.map
|