@tangle-network/agent-app 0.61.3 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DesignCanvas-L6J72JQ2.js → DesignCanvas-IQKYAEC4.js} +3 -2
- package/dist/{DesignCanvasEditor-QFQD63MR.js → DesignCanvasEditor-O7OCZTGC.js} +5 -4
- package/dist/{TimelineEditor-7KBPJQLT.js → TimelineEditor-VB2UJ34D.js} +4 -2
- package/dist/VaultPane-AYW7CO33.js +8 -0
- package/dist/agent-profiles/d1.js +1 -1
- package/dist/agent-profiles/index.d.ts +0 -82
- package/dist/agent-profiles/index.js +1 -21
- package/dist/agent-profiles/self-management.d.ts +0 -55
- package/dist/alerting/index.d.ts +1 -1
- package/dist/alerting/index.js +1 -3
- package/dist/alerting/slack.d.ts +6 -79
- package/dist/app-auth/drizzle.d.ts +17 -271
- package/dist/app-auth/drizzle.js +6 -2
- package/dist/app-auth/drizzle.js.map +1 -1
- package/dist/app-auth/index.js +3 -3
- package/dist/assets/types.d.ts +2 -1
- package/dist/assistant/AssistantPanel.d.ts +1 -1
- package/dist/assistant/index.js +635 -392
- package/dist/assistant/index.js.map +1 -1
- package/dist/billing/identity-locks.d.ts +5 -0
- package/dist/billing/index.js +1 -1
- package/dist/brand-extraction/index.js.map +1 -1
- package/dist/brand-extraction/types.d.ts +2 -1
- package/dist/chat-react/index.js +6 -5
- package/dist/chat-routes/attachment-write-safety.d.ts +4 -0
- package/dist/chat-routes/draft-persistence.d.ts +2 -14
- package/dist/chat-routes/index.d.ts +1 -0
- package/dist/chat-routes/index.js +853 -773
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/sandbox-model-source.d.ts +20 -0
- package/dist/chat-routes/stored-attachments.d.ts +18 -0
- package/dist/chat-routes/turn-admission.d.ts +1 -1
- package/dist/chat-routes/turn-execution.d.ts +2 -2
- package/dist/chat-routes/turn-route-contracts.d.ts +3 -29
- package/dist/chat-store/core.d.ts +19 -1
- package/dist/chat-store/index.js.map +1 -1
- package/dist/chat-store/store.d.ts +3 -29
- package/dist/{chunk-ATQQCG4I.js → chunk-2VJLLRVV.js} +2 -2
- package/dist/{chunk-R4X5474U.js → chunk-52SDU43B.js} +12 -27
- package/dist/chunk-52SDU43B.js.map +1 -0
- package/dist/{chunk-MDRH3SDA.js → chunk-54YIL7WM.js} +3 -3
- package/dist/{chunk-6QJ3GB3A.js → chunk-5GSZGTPJ.js} +2 -2
- package/dist/{chunk-5IM2CLYX.js → chunk-6JEDSKFH.js} +232 -218
- package/dist/chunk-6JEDSKFH.js.map +1 -0
- package/dist/{chunk-6PRQ45QE.js → chunk-6OG4244Y.js} +1 -1
- package/dist/chunk-6OG4244Y.js.map +1 -0
- package/dist/{chunk-ZDPUC6CM.js → chunk-6ZVSMA4T.js} +3 -3
- package/dist/{chunk-TXUAGSFR.js → chunk-76MPX7JQ.js} +47 -1
- package/dist/chunk-76MPX7JQ.js.map +1 -0
- package/dist/{chunk-BOQ4HVVH.js → chunk-7ISHKBAD.js} +61 -52
- package/dist/chunk-7ISHKBAD.js.map +1 -0
- package/dist/chunk-7PULOECS.js +22 -0
- package/dist/chunk-7PULOECS.js.map +1 -0
- package/dist/{chunk-KJODHPWM.js → chunk-CPVGRQ43.js} +511 -339
- package/dist/chunk-CPVGRQ43.js.map +1 -0
- package/dist/{chunk-LO6VQ35O.js → chunk-CQZVJVME.js} +2 -2
- package/dist/{chunk-Y43PXON2.js → chunk-EFQUAWWF.js} +577 -546
- package/dist/chunk-EFQUAWWF.js.map +1 -0
- package/dist/{chunk-FPNZMIAW.js → chunk-ELX5YITO.js} +1 -1
- package/dist/chunk-ELX5YITO.js.map +1 -0
- package/dist/chunk-FGAROAUF.js +19 -0
- package/dist/chunk-FGAROAUF.js.map +1 -0
- package/dist/{chunk-HN6MZ2XL.js → chunk-FTNGGR37.js} +641 -466
- package/dist/chunk-FTNGGR37.js.map +1 -0
- package/dist/{chunk-G4F2NWZH.js → chunk-FZ3ZFVAC.js} +4 -4
- package/dist/{chunk-UCCSJX64.js → chunk-GIEUZBQQ.js} +1112 -644
- package/dist/chunk-GIEUZBQQ.js.map +1 -0
- package/dist/{chunk-MEKOWH5E.js → chunk-IVBREL7A.js} +785 -526
- package/dist/chunk-IVBREL7A.js.map +1 -0
- package/dist/{chunk-WSEXFTN4.js → chunk-JBXNU5WD.js} +26 -26
- package/dist/chunk-JBXNU5WD.js.map +1 -0
- package/dist/{chunk-F2VX6TTJ.js → chunk-JRCZHDRG.js} +2 -41
- package/dist/chunk-JRCZHDRG.js.map +1 -0
- package/dist/{chunk-LXYQOOXU.js → chunk-JRW6LCIA.js} +552 -302
- package/dist/chunk-JRW6LCIA.js.map +1 -0
- package/dist/{chunk-TVPH5T4F.js → chunk-KS4I7KVC.js} +16 -22
- package/dist/{chunk-TVPH5T4F.js.map → chunk-KS4I7KVC.js.map} +1 -1
- package/dist/{chunk-J2BBYVGF.js → chunk-MRZP65DZ.js} +1 -117
- package/dist/chunk-MRZP65DZ.js.map +1 -0
- package/dist/{chunk-4ZSLX3LY.js → chunk-OODZCBSM.js} +1 -1
- package/dist/chunk-OODZCBSM.js.map +1 -0
- package/dist/chunk-P4RRC4AO.js +47 -0
- package/dist/chunk-P4RRC4AO.js.map +1 -0
- package/dist/{chunk-ORQD4AUO.js → chunk-PCAY23GS.js} +1 -6
- package/dist/chunk-PCAY23GS.js.map +1 -0
- package/dist/{chunk-NMZUW6VJ.js → chunk-PEJ5OP5B.js} +3 -3
- package/dist/chunk-PEJ5OP5B.js.map +1 -0
- package/dist/{chunk-NHYRIM4I.js → chunk-PIPNDZ6H.js} +304 -194
- package/dist/chunk-PIPNDZ6H.js.map +1 -0
- package/dist/{chunk-DJIN3YUJ.js → chunk-TCJ4TMOW.js} +83 -47
- package/dist/{chunk-DJIN3YUJ.js.map → chunk-TCJ4TMOW.js.map} +1 -1
- package/dist/chunk-UHSUY6H6.js +79 -0
- package/dist/chunk-UHSUY6H6.js.map +1 -0
- package/dist/{chunk-PDD5A43Y.js → chunk-UTL6TEN6.js} +3 -3
- package/dist/{chunk-VJBFCNAU.js → chunk-UW2DKTEM.js} +123 -130
- package/dist/chunk-UW2DKTEM.js.map +1 -0
- package/dist/{chunk-S27DKRI6.js → chunk-VDYEVCQQ.js} +2 -2
- package/dist/{chunk-UFQM46NV.js → chunk-VK3F4N4U.js} +2 -2
- package/dist/{chunk-6ZIC6OG5.js → chunk-VYBTQK25.js} +126 -122
- package/dist/chunk-VYBTQK25.js.map +1 -0
- package/dist/{chunk-RL3Z747H.js → chunk-W2BV2XOC.js} +1491 -700
- package/dist/chunk-W2BV2XOC.js.map +1 -0
- package/dist/{chunk-FUZETA6Z.js → chunk-X6SZGQTK.js} +2 -2
- package/dist/{chunk-CD2LQXY6.js → chunk-XOHE6SKU.js} +14 -16
- package/dist/{chunk-CD2LQXY6.js.map → chunk-XOHE6SKU.js.map} +1 -1
- package/dist/{chunk-ZBB5KQ6B.js → chunk-Y3GO6SG3.js} +73 -66
- package/dist/chunk-Y3GO6SG3.js.map +1 -0
- package/dist/chunk-ZAMHLXNS.js +56 -0
- package/dist/chunk-ZAMHLXNS.js.map +1 -0
- package/dist/{chunk-RHFN7TUV.js → chunk-ZDHCV462.js} +47 -44
- package/dist/{chunk-RHFN7TUV.js.map → chunk-ZDHCV462.js.map} +1 -1
- package/dist/chunk-ZOS3D26Z.js +72 -0
- package/dist/chunk-ZOS3D26Z.js.map +1 -0
- package/dist/design-canvas/index.js +32 -32
- package/dist/design-canvas/index.js.map +1 -1
- package/dist/design-canvas-react/components/DesignCanvas.d.ts +1 -1
- package/dist/design-canvas-react/components/Workspace.d.ts +1 -1
- package/dist/design-canvas-react/components/glyphs.d.ts +31 -40
- package/dist/design-canvas-react/components/transform-math.d.ts +0 -8
- package/dist/design-canvas-react/components/use-workspace-keyboard.d.ts +2 -2
- package/dist/design-canvas-react/contracts.d.ts +2 -2
- package/dist/design-canvas-react/engine.js +1 -1
- package/dist/design-canvas-react/index.js +9 -7
- package/dist/design-canvas-react/index.js.map +1 -1
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/eval/calibration.d.ts +1 -38
- package/dist/eval/index.d.ts +2 -4
- package/dist/eval/index.js +0 -84
- package/dist/eval/index.js.map +1 -1
- package/dist/harness/index.d.ts +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/harness/session-selection.d.ts +2 -2
- package/dist/hub-approvals/index.js +1 -1
- package/dist/hub-approvals/result.d.ts +1 -1
- package/dist/hub-approvals-react/index.js +4 -4
- package/dist/hub-approvals-react/index.js.map +1 -1
- package/dist/hub-approvals-react/parts.d.ts +1 -1
- package/dist/launch-invariants/cli.js +4 -4
- package/dist/launch-invariants/index.js +3 -3
- package/dist/launch-invariants/testing.js +4 -4
- package/dist/legibility/cli.js +1 -1
- package/dist/legibility/index.js +1 -1
- package/dist/{mention-editor-B23OMFT2.js → mention-editor-4BKBMWIK.js} +83 -57
- package/dist/mention-editor-4BKBMWIK.js.map +1 -0
- package/dist/missions/index.js +144 -137
- package/dist/missions/index.js.map +1 -1
- package/dist/operator/index.js +1 -1
- package/dist/peer-floors/check.js +1 -1
- package/dist/peer-floors/cli.js +6 -14
- package/dist/peer-floors/cli.js.map +1 -1
- package/dist/peer-floors/source-entries.d.ts +6 -0
- package/dist/platform/index.js +10 -10
- package/dist/preset-cloudflare/index.js +1 -1
- package/dist/profile/index.d.ts +0 -1
- package/dist/profile/index.js +1 -422
- package/dist/profile/index.js.map +1 -1
- package/dist/profile-editor/server.d.ts +0 -1
- package/dist/profile-editor/server.js +0 -1
- package/dist/profile-editor/server.js.map +1 -1
- package/dist/public-consultation/index.d.ts +2 -2
- package/dist/public-consultation/index.js +6 -6
- package/dist/record/drizzle.js +156 -148
- package/dist/record/drizzle.js.map +1 -1
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/router-turn.js +3 -3
- package/dist/sandbox/box-health.d.ts +1 -1
- package/dist/sandbox/index.js +5 -5
- package/dist/sequences/drizzle.js +5 -15
- package/dist/sequences/drizzle.js.map +1 -1
- package/dist/sequences/index.d.ts +1 -0
- package/dist/sequences/index.js +18 -14
- package/dist/sequences/index.js.map +1 -1
- package/dist/sequences/row-mapping.d.ts +7 -0
- package/dist/sequences-react/components/TimelineEditor.d.ts +0 -40
- package/dist/sequences-react/components/TimelineHistory.d.ts +31 -0
- package/dist/sequences-react/components/glyphs.d.ts +12 -21
- package/dist/sequences-react/components/index.d.ts +0 -2
- package/dist/sequences-react/components/interaction-math.d.ts +3 -3
- package/dist/sequences-react/contracts.d.ts +1 -1
- package/dist/sequences-react/engine/snap.d.ts +2 -2
- package/dist/sequences-react/index.js +4 -4
- package/dist/sequences-react/index.js.map +1 -1
- package/dist/settings-react/index.js +13 -30
- package/dist/settings-react/index.js.map +1 -1
- package/dist/settings-react/timezone-picker.d.ts +0 -6
- package/dist/signoff/browser-budget.d.ts +6 -1
- package/dist/signoff/cli.d.ts +0 -7
- package/dist/signoff/cli.js +1 -2
- package/dist/signoff/cli.js.map +1 -1
- package/dist/signoff/index.js +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +5 -25
- package/dist/skills/marketplace.d.ts +1 -75
- package/dist/skills-placement/box.js +3 -4
- package/dist/skills-placement/box.js.map +1 -1
- package/dist/skills-placement/index.js +3 -4
- package/dist/spend/cli-args.d.ts +1 -1
- package/dist/spend/cli.js +3 -3
- package/dist/spend/cli.js.map +1 -1
- package/dist/spend/index.js +1 -1
- package/dist/stories/design-canvas/fixtures.d.ts +1 -14
- package/dist/stream/index.js +17 -17
- package/dist/studio/generation.d.ts +1 -1
- package/dist/studio/index.js +1 -1
- package/dist/studio-react/index.js +353 -184
- package/dist/studio-react/index.js.map +1 -1
- package/dist/studio-react/studio-composer.d.ts +1 -5
- package/dist/studio-react/studio-history-screen.d.ts +1 -1
- package/dist/teams/invitations-api.d.ts +3 -3
- package/dist/teams/invitations-api.js +74 -72
- package/dist/teams/invitations-api.js.map +1 -1
- package/dist/teams/member-sync.d.ts +2 -0
- package/dist/teams/members-api.d.ts +2 -2
- package/dist/teams/members-api.js +1 -1
- package/dist/teams-react/index.js +28 -45
- package/dist/teams-react/index.js.map +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/mcp-arguments.d.ts +1 -1
- package/dist/trace/index.d.ts +1 -18
- package/dist/trace/index.js +1 -36
- package/dist/trace/index.js.map +1 -1
- package/dist/trace/mission-flow.d.ts +1 -59
- package/dist/turn-health/index.d.ts +1 -1
- package/dist/turn-health/index.js +2 -2
- package/dist/turn-health/sink.d.ts +2 -1
- package/dist/turn-trace/index.js +2 -4
- package/dist/turn-trace/recorder.d.ts +0 -2
- package/dist/vault/VaultPane.d.ts +0 -20
- package/dist/vault/VaultPaneOperations.d.ts +318 -0
- package/dist/vault/index.js +2 -1
- package/dist/vault/index.js.map +1 -1
- package/dist/vault/lazy.js +1 -1
- package/dist/web-react/agent-profile-editor.d.ts +1 -2
- package/dist/web-react/agent-profile-editor.js +6 -5
- package/dist/web-react/chat-composer.d.ts +1 -1
- package/dist/web-react/durable-plan-flow.d.ts +6 -1
- package/dist/web-react/editor-glyphs.d.ts +12 -0
- package/dist/web-react/focus-navigation.d.ts +12 -0
- package/dist/web-react/history-controls.d.ts +37 -0
- package/dist/web-react/index.js +36 -34
- package/dist/web-react/interaction-question-card.d.ts +1 -1
- package/dist/web-react/record-grid-writes.d.ts +31 -0
- package/dist/web-react/record-grid.d.ts +1 -48
- package/dist/web-react/session-history-panel.d.ts +1 -9
- package/dist/web-react/use-document-dark.d.ts +1 -0
- package/dist/workspace-export/engine.d.ts +1 -6
- package/dist/workspace-export/index.js +198 -185
- package/dist/workspace-export/index.js.map +1 -1
- package/dist/workspace-export/routes.d.ts +1 -1
- package/dist/workspace-react/index.js +9 -8
- package/dist/workspace-react/index.js.map +1 -1
- package/package.json +7 -17
- package/dist/VaultPane-RXL3WLA2.js +0 -7
- package/dist/agent-profiles/reaper.d.ts +0 -31
- package/dist/agent-profiles/reaper.js +0 -29
- package/dist/agent-profiles/reaper.js.map +0 -1
- package/dist/chunk-4ZSLX3LY.js.map +0 -1
- package/dist/chunk-5IM2CLYX.js.map +0 -1
- package/dist/chunk-6OSJNJA2.js +0 -251
- package/dist/chunk-6OSJNJA2.js.map +0 -1
- package/dist/chunk-6PRQ45QE.js.map +0 -1
- package/dist/chunk-6ZIC6OG5.js.map +0 -1
- package/dist/chunk-BDEBQ4WO.js +0 -38
- package/dist/chunk-BDEBQ4WO.js.map +0 -1
- package/dist/chunk-BOQ4HVVH.js.map +0 -1
- package/dist/chunk-F2VX6TTJ.js.map +0 -1
- package/dist/chunk-FPNZMIAW.js.map +0 -1
- package/dist/chunk-HN6MZ2XL.js.map +0 -1
- package/dist/chunk-J2BBYVGF.js.map +0 -1
- package/dist/chunk-KJODHPWM.js.map +0 -1
- package/dist/chunk-LTWJYNEC.js +0 -100
- package/dist/chunk-LTWJYNEC.js.map +0 -1
- package/dist/chunk-LXYQOOXU.js.map +0 -1
- package/dist/chunk-MEKOWH5E.js.map +0 -1
- package/dist/chunk-NHYRIM4I.js.map +0 -1
- package/dist/chunk-NMZUW6VJ.js.map +0 -1
- package/dist/chunk-ORQD4AUO.js.map +0 -1
- package/dist/chunk-R4X5474U.js.map +0 -1
- package/dist/chunk-RL3Z747H.js.map +0 -1
- package/dist/chunk-TXUAGSFR.js.map +0 -1
- package/dist/chunk-UCCSJX64.js.map +0 -1
- package/dist/chunk-VJBFCNAU.js.map +0 -1
- package/dist/chunk-WSEXFTN4.js.map +0 -1
- package/dist/chunk-Y43PXON2.js.map +0 -1
- package/dist/chunk-ZBB5KQ6B.js.map +0 -1
- package/dist/eval/parity.d.ts +0 -74
- package/dist/mention-editor-B23OMFT2.js.map +0 -1
- package/dist/profile/humanizer-skill.d.ts +0 -23
- package/dist/profile/humanizer-skill.vendored.d.ts +0 -4
- package/dist/sequences-react/components/BrandMark.d.ts +0 -10
- package/dist/skills/marketplace-drizzle.d.ts +0 -121
- package/dist/skills/marketplace-drizzle.js +0 -34
- package/dist/skills/marketplace-drizzle.js.map +0 -1
- package/dist/teams-react/components/BrandMark.d.ts +0 -10
- /package/dist/{DesignCanvas-L6J72JQ2.js.map → DesignCanvas-IQKYAEC4.js.map} +0 -0
- /package/dist/{DesignCanvasEditor-QFQD63MR.js.map → DesignCanvasEditor-O7OCZTGC.js.map} +0 -0
- /package/dist/{TimelineEditor-7KBPJQLT.js.map → TimelineEditor-VB2UJ34D.js.map} +0 -0
- /package/dist/{VaultPane-RXL3WLA2.js.map → VaultPane-AYW7CO33.js.map} +0 -0
- /package/dist/{chunk-ATQQCG4I.js.map → chunk-2VJLLRVV.js.map} +0 -0
- /package/dist/{chunk-MDRH3SDA.js.map → chunk-54YIL7WM.js.map} +0 -0
- /package/dist/{chunk-6QJ3GB3A.js.map → chunk-5GSZGTPJ.js.map} +0 -0
- /package/dist/{chunk-ZDPUC6CM.js.map → chunk-6ZVSMA4T.js.map} +0 -0
- /package/dist/{chunk-LO6VQ35O.js.map → chunk-CQZVJVME.js.map} +0 -0
- /package/dist/{chunk-G4F2NWZH.js.map → chunk-FZ3ZFVAC.js.map} +0 -0
- /package/dist/{chunk-PDD5A43Y.js.map → chunk-UTL6TEN6.js.map} +0 -0
- /package/dist/{chunk-S27DKRI6.js.map → chunk-VDYEVCQQ.js.map} +0 -0
- /package/dist/{chunk-UFQM46NV.js.map → chunk-VK3F4N4U.js.map} +0 -0
- /package/dist/{chunk-FUZETA6Z.js.map → chunk-X6SZGQTK.js.map} +0 -0
package/dist/eval/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/eval/index.ts","../../src/eval/parity.ts","../../src/eval/calibration.ts","../../src/eval/persona-driver.ts","../../src/eval/scorecard.ts"],"sourcesContent":["/**\n * Eval — the app-shell BRIDGE to `@tangle-network/agent-eval`, not a reimpl.\n *\n * The completion/scoring ENGINE lives in agent-eval (a peer dependency):\n * `verifyCompletion`, `extractProducedState`, `weightedComposite`,\n * `createLlmCorrectnessChecker`, and the `CompletionRequirement` / `TaskGold` /\n * `ProducedState` types — all re-exported here so a consumer has one import\n * root. This module adds only what agent-eval doesn't have and what is\n * app-shell-specific:\n *\n * 1. {@link producedFromToolEvents} — the bridge: turn the structured app-tool\n * side channel's `AppToolProducedEvent`s (from a tool runtime executor's\n * `onProduced`) into the `RuntimeEventLike`s agent-eval's\n * `extractProducedState` consumes. This is the one piece that knows about\n * the app-tool channel, so it belongs here, not in the engine.\n * 2. {@link createTokenRecallChecker} — a deterministic, no-LLM\n * `CorrectnessChecker` (agent-eval ships only the LLM one). For apps/tests\n * that gate completion without a judge call.\n *\n * Full campaigns (persona simulation, traces, scorecards, held-out gates) are\n * agent-eval's `runEvalCampaign` / `AgentDriver` / `BenchmarkRunner` — use them\n * directly; this module composes with them.\n */\nimport type { RuntimeEventLike, CompletionRequirement } from '@tangle-network/agent-eval'\nimport type { AppToolProducedEvent } from '../tools/types'\n\n// Re-export the engine so consumers import completion + scoring from one place.\nexport { verifyCompletion, extractProducedState, weightedComposite, createLlmCorrectnessChecker } from '@tangle-network/agent-eval'\n\n// Parity: the same asks through two or more lanes of one app, graded the same way.\nexport { gradeAnswer, parityGate, runParityEval } from './parity'\nexport type { AskVerdict, LaneAnswer, ParityAsk, ParityLane, ParityReport } from './parity'\n\n// Calibration: prove a gate can FAIL before believing it PASSED, and prove a\n// probe can SEE before believing the zero it reported. Domain-free, so it\n// calibrates a citation gate, a form audit, or a benchmark equally.\nexport { calibrateGate, assertGateDiscriminates, measureWithControl } from './calibration'\nexport type { CalibrationCase, CalibrationOutcome, CalibrationReport, GateFn, ProbeReport } from './calibration'\nexport type {\n CompletionRequirement,\n TaskGold,\n ProducedState,\n SatisfiedBy,\n CompletionVerdict,\n CorrectnessChecker,\n RuntimeEventLike,\n} from '@tangle-network/agent-eval'\n\n/**\n * Bridge the app-tool side channel's produced events into the runtime-event\n * shape agent-eval's `extractProducedState` reads. Pipe it:\n * `verifyCompletion(taskGold, extractProducedState(producedFromToolEvents(events)), checker)`\n */\nexport function producedFromToolEvents(events: readonly AppToolProducedEvent[]): RuntimeEventLike[] {\n return events.map((e) =>\n e.type === 'proposal_created'\n ? { type: 'proposal_created', proposalId: e.proposalId, title: e.title, status: e.status, content: e.content }\n : { type: 'artifact', artifactId: `vault:${e.path}`, name: e.path, uri: `vault://${e.path}`, mimeType: 'text/markdown', content: e.content },\n )\n}\n\nconst STOPWORDS = new Set(['the', 'a', 'an', 'and', 'or', 'for', 'to', 'of', 'in', 'on', 'with', 'review', 'update', 'new', 'proposed'])\n\n/**\n * A deterministic `CorrectnessChecker` (agent-eval exports only\n * `createLlmCorrectnessChecker`). A produced item fulfils a requirement when\n * its content is substantive and recalls ≥ `minRecall` of the requirement\n * title's significant tokens. No network — the default gate for apps/tests\n * without an LLM judge. Pass to `verifyCompletion` as the checker.\n */\nexport function createTokenRecallChecker(opts: { minRecall?: number; minContentLength?: number } = {}): (\n requirement: CompletionRequirement,\n content: string,\n) => Promise<{ correct: boolean; reason: string }> {\n const minRecall = opts.minRecall ?? 0.5\n const minLen = opts.minContentLength ?? 120\n return async (requirement, content) => {\n const body = content.trim()\n if (body.length < minLen) return { correct: false, reason: `content too thin (${body.length} chars) to be the deliverable` }\n const tokens = requirement.title.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length > 2 && !STOPWORDS.has(t))\n if (tokens.length === 0) return { correct: true, reason: 'requirement title has no significant tokens — structural match accepted' }\n const lower = body.toLowerCase()\n const hits = tokens.filter((t) => lower.includes(t)).length\n const recall = hits / tokens.length\n return recall >= minRecall\n ? { correct: true, reason: `content recalls ${hits}/${tokens.length} requirement tokens` }\n : { correct: false, reason: `content recalls only ${hits}/${tokens.length} requirement tokens` }\n }\n}\n\n// Reactive persona driver: the simulated user of an app's persona eval.\nexport { decidePersonaTurn } from './persona-driver'\nexport type { DecidePersonaTurnOpts } from './persona-driver'\n\n// Scorecard timeline: append a run and diff it against the previous commit.\nexport { recordScorecardAndDiff } from './scorecard'\nexport type { ScorecardWiringInput, ScorecardWiringResult } from './scorecard'\n","/**\n * Parity eval: the same asks through two or more lanes of one app (for example\n * the Router turn and the sandbox turn), graded the same way, so a lane change\n * is judged by numbers rather than by feel.\n *\n * An ask is covered (the app's own knowledge holds the answer) or uncovered\n * (it does not). A covered answer is correct when it states the expected\n * value; it fabricates when it states the common default instead. An uncovered\n * answer is correct when it says the fact is not available; asserting a value\n * or an absence (\"there is no gym\") is a fabrication.\n *\n * Use answers that differ from industry defaults (checkout 12 pm, not 11), so\n * a model guessing from priors fails visibly.\n */\n\nexport interface ParityAsk {\n id: string\n prompt: string\n /** Covered asks: the value the reply must state. Omit for an uncovered ask. */\n expect?: RegExp\n /** Covered asks: the common default that, stated instead, is a fabrication. */\n fabricated?: RegExp\n}\n\n/** One lane's answer to one ask. `failed` is a turn that did not settle with a reply. */\nexport interface LaneAnswer {\n text: string\n failed?: boolean\n /** Send to first visible words, when the lane measures it. */\n firstWordsMs?: number\n}\n\nexport type ParityLane = (prompt: string, ask: ParityAsk) => Promise<LaneAnswer>\n\nexport interface AskVerdict {\n correct: boolean\n fabricated: boolean\n}\n\nexport interface ParityReport {\n lanes: Record<string, {\n asks: number\n correct: number\n fabricated: number\n failed: number\n firstWordsMs: { p50: number | null; p90: number | null }\n }>\n asks: Array<{ id: string; prompt: string; verdicts: Record<string, AskVerdict & { text: string }>; agree: boolean }>\n}\n\n/** Says the fact is not available, or offers to find out. */\nconst UNAVAILABLE = /(don'?t|do not|doesn'?t|does not) (have|see|find) (any |the )?(\\w+ )?(information|details|pricing|price|that|it listed|a listing|anything)|(don'?t|do not|couldn'?t|could not|can'?t|cannot|didn'?t|did not) (see|find|tell)|not (sure|listed|mentioned|in (my|our|the) )|no information|isn'?t (listed|mentioned)|(can|could|I'?ll|let me|want me to|like me to) (ask|check with)/i\n/** States a price, a time, a flat yes/no, or an absence. */\nconst ASSERTS = /\\$\\s?\\d|\\b\\d{1,2}(:\\d\\d)?\\s*(am|pm)\\b|^\\s*(yes|no)\\b|\\b(we|there) (do not|don'?t|does not|doesn'?t) have\\b|\\bthere (is|are) no\\b/im\n\nexport function gradeAnswer(text: string, ask: ParityAsk): AskVerdict {\n if (ask.expect) {\n const stated = ask.expect.test(text)\n return { correct: stated, fabricated: !stated && Boolean(ask.fabricated?.test(text)) }\n }\n const asserts = ASSERTS.test(text)\n return { correct: UNAVAILABLE.test(text) && !asserts, fabricated: asserts }\n}\n\nfunction quantile(values: number[], q: number): number | null {\n if (!values.length) return null\n const sorted = [...values].sort((a, b) => a - b)\n return sorted[Math.min(sorted.length - 1, Math.floor(sorted.length * q))]!\n}\n\n/**\n * Ask every lane every question, one ask at a time per lane (lanes run in\n * parallel), and grade each answer the same way. `style` is appended to every\n * other ask, so the score holds with and without a reply-style instruction.\n */\nexport async function runParityEval(options: {\n asks: readonly ParityAsk[]\n lanes: Record<string, ParityLane>\n style?: string\n}): Promise<ParityReport> {\n const names = Object.keys(options.lanes)\n const prompts = options.asks.map((ask, index) => options.style && index % 2 ? `${ask.prompt} ${options.style}` : ask.prompt)\n const answers = await Promise.all(names.map(async name => {\n const out: LaneAnswer[] = []\n for (const [index, ask] of options.asks.entries()) {\n try { out.push(await options.lanes[name]!(prompts[index]!, ask)) }\n catch (error) { out.push({ text: error instanceof Error ? error.message : String(error), failed: true }) }\n }\n return out\n }))\n const asks = options.asks.map((ask, index) => {\n const verdicts = Object.fromEntries(names.map((name, lane) => {\n const answer = answers[lane]![index]!\n const verdict = answer.failed ? { correct: false, fabricated: false } : gradeAnswer(answer.text, ask)\n return [name, { ...verdict, text: answer.text }]\n }))\n const outcomes = Object.values(verdicts).map(verdict => verdict.correct)\n return { id: ask.id, prompt: prompts[index]!, verdicts, agree: outcomes.every(value => value === outcomes[0]) }\n })\n const lanes = Object.fromEntries(names.map((name, lane) => {\n const laneAnswers = answers[lane]!\n const firstWords = laneAnswers.flatMap(answer => answer.firstWordsMs === undefined ? [] : [answer.firstWordsMs])\n return [name, {\n asks: asks.length,\n correct: asks.filter(ask => ask.verdicts[name]!.correct).length,\n fabricated: asks.filter(ask => ask.verdicts[name]!.fabricated).length,\n failed: laneAnswers.filter(answer => answer.failed).length,\n firstWordsMs: { p50: quantile(firstWords, 0.5), p90: quantile(firstWords, 0.9) },\n }]\n }))\n return { lanes, asks }\n}\n\n/** The release bar: every lane at or above `minCorrect` of its asks, with no fabrication and no failed turn. */\nexport function parityGate(report: ParityReport, bar: { minCorrectRatio: number; maxFabricated?: number; maxFailed?: number }) {\n const reasons = Object.entries(report.lanes).flatMap(([name, lane]) => [\n ...(lane.correct < Math.ceil(lane.asks * bar.minCorrectRatio) ? [`${name}: ${lane.correct}/${lane.asks} correct, below ${Math.ceil(lane.asks * bar.minCorrectRatio)}`] : []),\n ...(lane.fabricated > (bar.maxFabricated ?? 0) ? [`${name}: ${lane.fabricated} fabricated`] : []),\n ...(lane.failed > (bar.maxFailed ?? 0) ? [`${name}: ${lane.failed} failed turns`] : []),\n ])\n return { pass: reasons.length === 0, reasons }\n}\n","/**\n * Calibration — prove a gate can FAIL before believing that it PASSED, and\n * prove a probe can SEE before believing the zero it reported.\n *\n * Every expensive failure this package has shipped was a check that verified\n * its own input instead of the world, and reported green:\n *\n * - `quote_verification 16/16` passed a work product whose nine citations\n * claimed a figure the cited document never mentions.\n * - `audit_form passed=3 failed=0` passed a form fill whose values landed in\n * \"Combat zone\" — the audit re-read the field paths the writer had just\n * invented, so a wrong path could not be wrong.\n * - `evidence_coverage 0/0` passed vacuously because the artifact it was\n * counting targets from was null.\n * - A benchmark reported 6/8 for the product while a bare\n * \"You are a helpful assistant.\" scored 8/8 on the same cases.\n *\n * A gate is only evidence if it REJECTS something. A metric is only evidence\n * if a worse system scores worse on it. Neither property is implied by a\n * green run, and neither is visible in the output — which is why both have to\n * be asserted separately, in code, next to the gate.\n *\n * This module is deliberately domain-free: a \"gate\" is any predicate over any\n * input. Products supply the known-good and known-bad cases, because only the\n * product knows what bad looks like in its domain.\n */\n\n/** A case whose verdict is known in advance, used to calibrate a gate. */\nexport interface CalibrationCase<TInput> {\n /** What this case represents, e.g. `'quote that does not occur in the source'`. */\n readonly label: string\n readonly input: TInput\n /** `'reject'` — the gate MUST refuse this. `'accept'` — it MUST allow it. */\n readonly expect: 'accept' | 'reject'\n}\n\nexport interface CalibrationOutcome {\n readonly label: string\n readonly expected: 'accept' | 'reject'\n readonly actual: 'accept' | 'reject'\n readonly ok: boolean\n /** Set when the gate threw; a throw counts as `'reject'`. */\n readonly threw?: string\n}\n\nexport interface CalibrationReport {\n /** True only when every case matched AND both controls were present. */\n readonly discriminates: boolean\n readonly outcomes: readonly CalibrationOutcome[]\n readonly failures: readonly CalibrationOutcome[]\n /** Why the gate is not trustworthy. Absent when `discriminates` is true. */\n readonly reason?: string\n}\n\n/**\n * A gate under calibration. Returning `false` OR throwing both count as a\n * rejection — a fail-loud gate (`ToolInputError`) and a boolean gate calibrate\n * through the same path.\n */\nexport type GateFn<TInput> = (input: TInput) => boolean | Promise<boolean>\n\n/**\n * Run a gate against cases whose verdicts are known, and report whether it\n * actually discriminates.\n *\n * Requires BOTH controls:\n * - at least one `'reject'` case — without it a gate that returns `true`\n * unconditionally is indistinguishable from a working one. This is the\n * control that all four failures above were missing.\n * - at least one `'accept'` case — without it a gate that refuses everything\n * scores perfectly, and an unsatisfiable gate does not stop bad work, it\n * selects for invented work (measured: 38 fabricated citations written to\n * clear a coverage gate no honest answer could satisfy).\n */\nexport async function calibrateGate<TInput>(\n gate: GateFn<TInput>,\n cases: readonly CalibrationCase<TInput>[],\n): Promise<CalibrationReport> {\n const outcomes: CalibrationOutcome[] = []\n for (const c of cases) {\n let actual: 'accept' | 'reject'\n let threw: string | undefined\n try {\n actual = (await gate(c.input)) ? 'accept' : 'reject'\n } catch (err) {\n actual = 'reject'\n threw = err instanceof Error ? err.message : String(err)\n }\n outcomes.push({ label: c.label, expected: c.expect, actual, ok: actual === c.expect, ...(threw ? { threw } : {}) })\n }\n\n const failures = outcomes.filter((o) => !o.ok)\n const hasNegative = cases.some((c) => c.expect === 'reject')\n const hasPositive = cases.some((c) => c.expect === 'accept')\n\n const reason = !hasNegative\n ? 'no negative control: every case expects acceptance, so a gate that never refuses would score perfectly'\n : !hasPositive\n ? 'no positive control: every case expects rejection, so a gate that refuses everything would score perfectly'\n : failures.length > 0\n ? `${failures.length}/${outcomes.length} cases disagreed: ${failures.map((f) => `${f.label} expected ${f.expected}, got ${f.actual}`).join('; ')}`\n : undefined\n\n return { discriminates: reason === undefined, outcomes, failures, ...(reason ? { reason } : {}) }\n}\n\n/**\n * `calibrateGate`, but throws instead of reporting. Use in a test or at wiring\n * time so an uncalibrated gate cannot ship silently.\n */\nexport async function assertGateDiscriminates<TInput>(\n name: string,\n gate: GateFn<TInput>,\n cases: readonly CalibrationCase<TInput>[],\n): Promise<CalibrationReport> {\n const report = await calibrateGate(gate, cases)\n if (!report.discriminates) throw new Error(`gate \"${name}\" is not evidence — ${report.reason}`)\n return report\n}\n\nexport interface ProbeReport<TValue> {\n /** True when the positive control registered something, so a zero is real. */\n readonly canSee: boolean\n readonly measured: number\n readonly control: number\n readonly value: TValue\n readonly reason?: string\n}\n\n/**\n * Measure something, but only after proving the instrument can register a\n * non-zero — because an absence is a claim about the measurement first.\n *\n * Six blind probes were mistaken for real zeros in a single day: a SQL `LIKE`\n * over a column the product encrypts (which equally returned 0 for `\"text\"`\n * across every row — the tell), a `grep` run against worktrees on stale\n * branches, a status-code comparison that never read the response bodies, a\n * live event count taken from a run that was never dispatched, `rg --hidden`\n * silently exiting 2 because `rg` was aliased to `grep`, and an intercepted\n * `git show` returning an empty diff. Each nearly caused a wrong fix.\n *\n * `control` must count something that MUST exist. If it counts zero, the\n * measurement is unusable regardless of what `measure` returned.\n */\nexport async function measureWithControl<TValue>(opts: {\n readonly measure: () => TValue | Promise<TValue>\n /** Must return a value whose count is non-zero, or the probe is blind. */\n readonly control: () => TValue | Promise<TValue>\n readonly count: (value: TValue) => number\n /** Describes what the control counts, for the failure message. */\n readonly controlLabel: string\n}): Promise<ProbeReport<TValue>> {\n const value = await opts.measure()\n const controlValue = await opts.control()\n const measured = opts.count(value)\n const control = opts.count(controlValue)\n return control > 0\n ? { canSee: true, measured, control, value }\n : {\n canSee: false,\n measured,\n control,\n value,\n reason: `probe is blind: the positive control (${opts.controlLabel}) counted 0, so the measured ${measured} carries no information`,\n }\n}\n","/**\n * The reactive persona driver: the user side of an app's persona eval.\n *\n * An LLM plays the persona and decides each next message from the transcript\n * and the run's produced state, instead of replaying a fixed turn list. It\n * signs off with the literal `DONE` when a real practitioner would act on the\n * work unmodified.\n *\n * The app owns the persona and product context; agent-eval supplies the priced\n * call, the ledger, and the model-substitution guard. The ledger actor and the\n * driver model are required so each app attributes and pins its own driver.\n */\n\nimport {\n assertServedModel,\n type ChatClient,\n type ChatRequest,\n CostLedger,\n type CostLedgerHandle,\n costReceiptFromLlm,\n costReceiptFromLlmError,\n type DriverState,\n maximumChargeForLlmRequest,\n type PersonaConfig,\n} from '@tangle-network/agent-eval'\n\ntype PersonaRigor = NonNullable<PersonaConfig['rigor']>\n\n/**\n * Per-rigor stance the driver adopts. Scales how hard the simulated user\n * interrogates the agent — see `PersonaConfig.rigor`.\n */\nconst RIGOR_STANCE: Record<PersonaRigor, string> = {\n cooperative:\n 'Your stance: a pragmatic early adopter. You accept reasonable answers and only push back on clear gaps or outright errors.',\n demanding:\n 'Your stance: an experienced professional with no time to waste. You do not accept vague, hedged, or generic answers — you expect specifics, and you say so plainly when you do not get them.',\n relentless:\n 'Your stance: a senior partner reviewing this work for a client who will litigate if it is wrong. You interrogate every claim. You accept nothing undefended. You find the single weakest point in every answer and attack it. Courteous, never satisfied.',\n}\n\n/** Describe which nominal completion criteria are met, for the driver prompt. */\nfunction describeCompletion(persona: PersonaConfig, state: DriverState): string {\n const results = persona.completionCriteria.map((c) => {\n const met = c.check(state)\n return `${c.name}: ${met ? 'MET' : 'NOT MET'}`\n })\n const metCount = results.filter((r) => r.includes('MET') && !r.includes('NOT')).length\n return `${metCount}/${persona.completionCriteria.length} — ${results.join(', ')}`\n}\n\n/**\n * Build the driver's system prompt. The simulated user judges the agent's last\n * response by a professional standard, refuses vague answers, challenges\n * undefended claims, probes the persona's pressure points without revealing\n * them, and signs off only when a real practitioner would act on the work\n * unmodified. Pure function of persona, produced state, and product context.\n */\nfunction buildPersonaDriverSystemPrompt(\n persona: PersonaConfig,\n state: DriverState,\n productContext = '',\n): string {\n const rigor: PersonaRigor = persona.rigor ?? 'demanding'\n const expertise = persona.expertise ? ` You are ${persona.expertise}.` : ''\n\n const pressure =\n persona.pressurePoints && persona.pressurePoints.length > 0\n ? `\\nA competent ${persona.role} here MUST get the agent to address each of:\\n${persona.pressurePoints\n .map((p) => ` - ${p}`)\n .join(\n '\\n',\n )}\\nDo NOT hand these to the agent. Probe whether it surfaces them itself. If it misses one, press on exactly that gap until it delivers or demonstrably fails.\\n`\n : ''\n\n const curveballs =\n persona.curveballs && persona.curveballs.length > 0\n ? `\\nOnce the agent is coasting on easy answers, introduce ONE of these as a genuine new development — never as a quiz:\\n${persona.curveballs\n .map((c) => ` - ${c}`)\n .join('\\n')}\\n`\n : ''\n\n return `You are role-playing a real ${persona.role} putting an AI agent through its paces.${expertise}\nYour objective: ${persona.goal}\nYou are deciding whether this agent's work is good enough to stake your professional reputation on. Assume it is not — until it proves otherwise.\n\n${RIGOR_STANCE[rigor]}\n${productContext ? `Product context:\\n${productContext}\\n` : ''}Current workspace state:\n- Tasks: ${state.tasks} | Events: ${state.events}\n- Proposals: pending=${state.proposals.pending}, approved=${state.proposals.approved}, rejected=${state.proposals.rejected}\n- Vault files (${state.vaultFiles.length}): ${state.vaultFiles.slice(0, 10).join(', ')}${state.vaultFiles.length > 10 ? ' …' : ''}\n- Nominal task criteria: ${describeCompletion(persona, state)}\n${pressure}${curveballs}\nHow to choose your next message:\n1. Silently judge the agent's last response the way a ${persona.role} would. Is every claim defended with a specific authority, figure, or mechanism? Or is it vague, hedged, or generic?\n2. If it is vague or hand-waved — do NOT move on. Name the gap and demand the specific authority / figure / mechanism. \"It depends\" is not an answer; force the decision.\n3. If it makes a claim you can challenge — challenge it. Make the agent defend or correct it.\n4. If it missed something a ${persona.role} would catch — press on exactly that, without naming it for the agent.\n5. If it is genuinely solid — escalate: go a layer deeper, or introduce a curveball.\n6. First message — state your situation as you really would: realistic, specific, with the messy detail, but do not coach the agent.\n\nSign-off: respond with exactly \"DONE\" only when a ${persona.role} would act on this work without redoing it. Nominal task completion is NOT sign-off — sloppy-but-complete still fails. If the agent never gets there, keep pushing; never sign off on weak work.\n\nOutput ONLY your next message to the agent — in character, first person, no meta-commentary, no stage directions.`\n}\n\nexport interface DecidePersonaTurnOpts {\n persona: PersonaConfig\n state: DriverState\n /** Conversation so far — alternating user/assistant messages, oldest first. */\n history: { role: string; content: string }[]\n /** Optional product context woven into the driver prompt. */\n productContext?: string\n /** Driver model. */\n model: string\n /** Cost-ledger actor for the driver-leg call, and the served-model guard context. */\n actor: string\n /** Shared account for the paid driver call. */\n costLedger?: CostLedgerHandle\n /** Attribution tags merged into the paid-call receipt. */\n costTags?: Record<string, string>\n}\n\n/**\n * Decide the simulated user's next turn. Returns the next user message, or the\n * literal `DONE` when the simulated professional would sign off.\n */\nexport async function decidePersonaTurn(\n chat: ChatClient,\n opts: DecidePersonaTurnOpts,\n): Promise<string> {\n const { persona, state, history, productContext = '', model, actor } = opts\n\n const lastResponse =\n history.length > 0\n ? history[history.length - 1]!.content.slice(0, 2000)\n : '(no conversation yet — this is the first message)'\n\n const recentHistory = history\n .slice(-6)\n .map((h) => `${h.role}: ${h.content.slice(0, 500)}`)\n .join('\\n\\n')\n\n const request = {\n model,\n messages: [\n { role: 'system', content: buildPersonaDriverSystemPrompt(persona, state, productContext) },\n {\n role: 'user',\n content: recentHistory\n ? `Recent conversation:\\n${recentHistory}\\n\\nThe agent's latest response:\\n${lastResponse}`\n : 'No conversation yet. Send your opening message — in character, phrased as this person actually would.',\n },\n ],\n temperature: 0.5,\n maxTokens: 700,\n } satisfies ChatRequest\n const paid = await (opts.costLedger ?? new CostLedger()).runPaidCall({\n channel: 'driver',\n phase: 'driver-turn',\n actor,\n model,\n tags: opts.costTags,\n maximumCharge:\n chat.maximumAttempts === undefined\n ? undefined\n : maximumChargeForLlmRequest(request, { maximumAttempts: chat.maximumAttempts }),\n execute: (signal, callId) => chat.chat(request, { signal, idempotencyKey: callId }),\n receipt: costReceiptFromLlm,\n receiptFromError: costReceiptFromLlmError,\n })\n if (!paid.succeeded) throw paid.error\n // Hold the transport to its own word: a persona turn written by a different\n // model is not this driver model's behaviour. A transport that echoes no id\n // cannot be made to prove identity here.\n assertServedModel(model, paid.value.servedModel, {\n allowUnreported: true,\n context: actor,\n })\n return paid.value.content.trim()\n}\n","/**\n * Scorecard wiring: fold a benchmark's `RunRecord[]` into agent-eval's\n * `(scenarioId x profileHash)` scorecard timeline.\n *\n * The scorecard is an append-only JSONL log, one line per (cell, commit).\n * {@link recordScorecardAndDiff} appends a run and diffs the latest entries\n * against their predecessors, answering \"did this commit regress any persona on\n * the same profile?\", which a single run's pass/fail gate cannot. The app owns\n * the behaviour-only `AgentProfile` it keys the scorecard on.\n */\n\nimport {\n agentProfileHash,\n diffScorecard,\n formatScorecardDiff,\n loadScorecard,\n recordRunsToScorecard,\n type AgentProfile,\n type RunRecord,\n type ScorecardDiff,\n} from '@tangle-network/agent-eval'\n\nexport interface ScorecardWiringInput {\n scorecardPath: string\n runs: RunRecord[]\n profile: AgentProfile\n commitSha: string\n /** Defaults to `new Date().toISOString()`. */\n timestamp?: string\n}\n\nexport interface ScorecardWiringResult {\n /** Number of cell entries appended to the log this run (one per scenario). */\n appendedCells: number\n /** Profile hash this run keyed into. */\n profileHash: string\n /** Diff of the latest entries against their predecessors. */\n diff: ScorecardDiff\n /** Human-readable diff block, what a PR or CI run prints. */\n formatted: string\n /** True when any cell's verdict is `regressed`. */\n regressed: boolean\n}\n\n/**\n * Append the run to the scorecard, fold the log, diff, and surface a\n * regression flag. Pure I/O over the JSONL log, no LLM calls. Concurrent eval\n * campaigns are safe: appends are line-atomic and `loadScorecard` skips\n * malformed lines rather than failing closed.\n */\nexport function recordScorecardAndDiff(input: ScorecardWiringInput): ScorecardWiringResult {\n const lines = recordRunsToScorecard(input.scorecardPath, input.runs, {\n profile: input.profile,\n commitSha: input.commitSha,\n timestamp: input.timestamp,\n })\n const diff = diffScorecard(loadScorecard(input.scorecardPath))\n return {\n appendedCells: lines.length,\n profileHash: agentProfileHash(input.profile),\n diff,\n formatted: formatScorecardDiff(diff),\n regressed: diff.cells.some((c) => c.verdict === 'regressed'),\n }\n}\n"],"mappings":";AA2BA,SAAS,kBAAkB,sBAAsB,mBAAmB,mCAAmC;;;ACwBvG,IAAM,cAAc;AAEpB,IAAM,UAAU;AAET,SAAS,YAAY,MAAc,KAA4B;AACpE,MAAI,IAAI,QAAQ;AACd,UAAM,SAAS,IAAI,OAAO,KAAK,IAAI;AACnC,WAAO,EAAE,SAAS,QAAQ,YAAY,CAAC,UAAU,QAAQ,IAAI,YAAY,KAAK,IAAI,CAAC,EAAE;AAAA,EACvF;AACA,QAAM,UAAU,QAAQ,KAAK,IAAI;AACjC,SAAO,EAAE,SAAS,YAAY,KAAK,IAAI,KAAK,CAAC,SAAS,YAAY,QAAQ;AAC5E;AAEA,SAAS,SAAS,QAAkB,GAA0B;AAC5D,MAAI,CAAC,OAAO,OAAQ,QAAO;AAC3B,QAAM,SAAS,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AAC/C,SAAO,OAAO,KAAK,IAAI,OAAO,SAAS,GAAG,KAAK,MAAM,OAAO,SAAS,CAAC,CAAC,CAAC;AAC1E;AAOA,eAAsB,cAAc,SAIV;AACxB,QAAM,QAAQ,OAAO,KAAK,QAAQ,KAAK;AACvC,QAAM,UAAU,QAAQ,KAAK,IAAI,CAAC,KAAK,UAAU,QAAQ,SAAS,QAAQ,IAAI,GAAG,IAAI,MAAM,IAAI,QAAQ,KAAK,KAAK,IAAI,MAAM;A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AAC,OAAO,KAAK,MAAM,OAAO,MAAM,OAAO,MAAM,MAAM,MAAM,MAAM,QAAQ,UAAU,UAAU,OAAO,UAAU,CAAC;AAShI,SAAS,yBAAyB,OAA0D,CAAC,GAGjD;AACjD,QAAM,YAAY,KAAK,aAAa;AACpC,QAAM,SAAS,KAAK,oBAAoB;AACxC,SAAO,OAAO,aAAa,YAAY;AACrC,UAAM,OAAO,QAAQ,KAAK;AAC1B,QAAI,KAAK,SAAS,OAAQ,QAAO,EAAE,SAAS,OAAO,QAAQ,qBAAqB,KAAK,MAAM,gCAAgC;AAC3H,UAAM,SAAS,YAAY,MAAM,YAAY,EAAE,MAAM,YAAY,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,KAAK,CAAC,UAAU,IAAI,CAAC,CAAC;AAClH,QAAI,OAAO,WAAW,EAAG,QAAO,EAAE,SAAS,MAAM,QAAQ,+EAA0E;AACnI,UAAM,QAAQ,KAAK,YAAY;AAC/B,UAAM,OAAO,OAAO,OAAO,CAAC,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE;AACrD,UAAM,SAAS,OAAO,OAAO;AAC7B,WAAO,UAAU,YACb,EAAE,SAAS,MAAM,QAAQ,mBAAmB,IAAI,IAAI,OAAO,MAAM,sBAAsB,IACvF,EAAE,SAAS,OAAO,QAAQ,wBAAwB,IAAI,IAAI,OAAO,MAAM,sBAAsB;AAAA,EACnG;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/eval/index.ts","../../src/eval/calibration.ts","../../src/eval/persona-driver.ts","../../src/eval/scorecard.ts"],"sourcesContent":["/**\n * Eval — the app-shell BRIDGE to `@tangle-network/agent-eval`, not a reimpl.\n *\n * The completion/scoring ENGINE lives in agent-eval (a peer dependency):\n * `verifyCompletion`, `extractProducedState`, `weightedComposite`,\n * `createLlmCorrectnessChecker`, and the `CompletionRequirement` / `TaskGold` /\n * `ProducedState` types — all re-exported here so a consumer has one import\n * root. This module adds only what agent-eval doesn't have and what is\n * app-shell-specific:\n *\n * 1. {@link producedFromToolEvents} — the bridge: turn the structured app-tool\n * side channel's `AppToolProducedEvent`s (from a tool runtime executor's\n * `onProduced`) into the `RuntimeEventLike`s agent-eval's\n * `extractProducedState` consumes. This is the one piece that knows about\n * the app-tool channel, so it belongs here, not in the engine.\n * 2. {@link createTokenRecallChecker} — a deterministic, no-LLM\n * `CorrectnessChecker` (agent-eval ships only the LLM one). For apps/tests\n * that gate completion without a judge call.\n *\n * Full campaigns (persona simulation, traces, scorecards, held-out gates) are\n * agent-eval's `runEvalCampaign` / `AgentDriver` / `BenchmarkRunner` — use them\n * directly; this module composes with them.\n */\nimport type { RuntimeEventLike, CompletionRequirement } from '@tangle-network/agent-eval'\nimport type { AppToolProducedEvent } from '../tools/types'\n\n// Re-export the engine so consumers import completion + scoring from one place.\nexport { verifyCompletion, extractProducedState, weightedComposite, createLlmCorrectnessChecker } from '@tangle-network/agent-eval'\n\n// Calibration: prove a gate can reject known bad inputs and accept known good ones.\nexport { calibrateGate } from './calibration'\nexport type { CalibrationCase, CalibrationOutcome, CalibrationReport, GateFn } from './calibration'\nexport type {\n CompletionRequirement,\n TaskGold,\n ProducedState,\n SatisfiedBy,\n CompletionVerdict,\n CorrectnessChecker,\n RuntimeEventLike,\n} from '@tangle-network/agent-eval'\n\n/**\n * Bridge the app-tool side channel's produced events into the runtime-event\n * shape agent-eval's `extractProducedState` reads. Pipe it:\n * `verifyCompletion(taskGold, extractProducedState(producedFromToolEvents(events)), checker)`\n */\nexport function producedFromToolEvents(events: readonly AppToolProducedEvent[]): RuntimeEventLike[] {\n return events.map((e) =>\n e.type === 'proposal_created'\n ? { type: 'proposal_created', proposalId: e.proposalId, title: e.title, status: e.status, content: e.content }\n : { type: 'artifact', artifactId: `vault:${e.path}`, name: e.path, uri: `vault://${e.path}`, mimeType: 'text/markdown', content: e.content },\n )\n}\n\nconst STOPWORDS = new Set(['the', 'a', 'an', 'and', 'or', 'for', 'to', 'of', 'in', 'on', 'with', 'review', 'update', 'new', 'proposed'])\n\n/**\n * A deterministic `CorrectnessChecker` (agent-eval exports only\n * `createLlmCorrectnessChecker`). A produced item fulfils a requirement when\n * its content is substantive and recalls ≥ `minRecall` of the requirement\n * title's significant tokens. No network — the default gate for apps/tests\n * without an LLM judge. Pass to `verifyCompletion` as the checker.\n */\nexport function createTokenRecallChecker(opts: { minRecall?: number; minContentLength?: number } = {}): (\n requirement: CompletionRequirement,\n content: string,\n) => Promise<{ correct: boolean; reason: string }> {\n const minRecall = opts.minRecall ?? 0.5\n const minLen = opts.minContentLength ?? 120\n return async (requirement, content) => {\n const body = content.trim()\n if (body.length < minLen) return { correct: false, reason: `content too thin (${body.length} chars) to be the deliverable` }\n const tokens = requirement.title.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length > 2 && !STOPWORDS.has(t))\n if (tokens.length === 0) return { correct: true, reason: 'requirement title has no significant tokens — structural match accepted' }\n const lower = body.toLowerCase()\n const hits = tokens.filter((t) => lower.includes(t)).length\n const recall = hits / tokens.length\n return recall >= minRecall\n ? { correct: true, reason: `content recalls ${hits}/${tokens.length} requirement tokens` }\n : { correct: false, reason: `content recalls only ${hits}/${tokens.length} requirement tokens` }\n }\n}\n\n// Reactive persona driver: the simulated user of an app's persona eval.\nexport { decidePersonaTurn } from './persona-driver'\nexport type { DecidePersonaTurnOpts } from './persona-driver'\n\n// Scorecard timeline: append a run and diff it against the previous commit.\nexport { recordScorecardAndDiff } from './scorecard'\nexport type { ScorecardWiringInput, ScorecardWiringResult } from './scorecard'\n","/**\n * Calibration — prove a gate can reject a known bad input before trusting its verdict.\n *\n * Every expensive failure this package has shipped was a check that verified\n * its own input instead of the world, and reported green:\n *\n * - `quote_verification 16/16` passed a work product whose nine citations\n * claimed a figure the cited document never mentions.\n * - `audit_form passed=3 failed=0` passed a form fill whose values landed in\n * \"Combat zone\" — the audit re-read the field paths the writer had just\n * invented, so a wrong path could not be wrong.\n * - `evidence_coverage 0/0` passed vacuously because the artifact it was\n * counting targets from was null.\n * - A benchmark reported 6/8 for the product while a bare\n * \"You are a helpful assistant.\" scored 8/8 on the same cases.\n *\n * A gate is only evidence if it REJECTS something. A metric is only evidence\n * if a worse system scores worse on it. Neither property is implied by a\n * green run, and neither is visible in the output — which is why both have to\n * be asserted separately, in code, next to the gate.\n *\n * This module is deliberately domain-free: a \"gate\" is any predicate over any\n * input. Products supply the known-good and known-bad cases, because only the\n * product knows what bad looks like in its domain.\n */\n\n/** A case whose verdict is known in advance, used to calibrate a gate. */\nexport interface CalibrationCase<TInput> {\n /** What this case represents, e.g. `'quote that does not occur in the source'`. */\n readonly label: string\n readonly input: TInput\n /** `'reject'` — the gate MUST refuse this. `'accept'` — it MUST allow it. */\n readonly expect: 'accept' | 'reject'\n}\n\nexport interface CalibrationOutcome {\n readonly label: string\n readonly expected: 'accept' | 'reject'\n readonly actual: 'accept' | 'reject'\n readonly ok: boolean\n /** Set when the gate threw; a throw counts as `'reject'`. */\n readonly threw?: string\n}\n\nexport interface CalibrationReport {\n /** True only when every case matched AND both controls were present. */\n readonly discriminates: boolean\n readonly outcomes: readonly CalibrationOutcome[]\n readonly failures: readonly CalibrationOutcome[]\n /** Why the gate is not trustworthy. Absent when `discriminates` is true. */\n readonly reason?: string\n}\n\n/**\n * A gate under calibration. Returning `false` OR throwing both count as a\n * rejection — a fail-loud gate (`ToolInputError`) and a boolean gate calibrate\n * through the same path.\n */\nexport type GateFn<TInput> = (input: TInput) => boolean | Promise<boolean>\n\n/**\n * Run a gate against cases whose verdicts are known, and report whether it\n * actually discriminates.\n *\n * Requires BOTH controls:\n * - at least one `'reject'` case — without it a gate that returns `true`\n * unconditionally is indistinguishable from a working one. This is the\n * control that all four failures above were missing.\n * - at least one `'accept'` case — without it a gate that refuses everything\n * scores perfectly, and an unsatisfiable gate does not stop bad work, it\n * selects for invented work (measured: 38 fabricated citations written to\n * clear a coverage gate no honest answer could satisfy).\n */\nexport async function calibrateGate<TInput>(\n gate: GateFn<TInput>,\n cases: readonly CalibrationCase<TInput>[],\n): Promise<CalibrationReport> {\n const outcomes: CalibrationOutcome[] = []\n for (const c of cases) {\n let actual: 'accept' | 'reject'\n let threw: string | undefined\n try {\n actual = (await gate(c.input)) ? 'accept' : 'reject'\n } catch (err) {\n actual = 'reject'\n threw = err instanceof Error ? err.message : String(err)\n }\n outcomes.push({ label: c.label, expected: c.expect, actual, ok: actual === c.expect, ...(threw ? { threw } : {}) })\n }\n\n const failures = outcomes.filter((o) => !o.ok)\n const hasNegative = cases.some((c) => c.expect === 'reject')\n const hasPositive = cases.some((c) => c.expect === 'accept')\n\n const reason = !hasNegative\n ? 'no negative control: every case expects acceptance, so a gate that never refuses would score perfectly'\n : !hasPositive\n ? 'no positive control: every case expects rejection, so a gate that refuses everything would score perfectly'\n : failures.length > 0\n ? `${failures.length}/${outcomes.length} cases disagreed: ${failures.map((f) => `${f.label} expected ${f.expected}, got ${f.actual}`).join('; ')}`\n : undefined\n\n return { discriminates: reason === undefined, outcomes, failures, ...(reason ? { reason } : {}) }\n}\n","/**\n * The reactive persona driver: the user side of an app's persona eval.\n *\n * An LLM plays the persona and decides each next message from the transcript\n * and the run's produced state, instead of replaying a fixed turn list. It\n * signs off with the literal `DONE` when a real practitioner would act on the\n * work unmodified.\n *\n * The app owns the persona and product context; agent-eval supplies the priced\n * call, the ledger, and the model-substitution guard. The ledger actor and the\n * driver model are required so each app attributes and pins its own driver.\n */\n\nimport {\n assertServedModel,\n type ChatClient,\n type ChatRequest,\n CostLedger,\n type CostLedgerHandle,\n costReceiptFromLlm,\n costReceiptFromLlmError,\n type DriverState,\n maximumChargeForLlmRequest,\n type PersonaConfig,\n} from '@tangle-network/agent-eval'\n\ntype PersonaRigor = NonNullable<PersonaConfig['rigor']>\n\n/**\n * Per-rigor stance the driver adopts. Scales how hard the simulated user\n * interrogates the agent — see `PersonaConfig.rigor`.\n */\nconst RIGOR_STANCE: Record<PersonaRigor, string> = {\n cooperative:\n 'Your stance: a pragmatic early adopter. You accept reasonable answers and only push back on clear gaps or outright errors.',\n demanding:\n 'Your stance: an experienced professional with no time to waste. You do not accept vague, hedged, or generic answers — you expect specifics, and you say so plainly when you do not get them.',\n relentless:\n 'Your stance: a senior partner reviewing this work for a client who will litigate if it is wrong. You interrogate every claim. You accept nothing undefended. You find the single weakest point in every answer and attack it. Courteous, never satisfied.',\n}\n\n/** Describe which nominal completion criteria are met, for the driver prompt. */\nfunction describeCompletion(persona: PersonaConfig, state: DriverState): string {\n const results = persona.completionCriteria.map((c) => {\n const met = c.check(state)\n return `${c.name}: ${met ? 'MET' : 'NOT MET'}`\n })\n const metCount = results.filter((r) => r.includes('MET') && !r.includes('NOT')).length\n return `${metCount}/${persona.completionCriteria.length} — ${results.join(', ')}`\n}\n\n/**\n * Build the driver's system prompt. The simulated user judges the agent's last\n * response by a professional standard, refuses vague answers, challenges\n * undefended claims, probes the persona's pressure points without revealing\n * them, and signs off only when a real practitioner would act on the work\n * unmodified. Pure function of persona, produced state, and product context.\n */\nfunction buildPersonaDriverSystemPrompt(\n persona: PersonaConfig,\n state: DriverState,\n productContext = '',\n): string {\n const rigor: PersonaRigor = persona.rigor ?? 'demanding'\n const expertise = persona.expertise ? ` You are ${persona.expertise}.` : ''\n\n const pressure =\n persona.pressurePoints && persona.pressurePoints.length > 0\n ? `\\nA competent ${persona.role} here MUST get the agent to address each of:\\n${persona.pressurePoints\n .map((p) => ` - ${p}`)\n .join(\n '\\n',\n )}\\nDo NOT hand these to the agent. Probe whether it surfaces them itself. If it misses one, press on exactly that gap until it delivers or demonstrably fails.\\n`\n : ''\n\n const curveballs =\n persona.curveballs && persona.curveballs.length > 0\n ? `\\nOnce the agent is coasting on easy answers, introduce ONE of these as a genuine new development — never as a quiz:\\n${persona.curveballs\n .map((c) => ` - ${c}`)\n .join('\\n')}\\n`\n : ''\n\n return `You are role-playing a real ${persona.role} putting an AI agent through its paces.${expertise}\nYour objective: ${persona.goal}\nYou are deciding whether this agent's work is good enough to stake your professional reputation on. Assume it is not — until it proves otherwise.\n\n${RIGOR_STANCE[rigor]}\n${productContext ? `Product context:\\n${productContext}\\n` : ''}Current workspace state:\n- Tasks: ${state.tasks} | Events: ${state.events}\n- Proposals: pending=${state.proposals.pending}, approved=${state.proposals.approved}, rejected=${state.proposals.rejected}\n- Vault files (${state.vaultFiles.length}): ${state.vaultFiles.slice(0, 10).join(', ')}${state.vaultFiles.length > 10 ? ' …' : ''}\n- Nominal task criteria: ${describeCompletion(persona, state)}\n${pressure}${curveballs}\nHow to choose your next message:\n1. Silently judge the agent's last response the way a ${persona.role} would. Is every claim defended with a specific authority, figure, or mechanism? Or is it vague, hedged, or generic?\n2. If it is vague or hand-waved — do NOT move on. Name the gap and demand the specific authority / figure / mechanism. \"It depends\" is not an answer; force the decision.\n3. If it makes a claim you can challenge — challenge it. Make the agent defend or correct it.\n4. If it missed something a ${persona.role} would catch — press on exactly that, without naming it for the agent.\n5. If it is genuinely solid — escalate: go a layer deeper, or introduce a curveball.\n6. First message — state your situation as you really would: realistic, specific, with the messy detail, but do not coach the agent.\n\nSign-off: respond with exactly \"DONE\" only when a ${persona.role} would act on this work without redoing it. Nominal task completion is NOT sign-off — sloppy-but-complete still fails. If the agent never gets there, keep pushing; never sign off on weak work.\n\nOutput ONLY your next message to the agent — in character, first person, no meta-commentary, no stage directions.`\n}\n\nexport interface DecidePersonaTurnOpts {\n persona: PersonaConfig\n state: DriverState\n /** Conversation so far — alternating user/assistant messages, oldest first. */\n history: { role: string; content: string }[]\n /** Optional product context woven into the driver prompt. */\n productContext?: string\n /** Driver model. */\n model: string\n /** Cost-ledger actor for the driver-leg call, and the served-model guard context. */\n actor: string\n /** Shared account for the paid driver call. */\n costLedger?: CostLedgerHandle\n /** Attribution tags merged into the paid-call receipt. */\n costTags?: Record<string, string>\n}\n\n/**\n * Decide the simulated user's next turn. Returns the next user message, or the\n * literal `DONE` when the simulated professional would sign off.\n */\nexport async function decidePersonaTurn(\n chat: ChatClient,\n opts: DecidePersonaTurnOpts,\n): Promise<string> {\n const { persona, state, history, productContext = '', model, actor } = opts\n\n const lastResponse =\n history.length > 0\n ? history[history.length - 1]!.content.slice(0, 2000)\n : '(no conversation yet — this is the first message)'\n\n const recentHistory = history\n .slice(-6)\n .map((h) => `${h.role}: ${h.content.slice(0, 500)}`)\n .join('\\n\\n')\n\n const request = {\n model,\n messages: [\n { role: 'system', content: buildPersonaDriverSystemPrompt(persona, state, productContext) },\n {\n role: 'user',\n content: recentHistory\n ? `Recent conversation:\\n${recentHistory}\\n\\nThe agent's latest response:\\n${lastResponse}`\n : 'No conversation yet. Send your opening message — in character, phrased as this person actually would.',\n },\n ],\n temperature: 0.5,\n maxTokens: 700,\n } satisfies ChatRequest\n const paid = await (opts.costLedger ?? new CostLedger()).runPaidCall({\n channel: 'driver',\n phase: 'driver-turn',\n actor,\n model,\n tags: opts.costTags,\n maximumCharge:\n chat.maximumAttempts === undefined\n ? undefined\n : maximumChargeForLlmRequest(request, { maximumAttempts: chat.maximumAttempts }),\n execute: (signal, callId) => chat.chat(request, { signal, idempotencyKey: callId }),\n receipt: costReceiptFromLlm,\n receiptFromError: costReceiptFromLlmError,\n })\n if (!paid.succeeded) throw paid.error\n // Hold the transport to its own word: a persona turn written by a different\n // model is not this driver model's behaviour. A transport that echoes no id\n // cannot be made to prove identity here.\n assertServedModel(model, paid.value.servedModel, {\n allowUnreported: true,\n context: actor,\n })\n return paid.value.content.trim()\n}\n","/**\n * Scorecard wiring: fold a benchmark's `RunRecord[]` into agent-eval's\n * `(scenarioId x profileHash)` scorecard timeline.\n *\n * The scorecard is an append-only JSONL log, one line per (cell, commit).\n * {@link recordScorecardAndDiff} appends a run and diffs the latest entries\n * against their predecessors, answering \"did this commit regress any persona on\n * the same profile?\", which a single run's pass/fail gate cannot. The app owns\n * the behaviour-only `AgentProfile` it keys the scorecard on.\n */\n\nimport {\n agentProfileHash,\n diffScorecard,\n formatScorecardDiff,\n loadScorecard,\n recordRunsToScorecard,\n type AgentProfile,\n type RunRecord,\n type ScorecardDiff,\n} from '@tangle-network/agent-eval'\n\nexport interface ScorecardWiringInput {\n scorecardPath: string\n runs: RunRecord[]\n profile: AgentProfile\n commitSha: string\n /** Defaults to `new Date().toISOString()`. */\n timestamp?: string\n}\n\nexport interface ScorecardWiringResult {\n /** Number of cell entries appended to the log this run (one per scenario). */\n appendedCells: number\n /** Profile hash this run keyed into. */\n profileHash: string\n /** Diff of the latest entries against their predecessors. */\n diff: ScorecardDiff\n /** Human-readable diff block, what a PR or CI run prints. */\n formatted: string\n /** True when any cell's verdict is `regressed`. */\n regressed: boolean\n}\n\n/**\n * Append the run to the scorecard, fold the log, diff, and surface a\n * regression flag. Pure I/O over the JSONL log, no LLM calls. Concurrent eval\n * campaigns are safe: appends are line-atomic and `loadScorecard` skips\n * malformed lines rather than failing closed.\n */\nexport function recordScorecardAndDiff(input: ScorecardWiringInput): ScorecardWiringResult {\n const lines = recordRunsToScorecard(input.scorecardPath, input.runs, {\n profile: input.profile,\n commitSha: input.commitSha,\n timestamp: input.timestamp,\n })\n const diff = diffScorecard(loadScorecard(input.scorecardPath))\n return {\n appendedCells: lines.length,\n profileHash: agentProfileHash(input.profile),\n diff,\n formatted: formatScorecardDiff(diff),\n regressed: diff.cells.some((c) => c.verdict === 'regressed'),\n }\n}\n"],"mappings":";AA2BA,SAAS,kBAAkB,sBAAsB,mBAAmB,mCAAmC;;;AC8CvG,eAAsB,cACpB,MACA,OAC4B;AAC5B,QAAM,WAAiC,CAAC;AACxC,aAAW,KAAK,OAAO;AACrB,QAAI;AACJ,QAAI;AACJ,QAAI;AACF,eAAU,MAAM,KAAK,EAAE,KAAK,IAAK,WAAW;AAAA,IAC9C,SAAS,KAAK;AACZ,eAAS;AACT,cAAQ,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAAA,IACzD;AACA,aAAS,KAAK,EAAE,OAAO,EAAE,OAAO,UAAU,EAAE,QAAQ,QAAQ,IAAI,WAAW,EAAE,QAAQ,GAAI,QAAQ,EAAE,MAAM,IAAI,CAAC,E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C,EAAE;AACrD,UAAM,SAAS,OAAO,OAAO;AAC7B,WAAO,UAAU,YACb,EAAE,SAAS,MAAM,QAAQ,mBAAmB,IAAI,IAAI,OAAO,MAAM,sBAAsB,IACvF,EAAE,SAAS,OAAO,QAAQ,wBAAwB,IAAI,IAAI,OAAO,MAAM,sBAAsB;AAAA,EACnG;AACF;","names":[]}
|
package/dist/harness/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* owns session selection; the consumer owns storage and deployment policy.
|
|
11
11
|
*/
|
|
12
12
|
import { modelProvider, type HarnessType } from '@tangle-network/agent-interface';
|
|
13
|
-
import { type
|
|
13
|
+
import { type SelectionAvailability, type SessionHarnessSelection, type SessionHarnessSelectionInput } from './session-selection';
|
|
14
14
|
export { HarnessSelectionError } from './session-selection';
|
|
15
15
|
/** Canonical identities that have no direct Sandbox backend. */
|
|
16
16
|
declare const NON_BACKEND_HARNESSES: readonly ["gemini"];
|
package/dist/harness/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Pure session admission. Harness identity is not deployment availability. */
|
|
2
|
-
export interface
|
|
2
|
+
export interface SelectionAvailability<H extends string> {
|
|
3
3
|
/** Server-owned selection for new sessions. An empty list disables all starts. */
|
|
4
4
|
readonly newSessions: readonly H[];
|
|
5
5
|
/** Includes draining harnesses. Omission uses newSessions, never all known IDs. */
|
|
@@ -11,7 +11,7 @@ export interface SessionHarnessSelectionInput<H extends string> {
|
|
|
11
11
|
workspaceDefault?: unknown;
|
|
12
12
|
fallback?: H;
|
|
13
13
|
/** Omit only when the caller deliberately admits every known harness. */
|
|
14
|
-
availability?:
|
|
14
|
+
availability?: SelectionAvailability<H>;
|
|
15
15
|
}
|
|
16
16
|
export interface SessionHarnessSelection<H extends string> {
|
|
17
17
|
harness: H;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Hub results, read the same way by every receipt: unwrapped from Hub's
|
|
3
3
|
* envelope and bounded before a host persists them.
|
|
4
4
|
*/
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function hubResultRecord(value: unknown): Record<string, unknown>;
|
|
6
6
|
/**
|
|
7
7
|
* The provider's own result inside Hub's envelopes. `tools.invoke` answers
|
|
8
8
|
* `{ result: … }` and a connector may wrap its body in `data`; a JSON string,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HubPreviewFeedback,
|
|
3
3
|
ReviewFeedbackForm
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-2VJLLRVV.js";
|
|
5
5
|
import {
|
|
6
6
|
HUB_APPROVAL_ACTIVE_PHASES,
|
|
7
7
|
HUB_APPROVAL_OPEN_PHASES,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
formatWhen,
|
|
12
12
|
hubActionReceipt,
|
|
13
13
|
presentHubAction
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-JBXNU5WD.js";
|
|
15
15
|
|
|
16
16
|
// src/hub-approvals-react/dock.tsx
|
|
17
17
|
import { useEffect as useEffect3, useMemo, useRef as useRef2, useState as useState4 } from "react";
|
|
@@ -106,7 +106,7 @@ function closesIn(expiresAt, now = Date.now()) {
|
|
|
106
106
|
if (!Number.isFinite(minutes) || minutes <= 0) return null;
|
|
107
107
|
return minutes >= 120 ? `closes in ${Math.round(minutes / 60)} h` : `closes in ${minutes} min`;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function approvalRelativeTime(at, now = Date.now()) {
|
|
110
110
|
if (!at) return null;
|
|
111
111
|
const then = Date.parse(at);
|
|
112
112
|
if (!Number.isFinite(then)) return null;
|
|
@@ -980,7 +980,7 @@ function HubApprovalsList({ items, onSelect, selectedId, className = "" }) {
|
|
|
980
980
|
/* @__PURE__ */ jsx6("ul", { className: "space-y-1", children: group.items.map((item) => {
|
|
981
981
|
const presentation = presentHubAction(item);
|
|
982
982
|
const title = item.phase === "done" ? hubActionReceipt(item).title : presentation.title;
|
|
983
|
-
const when = item.phase === "waiting" ? closesIn(item.expiresAt, now) ??
|
|
983
|
+
const when = item.phase === "waiting" ? closesIn(item.expiresAt, now) ?? approvalRelativeTime(item.requestedAt, now) : approvalRelativeTime(item.requestedAt, now);
|
|
984
984
|
const detail = [presentation.provider.name, distinctAccount(item.account, presentation.provider.name), when].filter(Boolean).join(" \xB7 ");
|
|
985
985
|
const selected = selectedId === item.id;
|
|
986
986
|
return /* @__PURE__ */ jsx6("li", { children: /* @__PURE__ */ jsxs6(
|