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,180 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import type { PRManager } from './pr-manager';
|
|
4
|
+
import type { BranchManager } from './branch-manager';
|
|
5
|
+
import type { VerificationManifest, ResidualRiskLedger } from '../verification/verification-manifest';
|
|
6
|
+
import type { RunResult } from '../scheduler/scheduler';
|
|
7
|
+
|
|
8
|
+
export interface RunPRLink {
|
|
9
|
+
run_id: string;
|
|
10
|
+
branch: string;
|
|
11
|
+
pr_url: string | null;
|
|
12
|
+
pr_number: number | null;
|
|
13
|
+
status: 'pending' | 'open' | 'merged' | 'closed' | 'blocked';
|
|
14
|
+
created_at: string;
|
|
15
|
+
merged_at: string | null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface PromotionOptions {
|
|
19
|
+
baseBranch?: string;
|
|
20
|
+
draftPR?: boolean;
|
|
21
|
+
autoMerge?: boolean;
|
|
22
|
+
mergeMethod?: 'merge' | 'squash' | 'rebase';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type MergeGateVerdict = 'approved' | 'blocked' | 'needs_review';
|
|
26
|
+
|
|
27
|
+
export interface MergeGateReport {
|
|
28
|
+
verdict: MergeGateVerdict;
|
|
29
|
+
reasons: string[];
|
|
30
|
+
blocking_risks: string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class MergeGateEvaluator {
|
|
34
|
+
evaluate(
|
|
35
|
+
runResult: RunResult,
|
|
36
|
+
manifest: VerificationManifest | null,
|
|
37
|
+
riskLedger: ResidualRiskLedger | null
|
|
38
|
+
): MergeGateReport {
|
|
39
|
+
const reasons: string[] = [];
|
|
40
|
+
const blockingRisks: string[] = [];
|
|
41
|
+
|
|
42
|
+
if (runResult.failed.length > 0) {
|
|
43
|
+
reasons.push(`${runResult.failed.length} task(s) failed: ${runResult.failed.join(', ')}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (runResult.blocked.length > 0) {
|
|
47
|
+
reasons.push(`${runResult.blocked.length} task(s) blocked: ${runResult.blocked.join(', ')}`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (manifest && !manifest.summary.all_passed) {
|
|
51
|
+
reasons.push(`Verification: ${manifest.summary.fail} check(s) failed, ${manifest.summary.error} error(s)`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (riskLedger) {
|
|
55
|
+
const critical = riskLedger.risks.filter((r) => r.severity === 'critical' || r.severity === 'high');
|
|
56
|
+
for (const risk of critical) {
|
|
57
|
+
blockingRisks.push(`[${risk.severity.toUpperCase()}] ${risk.description}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const hasBlockers = reasons.length > 0 || blockingRisks.length > 0;
|
|
62
|
+
const verdict: MergeGateVerdict = hasBlockers ? 'blocked' : 'approved';
|
|
63
|
+
|
|
64
|
+
return { verdict, reasons, blocking_risks: blockingRisks };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export class PromotionPipeline {
|
|
69
|
+
constructor(
|
|
70
|
+
private readonly projectRoot: string,
|
|
71
|
+
private readonly branchManager: BranchManager,
|
|
72
|
+
private readonly prManager: PRManager,
|
|
73
|
+
private readonly gateEvaluator: MergeGateEvaluator = new MergeGateEvaluator()
|
|
74
|
+
) {}
|
|
75
|
+
|
|
76
|
+
buildPRBody(
|
|
77
|
+
runResult: RunResult,
|
|
78
|
+
manifest: VerificationManifest | null,
|
|
79
|
+
riskLedger: ResidualRiskLedger | null
|
|
80
|
+
): string {
|
|
81
|
+
const lines: string[] = [];
|
|
82
|
+
lines.push('## OXE Run Summary');
|
|
83
|
+
lines.push('');
|
|
84
|
+
lines.push(`**Run ID:** \`${runResult.run_id}\``);
|
|
85
|
+
lines.push(`**Status:** ${runResult.status}`);
|
|
86
|
+
lines.push(`**Completed:** ${runResult.completed.length} tasks`);
|
|
87
|
+
if (runResult.failed.length > 0) {
|
|
88
|
+
lines.push(`**Failed:** ${runResult.failed.join(', ')}`);
|
|
89
|
+
}
|
|
90
|
+
if (runResult.blocked.length > 0) {
|
|
91
|
+
lines.push(`**Blocked:** ${runResult.blocked.join(', ')}`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (manifest) {
|
|
95
|
+
lines.push('');
|
|
96
|
+
lines.push('## Verification');
|
|
97
|
+
lines.push(`- Total: ${manifest.summary.total}`);
|
|
98
|
+
lines.push(`- Pass: ${manifest.summary.pass}`);
|
|
99
|
+
lines.push(`- Fail: ${manifest.summary.fail}`);
|
|
100
|
+
lines.push(`- Skip: ${manifest.summary.skip}`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (riskLedger && riskLedger.risks.length > 0) {
|
|
104
|
+
lines.push('');
|
|
105
|
+
lines.push('## Residual Risks');
|
|
106
|
+
for (const risk of riskLedger.risks) {
|
|
107
|
+
lines.push(`- [${risk.severity.toUpperCase()}] ${risk.description}`);
|
|
108
|
+
if (risk.mitigation) lines.push(` - Mitigation: ${risk.mitigation}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
lines.push('');
|
|
113
|
+
lines.push('---');
|
|
114
|
+
lines.push('*Generated by OXE Runtime*');
|
|
115
|
+
|
|
116
|
+
return lines.join('\n');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async promote(
|
|
120
|
+
runResult: RunResult,
|
|
121
|
+
manifest: VerificationManifest | null,
|
|
122
|
+
riskLedger: ResidualRiskLedger | null,
|
|
123
|
+
opts: PromotionOptions = {}
|
|
124
|
+
): Promise<RunPRLink> {
|
|
125
|
+
const gateReport = this.gateEvaluator.evaluate(runResult, manifest, riskLedger);
|
|
126
|
+
const link: RunPRLink = {
|
|
127
|
+
run_id: runResult.run_id,
|
|
128
|
+
branch: this.branchManager.currentBranch(),
|
|
129
|
+
pr_url: null,
|
|
130
|
+
pr_number: null,
|
|
131
|
+
status: 'pending',
|
|
132
|
+
created_at: new Date().toISOString(),
|
|
133
|
+
merged_at: null,
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
if (gateReport.verdict === 'blocked') {
|
|
137
|
+
link.status = 'blocked';
|
|
138
|
+
this.savePRLink(runResult.run_id, link);
|
|
139
|
+
return link;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const body = this.buildPRBody(runResult, manifest, riskLedger);
|
|
143
|
+
const title = `oxe: run ${runResult.run_id} — ${runResult.completed.length} tasks`;
|
|
144
|
+
|
|
145
|
+
const prResult = this.prManager.createDraft({
|
|
146
|
+
title,
|
|
147
|
+
body,
|
|
148
|
+
base: opts.baseBranch ?? 'main',
|
|
149
|
+
draft: opts.draftPR !== false,
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
if (!prResult.success || !prResult.url) {
|
|
153
|
+
link.status = 'blocked';
|
|
154
|
+
this.savePRLink(runResult.run_id, link);
|
|
155
|
+
return link;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
link.pr_url = prResult.url;
|
|
159
|
+
link.status = 'open';
|
|
160
|
+
this.savePRLink(runResult.run_id, link);
|
|
161
|
+
|
|
162
|
+
return link;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
savePRLink(runId: string, link: RunPRLink): void {
|
|
166
|
+
const p = path.join(this.projectRoot, '.oxe', 'runs', runId, 'pr-link.json');
|
|
167
|
+
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
168
|
+
fs.writeFileSync(p, JSON.stringify(link, null, 2), 'utf8');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
loadPRLink(runId: string): RunPRLink | null {
|
|
172
|
+
const p = path.join(this.projectRoot, '.oxe', 'runs', runId, 'pr-link.json');
|
|
173
|
+
if (!fs.existsSync(p)) return null;
|
|
174
|
+
try {
|
|
175
|
+
return JSON.parse(fs.readFileSync(p, 'utf8')) as RunPRLink;
|
|
176
|
+
} catch {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { OxeEvent } from './envelope';
|
|
2
|
+
import type { EventType } from './catalog';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
|
|
6
|
+
export type EventInput = Partial<Omit<OxeEvent, 'type'>> & { type: EventType };
|
|
7
|
+
|
|
8
|
+
interface OperationalEvent {
|
|
9
|
+
event_id?: string;
|
|
10
|
+
type?: string;
|
|
11
|
+
timestamp?: string;
|
|
12
|
+
session_id?: string | null;
|
|
13
|
+
run_id?: string | null;
|
|
14
|
+
task_id?: string | null;
|
|
15
|
+
work_item_id?: string | null;
|
|
16
|
+
attempt_id?: string | null;
|
|
17
|
+
causation_id?: string | null;
|
|
18
|
+
correlation_id?: string | null;
|
|
19
|
+
payload?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function loadOperationalModule(): {
|
|
23
|
+
appendEvent: (projectRoot: string, sessionId: string | null, event: Record<string, unknown>) => OperationalEvent;
|
|
24
|
+
readEvents: (projectRoot: string, sessionId: string | null) => OperationalEvent[];
|
|
25
|
+
} {
|
|
26
|
+
const candidates = [
|
|
27
|
+
path.resolve(__dirname, '../../../bin/lib/oxe-operational.cjs'),
|
|
28
|
+
path.resolve(__dirname, '../../../../bin/lib/oxe-operational.cjs'),
|
|
29
|
+
path.resolve(__dirname, '../../../../../bin/lib/oxe-operational.cjs'),
|
|
30
|
+
];
|
|
31
|
+
for (const candidate of candidates) {
|
|
32
|
+
if (!fs.existsSync(candidate)) continue;
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
34
|
+
return require(candidate) as {
|
|
35
|
+
appendEvent: (projectRoot: string, sessionId: string | null, event: Record<string, unknown>) => OperationalEvent;
|
|
36
|
+
readEvents: (projectRoot: string, sessionId: string | null) => OperationalEvent[];
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`Unable to locate oxe-operational.cjs from ${__dirname}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const operational = loadOperationalModule();
|
|
43
|
+
|
|
44
|
+
function fromOperationalEvent(raw: OperationalEvent): OxeEvent {
|
|
45
|
+
return {
|
|
46
|
+
id: String(raw.event_id || ''),
|
|
47
|
+
type: String(raw.type || 'RunStarted') as EventType,
|
|
48
|
+
timestamp: String(raw.timestamp || new Date().toISOString()),
|
|
49
|
+
session_id: raw.session_id ?? null,
|
|
50
|
+
run_id: raw.run_id ?? null,
|
|
51
|
+
work_item_id: raw.work_item_id ?? raw.task_id ?? null,
|
|
52
|
+
attempt_id: raw.attempt_id ?? null,
|
|
53
|
+
causation_id: raw.causation_id ?? null,
|
|
54
|
+
correlation_id: raw.correlation_id ?? null,
|
|
55
|
+
payload: raw.payload && typeof raw.payload === 'object' ? raw.payload : {},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function appendEvent(
|
|
60
|
+
projectRoot: string,
|
|
61
|
+
sessionId: string | null,
|
|
62
|
+
input: EventInput,
|
|
63
|
+
causationId?: string
|
|
64
|
+
): OxeEvent {
|
|
65
|
+
const event = operational.appendEvent(projectRoot, sessionId, {
|
|
66
|
+
event_id: input.id,
|
|
67
|
+
type: input.type,
|
|
68
|
+
timestamp: input.timestamp,
|
|
69
|
+
run_id: input.run_id ?? null,
|
|
70
|
+
work_item_id: input.work_item_id ?? null,
|
|
71
|
+
attempt_id: input.attempt_id ?? null,
|
|
72
|
+
causation_id: input.causation_id ?? causationId ?? null,
|
|
73
|
+
correlation_id: input.correlation_id ?? null,
|
|
74
|
+
payload: input.payload && typeof input.payload === 'object' ? input.payload : {},
|
|
75
|
+
});
|
|
76
|
+
return fromOperationalEvent(event);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function readEvents(
|
|
80
|
+
projectRoot: string,
|
|
81
|
+
sessionId: string | null
|
|
82
|
+
): OxeEvent[] {
|
|
83
|
+
return operational.readEvents(projectRoot, sessionId).map(fromOperationalEvent);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function filterByRun(events: OxeEvent[], runId: string): OxeEvent[] {
|
|
87
|
+
return events.filter((e) => e.run_id === runId);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function filterByWorkItem(events: OxeEvent[], workItemId: string): OxeEvent[] {
|
|
91
|
+
return events.filter((e) => e.work_item_id === workItemId);
|
|
92
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const EVENT_TYPES = [
|
|
2
|
+
'SessionCreated',
|
|
3
|
+
'RunStarted',
|
|
4
|
+
'GraphCompiled',
|
|
5
|
+
'WorkItemReady',
|
|
6
|
+
'WorkspaceAllocated',
|
|
7
|
+
'AttemptStarted',
|
|
8
|
+
'ToolInvoked',
|
|
9
|
+
'ToolCompleted',
|
|
10
|
+
'ToolFailed',
|
|
11
|
+
'EvidenceCollected',
|
|
12
|
+
'PolicyEvaluated',
|
|
13
|
+
'GateRequested',
|
|
14
|
+
'GateResolved',
|
|
15
|
+
'VerificationStarted',
|
|
16
|
+
'VerificationCompleted',
|
|
17
|
+
'RetryScheduled',
|
|
18
|
+
'WorkItemCompleted',
|
|
19
|
+
'WorkItemBlocked',
|
|
20
|
+
'RunCompleted',
|
|
21
|
+
'RetroPublished',
|
|
22
|
+
'LessonPromoted',
|
|
23
|
+
] as const;
|
|
24
|
+
|
|
25
|
+
export type EventType = (typeof EVENT_TYPES)[number];
|
|
26
|
+
|
|
27
|
+
export function isValidEventType(type: string): type is EventType {
|
|
28
|
+
return (EVENT_TYPES as readonly string[]).includes(type);
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EventType } from './catalog';
|
|
2
|
+
|
|
3
|
+
export interface OxeEvent {
|
|
4
|
+
id: string;
|
|
5
|
+
type: EventType;
|
|
6
|
+
timestamp: string;
|
|
7
|
+
session_id: string | null;
|
|
8
|
+
run_id: string | null;
|
|
9
|
+
work_item_id: string | null;
|
|
10
|
+
attempt_id: string | null;
|
|
11
|
+
causation_id: string | null;
|
|
12
|
+
correlation_id: string | null;
|
|
13
|
+
payload: Record<string, unknown>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import crypto from 'crypto';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import type { Evidence, EvidenceType } from '../models/evidence';
|
|
5
|
+
|
|
6
|
+
export interface EvidenceCollectOptions {
|
|
7
|
+
work_item_id: string;
|
|
8
|
+
run_id: string;
|
|
9
|
+
attempt_number: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface EvidenceContent {
|
|
13
|
+
evidence: Evidence;
|
|
14
|
+
content: Buffer;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const EXT_MAP: Record<EvidenceType, string> = {
|
|
18
|
+
diff: 'patch',
|
|
19
|
+
stdout: 'txt',
|
|
20
|
+
stderr: 'txt',
|
|
21
|
+
junit_xml: 'xml',
|
|
22
|
+
coverage: 'json',
|
|
23
|
+
screenshot: 'png',
|
|
24
|
+
trace: 'json',
|
|
25
|
+
log: 'txt',
|
|
26
|
+
security_report: 'json',
|
|
27
|
+
api_output: 'json',
|
|
28
|
+
summary: 'json',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export class EvidenceStore {
|
|
32
|
+
constructor(private readonly projectRoot: string) {}
|
|
33
|
+
|
|
34
|
+
private evidenceDir(runId: string, workItemId: string, attemptNumber: number): string {
|
|
35
|
+
return path.join(
|
|
36
|
+
this.projectRoot,
|
|
37
|
+
'.oxe',
|
|
38
|
+
'evidence',
|
|
39
|
+
'runs',
|
|
40
|
+
runId,
|
|
41
|
+
workItemId,
|
|
42
|
+
`attempt-${attemptNumber}`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private indexPath(runId: string, workItemId: string, attemptNumber: number): string {
|
|
47
|
+
return path.join(this.evidenceDir(runId, workItemId, attemptNumber), 'index.json');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private readIndex(runId: string, workItemId: string, attemptNumber: number): Evidence[] {
|
|
51
|
+
const p = this.indexPath(runId, workItemId, attemptNumber);
|
|
52
|
+
if (!fs.existsSync(p)) return [];
|
|
53
|
+
try {
|
|
54
|
+
return JSON.parse(fs.readFileSync(p, 'utf8')) as Evidence[];
|
|
55
|
+
} catch {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private writeIndex(runId: string, workItemId: string, attemptNumber: number, items: Evidence[]): void {
|
|
61
|
+
fs.writeFileSync(this.indexPath(runId, workItemId, attemptNumber), JSON.stringify(items, null, 2), 'utf8');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async collect(
|
|
65
|
+
type: EvidenceType,
|
|
66
|
+
content: Buffer | string,
|
|
67
|
+
opts: EvidenceCollectOptions
|
|
68
|
+
): Promise<Evidence> {
|
|
69
|
+
const { work_item_id, run_id, attempt_number } = opts;
|
|
70
|
+
const dir = this.evidenceDir(run_id, work_item_id, attempt_number);
|
|
71
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
72
|
+
|
|
73
|
+
const buf = Buffer.isBuffer(content) ? content : Buffer.from(content, 'utf8');
|
|
74
|
+
const checksum = crypto.createHash('sha256').update(buf).digest('hex').slice(0, 16);
|
|
75
|
+
const ext = EXT_MAP[type] ?? 'bin';
|
|
76
|
+
|
|
77
|
+
const existing = this.readIndex(run_id, work_item_id, attempt_number);
|
|
78
|
+
const seq = existing.filter((e) => e.type === type).length + 1;
|
|
79
|
+
const filename = seq === 1 ? `${type}.${ext}` : `${type}-${seq}.${ext}`;
|
|
80
|
+
const filePath = path.join(dir, filename);
|
|
81
|
+
|
|
82
|
+
fs.writeFileSync(filePath, buf);
|
|
83
|
+
|
|
84
|
+
const evidence: Evidence = {
|
|
85
|
+
evidence_id: `ev-${run_id}-${work_item_id}-a${attempt_number}-${type}-${seq}`,
|
|
86
|
+
attempt_id: `${work_item_id}-a${attempt_number}`,
|
|
87
|
+
type,
|
|
88
|
+
path: path.relative(this.projectRoot, filePath),
|
|
89
|
+
checksum,
|
|
90
|
+
created_at: new Date().toISOString(),
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
this.writeIndex(run_id, work_item_id, attempt_number, [...existing, evidence]);
|
|
94
|
+
return evidence;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async list(opts: EvidenceCollectOptions): Promise<Evidence[]> {
|
|
98
|
+
return this.readIndex(opts.run_id, opts.work_item_id, opts.attempt_number);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async get(evidenceId: string, opts: EvidenceCollectOptions): Promise<EvidenceContent | null> {
|
|
102
|
+
const items = this.readIndex(opts.run_id, opts.work_item_id, opts.attempt_number);
|
|
103
|
+
const ev = items.find((e) => e.evidence_id === evidenceId);
|
|
104
|
+
if (!ev) return null;
|
|
105
|
+
const absPath = path.join(this.projectRoot, ev.path);
|
|
106
|
+
if (!fs.existsSync(absPath)) return null;
|
|
107
|
+
return { evidence: ev, content: fs.readFileSync(absPath) };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async listByRun(runId: string): Promise<Evidence[]> {
|
|
111
|
+
const runDir = path.join(this.projectRoot, '.oxe', 'evidence', 'runs', runId);
|
|
112
|
+
if (!fs.existsSync(runDir)) return [];
|
|
113
|
+
const all: Evidence[] = [];
|
|
114
|
+
for (const workItem of fs.readdirSync(runDir)) {
|
|
115
|
+
const wiDir = path.join(runDir, workItem);
|
|
116
|
+
for (const attempt of fs.readdirSync(wiDir)) {
|
|
117
|
+
const indexPath = path.join(wiDir, attempt, 'index.json');
|
|
118
|
+
if (fs.existsSync(indexPath)) {
|
|
119
|
+
try {
|
|
120
|
+
const items = JSON.parse(fs.readFileSync(indexPath, 'utf8')) as Evidence[];
|
|
121
|
+
all.push(...items);
|
|
122
|
+
} catch {
|
|
123
|
+
// skip corrupt index
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return all;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './evidence-store';
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import crypto from 'crypto';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import { appendEvent } from '../events/bus';
|
|
5
|
+
import type { GateScope, GateDecisionValue } from '../models/gate-decision';
|
|
6
|
+
|
|
7
|
+
export interface GateContext {
|
|
8
|
+
work_item_id?: string;
|
|
9
|
+
run_id?: string;
|
|
10
|
+
description: string;
|
|
11
|
+
evidence_refs: string[];
|
|
12
|
+
risks: string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface GateToken {
|
|
16
|
+
gate_id: string;
|
|
17
|
+
scope: GateScope;
|
|
18
|
+
requested_at: string;
|
|
19
|
+
context: GateContext;
|
|
20
|
+
status: 'pending' | 'resolved';
|
|
21
|
+
decision?: GateDecisionValue;
|
|
22
|
+
actor?: string;
|
|
23
|
+
reason?: string;
|
|
24
|
+
resolved_at?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface GateResolution {
|
|
28
|
+
decision: GateDecisionValue;
|
|
29
|
+
actor: string;
|
|
30
|
+
reason?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class GateManager {
|
|
34
|
+
constructor(
|
|
35
|
+
private readonly projectRoot: string,
|
|
36
|
+
private readonly sessionId: string | null,
|
|
37
|
+
private readonly runId: string
|
|
38
|
+
) {}
|
|
39
|
+
|
|
40
|
+
private gatesPath(): string {
|
|
41
|
+
if (this.sessionId) {
|
|
42
|
+
return path.join(this.projectRoot, '.oxe', this.sessionId, 'execution', 'GATES.json');
|
|
43
|
+
}
|
|
44
|
+
return path.join(this.projectRoot, '.oxe', 'execution', 'GATES.json');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private readGates(): GateToken[] {
|
|
48
|
+
const p = this.gatesPath();
|
|
49
|
+
if (!fs.existsSync(p)) return [];
|
|
50
|
+
try {
|
|
51
|
+
return JSON.parse(fs.readFileSync(p, 'utf8')) as GateToken[];
|
|
52
|
+
} catch {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private writeGates(gates: GateToken[]): void {
|
|
58
|
+
const p = this.gatesPath();
|
|
59
|
+
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
60
|
+
fs.writeFileSync(p, JSON.stringify(gates, null, 2), 'utf8');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async request(scope: GateScope, ctx: GateContext): Promise<GateToken> {
|
|
64
|
+
const token: GateToken = {
|
|
65
|
+
gate_id: `gate-${crypto.randomBytes(4).toString('hex')}`,
|
|
66
|
+
scope,
|
|
67
|
+
requested_at: new Date().toISOString(),
|
|
68
|
+
context: ctx,
|
|
69
|
+
status: 'pending',
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const gates = this.readGates();
|
|
73
|
+
gates.push(token);
|
|
74
|
+
this.writeGates(gates);
|
|
75
|
+
|
|
76
|
+
appendEvent(this.projectRoot, this.sessionId, {
|
|
77
|
+
type: 'GateRequested',
|
|
78
|
+
run_id: this.runId,
|
|
79
|
+
work_item_id: ctx.work_item_id ?? null,
|
|
80
|
+
payload: {
|
|
81
|
+
gate_id: token.gate_id,
|
|
82
|
+
scope,
|
|
83
|
+
description: ctx.description,
|
|
84
|
+
evidence_refs: ctx.evidence_refs,
|
|
85
|
+
risks: ctx.risks,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return token;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async resolve(token: GateToken, resolution: GateResolution): Promise<GateToken> {
|
|
93
|
+
const gates = this.readGates();
|
|
94
|
+
const idx = gates.findIndex((g) => g.gate_id === token.gate_id);
|
|
95
|
+
if (idx === -1) throw new Error(`Gate ${token.gate_id} not found`);
|
|
96
|
+
|
|
97
|
+
const resolved: GateToken = {
|
|
98
|
+
...gates[idx],
|
|
99
|
+
status: 'resolved',
|
|
100
|
+
decision: resolution.decision,
|
|
101
|
+
actor: resolution.actor,
|
|
102
|
+
reason: resolution.reason ?? undefined,
|
|
103
|
+
resolved_at: new Date().toISOString(),
|
|
104
|
+
};
|
|
105
|
+
gates[idx] = resolved;
|
|
106
|
+
this.writeGates(gates);
|
|
107
|
+
|
|
108
|
+
appendEvent(this.projectRoot, this.sessionId, {
|
|
109
|
+
type: 'GateResolved',
|
|
110
|
+
run_id: this.runId,
|
|
111
|
+
payload: {
|
|
112
|
+
gate_id: token.gate_id,
|
|
113
|
+
scope: token.scope,
|
|
114
|
+
decision: resolution.decision,
|
|
115
|
+
actor: resolution.actor,
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
return resolved;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
isPending(scope: GateScope): boolean {
|
|
123
|
+
return this.readGates().some((g) => g.scope === scope && g.status === 'pending');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
listPending(): GateToken[] {
|
|
127
|
+
return this.readGates().filter((g) => g.status === 'pending');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
listAll(): GateToken[] {
|
|
131
|
+
return this.readGates();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
get(gateId: string): GateToken | null {
|
|
135
|
+
return this.readGates().find((g) => g.gate_id === gateId) ?? null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './gate-manager';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// R1 Public ABI — OXE Runtime Foundation
|
|
2
|
+
export * from './models/index';
|
|
3
|
+
export * from './events/index';
|
|
4
|
+
export * from './reducers/index';
|
|
5
|
+
export * from './compiler/index';
|
|
6
|
+
export * from './scheduler/index';
|
|
7
|
+
export * from './workspace/index';
|
|
8
|
+
|
|
9
|
+
// R2 Public ABI — OXE Evidence & Verification
|
|
10
|
+
export * from './evidence/index';
|
|
11
|
+
// verification exports compile as compileVerification to avoid conflict with compiler/compile
|
|
12
|
+
export {
|
|
13
|
+
compile as compileVerification,
|
|
14
|
+
runCheck,
|
|
15
|
+
runSuite,
|
|
16
|
+
summarizeSuite,
|
|
17
|
+
} from './verification/verification-compiler';
|
|
18
|
+
export type {
|
|
19
|
+
CheckType,
|
|
20
|
+
AcceptanceCheck,
|
|
21
|
+
AcceptanceCheckSuite,
|
|
22
|
+
CheckResult,
|
|
23
|
+
} from './verification/verification-compiler';
|
|
24
|
+
export * from './verification/verification-manifest';
|
|
25
|
+
export * from './policy/index';
|
|
26
|
+
export * from './gate/index';
|
|
27
|
+
export * from './projection/index';
|
|
28
|
+
|
|
29
|
+
// R3 Public ABI — OXE Delivery & Extensibility
|
|
30
|
+
export * from './plugins/index';
|
|
31
|
+
export * from './delivery/index';
|
|
32
|
+
export * from './context/index';
|
|
33
|
+
export * from './scheduler/multi-agent-coordinator';
|
|
34
|
+
|
|
35
|
+
// R4 Public ABI — Decision, Audit & Enterprise
|
|
36
|
+
export * from './decision/index';
|
|
37
|
+
export * from './audit/index';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type AttemptOutcome =
|
|
2
|
+
| 'success'
|
|
3
|
+
| 'failure_env'
|
|
4
|
+
| 'failure_policy'
|
|
5
|
+
| 'failure_test'
|
|
6
|
+
| 'failure_timeout'
|
|
7
|
+
| 'cancelled';
|
|
8
|
+
|
|
9
|
+
export interface Attempt {
|
|
10
|
+
attempt_id: string;
|
|
11
|
+
work_item_id: string;
|
|
12
|
+
attempt_number: number;
|
|
13
|
+
workspace_id: string | null;
|
|
14
|
+
agent_profile: string | null;
|
|
15
|
+
model: string | null;
|
|
16
|
+
started_at: string;
|
|
17
|
+
ended_at: string | null;
|
|
18
|
+
outcome: AttemptOutcome | null;
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type EvidenceType =
|
|
2
|
+
| 'diff'
|
|
3
|
+
| 'stdout'
|
|
4
|
+
| 'stderr'
|
|
5
|
+
| 'junit_xml'
|
|
6
|
+
| 'coverage'
|
|
7
|
+
| 'screenshot'
|
|
8
|
+
| 'trace'
|
|
9
|
+
| 'log'
|
|
10
|
+
| 'security_report'
|
|
11
|
+
| 'api_output'
|
|
12
|
+
| 'summary';
|
|
13
|
+
|
|
14
|
+
export interface Evidence {
|
|
15
|
+
evidence_id: string;
|
|
16
|
+
attempt_id: string;
|
|
17
|
+
type: EvidenceType;
|
|
18
|
+
path: string;
|
|
19
|
+
checksum: string | null;
|
|
20
|
+
created_at: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type GateDecisionValue =
|
|
2
|
+
| 'approved'
|
|
3
|
+
| 'rejected'
|
|
4
|
+
| 'approved_with_caveats'
|
|
5
|
+
| 'needs_more_evidence';
|
|
6
|
+
|
|
7
|
+
export type GateScope =
|
|
8
|
+
| 'plan_approval'
|
|
9
|
+
| 'critical_mutation'
|
|
10
|
+
| 'security'
|
|
11
|
+
| 'pr_promotion'
|
|
12
|
+
| 'merge';
|
|
13
|
+
|
|
14
|
+
export interface GateDecision {
|
|
15
|
+
gate_id: string;
|
|
16
|
+
scope: GateScope;
|
|
17
|
+
decision: GateDecisionValue;
|
|
18
|
+
actor: string;
|
|
19
|
+
reason: string | null;
|
|
20
|
+
timestamp: string;
|
|
21
|
+
}
|