@lumenflow/cli 4.23.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/README.md +54 -52
  2. package/dist/agent-issues-query.js +10 -2
  3. package/dist/agent-issues-query.js.map +1 -1
  4. package/dist/agent-runtime-enrollment-events.js +44 -0
  5. package/dist/agent-runtime-enrollment-events.js.map +1 -0
  6. package/dist/agent-session-end.js +47 -0
  7. package/dist/agent-session-end.js.map +1 -1
  8. package/dist/agent-session-heartbeat.js +250 -0
  9. package/dist/agent-session-heartbeat.js.map +1 -0
  10. package/dist/agent-session.js +299 -5
  11. package/dist/agent-session.js.map +1 -1
  12. package/dist/capacity-snapshot-emitter.js +73 -0
  13. package/dist/capacity-snapshot-emitter.js.map +1 -0
  14. package/dist/claim-queue.js +276 -0
  15. package/dist/claim-queue.js.map +1 -0
  16. package/dist/config-set.js +22 -3
  17. package/dist/config-set.js.map +1 -1
  18. package/dist/control-plane-sidecar-runner.js +145 -0
  19. package/dist/control-plane-sidecar-runner.js.map +1 -0
  20. package/dist/delegation-list.js +160 -1
  21. package/dist/delegation-list.js.map +1 -1
  22. package/dist/delegation-role-resolver.js +69 -0
  23. package/dist/delegation-role-resolver.js.map +1 -0
  24. package/dist/docs-generate-pack-reference.js +500 -0
  25. package/dist/docs-generate-pack-reference.js.map +1 -0
  26. package/dist/docs-sync.js +116 -1
  27. package/dist/docs-sync.js.map +1 -1
  28. package/dist/file-edit.js +28 -8
  29. package/dist/file-edit.js.map +1 -1
  30. package/dist/file-write.js +29 -5
  31. package/dist/file-write.js.map +1 -1
  32. package/dist/gate-co-change.js +25 -7
  33. package/dist/gate-co-change.js.map +1 -1
  34. package/dist/gate-conditional.js +19 -7
  35. package/dist/gate-conditional.js.map +1 -1
  36. package/dist/gates-runners.js +42 -33
  37. package/dist/gates-runners.js.map +1 -1
  38. package/dist/gates-utils.js +34 -20
  39. package/dist/gates-utils.js.map +1 -1
  40. package/dist/gates.js +79 -7
  41. package/dist/gates.js.map +1 -1
  42. package/dist/hooks/config-resolver.js +10 -1
  43. package/dist/hooks/config-resolver.js.map +1 -1
  44. package/dist/init-package-config.js +1 -1
  45. package/dist/init-package-config.js.map +1 -1
  46. package/dist/init-scaffolding.js +5 -1
  47. package/dist/init-scaffolding.js.map +1 -1
  48. package/dist/init-templates.js +10 -0
  49. package/dist/init-templates.js.map +1 -1
  50. package/dist/init.js +1 -1
  51. package/dist/init.js.map +1 -1
  52. package/dist/initiative-create.js +17 -0
  53. package/dist/initiative-create.js.map +1 -1
  54. package/dist/initiative-remove-wu.js +17 -3
  55. package/dist/initiative-remove-wu.js.map +1 -1
  56. package/dist/kernel-event-sync/emitters.js +104 -0
  57. package/dist/kernel-event-sync/emitters.js.map +1 -0
  58. package/dist/kernel-event-sync/index.js +13 -0
  59. package/dist/kernel-event-sync/index.js.map +1 -0
  60. package/dist/kernel-event-sync/lifecycle-emitters.js +160 -0
  61. package/dist/kernel-event-sync/lifecycle-emitters.js.map +1 -0
  62. package/dist/kernel-event-sync/narrow-emissions.js +89 -0
  63. package/dist/kernel-event-sync/narrow-emissions.js.map +1 -0
  64. package/dist/kernel-event-sync/software-delivery-emitters.js +297 -0
  65. package/dist/kernel-event-sync/software-delivery-emitters.js.map +1 -0
  66. package/dist/lane-lock.js +14 -1
  67. package/dist/lane-lock.js.map +1 -1
  68. package/dist/lane-suggest.js +21 -0
  69. package/dist/lane-suggest.js.map +1 -1
  70. package/dist/lumenflow-upgrade.js +7 -5
  71. package/dist/lumenflow-upgrade.js.map +1 -1
  72. package/dist/mem-context.js +145 -0
  73. package/dist/mem-context.js.map +1 -1
  74. package/dist/mem-create.js +39 -6
  75. package/dist/mem-create.js.map +1 -1
  76. package/dist/mem-inbox.js +16 -0
  77. package/dist/mem-inbox.js.map +1 -1
  78. package/dist/mem-roster.js +95 -0
  79. package/dist/mem-roster.js.map +1 -0
  80. package/dist/mem-signal.js +97 -2
  81. package/dist/mem-signal.js.map +1 -1
  82. package/dist/metrics-cli.js +3 -2
  83. package/dist/metrics-cli.js.map +1 -1
  84. package/dist/metrics-snapshot.js +271 -13
  85. package/dist/metrics-snapshot.js.map +1 -1
  86. package/dist/orchestrate-init-status.js +117 -2
  87. package/dist/orchestrate-init-status.js.map +1 -1
  88. package/dist/orchestrate-initiative.js +83 -10
  89. package/dist/orchestrate-initiative.js.map +1 -1
  90. package/dist/orchestrate-monitor-quality.js +289 -0
  91. package/dist/orchestrate-monitor-quality.js.map +1 -0
  92. package/dist/orchestrate-monitor.js +85 -0
  93. package/dist/orchestrate-monitor.js.map +1 -1
  94. package/dist/pack-validate.js +127 -2
  95. package/dist/pack-validate.js.map +1 -1
  96. package/dist/plan-create.js +18 -0
  97. package/dist/plan-create.js.map +1 -1
  98. package/dist/plan-link.js +13 -0
  99. package/dist/plan-link.js.map +1 -1
  100. package/dist/plan-promote.js +14 -0
  101. package/dist/plan-promote.js.map +1 -1
  102. package/dist/pre-commit-check.js +4 -3
  103. package/dist/pre-commit-check.js.map +1 -1
  104. package/dist/public-manifest.js +17 -3
  105. package/dist/public-manifest.js.map +1 -1
  106. package/dist/release.js +10 -10
  107. package/dist/release.js.map +1 -1
  108. package/dist/session-cross-link.js +139 -0
  109. package/dist/session-cross-link.js.map +1 -0
  110. package/dist/sidecar-manager.js +208 -0
  111. package/dist/sidecar-manager.js.map +1 -0
  112. package/dist/state-path-resolvers.js +18 -0
  113. package/dist/state-path-resolvers.js.map +1 -1
  114. package/dist/stream-heartbeat.js +151 -0
  115. package/dist/stream-heartbeat.js.map +1 -0
  116. package/dist/sync-templates.js +56 -2
  117. package/dist/sync-templates.js.map +1 -1
  118. package/dist/wu-block.js +47 -5
  119. package/dist/wu-block.js.map +1 -1
  120. package/dist/wu-claim-branch.js +8 -4
  121. package/dist/wu-claim-branch.js.map +1 -1
  122. package/dist/wu-claim-state.js +5 -3
  123. package/dist/wu-claim-state.js.map +1 -1
  124. package/dist/wu-claim-worktree.js +5 -3
  125. package/dist/wu-claim-worktree.js.map +1 -1
  126. package/dist/wu-claim.js +261 -9
  127. package/dist/wu-claim.js.map +1 -1
  128. package/dist/wu-done-auto-cleanup.js +3 -2
  129. package/dist/wu-done-auto-cleanup.js.map +1 -1
  130. package/dist/wu-done-git-ops.js +12 -8
  131. package/dist/wu-done-git-ops.js.map +1 -1
  132. package/dist/wu-done-preflight.js +3 -3
  133. package/dist/wu-done-preflight.js.map +1 -1
  134. package/dist/wu-done.js +46 -10
  135. package/dist/wu-done.js.map +1 -1
  136. package/dist/wu-lifecycle-sync/gate-scope-resolver.js +16 -0
  137. package/dist/wu-lifecycle-sync/gate-scope-resolver.js.map +1 -0
  138. package/dist/wu-lifecycle-sync/kernel-event-sync-shim.js +10 -0
  139. package/dist/wu-lifecycle-sync/kernel-event-sync-shim.js.map +1 -0
  140. package/dist/wu-prep.js +363 -22
  141. package/dist/wu-prep.js.map +1 -1
  142. package/dist/wu-prune.js +68 -27
  143. package/dist/wu-prune.js.map +1 -1
  144. package/dist/wu-release.js +34 -3
  145. package/dist/wu-release.js.map +1 -1
  146. package/dist/wu-review.js +167 -0
  147. package/dist/wu-review.js.map +1 -0
  148. package/dist/wu-spawn-prompt-builders.js +296 -40
  149. package/dist/wu-spawn-prompt-builders.js.map +1 -1
  150. package/dist/wu-spawn-strategy-resolver.js +126 -14
  151. package/dist/wu-spawn-strategy-resolver.js.map +1 -1
  152. package/dist/wu-unblock.js +52 -22
  153. package/dist/wu-unblock.js.map +1 -1
  154. package/package.json +13 -8
  155. package/packs/agent-runtime/.turbo/turbo-build.log +1 -1
  156. package/packs/agent-runtime/.turbo/turbo-test.log +25 -0
  157. package/packs/agent-runtime/.turbo/turbo-typecheck.log +4 -0
  158. package/packs/agent-runtime/agent-heartbeat.ts +163 -0
  159. package/packs/agent-runtime/auto-session-integration.ts +874 -0
  160. package/packs/agent-runtime/delegation-registry-schema.ts +220 -0
  161. package/packs/agent-runtime/delegation-registry-store.ts +269 -0
  162. package/packs/agent-runtime/delegation-tree.ts +328 -0
  163. package/packs/agent-runtime/index.ts +9 -0
  164. package/packs/agent-runtime/manifest.ts +103 -19
  165. package/packs/agent-runtime/manifest.yaml +132 -0
  166. package/packs/agent-runtime/memory-coordination-contract.ts +86 -0
  167. package/packs/agent-runtime/memory.d.ts +19 -0
  168. package/packs/agent-runtime/orchestration.ts +238 -23
  169. package/packs/agent-runtime/package.json +11 -2
  170. package/packs/agent-runtime/remote-controls/index.ts +7 -0
  171. package/packs/agent-runtime/remote-controls/operations.ts +399 -0
  172. package/packs/agent-runtime/remote-controls/port.ts +48 -0
  173. package/packs/agent-runtime/remote-controls/state-store.ts +258 -0
  174. package/packs/agent-runtime/remote-controls/types.ts +105 -0
  175. package/packs/agent-runtime/session-schema.ts +423 -0
  176. package/packs/agent-runtime/tool-impl/index.ts +1 -0
  177. package/packs/agent-runtime/tool-impl/remote-controls.mock.ts +252 -0
  178. package/packs/agent-runtime/tool-impl/remote-controls.ts +273 -0
  179. package/packs/agent-runtime/tsconfig.json +1 -1
  180. package/packs/agent-runtime/turn-lifecycle-events.ts +501 -0
  181. package/packs/sidekick/.lumenflow/state/conductor/outbox/sidekick-events.jsonl +213 -0
  182. package/packs/sidekick/.turbo/turbo-build.log +1 -1
  183. package/packs/sidekick/.turbo/turbo-test.log +25 -0
  184. package/packs/sidekick/.turbo/turbo-typecheck.log +4 -0
  185. package/packs/sidekick/channel-ingress.ts +137 -0
  186. package/packs/sidekick/manifest.ts +74 -0
  187. package/packs/sidekick/manifest.yaml +88 -0
  188. package/packs/sidekick/package.json +3 -1
  189. package/packs/sidekick/sidekick-events.ts +517 -0
  190. package/packs/sidekick/src/adapters/cloud-queue.ts +101 -0
  191. package/packs/sidekick/src/adapters/control-plane-bridge.adapter.ts +378 -0
  192. package/packs/sidekick/src/adapters/filesystem-bridge.adapter.ts +224 -0
  193. package/packs/sidekick/src/domain/channel.types.ts +84 -0
  194. package/packs/sidekick/src/ports/channel-bridge.port.ts +75 -0
  195. package/packs/sidekick/src/routines/commit.ts +74 -0
  196. package/packs/sidekick/tool-impl/channel-tools.ts +47 -0
  197. package/packs/sidekick/tool-impl/memory-tools.ts +17 -0
  198. package/packs/sidekick/tool-impl/routine-commit.ts +102 -0
  199. package/packs/sidekick/tool-impl/routine-tools.ts +67 -7
  200. package/packs/sidekick/tool-impl/runtime-context.ts +4 -0
  201. package/packs/sidekick/tool-impl/storage.ts +3 -0
  202. package/packs/sidekick/tool-impl/system-tools.ts +7 -0
  203. package/packs/sidekick/tool-impl/task-tools.ts +46 -0
  204. package/packs/sidekick/tsconfig.json +1 -1
  205. package/packs/software-delivery/.turbo/turbo-build.log +1 -1
  206. package/packs/software-delivery/.turbo/turbo-test.log +63 -0
  207. package/packs/software-delivery/.turbo/turbo-typecheck.log +4 -0
  208. package/packs/software-delivery/manifest-schema.ts +30 -0
  209. package/packs/software-delivery/manifest.ts +99 -1
  210. package/packs/software-delivery/manifest.yaml +46 -0
  211. package/packs/software-delivery/package.json +88 -3
  212. package/packs/software-delivery/src/commands/index.ts +5 -0
  213. package/packs/software-delivery/src/config/delivery-review-contract.ts +20 -0
  214. package/packs/software-delivery/src/config/env-accessors.ts +19 -0
  215. package/packs/software-delivery/src/config/index.ts +8 -0
  216. package/packs/software-delivery/src/config/normalize-config-keys.ts +19 -0
  217. package/packs/software-delivery/src/config/schemas/lumenflow-config-schema-types.ts +436 -0
  218. package/packs/software-delivery/src/config/workspace-reader.ts +310 -0
  219. package/packs/software-delivery/src/constants/backlog-patterns.ts +31 -0
  220. package/packs/software-delivery/src/constants/client-ids.ts +19 -0
  221. package/packs/software-delivery/src/constants/config-contract.ts +7 -0
  222. package/packs/software-delivery/src/constants/docs-layout-presets.ts +50 -0
  223. package/packs/software-delivery/src/constants/duration-constants.ts +20 -0
  224. package/packs/software-delivery/src/constants/gate-constants.ts +32 -0
  225. package/packs/software-delivery/src/constants/index.ts +29 -0
  226. package/packs/software-delivery/src/constants/lock-constants.ts +35 -0
  227. package/packs/software-delivery/src/constants/object-guards.ts +12 -0
  228. package/packs/software-delivery/src/constants/section-headings.ts +107 -0
  229. package/packs/software-delivery/src/constants/wu-cli-constants.ts +485 -0
  230. package/packs/software-delivery/src/constants/wu-domain-constants.ts +466 -0
  231. package/packs/software-delivery/src/constants/wu-git-constants.ts +7 -0
  232. package/packs/software-delivery/src/constants/wu-id-format.ts +327 -0
  233. package/packs/software-delivery/src/constants/wu-paths-constants.ts +358 -0
  234. package/packs/software-delivery/src/constants/wu-statuses.ts +287 -0
  235. package/packs/software-delivery/src/constants/wu-type-helpers.ts +67 -0
  236. package/packs/software-delivery/src/constants/wu-ui-constants.ts +267 -0
  237. package/packs/software-delivery/src/constants/wu-validation-constants.ts +73 -0
  238. package/packs/software-delivery/src/domain/index.ts +5 -0
  239. package/packs/software-delivery/src/domain/orchestration.constants.ts +168 -0
  240. package/packs/software-delivery/src/domain/orchestration.schemas.ts +239 -0
  241. package/packs/software-delivery/src/domain/orchestration.types.ts +178 -0
  242. package/packs/software-delivery/src/methodology/incremental-test.ts +90 -0
  243. package/packs/software-delivery/src/methodology/index.ts +6 -0
  244. package/packs/software-delivery/src/methodology/manual-test-validator.ts +292 -0
  245. package/packs/software-delivery/src/policy/coverage-gate.ts +270 -0
  246. package/packs/software-delivery/src/policy/gates-agent-mode.ts +223 -0
  247. package/packs/software-delivery/src/policy/gates-config-internal.ts +121 -0
  248. package/packs/software-delivery/src/policy/gates-config.ts +293 -0
  249. package/packs/software-delivery/src/policy/gates-coverage.ts +247 -0
  250. package/packs/software-delivery/src/policy/gates-presets.ts +134 -0
  251. package/packs/software-delivery/src/policy/gates-schemas.ts +173 -0
  252. package/packs/software-delivery/src/policy/index.ts +22 -0
  253. package/packs/software-delivery/src/policy/package-manager-resolver.ts +319 -0
  254. package/packs/software-delivery/src/policy/resolve-policy.ts +518 -0
  255. package/packs/software-delivery/src/ports/config.ports.ts +90 -0
  256. package/packs/software-delivery/src/ports/dashboard-renderer.port.ts +125 -0
  257. package/packs/software-delivery/src/ports/index.ts +10 -0
  258. package/packs/software-delivery/src/ports/sync-validator.ports.ts +59 -0
  259. package/packs/software-delivery/src/ports/wu-helpers.ports.ts +168 -0
  260. package/packs/software-delivery/src/ports/wu-state.ports.ts +241 -0
  261. package/packs/software-delivery/src/primitives/index.ts +5 -0
  262. package/packs/software-delivery/src/runtime/index.ts +6 -0
  263. package/packs/software-delivery/src/runtime/work-classifier.ts +561 -0
  264. package/packs/software-delivery/src/sandbox/index.ts +10 -0
  265. package/packs/software-delivery/src/sandbox/sandbox-allowlist.ts +118 -0
  266. package/packs/software-delivery/src/sandbox/sandbox-backend-linux.ts +88 -0
  267. package/packs/software-delivery/src/sandbox/sandbox-backend-macos.ts +154 -0
  268. package/packs/software-delivery/src/sandbox/sandbox-backend-windows.ts +47 -0
  269. package/packs/software-delivery/src/sandbox/sandbox-profile.ts +153 -0
  270. package/packs/software-delivery/src/schemas/index.ts +5 -0
  271. package/packs/software-delivery/src/state/date-utils.ts +158 -0
  272. package/packs/software-delivery/src/state/index.ts +15 -0
  273. package/packs/software-delivery/src/state/state-machine.ts +119 -0
  274. package/packs/software-delivery/src/state/wu-doc-types.ts +51 -0
  275. package/packs/software-delivery/src/state/wu-paths.ts +381 -0
  276. package/packs/software-delivery/src/state/wu-schema.ts +1139 -0
  277. package/packs/software-delivery/src/state/wu-state-schema.ts +255 -0
  278. package/packs/software-delivery/src/state/wu-yaml.ts +338 -0
  279. package/packs/software-delivery/src/types.d.ts +16 -0
  280. package/packs/software-delivery/tool-impl/wu-lifecycle-tools.ts +18 -0
  281. package/packs/software-delivery/tsconfig.json +28 -2
  282. package/templates/core/AGENTS.md.template +76 -17
  283. package/templates/core/LUMENFLOW.md.template +265 -66
  284. package/templates/core/_frameworks/lumenflow/wu-sizing-guide.md.template +180 -116
  285. package/templates/core/ai/onboarding/agent-invocation-guide.md.template +26 -8
  286. package/templates/core/ai/onboarding/existing-project-bootstrap.md.template +171 -0
  287. package/templates/core/ai/onboarding/first-15-mins.md.template +3 -1
  288. package/templates/core/ai/onboarding/first-wu-mistakes.md.template +1 -1
  289. package/templates/core/ai/onboarding/initiative-orchestration.md.template +46 -30
  290. package/templates/core/ai/onboarding/quick-ref-commands.md.template +36 -33
  291. package/templates/core/ai/onboarding/release-process.md.template +8 -7
  292. package/templates/core/ai/onboarding/starting-prompt.md.template +2 -0
  293. package/templates/core/ai/onboarding/troubleshooting-wu-done.md.template +62 -0
  294. package/templates/vendors/claude/.claude/CLAUDE.md.template +29 -54
  295. package/templates/vendors/cursor/.cursor/rules/lumenflow.md.template +24 -52
  296. package/templates/vendors/windsurf/.windsurf/rules/lumenflow.md.template +24 -52
@@ -0,0 +1,168 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ /**
5
+ * Orchestration Domain Constants
6
+ *
7
+ * Centralised constants for the agent orchestration dashboard.
8
+ * Avoids magic numbers and hardcoded strings throughout the orchestration layer.
9
+ *
10
+ * @module orchestration.constants
11
+ * @see {@link ../ports/dashboard-renderer.port.ts} - Uses these constants
12
+ * @see {@link ../ports/metrics-collector.port.ts} - Uses these constants
13
+ */
14
+
15
+ import { DIRECTORIES, LUMENFLOW_PATHS } from '../constants/wu-paths-constants.js';
16
+
17
+ /**
18
+ * Total number of Definition of Done checkpoints.
19
+ * Used by dashboard to show DoD progress (X/11).
20
+ */
21
+ export const DOD_TOTAL = 11;
22
+
23
+ /**
24
+ * Valid lane names in the LumenFlow system.
25
+ * Used for type-safe lane validation.
26
+ *
27
+ * Note: This should match the lanes defined in workspace.yaml.
28
+ * These are LumenFlow framework lanes, not application-specific lanes.
29
+ */
30
+ export const LANES = [
31
+ 'Framework: Core',
32
+ 'Framework: CLI',
33
+ 'Framework: Memory',
34
+ 'Framework: Agent',
35
+ 'Framework: Metrics',
36
+ 'Framework: Initiatives',
37
+ 'Framework: Shims',
38
+ 'Operations: Infrastructure',
39
+ 'Operations: CI/CD',
40
+ 'Content: Documentation',
41
+ ] as const;
42
+
43
+ /** Type for valid lane names */
44
+ export type Lane = (typeof LANES)[number];
45
+
46
+ /**
47
+ * Known agent names in the orchestration system.
48
+ * Includes both mandatory (Tier 1) and suggested (Tier 2) agents.
49
+ *
50
+ * Note: These are LumenFlow framework agents defined in .claude/agents/.
51
+ * Application-specific agents should be configured separately.
52
+ */
53
+ export const AGENT_NAMES = [
54
+ 'general-purpose',
55
+ 'lumenflow-pm',
56
+ 'test-engineer',
57
+ 'code-reviewer',
58
+ 'bug-triage',
59
+ 'lumenflow-enforcer',
60
+ 'lumenflow-doc-sync',
61
+ ] as const;
62
+
63
+ /** Type for agent names */
64
+ export type AgentName = (typeof AGENT_NAMES)[number];
65
+
66
+ /**
67
+ * Alert severity levels for dashboard display.
68
+ * HIGH = action required immediately
69
+ * MEDIUM = action suggested
70
+ * LOW = informational
71
+ */
72
+ export const SEVERITY_LEVELS = ['high', 'medium', 'low'] as const;
73
+
74
+ /** Type for severity levels */
75
+ export type SeverityLevel = (typeof SEVERITY_LEVELS)[number];
76
+
77
+ /**
78
+ * Default timeline window for dashboard display (hours).
79
+ */
80
+ export const TIMELINE_WINDOW_HOURS = 24;
81
+
82
+ /**
83
+ * Maximum alerts to display in dashboard.
84
+ */
85
+ export const MAX_ALERTS_DISPLAY = 10;
86
+
87
+ /**
88
+ * Agent result statuses for WU progress tracking.
89
+ */
90
+ export const AGENT_RESULT_STATUSES = ['pending', 'pass', 'fail', 'skipped'] as const;
91
+
92
+ /** Type for agent result statuses */
93
+ export type AgentResultStatus = (typeof AGENT_RESULT_STATUSES)[number];
94
+
95
+ /**
96
+ * Timeline event types for orchestration history.
97
+ */
98
+ export const TIMELINE_EVENT_TYPES = ['claim', 'done', 'block', 'agent', 'gates'] as const;
99
+
100
+ /** Type for timeline event types */
101
+ export type TimelineEventType = (typeof TIMELINE_EVENT_TYPES)[number];
102
+
103
+ /**
104
+ * Event severity levels for timeline display.
105
+ */
106
+ export const EVENT_SEVERITY_LEVELS = ['info', 'warning', 'error'] as const;
107
+
108
+ /** Type for event severity levels */
109
+ export type EventSeverityLevel = (typeof EVENT_SEVERITY_LEVELS)[number];
110
+
111
+ /**
112
+ * User choice options for execution plan confirmation.
113
+ */
114
+ export const USER_CHOICE_OPTIONS = ['approve', 'reject', 'edit'] as const;
115
+
116
+ /** Type for user choice options */
117
+ export type UserChoiceOption = (typeof USER_CHOICE_OPTIONS)[number];
118
+
119
+ /**
120
+ * Mandatory agent names (subset of AGENT_NAMES)
121
+ *
122
+ * Note: For LumenFlow framework development, mandatory agents are not currently
123
+ * enforced since this is a workflow framework, not an application with domain-specific concerns.
124
+ * Projects using LumenFlow can define their own mandatory agents in their config.
125
+ *
126
+ * The test-engineer and code-reviewer agents are suggested but not mandatory.
127
+ */
128
+ export const MANDATORY_AGENT_NAMES = [] as const;
129
+
130
+ /** Type for mandatory agent names */
131
+ export type MandatoryAgentName = (typeof MANDATORY_AGENT_NAMES)[number];
132
+
133
+ /**
134
+ * Mandatory agent triggers - glob patterns that indicate when agents must be invoked.
135
+ * Uses minimatch patterns (NOT regex) for file path matching.
136
+ *
137
+ * Note: For LumenFlow framework development, this is empty since we don't have
138
+ * application-specific concerns. Projects using LumenFlow
139
+ * should configure their own triggers based on their domain requirements.
140
+ *
141
+ * Example application-specific triggers (configure in your project):
142
+ * - security-auditor: supabase/migrations/**, auth/**, rls/**
143
+ * - llm-reviewer: prompts/**, llm/**
144
+ *
145
+ * Usage:
146
+ * ```typescript
147
+ * import { minimatch } from 'minimatch';
148
+ * const triggers = MANDATORY_TRIGGERS['my-agent'];
149
+ * const shouldTrigger = triggers?.some(pattern => minimatch(filePath, pattern));
150
+ * ```
151
+ */
152
+ export const MANDATORY_TRIGGERS: Record<string, readonly string[]> = {
153
+ // No mandatory triggers for LumenFlow framework development.
154
+ // Projects should configure their own triggers based on their domain.
155
+ };
156
+
157
+ /**
158
+ * File system paths for metrics collection.
159
+ * Used by FileSystemMetricsCollector to avoid hardcoded strings.
160
+ */
161
+ export const FILESYSTEM_PATHS = {
162
+ WU_DIR: DIRECTORIES.WU_DIR,
163
+ STATUS_FILE: DIRECTORIES.STATUS_PATH,
164
+ BACKLOG_FILE: DIRECTORIES.BACKLOG_PATH,
165
+ TELEMETRY_DIR: LUMENFLOW_PATHS.TELEMETRY,
166
+ STAMPS_DIR: LUMENFLOW_PATHS.STAMPS_DIR,
167
+ SESSION_FILE: LUMENFLOW_PATHS.SESSION_CURRENT,
168
+ };
@@ -0,0 +1,239 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ /**
5
+ * Orchestration Domain Schemas
6
+ *
7
+ * Zod schemas for runtime validation of orchestration domain types.
8
+ * Single source of truth - types are inferred from these schemas.
9
+ *
10
+ * @module orchestration.schemas
11
+ * @see {@link ./orchestration.types.ts} - Types inferred from these schemas
12
+ * @see {@link ./orchestration.constants.ts} - Constants used in validation
13
+ */
14
+
15
+ import { z } from 'zod';
16
+ import {
17
+ LANES,
18
+ AGENT_NAMES,
19
+ SEVERITY_LEVELS,
20
+ AGENT_RESULT_STATUSES,
21
+ TIMELINE_EVENT_TYPES,
22
+ EVENT_SEVERITY_LEVELS,
23
+ USER_CHOICE_OPTIONS,
24
+ DOD_TOTAL,
25
+ } from './orchestration.constants.js';
26
+
27
+ /**
28
+ * Schema for the longest running WU information.
29
+ */
30
+ const LongestRunningSchema = z.object({
31
+ wuId: z.string().min(1),
32
+ lane: z.enum(LANES),
33
+ durationMs: z.number().nonnegative(),
34
+ });
35
+
36
+ /**
37
+ * Schema for pending mandatory agent information.
38
+ */
39
+ const PendingMandatorySchema = z.object({
40
+ wuId: z.string().min(1),
41
+ agent: z.enum(AGENT_NAMES),
42
+ });
43
+
44
+ /**
45
+ * Schema for active agent session (WU-1438).
46
+ */
47
+ const ActiveSessionSchema = z.object({
48
+ sessionId: z.string().uuid(),
49
+ wuId: z.string().min(1),
50
+ started: z.string().datetime(),
51
+ contextTier: z.union([z.literal(1), z.literal(2), z.literal(3)]),
52
+ incidentsLogged: z.number().int().nonnegative(),
53
+ });
54
+
55
+ /**
56
+ * Schema for worktree with uncommitted changes (WU-1748).
57
+ * Used for cross-agent visibility of abandoned WU work.
58
+ */
59
+ const WorktreeWithUncommittedChangesSchema = z.object({
60
+ /** WU ID extracted from worktree branch name */
61
+ wuId: z.string().min(1),
62
+ /** Worktree directory path */
63
+ worktreePath: z.string().min(1),
64
+ /** Number of uncommitted files */
65
+ uncommittedFileCount: z.number().int().nonnegative(),
66
+ /** Last git activity timestamp (ISO 8601) */
67
+ lastActivityTimestamp: z.string(),
68
+ });
69
+
70
+ /**
71
+ * Schema for global orchestration status.
72
+ * Shows high-level dashboard metrics at a glance.
73
+ */
74
+ export const GlobalStatusSchema = z.object({
75
+ /** Number of WUs currently in progress */
76
+ activeWUs: z.number().int().nonnegative(),
77
+ /** Number of WUs completed in the last 24 hours */
78
+ completed24h: z.number().int().nonnegative(),
79
+ /** Number of currently blocked WUs */
80
+ blocked: z.number().int().nonnegative(),
81
+ /** Number of WUs with failing gates */
82
+ gatesFailing: z.number().int().nonnegative(),
83
+ /** Information about the longest running WU, or null if none active */
84
+ longestRunning: LongestRunningSchema.nullable(),
85
+ /** List of WUs with pending mandatory agents */
86
+ pendingMandatory: z.array(PendingMandatorySchema),
87
+ /** Current active agent session, or null if none (WU-1438) */
88
+ activeSession: ActiveSessionSchema.nullable(),
89
+ /** Worktrees with uncommitted changes for cross-agent visibility (WU-1748) */
90
+ worktreesWithUncommittedChanges: z.array(WorktreeWithUncommittedChangesSchema),
91
+ });
92
+
93
+ /**
94
+ * Schema for last run information within agent metrics.
95
+ */
96
+ const LastRunSchema = z.object({
97
+ wuId: z.string().min(1),
98
+ timestamp: z.string().datetime(),
99
+ result: z.enum(['pass', 'fail']),
100
+ });
101
+
102
+ /**
103
+ * Schema for per-agent metrics.
104
+ * Tracks invocation counts, pass rates, and timing.
105
+ */
106
+ export const AgentMetricSchema = z.object({
107
+ /** Total number of times this agent has been invoked */
108
+ invoked: z.number().int().nonnegative(),
109
+ /** Pass rate as percentage (0-100) */
110
+ passRate: z.number().min(0).max(100),
111
+ /** Average duration in milliseconds */
112
+ avgDurationMs: z.number().nonnegative(),
113
+ /** Information about the most recent run, or null if never run */
114
+ lastRun: LastRunSchema.nullable(),
115
+ });
116
+
117
+ /**
118
+ * Schema for WU progress tracking.
119
+ * Shows DoD progress and agent status per WU.
120
+ */
121
+ export const WUProgressSchema = z.object({
122
+ /** Work Unit ID (e.g., "WU-1234") */
123
+ wuId: z.string().min(1),
124
+ /** Lane the WU is assigned to */
125
+ lane: z.enum(LANES),
126
+ /** Human-readable title of the WU */
127
+ title: z.string().min(1),
128
+ /** Current DoD checkpoint progress (0 to DOD_TOTAL) */
129
+ dodProgress: z.number().int().min(0).max(DOD_TOTAL),
130
+ /** Total DoD checkpoints (always DOD_TOTAL) */
131
+ dodTotal: z.literal(DOD_TOTAL),
132
+ /** Status of each agent that has been or should be run */
133
+ agents: z.record(z.string(), z.enum(AGENT_RESULT_STATUSES)),
134
+ /** Tufte-style headline sentence describing current state */
135
+ headline: z.string(),
136
+ });
137
+
138
+ /**
139
+ * Schema for timeline events.
140
+ * Records orchestration history for dashboard display.
141
+ */
142
+ export const TimelineEventSchema = z.object({
143
+ /** ISO 8601 timestamp of the event */
144
+ timestamp: z.string().datetime(),
145
+ /** Type of orchestration event */
146
+ event: z.enum(TIMELINE_EVENT_TYPES),
147
+ /** Associated Work Unit ID */
148
+ wuId: z.string().min(1),
149
+ /** Human-readable event description */
150
+ detail: z.string(),
151
+ /** Visual severity for display */
152
+ severity: z.enum(EVENT_SEVERITY_LEVELS),
153
+ });
154
+
155
+ /**
156
+ * Schema for dashboard alerts.
157
+ * Highlights items requiring attention.
158
+ */
159
+ export const AlertSchema = z.object({
160
+ /** Alert severity level */
161
+ severity: z.enum(SEVERITY_LEVELS),
162
+ /** Human-readable alert message */
163
+ message: z.string().min(1),
164
+ /** Associated Work Unit ID */
165
+ wuId: z.string().min(1),
166
+ /** Suggested action or command */
167
+ action: z.string().min(1),
168
+ });
169
+
170
+ /**
171
+ * Schema for orchestration suggestions.
172
+ * Recommendations for next actions.
173
+ */
174
+ export const SuggestionSchema = z.object({
175
+ /** Unique suggestion identifier */
176
+ id: z.string().min(1),
177
+ /** Suggestion priority level */
178
+ priority: z.enum(SEVERITY_LEVELS),
179
+ /** Short action description */
180
+ action: z.string().min(1),
181
+ /** Reason for the suggestion */
182
+ reason: z.string().min(1),
183
+ /** CLI command to execute the suggestion */
184
+ command: z.string().min(1),
185
+ });
186
+
187
+ /**
188
+ * Schema for execution plan steps.
189
+ */
190
+ const ExecutionStepSchema = z.object({
191
+ /** Execution order (1-based) */
192
+ order: z.number().int().positive(),
193
+ /** Agent to run (if applicable) */
194
+ agent: z.string().optional(),
195
+ /** Action to perform (if not an agent) */
196
+ action: z.string().optional(),
197
+ /** Step execution status */
198
+ status: z.enum(AGENT_RESULT_STATUSES),
199
+ });
200
+
201
+ /**
202
+ * Schema for execution plans.
203
+ * Proposed sequence of orchestration actions.
204
+ */
205
+ export const ExecutionPlanSchema = z.object({
206
+ /** Work Unit ID this plan is for */
207
+ wuId: z.string().min(1),
208
+ /** Ordered list of steps to execute */
209
+ steps: z.array(ExecutionStepSchema),
210
+ /** Estimated token cost for the full plan */
211
+ estimatedTokens: z.number().int().nonnegative(),
212
+ });
213
+
214
+ /**
215
+ * Schema for user choices on execution plans.
216
+ */
217
+ export const UserChoiceSchema = z.object({
218
+ /** User's choice */
219
+ choice: z.enum(USER_CHOICE_OPTIONS),
220
+ /** Modifications if choice is 'edit' */
221
+ modifications: z.array(z.string()).optional(),
222
+ });
223
+
224
+ /**
225
+ * Schema for complete dashboard data.
226
+ * Aggregates all data needed for dashboard rendering.
227
+ */
228
+ export const DashboardDataSchema = z.object({
229
+ /** Global status metrics */
230
+ globalStatus: GlobalStatusSchema,
231
+ /** Per-agent metrics keyed by agent name */
232
+ agentMetrics: z.record(z.string(), AgentMetricSchema),
233
+ /** Progress for all active WUs */
234
+ wuProgress: z.array(WUProgressSchema),
235
+ /** Recent timeline events */
236
+ timeline: z.array(TimelineEventSchema),
237
+ /** Current alerts */
238
+ alerts: z.array(AlertSchema),
239
+ });
@@ -0,0 +1,178 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ /**
5
+ * Orchestration Domain Types
6
+ *
7
+ * TypeScript types inferred from Zod schemas.
8
+ * Single source of truth - schemas validate at runtime, types at compile time.
9
+ *
10
+ * @module orchestration.types
11
+ * @see {@link ./orchestration.schemas.ts} - Schemas these types are inferred from
12
+ * @see {@link ./orchestration.constants.ts} - Constants and derived types
13
+ */
14
+
15
+ import type { z } from 'zod';
16
+ import type {
17
+ GlobalStatusSchema,
18
+ AgentMetricSchema,
19
+ WUProgressSchema,
20
+ TimelineEventSchema,
21
+ AlertSchema,
22
+ SuggestionSchema,
23
+ ExecutionPlanSchema,
24
+ UserChoiceSchema,
25
+ DashboardDataSchema,
26
+ } from './orchestration.schemas.js';
27
+
28
+ // Re-export constant-derived types for convenience
29
+ export type {
30
+ Lane,
31
+ AgentName,
32
+ SeverityLevel,
33
+ AgentResultStatus,
34
+ TimelineEventType,
35
+ EventSeverityLevel,
36
+ UserChoiceOption,
37
+ MandatoryAgentName,
38
+ } from './orchestration.constants.js';
39
+
40
+ // Re-export const values as well
41
+ export {
42
+ LANES,
43
+ AGENT_NAMES,
44
+ SEVERITY_LEVELS,
45
+ AGENT_RESULT_STATUSES,
46
+ TIMELINE_EVENT_TYPES,
47
+ EVENT_SEVERITY_LEVELS,
48
+ USER_CHOICE_OPTIONS,
49
+ MANDATORY_AGENT_NAMES,
50
+ } from './orchestration.constants.js';
51
+
52
+ /**
53
+ * Global orchestration status.
54
+ * Shows high-level dashboard metrics at a glance.
55
+ *
56
+ * @example
57
+ * const status: GlobalStatus = {
58
+ * activeWUs: 2,
59
+ * completed24h: 5,
60
+ * blocked: 1,
61
+ * gatesFailing: 0,
62
+ * longestRunning: { wuId: 'WU-1234', lane: 'Intelligence', durationMs: 2700000 },
63
+ * pendingMandatory: [{ wuId: 'WU-1235', agent: 'security-auditor' }],
64
+ * };
65
+ */
66
+ export type GlobalStatus = z.infer<typeof GlobalStatusSchema>;
67
+
68
+ /**
69
+ * Per-agent metrics for dashboard display.
70
+ * Tracks invocation counts, pass rates, and timing.
71
+ *
72
+ * @example
73
+ * const metric: AgentMetric = {
74
+ * invoked: 3,
75
+ * passRate: 100,
76
+ * avgDurationMs: 120000,
77
+ * lastRun: { wuId: 'WU-1234', timestamp: '2025-01-15T10:00:00Z', result: 'pass' },
78
+ * };
79
+ */
80
+ export type AgentMetric = z.infer<typeof AgentMetricSchema>;
81
+
82
+ /**
83
+ * Work Unit progress for dashboard display.
84
+ * Shows DoD progress and agent status per WU.
85
+ *
86
+ * @example
87
+ * const progress: WUProgress = {
88
+ * wuId: 'WU-1234',
89
+ * lane: 'Intelligence',
90
+ * title: 'LLM Classification Feature',
91
+ * dodProgress: 8,
92
+ * dodTotal: 11,
93
+ * agents: { 'llm-reviewer': 'pass', 'code-reviewer': 'pending' },
94
+ * headline: 'Blocked on code-reviewer - awaiting approval',
95
+ * };
96
+ */
97
+ export type WUProgress = z.infer<typeof WUProgressSchema>;
98
+
99
+ /**
100
+ * Timeline event for orchestration history.
101
+ * Records key events for dashboard display.
102
+ *
103
+ * @example
104
+ * const event: TimelineEvent = {
105
+ * timestamp: '2025-01-15T09:00:00Z',
106
+ * event: 'claim',
107
+ * wuId: 'WU-1234',
108
+ * detail: 'Claimed for Intelligence lane',
109
+ * severity: 'info',
110
+ * };
111
+ */
112
+ export type TimelineEvent = z.infer<typeof TimelineEventSchema>;
113
+
114
+ /**
115
+ * Dashboard alert for items requiring attention.
116
+ *
117
+ * @example
118
+ * const alert: Alert = {
119
+ * severity: 'high',
120
+ * message: 'Mandatory agent not yet invoked',
121
+ * wuId: 'WU-1235',
122
+ * action: 'Run security-auditor before wu:done',
123
+ * };
124
+ */
125
+ export type Alert = z.infer<typeof AlertSchema>;
126
+
127
+ /**
128
+ * Orchestration suggestion for next actions.
129
+ *
130
+ * @example
131
+ * const suggestion: Suggestion = {
132
+ * id: 'sug-001',
133
+ * priority: 'high',
134
+ * action: 'Run security-auditor',
135
+ * reason: 'WU touches auth paths',
136
+ * command: 'pnpm orchestrate:run security-auditor',
137
+ * };
138
+ */
139
+ export type Suggestion = z.infer<typeof SuggestionSchema>;
140
+
141
+ /**
142
+ * Execution plan for proposed orchestration actions.
143
+ *
144
+ * @example
145
+ * const plan: ExecutionPlan = {
146
+ * wuId: 'WU-1234',
147
+ * steps: [
148
+ * { order: 1, agent: 'llm-reviewer', status: 'pending' },
149
+ * { order: 2, action: 'gates', status: 'pending' },
150
+ * ],
151
+ * estimatedTokens: 5000,
152
+ * };
153
+ */
154
+ export type ExecutionPlan = z.infer<typeof ExecutionPlanSchema>;
155
+
156
+ /**
157
+ * User choice on execution plan confirmation.
158
+ *
159
+ * @example
160
+ * const choice: UserChoice = { choice: 'approve' };
161
+ * const editChoice: UserChoice = { choice: 'edit', modifications: ['Skip step 2'] };
162
+ */
163
+ export type UserChoice = z.infer<typeof UserChoiceSchema>;
164
+
165
+ /**
166
+ * Complete dashboard data aggregating all metrics.
167
+ * This is the main data structure passed to renderers.
168
+ *
169
+ * @example
170
+ * const data: DashboardData = {
171
+ * globalStatus: { ... },
172
+ * agentMetrics: { 'security-auditor': { ... } },
173
+ * wuProgress: [{ ... }],
174
+ * timeline: [{ ... }],
175
+ * alerts: [{ ... }],
176
+ * };
177
+ */
178
+ export type DashboardData = z.infer<typeof DashboardDataSchema>;
@@ -0,0 +1,90 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ /**
5
+ * @file incremental-test.ts
6
+ * @description Helpers for Vitest --changed execution
7
+ *
8
+ * WU-1920: Add incremental test execution to gates
9
+ * WU-2504: Use Vitest --changed instead of custom file diff logic
10
+ */
11
+
12
+ import { GIT_REFS } from '../constants/wu-git-constants.js';
13
+
14
+ // WU-2790 follow-up: the software-delivery pack cannot import from
15
+ // @lumenflow/core (pack import-boundary enforcement restricts packs to
16
+ // @lumenflow/kernel + Node built-ins). Vitest --changed's base branch
17
+ // therefore stays on the pack's own GIT_REFS constant. If the host
18
+ // workspace reconfigures software_delivery.git.mainBranch, incremental
19
+ // test selection here falls back to origin/main — slightly over-selects
20
+ // when running --changed, but preserves correctness. Proper fix requires
21
+ // relocating the integration-target resolver into kernel; tracked
22
+ // separately as a pack-boundary follow-up.
23
+
24
+ /**
25
+ * Glob patterns to exclude slow integration/golden tests from changed runs.
26
+ * @type {string[]}
27
+ */
28
+ export const VITEST_CHANGED_EXCLUDES = Object.freeze(['**/*.integration.*', '**/golden-*.test.*']);
29
+
30
+ /**
31
+ * File extensions considered executable code for test runs.
32
+ * @type {string[]}
33
+ */
34
+ export const CODE_FILE_EXTENSIONS = Object.freeze([
35
+ '.ts',
36
+ '.tsx',
37
+ '.js',
38
+ '.jsx',
39
+ '.js',
40
+ '.cjs',
41
+ '.mts',
42
+ '.cts',
43
+ ]);
44
+
45
+ /**
46
+ * Check if a path points to a code file that should trigger full tests.
47
+ *
48
+ * @param {string} filePath - Path to check
49
+ * @returns {boolean} True if the path has a code extension
50
+ */
51
+ export function isCodeFilePath(filePath: string) {
52
+ if (!filePath || typeof filePath !== 'string') {
53
+ return false;
54
+ }
55
+
56
+ const normalized = filePath.replace(/\\/g, '/').toLowerCase();
57
+ return CODE_FILE_EXTENSIONS.some((ext) => normalized.endsWith(ext));
58
+ }
59
+
60
+ /**
61
+ * Options for building Vitest changed args
62
+ */
63
+ interface BuildVitestChangedArgsOptions {
64
+ /** Base branch for diff */
65
+ baseBranch?: string;
66
+ }
67
+
68
+ /**
69
+ * Build Vitest CLI args for --changed runs.
70
+ *
71
+ * @param {BuildVitestChangedArgsOptions} [options]
72
+ * @returns {string[]} Vitest args for changed test runs
73
+ */
74
+ export function buildVitestChangedArgs(options: BuildVitestChangedArgsOptions = {}) {
75
+ const { baseBranch = GIT_REFS.ORIGIN_MAIN } = options;
76
+ const args = [
77
+ '--changed',
78
+ baseBranch,
79
+ '--run',
80
+ '--passWithNoTests',
81
+ '--maxWorkers=1',
82
+ '--teardownTimeout=30000',
83
+ ];
84
+
85
+ for (const pattern of VITEST_CHANGED_EXCLUDES) {
86
+ args.push(`--exclude='${pattern}'`);
87
+ }
88
+
89
+ return args;
90
+ }
@@ -0,0 +1,6 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ // WU-2683 (INIT-058 L4): Methodology cohort barrel — re-export relocated modules.
5
+ export * from './manual-test-validator.js';
6
+ export * from './incremental-test.js';