@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,850 +1,17 @@
|
|
|
1
|
-
import { b as WorkProductProvenance, d as WorkProductStorePort, e as WorkProductAuditEvent, c as WorkProductRecord, f as WorkProductArtifact, Q as QualityCheck, E as EvidenceEntry, g as ExceptionEntry, h as WorkProductStatus, W as WorkProductPersistedPart } from '../types-CCeYywdS.js';
|
|
2
|
-
export { A as AgentCheckInput, i as EvidenceLocator, j as EvidenceSpan, k as ExceptionSeverity, P as ProfileBacktestSummary, l as QuoteBasis, m as WorkProductParseResult, n as WorkProductPatch, a as WorkProductRef, o as WorkProductUpdateGuard, p as WorkProductVersionEntry, q as isWorkProductStatus, r as parseAgentCheckInput, s as parseArtifactInput, t as parseEvidenceInput, u as parseExceptionInput, v as persistedPartToWorkProduct, w as unresolvedBlockingExceptions, x as workProductToPersistedPart } from '../types-CCeYywdS.js';
|
|
3
|
-
import { A as AppToolContext, b as AppToolDefinition } from '../types-B25Mib1r.js';
|
|
4
|
-
import { JudgeVerdict } from '@tangle-network/agent-eval';
|
|
5
|
-
import { T as TrustItem } from '../trust-gate-Dcm5xSva.js';
|
|
6
|
-
export { R as ReviewQueueInputs, a as ReviewQueueItem, b as ReviewQueuePendingAsk, c as ReviewQueueState, d as ReviewQueueThread, p as parseReviewQueueItem, e as projectReviewQueue } from '../queue-VTBA5ONX.js';
|
|
7
|
-
|
|
8
1
|
/**
|
|
9
|
-
*
|
|
10
|
-
* (
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
* missing row — deterministic, never retried). */
|
|
26
|
-
type WorkProductOutcome<T> = {
|
|
27
|
-
succeeded: true;
|
|
28
|
-
value: T;
|
|
29
|
-
} | {
|
|
30
|
-
succeeded: false;
|
|
31
|
-
error: string;
|
|
32
|
-
conflict: boolean;
|
|
33
|
-
};
|
|
34
|
-
/** Whether a legal edge exists from `from` to `to` in the review machine. */
|
|
35
|
-
declare function canTransitionWorkProduct(from: WorkProductStatus, to: WorkProductStatus): boolean;
|
|
36
|
-
/** Statuses a work product can never leave. */
|
|
37
|
-
declare function isWorkProductTerminal(status: WorkProductStatus): boolean;
|
|
38
|
-
/** Define the input required to create a new draft work product row */
|
|
39
|
-
interface CreateWorkProductInput {
|
|
40
|
-
/** Explicit row id — omit to use the service's generator. The MODEL never
|
|
41
|
-
* supplies ids; this is for deterministic server-side creation. */
|
|
42
|
-
id?: string;
|
|
43
|
-
workspaceId: string;
|
|
44
|
-
threadId: string | null;
|
|
45
|
-
scopeKey: string;
|
|
46
|
-
/** Version this draft will become; default 1. The tool layer passes
|
|
47
|
-
* `last reviewed version + 1` when a scope is re-engaged after approval. */
|
|
48
|
-
version?: number;
|
|
49
|
-
provenance: WorkProductProvenance;
|
|
50
|
-
/** Opaque product-column values handed VERBATIM to the store's insert. */
|
|
51
|
-
extras?: Record<string, unknown>;
|
|
52
|
-
}
|
|
53
|
-
/** Payload for the draft→ready submit transition */
|
|
54
|
-
interface SubmitWorkProductInput {
|
|
55
|
-
artifact: WorkProductArtifact;
|
|
56
|
-
checks: QualityCheck[];
|
|
57
|
-
provenance: WorkProductProvenance;
|
|
58
|
-
/** Frozen snapshot ref of this version's body for the history entry;
|
|
59
|
-
* defaults to `artifact.path`. */
|
|
60
|
-
artifactPath?: string;
|
|
61
|
-
}
|
|
62
|
-
/** Reviewer verdict payload for the ready→approved / ready→changes_requested transition */
|
|
63
|
-
interface WorkProductVerdictInput {
|
|
64
|
-
verdict: 'approve' | 'request_changes';
|
|
65
|
-
reviewedBy: string;
|
|
66
|
-
note?: string;
|
|
67
|
-
}
|
|
68
|
-
/** Guarded mutation surface over the work-product store */
|
|
69
|
-
interface WorkProductService {
|
|
70
|
-
create(input: CreateWorkProductInput): Promise<WorkProductRecord>;
|
|
71
|
-
get(id: string): Promise<WorkProductRecord | null>;
|
|
72
|
-
/** The scope's open accumulator row (`draft`/`blocked`), or null. */
|
|
73
|
-
openDraft(workspaceId: string, scopeKey: string): Promise<WorkProductRecord | null>;
|
|
74
|
-
/** The scope's `changes_requested` row awaiting its correction turn, or null. */
|
|
75
|
-
awaitingCorrection(workspaceId: string, scopeKey: string): Promise<WorkProductRecord | null>;
|
|
76
|
-
/** The scope's `ready` row awaiting review, or null. */
|
|
77
|
-
awaitingReview(workspaceId: string, scopeKey: string): Promise<WorkProductRecord | null>;
|
|
78
|
-
/** `max(version over the scope's approved/superseded rows) + 1` — the
|
|
79
|
-
* version a fresh draft for the scope should carry. */
|
|
80
|
-
nextVersion(workspaceId: string, scopeKey: string): Promise<number>;
|
|
81
|
-
/** Re-open a `changes_requested` row as the next draft: version bumps +1
|
|
82
|
-
* and the correction turn accumulates into the same scope row. */
|
|
83
|
-
reopen(id: string): Promise<WorkProductOutcome<WorkProductRecord>>;
|
|
84
|
-
/** Merge evidence entries by id AND by what they assert (target + source +
|
|
85
|
-
* claim), so re-stating a fact already recorded replaces it under whatever
|
|
86
|
-
* id this batch minted rather than appending a near-copy. Legal only while
|
|
87
|
-
* `draft`/`blocked`. */
|
|
88
|
-
upsertEvidence(id: string, entries: readonly EvidenceEntry[]): Promise<WorkProductOutcome<WorkProductRecord>>;
|
|
89
|
-
/** Merge exception entries by id, then reconcile the blocked flag: any
|
|
90
|
-
* unresolved blocking entry parks `draft`→`blocked`; resolving the last
|
|
91
|
-
* one releases `blocked`→`draft`. */
|
|
92
|
-
upsertExceptions(id: string, entries: readonly ExceptionEntry[]): Promise<WorkProductOutcome<WorkProductRecord>>;
|
|
93
|
-
/** Persist a checks array without transitioning — how a failed platform
|
|
94
|
-
* gate (e.g. evidence_coverage) stays visible on the still-draft row. */
|
|
95
|
-
recordChecks(id: string, checks: readonly QualityCheck[]): Promise<WorkProductOutcome<WorkProductRecord>>;
|
|
96
|
-
/** The terminal agent call: CAS `draft`→`ready` with artifact + checks +
|
|
97
|
-
* provenance, appending the version-history entry. Refuses while an
|
|
98
|
-
* unresolved blocking exception exists. */
|
|
99
|
-
submit(id: string, input: SubmitWorkProductInput): Promise<WorkProductOutcome<WorkProductRecord>>;
|
|
100
|
-
/** Reviewer verdict: CAS `ready`→`approved`/`changes_requested` + history
|
|
101
|
-
* entry. Approval also supersedes the scope's prior approved versions so
|
|
102
|
-
* exactly one approved version is current per scope. */
|
|
103
|
-
applyVerdict(id: string, input: WorkProductVerdictInput): Promise<WorkProductOutcome<WorkProductRecord>>;
|
|
104
|
-
/** Explicit replacement: CAS to `superseded` (legal from ready /
|
|
105
|
-
* changes_requested / approved). */
|
|
106
|
-
supersede(id: string): Promise<WorkProductOutcome<WorkProductRecord>>;
|
|
107
|
-
}
|
|
108
|
-
/** Configuration options for creating a work product service */
|
|
109
|
-
interface WorkProductServiceOptions {
|
|
110
|
-
store: WorkProductStorePort;
|
|
111
|
-
/** Injectable clock (epoch ms). Default `Date.now`. */
|
|
112
|
-
now?: () => number;
|
|
113
|
-
/** Row-id generator. Default `crypto.randomUUID()`. */
|
|
114
|
-
generateId?: () => string;
|
|
115
|
-
}
|
|
116
|
-
/** Create the guarded work-product service over a store port */
|
|
117
|
-
declare function createWorkProductService(options: WorkProductServiceOptions): WorkProductService;
|
|
118
|
-
/** In-memory store surface with audit trail access and unguarded direct writes for tests */
|
|
119
|
-
interface InMemoryWorkProductStore extends WorkProductStorePort {
|
|
120
|
-
/** The full audit trail, append order. */
|
|
121
|
-
events(): WorkProductAuditEvent[];
|
|
122
|
-
/** Unguarded direct write — simulates a concurrent owner in tests. */
|
|
123
|
-
put(record: WorkProductRecord): void;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* In-memory {@link WorkProductStorePort} — the portable backend for tests and
|
|
127
|
-
* reference assemblies. Records are deep-copied on every boundary so callers
|
|
128
|
-
* can never mutate stored state around the guards.
|
|
129
|
-
*/
|
|
130
|
-
declare function createInMemoryWorkProductStore(): InMemoryWorkProductStore;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Provenance stamping — the backtest spine. Every version of every work
|
|
134
|
-
* product carries `profileHash + runId + servingModels`, stamped at the two
|
|
135
|
-
* honest moments:
|
|
136
|
-
*
|
|
137
|
-
* 1. At dispatch, the product route composes the turn's profile and computes
|
|
138
|
-
* agent-eval's `agentProfileHash(profile)` — the SAME hash that keys the
|
|
139
|
-
* app's scorecard cells — and closes it (plus runId/sessionId) into the
|
|
140
|
-
* `provenance` seam `buildWorkProductTools` receives, so the model can
|
|
141
|
-
* neither omit nor forge it.
|
|
142
|
-
* 2. At turn completion, the route's existing lifecycle seam calls
|
|
143
|
-
* {@link finalizeWorkProductProvenance}: serving model and cost come from
|
|
144
|
-
* the usage receipt, because only the completed turn knows what actually
|
|
145
|
-
* served. `servingModels` is honestly EMPTY until then.
|
|
146
|
-
*
|
|
147
|
-
* The trust bridge ({@link workProductTrustInputs}) maps judge-sourced
|
|
148
|
-
* quality verdicts into `/eval-campaign`'s `trustVerdicts()` input with
|
|
149
|
-
* type-only imports — products call `trustVerdicts` from
|
|
150
|
-
* `@tangle-network/agent-app/eval-campaign` (which they already import for
|
|
151
|
-
* their ensemble loop). Deliberately NOT a value re-export here: it would put
|
|
152
|
-
* agent-eval's runtime on `/work-product`'s import path and drag the eval
|
|
153
|
-
* engine into every product worker bundle.
|
|
154
|
-
*/
|
|
155
|
-
|
|
156
|
-
/** The dispatch-time provenance closure's output: everything the route knows
|
|
157
|
-
* before the turn completes. */
|
|
158
|
-
type WorkProductProvenanceBase = Omit<WorkProductProvenance, 'servingModels' | 'producedAt'>;
|
|
159
|
-
/** Stamp a full provenance from the dispatch-time base. `servingModels` starts
|
|
160
|
-
* empty (honestly absent — never guessed) until the completion back-fill. */
|
|
161
|
-
declare function stampProvenance(base: WorkProductProvenanceBase, now?: () => number): WorkProductProvenance;
|
|
162
|
-
/** Completion receipt for one run, from the turn's usage/lifecycle seam. */
|
|
163
|
-
interface FinalizeWorkProductProvenanceInput {
|
|
164
|
-
workspaceId: string;
|
|
165
|
-
/** The chat turnId / mission-step run id the records were stamped with. */
|
|
166
|
-
runId: string;
|
|
167
|
-
/** What actually served, from the usage receipt / serving-model header. */
|
|
168
|
-
servingModels: readonly string[];
|
|
169
|
-
costUsd?: number;
|
|
170
|
-
logger?: Pick<Console, 'warn'>;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Back-fill `servingModels`/`costUsd` onto every record (and its history
|
|
174
|
-
* entries) stamped with `runId` — wire it into the chat route's existing
|
|
175
|
-
* `lifecycle.onTurnComplete` seam; no new hook. Returns the updated records.
|
|
176
|
-
* A CAS miss on one record is logged and skipped (the next completion or a
|
|
177
|
-
* re-read re-applies); it never throws mid-fleet.
|
|
178
|
-
*/
|
|
179
|
-
declare function finalizeWorkProductProvenance(store: WorkProductStorePort, input: FinalizeWorkProductProvenanceInput): Promise<WorkProductRecord[]>;
|
|
180
|
-
/**
|
|
181
|
-
* Trust-gate bridge: one `TrustItem` per work product whose production
|
|
182
|
-
* quality was scored by the product's eval-campaign ensemble. `verdictsFor`
|
|
183
|
-
* returns the per-judge raw verdicts the product retained for a record (the
|
|
184
|
-
* same verdicts `aggregateJudgeVerdicts` reduces); records without verdicts
|
|
185
|
-
* are omitted. Feed the result to `/eval-campaign`'s `trustVerdicts()` —
|
|
186
|
-
* an untrusted verdict renders as "quality: unverified", never a naked
|
|
187
|
-
* number. Zero statistics code here: pure mapping.
|
|
188
|
-
*/
|
|
189
|
-
declare function workProductTrustInputs<D extends string = string>(records: readonly WorkProductRecord[], verdictsFor: (record: WorkProductRecord) => readonly JudgeVerdict<D>[] | undefined): TrustItem<D>[];
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Claim support and target correctness — is this citation attached to the RIGHT
|
|
193
|
-
* place, and does the text it names actually say what the entry claims?
|
|
194
|
-
*
|
|
195
|
-
* Three checks live here, each answering a different half of "is this evidence
|
|
196
|
-
* row honest": {@link verifyClaimSupport} (claim ↔ cited text),
|
|
197
|
-
* {@link verifyTargetLabel} (target ↔ cited line), and
|
|
198
|
-
* {@link verifyArtifactAgreement} (claim ↔ the artifact field it decorates).
|
|
199
|
-
* They share the numeric canonicalization below, which is why they share a
|
|
200
|
-
* file — a second copy of "what counts as the same figure" is how two gates
|
|
201
|
-
* drift into disagreeing about the same row.
|
|
202
|
-
*
|
|
203
|
-
* ── Check one: claim support ────────────────────────────────────────────────
|
|
204
|
-
*
|
|
205
|
-
* The two gates before this one answer different questions. `sourceContainsQuote`
|
|
206
|
-
* asks whether the quote is really in the document; `findSourceLine` /
|
|
207
|
-
* `sliceSourceSpan` make the platform produce the quote so it cannot be typed
|
|
208
|
-
* wrong. Both are about the TEXT's provenance. Neither one looks at `claim`.
|
|
209
|
-
*
|
|
210
|
-
* Production row `7256ef49` is what that gap costs. Four evidence entries, all
|
|
211
|
-
* `quoteBasis:'span'`, every quote a genuine slice of the document it named —
|
|
212
|
-
* and every one landing on the employer/payer line about 200 characters above
|
|
213
|
-
* the figure:
|
|
214
|
-
*
|
|
215
|
-
* claim 128450.00 -> "tics LLC EIN 84-2213907\nEmployee: Dana"
|
|
216
|
-
* claim 812.44 -> "nt Savings Bank TIN 22-5510983\nRecip"
|
|
217
|
-
* claim 2204.18 -> "ndex Fund Trust TIN 47-3320115\nRec"
|
|
218
|
-
* claim 1955.02 -> "pient: Dana R. Whitfield\n------------"
|
|
219
|
-
*
|
|
220
|
-
* That is strictly worse than a fabricated quote. A fabricated quote fails the
|
|
221
|
-
* verbatim gate; this one passes every gate, is real text from the right
|
|
222
|
-
* document, and reads to a reviewer as an authoritative citation while
|
|
223
|
-
* supporting nothing. `locator.find` (the platform locating a value the model
|
|
224
|
-
* names) prevents the model from ADDRESSING the wrong line, and it is the right
|
|
225
|
-
* primary fix. This module is the independent check underneath it: whatever
|
|
226
|
-
* anchoring form produced the text, the text has to contain the figure.
|
|
227
|
-
*
|
|
228
|
-
* That also settles what a raw `locator.span` is worth. Hand-computed offsets
|
|
229
|
-
* stay accepted, but only when they independently verify — which is exactly
|
|
230
|
-
* "the slice contains the claimed value".
|
|
231
|
-
*
|
|
232
|
-
* ── The rule, and why it is drawn here ──────────────────────────────────────
|
|
233
|
-
*
|
|
234
|
-
* Strict on figures, silent on everything else. An unsatisfiable gate does not
|
|
235
|
-
* stop a bad submit, it SELECTS for one — that is the measured mechanism behind
|
|
236
|
-
* the 38 fabricated quotes on row `a68b1943`, where a coverage gate demanded
|
|
237
|
-
* document lineage for computed values and got thirteen invented citations
|
|
238
|
-
* forty seconds later. So the rule fires only where an honest citation can
|
|
239
|
-
* always satisfy it:
|
|
240
|
-
*
|
|
241
|
-
* - The claim IS a value (`"128450.00"`, `"$30,000"`, `"3"`) — the anchored
|
|
242
|
-
* text MUST contain that value. No latitude. This is the shape every tax
|
|
243
|
-
* figure takes and the shape row `7256ef49` failed.
|
|
244
|
-
* - The claim is prose naming figures (`"indemnity capped at $5,000,000"`) —
|
|
245
|
-
* at least one of its currency-shaped figures must occur. Not all of them:
|
|
246
|
-
* a claim may legitimately narrate a computation over several lines while
|
|
247
|
-
* anchoring to the one line under discussion, and refusing that would make
|
|
248
|
-
* an honest citation unrepresentable for the sake of a stricter-sounding
|
|
249
|
-
* rule. One is enough to keep the anchor tethered to the claim's subject.
|
|
250
|
-
* - The claim carries no figure at all (`"Married Filing Jointly"`,
|
|
251
|
-
* `"Dana R. Whitfield"`, `"2025-04-15"`) — nothing to check, and the entry
|
|
252
|
-
* passes. A filing status has no number to find, and inventing a
|
|
253
|
-
* word-overlap score here would re-open the hole the verbatim gate closes.
|
|
254
|
-
* - The entry has no anchored text at all — nothing to check. A computed
|
|
255
|
-
* value cites its computation, not a document.
|
|
256
|
-
*
|
|
257
|
-
* A bare year, a form number and a box number are deliberately NOT figures:
|
|
258
|
-
* `2025`, `1040` and `Box 1` have no thousands separator, no cent pair and no
|
|
259
|
-
* currency symbol, so prose mentioning them does not trip the rule.
|
|
260
|
-
*
|
|
261
|
-
* ── Matching is value-wise, never substring ─────────────────────────────────
|
|
262
|
-
*
|
|
263
|
-
* `text.includes(claim)` would be the obvious implementation and it is wrong in
|
|
264
|
-
* the direction that matters: it passes `"450.00"` against `"128,450.00"`, so a
|
|
265
|
-
* claim citing the wrong figure survives whenever its digits happen to be a tail
|
|
266
|
-
* of a real one. Both sides are tokenized into numbers and compared as VALUES,
|
|
267
|
-
* so `450` and `128450` are simply different.
|
|
268
|
-
*/
|
|
269
|
-
/**
|
|
270
|
-
* Reduce a numeric token to the form both sides are compared in: no currency,
|
|
271
|
-
* no grouping, no trailing zeros in the fraction, no leading zeros.
|
|
272
|
-
*
|
|
273
|
-
* Sign and accounting parentheses are stripped rather than preserved, so
|
|
274
|
-
* `(1,234.00)`, `-1,234.00` and `1,234.00` all reduce to `1234`. A document
|
|
275
|
-
* renders the same deduction all three ways depending on the form and the
|
|
276
|
-
* extractor, and the sign is a property of the TARGET LINE's semantics, not of
|
|
277
|
-
* the document's typography. Comparing magnitudes keeps those honest citations
|
|
278
|
-
* working, and it concedes nothing to fabrication: the digits still have to be
|
|
279
|
-
* the document's digits.
|
|
280
|
-
*
|
|
281
|
-
* Returns `null` for anything that is not a plain number.
|
|
282
|
-
*/
|
|
283
|
-
declare function canonicalizeValue(token: string): string | null;
|
|
284
|
-
/** Every distinct value appearing in `text`, canonicalized. */
|
|
285
|
-
declare function valuesInText(text: string): string[];
|
|
286
|
-
/**
|
|
287
|
-
* The values a claim asserts, canonicalized — empty when the claim asserts no
|
|
288
|
-
* figure, which is the "nothing to check" case.
|
|
289
|
-
*
|
|
290
|
-
* A claim that is ENTIRELY one value yields that value (strict path). Otherwise
|
|
291
|
-
* only currency-shaped figures inside the prose count, so an assertion that
|
|
292
|
-
* merely mentions a year or a form number yields nothing.
|
|
293
|
-
*/
|
|
294
|
-
declare function claimValues(claim: string): string[];
|
|
295
|
-
type ClaimSupport =
|
|
296
|
-
/** No figure to check: a non-numeric claim, or no anchored text. */
|
|
297
|
-
{
|
|
298
|
-
status: 'not_applicable';
|
|
299
|
-
} | {
|
|
300
|
-
status: 'supported';
|
|
301
|
-
matched: string;
|
|
302
|
-
} | {
|
|
303
|
-
status: 'unsupported';
|
|
304
|
-
claimed: string[];
|
|
305
|
-
present: string[];
|
|
306
|
-
};
|
|
307
|
-
/**
|
|
308
|
-
* Does `quote` carry the figure `claim` asserts?
|
|
309
|
-
*
|
|
310
|
-
* `supported` requires ONE claimed value to occur, which is exact for the
|
|
311
|
-
* single-value claim (there is only one) and deliberate latitude for prose (see
|
|
312
|
-
* the rule note at the top of the file).
|
|
313
|
-
*/
|
|
314
|
-
declare function verifyClaimSupport(quote: string, claim: string): ClaimSupport;
|
|
315
|
-
/**
|
|
316
|
-
* The sentence a model can act on without re-reading the document: what it
|
|
317
|
-
* claimed, what the line it cited actually says, what figures that line does
|
|
318
|
-
* carry, and the two ways out — cite the value, or drop the locator because the
|
|
319
|
-
* figure was computed. Naming both keeps the gate satisfiable, which is the
|
|
320
|
-
* property that stops it manufacturing the citation it screens for.
|
|
321
|
-
*/
|
|
322
|
-
declare function claimSupportErrorDetail(failure: Extract<ClaimSupport, {
|
|
323
|
-
status: 'unsupported';
|
|
324
|
-
}>, quote: string): string;
|
|
325
|
-
/**
|
|
326
|
-
* Does the cited line belong to the target the entry attaches it to?
|
|
327
|
-
*
|
|
328
|
-
* `verifyClaimSupport` asks whether the anchored text carries the claimed
|
|
329
|
-
* figure. It is blind, BY CONSTRUCTION, to whether that figure belongs on that
|
|
330
|
-
* line. Production row `95105c8a` is what the blindness costs — two entries,
|
|
331
|
-
* both anchored to a real line of the right document, both carrying the figure
|
|
332
|
-
* they claim, and both attached to the wrong form line:
|
|
333
|
-
*
|
|
334
|
-
* f1040.line_3b claim 1955.02 -> "Box 1b Qualified dividends ..... 1,955.02"
|
|
335
|
-
* f1040.line_3a claim 2204.18 -> "Box 1a Total ordinary dividends . 2,204.18"
|
|
336
|
-
*
|
|
337
|
-
* Form 1040 line 3a is QUALIFIED dividends and line 3b is ORDINARY, so each
|
|
338
|
-
* citation points a reviewer at the other one's line. `quote_verification`,
|
|
339
|
-
* `claim_support` and `evidence_coverage` were all green on that row. A
|
|
340
|
-
* citation that points at the wrong line is a wrong citation even when every
|
|
341
|
-
* character of it is real, and it is the failure a reviewer is least able to
|
|
342
|
-
* catch by eye, because it looks exactly like a good one.
|
|
343
|
-
*
|
|
344
|
-
* ── Why the domain supplies LABELS and the shell supplies the COMPARISON ────
|
|
345
|
-
*
|
|
346
|
-
* The shell cannot know that line 3a means qualified dividends; that is tax
|
|
347
|
-
* vocabulary and baking it here would violate the one rule this package is
|
|
348
|
-
* built on. So the product declares which targets are CONFUSABLE with each
|
|
349
|
-
* other and what each one's line looks like in a source document — a
|
|
350
|
-
* {@link ConfusableTargetGroup} — and the shell does the comparing.
|
|
351
|
-
*
|
|
352
|
-
* ── Why a group of labels, and not a per-target expectation ─────────────────
|
|
353
|
-
*
|
|
354
|
-
* The obvious shape is a per-target expectation read POSITIVELY: "a citation
|
|
355
|
-
* for line_3a must contain 'Qualified'". It is stricter, it is easier to
|
|
356
|
-
* explain, and it is the wrong shape, because it refuses honest work. A
|
|
357
|
-
* consolidated broker statement writing "Qual. div. income", a payer writing
|
|
358
|
-
* "Dividends that are qualified", an OCR layer dropping a word — each one turns
|
|
359
|
-
* a correct citation into a refusal. And this codebase has already measured
|
|
360
|
-
* what refusing honest work does: a coverage gate that demanded document
|
|
361
|
-
* lineage for computed values produced 38 fabricated quotes on row `a68b1943`,
|
|
362
|
-
* because a gate a model cannot satisfy honestly is a gate it satisfies
|
|
363
|
-
* dishonestly. An unsatisfiable rule does not stop bad work; it SELECTS for
|
|
364
|
-
* invented work.
|
|
365
|
-
*
|
|
366
|
-
* So the same labels are read NEGATIVELY and COMPARATIVELY. An entry is
|
|
367
|
-
* refused only when the cited line positively identifies a SIBLING target and
|
|
368
|
-
* says nothing that identifies its own:
|
|
369
|
-
*
|
|
370
|
-
* - the line carries one of the target's own labels → `identified`, pass
|
|
371
|
-
* - the line carries no label from the group at all → `not_applicable`, pass
|
|
372
|
-
* - the line carries a sibling's label and none of its own → `crossed`, refuse
|
|
373
|
-
*
|
|
374
|
-
* Silence therefore always passes. An unusually-labelled document costs
|
|
375
|
-
* nothing, a target the product never grouped costs nothing, and the only way
|
|
376
|
-
* to fail is for the document itself to say the line belongs to a different
|
|
377
|
-
* target — which is not a phrasing accident, it is the crossed pair. The rule
|
|
378
|
-
* is satisfiable by the honest citation in every case, and unsatisfiable only
|
|
379
|
-
* by the wrong one.
|
|
380
|
-
*
|
|
381
|
-
* Matching is punctuation- and case-insensitive: a label is a semantic marker
|
|
382
|
-
* for which LINE this is, not a quotation. (`sourceContainsQuote` stays exact —
|
|
383
|
-
* different question, different tolerance.)
|
|
384
|
-
*/
|
|
385
|
-
/** One set of targets whose source lines are mistakable for each other, with
|
|
386
|
-
* the phrases that tell them apart. Every string is product vocabulary; the
|
|
387
|
-
* shell reads none of them as meaning anything. */
|
|
388
|
-
interface ConfusableTargetGroup {
|
|
389
|
-
/** Named in the refusal so the model is told which distinction it missed
|
|
390
|
-
* ("Form 1099-DIV boxes 1a/1b"). */
|
|
391
|
-
note?: string;
|
|
392
|
-
/** Target → phrases that identify THAT target's line in a source document.
|
|
393
|
-
* Targets must be spelled the way evidence targets are spelled after the
|
|
394
|
-
* product's `normalizeTarget`, so one canonical name is written once. */
|
|
395
|
-
labels: Record<string, readonly string[]>;
|
|
396
|
-
}
|
|
397
|
-
type TargetLabelVerdict =
|
|
398
|
-
/** No group covers this target, or the line says nothing either way. */
|
|
399
|
-
{
|
|
400
|
-
status: 'not_applicable';
|
|
401
|
-
}
|
|
402
|
-
/** The cited line carries one of this target's own labels. */
|
|
403
|
-
| {
|
|
404
|
-
status: 'identified';
|
|
405
|
-
label: string;
|
|
406
|
-
}
|
|
407
|
-
/** The cited line identifies a DIFFERENT target in the same group. */
|
|
408
|
-
| {
|
|
409
|
-
status: 'crossed';
|
|
410
|
-
rival: string;
|
|
411
|
-
rivalLabel: string;
|
|
412
|
-
expected: readonly string[];
|
|
413
|
-
note?: string;
|
|
414
|
-
};
|
|
415
|
-
declare function verifyTargetLabel(quote: string, target: string, groups: readonly ConfusableTargetGroup[]): TargetLabelVerdict;
|
|
416
|
-
/** The sentence a model can act on: which line it actually cited, which target
|
|
417
|
-
* that line belongs to, and what its own target's line looks like. */
|
|
418
|
-
declare function targetLabelErrorDetail(failure: Extract<TargetLabelVerdict, {
|
|
419
|
-
status: 'crossed';
|
|
420
|
-
}>, target: string, quote: string): string;
|
|
421
|
-
/**
|
|
422
|
-
* Does the entry agree with the artifact it is evidence FOR?
|
|
423
|
-
*
|
|
424
|
-
* The two checks above compare evidence to the SOURCE. This one compares it to
|
|
425
|
-
* the DELIVERABLE, and it needs no product vocabulary at all: when the artifact
|
|
426
|
-
* states a value for a target and an evidence entry attached to that target
|
|
427
|
-
* asserts a different one, the work product contradicts itself, and a reviewer
|
|
428
|
-
* clicking that line is shown a figure the package does not report there.
|
|
429
|
-
*
|
|
430
|
-
* ── The rule, and the honest citation it must not refuse ────────────────────
|
|
431
|
-
*
|
|
432
|
-
* "Claim must equal the field" is the tempting rule and it is unsatisfiable for
|
|
433
|
-
* every aggregated or derived line. Measured on production row `a68b1943`:
|
|
434
|
-
* line 1a is 189,750.00 and its two evidence rows cite $128,450.00 and
|
|
435
|
-
* $61,300.00 — one per W-2, which is exactly the lineage a reviewer wants.
|
|
436
|
-
* Line 8 is a Schedule C net profit of 11,056.56 evidenced by gross receipts of
|
|
437
|
-
* 14,750.00 and four expense lines. Refusing those would delete correct work
|
|
438
|
-
* and, on this codebase's measured history, buy invented citations in its place.
|
|
439
|
-
*
|
|
440
|
-
* So the refusal is narrower and it is a CONTRADICTION rather than an
|
|
441
|
-
* inequality: the claim asserts a figure that the artifact itself assigns to a
|
|
442
|
-
* DIFFERENT target. On row `95105c8a` that is precisely the crossed pair —
|
|
443
|
-
* `line_3a` is 1955.02 in the artifact and its evidence claims 2204.18, which
|
|
444
|
-
* the same artifact reports on `line_3b`. There is no honest reading of that:
|
|
445
|
-
* the package cannot simultaneously say the number belongs on 3b and offer it
|
|
446
|
-
* as the support for 3a.
|
|
447
|
-
*
|
|
448
|
-
* A component that appears nowhere else in the field map (128,450.00 of a
|
|
449
|
-
* 189,750.00 total) is not a contradiction and is not refused. A claim
|
|
450
|
-
* narrating a computation passes as soon as one of its figures is the target's
|
|
451
|
-
* own value, which is what a narration of line 9 does by definition.
|
|
452
|
-
*/
|
|
453
|
-
/** Canonical target → canonical value, for the artifact fields that state a
|
|
454
|
-
* figure. Non-numeric fields are dropped: a filing status or a name has no
|
|
455
|
-
* numeric contradiction to detect, and inventing a string comparison here
|
|
456
|
-
* would re-open the fuzzy-matching hole the quote gate closes. */
|
|
457
|
-
declare function indexArtifactValues(fields: Readonly<Record<string, unknown>> | undefined, normalizeTarget?: (target: string) => string): Map<string, string>;
|
|
458
|
-
type ArtifactAgreement =
|
|
459
|
-
/** The artifact states no figure for this target, or the claim asserts none. */
|
|
460
|
-
{
|
|
461
|
-
status: 'not_applicable';
|
|
462
|
-
} | {
|
|
463
|
-
status: 'agrees';
|
|
464
|
-
value: string;
|
|
465
|
-
}
|
|
466
|
-
/** The claim asserts a figure the artifact reports on a different target. */
|
|
467
|
-
| {
|
|
468
|
-
status: 'contradicts';
|
|
469
|
-
claimed: string;
|
|
470
|
-
expected: string;
|
|
471
|
-
belongsTo: string;
|
|
472
|
-
};
|
|
473
|
-
declare function verifyArtifactAgreement(target: string, claim: string, fieldValues: ReadonlyMap<string, string>): ArtifactAgreement;
|
|
474
|
-
/** The sentence a model can act on: both numbers, both lines, and the two ways
|
|
475
|
-
* out — move the citation, or correct the artifact. */
|
|
476
|
-
declare function artifactAgreementErrorDetail(failure: Extract<ArtifactAgreement, {
|
|
477
|
-
status: 'contradicts';
|
|
478
|
-
}>, target: string): string;
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* The agent-facing work-product side channel — three registry `customTools`
|
|
482
|
-
* built on `/tools`' `defineAppTool`, dispatched through `dispatchAppTool`'s
|
|
483
|
-
* single validation/outcome path (a thrown `ToolInputError` → correctable 4xx
|
|
484
|
-
* back to the model; any other throw → internal error; a call never silently
|
|
485
|
-
* succeeds without its effect). Deliberately NOT new `/tools` built-ins:
|
|
486
|
-
* extending `AppToolHandlers` would break every existing consumer, and the
|
|
487
|
-
* registry seam exists precisely for a product tool family like this.
|
|
488
|
-
*
|
|
489
|
-
* Partial-emission contract across a long turn: the draft ROW is the
|
|
490
|
-
* accumulator. Evidence and exceptions stream in as found via small batched
|
|
491
|
-
* calls; the artifact arrives once at the end. The agent addresses everything
|
|
492
|
-
* by `scopeKey` — the server mints row ids, the model never invents them, and
|
|
493
|
-
* identity (userId/workspaceId/threadId) rides the trusted `AppToolContext`
|
|
494
|
-
* from headers, never model args. A turn that dies mid-emission leaves a
|
|
495
|
-
* consistent draft the next turn resumes by the same scopeKey.
|
|
496
|
-
*/
|
|
497
|
-
|
|
498
|
-
/** Max entries per `upsert_evidence`/`flag_exception` call — keeps each call a
|
|
499
|
-
* small batch the model can correct precisely on a named-index failure. */
|
|
500
|
-
declare const MAX_WORK_PRODUCT_BATCH = 50;
|
|
501
|
-
/** Platform check: every material target has ≥1 evidence row. Recorded as
|
|
502
|
-
* `QualityCheck{source:'platform'}`. */
|
|
503
|
-
declare const EVIDENCE_COVERAGE_CHECK = "evidence_coverage";
|
|
504
|
-
/** Platform check: how many evidence entries carry a quote the shell PROVED
|
|
505
|
-
* occurs in the source it names. Recorded when `readSourceText` is wired, so
|
|
506
|
-
* a reviewer reads the strength of the lineage off the row itself rather than
|
|
507
|
-
* trusting that a quote was checked. */
|
|
508
|
-
declare const QUOTE_VERIFICATION_CHECK = "quote_verification";
|
|
509
|
-
/** Platform check: how many quoted evidence entries anchor to text that
|
|
510
|
-
* actually CARRIES the figure the entry claims. Distinct from
|
|
511
|
-
* `quote_verification`, which only proves the text came from the document —
|
|
512
|
-
* production row `7256ef49` passed that one on all four entries while
|
|
513
|
-
* supporting none of them. */
|
|
514
|
-
declare const CLAIM_SUPPORT_CHECK = "claim_support";
|
|
515
|
-
/** Platform check: how many citations anchor to a line that belongs to the
|
|
516
|
-
* TARGET they are attached to, rather than to a sibling target's line.
|
|
517
|
-
* Recorded when the product declares `confusableTargets`; `claim_support`
|
|
518
|
-
* passes a crossed pair by construction, because the figure really is on the
|
|
519
|
-
* line — the wrong one. */
|
|
520
|
-
declare const TARGET_CORRECTNESS_CHECK = "target_correctness";
|
|
521
|
-
/** Platform check: how many evidence claims agree with the artifact field they
|
|
522
|
-
* decorate. A package whose evidence reports one figure on a line and whose
|
|
523
|
-
* artifact reports another contradicts itself; every other gate on this row
|
|
524
|
-
* reads only one of the two halves. */
|
|
525
|
-
declare const ARTIFACT_AGREEMENT_CHECK = "artifact_agreement";
|
|
526
|
-
/** Domain seams for the three work-product tools — every domain word is a
|
|
527
|
-
* parameter; the shell bakes none. */
|
|
528
|
-
interface WorkProductToolConfig {
|
|
529
|
-
store: WorkProductStorePort;
|
|
530
|
-
/** PARAMETER — accepted `artifact.kind` values, validated on submit. */
|
|
531
|
-
artifactKinds: readonly string[];
|
|
532
|
-
/** PARAMETER — accepted exception `kind` values. */
|
|
533
|
-
exceptionKinds: readonly string[];
|
|
534
|
-
/** Fail-loud source check: resolve an evidence `sourceRef` to existence
|
|
535
|
-
* (vault stat / attachment lookup). A dangling ref is a `ToolInputError`
|
|
536
|
-
* naming the entry index — lineage can never point at nothing. */
|
|
537
|
-
resolveSourceRef: (ref: string, ctx: AppToolContext) => Promise<boolean>;
|
|
538
|
-
/** Fail-loud QUOTE verification: return the source document's TEXT for a
|
|
539
|
-
* ref so the shell can prove each `locator.quote` occurs in it verbatim.
|
|
540
|
-
* Wiring this turns the gate ON — a quote that does not occur is a
|
|
541
|
-
* `ToolInputError` naming the entry index, so the model re-extracts from
|
|
542
|
-
* the document instead of persisting invented lineage.
|
|
543
|
-
*
|
|
544
|
-
* Return `null` ONLY when the ref genuinely has no extractable text (an
|
|
545
|
-
* image scan, an opaque blob). The gate is fail-CLOSED on `null`: a quote
|
|
546
|
-
* that cannot be checked is refused, because "unverifiable" and "verified"
|
|
547
|
-
* must never look the same to a reviewer. Such an entry is still recordable
|
|
548
|
-
* without `locator.quote` — `claim` carries the assertion.
|
|
549
|
-
*
|
|
550
|
-
* Omit the seam entirely and no quote is checked. */
|
|
551
|
-
readSourceText?: (ref: string, ctx: AppToolContext) => Promise<string | null>;
|
|
552
|
-
/** The material targets the platform coverage check requires evidence for.
|
|
553
|
-
* Product-owned vocabulary; omit to skip the coverage gate.
|
|
554
|
-
*
|
|
555
|
-
* Return ONLY targets a source document can actually evidence. A gate that
|
|
556
|
-
* demands document lineage for a value the session COMPUTED is not
|
|
557
|
-
* satisfiable by any honest answer, and an unsatisfiable gate does not stop
|
|
558
|
-
* a submit — it selects for an invented one. Computed values belong to a
|
|
559
|
-
* product's own computation check, where "matches what we already
|
|
560
|
-
* calculated" is satisfiable by construction. */
|
|
561
|
-
materialTargets?: (artifact: WorkProductArtifact) => string[];
|
|
562
|
-
/** Require every material target to carry a SOURCE ANCHOR — a span-sliced or
|
|
563
|
-
* verified quote — not merely an evidence row. Off by default (a bare
|
|
564
|
-
* `claim` is legitimate lineage for products with no readable sources);
|
|
565
|
-
* turn it ON once `readSourceText` is wired and `materialTargets` names only
|
|
566
|
-
* document-derived targets, and coverage stops being satisfiable by
|
|
567
|
-
* assertion. */
|
|
568
|
-
requireAnchoredEvidence?: boolean;
|
|
569
|
-
/** Verify that each anchored quote CARRIES the figure its entry claims.
|
|
570
|
-
* ON by default — an anchor that does not support its claim is the one
|
|
571
|
-
* failure mode every other gate here passes, and it reads to a reviewer as
|
|
572
|
-
* the most authoritative citation on the row.
|
|
573
|
-
*
|
|
574
|
-
* Only claims that assert a figure are checked, so a filing status, a name
|
|
575
|
-
* or a date is unaffected; see `./claim-support` for exactly where the line
|
|
576
|
-
* is drawn and why it is drawn to stay satisfiable. Set `false` only for a
|
|
577
|
-
* product whose claims are figures the source states in a form no numeric
|
|
578
|
-
* comparison can reach. */
|
|
579
|
-
verifyClaimSupport?: boolean;
|
|
580
|
-
/** Fold an evidence `target` (and every `materialTargets` name) to the
|
|
581
|
-
* product's ONE canonical spelling.
|
|
582
|
-
*
|
|
583
|
-
* Without it a target namespace forks and every check that joins evidence
|
|
584
|
-
* to the artifact by name silently half-works. Measured on production row
|
|
585
|
-
* `95105c8a`: the same seven form lines arrived as `line_3a` and
|
|
586
|
-
* `f1040.line_3a` in one turn, so coverage, deduplication and artifact
|
|
587
|
-
* agreement each saw two unrelated targets where the return has one line.
|
|
588
|
-
*
|
|
589
|
-
* Pure and total — it runs on every ingested entry and on the coverage
|
|
590
|
-
* target list, so a target it does not recognize must come back unchanged
|
|
591
|
-
* rather than throw. */
|
|
592
|
-
normalizeTarget?: (target: string) => string;
|
|
593
|
-
/** Targets whose SOURCE LINES are mistakable for each other, with the
|
|
594
|
-
* phrases that tell them apart — the product's vocabulary, compared by the
|
|
595
|
-
* shell. Omit and no target-correctness check runs.
|
|
596
|
-
*
|
|
597
|
-
* Read negatively: an entry is refused only when the line it cites carries
|
|
598
|
-
* a sibling target's label and none of its own, so an unusually-labelled
|
|
599
|
-
* document never costs an honest citation. See `./claim-support` for why
|
|
600
|
-
* the positive form ("the line must say X") is the wrong shape. */
|
|
601
|
-
confusableTargets?: readonly ConfusableTargetGroup[];
|
|
602
|
-
/** Refuse an evidence claim that asserts a figure the artifact reports on a
|
|
603
|
-
* DIFFERENT target. ON by default and domain-free — it compares the package
|
|
604
|
-
* to itself. Set `false` only for a product whose evidence claims are not
|
|
605
|
-
* the artifact's own figures. */
|
|
606
|
-
verifyArtifactAgreement?: boolean;
|
|
607
|
-
/** Per-turn provenance closure the ROUTE supplies (profileHash + runId are
|
|
608
|
-
* known at dispatch; trusted, never read from model args). */
|
|
609
|
-
provenance: (ctx: AppToolContext) => WorkProductProvenanceBase;
|
|
610
|
-
/** Called on the draft→ready commit so the route persists the transcript
|
|
611
|
-
* anchor part and the queue projection updates. */
|
|
612
|
-
onReady?: (record: WorkProductRecord, ctx: AppToolContext) => void | Promise<void>;
|
|
613
|
-
/** Injectable clock / id generator (tests, deterministic ids). */
|
|
614
|
-
now?: () => number;
|
|
615
|
-
generateId?: () => string;
|
|
616
|
-
}
|
|
617
|
-
/** Build the three work-product tools for `customTools` registration on the
|
|
618
|
-
* MCP server / HTTP handler / runtime executor. */
|
|
619
|
-
declare function buildWorkProductTools(config: WorkProductToolConfig): AppToolDefinition[];
|
|
620
|
-
|
|
621
|
-
/**
|
|
622
|
-
* Verbatim quote verification — the lineage gate.
|
|
623
|
-
*
|
|
624
|
-
* An evidence `locator.quote` is the reviewer's click target: it must land on
|
|
625
|
-
* text that is actually in the document the entry names. Nothing here is
|
|
626
|
-
* fuzzy. The only latitude is representational — the same characters written
|
|
627
|
-
* differently by a PDF extractor, a text transcription, or a model repeating
|
|
628
|
-
* what it read: Unicode compatibility forms, curly quotes, the several dash
|
|
629
|
-
* codepoints, non-breaking spaces, and run-length whitespace. A quote that
|
|
630
|
-
* still does not occur after that is not a formatting difference; it is text
|
|
631
|
-
* the document does not contain.
|
|
632
|
-
*
|
|
633
|
-
* Deliberately NOT tolerated, because each one re-opens the hole this closes:
|
|
634
|
-
* case (a quote is a quote), token subsets, edit distance, word-overlap
|
|
635
|
-
* scoring, and "the numbers match" heuristics. A fabricated quote and a real
|
|
636
|
-
* one differ by exactly the thing a fuzzy matcher forgives.
|
|
637
|
-
*/
|
|
638
|
-
/**
|
|
639
|
-
* Fold a string to the form both sides of a quote comparison are measured in.
|
|
640
|
-
* Composition and presentation only: NFKC, one dash, one apostrophe, one
|
|
641
|
-
* double quote, runs of any whitespace to a single space, trimmed. Case is
|
|
642
|
-
* PRESERVED — lowercasing would let "Box 1" match "box 1", and a citation
|
|
643
|
-
* that cannot reproduce capitalization did not read the document.
|
|
644
|
-
*/
|
|
645
|
-
declare function normalizeQuoteText(value: string): string;
|
|
646
|
-
/**
|
|
647
|
-
* Does `quote` occur in `sourceText`? Exact substring first (the common case,
|
|
648
|
-
* and free); the normalized comparison second, for the representational
|
|
649
|
-
* differences above. Nothing else.
|
|
650
|
-
*
|
|
651
|
-
* An empty or whitespace-only quote is NOT a match — it would otherwise be a
|
|
652
|
-
* substring of every document and pass the gate vacuously.
|
|
653
|
-
*/
|
|
654
|
-
declare function sourceContainsQuote(sourceText: string, quote: string): boolean;
|
|
655
|
-
/**
|
|
656
|
-
* Slice a citation out of the source text by character offset — the reason
|
|
657
|
-
* this module exists in its stronger form.
|
|
658
|
-
*
|
|
659
|
-
* Verification above is a REJECTION gate: the model retypes a quote and the
|
|
660
|
-
* shell refuses it when the characters do not occur. That gate is correct and
|
|
661
|
-
* it works, but a model that reproduces a line character-for-character only
|
|
662
|
-
* some of the time cannot USE it — every miss is a refusal, and the package
|
|
663
|
-
* ends up with no lineage at all rather than false lineage. A measured 9 of 59
|
|
664
|
-
* on the live tax surface is what "some of the time" meant in practice.
|
|
665
|
-
*
|
|
666
|
-
* A span inverts it. The model names two integers into text it just read; the
|
|
667
|
-
* PLATFORM produces the quote from the bytes it already holds. There is no
|
|
668
|
-
* retyping step to get wrong, so a fabricated quote is not rejected — it is
|
|
669
|
-
* unrepresentable. `sourceContainsQuote(text, sliceSourceSpan(text, span))` is
|
|
670
|
-
* true for every span this function returns, by construction.
|
|
671
|
-
*
|
|
672
|
-
* Offsets index the SAME string the product's document-reading tool pages
|
|
673
|
-
* with an offset, which is the same string its `readSourceText` seam returns.
|
|
674
|
-
* That is the one contract a product must keep; violate it and spans point at
|
|
675
|
-
* the wrong characters (still real characters of that document — never
|
|
676
|
-
* invented text, but the wrong line).
|
|
677
|
-
*
|
|
678
|
-
* Half-open `[start, end)`, matching `String.prototype.slice` and the
|
|
679
|
-
* `offset`/`offset + text.length` window a paged read already reports.
|
|
680
|
-
*/
|
|
681
|
-
type SourceSpanFailure = {
|
|
682
|
-
reason: 'not_integer';
|
|
683
|
-
field: 'start' | 'end';
|
|
684
|
-
} | {
|
|
685
|
-
reason: 'negative';
|
|
686
|
-
field: 'start' | 'end';
|
|
687
|
-
} | {
|
|
688
|
-
reason: 'inverted';
|
|
689
|
-
} | {
|
|
690
|
-
reason: 'out_of_range';
|
|
691
|
-
totalChars: number;
|
|
692
|
-
} | {
|
|
693
|
-
reason: 'blank';
|
|
694
|
-
};
|
|
695
|
-
type SourceSpanResult = {
|
|
696
|
-
ok: true;
|
|
697
|
-
quote: string;
|
|
698
|
-
} | {
|
|
699
|
-
ok: false;
|
|
700
|
-
failure: SourceSpanFailure;
|
|
701
|
-
};
|
|
702
|
-
/**
|
|
703
|
-
* Locate the line containing `value` and return it as a span — the citation
|
|
704
|
-
* form for a model that cannot count characters.
|
|
705
|
-
*
|
|
706
|
-
* Measured on production (tax session 135b7cc3, gpt-4.1-mini): given the
|
|
707
|
-
* document text and told exactly which line to cite, the model produced
|
|
708
|
-
* offsets that landed on the WRONG line four times out of four, then missed
|
|
709
|
-
* again on a second attempt after being shown the text its offsets had
|
|
710
|
-
* selected. Character arithmetic is not something this model class does.
|
|
711
|
-
*
|
|
712
|
-
* What it DOES do reliably is read the value: all four `claim` fields in that
|
|
713
|
-
* same run were correct to the cent. So the model names the value it read and
|
|
714
|
-
* the PLATFORM finds it. Both failure modes close at once —
|
|
715
|
-
*
|
|
716
|
-
* - the quote cannot be invented, because the platform slices it;
|
|
717
|
-
* - the span cannot be mis-addressed, because the platform computed it from
|
|
718
|
-
* a needle it PROVED occurs in the text.
|
|
719
|
-
*
|
|
720
|
-
* A needle that is not in the document is refused, which is the same fail-loud
|
|
721
|
-
* posture as a quote that does not occur — and correctly so: the model is
|
|
722
|
-
* asserting the document says something it does not.
|
|
723
|
-
*
|
|
724
|
-
* The cited span is the whole LINE, not the needle: "128,450.00" alone is not
|
|
725
|
-
* a click target a reviewer can judge, whereas the line it sits on says what
|
|
726
|
-
* the number IS. Number-only needles are common and deliberately supported.
|
|
727
|
-
*/
|
|
728
|
-
type SourceFindFailure = {
|
|
729
|
-
reason: 'blank_needle';
|
|
730
|
-
} | {
|
|
731
|
-
reason: 'not_found';
|
|
732
|
-
} | {
|
|
733
|
-
reason: 'occurrence_out_of_range';
|
|
734
|
-
found: number;
|
|
735
|
-
} | {
|
|
736
|
-
reason: 'not_distinctive';
|
|
737
|
-
needle: string;
|
|
738
|
-
found: number;
|
|
739
|
-
};
|
|
740
|
-
type SourceFindResult = {
|
|
741
|
-
ok: true;
|
|
742
|
-
span: {
|
|
743
|
-
start: number;
|
|
744
|
-
end: number;
|
|
745
|
-
};
|
|
746
|
-
quote: string;
|
|
747
|
-
occurrences: number;
|
|
748
|
-
} | {
|
|
749
|
-
ok: false;
|
|
750
|
-
failure: SourceFindFailure;
|
|
751
|
-
};
|
|
752
|
-
declare function findSourceLine(sourceText: string, needle: string, occurrence?: number): SourceFindResult;
|
|
753
|
-
/** Resolve `[start, end)` against `sourceText`. Every rejection is a caller
|
|
754
|
-
* mistake the model can correct from the paged read it already has, so each
|
|
755
|
-
* carries the discriminator a tool layer turns into a specific message. */
|
|
756
|
-
declare function sliceSourceSpan(sourceText: string, span: {
|
|
757
|
-
start: number;
|
|
758
|
-
end: number;
|
|
759
|
-
}): SourceSpanResult;
|
|
760
|
-
|
|
761
|
-
/**
|
|
762
|
-
* Framework-neutral work-product review endpoints — the
|
|
763
|
-
* `createInteractionAnswerRoute` factory pattern: web-standard
|
|
764
|
-
* `Request`/`Response`, ONE product-supplied `authorize` seam (session auth,
|
|
765
|
-
* workspace access, reviewer identity, rate limits), everything behind it
|
|
766
|
-
* mechanism. Server-only and subpath-only: never reachable from a client
|
|
767
|
-
* bundle (enforced by the browser-safety test).
|
|
768
|
-
*
|
|
769
|
-
* The verdict endpoint is deliberately NOT a second approval broker: agent
|
|
770
|
-
* asks stay on `/interactions`; this is the REVIEWER's plain authorized
|
|
771
|
-
* verdict on a ready package — one human-in-the-loop channel per direction.
|
|
772
|
-
* A `request_changes` note re-enters chat as the correction turn via the
|
|
773
|
-
* `onVerdict` seam; chat remains the driver surface.
|
|
774
|
-
*/
|
|
775
|
-
|
|
776
|
-
/** Reviewer verdict wire body for the POST endpoint. */
|
|
777
|
-
type WorkProductVerdictBody = {
|
|
778
|
-
ok: true;
|
|
779
|
-
id: string;
|
|
780
|
-
verdict: 'approve';
|
|
781
|
-
note?: string;
|
|
782
|
-
} | {
|
|
783
|
-
ok: true;
|
|
784
|
-
id: string;
|
|
785
|
-
verdict: 'request_changes';
|
|
786
|
-
note: string;
|
|
787
|
-
} | {
|
|
788
|
-
ok: false;
|
|
789
|
-
error: string;
|
|
790
|
-
};
|
|
791
|
-
/** Validate the verdict POST body: `{ id, verdict, note? }`; a
|
|
792
|
-
* `request_changes` verdict REQUIRES a non-empty note — the note IS the
|
|
793
|
-
* correction turn the agent works from. */
|
|
794
|
-
declare function validateWorkProductVerdictBody(body: Record<string, unknown>): WorkProductVerdictBody;
|
|
795
|
-
/** The product seam's verdict for one request: authenticated reviewer +
|
|
796
|
-
* workspace, or a product-authored short-circuit Response (401/403/429…). */
|
|
797
|
-
type WorkProductRouteAuthorization = {
|
|
798
|
-
ok: true;
|
|
799
|
-
workspaceId: string;
|
|
800
|
-
reviewedBy: string;
|
|
801
|
-
} | {
|
|
802
|
-
ok: false;
|
|
803
|
-
response: Response;
|
|
804
|
-
};
|
|
805
|
-
/** Auth seam arguments carrying the request, the endpoint intent, and the parsed verdict body */
|
|
806
|
-
interface WorkProductAuthorizeArgs {
|
|
807
|
-
request: Request;
|
|
808
|
-
intent: 'list' | 'detail' | 'verdict';
|
|
809
|
-
/** The parsed, validated POST body (verdict intent only). */
|
|
810
|
-
body?: Record<string, unknown>;
|
|
811
|
-
}
|
|
812
|
-
/** Configuration options assembling the review endpoints from the store and product seams */
|
|
813
|
-
interface WorkProductRoutesOptions {
|
|
814
|
-
store: WorkProductStorePort;
|
|
815
|
-
/** Authenticate + authorize the caller; the ONLY product access step. */
|
|
816
|
-
authorize: (args: WorkProductAuthorizeArgs) => Promise<WorkProductRouteAuthorization>;
|
|
817
|
-
/** Post-verdict product seam: post the `request_changes` note into the
|
|
818
|
-
* driving chat thread as the correction turn, notify, etc. Runs after the
|
|
819
|
-
* transition commits; a throw is logged, never unwinds the verdict. */
|
|
820
|
-
onVerdict?: (args: {
|
|
821
|
-
record: WorkProductRecord;
|
|
822
|
-
verdict: 'approve' | 'request_changes';
|
|
823
|
-
note?: string;
|
|
824
|
-
reviewedBy: string;
|
|
825
|
-
}) => void | Promise<void>;
|
|
826
|
-
/** Persist/update the transcript anchor part reflecting the new status, so
|
|
827
|
-
* the chat card flips with the verdict. */
|
|
828
|
-
persistAnchorPart?: (part: WorkProductPersistedPart, record: WorkProductRecord) => void | Promise<void>;
|
|
829
|
-
/** Future integration point fired on approval (push to a DMS/CRM/export
|
|
830
|
-
* pipeline). A stub seam by design — export itself stays the product's
|
|
831
|
-
* signed object-store download. */
|
|
832
|
-
onExport?: (record: WorkProductRecord) => void | Promise<void>;
|
|
833
|
-
logger?: Pick<Console, 'warn' | 'error'>;
|
|
834
|
-
now?: () => number;
|
|
835
|
-
}
|
|
836
|
-
/** Assembled review endpoints returning web-standard Responses */
|
|
837
|
-
interface WorkProductRoutes {
|
|
838
|
-
/** GET — the workspace's records for the queue projection. Optional
|
|
839
|
-
* `?status=a,b` filter. */
|
|
840
|
-
list: (request: Request) => Promise<Response>;
|
|
841
|
-
/** GET — one record by id (404 when absent or outside the workspace). */
|
|
842
|
-
detail: (request: Request, id: string) => Promise<Response>;
|
|
843
|
-
/** POST `{ id, verdict, note? }` — the reviewer verdict: CAS transition +
|
|
844
|
-
* history entry + product seams. 409 when the record is no longer ready. */
|
|
845
|
-
verdict: (request: Request) => Promise<Response>;
|
|
846
|
-
}
|
|
847
|
-
/** Create the work-product review endpoints over the store port and product seams */
|
|
848
|
-
declare function createWorkProductRoutes(options: WorkProductRoutesOptions): WorkProductRoutes;
|
|
849
|
-
|
|
850
|
-
export { ARTIFACT_AGREEMENT_CHECK, type ArtifactAgreement, CLAIM_SUPPORT_CHECK, type ClaimSupport, type ConfusableTargetGroup, type CreateWorkProductInput, EVIDENCE_COVERAGE_CHECK, EvidenceEntry, ExceptionEntry, type FinalizeWorkProductProvenanceInput, type InMemoryWorkProductStore, MAX_WORK_PRODUCT_BATCH, QUOTE_VERIFICATION_CHECK, QualityCheck, type SourceFindFailure, type SourceFindResult, type SourceSpanFailure, type SourceSpanResult, type SubmitWorkProductInput, TARGET_CORRECTNESS_CHECK, type TargetLabelVerdict, TrustItem, WorkProductArtifact, WorkProductAuditEvent, type WorkProductAuthorizeArgs, type WorkProductOutcome, WorkProductPersistedPart, WorkProductProvenance, type WorkProductProvenanceBase, WorkProductRecord, type WorkProductRouteAuthorization, type WorkProductRoutes, type WorkProductRoutesOptions, type WorkProductService, type WorkProductServiceOptions, WorkProductStatus, WorkProductStorePort, type WorkProductToolConfig, type WorkProductVerdictBody, type WorkProductVerdictInput, artifactAgreementErrorDetail, buildWorkProductTools, canTransitionWorkProduct, canonicalizeValue, claimSupportErrorDetail, claimValues, createInMemoryWorkProductStore, createWorkProductRoutes, createWorkProductService, finalizeWorkProductProvenance, findSourceLine, indexArtifactValues, isWorkProductTerminal, normalizeQuoteText, sliceSourceSpan, sourceContainsQuote, stampProvenance, targetLabelErrorDetail, validateWorkProductVerdictBody, valuesInText, verifyArtifactAgreement, verifyClaimSupport, verifyTargetLabel, workProductTrustInputs };
|
|
2
|
+
* `./work-product` — the reviewable work-product vertical: artifact +
|
|
3
|
+
* evidence map (source→field lineage) + exceptions + quality checks +
|
|
4
|
+
* version history + run provenance, produced by an agent through the
|
|
5
|
+
* schema-validated tool side channel and signed off by a professional
|
|
6
|
+
* through the verdict route. The review queue is a pure projection over
|
|
7
|
+
* this row plus existing sources (`/chat-store` threads, `/interactions`
|
|
8
|
+
* asks); chat stays the driver surface.
|
|
9
|
+
*/
|
|
10
|
+
export * from './types';
|
|
11
|
+
export * from './service';
|
|
12
|
+
export * from './tools';
|
|
13
|
+
export * from './quote';
|
|
14
|
+
export * from './claim-support';
|
|
15
|
+
export * from './queue';
|
|
16
|
+
export * from './route';
|
|
17
|
+
export * from './provenance';
|