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