@ashlr/hub 2.2.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/CHANGELOG.md +1158 -0
- package/LICENSE +21 -0
- package/README.md +833 -0
- package/bin/ashlr +8 -0
- package/dist/api/core.d.ts +28 -0
- package/dist/api/core.js +42 -0
- package/dist/api/core.js.map +1 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/index.js +9 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/plugin.d.ts +12 -0
- package/dist/api/plugin.js +13 -0
- package/dist/api/plugin.js.map +1 -0
- package/dist/api/types.d.ts +9 -0
- package/dist/api/types.js +9 -0
- package/dist/api/types.js.map +1 -0
- package/dist/cli/args.d.ts +20 -0
- package/dist/cli/args.js +23 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/ask.d.ts +22 -0
- package/dist/cli/ask.js +240 -0
- package/dist/cli/ask.js.map +1 -0
- package/dist/cli/audit.d.ts +26 -0
- package/dist/cli/audit.js +199 -0
- package/dist/cli/audit.js.map +1 -0
- package/dist/cli/backlog.d.ts +26 -0
- package/dist/cli/backlog.js +322 -0
- package/dist/cli/backlog.js.map +1 -0
- package/dist/cli/completions.d.ts +18 -0
- package/dist/cli/completions.js +156 -0
- package/dist/cli/completions.js.map +1 -0
- package/dist/cli/daemon.d.ts +31 -0
- package/dist/cli/daemon.js +334 -0
- package/dist/cli/daemon.js.map +1 -0
- package/dist/cli/demo-sandbox.d.ts +78 -0
- package/dist/cli/demo-sandbox.js +227 -0
- package/dist/cli/demo-sandbox.js.map +1 -0
- package/dist/cli/demo.d.ts +76 -0
- package/dist/cli/demo.js +285 -0
- package/dist/cli/demo.js.map +1 -0
- package/dist/cli/digest.d.ts +46 -0
- package/dist/cli/digest.js +352 -0
- package/dist/cli/digest.js.map +1 -0
- package/dist/cli/doctor-init.d.ts +28 -0
- package/dist/cli/doctor-init.js +335 -0
- package/dist/cli/doctor-init.js.map +1 -0
- package/dist/cli/genome.d.ts +62 -0
- package/dist/cli/genome.js +1061 -0
- package/dist/cli/genome.js.map +1 -0
- package/dist/cli/gh.d.ts +27 -0
- package/dist/cli/gh.js +322 -0
- package/dist/cli/gh.js.map +1 -0
- package/dist/cli/goals.d.ts +55 -0
- package/dist/cli/goals.js +667 -0
- package/dist/cli/goals.js.map +1 -0
- package/dist/cli/health.d.ts +56 -0
- package/dist/cli/health.js +407 -0
- package/dist/cli/health.js.map +1 -0
- package/dist/cli/help.d.ts +51 -0
- package/dist/cli/help.js +436 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/inbox.d.ts +28 -0
- package/dist/cli/inbox.js +589 -0
- package/dist/cli/inbox.js.map +1 -0
- package/dist/cli/index.d.ts +41 -0
- package/dist/cli/index.js +1208 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/knowledge.d.ts +33 -0
- package/dist/cli/knowledge.js +575 -0
- package/dist/cli/knowledge.js.map +1 -0
- package/dist/cli/mcp.d.ts +26 -0
- package/dist/cli/mcp.js +487 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli/models.d.ts +26 -0
- package/dist/cli/models.js +435 -0
- package/dist/cli/models.js.map +1 -0
- package/dist/cli/new.d.ts +32 -0
- package/dist/cli/new.js +565 -0
- package/dist/cli/new.js.map +1 -0
- package/dist/cli/notify.d.ts +20 -0
- package/dist/cli/notify.js +188 -0
- package/dist/cli/notify.js.map +1 -0
- package/dist/cli/onboard.d.ts +85 -0
- package/dist/cli/onboard.js +305 -0
- package/dist/cli/onboard.js.map +1 -0
- package/dist/cli/open.d.ts +38 -0
- package/dist/cli/open.js +86 -0
- package/dist/cli/open.js.map +1 -0
- package/dist/cli/orient.d.ts +14 -0
- package/dist/cli/orient.js +110 -0
- package/dist/cli/orient.js.map +1 -0
- package/dist/cli/picker.d.ts +21 -0
- package/dist/cli/picker.js +177 -0
- package/dist/cli/picker.js.map +1 -0
- package/dist/cli/plugins.d.ts +21 -0
- package/dist/cli/plugins.js +394 -0
- package/dist/cli/plugins.js.map +1 -0
- package/dist/cli/preflight.d.ts +29 -0
- package/dist/cli/preflight.js +131 -0
- package/dist/cli/preflight.js.map +1 -0
- package/dist/cli/pulse.d.ts +26 -0
- package/dist/cli/pulse.js +482 -0
- package/dist/cli/pulse.js.map +1 -0
- package/dist/cli/reflect.d.ts +42 -0
- package/dist/cli/reflect.js +381 -0
- package/dist/cli/reflect.js.map +1 -0
- package/dist/cli/run.d.ts +29 -0
- package/dist/cli/run.js +687 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/sandbox.d.ts +20 -0
- package/dist/cli/sandbox.js +345 -0
- package/dist/cli/sandbox.js.map +1 -0
- package/dist/cli/seams.d.ts +41 -0
- package/dist/cli/seams.js +167 -0
- package/dist/cli/seams.js.map +1 -0
- package/dist/cli/serve.d.ts +25 -0
- package/dist/cli/serve.js +249 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/ship.d.ts +33 -0
- package/dist/cli/ship.js +433 -0
- package/dist/cli/ship.js.map +1 -0
- package/dist/cli/spec.d.ts +19 -0
- package/dist/cli/spec.js +478 -0
- package/dist/cli/spec.js.map +1 -0
- package/dist/cli/swarm.d.ts +42 -0
- package/dist/cli/swarm.js +1365 -0
- package/dist/cli/swarm.js.map +1 -0
- package/dist/cli/telemetry.d.ts +26 -0
- package/dist/cli/telemetry.js +364 -0
- package/dist/cli/telemetry.js.map +1 -0
- package/dist/cli/tui.d.ts +17 -0
- package/dist/cli/tui.js +52 -0
- package/dist/cli/tui.js.map +1 -0
- package/dist/cli/ui.d.ts +53 -0
- package/dist/cli/ui.js +66 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/cli/update.d.ts +38 -0
- package/dist/cli/update.js +682 -0
- package/dist/cli/update.js.map +1 -0
- package/dist/cli/vercel.d.ts +20 -0
- package/dist/cli/vercel.js +193 -0
- package/dist/cli/vercel.js.map +1 -0
- package/dist/cli/verify-safety.d.ts +96 -0
- package/dist/cli/verify-safety.js +509 -0
- package/dist/cli/verify-safety.js.map +1 -0
- package/dist/cli/wire.d.ts +22 -0
- package/dist/cli/wire.js +205 -0
- package/dist/cli/wire.js.map +1 -0
- package/dist/core/classify.d.ts +51 -0
- package/dist/core/classify.js +450 -0
- package/dist/core/classify.js.map +1 -0
- package/dist/core/config.d.ts +63 -0
- package/dist/core/config.js +474 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/daemon/loop.d.ts +74 -0
- package/dist/core/daemon/loop.js +618 -0
- package/dist/core/daemon/loop.js.map +1 -0
- package/dist/core/daemon/state.d.ts +66 -0
- package/dist/core/daemon/state.js +197 -0
- package/dist/core/daemon/state.js.map +1 -0
- package/dist/core/dashboard.d.ts +40 -0
- package/dist/core/dashboard.js +463 -0
- package/dist/core/dashboard.js.map +1 -0
- package/dist/core/digest/build.d.ts +51 -0
- package/dist/core/digest/build.js +230 -0
- package/dist/core/digest/build.js.map +1 -0
- package/dist/core/digest/deliver.d.ts +47 -0
- package/dist/core/digest/deliver.js +230 -0
- package/dist/core/digest/deliver.js.map +1 -0
- package/dist/core/digest/store.d.ts +57 -0
- package/dist/core/digest/store.js +223 -0
- package/dist/core/digest/store.js.map +1 -0
- package/dist/core/doctor-fix.d.ts +21 -0
- package/dist/core/doctor-fix.js +440 -0
- package/dist/core/doctor-fix.js.map +1 -0
- package/dist/core/doctor.d.ts +18 -0
- package/dist/core/doctor.js +806 -0
- package/dist/core/doctor.js.map +1 -0
- package/dist/core/env-bridge.d.ts +64 -0
- package/dist/core/env-bridge.js +103 -0
- package/dist/core/env-bridge.js.map +1 -0
- package/dist/core/genome/capture.d.ts +49 -0
- package/dist/core/genome/capture.js +352 -0
- package/dist/core/genome/capture.js.map +1 -0
- package/dist/core/genome/consolidate.d.ts +38 -0
- package/dist/core/genome/consolidate.js +426 -0
- package/dist/core/genome/consolidate.js.map +1 -0
- package/dist/core/genome/export.d.ts +29 -0
- package/dist/core/genome/export.js +102 -0
- package/dist/core/genome/export.js.map +1 -0
- package/dist/core/genome/playbook.d.ts +33 -0
- package/dist/core/genome/playbook.js +320 -0
- package/dist/core/genome/playbook.js.map +1 -0
- package/dist/core/genome/recall.d.ts +45 -0
- package/dist/core/genome/recall.js +293 -0
- package/dist/core/genome/recall.js.map +1 -0
- package/dist/core/genome/store.d.ts +62 -0
- package/dist/core/genome/store.js +711 -0
- package/dist/core/genome/store.js.map +1 -0
- package/dist/core/git.d.ts +34 -0
- package/dist/core/git.js +115 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/goals/advance.d.ts +82 -0
- package/dist/core/goals/advance.js +263 -0
- package/dist/core/goals/advance.js.map +1 -0
- package/dist/core/goals/planner.d.ts +58 -0
- package/dist/core/goals/planner.js +233 -0
- package/dist/core/goals/planner.js.map +1 -0
- package/dist/core/goals/store.d.ts +128 -0
- package/dist/core/goals/store.js +442 -0
- package/dist/core/goals/store.js.map +1 -0
- package/dist/core/inbox/apply.d.ts +36 -0
- package/dist/core/inbox/apply.js +407 -0
- package/dist/core/inbox/apply.js.map +1 -0
- package/dist/core/inbox/notify-proposal.d.ts +13 -0
- package/dist/core/inbox/notify-proposal.js +21 -0
- package/dist/core/inbox/notify-proposal.js.map +1 -0
- package/dist/core/inbox/store.d.ts +67 -0
- package/dist/core/inbox/store.js +258 -0
- package/dist/core/inbox/store.js.map +1 -0
- package/dist/core/index-engine.d.ts +62 -0
- package/dist/core/index-engine.js +486 -0
- package/dist/core/index-engine.js.map +1 -0
- package/dist/core/integrations/desktop-notify.d.ts +18 -0
- package/dist/core/integrations/desktop-notify.js +42 -0
- package/dist/core/integrations/desktop-notify.js.map +1 -0
- package/dist/core/integrations/editors.d.ts +50 -0
- package/dist/core/integrations/editors.js +216 -0
- package/dist/core/integrations/editors.js.map +1 -0
- package/dist/core/integrations/github.d.ts +66 -0
- package/dist/core/integrations/github.js +332 -0
- package/dist/core/integrations/github.js.map +1 -0
- package/dist/core/integrations/identity.d.ts +29 -0
- package/dist/core/integrations/identity.js +359 -0
- package/dist/core/integrations/identity.js.map +1 -0
- package/dist/core/integrations/notify.d.ts +23 -0
- package/dist/core/integrations/notify.js +96 -0
- package/dist/core/integrations/notify.js.map +1 -0
- package/dist/core/integrations/vercel.d.ts +37 -0
- package/dist/core/integrations/vercel.js +192 -0
- package/dist/core/integrations/vercel.js.map +1 -0
- package/dist/core/knowledge/ask.d.ts +34 -0
- package/dist/core/knowledge/ask.js +325 -0
- package/dist/core/knowledge/ask.js.map +1 -0
- package/dist/core/knowledge/graph.d.ts +51 -0
- package/dist/core/knowledge/graph.js +564 -0
- package/dist/core/knowledge/graph.js.map +1 -0
- package/dist/core/knowledge/index.d.ts +74 -0
- package/dist/core/knowledge/index.js +586 -0
- package/dist/core/knowledge/index.js.map +1 -0
- package/dist/core/learn/playbooks.d.ts +84 -0
- package/dist/core/learn/playbooks.js +241 -0
- package/dist/core/learn/playbooks.js.map +1 -0
- package/dist/core/learn/reflect.d.ts +87 -0
- package/dist/core/learn/reflect.js +435 -0
- package/dist/core/learn/reflect.js.map +1 -0
- package/dist/core/learn/store.d.ts +51 -0
- package/dist/core/learn/store.js +165 -0
- package/dist/core/learn/store.js.map +1 -0
- package/dist/core/learn/tuning.d.ts +48 -0
- package/dist/core/learn/tuning.js +201 -0
- package/dist/core/learn/tuning.js.map +1 -0
- package/dist/core/lifecycle/scaffold.d.ts +43 -0
- package/dist/core/lifecycle/scaffold.js +260 -0
- package/dist/core/lifecycle/scaffold.js.map +1 -0
- package/dist/core/lifecycle/ship.d.ts +48 -0
- package/dist/core/lifecycle/ship.js +513 -0
- package/dist/core/lifecycle/ship.js.map +1 -0
- package/dist/core/lifecycle/templates.d.ts +20 -0
- package/dist/core/lifecycle/templates.js +605 -0
- package/dist/core/lifecycle/templates.js.map +1 -0
- package/dist/core/mcp-gateway.d.ts +59 -0
- package/dist/core/mcp-gateway.js +385 -0
- package/dist/core/mcp-gateway.js.map +1 -0
- package/dist/core/mcp-native.d.ts +53 -0
- package/dist/core/mcp-native.js +507 -0
- package/dist/core/mcp-native.js.map +1 -0
- package/dist/core/mcp-registry.d.ts +36 -0
- package/dist/core/mcp-registry.js +180 -0
- package/dist/core/mcp-registry.js.map +1 -0
- package/dist/core/observability/budget-alert.d.ts +18 -0
- package/dist/core/observability/budget-alert.js +90 -0
- package/dist/core/observability/budget-alert.js.map +1 -0
- package/dist/core/observability/estimate.d.ts +27 -0
- package/dist/core/observability/estimate.js +188 -0
- package/dist/core/observability/estimate.js.map +1 -0
- package/dist/core/observability/forecast.d.ts +19 -0
- package/dist/core/observability/forecast.js +101 -0
- package/dist/core/observability/forecast.js.map +1 -0
- package/dist/core/observability/governance.d.ts +28 -0
- package/dist/core/observability/governance.js +101 -0
- package/dist/core/observability/governance.js.map +1 -0
- package/dist/core/observability/otlp.d.ts +88 -0
- package/dist/core/observability/otlp.js +217 -0
- package/dist/core/observability/otlp.js.map +1 -0
- package/dist/core/observability/rollup.d.ts +35 -0
- package/dist/core/observability/rollup.js +311 -0
- package/dist/core/observability/rollup.js.map +1 -0
- package/dist/core/observability/telemetry-sink.d.ts +63 -0
- package/dist/core/observability/telemetry-sink.js +350 -0
- package/dist/core/observability/telemetry-sink.js.map +1 -0
- package/dist/core/observability/usage-source.d.ts +60 -0
- package/dist/core/observability/usage-source.js +347 -0
- package/dist/core/observability/usage-source.js.map +1 -0
- package/dist/core/onboard.d.ts +27 -0
- package/dist/core/onboard.js +288 -0
- package/dist/core/onboard.js.map +1 -0
- package/dist/core/orient.d.ts +23 -0
- package/dist/core/orient.js +135 -0
- package/dist/core/orient.js.map +1 -0
- package/dist/core/phantom.d.ts +23 -0
- package/dist/core/phantom.js +279 -0
- package/dist/core/phantom.js.map +1 -0
- package/dist/core/plugins/host-api.d.ts +29 -0
- package/dist/core/plugins/host-api.js +113 -0
- package/dist/core/plugins/host-api.js.map +1 -0
- package/dist/core/plugins/integrity.d.ts +36 -0
- package/dist/core/plugins/integrity.js +73 -0
- package/dist/core/plugins/integrity.js.map +1 -0
- package/dist/core/plugins/manifest.d.ts +31 -0
- package/dist/core/plugins/manifest.js +316 -0
- package/dist/core/plugins/manifest.js.map +1 -0
- package/dist/core/plugins/registry.d.ts +87 -0
- package/dist/core/plugins/registry.js +415 -0
- package/dist/core/plugins/registry.js.map +1 -0
- package/dist/core/plugins/types.d.ts +182 -0
- package/dist/core/plugins/types.js +40 -0
- package/dist/core/plugins/types.js.map +1 -0
- package/dist/core/plugins/wrappers.d.ts +40 -0
- package/dist/core/plugins/wrappers.js +229 -0
- package/dist/core/plugins/wrappers.js.map +1 -0
- package/dist/core/portfolio/backlog.d.ts +40 -0
- package/dist/core/portfolio/backlog.js +177 -0
- package/dist/core/portfolio/backlog.js.map +1 -0
- package/dist/core/portfolio/scanners.d.ts +21 -0
- package/dist/core/portfolio/scanners.js +600 -0
- package/dist/core/portfolio/scanners.js.map +1 -0
- package/dist/core/providers.d.ts +34 -0
- package/dist/core/providers.js +250 -0
- package/dist/core/providers.js.map +1 -0
- package/dist/core/quality/conventions.d.ts +35 -0
- package/dist/core/quality/conventions.js +267 -0
- package/dist/core/quality/conventions.js.map +1 -0
- package/dist/core/quality/fixes.d.ts +56 -0
- package/dist/core/quality/fixes.js +209 -0
- package/dist/core/quality/fixes.js.map +1 -0
- package/dist/core/quality/health.d.ts +69 -0
- package/dist/core/quality/health.js +350 -0
- package/dist/core/quality/health.js.map +1 -0
- package/dist/core/quality/store.d.ts +56 -0
- package/dist/core/quality/store.js +195 -0
- package/dist/core/quality/store.js.map +1 -0
- package/dist/core/readiness.d.ts +112 -0
- package/dist/core/readiness.js +431 -0
- package/dist/core/readiness.js.map +1 -0
- package/dist/core/run/agent-loop.d.ts +40 -0
- package/dist/core/run/agent-loop.js +291 -0
- package/dist/core/run/agent-loop.js.map +1 -0
- package/dist/core/run/budget.d.ts +47 -0
- package/dist/core/run/budget.js +113 -0
- package/dist/core/run/budget.js.map +1 -0
- package/dist/core/run/engines.d.ts +75 -0
- package/dist/core/run/engines.js +199 -0
- package/dist/core/run/engines.js.map +1 -0
- package/dist/core/run/model-manager.d.ts +64 -0
- package/dist/core/run/model-manager.js +339 -0
- package/dist/core/run/model-manager.js.map +1 -0
- package/dist/core/run/orchestrator.d.ts +100 -0
- package/dist/core/run/orchestrator.js +1515 -0
- package/dist/core/run/orchestrator.js.map +1 -0
- package/dist/core/run/provider-client.d.ts +46 -0
- package/dist/core/run/provider-client.js +796 -0
- package/dist/core/run/provider-client.js.map +1 -0
- package/dist/core/run/retry.d.ts +19 -0
- package/dist/core/run/retry.js +68 -0
- package/dist/core/run/retry.js.map +1 -0
- package/dist/core/run/router.d.ts +50 -0
- package/dist/core/run/router.js +257 -0
- package/dist/core/run/router.js.map +1 -0
- package/dist/core/run/self-heal.d.ts +52 -0
- package/dist/core/run/self-heal.js +181 -0
- package/dist/core/run/self-heal.js.map +1 -0
- package/dist/core/run/streaming.d.ts +31 -0
- package/dist/core/run/streaming.js +122 -0
- package/dist/core/run/streaming.js.map +1 -0
- package/dist/core/run/verify.d.ts +30 -0
- package/dist/core/run/verify.js +204 -0
- package/dist/core/run/verify.js.map +1 -0
- package/dist/core/sandbox/audit.d.ts +31 -0
- package/dist/core/sandbox/audit.js +169 -0
- package/dist/core/sandbox/audit.js.map +1 -0
- package/dist/core/sandbox/policy.d.ts +61 -0
- package/dist/core/sandbox/policy.js +211 -0
- package/dist/core/sandbox/policy.js.map +1 -0
- package/dist/core/sandbox/worktree.d.ts +175 -0
- package/dist/core/sandbox/worktree.js +673 -0
- package/dist/core/sandbox/worktree.js.map +1 -0
- package/dist/core/seams/backlog.d.ts +47 -0
- package/dist/core/seams/backlog.js +47 -0
- package/dist/core/seams/backlog.js.map +1 -0
- package/dist/core/seams/daemon-coordinator.d.ts +72 -0
- package/dist/core/seams/daemon-coordinator.js +76 -0
- package/dist/core/seams/daemon-coordinator.js.map +1 -0
- package/dist/core/seams/genome.d.ts +45 -0
- package/dist/core/seams/genome.js +53 -0
- package/dist/core/seams/genome.js.map +1 -0
- package/dist/core/seams/identity.d.ts +40 -0
- package/dist/core/seams/identity.js +44 -0
- package/dist/core/seams/identity.js.map +1 -0
- package/dist/core/seams/inbox.d.ts +60 -0
- package/dist/core/seams/inbox.js +66 -0
- package/dist/core/seams/inbox.js.map +1 -0
- package/dist/core/seams/index.d.ts +20 -0
- package/dist/core/seams/index.js +21 -0
- package/dist/core/seams/index.js.map +1 -0
- package/dist/core/seams/portfolio.d.ts +50 -0
- package/dist/core/seams/portfolio.js +61 -0
- package/dist/core/seams/portfolio.js.map +1 -0
- package/dist/core/seams/registry.d.ts +42 -0
- package/dist/core/seams/registry.js +128 -0
- package/dist/core/seams/registry.js.map +1 -0
- package/dist/core/seams/run-swarm.d.ts +66 -0
- package/dist/core/seams/run-swarm.js +74 -0
- package/dist/core/seams/run-swarm.js.map +1 -0
- package/dist/core/seams/types.d.ts +123 -0
- package/dist/core/seams/types.js +35 -0
- package/dist/core/seams/types.js.map +1 -0
- package/dist/core/spec/spec-store.d.ts +62 -0
- package/dist/core/spec/spec-store.js +359 -0
- package/dist/core/spec/spec-store.js.map +1 -0
- package/dist/core/swarm/gate.d.ts +45 -0
- package/dist/core/swarm/gate.js +114 -0
- package/dist/core/swarm/gate.js.map +1 -0
- package/dist/core/swarm/planner.d.ts +32 -0
- package/dist/core/swarm/planner.js +293 -0
- package/dist/core/swarm/planner.js.map +1 -0
- package/dist/core/swarm/rollback.d.ts +56 -0
- package/dist/core/swarm/rollback.js +266 -0
- package/dist/core/swarm/rollback.js.map +1 -0
- package/dist/core/swarm/runner.d.ts +62 -0
- package/dist/core/swarm/runner.js +1263 -0
- package/dist/core/swarm/runner.js.map +1 -0
- package/dist/core/swarm/sign.d.ts +71 -0
- package/dist/core/swarm/sign.js +362 -0
- package/dist/core/swarm/sign.js.map +1 -0
- package/dist/core/swarm/store.d.ts +52 -0
- package/dist/core/swarm/store.js +195 -0
- package/dist/core/swarm/store.js.map +1 -0
- package/dist/core/tidy.d.ts +32 -0
- package/dist/core/tidy.js +354 -0
- package/dist/core/tidy.js.map +1 -0
- package/dist/core/tools-registry.d.ts +16 -0
- package/dist/core/tools-registry.js +308 -0
- package/dist/core/tools-registry.js.map +1 -0
- package/dist/core/types.d.ts +2545 -0
- package/dist/core/types.js +9 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/web/api.d.ts +53 -0
- package/dist/core/web/api.js +698 -0
- package/dist/core/web/api.js.map +1 -0
- package/dist/core/web/public/app.js +1906 -0
- package/dist/core/web/public/index.html +721 -0
- package/dist/core/web/public/styles.css +2007 -0
- package/dist/core/web/server.d.ts +18 -0
- package/dist/core/web/server.js +122 -0
- package/dist/core/web/server.js.map +1 -0
- package/dist/core/web/static.d.ts +18 -0
- package/dist/core/web/static.js +122 -0
- package/dist/core/web/static.js.map +1 -0
- package/dist/tui/app.d.ts +33 -0
- package/dist/tui/app.js +350 -0
- package/dist/tui/app.js.map +1 -0
- package/dist/tui/render.d.ts +20 -0
- package/dist/tui/render.js +558 -0
- package/dist/tui/render.js.map +1 -0
- package/package.json +80 -0
- package/schema/config.schema.json +223 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* playbooks.ts — M26 playbook distillation from SUCCESSFUL past swarms.
|
|
3
|
+
*
|
|
4
|
+
* Distills recurring patterns from `done` swarms into playbook entries and
|
|
5
|
+
* persists them via the genome (appendHubEntry, hubOnly) so they auto-inject
|
|
6
|
+
* into future agents. An OPTIONAL local-model narrative may polish the playbook
|
|
7
|
+
* text — but the default path is deterministic and makes ZERO cloud calls.
|
|
8
|
+
*
|
|
9
|
+
* HARD SAFETY INVARIANTS (M26):
|
|
10
|
+
* - READ-ONLY over history: reads listSwarms() only. The ONLY write is
|
|
11
|
+
* appendHubEntry({ hubOnly: true }) into ~/.ashlr/genome/hub.jsonl — an
|
|
12
|
+
* APPEND to the genome hub. With hubOnly:true it NEVER drops a file into a
|
|
13
|
+
* user repo working tree (see appendHubEntry's contract). It NEVER writes
|
|
14
|
+
* CONFIG_PATH / router policy / prompts.
|
|
15
|
+
* - LOCAL-FIRST: narrative text routes through getActiveClient(cfg,
|
|
16
|
+
* { allowCloud }) EXACTLY as M25 ask.ts — local Ollama/LM Studio only unless
|
|
17
|
+
* the caller passes allowCloud AND a key is present. Default path is local
|
|
18
|
+
* and the deterministic fallback needs no model at all.
|
|
19
|
+
* - BOUNDED: analyzes at most `maxRuns` recent done swarms; caps emitted
|
|
20
|
+
* playbooks.
|
|
21
|
+
* - NEVER THROWS: degrades to the deterministic synthesis / a no-op persist.
|
|
22
|
+
*
|
|
23
|
+
* METADATA ONLY — never persists secret values or raw payloads.
|
|
24
|
+
*/
|
|
25
|
+
import type { AshlrConfig, GenomeEntry, SwarmRun } from '../types.js';
|
|
26
|
+
/** One distilled playbook before persistence. */
|
|
27
|
+
export interface DistilledPlaybook {
|
|
28
|
+
/** Coarse category / goal-cluster this playbook generalizes. */
|
|
29
|
+
category: string;
|
|
30
|
+
/** Short title used as the genome entry heading. */
|
|
31
|
+
title: string;
|
|
32
|
+
/** The playbook body (deterministic synthesis, optionally LLM-polished). */
|
|
33
|
+
text: string;
|
|
34
|
+
/** Tags attached to the persisted genome entry. */
|
|
35
|
+
tags: string[];
|
|
36
|
+
/** Number of successful swarms that informed this playbook. */
|
|
37
|
+
supportCount: number;
|
|
38
|
+
}
|
|
39
|
+
/** Result of a distill+persist pass. */
|
|
40
|
+
export interface PlaybookResult {
|
|
41
|
+
/** The distilled playbooks (whether or not persistence succeeded). */
|
|
42
|
+
playbooks: DistilledPlaybook[];
|
|
43
|
+
/** Genome entries actually appended (one per persisted playbook). Empty when
|
|
44
|
+
* persistence was not requested (the default report-only mode). */
|
|
45
|
+
persisted: GenomeEntry[];
|
|
46
|
+
/** True when the narrative text was produced by a LOCAL model (or no model). */
|
|
47
|
+
local: boolean;
|
|
48
|
+
/** Whether the genome hub was actually written (true only with persist:true). */
|
|
49
|
+
didPersist: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Distill recurring SUCCESSFUL patterns from `done` swarms into playbook
|
|
53
|
+
* candidates. Pure over the provided swarms; never throws.
|
|
54
|
+
*
|
|
55
|
+
* Filters to status==='done', clusters by coarse goal category, and for each
|
|
56
|
+
* cluster with >= MIN_SUPPORT support synthesizes a deterministic "what worked"
|
|
57
|
+
* body from the swarms' goals/results. Capped at MAX_PLAYBOOKS, sorted by
|
|
58
|
+
* supportCount desc.
|
|
59
|
+
*/
|
|
60
|
+
export declare function distillPlaybooks(swarms: SwarmRun[]): DistilledPlaybook[];
|
|
61
|
+
/**
|
|
62
|
+
* Distill playbooks from recent SUCCESSFUL swarms. Persisting them to the
|
|
63
|
+
* genome hub (appendHubEntry, hubOnly:true) — which auto-injects them into
|
|
64
|
+
* future agents — happens ONLY when `opts.persist` is true. By DEFAULT this is
|
|
65
|
+
* report-only: it distills and returns the playbooks but writes NOTHING, so a
|
|
66
|
+
* genome write that changes future-agent behaviour never happens without an
|
|
67
|
+
* explicit opt-in (the CLI's `--persist` flag).
|
|
68
|
+
*
|
|
69
|
+
* When `opts.narrative` is requested, each playbook body is optionally polished
|
|
70
|
+
* by a model via getActiveClient(cfg, { allowCloud: opts.allowCloud }) —
|
|
71
|
+
* LOCAL-ONLY unless allowCloud AND a key exist (getActiveClient throws
|
|
72
|
+
* otherwise; we then fall back to the deterministic body). The default path
|
|
73
|
+
* (no narrative) makes ZERO non-localhost connections.
|
|
74
|
+
*
|
|
75
|
+
* Never throws. MUST NOT call saveConfig() or write CONFIG_PATH / router policy.
|
|
76
|
+
*/
|
|
77
|
+
export declare function distillAndPersist(cfg: AshlrConfig, opts?: {
|
|
78
|
+
maxRuns?: number;
|
|
79
|
+
narrative?: boolean;
|
|
80
|
+
allowCloud?: boolean;
|
|
81
|
+
/** When true, persist distilled playbooks to the genome hub. Default false
|
|
82
|
+
* (report-only — no genome write, no future-agent behaviour change). */
|
|
83
|
+
persist?: boolean;
|
|
84
|
+
}): Promise<PlaybookResult>;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* playbooks.ts — M26 playbook distillation from SUCCESSFUL past swarms.
|
|
3
|
+
*
|
|
4
|
+
* Distills recurring patterns from `done` swarms into playbook entries and
|
|
5
|
+
* persists them via the genome (appendHubEntry, hubOnly) so they auto-inject
|
|
6
|
+
* into future agents. An OPTIONAL local-model narrative may polish the playbook
|
|
7
|
+
* text — but the default path is deterministic and makes ZERO cloud calls.
|
|
8
|
+
*
|
|
9
|
+
* HARD SAFETY INVARIANTS (M26):
|
|
10
|
+
* - READ-ONLY over history: reads listSwarms() only. The ONLY write is
|
|
11
|
+
* appendHubEntry({ hubOnly: true }) into ~/.ashlr/genome/hub.jsonl — an
|
|
12
|
+
* APPEND to the genome hub. With hubOnly:true it NEVER drops a file into a
|
|
13
|
+
* user repo working tree (see appendHubEntry's contract). It NEVER writes
|
|
14
|
+
* CONFIG_PATH / router policy / prompts.
|
|
15
|
+
* - LOCAL-FIRST: narrative text routes through getActiveClient(cfg,
|
|
16
|
+
* { allowCloud }) EXACTLY as M25 ask.ts — local Ollama/LM Studio only unless
|
|
17
|
+
* the caller passes allowCloud AND a key is present. Default path is local
|
|
18
|
+
* and the deterministic fallback needs no model at all.
|
|
19
|
+
* - BOUNDED: analyzes at most `maxRuns` recent done swarms; caps emitted
|
|
20
|
+
* playbooks.
|
|
21
|
+
* - NEVER THROWS: degrades to the deterministic synthesis / a no-op persist.
|
|
22
|
+
*
|
|
23
|
+
* METADATA ONLY — never persists secret values or raw payloads.
|
|
24
|
+
*/
|
|
25
|
+
import { listSwarms } from '../swarm/store.js';
|
|
26
|
+
import { appendHubEntry } from '../genome/store.js';
|
|
27
|
+
import { getActiveClient } from '../run/provider-client.js';
|
|
28
|
+
import { classifyGoal } from './reflect.js';
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// Bounds
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
/** Default cap on how many recent swarms to mine for patterns. */
|
|
33
|
+
const DEFAULT_MAX_RUNS = 100;
|
|
34
|
+
/** Max playbook entries distilled+persisted per invocation. */
|
|
35
|
+
const MAX_PLAYBOOKS = 5;
|
|
36
|
+
/** Minimum successful swarms in a category before it becomes a playbook. */
|
|
37
|
+
const MIN_SUPPORT = 2;
|
|
38
|
+
/** Hard cap on the narrative-synthesis prompt fed to the local model (chars). */
|
|
39
|
+
const SYNTHESIS_PROMPT_MAX_CHARS = 4000;
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// Pure distillation (exported for testing) — NO I/O, NO LLM
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
/** Collapse a result/goal string into a short, single-line excerpt. Pure. */
|
|
44
|
+
function excerpt(s, max = 140) {
|
|
45
|
+
if (!s)
|
|
46
|
+
return '';
|
|
47
|
+
return s.replace(/\s+/g, ' ').trim().slice(0, max);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Distill recurring SUCCESSFUL patterns from `done` swarms into playbook
|
|
51
|
+
* candidates. Pure over the provided swarms; never throws.
|
|
52
|
+
*
|
|
53
|
+
* Filters to status==='done', clusters by coarse goal category, and for each
|
|
54
|
+
* cluster with >= MIN_SUPPORT support synthesizes a deterministic "what worked"
|
|
55
|
+
* body from the swarms' goals/results. Capped at MAX_PLAYBOOKS, sorted by
|
|
56
|
+
* supportCount desc.
|
|
57
|
+
*/
|
|
58
|
+
export function distillPlaybooks(swarms) {
|
|
59
|
+
try {
|
|
60
|
+
if (!Array.isArray(swarms))
|
|
61
|
+
return [];
|
|
62
|
+
const done = swarms.filter((s) => s && s.status === 'done');
|
|
63
|
+
const byCat = new Map();
|
|
64
|
+
for (const s of done) {
|
|
65
|
+
const cat = classifyGoal(s.goal ?? '');
|
|
66
|
+
const arr = byCat.get(cat) ?? [];
|
|
67
|
+
arr.push(s);
|
|
68
|
+
byCat.set(cat, arr);
|
|
69
|
+
}
|
|
70
|
+
const playbooks = [];
|
|
71
|
+
for (const [category, group] of byCat) {
|
|
72
|
+
if (group.length < MIN_SUPPORT)
|
|
73
|
+
continue;
|
|
74
|
+
// Deterministic "what worked" body: a few representative goals + outcomes.
|
|
75
|
+
const samples = group.slice(0, 3).map((s) => {
|
|
76
|
+
const goal = excerpt(s.goal, 100) || '(no goal)';
|
|
77
|
+
const seq = phasePattern(s);
|
|
78
|
+
const phaseStr = seq ? ` [phases: ${seq}]` : '';
|
|
79
|
+
const result = excerpt(s.result, 100);
|
|
80
|
+
return `- ${goal}${phaseStr}${result ? ` -> ${result}` : ''}`;
|
|
81
|
+
});
|
|
82
|
+
// The most common phase pattern across the cluster (e.g. "plan -> build").
|
|
83
|
+
const dominant = dominantPhasePattern(group);
|
|
84
|
+
const text = `Playbook: ${category} work that succeeded\n\n` +
|
|
85
|
+
`Across ${group.length} successful '${category}' swarm(s), the following approaches ` +
|
|
86
|
+
`completed first-pass. ` +
|
|
87
|
+
(dominant
|
|
88
|
+
? `The recurring phase pattern was: ${dominant}. `
|
|
89
|
+
: `No consistent phase pattern was recorded. `) +
|
|
90
|
+
`Reuse the phase structure and framing below for similar goals:\n\n` +
|
|
91
|
+
samples.join('\n');
|
|
92
|
+
playbooks.push({
|
|
93
|
+
category,
|
|
94
|
+
title: `What works for ${category} swarms`,
|
|
95
|
+
text,
|
|
96
|
+
tags: ['m26', 'playbook', `cat:${category}`],
|
|
97
|
+
supportCount: group.length,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
playbooks.sort((a, b) => b.supportCount - a.supportCount ||
|
|
101
|
+
(a.category < b.category ? -1 : a.category > b.category ? 1 : 0));
|
|
102
|
+
return playbooks.slice(0, MAX_PLAYBOOKS);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Derive a swarm's de-duplicated phase sequence from its executed tasks,
|
|
110
|
+
* rendered as "plan -> build -> verify". Empty string when no phases. Pure.
|
|
111
|
+
*/
|
|
112
|
+
function phasePattern(s) {
|
|
113
|
+
const tasks = Array.isArray(s?.tasks) ? s.tasks : [];
|
|
114
|
+
const phases = [];
|
|
115
|
+
for (const t of tasks) {
|
|
116
|
+
const ph = t?.phase ? String(t.phase) : '';
|
|
117
|
+
if (ph && phases[phases.length - 1] !== ph)
|
|
118
|
+
phases.push(ph);
|
|
119
|
+
}
|
|
120
|
+
return phases.join(' -> ');
|
|
121
|
+
}
|
|
122
|
+
/** The most frequent phase pattern across a cluster of swarms. Pure. */
|
|
123
|
+
function dominantPhasePattern(group) {
|
|
124
|
+
const counts = new Map();
|
|
125
|
+
for (const s of group) {
|
|
126
|
+
const ptn = phasePattern(s);
|
|
127
|
+
if (!ptn)
|
|
128
|
+
continue;
|
|
129
|
+
counts.set(ptn, (counts.get(ptn) ?? 0) + 1);
|
|
130
|
+
}
|
|
131
|
+
let best = '';
|
|
132
|
+
let bestN = 0;
|
|
133
|
+
for (const [ptn, n] of counts) {
|
|
134
|
+
if (n > bestN || (n === bestN && (best === '' || ptn < best))) {
|
|
135
|
+
best = ptn;
|
|
136
|
+
bestN = n;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return best;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Build the OPTIONAL narrative-synthesis prompt for a playbook candidate.
|
|
143
|
+
* Pure; capped at SYNTHESIS_PROMPT_MAX_CHARS. Never throws.
|
|
144
|
+
*/
|
|
145
|
+
function buildNarrativePrompt(pb) {
|
|
146
|
+
const prompt = `You are distilling a reusable engineering playbook from past SUCCESSFUL runs. ` +
|
|
147
|
+
`Rewrite the notes below into a concise, actionable playbook (max ~120 words). ` +
|
|
148
|
+
`Do NOT invent facts; only generalize what is present.\n\n` +
|
|
149
|
+
`Category: ${pb.category}\nSupport: ${pb.supportCount} successful swarm(s)\n\n` +
|
|
150
|
+
`Notes:\n${pb.text}`;
|
|
151
|
+
return prompt.slice(0, SYNTHESIS_PROMPT_MAX_CHARS);
|
|
152
|
+
}
|
|
153
|
+
// ---------------------------------------------------------------------------
|
|
154
|
+
// Public: distill + persist
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
/**
|
|
157
|
+
* Distill playbooks from recent SUCCESSFUL swarms. Persisting them to the
|
|
158
|
+
* genome hub (appendHubEntry, hubOnly:true) — which auto-injects them into
|
|
159
|
+
* future agents — happens ONLY when `opts.persist` is true. By DEFAULT this is
|
|
160
|
+
* report-only: it distills and returns the playbooks but writes NOTHING, so a
|
|
161
|
+
* genome write that changes future-agent behaviour never happens without an
|
|
162
|
+
* explicit opt-in (the CLI's `--persist` flag).
|
|
163
|
+
*
|
|
164
|
+
* When `opts.narrative` is requested, each playbook body is optionally polished
|
|
165
|
+
* by a model via getActiveClient(cfg, { allowCloud: opts.allowCloud }) —
|
|
166
|
+
* LOCAL-ONLY unless allowCloud AND a key exist (getActiveClient throws
|
|
167
|
+
* otherwise; we then fall back to the deterministic body). The default path
|
|
168
|
+
* (no narrative) makes ZERO non-localhost connections.
|
|
169
|
+
*
|
|
170
|
+
* Never throws. MUST NOT call saveConfig() or write CONFIG_PATH / router policy.
|
|
171
|
+
*/
|
|
172
|
+
export async function distillAndPersist(cfg, opts = {}) {
|
|
173
|
+
// 1. Read recent swarms (READ-ONLY, BOUNDED).
|
|
174
|
+
let swarms = [];
|
|
175
|
+
try {
|
|
176
|
+
swarms = listSwarms().slice(0, Math.max(0, opts.maxRuns ?? DEFAULT_MAX_RUNS));
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
swarms = [];
|
|
180
|
+
}
|
|
181
|
+
// 2. Deterministic distillation.
|
|
182
|
+
const playbooks = distillPlaybooks(swarms);
|
|
183
|
+
// 3. OPTIONAL narrative polish — LOCAL-FIRST, mirrors M25 ask.ts.
|
|
184
|
+
// Default path (no narrative) never touches a model at all.
|
|
185
|
+
let local = true;
|
|
186
|
+
if (opts.narrative && playbooks.length > 0) {
|
|
187
|
+
try {
|
|
188
|
+
const client = await getActiveClient(cfg, { allowCloud: opts.allowCloud ?? false });
|
|
189
|
+
// ALLOWLIST (not denylist): only the known local providers count as local.
|
|
190
|
+
local = client.id === 'ollama' || client.id === 'lmstudio';
|
|
191
|
+
for (const pb of playbooks) {
|
|
192
|
+
try {
|
|
193
|
+
const res = await client.chat([
|
|
194
|
+
{
|
|
195
|
+
role: 'system',
|
|
196
|
+
content: 'You distill reusable engineering playbooks from successful past runs. ' +
|
|
197
|
+
'Be concise and never invent facts.',
|
|
198
|
+
},
|
|
199
|
+
{ role: 'user', content: buildNarrativePrompt(pb) },
|
|
200
|
+
]);
|
|
201
|
+
const polished = (res.content ?? '').trim();
|
|
202
|
+
if (polished)
|
|
203
|
+
pb.text = polished;
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
// Keep the deterministic body for this playbook on any model error.
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
// getActiveClient threw (no local provider, or cloud refused without key).
|
|
212
|
+
// Keep deterministic bodies; the local-first refusal is treated as a local
|
|
213
|
+
// attempt that simply didn't produce narrative.
|
|
214
|
+
local = true;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
// 4. Persist each via the genome hub (hubOnly:true => never writes a repo
|
|
218
|
+
// file) — ONLY when explicitly opted in via persist:true. By default this
|
|
219
|
+
// is report-only: NO genome write, so future-agent behaviour is unchanged
|
|
220
|
+
// until a human runs `reflect playbooks --persist`.
|
|
221
|
+
const persisted = [];
|
|
222
|
+
const didPersist = opts.persist === true;
|
|
223
|
+
if (didPersist) {
|
|
224
|
+
for (const pb of playbooks) {
|
|
225
|
+
try {
|
|
226
|
+
const entry = appendHubEntry({
|
|
227
|
+
text: pb.text,
|
|
228
|
+
title: pb.title,
|
|
229
|
+
tags: pb.tags,
|
|
230
|
+
hubOnly: true,
|
|
231
|
+
});
|
|
232
|
+
persisted.push(entry);
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
// Append failed — still return the distilled playbook to the caller.
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return { playbooks, persisted, local, didPersist };
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=playbooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playbooks.js","sourceRoot":"","sources":["../../../src/core/learn/playbooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,8EAA8E;AAC9E,SAAS;AACT,8EAA8E;AAE9E,kEAAkE;AAClE,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,+DAA+D;AAC/D,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,4EAA4E;AAC5E,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,iFAAiF;AACjF,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAiCxC,8EAA8E;AAC9E,4DAA4D;AAC5D,8EAA8E;AAE9E,6EAA6E;AAC7E,SAAS,OAAO,CAAC,CAAqB,EAAE,GAAG,GAAG,GAAG;IAC/C,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAClB,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAkB;IACjD,IAAI,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,OAAO,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CA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+1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reflect.ts — M26 deterministic reflection metrics engine.
|
|
3
|
+
*
|
|
4
|
+
* Scores the org's OWN past swarms/usage/genome and computes a ReflectionReport:
|
|
5
|
+
* success rate, avg cost & tokens per swarm, local-vs-cloud share, clustered
|
|
6
|
+
* top failure modes, slowest/most-expensive goal categories, and week-over-week
|
|
7
|
+
* deltas vs the prior persisted snapshot.
|
|
8
|
+
*
|
|
9
|
+
* HARD SAFETY INVARIANTS (M26):
|
|
10
|
+
* 1. READ-ONLY over history. Reads listSwarms() / genomeHubHealth /
|
|
11
|
+
* collectUsageEvents() ONLY — the HUB-ONLY genome reader (no portfolio
|
|
12
|
+
* disk scan). Writes nothing here (the CLI persists the snapshot via
|
|
13
|
+
* learn/store.ts under ~/.ashlr/learn/).
|
|
14
|
+
* 2. NO TUNING. This module never proposes or applies anything — pure metrics.
|
|
15
|
+
* 3. LOCAL-FIRST / NO LLM. buildReflection is DETERMINISTIC and makes ZERO
|
|
16
|
+
* network connections. No getActiveClient, no fetch. Narrative generation
|
|
17
|
+
* lives in playbooks.ts, never here.
|
|
18
|
+
* 4. BOUNDED. Reads at most `maxRuns` recent swarms (default DEFAULT_MAX_RUNS)
|
|
19
|
+
* and/or those within `sinceMs`. listSwarms() is itself capped at 200.
|
|
20
|
+
* 5. NEVER THROWS. Degrades to a zeroed report on any failure.
|
|
21
|
+
*
|
|
22
|
+
* METADATA ONLY — never reads/retains secret values or raw code/payloads.
|
|
23
|
+
*/
|
|
24
|
+
import type { AshlrConfig, FailureMode, GoalCategoryStat, ReflectionDelta, ReflectionOptions, ReflectionReport, SwarmRun } from '../types.js';
|
|
25
|
+
/** Default cap on how many recent swarms to analyze (bounds work). */
|
|
26
|
+
export declare const DEFAULT_MAX_RUNS = 100;
|
|
27
|
+
/**
|
|
28
|
+
* Default usage-window lookback (ms) applied when NO --since window is given.
|
|
29
|
+
* Bounds collectUsageEvents() so the default path never streams the entire
|
|
30
|
+
* historical transcript corpus — it matches the report's week-over-week
|
|
31
|
+
* framing. `--since all` (sinceMs explicitly 0) is the opt-in to scan all
|
|
32
|
+
* history (still bounded by the per-file caps in usage-source.ts).
|
|
33
|
+
*/
|
|
34
|
+
export declare const DEFAULT_USAGE_LOOKBACK_MS: number;
|
|
35
|
+
/** Coarse goal categories (keyword heuristic; deterministic). */
|
|
36
|
+
declare const GOAL_CATEGORIES: readonly ["feature", "bugfix", "refactor", "test", "docs", "chore", "other"];
|
|
37
|
+
/**
|
|
38
|
+
* Bucket a swarm goal string into one coarse GOAL_CATEGORIES label using a
|
|
39
|
+
* deterministic keyword heuristic. Pure; never throws.
|
|
40
|
+
*
|
|
41
|
+
* Order matters: the first matching category wins (most-specific verbs first).
|
|
42
|
+
*/
|
|
43
|
+
export declare function classifyGoal(goal: string): (typeof GOAL_CATEGORIES)[number];
|
|
44
|
+
/**
|
|
45
|
+
* Normalize a raw task.error string into a stable cluster key (lowercase,
|
|
46
|
+
* stripped of ids/paths/numbers/hashes) so similar errors cluster together.
|
|
47
|
+
* Pure; never throws.
|
|
48
|
+
*/
|
|
49
|
+
export declare function normalizeErrorKey(error: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Cluster failed tasks across swarms into the top FailureMode buckets, most
|
|
52
|
+
* frequent first, capped at MAX_FAILURE_MODES. Pure over the provided swarms;
|
|
53
|
+
* never throws.
|
|
54
|
+
*/
|
|
55
|
+
export declare function clusterFailures(swarms: SwarmRun[]): FailureMode[];
|
|
56
|
+
/**
|
|
57
|
+
* Aggregate per-goal-category cost/token/success stats over the swarms,
|
|
58
|
+
* most-expensive (avgCostUsd) first. Pure; never throws.
|
|
59
|
+
*/
|
|
60
|
+
export declare function summarizeGoalCategories(swarms: SwarmRun[]): GoalCategoryStat[];
|
|
61
|
+
/**
|
|
62
|
+
* Compute week-over-week deltas vs a prior snapshot. Pure; never throws.
|
|
63
|
+
* When `previous` is null, returns a no-prior delta (all numeric fields null).
|
|
64
|
+
*
|
|
65
|
+
* `currentWindow` (the window/scope label of the CURRENT report) is compared
|
|
66
|
+
* against `previous.window`. When they differ, the metrics were computed over
|
|
67
|
+
* DIFFERENT populations, so the headline is annotated '(windows differ)' to
|
|
68
|
+
* flag that the delta is apples-to-oranges. Omitting it (or passing the same
|
|
69
|
+
* label) leaves the headline unannotated.
|
|
70
|
+
*/
|
|
71
|
+
export declare function computeDelta(current: Pick<ReflectionReport, 'successRate' | 'avgCostUsd' | 'localShare'>, previous: ReflectionReport | null, currentWindow?: string | null): ReflectionDelta;
|
|
72
|
+
/**
|
|
73
|
+
* Build a ReflectionReport from the user's OWN local history.
|
|
74
|
+
*
|
|
75
|
+
* Reads (READ-ONLY):
|
|
76
|
+
* - listSwarms() — capped to the most-recent `maxRuns` and/or `sinceMs` window.
|
|
77
|
+
* - collectUsageEvents(sinceMs) — for the local-vs-cloud token share.
|
|
78
|
+
* - genomeHubHealth — HUB-ONLY entry counts (no portfolio disk scan).
|
|
79
|
+
*
|
|
80
|
+
* Computes: success rate, avg cost & tokens per swarm, local share, top failure
|
|
81
|
+
* modes, goal-category stats, and week-over-week deltas vs loadPreviousReport().
|
|
82
|
+
*
|
|
83
|
+
* DETERMINISTIC: makes ZERO network connections and uses NO LLM. Never throws —
|
|
84
|
+
* returns a zeroed report on any failure.
|
|
85
|
+
*/
|
|
86
|
+
export declare function buildReflection(_cfg: AshlrConfig, opts?: ReflectionOptions): ReflectionReport;
|
|
87
|
+
export {};
|