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.
- package/.cursor/commands/oxe-ask.md +2 -2
- package/.cursor/commands/oxe-capabilities.md +2 -2
- package/.cursor/commands/oxe-checkpoint.md +2 -2
- package/.cursor/commands/oxe-compact.md +2 -2
- package/.cursor/commands/oxe-dashboard.md +2 -2
- package/.cursor/commands/oxe-debug.md +2 -2
- package/.cursor/commands/oxe-discuss.md +2 -2
- package/.cursor/commands/oxe-execute.md +5 -2
- package/.cursor/commands/oxe-forensics.md +2 -2
- package/.cursor/commands/oxe-help.md +2 -2
- package/.cursor/commands/oxe-loop.md +2 -2
- package/.cursor/commands/oxe-milestone.md +2 -2
- package/.cursor/commands/oxe-next.md +2 -2
- package/.cursor/commands/oxe-obs.md +2 -2
- package/.cursor/commands/oxe-plan-agent.md +2 -2
- package/.cursor/commands/oxe-plan.md +2 -2
- package/.cursor/commands/oxe-project.md +2 -2
- package/.cursor/commands/oxe-quick.md +2 -2
- package/.cursor/commands/oxe-research.md +2 -2
- package/.cursor/commands/oxe-retro.md +2 -2
- package/.cursor/commands/oxe-review-pr.md +2 -2
- package/.cursor/commands/oxe-route.md +2 -2
- package/.cursor/commands/oxe-scan.md +2 -2
- package/.cursor/commands/oxe-security.md +2 -2
- package/.cursor/commands/oxe-session.md +2 -2
- package/.cursor/commands/oxe-ship.md +2 -2
- package/.cursor/commands/oxe-skill.md +2 -2
- package/.cursor/commands/oxe-spec.md +2 -2
- package/.cursor/commands/oxe-ui-review.md +2 -2
- package/.cursor/commands/oxe-ui-spec.md +2 -2
- package/.cursor/commands/oxe-update.md +2 -2
- package/.cursor/commands/oxe-validate-gaps.md +2 -2
- package/.cursor/commands/oxe-verify.md +5 -2
- package/.cursor/commands/oxe-workstream.md +2 -2
- package/.cursor/commands/oxe.md +2 -2
- package/.github/copilot-instructions.md +13 -13
- package/.github/prompts/oxe-ask.prompt.md +2 -2
- package/.github/prompts/oxe-capabilities.prompt.md +2 -2
- package/.github/prompts/oxe-checkpoint.prompt.md +2 -2
- package/.github/prompts/oxe-compact.prompt.md +2 -2
- package/.github/prompts/oxe-dashboard.prompt.md +2 -2
- package/.github/prompts/oxe-debug.prompt.md +2 -2
- package/.github/prompts/oxe-discuss.prompt.md +2 -2
- package/.github/prompts/oxe-execute.prompt.md +5 -2
- package/.github/prompts/oxe-forensics.prompt.md +2 -2
- package/.github/prompts/oxe-help.prompt.md +2 -2
- package/.github/prompts/oxe-loop.prompt.md +2 -2
- package/.github/prompts/oxe-milestone.prompt.md +2 -2
- package/.github/prompts/oxe-next.prompt.md +2 -2
- package/.github/prompts/oxe-obs.prompt.md +2 -2
- package/.github/prompts/oxe-plan-agent.prompt.md +2 -2
- package/.github/prompts/oxe-plan.prompt.md +2 -2
- package/.github/prompts/oxe-project.prompt.md +2 -2
- package/.github/prompts/oxe-quick.prompt.md +2 -2
- package/.github/prompts/oxe-research.prompt.md +2 -2
- package/.github/prompts/oxe-retro.prompt.md +2 -2
- package/.github/prompts/oxe-review-pr.prompt.md +2 -2
- package/.github/prompts/oxe-route.prompt.md +2 -2
- package/.github/prompts/oxe-scan.prompt.md +2 -2
- package/.github/prompts/oxe-security.prompt.md +2 -2
- package/.github/prompts/oxe-session.prompt.md +2 -2
- package/.github/prompts/oxe-ship.prompt.md +2 -2
- package/.github/prompts/oxe-skill.prompt.md +2 -2
- package/.github/prompts/oxe-spec.prompt.md +2 -2
- package/.github/prompts/oxe-ui-review.prompt.md +2 -2
- package/.github/prompts/oxe-ui-spec.prompt.md +2 -2
- package/.github/prompts/oxe-update.prompt.md +2 -2
- package/.github/prompts/oxe-validate-gaps.prompt.md +2 -2
- package/.github/prompts/oxe-verify.prompt.md +5 -2
- package/.github/prompts/oxe-workstream.prompt.md +2 -2
- package/.github/prompts/oxe.prompt.md +2 -2
- package/CHANGELOG.md +52 -17
- package/README.md +610 -551
- package/bin/banner.txt +1 -1
- package/bin/lib/oxe-agent-install.cjs +69 -69
- package/bin/lib/oxe-azure.cjs +1445 -1445
- package/bin/lib/oxe-context-engine.cjs +867 -867
- package/bin/lib/oxe-dashboard.cjs +76 -28
- package/bin/lib/oxe-operational.cjs +2144 -1340
- package/bin/lib/oxe-project-health.cjs +483 -1
- package/bin/lib/oxe-runtime-semantics.cjs +12 -0
- package/bin/oxe-cc.js +554 -152
- package/commands/oxe/ask.md +2 -2
- package/commands/oxe/capabilities.md +2 -2
- package/commands/oxe/checkpoint.md +2 -2
- package/commands/oxe/compact.md +2 -2
- package/commands/oxe/dashboard.md +2 -2
- package/commands/oxe/debug.md +2 -2
- package/commands/oxe/discuss.md +2 -2
- package/commands/oxe/execute.md +5 -2
- package/commands/oxe/forensics.md +2 -2
- package/commands/oxe/help.md +2 -2
- package/commands/oxe/loop.md +2 -2
- package/commands/oxe/milestone.md +2 -2
- package/commands/oxe/next.md +2 -2
- package/commands/oxe/obs.md +2 -2
- package/commands/oxe/oxe.md +2 -2
- package/commands/oxe/plan-agent.md +2 -2
- package/commands/oxe/plan.md +2 -2
- package/commands/oxe/project.md +2 -2
- package/commands/oxe/quick.md +2 -2
- package/commands/oxe/research.md +2 -2
- package/commands/oxe/retro.md +2 -2
- package/commands/oxe/review-pr.md +2 -2
- package/commands/oxe/route.md +2 -2
- package/commands/oxe/scan.md +2 -2
- package/commands/oxe/security.md +2 -2
- package/commands/oxe/session.md +2 -2
- package/commands/oxe/ship.md +2 -2
- package/commands/oxe/skill.md +2 -2
- package/commands/oxe/spec.md +2 -2
- package/commands/oxe/ui-review.md +2 -2
- package/commands/oxe/ui-spec.md +2 -2
- package/commands/oxe/update.md +2 -2
- package/commands/oxe/validate-gaps.md +2 -2
- package/commands/oxe/verify.md +5 -2
- package/commands/oxe/workstream.md +2 -2
- package/lib/runtime/delivery/branch-manager.d.ts +1 -0
- package/lib/runtime/delivery/branch-manager.js +7 -0
- package/lib/runtime/delivery/ci-checks.js +34 -1
- package/lib/runtime/delivery/delivery-records.d.ts +34 -0
- package/lib/runtime/delivery/delivery-records.js +48 -0
- package/lib/runtime/delivery/index.d.ts +1 -0
- package/lib/runtime/delivery/index.js +1 -0
- package/lib/runtime/delivery/promotion-pipeline.d.ts +26 -2
- package/lib/runtime/delivery/promotion-pipeline.js +111 -14
- package/lib/runtime/gate/gate-manager.d.ts +41 -0
- package/lib/runtime/gate/gate-manager.js +108 -1
- package/lib/runtime/index.d.ts +2 -2
- package/lib/runtime/index.js +3 -1
- package/lib/runtime/models/gate-decision.d.ts +4 -1
- package/lib/runtime/models/workspace.d.ts +3 -0
- package/lib/runtime/plugins/capability-adapter.d.ts +12 -0
- package/lib/runtime/plugins/capability-adapter.js +204 -0
- package/lib/runtime/plugins/capability-matrix.d.ts +5 -0
- package/lib/runtime/plugins/capability-matrix.js +48 -17
- package/lib/runtime/plugins/index.d.ts +1 -0
- package/lib/runtime/plugins/index.js +1 -0
- package/lib/runtime/plugins/plugin-abi.d.ts +2 -0
- package/lib/runtime/plugins/plugin-manifest.d.ts +1 -1
- package/lib/runtime/plugins/plugin-manifest.js +6 -2
- package/lib/runtime/plugins/plugin-registry.d.ts +46 -0
- package/lib/runtime/plugins/plugin-registry.js +79 -2
- package/lib/runtime/policy/policy-engine.d.ts +19 -0
- package/lib/runtime/policy/policy-engine.js +76 -4
- package/lib/runtime/projection/projection-engine.d.ts +9 -1
- package/lib/runtime/projection/projection-engine.js +73 -3
- package/lib/runtime/scheduler/multi-agent-coordinator.d.ts +43 -1
- package/lib/runtime/scheduler/multi-agent-coordinator.js +151 -39
- package/lib/runtime/scheduler/run-journal.d.ts +1 -1
- package/lib/runtime/scheduler/scheduler.d.ts +19 -1
- package/lib/runtime/scheduler/scheduler.js +258 -13
- package/lib/runtime/verification/verification-compiler.d.ts +43 -0
- package/lib/runtime/verification/verification-compiler.js +137 -0
- package/lib/runtime/verification/verification-manifest.d.ts +9 -0
- package/lib/runtime/verification/verification-manifest.js +56 -6
- package/lib/runtime/workspace/strategies/ephemeral-container.d.ts +1 -0
- package/lib/runtime/workspace/strategies/ephemeral-container.js +4 -0
- package/lib/runtime/workspace/strategies/git-worktree.d.ts +1 -0
- package/lib/runtime/workspace/strategies/git-worktree.js +2 -0
- package/lib/runtime/workspace/strategies/inplace.d.ts +1 -0
- package/lib/runtime/workspace/strategies/inplace.js +2 -0
- package/lib/runtime/workspace/workspace-manager.d.ts +2 -1
- package/lib/sdk/README.md +9 -9
- package/lib/sdk/index.cjs +33 -24
- package/lib/sdk/index.d.ts +149 -14
- package/oxe/templates/ACTIVE-RUN.template.json +32 -32
- package/oxe/templates/CAPABILITIES.template.md +7 -7
- package/oxe/templates/CAPABILITY.template.md +45 -45
- package/oxe/templates/CHECKPOINTS.template.md +7 -7
- package/oxe/templates/EXECUTION-RUNTIME.template.md +68 -68
- package/oxe/templates/HYPOTHESES.template.md +33 -33
- package/oxe/templates/LESSONS-METRICS.template.json +13 -13
- package/oxe/templates/NOTES.template.md +16 -16
- package/oxe/templates/PLAN-REVIEW.template.md +31 -31
- package/oxe/templates/SESSION.template.md +34 -34
- package/oxe/templates/SKILL.template.md +26 -26
- package/oxe/templates/STATE.md +55 -55
- package/oxe/templates/WORKFLOW_AUTHORING.md +18 -18
- package/oxe/workflows/ask.md +96 -96
- package/oxe/workflows/capabilities.md +25 -25
- package/oxe/workflows/dashboard.md +33 -33
- package/oxe/workflows/discuss.md +12 -12
- package/oxe/workflows/execute.md +14 -0
- package/oxe/workflows/help.md +352 -352
- package/oxe/workflows/next.md +22 -22
- package/oxe/workflows/oxe.md +6 -6
- package/oxe/workflows/plan-agent.md +9 -9
- package/oxe/workflows/quick.md +10 -10
- package/oxe/workflows/references/reasoning-discovery.md +28 -28
- package/oxe/workflows/references/reasoning-execution.md +29 -29
- package/oxe/workflows/references/reasoning-planning.md +32 -32
- package/oxe/workflows/references/reasoning-review.md +29 -29
- package/oxe/workflows/references/reasoning-status.md +24 -24
- package/oxe/workflows/references/robustness-elevation.md +295 -295
- package/oxe/workflows/references/workflow-runtime-contracts.json +952 -930
- package/oxe/workflows/route.md +16 -16
- package/oxe/workflows/session.md +213 -213
- package/oxe/workflows/ship.md +142 -142
- package/oxe/workflows/skill.md +44 -44
- package/oxe/workflows/ui-review.md +36 -36
- package/oxe/workflows/verify-audit.md +73 -73
- package/oxe/workflows/verify.md +10 -0
- package/package.json +92 -92
- package/packages/runtime/package.json +17 -17
- package/packages/runtime/src/audit/audit-trail.ts +243 -243
- package/packages/runtime/src/audit/index.ts +2 -2
- package/packages/runtime/src/audit/policy-pack.ts +62 -62
- package/packages/runtime/src/compiler/graph-compiler.ts +245 -245
- package/packages/runtime/src/compiler/index.ts +1 -1
- package/packages/runtime/src/context/context-pack-builder.ts +259 -259
- package/packages/runtime/src/context/context-pack-store.ts +197 -197
- package/packages/runtime/src/context/context-profiles.ts +60 -60
- package/packages/runtime/src/context/index.ts +3 -3
- package/packages/runtime/src/decision/decision-engine.ts +174 -174
- package/packages/runtime/src/decision/decision-memo.ts +211 -211
- package/packages/runtime/src/decision/index.ts +2 -2
- package/packages/runtime/src/delivery/branch-manager.ts +91 -84
- package/packages/runtime/src/delivery/ci-checks.ts +285 -252
- package/packages/runtime/src/delivery/delivery-records.ts +75 -0
- package/packages/runtime/src/delivery/index.ts +5 -4
- package/packages/runtime/src/delivery/pr-manager.ts +112 -112
- package/packages/runtime/src/delivery/promotion-pipeline.ts +334 -180
- package/packages/runtime/src/events/bus.ts +92 -92
- package/packages/runtime/src/events/catalog.ts +29 -29
- package/packages/runtime/src/events/envelope.ts +14 -14
- package/packages/runtime/src/events/index.ts +3 -3
- package/packages/runtime/src/evidence/evidence-store.ts +130 -130
- package/packages/runtime/src/evidence/index.ts +1 -1
- package/packages/runtime/src/gate/gate-manager.ts +289 -137
- package/packages/runtime/src/gate/index.ts +1 -1
- package/packages/runtime/src/index.ts +41 -37
- package/packages/runtime/src/models/attempt.ts +19 -19
- package/packages/runtime/src/models/evidence.ts +21 -21
- package/packages/runtime/src/models/gate-decision.ts +25 -21
- package/packages/runtime/src/models/index.ts +8 -8
- package/packages/runtime/src/models/run.ts +24 -24
- package/packages/runtime/src/models/session.ts +11 -11
- package/packages/runtime/src/models/verification-result.ts +10 -10
- package/packages/runtime/src/models/work-item.ts +25 -25
- package/packages/runtime/src/models/workspace.ts +31 -28
- package/packages/runtime/src/plugins/capability-adapter.ts +206 -0
- package/packages/runtime/src/plugins/capability-matrix.ts +126 -83
- package/packages/runtime/src/plugins/index.ts +5 -4
- package/packages/runtime/src/plugins/plugin-abi.ts +97 -95
- package/packages/runtime/src/plugins/plugin-manifest.ts +118 -113
- package/packages/runtime/src/plugins/plugin-registry.ts +232 -124
- package/packages/runtime/src/policy/index.ts +1 -1
- package/packages/runtime/src/policy/policy-engine.ts +330 -244
- package/packages/runtime/src/projection/index.ts +1 -1
- package/packages/runtime/src/projection/projection-engine.ts +328 -249
- package/packages/runtime/src/reducers/debug-reducer.ts +36 -36
- package/packages/runtime/src/reducers/index.ts +2 -2
- package/packages/runtime/src/reducers/run-state-reducer.ts +269 -269
- package/packages/runtime/src/scheduler/agent-registry.ts +132 -132
- package/packages/runtime/src/scheduler/agent-roles.ts +109 -109
- package/packages/runtime/src/scheduler/index.ts +4 -4
- package/packages/runtime/src/scheduler/multi-agent-coordinator.ts +521 -333
- package/packages/runtime/src/scheduler/run-journal.ts +62 -62
- package/packages/runtime/src/scheduler/scheduler.ts +722 -441
- package/packages/runtime/src/verification/index.ts +2 -2
- package/packages/runtime/src/verification/verification-compiler.ts +436 -225
- package/packages/runtime/src/verification/verification-manifest.ts +252 -192
- package/packages/runtime/src/workspace/index.ts +5 -5
- package/packages/runtime/src/workspace/strategies/ephemeral-container.ts +126 -121
- package/packages/runtime/src/workspace/strategies/git-worktree.ts +79 -77
- package/packages/runtime/src/workspace/strategies/inplace.ts +38 -35
- package/packages/runtime/src/workspace/workspace-manager.ts +16 -15
- package/packages/runtime/tsconfig.json +17 -17
- package/vscode-extension/.vscodeignore +7 -7
- package/vscode-extension/oxe-agents-1.0.0.vsix +0 -0
- package/vscode-extension/package.json +185 -185
- package/vscode-extension/src/extension.js +310 -310
- package/vscode-extension/src/shared/contextLoader.js +137 -137
- package/vscode-extension/src/shared/contractBuilder.js +159 -159
- 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
|
-
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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[]
|
|
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;
|