@tangle-network/agent-app 0.45.54 → 0.45.55
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/README.md +1 -1
- package/dist/alerting/index.d.ts +5 -175
- package/dist/alerting/slack.d.ts +176 -0
- package/dist/app-auth/index.d.ts +14 -17
- package/dist/assets/index.d.ts +2 -504
- package/dist/assets/schema.d.ts +264 -0
- package/dist/assets/types.d.ts +237 -0
- package/dist/assistant/AssistantDock.d.ts +56 -0
- package/dist/assistant/AssistantHistory.d.ts +41 -0
- package/dist/assistant/AssistantPanel.d.ts +84 -0
- package/dist/assistant/ProposalCard.d.ts +41 -0
- package/dist/assistant/ResizeHandle.d.ts +19 -0
- package/dist/assistant/client-context.d.ts +20 -0
- package/dist/assistant/client.d.ts +117 -0
- package/dist/assistant/index.d.ts +19 -848
- package/dist/assistant/launcher.d.ts +23 -0
- package/dist/assistant/persistence.d.ts +26 -0
- package/dist/assistant/presentation.d.ts +99 -0
- package/dist/assistant/provider-label.d.ts +7 -0
- package/dist/assistant/reducer.d.ts +130 -0
- package/dist/assistant/sse.d.ts +24 -0
- package/dist/assistant/time-ago.d.ts +6 -0
- package/dist/assistant/transcript.d.ts +97 -0
- package/dist/assistant/types.d.ts +291 -0
- package/dist/assistant/use-stick-to-bottom.d.ts +28 -0
- package/dist/assistant/useAssistantChat.d.ts +63 -0
- package/dist/assistant/useAssistantModels.d.ts +22 -0
- package/dist/assistant/useAssistantThreads.d.ts +47 -0
- package/dist/assistant/usePanelPrefs.d.ts +55 -0
- package/dist/billing/index.d.ts +19 -21
- package/dist/brand/index.d.ts +16 -10
- package/dist/brand-extraction/extract.d.ts +34 -0
- package/dist/brand-extraction/index.d.ts +12 -214
- package/dist/brand-extraction/map.d.ts +58 -0
- package/dist/brand-extraction/types.d.ts +119 -0
- package/dist/catalog/index.d.ts +11 -101
- package/dist/chat-react/composer-mode-controls.d.ts +14 -0
- package/dist/chat-react/entry-composer.d.ts +92 -0
- package/dist/chat-react/index.d.ts +22 -118
- package/dist/chat-react/types.d.ts +11 -0
- package/dist/chat-routes/attachment-store.d.ts +84 -0
- package/dist/chat-routes/attachment-upload.d.ts +84 -0
- package/dist/chat-routes/attachment-validation.d.ts +95 -0
- package/dist/chat-routes/binary-sniff.d.ts +45 -0
- package/dist/chat-routes/completed-sandbox-turn.d.ts +25 -0
- package/dist/chat-routes/detached-turn.d.ts +197 -0
- package/dist/chat-routes/dispatch-parts.d.ts +101 -0
- package/dist/chat-routes/draft-persistence.d.ts +189 -0
- package/dist/chat-routes/durable-projection.d.ts +18 -0
- package/dist/chat-routes/file-index.d.ts +115 -0
- package/dist/chat-routes/index.d.ts +25 -1840
- package/dist/chat-routes/model-failover-stream.d.ts +206 -0
- package/dist/chat-routes/promote-file-part.d.ts +84 -0
- package/dist/chat-routes/resolve-attachments.d.ts +72 -0
- package/dist/chat-routes/sandbox-producer.d.ts +146 -0
- package/dist/chat-routes/sandbox-turn-usage.d.ts +4 -0
- package/dist/{stale-turn-lock-DucQzvXu.d.ts → chat-routes/stale-turn-lock.d.ts} +7 -9
- package/dist/chat-routes/turn-routes.d.ts +540 -0
- package/dist/chat-routes/upload.d.ts +84 -0
- package/dist/{wire-DOZ-O6hD.d.ts → chat-routes/wire.d.ts} +41 -44
- package/dist/chat-store/core.d.ts +19 -0
- package/dist/chat-store/index.d.ts +22 -322
- package/dist/{parts-BqIHMdyu.d.ts → chat-store/parts.d.ts} +49 -47
- package/dist/chat-store/schema.d.ts +157 -0
- package/dist/chat-store/store.d.ts +177 -0
- package/dist/config/index.d.ts +13 -18
- package/dist/crypto/index.d.ts +10 -12
- package/dist/crypto/web-token.d.ts +22 -0
- package/dist/design-canvas/apply.d.ts +70 -0
- package/dist/design-canvas/drizzle-store.d.ts +29 -0
- package/dist/design-canvas/drizzle.d.ts +7 -575
- package/dist/{export-presets-mgVulRaV.d.ts → design-canvas/export-presets.d.ts} +18 -22
- package/dist/design-canvas/index.d.ts +22 -268
- package/dist/design-canvas/mcp-entry.d.ts +15 -0
- package/dist/design-canvas/mcp-handler.d.ts +34 -0
- package/dist/design-canvas/mcp-tools.d.ts +30 -0
- package/dist/{model-DnfO_PdJ.d.ts → design-canvas/model.d.ts} +33 -35
- package/dist/{operations-ByJ6yXOW.d.ts → design-canvas/operations.d.ts} +21 -25
- package/dist/design-canvas/schema.d.ts +558 -0
- package/dist/{store-CqfDtnPQ.d.ts → design-canvas/store.d.ts} +8 -12
- package/dist/design-canvas/templates.d.ts +72 -0
- package/dist/design-canvas/validate.d.ts +32 -0
- package/dist/design-canvas-react/components/BleedTrimOverlay.d.ts +22 -0
- package/dist/design-canvas-react/components/BrandKnot.d.ts +11 -0
- package/dist/design-canvas-react/components/CanvasEmptyState.d.ts +32 -0
- package/dist/design-canvas-react/components/CanvasInsertPanel.d.ts +53 -0
- package/dist/{lazy-DrkVyDpe.d.ts → design-canvas-react/components/DesignCanvas.d.ts} +27 -20
- package/dist/design-canvas-react/components/DesignCanvasEditor.d.ts +23 -0
- package/dist/design-canvas-react/components/ElementNode.d.ts +51 -0
- package/dist/design-canvas-react/components/ExportControl.d.ts +21 -0
- package/dist/design-canvas-react/components/GridLayer.d.ts +47 -0
- package/dist/design-canvas-react/components/InlineTextEditor.d.ts +25 -0
- package/dist/design-canvas-react/components/LayersPanel.d.ts +20 -0
- package/dist/design-canvas-react/components/PagesStrip.d.ts +34 -0
- package/dist/design-canvas-react/components/Rulers.d.ts +31 -0
- package/dist/design-canvas-react/components/SelectionLayer.d.ts +51 -0
- package/dist/design-canvas-react/components/SnapGuidesOverlay.d.ts +25 -0
- package/dist/design-canvas-react/components/Toolbar.d.ts +64 -0
- package/dist/design-canvas-react/components/Workspace.d.ts +92 -0
- package/dist/design-canvas-react/components/ZoomControls.d.ts +14 -0
- package/dist/design-canvas-react/components/glyphs.d.ts +46 -0
- package/dist/design-canvas-react/components/icon-button.d.ts +22 -0
- package/dist/design-canvas-react/components/index.d.ts +27 -0
- package/dist/design-canvas-react/components/layer-tree.d.ts +34 -0
- package/dist/design-canvas-react/components/ruler-math.d.ts +78 -0
- package/dist/design-canvas-react/components/transform-math.d.ts +168 -0
- package/dist/{command-stack-TNPWJCzW.d.ts → design-canvas-react/contracts.d.ts} +16 -63
- package/dist/design-canvas-react/engine/command-stack.d.ts +43 -0
- package/dist/design-canvas-react/engine/commands.d.ts +154 -0
- package/dist/design-canvas-react/engine/selection.d.ts +48 -0
- package/dist/design-canvas-react/engine/snap.d.ts +24 -0
- package/dist/design-canvas-react/engine/zoom-pan.d.ts +18 -0
- package/dist/design-canvas-react/engine.d.ts +21 -399
- package/dist/design-canvas-react/export-math.d.ts +104 -0
- package/dist/design-canvas-react/export.d.ts +89 -0
- package/dist/design-canvas-react/index.d.ts +16 -586
- package/dist/design-canvas-react/insert-builders.d.ts +61 -0
- package/dist/design-canvas-react/lazy.d.ts +21 -6
- package/dist/documents/docx.d.ts +50 -0
- package/dist/documents/extract.d.ts +87 -0
- package/dist/documents/index.d.ts +26 -232
- package/dist/documents/media-type.d.ts +33 -0
- package/dist/documents/pdf-inspector.d.ts +5 -9
- package/dist/{types-DrBidf3O.d.ts → documents/types.d.ts} +13 -15
- package/dist/documents/zip.d.ts +56 -0
- package/dist/eval/calibration.d.ts +106 -0
- package/dist/eval/index.d.ts +8 -116
- package/dist/eval-campaign/index.d.ts +11 -12
- package/dist/{trust-gate-Dcm5xSva.d.ts → eval-campaign/trust-gate.d.ts} +5 -9
- package/dist/forms/blank.d.ts +48 -0
- package/dist/forms/fill.d.ts +105 -0
- package/dist/forms/index.d.ts +58 -332
- package/dist/forms/registry.d.ts +115 -0
- package/dist/forms/verify.d.ts +58 -0
- package/dist/harness/index.d.ts +21 -19
- package/dist/intakes/api.d.ts +5 -11
- package/dist/{completion-CvcNUz07.d.ts → intakes/completion.d.ts} +7 -11
- package/dist/intakes/context-sufficiency.d.ts +113 -0
- package/dist/intakes/drizzle/schema.d.ts +338 -0
- package/dist/intakes/drizzle/store.d.ts +75 -0
- package/dist/intakes/drizzle.d.ts +12 -391
- package/dist/intakes/index.d.ts +23 -113
- package/dist/{model-C8U0HZxL.d.ts → intakes/model.d.ts} +15 -17
- package/dist/intakes-react/components/BrandMark.d.ts +10 -0
- package/dist/intakes-react/components/IntakeInterview.d.ts +15 -0
- package/dist/intakes-react/components/index.d.ts +1 -0
- package/dist/intakes-react/contracts.d.ts +42 -0
- package/dist/intakes-react/index.d.ts +12 -47
- package/dist/intakes-react/lazy.d.ts +9 -8
- package/dist/integrations/index.d.ts +10 -12
- package/dist/{contract-OxG_jVMx.d.ts → interactions/contract.d.ts} +40 -42
- package/dist/interactions/index.d.ts +16 -256
- package/dist/interactions/route.d.ts +151 -0
- package/dist/interactions/sidecar.d.ts +100 -0
- package/dist/knowledge/index.d.ts +7 -11
- package/dist/knowledge-loop/index.d.ts +13 -20
- package/dist/legibility/checks/empty-state.d.ts +59 -0
- package/dist/legibility/checks/reachability.d.ts +103 -0
- package/dist/legibility/checks/silent-failure.d.ts +57 -0
- package/dist/legibility/checks/success.d.ts +38 -0
- package/dist/legibility/checks/vocabulary.d.ts +65 -0
- package/dist/legibility/cli-args.d.ts +30 -0
- package/dist/legibility/cli.d.ts +25 -0
- package/dist/legibility/index.d.ts +10 -530
- package/dist/legibility/report.d.ts +22 -0
- package/dist/legibility/scan.d.ts +29 -0
- package/dist/legibility/source.d.ts +132 -0
- package/dist/legibility/suppress.d.ts +36 -0
- package/dist/legibility/types.d.ts +168 -0
- package/dist/legibility/walk-sources.d.ts +21 -0
- package/dist/{agent-activity-C8ZG0F0M.d.ts → missions/agent-activity.d.ts} +3 -5
- package/dist/missions/engine.d.ts +251 -0
- package/dist/missions/events.d.ts +195 -0
- package/dist/missions/index.d.ts +12 -765
- package/dist/missions/plan-parse.d.ts +50 -0
- package/dist/missions/service.d.ts +265 -0
- package/dist/{failover-D-3UXXTb.d.ts → model-resolution/failover.d.ts} +10 -12
- package/dist/model-resolution/index.d.ts +15 -18
- package/dist/object-store/index.d.ts +15 -17
- package/dist/openui/action.d.ts +54 -0
- package/dist/openui/authoring.d.ts +25 -0
- package/dist/openui/index.d.ts +24 -206
- package/dist/openui/route.d.ts +124 -0
- package/dist/openui/segments.d.ts +71 -0
- package/dist/openui/values.d.ts +82 -0
- package/dist/openui-react/index.d.ts +9 -13
- package/dist/peer-floors/check.d.ts +9 -190
- package/dist/peer-floors/cli.d.ts +2 -3
- package/dist/peer-floors/dependency-source.d.ts +178 -0
- package/dist/plans/index.d.ts +13 -14
- package/dist/{billing-BuNlaKlE.d.ts → platform/billing.d.ts} +28 -32
- package/dist/platform/guards.d.ts +79 -0
- package/dist/platform/hub.d.ts +107 -0
- package/dist/platform/index.d.ts +7 -112
- package/dist/{sso-Cm00S61u.d.ts → platform/sso.d.ts} +15 -97
- package/dist/preflight/cli.d.ts +3 -6
- package/dist/preflight/index.d.ts +16 -18
- package/dist/preset-cloudflare/headers.d.ts +12 -0
- package/dist/preset-cloudflare/index.d.ts +22 -74
- package/dist/preset-cloudflare/workflow-instance.d.ts +35 -0
- package/dist/profile/budget.d.ts +72 -0
- package/dist/profile/fingerprint.d.ts +65 -0
- package/dist/profile/index.d.ts +27 -19
- package/dist/prompt/index.d.ts +3 -5
- package/dist/record/drizzle/schema.d.ts +488 -0
- package/dist/record/drizzle/store.d.ts +224 -0
- package/dist/record/drizzle.d.ts +10 -679
- package/dist/record/fold.d.ts +99 -0
- package/dist/record/index.d.ts +13 -13
- package/dist/{fold-DACU7gtf.d.ts → record/model.d.ts} +22 -124
- package/dist/record/ulid.d.ts +12 -0
- package/dist/redact/index.d.ts +14 -16
- package/dist/run/index.d.ts +11 -16
- package/dist/runtime/agent.d.ts +23 -0
- package/dist/runtime/certified-delivery.d.ts +57 -0
- package/dist/runtime/index.d.ts +17 -367
- package/dist/runtime/loop.d.ts +58 -0
- package/dist/runtime/model-catalog.d.ts +103 -0
- package/dist/{model-CdCDfBA9.d.ts → runtime/model.d.ts} +25 -27
- package/dist/runtime/openai-stream.d.ts +126 -0
- package/dist/runtime/surface-profile.d.ts +115 -0
- package/dist/sandbox/binary-read.d.ts +63 -0
- package/dist/sandbox/diagnostics.d.ts +69 -0
- package/dist/sandbox/index.d.ts +103 -1085
- package/dist/sandbox/model.d.ts +179 -0
- package/dist/sandbox/outcome.d.ts +10 -0
- package/dist/sandbox/prewarm-claim-d1.d.ts +80 -0
- package/dist/sandbox/prewarm.d.ts +193 -0
- package/dist/sandbox/recovery.d.ts +216 -0
- package/dist/sandbox/terminal-connection.d.ts +145 -0
- package/dist/sandbox/workspace-sandbox-manager.d.ts +44 -0
- package/dist/sequences/apply.d.ts +54 -0
- package/dist/sequences/captions.d.ts +91 -0
- package/dist/sequences/drizzle-store.d.ts +36 -0
- package/dist/sequences/drizzle.d.ts +7 -1252
- package/dist/sequences/exports.d.ts +138 -0
- package/dist/sequences/index.d.ts +19 -340
- package/dist/sequences/mcp-entry.d.ts +15 -0
- package/dist/sequences/mcp-handler.d.ts +39 -0
- package/dist/sequences/mcp-tools.d.ts +47 -0
- package/dist/{store-B7LLlk9p.d.ts → sequences/model.d.ts} +26 -110
- package/dist/sequences/operations.d.ts +126 -0
- package/dist/sequences/schema.d.ts +1231 -0
- package/dist/sequences/store.d.ts +81 -0
- package/dist/sequences/validate.d.ts +98 -0
- package/dist/sequences-react/components/BrandMark.d.ts +10 -0
- package/dist/sequences-react/components/PreviewCanvas.d.ts +26 -0
- package/dist/sequences-react/components/SnapIndicatorLine.d.ts +11 -0
- package/dist/sequences-react/components/TimelineClipChip.d.ts +80 -0
- package/dist/sequences-react/components/TimelineEditor.d.ts +44 -0
- package/dist/sequences-react/components/TimelineEmptyState.d.ts +21 -0
- package/dist/sequences-react/components/TimelineGhostLanes.d.ts +14 -0
- package/dist/sequences-react/components/TimelinePlayhead.d.ts +11 -0
- package/dist/sequences-react/components/TimelineRuler.d.ts +16 -0
- package/dist/sequences-react/components/TimelineSmallScreenGate.d.ts +12 -0
- package/dist/sequences-react/components/TimelineTrackRow.d.ts +51 -0
- package/dist/sequences-react/components/ZoomControl.d.ts +15 -0
- package/dist/sequences-react/components/composite-command.d.ts +8 -0
- package/dist/sequences-react/components/glyphs.d.ts +26 -0
- package/dist/sequences-react/components/index.d.ts +31 -0
- package/dist/sequences-react/components/interaction-math.d.ts +103 -0
- package/dist/sequences-react/contracts.d.ts +187 -0
- package/dist/sequences-react/engine/command-stack.d.ts +18 -0
- package/dist/sequences-react/engine/commands.d.ts +146 -0
- package/dist/sequences-react/engine/playback.d.ts +18 -0
- package/dist/sequences-react/engine/snap.d.ts +29 -0
- package/dist/sequences-react/engine/zoom.d.ts +29 -0
- package/dist/sequences-react/index.d.ts +20 -880
- package/dist/sequences-react/lazy.d.ts +8 -0
- package/dist/sequences-react/media/frame-provider.d.ts +70 -0
- package/dist/sequences-react/media/transcription.d.ts +33 -0
- package/dist/sequences-react/media/waveform.d.ts +34 -0
- package/dist/session-shell/index.d.ts +31 -204
- package/dist/session-shell/nav-guard.d.ts +170 -0
- package/dist/session-shell/path.d.ts +19 -0
- package/dist/signoff/cli.d.ts +4 -7
- package/dist/signoff/config.d.ts +12 -0
- package/dist/signoff/exec.d.ts +44 -0
- package/dist/signoff/index.d.ts +56 -14
- package/dist/signoff/invoked-as-script.d.ts +25 -0
- package/dist/signoff/node-version.d.ts +50 -0
- package/dist/signoff/proof-attach.d.ts +88 -0
- package/dist/signoff/proof-cli.d.ts +1 -0
- package/dist/signoff/proof-fixture.d.ts +13 -0
- package/dist/signoff/proof-from-report.d.ts +22 -0
- package/dist/signoff/proof-git.d.ts +57 -0
- package/dist/signoff/proof-record.d.ts +202 -0
- package/dist/signoff/proof-verify.d.ts +103 -0
- package/dist/signoff/proof.d.ts +35 -310
- package/dist/signoff/report.d.ts +7 -0
- package/dist/{run-D80hoLKh.d.ts → signoff/run.d.ts} +3 -6
- package/dist/signoff/schedule.d.ts +55 -0
- package/dist/signoff/seeds.d.ts +50 -0
- package/dist/signoff/store.d.ts +22 -0
- package/dist/{types-Bd6uW9vQ.d.ts → signoff/types.d.ts} +15 -17
- package/dist/signoff/workflow-pin.d.ts +56 -0
- package/dist/signoff/workspace.d.ts +40 -0
- package/dist/skills/index.d.ts +28 -32
- package/dist/skills-placement/index.d.ts +7 -11
- package/dist/spend/budget.d.ts +123 -0
- package/dist/spend/ceiling.d.ts +51 -0
- package/dist/spend/cli-args.d.ts +20 -0
- package/dist/spend/cli.d.ts +1 -0
- package/dist/spend/fixtures/incident-parked-time.d.ts +55 -0
- package/dist/spend/index.d.ts +38 -1144
- package/dist/spend/liveness.d.ts +131 -0
- package/dist/spend/ownership.d.ts +87 -0
- package/dist/spend/reconcile.d.ts +109 -0
- package/dist/spend/reference.d.ts +42 -0
- package/dist/spend/report.d.ts +12 -0
- package/dist/spend/store.d.ts +123 -0
- package/dist/spend/types.d.ts +466 -0
- package/dist/store/index.d.ts +10 -12
- package/dist/stories/app-shell/fixtures.d.ts +43 -0
- package/dist/stories/app-shell/shell.d.ts +81 -0
- package/dist/stories/assistant/fixtures.d.ts +73 -0
- package/dist/stories/chat/fixtures.d.ts +70 -0
- package/dist/stories/chat/markdown.d.ts +11 -0
- package/dist/stories/chat/run-drill-in.d.ts +19 -0
- package/dist/stories/chat-controls/fixtures.d.ts +116 -0
- package/dist/stories/design-canvas/fixtures.d.ts +57 -0
- package/dist/stories/fixtures/canvas.d.ts +10 -0
- package/dist/stories/fixtures/catalog.d.ts +7 -0
- package/dist/stories/fixtures/chat.d.ts +39 -0
- package/dist/stories/fixtures/index.d.ts +4 -0
- package/dist/stories/fixtures/sequences.d.ts +17 -0
- package/dist/stories/panels/fixtures.d.ts +63 -0
- package/dist/stories/sequences/fixtures.d.ts +30 -0
- package/dist/stories/studio/fixtures.d.ts +22 -0
- package/dist/stream/index.d.ts +10 -56
- package/dist/{stream-normalizer-DKRxyVlZ.d.ts → stream/stream-normalizer.d.ts} +23 -26
- package/dist/{turn-buffer-COMQUwO2.d.ts → stream/turn-buffer.d.ts} +21 -23
- package/dist/stream/turn-identity.d.ts +49 -0
- package/dist/studio/generation.d.ts +179 -0
- package/dist/studio/index.d.ts +12 -181
- package/dist/studio-react/avatar-composer.d.ts +8 -0
- package/dist/studio-react/composer-hero.d.ts +12 -0
- package/dist/studio-react/composer-shell.d.ts +18 -0
- package/dist/studio-react/generation-card.d.ts +9 -0
- package/dist/studio-react/generation-detail-modal.d.ts +11 -0
- package/dist/studio-react/generation-detail.d.ts +6 -0
- package/dist/studio-react/generation-grid.d.ts +15 -0
- package/dist/studio-react/image-composer.d.ts +8 -0
- package/dist/studio-react/index.d.ts +32 -245
- package/dist/studio-react/library-drawer.d.ts +12 -0
- package/dist/studio-react/library-panel.d.ts +15 -0
- package/dist/studio-react/publish-package-composer.d.ts +18 -0
- package/dist/studio-react/result-canvas.d.ts +6 -0
- package/dist/studio-react/speech-composer.d.ts +4 -0
- package/dist/studio-react/studio-header.d.ts +5 -0
- package/dist/studio-react/studio-sheet.d.ts +12 -0
- package/dist/studio-react/studio-workspace.d.ts +23 -0
- package/dist/studio-react/transcription-composer.d.ts +12 -0
- package/dist/studio-react/type-config.d.ts +11 -0
- package/dist/studio-react/use-studio-generations.d.ts +20 -0
- package/dist/studio-react/video-composer.d.ts +10 -0
- package/dist/tangle/index.d.ts +7 -9
- package/dist/teams/drizzle/access.d.ts +82 -0
- package/dist/{invitations-schema-_fI7HkJP.d.ts → teams/drizzle/invitations-schema.d.ts} +39 -27
- package/dist/teams/drizzle/personal-organization.d.ts +41 -0
- package/dist/{access-490O6aOU.d.ts → teams/drizzle/schema.d.ts} +57 -122
- package/dist/teams/drizzle.d.ts +12 -44
- package/dist/teams/index.d.ts +20 -44
- package/dist/teams/invitations-api.d.ts +17 -21
- package/dist/{invitations-DoYMvXea.d.ts → teams/invitations.d.ts} +14 -18
- package/dist/teams/invite.d.ts +42 -0
- package/dist/teams/members-api.d.ts +12 -16
- package/dist/teams/resend.d.ts +3 -13
- package/dist/{roles-B4nU3jDi.d.ts → teams/roles.d.ts} +18 -20
- package/dist/teams-react/components/BrandMark.d.ts +10 -0
- package/dist/teams-react/components/InvitationsPanel.d.ts +13 -0
- package/dist/teams-react/components/InviteAcceptPage.d.ts +10 -0
- package/dist/teams-react/components/MembersPanel.d.ts +14 -0
- package/dist/teams-react/components/RoleSelect.d.ts +17 -0
- package/dist/teams-react/components/index.d.ts +3 -0
- package/dist/teams-react/contracts.d.ts +134 -0
- package/dist/teams-react/index.d.ts +12 -143
- package/dist/teams-react/lazy.d.ts +11 -11
- package/dist/test-setup.d.ts +1 -0
- package/dist/theme/index.d.ts +6 -104
- package/dist/theme/tailwind-preset.d.ts +1 -2
- package/dist/theme/theme.d.ts +106 -0
- package/dist/theme-contract/cli.d.ts +21 -0
- package/dist/theme-contract/index.d.ts +4 -6
- package/dist/{auth-BYtiazA4.d.ts → tools/auth.d.ts} +8 -11
- package/dist/tools/capability.d.ts +54 -0
- package/dist/tools/dispatch.d.ts +37 -0
- package/dist/tools/errors.d.ts +8 -0
- package/dist/tools/gating.d.ts +62 -0
- package/dist/tools/http.d.ts +27 -0
- package/dist/tools/index.d.ts +12 -217
- package/dist/{mcp-rpc-DYwPlYbZ.d.ts → tools/mcp-rpc.d.ts} +7 -9
- package/dist/{mcp-xxoZZfor.d.ts → tools/mcp.d.ts} +14 -16
- package/dist/tools/openai.d.ts +28 -0
- package/dist/tools/registry.d.ts +39 -0
- package/dist/tools/runtime.d.ts +22 -0
- package/dist/{types-B25Mib1r.d.ts → tools/types.d.ts} +15 -83
- package/dist/{flow-types-CJxEmaRy.d.ts → trace/flow-types.d.ts} +2 -4
- package/dist/trace/index.d.ts +11 -148
- package/dist/trace/mission-flow.d.ts +82 -0
- package/dist/trace/mission-trace.d.ts +52 -0
- package/dist/turn-health/classify.d.ts +207 -0
- package/dist/turn-health/index.d.ts +29 -637
- package/dist/turn-health/lifecycle.d.ts +75 -0
- package/dist/turn-health/sink.d.ts +122 -0
- package/dist/turn-health/sweep.d.ts +245 -0
- package/dist/turn-stream/adapters.d.ts +257 -0
- package/dist/turn-stream/core.d.ts +293 -0
- package/dist/turn-stream/do.d.ts +144 -0
- package/dist/turn-stream/index.d.ts +62 -738
- package/dist/turn-stream/memory.d.ts +41 -0
- package/dist/vault/ConfirmDialog.d.ts +22 -0
- package/dist/vault/VaultPane.d.ts +15 -0
- package/dist/{VaultPane-BDP6SB_K.d.ts → vault/contracts.d.ts} +15 -22
- package/dist/vault/index.d.ts +15 -22
- package/dist/vault/lazy.d.ts +9 -7
- package/dist/vault/server.d.ts +8 -10
- package/dist/web/free-route-limit.d.ts +187 -0
- package/dist/web/index.d.ts +15 -207
- package/dist/{rate-limit-BOVmJRXZ.d.ts → web/rate-limit.d.ts} +3 -5
- package/dist/web-react/agent-session-controls.d.ts +105 -0
- package/dist/web-react/async/async-view.d.ts +69 -0
- package/dist/web-react/async/index.d.ts +13 -305
- package/dist/web-react/async/state.d.ts +107 -0
- package/dist/web-react/async/use-async-resource.d.ts +41 -0
- package/dist/web-react/async/use-confirmed-mutation.d.ts +90 -0
- package/dist/web-react/brand-mark.d.ts +11 -0
- package/dist/web-react/chat-attachments.d.ts +21 -0
- package/dist/web-react/chat-composer.d.ts +174 -0
- package/dist/web-react/chat-interactions.d.ts +1 -0
- package/dist/web-react/chat-mentions.d.ts +48 -0
- package/dist/web-react/chat-stream.d.ts +106 -0
- package/dist/web-react/class-names.d.ts +10 -0
- package/dist/web-react/controls.d.ts +265 -0
- package/dist/web-react/durable-chat-cards.d.ts +40 -0
- package/dist/web-react/durable-interaction-submit.d.ts +22 -0
- package/dist/web-react/durable-plan-card.d.ts +13 -0
- package/dist/web-react/durable-plan-flow.d.ts +77 -0
- package/dist/web-react/harness-glyphs.d.ts +28 -0
- package/dist/web-react/index.d.ts +80 -2347
- package/dist/web-react/inert.d.ts +39 -0
- package/dist/web-react/insight-card.d.ts +203 -0
- package/dist/web-react/interaction-card-support.d.ts +115 -0
- package/dist/web-react/interaction-plan-card.d.ts +39 -0
- package/dist/web-react/interaction-question-card.d.ts +100 -0
- package/dist/web-react/message-attachments.d.ts +56 -0
- package/dist/web-react/mission-activity.d.ts +96 -0
- package/dist/web-react/motion.d.ts +43 -0
- package/dist/web-react/provenance-model.d.ts +195 -0
- package/dist/web-react/provenance.d.ts +82 -0
- package/dist/web-react/provider-logo.d.ts +14 -0
- package/dist/web-react/record-grid-model.d.ts +257 -0
- package/dist/web-react/record-grid.d.ts +108 -0
- package/dist/web-react/sandbox-terminal.d.ts +90 -0
- package/dist/web-react/seat-paywall.d.ts +47 -0
- package/dist/web-react/session-history.d.ts +196 -0
- package/dist/web-react/smooth-text.d.ts +29 -0
- package/dist/web-react/sparkline.d.ts +150 -0
- package/dist/web-react/terminal.d.ts +1 -92
- package/dist/web-react/use-chat-interactions.d.ts +78 -0
- package/dist/web-react/use-composer-attachments.d.ts +111 -0
- package/dist/web-react/use-file-mentions.d.ts +94 -0
- package/dist/web-react/work-product.d.ts +105 -0
- package/dist/work-product/claim-support.d.ts +288 -0
- package/dist/work-product/index.d.ts +16 -849
- package/dist/work-product/provenance.d.ts +61 -0
- package/dist/{queue-VTBA5ONX.d.ts → work-product/queue.d.ts} +10 -12
- package/dist/work-product/quote.d.ts +139 -0
- package/dist/work-product/route.d.ts +88 -0
- package/dist/work-product/service.d.ts +123 -0
- package/dist/work-product/tools.d.ts +144 -0
- package/dist/{types-CCeYywdS.d.ts → work-product/types.d.ts} +29 -31
- package/dist/work-product-react/index.d.ts +19 -8
- package/dist/workspace-react/index.d.ts +8 -11
- package/package.json +4 -3
- package/dist/agent-session-controls-CmlXwp_H.d.ts +0 -384
- package/dist/apply-6wlMOLf8.d.ts +0 -280
- package/dist/attachment-validation-BfJDBU1g.d.ts +0 -261
- package/dist/budget-BOucfcb_.d.ts +0 -142
- package/dist/values-C7RidJuI.d.ts +0 -156
|
@@ -1,740 +1,64 @@
|
|
|
1
|
-
import { R as ReconcileStaleTurnLockOptions } from '../stale-turn-lock-DucQzvXu.js';
|
|
2
|
-
import { T as TurnEventStore } from '../turn-buffer-COMQUwO2.js';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
|
-
* `/turn-stream`
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
timestamp: number;
|
|
64
|
-
seq?: number;
|
|
65
|
-
}
|
|
66
|
-
/** Terminal run markers: they close a turn segment and auto-release the
|
|
67
|
-
* channel's chat-turn lock for the segment's execution.
|
|
68
|
-
*
|
|
69
|
-
* KEPT (not deprecated with the segment buffer): the lock auto-release
|
|
70
|
-
* reads it. A product that stops broadcasting turn events to the thread
|
|
71
|
-
* channel loses only that auto-release — the cooperative release on settle
|
|
72
|
-
* (`createDurableTurnLock().release`) and `reconcileStaleDurableTurnLock`
|
|
73
|
-
* both still fire, which is what actually frees a wedged lane. */
|
|
74
|
-
declare function isTerminalRunEvent(type: string): boolean;
|
|
75
|
-
/** Define the scope level for acquiring a turn lock within thread or workspace contexts */
|
|
76
|
-
type TurnLockScope = 'thread' | 'workspace';
|
|
77
|
-
/** Generate a unique string key combining workspace and thread identifiers.
|
|
78
|
-
*
|
|
79
|
-
* KEPT: thread-scope LOCKS are keyed on it (see {@link turnLockChannelKey}).
|
|
80
|
-
* Only its second use — addressing a live-viewer socket for interactive
|
|
81
|
-
* sandbox-turn rebroadcast — is superseded by the session gateway. */
|
|
82
|
-
declare function threadChannelKey(workspaceId: string, threadId: string): string;
|
|
83
|
-
/** Generate a unique channel key based on the given workspace identifier.
|
|
84
|
-
*
|
|
85
|
-
* KEPT and canonical: the per-workspace signal channel (`thread.created`,
|
|
86
|
-
* `thread.activity`) plus workspace-scope locks. The session gateway is
|
|
87
|
-
* per-SESSION and read-only, so it cannot carry either. */
|
|
88
|
-
declare function workspaceChannelKey(workspaceId: string): string;
|
|
89
|
-
/** The channel a lock lives on: workspace-scope locks serialize every thread
|
|
90
|
-
* in the workspace (one shared sandbox), thread-scope locks serialize one
|
|
91
|
-
* thread (router lane). Same keying as the reference consumer, so a product
|
|
92
|
-
* swapping its fork for this package contends on identical instances. */
|
|
93
|
-
declare function turnLockChannelKey(workspaceId: string, threadId: string, scope: TurnLockScope): string;
|
|
94
|
-
/** Generate a storage channel key string for a given turn identifier.
|
|
95
|
-
*
|
|
96
|
-
* KEPT and canonical: the DETACHED lane's durable turn-event rows live on
|
|
97
|
-
* this instance. A detached run never reaches the session gateway, so this
|
|
98
|
-
* is the only way a browser tails one. */
|
|
99
|
-
declare function turnStorageChannelKey(turnId: string): string;
|
|
100
|
-
/** Generate a unique channel key string based on the provided scope identifier.
|
|
101
|
-
*
|
|
102
|
-
* KEPT and canonical: backs `TurnEventStore.listRunning`, which is how a
|
|
103
|
-
* reloaded client rediscovers an in-flight DETACHED turn. */
|
|
104
|
-
declare function scopeIndexChannelKey(scopeId: string): string;
|
|
105
|
-
/** DEPRECATED (interactive turn-rebroadcast buffer) — represent a segment of a turn containing events, sequence limit, and terminal status.
|
|
106
|
-
*
|
|
107
|
-
* @deprecated Part of the interactive turn-rebroadcast buffer — see the
|
|
108
|
-
* two-lane rule in this file's header. Removal is a major-version change. */
|
|
109
|
-
interface TurnSegment {
|
|
110
|
-
events: TurnStreamEvent[];
|
|
111
|
-
maxSeq: number;
|
|
112
|
-
terminal: boolean;
|
|
113
|
-
}
|
|
114
|
-
/** DEPRECATED (interactive turn-rebroadcast buffer) — define a store managing segments and tracking the active execution identifier.
|
|
115
|
-
*
|
|
116
|
-
* @deprecated Part of the interactive turn-rebroadcast buffer — see the
|
|
117
|
-
* two-lane rule in this file's header. Removal is a major-version change. */
|
|
118
|
-
interface SegmentStore {
|
|
119
|
-
segments: Map<string, TurnSegment>;
|
|
120
|
-
activeExecutionId: string | null;
|
|
121
|
-
}
|
|
122
|
-
/** DEPRECATED (interactive turn-rebroadcast buffer) — per-turn replay window. Generous enough for normal turns; a turn that
|
|
123
|
-
* exceeds it loses its earliest deltas from replay (a late resumer
|
|
124
|
-
* self-heals via the final `result` event + loader revalidation).
|
|
125
|
-
*
|
|
126
|
-
* @deprecated Sizes the interactive turn-rebroadcast buffer only. The
|
|
127
|
-
* DETACHED lane's durable rows (`turnEvent:` storage) are uncapped and are
|
|
128
|
-
* not affected. */
|
|
129
|
-
declare const MAX_SEGMENT_EVENTS = 2000;
|
|
130
|
-
/** Recent `thread.created` markers kept for late-connecting sidebars.
|
|
131
|
-
*
|
|
132
|
-
* KEPT: a workspace-level signal, not a turn rebroadcast. */
|
|
133
|
-
declare const MAX_RECENT_CREATED = 50;
|
|
134
|
-
/** A responding marker older than this is treated as stale, so a dropped
|
|
135
|
-
* `end` broadcast can't leave a permanently-stuck "responding" dot. */
|
|
136
|
-
declare const ACTIVITY_TTL_MS: number;
|
|
137
|
-
/** DEPRECATED (interactive sandbox-turn rebroadcast; the SDK's session gateway replaces it) — create a SegmentStore with initialized segments and no active execution ID.
|
|
138
|
-
*
|
|
139
|
-
* @deprecated Backs the interactive sandbox-turn rebroadcast, which the
|
|
140
|
-
* sandbox SDK already does better (measured: run/stream → 0 frames at the
|
|
141
|
-
* gateway, message lane → 297/297; see the two-lane rule in this file's
|
|
142
|
-
* header). Sandbox turns: drive on `box.session(id).sendMessage()` and let
|
|
143
|
-
* the browser attach with `box.mintScopedToken({ scope: 'session' })` +
|
|
144
|
-
* `SessionGatewayClient`. Sandbox-FREE turns: `/stream`'s
|
|
145
|
-
* `replayTurnEvents` (`GET /chat/stream/:turnId`) already follows a running
|
|
146
|
-
* turn from a cursor. Detached turns keep the durable turn-event rows —
|
|
147
|
-
* they are a different, non-deprecated lane. Removal is a major-version
|
|
148
|
-
* change; nothing is deleted here. */
|
|
149
|
-
declare function createSegmentStore(): SegmentStore;
|
|
150
|
-
/**
|
|
151
|
-
* DEPRECATED (interactive turn-rebroadcast buffer) — append a per-turn event to
|
|
152
|
-
* its execution's segment, assigning a monotonic
|
|
153
|
-
* `seq`. A `session.run.started` (or the first-seen event for an execution)
|
|
154
|
-
* opens a fresh segment, makes it active, and drops prior turns' buffers so a
|
|
155
|
-
* resumer only ever replays the current turn. A terminal run event marks the
|
|
156
|
-
* segment terminal. Returns the seq-stamped event to broadcast.
|
|
157
|
-
*
|
|
158
|
-
* @deprecated The interactive rebroadcast half — {@link createSegmentStore}
|
|
159
|
-
* names the replacement per lane; this file's header holds the measurement.
|
|
160
|
-
*/
|
|
161
|
-
declare function appendSegmentEvent(store: SegmentStore, executionId: string, incoming: TurnStreamEvent, maxEvents?: number): TurnStreamEvent;
|
|
162
|
-
/**
|
|
163
|
-
* DEPRECATED (interactive turn-rebroadcast buffer; the SDK replays losslessly on
|
|
164
|
-
* both lanes) — events of the active, non-terminal turn with `seq > afterSeq`,
|
|
165
|
-
* i.e. what a
|
|
166
|
-
* (re)connecting client replays before going live. A terminal (finished) turn
|
|
167
|
-
* replays nothing: the client falls back to the loader's persisted row.
|
|
168
|
-
*
|
|
169
|
-
* @deprecated The interactive rebroadcast half — {@link createSegmentStore}
|
|
170
|
-
* names the replacement per lane. The SDK's own reconnect replay is
|
|
171
|
-
* `SessionGatewayClient` + `lastEventId` (browser) or
|
|
172
|
-
* `box.streamPrompt('', { executionId, lastEventId })` (worker); both were
|
|
173
|
-
* measured lossless.
|
|
174
|
-
*/
|
|
175
|
-
declare function replayActiveSegment(store: SegmentStore, afterSeq: number): TurnStreamEvent[];
|
|
176
|
-
/**
|
|
177
|
-
* Remove responding entries (threadId → startedAt) older than `ttlMs`, so a
|
|
178
|
-
* dropped `end` broadcast can't leave a permanently-stuck dot. Mutates
|
|
179
|
-
* `active` and returns the removed thread ids.
|
|
180
|
-
*/
|
|
181
|
-
declare function pruneStaleThreads(active: Map<string, number>, now: number, ttlMs: number): string[];
|
|
182
|
-
/** Default lifetime of an unreleased lock. Long enough that a legitimately
|
|
183
|
-
* slow sandbox turn never loses its guard mid-run; the way OUT of a wedge is
|
|
184
|
-
* never the TTL but `reconcileStaleTurnLock` (in `/chat-routes`), which
|
|
185
|
-
* probes the execution's actual state.
|
|
186
|
-
*
|
|
187
|
-
* Everything from here down is the LOCK, and it is fully KEPT. The sandbox
|
|
188
|
-
* SDK ships no single-flight primitive — the session gateway is a read-only
|
|
189
|
-
* fanout — so moving a product to the message lane changes nothing about
|
|
190
|
-
* who is allowed to start a turn. */
|
|
191
|
-
declare const TURN_LOCK_TTL_MS: number;
|
|
192
|
-
/** The stored single-flight lock. Field-compatible with the reference
|
|
193
|
-
* consumer's `ChatTurnLock` so adoption is a swap, not a migration. */
|
|
194
|
-
interface DurableTurnLock {
|
|
195
|
-
workspaceId: string;
|
|
196
|
-
threadId: string;
|
|
197
|
-
scope: TurnLockScope;
|
|
198
|
-
executionId: string;
|
|
199
|
-
lockId: string;
|
|
200
|
-
startedAt: number;
|
|
201
|
-
expiresAt: number;
|
|
202
|
-
turnId?: string;
|
|
203
|
-
/** The turn released this lock, but a product-owned post-turn task (e.g.
|
|
204
|
-
* file persistence reading the box) is still running, so the release is
|
|
205
|
-
* parked on the lock until the task settles. Written only through the DO's
|
|
206
|
-
* defer seam — the base package never sets it on its own. */
|
|
207
|
-
releasePending?: boolean;
|
|
208
|
-
}
|
|
209
|
-
/** Define input parameters required to acquire a turn-based lock in a workspace thread */
|
|
210
|
-
interface TurnLockAcquireInput {
|
|
211
|
-
workspaceId: string;
|
|
212
|
-
threadId: string;
|
|
213
|
-
scope: TurnLockScope;
|
|
214
|
-
executionId: string;
|
|
215
|
-
lockId: string;
|
|
216
|
-
turnId?: string;
|
|
217
|
-
}
|
|
218
|
-
/** Resolve the result of attempting to acquire a turn lock indicating success or active lock status */
|
|
219
|
-
type TurnLockAcquireResult = {
|
|
220
|
-
acquired: true;
|
|
221
|
-
lock: DurableTurnLock;
|
|
222
|
-
} | {
|
|
223
|
-
acquired: false;
|
|
224
|
-
active: DurableTurnLock;
|
|
225
|
-
};
|
|
226
|
-
/** Define input parameters required to release a turn lock in a specific workspace thread */
|
|
227
|
-
interface TurnLockReleaseInput {
|
|
228
|
-
workspaceId: string;
|
|
229
|
-
threadId: string;
|
|
230
|
-
scope: TurnLockScope;
|
|
231
|
-
executionId: string;
|
|
232
|
-
lockId: string;
|
|
233
|
-
}
|
|
234
|
-
/** Fenced out-of-band release (stop button, stale-lock reconciliation). The
|
|
235
|
-
* fences make it refuse a SUCCESSOR lock: `interruptedAt` must not precede
|
|
236
|
-
* the lock's own start, and when either side names a turn, both must name
|
|
237
|
-
* the same one. */
|
|
238
|
-
interface TurnLockInterruptedReleaseInput {
|
|
239
|
-
workspaceId: string;
|
|
240
|
-
threadId: string;
|
|
241
|
-
/** Try only this scope; omit to try workspace then thread. */
|
|
242
|
-
scope?: TurnLockScope;
|
|
243
|
-
interruptedAt: number;
|
|
244
|
-
turnId?: string;
|
|
245
|
-
}
|
|
246
|
-
/** `stored` is what the DO read from storage; expired locks are dead. */
|
|
247
|
-
declare function activeTurnLock(stored: DurableTurnLock | undefined, now: number): DurableTurnLock | null;
|
|
248
|
-
/** Create a durable turn lock object with timing and scope based on input parameters */
|
|
249
|
-
declare function createTurnLock(input: TurnLockAcquireInput, now: number, ttlMs?: number): DurableTurnLock;
|
|
250
|
-
/** A cooperative release must present the lock's own identity — both the
|
|
251
|
-
* execution and the lockId minted at acquire — so a retry of a PREVIOUS turn
|
|
252
|
-
* can never release the current one. `lockId` is optional only for the DO's
|
|
253
|
-
* internal terminal-event auto-release, which knows the execution but not
|
|
254
|
-
* the caller-held lockId. */
|
|
255
|
-
declare function turnLockMatchesRelease(active: DurableTurnLock, input: {
|
|
256
|
-
executionId: string;
|
|
257
|
-
lockId?: string;
|
|
258
|
-
}): boolean;
|
|
259
|
-
/**
|
|
260
|
-
* The interrupted/stale release fence. `interruptedAt` is the instant the
|
|
261
|
-
* releasing evidence was observed (the stop click, the stale-lock probe) —
|
|
262
|
-
* a lock STARTED after that instant is a successor the evidence says nothing
|
|
263
|
-
* about, so it survives. When the lock recorded a client turnId, the release
|
|
264
|
-
* must name the same turn; a lock without one refuses a turn-specific
|
|
265
|
-
* release (it cannot prove it is that turn).
|
|
266
|
-
*/
|
|
267
|
-
declare function interruptedReleaseApplies(active: DurableTurnLock, input: {
|
|
268
|
-
threadId: string;
|
|
269
|
-
interruptedAt: number;
|
|
270
|
-
turnId?: string;
|
|
271
|
-
}): boolean;
|
|
272
|
-
/** Provide constant paths for managing chat turn streams and locks */
|
|
273
|
-
declare const TURN_STREAM_PATHS: {
|
|
274
|
-
readonly broadcast: "/broadcast";
|
|
275
|
-
readonly lockAcquire: "/chat-turn-lock/acquire";
|
|
276
|
-
readonly lockRelease: "/chat-turn-lock/release";
|
|
277
|
-
readonly lockReleaseInterrupted: "/chat-turn-lock/release-interrupted";
|
|
278
|
-
readonly turnEventsAppend: "/turn-events/append";
|
|
279
|
-
readonly turnEventsRead: "/turn-events/read";
|
|
280
|
-
readonly turnStatusSet: "/turn-status/set";
|
|
281
|
-
readonly turnStatusGet: "/turn-status/get";
|
|
282
|
-
readonly scopeStatusSet: "/turn-scope/set";
|
|
283
|
-
readonly scopeRunningList: "/turn-scope/running";
|
|
284
|
-
};
|
|
285
|
-
/** Storage keys inside a DO instance. Exported for subclass coexistence —
|
|
286
|
-
* a product extending the DO must not collide with these. */
|
|
287
|
-
declare const TURN_STREAM_STORAGE_KEYS: {
|
|
288
|
-
readonly lock: "chatTurnLock";
|
|
289
|
-
readonly activeThreads: "activeThreads";
|
|
290
|
-
readonly turnStatus: "turnStatus";
|
|
291
|
-
readonly turnScope: "turnScopeIndex";
|
|
292
|
-
readonly turnEventPrefix: "turnEvent:";
|
|
293
|
-
};
|
|
294
|
-
/** Zero-padded seq so DO storage `list({ prefix })` returns rows in replay
|
|
295
|
-
* order without a sort. 10 digits holds any realistic turn. */
|
|
296
|
-
declare function turnEventStorageKey(seq: number): string;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* `TurnStreamDO` — the shared Durable Object transport shell over the pure
|
|
300
|
-
* core (`./core`). One class serves every channel family; the instance NAME
|
|
301
|
-
* decides which endpoints a given instance ever sees:
|
|
302
|
-
*
|
|
303
|
-
* - **thread channel** (`${workspaceId}:${threadId}`) — the thread-scope lock
|
|
304
|
-
* (KEPT), plus the live turn rebroadcast: WebSocket fanout and per-turn
|
|
305
|
-
* segments with `sync`/`afterSeq` reconnect replay. That rebroadcast is
|
|
306
|
-
* `@deprecated` for sandbox-backed interactive turns — the sandbox session
|
|
307
|
-
* gateway already does it, browser-direct, when the turn is driven on the
|
|
308
|
-
* message lane (`./core`'s header has the production measurement).
|
|
309
|
-
* - **workspace channel** (`${workspaceId}`) — coarse sidebar signals
|
|
310
|
-
* (`thread.activity` responding set, durable across eviction;
|
|
311
|
-
* `thread.created` recent list) and the workspace-scope lock. KEPT: the
|
|
312
|
-
* gateway is per-session and read-only, so it carries neither.
|
|
313
|
-
* - **turn storage** (`turn:${turnId}`) — the durable `TurnEventStore` rows +
|
|
314
|
-
* status for one buffered turn (replay survives DO eviction — this is what
|
|
315
|
-
* graduates the vertical's `turnStore` from no-op). KEPT and load-bearing:
|
|
316
|
-
* a DETACHED run never reaches the gateway, so this is the only way a
|
|
317
|
-
* browser tails autonomous work.
|
|
318
|
-
* - **scope index** (`scope:${scopeId}`) — the running-turn index backing
|
|
319
|
-
* `TurnEventStore.listRunning` reconnect discovery. KEPT.
|
|
320
|
-
*
|
|
321
|
-
* The class is a PLAIN class over a structural {@link TurnStreamDOState} —
|
|
322
|
-
* no `cloudflare:workers` import, so this package stays substrate-free and
|
|
323
|
-
* the DO is unit-testable in Node. Cloudflare's `DurableObjectState`
|
|
324
|
-
* satisfies the interface; a product binds it in wrangler by re-exporting:
|
|
325
|
-
*
|
|
326
|
-
* // worker entry
|
|
327
|
-
* export { TurnStreamDO } from '@tangle-network/agent-app/turn-stream'
|
|
328
|
-
*
|
|
329
|
-
* Fan-out enumerates `state.getWebSockets()` (never an in-memory socket map)
|
|
330
|
-
* and reads per-socket metadata from the serialized attachment, so it is
|
|
331
|
-
* correct across WebSocket hibernation.
|
|
332
|
-
*
|
|
333
|
-
* Product extension (how the reference consumer keeps its Vault machinery
|
|
334
|
-
* while deleting its fork): subclass and override
|
|
335
|
-
* {@link TurnStreamDO.handleProductRequest} (extra POST endpoints),
|
|
336
|
-
* {@link TurnStreamDO.shouldDeferLockRelease} /
|
|
337
|
-
* {@link TurnStreamDO.completeDeferredLockRelease} (park a lock release
|
|
338
|
-
* behind a product-owned post-turn task), and
|
|
339
|
-
* {@link TurnStreamDO.productSyncEvents} (extra state replayed to a
|
|
340
|
-
* late-connecting socket). Product storage keys must avoid
|
|
341
|
-
* {@link TURN_STREAM_STORAGE_KEYS}.
|
|
342
|
-
*/
|
|
343
|
-
|
|
344
|
-
/** The socket surface the DO touches. Cloudflare's hibernatable `WebSocket`
|
|
345
|
-
* satisfies it. */
|
|
346
|
-
interface TurnStreamSocket {
|
|
347
|
-
send(data: string): void;
|
|
348
|
-
close(code?: number, reason?: string): void;
|
|
349
|
-
serializeAttachment(value: unknown): void;
|
|
350
|
-
deserializeAttachment(): unknown;
|
|
351
|
-
}
|
|
352
|
-
/** The storage surface the DO touches (Cloudflare `DurableObjectStorage`
|
|
353
|
-
* satisfies it structurally). `list` must return keys in ascending order —
|
|
354
|
-
* the turn-event rows rely on it for replay order. */
|
|
355
|
-
interface TurnStreamStorage {
|
|
356
|
-
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
357
|
-
put<T = unknown>(key: string, value: T): Promise<void>;
|
|
358
|
-
delete(key: string): Promise<boolean | void>;
|
|
359
|
-
list<T = unknown>(options: {
|
|
360
|
-
prefix: string;
|
|
361
|
-
start?: string;
|
|
362
|
-
}): Promise<Map<string, T>>;
|
|
363
|
-
}
|
|
364
|
-
/** The `DurableObjectState` surface the DO uses. */
|
|
365
|
-
interface TurnStreamDOState {
|
|
366
|
-
storage: TurnStreamStorage;
|
|
367
|
-
acceptWebSocket(ws: TurnStreamSocket): void;
|
|
368
|
-
getWebSockets(): TurnStreamSocket[];
|
|
369
|
-
}
|
|
370
|
-
/** Define options to override default TTL and event limits for TURN stream DO operations */
|
|
371
|
-
interface TurnStreamDOOptions {
|
|
372
|
-
/** Override {@link TURN_LOCK_TTL_MS}. */
|
|
373
|
-
lockTtlMs?: number;
|
|
374
|
-
/** Override {@link MAX_SEGMENT_EVENTS}. */
|
|
375
|
-
maxSegmentEvents?: number;
|
|
376
|
-
/** Override {@link ACTIVITY_TTL_MS}. */
|
|
377
|
-
activityTtlMs?: number;
|
|
378
|
-
/** How long an unrenewed running turn remains discoverable. */
|
|
379
|
-
runningTurnLeaseMs?: number;
|
|
380
|
-
}
|
|
381
|
-
/** Manage per-turn segments and track active threads with durable event storage */
|
|
382
|
-
declare class TurnStreamDO {
|
|
383
|
-
protected readonly state: TurnStreamDOState;
|
|
384
|
-
protected readonly env: unknown;
|
|
385
|
-
protected readonly options: TurnStreamDOOptions;
|
|
386
|
-
private segments;
|
|
387
|
-
private recentCreated;
|
|
388
|
-
private activeThreads;
|
|
389
|
-
constructor(state: TurnStreamDOState, env?: unknown, options?: TurnStreamDOOptions);
|
|
390
|
-
fetch(request: Request): Promise<Response>;
|
|
391
|
-
/** Called for any request no base endpoint claimed (before the 404), so a
|
|
392
|
-
* subclass adds product endpoints without touching base routing. Return
|
|
393
|
-
* `null` to decline. */
|
|
394
|
-
protected handleProductRequest(_request: Request, _url: URL): Promise<Response | null>;
|
|
395
|
-
/** Consulted before any lock release (cooperative, interrupted, or the
|
|
396
|
-
* terminal-event auto-release). Return `true` while a product-owned
|
|
397
|
-
* post-turn task for `executionId` must keep the scope serialized (e.g.
|
|
398
|
-
* file persistence still reading the box) — the release is then parked as
|
|
399
|
-
* `releasePending` on the lock and completed via
|
|
400
|
-
* {@link completeDeferredLockRelease}. Base: never defer. */
|
|
401
|
-
protected shouldDeferLockRelease(_executionId: string): Promise<boolean>;
|
|
402
|
-
/** Complete a release parked by {@link shouldDeferLockRelease}. A subclass
|
|
403
|
-
* calls this when its deferred condition settles. */
|
|
404
|
-
protected completeDeferredLockRelease(executionId: string): Promise<boolean>;
|
|
405
|
-
/** Extra product state replayed to a socket during its `sync`, after the
|
|
406
|
-
* base replay for its scope (e.g. an in-flight persistence status card).
|
|
407
|
-
* Base: none. */
|
|
408
|
-
protected productSyncEvents(_scope: 'thread' | 'workspace', _meta: {
|
|
409
|
-
sessionId: string;
|
|
410
|
-
}): Promise<TurnStreamEvent[]>;
|
|
411
|
-
private handleWebSocketUpgrade;
|
|
412
|
-
/**
|
|
413
|
-
* First (and only) client message after open: `{ type: 'sync', afterSeq }`.
|
|
414
|
-
* Replays the current state for the socket's scope, then marks it `synced`
|
|
415
|
-
* so live broadcasts start flowing. Because the DO is single-threaded, the
|
|
416
|
-
* replay snapshot and the synced flip are atomic w.r.t. broadcasts — every
|
|
417
|
-
* event reaches the socket exactly once, in order, via replay XOR live
|
|
418
|
-
* fan-out.
|
|
419
|
-
*/
|
|
420
|
-
webSocketMessage(ws: TurnStreamSocket, message: string | ArrayBuffer): Promise<void>;
|
|
421
|
-
webSocketClose(ws: TurnStreamSocket, code: number, reason: string): void;
|
|
422
|
-
webSocketError(): void;
|
|
423
|
-
private trySend;
|
|
424
|
-
private handleBroadcast;
|
|
425
|
-
private loadActiveThreads;
|
|
426
|
-
private persistActiveThreads;
|
|
427
|
-
protected loadActiveLock(now?: number): Promise<DurableTurnLock | null>;
|
|
428
|
-
private releaseActiveLock;
|
|
429
|
-
/** Park a release on the lock itself; {@link completeDeferredLockRelease}
|
|
430
|
-
* finishes it once the product's deferred condition settles. */
|
|
431
|
-
private deferLockRelease;
|
|
432
|
-
private handleLockAcquire;
|
|
433
|
-
private handleLockRelease;
|
|
434
|
-
private handleLockReleaseInterrupted;
|
|
435
|
-
private handleTurnEventsAppend;
|
|
436
|
-
private handleTurnEventsRead;
|
|
437
|
-
private handleTurnStatusSet;
|
|
438
|
-
private handleTurnStatusGet;
|
|
439
|
-
private handleScopeStatusSet;
|
|
440
|
-
private handleScopeRunningList;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Worker-side adapters over {@link TurnStreamDO}: the concrete implementations
|
|
445
|
-
* of the chat vertical's `turnStore` and `turnLock` seams, the WebSocket
|
|
446
|
-
* upgrade forwarder, the best-effort broadcast helpers, and an in-process
|
|
447
|
-
* memory harness for tests and keyless local dev.
|
|
448
|
-
*
|
|
449
|
-
* Everything takes the namespace STRUCTURALLY ({@link TurnStreamNamespaceLike}
|
|
450
|
-
* — Cloudflare's `DurableObjectNamespace` satisfies it), so nothing here
|
|
451
|
-
* imports Cloudflare types and the same adapters run against the memory
|
|
452
|
-
* harness in vitest.
|
|
453
|
-
*
|
|
454
|
-
* Live fanout is deliberately NOT a side effect of the turn-event store: the
|
|
455
|
-
* store is keyed by turnId/scopeId while viewer sockets live on the
|
|
456
|
-
* `${workspaceId}:${threadId}` channel, and only the product's per-turn
|
|
457
|
-
* context knows both. Products wire the workspace signal helpers into
|
|
458
|
-
* `createChatTurnRoutes`' `onEvent`.
|
|
459
|
-
*
|
|
460
|
-
* Which adapters are still the right answer (see `./core`'s header for the
|
|
461
|
-
* production measurement behind this split):
|
|
462
|
-
*
|
|
463
|
-
* | adapter | status |
|
|
464
|
-
* | ------------------------------------ | --------------------------------- |
|
|
465
|
-
* | {@link createDurableTurnLock} | KEPT — no SDK equivalent |
|
|
466
|
-
* | {@link reconcileStaleDurableTurnLock}| KEPT — no SDK equivalent |
|
|
467
|
-
* | {@link createDurableObjectTurnEventStore} | KEPT — the DETACHED lane |
|
|
468
|
-
* | {@link broadcastWorkspaceActivity} | KEPT — workspace signal |
|
|
469
|
-
* | {@link broadcastThreadCreated} | KEPT — workspace signal |
|
|
470
|
-
* | {@link createTurnStreamUpgradeHandler} | KEPT for the workspace channel |
|
|
471
|
-
* | {@link broadcastTurnStreamEvent} | `@deprecated` for sandbox turns |
|
|
472
|
-
*/
|
|
473
|
-
|
|
474
|
-
/** Resolve a stub interface for handling fetch requests with optional initialization parameters */
|
|
475
|
-
interface TurnStreamStubLike {
|
|
476
|
-
fetch(input: Request | string, init?: RequestInit): Promise<Response>;
|
|
477
|
-
}
|
|
478
|
-
/** The surface of `DurableObjectNamespace` the adapters use. */
|
|
479
|
-
interface TurnStreamNamespaceLike {
|
|
480
|
-
idFromName(name: string): unknown;
|
|
481
|
-
get(id: unknown): TurnStreamStubLike;
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* A {@link TurnEventStore} backed by {@link TurnStreamDO} storage — the
|
|
485
|
-
* production implementation of `createChatTurnRoutes`' `turnStore` seam for
|
|
486
|
-
* apps that don't run D1 for turn events (or want replay co-located with the
|
|
487
|
-
* live channel). Each buffered turn lives on its own `turn:<turnId>` DO
|
|
488
|
-
* instance; `listRunning` reconnect discovery rides a per-scope index
|
|
489
|
-
* instance. Drops in wherever `createD1TurnEventStore(env.DB)` would.
|
|
490
|
-
*
|
|
491
|
-
* KEPT and load-bearing for AUTONOMOUS work. A detached run
|
|
492
|
-
* (`dispatchPrompt({ detach: true })`, `driveTurn`) executes on the sandbox
|
|
493
|
-
* run/stream lane, which publishes nothing to the session event bus — a
|
|
494
|
-
* `SessionGatewayClient` attached to that session sees zero turn events
|
|
495
|
-
* (measured: 0 of 71 / 0 of 527 / 0 of 408 across three session-id
|
|
496
|
-
* strategies). So a browser that must tail a mission step, a queue job, or
|
|
497
|
-
* an inbound-email review has no SDK path; it needs these durable rows plus
|
|
498
|
-
* `runDetachedTurn` (`/chat-routes`). Nothing here is deprecated.
|
|
499
|
-
*/
|
|
500
|
-
declare function createDurableObjectTurnEventStore(namespace: TurnStreamNamespaceLike): TurnEventStore;
|
|
501
|
-
/** Define input parameters required to acquire a durable turn lock in a workspace thread context */
|
|
502
|
-
interface AcquireDurableTurnLockInput {
|
|
503
|
-
workspaceId: string;
|
|
504
|
-
threadId: string;
|
|
505
|
-
scope: TurnLockScope;
|
|
506
|
-
executionId: string;
|
|
507
|
-
turnId?: string;
|
|
508
|
-
/** Supply to reclaim/retry with a stable id; default mints a UUID. */
|
|
509
|
-
lockId?: string;
|
|
510
|
-
}
|
|
511
|
-
/** Acquire a durable turn lock in the specified namespace with given input parameters */
|
|
512
|
-
declare function acquireDurableTurnLock(namespace: TurnStreamNamespaceLike, input: AcquireDurableTurnLockInput): Promise<TurnLockAcquireResult>;
|
|
513
|
-
/** Release a durable turn lock and indicate if the release was successful or deferred */
|
|
514
|
-
declare function releaseDurableTurnLock(namespace: TurnStreamNamespaceLike, input: TurnLockReleaseInput): Promise<{
|
|
515
|
-
released: boolean;
|
|
516
|
-
deferred?: boolean;
|
|
517
|
-
}>;
|
|
518
|
-
/** Define input parameters to release an interrupted durable turn lock in a workspace or thread */
|
|
519
|
-
interface ReleaseInterruptedDurableTurnLockInput {
|
|
520
|
-
workspaceId: string;
|
|
521
|
-
threadId: string;
|
|
522
|
-
/** Try only this scope; omit to try workspace then thread (a stop button
|
|
523
|
-
* doesn't know which lane the wedged turn ran on). */
|
|
524
|
-
scope?: TurnLockScope;
|
|
525
|
-
interruptedAt: number;
|
|
526
|
-
turnId?: string;
|
|
527
|
-
}
|
|
528
|
-
/** Fenced out-of-band release — the DO refuses a successor lock (started
|
|
529
|
-
* after `interruptedAt`) and a turnId mismatch. Returns whether any scope
|
|
530
|
-
* released. */
|
|
531
|
-
declare function releaseInterruptedDurableTurnLock(namespace: TurnStreamNamespaceLike, input: ReleaseInterruptedDurableTurnLockInput): Promise<boolean>;
|
|
532
|
-
/** Define options to reconcile stale durable turn locks with context, namespace, workspace, and active lock details */
|
|
533
|
-
interface ReconcileStaleDurableTurnLockOptions extends Pick<ReconcileStaleTurnLockOptions, 'probeSandbox' | 'probeSession' | 'graceMs' | 'terminalGraceMs' | 'context' | 'log' | 'now'> {
|
|
534
|
-
namespace: TurnStreamNamespaceLike;
|
|
535
|
-
workspaceId: string;
|
|
536
|
-
threadId: string;
|
|
537
|
-
/** The lock the acquire attempt was refused on. */
|
|
538
|
-
active: DurableTurnLock;
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* `/chat-routes`' `reconcileStaleTurnLock` policy wired to the DO: the
|
|
542
|
-
* product supplies the probes (which box, what its session says), the policy
|
|
543
|
-
* decides, and a release lands as a FENCED interrupted release —
|
|
544
|
-
* `interruptedAt` is the policy's `fence.observedAt`, so a successor lock
|
|
545
|
-
* acquired while the probes were in flight survives by construction.
|
|
546
|
-
*/
|
|
547
|
-
declare function reconcileStaleDurableTurnLock(options: ReconcileStaleDurableTurnLockOptions): Promise<{
|
|
548
|
-
released: boolean;
|
|
549
|
-
diagnostics: Record<string, unknown>;
|
|
550
|
-
}>;
|
|
551
|
-
/** The subset of `ChatTurnProduceArgs` the lock adapter reads — structural,
|
|
552
|
-
* so this module needs no import from `/chat-routes/turn-routes` (which
|
|
553
|
-
* would drag the `agent-runtime` peer into every `/turn-stream` consumer). */
|
|
554
|
-
interface TurnLockSeamArgs<TContext> {
|
|
555
|
-
identity: {
|
|
556
|
-
tenantId: string;
|
|
557
|
-
sessionId: string;
|
|
558
|
-
};
|
|
559
|
-
executionId: string;
|
|
560
|
-
context: TContext;
|
|
561
|
-
body: {
|
|
562
|
-
turnId?: string;
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
/** Verdict shape of the vertical's `turnLock.acquire`. */
|
|
566
|
-
type TurnLockSeamResult = {
|
|
567
|
-
acquired: true;
|
|
568
|
-
handle?: unknown;
|
|
569
|
-
} | {
|
|
570
|
-
acquired: false;
|
|
571
|
-
response: Response;
|
|
572
|
-
};
|
|
573
|
-
/** Define options for creating a durable turn lock with customizable scope and identification methods */
|
|
574
|
-
interface CreateDurableTurnLockOptions<TContext> {
|
|
575
|
-
namespace: TurnStreamNamespaceLike;
|
|
576
|
-
/** Which lane serializes this turn: `'workspace'` (shared sandbox — one
|
|
577
|
-
* turn per workspace) or `'thread'` (router lane — one turn per thread). */
|
|
578
|
-
scopeOf(args: TurnLockSeamArgs<TContext>): TurnLockScope;
|
|
579
|
-
/** Override the execution id the lock records (e.g. a follow-up reclaiming
|
|
580
|
-
* the execution it already dispatched). Default: the turn's own. */
|
|
581
|
-
lockExecutionIdOf?(args: TurnLockSeamArgs<TContext>): string | undefined;
|
|
582
|
-
/** Client turn id recorded on the lock (fences interrupted releases to the
|
|
583
|
-
* right turn). Default: the request body's `turnId`. */
|
|
584
|
-
clientTurnIdOf?(args: TurnLockSeamArgs<TContext>): string | undefined;
|
|
585
|
-
/**
|
|
586
|
-
* Attempt stale-lock recovery after a refused acquire. Return whether the
|
|
587
|
-
* held lock was released (the adapter then retries the acquire once).
|
|
588
|
-
* Products wire {@link reconcileStaleDurableTurnLock} with their sandbox +
|
|
589
|
-
* session probes here. Omit → a refused acquire is final.
|
|
590
|
-
*/
|
|
591
|
-
reconcile?(args: TurnLockSeamArgs<TContext>, active: DurableTurnLock): Promise<{
|
|
592
|
-
released: boolean;
|
|
593
|
-
diagnostics?: Record<string, unknown>;
|
|
594
|
-
}>;
|
|
595
|
-
/** Build the refusal `Response`. Default: a 409 with the shared body shape
|
|
596
|
-
* (`code`, `message`, lock identity + age, reconcile diagnostics). */
|
|
597
|
-
onRefused?(active: DurableTurnLock, diagnostics: Record<string, unknown> | undefined): Response;
|
|
598
|
-
}
|
|
599
|
-
/**
|
|
600
|
-
* The vertical's `turnLock` seam on the shared DO: dual-scope single-flight
|
|
601
|
-
* acquire (with one reconcile-then-retry pass when the product supplies a
|
|
602
|
-
* stale-lock reconciler) and cooperative release on settle. The returned
|
|
603
|
-
* object satisfies `createChatTurnRoutes`' `ChatTurnLock<TContext>`
|
|
604
|
-
* structurally.
|
|
605
|
-
*/
|
|
606
|
-
declare function createDurableTurnLock<TContext>(options: CreateDurableTurnLockOptions<TContext>): {
|
|
607
|
-
acquire(args: TurnLockSeamArgs<TContext>): Promise<TurnLockSeamResult>;
|
|
608
|
-
release(handle: unknown): Promise<void>;
|
|
609
|
-
};
|
|
610
|
-
/**
|
|
611
|
-
* DEPRECATED for sandbox-backed interactive turns (drive on the session-message
|
|
612
|
-
* lane + `SessionGatewayClient` instead) — fan a turn event out to the
|
|
613
|
-
* per-thread channel. `executionId` groups events
|
|
614
|
-
* into a per-turn segment with a monotonic seq, so a reconnecting client
|
|
615
|
-
* replays only the active turn and resumes from a cursor. Callers MUST await
|
|
616
|
-
* (the DO assigns seq on arrival — emission order matters); failures are
|
|
617
|
-
* swallowed (fanout is best-effort and never breaks chat delivery).
|
|
618
|
-
*
|
|
619
|
-
* @deprecated For a SANDBOX-backed interactive turn this re-broadcasts events
|
|
620
|
-
* the sandbox platform already fans out, at the cost of a worker hop. Drive
|
|
621
|
-
* the turn on the session-MESSAGE lane instead —
|
|
622
|
-
* `box.createSession({ sessionId, backend })` then
|
|
623
|
-
* `box.session(id).sendMessage({ parts: [{ type: 'text', text }] })` — and let
|
|
624
|
-
* the tab attach with `box.mintScopedToken({ scope: 'session', sessionId,
|
|
625
|
-
* runtimeSessionId })` + `SessionGatewayClient`
|
|
626
|
-
* (`@tangle-network/sandbox/session-gateway`). Measured on production
|
|
627
|
-
* (4 arms, SDK 0.12.0): turns driven with `box.streamPrompt()` delivered
|
|
628
|
-
* 0 of 71 / 0 of 527 / 0 of 408 turn events to a gateway client, because
|
|
629
|
-
* `POST /agents/run/stream` publishes nothing to the session event bus;
|
|
630
|
-
* the message lane delivered 297 of 297.
|
|
631
|
-
*
|
|
632
|
-
* Two things this deprecation does NOT cover, both still supported:
|
|
633
|
-
* DETACHED runs (no gateway fanout at all — keep `runDetachedTurn` over the
|
|
634
|
-
* durable turn-event rows) and the per-workspace signals
|
|
635
|
-
* ({@link broadcastWorkspaceActivity} / {@link broadcastThreadCreated}).
|
|
636
|
-
* A SANDBOX-FREE copilot that wants a second viewer should use `/stream`'s
|
|
637
|
-
* `replayTurnEvents` (`GET /chat/stream/:turnId`), which follows a running
|
|
638
|
-
* turn from a cursor without a second broadcast fabric.
|
|
639
|
-
*
|
|
640
|
-
* Kept for back-compat; removal is a major-version change.
|
|
641
|
-
*/
|
|
642
|
-
declare function broadcastTurnStreamEvent(namespace: TurnStreamNamespaceLike, input: {
|
|
643
|
-
workspaceId: string;
|
|
644
|
-
threadId: string;
|
|
645
|
-
executionId: string;
|
|
646
|
-
event: {
|
|
647
|
-
type: string;
|
|
648
|
-
data?: Record<string, unknown>;
|
|
649
|
-
};
|
|
650
|
-
}): Promise<void>;
|
|
651
|
-
/** Coarse per-workspace marker that a thread's turn started / ended — drives
|
|
652
|
-
* a sidebar "agent responding" indicator subscribed once per workspace. */
|
|
653
|
-
declare function broadcastWorkspaceActivity(namespace: TurnStreamNamespaceLike, workspaceId: string, threadId: string, phase: 'start' | 'end'): Promise<void>;
|
|
654
|
-
/** Per-workspace marker that a new thread was created, so an already-open
|
|
655
|
-
* history list prepends it without a reload. */
|
|
656
|
-
declare function broadcastThreadCreated(namespace: TurnStreamNamespaceLike, workspaceId: string, thread: {
|
|
657
|
-
threadId: string;
|
|
658
|
-
title: string;
|
|
659
|
-
}): Promise<void>;
|
|
660
|
-
/** Represent success or failure of a TURN stream upgrade authorization with optional response data */
|
|
661
|
-
type TurnStreamUpgradeAuthorization = {
|
|
662
|
-
ok: true;
|
|
663
|
-
} | {
|
|
664
|
-
ok: false;
|
|
665
|
-
response: Response;
|
|
666
|
-
};
|
|
667
|
-
/** Define options for creating a TURN stream upgrade handler including namespace, path, and authorization logic */
|
|
668
|
-
interface CreateTurnStreamUpgradeHandlerOptions {
|
|
669
|
-
namespace: TurnStreamNamespaceLike;
|
|
670
|
-
/** The worker route serving the stream. Default `/api/session-stream`. */
|
|
671
|
-
path?: string;
|
|
672
|
-
/** Viewer access check (session cookie → workspace membership). */
|
|
673
|
-
authorize(request: Request, target: {
|
|
674
|
-
workspaceId: string;
|
|
675
|
-
threadId: string | null;
|
|
676
|
-
}): Promise<TurnStreamUpgradeAuthorization>;
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* The worker-entry WebSocket forwarder. Call BEFORE the app router (a router
|
|
680
|
-
* loader cannot return a 101); returns `null` for requests that are not a
|
|
681
|
-
* WebSocket upgrade on the configured path.
|
|
682
|
-
*
|
|
683
|
-
* GET {path}?workspaceId=... → workspace channel (sidebar)
|
|
684
|
-
* GET {path}?workspaceId=...&threadId=… → thread channel (turn resume)
|
|
685
|
-
*
|
|
686
|
-
* After the 101, the client sends `{type:'sync', afterSeq}` and receives the
|
|
687
|
-
* replay-then-live stream (see {@link TurnStreamDO.webSocketMessage}).
|
|
688
|
-
*
|
|
689
|
-
* NOT deprecated — the workspace variant (no `threadId`) is the canonical
|
|
690
|
-
* transport for the per-workspace signals, which the session gateway cannot
|
|
691
|
-
* carry (it is per-session and read-only). The THREAD variant is the
|
|
692
|
-
* deprecated half: for a sandbox-backed interactive turn the tab should
|
|
693
|
-
* attach to the session gateway directly instead of to this socket. See
|
|
694
|
-
* {@link broadcastTurnStreamEvent} for the measurement and the replacement
|
|
695
|
-
* wiring.
|
|
696
|
-
*/
|
|
697
|
-
declare function createTurnStreamUpgradeHandler(options: CreateTurnStreamUpgradeHandlerOptions): (request: Request) => Promise<Response | null>;
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* In-process turn-stream harness: a fake namespace that routes `idFromName`
|
|
701
|
-
* to REAL {@link TurnStreamDO} instances over an in-memory storage/socket
|
|
702
|
-
* state. The adapters and the DO run their production code paths — only the
|
|
703
|
-
* Cloudflare runtime (isolation, hibernation, real sockets) is simulated.
|
|
704
|
-
*
|
|
705
|
-
* For vitest composition tests and keyless local dev (the same role
|
|
706
|
-
* `createMemoryTurnEventStore` plays for the D1 store). Not for production:
|
|
707
|
-
* state is per-process and evaporates on restart.
|
|
708
|
-
*/
|
|
709
|
-
|
|
710
|
-
/** A test-side viewer socket: records frames sent by the DO and lets the
|
|
711
|
-
* test drive the `sync` handshake. */
|
|
712
|
-
interface MemoryTurnStreamSocket extends TurnStreamSocket {
|
|
713
|
-
readonly frames: string[];
|
|
714
|
-
readonly closed: boolean;
|
|
715
|
-
}
|
|
716
|
-
/** Define an in-memory channel for streaming turn-based data with viewer socket connection support */
|
|
717
|
-
interface MemoryTurnStreamChannel {
|
|
718
|
-
/** Attach a viewer socket to this channel (bypasses the HTTP 101 — the
|
|
719
|
-
* upgrade handshake is Cloudflare-runtime-only) and run its `sync`. */
|
|
720
|
-
connect(input: {
|
|
721
|
-
sessionId: string;
|
|
722
|
-
scope: 'thread' | 'workspace';
|
|
723
|
-
afterSeq?: number;
|
|
724
|
-
}): Promise<MemoryTurnStreamSocket>;
|
|
725
|
-
readonly instance: TurnStreamDO;
|
|
726
|
-
}
|
|
727
|
-
/** Provide an interface to manage channels and namespaces for memory-based turn stream testing */
|
|
728
|
-
interface MemoryTurnStreamHarness {
|
|
729
|
-
namespace: TurnStreamNamespaceLike;
|
|
730
|
-
/** The channel (creating its DO instance if needed) for a channel key —
|
|
731
|
-
* e.g. `threadChannelKey(ws, thread)` — to connect test viewers. */
|
|
732
|
-
channel(name: string): MemoryTurnStreamChannel;
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* Build the harness. `createInstance` lets a product test run its own
|
|
736
|
-
* `TurnStreamDO` subclass through the same wiring.
|
|
2
|
+
* `/turn-stream` — shared durable turn replay/broadcast/lock on a Cloudflare
|
|
3
|
+
* Durable Object (issue #221): the graduation of `createChatTurnRoutes`'
|
|
4
|
+
* `turnStore` seam from "bring your own DO" to a real implementation, plus
|
|
5
|
+
* the dual-scope single-flight turn lock and the live-viewer WebSocket
|
|
6
|
+
* channel every fleet app was hand-rolling.
|
|
7
|
+
*
|
|
8
|
+
* Subpath-only and server-only (like `/chat-routes`): never re-exported from
|
|
9
|
+
* the root barrel, never reachable from a client bundle. Cloudflare is
|
|
10
|
+
* STRUCTURAL throughout — no `cloudflare:workers` import; a product binds
|
|
11
|
+
* the DO by re-exporting {@link TurnStreamDO} from its worker entry and
|
|
12
|
+
* declaring it in wrangler.
|
|
13
|
+
*
|
|
14
|
+
* Layout:
|
|
15
|
+
* ./core — pure segment/lock/wire logic (unit-testable)
|
|
16
|
+
* ./do — the DO transport shell + product extension seams
|
|
17
|
+
* ./adapters — turnStore + turnLock seam implementations, broadcast
|
|
18
|
+
* helpers, WS upgrade forwarder
|
|
19
|
+
* ./memory — in-process harness for tests and keyless local dev
|
|
20
|
+
*
|
|
21
|
+
* What stays product-side, on purpose: WHICH scope a turn locks on, the
|
|
22
|
+
* sandbox/session probes for stale-lock recovery, viewer authorization, and
|
|
23
|
+
* any post-turn machinery that defers a lock release (the DO's protected
|
|
24
|
+
* seams exist for exactly that).
|
|
25
|
+
*
|
|
26
|
+
* ── What is still the right answer here, and what is not ─────────────────
|
|
27
|
+
*
|
|
28
|
+
* A production A/B (4 arms, sandbox.tangle.tools, SDK 0.12.0) showed that a
|
|
29
|
+
* browser attached to the sandbox session gateway sees a turn only when the
|
|
30
|
+
* turn is driven on the session-MESSAGE lane
|
|
31
|
+
* (`box.session(id).sendMessage()` → 297 of 297 frames delivered), never on
|
|
32
|
+
* the run/stream lane (`box.streamPrompt()` → 0 of 71, 0 of 527, 0 of 408
|
|
33
|
+
* across three session-id strategies). `./core`'s header carries the full
|
|
34
|
+
* table.
|
|
35
|
+
*
|
|
36
|
+
* KEPT — no SDK primitive replaces these:
|
|
37
|
+
* • the dual-scope single-flight TURN LOCK (`createDurableTurnLock`,
|
|
38
|
+
* `reconcileStaleDurableTurnLock`) — the gateway is a read-only fanout
|
|
39
|
+
* and ships no admission control;
|
|
40
|
+
* • the per-workspace SIGNALS (`thread.created`, `thread.activity`, plus
|
|
41
|
+
* `productSyncEvents`) — the gateway is per-session;
|
|
42
|
+
* • the durable TURN-EVENT rows + running-turn index
|
|
43
|
+
* (`createDurableObjectTurnEventStore`) that `runDetachedTurn` streams
|
|
44
|
+
* into — a detached run (`dispatchPrompt({ detach: true })`,
|
|
45
|
+
* `driveTurn`) goes through `streamPrompt` internally, so it never
|
|
46
|
+
* reaches the gateway at all. Autonomous work a browser must tail has
|
|
47
|
+
* no other path today.
|
|
48
|
+
*
|
|
49
|
+
* DEPRECATED — duplicates the SDK:
|
|
50
|
+
* • the interactive per-turn REBROADCAST/replay on the thread channel
|
|
51
|
+
* (`broadcastTurnStreamEvent` + the segment functions in `./core`).
|
|
52
|
+
* Sandbox products: drive on the message lane and attach the tab with
|
|
53
|
+
* `box.mintScopedToken({ scope: 'session' })` + `SessionGatewayClient`;
|
|
54
|
+
* resume a worker-side read with
|
|
55
|
+
* `box.streamPrompt('', { executionId, lastEventId })`, which replays
|
|
56
|
+
* strictly after the cursor without re-dispatching.
|
|
57
|
+
*
|
|
58
|
+
* Nothing is removed: these are published exports and unknown consumers may
|
|
59
|
+
* hold them. Removal is a major-version change.
|
|
737
60
|
*/
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
export
|
|
61
|
+
export * from './core';
|
|
62
|
+
export * from './do';
|
|
63
|
+
export * from './adapters';
|
|
64
|
+
export * from './memory';
|