oxe-cc 0.9.3 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/commands/oxe-ask.md +1 -1
- package/.cursor/commands/oxe-capabilities.md +1 -1
- package/.cursor/commands/oxe-checkpoint.md +1 -1
- package/.cursor/commands/oxe-compact.md +1 -1
- package/.cursor/commands/oxe-dashboard.md +1 -1
- package/.cursor/commands/oxe-debug.md +1 -1
- package/.cursor/commands/oxe-discuss.md +1 -1
- package/.cursor/commands/oxe-execute.md +2 -2
- package/.cursor/commands/oxe-forensics.md +1 -1
- package/.cursor/commands/oxe-help.md +1 -1
- package/.cursor/commands/oxe-loop.md +1 -1
- package/.cursor/commands/oxe-milestone.md +1 -1
- package/.cursor/commands/oxe-next.md +1 -1
- package/.cursor/commands/oxe-obs.md +1 -1
- package/.cursor/commands/oxe-plan-agent.md +1 -1
- package/.cursor/commands/oxe-plan.md +1 -1
- package/.cursor/commands/oxe-project.md +1 -1
- package/.cursor/commands/oxe-quick.md +1 -1
- package/.cursor/commands/oxe-research.md +1 -1
- package/.cursor/commands/oxe-retro.md +1 -1
- package/.cursor/commands/oxe-review-pr.md +1 -1
- package/.cursor/commands/oxe-route.md +1 -1
- package/.cursor/commands/oxe-scan.md +1 -1
- package/.cursor/commands/oxe-security.md +1 -1
- package/.cursor/commands/oxe-session.md +2 -2
- package/.cursor/commands/oxe-ship.md +45 -0
- package/.cursor/commands/oxe-skill.md +1 -1
- package/.cursor/commands/oxe-spec.md +1 -1
- package/.cursor/commands/oxe-ui-review.md +1 -1
- package/.cursor/commands/oxe-ui-spec.md +1 -1
- package/.cursor/commands/oxe-update.md +1 -1
- package/.cursor/commands/oxe-validate-gaps.md +1 -1
- package/.cursor/commands/oxe-verify.md +1 -1
- package/.cursor/commands/oxe-workstream.md +1 -1
- package/.cursor/commands/oxe.md +4 -4
- package/.github/copilot-instructions.md +91 -1
- package/.github/prompts/oxe-ask.prompt.md +1 -1
- package/.github/prompts/oxe-capabilities.prompt.md +1 -1
- package/.github/prompts/oxe-checkpoint.prompt.md +1 -1
- package/.github/prompts/oxe-compact.prompt.md +1 -1
- package/.github/prompts/oxe-dashboard.prompt.md +1 -1
- package/.github/prompts/oxe-debug.prompt.md +1 -1
- package/.github/prompts/oxe-discuss.prompt.md +1 -1
- package/.github/prompts/oxe-execute.prompt.md +2 -2
- package/.github/prompts/oxe-forensics.prompt.md +1 -1
- package/.github/prompts/oxe-help.prompt.md +1 -1
- package/.github/prompts/oxe-loop.prompt.md +1 -1
- package/.github/prompts/oxe-milestone.prompt.md +1 -1
- package/.github/prompts/oxe-next.prompt.md +1 -1
- package/.github/prompts/oxe-obs.prompt.md +1 -1
- package/.github/prompts/oxe-plan-agent.prompt.md +1 -1
- package/.github/prompts/oxe-plan.prompt.md +1 -1
- package/.github/prompts/oxe-project.prompt.md +1 -1
- package/.github/prompts/oxe-quick.prompt.md +1 -1
- package/.github/prompts/oxe-research.prompt.md +1 -1
- package/.github/prompts/oxe-retro.prompt.md +1 -1
- package/.github/prompts/oxe-review-pr.prompt.md +1 -1
- package/.github/prompts/oxe-route.prompt.md +1 -1
- package/.github/prompts/oxe-scan.prompt.md +1 -1
- package/.github/prompts/oxe-security.prompt.md +1 -1
- package/.github/prompts/oxe-session.prompt.md +2 -2
- package/.github/prompts/oxe-ship.prompt.md +45 -0
- package/.github/prompts/oxe-skill.prompt.md +1 -1
- package/.github/prompts/oxe-spec.prompt.md +1 -1
- package/.github/prompts/oxe-ui-review.prompt.md +1 -1
- package/.github/prompts/oxe-ui-spec.prompt.md +1 -1
- package/.github/prompts/oxe-update.prompt.md +1 -1
- package/.github/prompts/oxe-validate-gaps.prompt.md +1 -1
- package/.github/prompts/oxe-verify.prompt.md +1 -1
- package/.github/prompts/oxe-workstream.prompt.md +1 -1
- package/.github/prompts/oxe.prompt.md +3 -3
- package/AGENTS.md +43 -28
- package/CHANGELOG.md +158 -0
- package/README.md +72 -50
- package/bin/banner.txt +1 -1
- package/bin/lib/oxe-dashboard.cjs +9 -7
- package/bin/lib/oxe-operational.cjs +569 -4
- package/bin/lib/oxe-project-health.cjs +1 -1
- package/bin/oxe-cc.js +141 -57
- package/commands/oxe/ask.md +5 -1
- package/commands/oxe/checkpoint.md +1 -1
- package/commands/oxe/compact.md +1 -1
- package/commands/oxe/debug.md +1 -1
- package/commands/oxe/execute.md +2 -2
- package/commands/oxe/forensics.md +1 -1
- package/commands/oxe/loop.md +1 -1
- package/commands/oxe/milestone.md +1 -1
- package/commands/oxe/next.md +1 -1
- package/commands/oxe/obs.md +1 -1
- package/commands/oxe/oxe.md +3 -3
- package/commands/oxe/project.md +1 -1
- package/commands/oxe/research.md +1 -1
- package/commands/oxe/retro.md +1 -1
- package/commands/oxe/review-pr.md +1 -1
- package/commands/oxe/route.md +1 -1
- package/commands/oxe/scan.md +1 -1
- package/commands/oxe/security.md +1 -1
- package/commands/oxe/session.md +2 -2
- package/commands/oxe/ship.md +49 -0
- package/commands/oxe/spec.md +2 -2
- package/commands/oxe/ui-review.md +1 -1
- package/commands/oxe/ui-spec.md +1 -1
- package/commands/oxe/validate-gaps.md +1 -1
- package/commands/oxe/verify.md +2 -2
- package/commands/oxe/workstream.md +1 -1
- package/lib/runtime/audit/audit-trail.d.ts +71 -0
- package/lib/runtime/audit/audit-trail.js +154 -0
- package/lib/runtime/audit/index.d.ts +2 -0
- package/lib/runtime/audit/index.js +18 -0
- package/lib/runtime/audit/policy-pack.d.ts +15 -0
- package/lib/runtime/audit/policy-pack.js +57 -0
- package/lib/runtime/compiler/graph-compiler.d.ts +83 -0
- package/lib/runtime/compiler/graph-compiler.js +135 -0
- package/lib/runtime/compiler/index.d.ts +1 -0
- package/lib/runtime/compiler/index.js +17 -0
- package/lib/runtime/context/context-pack-builder.d.ts +51 -0
- package/lib/runtime/context/context-pack-builder.js +178 -0
- package/lib/runtime/context/context-pack-store.d.ts +38 -0
- package/lib/runtime/context/context-pack-store.js +142 -0
- package/lib/runtime/context/context-profiles.d.ts +11 -0
- package/lib/runtime/context/context-profiles.js +51 -0
- package/lib/runtime/context/index.d.ts +3 -0
- package/lib/runtime/context/index.js +19 -0
- package/lib/runtime/decision/decision-engine.d.ts +43 -0
- package/lib/runtime/decision/decision-engine.js +127 -0
- package/lib/runtime/decision/decision-memo.d.ts +53 -0
- package/lib/runtime/decision/decision-memo.js +173 -0
- package/lib/runtime/decision/index.d.ts +2 -0
- package/lib/runtime/decision/index.js +18 -0
- package/lib/runtime/delivery/branch-manager.d.ts +19 -0
- package/lib/runtime/delivery/branch-manager.js +78 -0
- package/lib/runtime/delivery/ci-checks.d.ts +34 -0
- package/lib/runtime/delivery/ci-checks.js +209 -0
- package/lib/runtime/delivery/index.d.ts +4 -0
- package/lib/runtime/delivery/index.js +20 -0
- package/lib/runtime/delivery/pr-manager.d.ts +30 -0
- package/lib/runtime/delivery/pr-manager.js +82 -0
- package/lib/runtime/delivery/promotion-pipeline.d.ts +39 -0
- package/lib/runtime/delivery/promotion-pipeline.js +127 -0
- package/lib/runtime/events/bus.d.ts +9 -0
- package/lib/runtime/events/bus.js +63 -0
- package/lib/runtime/events/catalog.d.ts +3 -0
- package/lib/runtime/events/catalog.js +30 -0
- package/lib/runtime/events/envelope.d.ts +13 -0
- package/lib/runtime/events/envelope.js +2 -0
- package/lib/runtime/events/index.d.ts +3 -0
- package/lib/runtime/events/index.js +19 -0
- package/lib/runtime/evidence/evidence-store.d.ts +22 -0
- package/lib/runtime/evidence/evidence-store.js +106 -0
- package/lib/runtime/evidence/index.d.ts +1 -0
- package/lib/runtime/evidence/index.js +17 -0
- package/lib/runtime/gate/gate-manager.d.ts +39 -0
- package/lib/runtime/gate/gate-manager.js +104 -0
- package/lib/runtime/gate/index.d.ts +1 -0
- package/lib/runtime/gate/index.js +17 -0
- package/lib/runtime/index.d.ts +19 -0
- package/lib/runtime/index.js +44 -0
- package/lib/runtime/models/attempt.d.ts +12 -0
- package/lib/runtime/models/attempt.js +2 -0
- package/lib/runtime/models/evidence.d.ts +9 -0
- package/lib/runtime/models/evidence.js +2 -0
- package/lib/runtime/models/gate-decision.d.ts +10 -0
- package/lib/runtime/models/gate-decision.js +2 -0
- package/lib/runtime/models/index.d.ts +8 -0
- package/lib/runtime/models/index.js +24 -0
- package/lib/runtime/models/run.d.ts +13 -0
- package/lib/runtime/models/run.js +2 -0
- package/lib/runtime/models/session.d.ts +10 -0
- package/lib/runtime/models/session.js +2 -0
- package/lib/runtime/models/verification-result.d.ts +9 -0
- package/lib/runtime/models/verification-result.js +2 -0
- package/lib/runtime/models/work-item.d.ts +15 -0
- package/lib/runtime/models/work-item.js +2 -0
- package/lib/runtime/models/workspace.d.ts +25 -0
- package/lib/runtime/models/workspace.js +2 -0
- package/lib/runtime/plugins/capability-matrix.d.ts +20 -0
- package/lib/runtime/plugins/capability-matrix.js +59 -0
- package/lib/runtime/plugins/index.d.ts +4 -0
- package/lib/runtime/plugins/index.js +20 -0
- package/lib/runtime/plugins/plugin-abi.d.ts +76 -0
- package/lib/runtime/plugins/plugin-abi.js +2 -0
- package/lib/runtime/plugins/plugin-manifest.d.ts +22 -0
- package/lib/runtime/plugins/plugin-manifest.js +91 -0
- package/lib/runtime/plugins/plugin-registry.d.ts +21 -0
- package/lib/runtime/plugins/plugin-registry.js +119 -0
- package/lib/runtime/policy/index.d.ts +1 -0
- package/lib/runtime/policy/index.js +17 -0
- package/lib/runtime/policy/policy-engine.d.ts +67 -0
- package/lib/runtime/policy/policy-engine.js +171 -0
- package/lib/runtime/projection/index.d.ts +1 -0
- package/lib/runtime/projection/index.js +17 -0
- package/lib/runtime/projection/projection-engine.d.ts +11 -0
- package/lib/runtime/projection/projection-engine.js +218 -0
- package/lib/runtime/reducers/debug-reducer.d.ts +10 -0
- package/lib/runtime/reducers/debug-reducer.js +30 -0
- package/lib/runtime/reducers/index.d.ts +2 -0
- package/lib/runtime/reducers/index.js +18 -0
- package/lib/runtime/reducers/run-state-reducer.d.ts +46 -0
- package/lib/runtime/reducers/run-state-reducer.js +226 -0
- package/lib/runtime/scheduler/agent-registry.d.ts +44 -0
- package/lib/runtime/scheduler/agent-registry.js +96 -0
- package/lib/runtime/scheduler/agent-roles.d.ts +54 -0
- package/lib/runtime/scheduler/agent-roles.js +62 -0
- package/lib/runtime/scheduler/index.d.ts +4 -0
- package/lib/runtime/scheduler/index.js +20 -0
- package/lib/runtime/scheduler/multi-agent-coordinator.d.ts +36 -0
- package/lib/runtime/scheduler/multi-agent-coordinator.js +253 -0
- package/lib/runtime/scheduler/run-journal.d.ts +18 -0
- package/lib/runtime/scheduler/run-journal.js +54 -0
- package/lib/runtime/scheduler/scheduler.d.ts +49 -0
- package/lib/runtime/scheduler/scheduler.js +324 -0
- package/lib/runtime/verification/index.d.ts +2 -0
- package/lib/runtime/verification/index.js +18 -0
- package/lib/runtime/verification/verification-compiler.d.ts +56 -0
- package/lib/runtime/verification/verification-compiler.js +147 -0
- package/lib/runtime/verification/verification-manifest.d.ts +58 -0
- package/lib/runtime/verification/verification-manifest.js +129 -0
- package/lib/runtime/workspace/index.d.ts +5 -0
- package/lib/runtime/workspace/index.js +24 -0
- package/lib/runtime/workspace/strategies/ephemeral-container.d.ts +22 -0
- package/lib/runtime/workspace/strategies/ephemeral-container.js +109 -0
- package/lib/runtime/workspace/strategies/git-worktree.d.ts +12 -0
- package/lib/runtime/workspace/strategies/git-worktree.js +79 -0
- package/lib/runtime/workspace/strategies/inplace.d.ts +10 -0
- package/lib/runtime/workspace/strategies/inplace.js +37 -0
- package/lib/runtime/workspace/workspace-manager.d.ts +13 -0
- package/lib/runtime/workspace/workspace-manager.js +2 -0
- package/lib/sdk/index.cjs +24 -7
- package/lib/sdk/index.d.ts +17 -7
- package/oxe/workflows/ask.md +4 -0
- package/oxe/workflows/checkpoint.md +14 -10
- package/oxe/workflows/debug.md +19 -15
- package/oxe/workflows/execute.md +30 -2
- package/oxe/workflows/forensics.md +13 -9
- package/oxe/workflows/help.md +97 -49
- package/oxe/workflows/loop.md +17 -13
- package/oxe/workflows/obs.md +4 -0
- package/oxe/workflows/oxe.md +64 -31
- package/oxe/workflows/project.md +6 -1
- package/oxe/workflows/references/workflow-runtime-contracts.json +23 -0
- package/oxe/workflows/research.md +32 -28
- package/oxe/workflows/retro.md +4 -0
- package/oxe/workflows/review-pr.md +15 -11
- package/oxe/workflows/scan.md +4 -0
- package/oxe/workflows/security.md +14 -10
- package/oxe/workflows/session.md +17 -1
- package/oxe/workflows/ship.md +142 -0
- package/oxe/workflows/spec.md +15 -0
- package/oxe/workflows/ui-review.md +20 -16
- package/oxe/workflows/ui-spec.md +7 -3
- package/oxe/workflows/validate-gaps.md +13 -9
- package/oxe/workflows/verify.md +42 -3
- package/package.json +9 -3
- package/packages/runtime/package.json +17 -0
- package/packages/runtime/src/audit/audit-trail.ts +243 -0
- package/packages/runtime/src/audit/index.ts +2 -0
- package/packages/runtime/src/audit/policy-pack.ts +62 -0
- package/packages/runtime/src/compiler/graph-compiler.ts +245 -0
- package/packages/runtime/src/compiler/index.ts +1 -0
- package/packages/runtime/src/context/context-pack-builder.ts +259 -0
- package/packages/runtime/src/context/context-pack-store.ts +197 -0
- package/packages/runtime/src/context/context-profiles.ts +60 -0
- package/packages/runtime/src/context/index.ts +3 -0
- package/packages/runtime/src/decision/decision-engine.ts +174 -0
- package/packages/runtime/src/decision/decision-memo.ts +211 -0
- package/packages/runtime/src/decision/index.ts +2 -0
- package/packages/runtime/src/delivery/branch-manager.ts +84 -0
- package/packages/runtime/src/delivery/ci-checks.ts +252 -0
- package/packages/runtime/src/delivery/index.ts +4 -0
- package/packages/runtime/src/delivery/pr-manager.ts +112 -0
- package/packages/runtime/src/delivery/promotion-pipeline.ts +180 -0
- package/packages/runtime/src/events/bus.ts +92 -0
- package/packages/runtime/src/events/catalog.ts +29 -0
- package/packages/runtime/src/events/envelope.ts +14 -0
- package/packages/runtime/src/events/index.ts +3 -0
- package/packages/runtime/src/evidence/evidence-store.ts +130 -0
- package/packages/runtime/src/evidence/index.ts +1 -0
- package/packages/runtime/src/gate/gate-manager.ts +137 -0
- package/packages/runtime/src/gate/index.ts +1 -0
- package/packages/runtime/src/index.ts +37 -0
- package/packages/runtime/src/models/attempt.ts +19 -0
- package/packages/runtime/src/models/evidence.ts +21 -0
- package/packages/runtime/src/models/gate-decision.ts +21 -0
- package/packages/runtime/src/models/index.ts +8 -0
- package/packages/runtime/src/models/run.ts +24 -0
- package/packages/runtime/src/models/session.ts +11 -0
- package/packages/runtime/src/models/verification-result.ts +10 -0
- package/packages/runtime/src/models/work-item.ts +25 -0
- package/packages/runtime/src/models/workspace.ts +28 -0
- package/packages/runtime/src/plugins/capability-matrix.ts +83 -0
- package/packages/runtime/src/plugins/index.ts +4 -0
- package/packages/runtime/src/plugins/plugin-abi.ts +95 -0
- package/packages/runtime/src/plugins/plugin-manifest.ts +113 -0
- package/packages/runtime/src/plugins/plugin-registry.ts +124 -0
- package/packages/runtime/src/policy/index.ts +1 -0
- package/packages/runtime/src/policy/policy-engine.ts +244 -0
- package/packages/runtime/src/projection/index.ts +1 -0
- package/packages/runtime/src/projection/projection-engine.ts +249 -0
- package/packages/runtime/src/reducers/debug-reducer.ts +36 -0
- package/packages/runtime/src/reducers/index.ts +2 -0
- package/packages/runtime/src/reducers/run-state-reducer.ts +269 -0
- package/packages/runtime/src/scheduler/agent-registry.ts +132 -0
- package/packages/runtime/src/scheduler/agent-roles.ts +109 -0
- package/packages/runtime/src/scheduler/index.ts +4 -0
- package/packages/runtime/src/scheduler/multi-agent-coordinator.ts +333 -0
- package/packages/runtime/src/scheduler/run-journal.ts +62 -0
- package/packages/runtime/src/scheduler/scheduler.ts +441 -0
- package/packages/runtime/src/verification/index.ts +2 -0
- package/packages/runtime/src/verification/verification-compiler.ts +225 -0
- package/packages/runtime/src/verification/verification-manifest.ts +192 -0
- package/packages/runtime/src/workspace/index.ts +5 -0
- package/packages/runtime/src/workspace/strategies/ephemeral-container.ts +121 -0
- package/packages/runtime/src/workspace/strategies/git-worktree.ts +77 -0
- package/packages/runtime/src/workspace/strategies/inplace.ts +35 -0
- package/packages/runtime/src/workspace/workspace-manager.ts +15 -0
- package/packages/runtime/tsconfig.json +17 -0
- package/vscode-extension/oxe-agents-0.9.2.vsix +0 -0
- package/vscode-extension/oxe-agents-1.0.0.vsix +0 -0
- package/vscode-extension/package.json +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
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.PluginRegistry = void 0;
|
|
7
|
+
exports.globalRegistry = globalRegistry;
|
|
8
|
+
exports.resetGlobalRegistry = resetGlobalRegistry;
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const plugin_manifest_1 = require("./plugin-manifest");
|
|
12
|
+
class PluginRegistry {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.plugins = [];
|
|
15
|
+
}
|
|
16
|
+
register(plugin) {
|
|
17
|
+
if (this.plugins.some((p) => p.name === plugin.name)) {
|
|
18
|
+
throw new Error(`Plugin "${plugin.name}" is already registered`);
|
|
19
|
+
}
|
|
20
|
+
const validation = (0, plugin_manifest_1.validatePlugin)(plugin);
|
|
21
|
+
if (!validation.valid && validation.errors.length > 0) {
|
|
22
|
+
throw new Error(`Plugin "${plugin.name}" failed validation: ${validation.errors.join('; ')}`);
|
|
23
|
+
}
|
|
24
|
+
this.plugins.push(plugin);
|
|
25
|
+
}
|
|
26
|
+
unregister(name) {
|
|
27
|
+
this.plugins = this.plugins.filter((p) => p.name !== name);
|
|
28
|
+
}
|
|
29
|
+
loadFromDirectory(dir) {
|
|
30
|
+
if (!fs_1.default.existsSync(dir))
|
|
31
|
+
return [];
|
|
32
|
+
const loaded = [];
|
|
33
|
+
for (const file of fs_1.default.readdirSync(dir)) {
|
|
34
|
+
if (!file.endsWith('.cjs') && !file.endsWith('.js'))
|
|
35
|
+
continue;
|
|
36
|
+
const fullPath = path_1.default.resolve(dir, file);
|
|
37
|
+
try {
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
39
|
+
const mod = require(fullPath);
|
|
40
|
+
const plugin = 'default' in mod && mod.default ? mod.default : mod;
|
|
41
|
+
if (plugin && plugin.name) {
|
|
42
|
+
this.register(plugin);
|
|
43
|
+
loaded.push(plugin.name);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// skip invalid plugin files
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return loaded;
|
|
51
|
+
}
|
|
52
|
+
toolProviderFor(actionType) {
|
|
53
|
+
for (const plugin of this.plugins) {
|
|
54
|
+
const provider = plugin.toolProviders?.find((p) => p.supports(actionType));
|
|
55
|
+
if (provider)
|
|
56
|
+
return provider;
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
workspaceProviderFor(strategy) {
|
|
61
|
+
for (const plugin of this.plugins) {
|
|
62
|
+
const provider = plugin.workspaceProviders?.find((p) => p.supportsStrategy(strategy));
|
|
63
|
+
if (provider)
|
|
64
|
+
return provider;
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
verifierProviderFor(checkType) {
|
|
69
|
+
for (const plugin of this.plugins) {
|
|
70
|
+
const provider = plugin.verifierProviders?.find((p) => p.supports(checkType));
|
|
71
|
+
if (provider)
|
|
72
|
+
return provider;
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
contextProviderFor(name) {
|
|
77
|
+
for (const plugin of this.plugins) {
|
|
78
|
+
const provider = plugin.contextProviders?.find((p) => p.name === name);
|
|
79
|
+
if (provider)
|
|
80
|
+
return provider;
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
allContextProviders() {
|
|
85
|
+
return this.plugins.flatMap((p) => p.contextProviders ?? []);
|
|
86
|
+
}
|
|
87
|
+
allToolProviders() {
|
|
88
|
+
return this.plugins.flatMap((p) => p.toolProviders ?? []);
|
|
89
|
+
}
|
|
90
|
+
async runHook(hookName, ctx) {
|
|
91
|
+
for (const plugin of this.plugins) {
|
|
92
|
+
const hook = plugin.hooks?.[hookName];
|
|
93
|
+
if (hook)
|
|
94
|
+
await hook(ctx);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
list() {
|
|
98
|
+
return this.plugins.map((p) => ({
|
|
99
|
+
name: p.name,
|
|
100
|
+
version: p.version,
|
|
101
|
+
providers: [
|
|
102
|
+
...(p.toolProviders?.map((tp) => `tool:${tp.name}`) ?? []),
|
|
103
|
+
...(p.workspaceProviders?.map((wp) => `workspace:${wp.name}`) ?? []),
|
|
104
|
+
...(p.verifierProviders?.map((vp) => `verifier:${vp.name}`) ?? []),
|
|
105
|
+
...(p.contextProviders?.map((cp) => `context:${cp.name}`) ?? []),
|
|
106
|
+
],
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.PluginRegistry = PluginRegistry;
|
|
111
|
+
let _globalRegistry = null;
|
|
112
|
+
function globalRegistry() {
|
|
113
|
+
if (!_globalRegistry)
|
|
114
|
+
_globalRegistry = new PluginRegistry();
|
|
115
|
+
return _globalRegistry;
|
|
116
|
+
}
|
|
117
|
+
function resetGlobalRegistry() {
|
|
118
|
+
_globalRegistry = null;
|
|
119
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './policy-engine';
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./policy-engine"), exports);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export type PolicyAction = 'allow' | 'deny' | 'require_human_gate';
|
|
2
|
+
export type SideEffectClass = 'read_fs' | 'write_fs' | 'spawn_process' | 'network_call' | 'git_mutation' | 'db_change' | 'secret_access' | 'infra_operation';
|
|
3
|
+
export type AutonomyTier = 'L0' | 'L1' | 'L2' | 'L3';
|
|
4
|
+
export interface PolicyWhenClause {
|
|
5
|
+
tool?: string;
|
|
6
|
+
env?: string;
|
|
7
|
+
kind?: string;
|
|
8
|
+
side_effect_class?: SideEffectClass;
|
|
9
|
+
autonomy_tier?: AutonomyTier;
|
|
10
|
+
}
|
|
11
|
+
export interface PolicyAssertClause {
|
|
12
|
+
diff_within_scope?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface NodePolicyConfig {
|
|
15
|
+
max_retries: number;
|
|
16
|
+
mutation_budget?: number;
|
|
17
|
+
autonomy_tier?: AutonomyTier;
|
|
18
|
+
allowed_side_effects?: SideEffectClass[];
|
|
19
|
+
}
|
|
20
|
+
export interface EnvironmentGuardrail {
|
|
21
|
+
protected_paths: string[];
|
|
22
|
+
protected_branches: string[];
|
|
23
|
+
require_human_gate_on: SideEffectClass[];
|
|
24
|
+
}
|
|
25
|
+
export interface PolicyRule {
|
|
26
|
+
id: string;
|
|
27
|
+
when: PolicyWhenClause;
|
|
28
|
+
assert?: PolicyAssertClause;
|
|
29
|
+
action: PolicyAction;
|
|
30
|
+
}
|
|
31
|
+
export interface PolicyContext {
|
|
32
|
+
tool: string;
|
|
33
|
+
env?: string;
|
|
34
|
+
kind?: string;
|
|
35
|
+
mutation_scope?: string[];
|
|
36
|
+
affected_paths?: string[];
|
|
37
|
+
side_effect_class?: SideEffectClass;
|
|
38
|
+
autonomy_tier?: AutonomyTier;
|
|
39
|
+
mutation_count?: number;
|
|
40
|
+
node_policy?: NodePolicyConfig;
|
|
41
|
+
}
|
|
42
|
+
export interface PolicyDecision {
|
|
43
|
+
allowed: boolean;
|
|
44
|
+
gate_required: boolean;
|
|
45
|
+
reason: string;
|
|
46
|
+
rule_id: string | null;
|
|
47
|
+
}
|
|
48
|
+
export declare class PolicyEngine {
|
|
49
|
+
private readonly rules;
|
|
50
|
+
private readonly guardrail;
|
|
51
|
+
constructor(rules?: PolicyRule[], guardrail?: EnvironmentGuardrail);
|
|
52
|
+
evaluate(ctx: PolicyContext): PolicyDecision;
|
|
53
|
+
private checkGuardrails;
|
|
54
|
+
private checkAutonomyTier;
|
|
55
|
+
private checkMutationBudget;
|
|
56
|
+
private matches;
|
|
57
|
+
private checkAssert;
|
|
58
|
+
withRule(rule: PolicyRule): PolicyEngine;
|
|
59
|
+
withGuardrail(guardrail: EnvironmentGuardrail): PolicyEngine;
|
|
60
|
+
getGuardrail(): EnvironmentGuardrail;
|
|
61
|
+
static fromConfig(config: {
|
|
62
|
+
policies?: PolicyRule[];
|
|
63
|
+
guardrail?: EnvironmentGuardrail;
|
|
64
|
+
}): PolicyEngine;
|
|
65
|
+
static fromConfigFile(configPath: string): PolicyEngine;
|
|
66
|
+
static defaultGuardrail(): EnvironmentGuardrail;
|
|
67
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolicyEngine = void 0;
|
|
4
|
+
const ALLOW_ALL = {
|
|
5
|
+
allowed: true,
|
|
6
|
+
gate_required: false,
|
|
7
|
+
reason: 'no matching policy — default allow',
|
|
8
|
+
rule_id: null,
|
|
9
|
+
};
|
|
10
|
+
const DEFAULT_GUARDRAIL = {
|
|
11
|
+
protected_paths: ['.oxe/config.json', '.env', 'package.json'],
|
|
12
|
+
protected_branches: ['main', 'master', 'production', 'release'],
|
|
13
|
+
require_human_gate_on: ['infra_operation', 'db_change', 'secret_access'],
|
|
14
|
+
};
|
|
15
|
+
// Autonomy tier → max side effect class allowed without a gate
|
|
16
|
+
const TIER_SIDE_EFFECT_MAP = {
|
|
17
|
+
L0: ['read_fs'],
|
|
18
|
+
L1: ['read_fs', 'write_fs', 'spawn_process'],
|
|
19
|
+
L2: ['read_fs', 'write_fs', 'spawn_process', 'network_call', 'git_mutation'],
|
|
20
|
+
L3: ['read_fs', 'write_fs', 'spawn_process', 'network_call', 'git_mutation', 'db_change', 'secret_access', 'infra_operation'],
|
|
21
|
+
};
|
|
22
|
+
class PolicyEngine {
|
|
23
|
+
constructor(rules = [], guardrail = DEFAULT_GUARDRAIL) {
|
|
24
|
+
this.rules = rules;
|
|
25
|
+
this.guardrail = guardrail;
|
|
26
|
+
}
|
|
27
|
+
evaluate(ctx) {
|
|
28
|
+
// Check autonomy tier first — a denial takes priority over guardrail gates
|
|
29
|
+
const tierDecision = this.checkAutonomyTier(ctx);
|
|
30
|
+
if (tierDecision)
|
|
31
|
+
return tierDecision;
|
|
32
|
+
// Check environment guardrails (may require gate even when tier permits)
|
|
33
|
+
const guardrailDecision = this.checkGuardrails(ctx);
|
|
34
|
+
if (guardrailDecision)
|
|
35
|
+
return guardrailDecision;
|
|
36
|
+
// Check mutation budget
|
|
37
|
+
const budgetDecision = this.checkMutationBudget(ctx);
|
|
38
|
+
if (budgetDecision)
|
|
39
|
+
return budgetDecision;
|
|
40
|
+
// Evaluate rules (first match wins)
|
|
41
|
+
for (const rule of this.rules) {
|
|
42
|
+
if (!this.matches(rule.when, ctx))
|
|
43
|
+
continue;
|
|
44
|
+
if (rule.assert) {
|
|
45
|
+
const assertFailed = this.checkAssert(rule.assert, ctx);
|
|
46
|
+
if (assertFailed) {
|
|
47
|
+
return {
|
|
48
|
+
allowed: false,
|
|
49
|
+
gate_required: false,
|
|
50
|
+
reason: `Assert failed for rule ${rule.id}: ${assertFailed}`,
|
|
51
|
+
rule_id: rule.id,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
switch (rule.action) {
|
|
56
|
+
case 'allow':
|
|
57
|
+
return { allowed: true, gate_required: false, reason: `Allowed by rule ${rule.id}`, rule_id: rule.id };
|
|
58
|
+
case 'deny':
|
|
59
|
+
return { allowed: false, gate_required: false, reason: `Denied by rule ${rule.id}`, rule_id: rule.id };
|
|
60
|
+
case 'require_human_gate':
|
|
61
|
+
return { allowed: true, gate_required: true, reason: `Gate required by rule ${rule.id}`, rule_id: rule.id };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return ALLOW_ALL;
|
|
65
|
+
}
|
|
66
|
+
checkGuardrails(ctx) {
|
|
67
|
+
// Protected path check
|
|
68
|
+
const affected = ctx.affected_paths ?? [];
|
|
69
|
+
for (const p of affected) {
|
|
70
|
+
if (this.guardrail.protected_paths.some((pp) => p === pp || p.startsWith(pp + '/'))) {
|
|
71
|
+
return {
|
|
72
|
+
allowed: true,
|
|
73
|
+
gate_required: true,
|
|
74
|
+
reason: `Protected path affected: ${p}`,
|
|
75
|
+
rule_id: '__guardrail_path',
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Side effect class requiring gate
|
|
80
|
+
if (ctx.side_effect_class && this.guardrail.require_human_gate_on.includes(ctx.side_effect_class)) {
|
|
81
|
+
return {
|
|
82
|
+
allowed: true,
|
|
83
|
+
gate_required: true,
|
|
84
|
+
reason: `Side effect class '${ctx.side_effect_class}' requires human gate`,
|
|
85
|
+
rule_id: '__guardrail_side_effect',
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
checkAutonomyTier(ctx) {
|
|
91
|
+
if (!ctx.autonomy_tier || !ctx.side_effect_class)
|
|
92
|
+
return null;
|
|
93
|
+
const allowed = TIER_SIDE_EFFECT_MAP[ctx.autonomy_tier] ?? [];
|
|
94
|
+
if (!allowed.includes(ctx.side_effect_class)) {
|
|
95
|
+
return {
|
|
96
|
+
allowed: false,
|
|
97
|
+
gate_required: false,
|
|
98
|
+
reason: `Autonomy tier ${ctx.autonomy_tier} does not permit side effect '${ctx.side_effect_class}'`,
|
|
99
|
+
rule_id: '__autonomy_tier',
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
checkMutationBudget(ctx) {
|
|
105
|
+
const budget = ctx.node_policy?.mutation_budget;
|
|
106
|
+
if (budget === undefined || budget === null)
|
|
107
|
+
return null;
|
|
108
|
+
const count = ctx.mutation_count ?? 0;
|
|
109
|
+
if (count >= budget) {
|
|
110
|
+
return {
|
|
111
|
+
allowed: false,
|
|
112
|
+
gate_required: false,
|
|
113
|
+
reason: `Mutation budget exhausted: ${count}/${budget}`,
|
|
114
|
+
rule_id: '__mutation_budget',
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
matches(when, ctx) {
|
|
120
|
+
if (when.tool && when.tool !== ctx.tool)
|
|
121
|
+
return false;
|
|
122
|
+
if (when.env && when.env !== ctx.env)
|
|
123
|
+
return false;
|
|
124
|
+
if (when.kind && when.kind !== ctx.kind)
|
|
125
|
+
return false;
|
|
126
|
+
if (when.side_effect_class && when.side_effect_class !== ctx.side_effect_class)
|
|
127
|
+
return false;
|
|
128
|
+
if (when.autonomy_tier && when.autonomy_tier !== ctx.autonomy_tier)
|
|
129
|
+
return false;
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
checkAssert(assert, ctx) {
|
|
133
|
+
if (assert.diff_within_scope === true) {
|
|
134
|
+
const scope = ctx.mutation_scope ?? [];
|
|
135
|
+
const affected = ctx.affected_paths ?? [];
|
|
136
|
+
if (scope.length === 0)
|
|
137
|
+
return null;
|
|
138
|
+
const outsideScope = affected.filter((p) => !scope.some((s) => p.startsWith(s) || s.startsWith(p)));
|
|
139
|
+
if (outsideScope.length > 0) {
|
|
140
|
+
return `paths outside mutation scope: ${outsideScope.join(', ')}`;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
withRule(rule) {
|
|
146
|
+
return new PolicyEngine([...this.rules, rule], this.guardrail);
|
|
147
|
+
}
|
|
148
|
+
withGuardrail(guardrail) {
|
|
149
|
+
return new PolicyEngine(this.rules, guardrail);
|
|
150
|
+
}
|
|
151
|
+
getGuardrail() {
|
|
152
|
+
return this.guardrail;
|
|
153
|
+
}
|
|
154
|
+
static fromConfig(config) {
|
|
155
|
+
return new PolicyEngine(config.policies ?? [], config.guardrail ?? DEFAULT_GUARDRAIL);
|
|
156
|
+
}
|
|
157
|
+
static fromConfigFile(configPath) {
|
|
158
|
+
try {
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
160
|
+
const cfg = require(configPath);
|
|
161
|
+
return PolicyEngine.fromConfig(cfg);
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return new PolicyEngine();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
static defaultGuardrail() {
|
|
168
|
+
return { ...DEFAULT_GUARDRAIL };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.PolicyEngine = PolicyEngine;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './projection-engine';
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./projection-engine"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RunState } from '../reducers/run-state-reducer';
|
|
2
|
+
import type { ExecutionGraph } from '../compiler/graph-compiler';
|
|
3
|
+
import type { VerificationResult } from '../models/verification-result';
|
|
4
|
+
import type { CheckResult } from '../verification/verification-compiler';
|
|
5
|
+
export declare class ProjectionEngine {
|
|
6
|
+
projectPlan(state: RunState, graph: ExecutionGraph): string;
|
|
7
|
+
projectVerify(state: RunState, results: VerificationResult[], checkResults?: CheckResult[]): string;
|
|
8
|
+
projectState(state: RunState): string;
|
|
9
|
+
projectRunSummary(state: RunState): string;
|
|
10
|
+
projectPRSummary(state: RunState, graph: ExecutionGraph): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProjectionEngine = void 0;
|
|
4
|
+
function isoToDate(iso) {
|
|
5
|
+
if (!iso)
|
|
6
|
+
return '—';
|
|
7
|
+
return iso.slice(0, 10);
|
|
8
|
+
}
|
|
9
|
+
function statusIcon(status) {
|
|
10
|
+
switch (status) {
|
|
11
|
+
case 'completed': return '✓';
|
|
12
|
+
case 'failed': return '✗';
|
|
13
|
+
case 'blocked': return '⊘';
|
|
14
|
+
case 'running': return '⟳';
|
|
15
|
+
default: return '○';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function verifyIcon(status) {
|
|
19
|
+
switch (status) {
|
|
20
|
+
case 'pass': return '✓ PASS';
|
|
21
|
+
case 'fail': return '✗ FAIL';
|
|
22
|
+
case 'skip': return '— SKIP';
|
|
23
|
+
case 'error': return '! ERROR';
|
|
24
|
+
default: return status;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
class ProjectionEngine {
|
|
28
|
+
projectPlan(state, graph) {
|
|
29
|
+
const run = state.run;
|
|
30
|
+
const lines = [
|
|
31
|
+
'# OXE — Plano de Execução',
|
|
32
|
+
'',
|
|
33
|
+
'<!-- Gerado automaticamente pelo Projection Engine — não editar diretamente -->',
|
|
34
|
+
'',
|
|
35
|
+
'## Resumo',
|
|
36
|
+
'',
|
|
37
|
+
`- **Run:** ${run?.run_id ?? '—'}`,
|
|
38
|
+
`- **Status:** ${run?.status ?? 'sem run'}`,
|
|
39
|
+
`- **Iniciado em:** ${isoToDate(run?.started_at)}`,
|
|
40
|
+
`- **Nós:** ${graph.metadata.node_count} tarefas em ${graph.metadata.wave_count} onda(s)`,
|
|
41
|
+
'',
|
|
42
|
+
'## Ondas e tarefas',
|
|
43
|
+
'',
|
|
44
|
+
];
|
|
45
|
+
for (const wave of graph.waves) {
|
|
46
|
+
lines.push(`### Onda ${wave.wave_number}`);
|
|
47
|
+
lines.push('');
|
|
48
|
+
lines.push('| ID | Título | Status | Dependências |');
|
|
49
|
+
lines.push('|----|--------|--------|--------------|');
|
|
50
|
+
for (const nodeId of wave.node_ids) {
|
|
51
|
+
const node = graph.nodes.get(nodeId);
|
|
52
|
+
const wItem = state.workItems.get(nodeId);
|
|
53
|
+
const status = wItem?.status ?? 'pending';
|
|
54
|
+
const deps = node?.depends_on.join(', ') || '—';
|
|
55
|
+
lines.push(`| ${nodeId} | ${node?.title ?? nodeId} | ${statusIcon(status)} ${status} | ${deps} |`);
|
|
56
|
+
}
|
|
57
|
+
lines.push('');
|
|
58
|
+
}
|
|
59
|
+
if (state.completedWorkItems.size > 0 || state.failedWorkItems.size > 0) {
|
|
60
|
+
lines.push('## Progresso');
|
|
61
|
+
lines.push('');
|
|
62
|
+
lines.push(`- **Concluídos:** ${[...state.completedWorkItems].join(', ') || '—'}`);
|
|
63
|
+
lines.push(`- **Falhos:** ${[...state.failedWorkItems].join(', ') || '—'}`);
|
|
64
|
+
lines.push(`- **Bloqueados:** ${[...state.blockedWorkItems].join(', ') || '—'}`);
|
|
65
|
+
lines.push('');
|
|
66
|
+
}
|
|
67
|
+
return lines.join('\n');
|
|
68
|
+
}
|
|
69
|
+
projectVerify(state, results, checkResults) {
|
|
70
|
+
const run = state.run;
|
|
71
|
+
const lines = [
|
|
72
|
+
'# OXE — Verificação',
|
|
73
|
+
'',
|
|
74
|
+
'<!-- Gerado automaticamente pelo Projection Engine — não editar diretamente -->',
|
|
75
|
+
'',
|
|
76
|
+
'## Auditoria de pré-execução',
|
|
77
|
+
'',
|
|
78
|
+
`- **Run:** ${run?.run_id ?? '—'}`,
|
|
79
|
+
`- **Iniciado em:** ${isoToDate(run?.started_at)}`,
|
|
80
|
+
`- **Concluído em:** ${isoToDate(run?.ended_at)}`,
|
|
81
|
+
`- **Status:** ${run?.status ?? '—'}`,
|
|
82
|
+
'',
|
|
83
|
+
];
|
|
84
|
+
if (results.length > 0) {
|
|
85
|
+
lines.push('## Critérios de aceite');
|
|
86
|
+
lines.push('');
|
|
87
|
+
lines.push('| ID | Check | Status | Evidências |');
|
|
88
|
+
lines.push('|----|-------|--------|------------|');
|
|
89
|
+
for (const r of results) {
|
|
90
|
+
const evidenceList = r.evidence_refs.join(', ') || '—';
|
|
91
|
+
lines.push(`| ${r.check_id} | ${r.summary ?? r.check_id} | ${verifyIcon(r.status)} | ${evidenceList} |`);
|
|
92
|
+
}
|
|
93
|
+
lines.push('');
|
|
94
|
+
}
|
|
95
|
+
if (checkResults && checkResults.length > 0) {
|
|
96
|
+
lines.push('## Resultados dos checks executados');
|
|
97
|
+
lines.push('');
|
|
98
|
+
lines.push('| Check | Aceite | Status | Duração |');
|
|
99
|
+
lines.push('|-------|--------|--------|---------|');
|
|
100
|
+
for (const cr of checkResults) {
|
|
101
|
+
lines.push(`| ${cr.check_id} | ${cr.acceptance_ref ?? '—'} | ${verifyIcon(cr.status)} | ${cr.duration_ms}ms |`);
|
|
102
|
+
}
|
|
103
|
+
lines.push('');
|
|
104
|
+
}
|
|
105
|
+
const passed = results.filter((r) => r.status === 'pass').length;
|
|
106
|
+
const failed = results.filter((r) => r.status === 'fail').length;
|
|
107
|
+
const allPass = failed === 0 && results.length > 0;
|
|
108
|
+
lines.push('## Conclusão');
|
|
109
|
+
lines.push('');
|
|
110
|
+
lines.push(`- **Total de critérios:** ${results.length}`);
|
|
111
|
+
lines.push(`- **Aprovados:** ${passed}`);
|
|
112
|
+
lines.push(`- **Reprovados:** ${failed}`);
|
|
113
|
+
lines.push('');
|
|
114
|
+
lines.push(allPass
|
|
115
|
+
? '> ✓ **Verificação concluída com sucesso.** Todos os critérios foram atendidos.'
|
|
116
|
+
: `> ✗ **Verificação com falhas.** ${failed} critério(s) não atendido(s).`);
|
|
117
|
+
lines.push('');
|
|
118
|
+
return lines.join('\n');
|
|
119
|
+
}
|
|
120
|
+
projectState(state) {
|
|
121
|
+
const run = state.run;
|
|
122
|
+
const completed = [...state.completedWorkItems];
|
|
123
|
+
const failed = [...state.failedWorkItems];
|
|
124
|
+
const blocked = [...state.blockedWorkItems];
|
|
125
|
+
const lines = [
|
|
126
|
+
'# OXE — Estado',
|
|
127
|
+
'',
|
|
128
|
+
'<!-- Gerado automaticamente pelo Projection Engine — não editar diretamente -->',
|
|
129
|
+
'',
|
|
130
|
+
'## Fase atual',
|
|
131
|
+
'',
|
|
132
|
+
`- **Status da run:** ${run?.status ?? 'sem run ativa'}`,
|
|
133
|
+
`- **Run ID:** ${run?.run_id ?? '—'}`,
|
|
134
|
+
`- **Modo:** ${run?.mode ?? '—'}`,
|
|
135
|
+
'',
|
|
136
|
+
'## Runtime operacional',
|
|
137
|
+
'',
|
|
138
|
+
`- **runtime_status:** ${run?.status ?? '—'}`,
|
|
139
|
+
`- **active_run_ref:** ${run?.run_id ?? '—'}`,
|
|
140
|
+
'',
|
|
141
|
+
'## Progresso',
|
|
142
|
+
'',
|
|
143
|
+
`- **Concluídos (${completed.length}):** ${completed.join(', ') || '—'}`,
|
|
144
|
+
`- **Falhos (${failed.length}):** ${failed.join(', ') || '—'}`,
|
|
145
|
+
`- **Bloqueados (${blocked.length}):** ${blocked.join(', ') || '—'}`,
|
|
146
|
+
'',
|
|
147
|
+
`- **lifecycleStatus:** ${run?.status === 'completed' ? 'closed' : run?.status === 'running' ? 'executing' : 'pending_execute'}`,
|
|
148
|
+
'',
|
|
149
|
+
];
|
|
150
|
+
return lines.join('\n');
|
|
151
|
+
}
|
|
152
|
+
projectRunSummary(state) {
|
|
153
|
+
const run = state.run;
|
|
154
|
+
const completed = [...state.completedWorkItems];
|
|
155
|
+
const failed = [...state.failedWorkItems];
|
|
156
|
+
const blocked = [...state.blockedWorkItems];
|
|
157
|
+
const totalAttempts = [...state.attempts.values()].reduce((s, a) => s + a.length, 0);
|
|
158
|
+
const lines = [
|
|
159
|
+
`## Run Summary — ${run?.run_id ?? 'unknown'}`,
|
|
160
|
+
'',
|
|
161
|
+
`**Status:** ${run?.status ?? '—'} `,
|
|
162
|
+
`**Mode:** ${run?.mode ?? '—'} `,
|
|
163
|
+
`**Started:** ${isoToDate(run?.started_at)} `,
|
|
164
|
+
`**Ended:** ${isoToDate(run?.ended_at)} `,
|
|
165
|
+
'',
|
|
166
|
+
`**Completed:** ${completed.length} tasks `,
|
|
167
|
+
`**Failed:** ${failed.length} tasks `,
|
|
168
|
+
`**Blocked:** ${blocked.length} tasks `,
|
|
169
|
+
`**Total attempts:** ${totalAttempts} `,
|
|
170
|
+
'',
|
|
171
|
+
];
|
|
172
|
+
if (completed.length > 0) {
|
|
173
|
+
lines.push(`**✓ Completed:** ${completed.join(', ')}`);
|
|
174
|
+
}
|
|
175
|
+
if (failed.length > 0) {
|
|
176
|
+
lines.push(`**✗ Failed:** ${failed.join(', ')}`);
|
|
177
|
+
}
|
|
178
|
+
if (blocked.length > 0) {
|
|
179
|
+
lines.push(`**⊘ Blocked:** ${blocked.join(', ')}`);
|
|
180
|
+
}
|
|
181
|
+
return lines.join('\n');
|
|
182
|
+
}
|
|
183
|
+
projectPRSummary(state, graph) {
|
|
184
|
+
const run = state.run;
|
|
185
|
+
const completed = [...state.completedWorkItems];
|
|
186
|
+
const failed = [...state.failedWorkItems];
|
|
187
|
+
const lines = [
|
|
188
|
+
'## Summary',
|
|
189
|
+
'',
|
|
190
|
+
];
|
|
191
|
+
if (completed.length > 0) {
|
|
192
|
+
for (const id of completed) {
|
|
193
|
+
const node = graph.nodes.get(id);
|
|
194
|
+
lines.push(`- ✓ ${node?.title ?? id} (\`${id}\`)`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (failed.length > 0) {
|
|
198
|
+
lines.push('');
|
|
199
|
+
lines.push('**⚠️ Incomplete tasks:**');
|
|
200
|
+
for (const id of failed) {
|
|
201
|
+
const node = graph.nodes.get(id);
|
|
202
|
+
lines.push(`- ✗ ${node?.title ?? id} (\`${id}\`)`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
lines.push('');
|
|
206
|
+
lines.push('## Test plan');
|
|
207
|
+
lines.push('');
|
|
208
|
+
for (const wave of graph.waves) {
|
|
209
|
+
lines.push(`- [ ] Wave ${wave.wave_number}: ${wave.node_ids.join(', ')}`);
|
|
210
|
+
}
|
|
211
|
+
lines.push('');
|
|
212
|
+
lines.push(`**Run:** \`${run?.run_id ?? '—'}\` | **Status:** ${run?.status ?? '—'}`);
|
|
213
|
+
lines.push('');
|
|
214
|
+
lines.push('🤖 Generated with [OXE Runtime](https://github.com/propagno/oxe-build)');
|
|
215
|
+
return lines.join('\n');
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
exports.ProjectionEngine = ProjectionEngine;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OxeEvent } from '../events/envelope';
|
|
2
|
+
import type { RunState } from './run-state-reducer';
|
|
3
|
+
export interface ReplayStep {
|
|
4
|
+
index: number;
|
|
5
|
+
event: OxeEvent;
|
|
6
|
+
state: RunState;
|
|
7
|
+
}
|
|
8
|
+
export declare function stepReplay(events: OxeEvent[]): Generator<ReplayStep>;
|
|
9
|
+
export declare function replayUntil(events: OxeEvent[], predicate: (step: ReplayStep) => boolean): ReplayStep | null;
|
|
10
|
+
export declare function replaySlice(events: OxeEvent[], from: number, to: number): ReplayStep[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stepReplay = stepReplay;
|
|
4
|
+
exports.replayUntil = replayUntil;
|
|
5
|
+
exports.replaySlice = replaySlice;
|
|
6
|
+
const run_state_reducer_1 = require("./run-state-reducer");
|
|
7
|
+
function* stepReplay(events) {
|
|
8
|
+
let state = (0, run_state_reducer_1.createEmptyRunState)();
|
|
9
|
+
for (let i = 0; i < events.length; i++) {
|
|
10
|
+
state = (0, run_state_reducer_1.applyEventExported)(state, events[i]);
|
|
11
|
+
yield { index: i, event: events[i], state };
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function replayUntil(events, predicate) {
|
|
15
|
+
for (const step of stepReplay(events)) {
|
|
16
|
+
if (predicate(step))
|
|
17
|
+
return step;
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
function replaySlice(events, from, to) {
|
|
22
|
+
const steps = [];
|
|
23
|
+
for (const step of stepReplay(events)) {
|
|
24
|
+
if (step.index >= from && step.index <= to)
|
|
25
|
+
steps.push(step);
|
|
26
|
+
if (step.index > to)
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
return steps;
|
|
30
|
+
}
|