@agentchatme/codex 0.7.0 → 0.7.1
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/daemon-main.js +87 -25
- package/dist/daemon-main.js.map +1 -1
- package/dist/index.js +108 -27
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4244,7 +4244,7 @@ var init_wrapper = __esm({
|
|
|
4244
4244
|
import * as fs10 from "fs";
|
|
4245
4245
|
import { parseArgs } from "util";
|
|
4246
4246
|
|
|
4247
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.7.
|
|
4247
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.7.1/node_modules/@agentchatme/agent-core/dist/chunk-5KMQ23O6.js
|
|
4248
4248
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
4249
4249
|
import { randomBytes } from "crypto";
|
|
4250
4250
|
import * as fs from "fs";
|
|
@@ -4252,6 +4252,7 @@ import * as path from "path";
|
|
|
4252
4252
|
import * as fs2 from "fs";
|
|
4253
4253
|
import * as os from "os";
|
|
4254
4254
|
import * as path2 from "path";
|
|
4255
|
+
import { spawn as nodeSpawn } from "child_process";
|
|
4255
4256
|
var __defProp2 = Object.defineProperty;
|
|
4256
4257
|
var __export2 = (target, all) => {
|
|
4257
4258
|
for (var name in all)
|
|
@@ -4607,7 +4608,7 @@ function runSpawned(spec, captureBytes) {
|
|
|
4607
4608
|
} catch {
|
|
4608
4609
|
}
|
|
4609
4610
|
};
|
|
4610
|
-
const classify = (code, signal, note) => {
|
|
4611
|
+
const classify = (code, signal, note, exitedAt) => {
|
|
4611
4612
|
const tail = redactDiagnostic(stderrTail);
|
|
4612
4613
|
const extra = `${note ? ` (${note})` : ""}${tail ? `: ${tail}` : ""}`;
|
|
4613
4614
|
if (timedOut) {
|
|
@@ -4620,9 +4621,10 @@ function runSpawned(spec, captureBytes) {
|
|
|
4620
4621
|
if (code === 0) return note ? { state: "ok", exitCode: 0, detail: note } : { state: "ok", exitCode: 0 };
|
|
4621
4622
|
const exit = code === null ? `signal ${signal ?? "unknown"}` : `exit ${code}`;
|
|
4622
4623
|
if (stdoutBytes === 0) {
|
|
4623
|
-
const ranMs = spawnedAt === null ? 0 :
|
|
4624
|
+
const ranMs = spawnedAt === null ? 0 : Math.max(0, exitedAt - spawnedAt);
|
|
4624
4625
|
if (spawnedAt !== null && ranMs >= notStartedWithinMs) {
|
|
4625
|
-
|
|
4626
|
+
const refused = tail.includes("API Error");
|
|
4627
|
+
return { state: "failed", ...refused ? {} : { silent: true }, exitCode: code, detail: `${exit} after ${Math.round(ranMs / 1e3)} s with nothing on stdout (it ran, then ended)${extra}` };
|
|
4626
4628
|
}
|
|
4627
4629
|
return { state: "not_started", exitCode: code, detail: `${exit} with nothing on stdout${extra}` };
|
|
4628
4630
|
}
|
|
@@ -4633,7 +4635,8 @@ function runSpawned(spec, captureBytes) {
|
|
|
4633
4635
|
return;
|
|
4634
4636
|
}
|
|
4635
4637
|
try {
|
|
4636
|
-
|
|
4638
|
+
const spawner = spec.shell === true ? nodeSpawn : spawnCommand;
|
|
4639
|
+
child = spawner(spec.command, [...spec.args], {
|
|
4637
4640
|
cwd: spec.cwd,
|
|
4638
4641
|
env: spec.env,
|
|
4639
4642
|
stdio: [spec.stdin === null ? "ignore" : "pipe", "pipe", "pipe"],
|
|
@@ -4726,18 +4729,19 @@ function runSpawned(spec, captureBytes) {
|
|
|
4726
4729
|
classify(
|
|
4727
4730
|
exited.code,
|
|
4728
4731
|
exited.signal,
|
|
4729
|
-
process.platform === "win32" ? "a process the run started kept its output open after it exited; its children were swept (taskkill) and the run detached from it \u2014 a process the sweep cannot see can survive" : "a process the run started kept its output open after it exited; the run's process group was signalled (SIGKILL) and the run detached from it \u2014 a process that left the group can survive"
|
|
4732
|
+
process.platform === "win32" ? "a process the run started kept its output open after it exited; its children were swept (taskkill) and the run detached from it \u2014 a process the sweep cannot see can survive" : "a process the run started kept its output open after it exited; the run's process group was signalled (SIGKILL) and the run detached from it \u2014 a process that left the group can survive",
|
|
4733
|
+
exited.at
|
|
4730
4734
|
)
|
|
4731
4735
|
);
|
|
4732
4736
|
});
|
|
4733
4737
|
});
|
|
4734
4738
|
proc.on("close", (code, signal) => {
|
|
4735
|
-
finish(classify(code, signal, null));
|
|
4739
|
+
finish(classify(code, signal, null, exited?.at ?? Date.now()));
|
|
4736
4740
|
});
|
|
4737
4741
|
});
|
|
4738
4742
|
}
|
|
4739
4743
|
|
|
4740
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.7.
|
|
4744
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.7.1/node_modules/@agentchatme/agent-core/dist/chunk-AQTRC7G4.js
|
|
4741
4745
|
import * as path3 from "path";
|
|
4742
4746
|
|
|
4743
4747
|
// node_modules/.pnpm/agentchatme@1.5.0_ws@8.21.1/node_modules/agentchatme/dist/index.js
|
|
@@ -11727,7 +11731,7 @@ var DAY = 24 * HOUR;
|
|
|
11727
11731
|
var INBOX_TRAY_MAX_LIMIT = 50;
|
|
11728
11732
|
var MAX_ATTACHMENT_SIZE = 25 * 1024 * 1024;
|
|
11729
11733
|
|
|
11730
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.7.
|
|
11734
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.7.1/node_modules/@agentchatme/agent-core/dist/chunk-AQTRC7G4.js
|
|
11731
11735
|
import * as fs3 from "fs";
|
|
11732
11736
|
import * as path22 from "path";
|
|
11733
11737
|
import { createHash } from "crypto";
|
|
@@ -16206,6 +16210,21 @@ function integrationStatusAge(status, now2 = Date.now()) {
|
|
|
16206
16210
|
const t = Date.parse(status.updated_at);
|
|
16207
16211
|
return Number.isNaN(t) ? null : Math.max(0, now2 - t);
|
|
16208
16212
|
}
|
|
16213
|
+
var INTEGRATION_STATUS_STALE_MS = 3 * 6e4;
|
|
16214
|
+
function integrationStatusFresh(status, now2 = Date.now()) {
|
|
16215
|
+
const age = integrationStatusAge(status, now2);
|
|
16216
|
+
return age !== null && age <= INTEGRATION_STATUS_STALE_MS;
|
|
16217
|
+
}
|
|
16218
|
+
function integrationStatusStaleFor(status, now2 = Date.now()) {
|
|
16219
|
+
const age = integrationStatusAge(status, now2);
|
|
16220
|
+
return age === null ? "an unknown time" : forWhile(age);
|
|
16221
|
+
}
|
|
16222
|
+
function forWhile(ms) {
|
|
16223
|
+
if (ms < 9e4) return "about a minute";
|
|
16224
|
+
if (ms < 45 * 6e4) return `${Math.round(ms / 6e4)} minutes`;
|
|
16225
|
+
if (ms < 36 * 36e5) return `${Math.round(ms / 36e5)} hour(s)`;
|
|
16226
|
+
return `${Math.round(ms / 864e5)} day(s)`;
|
|
16227
|
+
}
|
|
16209
16228
|
function ago(ms) {
|
|
16210
16229
|
if (ms < 45e3) return "just now";
|
|
16211
16230
|
if (ms < 9e4) return "1 minute ago";
|
|
@@ -16272,7 +16291,7 @@ function textsLine(texts, now2) {
|
|
|
16272
16291
|
function formatIntegrationStatus(status, now2 = Date.now()) {
|
|
16273
16292
|
if (status === null) return ["Integration: no status recorded yet (the daemon has not run, or is still starting)"];
|
|
16274
16293
|
const age = integrationStatusAge(status, now2);
|
|
16275
|
-
const stale = age !== null && age >
|
|
16294
|
+
const stale = age !== null && age > INTEGRATION_STATUS_STALE_MS;
|
|
16276
16295
|
const standby = status.standby ?? null;
|
|
16277
16296
|
const failing = status.runs_failing ?? null;
|
|
16278
16297
|
const unservable = status.unservable ?? null;
|
|
@@ -16476,8 +16495,8 @@ function agentLockDir(env = process.env, system = process.platform, home = os22.
|
|
|
16476
16495
|
return p.join(home, ".local", "state", "agentchat", "locks");
|
|
16477
16496
|
}
|
|
16478
16497
|
|
|
16479
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.7.
|
|
16480
|
-
var VERSION2 = "0.7.
|
|
16498
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.7.1/node_modules/@agentchatme/agent-core/dist/chunk-4PCDVXAR.js
|
|
16499
|
+
var VERSION2 = "0.7.1";
|
|
16481
16500
|
var HOSTED_MCP_PATH2 = integration_exports.HOSTED_MCP_PATH;
|
|
16482
16501
|
function hostedMcpUrl2(apiBase) {
|
|
16483
16502
|
return integration_exports.hostedMcpUrl(apiBase);
|
|
@@ -16553,7 +16572,7 @@ function runProbe(command, args, options) {
|
|
|
16553
16572
|
});
|
|
16554
16573
|
}
|
|
16555
16574
|
|
|
16556
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.7.
|
|
16575
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.7.1/node_modules/@agentchatme/agent-core/dist/index.js
|
|
16557
16576
|
import * as fs5 from "fs";
|
|
16558
16577
|
import * as path6 from "path";
|
|
16559
16578
|
import * as readline from "readline";
|
|
@@ -17517,11 +17536,17 @@ The key was not saved.`);
|
|
|
17517
17536
|
if (paused !== null) {
|
|
17518
17537
|
checks.push({ name: "could-not-process", verdict: "WARN", detail: paused.replace(/^could not process: /, "") });
|
|
17519
17538
|
} else if (lastCheck !== null && runtimeCheckFailingNow(integration)) {
|
|
17520
|
-
checks.push(
|
|
17521
|
-
|
|
17522
|
-
|
|
17523
|
-
|
|
17524
|
-
|
|
17539
|
+
checks.push(
|
|
17540
|
+
integrationStatusFresh(integration) ? {
|
|
17541
|
+
name: "could-not-process",
|
|
17542
|
+
verdict: "WARN",
|
|
17543
|
+
detail: `the runtime check failed (${lastCheck.detail ?? "no detail"}; ${lastCheck.at}): while it fails, a conversation whose run fails is not reported, its card stays on the tray and the server wakes the agent again`
|
|
17544
|
+
} : {
|
|
17545
|
+
name: "could-not-process",
|
|
17546
|
+
verdict: "WARN",
|
|
17547
|
+
detail: `the daemon has not written its status for ${integrationStatusStaleFor(integration)} \u2014 it may be down (a running daemon rewrites it every 30 s); the runtime check that failed at ${lastCheck.at} says nothing about now`
|
|
17548
|
+
}
|
|
17549
|
+
);
|
|
17525
17550
|
} else if (counts !== null) {
|
|
17526
17551
|
checks.push({ name: "could-not-process", verdict: "PASS", detail: counts.replace(/^could not process: /, "") });
|
|
17527
17552
|
}
|
|
@@ -18179,7 +18204,7 @@ import * as os4 from "os";
|
|
|
18179
18204
|
import * as path7 from "path";
|
|
18180
18205
|
|
|
18181
18206
|
// src/version.ts
|
|
18182
|
-
var VERSION3 = "0.7.
|
|
18207
|
+
var VERSION3 = "0.7.1";
|
|
18183
18208
|
|
|
18184
18209
|
// src/host.ts
|
|
18185
18210
|
function codexHome() {
|
|
@@ -18841,7 +18866,7 @@ function formatPlacement(steps) {
|
|
|
18841
18866
|
// src/identity.ts
|
|
18842
18867
|
import * as path13 from "path";
|
|
18843
18868
|
|
|
18844
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.7.
|
|
18869
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.7.1/node_modules/@agentchatme/agent-core/dist/presets.js
|
|
18845
18870
|
import * as fs24 from "fs";
|
|
18846
18871
|
import * as os5 from "os";
|
|
18847
18872
|
import * as path11 from "path";
|
|
@@ -19175,8 +19200,18 @@ function claudeProfileArgs(profile2, workdir) {
|
|
|
19175
19200
|
}
|
|
19176
19201
|
var RUNTIME_CHECK_SETTINGS = JSON.stringify({
|
|
19177
19202
|
env: { CLAUDE_CODE_DISABLE_CLAUDE_MDS: "1", CLAUDE_CODE_DISABLE_AUTO_MEMORY: "1" },
|
|
19178
|
-
disableAllHooks: true
|
|
19203
|
+
disableAllHooks: true,
|
|
19204
|
+
verbose: false,
|
|
19205
|
+
viewMode: "default",
|
|
19206
|
+
language: "english"
|
|
19179
19207
|
});
|
|
19208
|
+
function lastResultMessage(messages) {
|
|
19209
|
+
for (let i = messages.length - 1; i >= 0; i -= 1) {
|
|
19210
|
+
const m = messages[i];
|
|
19211
|
+
if (m !== null && typeof m === "object" && !Array.isArray(m) && m["type"] === "result") return m;
|
|
19212
|
+
}
|
|
19213
|
+
return null;
|
|
19214
|
+
}
|
|
19180
19215
|
function claudeRuntimeCheckJudge(stdout) {
|
|
19181
19216
|
const text2 = stdout.trim();
|
|
19182
19217
|
let parsed = null;
|
|
@@ -19188,9 +19223,22 @@ function claudeRuntimeCheckJudge(stdout) {
|
|
|
19188
19223
|
parsed = null;
|
|
19189
19224
|
}
|
|
19190
19225
|
}
|
|
19226
|
+
if (Array.isArray(parsed)) {
|
|
19227
|
+
parsed = lastResultMessage(parsed);
|
|
19228
|
+
if (parsed === null) return "its answer is a list of messages with no result";
|
|
19229
|
+
}
|
|
19191
19230
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return "its answer is not a JSON result";
|
|
19192
19231
|
const r = parsed;
|
|
19193
|
-
if (r["type"] === "result" && r["subtype"] === "success" && r["is_error"] === false)
|
|
19232
|
+
if (r["type"] === "result" && r["subtype"] === "success" && r["is_error"] === false) {
|
|
19233
|
+
const turns = r["num_turns"];
|
|
19234
|
+
if (typeof turns !== "number" || !(turns >= 1)) return `the result has no turn (num_turns ${typeof turns === "number" ? turns : "?"})`;
|
|
19235
|
+
const usage = r["usage"];
|
|
19236
|
+
if (usage !== void 0 && usage !== null) {
|
|
19237
|
+
const tokens = typeof usage === "object" && !Array.isArray(usage) ? usage["output_tokens"] : void 0;
|
|
19238
|
+
if (typeof tokens !== "number" || !(tokens >= 1)) return `the result has no output (usage.output_tokens ${typeof tokens === "number" ? tokens : "?"})`;
|
|
19239
|
+
}
|
|
19240
|
+
return null;
|
|
19241
|
+
}
|
|
19194
19242
|
const facts = [
|
|
19195
19243
|
`type ${typeof r["type"] === "string" ? r["type"] : "?"}`,
|
|
19196
19244
|
`subtype ${typeof r["subtype"] === "string" ? r["subtype"] : "?"}`,
|
|
@@ -19676,8 +19724,6 @@ function codexRuntimeCheckArgs(dir, agentchatUrl) {
|
|
|
19676
19724
|
"--sandbox",
|
|
19677
19725
|
"read-only",
|
|
19678
19726
|
"-c",
|
|
19679
|
-
'model_reasoning_effort="low"',
|
|
19680
|
-
"-c",
|
|
19681
19727
|
'web_search="disabled"',
|
|
19682
19728
|
...CODEX_RUNTIME_CHECK_DISABLED_FEATURES.flatMap((feature) => ["--disable", feature]),
|
|
19683
19729
|
...agentchatUrl !== void 0 ? ["-c", `${table}.url=${JSON.stringify(agentchatUrl)}`] : [],
|
|
@@ -19689,6 +19735,37 @@ function codexRuntimeCheckArgs(dir, agentchatUrl) {
|
|
|
19689
19735
|
function codexRuntimeCheckWorkdir(codexHome2) {
|
|
19690
19736
|
return path24.join(codexHome2, RUNTIME_CHECK_DIR);
|
|
19691
19737
|
}
|
|
19738
|
+
function jsonObject(value) {
|
|
19739
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
19740
|
+
}
|
|
19741
|
+
function codexRuntimeCheckJudge(stdout) {
|
|
19742
|
+
let events = 0;
|
|
19743
|
+
let completed = false;
|
|
19744
|
+
let failed = false;
|
|
19745
|
+
let answered = false;
|
|
19746
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
19747
|
+
if (line.trim().length === 0) continue;
|
|
19748
|
+
let event;
|
|
19749
|
+
try {
|
|
19750
|
+
event = jsonObject(JSON.parse(line));
|
|
19751
|
+
} catch {
|
|
19752
|
+
continue;
|
|
19753
|
+
}
|
|
19754
|
+
if (event === null) continue;
|
|
19755
|
+
events += 1;
|
|
19756
|
+
if (event["type"] === "turn.completed") completed = true;
|
|
19757
|
+
else if (event["type"] === "turn.failed") failed = true;
|
|
19758
|
+
else if (event["type"] === "item.completed") {
|
|
19759
|
+
const item = jsonObject(event["item"]);
|
|
19760
|
+
if (item !== null && item["type"] === "agent_message" && typeof item["text"] === "string" && item["text"].trim().length > 0) answered = true;
|
|
19761
|
+
}
|
|
19762
|
+
}
|
|
19763
|
+
if (events === 0) return "its answer holds no JSON event";
|
|
19764
|
+
if (failed) return "the turn failed (turn.failed)";
|
|
19765
|
+
if (!completed) return "the turn did not complete (no turn.completed)";
|
|
19766
|
+
if (!answered) return "the turn completed with no agent message";
|
|
19767
|
+
return null;
|
|
19768
|
+
}
|
|
19692
19769
|
function codexClientHeadersToml(clientVersion = VERSION2) {
|
|
19693
19770
|
const pairs = Object.entries(clientHeadersOf({ runtime: "codex", version: clientVersion })).map(([name, value]) => `${JSON.stringify(name)} = ${JSON.stringify(value)}`);
|
|
19694
19771
|
return `{ ${pairs.join(", ")} }`;
|
|
@@ -20014,9 +20091,11 @@ var CodexRunner = class {
|
|
|
20014
20091
|
/**
|
|
20015
20092
|
* Does the model answer right now, through this runner's binary, sign-in,
|
|
20016
20093
|
* CODEX_HOME and environment? One `codex exec` with a fixed prompt in its
|
|
20017
|
-
* own empty folder, read-only, with the hosted AgentChat server switched
|
|
20018
|
-
*
|
|
20019
|
-
*
|
|
20094
|
+
* own empty folder, read-only, with the hosted AgentChat server switched
|
|
20095
|
+
* off and the user's hooks on, as in the runs (`codexRuntimeCheckArgs`),
|
|
20096
|
+
* and no key in its environment; ok only on exit 0 with a completed turn
|
|
20097
|
+
* that holds an agent message (`codexRuntimeCheckJudge`). Its output is
|
|
20098
|
+
* read for that alone and never logged. Never throws.
|
|
20020
20099
|
*/
|
|
20021
20100
|
async checkRuntime(options = {}) {
|
|
20022
20101
|
if (this.options.refuse !== void 0) return { ok: false, detail: this.options.refuse };
|
|
@@ -20029,6 +20108,8 @@ var CodexRunner = class {
|
|
|
20029
20108
|
// The runs' environment; runRuntimeCheck takes every key variable out, this runner's own included.
|
|
20030
20109
|
env: this.env(),
|
|
20031
20110
|
keyEnv: this.options.keyEnv,
|
|
20111
|
+
// Exit 0 is not enough: the events must show a completed turn with the model's answer.
|
|
20112
|
+
judge: codexRuntimeCheckJudge,
|
|
20032
20113
|
...options.signal !== void 0 ? { signal: options.signal } : {}
|
|
20033
20114
|
});
|
|
20034
20115
|
}
|