oxe-cc 1.0.0 → 1.3.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 (322) hide show
  1. package/.cursor/commands/oxe-ask.md +3 -3
  2. package/.cursor/commands/oxe-capabilities.md +3 -3
  3. package/.cursor/commands/oxe-checkpoint.md +3 -3
  4. package/.cursor/commands/oxe-compact.md +3 -3
  5. package/.cursor/commands/oxe-dashboard.md +3 -3
  6. package/.cursor/commands/oxe-debug.md +3 -3
  7. package/.cursor/commands/oxe-discuss.md +3 -3
  8. package/.cursor/commands/oxe-execute.md +7 -4
  9. package/.cursor/commands/oxe-forensics.md +3 -3
  10. package/.cursor/commands/oxe-help.md +3 -3
  11. package/.cursor/commands/oxe-loop.md +3 -3
  12. package/.cursor/commands/oxe-milestone.md +3 -3
  13. package/.cursor/commands/oxe-next.md +3 -3
  14. package/.cursor/commands/oxe-obs.md +3 -3
  15. package/.cursor/commands/oxe-plan-agent.md +3 -3
  16. package/.cursor/commands/oxe-plan.md +3 -3
  17. package/.cursor/commands/oxe-project.md +3 -3
  18. package/.cursor/commands/oxe-quick.md +3 -3
  19. package/.cursor/commands/oxe-research.md +3 -3
  20. package/.cursor/commands/oxe-retro.md +3 -3
  21. package/.cursor/commands/oxe-review-pr.md +3 -3
  22. package/.cursor/commands/oxe-route.md +3 -3
  23. package/.cursor/commands/oxe-scan.md +3 -3
  24. package/.cursor/commands/oxe-security.md +3 -3
  25. package/.cursor/commands/oxe-session.md +4 -4
  26. package/.cursor/commands/oxe-ship.md +45 -0
  27. package/.cursor/commands/oxe-skill.md +3 -3
  28. package/.cursor/commands/oxe-spec.md +3 -3
  29. package/.cursor/commands/oxe-ui-review.md +3 -3
  30. package/.cursor/commands/oxe-ui-spec.md +3 -3
  31. package/.cursor/commands/oxe-update.md +3 -3
  32. package/.cursor/commands/oxe-validate-gaps.md +3 -3
  33. package/.cursor/commands/oxe-verify.md +6 -3
  34. package/.cursor/commands/oxe-workstream.md +3 -3
  35. package/.cursor/commands/oxe.md +6 -6
  36. package/.github/copilot-instructions.md +94 -4
  37. package/.github/prompts/oxe-ask.prompt.md +3 -3
  38. package/.github/prompts/oxe-capabilities.prompt.md +3 -3
  39. package/.github/prompts/oxe-checkpoint.prompt.md +3 -3
  40. package/.github/prompts/oxe-compact.prompt.md +3 -3
  41. package/.github/prompts/oxe-dashboard.prompt.md +3 -3
  42. package/.github/prompts/oxe-debug.prompt.md +3 -3
  43. package/.github/prompts/oxe-discuss.prompt.md +3 -3
  44. package/.github/prompts/oxe-execute.prompt.md +7 -4
  45. package/.github/prompts/oxe-forensics.prompt.md +3 -3
  46. package/.github/prompts/oxe-help.prompt.md +3 -3
  47. package/.github/prompts/oxe-loop.prompt.md +3 -3
  48. package/.github/prompts/oxe-milestone.prompt.md +3 -3
  49. package/.github/prompts/oxe-next.prompt.md +3 -3
  50. package/.github/prompts/oxe-obs.prompt.md +3 -3
  51. package/.github/prompts/oxe-plan-agent.prompt.md +3 -3
  52. package/.github/prompts/oxe-plan.prompt.md +3 -3
  53. package/.github/prompts/oxe-project.prompt.md +3 -3
  54. package/.github/prompts/oxe-quick.prompt.md +3 -3
  55. package/.github/prompts/oxe-research.prompt.md +3 -3
  56. package/.github/prompts/oxe-retro.prompt.md +3 -3
  57. package/.github/prompts/oxe-review-pr.prompt.md +3 -3
  58. package/.github/prompts/oxe-route.prompt.md +3 -3
  59. package/.github/prompts/oxe-scan.prompt.md +3 -3
  60. package/.github/prompts/oxe-security.prompt.md +3 -3
  61. package/.github/prompts/oxe-session.prompt.md +4 -4
  62. package/.github/prompts/oxe-ship.prompt.md +45 -0
  63. package/.github/prompts/oxe-skill.prompt.md +3 -3
  64. package/.github/prompts/oxe-spec.prompt.md +3 -3
  65. package/.github/prompts/oxe-ui-review.prompt.md +3 -3
  66. package/.github/prompts/oxe-ui-spec.prompt.md +3 -3
  67. package/.github/prompts/oxe-update.prompt.md +3 -3
  68. package/.github/prompts/oxe-validate-gaps.prompt.md +3 -3
  69. package/.github/prompts/oxe-verify.prompt.md +6 -3
  70. package/.github/prompts/oxe-workstream.prompt.md +3 -3
  71. package/.github/prompts/oxe.prompt.md +5 -5
  72. package/AGENTS.md +43 -28
  73. package/CHANGELOG.md +193 -0
  74. package/README.md +610 -529
  75. package/bin/banner.txt +1 -1
  76. package/bin/lib/oxe-agent-install.cjs +69 -69
  77. package/bin/lib/oxe-azure.cjs +1445 -1445
  78. package/bin/lib/oxe-context-engine.cjs +867 -867
  79. package/bin/lib/oxe-dashboard.cjs +76 -28
  80. package/bin/lib/oxe-operational.cjs +2144 -1340
  81. package/bin/lib/oxe-project-health.cjs +483 -1
  82. package/bin/lib/oxe-runtime-semantics.cjs +12 -0
  83. package/bin/oxe-cc.js +554 -152
  84. package/commands/oxe/ask.md +7 -3
  85. package/commands/oxe/capabilities.md +2 -2
  86. package/commands/oxe/checkpoint.md +3 -3
  87. package/commands/oxe/compact.md +3 -3
  88. package/commands/oxe/dashboard.md +2 -2
  89. package/commands/oxe/debug.md +3 -3
  90. package/commands/oxe/discuss.md +2 -2
  91. package/commands/oxe/execute.md +7 -4
  92. package/commands/oxe/forensics.md +3 -3
  93. package/commands/oxe/help.md +2 -2
  94. package/commands/oxe/loop.md +3 -3
  95. package/commands/oxe/milestone.md +3 -3
  96. package/commands/oxe/next.md +3 -3
  97. package/commands/oxe/obs.md +3 -3
  98. package/commands/oxe/oxe.md +5 -5
  99. package/commands/oxe/plan-agent.md +2 -2
  100. package/commands/oxe/plan.md +2 -2
  101. package/commands/oxe/project.md +3 -3
  102. package/commands/oxe/quick.md +2 -2
  103. package/commands/oxe/research.md +3 -3
  104. package/commands/oxe/retro.md +3 -3
  105. package/commands/oxe/review-pr.md +3 -3
  106. package/commands/oxe/route.md +3 -3
  107. package/commands/oxe/scan.md +3 -3
  108. package/commands/oxe/security.md +3 -3
  109. package/commands/oxe/session.md +4 -4
  110. package/commands/oxe/ship.md +49 -0
  111. package/commands/oxe/skill.md +2 -2
  112. package/commands/oxe/spec.md +4 -4
  113. package/commands/oxe/ui-review.md +3 -3
  114. package/commands/oxe/ui-spec.md +3 -3
  115. package/commands/oxe/update.md +2 -2
  116. package/commands/oxe/validate-gaps.md +3 -3
  117. package/commands/oxe/verify.md +7 -4
  118. package/commands/oxe/workstream.md +3 -3
  119. package/lib/runtime/audit/audit-trail.d.ts +71 -0
  120. package/lib/runtime/audit/audit-trail.js +154 -0
  121. package/lib/runtime/audit/index.d.ts +2 -0
  122. package/lib/runtime/audit/index.js +18 -0
  123. package/lib/runtime/audit/policy-pack.d.ts +15 -0
  124. package/lib/runtime/audit/policy-pack.js +57 -0
  125. package/lib/runtime/context/context-pack-builder.d.ts +15 -0
  126. package/lib/runtime/context/context-pack-builder.js +42 -0
  127. package/lib/runtime/context/context-pack-store.d.ts +38 -0
  128. package/lib/runtime/context/context-pack-store.js +142 -0
  129. package/lib/runtime/context/context-profiles.d.ts +11 -0
  130. package/lib/runtime/context/context-profiles.js +51 -0
  131. package/lib/runtime/context/index.d.ts +2 -0
  132. package/lib/runtime/context/index.js +2 -0
  133. package/lib/runtime/decision/decision-engine.d.ts +43 -0
  134. package/lib/runtime/decision/decision-engine.js +127 -0
  135. package/lib/runtime/decision/decision-memo.d.ts +53 -0
  136. package/lib/runtime/decision/decision-memo.js +173 -0
  137. package/lib/runtime/decision/index.d.ts +2 -0
  138. package/lib/runtime/decision/index.js +18 -0
  139. package/lib/runtime/delivery/branch-manager.d.ts +1 -0
  140. package/lib/runtime/delivery/branch-manager.js +7 -0
  141. package/lib/runtime/delivery/ci-checks.js +34 -1
  142. package/lib/runtime/delivery/delivery-records.d.ts +34 -0
  143. package/lib/runtime/delivery/delivery-records.js +48 -0
  144. package/lib/runtime/delivery/index.d.ts +2 -0
  145. package/lib/runtime/delivery/index.js +2 -0
  146. package/lib/runtime/delivery/promotion-pipeline.d.ts +63 -0
  147. package/lib/runtime/delivery/promotion-pipeline.js +224 -0
  148. package/lib/runtime/gate/gate-manager.d.ts +41 -0
  149. package/lib/runtime/gate/gate-manager.js +108 -1
  150. package/lib/runtime/index.d.ts +5 -2
  151. package/lib/runtime/index.js +7 -1
  152. package/lib/runtime/models/gate-decision.d.ts +4 -1
  153. package/lib/runtime/models/workspace.d.ts +3 -0
  154. package/lib/runtime/plugins/capability-adapter.d.ts +12 -0
  155. package/lib/runtime/plugins/capability-adapter.js +204 -0
  156. package/lib/runtime/plugins/capability-matrix.d.ts +25 -0
  157. package/lib/runtime/plugins/capability-matrix.js +90 -0
  158. package/lib/runtime/plugins/index.d.ts +3 -0
  159. package/lib/runtime/plugins/index.js +3 -0
  160. package/lib/runtime/plugins/plugin-abi.d.ts +2 -0
  161. package/lib/runtime/plugins/plugin-manifest.d.ts +22 -0
  162. package/lib/runtime/plugins/plugin-manifest.js +95 -0
  163. package/lib/runtime/plugins/plugin-registry.d.ts +46 -0
  164. package/lib/runtime/plugins/plugin-registry.js +84 -2
  165. package/lib/runtime/policy/policy-engine.d.ts +47 -1
  166. package/lib/runtime/policy/policy-engine.js +172 -9
  167. package/lib/runtime/projection/projection-engine.d.ts +9 -1
  168. package/lib/runtime/projection/projection-engine.js +73 -3
  169. package/lib/runtime/reducers/run-state-reducer.d.ts +26 -0
  170. package/lib/runtime/reducers/run-state-reducer.js +117 -1
  171. package/lib/runtime/scheduler/agent-registry.d.ts +44 -0
  172. package/lib/runtime/scheduler/agent-registry.js +96 -0
  173. package/lib/runtime/scheduler/agent-roles.d.ts +54 -0
  174. package/lib/runtime/scheduler/agent-roles.js +62 -0
  175. package/lib/runtime/scheduler/index.d.ts +3 -0
  176. package/lib/runtime/scheduler/index.js +3 -0
  177. package/lib/runtime/scheduler/multi-agent-coordinator.d.ts +45 -1
  178. package/lib/runtime/scheduler/multi-agent-coordinator.js +234 -35
  179. package/lib/runtime/scheduler/run-journal.d.ts +18 -0
  180. package/lib/runtime/scheduler/run-journal.js +54 -0
  181. package/lib/runtime/scheduler/scheduler.d.ts +29 -1
  182. package/lib/runtime/scheduler/scheduler.js +387 -14
  183. package/lib/runtime/verification/index.d.ts +1 -0
  184. package/lib/runtime/verification/index.js +1 -0
  185. package/lib/runtime/verification/verification-compiler.d.ts +43 -0
  186. package/lib/runtime/verification/verification-compiler.js +137 -0
  187. package/lib/runtime/verification/verification-manifest.d.ts +67 -0
  188. package/lib/runtime/verification/verification-manifest.js +179 -0
  189. package/lib/runtime/workspace/strategies/ephemeral-container.d.ts +1 -0
  190. package/lib/runtime/workspace/strategies/ephemeral-container.js +4 -0
  191. package/lib/runtime/workspace/strategies/git-worktree.d.ts +1 -0
  192. package/lib/runtime/workspace/strategies/git-worktree.js +2 -0
  193. package/lib/runtime/workspace/strategies/inplace.d.ts +1 -0
  194. package/lib/runtime/workspace/strategies/inplace.js +2 -0
  195. package/lib/runtime/workspace/workspace-manager.d.ts +2 -1
  196. package/lib/sdk/README.md +9 -9
  197. package/lib/sdk/index.cjs +33 -24
  198. package/lib/sdk/index.d.ts +149 -14
  199. package/oxe/templates/ACTIVE-RUN.template.json +32 -32
  200. package/oxe/templates/CAPABILITIES.template.md +7 -7
  201. package/oxe/templates/CAPABILITY.template.md +45 -45
  202. package/oxe/templates/CHECKPOINTS.template.md +7 -7
  203. package/oxe/templates/EXECUTION-RUNTIME.template.md +68 -68
  204. package/oxe/templates/HYPOTHESES.template.md +33 -33
  205. package/oxe/templates/LESSONS-METRICS.template.json +13 -13
  206. package/oxe/templates/NOTES.template.md +16 -16
  207. package/oxe/templates/PLAN-REVIEW.template.md +31 -31
  208. package/oxe/templates/SESSION.template.md +34 -34
  209. package/oxe/templates/SKILL.template.md +26 -26
  210. package/oxe/templates/STATE.md +55 -55
  211. package/oxe/templates/WORKFLOW_AUTHORING.md +18 -18
  212. package/oxe/workflows/ask.md +96 -92
  213. package/oxe/workflows/capabilities.md +25 -25
  214. package/oxe/workflows/checkpoint.md +14 -10
  215. package/oxe/workflows/dashboard.md +33 -33
  216. package/oxe/workflows/debug.md +19 -15
  217. package/oxe/workflows/discuss.md +12 -12
  218. package/oxe/workflows/execute.md +44 -2
  219. package/oxe/workflows/forensics.md +13 -9
  220. package/oxe/workflows/help.md +352 -304
  221. package/oxe/workflows/loop.md +17 -13
  222. package/oxe/workflows/next.md +22 -22
  223. package/oxe/workflows/obs.md +4 -0
  224. package/oxe/workflows/oxe.md +64 -31
  225. package/oxe/workflows/plan-agent.md +9 -9
  226. package/oxe/workflows/project.md +6 -1
  227. package/oxe/workflows/quick.md +10 -10
  228. package/oxe/workflows/references/reasoning-discovery.md +28 -28
  229. package/oxe/workflows/references/reasoning-execution.md +29 -29
  230. package/oxe/workflows/references/reasoning-planning.md +32 -32
  231. package/oxe/workflows/references/reasoning-review.md +29 -29
  232. package/oxe/workflows/references/reasoning-status.md +24 -24
  233. package/oxe/workflows/references/robustness-elevation.md +295 -295
  234. package/oxe/workflows/references/workflow-runtime-contracts.json +952 -907
  235. package/oxe/workflows/research.md +32 -28
  236. package/oxe/workflows/retro.md +4 -0
  237. package/oxe/workflows/review-pr.md +15 -11
  238. package/oxe/workflows/route.md +16 -16
  239. package/oxe/workflows/scan.md +4 -0
  240. package/oxe/workflows/security.md +14 -10
  241. package/oxe/workflows/session.md +213 -197
  242. package/oxe/workflows/ship.md +142 -0
  243. package/oxe/workflows/skill.md +44 -44
  244. package/oxe/workflows/spec.md +15 -0
  245. package/oxe/workflows/ui-review.md +20 -16
  246. package/oxe/workflows/ui-spec.md +7 -3
  247. package/oxe/workflows/validate-gaps.md +13 -9
  248. package/oxe/workflows/verify-audit.md +73 -73
  249. package/oxe/workflows/verify.md +52 -3
  250. package/package.json +92 -92
  251. package/packages/runtime/package.json +17 -17
  252. package/packages/runtime/src/audit/audit-trail.ts +243 -0
  253. package/packages/runtime/src/audit/index.ts +2 -0
  254. package/packages/runtime/src/audit/policy-pack.ts +62 -0
  255. package/packages/runtime/src/compiler/graph-compiler.ts +245 -245
  256. package/packages/runtime/src/compiler/index.ts +1 -1
  257. package/packages/runtime/src/context/context-pack-builder.ts +259 -193
  258. package/packages/runtime/src/context/context-pack-store.ts +197 -0
  259. package/packages/runtime/src/context/context-profiles.ts +60 -0
  260. package/packages/runtime/src/context/index.ts +3 -1
  261. package/packages/runtime/src/decision/decision-engine.ts +174 -0
  262. package/packages/runtime/src/decision/decision-memo.ts +211 -0
  263. package/packages/runtime/src/decision/index.ts +2 -0
  264. package/packages/runtime/src/delivery/branch-manager.ts +91 -84
  265. package/packages/runtime/src/delivery/ci-checks.ts +285 -252
  266. package/packages/runtime/src/delivery/delivery-records.ts +75 -0
  267. package/packages/runtime/src/delivery/index.ts +5 -3
  268. package/packages/runtime/src/delivery/pr-manager.ts +112 -112
  269. package/packages/runtime/src/delivery/promotion-pipeline.ts +334 -0
  270. package/packages/runtime/src/events/bus.ts +92 -92
  271. package/packages/runtime/src/events/catalog.ts +29 -29
  272. package/packages/runtime/src/events/envelope.ts +14 -14
  273. package/packages/runtime/src/events/index.ts +3 -3
  274. package/packages/runtime/src/evidence/evidence-store.ts +130 -130
  275. package/packages/runtime/src/evidence/index.ts +1 -1
  276. package/packages/runtime/src/gate/gate-manager.ts +289 -137
  277. package/packages/runtime/src/gate/index.ts +1 -1
  278. package/packages/runtime/src/index.ts +41 -32
  279. package/packages/runtime/src/models/attempt.ts +19 -19
  280. package/packages/runtime/src/models/evidence.ts +21 -21
  281. package/packages/runtime/src/models/gate-decision.ts +25 -21
  282. package/packages/runtime/src/models/index.ts +8 -8
  283. package/packages/runtime/src/models/run.ts +24 -24
  284. package/packages/runtime/src/models/session.ts +11 -11
  285. package/packages/runtime/src/models/verification-result.ts +10 -10
  286. package/packages/runtime/src/models/work-item.ts +25 -25
  287. package/packages/runtime/src/models/workspace.ts +31 -28
  288. package/packages/runtime/src/plugins/capability-adapter.ts +206 -0
  289. package/packages/runtime/src/plugins/capability-matrix.ts +126 -0
  290. package/packages/runtime/src/plugins/index.ts +5 -2
  291. package/packages/runtime/src/plugins/plugin-abi.ts +97 -95
  292. package/packages/runtime/src/plugins/plugin-manifest.ts +118 -0
  293. package/packages/runtime/src/plugins/plugin-registry.ts +232 -119
  294. package/packages/runtime/src/policy/index.ts +1 -1
  295. package/packages/runtime/src/policy/policy-engine.ts +330 -113
  296. package/packages/runtime/src/projection/index.ts +1 -1
  297. package/packages/runtime/src/projection/projection-engine.ts +328 -249
  298. package/packages/runtime/src/reducers/debug-reducer.ts +36 -36
  299. package/packages/runtime/src/reducers/index.ts +2 -2
  300. package/packages/runtime/src/reducers/run-state-reducer.ts +269 -127
  301. package/packages/runtime/src/scheduler/agent-registry.ts +132 -0
  302. package/packages/runtime/src/scheduler/agent-roles.ts +109 -0
  303. package/packages/runtime/src/scheduler/index.ts +4 -1
  304. package/packages/runtime/src/scheduler/multi-agent-coordinator.ts +521 -231
  305. package/packages/runtime/src/scheduler/run-journal.ts +62 -0
  306. package/packages/runtime/src/scheduler/scheduler.ts +722 -281
  307. package/packages/runtime/src/verification/index.ts +2 -1
  308. package/packages/runtime/src/verification/verification-compiler.ts +436 -225
  309. package/packages/runtime/src/verification/verification-manifest.ts +252 -0
  310. package/packages/runtime/src/workspace/index.ts +5 -5
  311. package/packages/runtime/src/workspace/strategies/ephemeral-container.ts +126 -121
  312. package/packages/runtime/src/workspace/strategies/git-worktree.ts +79 -77
  313. package/packages/runtime/src/workspace/strategies/inplace.ts +38 -35
  314. package/packages/runtime/src/workspace/workspace-manager.ts +16 -15
  315. package/packages/runtime/tsconfig.json +17 -17
  316. package/vscode-extension/.vscodeignore +7 -7
  317. package/vscode-extension/oxe-agents-1.0.0.vsix +0 -0
  318. package/vscode-extension/package.json +185 -185
  319. package/vscode-extension/src/extension.js +310 -310
  320. package/vscode-extension/src/shared/contextLoader.js +137 -137
  321. package/vscode-extension/src/shared/contractBuilder.js +159 -159
  322. package/vscode-extension/src/shared/stateReader.js +101 -101
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: oxe:session
3
- description: "Gerir sessões OXE: new, list, switch, resume, status, close, migrate"
4
- argument-hint: "[new <nome> | list | switch <id> | resume <id> | status | close | migrate <nome>]"
3
+ description: "Gerir sessões, milestones e workstreams OXE (absorve /oxe-project, /oxe-milestone, /oxe-workstream)"
4
+ argument-hint: "[new <nome> | list | switch <id> | close | migrate <nome> | milestone new|status|audit | workstream new|switch|list]"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Bash
@@ -17,7 +17,7 @@ oxe_tool_profile: write_bounded
17
17
  oxe_confidence_policy: explicit
18
18
  oxe_context_tier: standard
19
19
  oxe_contract_version: 2.0.0
20
- oxe_semantics_hash: 4a7e893fe47767a3
20
+ oxe_semantics_hash: df52e7982aeabf21
21
21
  ---
22
22
 
23
23
  <!-- oxe-reasoning-contract:start -->
@@ -31,7 +31,7 @@ oxe_semantics_hash: 4a7e893fe47767a3
31
31
  - **Política de confiança:** explícita
32
32
  - **Tier de contexto padrão:** padrão
33
33
  - **Versão do contrato:** 2.0.0
34
- - **Checksum semântico:** `4a7e893fe47767a3`
34
+ - **Checksum semântico:** `df52e7982aeabf21`
35
35
  - **Entrada de contexto prioritária:** `.oxe/context/packs/session.md` e `.oxe/context/packs/session.json`
36
36
  - **Regra pack-first:** ler o context pack primeiro; se estiver stale, incompleto ou ausente, cair para leitura direta com fallback explícito.
37
37
  - **Inspeção estruturada:** `oxe-cc context inspect --workflow session --json`
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: oxe:ship
3
+ description: "OXE — Entregar: cria commit local com mensagem gerada de SPEC+PLAN+VERIFY. Flags: --message, --amend, --verify-first, --dry-run"
4
+ argument-hint: "[--message 'mensagem'] [--amend] [--verify-first] [--no-checks] [--dry-run]"
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Glob
9
+ - Grep
10
+ - Write
11
+ - Task
12
+ oxe_workflow_slug: ship
13
+ oxe_reasoning_mode: execution
14
+ oxe_question_policy: ask_high_impact_only
15
+ oxe_output_contract: execution
16
+ oxe_tool_profile: write_bounded
17
+ oxe_confidence_policy: explicit
18
+ oxe_context_tier: standard
19
+ oxe_contract_version: 2.0.0
20
+ oxe_semantics_hash: 4a5d304e6ca781fc
21
+ ---
22
+
23
+ <!-- oxe-reasoning-contract:start -->
24
+
25
+ **Contrato de raciocínio OXE deste comando**
26
+ - **Workflow:** ship
27
+ - **Modo:** execução
28
+ - **Perguntas:** perguntar só alto impacto
29
+ - **Saída esperada:** execução
30
+ - **Perfil de ferramentas:** mutação limitada
31
+ - **Política de confiança:** explícita
32
+ - **Tier de contexto padrão:** padrão
33
+ - **Versão do contrato:** 2.0.0
34
+ - **Checksum semântico:** `4a5d304e6ca781fc`
35
+ - **Entrada de contexto prioritária:** `.oxe/context/packs/ship.md` e `.oxe/context/packs/ship.json`
36
+ - **Regra pack-first:** ler o context pack primeiro; se estiver stale, incompleto ou ausente, cair para leitura direta com fallback explícito.
37
+ - **Inspeção estruturada:** `oxe-cc context inspect --workflow ship --json`
38
+ - Fazer reconhecimento curto antes de editar ou executar mutações.
39
+ - Trabalhar no menor write set viável e validar após cada fatia relevante.
40
+ - Parar e explicitar o bloqueio quando houver hipótese crítica não verificada.
41
+ - **Seções esperadas:** Contexto lido · Alvo da mudança · Validação executada · Resultado · Próximo passo
42
+ - **Bloqueios formais:** missing:verify_without_override · missing:tracked_changes
43
+ - **Referência canónica:** `oxe/workflows/references/reasoning-execution.md`
44
+
45
+ <!-- oxe-reasoning-contract:end -->
46
+
47
+ **Workflow canônico:** `oxe/workflows/ship.md`
48
+
49
+ Execute integralmente esse ficheiro na raiz do repositório em que estás a trabalhar. Usa `$ARGUMENTS` como flags de entrega (`--message`, `--amend`, `--verify-first`, `--no-checks`, `--dry-run`).
@@ -17,7 +17,7 @@ oxe_tool_profile: write_bounded
17
17
  oxe_confidence_policy: explicit
18
18
  oxe_context_tier: standard
19
19
  oxe_contract_version: 2.0.0
20
- oxe_semantics_hash: 64cec6f03fc7cfe6
20
+ oxe_semantics_hash: 3cfb16d4930b8a59
21
21
  ---
22
22
 
23
23
  <!-- oxe-reasoning-contract:start -->
@@ -31,7 +31,7 @@ oxe_semantics_hash: 64cec6f03fc7cfe6
31
31
  - **Política de confiança:** explícita
32
32
  - **Tier de contexto padrão:** padrão
33
33
  - **Versão do contrato:** 2.0.0
34
- - **Checksum semântico:** `64cec6f03fc7cfe6`
34
+ - **Checksum semântico:** `3cfb16d4930b8a59`
35
35
  - **Entrada de contexto prioritária:** `.oxe/context/packs/skill.md` e `.oxe/context/packs/skill.json`
36
36
  - **Regra pack-first:** ler o context pack primeiro; se estiver stale, incompleto ou ausente, cair para leitura direta com fallback explícito.
37
37
  - **Inspeção estruturada:** `oxe-cc context inspect --workflow skill --json`
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: oxe:spec
3
- description: "Spec em 5 fases: perguntas pesquisa requisitos R-ID (v1/v2/fora) roteiro ROADMAP.md → aprovação → plan"
4
- argument-hint: "[descrição da feature, ideia ou @arquivo.md com PRD]"
3
+ description: "Spec em 5 fases. Flags: --refresh (scan incremental), --full (scan completo), --research (spike), --ui (gera UI-SPEC)"
4
+ argument-hint: "[descrição da feature | --refresh | --full | --research | --ui]"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Write
@@ -15,7 +15,7 @@ oxe_tool_profile: read_heavy
15
15
  oxe_confidence_policy: explicit
16
16
  oxe_context_tier: standard
17
17
  oxe_contract_version: 2.0.0
18
- oxe_semantics_hash: 598fcdce72e894c8
18
+ oxe_semantics_hash: eea8766eab635c97
19
19
  ---
20
20
 
21
21
  <!-- oxe-reasoning-contract:start -->
@@ -29,7 +29,7 @@ oxe_semantics_hash: 598fcdce72e894c8
29
29
  - **Política de confiança:** explícita
30
30
  - **Tier de contexto padrão:** padrão
31
31
  - **Versão do contrato:** 2.0.0
32
- - **Checksum semântico:** `598fcdce72e894c8`
32
+ - **Checksum semântico:** `eea8766eab635c97`
33
33
  - **Entrada de contexto prioritária:** `.oxe/context/packs/spec.md` e `.oxe/context/packs/spec.json`
34
34
  - **Regra pack-first:** ler o context pack primeiro; se estiver stale, incompleto ou ausente, cair para leitura direta com fallback explícito.
35
35
  - **Inspeção estruturada:** `oxe-cc context inspect --workflow spec --json`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oxe:ui-review
3
- description: OXE Auditoria UI (.oxe/UI-REVIEW.md)
3
+ description: "[DEPRECATED v1.1.0] Incorporado por /oxe-verify. Use: /oxe-verify --ui"
4
4
  argument-hint: "[paths ou Tn opcional]"
5
5
  allowed-tools:
6
6
  - Read
@@ -17,7 +17,7 @@ oxe_tool_profile: review_heavy
17
17
  oxe_confidence_policy: explicit
18
18
  oxe_context_tier: standard
19
19
  oxe_contract_version: 2.0.0
20
- oxe_semantics_hash: 94c1695de8d9ec7d
20
+ oxe_semantics_hash: 262a73b77bf68d6d
21
21
  ---
22
22
 
23
23
  <!-- oxe-reasoning-contract:start -->
@@ -31,7 +31,7 @@ oxe_semantics_hash: 94c1695de8d9ec7d
31
31
  - **Política de confiança:** explícita
32
32
  - **Tier de contexto padrão:** padrão
33
33
  - **Versão do contrato:** 2.0.0
34
- - **Checksum semântico:** `94c1695de8d9ec7d`
34
+ - **Checksum semântico:** `262a73b77bf68d6d`
35
35
  - **Entrada de contexto prioritária:** `.oxe/context/packs/ui-review.md` e `.oxe/context/packs/ui-review.json`
36
36
  - **Regra pack-first:** ler o context pack primeiro; se estiver stale, incompleto ou ausente, cair para leitura direta com fallback explícito.
37
37
  - **Inspeção estruturada:** `oxe-cc context inspect --workflow ui-review --json`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oxe:ui-spec
3
- description: OXE Contrato UI (.oxe/UI-SPEC.md) a partir da SPEC
3
+ description: "[DEPRECATED v1.1.0] Incorporado por /oxe-spec. Use: /oxe-spec --ui para gerar contrato UI/UX"
4
4
  argument-hint: "[âmbito UI opcional]"
5
5
  allowed-tools:
6
6
  - Read
@@ -17,7 +17,7 @@ oxe_tool_profile: mixed
17
17
  oxe_confidence_policy: rubric
18
18
  oxe_context_tier: standard
19
19
  oxe_contract_version: 2.0.0
20
- oxe_semantics_hash: 76ba6d1e0e2f02e6
20
+ oxe_semantics_hash: 5c8a7668f0a9fca1
21
21
  ---
22
22
 
23
23
  <!-- oxe-reasoning-contract:start -->
@@ -31,7 +31,7 @@ oxe_semantics_hash: 76ba6d1e0e2f02e6
31
31
  - **Política de confiança:** rubrica
32
32
  - **Tier de contexto padrão:** padrão
33
33
  - **Versão do contrato:** 2.0.0
34
- - **Checksum semântico:** `76ba6d1e0e2f02e6`
34
+ - **Checksum semântico:** `5c8a7668f0a9fca1`
35
35
  - **Entrada de contexto prioritária:** `.oxe/context/packs/ui-spec.md` e `.oxe/context/packs/ui-spec.json`
36
36
  - **Regra pack-first:** ler o context pack primeiro; se estiver stale, incompleto ou ausente, cair para leitura direta com fallback explícito.
37
37
  - **Inspeção estruturada:** `oxe-cc context inspect --workflow ui-spec --json`
@@ -17,7 +17,7 @@ oxe_tool_profile: write_bounded
17
17
  oxe_confidence_policy: explicit
18
18
  oxe_context_tier: standard
19
19
  oxe_contract_version: 2.0.0
20
- oxe_semantics_hash: 49332cbd409f2ac6
20
+ oxe_semantics_hash: afa0ff72a118df58
21
21
  ---
22
22
 
23
23
  <!-- oxe-reasoning-contract:start -->
@@ -31,7 +31,7 @@ oxe_semantics_hash: 49332cbd409f2ac6
31
31
  - **Política de confiança:** explícita
32
32
  - **Tier de contexto padrão:** padrão
33
33
  - **Versão do contrato:** 2.0.0
34
- - **Checksum semântico:** `49332cbd409f2ac6`
34
+ - **Checksum semântico:** `afa0ff72a118df58`
35
35
  - **Entrada de contexto prioritária:** `.oxe/context/packs/update.md` e `.oxe/context/packs/update.json`
36
36
  - **Regra pack-first:** ler o context pack primeiro; se estiver stale, incompleto ou ausente, cair para leitura direta com fallback explícito.
37
37
  - **Inspeção estruturada:** `oxe-cc context inspect --workflow update --json`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oxe:validate-gaps
3
- description: OXE Auditoria Nyquist-lite (.oxe/VALIDATION-GAPS.md) após verify
3
+ description: "[DEPRECATED v1.1.0] Incorporado por /oxe-verify. Use: /oxe-verify --gaps"
4
4
  argument-hint: "[opcional: Tn ou A*]"
5
5
  allowed-tools:
6
6
  - Read
@@ -17,7 +17,7 @@ oxe_tool_profile: review_heavy
17
17
  oxe_confidence_policy: explicit
18
18
  oxe_context_tier: standard
19
19
  oxe_contract_version: 2.0.0
20
- oxe_semantics_hash: 27d51ac144da4c1c
20
+ oxe_semantics_hash: 69e3f79ec51160e1
21
21
  ---
22
22
 
23
23
  <!-- oxe-reasoning-contract:start -->
@@ -31,7 +31,7 @@ oxe_semantics_hash: 27d51ac144da4c1c
31
31
  - **Política de confiança:** explícita
32
32
  - **Tier de contexto padrão:** padrão
33
33
  - **Versão do contrato:** 2.0.0
34
- - **Checksum semântico:** `27d51ac144da4c1c`
34
+ - **Checksum semântico:** `69e3f79ec51160e1`
35
35
  - **Entrada de contexto prioritária:** `.oxe/context/packs/validate-gaps.md` e `.oxe/context/packs/validate-gaps.json`
36
36
  - **Regra pack-first:** ler o context pack primeiro; se estiver stale, incompleto ou ausente, cair para leitura direta com fallback explícito.
37
37
  - **Inspeção estruturada:** `oxe-cc context inspect --workflow validate-gaps --json`
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: oxe:verify
3
- description: Valida implementação contra SPEC e PLAN; produz checklist e gaps
4
- argument-hint: "[Tn opcional focar uma tarefa]"
3
+ description: "Valida e fecha o ciclo (retro automática). Flags: --gaps, --security, --ui, --pr, --diff, --skip-retro"
4
+ argument-hint: "[Tn | --gaps | --security | --ui | --pr | --diff branchA...branchB | --skip-retro]"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Write
@@ -16,7 +16,7 @@ oxe_tool_profile: review_heavy
16
16
  oxe_confidence_policy: explicit
17
17
  oxe_context_tier: standard
18
18
  oxe_contract_version: 2.0.0
19
- oxe_semantics_hash: 442bb4594208d058
19
+ oxe_semantics_hash: 8b47625394eec62a
20
20
  ---
21
21
 
22
22
  <!-- oxe-reasoning-contract:start -->
@@ -30,7 +30,7 @@ oxe_semantics_hash: 442bb4594208d058
30
30
  - **Política de confiança:** explícita
31
31
  - **Tier de contexto padrão:** padrão
32
32
  - **Versão do contrato:** 2.0.0
33
- - **Checksum semântico:** `442bb4594208d058`
33
+ - **Checksum semântico:** `8b47625394eec62a`
34
34
  - **Entrada de contexto prioritária:** `.oxe/context/packs/verify.md` e `.oxe/context/packs/verify.json`
35
35
  - **Regra pack-first:** ler o context pack primeiro; se estiver stale, incompleto ou ausente, cair para leitura direta com fallback explícito.
36
36
  - **Inspeção estruturada:** `oxe-cc context inspect --workflow verify --json`
@@ -39,6 +39,9 @@ oxe_semantics_hash: 442bb4594208d058
39
39
  - Se não houver findings, declarar isso explicitamente e listar riscos residuais.
40
40
  - **Seções esperadas:** Findings · Perguntas abertas · Riscos residuais · Resumo
41
41
  - **Bloqueios formais:** missing:state
42
+ - **Caminho runtime padrão:** `oxe-cc runtime verify --dir <projeto>` → `oxe-cc runtime project --dir <projeto>`
43
+ - **Artefatos canónicos primários:** `.oxe/runs/<run_id>/verification-manifest.json` · `.oxe/runs/<run_id>/residual-risk-ledger.json` · `.oxe/runs/<run_id>/evidence-coverage.json` · `VERIFY.md projetado`
44
+ - **Fallback runtime:** Se runtime verify não estiver disponível, declarar fallback explícito para a verificação manual; se retornar partial, usar os gaps explícitos como backlog da revisão.
42
45
  - **Referência canónica:** `oxe/workflows/references/reasoning-review.md`
43
46
 
44
47
  <!-- oxe-reasoning-contract:end -->
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oxe:workstream
3
- description: "Trilhas paralelas list, new <nome>, switch <nome>, status, close <nome> — artefatos independentes em .oxe/workstreams/<nome>/"
3
+ description: "[DEPRECATED v1.1.0] Incorporado por /oxe-session. Use: /oxe-session workstream list|new|switch|close"
4
4
  argument-hint: "list | new <nome> | switch <nome> | status | close <nome>"
5
5
  allowed-tools:
6
6
  - Read
@@ -17,7 +17,7 @@ oxe_tool_profile: write_bounded
17
17
  oxe_confidence_policy: explicit
18
18
  oxe_context_tier: standard
19
19
  oxe_contract_version: 2.0.0
20
- oxe_semantics_hash: 82d171363381cc0d
20
+ oxe_semantics_hash: 380bd0a3f3620845
21
21
  ---
22
22
 
23
23
  <!-- oxe-reasoning-contract:start -->
@@ -31,7 +31,7 @@ oxe_semantics_hash: 82d171363381cc0d
31
31
  - **Política de confiança:** explícita
32
32
  - **Tier de contexto padrão:** padrão
33
33
  - **Versão do contrato:** 2.0.0
34
- - **Checksum semântico:** `82d171363381cc0d`
34
+ - **Checksum semântico:** `380bd0a3f3620845`
35
35
  - **Entrada de contexto prioritária:** `.oxe/context/packs/workstream.md` e `.oxe/context/packs/workstream.json`
36
36
  - **Regra pack-first:** ler o context pack primeiro; se estiver stale, incompleto ou ausente, cair para leitura direta com fallback explícito.
37
37
  - **Inspeção estruturada:** `oxe-cc context inspect --workflow workstream --json`
@@ -0,0 +1,71 @@
1
+ export interface AuditQueryFilter {
2
+ action?: AuditAction;
3
+ severity?: AuditSeverity;
4
+ runId?: string;
5
+ since?: string;
6
+ }
7
+ export interface RemoteAuditSink {
8
+ write(entry: AuditEntry): Promise<void>;
9
+ query(filter: AuditQueryFilter): Promise<AuditEntry[]>;
10
+ }
11
+ export interface AuditMetrics {
12
+ total_entries: number;
13
+ critical_count: number;
14
+ warn_count: number;
15
+ by_action: Partial<Record<AuditAction, number>>;
16
+ actors: string[];
17
+ oldest: string | null;
18
+ newest: string | null;
19
+ }
20
+ export type AuditAction = 'run_started' | 'run_completed' | 'run_paused' | 'run_recovered' | 'gate_requested' | 'gate_resolved' | 'policy_denied' | 'plugin_registered' | 'plugin_invoked' | 'secret_accessed' | 'infra_mutation' | 'pr_created' | 'merge_approved' | 'merge_blocked';
21
+ export type AuditSeverity = 'info' | 'warn' | 'critical';
22
+ export interface AuditEntry {
23
+ audit_id: string;
24
+ action: AuditAction;
25
+ severity: AuditSeverity;
26
+ run_id: string | null;
27
+ work_item_id: string | null;
28
+ actor: string;
29
+ resource: string | null;
30
+ detail: Record<string, unknown>;
31
+ timestamp: string;
32
+ }
33
+ export interface RunQuota {
34
+ run_id: string;
35
+ max_work_items: number;
36
+ max_mutations: number;
37
+ max_retries_total: number;
38
+ consumed_work_items: number;
39
+ consumed_mutations: number;
40
+ consumed_retries: number;
41
+ }
42
+ export interface QuotaViolation {
43
+ quota_type: 'work_items' | 'mutations' | 'retries';
44
+ limit: number;
45
+ consumed: number;
46
+ }
47
+ export declare class AuditTrail {
48
+ private readonly projectRoot;
49
+ private readonly remoteSink?;
50
+ constructor(projectRoot: string, remoteSink?: RemoteAuditSink | undefined);
51
+ record(action: AuditAction, actor: string, options?: {
52
+ runId?: string;
53
+ workItemId?: string;
54
+ resource?: string;
55
+ detail?: Record<string, unknown>;
56
+ }): AuditEntry;
57
+ query(filter?: {
58
+ action?: AuditAction;
59
+ severity?: AuditSeverity;
60
+ runId?: string;
61
+ since?: string;
62
+ }): AuditEntry[];
63
+ critical(): AuditEntry[];
64
+ metrics(): AuditMetrics;
65
+ private append;
66
+ private load;
67
+ private trailPath;
68
+ }
69
+ export declare function createQuota(runId: string, limits?: Partial<Omit<RunQuota, 'run_id' | 'consumed_work_items' | 'consumed_mutations' | 'consumed_retries'>>): RunQuota;
70
+ export declare function checkQuota(quota: RunQuota): QuotaViolation | null;
71
+ export declare function consumeQuota(quota: RunQuota, type: QuotaViolation['quota_type'], amount?: number): RunQuota;
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AuditTrail = void 0;
7
+ exports.createQuota = createQuota;
8
+ exports.checkQuota = checkQuota;
9
+ exports.consumeQuota = consumeQuota;
10
+ const crypto_1 = __importDefault(require("crypto"));
11
+ const path_1 = __importDefault(require("path"));
12
+ const fs_1 = __importDefault(require("fs"));
13
+ const ACTION_SEVERITY = {
14
+ run_started: 'info',
15
+ run_completed: 'info',
16
+ run_paused: 'info',
17
+ run_recovered: 'warn',
18
+ gate_requested: 'warn',
19
+ gate_resolved: 'info',
20
+ policy_denied: 'warn',
21
+ plugin_registered: 'info',
22
+ plugin_invoked: 'info',
23
+ secret_accessed: 'critical',
24
+ infra_mutation: 'critical',
25
+ pr_created: 'info',
26
+ merge_approved: 'warn',
27
+ merge_blocked: 'warn',
28
+ };
29
+ class AuditTrail {
30
+ constructor(projectRoot, remoteSink) {
31
+ this.projectRoot = projectRoot;
32
+ this.remoteSink = remoteSink;
33
+ }
34
+ record(action, actor, options = {}) {
35
+ const entry = {
36
+ audit_id: `aud-${crypto_1.default.randomBytes(4).toString('hex')}`,
37
+ action,
38
+ severity: ACTION_SEVERITY[action],
39
+ run_id: options.runId ?? null,
40
+ work_item_id: options.workItemId ?? null,
41
+ actor,
42
+ resource: options.resource ?? null,
43
+ detail: options.detail ?? {},
44
+ timestamp: new Date().toISOString(),
45
+ };
46
+ this.append(entry);
47
+ return entry;
48
+ }
49
+ query(filter = {}) {
50
+ return this.load().filter((e) => {
51
+ if (filter.action && e.action !== filter.action)
52
+ return false;
53
+ if (filter.severity && e.severity !== filter.severity)
54
+ return false;
55
+ if (filter.runId && e.run_id !== filter.runId)
56
+ return false;
57
+ if (filter.since && e.timestamp < filter.since)
58
+ return false;
59
+ return true;
60
+ });
61
+ }
62
+ critical() {
63
+ return this.query({ severity: 'critical' });
64
+ }
65
+ metrics() {
66
+ const entries = this.load();
67
+ const by_action = {};
68
+ const actorSet = new Set();
69
+ let oldest = null;
70
+ let newest = null;
71
+ let critical_count = 0;
72
+ let warn_count = 0;
73
+ for (const e of entries) {
74
+ by_action[e.action] = (by_action[e.action] ?? 0) + 1;
75
+ actorSet.add(e.actor);
76
+ if (e.severity === 'critical')
77
+ critical_count++;
78
+ if (e.severity === 'warn')
79
+ warn_count++;
80
+ if (!oldest || e.timestamp < oldest)
81
+ oldest = e.timestamp;
82
+ if (!newest || e.timestamp > newest)
83
+ newest = e.timestamp;
84
+ }
85
+ return {
86
+ total_entries: entries.length,
87
+ critical_count,
88
+ warn_count,
89
+ by_action,
90
+ actors: [...actorSet],
91
+ oldest,
92
+ newest,
93
+ };
94
+ }
95
+ append(entry) {
96
+ const p = this.trailPath();
97
+ fs_1.default.mkdirSync(path_1.default.dirname(p), { recursive: true });
98
+ fs_1.default.appendFileSync(p, JSON.stringify(entry) + '\n', 'utf8');
99
+ // Fire-and-forget remote sink (failures are non-fatal)
100
+ if (this.remoteSink) {
101
+ this.remoteSink.write(entry).catch(() => { });
102
+ }
103
+ }
104
+ load() {
105
+ const p = this.trailPath();
106
+ if (!fs_1.default.existsSync(p))
107
+ return [];
108
+ try {
109
+ return fs_1.default
110
+ .readFileSync(p, 'utf8')
111
+ .split('\n')
112
+ .filter(Boolean)
113
+ .map((line) => JSON.parse(line));
114
+ }
115
+ catch {
116
+ return [];
117
+ }
118
+ }
119
+ trailPath() {
120
+ return path_1.default.join(this.projectRoot, '.oxe', 'AUDIT-TRAIL.ndjson');
121
+ }
122
+ }
123
+ exports.AuditTrail = AuditTrail;
124
+ // ─── RunQuota ─────────────────────────────────────────────────────────────────
125
+ function createQuota(runId, limits = {}) {
126
+ return {
127
+ run_id: runId,
128
+ max_work_items: limits.max_work_items ?? Infinity,
129
+ max_mutations: limits.max_mutations ?? Infinity,
130
+ max_retries_total: limits.max_retries_total ?? Infinity,
131
+ consumed_work_items: 0,
132
+ consumed_mutations: 0,
133
+ consumed_retries: 0,
134
+ };
135
+ }
136
+ function checkQuota(quota) {
137
+ if (quota.consumed_work_items > quota.max_work_items) {
138
+ return { quota_type: 'work_items', limit: quota.max_work_items, consumed: quota.consumed_work_items };
139
+ }
140
+ if (quota.consumed_mutations > quota.max_mutations) {
141
+ return { quota_type: 'mutations', limit: quota.max_mutations, consumed: quota.consumed_mutations };
142
+ }
143
+ if (quota.consumed_retries > quota.max_retries_total) {
144
+ return { quota_type: 'retries', limit: quota.max_retries_total, consumed: quota.consumed_retries };
145
+ }
146
+ return null;
147
+ }
148
+ function consumeQuota(quota, type, amount = 1) {
149
+ switch (type) {
150
+ case 'work_items': return { ...quota, consumed_work_items: quota.consumed_work_items + amount };
151
+ case 'mutations': return { ...quota, consumed_mutations: quota.consumed_mutations + amount };
152
+ case 'retries': return { ...quota, consumed_retries: quota.consumed_retries + amount };
153
+ }
154
+ }
@@ -0,0 +1,2 @@
1
+ export * from './audit-trail';
2
+ export * from './policy-pack';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./audit-trail"), exports);
18
+ __exportStar(require("./policy-pack"), exports);
@@ -0,0 +1,15 @@
1
+ import type { PolicyRule, EnvironmentGuardrail } from '../policy/policy-engine';
2
+ import { PolicyEngine } from '../policy/policy-engine';
3
+ export interface PolicyPack {
4
+ pack_id: string;
5
+ org_id: string;
6
+ name: string;
7
+ version: string;
8
+ policies: PolicyRule[];
9
+ guardrail: EnvironmentGuardrail;
10
+ created_at: string;
11
+ }
12
+ export declare function savePolicyPack(projectRoot: string, pack: PolicyPack): void;
13
+ export declare function loadPolicyPack(projectRoot: string, packId: string): PolicyPack | null;
14
+ export declare function listPolicyPacks(projectRoot: string): PolicyPack[];
15
+ export declare function applyPolicyPack(engine: PolicyEngine, pack: PolicyPack): PolicyEngine;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.savePolicyPack = savePolicyPack;
7
+ exports.loadPolicyPack = loadPolicyPack;
8
+ exports.listPolicyPacks = listPolicyPacks;
9
+ exports.applyPolicyPack = applyPolicyPack;
10
+ const path_1 = __importDefault(require("path"));
11
+ const fs_1 = __importDefault(require("fs"));
12
+ function packDir(projectRoot) {
13
+ return path_1.default.join(projectRoot, '.oxe', 'policy-packs');
14
+ }
15
+ function packFilePath(projectRoot, packId) {
16
+ return path_1.default.join(packDir(projectRoot), `${packId}.json`);
17
+ }
18
+ function savePolicyPack(projectRoot, pack) {
19
+ const dir = packDir(projectRoot);
20
+ fs_1.default.mkdirSync(dir, { recursive: true });
21
+ fs_1.default.writeFileSync(packFilePath(projectRoot, pack.pack_id), JSON.stringify(pack, null, 2), 'utf8');
22
+ }
23
+ function loadPolicyPack(projectRoot, packId) {
24
+ const p = packFilePath(projectRoot, packId);
25
+ if (!fs_1.default.existsSync(p))
26
+ return null;
27
+ try {
28
+ return JSON.parse(fs_1.default.readFileSync(p, 'utf8'));
29
+ }
30
+ catch {
31
+ return null;
32
+ }
33
+ }
34
+ function listPolicyPacks(projectRoot) {
35
+ const dir = packDir(projectRoot);
36
+ if (!fs_1.default.existsSync(dir))
37
+ return [];
38
+ return fs_1.default
39
+ .readdirSync(dir)
40
+ .filter((f) => f.endsWith('.json'))
41
+ .map((f) => {
42
+ try {
43
+ return JSON.parse(fs_1.default.readFileSync(path_1.default.join(dir, f), 'utf8'));
44
+ }
45
+ catch {
46
+ return null;
47
+ }
48
+ })
49
+ .filter((p) => p !== null);
50
+ }
51
+ function applyPolicyPack(engine, pack) {
52
+ let result = engine.withGuardrail(pack.guardrail);
53
+ for (const rule of pack.policies) {
54
+ result = result.withRule(rule);
55
+ }
56
+ return result;
57
+ }
@@ -1,6 +1,8 @@
1
1
  import type { WorkItem } from '../models/work-item';
2
2
  import type { Evidence } from '../models/evidence';
3
3
  import type { RunState } from '../reducers/run-state-reducer';
4
+ import type { ContextProfile } from './context-profiles';
5
+ import type { AutonomyTier } from '../policy/policy-engine';
4
6
  export interface ContextArtifact {
5
7
  id: string;
6
8
  kind: 'evidence' | 'lesson' | 'file' | 'summary';
@@ -27,10 +29,23 @@ export interface ContextPack {
27
29
  redundancy_removed: number;
28
30
  built_at: string;
29
31
  }
32
+ export interface ContextQualityScore {
33
+ completeness: number;
34
+ relevance_mean: number;
35
+ redundancy: number;
36
+ recency_score: number;
37
+ overall: number;
38
+ }
39
+ export declare function scorePackQuality(pack: ContextPack, profile: ContextProfile): ContextQualityScore;
30
40
  export declare class ContextPackBuilder {
31
41
  private readonly opts;
32
42
  constructor(opts?: ContextPackOptions);
33
43
  build(workItem: WorkItem, state: RunState, evidenceItems: Evidence[], evidenceContents: Map<string, string>, lessons: LessonMetric[]): ContextPack;
34
44
  /** Convenience: build with no evidence, just lessons and state summary */
35
45
  buildLightweight(workItem: WorkItem, state: RunState, lessons: LessonMetric[]): ContextPack;
46
+ /**
47
+ * Filter artifacts to those whose path-like tags are within mutation_scope.
48
+ * L0/L1 tiers apply the filter; L2/L3 skip it (full access).
49
+ */
50
+ filterByMutationScope(artifacts: ContextArtifact[], mutationScope: string[], autonomyTier: AutonomyTier): ContextArtifact[];
36
51
  }