@agentchatme/agent-core 0.7.0 → 0.7.3
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/README.md +35 -11
- package/dist/{chunk-C2ARQLZ7.js → chunk-5KMQ23O6.js} +11 -7
- package/dist/chunk-5KMQ23O6.js.map +1 -0
- package/dist/{chunk-PTKQIKCI.js → chunk-7TTV2CQX.js} +3 -3
- package/dist/{chunk-PTKQIKCI.js.map → chunk-7TTV2CQX.js.map} +1 -1
- package/dist/{chunk-NYSMAN4N.js → chunk-FPAOQGMV.js} +534 -78
- package/dist/chunk-FPAOQGMV.js.map +1 -0
- package/dist/daemon-entry.d.ts +56 -7
- package/dist/daemon-entry.js +81 -10
- package/dist/daemon-entry.js.map +1 -1
- package/dist/index.d.ts +143 -51
- package/dist/index.js +180 -309
- package/dist/index.js.map +1 -1
- package/dist/presets.d.ts +65 -19
- package/dist/presets.js +66 -9
- package/dist/presets.js.map +1 -1
- package/dist/{runner-BjCgl4bV.d.ts → runner-BLvFalN4.d.ts} +17 -5
- package/dist/{served-manual-RAIaRcr2.d.ts → served-manual-CwxBzpwQ.d.ts} +199 -4
- package/package.json +2 -2
- package/dist/chunk-C2ARQLZ7.js.map +0 -1
- package/dist/chunk-NYSMAN4N.js.map +0 -1
package/dist/presets.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextsRuntime } from 'agentchatme';
|
|
2
|
-
import { a as RunProfile, b as RunRunner, f as RunPreflight, q as RunPreflightOptions, g as RunRequest, c as RunOutcome } from './runner-
|
|
2
|
+
import { a as RunProfile, b as RunRunner, f as RunPreflight, q as RunPreflightOptions, g as RunRequest, c as RunOutcome } from './runner-BLvFalN4.js';
|
|
3
3
|
|
|
4
4
|
/** What a preset needs to build a runner acting as one agent. */
|
|
5
5
|
interface PresetContext {
|
|
@@ -304,18 +304,47 @@ interface ClaudeRunArgOptions {
|
|
|
304
304
|
}
|
|
305
305
|
/**
|
|
306
306
|
* The `--settings` a runtime check is given: no hook of the user's (or a
|
|
307
|
-
* workdir repository's) fires on a health check,
|
|
307
|
+
* workdir repository's) fires on a health check, the two `ANSWER_ENV`
|
|
308
308
|
* switches again (a settings file's `env` overrides the process environment;
|
|
309
|
-
* `--settings` outranks user, project and local settings)
|
|
310
|
-
* (`claude --help`: a settings value that fails validation is
|
|
311
|
-
* in print mode).
|
|
309
|
+
* `--settings` outranks user, project and local settings), and verbose output
|
|
310
|
+
* off. A constant (`claude --help`: a settings value that fails validation is
|
|
311
|
+
* silently ignored in print mode).
|
|
312
|
+
*
|
|
313
|
+
* verbose: false, viewMode: "default" with verbose on (the user's `verbose`
|
|
314
|
+
* setting or its older `~/.claude.json` copy, or `viewMode: "verbose"`),
|
|
315
|
+
* `--output-format json` prints a JSON array of every message instead of
|
|
316
|
+
* the one result object. Both keys are documented settings
|
|
317
|
+
* (settings-reference.md: `viewMode` overrides `verbose`; only the
|
|
318
|
+
* `--verbose` flag, never passed here, outranks them). `verbose` is a
|
|
319
|
+
* settings key since 2.1.119, below the floor; `viewMode` is newer, and a
|
|
320
|
+
* version that does not know it ignores just that key (seen on 2.1.328:
|
|
321
|
+
* an unknown key or an invalid value leaves the rest of `--settings` in
|
|
322
|
+
* force, hooks off included). Managed settings outrank `--settings`, so
|
|
323
|
+
* the judge reads the array too (`claudeRuntimeCheckJudge`).
|
|
324
|
+
*
|
|
325
|
+
* language: "english" the user's `language` setting is an instruction to
|
|
326
|
+
* answer in that language; the fixed prompt is English, and the check
|
|
327
|
+
* is answered as written (`--settings` outranks the user's value).
|
|
328
|
+
*
|
|
329
|
+
* Verified on 2.1.328 against a stand-in provider: with the user's `verbose:
|
|
330
|
+
* true`, `viewMode: "verbose"` or the `~/.claude.json` `verbose`, settings
|
|
331
|
+
* without the two verbose keys printed an array; with them, one result object.
|
|
312
332
|
*/
|
|
313
333
|
declare const RUNTIME_CHECK_SETTINGS: string;
|
|
314
334
|
/**
|
|
315
335
|
* Whether a runtime check's stdout (`--output-format json`) is a good answer:
|
|
316
|
-
* null when
|
|
317
|
-
*
|
|
318
|
-
*
|
|
336
|
+
* null when its result has `type: "result"`, `subtype: "success"`,
|
|
337
|
+
* `is_error: false`, at least one turn (`num_turns >= 1`: a run a hook
|
|
338
|
+
* blocked before the model has none) and, when it carries `usage`, at least
|
|
339
|
+
* one output token (`usage.output_tokens >= 1`); otherwise why not, in ids,
|
|
340
|
+
* flags and counts only (`is_error`, `api_error_status`, `terminal_reason`,
|
|
341
|
+
* `num_turns`, `output_tokens`), never the result text. It is judged by its
|
|
342
|
+
* shape, never by its words: a model may answer "Okay", or in the user's
|
|
343
|
+
* language. The result is the one object Claude Code prints, or, with verbose
|
|
344
|
+
* output on (the `--verbose` flag, the `verbose` or `viewMode` setting), the
|
|
345
|
+
* last `type: "result"` element of the JSON array it prints instead. A false
|
|
346
|
+
* pass is the dangerous direction (an outage reported as one conversation's
|
|
347
|
+
* failure hides its messages), so anything short of all of that is not ok.
|
|
319
348
|
*/
|
|
320
349
|
declare function claudeRuntimeCheckJudge(stdout: string): string | null;
|
|
321
350
|
/**
|
|
@@ -545,20 +574,35 @@ declare const CODEX_ANSWER_FILESYSTEM = "{ \":workspace_roots\" = \"read\" }";
|
|
|
545
574
|
*/
|
|
546
575
|
declare const CODEX_ANSWER_DISABLED_FEATURES: readonly ["shell_tool", "view_image", "image_generation", "plugins", "apps", "memories", "browser_use", "browser_use_external", "computer_use", "in_app_browser"];
|
|
547
576
|
declare function codexProfileArgs(profile: RunProfile): string[];
|
|
548
|
-
/**
|
|
577
|
+
/**
|
|
578
|
+
* The features a runtime check turns off, as an `answer` run does (names at
|
|
579
|
+
* the 0.154.0 floor, `codex features list`). Not `hooks`: a user's hook that
|
|
580
|
+
* breaks every run must fail the check too (see the header).
|
|
581
|
+
*/
|
|
549
582
|
declare const CODEX_RUNTIME_CHECK_DISABLED_FEATURES: readonly ["memories", "plugins", "apps"];
|
|
550
583
|
/**
|
|
551
584
|
* The argv of a runtime check: `codex exec` in `dir` (an empty folder), the
|
|
552
|
-
* read-only sandbox, no session files,
|
|
553
|
-
*
|
|
554
|
-
* off for it;
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
585
|
+
* read-only sandbox, no session files, no web search, memories, plugins or
|
|
586
|
+
* connectors (the user's hooks stay on, as in the runs), and the hosted
|
|
587
|
+
* AgentChat server switched off for it;
|
|
588
|
+
* the prompt on stdin, as for a run. The model and its reasoning effort are
|
|
589
|
+
* the runs' (see the header). `agentchatUrl` is the URL the runs pin (with
|
|
590
|
+
* it, the `agentchat` table stays valid whether or not a config layer defines
|
|
591
|
+
* one); without it a config layer must define the table, as the runs need.
|
|
558
592
|
*/
|
|
559
593
|
declare function codexRuntimeCheckArgs(dir: string, agentchatUrl?: string): string[];
|
|
560
594
|
/** The empty folder a runtime check runs in, under CODEX_HOME. */
|
|
561
595
|
declare function codexRuntimeCheckWorkdir(codexHome: string): string;
|
|
596
|
+
/**
|
|
597
|
+
* Whether a runtime check's stdout (`codex exec --json`: one event per line,
|
|
598
|
+
* exec/src/exec_events.rs) is a good answer: null when it holds a
|
|
599
|
+
* `turn.completed` event and an `item.completed` whose item is an
|
|
600
|
+
* `agent_message` with text, and no `turn.failed`; otherwise why not, in event
|
|
601
|
+
* types only, never a message or an error's text. Exit 0 alone is not an
|
|
602
|
+
* answer. A line that is not a JSON object is skipped (a cut-off last line
|
|
603
|
+
* included: its events are then missing, and the check is not ok).
|
|
604
|
+
*/
|
|
605
|
+
declare function codexRuntimeCheckJudge(stdout: string): string | null;
|
|
562
606
|
/** Where a run's hosted tool server points, and which variable carries its bearer token. */
|
|
563
607
|
interface CodexMcpOverride {
|
|
564
608
|
readonly url: string;
|
|
@@ -771,9 +815,11 @@ declare class CodexRunner implements RunRunner {
|
|
|
771
815
|
/**
|
|
772
816
|
* Does the model answer right now, through this runner's binary, sign-in,
|
|
773
817
|
* CODEX_HOME and environment? One `codex exec` with a fixed prompt in its
|
|
774
|
-
* own empty folder, read-only, with the hosted AgentChat server switched
|
|
775
|
-
*
|
|
776
|
-
*
|
|
818
|
+
* own empty folder, read-only, with the hosted AgentChat server switched
|
|
819
|
+
* off and the user's hooks on, as in the runs (`codexRuntimeCheckArgs`),
|
|
820
|
+
* and no key in its environment; ok only on exit 0 with a completed turn
|
|
821
|
+
* that holds an agent message (`codexRuntimeCheckJudge`). Its output is
|
|
822
|
+
* read for that alone and never logged. Never throws.
|
|
777
823
|
*/
|
|
778
824
|
checkRuntime(options?: RunPreflightOptions): Promise<RunPreflight>;
|
|
779
825
|
start(request: RunRequest): Promise<RunOutcome>;
|
|
@@ -808,4 +854,4 @@ declare const PRESETS: Readonly<Record<string, Preset>>;
|
|
|
808
854
|
declare function presetNamed(name: string): Preset | null;
|
|
809
855
|
declare function presetNames(): string[];
|
|
810
856
|
|
|
811
|
-
export { AGENTCHAT_TOOL_ALLOW, ANSWER_DENIED_TOOLS, ANSWER_ENV, ANSWER_SETTINGS, ANSWER_TOOLS, CLAUDE_CODE_ENV_KEPT, CLAUDE_CODE_PRESET, CLAUDE_MCP_SERVER_NAME, CLAUDE_SESSION_ENV, CODEX_ANSWER_DISABLED_FEATURES, CODEX_ANSWER_FILESYSTEM, CODEX_ANSWER_PERMISSIONS, CODEX_LISTENER_HEADERS_HELPER_SOURCE, CODEX_MANAGED_PROXY_ENV, CODEX_MCP_LIST_MAX_AGE_MS, CODEX_MCP_LIST_TIMEOUT_MS, CODEX_MCP_SERVER_NAME, CODEX_PRESET, CODEX_PROBE_TIMEOUT_MS, CODEX_PROMPT_FROM_STDIN, CODEX_RUNTIME_CHECK_DISABLED_FEATURES, CODEX_SESSION_ENV, type ClaudeAnswerMcp, type ClaudeRunArgOptions, ClaudeRunner, type ClaudeRunnerOptions, type ClaudeSignIn, type CodexMcpOverride, CodexRunner, type CodexRunnerOptions, LISTENER_KEY_ENV, MIN_CLAUDE_CODE_VERSION, MIN_CODEX_VERSION, PARENT_ENV_KEYS, PRESETS, PROBE_TIMEOUT_MS, type Preset, type PresetContext, type PresetInspection, RUNTIME_CHECK_BUDGET_MS, RUNTIME_CHECK_DIR, RUNTIME_CHECK_KEY_ENV, RUNTIME_CHECK_OUTPUT_BYTES, RUNTIME_CHECK_PROMPT, RUNTIME_CHECK_SETTINGS, type RuntimeCheckSpec, WEB_TOOLS, WORK_TOOLS, agentchatTableKeys, buildClaudeEnv, claudeAnswerFallbackWorkdir, claudeCodePreset, claudeConfigDirFrom, claudeExtraDirectoriesGrant, claudeHomeFor, claudeIsLoggedIn, claudeManagedSettingsDir, claudeMcpConfig, claudeMcpConfigPath, claudeProfileArgs, claudeProjectsDirFor, claudeRunArgs, claudeRuntimeCheckArgs, claudeRuntimeCheckJudge, claudeRuntimeCheckWorkdir, claudeSettingsFilesGrantingDirectories, claudeSignIn, claudeUserStatePathFor, codexAgentchatExplicitAuth, codexAnswerFallbackWorkdir, codexClientHeadersToml, codexConfigLayerFiles, codexDotEnvKeyNames, codexHeadersHelperCommand, codexHomeFrom, codexIsLoggedIn, codexListenerHeadersHelperPath, codexMcpDisableArgs, codexMcpOverrideArgs, codexPinnedUrlArgs, codexPreset, codexProfileArgs, codexRunArgs, codexRuntimeCheckArgs, codexRuntimeCheckWorkdir, codexServerNameAddressable, deniedAncestorOf, inexpressibleDenyPaths, inspectClaudeRuntime, inspectCodexRuntime, isParentSessionEnv, parseCodexMcpList, presetNamed, presetNames, readDenyRules, runRuntimeCheck, semverAtLeast, withoutParentSession, workdirPaths, workdirReadRules };
|
|
857
|
+
export { AGENTCHAT_TOOL_ALLOW, ANSWER_DENIED_TOOLS, ANSWER_ENV, ANSWER_SETTINGS, ANSWER_TOOLS, CLAUDE_CODE_ENV_KEPT, CLAUDE_CODE_PRESET, CLAUDE_MCP_SERVER_NAME, CLAUDE_SESSION_ENV, CODEX_ANSWER_DISABLED_FEATURES, CODEX_ANSWER_FILESYSTEM, CODEX_ANSWER_PERMISSIONS, CODEX_LISTENER_HEADERS_HELPER_SOURCE, CODEX_MANAGED_PROXY_ENV, CODEX_MCP_LIST_MAX_AGE_MS, CODEX_MCP_LIST_TIMEOUT_MS, CODEX_MCP_SERVER_NAME, CODEX_PRESET, CODEX_PROBE_TIMEOUT_MS, CODEX_PROMPT_FROM_STDIN, CODEX_RUNTIME_CHECK_DISABLED_FEATURES, CODEX_SESSION_ENV, type ClaudeAnswerMcp, type ClaudeRunArgOptions, ClaudeRunner, type ClaudeRunnerOptions, type ClaudeSignIn, type CodexMcpOverride, CodexRunner, type CodexRunnerOptions, LISTENER_KEY_ENV, MIN_CLAUDE_CODE_VERSION, MIN_CODEX_VERSION, PARENT_ENV_KEYS, PRESETS, PROBE_TIMEOUT_MS, type Preset, type PresetContext, type PresetInspection, RUNTIME_CHECK_BUDGET_MS, RUNTIME_CHECK_DIR, RUNTIME_CHECK_KEY_ENV, RUNTIME_CHECK_OUTPUT_BYTES, RUNTIME_CHECK_PROMPT, RUNTIME_CHECK_SETTINGS, type RuntimeCheckSpec, WEB_TOOLS, WORK_TOOLS, agentchatTableKeys, buildClaudeEnv, claudeAnswerFallbackWorkdir, claudeCodePreset, claudeConfigDirFrom, claudeExtraDirectoriesGrant, claudeHomeFor, claudeIsLoggedIn, claudeManagedSettingsDir, claudeMcpConfig, claudeMcpConfigPath, claudeProfileArgs, claudeProjectsDirFor, claudeRunArgs, claudeRuntimeCheckArgs, claudeRuntimeCheckJudge, claudeRuntimeCheckWorkdir, claudeSettingsFilesGrantingDirectories, claudeSignIn, claudeUserStatePathFor, codexAgentchatExplicitAuth, codexAnswerFallbackWorkdir, codexClientHeadersToml, codexConfigLayerFiles, codexDotEnvKeyNames, codexHeadersHelperCommand, codexHomeFrom, codexIsLoggedIn, codexListenerHeadersHelperPath, codexMcpDisableArgs, codexMcpOverrideArgs, codexPinnedUrlArgs, codexPreset, codexProfileArgs, codexRunArgs, codexRuntimeCheckArgs, codexRuntimeCheckJudge, codexRuntimeCheckWorkdir, codexServerNameAddressable, deniedAncestorOf, inexpressibleDenyPaths, inspectClaudeRuntime, inspectCodexRuntime, isParentSessionEnv, parseCodexMcpList, presetNamed, presetNames, readDenyRules, runRuntimeCheck, semverAtLeast, withoutParentSession, workdirPaths, workdirReadRules };
|
package/dist/presets.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
VERSION,
|
|
3
3
|
hostedMcpUrl,
|
|
4
4
|
runProbe
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-7TTV2CQX.js";
|
|
6
6
|
import {
|
|
7
7
|
atomicWriteFile,
|
|
8
8
|
clientHeadersOf,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
spawnRun,
|
|
14
14
|
spawnRunCapturing,
|
|
15
15
|
workdirExposesHome
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-5KMQ23O6.js";
|
|
17
17
|
|
|
18
18
|
// src/presets/claude-code.ts
|
|
19
19
|
import * as fs2 from "fs";
|
|
@@ -371,8 +371,18 @@ function claudeProfileArgs(profile, workdir) {
|
|
|
371
371
|
}
|
|
372
372
|
var RUNTIME_CHECK_SETTINGS = JSON.stringify({
|
|
373
373
|
env: { CLAUDE_CODE_DISABLE_CLAUDE_MDS: "1", CLAUDE_CODE_DISABLE_AUTO_MEMORY: "1" },
|
|
374
|
-
disableAllHooks: true
|
|
374
|
+
disableAllHooks: true,
|
|
375
|
+
verbose: false,
|
|
376
|
+
viewMode: "default",
|
|
377
|
+
language: "english"
|
|
375
378
|
});
|
|
379
|
+
function lastResultMessage(messages) {
|
|
380
|
+
for (let i = messages.length - 1; i >= 0; i -= 1) {
|
|
381
|
+
const m = messages[i];
|
|
382
|
+
if (m !== null && typeof m === "object" && !Array.isArray(m) && m["type"] === "result") return m;
|
|
383
|
+
}
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
376
386
|
function claudeRuntimeCheckJudge(stdout) {
|
|
377
387
|
const text = stdout.trim();
|
|
378
388
|
let parsed = null;
|
|
@@ -384,9 +394,22 @@ function claudeRuntimeCheckJudge(stdout) {
|
|
|
384
394
|
parsed = null;
|
|
385
395
|
}
|
|
386
396
|
}
|
|
397
|
+
if (Array.isArray(parsed)) {
|
|
398
|
+
parsed = lastResultMessage(parsed);
|
|
399
|
+
if (parsed === null) return "its answer is a list of messages with no result";
|
|
400
|
+
}
|
|
387
401
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return "its answer is not a JSON result";
|
|
388
402
|
const r = parsed;
|
|
389
|
-
if (r["type"] === "result" && r["subtype"] === "success" && r["is_error"] === false)
|
|
403
|
+
if (r["type"] === "result" && r["subtype"] === "success" && r["is_error"] === false) {
|
|
404
|
+
const turns = r["num_turns"];
|
|
405
|
+
if (typeof turns !== "number" || !(turns >= 1)) return `the result has no turn (num_turns ${typeof turns === "number" ? turns : "?"})`;
|
|
406
|
+
const usage = r["usage"];
|
|
407
|
+
if (usage !== void 0 && usage !== null) {
|
|
408
|
+
const tokens = typeof usage === "object" && !Array.isArray(usage) ? usage["output_tokens"] : void 0;
|
|
409
|
+
if (typeof tokens !== "number" || !(tokens >= 1)) return `the result has no output (usage.output_tokens ${typeof tokens === "number" ? tokens : "?"})`;
|
|
410
|
+
}
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
390
413
|
const facts = [
|
|
391
414
|
`type ${typeof r["type"] === "string" ? r["type"] : "?"}`,
|
|
392
415
|
`subtype ${typeof r["subtype"] === "string" ? r["subtype"] : "?"}`,
|
|
@@ -877,8 +900,6 @@ function codexRuntimeCheckArgs(dir, agentchatUrl) {
|
|
|
877
900
|
"--sandbox",
|
|
878
901
|
"read-only",
|
|
879
902
|
"-c",
|
|
880
|
-
'model_reasoning_effort="low"',
|
|
881
|
-
"-c",
|
|
882
903
|
'web_search="disabled"',
|
|
883
904
|
...CODEX_RUNTIME_CHECK_DISABLED_FEATURES.flatMap((feature) => ["--disable", feature]),
|
|
884
905
|
...agentchatUrl !== void 0 ? ["-c", `${table}.url=${JSON.stringify(agentchatUrl)}`] : [],
|
|
@@ -890,6 +911,37 @@ function codexRuntimeCheckArgs(dir, agentchatUrl) {
|
|
|
890
911
|
function codexRuntimeCheckWorkdir(codexHome) {
|
|
891
912
|
return path2.join(codexHome, RUNTIME_CHECK_DIR);
|
|
892
913
|
}
|
|
914
|
+
function jsonObject(value) {
|
|
915
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
916
|
+
}
|
|
917
|
+
function codexRuntimeCheckJudge(stdout) {
|
|
918
|
+
let events = 0;
|
|
919
|
+
let completed = false;
|
|
920
|
+
let failed = false;
|
|
921
|
+
let answered = false;
|
|
922
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
923
|
+
if (line.trim().length === 0) continue;
|
|
924
|
+
let event;
|
|
925
|
+
try {
|
|
926
|
+
event = jsonObject(JSON.parse(line));
|
|
927
|
+
} catch {
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
if (event === null) continue;
|
|
931
|
+
events += 1;
|
|
932
|
+
if (event["type"] === "turn.completed") completed = true;
|
|
933
|
+
else if (event["type"] === "turn.failed") failed = true;
|
|
934
|
+
else if (event["type"] === "item.completed") {
|
|
935
|
+
const item = jsonObject(event["item"]);
|
|
936
|
+
if (item !== null && item["type"] === "agent_message" && typeof item["text"] === "string" && item["text"].trim().length > 0) answered = true;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
if (events === 0) return "its answer holds no JSON event";
|
|
940
|
+
if (failed) return "the turn failed (turn.failed)";
|
|
941
|
+
if (!completed) return "the turn did not complete (no turn.completed)";
|
|
942
|
+
if (!answered) return "the turn completed with no agent message";
|
|
943
|
+
return null;
|
|
944
|
+
}
|
|
893
945
|
function codexClientHeadersToml(clientVersion = VERSION) {
|
|
894
946
|
const pairs = Object.entries(clientHeadersOf({ runtime: "codex", version: clientVersion })).map(([name, value]) => `${JSON.stringify(name)} = ${JSON.stringify(value)}`);
|
|
895
947
|
return `{ ${pairs.join(", ")} }`;
|
|
@@ -1215,9 +1267,11 @@ var CodexRunner = class {
|
|
|
1215
1267
|
/**
|
|
1216
1268
|
* Does the model answer right now, through this runner's binary, sign-in,
|
|
1217
1269
|
* CODEX_HOME and environment? One `codex exec` with a fixed prompt in its
|
|
1218
|
-
* own empty folder, read-only, with the hosted AgentChat server switched
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1270
|
+
* own empty folder, read-only, with the hosted AgentChat server switched
|
|
1271
|
+
* off and the user's hooks on, as in the runs (`codexRuntimeCheckArgs`),
|
|
1272
|
+
* and no key in its environment; ok only on exit 0 with a completed turn
|
|
1273
|
+
* that holds an agent message (`codexRuntimeCheckJudge`). Its output is
|
|
1274
|
+
* read for that alone and never logged. Never throws.
|
|
1221
1275
|
*/
|
|
1222
1276
|
async checkRuntime(options = {}) {
|
|
1223
1277
|
if (this.options.refuse !== void 0) return { ok: false, detail: this.options.refuse };
|
|
@@ -1230,6 +1284,8 @@ var CodexRunner = class {
|
|
|
1230
1284
|
// The runs' environment; runRuntimeCheck takes every key variable out, this runner's own included.
|
|
1231
1285
|
env: this.env(),
|
|
1232
1286
|
keyEnv: this.options.keyEnv,
|
|
1287
|
+
// Exit 0 is not enough: the events must show a completed turn with the model's answer.
|
|
1288
|
+
judge: codexRuntimeCheckJudge,
|
|
1233
1289
|
...options.signal !== void 0 ? { signal: options.signal } : {}
|
|
1234
1290
|
});
|
|
1235
1291
|
}
|
|
@@ -1442,6 +1498,7 @@ export {
|
|
|
1442
1498
|
codexProfileArgs,
|
|
1443
1499
|
codexRunArgs,
|
|
1444
1500
|
codexRuntimeCheckArgs,
|
|
1501
|
+
codexRuntimeCheckJudge,
|
|
1445
1502
|
codexRuntimeCheckWorkdir,
|
|
1446
1503
|
codexServerNameAddressable,
|
|
1447
1504
|
deniedAncestorOf,
|