@tangle-network/agent-app 0.45.53 → 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 +5 -4
- 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,9 +1,3 @@
|
|
|
1
|
-
import { Part } from '@tangle-network/agent-interface';
|
|
2
|
-
import { C as ChatInteractionField, a as ChatInteractionStatus, I as InteractionAnswers, N as NoticeKind } from './contract-OxG_jVMx.js';
|
|
3
|
-
import { W as WorkProductPersistedPart } from './types-CCeYywdS.js';
|
|
4
|
-
import { ChatPlanPersistedPart } from './plans/index.js';
|
|
5
|
-
import { C as ChatMentionKind, a as ChatAttachmentKind, b as ChatAttachmentInput, F as FileMention } from './wire-DOZ-O6hD.js';
|
|
6
|
-
|
|
7
1
|
/**
|
|
8
2
|
* The stored shape of `message.parts` — one typed vocabulary for every part a
|
|
9
3
|
* product persists into a chat transcript. NOT an ad-hoc union reverse-
|
|
@@ -58,21 +52,26 @@ import { C as ChatMentionKind, a as ChatAttachmentKind, b as ChatAttachmentInput
|
|
|
58
52
|
* `/stream`'s `normalizeToolEvent`) and then persisted identically — the
|
|
59
53
|
* store never sees a router-specific shape.
|
|
60
54
|
*/
|
|
61
|
-
|
|
55
|
+
import type { Part as HarnessWirePart } from '@tangle-network/agent-interface';
|
|
56
|
+
import type { ChatInteractionField, ChatInteractionStatus, InteractionAnswers, NoticeKind } from '../web-react/chat-interactions';
|
|
57
|
+
import { type WorkProductPersistedPart } from '../work-product/types';
|
|
58
|
+
import { type ChatPlanPersistedPart } from '../plans/index';
|
|
59
|
+
import { type ChatAttachmentInput, type ChatAttachmentKind, type ChatMentionKind, type FileMention } from '../chat-routes/wire';
|
|
60
|
+
export type { ChatMentionKind, ChatAttachmentKind };
|
|
62
61
|
/** Start/end wall-clock millis, as normalized by `/stream`'s `normalizeTime`. */
|
|
63
|
-
interface ChatPartTime {
|
|
62
|
+
export interface ChatPartTime {
|
|
64
63
|
start?: number;
|
|
65
64
|
end?: number;
|
|
66
65
|
}
|
|
67
66
|
/** `id` is the harness's per-segment identity; absent on legacy/router parts,
|
|
68
67
|
* which collapse to a single logical text stream. Never invented client-side. */
|
|
69
|
-
interface ChatTextPart {
|
|
68
|
+
export interface ChatTextPart {
|
|
70
69
|
type: 'text';
|
|
71
70
|
text: string;
|
|
72
71
|
id?: string;
|
|
73
72
|
}
|
|
74
73
|
/** Define a reasoning part of a chat with text content and optional metadata fields */
|
|
75
|
-
interface ChatReasoningPart {
|
|
74
|
+
export interface ChatReasoningPart {
|
|
76
75
|
type: 'reasoning';
|
|
77
76
|
text: string;
|
|
78
77
|
id?: string;
|
|
@@ -81,9 +80,9 @@ interface ChatReasoningPart {
|
|
|
81
80
|
/** Superset of the sidecar's status enum (`pending|running|completed|failed`)
|
|
82
81
|
* and agent-interface's `ToolState` statuses; `error` is the persisted
|
|
83
82
|
* terminal form `/stream`'s `normalizePersistedPart` settles on. */
|
|
84
|
-
type ChatToolStatus = 'pending' | 'running' | 'completed' | 'error' | 'failed';
|
|
83
|
+
export type ChatToolStatus = 'pending' | 'running' | 'completed' | 'error' | 'failed';
|
|
85
84
|
/** Describe the current state and data of a chat tool including status, input, output, and metadata */
|
|
86
|
-
interface ChatToolState {
|
|
85
|
+
export interface ChatToolState {
|
|
87
86
|
status: ChatToolStatus;
|
|
88
87
|
input?: unknown;
|
|
89
88
|
output?: unknown;
|
|
@@ -93,7 +92,7 @@ interface ChatToolState {
|
|
|
93
92
|
time?: ChatPartTime;
|
|
94
93
|
}
|
|
95
94
|
/** Define a chat component representing a tool with its state and optional call identifier */
|
|
96
|
-
interface ChatToolPart {
|
|
95
|
+
export interface ChatToolPart {
|
|
97
96
|
type: 'tool';
|
|
98
97
|
id: string;
|
|
99
98
|
tool: string;
|
|
@@ -105,7 +104,7 @@ interface ChatToolPart {
|
|
|
105
104
|
* attachment-flavored display label an uploaded/promoted file carries (see
|
|
106
105
|
* {@link ChatAttachmentPart}) — absent on a harness-emitted file part, which
|
|
107
106
|
* uses `filename`. */
|
|
108
|
-
interface ChatFilePart {
|
|
107
|
+
export interface ChatFilePart {
|
|
109
108
|
type: 'file';
|
|
110
109
|
id?: string;
|
|
111
110
|
filename?: string;
|
|
@@ -116,7 +115,7 @@ interface ChatFilePart {
|
|
|
116
115
|
content?: string;
|
|
117
116
|
}
|
|
118
117
|
/** Define properties for an image part within a chat message including optional metadata fields */
|
|
119
|
-
interface ChatImagePart {
|
|
118
|
+
export interface ChatImagePart {
|
|
120
119
|
type: 'image';
|
|
121
120
|
filename?: string;
|
|
122
121
|
name?: string;
|
|
@@ -125,7 +124,7 @@ interface ChatImagePart {
|
|
|
125
124
|
path?: string;
|
|
126
125
|
}
|
|
127
126
|
/** Define a subtask part of a chat with prompt, description, agent, and optional identifier */
|
|
128
|
-
interface ChatSubtaskPart {
|
|
127
|
+
export interface ChatSubtaskPart {
|
|
129
128
|
type: 'subtask';
|
|
130
129
|
prompt: string;
|
|
131
130
|
description: string;
|
|
@@ -134,13 +133,13 @@ interface ChatSubtaskPart {
|
|
|
134
133
|
}
|
|
135
134
|
/** OpenCode step-boundary marker — no renderable text; preserved so mappers
|
|
136
135
|
* never coerce it into a "[object Object]" text part. */
|
|
137
|
-
interface ChatStepStartPart {
|
|
136
|
+
export interface ChatStepStartPart {
|
|
138
137
|
type: 'step-start';
|
|
139
138
|
}
|
|
140
139
|
/** Per-step usage receipt as the harness reports it (sidecar
|
|
141
140
|
* `StepFinishPartSchema`). The message-level token/cost columns are this
|
|
142
141
|
* shape flattened. */
|
|
143
|
-
interface ChatUsageTokens {
|
|
142
|
+
export interface ChatUsageTokens {
|
|
144
143
|
total?: number;
|
|
145
144
|
input?: number;
|
|
146
145
|
output?: number;
|
|
@@ -151,7 +150,7 @@ interface ChatUsageTokens {
|
|
|
151
150
|
};
|
|
152
151
|
}
|
|
153
152
|
/** Define a chat step finish part indicating completion with optional reason, tokens, and cost */
|
|
154
|
-
interface ChatStepFinishPart {
|
|
153
|
+
export interface ChatStepFinishPart {
|
|
155
154
|
type: 'step-finish';
|
|
156
155
|
reason?: string;
|
|
157
156
|
tokens?: ChatUsageTokens;
|
|
@@ -159,7 +158,7 @@ interface ChatStepFinishPart {
|
|
|
159
158
|
}
|
|
160
159
|
/** Persisted human-in-the-loop ask — byte-matches
|
|
161
160
|
* `interactionToPersistedPart` in `/web-react`'s chat-interactions contract. */
|
|
162
|
-
interface ChatInteractionPart {
|
|
161
|
+
export interface ChatInteractionPart {
|
|
163
162
|
type: 'interaction';
|
|
164
163
|
id: string;
|
|
165
164
|
kind: string;
|
|
@@ -173,15 +172,15 @@ interface ChatInteractionPart {
|
|
|
173
172
|
cancelReason?: string;
|
|
174
173
|
}
|
|
175
174
|
/** Resolve a chat plan part by aliasing it to the persisted chat plan part type */
|
|
176
|
-
type ChatPlanPart = ChatPlanPersistedPart;
|
|
175
|
+
export type ChatPlanPart = ChatPlanPersistedPart;
|
|
177
176
|
/** Persisted work-product anchor card — byte-matches
|
|
178
177
|
* `workProductToPersistedPart` in `/work-product`'s contract. Written by the
|
|
179
178
|
* PLATFORM on the ready transition (and updated on a verdict); never
|
|
180
179
|
* authored by a prompt. */
|
|
181
|
-
type ChatWorkProductPart = WorkProductPersistedPart;
|
|
180
|
+
export type ChatWorkProductPart = WorkProductPersistedPart;
|
|
182
181
|
/** Persisted one-line transcript notice — byte-matches `noticePart` in
|
|
183
182
|
* `/web-react`'s chat-interactions contract. */
|
|
184
|
-
interface ChatNoticePart {
|
|
183
|
+
export interface ChatNoticePart {
|
|
185
184
|
type: 'notice';
|
|
186
185
|
id: string;
|
|
187
186
|
noticeKind: NoticeKind;
|
|
@@ -199,7 +198,7 @@ interface ChatNoticePart {
|
|
|
199
198
|
* part. `turnId` is optional and set by products that rebuild a turn's
|
|
200
199
|
* mentions on retry.
|
|
201
200
|
*/
|
|
202
|
-
interface ChatMentionPart {
|
|
201
|
+
export interface ChatMentionPart {
|
|
203
202
|
type: 'mention';
|
|
204
203
|
mentionKind: ChatMentionKind;
|
|
205
204
|
path: string;
|
|
@@ -208,11 +207,11 @@ interface ChatMentionPart {
|
|
|
208
207
|
turnId?: string;
|
|
209
208
|
}
|
|
210
209
|
/** Represent parts of a chat message including text, reasoning, tools, files, images, subtasks, steps, interactions, notices, plans, and mentions */
|
|
211
|
-
type ChatMessagePart = ChatTextPart | ChatReasoningPart | ChatToolPart | ChatFilePart | ChatImagePart | ChatSubtaskPart | ChatStepStartPart | ChatStepFinishPart | ChatInteractionPart | ChatNoticePart | ChatPlanPart | ChatWorkProductPart | ChatMentionPart;
|
|
210
|
+
export type ChatMessagePart = ChatTextPart | ChatReasoningPart | ChatToolPart | ChatFilePart | ChatImagePart | ChatSubtaskPart | ChatStepStartPart | ChatStepFinishPart | ChatInteractionPart | ChatNoticePart | ChatPlanPart | ChatWorkProductPart | ChatMentionPart;
|
|
212
211
|
/** Every canonical harness wire-part kind must be storable — compile-time
|
|
213
212
|
* guarantee that a new agent-interface part kind cannot silently fall out of
|
|
214
213
|
* the persisted vocabulary. */
|
|
215
|
-
type StorableHarnessPartKind =
|
|
214
|
+
export type StorableHarnessPartKind = HarnessWirePart['type'] & ChatMessagePart['type'];
|
|
216
215
|
/**
|
|
217
216
|
* The typed projection at the `/stream` → `/chat-store` boundary. The stream
|
|
218
217
|
* normalizers (`normalizePersistedPart`/`mergePersistedPart`/
|
|
@@ -223,19 +222,19 @@ type StorableHarnessPartKind = Part['type'] & ChatMessagePart['type'];
|
|
|
223
222
|
* dropped, and — enforced by the exhaustiveness check below — no storable
|
|
224
223
|
* kind can silently fall out (the step-finish/interaction trap).
|
|
225
224
|
*/
|
|
226
|
-
declare function toChatMessageParts(parts: Array<Record<string, unknown>>): ChatMessagePart[];
|
|
225
|
+
export declare function toChatMessageParts(parts: Array<Record<string, unknown>>): ChatMessagePart[];
|
|
227
226
|
/** Resolve whether a ChatMessagePart is specifically a ChatToolPart based on its type property */
|
|
228
|
-
declare function isChatToolPart(part: ChatMessagePart): part is ChatToolPart;
|
|
227
|
+
export declare function isChatToolPart(part: ChatMessagePart): part is ChatToolPart;
|
|
229
228
|
/** Resolve whether a chat message part is a text part based on its type property */
|
|
230
|
-
declare function isChatTextPart(part: ChatMessagePart): part is ChatTextPart;
|
|
229
|
+
export declare function isChatTextPart(part: ChatMessagePart): part is ChatTextPart;
|
|
231
230
|
/** Resolve whether a ChatMessagePart is a ChatInteractionPart based on its type property */
|
|
232
|
-
declare function isChatInteractionPart(part: ChatMessagePart): part is ChatInteractionPart;
|
|
231
|
+
export declare function isChatInteractionPart(part: ChatMessagePart): part is ChatInteractionPart;
|
|
233
232
|
/** Resolve whether a chat message part is a persisted chat plan part */
|
|
234
|
-
declare function isChatPlanPart(part: ChatMessagePart): part is ChatPlanPart;
|
|
233
|
+
export declare function isChatPlanPart(part: ChatMessagePart): part is ChatPlanPart;
|
|
235
234
|
/** Resolve whether a chat message part is a persisted work-product anchor */
|
|
236
|
-
declare function isChatWorkProductPart(part: ChatMessagePart): part is ChatWorkProductPart;
|
|
235
|
+
export declare function isChatWorkProductPart(part: ChatMessagePart): part is ChatWorkProductPart;
|
|
237
236
|
/** Determine if a chat message part represents the completion of a chat step */
|
|
238
|
-
declare function isChatStepFinishPart(part: ChatMessagePart): part is ChatStepFinishPart;
|
|
237
|
+
export declare function isChatStepFinishPart(part: ChatMessagePart): part is ChatStepFinishPart;
|
|
239
238
|
/** Widened to `unknown` — unlike its siblings this guard also runs over raw
|
|
240
239
|
* untyped stored rows (a transcript renderer reads `message.parts` before the
|
|
241
240
|
* typed projection), which is exactly what {@link mentionPartsFromMessageParts}
|
|
@@ -248,21 +247,26 @@ declare function isChatStepFinishPart(part: ChatMessagePart): part is ChatStepFi
|
|
|
248
247
|
* type it does not have. Negative sizes are NOT re-rejected: the wire screens
|
|
249
248
|
* them, `mentionInputToPart` trusts its input, and a read guard stricter than
|
|
250
249
|
* what the writer can emit would drop rows it produced itself. */
|
|
251
|
-
declare function isChatMentionPart(part: unknown): part is ChatMentionPart;
|
|
250
|
+
export declare function isChatMentionPart(part: unknown): part is ChatMentionPart;
|
|
252
251
|
/** Every mention part on one message, in stored order. The projection a
|
|
253
252
|
* transcript renderer runs before deciding which mentions the message text
|
|
254
253
|
* already shows inline (see `segmentMentionContent` in `/web-react`). */
|
|
255
|
-
declare function mentionPartsFromMessageParts(parts: ReadonlyArray<Record<string, unknown>> | ReadonlyArray<ChatMessagePart> | null | undefined): ChatMentionPart[];
|
|
254
|
+
export declare function mentionPartsFromMessageParts(parts: ReadonlyArray<Record<string, unknown>> | ReadonlyArray<ChatMessagePart> | null | undefined): ChatMentionPart[];
|
|
256
255
|
/** A validated wire mention (`parseFileMentions` in `/chat-routes`) as the
|
|
257
256
|
* part the turn route persists. An absent/non-finite `size` is DROPPED rather
|
|
258
257
|
* than stored as `undefined`, so a stored row never carries a key that means
|
|
259
258
|
* nothing. */
|
|
260
|
-
declare function mentionInputToPart(input: FileMention): ChatMentionPart;
|
|
259
|
+
export declare function mentionInputToPart(input: FileMention): ChatMentionPart;
|
|
261
260
|
/** `image` for any `image/*` mime, `file` for everything else (including an
|
|
262
261
|
* absent/empty mime) — the same split the composer and the persisted-part
|
|
263
262
|
* discriminant both key on. */
|
|
264
|
-
declare function attachmentKindForMime(mime?: string): ChatAttachmentKind;
|
|
265
|
-
|
|
263
|
+
export declare function attachmentKindForMime(mime?: string): ChatAttachmentKind;
|
|
264
|
+
/** Stream/transcript part key for an attachment — ONE declaration, owned by
|
|
265
|
+
* `/stream`'s normalizer (whose `getPartKey` routes path-bearing file/image
|
|
266
|
+
* parts through it). Re-exported here (not redefined) so the root barrel's
|
|
267
|
+
* star-exports of both modules resolve to the same symbol instead of
|
|
268
|
+
* colliding (TS2308 in the dts build). */
|
|
269
|
+
export { attachmentPartKey } from '../stream/stream-normalizer';
|
|
266
270
|
/**
|
|
267
271
|
* Persisted attachment part: structurally an attachment-flavored `ChatFilePart`
|
|
268
272
|
* / `ChatImagePart` (`path` + `name` promoted to required) rather than a
|
|
@@ -271,7 +275,7 @@ declare function attachmentKindForMime(mime?: string): ChatAttachmentKind;
|
|
|
271
275
|
* arrays every other stored part rides in, and lets the `type`-driven
|
|
272
276
|
* constructors below build it without union-discriminant gymnastics.
|
|
273
277
|
*/
|
|
274
|
-
interface ChatAttachmentPart {
|
|
278
|
+
export interface ChatAttachmentPart {
|
|
275
279
|
type: ChatAttachmentKind;
|
|
276
280
|
path: string;
|
|
277
281
|
name: string;
|
|
@@ -290,16 +294,16 @@ interface ChatAttachmentPart {
|
|
|
290
294
|
* would otherwise render a malformed `(vault: )` pointer line — justifies the
|
|
291
295
|
* small divergence from byte-for-byte gtm parity here; no legitimate write
|
|
292
296
|
* path ever produces an empty `path`. */
|
|
293
|
-
declare function isChatAttachmentPart(part: unknown): part is ChatAttachmentPart;
|
|
297
|
+
export declare function isChatAttachmentPart(part: unknown): part is ChatAttachmentPart;
|
|
294
298
|
/** Drop absent/empty optional fields rather than persisting `undefined`/`''`
|
|
295
299
|
* — keeps stored parts minimal. */
|
|
296
|
-
declare function attachmentInputToPart(input: ChatAttachmentInput): ChatAttachmentPart;
|
|
300
|
+
export declare function attachmentInputToPart(input: ChatAttachmentInput): ChatAttachmentPart;
|
|
297
301
|
/** Every attachment part on one message's stored `parts`, in stored order. */
|
|
298
|
-
declare function attachmentPartsFromMessageParts(parts: ReadonlyArray<Record<string, unknown>> | null | undefined): ChatAttachmentPart[];
|
|
302
|
+
export declare function attachmentPartsFromMessageParts(parts: ReadonlyArray<Record<string, unknown>> | null | undefined): ChatAttachmentPart[];
|
|
299
303
|
/** gtm's exact default header for {@link buildAttachmentPromptBlock} — kept
|
|
300
304
|
* byte-identical because it feeds dispatched prompts (gtm-agent#618
|
|
301
305
|
* reproduces the prompt bytes through this module). Override only with intent. */
|
|
302
|
-
declare const DEFAULT_ATTACHMENT_PROMPT_HEADER = "Attached files (already saved to the workspace vault \u2014 read them from these paths):";
|
|
306
|
+
export declare const DEFAULT_ATTACHMENT_PROMPT_HEADER = "Attached files (already saved to the workspace vault \u2014 read them from these paths):";
|
|
303
307
|
/**
|
|
304
308
|
* The agent-facing pointer block appended to the dispatched prompt — never
|
|
305
309
|
* persisted in `message.content`. Empty array → `''` so callers can append
|
|
@@ -318,7 +322,7 @@ declare const DEFAULT_ATTACHMENT_PROMPT_HEADER = "Attached files (already saved
|
|
|
318
322
|
* The wire-side validator is the primary control; this is the backstop for
|
|
319
323
|
* rows it never saw.
|
|
320
324
|
*/
|
|
321
|
-
declare function buildAttachmentPromptBlock(atts: ReadonlyArray<Pick<ChatAttachmentPart, 'name' | 'path'>>, header?: string): string;
|
|
325
|
+
export declare function buildAttachmentPromptBlock(atts: ReadonlyArray<Pick<ChatAttachmentPart, 'name' | 'path'>>, header?: string): string;
|
|
322
326
|
/**
|
|
323
327
|
* History projection for a persisted message: `content` unchanged when it
|
|
324
328
|
* carries no attachment parts, else the block is appended once. The
|
|
@@ -331,9 +335,7 @@ declare function buildAttachmentPromptBlock(atts: ReadonlyArray<Pick<ChatAttachm
|
|
|
331
335
|
* contain the block's bytes, alongside attachment parts, still gets the block
|
|
332
336
|
* appended a second time. See the pinned test for that boundary.
|
|
333
337
|
*/
|
|
334
|
-
declare function historyContentWithAttachments(message: {
|
|
338
|
+
export declare function historyContentWithAttachments(message: {
|
|
335
339
|
content: string;
|
|
336
340
|
parts?: ReadonlyArray<Record<string, unknown>> | null;
|
|
337
341
|
}, header?: string): string;
|
|
338
|
-
|
|
339
|
-
export { isChatPlanPart as A, isChatStepFinishPart as B, type ChatMessagePart as C, DEFAULT_ATTACHMENT_PROMPT_HEADER as D, isChatTextPart as E, isChatToolPart as F, isChatWorkProductPart as G, mentionInputToPart as H, mentionPartsFromMessageParts as I, toChatMessageParts as J, type StorableHarnessPartKind as S, type ChatAttachmentPart as a, type ChatFilePart as b, type ChatImagePart as c, type ChatInteractionPart as d, type ChatMentionPart as e, type ChatNoticePart as f, type ChatPartTime as g, type ChatPlanPart as h, type ChatReasoningPart as i, type ChatStepFinishPart as j, type ChatStepStartPart as k, type ChatSubtaskPart as l, type ChatTextPart as m, type ChatToolPart as n, type ChatToolState as o, type ChatToolStatus as p, type ChatUsageTokens as q, type ChatWorkProductPart as r, attachmentInputToPart as s, attachmentKindForMime as t, attachmentPartsFromMessageParts as u, buildAttachmentPromptBlock as v, historyContentWithAttachments as w, isChatAttachmentPart as x, isChatInteractionPart as y, isChatMentionPart as z };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drizzle schema factory for the chat thread/message tables — the same
|
|
3
|
+
* injection pattern as `createTeamTables`: the product owns the workspace
|
|
4
|
+
* table; the factory wires the thread FK into it so the whole graph lives in
|
|
5
|
+
* one drizzle schema with real cascade semantics. Column names, types,
|
|
6
|
+
* defaults, enums, and indexes mirror legal's and gtm's hand-rolled `thread`/
|
|
7
|
+
* `message` tables so a product with those tables adopts the factory without
|
|
8
|
+
* rewriting rows; `tablePrefix` covers products that namespace (tax's
|
|
9
|
+
* `chat_messages` style).
|
|
10
|
+
*
|
|
11
|
+
* The core is the superset the three products agree on. Divergences dropped,
|
|
12
|
+
* and why:
|
|
13
|
+
* - `thread.status` ('active'|'archived', legal+gtm) — archive semantics
|
|
14
|
+
* diverge (tax uses `archivedAt`); product-domain lifecycle → extra column.
|
|
15
|
+
* - `thread.scopeKind`/`scopeKey`/`harness` (gtm) — artifact anchoring and
|
|
16
|
+
* harness pinning are product-domain → extra columns.
|
|
17
|
+
* - tax's `tax_sessions` session columns (`taxYear`, `projectRef`,
|
|
18
|
+
* `agentSessionId`, `agentRuntime`, `agentHarness`, `profile`, `error`,
|
|
19
|
+
* `userId`) — sandbox-session state, not chat state → extra columns.
|
|
20
|
+
* - `message.toolInput`/`toolOutput` (legal+gtm) — duplicate of the tool
|
|
21
|
+
* part's `state.input`/`state.output` inside `parts` (the shape `/stream`'s
|
|
22
|
+
* `normalizePersistedPart` owns); keeping both invites drift.
|
|
23
|
+
* - `message.vaultFiles` (legal+gtm) — vault is product-domain → extra column.
|
|
24
|
+
* - tax's re-declared `turn_events`/`turn_status` DDL — deliberately NOT here;
|
|
25
|
+
* `/stream`'s turn-buffer owns that DDL (`TURN_BUFFER_D1_SCHEMA_SQL`).
|
|
26
|
+
*
|
|
27
|
+
* Kept beyond the intersection: tax's per-message `model`/`inputTokens`/
|
|
28
|
+
* `outputTokens`, extended to the full usage receipt the harness actually
|
|
29
|
+
* reports in `step-finish` parts (`tokens {input, output, reasoning,
|
|
30
|
+
* cache{read, write}}` + `cost`) — see `./parts`.
|
|
31
|
+
*
|
|
32
|
+
* `threadExtraColumns`/`messageExtraColumns` merge product columns into the
|
|
33
|
+
* table definitions (the `/missions` opaque-extras pattern: the store writes
|
|
34
|
+
* `extras` values verbatim in the SAME insert statement and never reads,
|
|
35
|
+
* validates, or defaults them).
|
|
36
|
+
*
|
|
37
|
+
* SERVER-side module (D1/libsql/better-sqlite3 behind a worker or server
|
|
38
|
+
* route) — but free of `node:` builtins on purpose: D1 workers have none.
|
|
39
|
+
*/
|
|
40
|
+
import type { AnySQLiteColumn, AnySQLiteTable, SQLiteColumnBuilderBase, SQLiteTableExtraConfigValue } from 'drizzle-orm/sqlite-core';
|
|
41
|
+
import type { ChatMessagePart } from './parts';
|
|
42
|
+
/** A product table referenced by FK — only the `id` column is touched. */
|
|
43
|
+
export type ChatParentTable = AnySQLiteTable & {
|
|
44
|
+
id: AnySQLiteColumn;
|
|
45
|
+
};
|
|
46
|
+
/** Define options to customize chat thread and message table creation including workspace and naming prefixes */
|
|
47
|
+
export interface CreateChatTablesOptions<TThreadExtras extends Record<string, SQLiteColumnBuilderBase> = {}, TMessageExtras extends Record<string, SQLiteColumnBuilderBase> = {}> {
|
|
48
|
+
/** The product's workspace table — threads reference `workspaceTable.id`
|
|
49
|
+
* with cascade. Omitted: `workspace_id` stays a plain indexed text column
|
|
50
|
+
* (products whose tenant table lives in another database). */
|
|
51
|
+
workspaceTable?: ChatParentTable;
|
|
52
|
+
/** Prefixes table AND index names (`'chat_'` → `chat_thread`,
|
|
53
|
+
* `idx_chat_thread_workspace`) for products that namespace chat tables in a
|
|
54
|
+
* shared database. Default: unprefixed `thread`/`message` (legal/gtm row
|
|
55
|
+
* compatibility). */
|
|
56
|
+
tablePrefix?: string;
|
|
57
|
+
/** Product columns merged into the thread table (the `/missions` extras
|
|
58
|
+
* pattern) — e.g. a `status` lifecycle enum or gtm's scope columns. */
|
|
59
|
+
threadExtraColumns?: TThreadExtras;
|
|
60
|
+
/** Product columns merged into the message table — e.g. legal's
|
|
61
|
+
* `vault_files`. */
|
|
62
|
+
messageExtraColumns?: TMessageExtras;
|
|
63
|
+
/**
|
|
64
|
+
* Product indexes appended to the thread table's own, given the built
|
|
65
|
+
* columns (extras included) so a product can index what it added.
|
|
66
|
+
*
|
|
67
|
+
* Names are used VERBATIM — `tablePrefix` is not applied — because these
|
|
68
|
+
* have to byte-match indexes the product's migrations already created.
|
|
69
|
+
*
|
|
70
|
+
* Without this a product with one extra index cannot adopt the factory at
|
|
71
|
+
* all: it keeps a hand-rolled duplicate of the same physical table, and the
|
|
72
|
+
* two drift on the next factory change.
|
|
73
|
+
*/
|
|
74
|
+
threadExtraIndexes?: ChatExtraIndexes;
|
|
75
|
+
/** Product indexes appended to the message table's own. Same rules as
|
|
76
|
+
* `threadExtraIndexes`. */
|
|
77
|
+
messageExtraIndexes?: ChatExtraIndexes;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Builds product indexes from a table's columns.
|
|
81
|
+
*
|
|
82
|
+
* The column map is passed untyped because its shape depends on the product's
|
|
83
|
+
* own extras; the RETURN is drizzle's own extra-config type, so the spread
|
|
84
|
+
* below stays inside the union `sqliteTable` expects and the built table keeps
|
|
85
|
+
* its inferred column types. Returning `unknown[]` here would force a cast on
|
|
86
|
+
* the config array, which widens every column to the cross-dialect union and
|
|
87
|
+
* breaks `db.select()` at every call site.
|
|
88
|
+
*/
|
|
89
|
+
export type ChatExtraIndexes = (columns: Record<string, AnySQLiteColumn>) => SQLiteTableExtraConfigValue[];
|
|
90
|
+
/** Build chat-related SQLite tables with customizable thread and message columns */
|
|
91
|
+
export declare function createChatTables<TThreadExtras extends Record<string, SQLiteColumnBuilderBase> = {}, TMessageExtras extends Record<string, SQLiteColumnBuilderBase> = {}>(options?: CreateChatTablesOptions<TThreadExtras, TMessageExtras>): {
|
|
92
|
+
threads: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
93
|
+
name: `${string}thread`;
|
|
94
|
+
schema: undefined;
|
|
95
|
+
columns: {
|
|
96
|
+
id: import("drizzle-orm").HasDefault<import("drizzle-orm").IsPrimaryKey<import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>>;
|
|
97
|
+
workspaceId: import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"workspace_id", [string, ...string[]], number | undefined>>;
|
|
98
|
+
title: import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"title", [string, ...string[]], number | undefined>>;
|
|
99
|
+
category: import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"category", [string, ...string[]], number | undefined>;
|
|
100
|
+
isPinned: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteBooleanBuilderInitial<"is_pinned">>>;
|
|
101
|
+
createdAt: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteTimestampBuilderInitial<"created_at">>>;
|
|
102
|
+
updatedAt: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteTimestampBuilderInitial<"updated_at">>>;
|
|
103
|
+
} & TThreadExtras extends infer T extends Record<string, import("drizzle-orm").ColumnBuilderBase<import("drizzle-orm").ColumnBuilderBaseConfig<import("drizzle-orm").ColumnDataType, string>, object>> ? { [Key in keyof T]: import("drizzle-orm").BuildColumn<TTableName, {
|
|
104
|
+
_: Omit<T[Key]["_"], "name"> & {
|
|
105
|
+
name: T[Key]["_"]["name"] extends "" ? import("drizzle-orm").Assume<Key, string> : T[Key]["_"]["name"];
|
|
106
|
+
};
|
|
107
|
+
}, TDialect>; } : never;
|
|
108
|
+
dialect: "sqlite";
|
|
109
|
+
}>;
|
|
110
|
+
messages: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
111
|
+
name: `${string}message`;
|
|
112
|
+
schema: undefined;
|
|
113
|
+
columns: {
|
|
114
|
+
id: import("drizzle-orm").HasDefault<import("drizzle-orm").IsPrimaryKey<import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>>;
|
|
115
|
+
threadId: import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"thread_id", [string, ...string[]], number | undefined>>;
|
|
116
|
+
role: import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"role", ["user", "assistant", "system", "tool"], number | undefined>>;
|
|
117
|
+
content: import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"content", [string, ...string[]], number | undefined>>;
|
|
118
|
+
parts: import("drizzle-orm").HasDefault<import("drizzle-orm").$Type<import("drizzle-orm/sqlite-core").SQLiteTextJsonBuilderInitial<"parts">, ChatMessagePart[]>>;
|
|
119
|
+
toolName: import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"tool_name", [string, ...string[]], number | undefined>;
|
|
120
|
+
model: import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"model", [string, ...string[]], number | undefined>;
|
|
121
|
+
requestedModel: import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"requested_model", [string, ...string[]], number | undefined>;
|
|
122
|
+
servedModel: import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"served_model", [string, ...string[]], number | undefined>;
|
|
123
|
+
servedProvider: import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"served_provider", [string, ...string[]], number | undefined>;
|
|
124
|
+
servedSource: import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"served_model_source", [string, ...string[]], number | undefined>;
|
|
125
|
+
inputTokens: import("drizzle-orm/sqlite-core").SQLiteIntegerBuilderInitial<"input_tokens">;
|
|
126
|
+
outputTokens: import("drizzle-orm/sqlite-core").SQLiteIntegerBuilderInitial<"output_tokens">;
|
|
127
|
+
reasoningTokens: import("drizzle-orm/sqlite-core").SQLiteIntegerBuilderInitial<"reasoning_tokens">;
|
|
128
|
+
cacheReadTokens: import("drizzle-orm/sqlite-core").SQLiteIntegerBuilderInitial<"cache_read_tokens">;
|
|
129
|
+
cacheWriteTokens: import("drizzle-orm/sqlite-core").SQLiteIntegerBuilderInitial<"cache_write_tokens">;
|
|
130
|
+
costUsd: import("drizzle-orm/sqlite-core").SQLiteRealBuilderInitial<"cost_usd">;
|
|
131
|
+
createdAt: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteTimestampBuilderInitial<"created_at">>>;
|
|
132
|
+
} & TMessageExtras extends infer T_1 extends Record<string, import("drizzle-orm").ColumnBuilderBase<import("drizzle-orm").ColumnBuilderBaseConfig<import("drizzle-orm").ColumnDataType, string>, object>> ? { [Key_1 in keyof T_1]: import("drizzle-orm").BuildColumn<TTableName, {
|
|
133
|
+
_: Omit<T_1[Key_1]["_"], "name"> & {
|
|
134
|
+
name: T_1[Key_1]["_"]["name"] extends "" ? import("drizzle-orm").Assume<Key_1, string> : T_1[Key_1]["_"]["name"];
|
|
135
|
+
};
|
|
136
|
+
}, TDialect>; } : never;
|
|
137
|
+
dialect: "sqlite";
|
|
138
|
+
}>;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* The base (no-extras) table pair, pinned via an instantiation expression:
|
|
142
|
+
* `ReturnType<typeof createChatTables>` on the bare generic substitutes the
|
|
143
|
+
* extras params with their CONSTRAINT (`Record<string,
|
|
144
|
+
* SQLiteColumnBuilderBase>`), stamping an index signature into the column map
|
|
145
|
+
* that widens every concrete column to `unknown`/`notNull: false` — concrete
|
|
146
|
+
* factory results then fail `extends ChatTables`. (`teams`' `createTeamTables`
|
|
147
|
+
* is non-generic, so its plain `ReturnType` never hits this.)
|
|
148
|
+
*/
|
|
149
|
+
export type ChatTables = ReturnType<typeof createChatTables<{}, {}>>;
|
|
150
|
+
/** Resolve the selected fields of a chat thread row from the chat threads table */
|
|
151
|
+
export type ChatThreadRow = ChatTables['threads']['$inferSelect'];
|
|
152
|
+
/** Resolve the selected structure of a chat message row from the messages table */
|
|
153
|
+
export type ChatMessageRow = ChatTables['messages']['$inferSelect'];
|
|
154
|
+
/** Resolve the type for inserting a new chat thread row into the threads table */
|
|
155
|
+
export type NewChatThreadRow = ChatTables['threads']['$inferInsert'];
|
|
156
|
+
/** Resolve the type for inserting a new chat message row into the messages table */
|
|
157
|
+
export type NewChatMessageRow = ChatTables['messages']['$inferInsert'];
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed CRUD over the tables from `createChatTables`. Works against any
|
|
3
|
+
* SQLite drizzle driver (D1, libsql, better-sqlite3) — builders are awaited,
|
|
4
|
+
* never `.run()`/`.all()`, so sync and async drivers behave identically.
|
|
5
|
+
*
|
|
6
|
+
* Access control is an injected seam, never an import: single-thread routes
|
|
7
|
+
* check workspace access themselves (they know the thread), while
|
|
8
|
+
* `bulkDeleteThreads` REQUIRES an `assertAccess` callback because one request
|
|
9
|
+
* can span workspaces — it is called once per distinct workspace and any
|
|
10
|
+
* throw rejects the whole request before a single delete runs (fail-closed;
|
|
11
|
+
* legal's bulk-delete semantics).
|
|
12
|
+
*
|
|
13
|
+
* Deletes run messages-first in ONE `db.batch` round trip when the driver has
|
|
14
|
+
* one (D1, libsql), so a partial failure never leaves orphaned rows behind a
|
|
15
|
+
* deleted thread; drivers without `batch` (better-sqlite3) fall back to
|
|
16
|
+
* sequential awaits in the same order.
|
|
17
|
+
*/
|
|
18
|
+
import { type SQL } from 'drizzle-orm';
|
|
19
|
+
import type { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
|
|
20
|
+
import { type SqliteBatchDatabase } from '../store';
|
|
21
|
+
import type { ChatMessagePart } from './parts';
|
|
22
|
+
import type { ChatMessageRow, ChatTables, ChatThreadRow } from './schema';
|
|
23
|
+
/** Any SQLite drizzle database — `any` erases the driver-specific run-result
|
|
24
|
+
* and schema generics so better-sqlite3, D1, and libsql handles all fit.
|
|
25
|
+
* `batch` is structural: present on D1/libsql drizzle instances. */
|
|
26
|
+
export type ChatDatabase = BaseSQLiteDatabase<'sync' | 'async', any, any> & SqliteBatchDatabase;
|
|
27
|
+
/** Product-injected access check. Throw to deny; the store never interprets
|
|
28
|
+
* users or roles itself. */
|
|
29
|
+
export type WorkspaceAccessCheck = (workspaceId: string) => void | Promise<void>;
|
|
30
|
+
/** Define input parameters for listing threads within a workspace with pagination options */
|
|
31
|
+
export interface ListThreadsInput {
|
|
32
|
+
workspaceId: string;
|
|
33
|
+
/** Clamped to 1..200; default 50 (legal's list route semantics). */
|
|
34
|
+
limit?: number;
|
|
35
|
+
/** Clamped to >= 0; default 0. */
|
|
36
|
+
offset?: number;
|
|
37
|
+
}
|
|
38
|
+
/** Represent a paginated collection of chat threads with total count and pagination details */
|
|
39
|
+
export interface ListThreadsResult<TThread = ChatThreadRow> {
|
|
40
|
+
threads: TThread[];
|
|
41
|
+
total: number;
|
|
42
|
+
limit: number;
|
|
43
|
+
offset: number;
|
|
44
|
+
}
|
|
45
|
+
/** Define input parameters required to create a new thread in a workspace */
|
|
46
|
+
export interface CreateThreadInput {
|
|
47
|
+
workspaceId: string;
|
|
48
|
+
/** Title source when `title` is absent: first non-empty line, 80-char cap
|
|
49
|
+
* (`threadTitleFromMessage`). */
|
|
50
|
+
firstMessage?: string;
|
|
51
|
+
/** Explicit title; still normalized through `threadTitleFromMessage` so a
|
|
52
|
+
* multi-page paste never becomes a sidebar entry. */
|
|
53
|
+
title?: string;
|
|
54
|
+
category?: string | null;
|
|
55
|
+
isPinned?: boolean;
|
|
56
|
+
/** Opaque product-column values written verbatim in the SAME insert (the
|
|
57
|
+
* `/missions` extras pattern). Never read, validated, or defaulted here. */
|
|
58
|
+
extras?: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
/** Define input parameters for appending a message to a chat thread with optional metadata */
|
|
61
|
+
export interface AppendMessageInput {
|
|
62
|
+
/** Caller-assigned primary key. Omitted, the column default assigns a random
|
|
63
|
+
* hex id (today's behavior). Incremental assistant persistence passes a
|
|
64
|
+
* DETERMINISTIC id derived from the turn's own identity, so a re-entered
|
|
65
|
+
* turn (crashed worker, durable-driver retry) finds and updates the row a
|
|
66
|
+
* previous attempt started instead of inserting a second one. */
|
|
67
|
+
id?: string;
|
|
68
|
+
threadId: string;
|
|
69
|
+
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
70
|
+
content: string;
|
|
71
|
+
parts?: ChatMessagePart[];
|
|
72
|
+
toolName?: string | null;
|
|
73
|
+
model?: string | null;
|
|
74
|
+
requestedModel?: string | null;
|
|
75
|
+
servedModel?: string | null;
|
|
76
|
+
servedProvider?: string | null;
|
|
77
|
+
servedSource?: string | null;
|
|
78
|
+
inputTokens?: number | null;
|
|
79
|
+
outputTokens?: number | null;
|
|
80
|
+
reasoningTokens?: number | null;
|
|
81
|
+
cacheReadTokens?: number | null;
|
|
82
|
+
cacheWriteTokens?: number | null;
|
|
83
|
+
costUsd?: number | null;
|
|
84
|
+
/** Opaque product-column values written verbatim in the SAME insert. */
|
|
85
|
+
extras?: Record<string, unknown>;
|
|
86
|
+
}
|
|
87
|
+
/** Fields an existing message row may be patched with. Every field is
|
|
88
|
+
* optional and only DEFINED fields are written, so a partial patch never
|
|
89
|
+
* clears a column it does not mention. `threadId` and `role` are absent on
|
|
90
|
+
* purpose: a message never moves thread or changes speaker.
|
|
91
|
+
*
|
|
92
|
+
* Exists for incremental assistant persistence — the streaming turn writes
|
|
93
|
+
* the row once and then patches it as content accumulates, so the durable
|
|
94
|
+
* transcript is at most one cadence interval behind the live stream. */
|
|
95
|
+
export interface UpdateMessageInput {
|
|
96
|
+
content?: string;
|
|
97
|
+
parts?: ChatMessagePart[];
|
|
98
|
+
toolName?: string | null;
|
|
99
|
+
model?: string | null;
|
|
100
|
+
requestedModel?: string | null;
|
|
101
|
+
servedModel?: string | null;
|
|
102
|
+
servedProvider?: string | null;
|
|
103
|
+
servedSource?: string | null;
|
|
104
|
+
inputTokens?: number | null;
|
|
105
|
+
outputTokens?: number | null;
|
|
106
|
+
reasoningTokens?: number | null;
|
|
107
|
+
cacheReadTokens?: number | null;
|
|
108
|
+
cacheWriteTokens?: number | null;
|
|
109
|
+
costUsd?: number | null;
|
|
110
|
+
/** Opaque product-column values written verbatim in the SAME update. */
|
|
111
|
+
extras?: Record<string, unknown>;
|
|
112
|
+
}
|
|
113
|
+
/** Define options to configure message listing with optional limit and offset parameters */
|
|
114
|
+
export interface ListMessagesOptions {
|
|
115
|
+
limit?: number;
|
|
116
|
+
offset?: number;
|
|
117
|
+
}
|
|
118
|
+
/** Define input for bulk deleting threads with access checks per workspace */
|
|
119
|
+
export interface BulkDeleteThreadsInput {
|
|
120
|
+
ids: string[];
|
|
121
|
+
/** Optional single-workspace fence for products whose route already resolved
|
|
122
|
+
* one active workspace. Omitted preserves the multi-workspace legal route. */
|
|
123
|
+
workspaceId?: string;
|
|
124
|
+
/** Called once per distinct workspace the ids touch, before ANY delete. */
|
|
125
|
+
assertAccess: WorkspaceAccessCheck;
|
|
126
|
+
}
|
|
127
|
+
/** Delete threads selected by their last activity time within one workspace.
|
|
128
|
+
*
|
|
129
|
+
* Products can add a lifecycle predicate such as `status = 'active'` through
|
|
130
|
+
* `where`; the store still owns workspace scope, access ordering, and message
|
|
131
|
+
* cleanup for every consumer. */
|
|
132
|
+
export interface BulkDeleteThreadsByUpdatedAtInput {
|
|
133
|
+
workspaceId: string;
|
|
134
|
+
/** Exclusive upper bound: rows older than this instant. */
|
|
135
|
+
updatedBefore?: Date;
|
|
136
|
+
/** Inclusive lower bound: rows updated at or after this instant. */
|
|
137
|
+
updatedAfter?: Date;
|
|
138
|
+
where?: SQL;
|
|
139
|
+
/** Called before any delete for the requested workspace. */
|
|
140
|
+
assertAccess: WorkspaceAccessCheck;
|
|
141
|
+
}
|
|
142
|
+
/** Manage chat threads and messages with operations for listing, creating, updating, and deleting data */
|
|
143
|
+
export interface ChatStore<TThread = ChatThreadRow, TMessage = ChatMessageRow> {
|
|
144
|
+
listThreads(input: ListThreadsInput): Promise<ListThreadsResult<TThread>>;
|
|
145
|
+
getThread(threadId: string): Promise<TThread | null>;
|
|
146
|
+
createThread(input: CreateThreadInput): Promise<TThread>;
|
|
147
|
+
renameThread(threadId: string, title: string): Promise<TThread | null>;
|
|
148
|
+
pinThread(threadId: string, isPinned: boolean): Promise<TThread | null>;
|
|
149
|
+
/** Messages + thread in one batch. Resolves false when the thread does not
|
|
150
|
+
* exist. `assertAccess` (optional) receives the thread's workspaceId before
|
|
151
|
+
* the delete — single-thread callers usually check access themselves. */
|
|
152
|
+
deleteThread(threadId: string, options?: {
|
|
153
|
+
assertAccess?: WorkspaceAccessCheck;
|
|
154
|
+
}): Promise<boolean>;
|
|
155
|
+
bulkDeleteThreads(input: BulkDeleteThreadsInput): Promise<{
|
|
156
|
+
deleted: number;
|
|
157
|
+
}>;
|
|
158
|
+
bulkDeleteThreadsByUpdatedAt(input: BulkDeleteThreadsByUpdatedAtInput): Promise<{
|
|
159
|
+
deleted: number;
|
|
160
|
+
}>;
|
|
161
|
+
/** Ordered oldest-first: `created_at`, then rowid (insertion order within a
|
|
162
|
+
* same-second burst — a user+assistant pair lands in one epoch second). */
|
|
163
|
+
listMessages(threadId: string, options?: ListMessagesOptions): Promise<TMessage[]>;
|
|
164
|
+
/** Inserts the message and bumps the thread's `updatedAt` in one batch so
|
|
165
|
+
* workspace recency sorts stay truthful. */
|
|
166
|
+
appendMessage(input: AppendMessageInput): Promise<TMessage>;
|
|
167
|
+
/** Patches an existing message and bumps its thread's `updatedAt` in the
|
|
168
|
+
* same batch. Resolves `null` when the id does not exist. Only defined
|
|
169
|
+
* patch fields are written. */
|
|
170
|
+
updateMessage(id: string, patch: UpdateMessageInput): Promise<TMessage | null>;
|
|
171
|
+
/** Removes one message. Resolves false when the id does not exist. Used by
|
|
172
|
+
* incremental persistence to retract a draft row for a turn that ended
|
|
173
|
+
* producing nothing, so an empty assistant row is never left behind. */
|
|
174
|
+
deleteMessage(id: string): Promise<boolean>;
|
|
175
|
+
}
|
|
176
|
+
/** Create a chat store managing threads and messages based on the provided database and tables */
|
|
177
|
+
export declare function createChatStore<TTables extends ChatTables>(db: ChatDatabase, tables: TTables): ChatStore<TTables['threads']['$inferSelect'], TTables['messages']['$inferSelect']>;
|