@cleocode/cleo 2026.4.9 → 2026.4.11
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/add.d.ts +12 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +98 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/admin.d.ts +12 -0
- package/dist/cli/commands/admin.d.ts.map +1 -0
- package/dist/cli/commands/admin.js +59 -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 +38 -0
- package/dist/cli/commands/agent.d.ts.map +1 -0
- package/dist/cli/commands/agent.js +1125 -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 +147 -0
- package/dist/cli/commands/backfill.js.map +1 -0
- package/dist/cli/commands/backup.d.ts +8 -0
- package/dist/cli/commands/backup.d.ts.map +1 -0
- package/dist/cli/commands/backup.js +35 -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 +107 -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/cant.d.ts +32 -0
- package/dist/cli/commands/cant.d.ts.map +1 -0
- package/dist/cli/commands/cant.js +281 -0
- package/dist/cli/commands/cant.js.map +1 -0
- package/dist/cli/commands/check.d.ts +22 -0
- package/dist/cli/commands/check.d.ts.map +1 -0
- package/dist/cli/commands/check.js +164 -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/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 +43 -0
- package/dist/cli/commands/complete.js.map +1 -0
- package/dist/cli/commands/compliance.d.ts +8 -0
- package/dist/cli/commands/compliance.d.ts.map +1 -0
- package/dist/cli/commands/compliance.js +85 -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 +8 -0
- package/dist/cli/commands/context.d.ts.map +1 -0
- package/dist/cli/commands/context.js +40 -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 +24 -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 +424 -0
- package/dist/cli/commands/detect-drift.js.map +1 -0
- package/dist/cli/commands/detect.d.ts +10 -0
- package/dist/cli/commands/detect.d.ts.map +1 -0
- package/dist/cli/commands/detect.js +24 -0
- package/dist/cli/commands/detect.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 +22 -0
- package/dist/cli/commands/exists.d.ts.map +1 -0
- package/dist/cli/commands/exists.js +51 -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 +70 -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 +30 -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/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 +13 -0
- package/dist/cli/commands/labels.d.ts.map +1 -0
- package/dist/cli/commands/labels.js +44 -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 +84 -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 +71 -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 +14 -0
- package/dist/cli/commands/memory-brain.d.ts.map +1 -0
- package/dist/cli/commands/memory-brain.js +157 -0
- package/dist/cli/commands/memory-brain.js.map +1 -0
- package/dist/cli/commands/migrate-claude-mem.d.ts +18 -0
- package/dist/cli/commands/migrate-claude-mem.d.ts.map +1 -0
- package/dist/cli/commands/migrate-claude-mem.js +60 -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 +16 -0
- package/dist/cli/commands/nexus.d.ts.map +1 -0
- package/dist/cli/commands/nexus.js +155 -0
- package/dist/cli/commands/nexus.js.map +1 -0
- package/dist/cli/commands/observe.d.ts +9 -0
- package/dist/cli/commands/observe.d.ts.map +1 -0
- package/dist/cli/commands/observe.js +39 -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 +8 -0
- package/dist/cli/commands/orchestrate.d.ts.map +1 -0
- package/dist/cli/commands/orchestrate.js +58 -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 +12 -0
- package/dist/cli/commands/phases.d.ts.map +1 -0
- package/dist/cli/commands/phases.js +37 -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 +7 -0
- package/dist/cli/commands/promote.d.ts.map +1 -0
- package/dist/cli/commands/promote.js +15 -0
- package/dist/cli/commands/promote.js.map +1 -0
- package/dist/cli/commands/reason.d.ts +35 -0
- package/dist/cli/commands/reason.d.ts.map +1 -0
- package/dist/cli/commands/reason.js +104 -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 +72 -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 +7 -0
- package/dist/cli/commands/reorder.d.ts.map +1 -0
- package/dist/cli/commands/reorder.js +20 -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 +129 -0
- package/dist/cli/commands/research.js.map +1 -0
- package/dist/cli/commands/restore.d.ts +11 -0
- package/dist/cli/commands/restore.d.ts.map +1 -0
- package/dist/cli/commands/restore.js +224 -0
- package/dist/cli/commands/restore.js.map +1 -0
- package/dist/cli/commands/roadmap.d.ts +8 -0
- package/dist/cli/commands/roadmap.d.ts.map +1 -0
- package/dist/cli/commands/roadmap.js +21 -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/self-update.d.ts +15 -0
- package/dist/cli/commands/self-update.d.ts.map +1 -0
- package/dist/cli/commands/self-update.js +329 -0
- package/dist/cli/commands/self-update.js.map +1 -0
- package/dist/cli/commands/sequence.d.ts +8 -0
- package/dist/cli/commands/sequence.d.ts.map +1 -0
- package/dist/cli/commands/sequence.js +30 -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 +175 -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 +20 -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 +131 -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 +211 -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/testing.d.ts +13 -0
- package/dist/cli/commands/testing.d.ts.map +1 -0
- package/dist/cli/commands/testing.js +64 -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 +23 -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 +13 -0
- package/dist/cli/commands/web.d.ts.map +1 -0
- package/dist/cli/commands/web.js +277 -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/index.d.ts +9 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +3931 -3401
- package/dist/cli/index.js.map +4 -4
- 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 +59 -0
- package/dist/cli/renderers/index.d.ts.map +1 -0
- package/dist/cli/renderers/index.js +208 -0
- package/dist/cli/renderers/index.js.map +1 -0
- package/dist/cli/renderers/lafs-validator.d.ts +97 -0
- package/dist/cli/renderers/lafs-validator.d.ts.map +1 -0
- package/dist/cli/renderers/lafs-validator.js +229 -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 +262 -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 +719 -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 +360 -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 +247 -0
- package/dist/dispatch/domains/conduit.js.map +1 -0
- package/dist/dispatch/domains/index.d.ts +27 -0
- package/dist/dispatch/domains/index.d.ts.map +1 -0
- package/dist/dispatch/domains/index.js +40 -0
- package/dist/dispatch/domains/index.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 +303 -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 +19 -0
- package/dist/dispatch/domains/orchestrate.d.ts.map +1 -0
- package/dist/dispatch/domains/orchestrate.js +259 -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 +257 -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 +164 -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 +361 -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 +85 -0
- package/dist/dispatch/engines/_error.d.ts.map +1 -0
- package/dist/dispatch/engines/_error.js +244 -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/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 +133 -0
- package/dist/dispatch/engines/orchestrate-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/orchestrate-engine.js +769 -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 +383 -0
- package/dist/dispatch/engines/session-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/session-engine.js +960 -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 +539 -0
- package/dist/dispatch/engines/system-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/system-engine.js +1266 -0
- package/dist/dispatch/engines/system-engine.js.map +1 -0
- package/dist/dispatch/engines/task-engine.d.ts +1055 -0
- package/dist/dispatch/engines/task-engine.d.ts.map +1 -0
- package/dist/dispatch/engines/task-engine.js +1387 -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 +636 -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 +35 -0
- package/dist/dispatch/lib/budget.d.ts.map +1 -0
- package/dist/dispatch/lib/budget.js +102 -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 +117 -0
- package/dist/dispatch/lib/defaults.d.ts.map +1 -0
- package/dist/dispatch/lib/defaults.js +58 -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/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/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 +24 -0
- package/dist/dispatch/middleware/field-filter.d.ts.map +1 -0
- package/dist/dispatch/middleware/field-filter.js +65 -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 +27 -0
- package/dist/dispatch/middleware/protocol-enforcement.d.ts.map +1 -0
- package/dist/dispatch/middleware/protocol-enforcement.js +45 -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/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 +3133 -0
- package/dist/dispatch/registry.js.map +1 -0
- package/dist/dispatch/types.d.ts +202 -0
- package/dist/dispatch/types.d.ts.map +1 -0
- package/dist/dispatch/types.js +26 -0
- package/dist/dispatch/types.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LAFS Field Filter Middleware
|
|
3
|
+
*
|
|
4
|
+
* Implements LAFS _fields parameter (field selection) and _mvi envelope verbosity.
|
|
5
|
+
* Extracts _fields and _mvi from params (for callers that pass them as params),
|
|
6
|
+
* stores them on the request, and post-processes the response via the canonical
|
|
7
|
+
* SDK utilities from @cleocode/lafs v1.5.0.
|
|
8
|
+
*
|
|
9
|
+
* @epic T4820
|
|
10
|
+
* @task T4979
|
|
11
|
+
*/
|
|
12
|
+
import type { Middleware } from '../types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Create the LAFS field-filter middleware.
|
|
15
|
+
*
|
|
16
|
+
* Handles:
|
|
17
|
+
* - _fields: filter response data to specified fields (delegates to SDK applyFieldFilter)
|
|
18
|
+
* - _mvi: envelope verbosity — stored on request for downstream use
|
|
19
|
+
*
|
|
20
|
+
* _fields and _mvi are extracted from req.params (for callers that pass
|
|
21
|
+
* them as params) and stored on the DispatchRequest before the domain handler runs.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createFieldFilter(): Middleware;
|
|
24
|
+
//# sourceMappingURL=field-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-filter.d.ts","sourceRoot":"","sources":["../../../src/dispatch/middleware/field-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAqC,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjF;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,UAAU,CA+C9C"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LAFS Field Filter Middleware
|
|
3
|
+
*
|
|
4
|
+
* Implements LAFS _fields parameter (field selection) and _mvi envelope verbosity.
|
|
5
|
+
* Extracts _fields and _mvi from params (for callers that pass them as params),
|
|
6
|
+
* stores them on the request, and post-processes the response via the canonical
|
|
7
|
+
* SDK utilities from @cleocode/lafs v1.5.0.
|
|
8
|
+
*
|
|
9
|
+
* @epic T4820
|
|
10
|
+
* @task T4979
|
|
11
|
+
*/
|
|
12
|
+
import { isMVILevel, applyFieldFilter as sdkApplyFieldFilter } from '@cleocode/lafs';
|
|
13
|
+
/**
|
|
14
|
+
* Create the LAFS field-filter middleware.
|
|
15
|
+
*
|
|
16
|
+
* Handles:
|
|
17
|
+
* - _fields: filter response data to specified fields (delegates to SDK applyFieldFilter)
|
|
18
|
+
* - _mvi: envelope verbosity — stored on request for downstream use
|
|
19
|
+
*
|
|
20
|
+
* _fields and _mvi are extracted from req.params (for callers that pass
|
|
21
|
+
* them as params) and stored on the DispatchRequest before the domain handler runs.
|
|
22
|
+
*/
|
|
23
|
+
export function createFieldFilter() {
|
|
24
|
+
return async (req, next) => {
|
|
25
|
+
// Extract control params from req.params (callers may pass them here)
|
|
26
|
+
const _fields = req._fields ?? req.params?._fields;
|
|
27
|
+
const rawMvi = req._mvi ?? req.params?._mvi;
|
|
28
|
+
const _mvi = isMVILevel(rawMvi) ? rawMvi : undefined;
|
|
29
|
+
// Remove from params so domain handlers don't see them
|
|
30
|
+
if (req.params) {
|
|
31
|
+
delete req.params['_fields'];
|
|
32
|
+
delete req.params['_mvi'];
|
|
33
|
+
}
|
|
34
|
+
// Store on request for potential downstream use
|
|
35
|
+
if (_fields)
|
|
36
|
+
req._fields = _fields;
|
|
37
|
+
if (_mvi)
|
|
38
|
+
req._mvi = _mvi;
|
|
39
|
+
const response = await next();
|
|
40
|
+
// Apply _fields filter via SDK — handles all four result shapes,
|
|
41
|
+
// preserves envelope structure, sets _meta.mvi = 'custom' per §9.1
|
|
42
|
+
if (_fields?.length && response.success && response.data !== undefined) {
|
|
43
|
+
const stub = {
|
|
44
|
+
$schema: 'https://lafs.dev/schemas/v1/envelope.schema.json',
|
|
45
|
+
_meta: {
|
|
46
|
+
specVersion: '',
|
|
47
|
+
schemaVersion: '',
|
|
48
|
+
timestamp: response._meta.timestamp,
|
|
49
|
+
operation: response._meta.operation,
|
|
50
|
+
requestId: response._meta.requestId,
|
|
51
|
+
transport: 'sdk',
|
|
52
|
+
strict: true,
|
|
53
|
+
mvi: 'minimal',
|
|
54
|
+
contextVersion: 0,
|
|
55
|
+
},
|
|
56
|
+
success: true,
|
|
57
|
+
result: response.data,
|
|
58
|
+
};
|
|
59
|
+
const filtered = sdkApplyFieldFilter(stub, _fields);
|
|
60
|
+
response.data = filtered.result;
|
|
61
|
+
}
|
|
62
|
+
return response;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=field-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-filter.js","sourceRoot":"","sources":["../../../src/dispatch/middleware/field-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,UAAU,EAAE,gBAAgB,IAAI,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGrF;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,KAAK,EACV,GAAoB,EACpB,IAAqC,EACV,EAAE;QAC7B,sEAAsE;QACtE,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,IAAK,GAAG,CAAC,MAAM,EAAE,OAAgC,CAAC;QAC7E,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,IAAK,GAAG,CAAC,MAAM,EAAE,IAA2B,CAAC;QACpE,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;QAErD,uDAAuD;QACvD,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACf,OAAO,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC7B,OAAO,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QAED,gDAAgD;QAChD,IAAI,OAAO;YAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACnC,IAAI,IAAI;YAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;QAE1B,MAAM,QAAQ,GAAG,MAAM,IAAI,EAAE,CAAC;QAE9B,iEAAiE;QACjE,mEAAmE;QACnE,IAAI,OAAO,EAAE,MAAM,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACvE,MAAM,IAAI,GAAiB;gBACzB,OAAO,EAAE,kDAAkD;gBAC3D,KAAK,EAAE;oBACL,WAAW,EAAE,EAAE;oBACf,aAAa,EAAE,EAAE;oBACjB,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS;oBACnC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS;oBACnC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS;oBACnC,SAAS,EAAE,KAAK;oBAChB,MAAM,EAAE,IAAI;oBACZ,GAAG,EAAE,SAAS;oBACd,cAAc,EAAE,CAAC;iBAClB;gBACD,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,QAAQ,CAAC,IAA8B;aAChD,CAAC;YACF,MAAM,QAAQ,GAAG,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACpD,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC;QAClC,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified CQRS Dispatch Layer -- Middleware Pipeline
|
|
3
|
+
*
|
|
4
|
+
* Provides compose() to chain multiple Middleware functions together
|
|
5
|
+
* into a single executable pipeline.
|
|
6
|
+
*
|
|
7
|
+
* @epic T4820
|
|
8
|
+
* @task T4815
|
|
9
|
+
*/
|
|
10
|
+
import type { Middleware } from '../types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Composes an array of Middleware functions into a single Middleware function.
|
|
13
|
+
* Execution flows through the array from first to last, and returns bubble
|
|
14
|
+
* back up from last to first.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Uses an index-tracked dispatch function to prevent `next()` from being
|
|
18
|
+
* called multiple times within a single middleware. If the array is empty,
|
|
19
|
+
* a passthrough middleware that immediately calls `next()` is returned.
|
|
20
|
+
*
|
|
21
|
+
* @param middlewares - Array of middleware functions to chain
|
|
22
|
+
* @returns A single composed Middleware function
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { compose } from './pipeline.js';
|
|
27
|
+
*
|
|
28
|
+
* const pipeline = compose([sanitizer, rateLimiter, protocolEnforcement]);
|
|
29
|
+
* const response = await pipeline(request, handler);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function compose(middlewares: Middleware[]): Middleware;
|
|
33
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/dispatch/middleware/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAmD,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,OAAO,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAkC7D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified CQRS Dispatch Layer -- Middleware Pipeline
|
|
3
|
+
*
|
|
4
|
+
* Provides compose() to chain multiple Middleware functions together
|
|
5
|
+
* into a single executable pipeline.
|
|
6
|
+
*
|
|
7
|
+
* @epic T4820
|
|
8
|
+
* @task T4815
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Composes an array of Middleware functions into a single Middleware function.
|
|
12
|
+
* Execution flows through the array from first to last, and returns bubble
|
|
13
|
+
* back up from last to first.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Uses an index-tracked dispatch function to prevent `next()` from being
|
|
17
|
+
* called multiple times within a single middleware. If the array is empty,
|
|
18
|
+
* a passthrough middleware that immediately calls `next()` is returned.
|
|
19
|
+
*
|
|
20
|
+
* @param middlewares - Array of middleware functions to chain
|
|
21
|
+
* @returns A single composed Middleware function
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { compose } from './pipeline.js';
|
|
26
|
+
*
|
|
27
|
+
* const pipeline = compose([sanitizer, rateLimiter, protocolEnforcement]);
|
|
28
|
+
* const response = await pipeline(request, handler);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function compose(middlewares) {
|
|
32
|
+
if (middlewares.length === 0) {
|
|
33
|
+
return async (_req, next) => next();
|
|
34
|
+
}
|
|
35
|
+
return async (request, next) => {
|
|
36
|
+
let index = -1;
|
|
37
|
+
async function dispatch(i) {
|
|
38
|
+
if (i <= index) {
|
|
39
|
+
throw new Error('next() called multiple times in middleware');
|
|
40
|
+
}
|
|
41
|
+
index = i;
|
|
42
|
+
let fn = middlewares[i];
|
|
43
|
+
if (i === middlewares.length) {
|
|
44
|
+
// We've reached the end of the middleware chain; call the final handler
|
|
45
|
+
fn = async (_req, nxt) => nxt();
|
|
46
|
+
}
|
|
47
|
+
if (!fn) {
|
|
48
|
+
return next();
|
|
49
|
+
}
|
|
50
|
+
return fn(request, async () => {
|
|
51
|
+
if (i === middlewares.length) {
|
|
52
|
+
return next();
|
|
53
|
+
}
|
|
54
|
+
return dispatch(i + 1);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return dispatch(0);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../../src/dispatch/middleware/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,OAAO,CAAC,WAAyB;IAC/C,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,EAAE,IAAqB,EAAE,IAAkB,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IACrE,CAAC;IAED,OAAO,KAAK,EAAE,OAAwB,EAAE,IAAkB,EAA6B,EAAE;QACvF,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;QAEf,KAAK,UAAU,QAAQ,CAAC,CAAS;YAC/B,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;YAChE,CAAC;YACD,KAAK,GAAG,CAAC,CAAC;YAEV,IAAI,EAAE,GAA2B,WAAW,CAAC,CAAC,CAAC,CAAC;YAChD,IAAI,CAAC,KAAK,WAAW,CAAC,MAAM,EAAE,CAAC;gBAC7B,wEAAwE;gBACxE,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;YAClC,CAAC;YAED,IAAI,CAAC,EAAE,EAAE,CAAC;gBACR,OAAO,IAAI,EAAE,CAAC;YAChB,CAAC;YAED,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;gBAC5B,IAAI,CAAC,KAAK,WAAW,CAAC,MAAM,EAAE,CAAC;oBAC7B,OAAO,IAAI,EAAE,CAAC;gBAChB,CAAC;gBACD,OAAO,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACzB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MVI projection middleware.
|
|
3
|
+
* Reads _mviTier from request params and filters response fields accordingly.
|
|
4
|
+
* If the domain is not allowed at the resolved tier, short-circuits with an error.
|
|
5
|
+
*
|
|
6
|
+
* @epic T4820
|
|
7
|
+
* @task T5096
|
|
8
|
+
*/
|
|
9
|
+
import { type MviTier, type ProjectionConfig } from '../lib/projections.js';
|
|
10
|
+
import type { Middleware } from '../types.js';
|
|
11
|
+
export interface ProjectionContext {
|
|
12
|
+
tier: MviTier;
|
|
13
|
+
config: ProjectionConfig;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Check if a domain is allowed at the given tier.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isOperationAllowed(domain: string, tier: MviTier): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Apply field projection to a result object.
|
|
21
|
+
* Removes fields that are excluded at the given tier and prunes depth.
|
|
22
|
+
*/
|
|
23
|
+
export declare function applyProjection<T>(data: T, config: ProjectionConfig): T;
|
|
24
|
+
/**
|
|
25
|
+
* Create projection context from request params.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createProjectionContext(params?: Record<string, unknown>): ProjectionContext;
|
|
28
|
+
/**
|
|
29
|
+
* Create the MVI projection middleware.
|
|
30
|
+
*
|
|
31
|
+
* Extracts _mviTier from params, checks domain access, and applies
|
|
32
|
+
* field exclusions to the response.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createProjectionMiddleware(): Middleware;
|
|
35
|
+
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../../src/dispatch/middleware/projection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,KAAK,OAAO,EAEZ,KAAK,gBAAgB,EAEtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAqC,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAEzE;AAiCD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,gBAAgB,GAAG,CAAC,CAuCvE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAG3F;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,IAAI,UAAU,CAsDvD"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MVI projection middleware.
|
|
3
|
+
* Reads _mviTier from request params and filters response fields accordingly.
|
|
4
|
+
* If the domain is not allowed at the resolved tier, short-circuits with an error.
|
|
5
|
+
*
|
|
6
|
+
* @epic T4820
|
|
7
|
+
* @task T5096
|
|
8
|
+
*/
|
|
9
|
+
import { getBoundSession } from '../context/session-context.js';
|
|
10
|
+
import { PROJECTIONS, resolveTier, } from '../lib/projections.js';
|
|
11
|
+
/**
|
|
12
|
+
* Check if a domain is allowed at the given tier.
|
|
13
|
+
*/
|
|
14
|
+
export function isOperationAllowed(domain, tier) {
|
|
15
|
+
return PROJECTIONS[tier].allowedDomains.includes(domain);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Recursively prune data beyond maxDepth.
|
|
19
|
+
* At maxDepth, objects become '[Object]' and arrays become '[Array(N)]'.
|
|
20
|
+
*/
|
|
21
|
+
function pruneDepth(data, maxDepth, currentDepth = 0) {
|
|
22
|
+
// Primitives pass through at any depth
|
|
23
|
+
if (data === null || data === undefined || typeof data !== 'object') {
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
// At max depth, replace with placeholder
|
|
27
|
+
if (currentDepth >= maxDepth) {
|
|
28
|
+
if (Array.isArray(data)) {
|
|
29
|
+
return `[Array(${data.length})]`;
|
|
30
|
+
}
|
|
31
|
+
return '[Object]';
|
|
32
|
+
}
|
|
33
|
+
// Recurse into arrays
|
|
34
|
+
if (Array.isArray(data)) {
|
|
35
|
+
return data.map((item) => pruneDepth(item, maxDepth, currentDepth + 1));
|
|
36
|
+
}
|
|
37
|
+
// Recurse into objects
|
|
38
|
+
const result = {};
|
|
39
|
+
for (const [key, value] of Object.entries(data)) {
|
|
40
|
+
result[key] = pruneDepth(value, maxDepth, currentDepth + 1);
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Apply field projection to a result object.
|
|
46
|
+
* Removes fields that are excluded at the given tier and prunes depth.
|
|
47
|
+
*/
|
|
48
|
+
export function applyProjection(data, config) {
|
|
49
|
+
if (!data || typeof data !== 'object')
|
|
50
|
+
return data;
|
|
51
|
+
let result = data;
|
|
52
|
+
// Apply field exclusions
|
|
53
|
+
if (config.excludeFields?.length) {
|
|
54
|
+
const obj = { ...data };
|
|
55
|
+
for (const field of config.excludeFields) {
|
|
56
|
+
const parts = field.split('.');
|
|
57
|
+
if (parts.length === 1) {
|
|
58
|
+
delete obj[parts[0]];
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// Handle nested fields like 'metadata._internal'
|
|
62
|
+
let current = obj;
|
|
63
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
64
|
+
const val = current?.[parts[i]];
|
|
65
|
+
if (val && typeof val === 'object') {
|
|
66
|
+
current[parts[i]] = { ...val };
|
|
67
|
+
current = current[parts[i]];
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
current = undefined;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (current) {
|
|
75
|
+
delete current[parts[parts.length - 1]];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
result = obj;
|
|
80
|
+
}
|
|
81
|
+
// Apply depth pruning
|
|
82
|
+
if (config.maxDepth !== undefined) {
|
|
83
|
+
result = pruneDepth(result, config.maxDepth);
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Create projection context from request params.
|
|
89
|
+
*/
|
|
90
|
+
export function createProjectionContext(params) {
|
|
91
|
+
const tier = resolveTier(params);
|
|
92
|
+
return { tier, config: PROJECTIONS[tier] };
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Create the MVI projection middleware.
|
|
96
|
+
*
|
|
97
|
+
* Extracts _mviTier from params, checks domain access, and applies
|
|
98
|
+
* field exclusions to the response.
|
|
99
|
+
*/
|
|
100
|
+
export function createProjectionMiddleware() {
|
|
101
|
+
return async (req, next) => {
|
|
102
|
+
const session = getBoundSession();
|
|
103
|
+
const tier = resolveTier(req.params, session?.scope ?? null);
|
|
104
|
+
const config = PROJECTIONS[tier];
|
|
105
|
+
// Remove control param so domain handlers don't see it
|
|
106
|
+
if (req.params) {
|
|
107
|
+
delete req.params['_mviTier'];
|
|
108
|
+
}
|
|
109
|
+
// Smart defaults: tasks.list defaults to compact mode for non-CLI sources.
|
|
110
|
+
// CLI is the only source — compact injection applies to non-CLI callers.
|
|
111
|
+
if (req.domain === 'tasks' && req.operation === 'list' && req.source !== 'cli') {
|
|
112
|
+
req.params ??= {};
|
|
113
|
+
if (req.params['compact'] === undefined) {
|
|
114
|
+
req.params['compact'] = true;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Check domain access at this tier
|
|
118
|
+
if (!config.allowedDomains.includes(req.domain)) {
|
|
119
|
+
return {
|
|
120
|
+
_meta: {
|
|
121
|
+
gateway: req.gateway,
|
|
122
|
+
domain: req.domain,
|
|
123
|
+
operation: req.operation,
|
|
124
|
+
version: '1.0.0',
|
|
125
|
+
timestamp: new Date().toISOString(),
|
|
126
|
+
duration_ms: 0,
|
|
127
|
+
source: req.source,
|
|
128
|
+
requestId: req.requestId,
|
|
129
|
+
},
|
|
130
|
+
success: false,
|
|
131
|
+
error: {
|
|
132
|
+
code: 'E_INVALID_OPERATION',
|
|
133
|
+
exitCode: 2,
|
|
134
|
+
message: `Operation not available at '${tier}' tier. Domain '${req.domain}' requires a higher tier.`,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const response = await next();
|
|
139
|
+
// Apply field exclusions to successful responses
|
|
140
|
+
if (response.success && response.data !== undefined) {
|
|
141
|
+
response.data = applyProjection(response.data, config);
|
|
142
|
+
}
|
|
143
|
+
return response;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../../src/dispatch/middleware/projection.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Middleware } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a middleware that enforces protocol compliance.
|
|
4
|
+
*
|
|
5
|
+
* Delegates to ProtocolEnforcer.enforceProtocol() which:
|
|
6
|
+
* - Passes through query operations untouched
|
|
7
|
+
* - Passes through mutate operations that don't require validation
|
|
8
|
+
* - Validates protocol compliance on validated mutate operations after execution
|
|
9
|
+
* - In strict mode, blocks operations with protocol violations (exit codes 60-70)
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* The middleware ensures that DispatchResponse `_meta` fields (source, requestId)
|
|
13
|
+
* are always populated, even when ProtocolEnforcer returns a DomainResponse that
|
|
14
|
+
* lacks them. This prevents downstream consumers from encountering undefined values.
|
|
15
|
+
*
|
|
16
|
+
* @param strictMode - When true, blocks operations that violate protocol rules
|
|
17
|
+
* @returns Middleware function that enforces protocol compliance
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { createProtocolEnforcement } from './protocol-enforcement.js';
|
|
22
|
+
*
|
|
23
|
+
* const enforcement = createProtocolEnforcement(true);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function createProtocolEnforcement(strictMode?: boolean): Middleware;
|
|
27
|
+
//# sourceMappingURL=protocol-enforcement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol-enforcement.d.ts","sourceRoot":"","sources":["../../../src/dispatch/middleware/protocol-enforcement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmD,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,GAAE,OAAc,GAAG,UAAU,CAqBhF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ProtocolEnforcer } from '@cleocode/core/internal';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a middleware that enforces protocol compliance.
|
|
4
|
+
*
|
|
5
|
+
* Delegates to ProtocolEnforcer.enforceProtocol() which:
|
|
6
|
+
* - Passes through query operations untouched
|
|
7
|
+
* - Passes through mutate operations that don't require validation
|
|
8
|
+
* - Validates protocol compliance on validated mutate operations after execution
|
|
9
|
+
* - In strict mode, blocks operations with protocol violations (exit codes 60-70)
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* The middleware ensures that DispatchResponse `_meta` fields (source, requestId)
|
|
13
|
+
* are always populated, even when ProtocolEnforcer returns a DomainResponse that
|
|
14
|
+
* lacks them. This prevents downstream consumers from encountering undefined values.
|
|
15
|
+
*
|
|
16
|
+
* @param strictMode - When true, blocks operations that violate protocol rules
|
|
17
|
+
* @returns Middleware function that enforces protocol compliance
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { createProtocolEnforcement } from './protocol-enforcement.js';
|
|
22
|
+
*
|
|
23
|
+
* const enforcement = createProtocolEnforcement(true);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function createProtocolEnforcement(strictMode = true) {
|
|
27
|
+
const enforcer = new ProtocolEnforcer(strictMode);
|
|
28
|
+
return async (req, next) => {
|
|
29
|
+
const result = await enforcer.enforceProtocol(req, next);
|
|
30
|
+
// enforceProtocol may return a DomainResponse (missing source/requestId on _meta)
|
|
31
|
+
// when it constructs an error response. Ensure _meta has required DispatchResponse fields.
|
|
32
|
+
if (!result._meta.source || !result._meta.requestId) {
|
|
33
|
+
return {
|
|
34
|
+
...result,
|
|
35
|
+
_meta: {
|
|
36
|
+
...result._meta,
|
|
37
|
+
source: result._meta.source ?? req.source,
|
|
38
|
+
requestId: result._meta.requestId ?? req.requestId,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=protocol-enforcement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol-enforcement.js","sourceRoot":"","sources":["../../../src/dispatch/middleware/protocol-enforcement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,yBAAyB,CAAC,aAAsB,IAAI;IAClE,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAElD,OAAO,KAAK,EAAE,GAAoB,EAAE,IAAkB,EAA6B,EAAE;QACnF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAEzD,kFAAkF;QAClF,2FAA2F;QAC3F,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACpD,OAAO;gBACL,GAAG,MAAM;gBACT,KAAK,EAAE;oBACL,GAAG,MAAM,CAAC,KAAK;oBACf,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM;oBACzC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,IAAI,GAAG,CAAC,SAAS;iBACnD;aACkB,CAAC;QACxB,CAAC;QAED,OAAO,MAA0B,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { DispatchRequest, Middleware, RateLimitMeta } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Per-category rate limit thresholds.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Each category (query, mutate, spawn) uses a sliding window algorithm.
|
|
7
|
+
* Requests older than `windowMs` are pruned before checking the count.
|
|
8
|
+
*/
|
|
9
|
+
export interface RateLimitConfig {
|
|
10
|
+
/** Maximum number of requests allowed within the window. */
|
|
11
|
+
maxRequests: number;
|
|
12
|
+
/** Sliding window duration in milliseconds. */
|
|
13
|
+
windowMs: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Full rate limiting configuration across all categories.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* When `enabled` is false, all requests pass through without limit checks.
|
|
20
|
+
*/
|
|
21
|
+
export interface RateLimitingConfig {
|
|
22
|
+
/** Whether rate limiting is active. */
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
/** Limits for read-only query operations. */
|
|
25
|
+
query: RateLimitConfig;
|
|
26
|
+
/** Limits for mutate (write) operations. */
|
|
27
|
+
mutate: RateLimitConfig;
|
|
28
|
+
/** Limits for spawn (subagent launch) operations. */
|
|
29
|
+
spawn: RateLimitConfig;
|
|
30
|
+
}
|
|
31
|
+
export declare const DEFAULT_RATE_LIMITING: RateLimitingConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Sliding-window rate limiter for the dispatch pipeline.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* Tracks request timestamps per category (query, mutate, spawn) using
|
|
37
|
+
* in-memory sliding window buckets. The `check` method prunes stale
|
|
38
|
+
* timestamps, evaluates the current count, and returns whether the
|
|
39
|
+
* request is allowed along with limit metadata.
|
|
40
|
+
*/
|
|
41
|
+
export declare class RateLimiter {
|
|
42
|
+
/** Per-category sliding window buckets. */
|
|
43
|
+
private buckets;
|
|
44
|
+
/** Merged configuration with defaults. */
|
|
45
|
+
private config;
|
|
46
|
+
constructor(config?: Partial<RateLimitingConfig>);
|
|
47
|
+
check(req: DispatchRequest): RateLimitMeta & {
|
|
48
|
+
allowed: boolean;
|
|
49
|
+
};
|
|
50
|
+
private resolveCategory;
|
|
51
|
+
private getLimitConfig;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Creates a rate limiting middleware for the dispatch pipeline.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* Attaches rate limit metadata to every response `_meta.rateLimit` field.
|
|
58
|
+
* When the limit is exceeded, returns an error response with code
|
|
59
|
+
* `E_RATE_LIMIT_EXCEEDED` and HTTP-style exit code 429.
|
|
60
|
+
*
|
|
61
|
+
* @param config - Optional partial config to override defaults
|
|
62
|
+
* @returns Middleware function that enforces rate limits
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* import { createRateLimiter } from './rate-limiter.js';
|
|
67
|
+
*
|
|
68
|
+
* const limiter = createRateLimiter({ query: { maxRequests: 50, windowMs: 30_000 } });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare function createRateLimiter(config?: Partial<RateLimitingConfig>): Middleware;
|
|
72
|
+
//# sourceMappingURL=rate-limiter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limiter.d.ts","sourceRoot":"","sources":["../../../src/dispatch/middleware/rate-limiter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EAEf,UAAU,EACV,aAAa,EACd,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,KAAK,EAAE,eAAe,CAAC;IACvB,4CAA4C;IAC5C,MAAM,EAAE,eAAe,CAAC;IACxB,qDAAqD;IACrD,KAAK,EAAE,eAAe,CAAC;CACxB;AAED,eAAO,MAAM,qBAAqB,EAAE,kBAKnC,CAAC;AASF;;;;;;;;GAQG;AACH,qBAAa,WAAW;IACtB,2CAA2C;IAC3C,OAAO,CAAC,OAAO,CAA+C;IAC9D,0CAA0C;IAC1C,OAAO,CAAC,MAAM,CAAqB;gBAEvB,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAUhD,KAAK,CAAC,GAAG,EAAE,eAAe,GAAG,aAAa,GAAG;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;IA2CjE,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,cAAc;CAGvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,UAAU,CAqClF"}
|