oxe-cc 0.9.2 → 1.0.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-retro.md +2 -2
- package/.cursor/commands/oxe-spec.md +2 -2
- package/.github/prompts/oxe-retro.prompt.md +2 -2
- package/.github/prompts/oxe-spec.prompt.md +2 -2
- package/README.md +1 -1
- package/bin/banner.txt +1 -1
- package/bin/lib/oxe-context-engine.cjs +1 -0
- package/bin/lib/oxe-dashboard.cjs +9 -7
- package/bin/lib/oxe-operational.cjs +569 -4
- package/bin/oxe-cc.js +141 -57
- package/commands/oxe/retro.md +2 -2
- package/commands/oxe/spec.md +2 -2
- 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 +36 -0
- package/lib/runtime/context/context-pack-builder.js +136 -0
- package/lib/runtime/context/index.d.ts +1 -0
- package/lib/runtime/context/index.js +17 -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 +3 -0
- package/lib/runtime/delivery/index.js +19 -0
- package/lib/runtime/delivery/pr-manager.d.ts +30 -0
- package/lib/runtime/delivery/pr-manager.js +82 -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 +16 -0
- package/lib/runtime/index.js +40 -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/index.d.ts +2 -0
- package/lib/runtime/plugins/index.js +18 -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-registry.d.ts +21 -0
- package/lib/runtime/plugins/plugin-registry.js +114 -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 +40 -0
- package/lib/runtime/policy/policy-engine.js +80 -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 +20 -0
- package/lib/runtime/reducers/run-state-reducer.js +110 -0
- package/lib/runtime/scheduler/index.d.ts +1 -0
- package/lib/runtime/scheduler/index.js +17 -0
- package/lib/runtime/scheduler/multi-agent-coordinator.d.ts +34 -0
- package/lib/runtime/scheduler/multi-agent-coordinator.js +166 -0
- package/lib/runtime/scheduler/scheduler.d.ts +39 -0
- package/lib/runtime/scheduler/scheduler.js +196 -0
- package/lib/runtime/verification/index.d.ts +1 -0
- package/lib/runtime/verification/index.js +17 -0
- package/lib/runtime/verification/verification-compiler.d.ts +56 -0
- package/lib/runtime/verification/verification-compiler.js +147 -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/templates/LESSONS-METRICS.template.json +13 -0
- package/oxe/workflows/references/robustness-elevation.md +295 -0
- package/oxe/workflows/references/workflow-runtime-contracts.json +32 -4
- package/oxe/workflows/retro.md +21 -0
- package/oxe/workflows/spec.md +50 -26
- package/oxe/workflows/verify.md +36 -0
- package/package.json +9 -3
- package/packages/runtime/package.json +17 -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 +193 -0
- package/packages/runtime/src/context/index.ts +1 -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 +3 -0
- package/packages/runtime/src/delivery/pr-manager.ts +112 -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 +32 -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/index.ts +2 -0
- package/packages/runtime/src/plugins/plugin-abi.ts +95 -0
- package/packages/runtime/src/plugins/plugin-registry.ts +119 -0
- package/packages/runtime/src/policy/index.ts +1 -0
- package/packages/runtime/src/policy/policy-engine.ts +113 -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 +127 -0
- package/packages/runtime/src/scheduler/index.ts +1 -0
- package/packages/runtime/src/scheduler/multi-agent-coordinator.ts +231 -0
- package/packages/runtime/src/scheduler/scheduler.ts +281 -0
- package/packages/runtime/src/verification/index.ts +1 -0
- package/packages/runtime/src/verification/verification-compiler.ts +225 -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-1.0.0.vsix +0 -0
- package/vscode-extension/package.json +1 -1
|
@@ -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,16 @@
|
|
|
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 './policy/index';
|
|
11
|
+
export * from './gate/index';
|
|
12
|
+
export * from './projection/index';
|
|
13
|
+
export * from './plugins/index';
|
|
14
|
+
export * from './delivery/index';
|
|
15
|
+
export * from './context/index';
|
|
16
|
+
export * from './scheduler/multi-agent-coordinator';
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
exports.summarizeSuite = exports.runSuite = exports.runCheck = exports.compileVerification = void 0;
|
|
18
|
+
// R1 Public ABI — OXE Runtime Foundation
|
|
19
|
+
__exportStar(require("./models/index"), exports);
|
|
20
|
+
__exportStar(require("./events/index"), exports);
|
|
21
|
+
__exportStar(require("./reducers/index"), exports);
|
|
22
|
+
__exportStar(require("./compiler/index"), exports);
|
|
23
|
+
__exportStar(require("./scheduler/index"), exports);
|
|
24
|
+
__exportStar(require("./workspace/index"), exports);
|
|
25
|
+
// R2 Public ABI — OXE Evidence & Verification
|
|
26
|
+
__exportStar(require("./evidence/index"), exports);
|
|
27
|
+
// verification exports compile as compileVerification to avoid conflict with compiler/compile
|
|
28
|
+
var verification_compiler_1 = require("./verification/verification-compiler");
|
|
29
|
+
Object.defineProperty(exports, "compileVerification", { enumerable: true, get: function () { return verification_compiler_1.compile; } });
|
|
30
|
+
Object.defineProperty(exports, "runCheck", { enumerable: true, get: function () { return verification_compiler_1.runCheck; } });
|
|
31
|
+
Object.defineProperty(exports, "runSuite", { enumerable: true, get: function () { return verification_compiler_1.runSuite; } });
|
|
32
|
+
Object.defineProperty(exports, "summarizeSuite", { enumerable: true, get: function () { return verification_compiler_1.summarizeSuite; } });
|
|
33
|
+
__exportStar(require("./policy/index"), exports);
|
|
34
|
+
__exportStar(require("./gate/index"), exports);
|
|
35
|
+
__exportStar(require("./projection/index"), exports);
|
|
36
|
+
// R3 Public ABI — OXE Delivery & Extensibility
|
|
37
|
+
__exportStar(require("./plugins/index"), exports);
|
|
38
|
+
__exportStar(require("./delivery/index"), exports);
|
|
39
|
+
__exportStar(require("./context/index"), exports);
|
|
40
|
+
__exportStar(require("./scheduler/multi-agent-coordinator"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type AttemptOutcome = 'success' | 'failure_env' | 'failure_policy' | 'failure_test' | 'failure_timeout' | 'cancelled';
|
|
2
|
+
export interface Attempt {
|
|
3
|
+
attempt_id: string;
|
|
4
|
+
work_item_id: string;
|
|
5
|
+
attempt_number: number;
|
|
6
|
+
workspace_id: string | null;
|
|
7
|
+
agent_profile: string | null;
|
|
8
|
+
model: string | null;
|
|
9
|
+
started_at: string;
|
|
10
|
+
ended_at: string | null;
|
|
11
|
+
outcome: AttemptOutcome | null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type EvidenceType = 'diff' | 'stdout' | 'stderr' | 'junit_xml' | 'coverage' | 'screenshot' | 'trace' | 'log' | 'security_report' | 'api_output' | 'summary';
|
|
2
|
+
export interface Evidence {
|
|
3
|
+
evidence_id: string;
|
|
4
|
+
attempt_id: string;
|
|
5
|
+
type: EvidenceType;
|
|
6
|
+
path: string;
|
|
7
|
+
checksum: string | null;
|
|
8
|
+
created_at: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type GateDecisionValue = 'approved' | 'rejected' | 'approved_with_caveats' | 'needs_more_evidence';
|
|
2
|
+
export type GateScope = 'plan_approval' | 'critical_mutation' | 'security' | 'pr_promotion' | 'merge';
|
|
3
|
+
export interface GateDecision {
|
|
4
|
+
gate_id: string;
|
|
5
|
+
scope: GateScope;
|
|
6
|
+
decision: GateDecisionValue;
|
|
7
|
+
actor: string;
|
|
8
|
+
reason: string | null;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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("./session"), exports);
|
|
18
|
+
__exportStar(require("./run"), exports);
|
|
19
|
+
__exportStar(require("./work-item"), exports);
|
|
20
|
+
__exportStar(require("./attempt"), exports);
|
|
21
|
+
__exportStar(require("./workspace"), exports);
|
|
22
|
+
__exportStar(require("./evidence"), exports);
|
|
23
|
+
__exportStar(require("./gate-decision"), exports);
|
|
24
|
+
__exportStar(require("./verification-result"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type RunStatus = 'planned' | 'running' | 'paused' | 'waiting_approval' | 'failed' | 'completed' | 'replaying' | 'aborted' | 'cancelled';
|
|
2
|
+
export type RunMode = 'completo' | 'por_onda' | 'por_tarefa';
|
|
3
|
+
export type RunInitiator = 'user' | 'scheduler' | 'retry' | 'replay';
|
|
4
|
+
export interface Run {
|
|
5
|
+
run_id: string;
|
|
6
|
+
session_id: string | null;
|
|
7
|
+
graph_version: string;
|
|
8
|
+
started_at: string;
|
|
9
|
+
ended_at: string | null;
|
|
10
|
+
status: RunStatus;
|
|
11
|
+
initiator: RunInitiator;
|
|
12
|
+
mode: RunMode;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type SessionStatus = 'active' | 'archived' | 'closed';
|
|
2
|
+
export interface Session {
|
|
3
|
+
session_id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
created_at: string;
|
|
6
|
+
status: SessionStatus;
|
|
7
|
+
repo_root: string;
|
|
8
|
+
baseline_commit: string | null;
|
|
9
|
+
active_run_id: string | null;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type VerificationStatus = 'pass' | 'fail' | 'skip' | 'error';
|
|
2
|
+
export interface VerificationResult {
|
|
3
|
+
verification_id: string;
|
|
4
|
+
work_item_id: string;
|
|
5
|
+
check_id: string;
|
|
6
|
+
status: VerificationStatus;
|
|
7
|
+
evidence_refs: string[];
|
|
8
|
+
summary: string | null;
|
|
9
|
+
}
|