@northflare/runner 0.0.30 → 0.0.32

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.
Files changed (119) hide show
  1. package/bin/northflare-runner +1 -1
  2. package/dist/chunk-3QTLJ4CG.js +33622 -0
  3. package/dist/chunk-3QTLJ4CG.js.map +1 -0
  4. package/dist/chunk-7D4SUZUM.js +38 -0
  5. package/dist/chunk-7D4SUZUM.js.map +1 -0
  6. package/dist/dist-W7DZRE4U.js +365 -0
  7. package/dist/dist-W7DZRE4U.js.map +1 -0
  8. package/dist/index.d.ts +764 -5
  9. package/dist/index.js +9872 -202
  10. package/dist/index.js.map +1 -1
  11. package/dist/sdk-query-TRMSGGID-EIENWDKW.js +14 -0
  12. package/dist/sdk-query-TRMSGGID-EIENWDKW.js.map +1 -0
  13. package/package.json +17 -17
  14. package/tsup.config.ts +5 -2
  15. package/dist/components/claude-sdk-manager.d.ts +0 -60
  16. package/dist/components/claude-sdk-manager.d.ts.map +0 -1
  17. package/dist/components/claude-sdk-manager.js +0 -1378
  18. package/dist/components/claude-sdk-manager.js.map +0 -1
  19. package/dist/components/codex-sdk-manager.d.ts +0 -94
  20. package/dist/components/codex-sdk-manager.d.ts.map +0 -1
  21. package/dist/components/codex-sdk-manager.js +0 -1450
  22. package/dist/components/codex-sdk-manager.js.map +0 -1
  23. package/dist/components/enhanced-repository-manager.d.ts +0 -173
  24. package/dist/components/enhanced-repository-manager.d.ts.map +0 -1
  25. package/dist/components/enhanced-repository-manager.js +0 -1097
  26. package/dist/components/enhanced-repository-manager.js.map +0 -1
  27. package/dist/components/message-handler-sse.d.ts +0 -77
  28. package/dist/components/message-handler-sse.d.ts.map +0 -1
  29. package/dist/components/message-handler-sse.js +0 -1224
  30. package/dist/components/message-handler-sse.js.map +0 -1
  31. package/dist/components/northflare-agent-sdk-manager.d.ts +0 -58
  32. package/dist/components/northflare-agent-sdk-manager.d.ts.map +0 -1
  33. package/dist/components/northflare-agent-sdk-manager.js +0 -2032
  34. package/dist/components/northflare-agent-sdk-manager.js.map +0 -1
  35. package/dist/components/repository-manager.d.ts +0 -51
  36. package/dist/components/repository-manager.d.ts.map +0 -1
  37. package/dist/components/repository-manager.js +0 -256
  38. package/dist/components/repository-manager.js.map +0 -1
  39. package/dist/index.d.ts.map +0 -1
  40. package/dist/runner-sse.d.ts +0 -102
  41. package/dist/runner-sse.d.ts.map +0 -1
  42. package/dist/runner-sse.js +0 -877
  43. package/dist/runner-sse.js.map +0 -1
  44. package/dist/services/RunnerAPIClient.d.ts +0 -61
  45. package/dist/services/RunnerAPIClient.d.ts.map +0 -1
  46. package/dist/services/RunnerAPIClient.js +0 -187
  47. package/dist/services/RunnerAPIClient.js.map +0 -1
  48. package/dist/services/SSEClient.d.ts +0 -62
  49. package/dist/services/SSEClient.d.ts.map +0 -1
  50. package/dist/services/SSEClient.js +0 -225
  51. package/dist/services/SSEClient.js.map +0 -1
  52. package/dist/types/claude.d.ts +0 -80
  53. package/dist/types/claude.d.ts.map +0 -1
  54. package/dist/types/claude.js +0 -5
  55. package/dist/types/claude.js.map +0 -1
  56. package/dist/types/index.d.ts +0 -52
  57. package/dist/types/index.d.ts.map +0 -1
  58. package/dist/types/index.js +0 -7
  59. package/dist/types/index.js.map +0 -1
  60. package/dist/types/messages.d.ts +0 -33
  61. package/dist/types/messages.d.ts.map +0 -1
  62. package/dist/types/messages.js +0 -5
  63. package/dist/types/messages.js.map +0 -1
  64. package/dist/types/runner-interface.d.ts +0 -38
  65. package/dist/types/runner-interface.d.ts.map +0 -1
  66. package/dist/types/runner-interface.js +0 -5
  67. package/dist/types/runner-interface.js.map +0 -1
  68. package/dist/utils/StateManager.d.ts +0 -61
  69. package/dist/utils/StateManager.d.ts.map +0 -1
  70. package/dist/utils/StateManager.js +0 -170
  71. package/dist/utils/StateManager.js.map +0 -1
  72. package/dist/utils/config.d.ts +0 -48
  73. package/dist/utils/config.d.ts.map +0 -1
  74. package/dist/utils/config.js +0 -378
  75. package/dist/utils/config.js.map +0 -1
  76. package/dist/utils/console.d.ts +0 -8
  77. package/dist/utils/console.d.ts.map +0 -1
  78. package/dist/utils/console.js +0 -31
  79. package/dist/utils/console.js.map +0 -1
  80. package/dist/utils/debug.d.ts +0 -12
  81. package/dist/utils/debug.d.ts.map +0 -1
  82. package/dist/utils/debug.js +0 -94
  83. package/dist/utils/debug.js.map +0 -1
  84. package/dist/utils/expand-env.d.ts +0 -2
  85. package/dist/utils/expand-env.d.ts.map +0 -1
  86. package/dist/utils/expand-env.js +0 -17
  87. package/dist/utils/expand-env.js.map +0 -1
  88. package/dist/utils/inactivity-timeout.d.ts +0 -19
  89. package/dist/utils/inactivity-timeout.d.ts.map +0 -1
  90. package/dist/utils/inactivity-timeout.js +0 -72
  91. package/dist/utils/inactivity-timeout.js.map +0 -1
  92. package/dist/utils/logger.d.ts +0 -10
  93. package/dist/utils/logger.d.ts.map +0 -1
  94. package/dist/utils/logger.js +0 -129
  95. package/dist/utils/logger.js.map +0 -1
  96. package/dist/utils/message-log.d.ts +0 -23
  97. package/dist/utils/message-log.d.ts.map +0 -1
  98. package/dist/utils/message-log.js +0 -69
  99. package/dist/utils/message-log.js.map +0 -1
  100. package/dist/utils/model.d.ts +0 -8
  101. package/dist/utils/model.d.ts.map +0 -1
  102. package/dist/utils/model.js +0 -37
  103. package/dist/utils/model.js.map +0 -1
  104. package/dist/utils/status-line.d.ts +0 -34
  105. package/dist/utils/status-line.d.ts.map +0 -1
  106. package/dist/utils/status-line.js +0 -131
  107. package/dist/utils/status-line.js.map +0 -1
  108. package/dist/utils/tool-response-sanitizer.d.ts +0 -9
  109. package/dist/utils/tool-response-sanitizer.d.ts.map +0 -1
  110. package/dist/utils/tool-response-sanitizer.js +0 -118
  111. package/dist/utils/tool-response-sanitizer.js.map +0 -1
  112. package/dist/utils/update-coordinator.d.ts +0 -53
  113. package/dist/utils/update-coordinator.d.ts.map +0 -1
  114. package/dist/utils/update-coordinator.js +0 -159
  115. package/dist/utils/update-coordinator.js.map +0 -1
  116. package/dist/utils/version.d.ts +0 -10
  117. package/dist/utils/version.d.ts.map +0 -1
  118. package/dist/utils/version.js +0 -33
  119. package/dist/utils/version.js.map +0 -1
@@ -0,0 +1,38 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ export {
34
+ __require,
35
+ __commonJS,
36
+ __toESM
37
+ };
38
+ //# sourceMappingURL=chunk-7D4SUZUM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,365 @@
1
+ import "./chunk-7D4SUZUM.js";
2
+
3
+ // ../codex-sdk/dist/index.js
4
+ import { promises as fs } from "fs";
5
+ import os from "os";
6
+ import path from "path";
7
+ import { spawn } from "child_process";
8
+ import { existsSync, realpathSync } from "fs";
9
+ import path2 from "path";
10
+ import readline from "readline";
11
+ import { createRequire } from "module";
12
+ async function createOutputSchemaFile(schema) {
13
+ if (schema === void 0) {
14
+ return { cleanup: async () => {
15
+ } };
16
+ }
17
+ if (!isJsonObject(schema)) {
18
+ throw new Error("outputSchema must be a plain JSON object");
19
+ }
20
+ const schemaDir = await fs.mkdtemp(path.join(os.tmpdir(), "codex-output-schema-"));
21
+ const schemaPath = path.join(schemaDir, "schema.json");
22
+ const cleanup = async () => {
23
+ try {
24
+ await fs.rm(schemaDir, { recursive: true, force: true });
25
+ } catch {
26
+ }
27
+ };
28
+ try {
29
+ await fs.writeFile(schemaPath, JSON.stringify(schema), "utf8");
30
+ return { schemaPath, cleanup };
31
+ } catch (error) {
32
+ await cleanup();
33
+ throw error;
34
+ }
35
+ }
36
+ function isJsonObject(value) {
37
+ return typeof value === "object" && value !== null && !Array.isArray(value);
38
+ }
39
+ var Thread = class {
40
+ _exec;
41
+ _options;
42
+ _id;
43
+ _threadOptions;
44
+ _initialMessagesSent = false;
45
+ /** Returns the ID of the thread. Populated after the first turn starts. */
46
+ get id() {
47
+ return this._id;
48
+ }
49
+ /* @internal */
50
+ constructor(exec, options, threadOptions, id = null) {
51
+ this._exec = exec;
52
+ this._options = options;
53
+ this._id = id;
54
+ this._threadOptions = threadOptions;
55
+ this._initialMessagesSent = id !== null;
56
+ }
57
+ /** Provides the input to the agent and streams events as they are produced during the turn. */
58
+ async runStreamed(input, turnOptions = {}) {
59
+ return { events: this.runStreamedInternal(input, turnOptions) };
60
+ }
61
+ async *runStreamedInternal(input, turnOptions = {}) {
62
+ const { schemaPath, cleanup } = await createOutputSchemaFile(turnOptions.outputSchema);
63
+ const options = this._threadOptions;
64
+ const { prompt, images } = normalizeInput(input);
65
+ let finalPrompt = prompt;
66
+ if (!this._initialMessagesSent && options.initialMessages?.length) {
67
+ const formattedMessages = formatInitialMessages(options.initialMessages);
68
+ finalPrompt = formattedMessages + "\n\n" + prompt;
69
+ this._initialMessagesSent = true;
70
+ }
71
+ const generator = this._exec.run({
72
+ input: finalPrompt,
73
+ baseUrl: this._options.baseUrl,
74
+ apiKey: this._options.apiKey,
75
+ threadId: this._id,
76
+ images,
77
+ model: options?.model,
78
+ sandboxMode: options?.sandboxMode,
79
+ workingDirectory: options?.workingDirectory,
80
+ skipGitRepoCheck: options?.skipGitRepoCheck,
81
+ outputSchemaFile: schemaPath,
82
+ modelReasoningEffort: options?.modelReasoningEffort,
83
+ signal: turnOptions.signal,
84
+ networkAccessEnabled: options?.networkAccessEnabled,
85
+ webSearchEnabled: options?.webSearchEnabled,
86
+ approvalPolicy: options?.approvalPolicy,
87
+ additionalDirectories: options?.additionalDirectories,
88
+ configOverrides: options?.configOverrides
89
+ });
90
+ try {
91
+ for await (const item of generator) {
92
+ let parsed;
93
+ try {
94
+ parsed = JSON.parse(item);
95
+ } catch (error) {
96
+ throw new Error(`Failed to parse item: ${item}`, { cause: error });
97
+ }
98
+ if (parsed.type === "thread.started") {
99
+ this._id = parsed.thread_id;
100
+ }
101
+ yield parsed;
102
+ }
103
+ } finally {
104
+ await cleanup();
105
+ }
106
+ }
107
+ /** Provides the input to the agent and returns the completed turn. */
108
+ async run(input, turnOptions = {}) {
109
+ const generator = this.runStreamedInternal(input, turnOptions);
110
+ const items = [];
111
+ let finalResponse = "";
112
+ let usage = null;
113
+ let turnFailure = null;
114
+ for await (const event of generator) {
115
+ if (event.type === "item.completed") {
116
+ if (event.item.type === "agent_message") {
117
+ finalResponse = event.item.text;
118
+ }
119
+ items.push(event.item);
120
+ } else if (event.type === "turn.completed") {
121
+ usage = event.usage;
122
+ } else if (event.type === "turn.failed") {
123
+ turnFailure = event.error;
124
+ break;
125
+ }
126
+ }
127
+ if (turnFailure) {
128
+ throw new Error(turnFailure.message);
129
+ }
130
+ return { items, finalResponse, usage };
131
+ }
132
+ };
133
+ function normalizeInput(input) {
134
+ if (typeof input === "string") {
135
+ return { prompt: input, images: [] };
136
+ }
137
+ const promptParts = [];
138
+ const images = [];
139
+ for (const item of input) {
140
+ if (item.type === "text") {
141
+ promptParts.push(item.text);
142
+ } else if (item.type === "local_image") {
143
+ images.push(item.path);
144
+ }
145
+ }
146
+ return { prompt: promptParts.join("\n\n"), images };
147
+ }
148
+ function formatInitialMessages(messages) {
149
+ return messages.map((msg) => {
150
+ const roleLabel = msg.role.charAt(0).toUpperCase() + msg.role.slice(1);
151
+ return `[${roleLabel}]
152
+ ${msg.content}`;
153
+ }).join("\n\n");
154
+ }
155
+ var INTERNAL_ORIGINATOR_ENV = "CODEX_INTERNAL_ORIGINATOR_OVERRIDE";
156
+ var TYPESCRIPT_SDK_ORIGINATOR = "codex_sdk_ts";
157
+ var isDebugEnabled = process.env["DEBUG"] === "true";
158
+ var CodexExec = class {
159
+ executablePath;
160
+ envOverride;
161
+ constructor(executablePath = null, env) {
162
+ this.executablePath = executablePath || findCodexPath();
163
+ this.envOverride = env;
164
+ }
165
+ async *run(args) {
166
+ const commandArgs = ["exec", "--experimental-json"];
167
+ if (args.model) {
168
+ commandArgs.push("--model", args.model);
169
+ }
170
+ if (args.sandboxMode) {
171
+ commandArgs.push("--sandbox", args.sandboxMode);
172
+ }
173
+ if (args.workingDirectory) {
174
+ commandArgs.push("--cd", args.workingDirectory);
175
+ }
176
+ if (args.additionalDirectories?.length) {
177
+ for (const dir of args.additionalDirectories) {
178
+ commandArgs.push("--add-dir", dir);
179
+ }
180
+ }
181
+ if (args.skipGitRepoCheck) {
182
+ commandArgs.push("--skip-git-repo-check");
183
+ }
184
+ if (args.outputSchemaFile) {
185
+ commandArgs.push("--output-schema", args.outputSchemaFile);
186
+ }
187
+ if (args.modelReasoningEffort) {
188
+ commandArgs.push("--config", `model_reasoning_effort="${args.modelReasoningEffort}"`);
189
+ }
190
+ if (args.networkAccessEnabled !== void 0) {
191
+ commandArgs.push(
192
+ "--config",
193
+ `sandbox_workspace_write.network_access=${args.networkAccessEnabled}`
194
+ );
195
+ }
196
+ if (args.webSearchEnabled !== void 0) {
197
+ commandArgs.push("--config", `features.web_search_request=${args.webSearchEnabled}`);
198
+ }
199
+ if (args.approvalPolicy) {
200
+ commandArgs.push("--config", `approval_policy="${args.approvalPolicy}"`);
201
+ }
202
+ if (args.configOverrides) {
203
+ for (const [key, value] of Object.entries(args.configOverrides)) {
204
+ const formatted = formatConfigValue(value);
205
+ commandArgs.push("--config", `${key}=${formatted}`);
206
+ }
207
+ }
208
+ if (args.images?.length) {
209
+ for (const image of args.images) {
210
+ commandArgs.push("--image", image);
211
+ }
212
+ }
213
+ if (args.threadId) {
214
+ commandArgs.push("resume", args.threadId);
215
+ }
216
+ if (isDebugEnabled) {
217
+ console.log("[CodexExec] Executable path:", this.executablePath);
218
+ console.log("[CodexExec] Command arguments:", commandArgs);
219
+ }
220
+ const env = {};
221
+ if (this.envOverride) {
222
+ Object.assign(env, this.envOverride);
223
+ const hasPathKey = Object.keys(env).some((key) => key.toUpperCase() === "PATH");
224
+ if (!hasPathKey) {
225
+ const inheritedPathKey = Object.keys(process.env).find((key) => key.toUpperCase() === "PATH");
226
+ if (inheritedPathKey && process.env[inheritedPathKey]) {
227
+ env.PATH = process.env[inheritedPathKey];
228
+ }
229
+ }
230
+ } else {
231
+ for (const [key, value] of Object.entries(process.env)) {
232
+ if (value !== void 0) {
233
+ env[key] = value;
234
+ }
235
+ }
236
+ }
237
+ if (!env[INTERNAL_ORIGINATOR_ENV]) {
238
+ env[INTERNAL_ORIGINATOR_ENV] = TYPESCRIPT_SDK_ORIGINATOR;
239
+ }
240
+ if (args.baseUrl) {
241
+ env.OPENAI_BASE_URL = args.baseUrl;
242
+ }
243
+ if (args.apiKey) {
244
+ env.CODEX_API_KEY = args.apiKey;
245
+ }
246
+ const child = spawn(this.executablePath, commandArgs, {
247
+ env,
248
+ signal: args.signal
249
+ });
250
+ let spawnError = null;
251
+ child.once("error", (err) => spawnError = err);
252
+ if (!child.stdin) {
253
+ child.kill();
254
+ throw new Error("Child process has no stdin");
255
+ }
256
+ child.stdin.write(args.input);
257
+ child.stdin.end();
258
+ if (!child.stdout) {
259
+ child.kill();
260
+ throw new Error("Child process has no stdout");
261
+ }
262
+ const stderrChunks = [];
263
+ if (child.stderr) {
264
+ child.stderr.on("data", (data) => {
265
+ stderrChunks.push(data);
266
+ });
267
+ }
268
+ const rl = readline.createInterface({
269
+ input: child.stdout,
270
+ crlfDelay: Infinity
271
+ });
272
+ try {
273
+ for await (const line of rl) {
274
+ yield line;
275
+ }
276
+ const exitCode = new Promise((resolve, reject) => {
277
+ child.once("exit", (code) => {
278
+ if (code === 0) {
279
+ resolve(code);
280
+ } else {
281
+ const stderrBuffer = Buffer.concat(stderrChunks);
282
+ reject(
283
+ new Error(`Codex Exec exited with code ${code}: ${stderrBuffer.toString("utf8")}`)
284
+ );
285
+ }
286
+ });
287
+ });
288
+ if (spawnError) throw spawnError;
289
+ await exitCode;
290
+ } finally {
291
+ rl.close();
292
+ child.removeAllListeners();
293
+ try {
294
+ if (!child.killed) child.kill();
295
+ } catch {
296
+ }
297
+ }
298
+ }
299
+ };
300
+ var moduleRequire = createRequire(import.meta.url);
301
+ function findCodexPath() {
302
+ const candidates = process.platform === "win32" ? ["codex.cmd", "codex.ps1", "codex"] : ["codex"];
303
+ const searchPaths = moduleRequire.resolve.paths("@openai/codex-sdk") ?? [];
304
+ for (const basePath of searchPaths) {
305
+ if (!basePath) continue;
306
+ const codexSdkPackageRoot = path2.join(basePath, "@openai", "codex-sdk");
307
+ if (!existsSync(path2.join(codexSdkPackageRoot, "package.json"))) {
308
+ continue;
309
+ }
310
+ for (const binName of candidates) {
311
+ const binPath = path2.join(codexSdkPackageRoot, "node_modules", ".bin", binName);
312
+ if (!existsSync(binPath)) continue;
313
+ return realpathSync(binPath);
314
+ }
315
+ }
316
+ throw new Error(
317
+ `[Codex SDK] Unable to locate the Codex CLI entrypoint installed by @openai/codex-sdk. Try re-running \`pnpm install\` and ensure optional dependencies are enabled.`
318
+ );
319
+ }
320
+ function formatConfigValue(value) {
321
+ if (typeof value === "string") {
322
+ return JSON.stringify(value);
323
+ }
324
+ if (typeof value === "number" || typeof value === "boolean") {
325
+ return String(value);
326
+ }
327
+ if (value === null || value === void 0) {
328
+ return "null";
329
+ }
330
+ try {
331
+ return JSON.stringify(value);
332
+ } catch {
333
+ return JSON.stringify(String(value));
334
+ }
335
+ }
336
+ var Codex = class {
337
+ exec;
338
+ options;
339
+ constructor(options = {}) {
340
+ this.exec = new CodexExec(options.codexPathOverride, options.env);
341
+ this.options = options;
342
+ }
343
+ /**
344
+ * Starts a new conversation with an agent.
345
+ * @returns A new thread instance.
346
+ */
347
+ startThread(options = {}) {
348
+ return new Thread(this.exec, this.options, options);
349
+ }
350
+ /**
351
+ * Resumes a conversation with an agent based on the thread id.
352
+ * Threads are persisted in ~/.codex/sessions.
353
+ *
354
+ * @param id The id of the thread to resume.
355
+ * @returns A new thread instance.
356
+ */
357
+ resumeThread(id, options = {}) {
358
+ return new Thread(this.exec, this.options, options, id);
359
+ }
360
+ };
361
+ export {
362
+ Codex,
363
+ Thread
364
+ };
365
+ //# sourceMappingURL=dist-W7DZRE4U.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../codex-sdk/src/outputSchemaFile.ts","../../codex-sdk/src/thread.ts","../../codex-sdk/src/exec.ts","../../codex-sdk/src/codex.ts"],"sourcesContent":["import { promises as fs } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\nexport type OutputSchemaFile = {\n schemaPath?: string;\n cleanup: () => Promise<void>;\n};\n\nexport async function createOutputSchemaFile(schema: unknown): Promise<OutputSchemaFile> {\n if (schema === undefined) {\n return { cleanup: async () => {} };\n }\n\n if (!isJsonObject(schema)) {\n throw new Error(\"outputSchema must be a plain JSON object\");\n }\n\n const schemaDir = await fs.mkdtemp(path.join(os.tmpdir(), \"codex-output-schema-\"));\n const schemaPath = path.join(schemaDir, \"schema.json\");\n const cleanup = async () => {\n try {\n await fs.rm(schemaDir, { recursive: true, force: true });\n } catch {\n // suppress\n }\n };\n\n try {\n await fs.writeFile(schemaPath, JSON.stringify(schema), \"utf8\");\n return { schemaPath, cleanup };\n } catch (error) {\n await cleanup();\n throw error;\n }\n}\n\nfunction isJsonObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n","import { CodexOptions } from \"./codexOptions\";\nimport { ThreadEvent, ThreadError, Usage } from \"./events\";\nimport { CodexExec } from \"./exec\";\nimport { ThreadItem } from \"./items\";\nimport { ThreadOptions } from \"./threadOptions\";\nimport { TurnOptions } from \"./turnOptions\";\nimport { createOutputSchemaFile } from \"./outputSchemaFile\";\n\n/** Completed turn. */\nexport type Turn = {\n items: ThreadItem[];\n finalResponse: string;\n usage: Usage | null;\n};\n\n/** Alias for `Turn` to describe the result of `run()`. */\nexport type RunResult = Turn;\n\n/** The result of the `runStreamed` method. */\nexport type StreamedTurn = {\n events: AsyncGenerator<ThreadEvent>;\n};\n\n/** Alias for `StreamedTurn` to describe the result of `runStreamed()`. */\nexport type RunStreamedResult = StreamedTurn;\n\n/** An input to send to the agent. */\nexport type UserInput =\n | {\n type: \"text\";\n text: string;\n }\n | {\n type: \"local_image\";\n path: string;\n };\n\nexport type Input = string | UserInput[];\n\n/** Respesent a thread of conversation with the agent. One thread can have multiple consecutive turns. */\nexport class Thread {\n private _exec: CodexExec;\n private _options: CodexOptions;\n private _id: string | null;\n private _threadOptions: ThreadOptions;\n private _initialMessagesSent: boolean = false;\n\n /** Returns the ID of the thread. Populated after the first turn starts. */\n public get id(): string | null {\n return this._id;\n }\n\n /* @internal */\n constructor(\n exec: CodexExec,\n options: CodexOptions,\n threadOptions: ThreadOptions,\n id: string | null = null,\n ) {\n this._exec = exec;\n this._options = options;\n this._id = id;\n this._threadOptions = threadOptions;\n // If resuming an existing thread, initial messages have already been sent\n this._initialMessagesSent = id !== null;\n }\n\n /** Provides the input to the agent and streams events as they are produced during the turn. */\n async runStreamed(input: Input, turnOptions: TurnOptions = {}): Promise<StreamedTurn> {\n return { events: this.runStreamedInternal(input, turnOptions) };\n }\n\n private async *runStreamedInternal(\n input: Input,\n turnOptions: TurnOptions = {},\n ): AsyncGenerator<ThreadEvent> {\n const { schemaPath, cleanup } = await createOutputSchemaFile(turnOptions.outputSchema);\n const options = this._threadOptions;\n const { prompt, images } = normalizeInput(input);\n\n // Prepend initial messages on the first turn only\n let finalPrompt = prompt;\n if (!this._initialMessagesSent && options.initialMessages?.length) {\n const formattedMessages = formatInitialMessages(options.initialMessages);\n finalPrompt = formattedMessages + \"\\n\\n\" + prompt;\n this._initialMessagesSent = true;\n }\n\n const generator = this._exec.run({\n input: finalPrompt,\n baseUrl: this._options.baseUrl,\n apiKey: this._options.apiKey,\n threadId: this._id,\n images,\n model: options?.model,\n sandboxMode: options?.sandboxMode,\n workingDirectory: options?.workingDirectory,\n skipGitRepoCheck: options?.skipGitRepoCheck,\n outputSchemaFile: schemaPath,\n modelReasoningEffort: options?.modelReasoningEffort,\n signal: turnOptions.signal,\n networkAccessEnabled: options?.networkAccessEnabled,\n webSearchEnabled: options?.webSearchEnabled,\n approvalPolicy: options?.approvalPolicy,\n additionalDirectories: options?.additionalDirectories,\n configOverrides: options?.configOverrides,\n });\n try {\n for await (const item of generator) {\n let parsed: ThreadEvent;\n try {\n parsed = JSON.parse(item) as ThreadEvent;\n } catch (error) {\n throw new Error(`Failed to parse item: ${item}`, { cause: error });\n }\n if (parsed.type === \"thread.started\") {\n this._id = parsed.thread_id;\n }\n yield parsed;\n }\n } finally {\n await cleanup();\n }\n }\n\n /** Provides the input to the agent and returns the completed turn. */\n async run(input: Input, turnOptions: TurnOptions = {}): Promise<Turn> {\n const generator = this.runStreamedInternal(input, turnOptions);\n const items: ThreadItem[] = [];\n let finalResponse: string = \"\";\n let usage: Usage | null = null;\n let turnFailure: ThreadError | null = null;\n for await (const event of generator) {\n if (event.type === \"item.completed\") {\n if (event.item.type === \"agent_message\") {\n finalResponse = event.item.text;\n }\n items.push(event.item);\n } else if (event.type === \"turn.completed\") {\n usage = event.usage;\n } else if (event.type === \"turn.failed\") {\n turnFailure = event.error;\n break;\n }\n }\n if (turnFailure) {\n throw new Error(turnFailure.message);\n }\n return { items, finalResponse, usage };\n }\n}\n\nfunction normalizeInput(input: Input): { prompt: string; images: string[] } {\n if (typeof input === \"string\") {\n return { prompt: input, images: [] };\n }\n const promptParts: string[] = [];\n const images: string[] = [];\n for (const item of input) {\n if (item.type === \"text\") {\n promptParts.push(item.text);\n } else if (item.type === \"local_image\") {\n images.push(item.path);\n }\n }\n return { prompt: promptParts.join(\"\\n\\n\"), images };\n}\n\nimport type { InitialMessage } from \"./threadOptions\";\n\n/**\n * Format initial messages into a structured prompt section.\n * Each message is wrapped with role markers to preserve semantic meaning.\n */\nfunction formatInitialMessages(messages: InitialMessage[]): string {\n return messages\n .map((msg) => {\n const roleLabel = msg.role.charAt(0).toUpperCase() + msg.role.slice(1);\n return `[${roleLabel}]\\n${msg.content}`;\n })\n .join(\"\\n\\n\");\n}\n","import { spawn } from \"node:child_process\";\nimport { existsSync, realpathSync } from \"node:fs\";\nimport path from \"node:path\";\nimport readline from \"node:readline\";\nimport { createRequire } from \"node:module\";\n\nimport { SandboxMode, ModelReasoningEffort, ApprovalMode } from \"./threadOptions\";\n\nexport type CodexExecArgs = {\n input: string;\n\n baseUrl?: string;\n apiKey?: string;\n threadId?: string | null;\n images?: string[];\n // --model\n model?: string;\n // --sandbox\n sandboxMode?: SandboxMode;\n // --cd\n workingDirectory?: string;\n // --add-dir\n additionalDirectories?: string[];\n // --skip-git-repo-check\n skipGitRepoCheck?: boolean;\n // --output-schema\n outputSchemaFile?: string;\n // --config model_reasoning_effort\n modelReasoningEffort?: ModelReasoningEffort;\n // AbortSignal to cancel the execution\n signal?: AbortSignal;\n // --config sandbox_workspace_write.network_access\n networkAccessEnabled?: boolean;\n // --config features.web_search_request\n webSearchEnabled?: boolean;\n // --config approval_policy\n approvalPolicy?: ApprovalMode;\n // Generic config overrides for `-c key=value`\n configOverrides?: Record<string, unknown>;\n};\n\nconst INTERNAL_ORIGINATOR_ENV = \"CODEX_INTERNAL_ORIGINATOR_OVERRIDE\";\nconst TYPESCRIPT_SDK_ORIGINATOR = \"codex_sdk_ts\";\nconst isDebugEnabled = process.env[\"DEBUG\"] === \"true\";\n\nexport class CodexExec {\n private executablePath: string;\n private envOverride?: Record<string, string>;\n\n constructor(executablePath: string | null = null, env?: Record<string, string>) {\n this.executablePath = executablePath || findCodexPath();\n this.envOverride = env;\n }\n\n async *run(args: CodexExecArgs): AsyncGenerator<string> {\n const commandArgs: string[] = [\"exec\", \"--experimental-json\"];\n\n if (args.model) {\n commandArgs.push(\"--model\", args.model);\n }\n\n if (args.sandboxMode) {\n commandArgs.push(\"--sandbox\", args.sandboxMode);\n }\n\n if (args.workingDirectory) {\n commandArgs.push(\"--cd\", args.workingDirectory);\n }\n\n if (args.additionalDirectories?.length) {\n for (const dir of args.additionalDirectories) {\n commandArgs.push(\"--add-dir\", dir);\n }\n }\n\n if (args.skipGitRepoCheck) {\n commandArgs.push(\"--skip-git-repo-check\");\n }\n\n if (args.outputSchemaFile) {\n commandArgs.push(\"--output-schema\", args.outputSchemaFile);\n }\n\n if (args.modelReasoningEffort) {\n commandArgs.push(\"--config\", `model_reasoning_effort=\"${args.modelReasoningEffort}\"`);\n }\n\n if (args.networkAccessEnabled !== undefined) {\n commandArgs.push(\n \"--config\",\n `sandbox_workspace_write.network_access=${args.networkAccessEnabled}`,\n );\n }\n\n if (args.webSearchEnabled !== undefined) {\n commandArgs.push(\"--config\", `features.web_search_request=${args.webSearchEnabled}`);\n }\n\n if (args.approvalPolicy) {\n commandArgs.push(\"--config\", `approval_policy=\"${args.approvalPolicy}\"`);\n }\n\n if (args.configOverrides) {\n for (const [key, value] of Object.entries(args.configOverrides)) {\n const formatted = formatConfigValue(value);\n commandArgs.push(\"--config\", `${key}=${formatted}`);\n }\n }\n\n if (args.images?.length) {\n for (const image of args.images) {\n commandArgs.push(\"--image\", image);\n }\n }\n\n if (args.threadId) {\n commandArgs.push(\"resume\", args.threadId);\n }\n\n if (isDebugEnabled) {\n console.log(\"[CodexExec] Executable path:\", this.executablePath);\n console.log(\"[CodexExec] Command arguments:\", commandArgs);\n }\n\n const env: Record<string, string> = {};\n if (this.envOverride) {\n Object.assign(env, this.envOverride);\n const hasPathKey = Object.keys(env).some((key) => key.toUpperCase() === \"PATH\");\n if (!hasPathKey) {\n const inheritedPathKey = Object.keys(process.env).find((key) => key.toUpperCase() === \"PATH\");\n if (inheritedPathKey && process.env[inheritedPathKey]) {\n env.PATH = process.env[inheritedPathKey]!;\n }\n }\n } else {\n for (const [key, value] of Object.entries(process.env)) {\n if (value !== undefined) {\n env[key] = value;\n }\n }\n }\n if (!env[INTERNAL_ORIGINATOR_ENV]) {\n env[INTERNAL_ORIGINATOR_ENV] = TYPESCRIPT_SDK_ORIGINATOR;\n }\n if (args.baseUrl) {\n env.OPENAI_BASE_URL = args.baseUrl;\n }\n if (args.apiKey) {\n env.CODEX_API_KEY = args.apiKey;\n }\n\n const child = spawn(this.executablePath, commandArgs, {\n env,\n signal: args.signal,\n });\n\n let spawnError: unknown | null = null;\n child.once(\"error\", (err) => (spawnError = err));\n\n if (!child.stdin) {\n child.kill();\n throw new Error(\"Child process has no stdin\");\n }\n child.stdin.write(args.input);\n child.stdin.end();\n\n if (!child.stdout) {\n child.kill();\n throw new Error(\"Child process has no stdout\");\n }\n const stderrChunks: Buffer[] = [];\n\n if (child.stderr) {\n child.stderr.on(\"data\", (data) => {\n stderrChunks.push(data);\n });\n }\n\n const rl = readline.createInterface({\n input: child.stdout,\n crlfDelay: Infinity,\n });\n\n try {\n for await (const line of rl) {\n // `line` is a string (Node sets default encoding to utf8 for readline)\n yield line as string;\n }\n\n const exitCode = new Promise((resolve, reject) => {\n child.once(\"exit\", (code) => {\n if (code === 0) {\n resolve(code);\n } else {\n const stderrBuffer = Buffer.concat(stderrChunks);\n reject(\n new Error(`Codex Exec exited with code ${code}: ${stderrBuffer.toString(\"utf8\")}`),\n );\n }\n });\n });\n\n if (spawnError) throw spawnError;\n await exitCode;\n } finally {\n rl.close();\n child.removeAllListeners();\n try {\n if (!child.killed) child.kill();\n } catch {\n // ignore\n }\n }\n }\n}\n\nconst moduleRequire = createRequire(import.meta.url);\n\nfunction findCodexPath() {\n // `@openai/codex-sdk` provides a `codex` executable shim under\n // `@openai/codex-sdk/node_modules/.bin/codex`, which in turn launches\n // `@openai/codex/bin/codex.js` and the platform-specific native binary.\n //\n // IMPORTANT: in pnpm workspaces, the path we find here is often a symlink\n // (e.g. `packages/*/node_modules/...`). The shim script uses `$0` to compute\n // relative paths into pnpm's `.pnpm/` store, so we must spawn the *realpath*\n // of the shim or it will look in the wrong place (leading to ENOENT / MODULE_NOT_FOUND).\n\n const candidates =\n process.platform === \"win32\" ? [\"codex.cmd\", \"codex.ps1\", \"codex\"] : [\"codex\"];\n\n const searchPaths = moduleRequire.resolve.paths(\"@openai/codex-sdk\") ?? [];\n for (const basePath of searchPaths) {\n if (!basePath) continue;\n const codexSdkPackageRoot = path.join(basePath, \"@openai\", \"codex-sdk\");\n if (!existsSync(path.join(codexSdkPackageRoot, \"package.json\"))) {\n continue;\n }\n\n for (const binName of candidates) {\n const binPath = path.join(codexSdkPackageRoot, \"node_modules\", \".bin\", binName);\n if (!existsSync(binPath)) continue;\n return realpathSync(binPath);\n }\n }\n\n throw new Error(\n `[Codex SDK] Unable to locate the Codex CLI entrypoint installed by @openai/codex-sdk. ` +\n `Try re-running \\`pnpm install\\` and ensure optional dependencies are enabled.`,\n );\n}\n\nfunction formatConfigValue(value: unknown): string {\n if (typeof value === \"string\") {\n return JSON.stringify(value);\n }\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return String(value);\n }\n if (value === null || value === undefined) {\n return \"null\";\n }\n try {\n return JSON.stringify(value);\n } catch {\n return JSON.stringify(String(value));\n }\n}\n","import { CodexOptions } from \"./codexOptions\";\nimport { CodexExec } from \"./exec\";\nimport { Thread } from \"./thread\";\nimport { ThreadOptions } from \"./threadOptions\";\n\n/**\n * Codex is the main class for interacting with the Codex agent.\n *\n * Use the `startThread()` method to start a new thread or `resumeThread()` to resume a previously started thread.\n */\nexport class Codex {\n private exec: CodexExec;\n private options: CodexOptions;\n\n constructor(options: CodexOptions = {}) {\n this.exec = new CodexExec(options.codexPathOverride, options.env);\n this.options = options;\n }\n\n /**\n * Starts a new conversation with an agent.\n * @returns A new thread instance.\n */\n startThread(options: ThreadOptions = {}): Thread {\n return new Thread(this.exec, this.options, options);\n }\n\n /**\n * Resumes a conversation with an agent based on the thread id.\n * Threads are persisted in ~/.codex/sessions.\n *\n * @param id The id of the thread to resume.\n * @returns A new thread instance.\n */\n resumeThread(id: string, options: ThreadOptions = {}): Thread {\n return new Thread(this.exec, this.options, options, id);\n }\n}\n"],"mappings":";;;AAAA,SAAS,YAAY,UAAU;AAC/B,OAAO,QAAQ;AACf,OAAO,UAAU;AEFjB,SAAS,aAAa;AACtB,SAAS,YAAY,oBAAoB;AACzC,OAAOA,WAAU;AACjB,OAAO,cAAc;AACrB,SAAS,qBAAqB;AFK9B,eAAsB,uBAAuB,QAA4C;AACvF,MAAI,WAAW,QAAW;AACxB,WAAO,EAAE,SAAS,YAAY;IAAC,EAAE;EACnC;AAEA,MAAI,CAAC,aAAa,MAAM,GAAG;AACzB,UAAM,IAAI,MAAM,0CAA0C;EAC5D;AAEA,QAAM,YAAY,MAAM,GAAG,QAAQ,KAAK,KAAK,GAAG,OAAO,GAAG,sBAAsB,CAAC;AACjF,QAAM,aAAa,KAAK,KAAK,WAAW,aAAa;AACrD,QAAM,UAAU,YA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