@fitlab-ai/agent-infra 0.11.11 → 0.11.13
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/dist/bin/internal-cli.js +2 -2
- package/dist/lib/agent-clients/adapter.js +7 -1
- package/dist/lib/agent-clients/adapters/claude-code.js +5 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +78 -63
- package/dist/lib/agent-clients/adapters/codex-lifecycle/binding.js +114 -0
- package/dist/lib/agent-clients/adapters/codex-lifecycle/cli.js +447 -0
- package/dist/lib/agent-clients/adapters/codex-lifecycle/controller-client.js +130 -0
- package/dist/lib/agent-clients/adapters/codex-lifecycle/controller-operation.js +131 -0
- package/dist/lib/{sandbox/control → agent-clients/adapters/codex-lifecycle}/controller-registration.js +2 -2
- package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +48 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/recovery.js +124 -62
- package/dist/lib/{internal/codex-sandbox-controller.js → agent-clients/adapters/codex-lifecycle/sandbox-controller-cli.js} +3 -3
- package/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +3 -5
- package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +211 -213
- package/dist/lib/agent-clients/adapters/codex-orchestration.js +468 -0
- package/dist/lib/agent-clients/adapters/codex.js +40 -1
- package/dist/lib/agent-clients/adapters/index.js +2 -10
- package/dist/lib/agent-clients/tokens.js +3 -2
- package/dist/lib/internal/agent-client.js +132 -72
- package/dist/lib/internal/cli-route-inventory.js +2 -2
- package/dist/lib/internal/sandbox-control.js +1 -81
- package/dist/lib/internal/task-finalization.js +26 -19
- package/dist/lib/internal/task-lifecycle.js +1 -1
- package/dist/lib/internal/task-operation-registry.js +1 -1
- package/dist/lib/internal/task-validate.js +1 -1
- package/dist/lib/platform/github-client.js +33 -3
- package/dist/lib/platform/issues.js +18 -6
- package/dist/lib/runtime/agent-runtime.js +6 -29
- package/dist/lib/sandbox/commands/control-status.js +1 -0
- package/dist/lib/sandbox/commands/create.js +7 -2
- package/dist/lib/sandbox/commands/ls.js +4 -5
- package/dist/lib/sandbox/commands/rm.js +1 -1
- package/dist/lib/sandbox/control/agent-operation.js +34 -0
- package/dist/lib/sandbox/control/client.js +14 -201
- package/dist/lib/sandbox/control/executor.js +12 -125
- package/dist/lib/sandbox/control/lifecycle.js +66 -4
- package/dist/lib/sandbox/control/protocol.js +15 -54
- package/dist/lib/sandbox/control/server.js +216 -281
- package/dist/lib/sandbox/control/task-view.js +0 -13
- package/dist/lib/sandbox/mounts.js +9 -1
- package/dist/lib/sandbox/recovery.js +31 -10
- package/dist/lib/sandbox/removal.js +28 -5
- package/dist/lib/sandbox/workspace-identity.js +18 -6
- package/dist/lib/sandbox/workspace-view.js +56 -19
- package/dist/lib/task/commands/ls.js +3 -3
- package/dist/lib/task/control-authority.js +56 -264
- package/dist/lib/task/control-recovery.js +2 -3
- package/dist/lib/task/create.js +2 -2
- package/dist/lib/task/delegation-receipts.js +74 -161
- package/dist/lib/task/events.js +88 -44
- package/dist/lib/task/finalization.js +35 -6
- package/dist/lib/task/lifecycle.js +274 -115
- package/dist/lib/task/orchestration.js +201 -194
- package/dist/lib/task/runtime-paths.js +10 -0
- package/dist/lib/task/short-id.js +37 -27
- package/dist/lib/task/verification-engine.js +32 -26
- package/dist/lib/task/workspace-snapshot.js +1 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-clients/adapter.ts +39 -0
- package/lib/agent-clients/adapters/claude-code.ts +5 -1
- package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +105 -80
- package/lib/agent-clients/adapters/codex-lifecycle/binding.ts +147 -0
- package/lib/agent-clients/adapters/codex-lifecycle/cli.ts +510 -0
- package/lib/agent-clients/adapters/codex-lifecycle/controller-client.ts +158 -0
- package/lib/agent-clients/adapters/codex-lifecycle/controller-context.ts +1 -1
- package/lib/agent-clients/adapters/codex-lifecycle/controller-operation.ts +151 -0
- package/lib/{sandbox/control → agent-clients/adapters/codex-lifecycle}/controller-registration.ts +4 -4
- package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +43 -0
- package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +8 -5
- package/lib/agent-clients/adapters/codex-lifecycle/recovery.ts +190 -65
- package/lib/{internal/codex-sandbox-controller.ts → agent-clients/adapters/codex-lifecycle/sandbox-controller-cli.ts} +2 -2
- package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +3 -5
- package/lib/agent-clients/adapters/codex-lifecycle/store.ts +270 -224
- package/lib/agent-clients/adapters/codex-orchestration.ts +632 -0
- package/lib/agent-clients/adapters/codex.ts +44 -1
- package/lib/agent-clients/adapters/index.ts +7 -20
- package/lib/agent-clients/tokens.ts +4 -3
- package/lib/internal/agent-client.ts +142 -73
- package/lib/internal/cli-route-inventory.ts +2 -2
- package/lib/internal/sandbox-control.ts +0 -97
- package/lib/internal/task-finalization.ts +30 -18
- package/lib/internal/task-lifecycle.ts +1 -1
- package/lib/internal/task-operation-registry.ts +1 -1
- package/lib/internal/task-validate.ts +1 -1
- package/lib/platform/github-client.ts +34 -3
- package/lib/platform/issues.ts +18 -6
- package/lib/runtime/agent-runtime.ts +6 -41
- package/lib/sandbox/commands/control-status.ts +1 -0
- package/lib/sandbox/commands/create.ts +7 -1
- package/lib/sandbox/commands/ls.ts +4 -5
- package/lib/sandbox/commands/rm.ts +1 -1
- package/lib/sandbox/control/agent-operation.ts +49 -0
- package/lib/sandbox/control/client.ts +20 -254
- package/lib/sandbox/control/executor.ts +13 -136
- package/lib/sandbox/control/lifecycle.ts +67 -4
- package/lib/sandbox/control/protocol.ts +22 -66
- package/lib/sandbox/control/server.ts +21 -95
- package/lib/sandbox/control/task-view.ts +0 -19
- package/lib/sandbox/mounts.ts +10 -1
- package/lib/sandbox/recovery.ts +38 -17
- package/lib/sandbox/removal.ts +33 -7
- package/lib/sandbox/workspace-identity.ts +16 -6
- package/lib/sandbox/workspace-view.ts +50 -18
- package/lib/task/commands/ls.ts +3 -3
- package/lib/task/control-authority.ts +66 -378
- package/lib/task/control-recovery.ts +3 -4
- package/lib/task/create.ts +3 -3
- package/lib/task/delegation-receipts.ts +87 -231
- package/lib/task/events.ts +100 -42
- package/lib/task/finalization.ts +37 -7
- package/lib/task/lifecycle.ts +257 -109
- package/lib/task/orchestration.ts +260 -237
- package/lib/task/runtime-paths.ts +12 -0
- package/lib/task/short-id.ts +33 -40
- package/lib/task/verification-engine.ts +30 -25
- package/lib/task/workspace-snapshot.ts +1 -1
- package/package.json +1 -1
- package/templates/.agents/hooks/lifecycle-delegation.js +1 -25
- package/templates/.agents/rules/README.en.md +2 -1
- package/templates/.agents/rules/README.zh-CN.md +2 -1
- package/templates/.agents/rules/next-step-output.en.md +6 -19
- package/templates/.agents/rules/next-step-output.zh-CN.md +6 -19
- package/templates/.agents/rules/strategy-pattern.en.md +25 -0
- package/templates/.agents/rules/strategy-pattern.zh-CN.md +25 -0
- package/templates/.agents/skills/analyze-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/check-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/code-task/reference/code-rules.en.md +4 -0
- package/templates/.agents/skills/code-task/reference/code-rules.zh-CN.md +4 -0
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +0 -1
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +0 -1
- package/templates/.agents/skills/complete-task/SKILL.en.md +5 -29
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +5 -26
- package/templates/.agents/skills/plan-task/SKILL.en.md +7 -4
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +7 -4
- package/templates/.agents/skills/review-analysis/SKILL.en.md +1 -1
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/review-code/SKILL.en.md +1 -1
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/review-plan/SKILL.en.md +1 -1
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +1 -1
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/run-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +1 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/capability-store.js +0 -546
- package/dist/lib/internal/codex-lifecycle.js +0 -385
- package/dist/lib/task/codex-orchestration.js +0 -206
- package/lib/agent-clients/adapters/codex-lifecycle/capability-store.ts +0 -776
- package/lib/internal/codex-lifecycle.ts +0 -390
- package/lib/task/codex-orchestration.ts +0 -276
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import crypto from 'node:crypto';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { preflightCodexLifecycleEvidence, resolveCodexTerminal, resolveCodexThread } from '../agent-clients/adapters/codex-lifecycle/app-server.js';
|
|
6
|
-
import { createCodexLifecycleStore } from '../agent-clients/adapters/codex-lifecycle/store.js';
|
|
7
|
-
import { createCodexCapabilityStore } from '../agent-clients/adapters/codex-lifecycle/capability-store.js';
|
|
8
|
-
import { computeLifecycleBuildIdentity } from '../agent-clients/adapters/codex-lifecycle/build-identity.js';
|
|
9
|
-
import { verifyCodexSandboxControllerContextWithWarnings } from '../agent-clients/adapters/codex-lifecycle/sandbox-controller.js';
|
|
10
|
-
import { resolveTaskRef } from '../task/resolve-ref.js';
|
|
11
|
-
import { hasSealableOrchestrationDelegation } from '../task/orchestration.js';
|
|
12
|
-
import { activateCodexOrchestrationDelegation, activateCodexSpawnDelegation, reconcileCodexOrchestrationDelegation, sealCodexOrchestrationDelegation, sealCodexParentDelegation } from '../task/codex-orchestration.js';
|
|
13
|
-
import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
|
|
14
|
-
const USAGE = 'Usage: agent-infra-internal codex-lifecycle <capability-arm|hook-event|resolve-start|resolve-stop|preflight|consume> [options]\n';
|
|
15
|
-
const MANAGED_AGENT = /^agent-infra-lifecycle-(executor|reviewer)$/;
|
|
16
|
-
function output(value) {
|
|
17
|
-
process.stdout.write(`${JSON.stringify(value)}\n`);
|
|
18
|
-
}
|
|
19
|
-
function failure(code, message) {
|
|
20
|
-
output({ status: 'failed', changed: false, evidence: null, diagnostics: [], error: { code, message } });
|
|
21
|
-
process.exitCode = 1;
|
|
22
|
-
}
|
|
23
|
-
function outputBridgeResult(result) {
|
|
24
|
-
if (result.error?.code === 'ORCHESTRATION_DELEGATION_MISSING') {
|
|
25
|
-
output({ status: 'ignored', changed: false, evidence: null, diagnostics: [], error: null });
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
output(result);
|
|
29
|
-
if (result.status !== 'running')
|
|
30
|
-
process.exitCode = 1;
|
|
31
|
-
}
|
|
32
|
-
function parse(args) {
|
|
33
|
-
if (args[0] === '--help' || args[0] === '-h') {
|
|
34
|
-
process.stdout.write(USAGE);
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
const operation = args[0];
|
|
38
|
-
if (!operation) {
|
|
39
|
-
failure('CODEX_LIFECYCLE_PAYLOAD_INVALID', 'operation is required');
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
const allowed = {
|
|
43
|
-
'capability-arm': ['--task-id'],
|
|
44
|
-
'hook-event': ['--event', '--bridge'],
|
|
45
|
-
'resolve-start': ['--child-id'],
|
|
46
|
-
'resolve-stop': ['--child-id'],
|
|
47
|
-
preflight: ['--format', '--session-id', '--turn-id', '--tool-use-id'],
|
|
48
|
-
consume: ['--child-id', '--consumer']
|
|
49
|
-
}[operation];
|
|
50
|
-
if (!allowed) {
|
|
51
|
-
failure('CODEX_LIFECYCLE_PAYLOAD_INVALID', 'unknown operation');
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
const values = {};
|
|
55
|
-
for (let index = 1; index < args.length; index += 1) {
|
|
56
|
-
const flag = args[index];
|
|
57
|
-
if (!allowed.includes(flag) || Object.hasOwn(values, flag)) {
|
|
58
|
-
failure('CODEX_LIFECYCLE_PAYLOAD_INVALID', `invalid or duplicate option '${flag}'`);
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
const value = args[++index];
|
|
62
|
-
if (!value || value.startsWith('--')) {
|
|
63
|
-
failure('CODEX_LIFECYCLE_PAYLOAD_INVALID', `option '${flag}' requires a value`);
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
values[flag] = value;
|
|
67
|
-
}
|
|
68
|
-
return Object.freeze({ operation, values: Object.freeze(values) });
|
|
69
|
-
}
|
|
70
|
-
function cliVersion() {
|
|
71
|
-
const result = spawnSync('codex', ['--version'], { encoding: 'utf8' });
|
|
72
|
-
const version = /codex-cli\s+(\d+\.\d+\.\d+)/.exec(result.stdout ?? '')?.[1];
|
|
73
|
-
if (result.status !== 0 || !version)
|
|
74
|
-
throw new Error('Codex CLI version is unavailable');
|
|
75
|
-
return version;
|
|
76
|
-
}
|
|
77
|
-
function hookDefinitionHash() {
|
|
78
|
-
const file = path.join(process.cwd(), '.codex', 'hooks.json');
|
|
79
|
-
return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex');
|
|
80
|
-
}
|
|
81
|
-
function controllerBinding(taskId) {
|
|
82
|
-
const contextPath = process.env.AGENT_INFRA_CODEX_CONTROLLER_CONTEXT;
|
|
83
|
-
if (!contextPath)
|
|
84
|
-
return undefined;
|
|
85
|
-
const context = verifyCodexSandboxControllerContextWithWarnings(contextPath, { repoRoot: process.cwd() }).context;
|
|
86
|
-
return {
|
|
87
|
-
instanceDigest: context.controllerInstanceDigest,
|
|
88
|
-
controlGeneration: context.controlGeneration
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
async function readStdin() {
|
|
92
|
-
let input = '';
|
|
93
|
-
process.stdin.setEncoding('utf8');
|
|
94
|
-
for await (const chunk of process.stdin) {
|
|
95
|
-
input += chunk;
|
|
96
|
-
if (Buffer.byteLength(input) > 64 * 1024)
|
|
97
|
-
throw new Error('Codex lifecycle input exceeds 64 KiB');
|
|
98
|
-
}
|
|
99
|
-
return JSON.parse(input || '{}');
|
|
100
|
-
}
|
|
101
|
-
function recordFromPayload(phase, payload) {
|
|
102
|
-
if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
|
|
103
|
-
throw new Error('Codex lifecycle hook payload must be an object');
|
|
104
|
-
}
|
|
105
|
-
const value = payload;
|
|
106
|
-
const text = (key) => typeof value[key] === 'string' ? value[key] : '';
|
|
107
|
-
if (!MANAGED_AGENT.test(text('nativeAgent')))
|
|
108
|
-
return null;
|
|
109
|
-
if (phase === 'pre-tool')
|
|
110
|
-
return {
|
|
111
|
-
type: 'hook-spawn',
|
|
112
|
-
sessionId: text('sessionId'),
|
|
113
|
-
turnId: text('turnId'),
|
|
114
|
-
toolUseId: text('toolUseId'),
|
|
115
|
-
nativeAgent: text('nativeAgent'),
|
|
116
|
-
...(text('requestedModel') ? { requestedModel: text('requestedModel') } : {}),
|
|
117
|
-
...(text('requestedReasoningEffort') ? { requestedReasoningEffort: text('requestedReasoningEffort') } : {}),
|
|
118
|
-
hookDefinitionHash: text('hookDefinitionHash')
|
|
119
|
-
};
|
|
120
|
-
if (phase === 'subagent-start')
|
|
121
|
-
return {
|
|
122
|
-
type: 'hook-child',
|
|
123
|
-
sessionId: text('sessionId'),
|
|
124
|
-
turnId: text('turnId'),
|
|
125
|
-
childThreadId: text('childThreadId'),
|
|
126
|
-
nativeAgent: text('nativeAgent'),
|
|
127
|
-
source: 'hook'
|
|
128
|
-
};
|
|
129
|
-
if (phase === 'subagent-stop')
|
|
130
|
-
return {
|
|
131
|
-
type: 'hook-stop',
|
|
132
|
-
sessionId: text('sessionId'),
|
|
133
|
-
turnId: text('turnId'),
|
|
134
|
-
childThreadId: text('childThreadId'),
|
|
135
|
-
nativeAgent: text('nativeAgent')
|
|
136
|
-
};
|
|
137
|
-
if (phase === 'post-tool')
|
|
138
|
-
return null;
|
|
139
|
-
throw new Error(`unknown Codex lifecycle hook phase '${phase}'`);
|
|
140
|
-
}
|
|
141
|
-
function payloadText(payload, key) {
|
|
142
|
-
return payload && typeof payload === 'object' && !Array.isArray(payload)
|
|
143
|
-
&& typeof payload[key] === 'string'
|
|
144
|
-
? payload[key]
|
|
145
|
-
: '';
|
|
146
|
-
}
|
|
147
|
-
async function codexLifecycle(args = []) {
|
|
148
|
-
if (!ensureInternalHandlerRoute('codex-lifecycle', args))
|
|
149
|
-
return;
|
|
150
|
-
const parsed = parse(args);
|
|
151
|
-
if (!parsed || process.exitCode)
|
|
152
|
-
return;
|
|
153
|
-
try {
|
|
154
|
-
if (internalHandlerRoute('codex-lifecycle', 'preflight', parsed.operation)) {
|
|
155
|
-
const format = parsed.values['--format'] ?? 'json';
|
|
156
|
-
if (!['text', 'json'].includes(format))
|
|
157
|
-
throw new Error("format must be 'text' or 'json'");
|
|
158
|
-
const runtimeFields = [
|
|
159
|
-
parsed.values['--session-id'],
|
|
160
|
-
parsed.values['--turn-id'],
|
|
161
|
-
parsed.values['--tool-use-id']
|
|
162
|
-
];
|
|
163
|
-
if (runtimeFields.some(Boolean) && !runtimeFields.every(Boolean)) {
|
|
164
|
-
throw new Error('preflight runtime identity requires --session-id, --turn-id, and --tool-use-id together');
|
|
165
|
-
}
|
|
166
|
-
const runtimeIdentity = runtimeFields.every(Boolean) ? {
|
|
167
|
-
sessionId: runtimeFields[0],
|
|
168
|
-
turnId: runtimeFields[1],
|
|
169
|
-
toolUseId: runtimeFields[2]
|
|
170
|
-
} : undefined;
|
|
171
|
-
const result = await preflightCodexLifecycleEvidence(process.cwd(), runtimeIdentity);
|
|
172
|
-
if (format === 'text') {
|
|
173
|
-
process.stdout.write(`Codex lifecycle static preflight: ready\nCLI: ${result.cliVersion}\nRuntime hook liveness: ${result.runtimeLiveness ? 'observed' : 'not-yet-observed'}\n`);
|
|
174
|
-
}
|
|
175
|
-
else
|
|
176
|
-
output({ status: 'ready', changed: false, evidence: result, diagnostics: result.diagnostics, error: null });
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (internalHandlerRoute('codex-lifecycle', 'capability-arm', parsed.operation)) {
|
|
180
|
-
const taskId = parsed.values['--task-id'];
|
|
181
|
-
if (!taskId)
|
|
182
|
-
throw new Error('capability-arm requires --task-id');
|
|
183
|
-
const resolved = resolveTaskRef(taskId, { repoRoot: process.cwd() });
|
|
184
|
-
if (!resolved.ok)
|
|
185
|
-
throw new Error(`${resolved.code}: ${resolved.message}`);
|
|
186
|
-
const armed = createCodexCapabilityStore().arm({
|
|
187
|
-
taskId: resolved.taskId,
|
|
188
|
-
buildIdentity: computeLifecycleBuildIdentity(process.cwd()),
|
|
189
|
-
controller: controllerBinding(resolved.taskId)
|
|
190
|
-
});
|
|
191
|
-
output({
|
|
192
|
-
status: 'armed',
|
|
193
|
-
changed: true,
|
|
194
|
-
capabilityRef: armed.capabilityRef,
|
|
195
|
-
marker: armed.marker,
|
|
196
|
-
expiresAt: armed.expiresAt,
|
|
197
|
-
buildIdentity: armed.buildIdentity,
|
|
198
|
-
error: null
|
|
199
|
-
});
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
const store = createCodexLifecycleStore({ cliVersion: cliVersion() });
|
|
203
|
-
if (internalHandlerRoute('codex-lifecycle', 'hook-event', parsed.operation)) {
|
|
204
|
-
const phase = parsed.values['--event'];
|
|
205
|
-
if (!phase || !['pre-tool', 'subagent-start', 'post-tool', 'subagent-stop'].includes(phase)) {
|
|
206
|
-
throw new Error('hook-event requires a known --event');
|
|
207
|
-
}
|
|
208
|
-
if (parsed.values['--bridge'] !== undefined && parsed.values['--bridge'] !== 'true') {
|
|
209
|
-
throw new Error("hook-event --bridge must be 'true'");
|
|
210
|
-
}
|
|
211
|
-
const payload = await readStdin();
|
|
212
|
-
if (phase === 'post-tool') {
|
|
213
|
-
const capabilityRef = payloadText(payload, 'capabilityRef');
|
|
214
|
-
if (capabilityRef) {
|
|
215
|
-
const capabilityStore = createCodexCapabilityStore();
|
|
216
|
-
const armed = capabilityStore.inspectReference(capabilityRef);
|
|
217
|
-
const capability = capabilityStore.attestByReference({
|
|
218
|
-
capabilityRef,
|
|
219
|
-
sessionId: payloadText(payload, 'sessionId'),
|
|
220
|
-
turnId: payloadText(payload, 'turnId'),
|
|
221
|
-
toolUseId: payloadText(payload, 'toolUseId'),
|
|
222
|
-
hookDefinitionHash: payloadText(payload, 'hookDefinitionHash'),
|
|
223
|
-
buildIdentity: computeLifecycleBuildIdentity(process.cwd()),
|
|
224
|
-
controller: controllerBinding(armed.taskId)
|
|
225
|
-
});
|
|
226
|
-
output({
|
|
227
|
-
status: capability.status,
|
|
228
|
-
changed: true,
|
|
229
|
-
evidence: {
|
|
230
|
-
revision: capability.revision,
|
|
231
|
-
sessionId: capability.sessionId,
|
|
232
|
-
turnId: capability.turnId,
|
|
233
|
-
toolUseId: capability.toolUseId,
|
|
234
|
-
expiresAt: capability.expiresAt
|
|
235
|
-
},
|
|
236
|
-
diagnostics: [],
|
|
237
|
-
error: null
|
|
238
|
-
});
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
if (phase === 'post-tool' && parsed.values['--bridge'] === 'true') {
|
|
243
|
-
const toolName = payloadText(payload, 'toolName');
|
|
244
|
-
if (toolName === 'collaborationspawn_agent') {
|
|
245
|
-
const nativeAgent = payloadText(payload, 'nativeAgent');
|
|
246
|
-
if (!MANAGED_AGENT.test(nativeAgent)) {
|
|
247
|
-
output({ status: 'ignored', changed: false, evidence: null, diagnostics: [], error: null });
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
const requestedModel = payloadText(payload, 'requestedModel');
|
|
251
|
-
const requestedReasoningEffort = payloadText(payload, 'requestedReasoningEffort');
|
|
252
|
-
const bridged = await activateCodexSpawnDelegation({
|
|
253
|
-
sessionId: payloadText(payload, 'sessionId'),
|
|
254
|
-
turnId: payloadText(payload, 'turnId'),
|
|
255
|
-
toolUseId: payloadText(payload, 'toolUseId'),
|
|
256
|
-
transcriptPath: payloadText(payload, 'transcriptPath'),
|
|
257
|
-
nativeAgent,
|
|
258
|
-
taskName: payloadText(payload, 'taskName'),
|
|
259
|
-
...(requestedModel ? { requestedModel } : {}),
|
|
260
|
-
...(requestedReasoningEffort ? { requestedReasoningEffort } : {})
|
|
261
|
-
}, { store });
|
|
262
|
-
outputBridgeResult(bridged);
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
if (toolName === 'collaborationwait_agent') {
|
|
266
|
-
outputBridgeResult(await sealCodexParentDelegation(payloadText(payload, 'sessionId'), { store }));
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
output({ status: 'ignored', changed: false, evidence: null, diagnostics: [], error: null });
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
const event = recordFromPayload(phase, payload);
|
|
273
|
-
if (!event) {
|
|
274
|
-
if (phase === 'post-tool' && parsed.values['--bridge'] === 'true') {
|
|
275
|
-
const value = payload;
|
|
276
|
-
const childThreadId = String(value.childThreadId ?? '');
|
|
277
|
-
const reconciled = reconcileCodexOrchestrationDelegation(childThreadId);
|
|
278
|
-
outputBridgeResult(reconciled);
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
output({ status: 'ignored', changed: false, evidence: null, diagnostics: [], error: null });
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
if (parsed.values['--bridge'] === 'true' && event.type === 'hook-stop') {
|
|
285
|
-
try {
|
|
286
|
-
if (store.read(event.childThreadId).consumer) {
|
|
287
|
-
const bridged = await sealCodexOrchestrationDelegation(event.childThreadId, { store });
|
|
288
|
-
outputBridgeResult(bridged);
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
catch {
|
|
293
|
-
// The normal apply path below owns missing or invalid evidence errors.
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
if (parsed.values['--bridge'] === 'true' && event.type === 'hook-child') {
|
|
297
|
-
const resolved = await resolveCodexThread(event.childThreadId);
|
|
298
|
-
store.apply({
|
|
299
|
-
...event,
|
|
300
|
-
parentThreadId: resolved.resolution.thread.parentThreadId
|
|
301
|
-
});
|
|
302
|
-
const bridged = await activateCodexOrchestrationDelegation(event.childThreadId, {
|
|
303
|
-
store,
|
|
304
|
-
resolveThread: async () => resolved
|
|
305
|
-
});
|
|
306
|
-
outputBridgeResult(bridged);
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
if (event.type === 'hook-child') {
|
|
310
|
-
const resolved = await resolveCodexThread(event.childThreadId);
|
|
311
|
-
const result = store.apply({
|
|
312
|
-
...event,
|
|
313
|
-
parentThreadId: resolved.resolution.thread.parentThreadId
|
|
314
|
-
});
|
|
315
|
-
output({ status: result.state.status, changed: true, evidence: result.state, diagnostics: resolved.diagnostics, error: result.state.error });
|
|
316
|
-
if (result.state.status === 'invalid')
|
|
317
|
-
process.exitCode = 1;
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
const result = store.apply(event);
|
|
321
|
-
if (parsed.values['--bridge'] === 'true' && event.type === 'hook-stop') {
|
|
322
|
-
if (!hasSealableOrchestrationDelegation('codex', event.childThreadId, { repoRoot: process.cwd() })) {
|
|
323
|
-
output({ status: 'ignored', changed: false, evidence: null, diagnostics: [], error: null });
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
output({
|
|
327
|
-
status: result.state.status,
|
|
328
|
-
changed: true,
|
|
329
|
-
evidence: result.state,
|
|
330
|
-
diagnostics: [],
|
|
331
|
-
error: result.state.error
|
|
332
|
-
});
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
output({ status: result.state.status, changed: true, evidence: result.state, diagnostics: [], error: result.state.error });
|
|
336
|
-
if (result.state.status === 'invalid')
|
|
337
|
-
process.exitCode = 1;
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
const childThreadId = parsed.values['--child-id'];
|
|
341
|
-
if (!childThreadId)
|
|
342
|
-
throw new Error(`operation '${parsed.operation}' requires --child-id`);
|
|
343
|
-
if (internalHandlerRoute('codex-lifecycle', 'resolve-start', parsed.operation)) {
|
|
344
|
-
if (store.read(childThreadId).state.spawn?.hookDefinitionHash !== hookDefinitionHash()) {
|
|
345
|
-
throw new Error('Codex lifecycle hook definition hash is stale');
|
|
346
|
-
}
|
|
347
|
-
const resolved = await resolveCodexThread(childThreadId);
|
|
348
|
-
let latest = store.apply(resolved.resolution.thread);
|
|
349
|
-
for (const reroute of resolved.reroutes)
|
|
350
|
-
latest = store.apply(reroute);
|
|
351
|
-
latest = store.apply(resolved.resolution.settings);
|
|
352
|
-
output({ status: latest.state.status, changed: true, evidence: latest.state.startEvidence, diagnostics: resolved.diagnostics, error: latest.state.error });
|
|
353
|
-
if (latest.state.status !== 'start-ready')
|
|
354
|
-
process.exitCode = 1;
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
if (internalHandlerRoute('codex-lifecycle', 'resolve-stop', parsed.operation)) {
|
|
358
|
-
const stopTurnId = store.read(childThreadId).state.stop?.turnId;
|
|
359
|
-
if (!stopTurnId)
|
|
360
|
-
throw new Error('Codex lifecycle stop hook is not available');
|
|
361
|
-
const terminal = await resolveCodexTerminal(childThreadId, stopTurnId);
|
|
362
|
-
const latest = store.apply(terminal);
|
|
363
|
-
if (latest.state.status !== 'stop-ready') {
|
|
364
|
-
throw new Error(`Codex lifecycle stop evidence is not ready (status=${latest.state.status})`);
|
|
365
|
-
}
|
|
366
|
-
output({ status: latest.state.status, changed: true, evidence: latest.state.stopEvidence, diagnostics: [], error: latest.state.error });
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
if (internalHandlerRoute('codex-lifecycle', 'consume', parsed.operation)) {
|
|
370
|
-
const consumer = parsed.values['--consumer'];
|
|
371
|
-
if (!consumer)
|
|
372
|
-
throw new Error('consume requires --consumer');
|
|
373
|
-
const consumed = store.consume(childThreadId, consumer, hookDefinitionHash());
|
|
374
|
-
output({ status: 'consumed', changed: true, evidence: {
|
|
375
|
-
start: consumed.state.startEvidence,
|
|
376
|
-
stop: consumed.state.stopEvidence
|
|
377
|
-
}, diagnostics: [], error: null });
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
catch (error) {
|
|
381
|
-
failure('CODEX_LIFECYCLE_FAILED', error instanceof Error ? error.message : String(error));
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
export { codexLifecycle };
|
|
385
|
-
//# sourceMappingURL=codex-lifecycle.js.map
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { preflightCodexLifecycleEvidence, resolveCodexSpawnedChild, resolveCodexTerminal, resolveCodexThread } from '../agent-clients/adapters/codex-lifecycle/app-server.js';
|
|
2
|
-
import { createCodexLifecycleStore } from '../agent-clients/adapters/codex-lifecycle/store.js';
|
|
3
|
-
import { computeLifecycleBuildIdentity, } from '../agent-clients/adapters/codex-lifecycle/build-identity.js';
|
|
4
|
-
import { resolveTaskRef } from './resolve-ref.js';
|
|
5
|
-
import { activateMatchingOrchestrationDelegation, hasActivatableOrchestrationDelegation, hasSealableOrchestrationDelegation, OrchestrationStateError, pauseMatchingOrchestrationDelegation, prepareOrchestrationDelegation, reconcileMatchingOrchestrationDelegation, sealMatchingOrchestrationDelegationWithHostEvidence } from './orchestration.js';
|
|
6
|
-
function coreOptions(options) {
|
|
7
|
-
return { ...options.orchestrationOptions, repoRoot: options.repoRoot ?? options.orchestrationOptions?.repoRoot };
|
|
8
|
-
}
|
|
9
|
-
function bridgeFailure(code, message) {
|
|
10
|
-
return {
|
|
11
|
-
status: 'failed', changed: false, taskId: null, run: null, next: null,
|
|
12
|
-
error: { code, message }
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function pauseBridge(code, message, options) {
|
|
16
|
-
const paused = pauseMatchingOrchestrationDelegation('codex', code, message, coreOptions(options));
|
|
17
|
-
return paused.error?.code === 'ORCHESTRATION_DELEGATION_MISSING'
|
|
18
|
-
? bridgeFailure(code, message)
|
|
19
|
-
: paused;
|
|
20
|
-
}
|
|
21
|
-
function requiredStore(options) {
|
|
22
|
-
if (!options.store)
|
|
23
|
-
throw new Error('Codex lifecycle store is required for orchestration bridge events');
|
|
24
|
-
return options.store;
|
|
25
|
-
}
|
|
26
|
-
async function prepareCodexOrchestrationDelegation(taskRef, input, options = {}) {
|
|
27
|
-
if (input.client !== 'codex')
|
|
28
|
-
return prepareOrchestrationDelegation(taskRef, input, coreOptions(options));
|
|
29
|
-
try {
|
|
30
|
-
const repoRoot = options.repoRoot ?? process.cwd();
|
|
31
|
-
const resolved = resolveTaskRef(taskRef, { repoRoot });
|
|
32
|
-
if (!resolved.ok)
|
|
33
|
-
return bridgeFailure(resolved.code, resolved.message);
|
|
34
|
-
await (options.preflight ?? preflightCodexLifecycleEvidence)(repoRoot);
|
|
35
|
-
return prepareOrchestrationDelegation(taskRef, input, coreOptions(options));
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
if (error instanceof OrchestrationStateError)
|
|
39
|
-
return bridgeFailure(error.code, error.message);
|
|
40
|
-
return bridgeFailure('ORCHESTRATION_CLIENT_PREFLIGHT_FAILED', error instanceof Error ? error.message : String(error));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async function activateCodexOrchestrationDelegation(childThreadId, options = {}) {
|
|
44
|
-
try {
|
|
45
|
-
if (!hasActivatableOrchestrationDelegation('codex', childThreadId, coreOptions(options))) {
|
|
46
|
-
return bridgeFailure('ORCHESTRATION_DELEGATION_MISSING', 'No matching Codex delegation is active');
|
|
47
|
-
}
|
|
48
|
-
const store = requiredStore(options);
|
|
49
|
-
const resolved = await (options.resolveThread ?? resolveCodexThread)(childThreadId);
|
|
50
|
-
store.apply(resolved.resolution.thread);
|
|
51
|
-
for (const reroute of resolved.reroutes)
|
|
52
|
-
store.apply(reroute);
|
|
53
|
-
store.apply(resolved.resolution.settings);
|
|
54
|
-
const record = store.read(childThreadId);
|
|
55
|
-
const evidence = record.state.startEvidence;
|
|
56
|
-
if (record.state.status !== 'start-ready' || !evidence) {
|
|
57
|
-
return pauseBridge('ORCHESTRATION_CODEX_START_EVIDENCE_INVALID', 'Codex lifecycle start evidence is not ready', options);
|
|
58
|
-
}
|
|
59
|
-
const repoRoot = options.repoRoot ?? process.cwd();
|
|
60
|
-
const preflight = await (options.preflight ?? preflightCodexLifecycleEvidence)(repoRoot, {
|
|
61
|
-
sessionId: evidence.parentThreadId,
|
|
62
|
-
turnId: evidence.parentTurnId,
|
|
63
|
-
toolUseId: evidence.spawnToolUseId
|
|
64
|
-
});
|
|
65
|
-
const buildIdentity = options.buildIdentity ?? computeLifecycleBuildIdentity(repoRoot);
|
|
66
|
-
const activated = activateMatchingOrchestrationDelegation('codex', {
|
|
67
|
-
nativeAgent: evidence.nativeAgent,
|
|
68
|
-
childId: evidence.childThreadId,
|
|
69
|
-
parentId: evidence.parentThreadId,
|
|
70
|
-
spawnMode: evidence.spawnMode,
|
|
71
|
-
actualModel: evidence.actualModel.value,
|
|
72
|
-
actualReasoningEffort: evidence.actualReasoningEffort.value,
|
|
73
|
-
...(evidence.modelFallbackReason ? { modelFallbackReason: evidence.modelFallbackReason } : {}),
|
|
74
|
-
...(evidence.reasoningEffortFallbackReason
|
|
75
|
-
? { reasoningEffortFallbackReason: evidence.reasoningEffortFallbackReason }
|
|
76
|
-
: {}),
|
|
77
|
-
hostEvidence: {
|
|
78
|
-
kind: 'codex-lifecycle-v2',
|
|
79
|
-
hookDefinitionHash: evidence.hookDefinitionHash,
|
|
80
|
-
startRevision: record.revision,
|
|
81
|
-
...buildIdentity,
|
|
82
|
-
...preflight.hookProvenance,
|
|
83
|
-
capabilitySessionId: evidence.parentThreadId,
|
|
84
|
-
capabilityTurnId: evidence.parentTurnId,
|
|
85
|
-
spawnToolUseId: evidence.spawnToolUseId,
|
|
86
|
-
spawnObservedAt: record.spawnObservedAt ?? undefined,
|
|
87
|
-
controllerInstanceDigest: null,
|
|
88
|
-
controlGeneration: null
|
|
89
|
-
}
|
|
90
|
-
}, coreOptions(options));
|
|
91
|
-
return activated;
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
if (error instanceof OrchestrationStateError)
|
|
95
|
-
return bridgeFailure(error.code, error.message);
|
|
96
|
-
return pauseBridge('ORCHESTRATION_CODEX_START_FAILED', error instanceof Error ? error.message : String(error), options);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
async function activateCodexSpawnDelegation(spawn, options = {}) {
|
|
100
|
-
try {
|
|
101
|
-
const store = requiredStore(options);
|
|
102
|
-
const childThreadId = resolveCodexSpawnedChild(spawn.transcriptPath, spawn);
|
|
103
|
-
const resolved = await (options.resolveThread ?? resolveCodexThread)(childThreadId);
|
|
104
|
-
store.applyToSpawn(spawn, {
|
|
105
|
-
type: 'hook-child',
|
|
106
|
-
sessionId: spawn.sessionId,
|
|
107
|
-
turnId: spawn.turnId,
|
|
108
|
-
childThreadId,
|
|
109
|
-
parentThreadId: resolved.resolution.thread.parentThreadId,
|
|
110
|
-
nativeAgent: spawn.nativeAgent,
|
|
111
|
-
source: 'parent-rollout'
|
|
112
|
-
});
|
|
113
|
-
return activateCodexOrchestrationDelegation(childThreadId, {
|
|
114
|
-
...options,
|
|
115
|
-
store,
|
|
116
|
-
resolveThread: async () => resolved
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
if (error instanceof OrchestrationStateError)
|
|
121
|
-
return bridgeFailure(error.code, error.message);
|
|
122
|
-
return pauseBridge('ORCHESTRATION_CODEX_START_FAILED', error instanceof Error ? error.message : String(error), options);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
async function sealCodexOrchestrationDelegation(childThreadId, options = {}) {
|
|
126
|
-
try {
|
|
127
|
-
if (!hasSealableOrchestrationDelegation('codex', childThreadId, coreOptions(options))) {
|
|
128
|
-
return bridgeFailure('ORCHESTRATION_DELEGATION_MISSING', 'No matching Codex delegation is active');
|
|
129
|
-
}
|
|
130
|
-
const store = requiredStore(options);
|
|
131
|
-
const existing = store.read(childThreadId);
|
|
132
|
-
if (!existing.consumer) {
|
|
133
|
-
const stopTurnId = existing.state.stop?.turnId;
|
|
134
|
-
if (!stopTurnId) {
|
|
135
|
-
return pauseBridge('ORCHESTRATION_CODEX_STOP_EVIDENCE_INVALID', 'Codex lifecycle stop hook is not available', options);
|
|
136
|
-
}
|
|
137
|
-
store.apply(await (options.resolveTerminal ?? resolveCodexTerminal)(childThreadId, stopTurnId));
|
|
138
|
-
}
|
|
139
|
-
const record = store.read(childThreadId);
|
|
140
|
-
const evidence = record.state.stopEvidence;
|
|
141
|
-
if (record.state.status !== 'stop-ready' || !evidence || !record.state.startEvidence) {
|
|
142
|
-
return pauseBridge('ORCHESTRATION_CODEX_STOP_EVIDENCE_INVALID', 'Codex lifecycle stop evidence is not ready', options);
|
|
143
|
-
}
|
|
144
|
-
return sealMatchingOrchestrationDelegationWithHostEvidence('codex', { nativeAgent: record.state.startEvidence.nativeAgent, childId: childThreadId }, (receipt) => {
|
|
145
|
-
const consumed = store.consume(childThreadId, receipt.id, receipt.hostEvidence?.hookDefinitionHash);
|
|
146
|
-
return {
|
|
147
|
-
stopRevision: consumed.revision,
|
|
148
|
-
consumer: consumed.consumer,
|
|
149
|
-
consumedAt: consumed.consumedAt
|
|
150
|
-
};
|
|
151
|
-
}, coreOptions(options));
|
|
152
|
-
}
|
|
153
|
-
catch (error) {
|
|
154
|
-
if (error instanceof OrchestrationStateError)
|
|
155
|
-
return bridgeFailure(error.code, error.message);
|
|
156
|
-
return pauseBridge('ORCHESTRATION_CODEX_STOP_FAILED', error instanceof Error ? error.message : String(error), options);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
async function sealCodexParentDelegation(parentThreadId, options = {}) {
|
|
160
|
-
try {
|
|
161
|
-
const store = requiredStore(options);
|
|
162
|
-
const candidates = store.findByParent(parentThreadId);
|
|
163
|
-
if (!candidates.length)
|
|
164
|
-
return bridgeFailure('ORCHESTRATION_DELEGATION_MISSING', 'No matching Codex delegation is active');
|
|
165
|
-
for (const consumed of candidates.filter((record) => record.consumer)) {
|
|
166
|
-
const replayed = await sealCodexOrchestrationDelegation(consumed.state.startEvidence.childThreadId, options);
|
|
167
|
-
if (replayed.error?.code !== 'ORCHESTRATION_DELEGATION_MISSING')
|
|
168
|
-
return replayed;
|
|
169
|
-
}
|
|
170
|
-
const active = candidates.find((record) => !record.consumer);
|
|
171
|
-
if (!active)
|
|
172
|
-
return bridgeFailure('ORCHESTRATION_DELEGATION_MISSING', 'No matching Codex delegation is active');
|
|
173
|
-
const start = active.state.startEvidence;
|
|
174
|
-
const child = active.state.child;
|
|
175
|
-
if (!active.state.terminal) {
|
|
176
|
-
const resolveTerminal = options.resolveTerminal ?? resolveCodexTerminal;
|
|
177
|
-
store.apply(active.state.stop
|
|
178
|
-
? await resolveTerminal(start.childThreadId, active.state.stop.turnId)
|
|
179
|
-
: await resolveTerminal(start.childThreadId));
|
|
180
|
-
}
|
|
181
|
-
if (!store.read(start.childThreadId).state.stop) {
|
|
182
|
-
store.apply({
|
|
183
|
-
type: 'hook-stop',
|
|
184
|
-
sessionId: parentThreadId,
|
|
185
|
-
turnId: child.turnId,
|
|
186
|
-
childThreadId: start.childThreadId,
|
|
187
|
-
nativeAgent: start.nativeAgent,
|
|
188
|
-
source: 'parent-rollout'
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
return sealCodexOrchestrationDelegation(start.childThreadId, options);
|
|
192
|
-
}
|
|
193
|
-
catch (error) {
|
|
194
|
-
if (error instanceof OrchestrationStateError)
|
|
195
|
-
return bridgeFailure(error.code, error.message);
|
|
196
|
-
if (error instanceof Error && error.message === 'CODEX_TURN_NOT_TERMINAL') {
|
|
197
|
-
return bridgeFailure('ORCHESTRATION_DELEGATION_MISSING', 'The matching Codex child has not completed');
|
|
198
|
-
}
|
|
199
|
-
return pauseBridge('ORCHESTRATION_CODEX_STOP_FAILED', error instanceof Error ? error.message : String(error), options);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
function reconcileCodexOrchestrationDelegation(childThreadId, options = {}) {
|
|
203
|
-
return reconcileMatchingOrchestrationDelegation('codex', childThreadId, coreOptions(options));
|
|
204
|
-
}
|
|
205
|
-
export { activateCodexOrchestrationDelegation, activateCodexSpawnDelegation, prepareCodexOrchestrationDelegation, reconcileCodexOrchestrationDelegation, sealCodexParentDelegation, sealCodexOrchestrationDelegation };
|
|
206
|
-
//# sourceMappingURL=codex-orchestration.js.map
|