@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
package/dist/web-react/index.js
CHANGED
|
@@ -144,19 +144,15 @@ import {
|
|
|
144
144
|
withoutRecordGridCreated,
|
|
145
145
|
withoutRecordGridRemoved,
|
|
146
146
|
withoutRecordGridUpdate
|
|
147
|
-
} from "../chunk-
|
|
148
|
-
import {
|
|
149
|
-
useInfiniteScroll
|
|
150
|
-
} from "../chunk-BDEBQ4WO.js";
|
|
147
|
+
} from "../chunk-GIEUZBQQ.js";
|
|
151
148
|
import {
|
|
152
149
|
MENTION_PILL_CLASS
|
|
153
150
|
} from "../chunk-3HUFJ5LO.js";
|
|
154
|
-
import "../chunk-6OSJNJA2.js";
|
|
155
151
|
import {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
152
|
+
useInfiniteScroll
|
|
153
|
+
} from "../chunk-UHSUY6H6.js";
|
|
154
|
+
import "../chunk-7PULOECS.js";
|
|
155
|
+
import "../chunk-ZOS3D26Z.js";
|
|
160
156
|
import {
|
|
161
157
|
EvidenceLineageTable,
|
|
162
158
|
ExceptionList,
|
|
@@ -170,9 +166,6 @@ import {
|
|
|
170
166
|
workProductStatusLabel,
|
|
171
167
|
workProductStatusTone
|
|
172
168
|
} from "../chunk-Y6PRDUFJ.js";
|
|
173
|
-
import {
|
|
174
|
-
parseReviewQueueItem
|
|
175
|
-
} from "../chunk-GEYACSFW.js";
|
|
176
169
|
import {
|
|
177
170
|
ChatComposer,
|
|
178
171
|
ComposerModeControls,
|
|
@@ -185,29 +178,39 @@ import {
|
|
|
185
178
|
preloadWhenIdle,
|
|
186
179
|
useComposerAttachments,
|
|
187
180
|
useDictation
|
|
188
|
-
} from "../chunk-
|
|
181
|
+
} from "../chunk-JRW6LCIA.js";
|
|
189
182
|
import "../chunk-L7MB2LLM.js";
|
|
190
|
-
import {
|
|
191
|
-
AgentSessionControls,
|
|
192
|
-
AgentSettingsPopover,
|
|
193
|
-
HarnessGlyph,
|
|
194
|
-
HarnessPicker,
|
|
195
|
-
acceptRejectionReason,
|
|
196
|
-
filterAcceptedFiles,
|
|
197
|
-
isAcceptedFileType,
|
|
198
|
-
renamePastedImages
|
|
199
|
-
} from "../chunk-G4F2NWZH.js";
|
|
200
183
|
import {
|
|
201
184
|
WorkspaceInitial,
|
|
202
185
|
WorkspaceSwitcher
|
|
203
|
-
} from "../chunk-
|
|
186
|
+
} from "../chunk-6ZVSMA4T.js";
|
|
204
187
|
import {
|
|
205
188
|
WorkspacePrewarmContext,
|
|
206
189
|
requestWorkspacePrewarm,
|
|
207
190
|
useWorkspacePrewarm,
|
|
208
191
|
useWorkspacePrewarmHandle
|
|
209
192
|
} from "../chunk-2HQP2CTA.js";
|
|
210
|
-
import
|
|
193
|
+
import {
|
|
194
|
+
tabTerminalConnectionId,
|
|
195
|
+
useSandboxTerminalConnection
|
|
196
|
+
} from "../chunk-E4AY62T2.js";
|
|
197
|
+
import "../chunk-SJWIZT7B.js";
|
|
198
|
+
import {
|
|
199
|
+
AGENT_PROFILE_EDITOR_SECTIONS,
|
|
200
|
+
AgentProfileEditor,
|
|
201
|
+
AgentProfileRegistryError
|
|
202
|
+
} from "../chunk-FTNGGR37.js";
|
|
203
|
+
import {
|
|
204
|
+
AgentSessionControls,
|
|
205
|
+
AgentSettingsPopover,
|
|
206
|
+
HarnessGlyph,
|
|
207
|
+
HarnessPicker,
|
|
208
|
+
acceptRejectionReason,
|
|
209
|
+
filterAcceptedFiles,
|
|
210
|
+
isAcceptedFileType,
|
|
211
|
+
renamePastedImages
|
|
212
|
+
} from "../chunk-FZ3ZFVAC.js";
|
|
213
|
+
import "../chunk-X6SZGQTK.js";
|
|
211
214
|
import {
|
|
212
215
|
DEFAULT_EFFORT_LEVELS,
|
|
213
216
|
EFFORT_METER_SEGMENTS,
|
|
@@ -225,20 +228,19 @@ import {
|
|
|
225
228
|
reconcileEffortLevels,
|
|
226
229
|
usePending,
|
|
227
230
|
usePopover
|
|
228
|
-
} from "../chunk-
|
|
231
|
+
} from "../chunk-52SDU43B.js";
|
|
232
|
+
import "../chunk-ZAMHLXNS.js";
|
|
229
233
|
import {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
} from "../chunk-E4AY62T2.js";
|
|
233
|
-
import "../chunk-SJWIZT7B.js";
|
|
234
|
+
parseReviewQueueItem
|
|
235
|
+
} from "../chunk-GEYACSFW.js";
|
|
234
236
|
import {
|
|
235
237
|
ReviewFeedbackForm
|
|
236
|
-
} from "../chunk-
|
|
237
|
-
import "../chunk-
|
|
238
|
-
import "../chunk-AVP5SNIG.js";
|
|
238
|
+
} from "../chunk-2VJLLRVV.js";
|
|
239
|
+
import "../chunk-JBXNU5WD.js";
|
|
239
240
|
import {
|
|
240
241
|
ProviderLogo
|
|
241
242
|
} from "../chunk-RASGKEAL.js";
|
|
243
|
+
import "../chunk-AVP5SNIG.js";
|
|
242
244
|
import "../chunk-FQYAJYPW.js";
|
|
243
245
|
import {
|
|
244
246
|
ALLOWED_ATTACHMENT_SNIFFED_MIMES,
|
|
@@ -307,7 +309,7 @@ import {
|
|
|
307
309
|
questionInteractionContentSignature,
|
|
308
310
|
stampInteractionAnswers
|
|
309
311
|
} from "../chunk-6VQCFJWP.js";
|
|
310
|
-
import "../chunk-
|
|
312
|
+
import "../chunk-ELX5YITO.js";
|
|
311
313
|
import "../chunk-PV33JZKV.js";
|
|
312
314
|
import "../chunk-TXD5HXLE.js";
|
|
313
315
|
import "../chunk-WL7PZK7Q.js";
|
|
@@ -110,4 +110,4 @@ export interface InteractionQuestionCardProps {
|
|
|
110
110
|
declinable?: boolean;
|
|
111
111
|
className?: string;
|
|
112
112
|
}
|
|
113
|
-
export declare function InteractionQuestionCard(
|
|
113
|
+
export declare function InteractionQuestionCard(props: InteractionQuestionCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type RecordGridColumn, type RecordGridOverlay, type RecordGridRow, type RecordGridValue } from './record-grid-model';
|
|
2
|
+
import type { RecordGridProps } from './record-grid-types';
|
|
3
|
+
export declare function writeRecordGridCell(row: RecordGridRow, column: RecordGridColumn, value: RecordGridValue, { onUpdate, setOverlay, setRowError, setRowPending, locale }: {
|
|
4
|
+
onUpdate: RecordGridProps['onUpdate'];
|
|
5
|
+
setOverlay: (value: RecordGridOverlay | ((current: RecordGridOverlay) => RecordGridOverlay)) => void;
|
|
6
|
+
setRowError: (rowId: string, error: string | null) => void;
|
|
7
|
+
setRowPending: (rowId: string, pending: boolean) => void;
|
|
8
|
+
locale: RecordGridProps['locale'];
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
export declare function deleteRecordGridRow(row: RecordGridRow, { onDelete, setConfirmDelete, setRowError, setOverlay, columns }: {
|
|
11
|
+
onDelete: RecordGridProps['onDelete'];
|
|
12
|
+
setConfirmDelete: (id: string | null) => void;
|
|
13
|
+
setRowError: (rowId: string, error: string | null) => void;
|
|
14
|
+
setOverlay: (value: RecordGridOverlay | ((current: RecordGridOverlay) => RecordGridOverlay)) => void;
|
|
15
|
+
columns: RecordGridProps['columns'];
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
export declare function createRecordGridRow({ onCreate, columns, draft, setDraftErrors, setDraftError, draftCounter, fieldPrefix, setOverlay, setCreating, setAdding, resetDraft }: {
|
|
18
|
+
onCreate: RecordGridProps['onCreate'];
|
|
19
|
+
columns: RecordGridProps['columns'];
|
|
20
|
+
draft: Record<string, RecordGridValue>;
|
|
21
|
+
setDraftErrors: (errors: Readonly<Record<string, string>>) => void;
|
|
22
|
+
setDraftError: (error: string | null) => void;
|
|
23
|
+
draftCounter: {
|
|
24
|
+
current: number;
|
|
25
|
+
};
|
|
26
|
+
fieldPrefix: string;
|
|
27
|
+
setOverlay: (value: RecordGridOverlay | ((current: RecordGridOverlay) => RecordGridOverlay)) => void;
|
|
28
|
+
setCreating: (value: boolean) => void;
|
|
29
|
+
setAdding: (value: boolean) => void;
|
|
30
|
+
resetDraft: () => void;
|
|
31
|
+
}): Promise<void>;
|
|
@@ -1,51 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `RecordGrid` — the editable record table four verticals each hand-rolled: a
|
|
3
|
-
* cap table, two relationship record pages, a content board, and an entities
|
|
4
|
-
* panel. Every copy re-derived the same mechanism and each one lost a
|
|
5
|
-
* different part of it.
|
|
6
|
-
*
|
|
7
|
-
* What this owns:
|
|
8
|
-
*
|
|
9
|
-
* - **Typed columns with correctable errors.** A cell is text / number /
|
|
10
|
-
* currency / date / select / boolean (`./record-grid-model`), so a rejected
|
|
11
|
-
* edit explains itself next to the control instead of storing a coerced
|
|
12
|
-
* value.
|
|
13
|
-
* - **Optimistic write with a real rollback.** The edit lands instantly, the
|
|
14
|
-
* caller's writer returns a typed outcome, and a failure puts the previous
|
|
15
|
-
* value back AND says why. A grid that keeps a value the server refused is
|
|
16
|
-
* the defect this replaces.
|
|
17
|
-
* - **Provenance per cell.** An optional quote + link + basis, so a
|
|
18
|
-
* record-backed grid shows where a value came from without the product
|
|
19
|
-
* building a second surface for it.
|
|
20
|
-
* - **Review of a proposed change set.** Hand the grid a `proposed` patch
|
|
21
|
-
* (`./record-grid-model`'s `diffRecordGridProposal`) and it becomes the
|
|
22
|
-
* red/green row-diff surface a tax/legal review needs: changed cells render
|
|
23
|
-
* the struck live value against the proposed one, added/removed rows are
|
|
24
|
-
* marked, and every diffed row carries accept/reject — per row and for the
|
|
25
|
-
* whole set. What accepting MEANS stays the caller's (a record-store review
|
|
26
|
-
* write); the grid reports decisions, it does not persist them.
|
|
27
|
-
* - **Three distinct data states, on `web-react/async`'s own contract.**
|
|
28
|
-
* `state: AsyncResourceState<Row[]>` and `empty: AsyncEmptySpec` are the
|
|
29
|
-
* same types every other screen fetches through — loading, error-with-
|
|
30
|
-
* retry and empty are different renders, a failed fetch never looks like
|
|
31
|
-
* "no data yet", and the empty state carries the CALLER's next action.
|
|
32
|
-
* The optimistic overlay is layered on top of whichever `ready`/`empty`
|
|
33
|
-
* value the caller last supplied, so a row created while the caller's own
|
|
34
|
-
* status is still `empty` renders immediately rather than waiting for a
|
|
35
|
-
* refetch.
|
|
36
|
-
* - **Keyboard-navigable, labelled controls.** Arrow keys move between cells,
|
|
37
|
-
* Enter edits, Escape cancels, and no destructive control is an unlabelled
|
|
38
|
-
* icon.
|
|
39
|
-
*
|
|
40
|
-
* Presentation is Tailwind against the shared design tokens, with no icon
|
|
41
|
-
* library and no sandbox-ui — the same contract as the rest of `/web-react`.
|
|
42
|
-
*/
|
|
43
1
|
export * from './record-grid-model';
|
|
44
2
|
export type { RecordGridCellChange, RecordGridWriteOutcome, RecordGridCreateOutcome, RecordGridProps } from './record-grid-types';
|
|
45
3
|
import type { RecordGridProps } from './record-grid-types';
|
|
46
|
-
|
|
47
|
-
* The shared editable record table. A row is a flat value bag keyed by column
|
|
48
|
-
* id, so a record store's fold output maps straight on: one cell per entry,
|
|
49
|
-
* its quote and link in `sources`.
|
|
50
|
-
*/
|
|
51
|
-
export declare function RecordGrid({ columns, caption, state, empty, onCreate, onUpdate, onDelete, proposed, onAcceptRow, onRejectRow, onAcceptAll, onRejectAll, newRowDefaults, addLabel, locale, toolbar, loadingRowCount, className, }: RecordGridProps): import("react").JSX.Element;
|
|
4
|
+
export declare function RecordGrid(props: RecordGridProps): import("react").JSX.Element;
|
|
@@ -73,12 +73,4 @@ export type LinkLikeComponent = (props: LinkLikeProps) => ReactNode;
|
|
|
73
73
|
/** Compact relative time. Overridable — a product with its own i18n passes
|
|
74
74
|
* `formatTimestamp` rather than this being the only option. */
|
|
75
75
|
export declare function formatSessionTimestamp(isoDate: string | null): string;
|
|
76
|
-
|
|
77
|
-
* The full session history: search, sort, cursor-paged rows with per-row
|
|
78
|
-
* actions, and the states in between (first-run empty, loading, no matches,
|
|
79
|
-
* error + retry).
|
|
80
|
-
*
|
|
81
|
-
* This is the surface the rail's capped list overflows into — the reason the
|
|
82
|
-
* rail can stay short without hiding the user's work.
|
|
83
|
-
*/
|
|
84
|
-
export declare function SessionHistoryPanel({ history, hasAnySessions, query, onQueryChange, sort, onSortChange, hrefForSession, linkComponent: Link, respondingSessionIds, onRename, onDelete, onBulkAction, renameLabel, deleteLabel, extraActions, newSessionHref, title, showHeader, untitledLabel, emptyTitle, emptyDescription, formatTimestamp, contentWidth, className, }: SessionHistoryPanelProps): import("react").JSX.Element;
|
|
76
|
+
export declare function SessionHistoryPanel(props: SessionHistoryPanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useDocumentDark(): boolean;
|
|
@@ -44,12 +44,6 @@ export declare function createExportEngine(options: ExportEngineOptions): {
|
|
|
44
44
|
get(workspaceId: string, id: string): Promise<ExportJob | null>;
|
|
45
45
|
/** Start an export, or return the one already running for this workspace. */
|
|
46
46
|
start(workspaceId: string, requestedBy: string): Promise<ExportJob>;
|
|
47
|
-
/**
|
|
48
|
-
* Run pending units until `budgetMs` passes. A unit that starts always
|
|
49
|
-
* finishes, so one call can run longer than the budget. Returns the job as
|
|
50
|
-
* stored; another request holding the lease leaves it unchanged.
|
|
51
|
-
*/
|
|
52
|
-
advance(workspaceId: string, id: string, budgetMs?: number): Promise<ExportJob | null>;
|
|
53
47
|
progress(job: ExportJob): Omit<ExportProgress, 'downloadUrl' | 'downloadExpiresAt'>;
|
|
54
48
|
/** The finished archive as one stream with an exact length. */
|
|
55
49
|
zip(job: ExportJob): {
|
|
@@ -65,5 +59,6 @@ export declare function createExportEngine(options: ExportEngineOptions): {
|
|
|
65
59
|
*/
|
|
66
60
|
continueRunning(budgetMs?: number): Promise<number>;
|
|
67
61
|
prune(workspaceId: string, retentionMs: number, onlyId?: string): Promise<number>;
|
|
62
|
+
advance(workspaceId: string, id: string, budgetMs?: number): Promise<ExportJob | null>;
|
|
68
63
|
};
|
|
69
64
|
export type ExportEngine = ReturnType<typeof createExportEngine>;
|
|
@@ -631,6 +631,198 @@ function createExportEngine(options) {
|
|
|
631
631
|
if (!result) throw new LeaseLost("export job changed underneath this request");
|
|
632
632
|
return result.etag;
|
|
633
633
|
}
|
|
634
|
+
const { writeEntry, runUnit } = createExportUnitWriter(storage, base, now);
|
|
635
|
+
const { finalize } = createExportFinalizer(options, now, base, writeEntry);
|
|
636
|
+
return {
|
|
637
|
+
archiveKey,
|
|
638
|
+
async list(workspaceId) {
|
|
639
|
+
const ids = /* @__PURE__ */ new Set();
|
|
640
|
+
let cursor;
|
|
641
|
+
do {
|
|
642
|
+
const page = await storage.list(`${prefix}/${assertSafeKeySegment(workspaceId)}/`, cursor);
|
|
643
|
+
for (const key of page.keys) if (key.endsWith("/job.json")) ids.add(key.split("/").at(-2));
|
|
644
|
+
cursor = page.cursor;
|
|
645
|
+
} while (cursor);
|
|
646
|
+
const jobs = [];
|
|
647
|
+
for (const id of [...ids].sort().reverse().slice(0, 10)) {
|
|
648
|
+
const loaded = await loadJob(workspaceId, id);
|
|
649
|
+
if (loaded) jobs.push(loaded.job);
|
|
650
|
+
}
|
|
651
|
+
return jobs;
|
|
652
|
+
},
|
|
653
|
+
async get(workspaceId, id) {
|
|
654
|
+
return (await loadJob(workspaceId, id))?.job ?? null;
|
|
655
|
+
},
|
|
656
|
+
/** Start an export, or return the one already running for this workspace. */
|
|
657
|
+
async start(workspaceId, requestedBy) {
|
|
658
|
+
const existing = (await this.list(workspaceId)).find(
|
|
659
|
+
(job2) => job2.status === "running" && now() - Date.parse(job2.updatedAt) < 15 * 6e4
|
|
660
|
+
);
|
|
661
|
+
if (existing) return existing;
|
|
662
|
+
const plan = await options.plan({ workspaceId });
|
|
663
|
+
const names = /* @__PURE__ */ new Set();
|
|
664
|
+
for (const source of plan.sources) {
|
|
665
|
+
if (!SOURCE_NAME.test(source.name)) throw new Error(`workspace-export: invalid source name "${source.name}"`);
|
|
666
|
+
if (names.has(source.name)) throw new Error(`workspace-export: duplicate source name "${source.name}"`);
|
|
667
|
+
names.add(source.name);
|
|
668
|
+
}
|
|
669
|
+
const created = now();
|
|
670
|
+
const job = {
|
|
671
|
+
v: 1,
|
|
672
|
+
id: `${created.toString(36)}-${crypto.randomUUID().slice(0, 8)}`,
|
|
673
|
+
workspaceId,
|
|
674
|
+
requestedBy,
|
|
675
|
+
createdAt: iso(created),
|
|
676
|
+
updatedAt: iso(created),
|
|
677
|
+
status: "running",
|
|
678
|
+
units: plan.sources.map((s) => ({
|
|
679
|
+
name: s.name,
|
|
680
|
+
kind: s.kind,
|
|
681
|
+
dataClass: s.dataClass,
|
|
682
|
+
description: s.description,
|
|
683
|
+
status: "pending",
|
|
684
|
+
attempts: 0,
|
|
685
|
+
entries: [],
|
|
686
|
+
redactions: 0
|
|
687
|
+
}))
|
|
688
|
+
};
|
|
689
|
+
await saveJob(job);
|
|
690
|
+
await storage.put(runningKey(workspaceId, job.id), new Uint8Array(0));
|
|
691
|
+
return job;
|
|
692
|
+
},
|
|
693
|
+
/**
|
|
694
|
+
* Run pending units until `budgetMs` passes. A unit that starts always
|
|
695
|
+
* finishes, so one call can run longer than the budget. Returns the job as
|
|
696
|
+
* stored; another request holding the lease leaves it unchanged.
|
|
697
|
+
*/
|
|
698
|
+
...createExportAdvancer(loadJob, now, saveJob, storage, runningKey, options, nextBatch, runUnit, finalize),
|
|
699
|
+
progress(job) {
|
|
700
|
+
const bytesOf = (u) => u.entries.reduce((n, e) => n + e.size, 0);
|
|
701
|
+
return {
|
|
702
|
+
id: job.id,
|
|
703
|
+
status: job.status,
|
|
704
|
+
createdAt: job.createdAt,
|
|
705
|
+
completedAt: job.completedAt,
|
|
706
|
+
error: job.error,
|
|
707
|
+
unitsTotal: job.units.length,
|
|
708
|
+
unitsDone: job.units.filter((u) => u.status === "done" || u.status === "empty").length,
|
|
709
|
+
unitsFailed: job.units.filter((u) => u.status === "failed").length,
|
|
710
|
+
current: job.status === "running" ? job.units.find((u) => u.status === "pending")?.name : void 0,
|
|
711
|
+
bytes: job.units.reduce((n, u) => n + bytesOf(u), 0),
|
|
712
|
+
units: job.units.map((u) => ({
|
|
713
|
+
name: u.name,
|
|
714
|
+
dataClass: u.dataClass,
|
|
715
|
+
status: u.status,
|
|
716
|
+
rows: u.rows,
|
|
717
|
+
files: u.files,
|
|
718
|
+
bytes: bytesOf(u),
|
|
719
|
+
error: u.error
|
|
720
|
+
}))
|
|
721
|
+
};
|
|
722
|
+
},
|
|
723
|
+
/** The finished archive as one stream with an exact length. */
|
|
724
|
+
zip(job) {
|
|
725
|
+
if (job.status !== "complete" || !job.meta) throw new Error("workspace-export: export is not complete");
|
|
726
|
+
const modifiedAt = new Date(job.completedAt ?? job.createdAt);
|
|
727
|
+
const entries = [...job.meta, ...job.units.flatMap((u) => u.entries)].map((entry) => ({
|
|
728
|
+
name: entry.path,
|
|
729
|
+
method: entry.method,
|
|
730
|
+
crc32: entry.crc32,
|
|
731
|
+
compressedSize: entry.compressedSize,
|
|
732
|
+
uncompressedSize: entry.size,
|
|
733
|
+
modifiedAt,
|
|
734
|
+
open: async () => {
|
|
735
|
+
let index = 0;
|
|
736
|
+
let reader = null;
|
|
737
|
+
return new ReadableStream({
|
|
738
|
+
async pull(controller) {
|
|
739
|
+
for (; ; ) {
|
|
740
|
+
if (!reader) {
|
|
741
|
+
const segment = entry.segments[index];
|
|
742
|
+
if (!segment) {
|
|
743
|
+
controller.close();
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
index += 1;
|
|
747
|
+
const object = await storage.get(segment.key);
|
|
748
|
+
if (!object || object.size !== segment.size) {
|
|
749
|
+
controller.error(new Error(`workspace-export: segment ${segment.key} is missing or changed`));
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
reader = object.body.getReader();
|
|
753
|
+
}
|
|
754
|
+
const { done, value } = await reader.read();
|
|
755
|
+
if (!done) {
|
|
756
|
+
controller.enqueue(value);
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
reader = null;
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
async cancel(reason) {
|
|
763
|
+
await reader?.cancel(reason);
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
}));
|
|
768
|
+
const { length, stream } = createZipStream(entries);
|
|
769
|
+
const date = (job.completedAt ?? job.createdAt).slice(0, 10);
|
|
770
|
+
return { length, stream, filename: `${options.app}-workspace-export-${date}.zip` };
|
|
771
|
+
},
|
|
772
|
+
/** Delete exports older than `retentionMs`, and any export by id when given. */
|
|
773
|
+
/**
|
|
774
|
+
* Advance every running export whose lease has lapsed, so an export keeps
|
|
775
|
+
* going after the owner closes the tab. Call it from the product's scheduled
|
|
776
|
+
* handler (a one-minute cron). Returns how many exports it advanced.
|
|
777
|
+
*/
|
|
778
|
+
async continueRunning(budgetMs = 6e4) {
|
|
779
|
+
const deadline = now() + budgetMs;
|
|
780
|
+
const keys = [];
|
|
781
|
+
let cursor;
|
|
782
|
+
do {
|
|
783
|
+
const page = await storage.list(`${prefix}/_running/`, cursor);
|
|
784
|
+
keys.push(...page.keys);
|
|
785
|
+
cursor = page.cursor;
|
|
786
|
+
} while (cursor);
|
|
787
|
+
let advanced = 0;
|
|
788
|
+
for (const key of keys) {
|
|
789
|
+
const remaining = deadline - now();
|
|
790
|
+
if (remaining <= 0) break;
|
|
791
|
+
const name = key.split("/").at(-1) ?? "";
|
|
792
|
+
const workspaceId = name.slice(0, name.lastIndexOf("~"));
|
|
793
|
+
const id = name.slice(name.lastIndexOf("~") + 1);
|
|
794
|
+
if (!workspaceId || !id) continue;
|
|
795
|
+
const loaded = await loadJob(workspaceId, id);
|
|
796
|
+
if (!loaded || loaded.job.status !== "running") {
|
|
797
|
+
await storage.delete([key]);
|
|
798
|
+
continue;
|
|
799
|
+
}
|
|
800
|
+
if (loaded.job.lease && loaded.job.lease.until > now()) continue;
|
|
801
|
+
await this.advance(workspaceId, id, Math.min(remaining, 2e4));
|
|
802
|
+
advanced += 1;
|
|
803
|
+
}
|
|
804
|
+
return advanced;
|
|
805
|
+
},
|
|
806
|
+
async prune(workspaceId, retentionMs, onlyId) {
|
|
807
|
+
const cutoff = now() - retentionMs;
|
|
808
|
+
const doomed = [];
|
|
809
|
+
let cursor;
|
|
810
|
+
const root = `${prefix}/${assertSafeKeySegment(workspaceId)}/`;
|
|
811
|
+
do {
|
|
812
|
+
const page = await storage.list(root, cursor);
|
|
813
|
+
for (const key of page.keys) {
|
|
814
|
+
const id = key.slice(root.length).split("/")[0] ?? "";
|
|
815
|
+
const created = Number.parseInt(id.split("-")[0] ?? "", 36);
|
|
816
|
+
if (onlyId ? id === onlyId : Number.isFinite(created) && created < cutoff) doomed.push(key);
|
|
817
|
+
}
|
|
818
|
+
cursor = page.cursor;
|
|
819
|
+
} while (cursor);
|
|
820
|
+
await storage.delete(doomed);
|
|
821
|
+
return doomed.length;
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
function createExportUnitWriter(storage, base, now) {
|
|
634
826
|
async function writeEntry(keyBase, path, input, compress) {
|
|
635
827
|
let crc = 0;
|
|
636
828
|
let size = 0;
|
|
@@ -841,6 +1033,9 @@ function createExportEngine(options) {
|
|
|
841
1033
|
unit.files = stats.files;
|
|
842
1034
|
unit.status = "done";
|
|
843
1035
|
}
|
|
1036
|
+
return { writeEntry, runUnit };
|
|
1037
|
+
}
|
|
1038
|
+
function createExportFinalizer(options, now, base, writeEntry) {
|
|
844
1039
|
function manifest(job, notes) {
|
|
845
1040
|
const classes = {};
|
|
846
1041
|
for (const unit of job.units) {
|
|
@@ -920,68 +1115,10 @@ function createExportEngine(options) {
|
|
|
920
1115
|
];
|
|
921
1116
|
job.status = "complete";
|
|
922
1117
|
}
|
|
1118
|
+
return { finalize };
|
|
1119
|
+
}
|
|
1120
|
+
function createExportAdvancer(loadJob, now, saveJob, storage, runningKey, options, nextBatch, runUnit, finalize) {
|
|
923
1121
|
return {
|
|
924
|
-
archiveKey,
|
|
925
|
-
async list(workspaceId) {
|
|
926
|
-
const ids = /* @__PURE__ */ new Set();
|
|
927
|
-
let cursor;
|
|
928
|
-
do {
|
|
929
|
-
const page = await storage.list(`${prefix}/${assertSafeKeySegment(workspaceId)}/`, cursor);
|
|
930
|
-
for (const key of page.keys) if (key.endsWith("/job.json")) ids.add(key.split("/").at(-2));
|
|
931
|
-
cursor = page.cursor;
|
|
932
|
-
} while (cursor);
|
|
933
|
-
const jobs = [];
|
|
934
|
-
for (const id of [...ids].sort().reverse().slice(0, 10)) {
|
|
935
|
-
const loaded = await loadJob(workspaceId, id);
|
|
936
|
-
if (loaded) jobs.push(loaded.job);
|
|
937
|
-
}
|
|
938
|
-
return jobs;
|
|
939
|
-
},
|
|
940
|
-
async get(workspaceId, id) {
|
|
941
|
-
return (await loadJob(workspaceId, id))?.job ?? null;
|
|
942
|
-
},
|
|
943
|
-
/** Start an export, or return the one already running for this workspace. */
|
|
944
|
-
async start(workspaceId, requestedBy) {
|
|
945
|
-
const existing = (await this.list(workspaceId)).find(
|
|
946
|
-
(job2) => job2.status === "running" && now() - Date.parse(job2.updatedAt) < 15 * 6e4
|
|
947
|
-
);
|
|
948
|
-
if (existing) return existing;
|
|
949
|
-
const plan = await options.plan({ workspaceId });
|
|
950
|
-
const names = /* @__PURE__ */ new Set();
|
|
951
|
-
for (const source of plan.sources) {
|
|
952
|
-
if (!SOURCE_NAME.test(source.name)) throw new Error(`workspace-export: invalid source name "${source.name}"`);
|
|
953
|
-
if (names.has(source.name)) throw new Error(`workspace-export: duplicate source name "${source.name}"`);
|
|
954
|
-
names.add(source.name);
|
|
955
|
-
}
|
|
956
|
-
const created = now();
|
|
957
|
-
const job = {
|
|
958
|
-
v: 1,
|
|
959
|
-
id: `${created.toString(36)}-${crypto.randomUUID().slice(0, 8)}`,
|
|
960
|
-
workspaceId,
|
|
961
|
-
requestedBy,
|
|
962
|
-
createdAt: iso(created),
|
|
963
|
-
updatedAt: iso(created),
|
|
964
|
-
status: "running",
|
|
965
|
-
units: plan.sources.map((s) => ({
|
|
966
|
-
name: s.name,
|
|
967
|
-
kind: s.kind,
|
|
968
|
-
dataClass: s.dataClass,
|
|
969
|
-
description: s.description,
|
|
970
|
-
status: "pending",
|
|
971
|
-
attempts: 0,
|
|
972
|
-
entries: [],
|
|
973
|
-
redactions: 0
|
|
974
|
-
}))
|
|
975
|
-
};
|
|
976
|
-
await saveJob(job);
|
|
977
|
-
await storage.put(runningKey(workspaceId, job.id), new Uint8Array(0));
|
|
978
|
-
return job;
|
|
979
|
-
},
|
|
980
|
-
/**
|
|
981
|
-
* Run pending units until `budgetMs` passes. A unit that starts always
|
|
982
|
-
* finishes, so one call can run longer than the budget. Returns the job as
|
|
983
|
-
* stored; another request holding the lease leaves it unchanged.
|
|
984
|
-
*/
|
|
985
1122
|
async advance(workspaceId, id, budgetMs = 2e4) {
|
|
986
1123
|
const loaded = await loadJob(workspaceId, id);
|
|
987
1124
|
if (!loaded) return null;
|
|
@@ -1105,130 +1242,6 @@ function createExportEngine(options) {
|
|
|
1105
1242
|
} finally {
|
|
1106
1243
|
clearInterval(heartbeat);
|
|
1107
1244
|
}
|
|
1108
|
-
},
|
|
1109
|
-
progress(job) {
|
|
1110
|
-
const bytesOf = (u) => u.entries.reduce((n, e) => n + e.size, 0);
|
|
1111
|
-
return {
|
|
1112
|
-
id: job.id,
|
|
1113
|
-
status: job.status,
|
|
1114
|
-
createdAt: job.createdAt,
|
|
1115
|
-
completedAt: job.completedAt,
|
|
1116
|
-
error: job.error,
|
|
1117
|
-
unitsTotal: job.units.length,
|
|
1118
|
-
unitsDone: job.units.filter((u) => u.status === "done" || u.status === "empty").length,
|
|
1119
|
-
unitsFailed: job.units.filter((u) => u.status === "failed").length,
|
|
1120
|
-
current: job.status === "running" ? job.units.find((u) => u.status === "pending")?.name : void 0,
|
|
1121
|
-
bytes: job.units.reduce((n, u) => n + bytesOf(u), 0),
|
|
1122
|
-
units: job.units.map((u) => ({
|
|
1123
|
-
name: u.name,
|
|
1124
|
-
dataClass: u.dataClass,
|
|
1125
|
-
status: u.status,
|
|
1126
|
-
rows: u.rows,
|
|
1127
|
-
files: u.files,
|
|
1128
|
-
bytes: bytesOf(u),
|
|
1129
|
-
error: u.error
|
|
1130
|
-
}))
|
|
1131
|
-
};
|
|
1132
|
-
},
|
|
1133
|
-
/** The finished archive as one stream with an exact length. */
|
|
1134
|
-
zip(job) {
|
|
1135
|
-
if (job.status !== "complete" || !job.meta) throw new Error("workspace-export: export is not complete");
|
|
1136
|
-
const modifiedAt = new Date(job.completedAt ?? job.createdAt);
|
|
1137
|
-
const entries = [...job.meta, ...job.units.flatMap((u) => u.entries)].map((entry) => ({
|
|
1138
|
-
name: entry.path,
|
|
1139
|
-
method: entry.method,
|
|
1140
|
-
crc32: entry.crc32,
|
|
1141
|
-
compressedSize: entry.compressedSize,
|
|
1142
|
-
uncompressedSize: entry.size,
|
|
1143
|
-
modifiedAt,
|
|
1144
|
-
open: async () => {
|
|
1145
|
-
let index = 0;
|
|
1146
|
-
let reader = null;
|
|
1147
|
-
return new ReadableStream({
|
|
1148
|
-
async pull(controller) {
|
|
1149
|
-
for (; ; ) {
|
|
1150
|
-
if (!reader) {
|
|
1151
|
-
const segment = entry.segments[index];
|
|
1152
|
-
if (!segment) {
|
|
1153
|
-
controller.close();
|
|
1154
|
-
return;
|
|
1155
|
-
}
|
|
1156
|
-
index += 1;
|
|
1157
|
-
const object = await storage.get(segment.key);
|
|
1158
|
-
if (!object || object.size !== segment.size) {
|
|
1159
|
-
controller.error(new Error(`workspace-export: segment ${segment.key} is missing or changed`));
|
|
1160
|
-
return;
|
|
1161
|
-
}
|
|
1162
|
-
reader = object.body.getReader();
|
|
1163
|
-
}
|
|
1164
|
-
const { done, value } = await reader.read();
|
|
1165
|
-
if (!done) {
|
|
1166
|
-
controller.enqueue(value);
|
|
1167
|
-
return;
|
|
1168
|
-
}
|
|
1169
|
-
reader = null;
|
|
1170
|
-
}
|
|
1171
|
-
},
|
|
1172
|
-
async cancel(reason) {
|
|
1173
|
-
await reader?.cancel(reason);
|
|
1174
|
-
}
|
|
1175
|
-
});
|
|
1176
|
-
}
|
|
1177
|
-
}));
|
|
1178
|
-
const { length, stream } = createZipStream(entries);
|
|
1179
|
-
const date = (job.completedAt ?? job.createdAt).slice(0, 10);
|
|
1180
|
-
return { length, stream, filename: `${options.app}-workspace-export-${date}.zip` };
|
|
1181
|
-
},
|
|
1182
|
-
/** Delete exports older than `retentionMs`, and any export by id when given. */
|
|
1183
|
-
/**
|
|
1184
|
-
* Advance every running export whose lease has lapsed, so an export keeps
|
|
1185
|
-
* going after the owner closes the tab. Call it from the product's scheduled
|
|
1186
|
-
* handler (a one-minute cron). Returns how many exports it advanced.
|
|
1187
|
-
*/
|
|
1188
|
-
async continueRunning(budgetMs = 6e4) {
|
|
1189
|
-
const deadline = now() + budgetMs;
|
|
1190
|
-
const keys = [];
|
|
1191
|
-
let cursor;
|
|
1192
|
-
do {
|
|
1193
|
-
const page = await storage.list(`${prefix}/_running/`, cursor);
|
|
1194
|
-
keys.push(...page.keys);
|
|
1195
|
-
cursor = page.cursor;
|
|
1196
|
-
} while (cursor);
|
|
1197
|
-
let advanced = 0;
|
|
1198
|
-
for (const key of keys) {
|
|
1199
|
-
const remaining = deadline - now();
|
|
1200
|
-
if (remaining <= 0) break;
|
|
1201
|
-
const name = key.split("/").at(-1) ?? "";
|
|
1202
|
-
const workspaceId = name.slice(0, name.lastIndexOf("~"));
|
|
1203
|
-
const id = name.slice(name.lastIndexOf("~") + 1);
|
|
1204
|
-
if (!workspaceId || !id) continue;
|
|
1205
|
-
const loaded = await loadJob(workspaceId, id);
|
|
1206
|
-
if (!loaded || loaded.job.status !== "running") {
|
|
1207
|
-
await storage.delete([key]);
|
|
1208
|
-
continue;
|
|
1209
|
-
}
|
|
1210
|
-
if (loaded.job.lease && loaded.job.lease.until > now()) continue;
|
|
1211
|
-
await this.advance(workspaceId, id, Math.min(remaining, 2e4));
|
|
1212
|
-
advanced += 1;
|
|
1213
|
-
}
|
|
1214
|
-
return advanced;
|
|
1215
|
-
},
|
|
1216
|
-
async prune(workspaceId, retentionMs, onlyId) {
|
|
1217
|
-
const cutoff = now() - retentionMs;
|
|
1218
|
-
const doomed = [];
|
|
1219
|
-
let cursor;
|
|
1220
|
-
const root = `${prefix}/${assertSafeKeySegment(workspaceId)}/`;
|
|
1221
|
-
do {
|
|
1222
|
-
const page = await storage.list(root, cursor);
|
|
1223
|
-
for (const key of page.keys) {
|
|
1224
|
-
const id = key.slice(root.length).split("/")[0] ?? "";
|
|
1225
|
-
const created = Number.parseInt(id.split("-")[0] ?? "", 36);
|
|
1226
|
-
if (onlyId ? id === onlyId : Number.isFinite(created) && created < cutoff) doomed.push(key);
|
|
1227
|
-
}
|
|
1228
|
-
cursor = page.cursor;
|
|
1229
|
-
} while (cursor);
|
|
1230
|
-
await storage.delete(doomed);
|
|
1231
|
-
return doomed.length;
|
|
1232
1245
|
}
|
|
1233
1246
|
};
|
|
1234
1247
|
}
|