@excitedjs/agent-runtime-codex 0.6.1-beta.251 → 0.7.0-alpha.ged3454ecaaed
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 +31 -8
- package/dist/activity/cursor.d.ts +0 -1
- package/dist/activity/cursor.d.ts.map +1 -1
- package/dist/activity/cursor.js +4 -8
- package/dist/activity/cursor.js.map +1 -1
- package/dist/activity/opened-file.d.ts.map +1 -1
- package/dist/activity/opened-file.js +13 -10
- package/dist/activity/opened-file.js.map +1 -1
- package/dist/activity/path.d.ts +9 -3
- package/dist/activity/path.d.ts.map +1 -1
- package/dist/activity/path.js +55 -49
- package/dist/activity/path.js.map +1 -1
- package/dist/activity/reader.d.ts +1 -4
- package/dist/activity/reader.d.ts.map +1 -1
- package/dist/activity/reader.js +30 -56
- package/dist/activity/reader.js.map +1 -1
- package/dist/args.d.ts +14 -18
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +17 -36
- package/dist/args.js.map +1 -1
- package/dist/codex-home.d.ts +10 -6
- package/dist/codex-home.d.ts.map +1 -1
- package/dist/codex-home.js +24 -29
- package/dist/codex-home.js.map +1 -1
- package/dist/config.d.ts +3 -32
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +12 -46
- package/dist/config.js.map +1 -1
- package/dist/diagnostic.d.ts +7 -3
- package/dist/diagnostic.d.ts.map +1 -1
- package/dist/diagnostic.js +12 -4
- package/dist/diagnostic.js.map +1 -1
- package/dist/events.d.ts +18 -47
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +29 -198
- package/dist/events.js.map +1 -1
- package/dist/handshake.d.ts +1 -1
- package/dist/handshake.d.ts.map +1 -1
- package/dist/handshake.js.map +1 -1
- package/dist/index.d.ts +9 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -24
- package/dist/index.js.map +1 -1
- package/dist/output-schema-codec.d.ts.map +1 -1
- package/dist/output-schema-codec.js +7 -15
- package/dist/output-schema-codec.js.map +1 -1
- package/dist/paths.d.ts +11 -6
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +25 -18
- package/dist/paths.js.map +1 -1
- package/dist/plugin.d.ts +14 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +11 -0
- package/dist/plugin.js.map +1 -0
- package/dist/provider.d.ts +9 -30
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +14 -49
- package/dist/provider.js.map +1 -1
- package/dist/reasoning-effort.d.ts +23 -0
- package/dist/reasoning-effort.d.ts.map +1 -0
- package/dist/reasoning-effort.js +75 -0
- package/dist/reasoning-effort.js.map +1 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js.map +1 -1
- package/dist/runtime-deps.d.ts +6 -11
- package/dist/runtime-deps.d.ts.map +1 -1
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +82 -41
- package/dist/runtime.js.map +1 -1
- package/dist/skill-roots.d.ts.map +1 -1
- package/dist/skill-roots.js +1 -3
- package/dist/skill-roots.js.map +1 -1
- package/dist/supervisor.d.ts +1 -1
- package/dist/supervisor.d.ts.map +1 -1
- package/dist/system-prompt.d.ts +9 -0
- package/dist/system-prompt.d.ts.map +1 -0
- package/dist/system-prompt.js +26 -0
- package/dist/system-prompt.js.map +1 -0
- package/dist/tool-display.d.ts.map +1 -1
- package/dist/tool-display.js +70 -19
- package/dist/tool-display.js.map +1 -1
- package/dist/turn-manager.d.ts +8 -1
- package/dist/turn-manager.d.ts.map +1 -1
- package/dist/turn-manager.js +139 -89
- package/dist/turn-manager.js.map +1 -1
- package/dist/types.d.ts +4 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +5 -4
- package/dist/activity/budget.d.ts +0 -8
- package/dist/activity/budget.d.ts.map +0 -1
- package/dist/activity/budget.js +0 -9
- package/dist/activity/budget.js.map +0 -1
- package/dist/activity/error.d.ts +0 -16
- package/dist/activity/error.d.ts.map +0 -1
- package/dist/activity/error.js +0 -22
- package/dist/activity/error.js.map +0 -1
- package/dist/approval.d.ts +0 -31
- package/dist/approval.d.ts.map +0 -1
- package/dist/approval.js +0 -43
- package/dist/approval.js.map +0 -1
- package/dist/provider-ref.d.ts +0 -8
- package/dist/provider-ref.d.ts.map +0 -1
- package/dist/provider-ref.js +0 -8
- package/dist/provider-ref.js.map +0 -1
- package/dist/runtime-support.d.ts +0 -14
- package/dist/runtime-support.d.ts.map +0 -1
- package/dist/runtime-support.js +0 -35
- package/dist/runtime-support.js.map +0 -1
package/dist/config.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Builtin `builtin:codex` runtime config: schema type, defaults, reader
|
|
3
|
-
* the typed accessor.
|
|
2
|
+
* Builtin `builtin:codex` runtime config: schema type, defaults, and reader.
|
|
4
3
|
*
|
|
5
4
|
* Codex runtime config is owned by this package (the `builtin:codex` provider),
|
|
6
5
|
* not by the Dreamux host config module. It depends only on the shared neutral
|
|
7
|
-
* validation primitives (`@excitedjs/dreamux-utils`)
|
|
8
|
-
*
|
|
9
|
-
* module re-exports these so
|
|
6
|
+
* validation primitives (`@excitedjs/dreamux-utils`), never on
|
|
7
|
+
* `@excitedjs/dreamux` core. The Dreamux host config module re-exports these so
|
|
10
8
|
* the non-builtin callers (doctor, daemon, tests) keep their import paths.
|
|
11
9
|
*/
|
|
12
10
|
/**
|
|
@@ -20,18 +18,13 @@
|
|
|
20
18
|
* environment variable is a host-level override that takes precedence over it
|
|
21
19
|
* (resolved by the codex builtin's `resolveCodexBinPath`).
|
|
22
20
|
* `initialize_timeout_ms` is that dispatcher's handshake timeout.
|
|
23
|
-
* `turn_timeout_ms` is accepted and defaulted by this config reader, but the
|
|
24
|
-
* current `CodexRuntime` does not consume it. It therefore has no runtime
|
|
25
|
-
* effect; documenting that gap must not be confused with wiring a timeout.
|
|
26
21
|
*/
|
|
27
22
|
export interface DispatcherCodexConfig {
|
|
28
23
|
bin: string;
|
|
29
|
-
approval_policy: string;
|
|
30
24
|
sandbox_mode: string;
|
|
31
25
|
extra_args: string[];
|
|
32
26
|
extra_env: Record<string, string>;
|
|
33
27
|
initialize_timeout_ms: number;
|
|
34
|
-
turn_timeout_ms: number;
|
|
35
28
|
}
|
|
36
29
|
/**
|
|
37
30
|
* Default `agents[].config.bin`. The Codex binary path is
|
|
@@ -41,31 +34,9 @@ export interface DispatcherCodexConfig {
|
|
|
41
34
|
export declare const DEFAULT_CODEX_BIN = "codex";
|
|
42
35
|
/** Default `agents[].config.initialize_timeout_ms` (handshake timeout, ms). */
|
|
43
36
|
export declare const DEFAULT_INITIALIZE_TIMEOUT_MS = 10000;
|
|
44
|
-
/**
|
|
45
|
-
* Default accepted value for `agents[].config.turn_timeout_ms` (ms). The reader
|
|
46
|
-
* validates and returns it, but `CodexRuntime` currently does not consume it,
|
|
47
|
-
* so changing this value has no runtime effect.
|
|
48
|
-
*/
|
|
49
|
-
export declare const DEFAULT_CODEX_TURN_TIMEOUT_MS = 600000;
|
|
50
|
-
/** Default `agents[].config.approval_policy` when omitted. */
|
|
51
|
-
export declare const DEFAULT_APPROVAL_POLICY = "never";
|
|
52
37
|
/** Default `agents[].config.sandbox_mode` when omitted. */
|
|
53
38
|
export declare const DEFAULT_SANDBOX_MODE = "workspace-write";
|
|
54
|
-
export declare const ALLOWED_APPROVAL_POLICIES: Set<string>;
|
|
55
39
|
export declare const ALLOWED_SANDBOX_MODES: Set<string>;
|
|
56
40
|
export declare function defaultDispatcherCodexConfig(): DispatcherCodexConfig;
|
|
57
41
|
export declare function readDispatcherCodexConfig(rawCodex: Record<string, unknown>, file: string, prefix: string): DispatcherCodexConfig;
|
|
58
|
-
/**
|
|
59
|
-
* Typed accessor for a dispatcher's resolved codex runtime config. Typed
|
|
60
|
-
* structurally (not against `DispatcherConfig`) so this module never imports
|
|
61
|
-
* the host config type — a full `DispatcherConfig` still satisfies it at the
|
|
62
|
-
* call sites.
|
|
63
|
-
*/
|
|
64
|
-
export declare function dispatcherCodexConfig(dispatcher: {
|
|
65
|
-
id: string;
|
|
66
|
-
runtime: {
|
|
67
|
-
provider: string;
|
|
68
|
-
config: unknown;
|
|
69
|
-
};
|
|
70
|
-
}): DispatcherCodexConfig;
|
|
71
42
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAEzC,+EAA+E;AAC/E,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAEpD,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD,eAAO,MAAM,qBAAqB,aAIhC,CAAC;AAEH,wBAAgB,4BAA4B,IAAI,qBAAqB,CAQpE;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,qBAAqB,CA8DvB"}
|
package/dist/config.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Builtin `builtin:codex` runtime config: schema type, defaults, reader
|
|
3
|
-
* the typed accessor.
|
|
2
|
+
* Builtin `builtin:codex` runtime config: schema type, defaults, and reader.
|
|
4
3
|
*
|
|
5
4
|
* Codex runtime config is owned by this package (the `builtin:codex` provider),
|
|
6
5
|
* not by the Dreamux host config module. It depends only on the shared neutral
|
|
7
|
-
* validation primitives (`@excitedjs/dreamux-utils`)
|
|
8
|
-
*
|
|
9
|
-
* module re-exports these so
|
|
6
|
+
* validation primitives (`@excitedjs/dreamux-utils`), never on
|
|
7
|
+
* `@excitedjs/dreamux` core. The Dreamux host config module re-exports these so
|
|
10
8
|
* the non-builtin callers (doctor, daemon, tests) keep their import paths.
|
|
11
9
|
*/
|
|
12
|
-
import {
|
|
13
|
-
import { readOptionalString, rejectUnknownKeys, requirePositiveInt, requireStringArray, requireStringRecord, } from '@excitedjs/dreamux-utils';
|
|
10
|
+
import { readOptionalString, readPositiveInt, readStringArray, readStringRecord, rejectUnknownKeys, } from '@excitedjs/dreamux-utils';
|
|
14
11
|
/**
|
|
15
12
|
* Default `agents[].config.bin`. The Codex binary path is
|
|
16
13
|
* dispatcher-local; `CODEX_HOST_CODEX_BIN` is a host-level override above it,
|
|
@@ -19,22 +16,8 @@ import { readOptionalString, rejectUnknownKeys, requirePositiveInt, requireStrin
|
|
|
19
16
|
export const DEFAULT_CODEX_BIN = 'codex';
|
|
20
17
|
/** Default `agents[].config.initialize_timeout_ms` (handshake timeout, ms). */
|
|
21
18
|
export const DEFAULT_INITIALIZE_TIMEOUT_MS = 10_000;
|
|
22
|
-
/**
|
|
23
|
-
* Default accepted value for `agents[].config.turn_timeout_ms` (ms). The reader
|
|
24
|
-
* validates and returns it, but `CodexRuntime` currently does not consume it,
|
|
25
|
-
* so changing this value has no runtime effect.
|
|
26
|
-
*/
|
|
27
|
-
export const DEFAULT_CODEX_TURN_TIMEOUT_MS = 600_000;
|
|
28
|
-
/** Default `agents[].config.approval_policy` when omitted. */
|
|
29
|
-
export const DEFAULT_APPROVAL_POLICY = 'never';
|
|
30
19
|
/** Default `agents[].config.sandbox_mode` when omitted. */
|
|
31
20
|
export const DEFAULT_SANDBOX_MODE = 'workspace-write';
|
|
32
|
-
export const ALLOWED_APPROVAL_POLICIES = new Set([
|
|
33
|
-
'never',
|
|
34
|
-
'auto',
|
|
35
|
-
'auto-approve',
|
|
36
|
-
'on-failure',
|
|
37
|
-
]);
|
|
38
21
|
export const ALLOWED_SANDBOX_MODES = new Set([
|
|
39
22
|
'read-only',
|
|
40
23
|
'workspace-write',
|
|
@@ -43,23 +26,25 @@ export const ALLOWED_SANDBOX_MODES = new Set([
|
|
|
43
26
|
export function defaultDispatcherCodexConfig() {
|
|
44
27
|
return {
|
|
45
28
|
bin: DEFAULT_CODEX_BIN,
|
|
46
|
-
approval_policy: DEFAULT_APPROVAL_POLICY,
|
|
47
29
|
sandbox_mode: DEFAULT_SANDBOX_MODE,
|
|
48
30
|
extra_args: [],
|
|
49
31
|
extra_env: {},
|
|
50
32
|
initialize_timeout_ms: DEFAULT_INITIALIZE_TIMEOUT_MS,
|
|
51
|
-
turn_timeout_ms: DEFAULT_CODEX_TURN_TIMEOUT_MS,
|
|
52
33
|
};
|
|
53
34
|
}
|
|
54
35
|
export function readDispatcherCodexConfig(rawCodex, file, prefix) {
|
|
55
36
|
rejectUnknownKeys(rawCodex, new Set([
|
|
56
37
|
'bin',
|
|
38
|
+
// 'approval_policy' and 'turn_timeout_ms' are no longer read (Codex
|
|
39
|
+
// approval policy is hard-coded to 'never'; turn_timeout_ms was
|
|
40
|
+
// accepted-and-ignored with no runtime effect) but stay in this
|
|
41
|
+
// allow-list so a config.json written before this change still loads.
|
|
57
42
|
'approval_policy',
|
|
43
|
+
'turn_timeout_ms',
|
|
58
44
|
'sandbox_mode',
|
|
59
45
|
'extra_args',
|
|
60
46
|
'extra_env',
|
|
61
47
|
'initialize_timeout_ms',
|
|
62
|
-
'turn_timeout_ms',
|
|
63
48
|
]), file, prefix);
|
|
64
49
|
// An omitted (or explicitly null) field falls back to the dispatcher-local
|
|
65
50
|
// default. Before the top-level block was removed, `null` meant "inherit the
|
|
@@ -69,11 +54,6 @@ export function readDispatcherCodexConfig(rawCodex, file, prefix) {
|
|
|
69
54
|
if (bin.trim() === '') {
|
|
70
55
|
throw new Error(`dreamux config error in ${file}: ${prefix}bin must be a non-empty string`);
|
|
71
56
|
}
|
|
72
|
-
const approvalPolicy = readOptionalString(rawCodex, 'approval_policy', file, prefix) ??
|
|
73
|
-
defaults.approval_policy;
|
|
74
|
-
if (!ALLOWED_APPROVAL_POLICIES.has(approvalPolicy)) {
|
|
75
|
-
throw new Error(`dreamux config error in ${file}: ${prefix}approval_policy='${approvalPolicy}' is not one of ${Array.from(ALLOWED_APPROVAL_POLICIES).join(' | ')}`);
|
|
76
|
-
}
|
|
77
57
|
const sandboxMode = readOptionalString(rawCodex, 'sandbox_mode', file, prefix) ??
|
|
78
58
|
defaults.sandbox_mode;
|
|
79
59
|
if (!ALLOWED_SANDBOX_MODES.has(sandboxMode)) {
|
|
@@ -81,24 +61,10 @@ export function readDispatcherCodexConfig(rawCodex, file, prefix) {
|
|
|
81
61
|
}
|
|
82
62
|
return {
|
|
83
63
|
bin,
|
|
84
|
-
approval_policy: approvalPolicy,
|
|
85
64
|
sandbox_mode: sandboxMode,
|
|
86
|
-
extra_args:
|
|
87
|
-
extra_env:
|
|
88
|
-
initialize_timeout_ms:
|
|
89
|
-
turn_timeout_ms: requirePositiveInt(rawCodex, 'turn_timeout_ms', defaults.turn_timeout_ms, file, prefix),
|
|
65
|
+
extra_args: readStringArray(rawCodex, 'extra_args', defaults.extra_args, file, prefix),
|
|
66
|
+
extra_env: readStringRecord(rawCodex, 'extra_env', defaults.extra_env, file, prefix),
|
|
67
|
+
initialize_timeout_ms: readPositiveInt(rawCodex, 'initialize_timeout_ms', defaults.initialize_timeout_ms, file, prefix),
|
|
90
68
|
};
|
|
91
69
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Typed accessor for a dispatcher's resolved codex runtime config. Typed
|
|
94
|
-
* structurally (not against `DispatcherConfig`) so this module never imports
|
|
95
|
-
* the host config type — a full `DispatcherConfig` still satisfies it at the
|
|
96
|
-
* call sites.
|
|
97
|
-
*/
|
|
98
|
-
export function dispatcherCodexConfig(dispatcher) {
|
|
99
|
-
if (dispatcher.runtime.provider !== BUILTIN_CODEX_PROVIDER_REF) {
|
|
100
|
-
throw new Error(`dispatcher '${dispatcher.id}' runtime provider ${JSON.stringify(dispatcher.runtime.provider)} is not wired to Codex`);
|
|
101
|
-
}
|
|
102
|
-
return dispatcher.runtime.config;
|
|
103
|
-
}
|
|
104
70
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAsBlC;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAEzC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC;AAEpD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAEtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IAC3C,WAAW;IACX,iBAAiB;IACjB,oBAAoB;CACrB,CAAC,CAAC;AAEH,MAAM,UAAU,4BAA4B;IAC1C,OAAO;QACL,GAAG,EAAE,iBAAiB;QACtB,YAAY,EAAE,oBAAoB;QAClC,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,EAAE;QACb,qBAAqB,EAAE,6BAA6B;KACrD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,QAAiC,EACjC,IAAY,EACZ,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EAAE,eAAe,CACpC,QAAQ,EACR,uBAAuB,EACvB,QAAQ,CAAC,qBAAqB,EAC9B,IAAI,EACJ,MAAM,CACP;KACF,CAAC;AACJ,CAAC"}
|
package/dist/diagnostic.d.ts
CHANGED
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Declares the codex bin check (deduped + executed by Dreamux core) and runs
|
|
6
6
|
* the codex-home validation plus the codex version gate (#147) itself,
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* against the neutral `@excitedjs/dreamux-types` diagnostic context. The
|
|
8
|
+
* codex-home check runs against the runtime's actual spawn env (ambient env
|
|
9
|
+
* plus its own `config.extra_env`, via `paths.ts`'s `codexSpawnEnv`) rather
|
|
10
|
+
* than the ambient diagnostic env alone, so a per-agent `CODEX_HOME` or auth
|
|
11
|
+
* override is validated where it actually applies. The representative
|
|
12
|
+
* app-server socket sample is derived from the neutral path context's
|
|
13
|
+
* `runtimeSocketDirs()`, so the package never names `~/.dreamux`.
|
|
10
14
|
*/
|
|
11
15
|
import type { AgentRuntimeDiagnosticCapability } from '@excitedjs/dreamux-types';
|
|
12
16
|
import { type DispatcherCodexConfig } from './config.js';
|
package/dist/diagnostic.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostic.d.ts","sourceRoot":"","sources":["../src/diagnostic.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"diagnostic.d.ts","sourceRoot":"","sources":["../src/diagnostic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAEV,gCAAgC,EAIjC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAsCzD,eAAO,MAAM,2BAA2B,EAAE,gCAAgC,CAAC,qBAAqB,CAgD7F,CAAC"}
|
package/dist/diagnostic.js
CHANGED
|
@@ -2,9 +2,12 @@ import { codexArgsFromConfig, codexArgsToCli } from './args.js';
|
|
|
2
2
|
import { dispatcherCodexHomeDoctorContext, validateDispatcherCodexHome, } from './codex-home.js';
|
|
3
3
|
import { representativeCodexSocketPath } from './internal/socket.js';
|
|
4
4
|
import { resolveCodexBinPath } from './bin.js';
|
|
5
|
+
import { codexSpawnEnv } from './paths.js';
|
|
5
6
|
import { MIN_CODEX_VERSION, codexVersionSatisfies } from './version.js';
|
|
6
7
|
function codexBinCheckName(scope) {
|
|
7
|
-
return scope === 'managedService'
|
|
8
|
+
return scope === 'managedService'
|
|
9
|
+
? 'managed service Codex binary'
|
|
10
|
+
: 'codex binary';
|
|
8
11
|
}
|
|
9
12
|
async function checkCodexVersion(context, runner) {
|
|
10
13
|
const bin = resolveCodexBinPath(context.config.bin, context.env);
|
|
@@ -33,13 +36,18 @@ export const codexAgentRuntimeDiagnostic = {
|
|
|
33
36
|
},
|
|
34
37
|
async runDiagnostic(context, runner) {
|
|
35
38
|
const cliArgs = codexArgsToCli(codexArgsFromConfig(context.config));
|
|
36
|
-
const socketDirs = context.paths
|
|
37
|
-
|
|
39
|
+
const socketDirs = context.paths.runtimeSocketDirs();
|
|
40
|
+
// Validate against the env this runtime's Codex child actually spawns
|
|
41
|
+
// with (ambient env plus its own `extra_env`), not the ambient
|
|
42
|
+
// diagnostic env alone — an operator's per-agent `CODEX_HOME` or auth
|
|
43
|
+
// override in `extra_env` must be honored here too.
|
|
44
|
+
const env = codexSpawnEnv(context.config.extra_env);
|
|
45
|
+
const homeContext = dispatcherCodexHomeDoctorContext(context.runtime_id, env, {
|
|
38
46
|
codexCliArgs: cliArgs,
|
|
39
47
|
socketPath: representativeCodexSocketPath(socketDirs, context.runtime_id),
|
|
40
48
|
});
|
|
41
49
|
const home = await validateDispatcherCodexHome(homeContext, {
|
|
42
|
-
env
|
|
50
|
+
env,
|
|
43
51
|
codexCliArgs: cliArgs,
|
|
44
52
|
});
|
|
45
53
|
const errors = [...home.errors];
|
package/dist/diagnostic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostic.js","sourceRoot":"","sources":["../src/diagnostic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"diagnostic.js","sourceRoot":"","sources":["../src/diagnostic.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EACL,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAKxE,SAAS,iBAAiB,CAAC,KAAsC;IAC/D,OAAO,KAAK,KAAK,gBAAgB;QAC/B,CAAC,CAAC,8BAA8B;QAChC,CAAC,CAAC,cAAc,CAAC;AACrB,CAAC;AAED,KAAK,UAAU,iBAAiB,CAC9B,OAA+B,EAC/B,MAAoC;IAEpC,MAAM,GAAG,GAAG,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACjE,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACvE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,KAAK,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC/D,OAAO,0CAA0C,GAAG,KAAK,KAAK,u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M,YAAY,GAAG,MAAM,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9D,IAAI,YAAY,KAAK,IAAI;YAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACrD,0EAA0E;QAC1E,sCAAsC;QACtC,OAAO;YACL,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YACvB,MAAM,EAAE,WAAW,CAAC,SAAS;YAC7B,MAAM;SACP,CAAC;IACJ,CAAC;CACF,CAAC"}
|
package/dist/events.d.ts
CHANGED
|
@@ -16,58 +16,34 @@ export interface CollectedTurn {
|
|
|
16
16
|
status: TurnStatus;
|
|
17
17
|
}
|
|
18
18
|
export interface TurnCollector {
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Forget a turn's buffered `item/completed` items. `itemsByTurn` has no
|
|
21
|
+
* size bound of its own (unlike the terminal-id set below): every
|
|
22
|
+
* `item/completed` notification appends to it, and nothing else ever
|
|
23
|
+
* deletes an entry, so a long-lived resident collector leaks one array per
|
|
24
|
+
* native turn it has ever seen unless the caller releases each turn once
|
|
25
|
+
* it is done with it.
|
|
26
|
+
*/
|
|
20
27
|
releaseTurn(turnId: string): void;
|
|
21
28
|
dispose(): void;
|
|
22
29
|
}
|
|
23
|
-
/**
|
|
24
|
-
* One observed Codex notification, redacted to method + ids + item type — never
|
|
25
|
-
* prompt/assistant text. Emitted to {@link TurnSubscriptionOptions.onTrace} for
|
|
26
|
-
* every notification so a caller can see what Codex emitted after `turn/start`
|
|
27
|
-
* (issue #126 PR8): the dispatcher never awaits completion, so the worker is the
|
|
28
|
-
* only consumer of this stream, and an empty/abnormal trace is the diagnostic
|
|
29
|
-
* that distinguishes an environment stall (auth/network/quota) from a missed
|
|
30
|
-
* terminal event.
|
|
31
|
-
*/
|
|
32
|
-
export interface TurnTraceEvent {
|
|
33
|
-
method: string;
|
|
34
|
-
/** `params.threadId` if present, else null (reveals a field-shape mismatch). */
|
|
35
|
-
threadId: string | null;
|
|
36
|
-
turnId: string | null;
|
|
37
|
-
/** `item.type` for `item/completed`; never the item text. */
|
|
38
|
-
itemType: string | null;
|
|
39
|
-
/** Whether this notification counted toward THIS subscription's thread. */
|
|
40
|
-
matched: boolean;
|
|
41
|
-
}
|
|
42
30
|
export interface TurnSubscriptionOptions {
|
|
43
|
-
/**
|
|
44
|
-
* Accept `turn/completed` / `item/completed` even when the notification's
|
|
45
|
-
* `threadId` field does not match. A per-task worker app-server hosts exactly
|
|
46
|
-
* one thread, so any completion on its socket IS this task's completion;
|
|
47
|
-
* leniency makes the worker robust to a `threadId` field-shape drift in the
|
|
48
|
-
* Codex protocol that the strict dispatcher path never exercises. Default
|
|
49
|
-
* false preserves the strict, thread-scoped dispatcher behaviour.
|
|
50
|
-
*/
|
|
51
|
-
acceptAnyThread?: boolean;
|
|
52
|
-
/** Diagnostic hook fired for EVERY notification, before any filtering. */
|
|
53
|
-
onTrace?: (event: TurnTraceEvent) => void;
|
|
54
|
-
/** Keep listening while a resident runtime observes successive native turns. */
|
|
55
|
-
retainAfterTerminal?: boolean;
|
|
56
31
|
onTokenUsage?: (usage: ThreadTokenUsage) => void;
|
|
57
32
|
onItemStarted?: (turnId: string, item: ThreadItem) => void;
|
|
58
33
|
onItemCompleted?: (turnId: string, item: ThreadItem, occurredAt: number) => void;
|
|
59
34
|
onTerminal?: (turnId: string, terminal: CollectedTurn | Error) => void;
|
|
35
|
+
/**
|
|
36
|
+
* An `error` notification with no `turnId` — a connection-level protocol
|
|
37
|
+
* failure rather than one turn's failure. The collector stops reacting to
|
|
38
|
+
* further notifications once this fires: nothing scopes a recovery to a
|
|
39
|
+
* single turn.
|
|
40
|
+
*/
|
|
60
41
|
onUnscopedFailure?: (error: Error) => void;
|
|
61
|
-
onProtocolViolation?: (error: Error) => void;
|
|
62
42
|
}
|
|
63
43
|
/**
|
|
64
|
-
* Subscribe to turn notifications for one thread
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* error that interrupts the turn; codex emits no `turn/completed` after it, so a
|
|
68
|
-
* resolve-only collector would hang forever) or a `turn/completed` carrying a
|
|
69
|
-
* `turn.error`. Items arriving on the parallel `item/completed` stream are
|
|
70
|
-
* buffered and merged into the resolved turn.
|
|
44
|
+
* Subscribe to turn notifications for one thread, pushing each turn's
|
|
45
|
+
* lifecycle to the given callbacks as codex reports it. Stays subscribed
|
|
46
|
+
* across successive native turns until `dispose()`.
|
|
71
47
|
*/
|
|
72
48
|
export declare function subscribeTurnCollection(client: CodexWsClient, threadId: string, options?: TurnSubscriptionOptions): TurnCollector;
|
|
73
49
|
/**
|
|
@@ -75,14 +51,9 @@ export declare function subscribeTurnCollection(client: CodexWsClient, threadId:
|
|
|
75
51
|
* This is the production Feishu inbound primitive: it intentionally does not
|
|
76
52
|
* wait for `turn/completed`.
|
|
77
53
|
*/
|
|
78
|
-
export declare function submitTurnStart(client: CodexWsClient, threadId: string,
|
|
54
|
+
export declare function submitTurnStart(client: CodexWsClient, threadId: string, texts: string[], cwd: string | null, outputSchema?: Record<string, unknown>, effort?: string): Promise<TurnStartResponse>;
|
|
79
55
|
/** Interrupt one running turn and resolve once Codex accepts the request. */
|
|
80
56
|
export declare function interruptTurn(client: CodexWsClient, threadId: string, turnId: string): Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* Send a `turn/start` request and await `turn/completed`.
|
|
83
|
-
* Returns the collected turn, or throws on RPC failure.
|
|
84
|
-
*/
|
|
85
|
-
export declare function runTurn(client: CodexWsClient, threadId: string, prompt: string, cwd: string | null): Promise<CollectedTurn>;
|
|
86
57
|
/**
|
|
87
58
|
* Extract the final assistant message text from a collected turn.
|
|
88
59
|
* Returns null if the turn had no assistant message — caller decides
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UA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