@workbench-ai/agent-driver-openai-codex 0.0.44 → 0.0.46

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/index.d.ts CHANGED
@@ -64,6 +64,7 @@ export declare function createCodexHarnessDefinition(options?: {
64
64
  strategy: "secret_ref";
65
65
  ref: string;
66
66
  };
67
+ model: string;
67
68
  config: {};
68
69
  };
69
70
  capabilities: {
@@ -104,6 +105,7 @@ export declare const codexHarnessDefinition: {
104
105
  strategy: "secret_ref";
105
106
  ref: string;
106
107
  };
108
+ model: string;
107
109
  config: {};
108
110
  };
109
111
  capabilities: {
@@ -135,6 +137,7 @@ export declare const codexHarnessProvider: HarnessProvider<CodexSessionState, {
135
137
  export { listCodexIntegrations, projectCodexIntegrations, updateCodexIntegrations, } from "./integrations.js";
136
138
  export { projectCodexGlobalSkills, syncCodexGlobalSkills, } from "./global-skills.js";
137
139
  export { codexWorkbenchProviderAuth, } from "./workbench-auth.js";
140
+ export { codexLocalTraceAdapter, } from "./local-traces.js";
138
141
  export declare function codexHarness(options?: {
139
142
  executable?: string;
140
143
  }): HarnessProvider<CodexSessionState, {
@@ -161,6 +164,8 @@ interface CodexSessionState {
161
164
  attemptWorkspacePath: string;
162
165
  sessionWorkspacePath: string | null;
163
166
  childEnv: NodeJS.ProcessEnv;
167
+ managedCodexHomeDir: string;
168
+ profileSourceRoot: string | null;
164
169
  process: ChildProcessWithoutNullStreams;
165
170
  reader: readline.Interface;
166
171
  nextId: number;
@@ -180,6 +185,8 @@ interface CodexNotificationNormalization {
180
185
  }
181
186
  interface PreparedManagedCodexHome {
182
187
  managedHomeDir: string;
188
+ managedCodexHomeDir: string;
189
+ profileSourceRoot: string | null;
183
190
  trustedProjectPaths: string[];
184
191
  childEnv: NodeJS.ProcessEnv;
185
192
  }
@@ -271,7 +278,9 @@ export declare class CodexHarnessAdapter implements HarnessAdapter<CodexSessionS
271
278
  static getAppServerCommand(command: string): string;
272
279
  static getLoginCommand(command: string): string;
273
280
  static hasSeededApiKeyAuth(apiKey: string, codexHomeDir: string): Promise<boolean>;
274
- static ensureManagedHomeAuth(plan: HarnessExecutionPlan, codexHomeDir: string, childEnv: NodeJS.ProcessEnv, command: string, repoRoot: string, trustedProjectPaths?: string[], runtimeHome?: string): Promise<void>;
281
+ static ensureManagedHomeAuth(plan: HarnessExecutionPlan, codexHomeDir: string, childEnv: NodeJS.ProcessEnv, command: string, repoRoot: string, trustedProjectPaths?: string[], runtimeHome?: string): Promise<{
282
+ profileSourceRoot: string | null;
283
+ }>;
275
284
  static prepareManagedCodexHome(args: {
276
285
  plan: HarnessExecutionPlan;
277
286
  workspacePath: string;
@@ -286,6 +295,10 @@ export declare class CodexHarnessAdapter implements HarnessAdapter<CodexSessionS
286
295
  startTurn(context: ActiveHarnessSession<CodexSessionState>, args: StartTurnArgs): Promise<HarnessRunResult>;
287
296
  interruptTurn(context: ActiveHarnessSession<CodexSessionState>): Promise<void>;
288
297
  closeSession(context: ActiveHarnessSession<CodexSessionState>, cancelConfig?: WorkflowHarnessCancel): Promise<void>;
298
+ static persistProfileAuthFromManagedHome(args: {
299
+ managedCodexHomeDir: string;
300
+ profileSourceRoot: string | null;
301
+ }): Promise<void>;
289
302
  static getHarness(plan: HarnessExecutionPlan): NonNullable<HarnessExecutionPlan["harness"]>;
290
303
  static getHarnessAuth(plan: HarnessExecutionPlan): CodexHarnessAuth;
291
304
  static getHarnessConfig(plan: HarnessExecutionPlan): CodexHarnessConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAGhF,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,gBA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AA8B;IAStC,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,mBAAmB;IAe3B,OAAO,CAAC,uBAAuB;CAShC;AAMD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,oBAAoB,CAAC,SAAS,CAAC,EACxC,YAAY,EAAE,mBAAmB,EACjC,EAAE,SAAW,GACZ,8BAA8B,CAahC"}
package/dist/index.js CHANGED
@@ -63,6 +63,7 @@ export function createCodexHarnessDefinition(options = {}) {
63
63
  strategy: "secret_ref",
64
64
  ref: "OPENAI_API_KEY",
65
65
  },
66
+ model: "gpt-5.5",
66
67
  config: {},
67
68
  },
68
69
  capabilities: {
@@ -89,6 +90,7 @@ export const codexHarnessProvider = codexHarness();
89
90
  export { listCodexIntegrations, projectCodexIntegrations, updateCodexIntegrations, } from "./integrations.js";
90
91
  export { projectCodexGlobalSkills, syncCodexGlobalSkills, } from "./global-skills.js";
91
92
  export { codexWorkbenchProviderAuth, } from "./workbench-auth.js";
93
+ export { codexLocalTraceAdapter, } from "./local-traces.js";
92
94
  export function codexHarness(options = {}) {
93
95
  const definition = createCodexHarnessDefinition(options);
94
96
  return defineHarnessProvider({
@@ -545,7 +547,7 @@ export class CodexHarnessAdapter {
545
547
  codexHomeDir,
546
548
  trustedProjectPaths,
547
549
  });
548
- return;
550
+ return { profileSourceRoot: sourceRoot };
549
551
  }
550
552
  const apiKeyAuth = CodexHarnessAdapter.resolveApiKeyAuth(plan, repoRoot, runtimeHome);
551
553
  if (provider.id === "azure") {
@@ -557,10 +559,10 @@ export class CodexHarnessAdapter {
557
559
  trustedProjectPaths,
558
560
  });
559
561
  if (provider.id === "azure") {
560
- return;
562
+ return { profileSourceRoot: null };
561
563
  }
562
564
  if (await CodexHarnessAdapter.hasSeededApiKeyAuth(apiKeyAuth.apiKey, codexHomeDir)) {
563
- return;
565
+ return { profileSourceRoot: null };
564
566
  }
565
567
  const loginCommand = CodexHarnessAdapter.getLoginCommand(command);
566
568
  await new Promise((resolve, reject) => {
@@ -596,6 +598,7 @@ export class CodexHarnessAdapter {
596
598
  codexHomeDir,
597
599
  trustedProjectPaths,
598
600
  });
601
+ return { profileSourceRoot: null };
599
602
  }
600
603
  static async prepareManagedCodexHome(args) {
601
604
  const managedHomeDir = getManagedHarnessHomePath(args.stageSessionPath);
@@ -605,7 +608,7 @@ export class CodexHarnessAdapter {
605
608
  codexHomeDir: managedCodexHomeDir,
606
609
  }, args.parentEnv ?? process.env);
607
610
  const trustedProjectPaths = await CodexHarnessAdapter.resolveTrustedProjectPaths(args.workspacePath);
608
- await CodexHarnessAdapter.ensureManagedHomeAuth(args.plan, managedCodexHomeDir, childEnv, args.command, args.repoRoot, trustedProjectPaths, args.runtimeHome);
611
+ const auth = await CodexHarnessAdapter.ensureManagedHomeAuth(args.plan, managedCodexHomeDir, childEnv, args.command, args.repoRoot, trustedProjectPaths, args.runtimeHome);
609
612
  const sourceHomeDir = resolveAmbientHomeDir(args.parentEnv);
610
613
  const sourceCodexHomeDir = resolveAmbientCodexHomeDir(args.parentEnv, sourceHomeDir);
611
614
  if (sourceHomeDir && sourceCodexHomeDir) {
@@ -621,6 +624,8 @@ export class CodexHarnessAdapter {
621
624
  }
622
625
  return {
623
626
  managedHomeDir,
627
+ managedCodexHomeDir,
628
+ profileSourceRoot: auth.profileSourceRoot,
624
629
  trustedProjectPaths,
625
630
  childEnv,
626
631
  };
@@ -640,7 +645,7 @@ export class CodexHarnessAdapter {
640
645
  excludedTopLevelEntries: [".agents", ".codex"],
641
646
  });
642
647
  const { workspacePath, attemptWorkspacePath, sessionWorkspacePath } = preparedWorkspace;
643
- const { managedHomeDir, childEnv } = await CodexHarnessAdapter.prepareManagedCodexHome({
648
+ const { managedHomeDir, managedCodexHomeDir, profileSourceRoot, childEnv } = await CodexHarnessAdapter.prepareManagedCodexHome({
644
649
  plan: args.plan,
645
650
  workspacePath,
646
651
  stageSessionPath: args.stageSessionPath,
@@ -690,6 +695,8 @@ export class CodexHarnessAdapter {
690
695
  attemptWorkspacePath,
691
696
  sessionWorkspacePath,
692
697
  childEnv,
698
+ managedCodexHomeDir,
699
+ profileSourceRoot,
693
700
  process: child,
694
701
  reader,
695
702
  nextId: 1,
@@ -849,12 +856,24 @@ export class CodexHarnessAdapter {
849
856
  const hardKillTimeoutMs = cancelConfig?.hard_kill_timeout_ms ?? 1_000;
850
857
  await terminateProcess(context.state.process, gracefulTimeoutMs, hardKillTimeoutMs);
851
858
  context.state.reader.close();
859
+ await CodexHarnessAdapter.persistProfileAuthFromManagedHome({
860
+ managedCodexHomeDir: context.state.managedCodexHomeDir,
861
+ profileSourceRoot: context.state.profileSourceRoot,
862
+ });
852
863
  await persistStageSessionWorkspace({
853
864
  sessionWorkspacePath: context.state.sessionWorkspacePath,
854
865
  attemptWorkspacePath: context.state.attemptWorkspacePath,
855
866
  excludedTopLevelEntries: [".agents", ".codex"],
856
867
  });
857
868
  }
869
+ static async persistProfileAuthFromManagedHome(args) {
870
+ if (!args.profileSourceRoot) {
871
+ return;
872
+ }
873
+ const targetAuthPath = path.join(args.profileSourceRoot, ".codex", "auth.json");
874
+ await ensureDir(path.dirname(targetAuthPath));
875
+ await fs.copyFile(CodexHarnessAdapter.getAuthPath(args.managedCodexHomeDir), targetAuthPath);
876
+ }
858
877
  static getHarness(plan) {
859
878
  const harness = plan.harness;
860
879
  if (!harness) {
@@ -0,0 +1,3 @@
1
+ import { type LocalTraceAdapter } from "@workbench-ai/agent-driver";
2
+ export declare const codexLocalTraceAdapter: LocalTraceAdapter;
3
+ //# sourceMappingURL=local-traces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-traces.d.ts","sourceRoot":"","sources":["../src/local-traces.ts"],"names":[],"mappings":"AAGA,OAAO,EAwBL,KAAK,iBAAiB,EAKvB,MAAM,4BAA4B,CAAC;AAwBpC,eAAO,MAAM,sBAAsB,EAAE,iBAoKpC,CAAC"}
@@ -0,0 +1,492 @@
1
+ import { promises as fs } from "node:fs";
2
+ import path from "node:path";
3
+ import { appendUnique, buildAgentReadableTraceDigest, collectTraceToolArtifacts, createEmptyTraceArtifacts, expandLocalTraceHomePath, localTraceHomeDir, localTraceRefIsAtOrAfter, localTraceRefMatchesWorkspace, localTraceShortHash, mergeLocalTraceRawType, mergeLocalTraceTimelineTool, normalizeTraceText, readLocalTraceJsonLines, sortLocalTraceRefs, traceJsonArray, traceJsonObject, traceNumber, traceString, truncateTraceJsonValue, truncateTraceText, } from "@workbench-ai/agent-driver";
4
+ const CODEX_LOCAL_TRACE_PROVIDER = "codex";
5
+ const CODEX_LOCAL_TRACE_DISPLAY = "OpenAI Codex";
6
+ export const codexLocalTraceAdapter = {
7
+ id: CODEX_LOCAL_TRACE_PROVIDER,
8
+ displayName: CODEX_LOCAL_TRACE_DISPLAY,
9
+ async discoverLocalTraces(context = {}) {
10
+ const requested = parseCodexTraceId(context.traceId);
11
+ if (context.traceId && !requested) {
12
+ return [];
13
+ }
14
+ const codexHome = resolveCodexHome(context.env);
15
+ const indexPath = path.join(codexHome, "session_index.jsonl");
16
+ const index = await readCodexIndex(indexPath);
17
+ const files = await listCodexSessionFiles(codexHome);
18
+ const refs = [];
19
+ for (const file of files) {
20
+ if (requested && localTraceShortHash(file.sourcePath) !== requested.sourceHash) {
21
+ continue;
22
+ }
23
+ const summary = await summarizeCodexSessionFile(file.sourcePath, index, file.mtimeMs);
24
+ if (!summary) {
25
+ continue;
26
+ }
27
+ if (requested && summary.threadId !== requested.sessionId) {
28
+ continue;
29
+ }
30
+ const ref = codexSummaryToRef(codexHome, indexPath, file.sourcePath, summary);
31
+ if (!localTraceRefMatchesWorkspace(ref, context.workspaceRoot)) {
32
+ continue;
33
+ }
34
+ if (context.since && !localTraceRefIsAtOrAfter(ref, context.since)) {
35
+ continue;
36
+ }
37
+ refs.push(ref);
38
+ if (requested) {
39
+ break;
40
+ }
41
+ if (typeof context.limit === "number" && context.limit > 0 && refs.length >= context.limit) {
42
+ break;
43
+ }
44
+ }
45
+ const sorted = sortLocalTraceRefs(refs);
46
+ return sorted;
47
+ },
48
+ async readLocalTraceDigest(ref, context = {}) {
49
+ const records = await readLocalTraceJsonLines(ref.sourcePath);
50
+ const maxTextChars = context.maxTextChars ?? 4_000;
51
+ const maxToolOutputChars = context.maxToolOutputChars ?? Math.min(maxTextChars, 1_000);
52
+ const timeline = [];
53
+ const toolEntryById = new Map();
54
+ const artifacts = createEmptyTraceArtifacts();
55
+ let goal;
56
+ let activeThreadId = null;
57
+ const pushEntry = (entry) => {
58
+ const timelineEntry = {
59
+ index: timeline.length,
60
+ ...entry,
61
+ };
62
+ timeline.push(timelineEntry);
63
+ return timelineEntry;
64
+ };
65
+ const pushToolEntry = (tool, at, rawType) => {
66
+ collectTraceToolArtifacts(artifacts, tool);
67
+ const existing = tool.id ? toolEntryById.get(tool.id) : undefined;
68
+ if (existing?.tool) {
69
+ existing.tool = mergeLocalTraceTimelineTool(existing.tool, tool);
70
+ existing.raw = { type: mergeLocalTraceRawType(existing.raw?.type, rawType) };
71
+ return;
72
+ }
73
+ const entry = pushEntry({
74
+ type: "tool",
75
+ ...(at ? { at } : {}),
76
+ tool,
77
+ raw: { type: rawType },
78
+ });
79
+ if (tool.id) {
80
+ toolEntryById.set(tool.id, entry);
81
+ }
82
+ };
83
+ for (const record of records) {
84
+ const recordType = traceString(record.type);
85
+ const payload = traceJsonObject(record.payload);
86
+ const at = traceString(record.timestamp);
87
+ if (recordType === "session_meta") {
88
+ activeThreadId = traceString(payload?.id);
89
+ continue;
90
+ }
91
+ if (!payload || (ref.sessionId && activeThreadId && activeThreadId !== ref.sessionId)) {
92
+ continue;
93
+ }
94
+ if (recordType === "response_item") {
95
+ const payloadType = traceString(payload.type);
96
+ if (payloadType === "message") {
97
+ const role = traceString(payload.role);
98
+ if (role !== "user" && role !== "assistant") {
99
+ continue;
100
+ }
101
+ const text = extractCodexMessageText(traceJsonArray(payload.content), role);
102
+ const truncated = truncateTraceText(text, maxTextChars);
103
+ if (!truncated || (role === "user" && isCodexSyntheticUserText(truncated))) {
104
+ continue;
105
+ }
106
+ if (role === "user" && !goal) {
107
+ goal = truncateTraceText(truncated, 300) ?? undefined;
108
+ }
109
+ pushEntry({
110
+ type: role,
111
+ ...(at ? { at } : {}),
112
+ text: truncated,
113
+ ...(traceString(payload.phase) ? { phase: traceString(payload.phase) } : {}),
114
+ raw: { type: "response_item.message" },
115
+ });
116
+ continue;
117
+ }
118
+ if (payloadType === "function_call") {
119
+ const tool = codexToolFromPayload(payload, "started", maxTextChars, maxToolOutputChars);
120
+ pushToolEntry(tool, at, "response_item.function_call");
121
+ continue;
122
+ }
123
+ if (payloadType === "function_call_output") {
124
+ const tool = codexToolFromPayload(payload, "completed", maxTextChars, maxToolOutputChars);
125
+ pushToolEntry(tool, at, "response_item.function_call_output");
126
+ }
127
+ continue;
128
+ }
129
+ if (recordType !== "event_msg") {
130
+ continue;
131
+ }
132
+ const eventType = traceString(payload.type);
133
+ if (eventType === "error") {
134
+ const message = truncateTraceText(traceString(payload.message), maxTextChars);
135
+ if (message) {
136
+ appendUnique(artifacts.errors, message);
137
+ pushEntry({
138
+ type: "error",
139
+ ...(at ? { at } : {}),
140
+ text: message,
141
+ raw: { type: "event_msg.error" },
142
+ });
143
+ }
144
+ continue;
145
+ }
146
+ if (eventType !== "exec_command_end" && eventType !== "mcp_tool_call_end") {
147
+ continue;
148
+ }
149
+ const tool = codexToolFromPayload(payload, "completed", maxTextChars, maxToolOutputChars);
150
+ pushToolEntry(tool, at, `event_msg.${eventType}`);
151
+ }
152
+ return buildAgentReadableTraceDigest({
153
+ provider: CODEX_LOCAL_TRACE_PROVIDER,
154
+ ref,
155
+ ...(goal ? { goal } : {}),
156
+ timeline,
157
+ artifacts,
158
+ });
159
+ },
160
+ };
161
+ function parseCodexTraceId(traceId) {
162
+ if (!traceId) {
163
+ return null;
164
+ }
165
+ const [provider, sessionId, sourceHash, ...extra] = traceId.split(":");
166
+ if (provider !== CODEX_LOCAL_TRACE_PROVIDER ||
167
+ !sessionId ||
168
+ !sourceHash ||
169
+ extra.length > 0) {
170
+ return null;
171
+ }
172
+ return { sessionId, sourceHash };
173
+ }
174
+ function resolveCodexHome(env = process.env) {
175
+ const explicit = env.CODEX_HOME?.trim();
176
+ if (explicit) {
177
+ return path.resolve(expandLocalTraceHomePath(explicit, env));
178
+ }
179
+ return path.join(localTraceHomeDir(env), ".codex");
180
+ }
181
+ async function readCodexIndex(indexPath) {
182
+ const index = new Map();
183
+ const records = await readLocalTraceJsonLines(indexPath).catch(() => []);
184
+ for (const record of records) {
185
+ const id = traceString(record.id);
186
+ if (!id) {
187
+ continue;
188
+ }
189
+ const entry = {};
190
+ const title = traceString(record.thread_name);
191
+ const updatedAt = traceString(record.updated_at);
192
+ if (title && !isCodexSyntheticUserText(title)) {
193
+ entry.title = title;
194
+ }
195
+ if (updatedAt) {
196
+ entry.updatedAt = updatedAt;
197
+ }
198
+ index.set(id, entry);
199
+ }
200
+ return index;
201
+ }
202
+ async function listCodexSessionFiles(codexHome) {
203
+ const roots = [
204
+ path.join(codexHome, "sessions"),
205
+ path.join(codexHome, "archived_sessions"),
206
+ ];
207
+ const files = [];
208
+ for (const root of roots) {
209
+ await collectJsonlFiles(root, files);
210
+ }
211
+ return files.sort((left, right) => right.mtimeMs - left.mtimeMs || left.sourcePath.localeCompare(right.sourcePath));
212
+ }
213
+ async function collectJsonlFiles(root, files) {
214
+ const entries = await fs.readdir(root, { withFileTypes: true }).catch(() => []);
215
+ for (const entry of entries) {
216
+ const entryPath = path.join(root, entry.name);
217
+ if (entry.isDirectory()) {
218
+ await collectJsonlFiles(entryPath, files);
219
+ continue;
220
+ }
221
+ if (entry.isFile() && entry.name.endsWith(".jsonl")) {
222
+ const stat = await fs.stat(entryPath).catch(() => null);
223
+ files.push({
224
+ sourcePath: entryPath,
225
+ mtimeMs: stat?.mtimeMs ?? 0,
226
+ });
227
+ }
228
+ }
229
+ }
230
+ async function summarizeCodexSessionFile(sourcePath, index, fallbackMtimeMs) {
231
+ const records = await readLocalTraceJsonLines(sourcePath).catch(() => []);
232
+ let threadId = null;
233
+ let workspaceRoot;
234
+ let startedAt;
235
+ let endedAt;
236
+ let title;
237
+ for (const record of records) {
238
+ const timestamp = traceString(record.timestamp);
239
+ if (timestamp) {
240
+ startedAt ??= timestamp;
241
+ endedAt = timestamp;
242
+ }
243
+ const recordType = traceString(record.type);
244
+ const payload = traceJsonObject(record.payload);
245
+ if (recordType === "session_meta" && payload) {
246
+ threadId ??= traceString(payload.id);
247
+ const cwd = traceString(payload.cwd);
248
+ if (cwd) {
249
+ workspaceRoot = path.resolve(cwd);
250
+ }
251
+ startedAt ??= traceString(payload.timestamp) ?? timestamp ?? undefined;
252
+ continue;
253
+ }
254
+ if (title || recordType !== "response_item" || !payload) {
255
+ continue;
256
+ }
257
+ if (traceString(payload.type) !== "message" || traceString(payload.role) !== "user") {
258
+ continue;
259
+ }
260
+ const text = extractCodexMessageText(traceJsonArray(payload.content), "user");
261
+ if (!text || isCodexSyntheticUserText(text)) {
262
+ continue;
263
+ }
264
+ title = truncateTraceText(text, 96) ?? undefined;
265
+ }
266
+ if (!threadId) {
267
+ return null;
268
+ }
269
+ const indexEntry = index.get(threadId);
270
+ const fallbackUpdatedAt = typeof fallbackMtimeMs === "number" && fallbackMtimeMs > 0
271
+ ? new Date(fallbackMtimeMs).toISOString()
272
+ : await fs.stat(sourcePath)
273
+ .then((stat) => stat.mtime.toISOString())
274
+ .catch(() => undefined);
275
+ return {
276
+ threadId,
277
+ ...(indexEntry?.title || title ? { title: indexEntry?.title ?? title } : {}),
278
+ ...(workspaceRoot ? { workspaceRoot } : {}),
279
+ ...(startedAt ? { startedAt } : {}),
280
+ ...(endedAt ? { endedAt } : {}),
281
+ updatedAt: indexEntry?.updatedAt ?? endedAt ?? fallbackUpdatedAt,
282
+ };
283
+ }
284
+ function codexSummaryToRef(codexHome, indexPath, sourcePath, summary) {
285
+ return {
286
+ provider: CODEX_LOCAL_TRACE_PROVIDER,
287
+ traceId: `codex:${summary.threadId}:${localTraceShortHash(sourcePath)}`,
288
+ sourcePath,
289
+ profileRoot: codexHome,
290
+ indexPath,
291
+ sessionId: summary.threadId,
292
+ ...(summary.title ? { title: summary.title } : {}),
293
+ ...(summary.workspaceRoot ? { workspaceRoot: summary.workspaceRoot } : {}),
294
+ ...(summary.startedAt ? { startedAt: summary.startedAt } : {}),
295
+ ...(summary.endedAt ? { endedAt: summary.endedAt } : {}),
296
+ ...(summary.updatedAt ? { updatedAt: summary.updatedAt } : {}),
297
+ };
298
+ }
299
+ function extractCodexMessageText(content, role) {
300
+ const chunks = [];
301
+ for (const entry of content) {
302
+ const block = traceJsonObject(entry);
303
+ const type = traceString(block?.type);
304
+ if (role === "user" && type === "input_text") {
305
+ const text = normalizeTraceText(traceString(block?.text));
306
+ if (text) {
307
+ chunks.push(text);
308
+ }
309
+ }
310
+ if (role === "assistant" && type === "output_text") {
311
+ const text = normalizeTraceText(traceString(block?.text));
312
+ if (text) {
313
+ chunks.push(text);
314
+ }
315
+ }
316
+ }
317
+ return chunks.length > 0 ? chunks.join("\n\n") : null;
318
+ }
319
+ function isCodexSyntheticUserText(text) {
320
+ const trimmed = text.trimStart();
321
+ return (trimmed.startsWith("<user_instructions>") ||
322
+ trimmed.startsWith("<environment_context>") ||
323
+ trimmed.startsWith("# AGENTS.md instructions for ") ||
324
+ trimmed.startsWith("# AGENTS instructions for "));
325
+ }
326
+ function codexToolFromPayload(payload, status, maxTextChars, maxToolOutputChars) {
327
+ const input = readCodexToolInput(payload, maxTextChars);
328
+ const output = readCodexToolOutput(payload, maxToolOutputChars);
329
+ const error = truncateTraceText(readCodexToolError(payload), maxTextChars) ?? undefined;
330
+ const command = readToolCommand(payload, input);
331
+ const cwd = readCodexString(payload, [["cwd"], ["item", "cwd"]]) ?? readToolCwd(input);
332
+ const exitCode = traceNumber(payload.exit_code) ??
333
+ traceNumber(payload.exitCode) ??
334
+ traceNumber(readCodexValue(payload, ["result", "exit_code"])) ??
335
+ traceNumber(readCodexValue(payload, ["result", "exitCode"])) ??
336
+ undefined;
337
+ return {
338
+ status,
339
+ ...(readCodexToolId(payload) ? { id: readCodexToolId(payload) } : {}),
340
+ ...(readCodexToolName(payload) ? { name: readCodexToolName(payload) } : {}),
341
+ ...(input !== undefined ? { input } : {}),
342
+ ...(output !== undefined ? { output } : {}),
343
+ ...(error ? { error } : {}),
344
+ ...(command ? { command } : {}),
345
+ ...(cwd ? { cwd } : {}),
346
+ ...(typeof exitCode === "number" ? { exitCode } : {}),
347
+ };
348
+ }
349
+ function readCodexValue(payload, segments) {
350
+ let current = payload ?? undefined;
351
+ for (const segment of segments) {
352
+ if (!current || Array.isArray(current) || typeof current !== "object") {
353
+ return undefined;
354
+ }
355
+ current = current[segment];
356
+ }
357
+ return current;
358
+ }
359
+ function readCodexString(payload, paths) {
360
+ for (const itemPath of paths) {
361
+ const value = readCodexValue(payload, itemPath);
362
+ const text = traceString(value);
363
+ if (text) {
364
+ return text;
365
+ }
366
+ }
367
+ return null;
368
+ }
369
+ function readCodexToolId(payload) {
370
+ return readCodexString(payload, [
371
+ ["id"],
372
+ ["item", "id"],
373
+ ["call_id"],
374
+ ["callId"],
375
+ ["toolCall", "id"],
376
+ ["tool_call", "id"],
377
+ ["call", "id"],
378
+ ]);
379
+ }
380
+ function readCodexToolName(payload) {
381
+ return readCodexString(payload, [
382
+ ["name"],
383
+ ["item", "name"],
384
+ ["toolName"],
385
+ ["tool_name"],
386
+ ["tool", "name"],
387
+ ["call", "name"],
388
+ ["invocation", "tool"],
389
+ ["item", "invocation", "tool"],
390
+ ["title"],
391
+ ["item", "title"],
392
+ ]);
393
+ }
394
+ function readCodexToolInput(payload, maxTextChars) {
395
+ const raw = readCodexValue(payload, ["arguments"]) ??
396
+ readCodexValue(payload, ["item", "arguments"]) ??
397
+ readCodexValue(payload, ["invocation", "arguments"]) ??
398
+ readCodexValue(payload, ["item", "invocation", "arguments"]) ??
399
+ readCodexValue(payload, ["input"]) ??
400
+ readCodexValue(payload, ["item", "input"]);
401
+ if (raw !== undefined) {
402
+ return truncateTraceJsonValue(normalizeCodexJsonValue(raw), { maxTextChars });
403
+ }
404
+ const command = readCodexValue(payload, ["command"]);
405
+ const cwd = traceString(payload.cwd);
406
+ const fallback = {};
407
+ if (command !== undefined) {
408
+ fallback.command = command;
409
+ }
410
+ if (cwd) {
411
+ fallback.cwd = cwd;
412
+ }
413
+ return Object.keys(fallback).length > 0
414
+ ? truncateTraceJsonValue(fallback, { maxTextChars })
415
+ : undefined;
416
+ }
417
+ function readCodexToolOutput(payload, maxTextChars) {
418
+ const result = readCodexValue(payload, ["result"]) ??
419
+ readCodexValue(payload, ["item", "result"]) ??
420
+ readCodexValue(payload, ["output"]) ??
421
+ readCodexValue(payload, ["item", "output"]);
422
+ if (result !== undefined) {
423
+ return truncateTraceJsonValue(normalizeCodexJsonValue(result), { maxTextChars });
424
+ }
425
+ const aggregatedOutput = readCodexString(payload, [
426
+ ["aggregated_output"],
427
+ ["aggregatedOutput"],
428
+ ["item", "aggregatedOutput"],
429
+ ]);
430
+ return truncateTraceText(aggregatedOutput, maxTextChars) ?? undefined;
431
+ }
432
+ function readCodexToolError(payload) {
433
+ const status = readCodexString(payload, [["status"], ["item", "status"]]);
434
+ const errorText = readCodexString(payload, [
435
+ ["error"],
436
+ ["errorText"],
437
+ ["stderr"],
438
+ ["formatted_output"],
439
+ ["formattedOutput"],
440
+ ]);
441
+ if (errorText) {
442
+ return errorText;
443
+ }
444
+ if (status === "failed" || status === "error") {
445
+ return readCodexString(payload, [
446
+ ["aggregated_output"],
447
+ ["aggregatedOutput"],
448
+ ["output"],
449
+ ]);
450
+ }
451
+ return null;
452
+ }
453
+ function normalizeCodexJsonValue(value) {
454
+ if (typeof value !== "string") {
455
+ return value;
456
+ }
457
+ const trimmed = value.trim();
458
+ if (!/^[\[{"]/u.test(trimmed)) {
459
+ return value;
460
+ }
461
+ try {
462
+ return JSON.parse(trimmed);
463
+ }
464
+ catch {
465
+ return value;
466
+ }
467
+ }
468
+ function readToolCommand(payload, input) {
469
+ const direct = readCodexValue(payload, ["command"]);
470
+ if (Array.isArray(direct)) {
471
+ return direct.map((part) => String(part)).join(" ");
472
+ }
473
+ if (typeof direct === "string") {
474
+ return direct;
475
+ }
476
+ const inputRecord = traceJsonObject(input);
477
+ const command = traceString(inputRecord?.cmd) ?? traceString(inputRecord?.command);
478
+ if (command) {
479
+ return command;
480
+ }
481
+ const commandArray = inputRecord?.command;
482
+ if (Array.isArray(commandArray)) {
483
+ return commandArray.map((part) => String(part)).join(" ");
484
+ }
485
+ return undefined;
486
+ }
487
+ function readToolCwd(input) {
488
+ const inputRecord = traceJsonObject(input);
489
+ return traceString(inputRecord?.cwd) ??
490
+ traceString(inputRecord?.workdir) ??
491
+ undefined;
492
+ }
package/package.json CHANGED
@@ -1,12 +1,7 @@
1
1
  {
2
2
  "name": "@workbench-ai/agent-driver-openai-codex",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
4
4
  "type": "module",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/workbench-ai/workbench-monorepo.git",
8
- "directory": "products/agent-drivers/packages/openai-codex"
9
- },
10
5
  "publishConfig": {
11
6
  "registry": "https://registry.npmjs.org/",
12
7
  "access": "public"
@@ -28,7 +23,7 @@
28
23
  ],
29
24
  "dependencies": {
30
25
  "zod": "^4.1.5",
31
- "@workbench-ai/agent-driver": "0.0.44"
26
+ "@workbench-ai/agent-driver": "0.0.46"
32
27
  },
33
28
  "devDependencies": {
34
29
  "@types/node": "^24.3.1",