rookery-agent 0.1.0 → 0.3.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 +467 -367
- package/docs/migration.md +88 -88
- package/docs/updates.md +112 -0
- package/package.json +13 -3
- package/packages/cli/dist/commands/config.js +2 -2
- package/packages/cli/dist/commands/doctor.d.ts.map +1 -1
- package/packages/cli/dist/commands/doctor.js +13 -9
- package/packages/cli/dist/commands/doctor.js.map +1 -1
- package/packages/cli/dist/commands/memory.js +1 -1
- package/packages/cli/dist/commands/org.d.ts +2 -2
- package/packages/cli/dist/commands/org.d.ts.map +1 -1
- package/packages/cli/dist/commands/org.js +19 -17
- package/packages/cli/dist/commands/org.js.map +1 -1
- package/packages/cli/dist/commands/serve.js +1 -1
- package/packages/cli/dist/commands/serve.js.map +1 -1
- package/packages/cli/dist/commands/shared.d.ts.map +1 -1
- package/packages/cli/dist/commands/shared.js +2 -1
- package/packages/cli/dist/commands/shared.js.map +1 -1
- package/packages/cli/dist/commands/tasks.d.ts.map +1 -1
- package/packages/cli/dist/commands/tasks.js +25 -11
- package/packages/cli/dist/commands/tasks.js.map +1 -1
- package/packages/cli/dist/commands/tools.js +1 -1
- package/packages/cli/dist/commands/tools.js.map +1 -1
- package/packages/cli/dist/index.js +13 -13
- package/packages/cli/dist/index.js.map +1 -1
- package/packages/cli/dist/repl.d.ts +12 -0
- package/packages/cli/dist/repl.d.ts.map +1 -1
- package/packages/cli/dist/repl.js +170 -16
- package/packages/cli/dist/repl.js.map +1 -1
- package/packages/cli/dist/tui/App.d.ts +7 -3
- package/packages/cli/dist/tui/App.d.ts.map +1 -1
- package/packages/cli/dist/tui/App.js +182 -16
- package/packages/cli/dist/tui/App.js.map +1 -1
- package/packages/cli/dist/tui/commands.d.ts +7 -0
- package/packages/cli/dist/tui/commands.d.ts.map +1 -1
- package/packages/cli/dist/tui/commands.js +70 -8
- package/packages/cli/dist/tui/commands.js.map +1 -1
- package/packages/cli/dist/tui/components/AssignmentsView.js +4 -4
- package/packages/cli/dist/tui/components/AssignmentsView.js.map +1 -1
- package/packages/cli/dist/tui/components/Banner.d.ts +11 -2
- package/packages/cli/dist/tui/components/Banner.d.ts.map +1 -1
- package/packages/cli/dist/tui/components/Banner.js +7 -10
- package/packages/cli/dist/tui/components/Banner.js.map +1 -1
- package/packages/cli/dist/tui/components/CodeBlock.js +2 -2
- package/packages/cli/dist/tui/components/CodeBlock.js.map +1 -1
- package/packages/cli/dist/tui/components/InputBox.d.ts.map +1 -1
- package/packages/cli/dist/tui/components/InputBox.js +4 -4
- package/packages/cli/dist/tui/components/InputBox.js.map +1 -1
- package/packages/cli/dist/tui/components/Logo.d.ts +56 -0
- package/packages/cli/dist/tui/components/Logo.d.ts.map +1 -0
- package/packages/cli/dist/tui/components/Logo.js +50 -0
- package/packages/cli/dist/tui/components/Logo.js.map +1 -0
- package/packages/cli/dist/tui/components/Markdown.js +8 -8
- package/packages/cli/dist/tui/components/Markdown.js.map +1 -1
- package/packages/cli/dist/tui/components/Message.d.ts +1 -1
- package/packages/cli/dist/tui/components/Message.d.ts.map +1 -1
- package/packages/cli/dist/tui/components/Message.js +5 -4
- package/packages/cli/dist/tui/components/Message.js.map +1 -1
- package/packages/cli/dist/tui/components/QuestionView.d.ts +29 -0
- package/packages/cli/dist/tui/components/QuestionView.d.ts.map +1 -0
- package/packages/cli/dist/tui/components/QuestionView.js +53 -0
- package/packages/cli/dist/tui/components/QuestionView.js.map +1 -0
- package/packages/cli/dist/tui/components/SlashPalette.d.ts +5 -2
- package/packages/cli/dist/tui/components/SlashPalette.d.ts.map +1 -1
- package/packages/cli/dist/tui/components/SlashPalette.js +2 -2
- package/packages/cli/dist/tui/components/SlashPalette.js.map +1 -1
- package/packages/cli/dist/tui/components/StatusLine.d.ts +0 -2
- package/packages/cli/dist/tui/components/StatusLine.d.ts.map +1 -1
- package/packages/cli/dist/tui/components/StatusLine.js +8 -5
- package/packages/cli/dist/tui/components/StatusLine.js.map +1 -1
- package/packages/cli/dist/tui/components/ToolGroup.js +2 -2
- package/packages/cli/dist/tui/components/ToolGroup.js.map +1 -1
- package/packages/cli/dist/tui/components/WatchView.d.ts +21 -0
- package/packages/cli/dist/tui/components/WatchView.d.ts.map +1 -0
- package/packages/cli/dist/tui/components/WatchView.js +36 -0
- package/packages/cli/dist/tui/components/WatchView.js.map +1 -0
- package/packages/cli/dist/tui/history.d.ts +20 -0
- package/packages/cli/dist/tui/history.d.ts.map +1 -0
- package/packages/cli/dist/tui/history.js +105 -0
- package/packages/cli/dist/tui/history.js.map +1 -0
- package/packages/cli/dist/tui/hooks/useSlash.d.ts.map +1 -1
- package/packages/cli/dist/tui/hooks/useSlash.js +3 -2
- package/packages/cli/dist/tui/hooks/useSlash.js.map +1 -1
- package/packages/cli/dist/tui/hooks/useTurn.d.ts +58 -1
- package/packages/cli/dist/tui/hooks/useTurn.d.ts.map +1 -1
- package/packages/cli/dist/tui/hooks/useTurn.js +214 -36
- package/packages/cli/dist/tui/hooks/useTurn.js.map +1 -1
- package/packages/cli/dist/tui/hooks/useWatch.d.ts +52 -0
- package/packages/cli/dist/tui/hooks/useWatch.d.ts.map +1 -0
- package/packages/cli/dist/tui/hooks/useWatch.js +145 -0
- package/packages/cli/dist/tui/hooks/useWatch.js.map +1 -0
- package/packages/cli/dist/tui/inkTheme.d.ts +19 -0
- package/packages/cli/dist/tui/inkTheme.d.ts.map +1 -0
- package/packages/cli/dist/tui/inkTheme.js +81 -0
- package/packages/cli/dist/tui/inkTheme.js.map +1 -0
- package/packages/cli/dist/tui/theme.d.ts +39 -29
- package/packages/cli/dist/tui/theme.d.ts.map +1 -1
- package/packages/cli/dist/tui/theme.js +35 -25
- package/packages/cli/dist/tui/theme.js.map +1 -1
- package/packages/cli/dist/tui/types.d.ts +56 -3
- package/packages/cli/dist/tui/types.d.ts.map +1 -1
- package/packages/cli/dist/tui/types.js +85 -0
- package/packages/cli/dist/tui/types.js.map +1 -1
- package/packages/cli/dist/ui/modelNames.d.ts +51 -0
- package/packages/cli/dist/ui/modelNames.d.ts.map +1 -0
- package/packages/cli/dist/ui/modelNames.js +134 -0
- package/packages/cli/dist/ui/modelNames.js.map +1 -0
- package/packages/cli/dist/ui/render.d.ts.map +1 -1
- package/packages/cli/dist/ui/render.js +17 -8
- package/packages/cli/dist/ui/render.js.map +1 -1
- package/packages/cli/dist/ui/speech.js +5 -0
- package/packages/cli/dist/ui/speech.js.map +1 -1
- package/packages/cli/dist/ui/theme.d.ts +33 -9
- package/packages/cli/dist/ui/theme.d.ts.map +1 -1
- package/packages/cli/dist/ui/theme.js +33 -9
- package/packages/cli/dist/ui/theme.js.map +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/core/dist/agents/persona.d.ts.map +1 -1
- package/packages/core/dist/agents/persona.js +5 -2
- package/packages/core/dist/agents/persona.js.map +1 -1
- package/packages/core/dist/computer/accessibility.d.ts +78 -0
- package/packages/core/dist/computer/accessibility.d.ts.map +1 -0
- package/packages/core/dist/computer/accessibility.js +270 -0
- package/packages/core/dist/computer/accessibility.js.map +1 -0
- package/packages/core/dist/computer/assemblies.d.ts +17 -0
- package/packages/core/dist/computer/assemblies.d.ts.map +1 -0
- package/packages/core/dist/computer/assemblies.js +55 -0
- package/packages/core/dist/computer/assemblies.js.map +1 -0
- package/packages/core/dist/computer/browser-init.d.ts +9 -0
- package/packages/core/dist/computer/browser-init.d.ts.map +1 -0
- package/packages/core/dist/computer/browser-init.js +133 -0
- package/packages/core/dist/computer/browser-init.js.map +1 -0
- package/packages/core/dist/computer/cursor.d.ts +30 -0
- package/packages/core/dist/computer/cursor.d.ts.map +1 -0
- package/packages/core/dist/computer/cursor.js +30 -0
- package/packages/core/dist/computer/cursor.js.map +1 -0
- package/packages/core/dist/computer/mcp-server.js +524 -82
- package/packages/core/dist/computer/mcp-server.js.map +1 -1
- package/packages/core/dist/computer/powershell.d.ts +4 -0
- package/packages/core/dist/computer/powershell.d.ts.map +1 -1
- package/packages/core/dist/computer/powershell.js +471 -81
- package/packages/core/dist/computer/powershell.js.map +1 -1
- package/packages/core/dist/computer/screen-text.d.ts +82 -0
- package/packages/core/dist/computer/screen-text.d.ts.map +1 -0
- package/packages/core/dist/computer/screen-text.js +243 -0
- package/packages/core/dist/computer/screen-text.js.map +1 -0
- package/packages/core/dist/computer/sketch.d.ts +66 -0
- package/packages/core/dist/computer/sketch.d.ts.map +1 -0
- package/packages/core/dist/computer/sketch.js +540 -0
- package/packages/core/dist/computer/sketch.js.map +1 -0
- package/packages/core/dist/computer/tools.d.ts +8 -8
- package/packages/core/dist/computer/tools.d.ts.map +1 -1
- package/packages/core/dist/computer/tools.js +186 -31
- package/packages/core/dist/computer/tools.js.map +1 -1
- package/packages/core/dist/computer/validation.d.ts +555 -0
- package/packages/core/dist/computer/validation.d.ts.map +1 -0
- package/packages/core/dist/computer/validation.js +111 -0
- package/packages/core/dist/computer/validation.js.map +1 -0
- package/packages/core/dist/computer/windows-cursor.d.ts +14 -0
- package/packages/core/dist/computer/windows-cursor.d.ts.map +1 -0
- package/packages/core/dist/computer/windows-cursor.js +713 -0
- package/packages/core/dist/computer/windows-cursor.js.map +1 -0
- package/packages/core/dist/config.d.ts +34 -1
- package/packages/core/dist/config.d.ts.map +1 -1
- package/packages/core/dist/config.js +362 -11
- package/packages/core/dist/config.js.map +1 -1
- package/packages/core/dist/cron/scheduler.d.ts +59 -6
- package/packages/core/dist/cron/scheduler.d.ts.map +1 -1
- package/packages/core/dist/cron/scheduler.js +295 -27
- package/packages/core/dist/cron/scheduler.js.map +1 -1
- package/packages/core/dist/cron/store.d.ts +19 -1
- package/packages/core/dist/cron/store.d.ts.map +1 -1
- package/packages/core/dist/cron/store.js +36 -8
- package/packages/core/dist/cron/store.js.map +1 -1
- package/packages/core/dist/external/claude-code.d.ts +4 -0
- package/packages/core/dist/external/claude-code.d.ts.map +1 -0
- package/packages/core/dist/external/claude-code.js +111 -0
- package/packages/core/dist/external/claude-code.js.map +1 -0
- package/packages/core/dist/external/discovery.d.ts +33 -0
- package/packages/core/dist/external/discovery.d.ts.map +1 -0
- package/packages/core/dist/external/discovery.js +144 -0
- package/packages/core/dist/external/discovery.js.map +1 -0
- package/packages/core/dist/external/homes.d.ts +26 -0
- package/packages/core/dist/external/homes.d.ts.map +1 -0
- package/packages/core/dist/external/homes.js +49 -0
- package/packages/core/dist/external/homes.js.map +1 -0
- package/packages/core/dist/external/shared.d.ts +201 -0
- package/packages/core/dist/external/shared.d.ts.map +1 -0
- package/packages/core/dist/external/shared.js +308 -0
- package/packages/core/dist/external/shared.js.map +1 -0
- package/packages/core/dist/gateway/policy.d.ts +117 -2
- package/packages/core/dist/gateway/policy.d.ts.map +1 -1
- package/packages/core/dist/gateway/policy.js +286 -6
- package/packages/core/dist/gateway/policy.js.map +1 -1
- package/packages/core/dist/index.d.ts +38 -12
- package/packages/core/dist/index.d.ts.map +1 -1
- package/packages/core/dist/index.js +66 -12
- package/packages/core/dist/index.js.map +1 -1
- package/packages/core/dist/memory/db.d.ts +1 -1
- package/packages/core/dist/memory/db.d.ts.map +1 -1
- package/packages/core/dist/memory/db.js +878 -1
- package/packages/core/dist/memory/db.js.map +1 -1
- package/packages/core/dist/memory/dream/admission.d.ts +124 -0
- package/packages/core/dist/memory/dream/admission.d.ts.map +1 -0
- package/packages/core/dist/memory/dream/admission.js +116 -0
- package/packages/core/dist/memory/dream/admission.js.map +1 -0
- package/packages/core/dist/memory/dream/candidate.d.ts +152 -0
- package/packages/core/dist/memory/dream/candidate.d.ts.map +1 -0
- package/packages/core/dist/memory/dream/candidate.js +547 -0
- package/packages/core/dist/memory/dream/candidate.js.map +1 -0
- package/packages/core/dist/memory/dream/evaluate.d.ts +394 -0
- package/packages/core/dist/memory/dream/evaluate.d.ts.map +1 -0
- package/packages/core/dist/memory/dream/evaluate.js +1032 -0
- package/packages/core/dist/memory/dream/evaluate.js.map +1 -0
- package/packages/core/dist/memory/dream/frame.d.ts +61 -0
- package/packages/core/dist/memory/dream/frame.d.ts.map +1 -0
- package/packages/core/dist/memory/dream/frame.js +292 -0
- package/packages/core/dist/memory/dream/frame.js.map +1 -0
- package/packages/core/dist/memory/dream/label.d.ts +370 -0
- package/packages/core/dist/memory/dream/label.d.ts.map +1 -0
- package/packages/core/dist/memory/dream/label.js +439 -0
- package/packages/core/dist/memory/dream/label.js.map +1 -0
- package/packages/core/dist/memory/dream/measure.d.ts +114 -0
- package/packages/core/dist/memory/dream/measure.d.ts.map +1 -0
- package/packages/core/dist/memory/dream/measure.js +205 -0
- package/packages/core/dist/memory/dream/measure.js.map +1 -0
- package/packages/core/dist/memory/dream/policy.d.ts +21 -0
- package/packages/core/dist/memory/dream/policy.d.ts.map +1 -0
- package/packages/core/dist/memory/dream/policy.js +157 -0
- package/packages/core/dist/memory/dream/policy.js.map +1 -0
- package/packages/core/dist/memory/dream/probe.d.ts +202 -0
- package/packages/core/dist/memory/dream/probe.d.ts.map +1 -0
- package/packages/core/dist/memory/dream/probe.js +671 -0
- package/packages/core/dist/memory/dream/probe.js.map +1 -0
- package/packages/core/dist/memory/dream/promote.d.ts +312 -0
- package/packages/core/dist/memory/dream/promote.d.ts.map +1 -0
- package/packages/core/dist/memory/dream/promote.js +528 -0
- package/packages/core/dist/memory/dream/promote.js.map +1 -0
- package/packages/core/dist/memory/dream/score.d.ts +103 -0
- package/packages/core/dist/memory/dream/score.d.ts.map +1 -0
- package/packages/core/dist/memory/dream/score.js +334 -0
- package/packages/core/dist/memory/dream/score.js.map +1 -0
- package/packages/core/dist/memory/dream/slots.d.ts +193 -0
- package/packages/core/dist/memory/dream/slots.d.ts.map +1 -0
- package/packages/core/dist/memory/dream/slots.js +0 -0
- package/packages/core/dist/memory/dream/slots.js.map +1 -0
- package/packages/core/dist/memory/dream/trajectory.d.ts +262 -0
- package/packages/core/dist/memory/dream/trajectory.d.ts.map +1 -0
- package/packages/core/dist/memory/dream/trajectory.js +366 -0
- package/packages/core/dist/memory/dream/trajectory.js.map +1 -0
- package/packages/core/dist/memory/extractor.d.ts +7 -0
- package/packages/core/dist/memory/extractor.d.ts.map +1 -1
- package/packages/core/dist/memory/extractor.js +35 -12
- package/packages/core/dist/memory/extractor.js.map +1 -1
- package/packages/core/dist/memory/gate.d.ts +43 -7
- package/packages/core/dist/memory/gate.d.ts.map +1 -1
- package/packages/core/dist/memory/gate.js +91 -4
- package/packages/core/dist/memory/gate.js.map +1 -1
- package/packages/core/dist/memory/recall.d.ts +57 -0
- package/packages/core/dist/memory/recall.d.ts.map +1 -1
- package/packages/core/dist/memory/recall.js +60 -123
- package/packages/core/dist/memory/recall.js.map +1 -1
- package/packages/core/dist/memory/sleep.d.ts +131 -4
- package/packages/core/dist/memory/sleep.d.ts.map +1 -1
- package/packages/core/dist/memory/sleep.js +2384 -65
- package/packages/core/dist/memory/sleep.js.map +1 -1
- package/packages/core/dist/memory/store.d.ts +564 -10
- package/packages/core/dist/memory/store.d.ts.map +1 -1
- package/packages/core/dist/memory/store.js +1673 -102
- package/packages/core/dist/memory/store.js.map +1 -1
- package/packages/core/dist/org/controller.d.ts +268 -4
- package/packages/core/dist/org/controller.d.ts.map +1 -1
- package/packages/core/dist/org/controller.js +2298 -248
- package/packages/core/dist/org/controller.js.map +1 -1
- package/packages/core/dist/org/ponytail.d.ts +1 -1
- package/packages/core/dist/org/ponytail.js +1 -1
- package/packages/core/dist/org/project-mcp.d.ts +3 -3
- package/packages/core/dist/org/prompts.d.ts +44 -30
- package/packages/core/dist/org/prompts.d.ts.map +1 -1
- package/packages/core/dist/org/prompts.js +209 -92
- package/packages/core/dist/org/prompts.js.map +1 -1
- package/packages/core/dist/org/questions.d.ts +104 -0
- package/packages/core/dist/org/questions.d.ts.map +1 -0
- package/packages/core/dist/org/questions.js +136 -0
- package/packages/core/dist/org/questions.js.map +1 -0
- package/packages/core/dist/org/review.d.ts +100 -0
- package/packages/core/dist/org/review.d.ts.map +1 -0
- package/packages/core/dist/org/review.js +256 -0
- package/packages/core/dist/org/review.js.map +1 -0
- package/packages/core/dist/org/store.d.ts +311 -2
- package/packages/core/dist/org/store.d.ts.map +1 -1
- package/packages/core/dist/org/store.js +981 -13
- package/packages/core/dist/org/store.js.map +1 -1
- package/packages/core/dist/org/tools.d.ts +33 -3
- package/packages/core/dist/org/tools.d.ts.map +1 -1
- package/packages/core/dist/org/tools.js +380 -67
- package/packages/core/dist/org/tools.js.map +1 -1
- package/packages/core/dist/providers/catalogue.d.ts +1 -1
- package/packages/core/dist/providers/catalogue.d.ts.map +1 -1
- package/packages/core/dist/providers/catalogue.js +2 -2
- package/packages/core/dist/providers/catalogue.js.map +1 -1
- package/packages/core/dist/providers/claude-code.d.ts +19 -3
- package/packages/core/dist/providers/claude-code.d.ts.map +1 -1
- package/packages/core/dist/providers/claude-code.js +501 -40
- package/packages/core/dist/providers/claude-code.js.map +1 -1
- package/packages/core/dist/providers/claude-tui.d.ts +288 -0
- package/packages/core/dist/providers/claude-tui.d.ts.map +1 -0
- package/packages/core/dist/providers/claude-tui.js +1118 -0
- package/packages/core/dist/providers/claude-tui.js.map +1 -0
- package/packages/core/dist/providers/codex-auth.d.ts +15 -0
- package/packages/core/dist/providers/codex-auth.d.ts.map +1 -0
- package/packages/core/dist/providers/codex-auth.js +127 -0
- package/packages/core/dist/providers/codex-auth.js.map +1 -0
- package/packages/core/dist/providers/codex-bridge.d.ts +58 -0
- package/packages/core/dist/providers/codex-bridge.d.ts.map +1 -0
- package/packages/core/dist/providers/codex-bridge.js +375 -0
- package/packages/core/dist/providers/codex-bridge.js.map +1 -0
- package/packages/core/dist/providers/codex-translate.d.ts +75 -0
- package/packages/core/dist/providers/codex-translate.d.ts.map +1 -0
- package/packages/core/dist/providers/codex-translate.js +383 -0
- package/packages/core/dist/providers/codex-translate.js.map +1 -0
- package/packages/core/dist/providers/model-gateway.d.ts +56 -0
- package/packages/core/dist/providers/model-gateway.d.ts.map +1 -0
- package/packages/core/dist/providers/model-gateway.js +119 -0
- package/packages/core/dist/providers/model-gateway.js.map +1 -0
- package/packages/core/dist/providers/process.d.ts +3 -1
- package/packages/core/dist/providers/process.d.ts.map +1 -1
- package/packages/core/dist/providers/process.js +3 -3
- package/packages/core/dist/providers/process.js.map +1 -1
- package/packages/core/dist/providers/profiles.d.ts +11 -0
- package/packages/core/dist/providers/profiles.d.ts.map +1 -0
- package/packages/core/dist/providers/profiles.js +28 -0
- package/packages/core/dist/providers/profiles.js.map +1 -0
- package/packages/core/dist/providers/provider-catalog.d.ts +72 -0
- package/packages/core/dist/providers/provider-catalog.d.ts.map +1 -0
- package/packages/core/dist/providers/provider-catalog.js +144 -0
- package/packages/core/dist/providers/provider-catalog.js.map +1 -0
- package/packages/core/dist/providers/quota.d.ts +40 -1
- package/packages/core/dist/providers/quota.d.ts.map +1 -1
- package/packages/core/dist/providers/quota.js +288 -25
- package/packages/core/dist/providers/quota.js.map +1 -1
- package/packages/core/dist/providers/registry.d.ts +46 -3
- package/packages/core/dist/providers/registry.d.ts.map +1 -1
- package/packages/core/dist/providers/registry.js +148 -13
- package/packages/core/dist/providers/registry.js.map +1 -1
- package/packages/core/dist/providers/router.d.ts +28 -0
- package/packages/core/dist/providers/router.d.ts.map +1 -0
- package/packages/core/dist/providers/router.js +88 -0
- package/packages/core/dist/providers/router.js.map +1 -0
- package/packages/core/dist/providers/user-settings-guard.d.ts +12 -0
- package/packages/core/dist/providers/user-settings-guard.d.ts.map +1 -0
- package/packages/core/dist/providers/user-settings-guard.js +130 -0
- package/packages/core/dist/providers/user-settings-guard.js.map +1 -0
- package/packages/core/dist/runtime.d.ts +193 -7
- package/packages/core/dist/runtime.d.ts.map +1 -1
- package/packages/core/dist/runtime.js +1676 -219
- package/packages/core/dist/runtime.js.map +1 -1
- package/packages/core/dist/skills/builtin.d.ts +34 -0
- package/packages/core/dist/skills/builtin.d.ts.map +1 -0
- package/packages/core/dist/skills/builtin.js +305 -0
- package/packages/core/dist/skills/builtin.js.map +1 -0
- package/packages/core/dist/skills/shelf.d.ts +30 -0
- package/packages/core/dist/skills/shelf.d.ts.map +1 -0
- package/packages/core/dist/skills/shelf.js +159 -0
- package/packages/core/dist/skills/shelf.js.map +1 -0
- package/packages/core/dist/skills/store.d.ts +66 -4
- package/packages/core/dist/skills/store.d.ts.map +1 -1
- package/packages/core/dist/skills/store.js +105 -18
- package/packages/core/dist/skills/store.js.map +1 -1
- package/packages/core/dist/skills/suggest.d.ts +21 -0
- package/packages/core/dist/skills/suggest.d.ts.map +1 -0
- package/packages/core/dist/skills/suggest.js +150 -0
- package/packages/core/dist/skills/suggest.js.map +1 -0
- package/packages/core/dist/tools/catalog.d.ts +1 -3
- package/packages/core/dist/tools/catalog.d.ts.map +1 -1
- package/packages/core/dist/tools/catalog.js +38 -26
- package/packages/core/dist/tools/catalog.js.map +1 -1
- package/packages/core/dist/tools/hub.d.ts +136 -10
- package/packages/core/dist/tools/hub.d.ts.map +1 -1
- package/packages/core/dist/tools/hub.js +418 -24
- package/packages/core/dist/tools/hub.js.map +1 -1
- package/packages/core/dist/turns/journal.d.ts +78 -0
- package/packages/core/dist/turns/journal.d.ts.map +1 -0
- package/packages/core/dist/turns/journal.js +104 -0
- package/packages/core/dist/turns/journal.js.map +1 -0
- package/packages/core/dist/types.d.ts +1776 -12
- package/packages/core/dist/types.d.ts.map +1 -1
- package/packages/core/dist/types.js.map +1 -1
- package/packages/core/dist/util/blocks.d.ts +41 -0
- package/packages/core/dist/util/blocks.d.ts.map +1 -0
- package/packages/core/dist/util/blocks.js +175 -0
- package/packages/core/dist/util/blocks.js.map +1 -0
- package/packages/core/dist/util/queue.d.ts +12 -0
- package/packages/core/dist/util/queue.d.ts.map +1 -1
- package/packages/core/dist/util/queue.js +16 -0
- package/packages/core/dist/util/queue.js.map +1 -1
- package/packages/core/dist/util/time.d.ts +39 -0
- package/packages/core/dist/util/time.d.ts.map +1 -0
- package/packages/core/dist/util/time.js +71 -0
- package/packages/core/dist/util/time.js.map +1 -0
- package/packages/core/package.json +1 -1
- package/packages/server/dist/auth.d.ts +14 -1
- package/packages/server/dist/auth.d.ts.map +1 -1
- package/packages/server/dist/auth.js +19 -0
- package/packages/server/dist/auth.js.map +1 -1
- package/packages/server/dist/context.d.ts +35 -1
- package/packages/server/dist/context.d.ts.map +1 -1
- package/packages/server/dist/context.js +39 -10
- package/packages/server/dist/context.js.map +1 -1
- package/packages/server/dist/gateways/attachments.d.ts +32 -0
- package/packages/server/dist/gateways/attachments.d.ts.map +1 -0
- package/packages/server/dist/gateways/attachments.js +167 -0
- package/packages/server/dist/gateways/attachments.js.map +1 -0
- package/packages/server/dist/gateways/markdown.d.ts +9 -0
- package/packages/server/dist/gateways/markdown.d.ts.map +1 -0
- package/packages/server/dist/gateways/markdown.js +170 -0
- package/packages/server/dist/gateways/markdown.js.map +1 -0
- package/packages/server/dist/gateways/push.d.ts +1 -1
- package/packages/server/dist/gateways/push.d.ts.map +1 -1
- package/packages/server/dist/gateways/push.js +420 -13
- package/packages/server/dist/gateways/push.js.map +1 -1
- package/packages/server/dist/gateways/telegram-api.d.ts +70 -1
- package/packages/server/dist/gateways/telegram-api.d.ts.map +1 -1
- package/packages/server/dist/gateways/telegram-api.js +140 -1
- package/packages/server/dist/gateways/telegram-api.js.map +1 -1
- package/packages/server/dist/gateways/telegram.d.ts +181 -1
- package/packages/server/dist/gateways/telegram.d.ts.map +1 -1
- package/packages/server/dist/gateways/telegram.js +1572 -78
- package/packages/server/dist/gateways/telegram.js.map +1 -1
- package/packages/server/dist/gateways/threads.d.ts +84 -0
- package/packages/server/dist/gateways/threads.d.ts.map +1 -0
- package/packages/server/dist/gateways/threads.js +289 -0
- package/packages/server/dist/gateways/threads.js.map +1 -0
- package/packages/server/dist/index.d.ts +2 -1
- package/packages/server/dist/index.d.ts.map +1 -1
- package/packages/server/dist/index.js +2 -1
- package/packages/server/dist/index.js.map +1 -1
- package/packages/server/dist/listeners/imap.d.ts +13 -0
- package/packages/server/dist/listeners/imap.d.ts.map +1 -0
- package/packages/server/dist/listeners/imap.js +0 -0
- package/packages/server/dist/listeners/imap.js.map +1 -0
- package/packages/server/dist/listeners/registry.d.ts +18 -0
- package/packages/server/dist/listeners/registry.d.ts.map +1 -0
- package/packages/server/dist/listeners/registry.js +88 -0
- package/packages/server/dist/listeners/registry.js.map +1 -0
- package/packages/server/dist/listeners/types.d.ts +55 -0
- package/packages/server/dist/listeners/types.d.ts.map +1 -0
- package/packages/server/dist/listeners/types.js +2 -0
- package/packages/server/dist/listeners/types.js.map +1 -0
- package/packages/server/dist/main.js +15 -1
- package/packages/server/dist/main.js.map +1 -1
- package/packages/server/dist/routes/chat.d.ts +7 -3
- package/packages/server/dist/routes/chat.d.ts.map +1 -1
- package/packages/server/dist/routes/chat.js +8 -17
- package/packages/server/dist/routes/chat.js.map +1 -1
- package/packages/server/dist/routes/config.d.ts.map +1 -1
- package/packages/server/dist/routes/config.js +66 -7
- package/packages/server/dist/routes/config.js.map +1 -1
- package/packages/server/dist/routes/cron.d.ts.map +1 -1
- package/packages/server/dist/routes/cron.js +65 -8
- package/packages/server/dist/routes/cron.js.map +1 -1
- package/packages/server/dist/routes/dream.d.ts +22 -0
- package/packages/server/dist/routes/dream.d.ts.map +1 -0
- package/packages/server/dist/routes/dream.js +152 -0
- package/packages/server/dist/routes/dream.js.map +1 -0
- package/packages/server/dist/routes/hooks.d.ts +18 -0
- package/packages/server/dist/routes/hooks.d.ts.map +1 -0
- package/packages/server/dist/routes/hooks.js +62 -0
- package/packages/server/dist/routes/hooks.js.map +1 -0
- package/packages/server/dist/routes/listeners.d.ts +10 -0
- package/packages/server/dist/routes/listeners.d.ts.map +1 -0
- package/packages/server/dist/routes/listeners.js +12 -0
- package/packages/server/dist/routes/listeners.js.map +1 -0
- package/packages/server/dist/routes/memories.d.ts.map +1 -1
- package/packages/server/dist/routes/memories.js +55 -3
- package/packages/server/dist/routes/memories.js.map +1 -1
- package/packages/server/dist/routes/org.d.ts.map +1 -1
- package/packages/server/dist/routes/org.js +289 -49
- package/packages/server/dist/routes/org.js.map +1 -1
- package/packages/server/dist/routes/profile.d.ts.map +1 -1
- package/packages/server/dist/routes/profile.js +6 -3
- package/packages/server/dist/routes/profile.js.map +1 -1
- package/packages/server/dist/routes/providers.d.ts.map +1 -1
- package/packages/server/dist/routes/providers.js +66 -7
- package/packages/server/dist/routes/providers.js.map +1 -1
- package/packages/server/dist/routes/questions.d.ts +45 -0
- package/packages/server/dist/routes/questions.d.ts.map +1 -0
- package/packages/server/dist/routes/questions.js +73 -0
- package/packages/server/dist/routes/questions.js.map +1 -0
- package/packages/server/dist/routes/sessions.d.ts.map +1 -1
- package/packages/server/dist/routes/sessions.js +26 -6
- package/packages/server/dist/routes/sessions.js.map +1 -1
- package/packages/server/dist/routes/sleep.d.ts.map +1 -1
- package/packages/server/dist/routes/sleep.js +71 -2
- package/packages/server/dist/routes/sleep.js.map +1 -1
- package/packages/server/dist/routes/terminals.d.ts +25 -0
- package/packages/server/dist/routes/terminals.d.ts.map +1 -0
- package/packages/server/dist/routes/terminals.js +35 -0
- package/packages/server/dist/routes/terminals.js.map +1 -0
- package/packages/server/dist/routes/tools.d.ts.map +1 -1
- package/packages/server/dist/routes/tools.js +140 -6
- package/packages/server/dist/routes/tools.js.map +1 -1
- package/packages/server/dist/routes/updates.d.ts +10 -0
- package/packages/server/dist/routes/updates.d.ts.map +1 -0
- package/packages/server/dist/routes/updates.js +22 -0
- package/packages/server/dist/routes/updates.js.map +1 -0
- package/packages/server/dist/routes/ws.d.ts +11 -5
- package/packages/server/dist/routes/ws.d.ts.map +1 -1
- package/packages/server/dist/routes/ws.js +168 -28
- package/packages/server/dist/routes/ws.js.map +1 -1
- package/packages/server/dist/schemas.d.ts +1177 -215
- package/packages/server/dist/schemas.d.ts.map +1 -1
- package/packages/server/dist/schemas.js +317 -12
- package/packages/server/dist/schemas.js.map +1 -1
- package/packages/server/dist/server.d.ts +7 -1
- package/packages/server/dist/server.d.ts.map +1 -1
- package/packages/server/dist/server.js +210 -3
- package/packages/server/dist/server.js.map +1 -1
- package/packages/server/dist/services/stream.d.ts +94 -5
- package/packages/server/dist/services/stream.d.ts.map +1 -1
- package/packages/server/dist/services/stream.js +9 -20
- package/packages/server/dist/services/stream.js.map +1 -1
- package/packages/server/dist/services/stt.d.ts +65 -0
- package/packages/server/dist/services/stt.d.ts.map +1 -0
- package/packages/server/dist/services/stt.js +306 -0
- package/packages/server/dist/services/stt.js.map +1 -0
- package/packages/server/dist/services/turns.d.ts +54 -0
- package/packages/server/dist/services/turns.d.ts.map +1 -0
- package/packages/server/dist/services/turns.js +186 -0
- package/packages/server/dist/services/turns.js.map +1 -0
- package/packages/server/dist/services/updates.d.ts +99 -0
- package/packages/server/dist/services/updates.d.ts.map +1 -0
- package/packages/server/dist/services/updates.js +316 -0
- package/packages/server/dist/services/updates.js.map +1 -0
- package/packages/server/package.json +1 -1
- package/packages/web/dist/app-icon.svg +2 -0
- package/packages/web/dist/apple-touch-icon.png +0 -0
- package/packages/web/dist/assets/abnfDiagram-O67JEVCF-D7YyFndQ.js +1 -0
- package/packages/web/dist/assets/arc-C_Zgk2dJ.js +1 -0
- package/packages/web/dist/assets/architectureDiagram-NJMV4G6O-eI0adu1B.js +36 -0
- package/packages/web/dist/assets/blockDiagram-BEXU5L5S-WAoOFUA9.js +140 -0
- package/packages/web/dist/assets/c4Diagram-YGBWAQC7-DE8Zyhng.js +38 -0
- package/packages/web/dist/assets/channel-egZxcyUK.js +1 -0
- package/packages/web/dist/assets/chunk-2Q5K7J3B-bnqLP2XD.js +1 -0
- package/packages/web/dist/assets/chunk-3FUC2YCW-Ck1_SVe0.js +2 -0
- package/packages/web/dist/assets/chunk-5VM5RSS4-hDmC41gD.js +15 -0
- package/packages/web/dist/assets/chunk-GTNCS2PH-PoWvfCrT.js +88 -0
- package/packages/web/dist/assets/chunk-GWA4HPMP-D3V0IG43.js +1 -0
- package/packages/web/dist/assets/chunk-JWPE2WC7-BryfpHM5.js +1 -0
- package/packages/web/dist/assets/chunk-NETBCI7D-8ic1iEdT.js +1 -0
- package/packages/web/dist/assets/chunk-WEXAMYUT-nM8tmQT2.js +1 -0
- package/packages/web/dist/assets/chunk-XXDRQBXY-Do28F482.js +1 -0
- package/packages/web/dist/assets/classDiagram-v2-NBCMYWYE-Bop9oNNO.js +217 -0
- package/packages/web/dist/assets/cose-bilkent-JH36ORCC-a7f_bpnt.js +1 -0
- package/packages/web/dist/assets/cynefin-OW5HDTMX-DnArcis_.js +178 -0
- package/packages/web/dist/assets/cynefinDiagram-VND7K2PF-vEuTb1GD.js +62 -0
- package/packages/web/dist/assets/cytoscape.esm-Ix0LnXOy.js +331 -0
- package/packages/web/dist/assets/dagre-6A5THRUB-BgG4MynJ.js +4 -0
- package/packages/web/dist/assets/diagram-22UHCM2B-DRCQpafv.js +200 -0
- package/packages/web/dist/assets/diagram-3UASUU5V-BKgmAXde.js +24 -0
- package/packages/web/dist/assets/diagram-ATOU4E4O-B6Hsy36X.js +3 -0
- package/packages/web/dist/assets/diagram-CDSNMT55-JflyfyoB.js +30 -0
- package/packages/web/dist/assets/diagram-MLGK6HIB-Dd2QPJjT.js +24 -0
- package/packages/web/dist/assets/diagram-MPIPVDR6-DE5QU60x.js +41 -0
- package/packages/web/dist/assets/draco_decoder-C32yEggz.wasm +0 -0
- package/packages/web/dist/assets/draco_decoder-Z1_iN-Ht.wasm +0 -0
- package/packages/web/dist/assets/draco_decoder-fzg4nYZr.js +34 -0
- package/packages/web/dist/assets/draco_wasm_wrapper-DxJM36Ib.js +117 -0
- package/packages/web/dist/assets/draco_wasm_wrapper-fZCQGLGb.js +116 -0
- package/packages/web/dist/assets/ebnfDiagram-ZINNZB2B-D7AQ741b.js +1 -0
- package/packages/web/dist/assets/elk-276RUBZZ-CeewBVLF.js +27 -0
- package/packages/web/dist/assets/erDiagram-OPXOYQCR-mLLYkZ5c.js +99 -0
- package/packages/web/dist/assets/flowDiagram-KWPJA3E3-DtpSpsQN.js +213 -0
- package/packages/web/dist/assets/ganttDiagram-FUAMR5RP-1_lh-3ky.js +292 -0
- package/packages/web/dist/assets/gitGraphDiagram-X574FWY7-DoPXZuT5.js +106 -0
- package/packages/web/dist/assets/graph-Bn3Yngep.js +1 -0
- package/packages/web/dist/assets/index-Cw2Opmx7.js +648 -0
- package/packages/web/dist/assets/index-j0zBRCgT.css +32 -0
- package/packages/web/dist/assets/infoDiagram-VRGFBTTK-DQpRGGiD.js +2 -0
- package/packages/web/dist/assets/ishikawaDiagram-OU5B5YK6-gH5C9Q2e.js +70 -0
- package/packages/web/dist/assets/journeyDiagram-ZHPQQLJL-Bg-oeFjb.js +139 -0
- package/packages/web/dist/assets/kanban-definition-PNTS6WVX-BnpI4VH8.js +89 -0
- package/packages/web/dist/assets/katex-C5jXJg4s.js +257 -0
- package/packages/web/dist/assets/mermaid.core-BwBKxlRA.js +313 -0
- package/packages/web/dist/assets/mindmap-definition-NLK3R4M7-NBnnxEoO.js +96 -0
- package/packages/web/dist/assets/pegDiagram-GJSIUBJH-RrXXbIvO.js +1 -0
- package/packages/web/dist/assets/pieDiagram-5QR66LMP-B27q6Gso.js +39 -0
- package/packages/web/dist/assets/quadrantDiagram-O4NWA36T-DGDsdur2.js +7 -0
- package/packages/web/dist/assets/railroadDiagram-XR7U4H2S-GdjkE3mI.js +1 -0
- package/packages/web/dist/assets/requirementDiagram-PLB6GJNP-DjK0GfgO.js +84 -0
- package/packages/web/dist/assets/sankeyDiagram-IPEJSGJF-BG_AIkwF.js +40 -0
- package/packages/web/dist/assets/scene-D4LPicHk.js +4620 -0
- package/packages/web/dist/assets/sequenceDiagram-PO4LG4MO-CIQwUb4y.js +169 -0
- package/packages/web/dist/assets/sizeCapture-INFHLROL-bpIoPxdJ.js +1 -0
- package/packages/web/dist/assets/stateDiagram-v2-GCMORJYK-8hYXvPPv.js +291 -0
- package/packages/web/dist/assets/swimlanes-2SLR337P-gfflUMF9.js +1 -0
- package/packages/web/dist/assets/swimlanesDiagram-TC7HE7FX-9wdzGXU-.js +8 -0
- package/packages/web/dist/assets/timeline-definition-EJHVYXUP-PHMNoGTZ.js +120 -0
- package/packages/web/dist/assets/usecaseDiagram-POWQR4AR-B2j5iteO.js +370 -0
- package/packages/web/dist/assets/vennDiagram-UO4OBE2U-BzxtZ-_2.js +34 -0
- package/packages/web/dist/assets/wardleyDiagram-VNRHLVJA-DL7YbMpY.js +78 -0
- package/packages/web/dist/assets/xychartDiagram-PMCCYNJV-CisgP1cT.js +7 -0
- package/packages/web/dist/draco/draco_decoder.js +33 -0
- package/packages/web/dist/draco/draco_decoder.wasm +0 -0
- package/packages/web/dist/draco/draco_wasm_wrapper.js +116 -0
- package/packages/web/dist/favicon-16.png +0 -0
- package/packages/web/dist/favicon-32.png +0 -0
- package/packages/web/dist/favicon-48.png +0 -0
- package/packages/web/dist/favicon.ico +0 -0
- package/packages/web/dist/favicon.svg +1 -1
- package/packages/web/dist/icon-192.png +0 -0
- package/packages/web/dist/icon-512.png +0 -0
- package/packages/web/dist/index.html +12 -4
- package/packages/web/dist/logo-light.svg +1 -1
- package/packages/web/dist/logo-mono.svg +2 -0
- package/packages/web/dist/logo-stacked-light.svg +2 -0
- package/packages/web/dist/logo-stacked.svg +2 -0
- package/packages/web/dist/logo-white.svg +2 -0
- package/packages/web/dist/logo.svg +1 -1
- package/packages/web/dist/mark-light.svg +1 -1
- package/packages/web/dist/mark-mono.svg +2 -0
- package/packages/web/dist/mark-small-light.svg +2 -0
- package/packages/web/dist/mark-small.svg +2 -0
- package/packages/web/dist/mark-white.svg +2 -0
- package/packages/web/dist/mark.svg +1 -1
- package/packages/web/dist/models/LICENSE.txt +5 -0
- package/packages/web/dist/models/brain.glb +0 -0
- package/packages/web/dist/site.webmanifest +23 -0
- package/packages/web/dist/wordmark-light.svg +2 -0
- package/packages/web/dist/wordmark.svg +2 -0
- package/packages/web/package.json +1 -1
- package/scripts/rookery.mjs +204 -122
- package/scripts/updater.mjs +227 -0
- package/packages/cli/dist/tui/components/Wordmark.d.ts +0 -35
- package/packages/cli/dist/tui/components/Wordmark.d.ts.map +0 -1
- package/packages/cli/dist/tui/components/Wordmark.js +0 -81
- package/packages/cli/dist/tui/components/Wordmark.js.map +0 -1
- package/packages/core/dist/agents/orchestrator.d.ts +0 -24
- package/packages/core/dist/agents/orchestrator.d.ts.map +0 -1
- package/packages/core/dist/agents/orchestrator.js +0 -88
- package/packages/core/dist/agents/orchestrator.js.map +0 -1
- package/packages/core/dist/agents/roles.d.ts +0 -21
- package/packages/core/dist/agents/roles.d.ts.map +0 -1
- package/packages/core/dist/agents/roles.js +0 -81
- package/packages/core/dist/agents/roles.js.map +0 -1
- package/packages/core/dist/agents/team.d.ts +0 -105
- package/packages/core/dist/agents/team.d.ts.map +0 -1
- package/packages/core/dist/agents/team.js +0 -623
- package/packages/core/dist/agents/team.js.map +0 -1
- package/packages/core/dist/providers/codex.d.ts +0 -10
- package/packages/core/dist/providers/codex.d.ts.map +0 -1
- package/packages/core/dist/providers/codex.js +0 -375
- package/packages/core/dist/providers/codex.js.map +0 -1
- package/packages/core/dist/tools/browser.d.ts +0 -20
- package/packages/core/dist/tools/browser.d.ts.map +0 -1
- package/packages/core/dist/tools/browser.js +0 -72
- package/packages/core/dist/tools/browser.js.map +0 -1
- package/packages/server/dist/routes/agents.d.ts +0 -5
- package/packages/server/dist/routes/agents.d.ts.map +0 -1
- package/packages/server/dist/routes/agents.js +0 -6
- package/packages/server/dist/routes/agents.js.map +0 -1
- package/packages/server/dist/routes/team.d.ts +0 -11
- package/packages/server/dist/routes/team.d.ts.map +0 -1
- package/packages/server/dist/routes/team.js +0 -36
- package/packages/server/dist/routes/team.js.map +0 -1
- package/packages/web/dist/assets/3d-force-graph-BPZmoydi.js +0 -1163
- package/packages/web/dist/assets/index-IBSTzK7-.js +0 -1255
- package/packages/web/dist/assets/index-qUXUui7W.css +0 -1
- package/packages/web/dist/assets/three-spritetext-B9ZIW7c-.js +0 -4
- package/packages/web/dist/assets/three.module-cmFfBtHS.js +0 -4228
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import type { AgentEvent, DreamEpisode, DreamEpisodeStep, DreamVerdict } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* First-divergence judging (dream stage 2, AP7; concept 7.2 and 11, Phase 6).
|
|
4
|
+
*
|
|
5
|
+
* A recorded trajectory is a prefix-closed simulator. At step k the candidate
|
|
6
|
+
* policy sees the recorded prefix and names step k, and nothing else: it is
|
|
7
|
+
* never told how long the episode was, so it cannot learn where to stop.
|
|
8
|
+
* Matches `(name, argsHash)` and the recorded observation is served; misses,
|
|
9
|
+
* and the decision at k is still exactly judgeable - the simulated bank is
|
|
10
|
+
* identical up to there - while everything after k is undefined, and nothing
|
|
11
|
+
* about it is claimed.
|
|
12
|
+
*
|
|
13
|
+
* Observations are keyed on `(step, argsHash)` (S29). That keying is the
|
|
14
|
+
* whole safety argument: a diverging action can structurally not look one up,
|
|
15
|
+
* which is what makes classical off-policy invention impossible. It is not a
|
|
16
|
+
* check that could be forgotten - there is no other way in.
|
|
17
|
+
*
|
|
18
|
+
* Three contracts hold in this module:
|
|
19
|
+
*
|
|
20
|
+
* - It owns no storage. `episodeFromEvents` reads the existing `turn_events`
|
|
21
|
+
* journal (`turns/journal.ts`); `dream_episodes` is an index over that
|
|
22
|
+
* journal, never a second store of verbatim text (concept, AP1). Nothing
|
|
23
|
+
* here writes.
|
|
24
|
+
* - It never throws. A decider that throws is a divergence, not an exception,
|
|
25
|
+
* the same way `dream/probe.ts` reports into its result instead of
|
|
26
|
+
* unwinding the night.
|
|
27
|
+
* - The hash is defined once. `canonicalJson`/`hashCanonicalJson` are what the
|
|
28
|
+
* recorder in `providers/claude-code.ts` uses to stamp `argsHash` onto the
|
|
29
|
+
* start event. If judge and recorder ever computed it differently, every
|
|
30
|
+
* episode would read as diverging at step 0 and the failure would look like
|
|
31
|
+
* a finding - which is why the provider imports them from here instead of
|
|
32
|
+
* keeping a second copy.
|
|
33
|
+
*
|
|
34
|
+
* Everything here is off by default: `memory.dream.trialEpisodes` is 0.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* How much canonical argument JSON the recorder carries on a start event:
|
|
38
|
+
* the same 4000 characters `summariseInput`'s fallback already used, so the
|
|
39
|
+
* per-event cost of S28 stays inside what the journal already tolerated. The
|
|
40
|
+
* hash is taken over the WHOLE canonical JSON, never over the truncation -
|
|
41
|
+
* `input` is for a human reading a diff, `argsHash` is the key.
|
|
42
|
+
*/
|
|
43
|
+
export declare const TOOL_INPUT_LIMIT = 4000;
|
|
44
|
+
/**
|
|
45
|
+
* JSON with a stable key order, so the same arguments always hash the same.
|
|
46
|
+
*
|
|
47
|
+
* Keys are sorted by UTF-16 code unit (`Array.sort`'s default), `undefined`
|
|
48
|
+
* members are dropped from objects and written as `null` inside arrays, and a
|
|
49
|
+
* non-finite number becomes `null` - exactly what `JSON.stringify` does, minus
|
|
50
|
+
* its dependence on insertion order. Anything it cannot represent (a function,
|
|
51
|
+
* a symbol) becomes `null` rather than an exception.
|
|
52
|
+
*/
|
|
53
|
+
export declare function canonicalJson(value: unknown): string;
|
|
54
|
+
/** The argument hash of an already canonicalised string. */
|
|
55
|
+
export declare function hashCanonicalJson(canonical: string): string;
|
|
56
|
+
/** `sha256(canonicalJson(input))` - the key every observation is stored under. */
|
|
57
|
+
export declare function argsHashOf(input: unknown): string;
|
|
58
|
+
/**
|
|
59
|
+
* What the journal does not know about an episode: who it belongs to, which
|
|
60
|
+
* slot's policy it is relevant to, and which side of the frozen split its
|
|
61
|
+
* session fell on (AP8's `splitOf`). Everything else - the steps, their
|
|
62
|
+
* arguments, their observations - is read back out of `turn_events`.
|
|
63
|
+
*/
|
|
64
|
+
export interface EpisodeSource {
|
|
65
|
+
owner: string;
|
|
66
|
+
kind: DreamEpisode['kind'];
|
|
67
|
+
/** Which slot's policy this episode is relevant to. */
|
|
68
|
+
slot: string;
|
|
69
|
+
sessionId?: string;
|
|
70
|
+
startedAt: number;
|
|
71
|
+
finishedAt?: number;
|
|
72
|
+
holdout?: boolean;
|
|
73
|
+
audit?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Override what the events imply. An assignment knows its own result better
|
|
76
|
+
* than its stream does; a chat turn does not, and leaves this unset.
|
|
77
|
+
*/
|
|
78
|
+
outcome?: DreamEpisode['outcome'];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* One journal row as `TurnJournal.events` hands it back, or a bare event. The
|
|
82
|
+
* journal wraps each event in its sequence number; a caller that already
|
|
83
|
+
* unwrapped them passes the events themselves. Both are accepted so that
|
|
84
|
+
* neither side has to map a list just to call this.
|
|
85
|
+
*/
|
|
86
|
+
export type JournalledEvent = AgentEvent | {
|
|
87
|
+
seq: number;
|
|
88
|
+
event: Record<string, unknown>;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Index one turn's or one assignment's journal as an episode.
|
|
92
|
+
*
|
|
93
|
+
* The steps are the provider's own tool calls, in the order they were
|
|
94
|
+
* yielded: a `start` opens a step, and the `end` carrying the same `id`
|
|
95
|
+
* closes it with its observation. Since S28 the `end` carries the real tool
|
|
96
|
+
* name too, but the correlation stays on `id` - an end without one attaches
|
|
97
|
+
* to the newest step still waiting for a result, which is what the stream
|
|
98
|
+
* order means anyway.
|
|
99
|
+
*
|
|
100
|
+
* `at` is the episode's start on every step, not the step's own wall clock:
|
|
101
|
+
* `turn_events` has no timestamp column (`db.ts`, schema 19), so there is no
|
|
102
|
+
* per-step time to read. It is repeated rather than interpolated - the judge
|
|
103
|
+
* orders on `step`, and nothing here may be read as a duration.
|
|
104
|
+
*/
|
|
105
|
+
export declare function episodeFromEvents(id: string, events: readonly JournalledEvent[], source: EpisodeSource): {
|
|
106
|
+
episode: DreamEpisode;
|
|
107
|
+
steps: DreamEpisodeStep[];
|
|
108
|
+
};
|
|
109
|
+
/** One recorded observation, served only to an action that matches its key. */
|
|
110
|
+
export interface StepObservation {
|
|
111
|
+
result?: string;
|
|
112
|
+
isError?: boolean;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* What the candidate policy names for one step. `argsHash` wins when both are
|
|
116
|
+
* given; otherwise the arguments are hashed with the same `canonicalJson` the
|
|
117
|
+
* recorder used, which is the only way the two can ever agree.
|
|
118
|
+
*/
|
|
119
|
+
export interface ProposedAction {
|
|
120
|
+
name: string;
|
|
121
|
+
input?: unknown;
|
|
122
|
+
argsHash?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* What the simulator puts in front of the candidate at step k.
|
|
126
|
+
*
|
|
127
|
+
* `prefix` is the recorded episode up to but not including `step`, verbatim,
|
|
128
|
+
* with the observation each of those steps produced. There is deliberately no
|
|
129
|
+
* step count in here: a policy that knew `n` could manufacture `no-change` by
|
|
130
|
+
* naming exactly as many steps as were recorded, and `no-change` is the
|
|
131
|
+
* verdict this mechanism most needs to be able to trust.
|
|
132
|
+
*/
|
|
133
|
+
export interface DecisionContext {
|
|
134
|
+
/** Zero-based index of the step to name. */
|
|
135
|
+
step: number;
|
|
136
|
+
/** Steps 0..step-1 as they were recorded, each with its observation. */
|
|
137
|
+
prefix: readonly DreamEpisodeStep[];
|
|
138
|
+
/**
|
|
139
|
+
* The recorded observation for `(step, argsHash)`, or `undefined`. A
|
|
140
|
+
* diverging action has a different hash and therefore no entry - this is
|
|
141
|
+
* the keying from S29, not a check somebody could skip.
|
|
142
|
+
*/
|
|
143
|
+
observe(step: number, argsHash: string): StepObservation | undefined;
|
|
144
|
+
}
|
|
145
|
+
/** Names step `step` of the episode, or `null` for "I would stop here". */
|
|
146
|
+
export type StepDecider = (context: DecisionContext) => ProposedAction | null;
|
|
147
|
+
/** Why the replay stopped where it did. */
|
|
148
|
+
export type JudgementStop =
|
|
149
|
+
/** Every recorded step was reproduced: k = n. */
|
|
150
|
+
'reproduced'
|
|
151
|
+
/** The candidate named a different `(name, argsHash)` at k. */
|
|
152
|
+
| 'action-mismatch'
|
|
153
|
+
/** The candidate named nothing at k while the episode had a step there. */
|
|
154
|
+
| 'no-action'
|
|
155
|
+
/** The recorded step at k predates S28 and carries no `argsHash`. */
|
|
156
|
+
| 'unrecorded-args'
|
|
157
|
+
/** The decider threw. The dream reports; it does not unwind the night. */
|
|
158
|
+
| 'decider-error';
|
|
159
|
+
/**
|
|
160
|
+
* The first-divergence judgement of one episode.
|
|
161
|
+
*
|
|
162
|
+
* Read `counts` before `verdict`. Only `no-change` and a `regression-risk`
|
|
163
|
+
* found on a fully recorded episode may enter an aggregate: a
|
|
164
|
+
* `may-avoid-failure` counts for nothing by decision (S29), and a replay that
|
|
165
|
+
* stopped on `unrecorded-args` is missing evidence rather than evidence, so it
|
|
166
|
+
* counts for nothing either.
|
|
167
|
+
*/
|
|
168
|
+
export interface EpisodeJudgement {
|
|
169
|
+
verdict: DreamVerdict;
|
|
170
|
+
/** k - the first diverging step. Unset when the candidate reproduced all n. */
|
|
171
|
+
divergedAt?: number;
|
|
172
|
+
/** How many steps the candidate reproduced exactly. Equals k. */
|
|
173
|
+
agreed: number;
|
|
174
|
+
/** n - the recorded length. */
|
|
175
|
+
steps: number;
|
|
176
|
+
counts: boolean;
|
|
177
|
+
reason: JudgementStop;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Replay a recorded trajectory against a candidate decider, step by step, and
|
|
181
|
+
* stop at the first divergence.
|
|
182
|
+
*
|
|
183
|
+
* Four admissible verdicts and no fifth (S29): `k = n` is `no-change`, the
|
|
184
|
+
* cheapest and most valuable case; `k < n` on an episode that failed is
|
|
185
|
+
* `may-avoid-failure` and counts for nothing, because the other branch was
|
|
186
|
+
* never run and nothing verified it; `k < n` on an episode that succeeded is
|
|
187
|
+
* `regression-risk` at k; and after k nothing is claimed at all - not the
|
|
188
|
+
* outcome, not the remaining steps, not the cost.
|
|
189
|
+
*
|
|
190
|
+
* `outcome` is the episode's, from `episodeFromEvents`. It defaults to
|
|
191
|
+
* `'unknown'`, and an unknown outcome falls into the bucket that counts for
|
|
192
|
+
* nothing: an episode that neither succeeded nor failed cannot carry a
|
|
193
|
+
* regression claim, and calling it failed would be a claim of its own.
|
|
194
|
+
*/
|
|
195
|
+
export declare function judgeEpisode(steps: readonly DreamEpisodeStep[], decide: StepDecider, outcome?: DreamEpisode['outcome']): EpisodeJudgement;
|
|
196
|
+
/**
|
|
197
|
+
* One episode judged twice: by the simulator, and by letting an agent run
|
|
198
|
+
* freely over the same task and watching where it actually first departed
|
|
199
|
+
* from the record.
|
|
200
|
+
*/
|
|
201
|
+
export interface DivergenceSample {
|
|
202
|
+
/** The episode id, so a disagreement can be looked at rather than argued about. */
|
|
203
|
+
id: string;
|
|
204
|
+
/** k from `judgeEpisode`. Unset means it found no divergence at all. */
|
|
205
|
+
judgedAt?: number;
|
|
206
|
+
/** Where the free run first departed. Unset means it reproduced the episode. */
|
|
207
|
+
observedAt?: number;
|
|
208
|
+
steps: number;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* The agreement the proxy has to reach before Phase 6 may be believed.
|
|
212
|
+
* Guessed: the concept names the gate but not its threshold, and four in five
|
|
213
|
+
* is the lowest number at which "the proxy finds the same step" is still a
|
|
214
|
+
* statement about divergence rather than about chance.
|
|
215
|
+
*/
|
|
216
|
+
export declare const PROXY_AGREEMENT_FLOOR = 0.8;
|
|
217
|
+
/**
|
|
218
|
+
* Below this many samples the gate means nothing, and therefore does not pass.
|
|
219
|
+
* Guessed, and deliberately on the strict side: a gate that can be cleared
|
|
220
|
+
* with three free runs is a formality, not a validation.
|
|
221
|
+
*/
|
|
222
|
+
export declare const PROXY_MIN_SAMPLES = 20;
|
|
223
|
+
/** The validation gate's finding. `note` is one line, fit for the report. */
|
|
224
|
+
export interface DivergenceProxyReport {
|
|
225
|
+
samples: number;
|
|
226
|
+
agreed: number;
|
|
227
|
+
/** `agreed / samples`, 0 with no samples. */
|
|
228
|
+
agreement: number;
|
|
229
|
+
/** Proxy and free run both saw no divergence - the strongest agreement there is. */
|
|
230
|
+
bothReproduced: number;
|
|
231
|
+
/** The proxy called a divergence earlier than the free run had one. */
|
|
232
|
+
early: number;
|
|
233
|
+
/** Later than the free run, or missed it entirely. */
|
|
234
|
+
late: number;
|
|
235
|
+
/** Every disagreement, listed. Never summarised away. */
|
|
236
|
+
disagreements: DivergenceSample[];
|
|
237
|
+
agreementFloor: number;
|
|
238
|
+
minSamples: number;
|
|
239
|
+
passed: boolean;
|
|
240
|
+
note: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The validation gate of Phase 6 (concept 11, Phase 6).
|
|
244
|
+
*
|
|
245
|
+
* The step-k question is a different prompt shape from a real turn, so a
|
|
246
|
+
* detected divergence is a proxy FOR divergence, not divergence. The
|
|
247
|
+
* validation is this: let a sample run freely, and check whether the first
|
|
248
|
+
* step it really departs on is the k the simulator named. This function
|
|
249
|
+
* reports the disagreement. It does not route around it, does not reweight it
|
|
250
|
+
* and does not offer a lower threshold.
|
|
251
|
+
*
|
|
252
|
+
* If it fails, Phase 6 is dead. Not "needs tuning" - dead: first-divergence
|
|
253
|
+
* judging would then be measuring the prompt shape rather than divergence,
|
|
254
|
+
* and every number built on it would be a number about the prompt shape. The
|
|
255
|
+
* only honest way back is the full double run of the concept's first version,
|
|
256
|
+
* section 9.
|
|
257
|
+
*/
|
|
258
|
+
export declare function divergenceProxyReport(samples: readonly DivergenceSample[], options?: {
|
|
259
|
+
agreementFloor?: number;
|
|
260
|
+
minSamples?: number;
|
|
261
|
+
}): DivergenceProxyReport;
|
|
262
|
+
//# sourceMappingURL=trajectory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trajectory.d.ts","sourceRoot":"","sources":["../../../src/memory/dream/trajectory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAUrC;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAA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;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,oFAAoF;IACpF,cAAc,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,aAAa,EAAE,gBAAgB,EAAE,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7D,qBAAqB,CAsEvB"}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
/**
|
|
3
|
+
* First-divergence judging (dream stage 2, AP7; concept 7.2 and 11, Phase 6).
|
|
4
|
+
*
|
|
5
|
+
* A recorded trajectory is a prefix-closed simulator. At step k the candidate
|
|
6
|
+
* policy sees the recorded prefix and names step k, and nothing else: it is
|
|
7
|
+
* never told how long the episode was, so it cannot learn where to stop.
|
|
8
|
+
* Matches `(name, argsHash)` and the recorded observation is served; misses,
|
|
9
|
+
* and the decision at k is still exactly judgeable - the simulated bank is
|
|
10
|
+
* identical up to there - while everything after k is undefined, and nothing
|
|
11
|
+
* about it is claimed.
|
|
12
|
+
*
|
|
13
|
+
* Observations are keyed on `(step, argsHash)` (S29). That keying is the
|
|
14
|
+
* whole safety argument: a diverging action can structurally not look one up,
|
|
15
|
+
* which is what makes classical off-policy invention impossible. It is not a
|
|
16
|
+
* check that could be forgotten - there is no other way in.
|
|
17
|
+
*
|
|
18
|
+
* Three contracts hold in this module:
|
|
19
|
+
*
|
|
20
|
+
* - It owns no storage. `episodeFromEvents` reads the existing `turn_events`
|
|
21
|
+
* journal (`turns/journal.ts`); `dream_episodes` is an index over that
|
|
22
|
+
* journal, never a second store of verbatim text (concept, AP1). Nothing
|
|
23
|
+
* here writes.
|
|
24
|
+
* - It never throws. A decider that throws is a divergence, not an exception,
|
|
25
|
+
* the same way `dream/probe.ts` reports into its result instead of
|
|
26
|
+
* unwinding the night.
|
|
27
|
+
* - The hash is defined once. `canonicalJson`/`hashCanonicalJson` are what the
|
|
28
|
+
* recorder in `providers/claude-code.ts` uses to stamp `argsHash` onto the
|
|
29
|
+
* start event. If judge and recorder ever computed it differently, every
|
|
30
|
+
* episode would read as diverging at step 0 and the failure would look like
|
|
31
|
+
* a finding - which is why the provider imports them from here instead of
|
|
32
|
+
* keeping a second copy.
|
|
33
|
+
*
|
|
34
|
+
* Everything here is off by default: `memory.dream.trialEpisodes` is 0.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* How much canonical argument JSON the recorder carries on a start event:
|
|
38
|
+
* the same 4000 characters `summariseInput`'s fallback already used, so the
|
|
39
|
+
* per-event cost of S28 stays inside what the journal already tolerated. The
|
|
40
|
+
* hash is taken over the WHOLE canonical JSON, never over the truncation -
|
|
41
|
+
* `input` is for a human reading a diff, `argsHash` is the key.
|
|
42
|
+
*/
|
|
43
|
+
export const TOOL_INPUT_LIMIT = 4000;
|
|
44
|
+
/**
|
|
45
|
+
* Deepest structure `canonicalJson` descends into before writing `null`.
|
|
46
|
+
* Tool arguments come out of `JSON.parse` and are acyclic, so this exists
|
|
47
|
+
* only so that a pathological input can never make the recorder throw or
|
|
48
|
+
* recurse without end. No real tool schema comes close.
|
|
49
|
+
*/
|
|
50
|
+
const MAX_DEPTH = 32;
|
|
51
|
+
/**
|
|
52
|
+
* JSON with a stable key order, so the same arguments always hash the same.
|
|
53
|
+
*
|
|
54
|
+
* Keys are sorted by UTF-16 code unit (`Array.sort`'s default), `undefined`
|
|
55
|
+
* members are dropped from objects and written as `null` inside arrays, and a
|
|
56
|
+
* non-finite number becomes `null` - exactly what `JSON.stringify` does, minus
|
|
57
|
+
* its dependence on insertion order. Anything it cannot represent (a function,
|
|
58
|
+
* a symbol) becomes `null` rather than an exception.
|
|
59
|
+
*/
|
|
60
|
+
export function canonicalJson(value) {
|
|
61
|
+
return write(value, 0);
|
|
62
|
+
}
|
|
63
|
+
function write(value, depth) {
|
|
64
|
+
if (depth > MAX_DEPTH)
|
|
65
|
+
return 'null';
|
|
66
|
+
if (value === null || value === undefined)
|
|
67
|
+
return 'null';
|
|
68
|
+
if (typeof value === 'boolean')
|
|
69
|
+
return value ? 'true' : 'false';
|
|
70
|
+
if (typeof value === 'number')
|
|
71
|
+
return Number.isFinite(value) ? JSON.stringify(value) : 'null';
|
|
72
|
+
if (typeof value === 'string')
|
|
73
|
+
return JSON.stringify(value);
|
|
74
|
+
if (typeof value === 'bigint')
|
|
75
|
+
return JSON.stringify(value.toString());
|
|
76
|
+
if (Array.isArray(value))
|
|
77
|
+
return '[' + value.map((entry) => write(entry, depth + 1)).join(',') + ']';
|
|
78
|
+
if (typeof value === 'object') {
|
|
79
|
+
const record = value;
|
|
80
|
+
const keys = Object.keys(record)
|
|
81
|
+
.filter((key) => record[key] !== undefined)
|
|
82
|
+
.sort();
|
|
83
|
+
return ('{' +
|
|
84
|
+
keys.map((key) => JSON.stringify(key) + ':' + write(record[key], depth + 1)).join(',') +
|
|
85
|
+
'}');
|
|
86
|
+
}
|
|
87
|
+
return 'null';
|
|
88
|
+
}
|
|
89
|
+
/** The argument hash of an already canonicalised string. */
|
|
90
|
+
export function hashCanonicalJson(canonical) {
|
|
91
|
+
return createHash('sha256').update(canonical).digest('hex');
|
|
92
|
+
}
|
|
93
|
+
/** `sha256(canonicalJson(input))` - the key every observation is stored under. */
|
|
94
|
+
export function argsHashOf(input) {
|
|
95
|
+
return hashCanonicalJson(canonicalJson(input));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Index one turn's or one assignment's journal as an episode.
|
|
99
|
+
*
|
|
100
|
+
* The steps are the provider's own tool calls, in the order they were
|
|
101
|
+
* yielded: a `start` opens a step, and the `end` carrying the same `id`
|
|
102
|
+
* closes it with its observation. Since S28 the `end` carries the real tool
|
|
103
|
+
* name too, but the correlation stays on `id` - an end without one attaches
|
|
104
|
+
* to the newest step still waiting for a result, which is what the stream
|
|
105
|
+
* order means anyway.
|
|
106
|
+
*
|
|
107
|
+
* `at` is the episode's start on every step, not the step's own wall clock:
|
|
108
|
+
* `turn_events` has no timestamp column (`db.ts`, schema 19), so there is no
|
|
109
|
+
* per-step time to read. It is repeated rather than interpolated - the judge
|
|
110
|
+
* orders on `step`, and nothing here may be read as a duration.
|
|
111
|
+
*/
|
|
112
|
+
export function episodeFromEvents(id, events, source) {
|
|
113
|
+
const steps = [];
|
|
114
|
+
/** Open steps by tool-use id, so an `end` finds the `start` it belongs to. */
|
|
115
|
+
const open = new Map();
|
|
116
|
+
let outcome = 'unknown';
|
|
117
|
+
for (const entry of events) {
|
|
118
|
+
const event = unwrap(entry);
|
|
119
|
+
if (!event)
|
|
120
|
+
continue;
|
|
121
|
+
if (event.type === 'error') {
|
|
122
|
+
outcome = 'failure';
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (event.type === 'done') {
|
|
126
|
+
// An errored result ends the turn without a `done`, so a failure seen
|
|
127
|
+
// earlier stands: the last word is the error, not the absence of one.
|
|
128
|
+
if (outcome === 'unknown')
|
|
129
|
+
outcome = 'success';
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (event.type !== 'tool')
|
|
133
|
+
continue;
|
|
134
|
+
if (event.status === 'start') {
|
|
135
|
+
const index = steps.length;
|
|
136
|
+
steps.push({
|
|
137
|
+
step: index,
|
|
138
|
+
name: event.name,
|
|
139
|
+
...(event.argsHash !== undefined ? { argsHash: event.argsHash } : {}),
|
|
140
|
+
...(event.input !== undefined ? { input: event.input } : {}),
|
|
141
|
+
at: source.startedAt,
|
|
142
|
+
});
|
|
143
|
+
if (event.id)
|
|
144
|
+
open.set(event.id, index);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const index = event.id !== undefined ? open.get(event.id) : lastOpen(steps);
|
|
148
|
+
if (index === undefined)
|
|
149
|
+
continue;
|
|
150
|
+
if (event.id !== undefined)
|
|
151
|
+
open.delete(event.id);
|
|
152
|
+
const step = steps[index];
|
|
153
|
+
if (event.result !== undefined)
|
|
154
|
+
step.result = event.result;
|
|
155
|
+
if (event.isError !== undefined)
|
|
156
|
+
step.isError = event.isError;
|
|
157
|
+
}
|
|
158
|
+
const episode = {
|
|
159
|
+
id,
|
|
160
|
+
owner: source.owner,
|
|
161
|
+
kind: source.kind,
|
|
162
|
+
...(source.sessionId !== undefined ? { sessionId: source.sessionId } : {}),
|
|
163
|
+
slot: source.slot,
|
|
164
|
+
steps: steps.length,
|
|
165
|
+
outcome: source.outcome ?? outcome,
|
|
166
|
+
holdout: source.holdout === true,
|
|
167
|
+
audit: source.audit === true,
|
|
168
|
+
startedAt: source.startedAt,
|
|
169
|
+
...(source.finishedAt !== undefined ? { finishedAt: source.finishedAt } : {}),
|
|
170
|
+
createdAt: Date.now(),
|
|
171
|
+
};
|
|
172
|
+
return { episode, steps };
|
|
173
|
+
}
|
|
174
|
+
function unwrap(entry) {
|
|
175
|
+
const record = entry;
|
|
176
|
+
if (typeof record.type === 'string')
|
|
177
|
+
return entry;
|
|
178
|
+
const inner = record.event;
|
|
179
|
+
if (inner && typeof inner === 'object' && typeof inner.type === 'string') {
|
|
180
|
+
return inner;
|
|
181
|
+
}
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
/** The newest step nothing has closed yet, for an `end` that carries no id. */
|
|
185
|
+
function lastOpen(steps) {
|
|
186
|
+
for (let index = steps.length - 1; index >= 0; index -= 1) {
|
|
187
|
+
const step = steps[index];
|
|
188
|
+
if (step.result === undefined && step.isError === undefined)
|
|
189
|
+
return index;
|
|
190
|
+
}
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Replay a recorded trajectory against a candidate decider, step by step, and
|
|
195
|
+
* stop at the first divergence.
|
|
196
|
+
*
|
|
197
|
+
* Four admissible verdicts and no fifth (S29): `k = n` is `no-change`, the
|
|
198
|
+
* cheapest and most valuable case; `k < n` on an episode that failed is
|
|
199
|
+
* `may-avoid-failure` and counts for nothing, because the other branch was
|
|
200
|
+
* never run and nothing verified it; `k < n` on an episode that succeeded is
|
|
201
|
+
* `regression-risk` at k; and after k nothing is claimed at all - not the
|
|
202
|
+
* outcome, not the remaining steps, not the cost.
|
|
203
|
+
*
|
|
204
|
+
* `outcome` is the episode's, from `episodeFromEvents`. It defaults to
|
|
205
|
+
* `'unknown'`, and an unknown outcome falls into the bucket that counts for
|
|
206
|
+
* nothing: an episode that neither succeeded nor failed cannot carry a
|
|
207
|
+
* regression claim, and calling it failed would be a claim of its own.
|
|
208
|
+
*/
|
|
209
|
+
export function judgeEpisode(steps, decide, outcome = 'unknown') {
|
|
210
|
+
const observations = observationIndex(steps);
|
|
211
|
+
const observe = (step, argsHash) => observations.get(observationKey(step, argsHash));
|
|
212
|
+
for (let index = 0; index < steps.length; index += 1) {
|
|
213
|
+
const recorded = steps[index];
|
|
214
|
+
if (recorded.argsHash === undefined) {
|
|
215
|
+
return stopped(index, steps.length, outcome, 'unrecorded-args');
|
|
216
|
+
}
|
|
217
|
+
let proposed;
|
|
218
|
+
try {
|
|
219
|
+
proposed = decide({ step: index, prefix: steps.slice(0, index), observe });
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
return stopped(index, steps.length, outcome, 'decider-error');
|
|
223
|
+
}
|
|
224
|
+
if (!proposed)
|
|
225
|
+
return stopped(index, steps.length, outcome, 'no-action');
|
|
226
|
+
const argsHash = proposed.argsHash ?? argsHashOf(proposed.input);
|
|
227
|
+
if (proposed.name !== recorded.name || argsHash !== recorded.argsHash) {
|
|
228
|
+
return stopped(index, steps.length, outcome, 'action-mismatch');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
verdict: 'no-change',
|
|
233
|
+
agreed: steps.length,
|
|
234
|
+
steps: steps.length,
|
|
235
|
+
counts: true,
|
|
236
|
+
reason: 'reproduced',
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function stopped(at, steps, outcome, reason) {
|
|
240
|
+
// A stop on unrecorded arguments says nothing about the candidate: the
|
|
241
|
+
// recorder, not the policy, is what ran out.
|
|
242
|
+
const regression = outcome === 'success' && reason !== 'unrecorded-args';
|
|
243
|
+
return {
|
|
244
|
+
verdict: regression ? 'regression-risk' : 'may-avoid-failure',
|
|
245
|
+
divergedAt: at,
|
|
246
|
+
agreed: at,
|
|
247
|
+
steps,
|
|
248
|
+
counts: regression,
|
|
249
|
+
reason,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function observationIndex(steps) {
|
|
253
|
+
const index = new Map();
|
|
254
|
+
for (const step of steps) {
|
|
255
|
+
if (step.argsHash === undefined)
|
|
256
|
+
continue;
|
|
257
|
+
index.set(observationKey(step.step, step.argsHash), {
|
|
258
|
+
...(step.result !== undefined ? { result: step.result } : {}),
|
|
259
|
+
...(step.isError !== undefined ? { isError: step.isError } : {}),
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
return index;
|
|
263
|
+
}
|
|
264
|
+
/** A space cannot occur in a hex digest, so the two halves never blur. */
|
|
265
|
+
function observationKey(step, argsHash) {
|
|
266
|
+
return String(step) + ' ' + argsHash;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* The agreement the proxy has to reach before Phase 6 may be believed.
|
|
270
|
+
* Guessed: the concept names the gate but not its threshold, and four in five
|
|
271
|
+
* is the lowest number at which "the proxy finds the same step" is still a
|
|
272
|
+
* statement about divergence rather than about chance.
|
|
273
|
+
*/
|
|
274
|
+
export const PROXY_AGREEMENT_FLOOR = 0.8;
|
|
275
|
+
/**
|
|
276
|
+
* Below this many samples the gate means nothing, and therefore does not pass.
|
|
277
|
+
* Guessed, and deliberately on the strict side: a gate that can be cleared
|
|
278
|
+
* with three free runs is a formality, not a validation.
|
|
279
|
+
*/
|
|
280
|
+
export const PROXY_MIN_SAMPLES = 20;
|
|
281
|
+
/**
|
|
282
|
+
* The validation gate of Phase 6 (concept 11, Phase 6).
|
|
283
|
+
*
|
|
284
|
+
* The step-k question is a different prompt shape from a real turn, so a
|
|
285
|
+
* detected divergence is a proxy FOR divergence, not divergence. The
|
|
286
|
+
* validation is this: let a sample run freely, and check whether the first
|
|
287
|
+
* step it really departs on is the k the simulator named. This function
|
|
288
|
+
* reports the disagreement. It does not route around it, does not reweight it
|
|
289
|
+
* and does not offer a lower threshold.
|
|
290
|
+
*
|
|
291
|
+
* If it fails, Phase 6 is dead. Not "needs tuning" - dead: first-divergence
|
|
292
|
+
* judging would then be measuring the prompt shape rather than divergence,
|
|
293
|
+
* and every number built on it would be a number about the prompt shape. The
|
|
294
|
+
* only honest way back is the full double run of the concept's first version,
|
|
295
|
+
* section 9.
|
|
296
|
+
*/
|
|
297
|
+
export function divergenceProxyReport(samples, options = {}) {
|
|
298
|
+
const agreementFloor = options.agreementFloor ?? PROXY_AGREEMENT_FLOOR;
|
|
299
|
+
const minSamples = options.minSamples ?? PROXY_MIN_SAMPLES;
|
|
300
|
+
const disagreements = [];
|
|
301
|
+
let agreed = 0;
|
|
302
|
+
let bothReproduced = 0;
|
|
303
|
+
let early = 0;
|
|
304
|
+
let late = 0;
|
|
305
|
+
for (const sample of samples) {
|
|
306
|
+
if (sample.judgedAt === sample.observedAt) {
|
|
307
|
+
agreed += 1;
|
|
308
|
+
if (sample.judgedAt === undefined)
|
|
309
|
+
bothReproduced += 1;
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
disagreements.push(sample);
|
|
313
|
+
// An unset k is "no divergence found at all", which is as late as it gets.
|
|
314
|
+
const judged = sample.judgedAt ?? sample.steps;
|
|
315
|
+
const observed = sample.observedAt ?? sample.steps;
|
|
316
|
+
if (judged < observed)
|
|
317
|
+
early += 1;
|
|
318
|
+
else
|
|
319
|
+
late += 1;
|
|
320
|
+
}
|
|
321
|
+
const agreement = samples.length ? agreed / samples.length : 0;
|
|
322
|
+
const thin = samples.length < minSamples;
|
|
323
|
+
const passed = !thin && agreement >= agreementFloor;
|
|
324
|
+
const percent = (value) => String(Math.round(value * 100)) + '%';
|
|
325
|
+
const note = thin
|
|
326
|
+
? 'Only ' +
|
|
327
|
+
samples.length +
|
|
328
|
+
' sample(s); the gate needs ' +
|
|
329
|
+
minSamples +
|
|
330
|
+
' before it says anything. Not passed.'
|
|
331
|
+
: passed
|
|
332
|
+
? 'The proxy found the same first diverging step as the free run in ' +
|
|
333
|
+
agreed +
|
|
334
|
+
' of ' +
|
|
335
|
+
samples.length +
|
|
336
|
+
' samples (' +
|
|
337
|
+
percent(agreement) +
|
|
338
|
+
', floor ' +
|
|
339
|
+
percent(agreementFloor) +
|
|
340
|
+
').'
|
|
341
|
+
: 'The proxy disagreed with the free run in ' +
|
|
342
|
+
disagreements.length +
|
|
343
|
+
' of ' +
|
|
344
|
+
samples.length +
|
|
345
|
+
' samples (' +
|
|
346
|
+
percent(agreement) +
|
|
347
|
+
' agreement, floor ' +
|
|
348
|
+
percent(agreementFloor) +
|
|
349
|
+
'). Phase 6 is dead as designed: first-divergence judging is then ' +
|
|
350
|
+
'measuring the prompt shape, not divergence, and the only honest way ' +
|
|
351
|
+
'back is the full double run (concept version 1, section 9).';
|
|
352
|
+
return {
|
|
353
|
+
samples: samples.length,
|
|
354
|
+
agreed,
|
|
355
|
+
agreement,
|
|
356
|
+
bothReproduced,
|
|
357
|
+
early,
|
|
358
|
+
late,
|
|
359
|
+
disagreements,
|
|
360
|
+
agreementFloor,
|
|
361
|
+
minSamples,
|
|
362
|
+
passed,
|
|
363
|
+
note,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
//# sourceMappingURL=trajectory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trajectory.js","sourceRoot":"","sources":["../../../src/memory/dream/trajectory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAErC;;;;;GAKG;AACH,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,KAAK,CAAC,KAAc,EAAE,KAAa;IAC1C,IAAI,KAAK,GAAG,SAAS;QAAE,OAAO,MAAM,CAAC;IACrC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACzD,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC9F,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC5D,IAAI,OAAO,KAAK,KAA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CAAC,IAAI,IAAI,SAAS,IAAI,cAAc,CAAC;IACpD,MAAM,OAAO,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IAEjF,MAAM,IAAI,GAAG,IAAI;QACf,CAAC,CAAC,OAAO;YACP,OAAO,CAAC,MAAM;YACd,6BAA6B;YAC7B,UAAU;YACV,uCAAuC;QACzC,CAAC,CAAC,MAAM;YACN,CAAC,CAAC,mEAAmE;gBACnE,MAAM;gBACN,MAAM;gBACN,OAAO,CAAC,MAAM;gBACd,YAAY;gBACZ,OAAO,CAAC,SAAS,CAAC;gBAClB,UAAU;gBACV,OAAO,CAAC,cAAc,CAAC;gBACvB,IAAI;YACN,CAAC,CAAC,2CAA2C;gBAC3C,aAAa,CAAC,MAAM;gBACpB,MAAM;gBACN,OAAO,CAAC,MAAM;gBACd,YAAY;gBACZ,OAAO,CAAC,SAAS,CAAC;gBAClB,oBAAoB;gBACpB,OAAO,CAAC,cAAc,CAAC;gBACvB,mEAAmE;gBACnE,sEAAsE;gBACtE,6DAA6D,CAAC;IAEpE,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,MAAM;QACvB,MAAM;QACN,SAAS;QACT,cAAc;QACd,KAAK;QACL,IAAI;QACJ,aAAa;QACb,cAAc;QACd,UAAU;QACV,MAAM;QACN,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -11,6 +11,13 @@ export interface MemoryCandidate {
|
|
|
11
11
|
content: string;
|
|
12
12
|
tags: string[];
|
|
13
13
|
importance: number;
|
|
14
|
+
/**
|
|
15
|
+
* The words the candidate stands on, copied out of what the user - or, for
|
|
16
|
+
* an agent, the assignment and the report - actually wrote. The gate checks
|
|
17
|
+
* it against the source text and throws the candidate away when it is not
|
|
18
|
+
* there, so a model that paraphrases its way to a "fact" gets nowhere.
|
|
19
|
+
*/
|
|
20
|
+
evidence: string;
|
|
14
21
|
}
|
|
15
22
|
export interface ExtractionInput {
|
|
16
23
|
userText: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../src/memory/extractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;GAMG;AAEH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../src/memory/extractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;GAMG;AAEH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAoFD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mGAAmG;IACnG,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,eAAe,EACtB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,eAAe,EAAE,CAAC,CAiC5B;AAED,kFA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