oxe-cc 1.2.1 → 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 (276) hide show
  1. package/.cursor/commands/oxe-ask.md +2 -2
  2. package/.cursor/commands/oxe-capabilities.md +2 -2
  3. package/.cursor/commands/oxe-checkpoint.md +2 -2
  4. package/.cursor/commands/oxe-compact.md +2 -2
  5. package/.cursor/commands/oxe-dashboard.md +2 -2
  6. package/.cursor/commands/oxe-debug.md +2 -2
  7. package/.cursor/commands/oxe-discuss.md +2 -2
  8. package/.cursor/commands/oxe-execute.md +5 -2
  9. package/.cursor/commands/oxe-forensics.md +2 -2
  10. package/.cursor/commands/oxe-help.md +2 -2
  11. package/.cursor/commands/oxe-loop.md +2 -2
  12. package/.cursor/commands/oxe-milestone.md +2 -2
  13. package/.cursor/commands/oxe-next.md +2 -2
  14. package/.cursor/commands/oxe-obs.md +2 -2
  15. package/.cursor/commands/oxe-plan-agent.md +2 -2
  16. package/.cursor/commands/oxe-plan.md +2 -2
  17. package/.cursor/commands/oxe-project.md +2 -2
  18. package/.cursor/commands/oxe-quick.md +2 -2
  19. package/.cursor/commands/oxe-research.md +2 -2
  20. package/.cursor/commands/oxe-retro.md +2 -2
  21. package/.cursor/commands/oxe-review-pr.md +2 -2
  22. package/.cursor/commands/oxe-route.md +2 -2
  23. package/.cursor/commands/oxe-scan.md +2 -2
  24. package/.cursor/commands/oxe-security.md +2 -2
  25. package/.cursor/commands/oxe-session.md +2 -2
  26. package/.cursor/commands/oxe-ship.md +2 -2
  27. package/.cursor/commands/oxe-skill.md +2 -2
  28. package/.cursor/commands/oxe-spec.md +2 -2
  29. package/.cursor/commands/oxe-ui-review.md +2 -2
  30. package/.cursor/commands/oxe-ui-spec.md +2 -2
  31. package/.cursor/commands/oxe-update.md +2 -2
  32. package/.cursor/commands/oxe-validate-gaps.md +2 -2
  33. package/.cursor/commands/oxe-verify.md +5 -2
  34. package/.cursor/commands/oxe-workstream.md +2 -2
  35. package/.cursor/commands/oxe.md +2 -2
  36. package/.github/copilot-instructions.md +13 -13
  37. package/.github/prompts/oxe-ask.prompt.md +2 -2
  38. package/.github/prompts/oxe-capabilities.prompt.md +2 -2
  39. package/.github/prompts/oxe-checkpoint.prompt.md +2 -2
  40. package/.github/prompts/oxe-compact.prompt.md +2 -2
  41. package/.github/prompts/oxe-dashboard.prompt.md +2 -2
  42. package/.github/prompts/oxe-debug.prompt.md +2 -2
  43. package/.github/prompts/oxe-discuss.prompt.md +2 -2
  44. package/.github/prompts/oxe-execute.prompt.md +5 -2
  45. package/.github/prompts/oxe-forensics.prompt.md +2 -2
  46. package/.github/prompts/oxe-help.prompt.md +2 -2
  47. package/.github/prompts/oxe-loop.prompt.md +2 -2
  48. package/.github/prompts/oxe-milestone.prompt.md +2 -2
  49. package/.github/prompts/oxe-next.prompt.md +2 -2
  50. package/.github/prompts/oxe-obs.prompt.md +2 -2
  51. package/.github/prompts/oxe-plan-agent.prompt.md +2 -2
  52. package/.github/prompts/oxe-plan.prompt.md +2 -2
  53. package/.github/prompts/oxe-project.prompt.md +2 -2
  54. package/.github/prompts/oxe-quick.prompt.md +2 -2
  55. package/.github/prompts/oxe-research.prompt.md +2 -2
  56. package/.github/prompts/oxe-retro.prompt.md +2 -2
  57. package/.github/prompts/oxe-review-pr.prompt.md +2 -2
  58. package/.github/prompts/oxe-route.prompt.md +2 -2
  59. package/.github/prompts/oxe-scan.prompt.md +2 -2
  60. package/.github/prompts/oxe-security.prompt.md +2 -2
  61. package/.github/prompts/oxe-session.prompt.md +2 -2
  62. package/.github/prompts/oxe-ship.prompt.md +2 -2
  63. package/.github/prompts/oxe-skill.prompt.md +2 -2
  64. package/.github/prompts/oxe-spec.prompt.md +2 -2
  65. package/.github/prompts/oxe-ui-review.prompt.md +2 -2
  66. package/.github/prompts/oxe-ui-spec.prompt.md +2 -2
  67. package/.github/prompts/oxe-update.prompt.md +2 -2
  68. package/.github/prompts/oxe-validate-gaps.prompt.md +2 -2
  69. package/.github/prompts/oxe-verify.prompt.md +5 -2
  70. package/.github/prompts/oxe-workstream.prompt.md +2 -2
  71. package/.github/prompts/oxe.prompt.md +2 -2
  72. package/CHANGELOG.md +52 -17
  73. package/README.md +610 -551
  74. package/bin/banner.txt +1 -1
  75. package/bin/lib/oxe-agent-install.cjs +69 -69
  76. package/bin/lib/oxe-azure.cjs +1445 -1445
  77. package/bin/lib/oxe-context-engine.cjs +867 -867
  78. package/bin/lib/oxe-dashboard.cjs +76 -28
  79. package/bin/lib/oxe-operational.cjs +2144 -1340
  80. package/bin/lib/oxe-project-health.cjs +483 -1
  81. package/bin/lib/oxe-runtime-semantics.cjs +12 -0
  82. package/bin/oxe-cc.js +554 -152
  83. package/commands/oxe/ask.md +2 -2
  84. package/commands/oxe/capabilities.md +2 -2
  85. package/commands/oxe/checkpoint.md +2 -2
  86. package/commands/oxe/compact.md +2 -2
  87. package/commands/oxe/dashboard.md +2 -2
  88. package/commands/oxe/debug.md +2 -2
  89. package/commands/oxe/discuss.md +2 -2
  90. package/commands/oxe/execute.md +5 -2
  91. package/commands/oxe/forensics.md +2 -2
  92. package/commands/oxe/help.md +2 -2
  93. package/commands/oxe/loop.md +2 -2
  94. package/commands/oxe/milestone.md +2 -2
  95. package/commands/oxe/next.md +2 -2
  96. package/commands/oxe/obs.md +2 -2
  97. package/commands/oxe/oxe.md +2 -2
  98. package/commands/oxe/plan-agent.md +2 -2
  99. package/commands/oxe/plan.md +2 -2
  100. package/commands/oxe/project.md +2 -2
  101. package/commands/oxe/quick.md +2 -2
  102. package/commands/oxe/research.md +2 -2
  103. package/commands/oxe/retro.md +2 -2
  104. package/commands/oxe/review-pr.md +2 -2
  105. package/commands/oxe/route.md +2 -2
  106. package/commands/oxe/scan.md +2 -2
  107. package/commands/oxe/security.md +2 -2
  108. package/commands/oxe/session.md +2 -2
  109. package/commands/oxe/ship.md +2 -2
  110. package/commands/oxe/skill.md +2 -2
  111. package/commands/oxe/spec.md +2 -2
  112. package/commands/oxe/ui-review.md +2 -2
  113. package/commands/oxe/ui-spec.md +2 -2
  114. package/commands/oxe/update.md +2 -2
  115. package/commands/oxe/validate-gaps.md +2 -2
  116. package/commands/oxe/verify.md +5 -2
  117. package/commands/oxe/workstream.md +2 -2
  118. package/lib/runtime/delivery/branch-manager.d.ts +1 -0
  119. package/lib/runtime/delivery/branch-manager.js +7 -0
  120. package/lib/runtime/delivery/ci-checks.js +34 -1
  121. package/lib/runtime/delivery/delivery-records.d.ts +34 -0
  122. package/lib/runtime/delivery/delivery-records.js +48 -0
  123. package/lib/runtime/delivery/index.d.ts +1 -0
  124. package/lib/runtime/delivery/index.js +1 -0
  125. package/lib/runtime/delivery/promotion-pipeline.d.ts +26 -2
  126. package/lib/runtime/delivery/promotion-pipeline.js +111 -14
  127. package/lib/runtime/gate/gate-manager.d.ts +41 -0
  128. package/lib/runtime/gate/gate-manager.js +108 -1
  129. package/lib/runtime/index.d.ts +2 -2
  130. package/lib/runtime/index.js +3 -1
  131. package/lib/runtime/models/gate-decision.d.ts +4 -1
  132. package/lib/runtime/models/workspace.d.ts +3 -0
  133. package/lib/runtime/plugins/capability-adapter.d.ts +12 -0
  134. package/lib/runtime/plugins/capability-adapter.js +204 -0
  135. package/lib/runtime/plugins/capability-matrix.d.ts +5 -0
  136. package/lib/runtime/plugins/capability-matrix.js +48 -17
  137. package/lib/runtime/plugins/index.d.ts +1 -0
  138. package/lib/runtime/plugins/index.js +1 -0
  139. package/lib/runtime/plugins/plugin-abi.d.ts +2 -0
  140. package/lib/runtime/plugins/plugin-manifest.d.ts +1 -1
  141. package/lib/runtime/plugins/plugin-manifest.js +6 -2
  142. package/lib/runtime/plugins/plugin-registry.d.ts +46 -0
  143. package/lib/runtime/plugins/plugin-registry.js +79 -2
  144. package/lib/runtime/policy/policy-engine.d.ts +19 -0
  145. package/lib/runtime/policy/policy-engine.js +76 -4
  146. package/lib/runtime/projection/projection-engine.d.ts +9 -1
  147. package/lib/runtime/projection/projection-engine.js +73 -3
  148. package/lib/runtime/scheduler/multi-agent-coordinator.d.ts +43 -1
  149. package/lib/runtime/scheduler/multi-agent-coordinator.js +151 -39
  150. package/lib/runtime/scheduler/run-journal.d.ts +1 -1
  151. package/lib/runtime/scheduler/scheduler.d.ts +19 -1
  152. package/lib/runtime/scheduler/scheduler.js +258 -13
  153. package/lib/runtime/verification/verification-compiler.d.ts +43 -0
  154. package/lib/runtime/verification/verification-compiler.js +137 -0
  155. package/lib/runtime/verification/verification-manifest.d.ts +9 -0
  156. package/lib/runtime/verification/verification-manifest.js +56 -6
  157. package/lib/runtime/workspace/strategies/ephemeral-container.d.ts +1 -0
  158. package/lib/runtime/workspace/strategies/ephemeral-container.js +4 -0
  159. package/lib/runtime/workspace/strategies/git-worktree.d.ts +1 -0
  160. package/lib/runtime/workspace/strategies/git-worktree.js +2 -0
  161. package/lib/runtime/workspace/strategies/inplace.d.ts +1 -0
  162. package/lib/runtime/workspace/strategies/inplace.js +2 -0
  163. package/lib/runtime/workspace/workspace-manager.d.ts +2 -1
  164. package/lib/sdk/README.md +9 -9
  165. package/lib/sdk/index.cjs +33 -24
  166. package/lib/sdk/index.d.ts +149 -14
  167. package/oxe/templates/ACTIVE-RUN.template.json +32 -32
  168. package/oxe/templates/CAPABILITIES.template.md +7 -7
  169. package/oxe/templates/CAPABILITY.template.md +45 -45
  170. package/oxe/templates/CHECKPOINTS.template.md +7 -7
  171. package/oxe/templates/EXECUTION-RUNTIME.template.md +68 -68
  172. package/oxe/templates/HYPOTHESES.template.md +33 -33
  173. package/oxe/templates/LESSONS-METRICS.template.json +13 -13
  174. package/oxe/templates/NOTES.template.md +16 -16
  175. package/oxe/templates/PLAN-REVIEW.template.md +31 -31
  176. package/oxe/templates/SESSION.template.md +34 -34
  177. package/oxe/templates/SKILL.template.md +26 -26
  178. package/oxe/templates/STATE.md +55 -55
  179. package/oxe/templates/WORKFLOW_AUTHORING.md +18 -18
  180. package/oxe/workflows/ask.md +96 -96
  181. package/oxe/workflows/capabilities.md +25 -25
  182. package/oxe/workflows/dashboard.md +33 -33
  183. package/oxe/workflows/discuss.md +12 -12
  184. package/oxe/workflows/execute.md +14 -0
  185. package/oxe/workflows/help.md +352 -352
  186. package/oxe/workflows/next.md +22 -22
  187. package/oxe/workflows/oxe.md +6 -6
  188. package/oxe/workflows/plan-agent.md +9 -9
  189. package/oxe/workflows/quick.md +10 -10
  190. package/oxe/workflows/references/reasoning-discovery.md +28 -28
  191. package/oxe/workflows/references/reasoning-execution.md +29 -29
  192. package/oxe/workflows/references/reasoning-planning.md +32 -32
  193. package/oxe/workflows/references/reasoning-review.md +29 -29
  194. package/oxe/workflows/references/reasoning-status.md +24 -24
  195. package/oxe/workflows/references/robustness-elevation.md +295 -295
  196. package/oxe/workflows/references/workflow-runtime-contracts.json +952 -930
  197. package/oxe/workflows/route.md +16 -16
  198. package/oxe/workflows/session.md +213 -213
  199. package/oxe/workflows/ship.md +142 -142
  200. package/oxe/workflows/skill.md +44 -44
  201. package/oxe/workflows/ui-review.md +36 -36
  202. package/oxe/workflows/verify-audit.md +73 -73
  203. package/oxe/workflows/verify.md +10 -0
  204. package/package.json +92 -92
  205. package/packages/runtime/package.json +17 -17
  206. package/packages/runtime/src/audit/audit-trail.ts +243 -243
  207. package/packages/runtime/src/audit/index.ts +2 -2
  208. package/packages/runtime/src/audit/policy-pack.ts +62 -62
  209. package/packages/runtime/src/compiler/graph-compiler.ts +245 -245
  210. package/packages/runtime/src/compiler/index.ts +1 -1
  211. package/packages/runtime/src/context/context-pack-builder.ts +259 -259
  212. package/packages/runtime/src/context/context-pack-store.ts +197 -197
  213. package/packages/runtime/src/context/context-profiles.ts +60 -60
  214. package/packages/runtime/src/context/index.ts +3 -3
  215. package/packages/runtime/src/decision/decision-engine.ts +174 -174
  216. package/packages/runtime/src/decision/decision-memo.ts +211 -211
  217. package/packages/runtime/src/decision/index.ts +2 -2
  218. package/packages/runtime/src/delivery/branch-manager.ts +91 -84
  219. package/packages/runtime/src/delivery/ci-checks.ts +285 -252
  220. package/packages/runtime/src/delivery/delivery-records.ts +75 -0
  221. package/packages/runtime/src/delivery/index.ts +5 -4
  222. package/packages/runtime/src/delivery/pr-manager.ts +112 -112
  223. package/packages/runtime/src/delivery/promotion-pipeline.ts +334 -180
  224. package/packages/runtime/src/events/bus.ts +92 -92
  225. package/packages/runtime/src/events/catalog.ts +29 -29
  226. package/packages/runtime/src/events/envelope.ts +14 -14
  227. package/packages/runtime/src/events/index.ts +3 -3
  228. package/packages/runtime/src/evidence/evidence-store.ts +130 -130
  229. package/packages/runtime/src/evidence/index.ts +1 -1
  230. package/packages/runtime/src/gate/gate-manager.ts +289 -137
  231. package/packages/runtime/src/gate/index.ts +1 -1
  232. package/packages/runtime/src/index.ts +41 -37
  233. package/packages/runtime/src/models/attempt.ts +19 -19
  234. package/packages/runtime/src/models/evidence.ts +21 -21
  235. package/packages/runtime/src/models/gate-decision.ts +25 -21
  236. package/packages/runtime/src/models/index.ts +8 -8
  237. package/packages/runtime/src/models/run.ts +24 -24
  238. package/packages/runtime/src/models/session.ts +11 -11
  239. package/packages/runtime/src/models/verification-result.ts +10 -10
  240. package/packages/runtime/src/models/work-item.ts +25 -25
  241. package/packages/runtime/src/models/workspace.ts +31 -28
  242. package/packages/runtime/src/plugins/capability-adapter.ts +206 -0
  243. package/packages/runtime/src/plugins/capability-matrix.ts +126 -83
  244. package/packages/runtime/src/plugins/index.ts +5 -4
  245. package/packages/runtime/src/plugins/plugin-abi.ts +97 -95
  246. package/packages/runtime/src/plugins/plugin-manifest.ts +118 -113
  247. package/packages/runtime/src/plugins/plugin-registry.ts +232 -124
  248. package/packages/runtime/src/policy/index.ts +1 -1
  249. package/packages/runtime/src/policy/policy-engine.ts +330 -244
  250. package/packages/runtime/src/projection/index.ts +1 -1
  251. package/packages/runtime/src/projection/projection-engine.ts +328 -249
  252. package/packages/runtime/src/reducers/debug-reducer.ts +36 -36
  253. package/packages/runtime/src/reducers/index.ts +2 -2
  254. package/packages/runtime/src/reducers/run-state-reducer.ts +269 -269
  255. package/packages/runtime/src/scheduler/agent-registry.ts +132 -132
  256. package/packages/runtime/src/scheduler/agent-roles.ts +109 -109
  257. package/packages/runtime/src/scheduler/index.ts +4 -4
  258. package/packages/runtime/src/scheduler/multi-agent-coordinator.ts +521 -333
  259. package/packages/runtime/src/scheduler/run-journal.ts +62 -62
  260. package/packages/runtime/src/scheduler/scheduler.ts +722 -441
  261. package/packages/runtime/src/verification/index.ts +2 -2
  262. package/packages/runtime/src/verification/verification-compiler.ts +436 -225
  263. package/packages/runtime/src/verification/verification-manifest.ts +252 -192
  264. package/packages/runtime/src/workspace/index.ts +5 -5
  265. package/packages/runtime/src/workspace/strategies/ephemeral-container.ts +126 -121
  266. package/packages/runtime/src/workspace/strategies/git-worktree.ts +79 -77
  267. package/packages/runtime/src/workspace/strategies/inplace.ts +38 -35
  268. package/packages/runtime/src/workspace/workspace-manager.ts +16 -15
  269. package/packages/runtime/tsconfig.json +17 -17
  270. package/vscode-extension/.vscodeignore +7 -7
  271. package/vscode-extension/oxe-agents-1.0.0.vsix +0 -0
  272. package/vscode-extension/package.json +185 -185
  273. package/vscode-extension/src/extension.js +310 -310
  274. package/vscode-extension/src/shared/contextLoader.js +137 -137
  275. package/vscode-extension/src/shared/contractBuilder.js +159 -159
  276. package/vscode-extension/src/shared/stateReader.js +101 -101
@@ -6,12 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PluginRegistry = void 0;
7
7
  exports.globalRegistry = globalRegistry;
8
8
  exports.resetGlobalRegistry = resetGlobalRegistry;
9
+ exports.registrySummary = registrySummary;
10
+ exports.resolveCapabilityMatrix = resolveCapabilityMatrix;
9
11
  const fs_1 = __importDefault(require("fs"));
10
12
  const path_1 = __importDefault(require("path"));
11
13
  const plugin_manifest_1 = require("./plugin-manifest");
14
+ const capability_matrix_1 = require("./capability-matrix");
15
+ const capability_adapter_1 = require("./capability-adapter");
12
16
  class PluginRegistry {
13
17
  constructor() {
14
18
  this.plugins = [];
19
+ this.loadErrors = [];
15
20
  }
16
21
  register(plugin) {
17
22
  if (this.plugins.some((p) => p.name === plugin.name)) {
@@ -43,8 +48,8 @@ class PluginRegistry {
43
48
  loaded.push(plugin.name);
44
49
  }
45
50
  }
46
- catch {
47
- // skip invalid plugin files
51
+ catch (error) {
52
+ this.loadErrors.push(`Plugin ${fullPath} falhou ao carregar: ${error instanceof Error ? error.message : String(error)}`);
48
53
  }
49
54
  }
50
55
  return loaded;
@@ -106,6 +111,72 @@ class PluginRegistry {
106
111
  ],
107
112
  }));
108
113
  }
114
+ registerProjectCapabilities(projectRoot) {
115
+ const loaded = [];
116
+ for (const plugin of (0, capability_adapter_1.loadCapabilityPlugins)(projectRoot)) {
117
+ try {
118
+ this.register(plugin);
119
+ loaded.push(plugin.name);
120
+ }
121
+ catch (error) {
122
+ this.loadErrors.push(`Capability plugin ${plugin.name} falhou ao registrar: ${error instanceof Error ? error.message : String(error)}`);
123
+ }
124
+ }
125
+ return loaded;
126
+ }
127
+ loadErrorsSnapshot() {
128
+ return [...this.loadErrors];
129
+ }
130
+ clearLoadErrors() {
131
+ this.loadErrors = [];
132
+ }
133
+ snapshot() {
134
+ return this.plugins.map((plugin) => ({
135
+ name: plugin.name,
136
+ version: plugin.version,
137
+ abi_version: plugin.abi_version,
138
+ toolProviders: (plugin.toolProviders ?? []).map((provider) => ({
139
+ name: provider.name,
140
+ kind: provider.kind,
141
+ idempotent: provider.idempotent,
142
+ })),
143
+ workspaceProviders: (plugin.workspaceProviders ?? []).map((provider) => ({
144
+ name: provider.name,
145
+ })),
146
+ verifierProviders: (plugin.verifierProviders ?? []).map((provider) => ({
147
+ name: provider.name,
148
+ })),
149
+ contextProviders: (plugin.contextProviders ?? []).map((provider) => ({
150
+ name: provider.name,
151
+ })),
152
+ }));
153
+ }
154
+ summary() {
155
+ const plugins = this.list();
156
+ const toolProviders = plugins.reduce((sum, plugin) => sum + plugin.providers.filter((provider) => provider.startsWith('tool:')).length, 0);
157
+ const workspaceProviders = plugins.reduce((sum, plugin) => sum + plugin.providers.filter((provider) => provider.startsWith('workspace:')).length, 0);
158
+ const verifierProviders = plugins.reduce((sum, plugin) => sum + plugin.providers.filter((provider) => provider.startsWith('verifier:')).length, 0);
159
+ const contextProviders = plugins.reduce((sum, plugin) => sum + plugin.providers.filter((provider) => provider.startsWith('context:')).length, 0);
160
+ const loadErrors = this.loadErrors.length;
161
+ return {
162
+ total_plugins: plugins.length,
163
+ tool_providers: toolProviders,
164
+ workspace_providers: workspaceProviders,
165
+ verifier_providers: verifierProviders,
166
+ context_providers: contextProviders,
167
+ load_errors: loadErrors,
168
+ pluginsCount: plugins.length,
169
+ toolProviders,
170
+ workspaceProviders,
171
+ verifierProviders,
172
+ contextProviders,
173
+ loadErrors,
174
+ plugins,
175
+ };
176
+ }
177
+ capabilityMatrix() {
178
+ return (0, capability_matrix_1.buildMatrix)(this);
179
+ }
109
180
  }
110
181
  exports.PluginRegistry = PluginRegistry;
111
182
  let _globalRegistry = null;
@@ -117,3 +188,9 @@ function globalRegistry() {
117
188
  function resetGlobalRegistry() {
118
189
  _globalRegistry = null;
119
190
  }
191
+ function registrySummary(registry) {
192
+ return registry.summary();
193
+ }
194
+ function resolveCapabilityMatrix(registry) {
195
+ return registry.capabilityMatrix();
196
+ }
@@ -40,10 +40,21 @@ export interface PolicyContext {
40
40
  node_policy?: NodePolicyConfig;
41
41
  }
42
42
  export interface PolicyDecision {
43
+ decision_id: string;
43
44
  allowed: boolean;
44
45
  gate_required: boolean;
45
46
  reason: string;
46
47
  rule_id: string | null;
48
+ timestamp: string;
49
+ }
50
+ export interface PersistedPolicyDecision extends PolicyDecision {
51
+ run_id: string;
52
+ work_item_id: string | null;
53
+ action: string;
54
+ actor: string;
55
+ override: boolean;
56
+ rationale: string | null;
57
+ context: PolicyContext;
47
58
  }
48
59
  export declare class PolicyEngine {
49
60
  private readonly rules;
@@ -65,3 +76,11 @@ export declare class PolicyEngine {
65
76
  static fromConfigFile(configPath: string): PolicyEngine;
66
77
  static defaultGuardrail(): EnvironmentGuardrail;
67
78
  }
79
+ export declare function savePolicyDecision(projectRoot: string, decision: PersistedPolicyDecision): PersistedPolicyDecision;
80
+ export declare function loadPolicyDecisions(projectRoot: string, runId: string): PersistedPolicyDecision[];
81
+ export declare function summarizePolicyDecisions(decisions: PersistedPolicyDecision[]): {
82
+ total: number;
83
+ denied: number;
84
+ gated: number;
85
+ overridesWithoutRationale: number;
86
+ };
@@ -1,11 +1,21 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.PolicyEngine = void 0;
7
+ exports.savePolicyDecision = savePolicyDecision;
8
+ exports.loadPolicyDecisions = loadPolicyDecisions;
9
+ exports.summarizePolicyDecisions = summarizePolicyDecisions;
10
+ const fs_1 = __importDefault(require("fs"));
11
+ const path_1 = __importDefault(require("path"));
4
12
  const ALLOW_ALL = {
13
+ decision_id: '__default_allow',
5
14
  allowed: true,
6
15
  gate_required: false,
7
16
  reason: 'no matching policy — default allow',
8
17
  rule_id: null,
18
+ timestamp: new Date().toISOString(),
9
19
  };
10
20
  const DEFAULT_GUARDRAIL = {
11
21
  protected_paths: ['.oxe/config.json', '.env', 'package.json'],
@@ -45,23 +55,46 @@ class PolicyEngine {
45
55
  const assertFailed = this.checkAssert(rule.assert, ctx);
46
56
  if (assertFailed) {
47
57
  return {
58
+ decision_id: rule.id,
48
59
  allowed: false,
49
60
  gate_required: false,
50
61
  reason: `Assert failed for rule ${rule.id}: ${assertFailed}`,
51
62
  rule_id: rule.id,
63
+ timestamp: new Date().toISOString(),
52
64
  };
53
65
  }
54
66
  }
55
67
  switch (rule.action) {
56
68
  case 'allow':
57
- return { allowed: true, gate_required: false, reason: `Allowed by rule ${rule.id}`, rule_id: rule.id };
69
+ return {
70
+ decision_id: rule.id,
71
+ allowed: true,
72
+ gate_required: false,
73
+ reason: `Allowed by rule ${rule.id}`,
74
+ rule_id: rule.id,
75
+ timestamp: new Date().toISOString(),
76
+ };
58
77
  case 'deny':
59
- return { allowed: false, gate_required: false, reason: `Denied by rule ${rule.id}`, rule_id: rule.id };
78
+ return {
79
+ decision_id: rule.id,
80
+ allowed: false,
81
+ gate_required: false,
82
+ reason: `Denied by rule ${rule.id}`,
83
+ rule_id: rule.id,
84
+ timestamp: new Date().toISOString(),
85
+ };
60
86
  case 'require_human_gate':
61
- return { allowed: true, gate_required: true, reason: `Gate required by rule ${rule.id}`, rule_id: rule.id };
87
+ return {
88
+ decision_id: rule.id,
89
+ allowed: true,
90
+ gate_required: true,
91
+ reason: `Gate required by rule ${rule.id}`,
92
+ rule_id: rule.id,
93
+ timestamp: new Date().toISOString(),
94
+ };
62
95
  }
63
96
  }
64
- return ALLOW_ALL;
97
+ return { ...ALLOW_ALL, timestamp: new Date().toISOString() };
65
98
  }
66
99
  checkGuardrails(ctx) {
67
100
  // Protected path check
@@ -69,20 +102,24 @@ class PolicyEngine {
69
102
  for (const p of affected) {
70
103
  if (this.guardrail.protected_paths.some((pp) => p === pp || p.startsWith(pp + '/'))) {
71
104
  return {
105
+ decision_id: '__guardrail_path',
72
106
  allowed: true,
73
107
  gate_required: true,
74
108
  reason: `Protected path affected: ${p}`,
75
109
  rule_id: '__guardrail_path',
110
+ timestamp: new Date().toISOString(),
76
111
  };
77
112
  }
78
113
  }
79
114
  // Side effect class requiring gate
80
115
  if (ctx.side_effect_class && this.guardrail.require_human_gate_on.includes(ctx.side_effect_class)) {
81
116
  return {
117
+ decision_id: '__guardrail_side_effect',
82
118
  allowed: true,
83
119
  gate_required: true,
84
120
  reason: `Side effect class '${ctx.side_effect_class}' requires human gate`,
85
121
  rule_id: '__guardrail_side_effect',
122
+ timestamp: new Date().toISOString(),
86
123
  };
87
124
  }
88
125
  return null;
@@ -93,10 +130,12 @@ class PolicyEngine {
93
130
  const allowed = TIER_SIDE_EFFECT_MAP[ctx.autonomy_tier] ?? [];
94
131
  if (!allowed.includes(ctx.side_effect_class)) {
95
132
  return {
133
+ decision_id: '__autonomy_tier',
96
134
  allowed: false,
97
135
  gate_required: false,
98
136
  reason: `Autonomy tier ${ctx.autonomy_tier} does not permit side effect '${ctx.side_effect_class}'`,
99
137
  rule_id: '__autonomy_tier',
138
+ timestamp: new Date().toISOString(),
100
139
  };
101
140
  }
102
141
  return null;
@@ -108,10 +147,12 @@ class PolicyEngine {
108
147
  const count = ctx.mutation_count ?? 0;
109
148
  if (count >= budget) {
110
149
  return {
150
+ decision_id: '__mutation_budget',
111
151
  allowed: false,
112
152
  gate_required: false,
113
153
  reason: `Mutation budget exhausted: ${count}/${budget}`,
114
154
  rule_id: '__mutation_budget',
155
+ timestamp: new Date().toISOString(),
115
156
  };
116
157
  }
117
158
  return null;
@@ -169,3 +210,34 @@ class PolicyEngine {
169
210
  }
170
211
  }
171
212
  exports.PolicyEngine = PolicyEngine;
213
+ function policyDecisionPath(projectRoot, runId) {
214
+ return path_1.default.join(projectRoot, '.oxe', 'runs', runId, 'policy-decisions.json');
215
+ }
216
+ function savePolicyDecision(projectRoot, decision) {
217
+ const target = policyDecisionPath(projectRoot, decision.run_id);
218
+ fs_1.default.mkdirSync(path_1.default.dirname(target), { recursive: true });
219
+ const existing = loadPolicyDecisions(projectRoot, decision.run_id);
220
+ const next = [...existing.filter((item) => item.decision_id !== decision.decision_id), decision];
221
+ fs_1.default.writeFileSync(target, JSON.stringify(next, null, 2), 'utf8');
222
+ return decision;
223
+ }
224
+ function loadPolicyDecisions(projectRoot, runId) {
225
+ const target = policyDecisionPath(projectRoot, runId);
226
+ if (!fs_1.default.existsSync(target))
227
+ return [];
228
+ try {
229
+ const raw = JSON.parse(fs_1.default.readFileSync(target, 'utf8'));
230
+ return Array.isArray(raw) ? raw : [];
231
+ }
232
+ catch {
233
+ return [];
234
+ }
235
+ }
236
+ function summarizePolicyDecisions(decisions) {
237
+ return {
238
+ total: decisions.length,
239
+ denied: decisions.filter((decision) => !decision.allowed).length,
240
+ gated: decisions.filter((decision) => decision.gate_required).length,
241
+ overridesWithoutRationale: decisions.filter((decision) => decision.override && !decision.rationale).length,
242
+ };
243
+ }
@@ -2,10 +2,18 @@ import type { RunState } from '../reducers/run-state-reducer';
2
2
  import type { ExecutionGraph } from '../compiler/graph-compiler';
3
3
  import type { VerificationResult } from '../models/verification-result';
4
4
  import type { CheckResult } from '../verification/verification-compiler';
5
+ import type { VerificationManifest, ResidualRiskLedger } from '../verification/verification-manifest';
5
6
  export declare class ProjectionEngine {
6
7
  projectPlan(state: RunState, graph: ExecutionGraph): string;
7
- projectVerify(state: RunState, results: VerificationResult[], checkResults?: CheckResult[]): string;
8
+ projectVerify(state: RunState, results: VerificationResult[], checkResults?: CheckResult[], manifest?: VerificationManifest | null, riskLedger?: ResidualRiskLedger | null, evidenceCoverage?: {
9
+ total_checks: number;
10
+ checks_with_evidence: number;
11
+ total_evidence_refs: number;
12
+ coverage_percent: number;
13
+ } | null): string;
8
14
  projectState(state: RunState): string;
9
15
  projectRunSummary(state: RunState): string;
10
16
  projectPRSummary(state: RunState, graph: ExecutionGraph): string;
17
+ projectCommitSummary(state: RunState, graph: ExecutionGraph): string;
18
+ projectPromotionSummary(state: RunState, graph: ExecutionGraph): string;
11
19
  }
@@ -66,7 +66,7 @@ class ProjectionEngine {
66
66
  }
67
67
  return lines.join('\n');
68
68
  }
69
- projectVerify(state, results, checkResults) {
69
+ projectVerify(state, results, checkResults, manifest, riskLedger, evidenceCoverage) {
70
70
  const run = state.run;
71
71
  const lines = [
72
72
  '# OXE — Verificação',
@@ -92,6 +92,33 @@ class ProjectionEngine {
92
92
  }
93
93
  lines.push('');
94
94
  }
95
+ if (manifest) {
96
+ lines.push('## Verification Manifest');
97
+ lines.push('');
98
+ lines.push(`- **Checks:** ${manifest.summary.total}`);
99
+ lines.push(`- **Pass:** ${manifest.summary.pass}`);
100
+ lines.push(`- **Fail:** ${manifest.summary.fail}`);
101
+ lines.push(`- **Skip:** ${manifest.summary.skip}`);
102
+ lines.push(`- **Errors:** ${manifest.summary.error}`);
103
+ lines.push(`- **All passed:** ${manifest.summary.all_passed ? 'sim' : 'não'}`);
104
+ lines.push('');
105
+ }
106
+ if (evidenceCoverage) {
107
+ lines.push('## Evidence Coverage');
108
+ lines.push('');
109
+ lines.push(`- **Checks com evidência:** ${evidenceCoverage.checks_with_evidence}/${evidenceCoverage.total_checks}`);
110
+ lines.push(`- **Refs totais:** ${evidenceCoverage.total_evidence_refs}`);
111
+ lines.push(`- **Cobertura:** ${evidenceCoverage.coverage_percent}%`);
112
+ lines.push('');
113
+ }
114
+ if (riskLedger && riskLedger.risks.length > 0) {
115
+ lines.push('## Residual Risks');
116
+ lines.push('');
117
+ for (const risk of riskLedger.risks) {
118
+ lines.push(`- [${risk.severity.toUpperCase()}] ${risk.description}`);
119
+ }
120
+ lines.push('');
121
+ }
95
122
  if (checkResults && checkResults.length > 0) {
96
123
  lines.push('## Resultados dos checks executados');
97
124
  lines.push('');
@@ -181,11 +208,50 @@ class ProjectionEngine {
181
208
  return lines.join('\n');
182
209
  }
183
210
  projectPRSummary(state, graph) {
211
+ return this.projectPromotionSummary(state, graph);
212
+ }
213
+ projectCommitSummary(state, graph) {
184
214
  const run = state.run;
185
215
  const completed = [...state.completedWorkItems];
186
216
  const failed = [...state.failedWorkItems];
217
+ const blocked = [...state.blockedWorkItems];
187
218
  const lines = [
188
- '## Summary',
219
+ '## Commit Summary',
220
+ '',
221
+ `**Run:** \`${run?.run_id ?? '—'}\``,
222
+ `**Status:** ${run?.status ?? '—'}`,
223
+ '',
224
+ '### Included work items',
225
+ '',
226
+ ];
227
+ for (const id of completed) {
228
+ const node = graph.nodes.get(id);
229
+ lines.push(`- ✓ ${node?.title ?? id} (\`${id}\`)`);
230
+ }
231
+ if (failed.length || blocked.length) {
232
+ lines.push('');
233
+ lines.push('### Attention points');
234
+ lines.push('');
235
+ for (const id of failed) {
236
+ const node = graph.nodes.get(id);
237
+ lines.push(`- ✗ ${node?.title ?? id} (\`${id}\`)`);
238
+ }
239
+ for (const id of blocked) {
240
+ const node = graph.nodes.get(id);
241
+ lines.push(`- ⊘ ${node?.title ?? id} (\`${id}\`)`);
242
+ }
243
+ }
244
+ lines.push('');
245
+ lines.push('Generated by OXE Runtime.');
246
+ return lines.join('\n');
247
+ }
248
+ projectPromotionSummary(state, graph) {
249
+ const run = state.run;
250
+ const completed = [...state.completedWorkItems];
251
+ const failed = [...state.failedWorkItems];
252
+ const blocked = [...state.blockedWorkItems];
253
+ const lines = [
254
+ '## Promotion Summary',
189
255
  '',
190
256
  ];
191
257
  if (completed.length > 0) {
@@ -194,13 +260,17 @@ class ProjectionEngine {
194
260
  lines.push(`- ✓ ${node?.title ?? id} (\`${id}\`)`);
195
261
  }
196
262
  }
197
- if (failed.length > 0) {
263
+ if (failed.length > 0 || blocked.length > 0) {
198
264
  lines.push('');
199
265
  lines.push('**⚠️ Incomplete tasks:**');
200
266
  for (const id of failed) {
201
267
  const node = graph.nodes.get(id);
202
268
  lines.push(`- ✗ ${node?.title ?? id} (\`${id}\`)`);
203
269
  }
270
+ for (const id of blocked) {
271
+ const node = graph.nodes.get(id);
272
+ lines.push(`- ⊘ ${node?.title ?? id} (\`${id}\`)`);
273
+ }
204
274
  }
205
275
  lines.push('');
206
276
  lines.push('## Test plan');
@@ -1,6 +1,6 @@
1
1
  import type { ExecutionGraph } from '../compiler/graph-compiler';
2
2
  import type { WorkspaceManager } from '../workspace/workspace-manager';
3
- import type { TaskExecutor, SchedulerContext } from './scheduler';
3
+ import type { TaskExecutor, TaskResult, SchedulerContext } from './scheduler';
4
4
  import type { CooperativeHandoff } from './agent-roles';
5
5
  export type CoordinationMode = 'parallel' | 'competitive' | 'cooperative';
6
6
  export interface AgentSpec {
@@ -18,6 +18,44 @@ export interface CoordinationOptions {
18
18
  runId: string;
19
19
  onEvent?: SchedulerContext['onEvent'];
20
20
  }
21
+ export interface ArbitrationRecord {
22
+ work_item_id: string;
23
+ mode: CoordinationMode;
24
+ winner_agent_id: string | null;
25
+ participant_agent_ids: string[];
26
+ success: boolean;
27
+ failure_class: TaskResult['failure_class'];
28
+ evidence_count: number;
29
+ recorded_at: string;
30
+ }
31
+ export interface MultiAgentOwnership {
32
+ work_item_id: string;
33
+ owner_agent_id: string;
34
+ }
35
+ export interface MultiAgentStatusSnapshot {
36
+ run_id: string;
37
+ mode: CoordinationMode;
38
+ workspace_isolation_required: 'isolated';
39
+ workspace_isolation_enforced: boolean;
40
+ agent_count: number;
41
+ ownership: MultiAgentOwnership[];
42
+ completed: string[];
43
+ failed: string[];
44
+ blocked: string[];
45
+ agent_results: Array<{
46
+ agent_id: string;
47
+ isolation_level: 'shared' | 'isolated';
48
+ assigned_task_ids: string[];
49
+ completed: string[];
50
+ failed: string[];
51
+ }>;
52
+ orphan_reassignments: Array<{
53
+ from_agent_id: string;
54
+ to_agent_id: string;
55
+ work_item_ids: string[];
56
+ }>;
57
+ updated_at: string;
58
+ }
21
59
  export interface CoordinationResult {
22
60
  mode: CoordinationMode;
23
61
  run_id: string;
@@ -30,7 +68,11 @@ export interface CoordinationResult {
30
68
  failed: string[];
31
69
  }>;
32
70
  handoffs?: CooperativeHandoff[];
71
+ arbitration_results?: ArbitrationRecord[];
72
+ state?: MultiAgentStatusSnapshot;
33
73
  }
34
74
  export declare class MultiAgentCoordinator {
35
75
  run(graph: ExecutionGraph, opts: CoordinationOptions): Promise<CoordinationResult>;
36
76
  }
77
+ export declare function multiAgentStatePath(projectRoot: string, runId: string): string;
78
+ export declare function loadMultiAgentState(projectRoot: string, runId: string): MultiAgentStatusSnapshot | null;