@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,415 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/plugins/registry.ts — M33 plugin discovery, load, and accessors.
|
|
3
|
+
*
|
|
4
|
+
* CONTRACT RULES (non-negotiable):
|
|
5
|
+
* - discoverPlugins NEVER imports plugin code. It only reads manifest.json.
|
|
6
|
+
* - loadEnabledPlugins gate chain (in order):
|
|
7
|
+
* 1. ASHLR_NO_PLUGINS=1 → return [] immediately.
|
|
8
|
+
* 2. killSwitchOn() → return [] + audit 'plugin:load' refused.
|
|
9
|
+
* 3. Only names in cfg.plugins?.enabled ?? [] (default empty → load NOTHING).
|
|
10
|
+
* 4. Manifest valid + apiVersion compatible (via readManifest).
|
|
11
|
+
* 5. verifyIntegrity passes.
|
|
12
|
+
* 6. await import(pathToFileURL(entry).href) in try/catch.
|
|
13
|
+
* 7. activate(host) raced against timeout.
|
|
14
|
+
* 8. Capability filter: drop contributions whose kind is not declared.
|
|
15
|
+
* - A failing plugin is skipped (audited), NEVER fatal.
|
|
16
|
+
* - Module-level memo cache: one load per process.
|
|
17
|
+
* - homedir() re-resolved at call time for test HOME relocation.
|
|
18
|
+
*
|
|
19
|
+
* ZERO RUNTIME DEPS: only Node builtins + local imports.
|
|
20
|
+
*/
|
|
21
|
+
import { readdirSync, statSync } from 'node:fs';
|
|
22
|
+
import { homedir } from 'node:os';
|
|
23
|
+
import { join, resolve as resolvePath } from 'node:path';
|
|
24
|
+
import { pathToFileURL } from 'node:url';
|
|
25
|
+
import { audit } from '../sandbox/audit.js';
|
|
26
|
+
import { killSwitchOn } from '../sandbox/policy.js';
|
|
27
|
+
import { readManifest } from './manifest.js';
|
|
28
|
+
import { verifyIntegrity } from './integrity.js';
|
|
29
|
+
import { buildHostApi } from './host-api.js';
|
|
30
|
+
import { wrapScanner, validateTemplate, wrapCommand } from './wrappers.js';
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Timeout control (exported for tests via _setActivateTimeoutForTest)
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
/** Default activate() timeout in milliseconds. */
|
|
35
|
+
const DEFAULT_ACTIVATE_TIMEOUT_MS = 5000;
|
|
36
|
+
/** Current activate timeout; overridable for tests. */
|
|
37
|
+
let _activateTimeoutMs = DEFAULT_ACTIVATE_TIMEOUT_MS;
|
|
38
|
+
/**
|
|
39
|
+
* Override the activate() timeout for tests. Pass undefined to reset to default.
|
|
40
|
+
* Named with underscore prefix per house test-seam convention.
|
|
41
|
+
*/
|
|
42
|
+
export function _setActivateTimeoutForTest(ms) {
|
|
43
|
+
_activateTimeoutMs = ms !== undefined ? ms : DEFAULT_ACTIVATE_TIMEOUT_MS;
|
|
44
|
+
}
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
// Module-level cache (one load per process)
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
/** Memoised result of loadEnabledPlugins, keyed on JSON-sorted enabled names. */
|
|
49
|
+
let _cache = null;
|
|
50
|
+
/**
|
|
51
|
+
* Reset the plugin cache. For tests only — allows re-loading after config changes.
|
|
52
|
+
* Named with underscore prefix per house test-seam convention.
|
|
53
|
+
*/
|
|
54
|
+
export function _resetPluginCacheForTest() {
|
|
55
|
+
_cache = null;
|
|
56
|
+
}
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// discoverPlugins — list ~/.ashlr/plugins/*/, read manifests
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
/**
|
|
61
|
+
* Discover all plugin directories under ~/.ashlr/plugins/.
|
|
62
|
+
* For each subdirectory, attempts to read and validate manifest.json.
|
|
63
|
+
*
|
|
64
|
+
* NEVER imports plugin code — manifest read only.
|
|
65
|
+
* NEVER throws.
|
|
66
|
+
*
|
|
67
|
+
* homedir() is resolved at call time so tests can relocate HOME.
|
|
68
|
+
*/
|
|
69
|
+
export function discoverPlugins() {
|
|
70
|
+
try {
|
|
71
|
+
const pluginsDir = join(homedir(), '.ashlr', 'plugins');
|
|
72
|
+
let entries;
|
|
73
|
+
try {
|
|
74
|
+
entries = readdirSync(pluginsDir);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Plugins dir absent — no plugins discovered.
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const results = [];
|
|
81
|
+
for (const entry of entries) {
|
|
82
|
+
const dir = join(pluginsDir, entry);
|
|
83
|
+
// Only descend into directories (skip files, symlinks, etc.).
|
|
84
|
+
try {
|
|
85
|
+
const st = statSync(dir);
|
|
86
|
+
if (!st.isDirectory())
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const result = readManifest(dir);
|
|
93
|
+
if (result.ok) {
|
|
94
|
+
results.push({ dir, manifest: result.manifest, ok: true });
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
results.push({ dir, ok: false, reason: result.reason });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return results;
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
// Internal: raceActivate — activate with timeout
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
/**
|
|
110
|
+
* Race plugin.activate(host) against a timeout.
|
|
111
|
+
* Returns contributions on success, or throws on timeout/error.
|
|
112
|
+
*/
|
|
113
|
+
function raceActivate(plugin, host) {
|
|
114
|
+
return new Promise((resolve, reject) => {
|
|
115
|
+
const timer = setTimeout(() => {
|
|
116
|
+
reject(new Error('plugin activate() timed out'));
|
|
117
|
+
}, _activateTimeoutMs);
|
|
118
|
+
Promise.resolve()
|
|
119
|
+
.then(() => plugin.activate(host))
|
|
120
|
+
.then((contributions) => {
|
|
121
|
+
clearTimeout(timer);
|
|
122
|
+
resolve(contributions);
|
|
123
|
+
})
|
|
124
|
+
.catch((err) => {
|
|
125
|
+
clearTimeout(timer);
|
|
126
|
+
reject(err instanceof Error ? err : new Error(String(err)));
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
// Internal: filterContributions — drop undeclared capability kinds
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
/**
|
|
134
|
+
* Drop contributions whose kind is not declared in manifest.capabilities.
|
|
135
|
+
* Audits a 'plugin:capability-violation' for each dropped kind.
|
|
136
|
+
*/
|
|
137
|
+
function filterContributions(name, manifest, raw) {
|
|
138
|
+
const caps = new Set(manifest.capabilities);
|
|
139
|
+
const filtered = {};
|
|
140
|
+
if (raw.scanners !== undefined) {
|
|
141
|
+
if (caps.has('scanner')) {
|
|
142
|
+
filtered.scanners = raw.scanners;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
audit({
|
|
146
|
+
action: 'plugin:capability-violation',
|
|
147
|
+
repo: null,
|
|
148
|
+
sandboxId: null,
|
|
149
|
+
summary: `plugin "${name}" contributed scanners but did not declare 'scanner' capability`,
|
|
150
|
+
result: 'refused',
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (raw.templates !== undefined) {
|
|
155
|
+
if (caps.has('template')) {
|
|
156
|
+
filtered.templates = raw.templates;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
audit({
|
|
160
|
+
action: 'plugin:capability-violation',
|
|
161
|
+
repo: null,
|
|
162
|
+
sandboxId: null,
|
|
163
|
+
summary: `plugin "${name}" contributed templates but did not declare 'template' capability`,
|
|
164
|
+
result: 'refused',
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (raw.providers !== undefined) {
|
|
169
|
+
if (caps.has('provider')) {
|
|
170
|
+
filtered.providers = raw.providers;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
audit({
|
|
174
|
+
action: 'plugin:capability-violation',
|
|
175
|
+
repo: null,
|
|
176
|
+
sandboxId: null,
|
|
177
|
+
summary: `plugin "${name}" contributed providers but did not declare 'provider' capability`,
|
|
178
|
+
result: 'refused',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (raw.commands !== undefined) {
|
|
183
|
+
if (caps.has('command')) {
|
|
184
|
+
filtered.commands = raw.commands;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
audit({
|
|
188
|
+
action: 'plugin:capability-violation',
|
|
189
|
+
repo: null,
|
|
190
|
+
sandboxId: null,
|
|
191
|
+
summary: `plugin "${name}" contributed commands but did not declare 'command' capability`,
|
|
192
|
+
result: 'refused',
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return filtered;
|
|
197
|
+
}
|
|
198
|
+
// ---------------------------------------------------------------------------
|
|
199
|
+
// loadEnabledPlugins — the main loader
|
|
200
|
+
// ---------------------------------------------------------------------------
|
|
201
|
+
/**
|
|
202
|
+
* Load all enabled plugins per cfg.plugins.enabled gate chain.
|
|
203
|
+
*
|
|
204
|
+
* Gate chain (each step audited):
|
|
205
|
+
* 1. ASHLR_NO_PLUGINS=1 → return [].
|
|
206
|
+
* 2. killSwitchOn() → return [] + audit refused.
|
|
207
|
+
* 3. cfg.plugins?.enabled ?? [] (default empty → load NOTHING).
|
|
208
|
+
* 4. Manifest valid + apiVersion compatible.
|
|
209
|
+
* 5. verifyIntegrity passes.
|
|
210
|
+
* 6. await import(pathToFileURL(entry).href).
|
|
211
|
+
* 7. activate(host) raced against timeout.
|
|
212
|
+
* 8. Capability filter.
|
|
213
|
+
*
|
|
214
|
+
* A failing plugin is skipped (audited), never fatal.
|
|
215
|
+
* Results are cached per process (keyed on sorted enabled names).
|
|
216
|
+
*/
|
|
217
|
+
export async function loadEnabledPlugins(cfg) {
|
|
218
|
+
// Gate 1: ASHLR_NO_PLUGINS
|
|
219
|
+
if (process.env.ASHLR_NO_PLUGINS === '1') {
|
|
220
|
+
return [];
|
|
221
|
+
}
|
|
222
|
+
// Gate 2: kill switch
|
|
223
|
+
if (killSwitchOn()) {
|
|
224
|
+
audit({
|
|
225
|
+
action: 'plugin:load',
|
|
226
|
+
repo: null,
|
|
227
|
+
sandboxId: null,
|
|
228
|
+
summary: 'plugin loading refused: kill switch is ON',
|
|
229
|
+
result: 'refused',
|
|
230
|
+
});
|
|
231
|
+
return [];
|
|
232
|
+
}
|
|
233
|
+
// Gate 3: enabled list (default empty = load nothing)
|
|
234
|
+
const enabled = cfg.plugins?.enabled ?? [];
|
|
235
|
+
if (enabled.length === 0) {
|
|
236
|
+
return [];
|
|
237
|
+
}
|
|
238
|
+
// Cache key: sorted enabled names (order-independent)
|
|
239
|
+
const cacheKey = JSON.stringify([...enabled].sort());
|
|
240
|
+
if (_cache !== null) {
|
|
241
|
+
const cached = _cache.get(cacheKey);
|
|
242
|
+
if (cached !== undefined) {
|
|
243
|
+
return cached;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
const pluginsDir = join(homedir(), '.ashlr', 'plugins');
|
|
247
|
+
const loaded = [];
|
|
248
|
+
for (const name of enabled) {
|
|
249
|
+
const dir = join(pluginsDir, name);
|
|
250
|
+
// Gate 4: read + validate manifest (also checks apiVersion range)
|
|
251
|
+
const manifestResult = readManifest(dir);
|
|
252
|
+
if (!manifestResult.ok) {
|
|
253
|
+
audit({
|
|
254
|
+
action: 'plugin:load',
|
|
255
|
+
repo: null,
|
|
256
|
+
sandboxId: null,
|
|
257
|
+
summary: `plugin "${name}" refused: invalid manifest — ${manifestResult.reason}`,
|
|
258
|
+
result: 'refused',
|
|
259
|
+
});
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
const manifest = manifestResult.manifest;
|
|
263
|
+
const entryPath = resolvePath(dir, manifest.entry);
|
|
264
|
+
// Gate 5: integrity verification
|
|
265
|
+
const integrityResult = verifyIntegrity(cfg, name, entryPath);
|
|
266
|
+
if (!integrityResult.ok) {
|
|
267
|
+
audit({
|
|
268
|
+
action: 'plugin:load',
|
|
269
|
+
repo: null,
|
|
270
|
+
sandboxId: null,
|
|
271
|
+
summary: `plugin "${name}" refused: integrity check failed — ${integrityResult.reason ?? 'unknown'}`,
|
|
272
|
+
result: 'refused',
|
|
273
|
+
});
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
// Gate 6: dynamic import
|
|
277
|
+
let pluginModule;
|
|
278
|
+
try {
|
|
279
|
+
pluginModule = await import(pathToFileURL(entryPath).href);
|
|
280
|
+
}
|
|
281
|
+
catch (err) {
|
|
282
|
+
audit({
|
|
283
|
+
action: 'plugin:load',
|
|
284
|
+
repo: null,
|
|
285
|
+
sandboxId: null,
|
|
286
|
+
summary: `plugin "${name}" error: import failed — ${err instanceof Error ? err.message : String(err)}`,
|
|
287
|
+
result: 'error',
|
|
288
|
+
});
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
// Resolve module default export or named 'plugin' export
|
|
292
|
+
let plugin;
|
|
293
|
+
if (pluginModule !== null && typeof pluginModule === 'object') {
|
|
294
|
+
const mod = pluginModule;
|
|
295
|
+
if ('default' in mod) {
|
|
296
|
+
plugin = mod['default'];
|
|
297
|
+
}
|
|
298
|
+
else if ('plugin' in mod) {
|
|
299
|
+
plugin = mod['plugin'];
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
plugin = pluginModule;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
plugin = pluginModule;
|
|
307
|
+
}
|
|
308
|
+
// Validate AshlrPlugin shape (must have activate function)
|
|
309
|
+
if (plugin === null ||
|
|
310
|
+
typeof plugin !== 'object' ||
|
|
311
|
+
typeof plugin['activate'] !== 'function') {
|
|
312
|
+
audit({
|
|
313
|
+
action: 'plugin:load',
|
|
314
|
+
repo: null,
|
|
315
|
+
sandboxId: null,
|
|
316
|
+
summary: `plugin "${name}" error: module does not export an AshlrPlugin (missing activate function)`,
|
|
317
|
+
result: 'error',
|
|
318
|
+
});
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
const ashlrPlugin = plugin;
|
|
322
|
+
// Gate 7: activate with timeout
|
|
323
|
+
const host = buildHostApi(manifest, cfg);
|
|
324
|
+
let contributions;
|
|
325
|
+
try {
|
|
326
|
+
contributions = await raceActivate(ashlrPlugin, host);
|
|
327
|
+
}
|
|
328
|
+
catch (err) {
|
|
329
|
+
audit({
|
|
330
|
+
action: 'plugin:load',
|
|
331
|
+
repo: null,
|
|
332
|
+
sandboxId: null,
|
|
333
|
+
summary: `plugin "${name}" error: activate() failed — ${err instanceof Error ? err.message : String(err)}`,
|
|
334
|
+
result: 'error',
|
|
335
|
+
});
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
// Gate 8: capability filter (drops undeclared kinds + audits violations)
|
|
339
|
+
const filtered = filterContributions(name, manifest, contributions);
|
|
340
|
+
audit({
|
|
341
|
+
action: 'plugin:load',
|
|
342
|
+
repo: null,
|
|
343
|
+
sandboxId: null,
|
|
344
|
+
summary: `plugin "${name}" loaded successfully`,
|
|
345
|
+
result: 'ok',
|
|
346
|
+
});
|
|
347
|
+
loaded.push({ name, manifest, contributions: filtered });
|
|
348
|
+
}
|
|
349
|
+
// Store in cache
|
|
350
|
+
if (_cache === null) {
|
|
351
|
+
_cache = new Map();
|
|
352
|
+
}
|
|
353
|
+
_cache.set(cacheKey, loaded);
|
|
354
|
+
return loaded;
|
|
355
|
+
}
|
|
356
|
+
// ---------------------------------------------------------------------------
|
|
357
|
+
// Accessors — async helpers over loadEnabledPlugins
|
|
358
|
+
// ---------------------------------------------------------------------------
|
|
359
|
+
/**
|
|
360
|
+
* Get all plugin scanners, wrapped for safety (timeout, cap, scrub, namespace).
|
|
361
|
+
* Returns wrapped functions (repo: string) => Promise<WorkItem[]>.
|
|
362
|
+
*/
|
|
363
|
+
export async function getPluginScanners(cfg) {
|
|
364
|
+
const plugins = await loadEnabledPlugins(cfg);
|
|
365
|
+
const wrapped = [];
|
|
366
|
+
for (const p of plugins) {
|
|
367
|
+
for (const scanner of (p.contributions.scanners ?? [])) {
|
|
368
|
+
wrapped.push(wrapScanner(p.name, scanner));
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return wrapped;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Get all plugin templates, validated (id-prefixed, path-checked).
|
|
375
|
+
*/
|
|
376
|
+
export async function getPluginTemplates(cfg) {
|
|
377
|
+
const plugins = await loadEnabledPlugins(cfg);
|
|
378
|
+
const templates = [];
|
|
379
|
+
for (const p of plugins) {
|
|
380
|
+
for (const t of p.contributions.templates ?? []) {
|
|
381
|
+
const validated = validateTemplate(p.name, t);
|
|
382
|
+
if (validated !== null) {
|
|
383
|
+
templates.push(validated);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return templates;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Get all plugin providers (raw, as contributed after capability filtering).
|
|
391
|
+
*/
|
|
392
|
+
export async function getPluginProviders(cfg) {
|
|
393
|
+
const plugins = await loadEnabledPlugins(cfg);
|
|
394
|
+
const providers = [];
|
|
395
|
+
for (const p of plugins) {
|
|
396
|
+
for (const provider of p.contributions.providers ?? []) {
|
|
397
|
+
providers.push(provider);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return providers;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Get all plugin commands, wrapped for safety (audit, exit-code catch).
|
|
404
|
+
*/
|
|
405
|
+
export async function getPluginCommands(cfg) {
|
|
406
|
+
const plugins = await loadEnabledPlugins(cfg);
|
|
407
|
+
const commands = [];
|
|
408
|
+
for (const p of plugins) {
|
|
409
|
+
for (const cmd of p.contributions.commands ?? []) {
|
|
410
|
+
commands.push(wrapCommand(p.name, cmd));
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return commands;
|
|
414
|
+
}
|
|
415
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/core/plugins/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe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IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;gBACvB,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,GAAgB;IACvD,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAyB,EAAE,CAAC;IAC3C,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,KAAK,MAAM,QAAQ,IAAI,CAAC,CAAC,aAAa,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;YACvD,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,GAAgB;IACtD,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAwB,EAAE,CAAC;IACzC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,aAAa,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;YACjD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/plugins/types.ts — M33 plugin-system public types.
|
|
3
|
+
*
|
|
4
|
+
* CONTRACT RULES (non-negotiable):
|
|
5
|
+
* - PLUGIN_API_VERSION is the host's current API version. Plugins declare a
|
|
6
|
+
* semver RANGE in manifest.apiVersion; loadEnabledPlugins verifies
|
|
7
|
+
* compatibility before import.
|
|
8
|
+
* - PluginHost carries ONLY a deep-frozen copy of the plugin's own settings
|
|
9
|
+
* and an allowlisted VIEW of config — never the full AshlrConfig.
|
|
10
|
+
* - PluginContributions may include scanners, templates, providers, commands.
|
|
11
|
+
* Contributions whose kind is not declared in manifest.capabilities are
|
|
12
|
+
* DROPPED by the registry gate (capability-violation audit).
|
|
13
|
+
* - definePlugin is an identity helper so plugin authors get full type-checking
|
|
14
|
+
* on their module default export without an explicit cast.
|
|
15
|
+
* - Never throws from any type-level helper; all guards are pure.
|
|
16
|
+
*/
|
|
17
|
+
import type { WorkItem, ProjectTemplate } from '../types.js';
|
|
18
|
+
/**
|
|
19
|
+
* The API version this host implements. Plugins declare a semver RANGE in
|
|
20
|
+
* manifest.apiVersion; only compatible ranges are loaded.
|
|
21
|
+
* Bumped when the PluginHost shape or contribution contracts change.
|
|
22
|
+
*/
|
|
23
|
+
export declare const PLUGIN_API_VERSION = "1.0.0";
|
|
24
|
+
/**
|
|
25
|
+
* The set of capability kinds a plugin may declare. A plugin may only
|
|
26
|
+
* contribute items whose kind appears in manifest.capabilities — undeclared
|
|
27
|
+
* contributions are DROPPED and audited as 'plugin:capability-violation'.
|
|
28
|
+
*/
|
|
29
|
+
export type PluginCapability = 'scanner' | 'template' | 'provider' | 'command';
|
|
30
|
+
/**
|
|
31
|
+
* Parsed, validated shape of a plugin's manifest.json.
|
|
32
|
+
*
|
|
33
|
+
* VALIDATION RULES (enforced by readManifest — never assumed by callers):
|
|
34
|
+
* - name: ^[a-z][a-z0-9-]{0,39}$ AND must equal basename(dir).
|
|
35
|
+
* - version: plugin's own semver (informational; not range-evaluated).
|
|
36
|
+
* - apiVersion: semver RANGE evaluated against PLUGIN_API_VERSION.
|
|
37
|
+
* Supported forms: exact "1.0.0", caret "^1.0.0", tilde "~1.0.0", wildcard "1.x".
|
|
38
|
+
* - entry: relative path ("./index.js"); must resolve INSIDE the plugin dir
|
|
39
|
+
* (path-string containment check; entry file may not exist at discovery time).
|
|
40
|
+
* - capabilities: non-empty array of PluginCapability.
|
|
41
|
+
* - No __proto__ / constructor / prototype keys anywhere in the object.
|
|
42
|
+
*/
|
|
43
|
+
export interface PluginManifest {
|
|
44
|
+
/** Plugin name — must match ^[a-z][a-z0-9-]{0,39}$ and equal basename(dir). */
|
|
45
|
+
name: string;
|
|
46
|
+
/** The plugin's own semver (e.g. "0.1.0"). */
|
|
47
|
+
version: string;
|
|
48
|
+
/**
|
|
49
|
+
* Semver RANGE the plugin requires of the host API.
|
|
50
|
+
* Forms: exact "1.0.0", caret "^1.0.0", tilde "~1.0.0", wildcard "1.x" / "1.0.x".
|
|
51
|
+
*/
|
|
52
|
+
apiVersion: string;
|
|
53
|
+
/** Short human-readable description. */
|
|
54
|
+
description?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Relative ESM entry path from the plugin dir (e.g. "./index.js").
|
|
57
|
+
* Must resolve INSIDE the plugin dir — no ".." segments, no absolute paths.
|
|
58
|
+
*/
|
|
59
|
+
entry: string;
|
|
60
|
+
/** What this plugin contributes. Only declared kinds may appear in contributions. */
|
|
61
|
+
capabilities: PluginCapability[];
|
|
62
|
+
/** Optional link to plugin docs or homepage. */
|
|
63
|
+
homepage?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The host API handed to a plugin's activate() function.
|
|
67
|
+
* Every property is read-only and frozen; the plugin cannot mutate host state.
|
|
68
|
+
*
|
|
69
|
+
* SAFETY:
|
|
70
|
+
* - `settings` is a deep-frozen structuredClone of cfg.plugins.settings[name] only.
|
|
71
|
+
* The plugin NEVER receives the full AshlrConfig.
|
|
72
|
+
* - `view` is a frozen, allowlisted projection — never the raw config.
|
|
73
|
+
* - `audit()` prefixes every action with "plugin:<name>:" automatically.
|
|
74
|
+
* - `log()` writes to stderr, prefixed "[plugin:<name>]".
|
|
75
|
+
* - `dataDir` is ~/.ashlr/plugin-data/<name>/; created eagerly on buildHostApi.
|
|
76
|
+
*/
|
|
77
|
+
export interface PluginHost {
|
|
78
|
+
/** The host's current API version (PLUGIN_API_VERSION). */
|
|
79
|
+
readonly apiVersion: string;
|
|
80
|
+
/** The name of this plugin (from its manifest). */
|
|
81
|
+
readonly pluginName: string;
|
|
82
|
+
/**
|
|
83
|
+
* Write a log line to stderr. Output is prefixed "[plugin:<name>]".
|
|
84
|
+
* Never throws.
|
|
85
|
+
*/
|
|
86
|
+
log(msg: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Emit an audit record. The action is automatically namespaced as
|
|
89
|
+
* "plugin:<name>:<action>" so plugin audit traffic is identifiable.
|
|
90
|
+
* Delegates to core/sandbox/audit.ts audit(); never throws.
|
|
91
|
+
*/
|
|
92
|
+
audit(action: string, summary: string): void;
|
|
93
|
+
/**
|
|
94
|
+
* Deep-frozen copy of cfg.plugins.settings[<name>] — the plugin's own
|
|
95
|
+
* key/value settings ONLY. Never the full AshlrConfig.
|
|
96
|
+
*/
|
|
97
|
+
readonly settings: Readonly<Record<string, unknown>>;
|
|
98
|
+
/**
|
|
99
|
+
* Frozen, allowlisted projection of the host config. Contains only
|
|
100
|
+
* non-sensitive fields that plugins legitimately need.
|
|
101
|
+
* Never the raw AshlrConfig.
|
|
102
|
+
*/
|
|
103
|
+
readonly view: Readonly<{
|
|
104
|
+
editor: string;
|
|
105
|
+
staleDays: number;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* Absolute path to ~/.ashlr/plugin-data/<name>/.
|
|
109
|
+
* Created eagerly by buildHostApi; the plugin may read/write here freely.
|
|
110
|
+
*/
|
|
111
|
+
readonly dataDir: string;
|
|
112
|
+
}
|
|
113
|
+
/** A scanner contributed by a plugin. */
|
|
114
|
+
export interface PluginScanner {
|
|
115
|
+
/** Stable scanner id (e.g. "my-linter"). Namespaced on load: plugin:<name>:<id>. */
|
|
116
|
+
id: string;
|
|
117
|
+
/**
|
|
118
|
+
* Scan a repo and return discovered WorkItems. Must not throw — errors should
|
|
119
|
+
* be caught internally and return []. Called with a 15-second AbortSignal.
|
|
120
|
+
*/
|
|
121
|
+
scan(repo: string, ctx: {
|
|
122
|
+
signal: AbortSignal;
|
|
123
|
+
}): Promise<WorkItem[]>;
|
|
124
|
+
}
|
|
125
|
+
/** A provider spec contributed by a plugin. */
|
|
126
|
+
export interface PluginProviderSpec {
|
|
127
|
+
/** Stable provider id. */
|
|
128
|
+
id: string;
|
|
129
|
+
/** Whether this provider runs locally or in the cloud. */
|
|
130
|
+
tier: 'local' | 'cloud';
|
|
131
|
+
/** Environment variable names this provider requires. */
|
|
132
|
+
envKeys?: string[];
|
|
133
|
+
/** Probe availability. Should resolve quickly; never throw. */
|
|
134
|
+
probe(): Promise<unknown>;
|
|
135
|
+
/** Create a client instance. */
|
|
136
|
+
createClient(opts: {
|
|
137
|
+
model?: string;
|
|
138
|
+
}): Promise<unknown>;
|
|
139
|
+
}
|
|
140
|
+
/** A CLI command contributed by a plugin. */
|
|
141
|
+
export interface PluginCommandSpec {
|
|
142
|
+
/** The sub-command name (e.g. "lint"). Invoked as `ashlr plugin <name> <cmd>`. */
|
|
143
|
+
name: string;
|
|
144
|
+
/** Short description shown in help. */
|
|
145
|
+
description: string;
|
|
146
|
+
/**
|
|
147
|
+
* Run the command. Return exit code (0 = success). Must not throw — the
|
|
148
|
+
* wrapper catches throws and returns exit code 1.
|
|
149
|
+
*/
|
|
150
|
+
run(args: string[], host: PluginHost): Promise<number>;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* What a plugin contributes to the host after activate() resolves.
|
|
154
|
+
* Contributions whose kind is not declared in manifest.capabilities are
|
|
155
|
+
* silently DROPPED and audited by the registry gate.
|
|
156
|
+
*/
|
|
157
|
+
export interface PluginContributions {
|
|
158
|
+
scanners?: PluginScanner[];
|
|
159
|
+
templates?: ProjectTemplate[];
|
|
160
|
+
providers?: PluginProviderSpec[];
|
|
161
|
+
commands?: PluginCommandSpec[];
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The interface a plugin module must satisfy. The module's default export (or
|
|
165
|
+
* named `plugin` export) must implement this.
|
|
166
|
+
*
|
|
167
|
+
* `activate(host)` is called once per process, raced against a 5-second
|
|
168
|
+
* timeout. May be sync or async. Must not throw — failures are isolated by the
|
|
169
|
+
* registry loader.
|
|
170
|
+
*/
|
|
171
|
+
export interface AshlrPlugin {
|
|
172
|
+
activate(host: PluginHost): PluginContributions | Promise<PluginContributions>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Identity helper for plugin authors. Wrap your plugin object to get full
|
|
176
|
+
* TypeScript checking without an explicit cast:
|
|
177
|
+
*
|
|
178
|
+
* export default definePlugin({ activate(host) { ... } });
|
|
179
|
+
*
|
|
180
|
+
* At runtime this is a pure identity function — zero overhead.
|
|
181
|
+
*/
|
|
182
|
+
export declare function definePlugin(p: AshlrPlugin): AshlrPlugin;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/plugins/types.ts — M33 plugin-system public types.
|
|
3
|
+
*
|
|
4
|
+
* CONTRACT RULES (non-negotiable):
|
|
5
|
+
* - PLUGIN_API_VERSION is the host's current API version. Plugins declare a
|
|
6
|
+
* semver RANGE in manifest.apiVersion; loadEnabledPlugins verifies
|
|
7
|
+
* compatibility before import.
|
|
8
|
+
* - PluginHost carries ONLY a deep-frozen copy of the plugin's own settings
|
|
9
|
+
* and an allowlisted VIEW of config — never the full AshlrConfig.
|
|
10
|
+
* - PluginContributions may include scanners, templates, providers, commands.
|
|
11
|
+
* Contributions whose kind is not declared in manifest.capabilities are
|
|
12
|
+
* DROPPED by the registry gate (capability-violation audit).
|
|
13
|
+
* - definePlugin is an identity helper so plugin authors get full type-checking
|
|
14
|
+
* on their module default export without an explicit cast.
|
|
15
|
+
* - Never throws from any type-level helper; all guards are pure.
|
|
16
|
+
*/
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Host API version
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
/**
|
|
21
|
+
* The API version this host implements. Plugins declare a semver RANGE in
|
|
22
|
+
* manifest.apiVersion; only compatible ranges are loaded.
|
|
23
|
+
* Bumped when the PluginHost shape or contribution contracts change.
|
|
24
|
+
*/
|
|
25
|
+
export const PLUGIN_API_VERSION = '1.0.0';
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
// definePlugin — identity helper
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
/**
|
|
30
|
+
* Identity helper for plugin authors. Wrap your plugin object to get full
|
|
31
|
+
* TypeScript checking without an explicit cast:
|
|
32
|
+
*
|
|
33
|
+
* export default definePlugin({ activate(host) { ... } });
|
|
34
|
+
*
|
|
35
|
+
* At runtime this is a pure identity function — zero overhead.
|
|
36
|
+
*/
|
|
37
|
+
export function definePlugin(p) {
|
|
38
|
+
return p;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/plugins/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAiL1C,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,CAAc;IACzC,OAAO,CAAC,CAAC;AACX,CAAC"}
|