@cleocode/cleo 2026.4.58 → 2026.4.59
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/dist/cli/commander-shim.d.ts +112 -0
- package/dist/cli/commander-shim.d.ts.map +1 -0
- package/dist/cli/commander-shim.js +233 -0
- package/dist/cli/commander-shim.js.map +1 -0
- package/dist/cli/commands/adapter.d.ts +21 -0
- package/dist/cli/commands/adapter.d.ts.map +1 -0
- package/dist/cli/commands/adapter.js +73 -0
- package/dist/cli/commands/adapter.js.map +1 -0
- package/dist/cli/commands/add-batch.d.ts +16 -0
- package/dist/cli/commands/add-batch.d.ts.map +1 -0
- package/dist/cli/commands/add-batch.js +133 -0
- package/dist/cli/commands/add-batch.js.map +1 -0
- package/dist/cli/commands/add.d.ts +12 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +238 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/admin.d.ts +15 -0
- package/dist/cli/commands/admin.d.ts.map +1 -0
- package/dist/cli/commands/admin.js +143 -0
- package/dist/cli/commands/admin.js.map +1 -0
- package/dist/cli/commands/adr.d.ts +27 -0
- package/dist/cli/commands/adr.d.ts.map +1 -0
- package/dist/cli/commands/adr.js +79 -0
- package/dist/cli/commands/adr.js.map +1 -0
- package/dist/cli/commands/agent-profile-status.d.ts +98 -0
- package/dist/cli/commands/agent-profile-status.d.ts.map +1 -0
- package/dist/cli/commands/agent-profile-status.js +71 -0
- package/dist/cli/commands/agent-profile-status.js.map +1 -0
- package/dist/cli/commands/agent.d.ts +41 -0
- package/dist/cli/commands/agent.d.ts.map +1 -0
- package/dist/cli/commands/agent.js +2270 -0
- package/dist/cli/commands/agent.js.map +1 -0
- package/dist/cli/commands/agents.d.ts +17 -0
- package/dist/cli/commands/agents.d.ts.map +1 -0
- package/dist/cli/commands/agents.js +20 -0
- package/dist/cli/commands/agents.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts +12 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -0
- package/dist/cli/commands/analyze.js +20 -0
- package/dist/cli/commands/analyze.js.map +1 -0
- package/dist/cli/commands/archive-stats.d.ts +18 -0
- package/dist/cli/commands/archive-stats.d.ts.map +1 -0
- package/dist/cli/commands/archive-stats.js +49 -0
- package/dist/cli/commands/archive-stats.js.map +1 -0
- package/dist/cli/commands/archive.d.ts +12 -0
- package/dist/cli/commands/archive.d.ts.map +1 -0
- package/dist/cli/commands/archive.js +32 -0
- package/dist/cli/commands/archive.js.map +1 -0
- package/dist/cli/commands/backfill.d.ts +38 -0
- package/dist/cli/commands/backfill.d.ts.map +1 -0
- package/dist/cli/commands/backfill.js +144 -0
- package/dist/cli/commands/backfill.js.map +1 -0
- package/dist/cli/commands/backup-inspect.d.ts +24 -0
- package/dist/cli/commands/backup-inspect.d.ts.map +1 -0
- package/dist/cli/commands/backup-inspect.js +417 -0
- package/dist/cli/commands/backup-inspect.js.map +1 -0
- package/dist/cli/commands/backup.d.ts +13 -0
- package/dist/cli/commands/backup.d.ts.map +1 -0
- package/dist/cli/commands/backup.js +479 -0
- package/dist/cli/commands/backup.js.map +1 -0
- package/dist/cli/commands/blockers.d.ts +7 -0
- package/dist/cli/commands/blockers.d.ts.map +1 -0
- package/dist/cli/commands/blockers.js +16 -0
- package/dist/cli/commands/blockers.js.map +1 -0
- package/dist/cli/commands/brain.d.ts +29 -0
- package/dist/cli/commands/brain.d.ts.map +1 -0
- package/dist/cli/commands/brain.js +358 -0
- package/dist/cli/commands/brain.js.map +1 -0
- package/dist/cli/commands/briefing.d.ts +22 -0
- package/dist/cli/commands/briefing.d.ts.map +1 -0
- package/dist/cli/commands/briefing.js +45 -0
- package/dist/cli/commands/briefing.js.map +1 -0
- package/dist/cli/commands/bug.d.ts +12 -0
- package/dist/cli/commands/bug.d.ts.map +1 -0
- package/dist/cli/commands/bug.js +81 -0
- package/dist/cli/commands/bug.js.map +1 -0
- package/dist/cli/commands/cancel.d.ts +17 -0
- package/dist/cli/commands/cancel.d.ts.map +1 -0
- package/dist/cli/commands/cancel.js +28 -0
- package/dist/cli/commands/cancel.js.map +1 -0
- package/dist/cli/commands/cant.d.ts +32 -0
- package/dist/cli/commands/cant.d.ts.map +1 -0
- package/dist/cli/commands/cant.js +264 -0
- package/dist/cli/commands/cant.js.map +1 -0
- package/dist/cli/commands/chain.d.ts +16 -0
- package/dist/cli/commands/chain.d.ts.map +1 -0
- package/dist/cli/commands/chain.js +52 -0
- package/dist/cli/commands/chain.js.map +1 -0
- package/dist/cli/commands/check.d.ts +25 -0
- package/dist/cli/commands/check.d.ts.map +1 -0
- package/dist/cli/commands/check.js +193 -0
- package/dist/cli/commands/check.js.map +1 -0
- package/dist/cli/commands/checkpoint.d.ts +15 -0
- package/dist/cli/commands/checkpoint.d.ts.map +1 -0
- package/dist/cli/commands/checkpoint.js +91 -0
- package/dist/cli/commands/checkpoint.js.map +1 -0
- package/dist/cli/commands/claim.d.ts +27 -0
- package/dist/cli/commands/claim.d.ts.map +1 -0
- package/dist/cli/commands/claim.js +45 -0
- package/dist/cli/commands/claim.js.map +1 -0
- package/dist/cli/commands/code.d.ts +11 -0
- package/dist/cli/commands/code.d.ts.map +1 -0
- package/dist/cli/commands/code.js +114 -0
- package/dist/cli/commands/code.js.map +1 -0
- package/dist/cli/commands/commands.d.ts +13 -0
- package/dist/cli/commands/commands.d.ts.map +1 -0
- package/dist/cli/commands/commands.js +29 -0
- package/dist/cli/commands/commands.js.map +1 -0
- package/dist/cli/commands/complete.d.ts +12 -0
- package/dist/cli/commands/complete.d.ts.map +1 -0
- package/dist/cli/commands/complete.js +92 -0
- package/dist/cli/commands/complete.js.map +1 -0
- package/dist/cli/commands/complexity.d.ts +17 -0
- package/dist/cli/commands/complexity.d.ts.map +1 -0
- package/dist/cli/commands/complexity.js +25 -0
- package/dist/cli/commands/complexity.js.map +1 -0
- package/dist/cli/commands/compliance.d.ts +9 -0
- package/dist/cli/commands/compliance.d.ts.map +1 -0
- package/dist/cli/commands/compliance.js +110 -0
- package/dist/cli/commands/compliance.js.map +1 -0
- package/dist/cli/commands/config.d.ts +10 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +69 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/consensus.d.ts +13 -0
- package/dist/cli/commands/consensus.d.ts.map +1 -0
- package/dist/cli/commands/consensus.js +45 -0
- package/dist/cli/commands/consensus.js.map +1 -0
- package/dist/cli/commands/context.d.ts +15 -0
- package/dist/cli/commands/context.d.ts.map +1 -0
- package/dist/cli/commands/context.js +76 -0
- package/dist/cli/commands/context.js.map +1 -0
- package/dist/cli/commands/contribution.d.ts +13 -0
- package/dist/cli/commands/contribution.d.ts.map +1 -0
- package/dist/cli/commands/contribution.js +41 -0
- package/dist/cli/commands/contribution.js.map +1 -0
- package/dist/cli/commands/current.d.ts +13 -0
- package/dist/cli/commands/current.d.ts.map +1 -0
- package/dist/cli/commands/current.js +20 -0
- package/dist/cli/commands/current.js.map +1 -0
- package/dist/cli/commands/dash.d.ts +12 -0
- package/dist/cli/commands/dash.d.ts.map +1 -0
- package/dist/cli/commands/dash.js +20 -0
- package/dist/cli/commands/dash.js.map +1 -0
- package/dist/cli/commands/decomposition.d.ts +13 -0
- package/dist/cli/commands/decomposition.d.ts.map +1 -0
- package/dist/cli/commands/decomposition.js +45 -0
- package/dist/cli/commands/decomposition.js.map +1 -0
- package/dist/cli/commands/delete.d.ts +12 -0
- package/dist/cli/commands/delete.d.ts.map +1 -0
- package/dist/cli/commands/delete.js +37 -0
- package/dist/cli/commands/delete.js.map +1 -0
- package/dist/cli/commands/deps.d.ts +24 -0
- package/dist/cli/commands/deps.d.ts.map +1 -0
- package/dist/cli/commands/deps.js +98 -0
- package/dist/cli/commands/deps.js.map +1 -0
- package/dist/cli/commands/detect-drift.d.ts +15 -0
- package/dist/cli/commands/detect-drift.d.ts.map +1 -0
- package/dist/cli/commands/detect-drift.js +428 -0
- package/dist/cli/commands/detect-drift.js.map +1 -0
- package/dist/cli/commands/detect.d.ts +13 -0
- package/dist/cli/commands/detect.d.ts.map +1 -0
- package/dist/cli/commands/detect.js +20 -0
- package/dist/cli/commands/detect.js.map +1 -0
- package/dist/cli/commands/diagnostics.d.ts +16 -0
- package/dist/cli/commands/diagnostics.d.ts.map +1 -0
- package/dist/cli/commands/diagnostics.js +58 -0
- package/dist/cli/commands/diagnostics.js.map +1 -0
- package/dist/cli/commands/docs.d.ts +13 -0
- package/dist/cli/commands/docs.d.ts.map +1 -0
- package/dist/cli/commands/docs.js +169 -0
- package/dist/cli/commands/docs.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +15 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +133 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/dynamic.d.ts +24 -0
- package/dist/cli/commands/dynamic.d.ts.map +1 -0
- package/dist/cli/commands/dynamic.js +27 -0
- package/dist/cli/commands/dynamic.js.map +1 -0
- package/dist/cli/commands/env.d.ts +12 -0
- package/dist/cli/commands/env.d.ts.map +1 -0
- package/dist/cli/commands/env.js +44 -0
- package/dist/cli/commands/env.js.map +1 -0
- package/dist/cli/commands/exists.d.ts +24 -0
- package/dist/cli/commands/exists.d.ts.map +1 -0
- package/dist/cli/commands/exists.js +53 -0
- package/dist/cli/commands/exists.js.map +1 -0
- package/dist/cli/commands/export-tasks.d.ts +10 -0
- package/dist/cli/commands/export-tasks.d.ts.map +1 -0
- package/dist/cli/commands/export-tasks.js +47 -0
- package/dist/cli/commands/export-tasks.js.map +1 -0
- package/dist/cli/commands/export.d.ts +9 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +46 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/find.d.ts +14 -0
- package/dist/cli/commands/find.d.ts.map +1 -0
- package/dist/cli/commands/find.js +152 -0
- package/dist/cli/commands/find.js.map +1 -0
- package/dist/cli/commands/generate-changelog.d.ts +14 -0
- package/dist/cli/commands/generate-changelog.d.ts.map +1 -0
- package/dist/cli/commands/generate-changelog.js +252 -0
- package/dist/cli/commands/generate-changelog.js.map +1 -0
- package/dist/cli/commands/grade.d.ts +13 -0
- package/dist/cli/commands/grade.d.ts.map +1 -0
- package/dist/cli/commands/grade.js +26 -0
- package/dist/cli/commands/grade.js.map +1 -0
- package/dist/cli/commands/history.d.ts +9 -0
- package/dist/cli/commands/history.d.ts.map +1 -0
- package/dist/cli/commands/history.js +33 -0
- package/dist/cli/commands/history.js.map +1 -0
- package/dist/cli/commands/implementation.d.ts +13 -0
- package/dist/cli/commands/implementation.d.ts.map +1 -0
- package/dist/cli/commands/implementation.js +41 -0
- package/dist/cli/commands/implementation.js.map +1 -0
- package/dist/cli/commands/import-tasks.d.ts +10 -0
- package/dist/cli/commands/import-tasks.d.ts.map +1 -0
- package/dist/cli/commands/import-tasks.js +38 -0
- package/dist/cli/commands/import-tasks.js.map +1 -0
- package/dist/cli/commands/import.d.ts +9 -0
- package/dist/cli/commands/import.d.ts.map +1 -0
- package/dist/cli/commands/import.js +28 -0
- package/dist/cli/commands/import.js.map +1 -0
- package/dist/cli/commands/init.d.ts +34 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +96 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/inject.d.ts +8 -0
- package/dist/cli/commands/inject.d.ts.map +1 -0
- package/dist/cli/commands/inject.js +28 -0
- package/dist/cli/commands/inject.js.map +1 -0
- package/dist/cli/commands/intelligence.d.ts +22 -0
- package/dist/cli/commands/intelligence.d.ts.map +1 -0
- package/dist/cli/commands/intelligence.js +72 -0
- package/dist/cli/commands/intelligence.js.map +1 -0
- package/dist/cli/commands/issue.d.ts +17 -0
- package/dist/cli/commands/issue.d.ts.map +1 -0
- package/dist/cli/commands/issue.js +107 -0
- package/dist/cli/commands/issue.js.map +1 -0
- package/dist/cli/commands/labels.d.ts +17 -0
- package/dist/cli/commands/labels.d.ts.map +1 -0
- package/dist/cli/commands/labels.js +48 -0
- package/dist/cli/commands/labels.js.map +1 -0
- package/dist/cli/commands/lifecycle.d.ts +8 -0
- package/dist/cli/commands/lifecycle.d.ts.map +1 -0
- package/dist/cli/commands/lifecycle.js +128 -0
- package/dist/cli/commands/lifecycle.js.map +1 -0
- package/dist/cli/commands/list.d.ts +14 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +143 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/log.d.ts +12 -0
- package/dist/cli/commands/log.d.ts.map +1 -0
- package/dist/cli/commands/log.js +30 -0
- package/dist/cli/commands/log.js.map +1 -0
- package/dist/cli/commands/map.d.ts +10 -0
- package/dist/cli/commands/map.d.ts.map +1 -0
- package/dist/cli/commands/map.js +23 -0
- package/dist/cli/commands/map.js.map +1 -0
- package/dist/cli/commands/memory-brain.d.ts +15 -0
- package/dist/cli/commands/memory-brain.d.ts.map +1 -0
- package/dist/cli/commands/memory-brain.js +436 -0
- package/dist/cli/commands/memory-brain.js.map +1 -0
- package/dist/cli/commands/migrate-claude-mem.d.ts +23 -0
- package/dist/cli/commands/migrate-claude-mem.d.ts.map +1 -0
- package/dist/cli/commands/migrate-claude-mem.js +79 -0
- package/dist/cli/commands/migrate-claude-mem.js.map +1 -0
- package/dist/cli/commands/next.d.ts +9 -0
- package/dist/cli/commands/next.d.ts.map +1 -0
- package/dist/cli/commands/next.js +20 -0
- package/dist/cli/commands/next.js.map +1 -0
- package/dist/cli/commands/nexus.d.ts +20 -0
- package/dist/cli/commands/nexus.d.ts.map +1 -0
- package/dist/cli/commands/nexus.js +2290 -0
- package/dist/cli/commands/nexus.js.map +1 -0
- package/dist/cli/commands/observe.d.ts +13 -0
- package/dist/cli/commands/observe.d.ts.map +1 -0
- package/dist/cli/commands/observe.js +30 -0
- package/dist/cli/commands/observe.js.map +1 -0
- package/dist/cli/commands/ops.d.ts +10 -0
- package/dist/cli/commands/ops.d.ts.map +1 -0
- package/dist/cli/commands/ops.js +19 -0
- package/dist/cli/commands/ops.js.map +1 -0
- package/dist/cli/commands/orchestrate.d.ts +24 -0
- package/dist/cli/commands/orchestrate.d.ts.map +1 -0
- package/dist/cli/commands/orchestrate.js +254 -0
- package/dist/cli/commands/orchestrate.js.map +1 -0
- package/dist/cli/commands/otel.d.ts +12 -0
- package/dist/cli/commands/otel.d.ts.map +1 -0
- package/dist/cli/commands/otel.js +128 -0
- package/dist/cli/commands/otel.js.map +1 -0
- package/dist/cli/commands/phase.d.ts +12 -0
- package/dist/cli/commands/phase.d.ts.map +1 -0
- package/dist/cli/commands/phase.js +91 -0
- package/dist/cli/commands/phase.js.map +1 -0
- package/dist/cli/commands/phases.d.ts +14 -0
- package/dist/cli/commands/phases.d.ts.map +1 -0
- package/dist/cli/commands/phases.js +42 -0
- package/dist/cli/commands/phases.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +8 -0
- package/dist/cli/commands/plan.d.ts.map +1 -0
- package/dist/cli/commands/plan.js +15 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/promote.d.ts +11 -0
- package/dist/cli/commands/promote.d.ts.map +1 -0
- package/dist/cli/commands/promote.js +18 -0
- package/dist/cli/commands/promote.js.map +1 -0
- package/dist/cli/commands/provider.d.ts +21 -0
- package/dist/cli/commands/provider.d.ts.map +1 -0
- package/dist/cli/commands/provider.js +88 -0
- package/dist/cli/commands/provider.js.map +1 -0
- package/dist/cli/commands/reason.d.ts +36 -0
- package/dist/cli/commands/reason.d.ts.map +1 -0
- package/dist/cli/commands/reason.js +85 -0
- package/dist/cli/commands/reason.js.map +1 -0
- package/dist/cli/commands/refresh-memory.d.ts +9 -0
- package/dist/cli/commands/refresh-memory.d.ts.map +1 -0
- package/dist/cli/commands/refresh-memory.js +24 -0
- package/dist/cli/commands/refresh-memory.js.map +1 -0
- package/dist/cli/commands/relates.d.ts +12 -0
- package/dist/cli/commands/relates.d.ts.map +1 -0
- package/dist/cli/commands/relates.js +53 -0
- package/dist/cli/commands/relates.js.map +1 -0
- package/dist/cli/commands/release.d.ts +8 -0
- package/dist/cli/commands/release.d.ts.map +1 -0
- package/dist/cli/commands/release.js +82 -0
- package/dist/cli/commands/release.js.map +1 -0
- package/dist/cli/commands/remote.d.ts +12 -0
- package/dist/cli/commands/remote.d.ts.map +1 -0
- package/dist/cli/commands/remote.js +207 -0
- package/dist/cli/commands/remote.js.map +1 -0
- package/dist/cli/commands/reorder.d.ts +17 -0
- package/dist/cli/commands/reorder.d.ts.map +1 -0
- package/dist/cli/commands/reorder.js +41 -0
- package/dist/cli/commands/reorder.js.map +1 -0
- package/dist/cli/commands/reparent.d.ts +10 -0
- package/dist/cli/commands/reparent.d.ts.map +1 -0
- package/dist/cli/commands/reparent.js +19 -0
- package/dist/cli/commands/reparent.js.map +1 -0
- package/dist/cli/commands/research.d.ts +8 -0
- package/dist/cli/commands/research.d.ts.map +1 -0
- package/dist/cli/commands/research.js +164 -0
- package/dist/cli/commands/research.js.map +1 -0
- package/dist/cli/commands/restore.d.ts +54 -0
- package/dist/cli/commands/restore.d.ts.map +1 -0
- package/dist/cli/commands/restore.js +470 -0
- package/dist/cli/commands/restore.js.map +1 -0
- package/dist/cli/commands/roadmap.d.ts +14 -0
- package/dist/cli/commands/roadmap.d.ts.map +1 -0
- package/dist/cli/commands/roadmap.js +26 -0
- package/dist/cli/commands/roadmap.js.map +1 -0
- package/dist/cli/commands/safestop.d.ts +14 -0
- package/dist/cli/commands/safestop.d.ts.map +1 -0
- package/dist/cli/commands/safestop.js +32 -0
- package/dist/cli/commands/safestop.js.map +1 -0
- package/dist/cli/commands/schema.d.ts +27 -0
- package/dist/cli/commands/schema.d.ts.map +1 -0
- package/dist/cli/commands/schema.js +160 -0
- package/dist/cli/commands/schema.js.map +1 -0
- package/dist/cli/commands/self-update.d.ts +15 -0
- package/dist/cli/commands/self-update.d.ts.map +1 -0
- package/dist/cli/commands/self-update.js +363 -0
- package/dist/cli/commands/self-update.js.map +1 -0
- package/dist/cli/commands/sequence.d.ts +11 -0
- package/dist/cli/commands/sequence.d.ts.map +1 -0
- package/dist/cli/commands/sequence.js +40 -0
- package/dist/cli/commands/sequence.js.map +1 -0
- package/dist/cli/commands/session.d.ts +12 -0
- package/dist/cli/commands/session.d.ts.map +1 -0
- package/dist/cli/commands/session.js +219 -0
- package/dist/cli/commands/session.js.map +1 -0
- package/dist/cli/commands/show.d.ts +13 -0
- package/dist/cli/commands/show.d.ts.map +1 -0
- package/dist/cli/commands/show.js +40 -0
- package/dist/cli/commands/show.js.map +1 -0
- package/dist/cli/commands/skills.d.ts +13 -0
- package/dist/cli/commands/skills.d.ts.map +1 -0
- package/dist/cli/commands/skills.js +161 -0
- package/dist/cli/commands/skills.js.map +1 -0
- package/dist/cli/commands/snapshot.d.ts +9 -0
- package/dist/cli/commands/snapshot.d.ts.map +1 -0
- package/dist/cli/commands/snapshot.js +50 -0
- package/dist/cli/commands/snapshot.js.map +1 -0
- package/dist/cli/commands/specification.d.ts +13 -0
- package/dist/cli/commands/specification.d.ts.map +1 -0
- package/dist/cli/commands/specification.js +45 -0
- package/dist/cli/commands/specification.js.map +1 -0
- package/dist/cli/commands/start.d.ts +13 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +20 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/stats.d.ts +12 -0
- package/dist/cli/commands/stats.d.ts.map +1 -0
- package/dist/cli/commands/stats.js +35 -0
- package/dist/cli/commands/stats.js.map +1 -0
- package/dist/cli/commands/sticky.d.ts +16 -0
- package/dist/cli/commands/sticky.d.ts.map +1 -0
- package/dist/cli/commands/sticky.js +218 -0
- package/dist/cli/commands/sticky.js.map +1 -0
- package/dist/cli/commands/stop.d.ts +13 -0
- package/dist/cli/commands/stop.d.ts.map +1 -0
- package/dist/cli/commands/stop.js +20 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/commands/sync.d.ts +26 -0
- package/dist/cli/commands/sync.d.ts.map +1 -0
- package/dist/cli/commands/sync.js +82 -0
- package/dist/cli/commands/sync.js.map +1 -0
- package/dist/cli/commands/testing.d.ts +13 -0
- package/dist/cli/commands/testing.d.ts.map +1 -0
- package/dist/cli/commands/testing.js +65 -0
- package/dist/cli/commands/testing.js.map +1 -0
- package/dist/cli/commands/token.d.ts +10 -0
- package/dist/cli/commands/token.d.ts.map +1 -0
- package/dist/cli/commands/token.js +135 -0
- package/dist/cli/commands/token.js.map +1 -0
- package/dist/cli/commands/update.d.ts +12 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +83 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/commands/upgrade.d.ts +18 -0
- package/dist/cli/commands/upgrade.d.ts.map +1 -0
- package/dist/cli/commands/upgrade.js +103 -0
- package/dist/cli/commands/upgrade.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +12 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +24 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/commands/verify.d.ts +8 -0
- package/dist/cli/commands/verify.d.ts.map +1 -0
- package/dist/cli/commands/verify.js +28 -0
- package/dist/cli/commands/verify.js.map +1 -0
- package/dist/cli/commands/web.d.ts +19 -0
- package/dist/cli/commands/web.d.ts.map +1 -0
- package/dist/cli/commands/web.js +371 -0
- package/dist/cli/commands/web.js.map +1 -0
- package/dist/cli/field-context.d.ts +32 -0
- package/dist/cli/field-context.d.ts.map +1 -0
- package/dist/cli/field-context.js +47 -0
- package/dist/cli/field-context.js.map +1 -0
- package/dist/cli/format-context.d.ts +32 -0
- package/dist/cli/format-context.d.ts.map +1 -0
- package/dist/cli/format-context.js +50 -0
- package/dist/cli/format-context.js.map +1 -0
- package/dist/cli/help-generator.d.ts +74 -0
- package/dist/cli/help-generator.d.ts.map +1 -0
- package/dist/cli/help-generator.js +229 -0
- package/dist/cli/help-generator.js.map +1 -0
- package/dist/cli/help-renderer.d.ts +28 -0
- package/dist/cli/help-renderer.d.ts.map +1 -0
- package/dist/cli/help-renderer.js +301 -0
- package/dist/cli/help-renderer.js.map +1 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/logger-bootstrap.d.ts +6 -0
- package/dist/cli/logger-bootstrap.d.ts.map +1 -0
- package/dist/cli/logger-bootstrap.js +10 -0
- package/dist/cli/logger-bootstrap.js.map +1 -0
- package/dist/cli/middleware/output-format.d.ts +30 -0
- package/dist/cli/middleware/output-format.d.ts.map +1 -0
- package/dist/cli/middleware/output-format.js +35 -0
- package/dist/cli/middleware/output-format.js.map +1 -0
- package/dist/cli/progress.d.ts +84 -0
- package/dist/cli/progress.d.ts.map +1 -0
- package/dist/cli/progress.js +169 -0
- package/dist/cli/progress.js.map +1 -0
- package/dist/cli/renderers/colors.d.ts +32 -0
- package/dist/cli/renderers/colors.d.ts.map +1 -0
- package/dist/cli/renderers/colors.js +141 -0
- package/dist/cli/renderers/colors.js.map +1 -0
- package/dist/cli/renderers/error.d.ts +13 -0
- package/dist/cli/renderers/error.d.ts.map +1 -0
- package/dist/cli/renderers/error.js +42 -0
- package/dist/cli/renderers/error.js.map +1 -0
- package/dist/cli/renderers/index.d.ts +87 -0
- package/dist/cli/renderers/index.d.ts.map +1 -0
- package/dist/cli/renderers/index.js +262 -0
- package/dist/cli/renderers/index.js.map +1 -0
- package/dist/cli/renderers/lafs-validator.d.ts +91 -0
- package/dist/cli/renderers/lafs-validator.d.ts.map +1 -0
- package/dist/cli/renderers/lafs-validator.js +176 -0
- package/dist/cli/renderers/lafs-validator.js.map +1 -0
- package/dist/cli/renderers/normalizer.d.ts +21 -0
- package/dist/cli/renderers/normalizer.d.ts.map +1 -0
- package/dist/cli/renderers/normalizer.js +106 -0
- package/dist/cli/renderers/normalizer.js.map +1 -0
- package/dist/cli/renderers/system.d.ts +25 -0
- package/dist/cli/renderers/system.d.ts.map +1 -0
- package/dist/cli/renderers/system.js +416 -0
- package/dist/cli/renderers/system.js.map +1 -0
- package/dist/cli/renderers/tasks.d.ts +28 -0
- package/dist/cli/renderers/tasks.d.ts.map +1 -0
- package/dist/cli/renderers/tasks.js +306 -0
- package/dist/cli/renderers/tasks.js.map +1 -0
- package/dist/dispatch/adapters/cli.d.ts +67 -0
- package/dist/dispatch/adapters/cli.d.ts.map +1 -0
- package/dist/dispatch/adapters/cli.js +331 -0
- package/dist/dispatch/adapters/cli.js.map +1 -0
- package/dist/dispatch/context/session-context.d.ts +54 -0
- package/dist/dispatch/context/session-context.d.ts.map +1 -0
- package/dist/dispatch/context/session-context.js +61 -0
- package/dist/dispatch/context/session-context.js.map +1 -0
- package/dist/dispatch/dispatcher.d.ts +23 -0
- package/dist/dispatch/dispatcher.d.ts.map +1 -0
- package/dist/dispatch/dispatcher.js +84 -0
- package/dist/dispatch/dispatcher.js.map +1 -0
- package/dist/dispatch/domains/_base.d.ts +59 -0
- package/dist/dispatch/domains/_base.d.ts.map +1 -0
- package/dist/dispatch/domains/_base.js +77 -0
- package/dist/dispatch/domains/_base.js.map +1 -0
- package/dist/dispatch/domains/_meta.d.ts +23 -0
- package/dist/dispatch/domains/_meta.d.ts.map +1 -0
- package/dist/dispatch/domains/_meta.js +25 -0
- package/dist/dispatch/domains/_meta.js.map +1 -0
- package/dist/dispatch/domains/_routing.d.ts +8 -0
- package/dist/dispatch/domains/_routing.d.ts.map +1 -0
- package/dist/dispatch/domains/_routing.js +20 -0
- package/dist/dispatch/domains/_routing.js.map +1 -0
- package/dist/dispatch/domains/admin.d.ts +25 -0
- package/dist/dispatch/domains/admin.d.ts.map +1 -0
- package/dist/dispatch/domains/admin.js +791 -0
- package/dist/dispatch/domains/admin.js.map +1 -0
- package/dist/dispatch/domains/check.d.ts +22 -0
- package/dist/dispatch/domains/check.d.ts.map +1 -0
- package/dist/dispatch/domains/check.js +381 -0
- package/dist/dispatch/domains/check.js.map +1 -0
- package/dist/dispatch/domains/conduit.d.ts +38 -0
- package/dist/dispatch/domains/conduit.d.ts.map +1 -0
- package/dist/dispatch/domains/conduit.js +360 -0
- package/dist/dispatch/domains/conduit.js.map +1 -0
- package/dist/dispatch/domains/diagnostics.d.ts +20 -0
- package/dist/dispatch/domains/diagnostics.d.ts.map +1 -0
- package/dist/dispatch/domains/diagnostics.js +77 -0
- package/dist/dispatch/domains/diagnostics.js.map +1 -0
- package/dist/dispatch/domains/index.d.ts +29 -0
- package/dist/dispatch/domains/index.d.ts.map +1 -0
- package/dist/dispatch/domains/index.js +45 -0
- package/dist/dispatch/domains/index.js.map +1 -0
- package/dist/dispatch/domains/intelligence.d.ts +26 -0
- package/dist/dispatch/domains/intelligence.d.ts.map +1 -0
- package/dist/dispatch/domains/intelligence.js +154 -0
- package/dist/dispatch/domains/intelligence.js.map +1 -0
- package/dist/dispatch/domains/memory.d.ts +22 -0
- package/dist/dispatch/domains/memory.d.ts.map +1 -0
- package/dist/dispatch/domains/memory.js +387 -0
- package/dist/dispatch/domains/memory.js.map +1 -0
- package/dist/dispatch/domains/nexus.d.ts +22 -0
- package/dist/dispatch/domains/nexus.d.ts.map +1 -0
- package/dist/dispatch/domains/nexus.js +286 -0
- package/dist/dispatch/domains/nexus.js.map +1 -0
- package/dist/dispatch/domains/orchestrate.d.ts +26 -0
- package/dist/dispatch/domains/orchestrate.d.ts.map +1 -0
- package/dist/dispatch/domains/orchestrate.js +691 -0
- package/dist/dispatch/domains/orchestrate.js.map +1 -0
- package/dist/dispatch/domains/pipeline.d.ts +35 -0
- package/dist/dispatch/domains/pipeline.d.ts.map +1 -0
- package/dist/dispatch/domains/pipeline.js +593 -0
- package/dist/dispatch/domains/pipeline.js.map +1 -0
- package/dist/dispatch/domains/session.d.ts +22 -0
- package/dist/dispatch/domains/session.d.ts.map +1 -0
- package/dist/dispatch/domains/session.js +267 -0
- package/dist/dispatch/domains/session.js.map +1 -0
- package/dist/dispatch/domains/sticky.d.ts +20 -0
- package/dist/dispatch/domains/sticky.d.ts.map +1 -0
- package/dist/dispatch/domains/sticky.js +167 -0
- package/dist/dispatch/domains/sticky.js.map +1 -0
- package/dist/dispatch/domains/tasks.d.ts +25 -0
- package/dist/dispatch/domains/tasks.d.ts.map +1 -0
- package/dist/dispatch/domains/tasks.js +368 -0
- package/dist/dispatch/domains/tasks.js.map +1 -0
- package/dist/dispatch/domains/tools.d.ts +37 -0
- package/dist/dispatch/domains/tools.d.ts.map +1 -0
- package/dist/dispatch/domains/tools.js +481 -0
- package/dist/dispatch/domains/tools.js.map +1 -0
- package/dist/dispatch/engines/_error.d.ts +119 -0
- package/dist/dispatch/engines/_error.d.ts.map +1 -0
- package/dist/dispatch/engines/_error.js +298 -0
- package/dist/dispatch/engines/_error.js.map +1 -0
- package/dist/dispatch/engines/code-engine.d.ts +18 -0
- package/dist/dispatch/engines/code-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/code-engine.js +71 -0
- package/dist/dispatch/engines/code-engine.js.map +1 -0
- package/dist/dispatch/engines/codebase-map-engine.d.ts +31 -0
- package/dist/dispatch/engines/codebase-map-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/codebase-map-engine.js +43 -0
- package/dist/dispatch/engines/codebase-map-engine.js.map +1 -0
- package/dist/dispatch/engines/config-engine.d.ts +32 -0
- package/dist/dispatch/engines/config-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/config-engine.js +70 -0
- package/dist/dispatch/engines/config-engine.js.map +1 -0
- package/dist/dispatch/engines/diagnostics-engine.d.ts +57 -0
- package/dist/dispatch/engines/diagnostics-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/diagnostics-engine.js +163 -0
- package/dist/dispatch/engines/diagnostics-engine.js.map +1 -0
- package/dist/dispatch/engines/hooks-engine.d.ts +96 -0
- package/dist/dispatch/engines/hooks-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/hooks-engine.js +144 -0
- package/dist/dispatch/engines/hooks-engine.js.map +1 -0
- package/dist/dispatch/engines/init-engine.d.ts +56 -0
- package/dist/dispatch/engines/init-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/init-engine.js +78 -0
- package/dist/dispatch/engines/init-engine.js.map +1 -0
- package/dist/dispatch/engines/lifecycle-engine.d.ts +66 -0
- package/dist/dispatch/engines/lifecycle-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/lifecycle-engine.js +224 -0
- package/dist/dispatch/engines/lifecycle-engine.js.map +1 -0
- package/dist/dispatch/engines/memory-engine.d.ts +10 -0
- package/dist/dispatch/engines/memory-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/memory-engine.js +10 -0
- package/dist/dispatch/engines/memory-engine.js.map +1 -0
- package/dist/dispatch/engines/nexus-engine.d.ts +167 -0
- package/dist/dispatch/engines/nexus-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/nexus-engine.js +356 -0
- package/dist/dispatch/engines/nexus-engine.js.map +1 -0
- package/dist/dispatch/engines/orchestrate-engine.d.ts +141 -0
- package/dist/dispatch/engines/orchestrate-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/orchestrate-engine.js +892 -0
- package/dist/dispatch/engines/orchestrate-engine.js.map +1 -0
- package/dist/dispatch/engines/pipeline-engine.d.ts +51 -0
- package/dist/dispatch/engines/pipeline-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/pipeline-engine.js +191 -0
- package/dist/dispatch/engines/pipeline-engine.js.map +1 -0
- package/dist/dispatch/engines/release-engine.d.ts +94 -0
- package/dist/dispatch/engines/release-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/release-engine.js +763 -0
- package/dist/dispatch/engines/release-engine.js.map +1 -0
- package/dist/dispatch/engines/session-engine.d.ts +387 -0
- package/dist/dispatch/engines/session-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/session-engine.js +924 -0
- package/dist/dispatch/engines/session-engine.js.map +1 -0
- package/dist/dispatch/engines/sticky-engine.d.ts +100 -0
- package/dist/dispatch/engines/sticky-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/sticky-engine.js +181 -0
- package/dist/dispatch/engines/sticky-engine.js.map +1 -0
- package/dist/dispatch/engines/system-engine.d.ts +543 -0
- package/dist/dispatch/engines/system-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/system-engine.js +1273 -0
- package/dist/dispatch/engines/system-engine.js.map +1 -0
- package/dist/dispatch/engines/task-engine.d.ts +971 -0
- package/dist/dispatch/engines/task-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/task-engine.js +1255 -0
- package/dist/dispatch/engines/task-engine.js.map +1 -0
- package/dist/dispatch/engines/template-parser.d.ts +85 -0
- package/dist/dispatch/engines/template-parser.d.ts.map +1 -0
- package/dist/dispatch/engines/template-parser.js +108 -0
- package/dist/dispatch/engines/template-parser.js.map +1 -0
- package/dist/dispatch/engines/tools-engine.d.ts +270 -0
- package/dist/dispatch/engines/tools-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/tools-engine.js +663 -0
- package/dist/dispatch/engines/tools-engine.js.map +1 -0
- package/dist/dispatch/engines/validate-engine.d.ts +218 -0
- package/dist/dispatch/engines/validate-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/validate-engine.js +737 -0
- package/dist/dispatch/engines/validate-engine.js.map +1 -0
- package/dist/dispatch/index.d.ts +20 -0
- package/dist/dispatch/index.d.ts.map +1 -0
- package/dist/dispatch/index.js +19 -0
- package/dist/dispatch/index.js.map +1 -0
- package/dist/dispatch/lib/background-jobs.d.ts +86 -0
- package/dist/dispatch/lib/background-jobs.d.ts.map +1 -0
- package/dist/dispatch/lib/background-jobs.js +183 -0
- package/dist/dispatch/lib/background-jobs.js.map +1 -0
- package/dist/dispatch/lib/budget.d.ts +36 -0
- package/dist/dispatch/lib/budget.d.ts.map +1 -0
- package/dist/dispatch/lib/budget.js +109 -0
- package/dist/dispatch/lib/budget.js.map +1 -0
- package/dist/dispatch/lib/capability-matrix.d.ts +11 -0
- package/dist/dispatch/lib/capability-matrix.d.ts.map +1 -0
- package/dist/dispatch/lib/capability-matrix.js +10 -0
- package/dist/dispatch/lib/capability-matrix.js.map +1 -0
- package/dist/dispatch/lib/config-loader.d.ts +42 -0
- package/dist/dispatch/lib/config-loader.d.ts.map +1 -0
- package/dist/dispatch/lib/config-loader.js +217 -0
- package/dist/dispatch/lib/config-loader.js.map +1 -0
- package/dist/dispatch/lib/config.d.ts +11 -0
- package/dist/dispatch/lib/config.d.ts.map +1 -0
- package/dist/dispatch/lib/config.js +10 -0
- package/dist/dispatch/lib/config.js.map +1 -0
- package/dist/dispatch/lib/defaults.d.ts +115 -0
- package/dist/dispatch/lib/defaults.d.ts.map +1 -0
- package/dist/dispatch/lib/defaults.js +61 -0
- package/dist/dispatch/lib/defaults.js.map +1 -0
- package/dist/dispatch/lib/engine.d.ts +26 -0
- package/dist/dispatch/lib/engine.d.ts.map +1 -0
- package/dist/dispatch/lib/engine.js +46 -0
- package/dist/dispatch/lib/engine.js.map +1 -0
- package/dist/dispatch/lib/exit-codes.d.ts +35 -0
- package/dist/dispatch/lib/exit-codes.d.ts.map +1 -0
- package/dist/dispatch/lib/exit-codes.js +60 -0
- package/dist/dispatch/lib/exit-codes.js.map +1 -0
- package/dist/dispatch/lib/gateway-meta.d.ts +37 -0
- package/dist/dispatch/lib/gateway-meta.d.ts.map +1 -0
- package/dist/dispatch/lib/gateway-meta.js +50 -0
- package/dist/dispatch/lib/gateway-meta.js.map +1 -0
- package/dist/dispatch/lib/job-manager-accessor.d.ts +9 -0
- package/dist/dispatch/lib/job-manager-accessor.d.ts.map +1 -0
- package/dist/dispatch/lib/job-manager-accessor.js +13 -0
- package/dist/dispatch/lib/job-manager-accessor.js.map +1 -0
- package/dist/dispatch/lib/meta.d.ts +26 -0
- package/dist/dispatch/lib/meta.d.ts.map +1 -0
- package/dist/dispatch/lib/meta.js +37 -0
- package/dist/dispatch/lib/meta.js.map +1 -0
- package/dist/dispatch/lib/param-utils.d.ts +11 -0
- package/dist/dispatch/lib/param-utils.d.ts.map +1 -0
- package/dist/dispatch/lib/param-utils.js +10 -0
- package/dist/dispatch/lib/param-utils.js.map +1 -0
- package/dist/dispatch/lib/projections.d.ts +56 -0
- package/dist/dispatch/lib/projections.d.ts.map +1 -0
- package/dist/dispatch/lib/projections.js +65 -0
- package/dist/dispatch/lib/projections.js.map +1 -0
- package/dist/dispatch/lib/proto-envelope.d.ts +56 -0
- package/dist/dispatch/lib/proto-envelope.d.ts.map +1 -0
- package/dist/dispatch/lib/proto-envelope.js +17 -0
- package/dist/dispatch/lib/proto-envelope.js.map +1 -0
- package/dist/dispatch/lib/schema-utils.d.ts +39 -0
- package/dist/dispatch/lib/schema-utils.d.ts.map +1 -0
- package/dist/dispatch/lib/schema-utils.js +88 -0
- package/dist/dispatch/lib/schema-utils.js.map +1 -0
- package/dist/dispatch/lib/security.d.ts +11 -0
- package/dist/dispatch/lib/security.d.ts.map +1 -0
- package/dist/dispatch/lib/security.js +10 -0
- package/dist/dispatch/lib/security.js.map +1 -0
- package/dist/dispatch/middleware/audit.d.ts +23 -0
- package/dist/dispatch/middleware/audit.d.ts.map +1 -0
- package/dist/dispatch/middleware/audit.js +169 -0
- package/dist/dispatch/middleware/audit.js.map +1 -0
- package/dist/dispatch/middleware/field-filter.d.ts +25 -0
- package/dist/dispatch/middleware/field-filter.d.ts.map +1 -0
- package/dist/dispatch/middleware/field-filter.js +70 -0
- package/dist/dispatch/middleware/field-filter.js.map +1 -0
- package/dist/dispatch/middleware/pipeline.d.ts +33 -0
- package/dist/dispatch/middleware/pipeline.d.ts.map +1 -0
- package/dist/dispatch/middleware/pipeline.js +60 -0
- package/dist/dispatch/middleware/pipeline.js.map +1 -0
- package/dist/dispatch/middleware/projection.d.ts +35 -0
- package/dist/dispatch/middleware/projection.d.ts.map +1 -0
- package/dist/dispatch/middleware/projection.js +146 -0
- package/dist/dispatch/middleware/projection.js.map +1 -0
- package/dist/dispatch/middleware/protocol-enforcement.d.ts +30 -0
- package/dist/dispatch/middleware/protocol-enforcement.d.ts.map +1 -0
- package/dist/dispatch/middleware/protocol-enforcement.js +56 -0
- package/dist/dispatch/middleware/protocol-enforcement.js.map +1 -0
- package/dist/dispatch/middleware/rate-limiter.d.ts +72 -0
- package/dist/dispatch/middleware/rate-limiter.d.ts.map +1 -0
- package/dist/dispatch/middleware/rate-limiter.js +127 -0
- package/dist/dispatch/middleware/rate-limiter.js.map +1 -0
- package/dist/dispatch/middleware/sanitizer.d.ts +24 -0
- package/dist/dispatch/middleware/sanitizer.d.ts.map +1 -0
- package/dist/dispatch/middleware/sanitizer.js +56 -0
- package/dist/dispatch/middleware/sanitizer.js.map +1 -0
- package/dist/dispatch/middleware/session-resolver.d.ts +26 -0
- package/dist/dispatch/middleware/session-resolver.d.ts.map +1 -0
- package/dist/dispatch/middleware/session-resolver.js +65 -0
- package/dist/dispatch/middleware/session-resolver.js.map +1 -0
- package/dist/dispatch/middleware/telemetry.d.ts +21 -0
- package/dist/dispatch/middleware/telemetry.d.ts.map +1 -0
- package/dist/dispatch/middleware/telemetry.js +50 -0
- package/dist/dispatch/middleware/telemetry.js.map +1 -0
- package/dist/dispatch/middleware/verification-gates.d.ts +22 -0
- package/dist/dispatch/middleware/verification-gates.d.ts.map +1 -0
- package/dist/dispatch/middleware/verification-gates.js +59 -0
- package/dist/dispatch/middleware/verification-gates.js.map +1 -0
- package/dist/dispatch/registry.d.ts +91 -0
- package/dist/dispatch/registry.d.ts.map +1 -0
- package/dist/dispatch/registry.js +3535 -0
- package/dist/dispatch/registry.js.map +1 -0
- package/dist/dispatch/types.d.ts +206 -0
- package/dist/dispatch/types.d.ts.map +1 -0
- package/dist/dispatch/types.js +27 -0
- package/dist/dispatch/types.js.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Adapter for the CQRS Dispatch Layer.
|
|
3
|
+
*
|
|
4
|
+
* Provides dispatchFromCli() — the single entry point for all CLI commands
|
|
5
|
+
* that route through the dispatch pipeline. Also exports getCliDispatcher()
|
|
6
|
+
* for commands needing custom output handling.
|
|
7
|
+
*
|
|
8
|
+
* @epic T4820
|
|
9
|
+
* @task T4818
|
|
10
|
+
*/
|
|
11
|
+
import { randomUUID } from 'node:crypto';
|
|
12
|
+
import { existsSync } from 'node:fs';
|
|
13
|
+
import { createRequire } from 'node:module';
|
|
14
|
+
import { dirname, join } from 'node:path';
|
|
15
|
+
import { fileURLToPath } from 'node:url';
|
|
16
|
+
import { catalog, registerSkillLibraryFromPath } from '@cleocode/caamp';
|
|
17
|
+
import { autoRecordDispatchTokenUsage, getProjectRoot, hooks } from '@cleocode/core/internal';
|
|
18
|
+
import { cliError, cliOutput } from '../../cli/renderers/index.js';
|
|
19
|
+
import { Dispatcher } from '../dispatcher.js';
|
|
20
|
+
import { createDomainHandlers } from '../domains/index.js';
|
|
21
|
+
import { createAudit } from '../middleware/audit.js';
|
|
22
|
+
import { createFieldFilter } from '../middleware/field-filter.js';
|
|
23
|
+
import { createSanitizer } from '../middleware/sanitizer.js';
|
|
24
|
+
import { createSessionResolver } from '../middleware/session-resolver.js';
|
|
25
|
+
import { createTelemetry } from '../middleware/telemetry.js';
|
|
26
|
+
// Reverse mapping from string error codes to numeric exit codes.
|
|
27
|
+
// Used when dispatch handlers return string error codes without exitCode.
|
|
28
|
+
const ERROR_CODE_TO_EXIT = {
|
|
29
|
+
E_NOT_FOUND: 4,
|
|
30
|
+
E_INVALID_INPUT: 2,
|
|
31
|
+
E_FILE_ERROR: 3,
|
|
32
|
+
E_DEPENDENCY: 5,
|
|
33
|
+
E_VALIDATION: 6,
|
|
34
|
+
E_RETRYABLE: 7,
|
|
35
|
+
E_CONFIG_ERROR: 8,
|
|
36
|
+
E_PARENT_NOT_FOUND: 10,
|
|
37
|
+
E_DEPTH_EXCEEDED: 11,
|
|
38
|
+
E_SIBLING_LIMIT: 12,
|
|
39
|
+
E_CIRCULAR_DEP: 14,
|
|
40
|
+
E_INVALID_PARENT_TYPE: 13,
|
|
41
|
+
E_ORPHAN_DETECTED: 15,
|
|
42
|
+
E_HAS_CHILDREN: 16,
|
|
43
|
+
E_TASK_COMPLETED: 17, // ExitCode.TASK_COMPLETED — canonical value from @cleocode/contracts
|
|
44
|
+
E_HAS_DEPENDENTS: 19,
|
|
45
|
+
E_CHECKSUM_MISMATCH: 20,
|
|
46
|
+
E_SESSION_EXISTS: 30,
|
|
47
|
+
E_SESSION_NOT_FOUND: 31,
|
|
48
|
+
E_SCOPE_CONFLICT: 32,
|
|
49
|
+
E_ACTIVE_TASK_REQUIRED: 38,
|
|
50
|
+
E_INVALID_OPERATION: 2,
|
|
51
|
+
E_MISSING_PARAMS: 2,
|
|
52
|
+
E_NO_HANDLER: 1,
|
|
53
|
+
E_INTERNAL: 1,
|
|
54
|
+
};
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
// CAAMP skill library auto-registration
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
/**
|
|
59
|
+
* Best-effort registration of the CAAMP skill library.
|
|
60
|
+
*
|
|
61
|
+
* Resolves the `@cleocode/skills` package via Node module resolution,
|
|
62
|
+
* falling back to workspace monorepo path. Non-fatal: if the library
|
|
63
|
+
* cannot be found, catalog-dependent operations (skills validate/dispatch/deps)
|
|
64
|
+
* will return a helpful error instead of crashing.
|
|
65
|
+
*/
|
|
66
|
+
function ensureCaampLibrary() {
|
|
67
|
+
// Already registered (e.g. via `cleo init` or env var) — nothing to do
|
|
68
|
+
if (catalog.isCatalogAvailable())
|
|
69
|
+
return;
|
|
70
|
+
try {
|
|
71
|
+
// Strategy 1: resolve @cleocode/skills via Node module resolution
|
|
72
|
+
let skillsRoot = null;
|
|
73
|
+
try {
|
|
74
|
+
const req = createRequire(import.meta.url);
|
|
75
|
+
const skillsPkgJson = req.resolve('@cleocode/skills/package.json');
|
|
76
|
+
const candidate = dirname(skillsPkgJson);
|
|
77
|
+
if (existsSync(join(candidate, 'skills.json'))) {
|
|
78
|
+
skillsRoot = candidate;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Not resolvable — try fallback
|
|
83
|
+
}
|
|
84
|
+
// Strategy 2: workspace monorepo path (packages/skills/)
|
|
85
|
+
if (!skillsRoot) {
|
|
86
|
+
const thisFile = fileURLToPath(import.meta.url);
|
|
87
|
+
const packageRoot = join(dirname(thisFile), '..', '..', '..', '..', '..');
|
|
88
|
+
const candidate = join(packageRoot, 'packages', 'skills');
|
|
89
|
+
if (existsSync(join(candidate, 'skills.json'))) {
|
|
90
|
+
skillsRoot = candidate;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (skillsRoot) {
|
|
94
|
+
registerSkillLibraryFromPath(skillsRoot);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// Non-fatal — catalog operations will degrade gracefully
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
// Lazy singleton dispatcher
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
let _dispatcher = null;
|
|
105
|
+
/**
|
|
106
|
+
* Get or create the singleton CLI dispatcher.
|
|
107
|
+
*
|
|
108
|
+
* Creates a Dispatcher with all 9 domain handlers and sanitizer middleware.
|
|
109
|
+
* No rate limiter — CLI is a single-user tool.
|
|
110
|
+
*/
|
|
111
|
+
export function getCliDispatcher() {
|
|
112
|
+
if (!_dispatcher) {
|
|
113
|
+
_dispatcher = createCliDispatcher();
|
|
114
|
+
}
|
|
115
|
+
return _dispatcher;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Best-effort lookup of the active session ID from SQLite.
|
|
119
|
+
* Used by session-resolver middleware for CLI commands.
|
|
120
|
+
* Returns null on any failure (many CLI commands don't need a session).
|
|
121
|
+
*
|
|
122
|
+
* @epic T4959
|
|
123
|
+
*/
|
|
124
|
+
async function lookupCliSession() {
|
|
125
|
+
try {
|
|
126
|
+
const { getActiveSession } = await import('@cleocode/core/internal');
|
|
127
|
+
const session = await getActiveSession();
|
|
128
|
+
return session?.id ?? null;
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Factory: creates a Dispatcher with all domain handlers + session-resolver,
|
|
136
|
+
* sanitizer, field-filter, and audit middleware.
|
|
137
|
+
*
|
|
138
|
+
* @epic T4959 — added session-resolver + audit to CLI pipeline
|
|
139
|
+
*/
|
|
140
|
+
export function createCliDispatcher() {
|
|
141
|
+
// Ensure the CAAMP skill catalog is available for tools domain operations
|
|
142
|
+
ensureCaampLibrary();
|
|
143
|
+
const handlers = createDomainHandlers();
|
|
144
|
+
return new Dispatcher({
|
|
145
|
+
handlers,
|
|
146
|
+
middlewares: [
|
|
147
|
+
createSessionResolver(lookupCliSession), // T4959: session identity first
|
|
148
|
+
createSanitizer(() => getProjectRoot()),
|
|
149
|
+
createFieldFilter(),
|
|
150
|
+
createAudit(), // T4959: CLI now gets audit trail
|
|
151
|
+
createTelemetry(), // T624: opt-in self-improvement telemetry
|
|
152
|
+
],
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Reset the singleton dispatcher (for testing).
|
|
157
|
+
*/
|
|
158
|
+
export function resetCliDispatcher() {
|
|
159
|
+
_dispatcher = null;
|
|
160
|
+
}
|
|
161
|
+
// ---------------------------------------------------------------------------
|
|
162
|
+
// Main adapter function
|
|
163
|
+
// ---------------------------------------------------------------------------
|
|
164
|
+
/**
|
|
165
|
+
* Build a DispatchRequest, dispatch it, and handle output/errors.
|
|
166
|
+
*
|
|
167
|
+
* This is the primary entry point for migrated CLI commands:
|
|
168
|
+
* await dispatchFromCli('query', 'tasks', 'show', { taskId }, { command: 'show' });
|
|
169
|
+
*
|
|
170
|
+
* Automatically honors global --field/--fields/--mvi flags from the FieldContext:
|
|
171
|
+
* - --field <name> → plain-text extraction, no JSON envelope
|
|
172
|
+
* - --fields <list> → field-filter middleware filters the JSON response
|
|
173
|
+
* - --mvi <level> → envelope verbosity passed to field-filter middleware
|
|
174
|
+
*
|
|
175
|
+
* On success: calls cliOutput(response.data, outputOpts)
|
|
176
|
+
* On error: calls cliError(message, exitCode) + process.exit(exitCode)
|
|
177
|
+
*
|
|
178
|
+
* @epic T4953
|
|
179
|
+
* @task T4955
|
|
180
|
+
*/
|
|
181
|
+
export async function dispatchFromCli(gateway, domain, operation, params, outputOpts) {
|
|
182
|
+
const dispatcher = getCliDispatcher();
|
|
183
|
+
const projectRoot = getProjectRoot();
|
|
184
|
+
const dispatchStart = Date.now();
|
|
185
|
+
// Dispatch PromptSubmit hook (best-effort, fire-and-forget)
|
|
186
|
+
hooks
|
|
187
|
+
.dispatch('PromptSubmit', projectRoot, {
|
|
188
|
+
timestamp: new Date().toISOString(),
|
|
189
|
+
gateway,
|
|
190
|
+
domain,
|
|
191
|
+
operation,
|
|
192
|
+
source: 'cli',
|
|
193
|
+
})
|
|
194
|
+
.catch(() => {
|
|
195
|
+
/* hook errors are non-fatal */
|
|
196
|
+
});
|
|
197
|
+
const response = await dispatcher.dispatch({
|
|
198
|
+
gateway,
|
|
199
|
+
domain,
|
|
200
|
+
operation,
|
|
201
|
+
params,
|
|
202
|
+
source: 'cli',
|
|
203
|
+
requestId: randomUUID(),
|
|
204
|
+
});
|
|
205
|
+
// Dispatch ResponseComplete hook (best-effort, fire-and-forget)
|
|
206
|
+
hooks
|
|
207
|
+
.dispatch('ResponseComplete', projectRoot, {
|
|
208
|
+
timestamp: new Date().toISOString(),
|
|
209
|
+
gateway,
|
|
210
|
+
domain,
|
|
211
|
+
operation,
|
|
212
|
+
success: response.success,
|
|
213
|
+
durationMs: Date.now() - dispatchStart,
|
|
214
|
+
errorCode: response.error?.code,
|
|
215
|
+
})
|
|
216
|
+
.catch(() => {
|
|
217
|
+
/* hook errors are non-fatal */
|
|
218
|
+
});
|
|
219
|
+
if (response.success) {
|
|
220
|
+
await autoRecordDispatchTokenUsage({
|
|
221
|
+
requestPayload: params,
|
|
222
|
+
responsePayload: { data: response.data, page: response.page },
|
|
223
|
+
transport: 'cli',
|
|
224
|
+
gateway,
|
|
225
|
+
domain,
|
|
226
|
+
operation,
|
|
227
|
+
sessionId: response.meta.sessionId,
|
|
228
|
+
requestId: response.meta.requestId,
|
|
229
|
+
cwd: getProjectRoot(),
|
|
230
|
+
});
|
|
231
|
+
const opts = {
|
|
232
|
+
command: outputOpts?.command ?? operation,
|
|
233
|
+
operation: outputOpts?.operation ?? `${domain}.${operation}`,
|
|
234
|
+
...outputOpts,
|
|
235
|
+
};
|
|
236
|
+
if (opts.page === undefined && response.page !== undefined) {
|
|
237
|
+
opts.page = response.page;
|
|
238
|
+
}
|
|
239
|
+
cliOutput(response.data, opts);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
// Derive exit code from the string error code when exitCode is not set
|
|
243
|
+
const errorCode = response.error?.code ?? 'E_GENERAL';
|
|
244
|
+
const exitCode = response.error?.exitCode ?? ERROR_CODE_TO_EXIT[errorCode] ?? 1;
|
|
245
|
+
cliError(response.error?.message ?? 'Unknown error', exitCode, {
|
|
246
|
+
name: errorCode,
|
|
247
|
+
details: response.error?.details,
|
|
248
|
+
fix: response.error?.fix,
|
|
249
|
+
alternatives: response.error?.alternatives,
|
|
250
|
+
}, {
|
|
251
|
+
operation: `${domain}.${operation}`,
|
|
252
|
+
requestId: response.meta.requestId,
|
|
253
|
+
duration_ms: response.meta.duration_ms,
|
|
254
|
+
timestamp: response.meta.timestamp,
|
|
255
|
+
...(response.meta.sessionId ? { sessionId: response.meta.sessionId } : {}),
|
|
256
|
+
});
|
|
257
|
+
process.exit(exitCode);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Handle an error response from dispatchRaw().
|
|
262
|
+
*
|
|
263
|
+
* Calls cliError() and process.exit() when the response indicates failure.
|
|
264
|
+
* No-op when response.success is true.
|
|
265
|
+
*/
|
|
266
|
+
export function handleRawError(response, _opts) {
|
|
267
|
+
if (response.success)
|
|
268
|
+
return;
|
|
269
|
+
const errorCode = response.error?.code ?? 'E_GENERAL';
|
|
270
|
+
const exitCode = response.error?.exitCode ?? ERROR_CODE_TO_EXIT[errorCode] ?? 1;
|
|
271
|
+
cliError(response.error?.message ?? 'Unknown error', exitCode, {
|
|
272
|
+
name: errorCode,
|
|
273
|
+
details: response.error?.details,
|
|
274
|
+
fix: response.error?.fix,
|
|
275
|
+
alternatives: response.error?.alternatives,
|
|
276
|
+
}, {
|
|
277
|
+
operation: _opts.operation,
|
|
278
|
+
requestId: response.meta.requestId,
|
|
279
|
+
duration_ms: response.meta.duration_ms,
|
|
280
|
+
timestamp: response.meta.timestamp,
|
|
281
|
+
...(response.meta.sessionId ? { sessionId: response.meta.sessionId } : {}),
|
|
282
|
+
});
|
|
283
|
+
process.exit(exitCode);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Dispatch and return the raw response without handling output.
|
|
287
|
+
*
|
|
288
|
+
* For commands that need custom output logic (pagination, conditional
|
|
289
|
+
* messages, etc.), call this instead of dispatchFromCli().
|
|
290
|
+
*/
|
|
291
|
+
export async function dispatchRaw(gateway, domain, operation, params) {
|
|
292
|
+
const dispatcher = getCliDispatcher();
|
|
293
|
+
const projectRoot = getProjectRoot();
|
|
294
|
+
const dispatchStart = Date.now();
|
|
295
|
+
// Dispatch PromptSubmit hook (best-effort, fire-and-forget)
|
|
296
|
+
hooks
|
|
297
|
+
.dispatch('PromptSubmit', projectRoot, {
|
|
298
|
+
timestamp: new Date().toISOString(),
|
|
299
|
+
gateway,
|
|
300
|
+
domain,
|
|
301
|
+
operation,
|
|
302
|
+
source: 'cli',
|
|
303
|
+
})
|
|
304
|
+
.catch(() => {
|
|
305
|
+
/* hook errors are non-fatal */
|
|
306
|
+
});
|
|
307
|
+
const response = await dispatcher.dispatch({
|
|
308
|
+
gateway,
|
|
309
|
+
domain,
|
|
310
|
+
operation,
|
|
311
|
+
params,
|
|
312
|
+
source: 'cli',
|
|
313
|
+
requestId: randomUUID(),
|
|
314
|
+
});
|
|
315
|
+
// Dispatch ResponseComplete hook (best-effort, fire-and-forget)
|
|
316
|
+
hooks
|
|
317
|
+
.dispatch('ResponseComplete', projectRoot, {
|
|
318
|
+
timestamp: new Date().toISOString(),
|
|
319
|
+
gateway,
|
|
320
|
+
domain,
|
|
321
|
+
operation,
|
|
322
|
+
success: response.success,
|
|
323
|
+
durationMs: Date.now() - dispatchStart,
|
|
324
|
+
errorCode: response.error?.code,
|
|
325
|
+
})
|
|
326
|
+
.catch(() => {
|
|
327
|
+
/* hook errors are non-fatal */
|
|
328
|
+
});
|
|
329
|
+
return response;
|
|
330
|
+
}
|
|
331
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/dispatch/adapters/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAyB,QAAQ,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC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AAO;QACP,MAAM;QACN,SAAS;QACT,MAAM,EAAE,KAAK;KACd,CAAC;SACD,KAAK,CAAC,GAAG,EAAE;QACV,+BAA+B;IACjC,CAAC,CAAC,CAAC;IAEL,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC;QACzC,OAAO;QACP,MAAM;QACN,SAAS;QACT,MAAM;QACN,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,UAAU,EAAE;KACxB,CAAC,CAAC;IAEH,gEAAgE;IAChE,KAAK;SACF,QAAQ,CAAC,kBAAkB,EAAE,WAAW,EAAE;QACzC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,OAAO;QACP,MAAM;QACN,SAAS;QACT,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,aAAa;QACtC,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI;KAChC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE;QACV,+BAA+B;IACjC,CAAC,CAAC,CAAC;IAEL,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-scoped session context for the CLEO dispatch layer.
|
|
3
|
+
*
|
|
4
|
+
* Each Claude Code conversation spawns its own process, so 5 concurrent
|
|
5
|
+
* agents = 5 isolated SessionContext instances with zero shared state.
|
|
6
|
+
* This replaces the fragile process.env.CLEO_SESSION_ID mechanism.
|
|
7
|
+
*
|
|
8
|
+
* @epic T4959
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Immutable snapshot of the bound session context.
|
|
12
|
+
*/
|
|
13
|
+
export interface SessionContext {
|
|
14
|
+
/** Active session ID. */
|
|
15
|
+
sessionId: string;
|
|
16
|
+
/** Session scope. */
|
|
17
|
+
scope: {
|
|
18
|
+
type: string;
|
|
19
|
+
epicId?: string;
|
|
20
|
+
};
|
|
21
|
+
/** Whether full audit logging is enabled for behavioral grading. */
|
|
22
|
+
gradeMode: boolean;
|
|
23
|
+
/** PID of the process that bound this context. */
|
|
24
|
+
agentPid: number;
|
|
25
|
+
/** ISO timestamp when this context was bound. */
|
|
26
|
+
boundAt: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Bind a session to the current process.
|
|
30
|
+
* Called by session.start mutation handler after successful session creation.
|
|
31
|
+
*
|
|
32
|
+
* @throws if a session is already bound (call unbindSession first).
|
|
33
|
+
*/
|
|
34
|
+
export declare function bindSession(ctx: Omit<SessionContext, 'agentPid' | 'boundAt'>): SessionContext;
|
|
35
|
+
/**
|
|
36
|
+
* Get the currently bound session context, or null if none is bound.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getBoundSession(): SessionContext | null;
|
|
39
|
+
/**
|
|
40
|
+
* Check whether a session is currently bound.
|
|
41
|
+
*/
|
|
42
|
+
export declare function hasSession(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Unbind the current session context.
|
|
45
|
+
* Called by session.end mutation handler.
|
|
46
|
+
*
|
|
47
|
+
* @returns The unbound context, or null if nothing was bound.
|
|
48
|
+
*/
|
|
49
|
+
export declare function unbindSession(): SessionContext | null;
|
|
50
|
+
/**
|
|
51
|
+
* Reset the session context (for testing only).
|
|
52
|
+
*/
|
|
53
|
+
export declare function resetSessionContext(): void;
|
|
54
|
+
//# sourceMappingURL=session-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-context.d.ts","sourceRoot":"","sources":["../../../src/dispatch/context/session-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB;IACrB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,oEAAoE;IACpE,SAAS,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;CACjB;AAQD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,SAAS,CAAC,GAAG,cAAc,CAa7F;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,cAAc,GAAG,IAAI,CAEvD;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,cAAc,GAAG,IAAI,CAIrD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-scoped session context for the CLEO dispatch layer.
|
|
3
|
+
*
|
|
4
|
+
* Each Claude Code conversation spawns its own process, so 5 concurrent
|
|
5
|
+
* agents = 5 isolated SessionContext instances with zero shared state.
|
|
6
|
+
* This replaces the fragile process.env.CLEO_SESSION_ID mechanism.
|
|
7
|
+
*
|
|
8
|
+
* @epic T4959
|
|
9
|
+
*/
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Module-level singleton
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
let _context = null;
|
|
14
|
+
/**
|
|
15
|
+
* Bind a session to the current process.
|
|
16
|
+
* Called by session.start mutation handler after successful session creation.
|
|
17
|
+
*
|
|
18
|
+
* @throws if a session is already bound (call unbindSession first).
|
|
19
|
+
*/
|
|
20
|
+
export function bindSession(ctx) {
|
|
21
|
+
if (_context) {
|
|
22
|
+
throw new Error(`Session already bound: ${_context.sessionId}. ` +
|
|
23
|
+
`Call unbindSession() before binding a new session.`);
|
|
24
|
+
}
|
|
25
|
+
_context = {
|
|
26
|
+
...ctx,
|
|
27
|
+
agentPid: process.pid,
|
|
28
|
+
boundAt: new Date().toISOString(),
|
|
29
|
+
};
|
|
30
|
+
return _context;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get the currently bound session context, or null if none is bound.
|
|
34
|
+
*/
|
|
35
|
+
export function getBoundSession() {
|
|
36
|
+
return _context;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Check whether a session is currently bound.
|
|
40
|
+
*/
|
|
41
|
+
export function hasSession() {
|
|
42
|
+
return _context !== null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Unbind the current session context.
|
|
46
|
+
* Called by session.end mutation handler.
|
|
47
|
+
*
|
|
48
|
+
* @returns The unbound context, or null if nothing was bound.
|
|
49
|
+
*/
|
|
50
|
+
export function unbindSession() {
|
|
51
|
+
const prev = _context;
|
|
52
|
+
_context = null;
|
|
53
|
+
return prev;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Reset the session context (for testing only).
|
|
57
|
+
*/
|
|
58
|
+
export function resetSessionContext() {
|
|
59
|
+
_context = null;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=session-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-context.js","sourceRoot":"","sources":["../../../src/dispatch/context/session-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkBH,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E,IAAI,QAAQ,GAA0B,IAAI,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,GAAiD;IAC3E,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,0BAA0B,QAAQ,CAAC,SAAS,IAAI;YAC9C,oDAAoD,CACvD,CAAC;IACJ,CAAC;IACD,QAAQ,GAAG;QACT,GAAG,GAAG;QACN,QAAQ,EAAE,OAAO,CAAC,GAAG;QACrB,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KAClC,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,QAAQ,KAAK,IAAI,CAAC;AAC3B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,IAAI,GAAG,QAAQ,CAAC;IACtB,QAAQ,GAAG,IAAI,CAAC;IAChB,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,QAAQ,GAAG,IAAI,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central Dispatcher -- Routes requests through middleware to domain handlers.
|
|
3
|
+
*
|
|
4
|
+
* The dispatcher is the single entry point for the CLI adapter.
|
|
5
|
+
* It resolves operations, validates parameters, runs the middleware pipeline,
|
|
6
|
+
* and delegates to the appropriate domain handler.
|
|
7
|
+
*
|
|
8
|
+
* Flow: DispatchRequest → resolve → param validation → middleware → handler
|
|
9
|
+
*
|
|
10
|
+
* @epic T4820
|
|
11
|
+
*/
|
|
12
|
+
import type { DispatchRequest, DispatchResponse, DomainHandler, Middleware } from './types.js';
|
|
13
|
+
export interface DispatcherConfig {
|
|
14
|
+
handlers: Map<string, DomainHandler>;
|
|
15
|
+
middlewares?: Middleware[];
|
|
16
|
+
}
|
|
17
|
+
export declare class Dispatcher {
|
|
18
|
+
private handlers;
|
|
19
|
+
private pipeline;
|
|
20
|
+
constructor(config: DispatcherConfig);
|
|
21
|
+
dispatch(request: DispatchRequest): Promise<DispatchResponse>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=dispatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../src/dispatch/dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE/F,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;CAC5B;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,QAAQ,CAAa;gBAEjB,MAAM,EAAE,gBAAgB;IAO9B,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAuFpE"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central Dispatcher -- Routes requests through middleware to domain handlers.
|
|
3
|
+
*
|
|
4
|
+
* The dispatcher is the single entry point for the CLI adapter.
|
|
5
|
+
* It resolves operations, validates parameters, runs the middleware pipeline,
|
|
6
|
+
* and delegates to the appropriate domain handler.
|
|
7
|
+
*
|
|
8
|
+
* Flow: DispatchRequest → resolve → param validation → middleware → handler
|
|
9
|
+
*
|
|
10
|
+
* @epic T4820
|
|
11
|
+
*/
|
|
12
|
+
import { createDispatchMeta } from './lib/meta.js';
|
|
13
|
+
import { compose } from './middleware/pipeline.js';
|
|
14
|
+
import { resolve, validateRequiredParams } from './registry.js';
|
|
15
|
+
export class Dispatcher {
|
|
16
|
+
handlers;
|
|
17
|
+
pipeline;
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.handlers = config.handlers;
|
|
20
|
+
this.pipeline = config.middlewares?.length
|
|
21
|
+
? compose(config.middlewares)
|
|
22
|
+
: (_req, next) => next();
|
|
23
|
+
}
|
|
24
|
+
async dispatch(request) {
|
|
25
|
+
const startTime = Date.now();
|
|
26
|
+
// 1. Resolve operation from registry
|
|
27
|
+
const resolved = resolve(request.gateway, request.domain, request.operation);
|
|
28
|
+
if (!resolved) {
|
|
29
|
+
return {
|
|
30
|
+
meta: createDispatchMeta(request.gateway, request.domain, request.operation, startTime, request.source, request.requestId),
|
|
31
|
+
success: false,
|
|
32
|
+
error: {
|
|
33
|
+
code: 'E_INVALID_OPERATION',
|
|
34
|
+
message: `Unknown operation: ${request.gateway}:${request.domain}.${request.operation}`,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// 2. Validate required params
|
|
39
|
+
const missing = validateRequiredParams(resolved.def, request.params);
|
|
40
|
+
if (missing.length > 0) {
|
|
41
|
+
return {
|
|
42
|
+
meta: createDispatchMeta(request.gateway, resolved.domain, resolved.operation, startTime, request.source, request.requestId),
|
|
43
|
+
success: false,
|
|
44
|
+
error: {
|
|
45
|
+
code: 'E_MISSING_PARAMS',
|
|
46
|
+
message: `Missing required parameters: ${missing.join(', ')}`,
|
|
47
|
+
details: { missing },
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
// 3. Look up domain handler
|
|
52
|
+
const handler = this.handlers.get(resolved.domain);
|
|
53
|
+
if (!handler) {
|
|
54
|
+
return {
|
|
55
|
+
meta: createDispatchMeta(request.gateway, resolved.domain, resolved.operation, startTime, request.source, request.requestId),
|
|
56
|
+
success: false,
|
|
57
|
+
error: {
|
|
58
|
+
code: 'E_NO_HANDLER',
|
|
59
|
+
message: `No handler for domain: ${resolved.domain}`,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// 4. Run middleware pipeline with terminal handler
|
|
64
|
+
const terminal = async () => {
|
|
65
|
+
if (request.gateway === 'query') {
|
|
66
|
+
return handler.query(resolved.operation, request.params);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return handler.mutate(resolved.operation, request.params);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const response = await this.pipeline(request, terminal);
|
|
73
|
+
// 5. Stamp timing and tracing metadata
|
|
74
|
+
response.meta.duration_ms = Date.now() - startTime;
|
|
75
|
+
response.meta.requestId = request.requestId;
|
|
76
|
+
response.meta.source = request.source;
|
|
77
|
+
// 6. Stamp session identity (T4959)
|
|
78
|
+
if (request.sessionId) {
|
|
79
|
+
response.meta.sessionId = request.sessionId;
|
|
80
|
+
}
|
|
81
|
+
return response;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=dispatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../src/dispatch/dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAQhE,MAAM,OAAO,UAAU;IACb,QAAQ,CAA6B;IACrC,QAAQ,CAAa;IAE7B,YAAY,MAAwB;QAClC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,WAAW,EAAE,MAAM;YACxC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;YAC7B,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAwB;QACrC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,qCAAqC;QACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7E,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO;gBACL,IAAI,EAAE,kBAAkB,CACtB,OAAO,CAAC,OA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,cAAc;oBACpB,OAAO,EAAE,0BAA0B,QAAQ,CAAC,MAAM,EAAE;iBACrD;aACF,CAAC;QACJ,CAAC;QAED,mDAAmD;QACnD,MAAM,QAAQ,GAAG,KAAK,IAA+B,EAAE;YACrD,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;gBAChC,OAAO,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YAC3D,CAAC;iBAAM,CAAC;gBACN,OAAO,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAExD,uCAAuC;QACvC,QAAQ,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QACnD,QAAQ,CAAC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAC5C,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAEtC,oCAAoC;QACpC,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,QAAQ,CAAC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAC9C,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared base helpers for domain handlers.
|
|
3
|
+
* DRY utility -- extracts the 4 common patterns found in all domain handlers.
|
|
4
|
+
*
|
|
5
|
+
* All functions are standalone (not a class) to match the function-based helper style.
|
|
6
|
+
* Handlers call these instead of re-implementing wrapEngineResult, errorResponse, etc.
|
|
7
|
+
*
|
|
8
|
+
* @epic T5671
|
|
9
|
+
*/
|
|
10
|
+
import type { ProblemDetails } from '@cleocode/core';
|
|
11
|
+
import type { DispatchResponse } from '../types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Engine result shape accepted by wrapResult.
|
|
14
|
+
* Matches the union of what all engine functions return.
|
|
15
|
+
*/
|
|
16
|
+
export interface EngineResult {
|
|
17
|
+
success: boolean;
|
|
18
|
+
data?: unknown;
|
|
19
|
+
page?: import('@cleocode/lafs').LAFSPage;
|
|
20
|
+
error?: {
|
|
21
|
+
code: string;
|
|
22
|
+
message: string;
|
|
23
|
+
details?: unknown;
|
|
24
|
+
exitCode?: number;
|
|
25
|
+
fix?: string;
|
|
26
|
+
alternatives?: Array<{
|
|
27
|
+
action: string;
|
|
28
|
+
command: string;
|
|
29
|
+
}>;
|
|
30
|
+
problemDetails?: ProblemDetails;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Wrap a native engine result into a DispatchResponse.
|
|
35
|
+
* Handles success data, page metadata, and structured errors.
|
|
36
|
+
*/
|
|
37
|
+
export declare function wrapResult(result: EngineResult, gateway: string, domain: string, operation: string, startTime: number): DispatchResponse;
|
|
38
|
+
/**
|
|
39
|
+
* Return a standard error response.
|
|
40
|
+
*/
|
|
41
|
+
export declare function errorResult(gateway: string, domain: string, operation: string, code: string, message: string, startTime: number): DispatchResponse;
|
|
42
|
+
/**
|
|
43
|
+
* Return a standard "unsupported operation" error response.
|
|
44
|
+
*/
|
|
45
|
+
export declare function unsupportedOp(gateway: string, domain: string, operation: string, startTime: number): DispatchResponse;
|
|
46
|
+
/**
|
|
47
|
+
* Extract limit and offset pagination params from a params dict.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getListParams(params?: Record<string, unknown>): {
|
|
50
|
+
limit?: number;
|
|
51
|
+
offset?: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Handle a caught error: extract message and return an internal error response.
|
|
55
|
+
* Callers should log the error themselves (with their domain-specific logger)
|
|
56
|
+
* before or after calling this.
|
|
57
|
+
*/
|
|
58
|
+
export declare function handleErrorResult(gateway: string, domain: string, operation: string, error: unknown, startTime: number): DispatchResponse;
|
|
59
|
+
//# sourceMappingURL=_base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_base.d.ts","sourceRoot":"","sources":["../../../src/dispatch/domains/_base.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,gBAAgB,EAAE,QAAQ,CAAC;IACzC,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,YAAY,CAAC,EAAE,KAAK,CAAC;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC1D,cAAc,CAAC,EAAE,cAAc,CAAC;KACjC,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,gBAAgB,CAoBlB;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,SAAS,EAAE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