codex-orchestrator 0.1.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/LICENSE +21 -0
- package/README.md +94 -0
- package/dist/src/cli.d.ts +3 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +253 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/codex/command-adapter.d.ts +27 -0
- package/dist/src/codex/command-adapter.d.ts.map +1 -0
- package/dist/src/codex/command-adapter.js +49 -0
- package/dist/src/codex/command-adapter.js.map +1 -0
- package/dist/src/config/constants.d.ts +6 -0
- package/dist/src/config/constants.d.ts.map +1 -0
- package/dist/src/config/constants.js +13 -0
- package/dist/src/config/constants.js.map +1 -0
- package/dist/src/config/schema.d.ts +87 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/schema.js +180 -0
- package/dist/src/config/schema.js.map +1 -0
- package/dist/src/git/worktree.d.ts +50 -0
- package/dist/src/git/worktree.d.ts.map +1 -0
- package/dist/src/git/worktree.js +139 -0
- package/dist/src/git/worktree.js.map +1 -0
- package/dist/src/github/gh-cli.d.ts +11 -0
- package/dist/src/github/gh-cli.d.ts.map +1 -0
- package/dist/src/github/gh-cli.js +28 -0
- package/dist/src/github/gh-cli.js.map +1 -0
- package/dist/src/github/gh-issue-adapter.d.ts +15 -0
- package/dist/src/github/gh-issue-adapter.d.ts.map +1 -0
- package/dist/src/github/gh-issue-adapter.js +193 -0
- package/dist/src/github/gh-issue-adapter.js.map +1 -0
- package/dist/src/github/gh-pull-request-adapter.d.ts +9 -0
- package/dist/src/github/gh-pull-request-adapter.d.ts.map +1 -0
- package/dist/src/github/gh-pull-request-adapter.js +39 -0
- package/dist/src/github/gh-pull-request-adapter.js.map +1 -0
- package/dist/src/github/issues.d.ts +80 -0
- package/dist/src/github/issues.d.ts.map +1 -0
- package/dist/src/github/issues.js +122 -0
- package/dist/src/github/issues.js.map +1 -0
- package/dist/src/github/pull-requests.d.ts +24 -0
- package/dist/src/github/pull-requests.d.ts.map +1 -0
- package/dist/src/github/pull-requests.js +21 -0
- package/dist/src/github/pull-requests.js.map +1 -0
- package/dist/src/index.d.ts +31 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +17 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/package-info.d.ts +6 -0
- package/dist/src/package-info.d.ts.map +1 -0
- package/dist/src/package-info.js +13 -0
- package/dist/src/package-info.js.map +1 -0
- package/dist/src/process/command.d.ts +15 -0
- package/dist/src/process/command.d.ts.map +1 -0
- package/dist/src/process/command.js +34 -0
- package/dist/src/process/command.js.map +1 -0
- package/dist/src/runner/command-utils.d.ts +5 -0
- package/dist/src/runner/command-utils.d.ts.map +1 -0
- package/dist/src/runner/command-utils.js +19 -0
- package/dist/src/runner/command-utils.js.map +1 -0
- package/dist/src/runner/issue-state-machine.d.ts +39 -0
- package/dist/src/runner/issue-state-machine.d.ts.map +1 -0
- package/dist/src/runner/issue-state-machine.js +119 -0
- package/dist/src/runner/issue-state-machine.js.map +1 -0
- package/dist/src/runner/issue-tree.d.ts +62 -0
- package/dist/src/runner/issue-tree.d.ts.map +1 -0
- package/dist/src/runner/issue-tree.js +376 -0
- package/dist/src/runner/issue-tree.js.map +1 -0
- package/dist/src/runner/local-state.d.ts +31 -0
- package/dist/src/runner/local-state.d.ts.map +1 -0
- package/dist/src/runner/local-state.js +125 -0
- package/dist/src/runner/local-state.js.map +1 -0
- package/dist/src/runner/plan-auto-command.d.ts +30 -0
- package/dist/src/runner/plan-auto-command.d.ts.map +1 -0
- package/dist/src/runner/plan-auto-command.js +611 -0
- package/dist/src/runner/plan-auto-command.js.map +1 -0
- package/dist/src/runner/prompt.d.ts +108 -0
- package/dist/src/runner/prompt.d.ts.map +1 -0
- package/dist/src/runner/prompt.js +322 -0
- package/dist/src/runner/prompt.js.map +1 -0
- package/dist/src/runner/recovery.d.ts +24 -0
- package/dist/src/runner/recovery.d.ts.map +1 -0
- package/dist/src/runner/recovery.js +62 -0
- package/dist/src/runner/recovery.js.map +1 -0
- package/dist/src/runner/safety.d.ts +14 -0
- package/dist/src/runner/safety.d.ts.map +1 -0
- package/dist/src/runner/safety.js +46 -0
- package/dist/src/runner/safety.js.map +1 -0
- package/dist/src/runner/scoped-auto-command.d.ts +29 -0
- package/dist/src/runner/scoped-auto-command.d.ts.map +1 -0
- package/dist/src/runner/scoped-auto-command.js +262 -0
- package/dist/src/runner/scoped-auto-command.js.map +1 -0
- package/dist/src/runner/status-command.d.ts +17 -0
- package/dist/src/runner/status-command.d.ts.map +1 -0
- package/dist/src/runner/status-command.js +72 -0
- package/dist/src/runner/status-command.js.map +1 -0
- package/dist/src/setup/github-label-adapter.d.ts +13 -0
- package/dist/src/setup/github-label-adapter.d.ts.map +1 -0
- package/dist/src/setup/github-label-adapter.js +28 -0
- package/dist/src/setup/github-label-adapter.js.map +1 -0
- package/dist/src/setup/labels.d.ts +27 -0
- package/dist/src/setup/labels.d.ts.map +1 -0
- package/dist/src/setup/labels.js +42 -0
- package/dist/src/setup/labels.js.map +1 -0
- package/dist/src/setup/project-config.d.ts +15 -0
- package/dist/src/setup/project-config.d.ts.map +1 -0
- package/dist/src/setup/project-config.js +124 -0
- package/dist/src/setup/project-config.js.map +1 -0
- package/dist/src/setup/setup-command.d.ts +22 -0
- package/dist/src/setup/setup-command.d.ts.map +1 -0
- package/dist/src/setup/setup-command.js +104 -0
- package/dist/src/setup/setup-command.js.map +1 -0
- package/dist/src/setup/workflows.d.ts +11 -0
- package/dist/src/setup/workflows.d.ts.map +1 -0
- package/dist/src/setup/workflows.js +60 -0
- package/dist/src/setup/workflows.js.map +1 -0
- package/package.json +45 -0
- package/prompts/setup-skill.md +11 -0
- package/prompts/workflows/breakdown-review.md +4 -0
- package/prompts/workflows/issue-breakdown.md +4 -0
- package/prompts/workflows/issue-tree-orchestration.md +4 -0
- package/prompts/workflows/prd.md +4 -0
- package/prompts/workflows/scoped-implementation.md +4 -0
- package/prompts/workflows/triage.md +4 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { CodexOrchestratorConfig } from '../config/schema.js';
|
|
2
|
+
import type { GitHubIssue } from '../github/issues.js';
|
|
3
|
+
import type { AutonomousChildMetadata } from './issue-tree.js';
|
|
4
|
+
import type { PlanGraph } from './issue-tree.js';
|
|
5
|
+
export interface ScopedPromptInput {
|
|
6
|
+
issue: GitHubIssue;
|
|
7
|
+
config: CodexOrchestratorConfig;
|
|
8
|
+
workflowPromptText: string;
|
|
9
|
+
promptPath: string;
|
|
10
|
+
reportPath: string;
|
|
11
|
+
branchName: string;
|
|
12
|
+
worktreePath: string;
|
|
13
|
+
}
|
|
14
|
+
export interface PlanAutoPromptInput {
|
|
15
|
+
parentIssue: GitHubIssue;
|
|
16
|
+
config: CodexOrchestratorConfig;
|
|
17
|
+
prompts: {
|
|
18
|
+
prd: string;
|
|
19
|
+
issueBreakdown: string;
|
|
20
|
+
breakdownReview: string;
|
|
21
|
+
triage: string;
|
|
22
|
+
};
|
|
23
|
+
promptPath: string;
|
|
24
|
+
reportPath: string;
|
|
25
|
+
branchName: string;
|
|
26
|
+
worktreePath: string;
|
|
27
|
+
}
|
|
28
|
+
export interface IssueTreeChildPromptInput {
|
|
29
|
+
parentIssue: GitHubIssue;
|
|
30
|
+
childIssue: GitHubIssue;
|
|
31
|
+
config: CodexOrchestratorConfig;
|
|
32
|
+
workflowPromptText: string;
|
|
33
|
+
childMetadata: AutonomousChildMetadata;
|
|
34
|
+
dependencyIssues: GitHubIssue[];
|
|
35
|
+
promptPath: string;
|
|
36
|
+
reportPath: string;
|
|
37
|
+
branchName: string;
|
|
38
|
+
worktreePath: string;
|
|
39
|
+
}
|
|
40
|
+
export type CompletionStatus = 'completed' | 'needs-promotion';
|
|
41
|
+
export type ValidationStatus = 'passed' | 'failed' | 'skipped';
|
|
42
|
+
export type ProhibitedActionType = 'secret-file-read' | 'secret-file-change' | 'destructive-db-or-cache' | 'production-deploy-or-release';
|
|
43
|
+
export interface ScopedCompletionReport {
|
|
44
|
+
status: CompletionStatus;
|
|
45
|
+
changes: string[];
|
|
46
|
+
validation: Array<{
|
|
47
|
+
command: string;
|
|
48
|
+
status: ValidationStatus;
|
|
49
|
+
summary: string;
|
|
50
|
+
}>;
|
|
51
|
+
skippedChecks: string[];
|
|
52
|
+
residualRisks: string[];
|
|
53
|
+
prohibitedActions: Array<{
|
|
54
|
+
type: ProhibitedActionType;
|
|
55
|
+
description: string;
|
|
56
|
+
}>;
|
|
57
|
+
promotion?: {
|
|
58
|
+
reason: string;
|
|
59
|
+
criteria: string[];
|
|
60
|
+
evidence: string[];
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface PlanAutoCompletionReport {
|
|
64
|
+
status: 'completed';
|
|
65
|
+
parent: {
|
|
66
|
+
title?: string;
|
|
67
|
+
body: string;
|
|
68
|
+
};
|
|
69
|
+
graph: PlanGraph;
|
|
70
|
+
residualRisks: string[];
|
|
71
|
+
}
|
|
72
|
+
export type ScopedCompletionReportReadResult = {
|
|
73
|
+
kind: 'missing';
|
|
74
|
+
} | {
|
|
75
|
+
kind: 'valid';
|
|
76
|
+
report: ScopedCompletionReport;
|
|
77
|
+
};
|
|
78
|
+
export type PlanAutoCompletionReportReadResult = {
|
|
79
|
+
kind: 'missing';
|
|
80
|
+
} | {
|
|
81
|
+
kind: 'valid';
|
|
82
|
+
report: PlanAutoCompletionReport;
|
|
83
|
+
};
|
|
84
|
+
export declare function buildScopedImplementationPrompt(input: ScopedPromptInput): string;
|
|
85
|
+
export declare function buildPlanAutoPrompt(input: PlanAutoPromptInput): string;
|
|
86
|
+
export declare function buildIssueTreeChildPrompt(input: IssueTreeChildPromptInput): string;
|
|
87
|
+
export declare function readScopedCompletionReport(reportPath: string): Promise<ScopedCompletionReportReadResult>;
|
|
88
|
+
export declare function readPlanAutoCompletionReport(reportPath: string): Promise<PlanAutoCompletionReportReadResult>;
|
|
89
|
+
export declare function writeDurablePrompt(input: {
|
|
90
|
+
targetRoot: string;
|
|
91
|
+
config: CodexOrchestratorConfig;
|
|
92
|
+
issueNumber: number;
|
|
93
|
+
sessionId: string;
|
|
94
|
+
promptText: string;
|
|
95
|
+
}): Promise<string>;
|
|
96
|
+
export declare function sessionPromptPath(input: {
|
|
97
|
+
targetRoot: string;
|
|
98
|
+
config: CodexOrchestratorConfig;
|
|
99
|
+
issueNumber: number;
|
|
100
|
+
sessionId: string;
|
|
101
|
+
}): string;
|
|
102
|
+
export declare function sessionReportPath(input: {
|
|
103
|
+
targetRoot: string;
|
|
104
|
+
config: CodexOrchestratorConfig;
|
|
105
|
+
issueNumber: number;
|
|
106
|
+
sessionId: string;
|
|
107
|
+
}): string;
|
|
108
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/runner/prompt.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,uBAAuB,CAAC;IAChC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,uBAAuB,CAAC;IAChC,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAC;QACZ,cAAc,EAAE,MAAM,CAAC;QACvB,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AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,uBAAuB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAOT;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,uBAAuB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAOT"}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { validatePlanGraph } from './issue-tree.js';
|
|
4
|
+
export function buildScopedImplementationPrompt(input) {
|
|
5
|
+
const labels = input.issue.labels.map((label) => label.name).join(', ') || 'none';
|
|
6
|
+
const comments = [...input.issue.comments]
|
|
7
|
+
.sort((left, right) => left.createdAt.localeCompare(right.createdAt))
|
|
8
|
+
.map((comment) => `- ${comment.createdAt} ${comment.author.login} (${comment.authorAssociation}): ${comment.body}`)
|
|
9
|
+
.join('\n') || 'none';
|
|
10
|
+
return [
|
|
11
|
+
'# Codex Orchestrator Scoped Implementation',
|
|
12
|
+
'## Issue Context',
|
|
13
|
+
`Issue: #${input.issue.number}`,
|
|
14
|
+
`Title: ${input.issue.title}`,
|
|
15
|
+
`URL: ${input.issue.url}`,
|
|
16
|
+
`Body:\n${input.issue.body}`,
|
|
17
|
+
`Labels: ${labels}`,
|
|
18
|
+
`Comments:\n${comments}`,
|
|
19
|
+
'## Project Workflow',
|
|
20
|
+
input.workflowPromptText,
|
|
21
|
+
'## Runner-Owned Publication Contract',
|
|
22
|
+
'Change files only. Do not commit, push, open pull requests, merge, publish, deploy, or edit GitHub labels/comments. The runner owns publication.',
|
|
23
|
+
'## Safety Contract',
|
|
24
|
+
`Do not read or modify configured secret file patterns: ${input.config.deny.secretFiles.join(', ')}.`,
|
|
25
|
+
'Do not run destructive database/cache actions.',
|
|
26
|
+
'Do not run production deploy/release actions.',
|
|
27
|
+
'## Completion Report Contract',
|
|
28
|
+
`The Codex CLI will save your final response to ${input.reportPath}; do not try to write this file yourself.`,
|
|
29
|
+
'Your final response must be only raw valid JSON, with no markdown fence or explanatory prose.',
|
|
30
|
+
'Schema: { "status": "completed" | "needs-promotion", "changes": string[], "validation": { "command": string, "status": "passed" | "failed" | "skipped", "summary": string }[], "skippedChecks": string[], "residualRisks": string[], "prohibitedActions": { "type": "secret-file-read" | "secret-file-change" | "destructive-db-or-cache" | "production-deploy-or-release", "description": string }[], "promotion"?: { "reason": string, "criteria": string[], "evidence": string[] } }.',
|
|
31
|
+
`Prompt file: ${input.promptPath}`,
|
|
32
|
+
`Branch: ${input.branchName}`,
|
|
33
|
+
`Worktree: ${input.worktreePath}`,
|
|
34
|
+
].join('\n\n');
|
|
35
|
+
}
|
|
36
|
+
export function buildPlanAutoPrompt(input) {
|
|
37
|
+
const labels = input.parentIssue.labels.map((label) => label.name).join(', ') || 'none';
|
|
38
|
+
const comments = [...input.parentIssue.comments]
|
|
39
|
+
.sort((left, right) => left.createdAt.localeCompare(right.createdAt))
|
|
40
|
+
.map((comment) => `- ${comment.createdAt} ${comment.author.login} (${comment.authorAssociation}): ${comment.body}`)
|
|
41
|
+
.join('\n') || 'none';
|
|
42
|
+
return [
|
|
43
|
+
'# Codex Orchestrator Parent Planning',
|
|
44
|
+
'## Parent Issue Context',
|
|
45
|
+
`Issue: #${input.parentIssue.number}`,
|
|
46
|
+
`Title: ${input.parentIssue.title}`,
|
|
47
|
+
`URL: ${input.parentIssue.url}`,
|
|
48
|
+
`Body:\n${input.parentIssue.body}`,
|
|
49
|
+
`Labels: ${labels}`,
|
|
50
|
+
`Comments:\n${comments}`,
|
|
51
|
+
'## PRD Workflow',
|
|
52
|
+
input.prompts.prd,
|
|
53
|
+
'## Issue Breakdown Workflow',
|
|
54
|
+
input.prompts.issueBreakdown,
|
|
55
|
+
'## Breakdown Review Workflow',
|
|
56
|
+
input.prompts.breakdownReview,
|
|
57
|
+
'## Triage Workflow',
|
|
58
|
+
input.prompts.triage,
|
|
59
|
+
'## Runner-Owned GitHub Contract',
|
|
60
|
+
'Return structured output only. Do not create/edit GitHub issues, labels, comments, milestones, projects, branches, commits, pushes, pull requests, merges, publishes, deploys, or execute child waves. The runner owns all GitHub mutations.',
|
|
61
|
+
'## Autonomous Child Contract',
|
|
62
|
+
'Every child must be represented in the JSON report. Autonomous membership requires the explicit runner marker plus parent reference. Arbitrary links, milestones, projects, and comments do not grant membership or inherited authorization.',
|
|
63
|
+
'## Planning Report Contract',
|
|
64
|
+
[
|
|
65
|
+
`The Codex CLI will save your final response to ${input.reportPath}; do not try to write this file yourself.`,
|
|
66
|
+
'Your final response must be only raw valid JSON, with no markdown fence or explanatory prose.',
|
|
67
|
+
'Schema: { "status": "completed", "parent": { "title"?: string, "body": string }, "graph": { "nodes": PlanChildNode[], "edges": PlanDependencyEdge[], "specGate": "wave-level" }, "residualRisks": string[] }.',
|
|
68
|
+
'PlanChildNode: { stableId, issueNumber?, title, body, afkHitl: "afk" | "hitl", ownershipScope: string[], dependsOn: string[], verification: string[] }.',
|
|
69
|
+
'PlanDependencyEdge: { from, to, reason } where from is the dependency and to depends on it.',
|
|
70
|
+
`Prompt file: ${input.promptPath}`,
|
|
71
|
+
`Branch: ${input.branchName}`,
|
|
72
|
+
`Worktree: ${input.worktreePath}`,
|
|
73
|
+
].join('\n'),
|
|
74
|
+
].join('\n\n');
|
|
75
|
+
}
|
|
76
|
+
export function buildIssueTreeChildPrompt(input) {
|
|
77
|
+
const labels = input.childIssue.labels.map((label) => label.name).join(', ') || 'none';
|
|
78
|
+
const comments = [...input.childIssue.comments]
|
|
79
|
+
.sort((left, right) => left.createdAt.localeCompare(right.createdAt))
|
|
80
|
+
.map((comment) => `- ${comment.createdAt} ${comment.author.login} (${comment.authorAssociation}): ${comment.body}`)
|
|
81
|
+
.join('\n') || 'none';
|
|
82
|
+
const dependencies = input.dependencyIssues.length > 0
|
|
83
|
+
? input.dependencyIssues.map((issue) => `- #${issue.number} ${issue.title}`).join('\n')
|
|
84
|
+
: 'none';
|
|
85
|
+
return [
|
|
86
|
+
'# Codex Orchestrator Issue-Tree Child Implementation',
|
|
87
|
+
'## Parent Issue Context',
|
|
88
|
+
`Issue: #${input.parentIssue.number}`,
|
|
89
|
+
`Title: ${input.parentIssue.title}`,
|
|
90
|
+
`URL: ${input.parentIssue.url}`,
|
|
91
|
+
`Body:\n${input.parentIssue.body}`,
|
|
92
|
+
'## Child Issue Context',
|
|
93
|
+
`Issue: #${input.childIssue.number}`,
|
|
94
|
+
`Title: ${input.childIssue.title}`,
|
|
95
|
+
`URL: ${input.childIssue.url}`,
|
|
96
|
+
`Body:\n${input.childIssue.body}`,
|
|
97
|
+
`Labels: ${labels}`,
|
|
98
|
+
`Comments:\n${comments}`,
|
|
99
|
+
`Stable ID: ${input.childMetadata.stableId}`,
|
|
100
|
+
`Ownership Scope: ${input.childMetadata.ownershipScope.join(', ')}`,
|
|
101
|
+
`Dependencies: ${input.childMetadata.dependsOn.length > 0 ? input.childMetadata.dependsOn.join(', ') : 'none'}`,
|
|
102
|
+
`Verification Expectations: ${input.childMetadata.verification.join(', ')}`,
|
|
103
|
+
'## Dependency Context',
|
|
104
|
+
dependencies,
|
|
105
|
+
'Dependency child issues listed here were merged into the parent integration branch before this child starts.',
|
|
106
|
+
'## Project Workflow',
|
|
107
|
+
input.workflowPromptText,
|
|
108
|
+
'## Runner-Owned Publication Contract',
|
|
109
|
+
'Change files only. You must not commit, push, merge, open pull requests, merge pull requests, publish, deploy, or edit GitHub labels/comments. The runner owns publication.',
|
|
110
|
+
'## Safety Contract',
|
|
111
|
+
`Do not read or modify configured secret file patterns: ${input.config.deny.secretFiles.join(', ')}.`,
|
|
112
|
+
'Do not run destructive database/cache actions.',
|
|
113
|
+
'Do not run production deploy/release actions.',
|
|
114
|
+
'## Completion Report Contract',
|
|
115
|
+
`The Codex CLI will save your final response to ${input.reportPath}; do not try to write this file yourself.`,
|
|
116
|
+
'Your final response must be only raw valid JSON, with no markdown fence or explanatory prose.',
|
|
117
|
+
'Schema: { "status": "completed" | "needs-promotion", "changes": string[], "validation": { "command": string, "status": "passed" | "failed" | "skipped", "summary": string }[], "skippedChecks": string[], "residualRisks": string[], "prohibitedActions": { "type": "secret-file-read" | "secret-file-change" | "destructive-db-or-cache" | "production-deploy-or-release", "description": string }[], "promotion"?: { "reason": string, "criteria": string[], "evidence": string[] } }.',
|
|
118
|
+
`Prompt file: ${input.promptPath}`,
|
|
119
|
+
`Branch: ${input.branchName}`,
|
|
120
|
+
`Worktree: ${input.worktreePath}`,
|
|
121
|
+
].join('\n\n');
|
|
122
|
+
}
|
|
123
|
+
export async function readScopedCompletionReport(reportPath) {
|
|
124
|
+
let content;
|
|
125
|
+
try {
|
|
126
|
+
content = await readFile(reportPath, 'utf8');
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
130
|
+
return { kind: 'missing' };
|
|
131
|
+
}
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
let parsed;
|
|
135
|
+
try {
|
|
136
|
+
parsed = JSON.parse(content);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
throw new Error('Invalid scoped completion report: report must be valid JSON');
|
|
140
|
+
}
|
|
141
|
+
assertScopedCompletionReport(parsed);
|
|
142
|
+
return { kind: 'valid', report: parsed };
|
|
143
|
+
}
|
|
144
|
+
export async function readPlanAutoCompletionReport(reportPath) {
|
|
145
|
+
let content;
|
|
146
|
+
try {
|
|
147
|
+
content = await readFile(reportPath, 'utf8');
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
151
|
+
return { kind: 'missing' };
|
|
152
|
+
}
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
let parsed;
|
|
156
|
+
try {
|
|
157
|
+
parsed = JSON.parse(content);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
throw new Error('Invalid plan-auto completion report: report must be valid JSON');
|
|
161
|
+
}
|
|
162
|
+
assertPlanAutoCompletionReport(parsed);
|
|
163
|
+
return { kind: 'valid', report: parsed };
|
|
164
|
+
}
|
|
165
|
+
export async function writeDurablePrompt(input) {
|
|
166
|
+
const path = sessionPromptPath(input);
|
|
167
|
+
await mkdir(dirname(path), { recursive: true });
|
|
168
|
+
await writeFile(path, input.promptText, 'utf8');
|
|
169
|
+
return path;
|
|
170
|
+
}
|
|
171
|
+
export function sessionPromptPath(input) {
|
|
172
|
+
return join(input.targetRoot, input.config.runner.stateDir, 'prompts', `issue-${input.issueNumber}-${input.sessionId}.md`);
|
|
173
|
+
}
|
|
174
|
+
export function sessionReportPath(input) {
|
|
175
|
+
return join(input.targetRoot, input.config.runner.stateDir, 'reports', `issue-${input.issueNumber}-${input.sessionId}.json`);
|
|
176
|
+
}
|
|
177
|
+
function assertScopedCompletionReport(value) {
|
|
178
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
179
|
+
throw new Error('Invalid scoped completion report: report must be an object');
|
|
180
|
+
}
|
|
181
|
+
const record = value;
|
|
182
|
+
if (record.status !== 'completed' && record.status !== 'needs-promotion') {
|
|
183
|
+
throw new Error('Invalid scoped completion report: status must be completed or needs-promotion');
|
|
184
|
+
}
|
|
185
|
+
assertStringArray(record.changes, 'changes');
|
|
186
|
+
assertValidation(record.validation);
|
|
187
|
+
assertStringArray(record.skippedChecks, 'skippedChecks');
|
|
188
|
+
assertStringArray(record.residualRisks, 'residualRisks');
|
|
189
|
+
assertProhibitedActions(record.prohibitedActions);
|
|
190
|
+
if (record.status === 'needs-promotion') {
|
|
191
|
+
assertPromotion(record.promotion);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function assertPlanAutoCompletionReport(value) {
|
|
195
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
196
|
+
throw new Error('Invalid plan-auto completion report: report must be an object');
|
|
197
|
+
}
|
|
198
|
+
const record = value;
|
|
199
|
+
if (record.status !== 'completed') {
|
|
200
|
+
throw new Error('Invalid plan-auto completion report: status must be completed');
|
|
201
|
+
}
|
|
202
|
+
assertPlanParent(record.parent);
|
|
203
|
+
assertPlanGraph(record.graph);
|
|
204
|
+
assertStringArray(record.residualRisks, 'residualRisks', 'Invalid plan-auto completion report');
|
|
205
|
+
const graphValidation = validatePlanGraph(record.graph);
|
|
206
|
+
if (!graphValidation.ok) {
|
|
207
|
+
throw new Error(`Invalid plan-auto completion report: ${graphValidation.errors.join('; ')}`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function assertPlanParent(value) {
|
|
211
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
212
|
+
throw new Error('Invalid plan-auto completion report: parent must be an object');
|
|
213
|
+
}
|
|
214
|
+
const record = value;
|
|
215
|
+
if ('title' in record && typeof record.title !== 'string') {
|
|
216
|
+
throw new Error('Invalid plan-auto completion report: parent.title must be a string');
|
|
217
|
+
}
|
|
218
|
+
if (typeof record.body !== 'string' || record.body.trim().length === 0) {
|
|
219
|
+
throw new Error('Invalid plan-auto completion report: parent.body must be a non-empty string');
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function assertPlanGraph(value) {
|
|
223
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
224
|
+
throw new Error('Invalid plan-auto completion report: graph must be an object');
|
|
225
|
+
}
|
|
226
|
+
const record = value;
|
|
227
|
+
if (!Array.isArray(record.nodes)) {
|
|
228
|
+
throw new Error('Invalid plan-auto completion report: graph.nodes must be an array');
|
|
229
|
+
}
|
|
230
|
+
if (!Array.isArray(record.edges)) {
|
|
231
|
+
throw new Error('Invalid plan-auto completion report: graph.edges must be an array');
|
|
232
|
+
}
|
|
233
|
+
if (record.specGate !== 'wave-level') {
|
|
234
|
+
throw new Error('Invalid plan-auto completion report: graph.specGate must be wave-level');
|
|
235
|
+
}
|
|
236
|
+
for (const item of record.nodes) {
|
|
237
|
+
assertPlanChildNode(item);
|
|
238
|
+
}
|
|
239
|
+
for (const item of record.edges) {
|
|
240
|
+
assertPlanDependencyEdge(item);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function assertPlanChildNode(value) {
|
|
244
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
245
|
+
throw new Error('Invalid plan-auto completion report: graph node must be an object');
|
|
246
|
+
}
|
|
247
|
+
const record = value;
|
|
248
|
+
for (const key of ['stableId', 'title', 'body']) {
|
|
249
|
+
if (typeof record[key] !== 'string' || record[key].length === 0) {
|
|
250
|
+
throw new Error(`Invalid plan-auto completion report: graph node ${key} must be a non-empty string`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if ('issueNumber' in record && !Number.isInteger(record.issueNumber)) {
|
|
254
|
+
throw new Error('Invalid plan-auto completion report: graph node issueNumber must be an integer');
|
|
255
|
+
}
|
|
256
|
+
if (record.afkHitl !== 'afk' && record.afkHitl !== 'hitl') {
|
|
257
|
+
throw new Error('Invalid plan-auto completion report: graph node afkHitl must be afk or hitl');
|
|
258
|
+
}
|
|
259
|
+
assertStringArray(record.ownershipScope, 'ownershipScope', 'Invalid plan-auto completion report');
|
|
260
|
+
assertStringArray(record.dependsOn, 'dependsOn', 'Invalid plan-auto completion report');
|
|
261
|
+
assertStringArray(record.verification, 'verification', 'Invalid plan-auto completion report');
|
|
262
|
+
}
|
|
263
|
+
function assertPlanDependencyEdge(value) {
|
|
264
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
265
|
+
throw new Error('Invalid plan-auto completion report: graph edge must be an object');
|
|
266
|
+
}
|
|
267
|
+
const record = value;
|
|
268
|
+
for (const key of ['from', 'to', 'reason']) {
|
|
269
|
+
if (typeof record[key] !== 'string' || record[key].length === 0) {
|
|
270
|
+
throw new Error(`Invalid plan-auto completion report: graph edge ${key} must be a non-empty string`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
function assertStringArray(value, key, prefix = 'Invalid scoped completion report') {
|
|
275
|
+
if (!Array.isArray(value) || value.some((item) => typeof item !== 'string')) {
|
|
276
|
+
throw new Error(`${prefix}: ${key} must be a string array`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function assertValidation(value) {
|
|
280
|
+
if (!Array.isArray(value)) {
|
|
281
|
+
throw new Error('Invalid scoped completion report: validation must be an array');
|
|
282
|
+
}
|
|
283
|
+
for (const item of value) {
|
|
284
|
+
if (typeof item !== 'object' || item === null || Array.isArray(item)) {
|
|
285
|
+
throw new Error('Invalid scoped completion report: validation item must be an object');
|
|
286
|
+
}
|
|
287
|
+
const record = item;
|
|
288
|
+
if (typeof record.command !== 'string' || !['passed', 'failed', 'skipped'].includes(String(record.status)) || typeof record.summary !== 'string') {
|
|
289
|
+
throw new Error('Invalid scoped completion report: validation item is malformed');
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function assertProhibitedActions(value) {
|
|
294
|
+
const types = new Set(['secret-file-read', 'secret-file-change', 'destructive-db-or-cache', 'production-deploy-or-release']);
|
|
295
|
+
if (!Array.isArray(value)) {
|
|
296
|
+
throw new Error('Invalid scoped completion report: prohibitedActions must be an array');
|
|
297
|
+
}
|
|
298
|
+
for (const item of value) {
|
|
299
|
+
if (typeof item !== 'object' || item === null || Array.isArray(item)) {
|
|
300
|
+
throw new Error('Invalid scoped completion report: prohibitedActions item must be an object');
|
|
301
|
+
}
|
|
302
|
+
const record = item;
|
|
303
|
+
if (typeof record.type !== 'string' || !types.has(record.type) || typeof record.description !== 'string') {
|
|
304
|
+
throw new Error('Invalid scoped completion report: prohibitedActions item is malformed');
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function assertPromotion(value) {
|
|
309
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
310
|
+
throw new Error('Invalid scoped completion report: promotion is required for needs-promotion');
|
|
311
|
+
}
|
|
312
|
+
const record = value;
|
|
313
|
+
if (typeof record.reason !== 'string' || record.reason.trim().length === 0) {
|
|
314
|
+
throw new Error('Invalid scoped completion report: promotion.reason must be non-empty');
|
|
315
|
+
}
|
|
316
|
+
assertStringArray(record.criteria, 'promotion.criteria');
|
|
317
|
+
assertStringArray(record.evidence, 'promotion.evidence');
|
|
318
|
+
if (record.criteria.length === 0 || record.evidence.length === 0) {
|
|
319
|
+
throw new Error('Invalid scoped completion report: promotion criteria and evidence must be non-empty');
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/runner/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAM1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAgFpD,MAAM,UAAU,+BAA+B,CAAC,KAAwB;IACtE,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC;IAClF,MAAM,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;SACvC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,CAA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IACH,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC;IACjG,CAAC;IACD,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3E,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;IAC1F,CAAC;IACD,iBAAiB,CAAC,MAAM,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IACzD,iBAAiB,CAAC,MAAM,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IACzD,IAAK,MAAM,CAAC,QAAqB,CAAC,MAAM,KAAK,CAAC,IAAK,MAAM,CAAC,QAAqB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7F,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC,CAAC;IACzG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CodexOrchestratorConfig } from '../config/schema.js';
|
|
2
|
+
import type { GitHubIssueAdapter } from '../github/issues.js';
|
|
3
|
+
import { type RunnerMode } from './issue-state-machine.js';
|
|
4
|
+
import type { RunnerStateStore } from './local-state.js';
|
|
5
|
+
export type RecoveryStatus = 'active' | 'stale' | 'missing' | 'completed' | 'waiting-for-clarification' | 'clarification-resumable';
|
|
6
|
+
export interface RecoveryEntry {
|
|
7
|
+
issueNumber: number;
|
|
8
|
+
mode: RunnerMode;
|
|
9
|
+
status: RecoveryStatus;
|
|
10
|
+
reason: string;
|
|
11
|
+
workspacePath: string;
|
|
12
|
+
sessionId: string;
|
|
13
|
+
retryCount: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ReconcileRunnerStateInput {
|
|
16
|
+
store: RunnerStateStore;
|
|
17
|
+
issueAdapter: GitHubIssueAdapter;
|
|
18
|
+
config: CodexOrchestratorConfig;
|
|
19
|
+
now: Date;
|
|
20
|
+
allowClarificationResume?: boolean;
|
|
21
|
+
updateLocalState?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function reconcileRunnerState(input: ReconcileRunnerStateInput): Promise<RecoveryEntry[]>;
|
|
24
|
+
//# sourceMappingURL=recovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery.d.ts","sourceRoot":"","sources":["../../../src/runner/recovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAe,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,OAAO,GACP,SAAS,GACT,WAAW,GACX,2BAA2B,GAC3B,yBAAyB,CAAC;AAE9B,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,gBAAgB,CAAC;IACxB,YAAY,EAAE,kBAAkB,CAAC;IACjC,MAAM,EAAE,uBAAuB,CAAC;IAChC,GAAG,EAAE,IAAI,CAAC;IACV,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAWD,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAoCrG"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { clearClarificationGate, hasMaintainerResponseAfterLatestClarification, } from './issue-state-machine.js';
|
|
2
|
+
const recoveryReasons = {
|
|
3
|
+
active: 'GitHub still marks the issue running',
|
|
4
|
+
stale: 'local run exists but GitHub no longer marks it running',
|
|
5
|
+
missing: 'local run has no matching GitHub issue',
|
|
6
|
+
completed: 'GitHub marks the work completed',
|
|
7
|
+
'waiting-for-clarification': 'blocked clarification is waiting for maintainer response',
|
|
8
|
+
'clarification-resumable': 'maintainer clarification response detected',
|
|
9
|
+
};
|
|
10
|
+
export async function reconcileRunnerState(input) {
|
|
11
|
+
const allowClarificationResume = input.allowClarificationResume ?? false;
|
|
12
|
+
const updateLocalState = input.updateLocalState ?? true;
|
|
13
|
+
const state = await input.store.load();
|
|
14
|
+
const entries = [];
|
|
15
|
+
for (const run of state.runs) {
|
|
16
|
+
const issue = await input.issueAdapter.getIssue(run.issueNumber);
|
|
17
|
+
const status = classifyIssue(issue, input.config);
|
|
18
|
+
if (status === 'clarification-resumable' && allowClarificationResume) {
|
|
19
|
+
await clearClarificationGate(input.issueAdapter, input.config, run.issueNumber, input.now);
|
|
20
|
+
}
|
|
21
|
+
entries.push({
|
|
22
|
+
issueNumber: run.issueNumber,
|
|
23
|
+
mode: run.mode,
|
|
24
|
+
status,
|
|
25
|
+
reason: recoveryReasons[status],
|
|
26
|
+
workspacePath: run.workspacePath,
|
|
27
|
+
sessionId: run.sessionId,
|
|
28
|
+
retryCount: run.retryCount,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (updateLocalState) {
|
|
32
|
+
await input.store.save({
|
|
33
|
+
version: 1,
|
|
34
|
+
runs: state.runs.map((run) => ({
|
|
35
|
+
...run,
|
|
36
|
+
lastRecoveredAt: input.now.toISOString(),
|
|
37
|
+
})),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return entries.sort((left, right) => left.issueNumber - right.issueNumber);
|
|
41
|
+
}
|
|
42
|
+
function classifyIssue(issue, config) {
|
|
43
|
+
if (!issue) {
|
|
44
|
+
return 'missing';
|
|
45
|
+
}
|
|
46
|
+
const labels = new Set(issue.labels.map((label) => label.name));
|
|
47
|
+
if (issue.state === 'CLOSED' ||
|
|
48
|
+
labels.has(config.github.labels.review.name) ||
|
|
49
|
+
issue.closedByPullRequestsReferences.length > 0) {
|
|
50
|
+
return 'completed';
|
|
51
|
+
}
|
|
52
|
+
if (labels.has(config.github.labels.blocked.name)) {
|
|
53
|
+
return hasMaintainerResponseAfterLatestClarification(issue)
|
|
54
|
+
? 'clarification-resumable'
|
|
55
|
+
: 'waiting-for-clarification';
|
|
56
|
+
}
|
|
57
|
+
if (labels.has(config.github.labels.running.name)) {
|
|
58
|
+
return 'active';
|
|
59
|
+
}
|
|
60
|
+
return 'stale';
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=recovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery.js","sourceRoot":"","sources":["../../../src/runner/recovery.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,sBAAsB,EACtB,6CAA6C,GAE9C,MAAM,0BAA0B,CAAC;AA8BlC,MAAM,eAAe,GAAmC;IACtD,MAAM,EAAE,sCAAsC;IAC9C,KAAK,EAAE,wDAAwD;IAC/D,OAAO,EAAE,wCAAwC;IACjD,SAAS,EAAE,iCAAiC;IAC5C,2BAA2B,EAAE,0DAA0D;IACvF,yBAAyB,EAAE,4CAA4C;CACxE,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,KAAgC;IACzE,MAAM,wBAAwB,GAAG,KAAK,CAAC,wBAAwB,IAAI,KAAK,CAAC;IACzE,MAAM,gBAAgB,GAAG,KAAK,CAAC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AE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,aAAa,CAAC,KAA8B,EAAE,MAA+B;IACpF,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,IACE,KAAK,CAAC,KAAK,KAAK,QAAQ;QACxB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5C,KAAK,CAAC,8BAA8B,CAAC,MAAM,GAAG,CAAC,EAC/C,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,OAAO,6CAA6C,CAAC,KAAK,CAAC;YACzD,CAAC,CAAC,yBAAyB;YAC3B,CAAC,CAAC,2BAA2B,CAAC;IAClC,CAAC;IACD,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CodexOrchestratorConfig } from '../config/schema.js';
|
|
2
|
+
import type { ScopedCompletionReport } from './prompt.js';
|
|
3
|
+
export type SafetyViolationCode = 'secret-file-change' | 'secret-file-read' | 'destructive-db-or-cache' | 'production-deploy-or-release' | 'agent-owned-git-publication';
|
|
4
|
+
export interface SafetyViolation {
|
|
5
|
+
code: SafetyViolationCode;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Supports exact path literals, `*` within one path segment, and `**` across path segments.
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateChangedPaths(paths: string[], config: CodexOrchestratorConfig): SafetyViolation[];
|
|
12
|
+
export declare function validateCompletionReportSafety(report: ScopedCompletionReport): SafetyViolation[];
|
|
13
|
+
export declare function validateNoAgentOwnedGitPublication(beforeHead: string, afterHead: string): SafetyViolation[];
|
|
14
|
+
//# sourceMappingURL=safety.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../../src/runner/safety.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,MAAM,mBAAmB,GAC3B,oBAAoB,GACpB,kBAAkB,GAClB,yBAAyB,GACzB,8BAA8B,GAC9B,6BAA6B,CAAC;AAElC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,uBAAuB,GAAG,eAAe,EAAE,CAOxG;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,sBAAsB,GAAG,eAAe,EAAE,CAKhG;AAED,wBAAgB,kCAAkC,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE,CAU3G"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supports exact path literals, `*` within one path segment, and `**` across path segments.
|
|
3
|
+
*/
|
|
4
|
+
export function validateChangedPaths(paths, config) {
|
|
5
|
+
const patterns = [...config.deny.secretFiles, ...config.deny.additionalPathGlobs];
|
|
6
|
+
return paths.flatMap((path) => {
|
|
7
|
+
const normalized = normalizePath(path);
|
|
8
|
+
const matched = patterns.find((pattern) => globMatches(pattern, normalized));
|
|
9
|
+
return matched ? [{ code: 'secret-file-change', message: `Changed path ${normalized} matches denied pattern ${matched}` }] : [];
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export function validateCompletionReportSafety(report) {
|
|
13
|
+
return report.prohibitedActions.map((action) => ({
|
|
14
|
+
code: action.type,
|
|
15
|
+
message: action.description,
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
export function validateNoAgentOwnedGitPublication(beforeHead, afterHead) {
|
|
19
|
+
if (beforeHead !== afterHead) {
|
|
20
|
+
return [
|
|
21
|
+
{
|
|
22
|
+
code: 'agent-owned-git-publication',
|
|
23
|
+
message: 'Codex changed git HEAD; runner-owned publication was violated',
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
function globMatches(pattern, path) {
|
|
30
|
+
const escaped = pattern
|
|
31
|
+
.split('/')
|
|
32
|
+
.map((segment) => {
|
|
33
|
+
if (segment === '**') {
|
|
34
|
+
return '.*';
|
|
35
|
+
}
|
|
36
|
+
return segment
|
|
37
|
+
.replace(/[.+?^${}()|[\]\\]/g, '\\$&')
|
|
38
|
+
.replaceAll('*', '[^/]*');
|
|
39
|
+
})
|
|
40
|
+
.join('/');
|
|
41
|
+
return new RegExp(`^${escaped}$`).test(path);
|
|
42
|
+
}
|
|
43
|
+
function normalizePath(path) {
|
|
44
|
+
return path.replaceAll('\\', '/').replace(/^\.\//, '');
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=safety.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safety.js","sourceRoot":"","sources":["../../../src/runner/safety.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,UAAU,oBAAoB,C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