@reticlehq/server 3.5.0 → 3.7.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/README.md +1 -1
- package/SKILL.md +123 -116
- package/dist/chromium-launch-options.d.ts +3 -1
- package/dist/chromium-launch-options.js +2 -1
- package/dist/command/cli/adhoc-suite.d.ts +14 -0
- package/dist/command/cli/adhoc-suite.js +42 -7
- package/dist/command/cli/adhoc-verdict.d.ts +19 -2
- package/dist/command/cli/adhoc-verdict.js +76 -9
- package/dist/command/cli/answers/gate-exit.d.ts +23 -0
- package/dist/command/cli/answers/gate-exit.js +45 -0
- package/dist/command/cli/answers/gate-hook-message.d.ts +2 -0
- package/dist/command/cli/answers/gate-hook-message.js +3 -1
- package/dist/command/cli/answers/open-note.d.ts +2 -0
- package/dist/command/cli/answers/open-note.js +22 -0
- package/dist/command/cli/auth/device-flow.d.ts +13 -2
- package/dist/command/cli/auth/device-flow.js +17 -0
- package/dist/command/cli/cli-doctor.js +14 -0
- package/dist/command/cli/cli-flow-commands.d.ts +0 -11
- package/dist/command/cli/cli-flow-commands.js +31 -112
- package/dist/command/cli/cli-kill.js +3 -2
- package/dist/command/cli/cli-parse-grammar.d.ts +24 -0
- package/dist/command/cli/cli-parse-grammar.js +75 -0
- package/dist/command/cli/cli-parse-verify.d.ts +2 -0
- package/dist/command/cli/cli-parse-verify.js +18 -0
- package/dist/command/cli/cli-parse.d.ts +19 -28
- package/dist/command/cli/cli-parse.js +82 -182
- package/dist/command/cli/cli-update-commands.d.ts +1 -1
- package/dist/command/cli/cli-update-commands.js +61 -9
- package/dist/command/cli/cli-usage.d.ts +33 -0
- package/dist/command/cli/cli-usage.js +287 -0
- package/dist/command/cli/cli-verify.d.ts +35 -5
- package/dist/command/cli/cli-verify.js +114 -35
- package/dist/command/cli/cloud-cli.d.ts +13 -0
- package/dist/command/cli/cloud-cli.js +192 -341
- package/dist/command/cli/cloud-kit.d.ts +12 -0
- package/dist/command/cli/cloud-kit.js +41 -2
- package/dist/command/cli/cloud-link.d.ts +57 -0
- package/dist/command/cli/cloud-link.js +308 -0
- package/dist/command/cli/cloud-login.d.ts +22 -0
- package/dist/command/cli/cloud-login.js +96 -8
- package/dist/command/cli/context-command.d.ts +1 -0
- package/dist/command/cli/context-command.js +33 -0
- package/dist/command/cli/daemon-start-options.d.ts +3 -0
- package/dist/command/cli/daemon-start-options.js +24 -3
- package/dist/command/cli/doctor/browser/chromium-hint.d.ts +46 -0
- package/dist/command/cli/doctor/browser/chromium-hint.js +99 -1
- package/dist/command/cli/doctor/doctor-coverage-line.d.ts +2 -0
- package/dist/command/cli/doctor/doctor-coverage-line.js +47 -0
- package/dist/command/cli/doctor/doctor-project-line.d.ts +0 -12
- package/dist/command/cli/doctor/doctor-project-line.js +5 -4
- package/dist/command/cli/doctor/doctor-rows.d.ts +6 -0
- package/dist/command/cli/doctor/doctor-rows.js +6 -0
- package/dist/command/cli/doctor/doctor-signing-line.d.ts +38 -0
- package/dist/command/cli/doctor/doctor-signing-line.js +114 -0
- package/dist/command/cli/drive/drive-attach.d.ts +27 -2
- package/dist/command/cli/drive/drive-attach.js +71 -4
- package/dist/command/cli/drive/drive-command.d.ts +2 -1
- package/dist/command/cli/drive/drive-command.js +13 -7
- package/dist/command/cli/known-regression.d.ts +13 -0
- package/dist/command/cli/known-regression.js +34 -0
- package/dist/command/cli/launch/sdk-version-match.d.ts +12 -0
- package/dist/command/cli/launch/sdk-version-match.js +25 -0
- package/dist/command/cli/lifecycle/daemon-lifecycle.js +15 -3
- package/dist/command/cli/mcp-command.d.ts +6 -0
- package/dist/command/cli/mcp-command.js +13 -5
- package/dist/command/cli/ports/port-holder.d.ts +10 -0
- package/dist/command/cli/ports/port-holder.js +25 -1
- package/dist/command/cli/project-name.d.ts +29 -1
- package/dist/command/cli/project-name.js +107 -2
- package/dist/command/cli/setup-mcp-cli.d.ts +17 -1
- package/dist/command/cli/setup-mcp-cli.js +35 -12
- package/dist/command/cli/status/status-lines.d.ts +1 -0
- package/dist/command/cli/status/status-lines.js +47 -2
- package/dist/command/cli/status/workspace-links.d.ts +10 -0
- package/dist/command/cli/status/workspace-links.js +29 -0
- package/dist/command/cli/try-command.d.ts +96 -0
- package/dist/command/cli/try-command.js +362 -0
- package/dist/command/cli/tutorial.d.ts +0 -100
- package/dist/command/cli/tutorial.js +0 -181
- package/dist/command/cli/verify-results.d.ts +19 -0
- package/dist/command/cli/verify-results.js +29 -0
- package/dist/command/cli-onboarding.d.ts +0 -11
- package/dist/command/cli-onboarding.js +0 -15
- package/dist/command/cli.d.ts +20 -0
- package/dist/command/cli.js +130 -104
- package/dist/command/daemon/binding/daemon-status-probe.d.ts +2 -0
- package/dist/command/daemon/binding/daemon-status-probe.js +1 -0
- package/dist/command/daemon/daemon-resilience.js +4 -4
- package/dist/command/daemon/daemon-resolve.d.ts +23 -1
- package/dist/command/daemon/daemon-resolve.js +79 -9
- package/dist/command/setup/agent-writer.d.ts +1 -1
- package/dist/command/setup/agent-writer.js +3 -2
- package/dist/command/setup/bringup/bridge-port.d.ts +3 -1
- package/dist/command/setup/bringup/bridge-port.js +13 -3
- package/dist/command/setup/bringup/connect-lease.d.ts +1 -0
- package/dist/command/setup/bringup/connect-lease.js +1 -0
- package/dist/command/setup/bringup/dev-server-log-cap.js +2 -0
- package/dist/command/setup/bringup/dev-server-wait.d.ts +8 -0
- package/dist/command/setup/bringup/dev-server-wait.js +19 -0
- package/dist/command/setup/bringup/ensure-daemon.js +9 -2
- package/dist/command/setup/init/agent-restart.d.ts +23 -0
- package/dist/command/setup/init/agent-restart.js +28 -0
- package/dist/command/setup/init/init-port.d.ts +14 -1
- package/dist/command/setup/init/init-port.js +32 -2
- package/dist/command/setup/init/init-runtime.d.ts +22 -2
- package/dist/command/setup/init/init-runtime.js +114 -38
- package/dist/command/setup/node-effects.d.ts +2 -0
- package/dist/command/setup/node-effects.js +38 -9
- package/dist/command/setup/probe/existing-app.d.ts +12 -0
- package/dist/command/setup/probe/existing-app.js +14 -0
- package/dist/command/setup/remaining-steps.js +2 -1
- package/dist/command/setup/run-setup.d.ts +34 -9
- package/dist/command/setup/run-setup.js +65 -51
- package/dist/command/setup/setup-command.d.ts +25 -1
- package/dist/command/setup/setup-command.js +59 -4
- package/dist/command/setup/setup-mcp.js +25 -2
- package/dist/command/setup/tauri-signing.d.ts +19 -0
- package/dist/command/setup/tauri-signing.js +79 -0
- package/dist/command/setup/terminal/listeners.d.ts +10 -1
- package/dist/command/setup/terminal/listeners.js +37 -6
- package/dist/command/update/update-nudge.d.ts +9 -0
- package/dist/command/update/update-nudge.js +1 -1
- package/dist/command/update/updater.js +11 -15
- package/dist/command/version/version-nudge.js +3 -0
- package/dist/command/version/version-skew.d.ts +20 -1
- package/dist/command/version/version-skew.js +49 -4
- package/dist/features/crawl/crawl-tools.js +4 -0
- package/dist/features/crawl/crawl.d.ts +6 -0
- package/dist/features/crawl/crawl.js +23 -2
- package/dist/features/exhaust/ledger.d.ts +21 -14
- package/dist/features/exhaust/ledger.js +35 -9
- package/dist/features/harness/app-findings.d.ts +2 -0
- package/dist/features/harness/app-findings.js +52 -0
- package/dist/features/harness/drive-report.d.ts +61 -1
- package/dist/features/harness/drive-report.js +394 -26
- package/dist/features/harness/drive-runs.d.ts +120 -0
- package/dist/features/harness/drive-runs.js +289 -0
- package/dist/features/harness/drivers.d.ts +10 -14
- package/dist/features/harness/drivers.js +10 -14
- package/dist/features/harness/explore/console-pages.d.ts +15 -0
- package/dist/features/harness/explore/console-pages.js +146 -0
- package/dist/features/harness/explore/disparity.d.ts +19 -0
- package/dist/features/harness/explore/disparity.js +71 -0
- package/dist/features/harness/explore/fake-app.d.ts +16 -0
- package/dist/features/harness/explore/fake-app.js +49 -0
- package/dist/features/harness/explore/goal-search.d.ts +26 -0
- package/dist/features/harness/explore/goal-search.js +144 -0
- package/dist/features/harness/explore/page-tree.d.ts +49 -0
- package/dist/features/harness/explore/page-tree.js +148 -0
- package/dist/features/harness/explore/site-map.d.ts +34 -0
- package/dist/features/harness/explore/site-map.js +150 -0
- package/dist/features/harness/fill-values.d.ts +3 -73
- package/dist/features/harness/fill-values.js +3 -169
- package/dist/features/harness/goals.d.ts +82 -0
- package/dist/features/harness/goals.js +330 -0
- package/dist/features/harness/harness.d.ts +51 -1
- package/dist/features/harness/harness.js +207 -6
- package/dist/features/harness/platform/drive-target.d.ts +30 -0
- package/dist/features/harness/platform/drive-target.js +81 -0
- package/dist/features/harness/platform/local-apps.d.ts +127 -0
- package/dist/features/harness/platform/local-apps.js +280 -0
- package/dist/features/harness/platform/persona-credentials.d.ts +20 -0
- package/dist/features/harness/platform/persona-credentials.js +69 -0
- package/dist/features/harness/platform/platform-drives.d.ts +61 -0
- package/dist/features/harness/platform/platform-drives.js +114 -0
- package/dist/features/harness/platform/refusal.d.ts +52 -0
- package/dist/features/harness/platform/refusal.js +71 -0
- package/dist/features/harness/platform/remote-drive.d.ts +186 -0
- package/dist/features/harness/platform/remote-drive.js +378 -0
- package/dist/features/harness/platform/script.d.ts +94 -0
- package/dist/features/harness/platform/script.js +260 -0
- package/dist/features/harness/platform/server-driver.d.ts +54 -0
- package/dist/features/harness/platform/server-driver.js +182 -0
- package/dist/features/harness/platform-config.d.ts +41 -1
- package/dist/features/harness/platform-config.js +106 -9
- package/dist/features/harness/route-guess.d.ts +13 -0
- package/dist/features/harness/route-guess.js +49 -0
- package/dist/features/harness/script/app-controls.d.ts +5 -0
- package/dist/features/harness/script/app-controls.js +40 -0
- package/dist/features/harness/script/lane-ids.d.ts +14 -0
- package/dist/features/harness/script/lane-ids.js +16 -0
- package/dist/features/harness/script/script-run.d.ts +70 -0
- package/dist/features/harness/script/script-run.js +606 -0
- package/dist/features/license/license.d.ts +2 -2
- package/dist/features/visual/step-shots.d.ts +31 -0
- package/dist/features/visual/step-shots.js +231 -0
- package/dist/features/visual/visual-tools.d.ts +10 -1
- package/dist/features/visual/visual-tools.js +62 -17
- package/dist/hooks/client-directory.d.ts +18 -0
- package/dist/hooks/client-directory.js +57 -0
- package/dist/hooks/coding-agents.d.ts +34 -0
- package/dist/hooks/coding-agents.js +117 -0
- package/dist/hooks/driven-by.d.ts +23 -0
- package/dist/hooks/driven-by.js +56 -0
- package/dist/hooks/hook-bus.d.ts +4 -0
- package/dist/hooks/hook-bus.js +18 -0
- package/dist/hooks/hook-commands.js +15 -4
- package/dist/hooks/tool-log.d.ts +9 -0
- package/dist/hooks/tool-log.js +29 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +80 -243
- package/dist/judgement/capsule/capsule-store.d.ts +2 -2
- package/dist/judgement/capsule/causal-summary.d.ts +15 -1
- package/dist/judgement/capsule/causal-summary.js +33 -0
- package/dist/judgement/runs/artifact/build-verification-run.d.ts +1 -1
- package/dist/judgement/runs/artifact/build-verification-run.js +25 -3
- package/dist/judgement/runs/artifact/gap-summary.d.ts +0 -18
- package/dist/judgement/runs/artifact/gap-summary.js +12 -3
- package/dist/judgement/runs/artifact/replay-mapping.d.ts +1 -1
- package/dist/judgement/runs/artifact/replay-mapping.js +37 -11
- package/dist/judgement/runs/artifact/run-store.d.ts +14 -2
- package/dist/judgement/runs/artifact/run-store.js +195 -3
- package/dist/judgement/runs/context-tools.js +59 -1
- package/dist/judgement/runs/default-run-id.d.ts +3 -0
- package/dist/judgement/runs/default-run-id.js +16 -0
- package/dist/judgement/runs/drive-run.d.ts +71 -1
- package/dist/judgement/runs/drive-run.js +317 -5
- package/dist/judgement/runs/repair-prompt.js +1 -1
- package/dist/judgement/runs/resume.d.ts +44 -0
- package/dist/judgement/runs/resume.js +137 -0
- package/dist/judgement/runs/reticle-runner.js +13 -3
- package/dist/judgement/runs/runner-port.d.ts +5 -1
- package/dist/judgement/runs/runner-port.js +8 -2
- package/dist/judgement/runs/verification-sync.d.ts +5 -2
- package/dist/judgement/runs/verification-sync.js +40 -18
- package/dist/language/flows/change/gate.d.ts +10 -0
- package/dist/language/flows/change/gate.js +22 -0
- package/dist/language/flows/decision.js +36 -1
- package/dist/language/flows/fields/flow-secret-field.d.ts +12 -0
- package/dist/language/flows/fields/flow-secret-field.js +25 -2
- package/dist/language/flows/flow-anchor.d.ts +61 -10
- package/dist/language/flows/flow-anchor.js +98 -6
- package/dist/language/flows/flow-cross-step.d.ts +15 -0
- package/dist/language/flows/flow-cross-step.js +21 -0
- package/dist/language/flows/flow-intent.d.ts +1 -0
- package/dist/language/flows/flow-journey.d.ts +6 -0
- package/dist/language/flows/flow-journey.js +20 -0
- package/dist/language/flows/flow-learning.d.ts +4 -0
- package/dist/language/flows/flow-learning.js +45 -14
- package/dist/language/flows/flow-mutate-tools.js +5 -3
- package/dist/language/flows/flow-replay-run.d.ts +23 -9
- package/dist/language/flows/flow-replay-run.js +115 -110
- package/dist/language/flows/flow-replay-types.d.ts +1 -1
- package/dist/language/flows/flow-replay.d.ts +40 -1
- package/dist/language/flows/flow-replay.js +110 -22
- package/dist/language/flows/flow-result.d.ts +22 -1
- package/dist/language/flows/flow-result.js +47 -2
- package/dist/language/flows/flow-scope.js +5 -1
- package/dist/language/flows/flow-step-runners.d.ts +22 -2
- package/dist/language/flows/flow-step-runners.js +247 -47
- package/dist/language/flows/flow-store-for-session.d.ts +2 -2
- package/dist/language/flows/flow-store-for-session.js +7 -3
- package/dist/language/flows/flow-tools.d.ts +10 -0
- package/dist/language/flows/flow-tools.js +112 -89
- package/dist/language/flows/flows.d.ts +16 -1
- package/dist/language/flows/flows.js +74 -12
- package/dist/language/flows/heal-run.js +6 -4
- package/dist/language/flows/narrow-write.d.ts +7 -0
- package/dist/language/flows/narrow-write.js +36 -1
- package/dist/language/flows/recording/flake.d.ts +2 -2
- package/dist/language/flows/recording/recording-backtrack.js +14 -1
- package/dist/language/flows/recording/tape/recordings.d.ts +58 -4
- package/dist/language/flows/recording/tape/recordings.js +95 -13
- package/dist/language/flows/replay-from-hud.d.ts +20 -0
- package/dist/language/flows/replay-from-hud.js +51 -0
- package/dist/language/flows/replay.d.ts +9 -5
- package/dist/language/flows/replay.js +56 -15
- package/dist/language/flows/single-replay.d.ts +7 -0
- package/dist/language/flows/single-replay.js +26 -0
- package/dist/language/flows/suite/suite-flakes.js +2 -0
- package/dist/language/flows/suite-selection.d.ts +2 -15
- package/dist/language/flows/suite-selection.js +4 -3
- package/dist/language/flows/verify-change-tools.d.ts +1 -0
- package/dist/language/flows/verify-change-tools.js +202 -191
- package/dist/launch-chromium.d.ts +27 -5
- package/dist/launch-chromium.js +38 -8
- package/dist/memory/cloud/cloud-config.d.ts +22 -1
- package/dist/memory/cloud/cloud-config.js +34 -5
- package/dist/memory/cloud/cloud-sync.d.ts +17 -14
- package/dist/memory/cloud/cloud-sync.js +15 -4
- package/dist/memory/cloud/harness-config.d.ts +75 -1
- package/dist/memory/cloud/harness-config.js +115 -24
- package/dist/memory/cloud/hud-notices-source.d.ts +21 -0
- package/dist/memory/cloud/hud-notices-source.js +128 -0
- package/dist/memory/cloud/memory-scope.d.ts +161 -0
- package/dist/memory/cloud/memory-scope.js +227 -0
- package/dist/memory/cloud/sync-cycle.d.ts +44 -7
- package/dist/memory/cloud/sync-cycle.js +129 -15
- package/dist/memory/cloud/sync-daemon.d.ts +11 -0
- package/dist/memory/cloud/sync-daemon.js +121 -9
- package/dist/memory/cloud/sync-disk.d.ts +1 -1
- package/dist/memory/cloud/sync-disk.js +31 -10
- package/dist/memory/cloud/sync-screenshots.d.ts +32 -0
- package/dist/memory/cloud/sync-screenshots.js +105 -0
- package/dist/memory/cloud/unsynced-roots.d.ts +47 -0
- package/dist/memory/cloud/unsynced-roots.js +166 -0
- package/dist/memory/impact/account-watch.d.ts +34 -0
- package/dist/memory/impact/account-watch.js +59 -0
- package/dist/memory/impact/impact-recorder.d.ts +8 -0
- package/dist/memory/impact/impact-recorder.js +12 -2
- package/dist/memory/impact/impact-store.d.ts +17 -4
- package/dist/memory/impact/impact-store.js +169 -63
- package/dist/memory/intent/inline-intent.d.ts +1 -0
- package/dist/memory/intent/intent-shard-store.js +16 -4
- package/dist/memory/intent/intent-shard.d.ts +14 -2
- package/dist/memory/intent/intent-store.d.ts +1 -0
- package/dist/memory/intent/intent-tools.js +122 -4
- package/dist/memory/intent/open-intents.d.ts +6 -0
- package/dist/memory/intent/open-intents.js +10 -1
- package/dist/memory/intent/settled-words.d.ts +24 -0
- package/dist/memory/intent/settled-words.js +130 -0
- package/dist/memory/journal/drive-flow.d.ts +16 -0
- package/dist/memory/journal/drive-flow.js +34 -2
- package/dist/memory/journal/drive-run-flush.d.ts +2 -0
- package/dist/memory/journal/drive-run-flush.js +20 -5
- package/dist/memory/journal/envelope.d.ts +8 -8
- package/dist/memory/journal/journal-recorder.js +52 -3
- package/dist/memory/journal/on-disk/retention.d.ts +8 -0
- package/dist/memory/journal/on-disk/retention.js +32 -2
- package/dist/memory/journal/on-disk/startup-maintenance.js +3 -1
- package/dist/memory/journal/on-disk/workspace-tiers.js +9 -4
- package/dist/memory/journal/session-end.d.ts +15 -1
- package/dist/memory/journal/session-end.js +42 -9
- package/dist/memory/project/artifact-root-resolver.d.ts +26 -1
- package/dist/memory/project/artifact-root-resolver.js +125 -16
- package/dist/memory/project/artifact-root.d.ts +46 -8
- package/dist/memory/project/artifact-root.js +89 -10
- package/dist/memory/project/dir/reticle-dir.d.ts +18 -2
- package/dist/memory/project/dir/reticle-dir.js +26 -3
- package/dist/memory/project/link-directory.d.ts +15 -0
- package/dist/memory/project/link-directory.js +44 -0
- package/dist/memory/project/project-tools.js +22 -3
- package/dist/memory/project/root-claims.d.ts +6 -0
- package/dist/memory/project/root-claims.js +39 -0
- package/dist/memory/project/session-root.d.ts +26 -1
- package/dist/memory/project/session-root.js +49 -5
- package/dist/memory/project/sync-status.d.ts +85 -0
- package/dist/memory/project/sync-status.js +224 -0
- package/dist/memory/recall/memory-tools.js +47 -2
- package/dist/memory/recall/platform-memory.d.ts +34 -0
- package/dist/memory/recall/platform-memory.js +139 -0
- package/dist/memory/recall/project-memory.d.ts +19 -0
- package/dist/memory/recall/project-memory.js +80 -13
- package/dist/portal/bridge/bridge.d.ts +9 -3
- package/dist/portal/bridge/bridge.js +82 -22
- package/dist/portal/bridge/harness-request.d.ts +23 -0
- package/dist/portal/bridge/harness-request.js +27 -0
- package/dist/portal/bridge/pairing-token.d.ts +9 -0
- package/dist/portal/bridge/pairing-token.js +17 -0
- package/dist/portal/bridge/wrong-path.d.ts +17 -0
- package/dist/portal/bridge/wrong-path.js +35 -0
- package/dist/portal/input/network-mock-tools.js +11 -2
- package/dist/portal/input/real-input.d.ts +83 -10
- package/dist/portal/input/real-input.js +218 -30
- package/dist/portal/input/viewport-tools.js +3 -3
- package/dist/portal/pool/browser-pool.d.ts +70 -9
- package/dist/portal/pool/browser-pool.js +190 -37
- package/dist/portal/pool/context-permissions.d.ts +33 -0
- package/dist/portal/pool/context-permissions.js +33 -0
- package/dist/portal/pool/lease-marker-stamp.d.ts +23 -0
- package/dist/portal/pool/lease-marker-stamp.js +49 -0
- package/dist/portal/pool/playwright-launcher.d.ts +35 -0
- package/dist/portal/pool/playwright-launcher.js +64 -3
- package/dist/portal/pool/pool-contract.d.ts +28 -5
- package/dist/portal/session/agent-link.d.ts +8 -0
- package/dist/portal/session/agent-link.js +17 -0
- package/dist/portal/session/command-payload.d.ts +8 -0
- package/dist/portal/session/command-payload.js +24 -0
- package/dist/portal/session/daemon-answers.d.ts +3 -3
- package/dist/portal/session/daemon-answers.js +4 -2
- package/dist/portal/session/dev-server/dev-command.d.ts +21 -0
- package/dist/portal/session/dev-server/dev-command.js +87 -12
- package/dist/portal/session/facts/departure-note.d.ts +22 -0
- package/dist/portal/session/facts/departure-note.js +47 -0
- package/dist/portal/session/facts/observed-state.d.ts +16 -18
- package/dist/portal/session/facts/observed-state.js +46 -3
- package/dist/portal/session/facts/session-replaced.d.ts +5 -0
- package/dist/portal/session/facts/session-replaced.js +5 -0
- package/dist/portal/session/first-run-wiring.d.ts +42 -0
- package/dist/portal/session/first-run-wiring.js +132 -0
- package/dist/portal/session/human/live-control.d.ts +9 -2
- package/dist/portal/session/human/live-control.js +12 -3
- package/dist/portal/session/human/notes-ledger.d.ts +20 -0
- package/dist/portal/session/human/notes-ledger.js +55 -0
- package/dist/portal/session/human/review-store.d.ts +12 -0
- package/dist/portal/session/human/review-store.js +18 -10
- package/dist/portal/session/live-control-tools.d.ts +0 -13
- package/dist/portal/session/live-control-tools.js +107 -13
- package/dist/portal/session/narration-args.d.ts +5 -0
- package/dist/portal/session/narration-args.js +17 -0
- package/dist/portal/session/no-session-diagnosis.d.ts +8 -1
- package/dist/portal/session/no-session-diagnosis.js +46 -9
- package/dist/portal/session/no-session-next-action.d.ts +31 -0
- package/dist/portal/session/no-session-next-action.js +159 -60
- package/dist/portal/session/no-session-watch.d.ts +14 -1
- package/dist/portal/session/no-session-watch.js +227 -17
- package/dist/portal/session/presence/session-lease.js +1 -1
- package/dist/portal/session/presence/session-mirror.js +3 -0
- package/dist/portal/session/recorded-gaps.d.ts +97 -0
- package/dist/portal/session/recorded-gaps.js +251 -0
- package/dist/portal/session/serving-directory.d.ts +27 -0
- package/dist/portal/session/serving-directory.js +45 -0
- package/dist/portal/session/session-health.d.ts +18 -0
- package/dist/portal/session/session-health.js +9 -1
- package/dist/portal/session/session-info.d.ts +8 -1
- package/dist/portal/session/session-info.js +8 -1
- package/dist/portal/session/session-manager.d.ts +39 -0
- package/dist/portal/session/session-manager.js +98 -11
- package/dist/portal/session/session-reaper.js +4 -1
- package/dist/portal/session/session-successor.d.ts +13 -0
- package/dist/portal/session/session-successor.js +1 -1
- package/dist/portal/session/session-tools.js +26 -3
- package/dist/portal/session/session.d.ts +22 -30
- package/dist/portal/session/session.js +81 -79
- package/dist/portal/session/timing/command-timeout.js +25 -1
- package/dist/portal/session/timing/wall-clock.d.ts +1 -1
- package/dist/portal/session/timing/wall-clock.js +1 -1
- package/dist/portal/session/zero-install-first-call.d.ts +31 -0
- package/dist/portal/session/zero-install-first-call.js +88 -0
- package/dist/start-options.d.ts +12 -0
- package/dist/start-wiring.d.ts +63 -0
- package/dist/start-wiring.js +169 -0
- package/dist/status-payload.d.ts +23 -1
- package/dist/status-payload.js +36 -1
- package/dist/surface/http-server.js +18 -2
- package/dist/surface/mcp/attach-memory.d.ts +1 -0
- package/dist/surface/mcp/attach-memory.js +12 -1
- package/dist/surface/mcp/mcp-proxy.d.ts +9 -0
- package/dist/surface/mcp/mcp-proxy.js +65 -13
- package/dist/surface/mcp/mcp.d.ts +34 -6
- package/dist/surface/mcp/mcp.js +61 -17
- package/dist/surface/mcp/proxy/drive-calls.d.ts +10 -0
- package/dist/surface/mcp/proxy/drive-calls.js +27 -0
- package/dist/surface/mcp/proxy/mcp-post-transport.js +5 -0
- package/dist/surface/mcp/server-instructions.d.ts +4 -2
- package/dist/surface/mcp/server-instructions.js +32 -14
- package/dist/surface/mcp/shared-params.js +2 -2
- package/dist/surface/mcp/surface-vocabulary.d.ts +2 -0
- package/dist/surface/mcp/surface-vocabulary.js +1 -0
- package/dist/surface/tools/account-tool.d.ts +22 -0
- package/dist/surface/tools/account-tool.js +157 -0
- package/dist/surface/tools/act/act-danger.d.ts +11 -0
- package/dist/surface/tools/act/act-danger.js +38 -1
- package/dist/surface/tools/act/act-observation.d.ts +33 -0
- package/dist/surface/tools/act/act-observation.js +57 -0
- package/dist/surface/tools/act/act-preflight.js +25 -2
- package/dist/surface/tools/act/act-target.js +8 -3
- package/dist/surface/tools/act/navigation/navigate-arrival.d.ts +8 -0
- package/dist/surface/tools/act/navigation/navigate-arrival.js +56 -2
- package/dist/surface/tools/act/resolve-target.d.ts +1 -1
- package/dist/surface/tools/act/resolve-target.js +18 -3
- package/dist/surface/tools/act/screen-request.d.ts +34 -0
- package/dist/surface/tools/act/screen-request.js +113 -0
- package/dist/surface/tools/act/sequence-grade.d.ts +8 -0
- package/dist/surface/tools/act/sequence-grade.js +13 -2
- package/dist/surface/tools/act/settle-in-flight.js +25 -3
- package/dist/surface/tools/act-sequence-tool.js +138 -29
- package/dist/surface/tools/act-tools.d.ts +0 -9
- package/dist/surface/tools/act-tools.js +71 -41
- package/dist/surface/tools/agent/app-notes-learning.d.ts +7 -0
- package/dist/surface/tools/agent/app-notes-learning.js +80 -0
- package/dist/surface/tools/agent/app-notes.d.ts +4 -0
- package/dist/surface/tools/agent/app-notes.js +48 -0
- package/dist/surface/tools/agent/build-staleness.d.ts +7 -0
- package/dist/surface/tools/agent/build-staleness.js +62 -0
- package/dist/surface/tools/agent/compact-envelope.d.ts +80 -0
- package/dist/surface/tools/agent/compact-envelope.js +374 -0
- package/dist/surface/tools/agent/for-the-agent.d.ts +12 -0
- package/dist/surface/tools/agent/for-the-agent.js +44 -0
- package/dist/surface/tools/agent/notices.d.ts +50 -0
- package/dist/surface/tools/agent/notices.js +152 -0
- package/dist/surface/tools/agent/reteach.d.ts +11 -0
- package/dist/surface/tools/agent/reteach.js +50 -0
- package/dist/surface/tools/args/alias-args.d.ts +5 -0
- package/dist/surface/tools/args/alias-args.js +10 -0
- package/dist/surface/tools/args/confirm-dangerous-arg.d.ts +6 -0
- package/dist/surface/tools/args/confirm-dangerous-arg.js +6 -0
- package/dist/surface/tools/assert/assert-source.d.ts +15 -0
- package/dist/surface/tools/assert/assert-source.js +40 -0
- package/dist/surface/tools/assert/assert-verdict.d.ts +1 -1
- package/dist/surface/tools/assert/assert-verdict.js +42 -17
- package/dist/surface/tools/browser-tools.js +51 -2
- package/dist/surface/tools/chat-drives.d.ts +101 -0
- package/dist/surface/tools/chat-drives.js +409 -0
- package/dist/surface/tools/coverage-tools.d.ts +2 -10
- package/dist/surface/tools/coverage-tools.js +2 -53
- package/dist/surface/tools/dynamic-tools.js +29 -1
- package/dist/surface/tools/empty-session-list.d.ts +51 -0
- package/dist/surface/tools/empty-session-list.js +120 -0
- package/dist/surface/tools/error-recovery.d.ts +14 -0
- package/dist/surface/tools/error-recovery.js +105 -8
- package/dist/surface/tools/explore-tools.d.ts +31 -1
- package/dist/surface/tools/explore-tools.js +438 -66
- package/dist/surface/tools/feedback-tools.d.ts +2 -3
- package/dist/surface/tools/feedback-tools.js +18 -3
- package/dist/surface/tools/gap-novelty.d.ts +3 -1
- package/dist/surface/tools/gap-novelty.js +8 -1
- package/dist/surface/tools/harness-explore.d.ts +118 -57
- package/dist/surface/tools/harness-explore.js +344 -292
- package/dist/surface/tools/harness-gate.d.ts +88 -0
- package/dist/surface/tools/harness-gate.js +235 -0
- package/dist/surface/tools/harness-hunt.d.ts +43 -0
- package/dist/surface/tools/harness-hunt.js +215 -0
- package/dist/surface/tools/harness-plan.d.ts +17 -0
- package/dist/surface/tools/harness-plan.js +38 -0
- package/dist/surface/tools/harness-script.d.ts +30 -0
- package/dist/surface/tools/harness-script.js +560 -0
- package/dist/surface/tools/harness-tab-guard.d.ts +5 -0
- package/dist/surface/tools/harness-tab-guard.js +27 -0
- package/dist/surface/tools/harness-toolset.d.ts +22 -1
- package/dist/surface/tools/harness-toolset.js +101 -7
- package/dist/surface/tools/human-notes.d.ts +16 -0
- package/dist/surface/tools/human-notes.js +27 -0
- package/dist/surface/tools/invoke-tool.d.ts +5 -2
- package/dist/surface/tools/invoke-tool.js +263 -85
- package/dist/surface/tools/lease-hint.js +26 -5
- package/dist/surface/tools/lease-permissions.d.ts +33 -0
- package/dist/surface/tools/lease-permissions.js +73 -0
- package/dist/surface/tools/lease-readiness.d.ts +38 -0
- package/dist/surface/tools/lease-readiness.js +57 -0
- package/dist/surface/tools/lease-seed.d.ts +49 -0
- package/dist/surface/tools/lease-seed.js +167 -0
- package/dist/surface/tools/lease-tools.d.ts +13 -24
- package/dist/surface/tools/lease-tools.js +146 -197
- package/dist/surface/tools/live-call-text.js +4 -4
- package/dist/surface/tools/merge-tools.js +42 -2
- package/dist/surface/tools/merged-name-redirect.js +4 -0
- package/dist/surface/tools/next-step.d.ts +29 -0
- package/dist/surface/tools/next-step.js +214 -0
- package/dist/surface/tools/observe-tools.js +45 -9
- package/dist/surface/tools/platform-moment.d.ts +72 -0
- package/dist/surface/tools/platform-moment.js +296 -0
- package/dist/surface/tools/query-hint-schema.d.ts +7 -0
- package/dist/surface/tools/query-hint-schema.js +10 -0
- package/dist/surface/tools/read-tools.js +71 -14
- package/dist/surface/tools/real-input-attempt.js +96 -13
- package/dist/surface/tools/reticle-result.d.ts +120 -0
- package/dist/surface/tools/reticle-result.js +364 -0
- package/dist/surface/tools/tool-kit.d.ts +83 -3
- package/dist/surface/tools/tool-kit.js +77 -7
- package/dist/surface/tools/tools.js +43 -59
- package/dist/telemetry/account-envelope.d.ts +7 -0
- package/dist/telemetry/account-envelope.js +61 -0
- package/dist/telemetry/agent-client.d.ts +15 -0
- package/dist/telemetry/agent-client.js +57 -0
- package/dist/telemetry/app-instrumented.js +9 -2
- package/dist/telemetry/argument-shape.d.ts +7 -0
- package/dist/telemetry/argument-shape.js +86 -1
- package/dist/telemetry/automation-hint.d.ts +2 -3
- package/dist/telemetry/automation-hint.js +33 -8
- package/dist/telemetry/cli-telemetry.js +7 -2
- package/dist/telemetry/daemon-telemetry.js +3 -0
- package/dist/telemetry/error-fingerprint.d.ts +10 -1
- package/dist/telemetry/error-fingerprint.js +61 -5
- package/dist/telemetry/feedback-cli.d.ts +0 -13
- package/dist/telemetry/feedback-cli.js +0 -77
- package/dist/telemetry/feedback.d.ts +13 -0
- package/dist/telemetry/feedback.js +183 -17
- package/dist/telemetry/harness-run.d.ts +18 -0
- package/dist/telemetry/harness-run.js +80 -0
- package/dist/telemetry/hud-events.d.ts +16 -0
- package/dist/telemetry/hud-events.js +27 -0
- package/dist/telemetry/hud-metrics.d.ts +29 -6
- package/dist/telemetry/hud-metrics.js +116 -25
- package/dist/telemetry/init-telemetry.js +2 -2
- package/dist/telemetry/install-source.d.ts +13 -25
- package/dist/telemetry/install-source.js +44 -3
- package/dist/telemetry/mcp-connection.d.ts +0 -14
- package/dist/telemetry/mcp-connection.js +5 -1
- package/dist/telemetry/onboarding-firsts.d.ts +32 -0
- package/dist/telemetry/onboarding-firsts.js +81 -6
- package/dist/telemetry/platform-linked.d.ts +5 -0
- package/dist/telemetry/platform-linked.js +32 -0
- package/dist/telemetry/project-profile.js +5 -3
- package/dist/telemetry/proxy-telemetry.js +4 -1
- package/dist/telemetry/session-metrics.d.ts +15 -4
- package/dist/telemetry/session-metrics.js +88 -52
- package/dist/telemetry/telemetry.d.ts +38 -2
- package/dist/telemetry/telemetry.js +144 -34
- package/dist/telemetry/verification-of.d.ts +3 -1
- package/dist/telemetry/verification-of.js +13 -4
- package/dist/wire-journal.d.ts +2 -2
- package/dist/wire-journal.js +20 -6
- package/docs/README.md +3 -3
- package/docs/actions.mdx +6 -3
- package/docs/adapters.md +1 -1
- package/docs/agent-cheatsheet.md +25 -28
- package/docs/architecture.md +5 -5
- package/docs/autodrive.md +33 -28
- package/docs/benchmarks.md +5 -5
- package/docs/best-practices.mdx +27 -9
- package/docs/capabilities.mdx +14 -16
- package/docs/cli/affected.mdx +1 -1
- package/docs/cli/cloud.mdx +54 -75
- package/docs/cli/doctor.mdx +14 -3
- package/docs/cli/drive.mdx +20 -14
- package/docs/cli/feedback.mdx +3 -3
- package/docs/cli/gate.mdx +7 -2
- package/docs/cli/help.mdx +50 -55
- package/docs/cli/init.mdx +43 -28
- package/docs/cli/license.mdx +12 -8
- package/docs/cli/mcp.mdx +4 -4
- package/docs/cli/open.mdx +3 -3
- package/docs/cli/report.mdx +4 -2
- package/docs/cli/restart.mdx +2 -2
- package/docs/cli/rollback.mdx +14 -8
- package/docs/cli/serve.mdx +4 -4
- package/docs/cli/setup.mdx +23 -0
- package/docs/cli/status.mdx +18 -5
- package/docs/cli/stop.mdx +67 -8
- package/docs/cli/try.mdx +62 -0
- package/docs/cli/update.mdx +4 -3
- package/docs/cli/verify.mdx +17 -6
- package/docs/cli/version.mdx +5 -4
- package/docs/cli.mdx +111 -42
- package/docs/debugging.md +3 -3
- package/docs/deploy-checks.md +1 -1
- package/docs/desktop.mdx +9 -3
- package/docs/enterprise.md +11 -10
- package/docs/environment.mdx +7 -8
- package/docs/faq.mdx +3 -3
- package/docs/first-drive.md +5 -4
- package/docs/flows.md +35 -27
- package/docs/for-agents.md +4 -5
- package/docs/frameworks.mdx +32 -21
- package/docs/getting-started.md +65 -61
- package/docs/human-control.md +16 -16
- package/docs/index.mdx +15 -42
- package/docs/install-agentic.mdx +22 -37
- package/docs/install-manual.mdx +23 -13
- package/docs/instrumentation.mdx +5 -3
- package/docs/integration-patterns.md +7 -7
- package/docs/license-activation.mdx +1 -1
- package/docs/multi-agent-testing.md +24 -6
- package/docs/packages/babel-plugin.mdx +4 -2
- package/docs/packages/browser.mdx +16 -10
- package/docs/packages/core.mdx +12 -5
- package/docs/packages/electron.mdx +3 -2
- package/docs/packages/engine.mdx +1 -1
- package/docs/packages/eslint-plugin.mdx +18 -12
- package/docs/packages/next.mdx +8 -7
- package/docs/packages/open-verification.mdx +1 -1
- package/docs/packages/server.mdx +5 -5
- package/docs/packages/tauri.mdx +9 -9
- package/docs/packages/test.mdx +4 -10
- package/docs/packages/vite-plugin.mdx +32 -4
- package/docs/packages.mdx +11 -15
- package/docs/platform-integration.md +6 -5
- package/docs/predicates.mdx +40 -24
- package/docs/quickstart.mdx +69 -30
- package/docs/required-checks.md +8 -7
- package/docs/reticle-manual.md +15 -5
- package/docs/skill-file.mdx +17 -79
- package/docs/skill-setup.md +9 -9
- package/docs/skill.md +200 -0
- package/docs/system-map.md +7 -7
- package/docs/telemetry.md +23 -25
- package/docs/testing.md +4 -4
- package/docs/token-efficiency.md +12 -12
- package/docs/tools/act-and-wait.mdx +9 -2
- package/docs/tools/act-sequence.mdx +6 -7
- package/docs/tools/act.mdx +2 -2
- package/docs/tools/assert.mdx +18 -17
- package/docs/tools/console.mdx +9 -9
- package/docs/tools/inspect.mdx +16 -7
- package/docs/tools/look.mdx +24 -0
- package/docs/tools/navigate.mdx +5 -3
- package/docs/tools/network.mdx +2 -2
- package/docs/tools/observe.mdx +6 -6
- package/docs/tools/overview.mdx +34 -33
- package/docs/tools/query.mdx +5 -5
- package/docs/tools/session-and-feedback.mdx +22 -13
- package/docs/tools/sessions.mdx +8 -8
- package/docs/tools/snapshot.mdx +6 -5
- package/docs/tools/state.mdx +9 -9
- package/docs/tools/tools-and-run.mdx +26 -24
- package/docs/tools/verify.mdx +28 -0
- package/docs/tools/wait-for.mdx +8 -4
- package/docs/troubleshooting.mdx +21 -6
- package/docs/usage.md +55 -46
- package/docs/use-cases.mdx +3 -3
- package/docs/vs-chrome-devtools-mcp.mdx +9 -6
- package/docs/vs-playwright-mcp.mdx +3 -1
- package/docs/what-is-recorded.md +17 -5
- package/docs/what-is-reticle.mdx +5 -3
- package/docs/why-reticle.mdx +1 -1
- package/package.json +9 -12
- package/dist/command/cli/demo/demo-page.d.ts +0 -78
- package/dist/command/cli/demo/demo-page.js +0 -241
- package/dist/command/cli/demo/demo-run.d.ts +0 -38
- package/dist/command/cli/demo/demo-run.js +0 -138
- package/dist/features/harness/driver.d.ts +0 -50
- package/dist/features/harness/driver.js +0 -236
- package/dist/features/harness/jev-driver.d.ts +0 -188
- package/dist/features/harness/jev-driver.js +0 -678
- package/dist/features/harness/openai-driver.d.ts +0 -58
- package/dist/features/harness/openai-driver.js +0 -206
- package/dist/judgement/hunt/hunt-report.d.ts +0 -49
- package/dist/judgement/hunt/hunt-report.js +0 -84
- package/dist/language/flows/buddy-status.d.ts +0 -25
- package/dist/language/flows/buddy-status.js +0 -32
- package/dist/language/flows/change/watch-batcher.d.ts +0 -18
- package/dist/language/flows/change/watch-batcher.js +0 -19
- package/dist/memory/cloud/harness-offer.d.ts +0 -44
- package/dist/memory/cloud/harness-offer.js +0 -145
- package/dist/memory/project/dir/fill-value-store.d.ts +0 -32
- package/dist/memory/project/dir/fill-value-store.js +0 -88
- package/dist/surface/tools/feature-capture.d.ts +0 -151
- package/dist/surface/tools/feature-capture.js +0 -235
- package/dist/surface/tools/tool-hit-rate.d.ts +0 -87
- package/dist/surface/tools/tool-hit-rate.js +0 -90
- package/dist/telemetry/harness-drive.d.ts +0 -4
- package/dist/telemetry/harness-drive.js +0 -35
- package/dist/telemetry/identify.d.ts +0 -22
- package/dist/telemetry/identify.js +0 -73
- package/docs/cli/capsules.mdx +0 -70
- package/docs/cli/hunt.mdx +0 -73
- package/docs/cli/identify.mdx +0 -76
- package/docs/cli/kill.mdx +0 -91
- package/docs/cli/watch.mdx +0 -62
- package/docs/local-registry.md +0 -143
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compact envelope: what a verdict result carries by default, and what waits behind
|
|
3
|
+
* `detail: "full"`.
|
|
4
|
+
*
|
|
5
|
+
* The rule (plan: "the middle ground — what a result carries"): answer the question, include what
|
|
6
|
+
* decides the next move, and give a cursor for the rest. A click on a cache-backed page used to
|
|
7
|
+
* return several thousand tokens, most of it store snapshots and counters, and the verdict was a
|
|
8
|
+
* field among them. Compaction never touches a decisive key — `verified`, `because`, the verdict's
|
|
9
|
+
* expected/observed/evidence, contradictions, capture integrity, failed requests, console errors,
|
|
10
|
+
* the acted element's source — and `compact-envelope.contract.test.ts` fails the build if it ever
|
|
11
|
+
* does. What it drops is redundant (identity fields the agent sent), restated (counts the `changed`
|
|
12
|
+
* line already says) or always one `reticle_observe { since }` away.
|
|
13
|
+
*
|
|
14
|
+
* It works by DROPPING named keys, never by allow-listing: a field added to a result later survives
|
|
15
|
+
* compaction until somebody decides it should not. The accurate direction to fail in.
|
|
16
|
+
*
|
|
17
|
+
* Applied once, at the dispatch chokepoint, to an agent's own calls. The Harness and the HUD read
|
|
18
|
+
* the full result; so does telemetry, which runs before this.
|
|
19
|
+
*/
|
|
20
|
+
import { z } from 'zod';
|
|
21
|
+
import { ReticleTool, asRecord, predicateAliasesUsed } from '@reticlehq/core';
|
|
22
|
+
/** The argument that asks for today's full envelope. */
|
|
23
|
+
export const DETAIL_ARG = 'detail';
|
|
24
|
+
export const Detail = { COMPACT: 'compact', FULL: 'full' };
|
|
25
|
+
/**
|
|
26
|
+
* The A/B control: `RETICLE_RESULT_DETAIL=full` makes every agent call answer as if it had passed
|
|
27
|
+
* `detail: "full"`, so the agent-loop benchmark can run compact against full on the same build with
|
|
28
|
+
* nothing else different — the measurement CLAUDE.md requires beside any token optimisation.
|
|
29
|
+
*/
|
|
30
|
+
export const RESULT_DETAIL_ENV = 'RETICLE_RESULT_DETAIL';
|
|
31
|
+
/**
|
|
32
|
+
* Did this call (or the daemon's environment) ask for the full envelope AND nothing else — no
|
|
33
|
+
* notices, no re-teach? Only an explicit ask: the A/B control arm, and an agent that said so.
|
|
34
|
+
*/
|
|
35
|
+
export function wantsFull(args) {
|
|
36
|
+
return Detail.FULL === args[DETAIL_ARG] || Detail.FULL === process.env[RESULT_DETAIL_ENV];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Did this call (or the daemon) ask for the compact envelope? Compaction is opt-in: in the
|
|
40
|
+
* agent-loop A/B the compact arm saved little per task and missed one failure the full arm caught,
|
|
41
|
+
* and a token saving ships only beside a correctness measurement that is at least as good.
|
|
42
|
+
*/
|
|
43
|
+
export function wantsCompact(args) {
|
|
44
|
+
return Detail.COMPACT === (args[DETAIL_ARG] ?? process.env[RESULT_DETAIL_ENV]);
|
|
45
|
+
}
|
|
46
|
+
/** The tools whose results are compacted. Each one's full shape stays one argument away. */
|
|
47
|
+
export const COMPACTED_TOOLS = new Set([
|
|
48
|
+
ReticleTool.ACT_AND_WAIT,
|
|
49
|
+
ReticleTool.ASSERT,
|
|
50
|
+
ReticleTool.WAIT_FOR,
|
|
51
|
+
ReticleTool.ACT_SEQUENCE,
|
|
52
|
+
// The merged surface's `reticle_act` routes `steps` to the sequence handler.
|
|
53
|
+
ReticleTool.ACT,
|
|
54
|
+
]);
|
|
55
|
+
/** Short enough for the per-turn surface; the reasoning lives in this file and the instructions. */
|
|
56
|
+
export const DETAIL_ARG_DESCRIPTION = '"compact" keeps only the deciding fields.';
|
|
57
|
+
/** Where the aliases a predicate was normalised from are named. */
|
|
58
|
+
export const NORMALIZED_KEY = 'normalized';
|
|
59
|
+
/**
|
|
60
|
+
* The aliases the call's predicates were written in (`until`/`predicate`, and each step's `expect`).
|
|
61
|
+
* The parse accepted them silently; this says so, so the canonical spelling is learned once.
|
|
62
|
+
*/
|
|
63
|
+
function aliasesWritten(args) {
|
|
64
|
+
const used = [...predicateAliasesUsed(args['until']), ...predicateAliasesUsed(args['predicate'])];
|
|
65
|
+
const steps = args['steps'];
|
|
66
|
+
if (Array.isArray(steps)) {
|
|
67
|
+
steps.forEach((step, i) => {
|
|
68
|
+
for (const alias of predicateAliasesUsed(asRecord(step)['expect'])) {
|
|
69
|
+
used.push(`step ${String(i)}: ${alias}`);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return used;
|
|
74
|
+
}
|
|
75
|
+
/** The key the one-line "what changed" summary travels under. */
|
|
76
|
+
export const CHANGED_KEY = 'changed';
|
|
77
|
+
/** Effect keys that only repeat what the agent sent, or restate a default. */
|
|
78
|
+
const EFFECT_IDENTITY_KEYS = [
|
|
79
|
+
'ok',
|
|
80
|
+
'ref',
|
|
81
|
+
'action',
|
|
82
|
+
'testid',
|
|
83
|
+
'component',
|
|
84
|
+
'role',
|
|
85
|
+
'name',
|
|
86
|
+
'source',
|
|
87
|
+
];
|
|
88
|
+
/** Nested effect keys that describe the motion, not the outcome. */
|
|
89
|
+
const EFFECT_MOTION_KEYS = ['focusMoved'];
|
|
90
|
+
/**
|
|
91
|
+
* Evidence keys that describe HOW a request travelled, not what decided the verdict. Removed only
|
|
92
|
+
* from the evidence's own records, wherever they nest; every other key — the method, url, status,
|
|
93
|
+
* the matched body field — stays.
|
|
94
|
+
*/
|
|
95
|
+
const EVIDENCE_NOISE_KEYS = new Set([
|
|
96
|
+
'initiatorStack',
|
|
97
|
+
'initiator',
|
|
98
|
+
'requestShape',
|
|
99
|
+
'responseSize',
|
|
100
|
+
'requestSize',
|
|
101
|
+
'contentType',
|
|
102
|
+
'statusText',
|
|
103
|
+
'headers',
|
|
104
|
+
'requestHeaders',
|
|
105
|
+
'responseHeaders',
|
|
106
|
+
'timing',
|
|
107
|
+
]);
|
|
108
|
+
/** A request slower than this keeps its duration: slowness is then the finding. */
|
|
109
|
+
const SLOW_MS = 1000;
|
|
110
|
+
/** The causal-summary keys that decide something, kept beside the `changed` line. */
|
|
111
|
+
const DECISIVE_SUMMARY_KEYS = [
|
|
112
|
+
'consoleErrors',
|
|
113
|
+
'firstConsoleError',
|
|
114
|
+
'truncated',
|
|
115
|
+
'stateUnwatched',
|
|
116
|
+
'elided',
|
|
117
|
+
];
|
|
118
|
+
function isRecord(value) {
|
|
119
|
+
return 'object' === typeof value && null !== value && !Array.isArray(value);
|
|
120
|
+
}
|
|
121
|
+
function without(record, keys) {
|
|
122
|
+
const out = { ...record };
|
|
123
|
+
for (const key of keys)
|
|
124
|
+
delete out[key];
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
/** Evidence with transport detail removed, recursively, keeping every deciding field. */
|
|
128
|
+
export function trimEvidence(value, depth = 0) {
|
|
129
|
+
if (depth > 4)
|
|
130
|
+
return value;
|
|
131
|
+
if (Array.isArray(value))
|
|
132
|
+
return value.map((item) => trimEvidence(item, depth + 1));
|
|
133
|
+
if (!isRecord(value))
|
|
134
|
+
return value;
|
|
135
|
+
const out = {};
|
|
136
|
+
for (const [key, item] of Object.entries(value)) {
|
|
137
|
+
if (EVIDENCE_NOISE_KEYS.has(key))
|
|
138
|
+
continue;
|
|
139
|
+
if ('durationMs' === key && 'number' === typeof item && item < SLOW_MS)
|
|
140
|
+
continue;
|
|
141
|
+
out[key] = trimEvidence(item, depth + 1);
|
|
142
|
+
}
|
|
143
|
+
return out;
|
|
144
|
+
}
|
|
145
|
+
/** `src/x.tsx:81` from a `{file,line}` source record, or the string as given. */
|
|
146
|
+
function sourceLabel(source) {
|
|
147
|
+
if ('string' === typeof source)
|
|
148
|
+
return source;
|
|
149
|
+
if (!isRecord(source) || 'string' !== typeof source['file'])
|
|
150
|
+
return undefined;
|
|
151
|
+
return 'number' === typeof source['line']
|
|
152
|
+
? `${source['file']}:${String(source['line'])}`
|
|
153
|
+
: source['file'];
|
|
154
|
+
}
|
|
155
|
+
/** The `{effect}` of an act, keeping only what says something the agent did not already know. */
|
|
156
|
+
function compactEffect(effect) {
|
|
157
|
+
const out = without(effect, EFFECT_IDENTITY_KEYS);
|
|
158
|
+
if (true === out['dispatched'])
|
|
159
|
+
delete out['dispatched'];
|
|
160
|
+
if (true === out['settled'])
|
|
161
|
+
delete out['settled'];
|
|
162
|
+
if (null === out['settleReason'] || undefined === out['settleReason'])
|
|
163
|
+
delete out['settleReason'];
|
|
164
|
+
const nested = out['effect'];
|
|
165
|
+
if (isRecord(nested)) {
|
|
166
|
+
const lean = without(nested, EFFECT_MOTION_KEYS);
|
|
167
|
+
if (0 === Object.keys(lean).length)
|
|
168
|
+
delete out['effect'];
|
|
169
|
+
else
|
|
170
|
+
out['effect'] = lean;
|
|
171
|
+
}
|
|
172
|
+
return out;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* One line naming what moved: the route, the requests, the MEANINGFUL state paths (cache
|
|
176
|
+
* bookkeeping is already filtered out upstream), storage keys, fields and signals.
|
|
177
|
+
*/
|
|
178
|
+
export function changedLine(summary) {
|
|
179
|
+
const parts = [];
|
|
180
|
+
if ('string' === typeof summary['route'])
|
|
181
|
+
parts.push(`route ${summary['route']}`);
|
|
182
|
+
const requests = Array.isArray(summary['requests']) ? summary['requests'] : [];
|
|
183
|
+
if (requests.length > 0)
|
|
184
|
+
parts.push(requests.map(String).join(', '));
|
|
185
|
+
const stateDiffs = Array.isArray(summary['stateDiffs'])
|
|
186
|
+
? summary['stateDiffs']
|
|
187
|
+
: [];
|
|
188
|
+
const statePaths = [...new Set(stateDiffs.map((d) => asRecord(d)['path']).map(String))];
|
|
189
|
+
if (statePaths.length > 0)
|
|
190
|
+
parts.push(`state ${statePaths.join(', ')}`);
|
|
191
|
+
const list = (key, label) => {
|
|
192
|
+
const items = summary[key];
|
|
193
|
+
if (Array.isArray(items) && items.length > 0)
|
|
194
|
+
parts.push(`${label} ${items.map(String).join(', ')}`);
|
|
195
|
+
};
|
|
196
|
+
list('storageKeysChanged', 'storage');
|
|
197
|
+
list('fieldsChanged', 'fields');
|
|
198
|
+
list('signals', 'signal');
|
|
199
|
+
return 0 === parts.length ? undefined : parts.join(' · ');
|
|
200
|
+
}
|
|
201
|
+
/** The causal summary reduced to the facts that decide something, or undefined when none did. */
|
|
202
|
+
function decisiveSummary(summary) {
|
|
203
|
+
const out = {};
|
|
204
|
+
for (const key of DECISIVE_SUMMARY_KEYS) {
|
|
205
|
+
const value = summary[key];
|
|
206
|
+
if (value === undefined || 0 === value)
|
|
207
|
+
continue;
|
|
208
|
+
out[key] = value;
|
|
209
|
+
}
|
|
210
|
+
const net = asRecord(summary['net']);
|
|
211
|
+
if ('number' === typeof net['errors'] && net['errors'] > 0) {
|
|
212
|
+
out['net'] = {
|
|
213
|
+
errors: net['errors'],
|
|
214
|
+
...(net['headline'] === undefined ? {} : { headline: net['headline'] }),
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
return 0 === Object.keys(out).length ? undefined : out;
|
|
218
|
+
}
|
|
219
|
+
/** Honesty: the grade, integrity always, the rest only when it says something. */
|
|
220
|
+
function compactHonesty(honesty) {
|
|
221
|
+
const out = { ...honesty };
|
|
222
|
+
if ('window' === out['attribution'])
|
|
223
|
+
delete out['attribution'];
|
|
224
|
+
const coverage = asRecord(out['coverage']);
|
|
225
|
+
if (true !== coverage['partial'])
|
|
226
|
+
delete out['coverage'];
|
|
227
|
+
if (true === out['settled'])
|
|
228
|
+
delete out['settled'];
|
|
229
|
+
return out;
|
|
230
|
+
}
|
|
231
|
+
/** A gap repeated this session carries no remedy and no news — drop it. */
|
|
232
|
+
function freshGaps(gaps) {
|
|
233
|
+
return Array.isArray(gaps) ? gaps.filter((gap) => true !== asRecord(gap)['repeat']) : [];
|
|
234
|
+
}
|
|
235
|
+
/** The screenshot by path, or the reason there is none. */
|
|
236
|
+
function compactScreenshot(shot) {
|
|
237
|
+
if (!isRecord(shot) || 'string' !== typeof shot['path'])
|
|
238
|
+
return shot;
|
|
239
|
+
return { path: shot['path'] };
|
|
240
|
+
}
|
|
241
|
+
/** One verdict result (act_and_wait, assert, wait_for), compacted. Idempotent. */
|
|
242
|
+
export function compactVerdict(result) {
|
|
243
|
+
const out = { ...result };
|
|
244
|
+
delete out['trace'];
|
|
245
|
+
const effect = out['effect'];
|
|
246
|
+
if (isRecord(effect)) {
|
|
247
|
+
if (out['ref'] === undefined && 'string' === typeof effect['ref'])
|
|
248
|
+
out['ref'] = effect['ref'];
|
|
249
|
+
const source = sourceLabel(effect['source']);
|
|
250
|
+
if (out['source'] === undefined && source !== undefined)
|
|
251
|
+
out['source'] = source;
|
|
252
|
+
const lean = compactEffect(effect);
|
|
253
|
+
if (0 === Object.keys(lean).length)
|
|
254
|
+
delete out['effect'];
|
|
255
|
+
else
|
|
256
|
+
out['effect'] = lean;
|
|
257
|
+
}
|
|
258
|
+
const verdict = out['verdict'];
|
|
259
|
+
if (isRecord(verdict) && verdict['evidence'] !== undefined) {
|
|
260
|
+
out['verdict'] = { ...verdict, evidence: trimEvidence(verdict['evidence']) };
|
|
261
|
+
}
|
|
262
|
+
const summary = out['summary'];
|
|
263
|
+
// A summary carrying `net` as an object is the full causal summary; a compact one never does.
|
|
264
|
+
if (isRecord(summary) &&
|
|
265
|
+
isRecord(summary['net']) &&
|
|
266
|
+
'number' === typeof summary['net']['total']) {
|
|
267
|
+
const line = changedLine(summary);
|
|
268
|
+
if (line !== undefined)
|
|
269
|
+
out[CHANGED_KEY] = line;
|
|
270
|
+
const decisive = decisiveSummary(summary);
|
|
271
|
+
if (decisive === undefined)
|
|
272
|
+
delete out['summary'];
|
|
273
|
+
else
|
|
274
|
+
out['summary'] = decisive;
|
|
275
|
+
}
|
|
276
|
+
if (isRecord(out['honesty']))
|
|
277
|
+
out['honesty'] = compactHonesty(out['honesty']);
|
|
278
|
+
if (out['instrumentationGaps'] !== undefined) {
|
|
279
|
+
const gaps = freshGaps(out['instrumentationGaps']);
|
|
280
|
+
if (0 === gaps.length)
|
|
281
|
+
delete out['instrumentationGaps'];
|
|
282
|
+
else
|
|
283
|
+
out['instrumentationGaps'] = gaps;
|
|
284
|
+
}
|
|
285
|
+
if (out['screenshot'] !== undefined)
|
|
286
|
+
out['screenshot'] = compactScreenshot(out['screenshot']);
|
|
287
|
+
// The blast radius on a green mostly restates the `changed` line. Its undeclared REQUESTS are the
|
|
288
|
+
// exception — "it worked, and it also fired a DELETE" — so those stay. On a red it lives in the
|
|
289
|
+
// capsule, which is kept whole.
|
|
290
|
+
if (out[CHANGED_KEY] !== undefined && Array.isArray(out['blastRadius'])) {
|
|
291
|
+
const requests = out['blastRadius'].filter((b) => 'string' === typeof b && b.startsWith('net '));
|
|
292
|
+
if (0 === requests.length)
|
|
293
|
+
delete out['blastRadius'];
|
|
294
|
+
else
|
|
295
|
+
out['blastRadius'] = requests;
|
|
296
|
+
}
|
|
297
|
+
return out;
|
|
298
|
+
}
|
|
299
|
+
/** One sequence step, compacted: the outcome, its source, its screenshot, its contradictions. */
|
|
300
|
+
function compactStep(step) {
|
|
301
|
+
if (!isRecord(step))
|
|
302
|
+
return step;
|
|
303
|
+
const out = without(step, ['testid', 'component', 'role', 'name', 'digest']);
|
|
304
|
+
if (true === out['dispatched'])
|
|
305
|
+
delete out['dispatched'];
|
|
306
|
+
if (true === out['settled'])
|
|
307
|
+
delete out['settled'];
|
|
308
|
+
if (null === out['settleReason'])
|
|
309
|
+
delete out['settleReason'];
|
|
310
|
+
const source = sourceLabel(out['source']);
|
|
311
|
+
if (source !== undefined)
|
|
312
|
+
out['source'] = source;
|
|
313
|
+
if (out['screenshot'] !== undefined)
|
|
314
|
+
out['screenshot'] = compactScreenshot(out['screenshot']);
|
|
315
|
+
return out;
|
|
316
|
+
}
|
|
317
|
+
/** A sequence result, compacted per step. Idempotent. */
|
|
318
|
+
export function compactSequence(result) {
|
|
319
|
+
if (!Array.isArray(result['steps']))
|
|
320
|
+
return result;
|
|
321
|
+
return { ...result, steps: result['steps'].map(compactStep) };
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* The result as an agent receives it: full unless it asked for `detail: "compact"`.
|
|
325
|
+
*
|
|
326
|
+
* `agentCall` is the dispatcher's own judgement (an MCP connection, not the Harness or the HUD).
|
|
327
|
+
*/
|
|
328
|
+
export function shapeForAgent(tool, args, result, agentCall) {
|
|
329
|
+
if (!agentCall || !COMPACTED_TOOLS.has(tool) || !isRecord(result))
|
|
330
|
+
return result;
|
|
331
|
+
const normalized = aliasesWritten(args);
|
|
332
|
+
const noted = 0 === normalized.length ? result : { ...result, [NORMALIZED_KEY]: normalized };
|
|
333
|
+
if (!wantsCompact(args))
|
|
334
|
+
return noted;
|
|
335
|
+
if (Array.isArray(noted['steps']))
|
|
336
|
+
return compactSequence(noted);
|
|
337
|
+
return 'verified' in noted ? compactVerdict(noted) : noted;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* The compacted tools, with `detail` accepted and the compact-only keys declared.
|
|
341
|
+
*
|
|
342
|
+
* Declared because a schema-strict client validates `structuredContent` against `outputSchema` and
|
|
343
|
+
* drops what is not there: `changed`, `ref` and `source` would be built and silently thrown away.
|
|
344
|
+
*/
|
|
345
|
+
export function withCompactEnvelope(tools) {
|
|
346
|
+
return tools.map((tool) => {
|
|
347
|
+
if (!COMPACTED_TOOLS.has(tool.name))
|
|
348
|
+
return tool;
|
|
349
|
+
const output = tool.outputSchema;
|
|
350
|
+
return {
|
|
351
|
+
...tool,
|
|
352
|
+
inputSchema: {
|
|
353
|
+
...tool.inputSchema,
|
|
354
|
+
[DETAIL_ARG]: z
|
|
355
|
+
.enum([Detail.COMPACT, Detail.FULL])
|
|
356
|
+
.optional()
|
|
357
|
+
.describe(DETAIL_ARG_DESCRIPTION),
|
|
358
|
+
},
|
|
359
|
+
...(output === undefined
|
|
360
|
+
? {}
|
|
361
|
+
: {
|
|
362
|
+
outputSchema: {
|
|
363
|
+
[CHANGED_KEY]: z.string().optional(),
|
|
364
|
+
ref: z.string().optional(),
|
|
365
|
+
source: z.string().optional(),
|
|
366
|
+
[NORMALIZED_KEY]: z.array(z.string()).optional(),
|
|
367
|
+
caseOnlyMiss: z.boolean().optional(),
|
|
368
|
+
wouldHold: z.string().optional(),
|
|
369
|
+
...output,
|
|
370
|
+
},
|
|
371
|
+
}),
|
|
372
|
+
};
|
|
373
|
+
});
|
|
374
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type NoticeFold } from './notices.js';
|
|
2
|
+
export interface AgentAnswer {
|
|
3
|
+
name: string;
|
|
4
|
+
args: Record<string, unknown>;
|
|
5
|
+
result: unknown;
|
|
6
|
+
/** The agent session; undefined for every caller that is not an agent's own connection. */
|
|
7
|
+
attach: string | undefined;
|
|
8
|
+
/** The project's `.reticle` root, when one resolves. */
|
|
9
|
+
root: string | undefined;
|
|
10
|
+
fold: NoticeFold;
|
|
11
|
+
}
|
|
12
|
+
export declare function forTheAgent(answer: AgentAnswer): unknown;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an agent's own call (an MCP connection, not the Harness or the HUD) receives: compacted, its
|
|
3
|
+
* advisories folded into once-per-session notices, the rule it just broke re-taught once, and — on
|
|
4
|
+
* its first answer — the pointer to the primer and this app's notes.
|
|
5
|
+
*
|
|
6
|
+
* `detail: "full"` keeps today's envelope. `reticle_run` passes its inner call's answer through,
|
|
7
|
+
* which was already shaped. Everything here runs AFTER the verdict was decided and after telemetry
|
|
8
|
+
* read the full result; none of it can change a verdict.
|
|
9
|
+
*/
|
|
10
|
+
import { ReticleTool } from '@reticlehq/core';
|
|
11
|
+
import { addAppNote, readAppNotes } from './app-notes.js';
|
|
12
|
+
import { shapeForAgent, wantsFull } from './compact-envelope.js';
|
|
13
|
+
import { learnFromVerdict } from './app-notes-learning.js';
|
|
14
|
+
import { reteachFor } from './reteach.js';
|
|
15
|
+
import { staleBuildNotice } from './build-staleness.js';
|
|
16
|
+
import { PRIMER_POINTER, foldNotices } from './notices.js';
|
|
17
|
+
import { dirname } from 'node:path';
|
|
18
|
+
import { keychainNoticeOnce, projectReader } from '../../../command/cli/doctor/doctor-signing-line.js';
|
|
19
|
+
const isRecord = (value) => 'object' === typeof value && null !== value && !Array.isArray(value);
|
|
20
|
+
export function forTheAgent(answer) {
|
|
21
|
+
const { name, args, attach, root } = answer;
|
|
22
|
+
const shaped = shapeForAgent(name, args, answer.result, attach !== undefined);
|
|
23
|
+
if (attach === undefined || ReticleTool.RUN === name || !isRecord(shaped))
|
|
24
|
+
return shaped;
|
|
25
|
+
// A corrected failure that just passed becomes an app note: a hint for the next session.
|
|
26
|
+
const learned = learnFromVerdict(attach, args, shaped);
|
|
27
|
+
if (learned !== undefined && root !== undefined)
|
|
28
|
+
addAppNote(root, learned);
|
|
29
|
+
if (wantsFull(args))
|
|
30
|
+
return shaped;
|
|
31
|
+
const notes = root === undefined ? [] : readAppNotes(root).map((note) => `App note: ${note}`);
|
|
32
|
+
const stale = staleBuildNotice();
|
|
33
|
+
const project = root === undefined ? undefined : dirname(root);
|
|
34
|
+
const keychain = project === undefined
|
|
35
|
+
? undefined
|
|
36
|
+
: keychainNoticeOnce(attach, { read: projectReader(project), dir: project });
|
|
37
|
+
return foldNotices(shaped, attach, answer.fold, [
|
|
38
|
+
...(stale === undefined ? [] : [stale]),
|
|
39
|
+
...(keychain === undefined ? [] : [keychain]),
|
|
40
|
+
PRIMER_POINTER,
|
|
41
|
+
...notes,
|
|
42
|
+
...reteachFor(attach, name, args, shaped),
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One `notices` field, each notice at most once per agent session.
|
|
3
|
+
*
|
|
4
|
+
* Advisories used to arrive as their own keys — `feedback_prompt`, `talk_to_us`, `platform`,
|
|
5
|
+
* `update_available`, `session_lease`… — each with its own paragraph, and the ones that were not
|
|
6
|
+
* one-shot at the source repeated on every call. An agent reads a result to find the verdict; every
|
|
7
|
+
* advisory beside it is something it has to read past, and the same one twice is pure cost.
|
|
8
|
+
*
|
|
9
|
+
* So, for an agent's own call: each advisory becomes ONE line in `notices`, said once per agent
|
|
10
|
+
* session (one MCP connection); `next` is said only when it says something new; the throttled-tab
|
|
11
|
+
* paragraph is said once (the `session.throttled` flag still rides on every result — the FACT is
|
|
12
|
+
* never deduplicated, only its explanation). Telemetry already counted every advisory when it was
|
|
13
|
+
* taken, before this runs.
|
|
14
|
+
*
|
|
15
|
+
* `detail: "full"` callers and the Harness/HUD get the result untouched.
|
|
16
|
+
*/
|
|
17
|
+
/** Which result keys fold into notices, and where the folded lines go. Supplied by the dispatcher. */
|
|
18
|
+
export interface NoticeFold {
|
|
19
|
+
/** Advisory keys whose value becomes one notice line. */
|
|
20
|
+
readonly advisories: readonly string[];
|
|
21
|
+
/** Where the lines go. */
|
|
22
|
+
readonly notices: string;
|
|
23
|
+
/** The one-line "do this next" key: kept only when its text is new this session. */
|
|
24
|
+
readonly next: string;
|
|
25
|
+
/** The key the session-health warning travels under. */
|
|
26
|
+
readonly warning: string;
|
|
27
|
+
/**
|
|
28
|
+
* Warnings that are paragraphs about the TAB (throttled, version skew): said in full once per
|
|
29
|
+
* session, then replaced by their short form (`undefined` drops it — used only where the fact
|
|
30
|
+
* itself still rides on every result, as `session.throttled` does).
|
|
31
|
+
*/
|
|
32
|
+
readonly onceWarnings: ReadonlyMap<string, string | undefined>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The one-line pointer an agent session's first answer carries. The primer itself lives in the
|
|
36
|
+
* agent's rules file (written by `reticle init`), which survives a compaction; a tool result does not.
|
|
37
|
+
*/
|
|
38
|
+
export declare const PRIMER_POINTER = "Reticle's rules are in the Reticle section of your CLAUDE.md / AGENTS.md. Context compacted? reticle_run { tool: \"reticle_context\", args: { compact: true } } first.";
|
|
39
|
+
/** Tests only. */
|
|
40
|
+
export declare function resetNotices(): void;
|
|
41
|
+
/** One line from an advisory's value: a string as-is, an object by its sentence field. */
|
|
42
|
+
export declare function noticeLine(value: unknown): string | undefined;
|
|
43
|
+
/** The first sentence of a paragraph (a full stop followed by a space or the end). */
|
|
44
|
+
export declare function firstSentenceOf(text: string): string;
|
|
45
|
+
/** Fold a result's advisories into once-per-session notices. Never touches any other key. */
|
|
46
|
+
export declare function foldNotices(result: Record<string, unknown>, session: string, fold: NoticeFold, extra?: readonly string[]): Record<string, unknown>;
|
|
47
|
+
/** Has this agent session already been asked for feedback? Undefined session: never gated. */
|
|
48
|
+
export declare function feedbackAlreadyAsked(session: string | undefined): boolean;
|
|
49
|
+
/** Record that this session was asked. */
|
|
50
|
+
export declare function noteFeedbackAsked(session: string | undefined): void;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One `notices` field, each notice at most once per agent session.
|
|
3
|
+
*
|
|
4
|
+
* Advisories used to arrive as their own keys — `feedback_prompt`, `talk_to_us`, `platform`,
|
|
5
|
+
* `update_available`, `session_lease`… — each with its own paragraph, and the ones that were not
|
|
6
|
+
* one-shot at the source repeated on every call. An agent reads a result to find the verdict; every
|
|
7
|
+
* advisory beside it is something it has to read past, and the same one twice is pure cost.
|
|
8
|
+
*
|
|
9
|
+
* So, for an agent's own call: each advisory becomes ONE line in `notices`, said once per agent
|
|
10
|
+
* session (one MCP connection); `next` is said only when it says something new; the throttled-tab
|
|
11
|
+
* paragraph is said once (the `session.throttled` flag still rides on every result — the FACT is
|
|
12
|
+
* never deduplicated, only its explanation). Telemetry already counted every advisory when it was
|
|
13
|
+
* taken, before this runs.
|
|
14
|
+
*
|
|
15
|
+
* `detail: "full"` callers and the Harness/HUD get the result untouched.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The one-line pointer an agent session's first answer carries. The primer itself lives in the
|
|
19
|
+
* agent's rules file (written by `reticle init`), which survives a compaction; a tool result does not.
|
|
20
|
+
*/
|
|
21
|
+
export const PRIMER_POINTER = 'Reticle\'s rules are in the Reticle section of your CLAUDE.md / AGENTS.md. Context compacted? reticle_run { tool: "reticle_context", args: { compact: true } } first.';
|
|
22
|
+
/** An empty session list keeps its first sentence; the executable `next_action` carries the rest. */
|
|
23
|
+
const WHY_KEY = 'why';
|
|
24
|
+
const SESSIONS_KEY = 'sessions';
|
|
25
|
+
/** Fields of an advisory object that hold its sentence, in the order they are tried. */
|
|
26
|
+
const SENTENCE_FIELDS = [
|
|
27
|
+
'ask',
|
|
28
|
+
'message',
|
|
29
|
+
'text',
|
|
30
|
+
'line',
|
|
31
|
+
'reason',
|
|
32
|
+
'IMPORTANT',
|
|
33
|
+
];
|
|
34
|
+
/** Bound on remembered lines per session, and on remembered sessions: a daemon outlives both. */
|
|
35
|
+
const MAX_LINES = 200;
|
|
36
|
+
const MAX_SESSIONS = 500;
|
|
37
|
+
const seenBySession = new Map();
|
|
38
|
+
/** Tests only. */
|
|
39
|
+
export function resetNotices() {
|
|
40
|
+
seenBySession.clear();
|
|
41
|
+
feedbackAsked.clear();
|
|
42
|
+
}
|
|
43
|
+
function seenFor(session) {
|
|
44
|
+
let seen = seenBySession.get(session);
|
|
45
|
+
if (seen === undefined) {
|
|
46
|
+
if (seenBySession.size >= MAX_SESSIONS) {
|
|
47
|
+
const oldest = seenBySession.keys().next().value;
|
|
48
|
+
if (oldest !== undefined)
|
|
49
|
+
seenBySession.delete(oldest);
|
|
50
|
+
}
|
|
51
|
+
seen = new Set();
|
|
52
|
+
seenBySession.set(session, seen);
|
|
53
|
+
}
|
|
54
|
+
return seen;
|
|
55
|
+
}
|
|
56
|
+
/** First time this session sees `line`? Records it either way. */
|
|
57
|
+
function firstTime(seen, line) {
|
|
58
|
+
if (seen.has(line))
|
|
59
|
+
return false;
|
|
60
|
+
if (seen.size < MAX_LINES)
|
|
61
|
+
seen.add(line);
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
/** One line from an advisory's value: a string as-is, an object by its sentence field. */
|
|
65
|
+
export function noticeLine(value) {
|
|
66
|
+
if ('string' === typeof value)
|
|
67
|
+
return 0 === value.trim().length ? undefined : value.trim();
|
|
68
|
+
if ('object' !== typeof value || null === value)
|
|
69
|
+
return undefined;
|
|
70
|
+
const record = value;
|
|
71
|
+
for (const field of SENTENCE_FIELDS) {
|
|
72
|
+
const text = record[field];
|
|
73
|
+
if ('string' === typeof text && text.trim().length > 0) {
|
|
74
|
+
const command = record['command'];
|
|
75
|
+
return 'string' === typeof command ? `${text.trim()} (${command})` : text.trim();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
return JSON.stringify(value);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** The first sentence of a paragraph (a full stop followed by a space or the end). */
|
|
86
|
+
export function firstSentenceOf(text) {
|
|
87
|
+
const match = /^[\s\S]*?[.!?](?=\s|$)/.exec(text);
|
|
88
|
+
return (match?.[0] ?? text).trim();
|
|
89
|
+
}
|
|
90
|
+
/** Fold a result's advisories into once-per-session notices. Never touches any other key. */
|
|
91
|
+
export function foldNotices(result, session, fold, extra = []) {
|
|
92
|
+
const seen = seenFor(session);
|
|
93
|
+
const out = { ...result };
|
|
94
|
+
const lines = Array.isArray(out[fold.notices])
|
|
95
|
+
? out[fold.notices].filter((l) => 'string' === typeof l)
|
|
96
|
+
: [];
|
|
97
|
+
for (const key of fold.advisories) {
|
|
98
|
+
if (!(key in out))
|
|
99
|
+
continue;
|
|
100
|
+
const line = noticeLine(out[key]);
|
|
101
|
+
delete out[key];
|
|
102
|
+
if (line !== undefined && firstTime(seen, `${key}\u0000${line}`))
|
|
103
|
+
lines.push(line);
|
|
104
|
+
}
|
|
105
|
+
for (const line of extra)
|
|
106
|
+
if (firstTime(seen, `\u0000${line}`))
|
|
107
|
+
lines.push(line);
|
|
108
|
+
const next = out[fold.next];
|
|
109
|
+
if ('string' === typeof next && !firstTime(seen, `${fold.next}\u0000${next}`)) {
|
|
110
|
+
delete out[fold.next];
|
|
111
|
+
}
|
|
112
|
+
const warning = out[fold.warning];
|
|
113
|
+
if ('string' === typeof warning &&
|
|
114
|
+
fold.onceWarnings.has(warning) &&
|
|
115
|
+
!firstTime(seen, `${fold.warning}\u0000${warning}`)) {
|
|
116
|
+
const short = fold.onceWarnings.get(warning);
|
|
117
|
+
if (short === undefined)
|
|
118
|
+
delete out[fold.warning];
|
|
119
|
+
else
|
|
120
|
+
out[fold.warning] = short;
|
|
121
|
+
}
|
|
122
|
+
const sessions = out[SESSIONS_KEY];
|
|
123
|
+
const why = out[WHY_KEY];
|
|
124
|
+
if (Array.isArray(sessions) && 0 === sessions.length && 'string' === typeof why) {
|
|
125
|
+
out[WHY_KEY] = firstSentenceOf(why);
|
|
126
|
+
}
|
|
127
|
+
if (lines.length > 0)
|
|
128
|
+
out[fold.notices] = lines;
|
|
129
|
+
else
|
|
130
|
+
delete out[fold.notices];
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The feedback reflex, at most once per agent session.
|
|
135
|
+
*
|
|
136
|
+
* The ask (`feedback_prompt`), the friction invitation (`feedback_invite` + `talk_to_us`) and their
|
|
137
|
+
* kin are one family: an agent asked twice in a session hears noise. Gated where they are TAKEN
|
|
138
|
+
* rather than hidden after, so the `feedbackPrompted` denominator counts only asks an agent saw.
|
|
139
|
+
*/
|
|
140
|
+
const feedbackAsked = new Set();
|
|
141
|
+
/** Has this agent session already been asked for feedback? Undefined session: never gated. */
|
|
142
|
+
export function feedbackAlreadyAsked(session) {
|
|
143
|
+
return session !== undefined && feedbackAsked.has(session);
|
|
144
|
+
}
|
|
145
|
+
/** Record that this session was asked. */
|
|
146
|
+
export function noteFeedbackAsked(session) {
|
|
147
|
+
if (session === undefined)
|
|
148
|
+
return;
|
|
149
|
+
if (feedbackAsked.size >= MAX_SESSIONS)
|
|
150
|
+
feedbackAsked.clear();
|
|
151
|
+
feedbackAsked.add(session);
|
|
152
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const ReteachLine: {
|
|
2
|
+
readonly NO_UNTIL: "Rule: name the consequence in `until` BEFORE acting — without it the result is \"no-fault\", which proves nothing.";
|
|
3
|
+
readonly ALIAS: "Rule: write predicates in their canonical spelling (see `normalized`); aliases are a courtesy, not the API.";
|
|
4
|
+
readonly CASE: "Rule: text checks are exact-case — use ignoreCase: true only when the case truly does not matter.";
|
|
5
|
+
readonly RELIST: "Rule: you already have this tab — reuse its sessionId (or omit it) instead of listing sessions again.";
|
|
6
|
+
readonly COMPACTED: "Lost track (context compacted)? reticle_run { tool: \"reticle_context\", args: { compact: true } } returns what this session proved, failed and still owes.";
|
|
7
|
+
};
|
|
8
|
+
/** Tests only. */
|
|
9
|
+
export declare function resetReteach(): void;
|
|
10
|
+
/** The rule this call broke, if any. */
|
|
11
|
+
export declare function reteachFor(session: string, tool: string, args: Record<string, unknown>, result: Record<string, unknown>): string[];
|