@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,385 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/mcp-gateway.ts — MCP aggregation gateway + per-server probe.
|
|
3
|
+
*
|
|
4
|
+
* Two responsibilities:
|
|
5
|
+
*
|
|
6
|
+
* 1. probeServer(spec, timeoutMs): start ONE downstream MCP server as a child,
|
|
7
|
+
* list its tools, tear it down, and return an McpServerHealth. NEVER throws —
|
|
8
|
+
* startup failures, timeouts, and crashes surface in the returned health
|
|
9
|
+
* object (ok:false + error). Used by `ashlr mcp doctor` and gateway startup.
|
|
10
|
+
*
|
|
11
|
+
* 2. startGateway(registry): run a stdio MCP server (this process) that starts
|
|
12
|
+
* every discovered downstream as a child, namespaces their tools as
|
|
13
|
+
* `<server>__<tool>`, and proxies tools/list + tools/call to the correct
|
|
14
|
+
* downstream. ROBUST: per-downstream startup timeout; a downstream that
|
|
15
|
+
* fails to start is skipped with a stderr warning and never crashes the
|
|
16
|
+
* gateway. Point ANY agent at `ashlr mcp` to get every discovered tool.
|
|
17
|
+
*
|
|
18
|
+
* This module is the ONLY place (besides mcp-registry) allowed to depend on
|
|
19
|
+
* @modelcontextprotocol/sdk.
|
|
20
|
+
*/
|
|
21
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
22
|
+
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
23
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
24
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
25
|
+
import { ListToolsRequestSchema, CallToolRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
26
|
+
import { loadConfig } from './config.js';
|
|
27
|
+
import { withToolEnv } from './env-bridge.js';
|
|
28
|
+
import { withHeal, defaultHealPolicy } from './run/self-heal.js';
|
|
29
|
+
import { listNativeTools, isNativeTool, callNativeTool } from './mcp-native.js';
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Constants
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
/** Default per-downstream startup/list timeout. */
|
|
34
|
+
const DEFAULT_TIMEOUT_MS = 8_000;
|
|
35
|
+
/** Namespacing separator: gateway tool name = `<server>__<tool>`. */
|
|
36
|
+
const NS = '__';
|
|
37
|
+
/**
|
|
38
|
+
* Env var set on every downstream child the gateway spawns. A downstream that
|
|
39
|
+
* is itself an ashlr gateway can read this to refuse re-aggregation, providing
|
|
40
|
+
* a second line of defense against the self-spawn fork bomb (the primary
|
|
41
|
+
* defense is isSelfGateway() filtering at startGateway).
|
|
42
|
+
*/
|
|
43
|
+
export const GATEWAY_ENV_MARKER = 'ASHLR_MCP_GATEWAY';
|
|
44
|
+
// The MCP SDK deliberately spawns downstream servers with a NARROW env allowlist
|
|
45
|
+
// (not the full process.env) so ambient secrets don't leak into third-party servers.
|
|
46
|
+
// We preserve that isolation: downstreams get this safe base + ashlr's non-secret
|
|
47
|
+
// config keys (via withToolEnv) + their own declared spec.env — never the hub's full env.
|
|
48
|
+
const SAFE_CHILD_ENV_KEYS = ['HOME', 'PATH', 'SHELL', 'TERM', 'USER', 'LOGNAME'];
|
|
49
|
+
function safeChildBase() {
|
|
50
|
+
const base = {};
|
|
51
|
+
for (const k of SAFE_CHILD_ENV_KEYS) {
|
|
52
|
+
if (process.env[k] !== undefined)
|
|
53
|
+
base[k] = process.env[k];
|
|
54
|
+
}
|
|
55
|
+
return base;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* True when a spec resolves to THIS aggregation gateway — i.e. running it as a
|
|
59
|
+
* downstream would recurse (`ashlr mcp install` writes exactly such an entry:
|
|
60
|
+
* name "ashlr", command <bin>/ashlr, args ['mcp']). We detect it structurally
|
|
61
|
+
* (no path resolution needed): the canonical installed entry is `args`
|
|
62
|
+
* containing 'mcp' AND the command basename being `ashlr`, OR the conventional
|
|
63
|
+
* name 'ashlr' paired with an 'mcp' arg. Skipping these prevents an unbounded
|
|
64
|
+
* fan-out of nested gateways.
|
|
65
|
+
*/
|
|
66
|
+
export function isSelfGateway(spec) {
|
|
67
|
+
const hasMcpArg = spec.args.includes('mcp');
|
|
68
|
+
if (!hasMcpArg)
|
|
69
|
+
return false;
|
|
70
|
+
// basename of the command (handles absolute paths like /…/bin/ashlr)
|
|
71
|
+
const base = spec.command.split('/').pop() ?? spec.command;
|
|
72
|
+
return base === 'ashlr' || spec.name === 'ashlr';
|
|
73
|
+
}
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
// Helpers
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
/** Reject after `ms` with a timeout error. */
|
|
78
|
+
function timeout(ms, label) {
|
|
79
|
+
return new Promise((_resolve, reject) => {
|
|
80
|
+
const t = setTimeout(() => reject(new Error(`${label} timed out after ${ms}ms`)), ms);
|
|
81
|
+
// Don't keep the event loop alive solely for this timer.
|
|
82
|
+
if (typeof t.unref === 'function')
|
|
83
|
+
t.unref();
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Build a connected SDK Client for one downstream spec, racing the connect
|
|
88
|
+
* against a timeout. The caller owns closing the returned client.
|
|
89
|
+
* Throws on failure (caller wraps).
|
|
90
|
+
*/
|
|
91
|
+
async function connectDownstream(spec, timeoutMs, cfg) {
|
|
92
|
+
const transport = new StdioClientTransport({
|
|
93
|
+
command: spec.command,
|
|
94
|
+
args: spec.args,
|
|
95
|
+
// Merge spec env with a self-marker so any downstream that happens to be an
|
|
96
|
+
// ashlr gateway can detect it was launched BY a gateway and refuse to
|
|
97
|
+
// re-aggregate (belt-and-suspenders against the self-spawn fork bomb).
|
|
98
|
+
// M10 env-bridge: project unified config into each downstream child, then
|
|
99
|
+
// let spec.env override (per-server keys win over hub-wide defaults).
|
|
100
|
+
// The gateway marker is set last so it can never be clobbered by spec.env.
|
|
101
|
+
env: {
|
|
102
|
+
...(cfg ? withToolEnv(cfg, safeChildBase()) : safeChildBase()),
|
|
103
|
+
...(spec.env ?? {}),
|
|
104
|
+
[GATEWAY_ENV_MARKER]: '1',
|
|
105
|
+
},
|
|
106
|
+
// Surface child stderr to our stderr for debugging; never pollutes stdio JSON-RPC.
|
|
107
|
+
stderr: 'inherit',
|
|
108
|
+
});
|
|
109
|
+
const client = new Client({ name: 'ashlr-gateway', version: '0.1.0' }, { capabilities: {} });
|
|
110
|
+
try {
|
|
111
|
+
// Capture the connect promise and pre-attach a no-op catch so that when the
|
|
112
|
+
// timeout branch wins the race, the still-pending connect's eventual
|
|
113
|
+
// rejection has a handler — otherwise it surfaces as an unhandledRejection
|
|
114
|
+
// (noisy on Node 22, fatal under --unhandled-rejections=throw).
|
|
115
|
+
const connectPromise = client.connect(transport);
|
|
116
|
+
connectPromise.catch(() => { });
|
|
117
|
+
await Promise.race([
|
|
118
|
+
connectPromise,
|
|
119
|
+
timeout(timeoutMs, `connect(${spec.name})`),
|
|
120
|
+
]);
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
// Ensure the child is reaped on a failed/timed-out connect.
|
|
124
|
+
try {
|
|
125
|
+
await client.close();
|
|
126
|
+
}
|
|
127
|
+
catch { /* ignore */ }
|
|
128
|
+
try {
|
|
129
|
+
await transport.close();
|
|
130
|
+
}
|
|
131
|
+
catch { /* ignore */ }
|
|
132
|
+
throw err;
|
|
133
|
+
}
|
|
134
|
+
return client;
|
|
135
|
+
}
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
// probeServer
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
/**
|
|
140
|
+
* Start a single downstream MCP server, list its tools, and tear it down.
|
|
141
|
+
* NEVER throws — all failures (ENOENT, crash, timeout) are reported via the
|
|
142
|
+
* returned McpServerHealth (ok:false, toolCount:0, tools:[], error:<msg>).
|
|
143
|
+
*
|
|
144
|
+
* @param spec The downstream server spec to probe.
|
|
145
|
+
* @param timeoutMs Per-probe startup/list timeout (default 8s).
|
|
146
|
+
*/
|
|
147
|
+
export async function probeServer(spec, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
148
|
+
// M10: load config once so probeServer also bridges env into probed children.
|
|
149
|
+
// loadConfig() is lightweight (fs read + merge); safe to call per-probe.
|
|
150
|
+
let cfgForProbe;
|
|
151
|
+
try {
|
|
152
|
+
cfgForProbe = loadConfig();
|
|
153
|
+
}
|
|
154
|
+
catch { /* non-fatal: fall back to process.env */ }
|
|
155
|
+
let client = null;
|
|
156
|
+
try {
|
|
157
|
+
client = await connectDownstream(spec, timeoutMs, cfgForProbe);
|
|
158
|
+
const listed = await Promise.race([
|
|
159
|
+
client.listTools({}, { timeout: timeoutMs }),
|
|
160
|
+
timeout(timeoutMs, `tools/list(${spec.name})`),
|
|
161
|
+
]);
|
|
162
|
+
const tools = (listed.tools ?? []).map((t) => t.name);
|
|
163
|
+
return {
|
|
164
|
+
name: spec.name,
|
|
165
|
+
ok: true,
|
|
166
|
+
toolCount: tools.length,
|
|
167
|
+
tools,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
172
|
+
return {
|
|
173
|
+
name: spec.name,
|
|
174
|
+
ok: false,
|
|
175
|
+
toolCount: 0,
|
|
176
|
+
tools: [],
|
|
177
|
+
error: msg,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
if (client) {
|
|
182
|
+
try {
|
|
183
|
+
await client.close();
|
|
184
|
+
}
|
|
185
|
+
catch { /* ignore */ }
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Run the aggregation gateway on stdio.
|
|
191
|
+
*
|
|
192
|
+
* Starts every server in `registry` as a child (skipping any that fail to start
|
|
193
|
+
* within the timeout, with a stderr warning), exposes their tools namespaced as
|
|
194
|
+
* `<server>__<tool>`, and proxies tools/list + tools/call to the owning
|
|
195
|
+
* downstream. Resolves only when the gateway transport closes (stdin EOF).
|
|
196
|
+
*
|
|
197
|
+
* @param registry The discovered MCP servers to aggregate.
|
|
198
|
+
* @param timeoutMs Per-downstream startup timeout (default 8s).
|
|
199
|
+
*/
|
|
200
|
+
export async function startGateway(registry, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
201
|
+
// M10: load config once for the gateway lifetime so all downstream spawns
|
|
202
|
+
// inherit the unified config env. Non-fatal if config is unreadable.
|
|
203
|
+
let gatewayCfg;
|
|
204
|
+
try {
|
|
205
|
+
gatewayCfg = loadConfig();
|
|
206
|
+
}
|
|
207
|
+
catch { /* non-fatal: fall back to process.env */ }
|
|
208
|
+
// ── Self-exclusion: never aggregate ourself (fork-bomb guard) ─────────────
|
|
209
|
+
// `ashlr mcp install` writes a downstream entry pointing back at this gateway.
|
|
210
|
+
// Discovering and spawning it would recurse without bound. Filter it out here
|
|
211
|
+
// (primary defense); the ASHLR_MCP_GATEWAY env marker on spawned children is
|
|
212
|
+
// the secondary defense for any path that bypasses this.
|
|
213
|
+
const aggregable = registry.servers.filter((spec) => {
|
|
214
|
+
if (isSelfGateway(spec)) {
|
|
215
|
+
process.stderr.write(`[ashlr mcp] skipping self "${spec.name}" (${spec.command} ${spec.args.join(' ')}) — would recurse\n`);
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
return true;
|
|
219
|
+
});
|
|
220
|
+
// ── Connect every downstream in parallel; skip failures ───────────────────
|
|
221
|
+
const settled = await Promise.allSettled(aggregable.map(async (spec) => {
|
|
222
|
+
// M20: bounded self-heal — restart a crashed downstream up to maxRestarts
|
|
223
|
+
// times before falling through to the existing skip-on-failure path.
|
|
224
|
+
// Opt-out: ASHLR_NO_HEAL env var disables the heal wrapper.
|
|
225
|
+
const noHeal = process.env['ASHLR_NO_HEAL'] === '1';
|
|
226
|
+
let client;
|
|
227
|
+
if (noHeal) {
|
|
228
|
+
client = await connectDownstream(spec, timeoutMs, gatewayCfg);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
const healPolicy = defaultHealPolicy();
|
|
232
|
+
client = await withHeal((_attempt) => connectDownstream(spec, timeoutMs, gatewayCfg), healPolicy, (event) => {
|
|
233
|
+
process.stderr.write(`[ashlr mcp] heal(${event.kind}) "${spec.name}" attempt ${event.attempt}: ${event.detail}\n`);
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
let toolNames = new Set();
|
|
237
|
+
try {
|
|
238
|
+
const listed = await Promise.race([
|
|
239
|
+
client.listTools({}, { timeout: timeoutMs }),
|
|
240
|
+
timeout(timeoutMs, `tools/list(${spec.name})`),
|
|
241
|
+
]);
|
|
242
|
+
toolNames = new Set((listed.tools ?? []).map((t) => t.name));
|
|
243
|
+
}
|
|
244
|
+
catch (err) {
|
|
245
|
+
// Connected but couldn't list — close and rethrow so it's skipped.
|
|
246
|
+
try {
|
|
247
|
+
await client.close();
|
|
248
|
+
}
|
|
249
|
+
catch { /* ignore */ }
|
|
250
|
+
throw err;
|
|
251
|
+
}
|
|
252
|
+
return { spec, client, toolNames };
|
|
253
|
+
}));
|
|
254
|
+
const downstreams = [];
|
|
255
|
+
settled.forEach((result, i) => {
|
|
256
|
+
const name = aggregable[i]?.name ?? '(unknown)';
|
|
257
|
+
if (result.status === 'fulfilled') {
|
|
258
|
+
downstreams.push(result.value);
|
|
259
|
+
process.stderr.write(`[ashlr mcp] connected "${name}" (${result.value.toolNames.size} tools)\n`);
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
const reason = result.reason instanceof Error ? result.reason.message : String(result.reason);
|
|
263
|
+
process.stderr.write(`[ashlr mcp] WARN skipping "${name}": ${reason}\n`);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
const routes = new Map();
|
|
267
|
+
for (const d of downstreams) {
|
|
268
|
+
for (const toolName of d.toolNames) {
|
|
269
|
+
const key = `${d.spec.name}${NS}${toolName}`;
|
|
270
|
+
// M31 reserved-name guard (native wins; see tools/list for the live re-list guard).
|
|
271
|
+
if (isNativeTool(key)) {
|
|
272
|
+
process.stderr.write(`[ashlr mcp] WARN downstream "${key}" collides with a native ashlr tool — skipped\n`);
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
// Guard: a server name containing the NS separator can collide with a
|
|
276
|
+
// different (server, tool) pair, silently shadowing one route. Warn so the
|
|
277
|
+
// ambiguity is visible rather than last-writer-wins.
|
|
278
|
+
const prior = routes.get(key);
|
|
279
|
+
if (prior && prior.downstream.spec.name !== d.spec.name) {
|
|
280
|
+
process.stderr.write(`[ashlr mcp] WARN namespace collision on "${key}" ` +
|
|
281
|
+
`("${prior.downstream.spec.name}" vs "${d.spec.name}") — last one wins\n`);
|
|
282
|
+
}
|
|
283
|
+
routes.set(key, { downstream: d, original: toolName });
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
// ── Build the gateway server ──────────────────────────────────────────────
|
|
287
|
+
const server = new Server({ name: 'ashlr', version: '0.1.0' }, { capabilities: { tools: {} } });
|
|
288
|
+
// tools/list — native ashlr tools first, then every downstream's, namespaced.
|
|
289
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
290
|
+
const tools = [];
|
|
291
|
+
// M31: native tools are served by the gateway itself (ashlr_<verb> — single
|
|
292
|
+
// underscore; downstream keys always contain `__`, so collision is
|
|
293
|
+
// structurally impossible, but the route loop below still guards).
|
|
294
|
+
for (const t of listNativeTools()) {
|
|
295
|
+
tools.push({ name: t.name, description: t.description, inputSchema: t.inputSchema });
|
|
296
|
+
}
|
|
297
|
+
// Re-list live so the gateway reflects the current downstream tool set.
|
|
298
|
+
for (const d of downstreams) {
|
|
299
|
+
try {
|
|
300
|
+
const listed = await d.client.listTools({}, { timeout: timeoutMs });
|
|
301
|
+
for (const t of listed.tools ?? []) {
|
|
302
|
+
const key = `${d.spec.name}${NS}${t.name}`;
|
|
303
|
+
// M31 reserved-name guard: a downstream key can never shadow a native
|
|
304
|
+
// tool (native wins; the collision is reported, not silently dropped).
|
|
305
|
+
if (isNativeTool(key)) {
|
|
306
|
+
process.stderr.write(`[ashlr mcp] WARN downstream "${key}" collides with a native ashlr tool — skipped\n`);
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
tools.push({
|
|
310
|
+
name: key,
|
|
311
|
+
description: t.description
|
|
312
|
+
? `[${d.spec.name}] ${t.description}`
|
|
313
|
+
: `[${d.spec.name}] ${t.name}`,
|
|
314
|
+
inputSchema: t.inputSchema ?? { type: 'object' },
|
|
315
|
+
});
|
|
316
|
+
// Keep the route map fresh for tools/call.
|
|
317
|
+
routes.set(key, { downstream: d, original: t.name });
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
catch (err) {
|
|
321
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
322
|
+
process.stderr.write(`[ashlr mcp] WARN tools/list("${d.spec.name}") failed: ${msg}\n`);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
// The SDK validates the result against ListToolsResultSchema.
|
|
326
|
+
return { tools };
|
|
327
|
+
});
|
|
328
|
+
// tools/call — native ashlr tools first, then proxy to the owning downstream.
|
|
329
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
330
|
+
const requested = request.params.name;
|
|
331
|
+
// M31: native tools route BEFORE the downstream map and never throw —
|
|
332
|
+
// failures come back as isError text results (audited in mcp-native).
|
|
333
|
+
if (isNativeTool(requested)) {
|
|
334
|
+
return callNativeTool(requested, request.params.arguments ?? {});
|
|
335
|
+
}
|
|
336
|
+
const route = routes.get(requested);
|
|
337
|
+
if (!route) {
|
|
338
|
+
throw new Error(`Unknown tool "${requested}". Expected an \`ashlr_*\` native tool or ` +
|
|
339
|
+
`"<server>${NS}<tool>" form. Run \`ashlr mcp list\` to see available tools.`);
|
|
340
|
+
}
|
|
341
|
+
const result = await route.downstream.client.callTool({
|
|
342
|
+
name: route.original,
|
|
343
|
+
arguments: request.params.arguments ?? {},
|
|
344
|
+
}, undefined, { timeout: timeoutMs });
|
|
345
|
+
return result;
|
|
346
|
+
});
|
|
347
|
+
// ── Graceful shutdown: close every downstream on exit ─────────────────────
|
|
348
|
+
// Runs exactly once even if multiple shutdown paths fire (stdin EOF +
|
|
349
|
+
// SIGTERM/SIGINT). Tracks downstreams via closure so signal handlers reach
|
|
350
|
+
// them and reap the spawned children rather than orphaning them.
|
|
351
|
+
let closed = false;
|
|
352
|
+
const closeAll = async () => {
|
|
353
|
+
if (closed)
|
|
354
|
+
return;
|
|
355
|
+
closed = true;
|
|
356
|
+
for (const d of downstreams) {
|
|
357
|
+
try {
|
|
358
|
+
await d.client.close();
|
|
359
|
+
}
|
|
360
|
+
catch { /* ignore */ }
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
// ── Serve on stdio ────────────────────────────────────────────────────────
|
|
364
|
+
const transport = new StdioServerTransport();
|
|
365
|
+
await server.connect(transport);
|
|
366
|
+
process.stderr.write(`[ashlr mcp] gateway ready — ${listNativeTools().length} native ashlr tool(s) + ` +
|
|
367
|
+
`${routes.size} downstream tool(s) from ${downstreams.length}/${aggregable.length} server(s)\n`);
|
|
368
|
+
// Resolve when the transport closes (stdin EOF) OR a termination signal
|
|
369
|
+
// arrives — awaiting closeAll() in every path so children are torn down
|
|
370
|
+
// before we exit (the SDK's own child SIGTERM→SIGKILL teardown can take ~4s).
|
|
371
|
+
await new Promise((resolve) => {
|
|
372
|
+
const finish = () => { void closeAll().finally(() => resolve()); };
|
|
373
|
+
// stdin EOF (normal MCP client disconnect).
|
|
374
|
+
server.onclose = finish;
|
|
375
|
+
// Signal-based shutdown (common, normal termination path) — onclose does
|
|
376
|
+
// not necessarily fire, so handle SIGINT/SIGTERM explicitly.
|
|
377
|
+
const onSignal = (sig) => {
|
|
378
|
+
process.stderr.write(`[ashlr mcp] received ${sig} — shutting down\n`);
|
|
379
|
+
finish();
|
|
380
|
+
};
|
|
381
|
+
process.once('SIGINT', onSignal);
|
|
382
|
+
process.once('SIGTERM', onSignal);
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
//# sourceMappingURL=mcp-gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-gateway.js","sourceRoot":"","sources":["../../src/core/mcp-gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE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6D;QAC7D,MAAM,QAAQ,GAAG,CAAC,GAAmB,EAAQ,EAAE;YAC7C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,GAAG,oBAAoB,CAAC,CAAC;YACtE,MAAM,EAAE,CAAC;QACX,CAAC,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACjC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M31: Native MCP tools — ashlr's own intelligence served by the gateway.
|
|
3
|
+
*
|
|
4
|
+
* SDK-FREE by contract: this module returns plain objects; mcp-gateway.ts is
|
|
5
|
+
* the only adapter (and, with mcp-registry, the only module allowed to import
|
|
6
|
+
* @modelcontextprotocol/sdk). Everything here is independently unit-testable
|
|
7
|
+
* without a transport.
|
|
8
|
+
*
|
|
9
|
+
* Safety model (CONTRACT-M31) — the gate is STRUCTURAL, enforced in
|
|
10
|
+
* callNativeTool before any handler runs:
|
|
11
|
+
* 'read' — pure read of local stores; allowed even when KILL is on.
|
|
12
|
+
* 'append' — append-only write under ~/.ashlr/ (genome hub); REFUSED on KILL.
|
|
13
|
+
* 'proposal' — creates a PENDING inbox Proposal; REFUSED on KILL.
|
|
14
|
+
*
|
|
15
|
+
* There is deliberately NO approve/reject/apply tool: approval stays human-only
|
|
16
|
+
* via `ashlr inbox`. `ashlr_ask` hardcodes allowCloud:false — agent sessions
|
|
17
|
+
* bring their own model; ashlr code never leaves the machine via this surface.
|
|
18
|
+
*
|
|
19
|
+
* Every call (ok / refused / error) is audited as 'mcp:native-call' with the
|
|
20
|
+
* tool name + argument KEYS only (never values). Output is secret-scrubbed and
|
|
21
|
+
* size-capped so a tool reply can never blow agent context or leak credentials.
|
|
22
|
+
*/
|
|
23
|
+
import type { NativeToolDef } from './types.js';
|
|
24
|
+
/** The native tool definitions (no handlers) for diagnostics/docs surfaces. */
|
|
25
|
+
export declare function nativeToolDefs(): NativeToolDef[];
|
|
26
|
+
/** tools/list shape: name + description + inputSchema (gateway prepends these). */
|
|
27
|
+
export declare function listNativeTools(): {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
inputSchema: object;
|
|
31
|
+
}[];
|
|
32
|
+
/** True when `name` is a native tool (used by the gateway router). */
|
|
33
|
+
export declare function isNativeTool(name: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* MCP-style text result (plain object; the SDK validates it gateway-side).
|
|
36
|
+
* A `type` alias (not an interface) so it picks up an implicit index signature
|
|
37
|
+
* and stays assignable to the SDK's CallToolResult without importing the SDK.
|
|
38
|
+
*/
|
|
39
|
+
export type NativeToolResult = {
|
|
40
|
+
content: {
|
|
41
|
+
type: 'text';
|
|
42
|
+
text: string;
|
|
43
|
+
}[];
|
|
44
|
+
isError?: boolean;
|
|
45
|
+
};
|
|
46
|
+
/** Exported for tests: serialize + scrub + cap exactly as tool results do. */
|
|
47
|
+
export declare function renderToolText(payload: unknown): string;
|
|
48
|
+
/**
|
|
49
|
+
* Execute a native tool through the full safety pipeline. NEVER throws:
|
|
50
|
+
* unknown tools, invalid args, kill-switch refusals, and handler failures all
|
|
51
|
+
* surface as isError text results. Every outcome is audited.
|
|
52
|
+
*/
|
|
53
|
+
export declare function callNativeTool(name: string, rawArgs: unknown): Promise<NativeToolResult>;
|