@excitedjs/agent-runtime-claude-code 0.2.0-alpha.g0ddd418597ca
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/LICENSE +21 -0
- package/README.md +32 -0
- package/dist/args.d.ts +71 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +87 -0
- package/dist/args.js.map +1 -0
- package/dist/config.d.ts +71 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +86 -0
- package/dist/config.js.map +1 -0
- package/dist/diagnostic.d.ts +12 -0
- package/dist/diagnostic.d.ts.map +1 -0
- package/dist/diagnostic.js +25 -0
- package/dist/diagnostic.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/completion-body.d.ts +38 -0
- package/dist/internal/completion-body.d.ts.map +1 -0
- package/dist/internal/completion-body.js +62 -0
- package/dist/internal/completion-body.js.map +1 -0
- package/dist/internal/config-validate.d.ts +23 -0
- package/dist/internal/config-validate.d.ts.map +1 -0
- package/dist/internal/config-validate.js +122 -0
- package/dist/internal/config-validate.js.map +1 -0
- package/dist/internal/os.d.ts +30 -0
- package/dist/internal/os.d.ts.map +1 -0
- package/dist/internal/os.js +81 -0
- package/dist/internal/os.js.map +1 -0
- package/dist/internal/turn-render.d.ts +22 -0
- package/dist/internal/turn-render.d.ts.map +1 -0
- package/dist/internal/turn-render.js +40 -0
- package/dist/internal/turn-render.js.map +1 -0
- package/dist/mcp-config.d.ts +19 -0
- package/dist/mcp-config.d.ts.map +1 -0
- package/dist/mcp-config.js +22 -0
- package/dist/mcp-config.js.map +1 -0
- package/dist/provider-ref.d.ts +8 -0
- package/dist/provider-ref.d.ts.map +1 -0
- package/dist/provider-ref.js +8 -0
- package/dist/provider-ref.js.map +1 -0
- package/dist/provider.d.ts +60 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +110 -0
- package/dist/provider.js.map +1 -0
- package/dist/rpc.d.ts +45 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +212 -0
- package/dist/rpc.js.map +1 -0
- package/dist/runtime.d.ts +174 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +464 -0
- package/dist/runtime.js.map +1 -0
- package/dist/stream.d.ts +96 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +289 -0
- package/dist/stream.js.map +1 -0
- package/dist/supervisor.d.ts +17 -0
- package/dist/supervisor.d.ts.map +1 -0
- package/dist/supervisor.js +170 -0
- package/dist/supervisor.js.map +1 -0
- package/dist/types.d.ts +133 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Neutral config validation primitives.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from `config/config.ts` so that per-runtime config readers (each
|
|
5
|
+
* builtin's `agent-runtime/builtin/<name>/config.ts`) can validate their own
|
|
6
|
+
* config blocks without importing `config/config.ts` — importing the host
|
|
7
|
+
* config module from a builtin would re-form the builtin -> config import
|
|
8
|
+
* cycle. These helpers are runtime-agnostic: they only know about JSON shapes
|
|
9
|
+
* and produce `dreamux config error in <file>: ...` messages.
|
|
10
|
+
*/
|
|
11
|
+
export function isPlainObject(v) {
|
|
12
|
+
return v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
13
|
+
}
|
|
14
|
+
export function describeType(v) {
|
|
15
|
+
if (v === null)
|
|
16
|
+
return 'null';
|
|
17
|
+
if (Array.isArray(v))
|
|
18
|
+
return 'array';
|
|
19
|
+
return typeof v;
|
|
20
|
+
}
|
|
21
|
+
export function rejectUnknownKeys(obj, allowed, file, prefix) {
|
|
22
|
+
for (const key of Object.keys(obj)) {
|
|
23
|
+
if (allowed.has(key))
|
|
24
|
+
continue;
|
|
25
|
+
const name = `${prefix}${key}`;
|
|
26
|
+
if (/^dispatchers\[\d+\]\.$/.test(prefix) && (key === 'feishu' || key === 'codex')) {
|
|
27
|
+
throw new Error(`dreamux config error in ${file}: ${name} is not supported by the providerized config v2 schema.\n` +
|
|
28
|
+
'Dreamux 0.x does not silently migrate operator-owned config. Rebuild this dispatcher with ' +
|
|
29
|
+
'dispatchers[].channels[] for the channel and a named agents[] entry referenced via ' +
|
|
30
|
+
'dispatchers[].agentRuntime for the runtime, then restart.');
|
|
31
|
+
}
|
|
32
|
+
throw new Error(`dreamux config error in ${file}: ${name} is not supported by the providerized config v2 schema`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function ensureString(v, key, file) {
|
|
36
|
+
if (typeof v !== 'string') {
|
|
37
|
+
throw new Error(`dreamux config error in ${file}: ${key} must be a string (got ${describeType(v)})`);
|
|
38
|
+
}
|
|
39
|
+
return v;
|
|
40
|
+
}
|
|
41
|
+
function requireString(obj, key, fallback, file, prefix = '') {
|
|
42
|
+
const v = obj[key];
|
|
43
|
+
if (v === undefined)
|
|
44
|
+
return fallback;
|
|
45
|
+
return ensureString(v, `${prefix}${key}`, file);
|
|
46
|
+
}
|
|
47
|
+
export function requireNonEmptyString(obj, key, file, prefix = '') {
|
|
48
|
+
const value = requireString(obj, key, '', file, prefix);
|
|
49
|
+
if (value.trim() !== '')
|
|
50
|
+
return value;
|
|
51
|
+
throw new Error(`dreamux config error in ${file}: ${prefix}${key} must be a non-empty string`);
|
|
52
|
+
}
|
|
53
|
+
export function readOptionalString(obj, key, file, prefix = '') {
|
|
54
|
+
const v = obj[key];
|
|
55
|
+
if (v === undefined || v === null)
|
|
56
|
+
return null;
|
|
57
|
+
return ensureString(v, `${prefix}${key}`, file);
|
|
58
|
+
}
|
|
59
|
+
export function readOptionalBoolean(obj, key, fallback, file, prefix = '') {
|
|
60
|
+
const v = obj[key];
|
|
61
|
+
if (v === undefined)
|
|
62
|
+
return fallback;
|
|
63
|
+
if (typeof v === 'boolean')
|
|
64
|
+
return v;
|
|
65
|
+
throw new Error(`dreamux config error in ${file}: ${prefix}${key} must be a boolean (got ${describeType(v)})`);
|
|
66
|
+
}
|
|
67
|
+
export function requireStringArray(obj, key, fallback, file, prefix = '') {
|
|
68
|
+
const v = obj[key];
|
|
69
|
+
if (v === undefined)
|
|
70
|
+
return fallback;
|
|
71
|
+
if (!Array.isArray(v)) {
|
|
72
|
+
throw new Error(`dreamux config error in ${file}: ${prefix}${key} must be an array of strings (got ${describeType(v)})`);
|
|
73
|
+
}
|
|
74
|
+
return v.map((item, i) => {
|
|
75
|
+
if (typeof item !== 'string') {
|
|
76
|
+
throw new Error(`dreamux config error in ${file}: ${prefix}${key}[${i}] must be a string (got ${describeType(item)})`);
|
|
77
|
+
}
|
|
78
|
+
return item;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export function requireStringRecord(obj, key, fallback, file, prefix = '') {
|
|
82
|
+
const v = obj[key];
|
|
83
|
+
if (v === undefined)
|
|
84
|
+
return { ...fallback };
|
|
85
|
+
if (!isPlainObject(v)) {
|
|
86
|
+
throw new Error(`dreamux config error in ${file}: ${prefix}${key} must be an object of strings (got ${describeType(v)})`);
|
|
87
|
+
}
|
|
88
|
+
const out = {};
|
|
89
|
+
for (const [entryKey, entryValue] of Object.entries(v)) {
|
|
90
|
+
if (typeof entryValue !== 'string') {
|
|
91
|
+
throw new Error(`dreamux config error in ${file}: ${prefix}${key}.${entryKey} must be a string (got ${describeType(entryValue)})`);
|
|
92
|
+
}
|
|
93
|
+
out[entryKey] = entryValue;
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
function readInt(obj, key, file, prefix) {
|
|
98
|
+
const v = obj[key];
|
|
99
|
+
if (v === undefined)
|
|
100
|
+
return null;
|
|
101
|
+
if (typeof v === 'number' && Number.isInteger(v))
|
|
102
|
+
return v;
|
|
103
|
+
throw new Error(`dreamux config error in ${file}: ${prefix}${key} must be an integer (got ${describeType(v)})`);
|
|
104
|
+
}
|
|
105
|
+
export function requirePositiveInt(obj, key, fallback, file, prefix = '') {
|
|
106
|
+
const n = readInt(obj, key, file, prefix);
|
|
107
|
+
if (n === null)
|
|
108
|
+
return fallback;
|
|
109
|
+
if (n <= 0) {
|
|
110
|
+
throw new Error(`dreamux config error in ${file}: ${prefix}${key} must be > 0 (got ${n})`);
|
|
111
|
+
}
|
|
112
|
+
return n;
|
|
113
|
+
}
|
|
114
|
+
export function readProviderConfigObject(rawConfig, file, name, options = {}) {
|
|
115
|
+
if (rawConfig === undefined && options.allowMissing === true)
|
|
116
|
+
return {};
|
|
117
|
+
if (!isPlainObject(rawConfig)) {
|
|
118
|
+
throw new Error(`dreamux config error in ${file}: ${name} must be an object (got ${describeType(rawConfig)})`);
|
|
119
|
+
}
|
|
120
|
+
return rawConfig;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=config-validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-validate.js","sourceRoot":"","sources":["../../src/internal/config-validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,UAAU,aAAa,CAAC,CAAU;IACtC,OAAO,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAU;IACrC,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC;IACrC,OAAO,OAAO,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,GAA4B,EAC5B,OAAoB,EACpB,IAAY,EACZ,MAAc;IAEd,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,IAAI,OAAO,CAAC,GAAG,C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|
|
2
|
+
* Generic OS/filesystem utilities the Codex runtime needs, vendored into this
|
|
3
|
+
* package so it depends on `@excitedjs/dreamux-types` only and never imports
|
|
4
|
+
* `@excitedjs/dreamux` core. These are platform primitives (process-group
|
|
5
|
+
* signalling, owner-only dir enforcement, empty-log cleanup, existence probe),
|
|
6
|
+
* NOT Dreamux host layout/path/socket/log contracts — those are supplied by the
|
|
7
|
+
* host through the create context and provider options.
|
|
8
|
+
*/
|
|
9
|
+
/** True when `pid` names a live process (EPERM counts as alive). */
|
|
10
|
+
export declare function isProcessAlive(pid: number): boolean;
|
|
11
|
+
/** Signal an entire process group; ESRCH/EPERM are swallowed. */
|
|
12
|
+
export declare function killProcessGroup(pgid: number, signal: NodeJS.Signals | number): void;
|
|
13
|
+
export interface EnsureOwnerOnlyDirOptions {
|
|
14
|
+
/** Current-user uid probe override (tests). */
|
|
15
|
+
getuid?: () => number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create/adopt a directory and guarantee the owner-only (0700) privacy
|
|
19
|
+
* invariant regardless of who created it: reject a symlink leaf, fail loud on a
|
|
20
|
+
* foreign-uid dir, and tighten any group/other permission bits.
|
|
21
|
+
*/
|
|
22
|
+
export declare function ensureOwnerOnlyDir(path: string, options?: EnsureOwnerOnlyDirOptions): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Remove `path` only if it exists and is zero bytes. Best-effort: a missing,
|
|
25
|
+
* non-empty, or busy file is left untouched and never throws.
|
|
26
|
+
*/
|
|
27
|
+
export declare function removeEmptyLogFile(path: string): Promise<void>;
|
|
28
|
+
/** Best-effort existence probe — the async replacement for `existsSync`. */
|
|
29
|
+
export declare function pathExists(path: string): Promise<boolean>;
|
|
30
|
+
//# sourceMappingURL=os.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"os.d.ts","sourceRoot":"","sources":["../../src/internal/os.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CASnD;AAED,iEAAiE;AACjE,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,MAAM,GAC9B,IAAI,CASN;AAED,MAAM,WAAW,yBAAyB;IACxC,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOpE;AAED,4EAA4E;AAC5E,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO/D"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic OS/filesystem utilities the Codex runtime needs, vendored into this
|
|
3
|
+
* package so it depends on `@excitedjs/dreamux-types` only and never imports
|
|
4
|
+
* `@excitedjs/dreamux` core. These are platform primitives (process-group
|
|
5
|
+
* signalling, owner-only dir enforcement, empty-log cleanup, existence probe),
|
|
6
|
+
* NOT Dreamux host layout/path/socket/log contracts — those are supplied by the
|
|
7
|
+
* host through the create context and provider options.
|
|
8
|
+
*/
|
|
9
|
+
import { access, chmod, lstat, mkdir, stat, unlink } from 'node:fs/promises';
|
|
10
|
+
/** True when `pid` names a live process (EPERM counts as alive). */
|
|
11
|
+
export function isProcessAlive(pid) {
|
|
12
|
+
if (!Number.isFinite(pid) || pid <= 0)
|
|
13
|
+
return false;
|
|
14
|
+
try {
|
|
15
|
+
process.kill(pid, 0);
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
const errno = e.code;
|
|
20
|
+
return errno === 'EPERM';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** Signal an entire process group; ESRCH/EPERM are swallowed. */
|
|
24
|
+
export function killProcessGroup(pgid, signal) {
|
|
25
|
+
if (!Number.isFinite(pgid) || pgid <= 0)
|
|
26
|
+
return;
|
|
27
|
+
try {
|
|
28
|
+
process.kill(-pgid, signal);
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
const errno = e.code;
|
|
32
|
+
if (errno === 'ESRCH' || errno === 'EPERM')
|
|
33
|
+
return;
|
|
34
|
+
throw e;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create/adopt a directory and guarantee the owner-only (0700) privacy
|
|
39
|
+
* invariant regardless of who created it: reject a symlink leaf, fail loud on a
|
|
40
|
+
* foreign-uid dir, and tighten any group/other permission bits.
|
|
41
|
+
*/
|
|
42
|
+
export async function ensureOwnerOnlyDir(path, options = {}) {
|
|
43
|
+
await mkdir(path, { recursive: true, mode: 0o700 });
|
|
44
|
+
const info = await lstat(path);
|
|
45
|
+
if (info.isSymbolicLink()) {
|
|
46
|
+
throw new Error(`refusing to use Dreamux runtime directory ${path}: it is a symlink, not a real directory`);
|
|
47
|
+
}
|
|
48
|
+
const getuid = options.getuid ?? process.getuid?.bind(process);
|
|
49
|
+
if (getuid !== undefined && info.uid !== getuid()) {
|
|
50
|
+
throw new Error(`refusing to use Dreamux runtime directory ${path}: it is owned by uid ${info.uid}, ` +
|
|
51
|
+
`not the current user (uid ${getuid()})`);
|
|
52
|
+
}
|
|
53
|
+
if ((info.mode & 0o077) !== 0) {
|
|
54
|
+
await chmod(path, 0o700);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Remove `path` only if it exists and is zero bytes. Best-effort: a missing,
|
|
59
|
+
* non-empty, or busy file is left untouched and never throws.
|
|
60
|
+
*/
|
|
61
|
+
export async function removeEmptyLogFile(path) {
|
|
62
|
+
try {
|
|
63
|
+
const info = await stat(path);
|
|
64
|
+
if (info.size === 0)
|
|
65
|
+
await unlink(path);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
/* best effort — missing/busy/non-empty files are left as-is */
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** Best-effort existence probe — the async replacement for `existsSync`. */
|
|
72
|
+
export async function pathExists(path) {
|
|
73
|
+
try {
|
|
74
|
+
await access(path);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=os.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"os.js","sourceRoot":"","sources":["../../src/internal/os.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE7E,oEAAoE;AACpE,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACpD,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,KAAK,GAAI,CAA2B,CAAC,IAAI,CAAC;QAChD,OAAO,KAAK,KAAK,OAAO,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,MAA+B;IAE/B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;QAAE,OAAO;IAChD,IAAI,CAAC;QACH,OAAO,CAAC,IAA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,CAAC;QAC9B,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC;YAAE,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,+DAA+D;IACjE,CAAC;AACH,CAAC;AAED,4EAA4E;AAC5E,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC3C,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inbound-turn render helpers. The data shapes are published by
|
|
3
|
+
* `@excitedjs/dreamux-types`; these executable helpers render a neutral
|
|
4
|
+
* `InboundTurnInput` into Claude Code delivery text. Mirrors the host's neutral
|
|
5
|
+
* `agent-runtime/turn.ts` runtime helpers, vendored here so this package never
|
|
6
|
+
* imports `@excitedjs/dreamux` core.
|
|
7
|
+
*/
|
|
8
|
+
import type { InboundTurnInput } from '@excitedjs/dreamux-types';
|
|
9
|
+
export declare const DEFAULT_MESSAGE_ID_DEDUPE_WINDOW = 1024;
|
|
10
|
+
/**
|
|
11
|
+
* Wrap a channel turn body in the native `<channel source="…" …>` envelope.
|
|
12
|
+
* Only safe attribute keys (`^[a-zA-Z_][a-zA-Z0-9_]*$`) are rendered and every
|
|
13
|
+
* value is XML-escaped.
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderChannelBlock(source: string, attrs: ReadonlyArray<readonly [string, string]>, body: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Render an inbound turn to delivery text. A channel-structured input (both
|
|
18
|
+
* `attrs` and `body` present) is wrapped into the `<channel>` block; a plain
|
|
19
|
+
* input (e.g. a system trigger turn) passes its `text` through unchanged.
|
|
20
|
+
*/
|
|
21
|
+
export declare function renderChannelInput(input: InboundTurnInput): string;
|
|
22
|
+
//# sourceMappingURL=turn-render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-render.d.ts","sourceRoot":"","sources":["../../src/internal/turn-render.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,eAAO,MAAM,gCAAgC,OAAO,CAAC;AAYrD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC/C,IAAI,EAAE,MAAM,GACX,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAKlE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inbound-turn render helpers. The data shapes are published by
|
|
3
|
+
* `@excitedjs/dreamux-types`; these executable helpers render a neutral
|
|
4
|
+
* `InboundTurnInput` into Claude Code delivery text. Mirrors the host's neutral
|
|
5
|
+
* `agent-runtime/turn.ts` runtime helpers, vendored here so this package never
|
|
6
|
+
* imports `@excitedjs/dreamux` core.
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_MESSAGE_ID_DEDUPE_WINDOW = 1024;
|
|
9
|
+
const SAFE_CHANNEL_ATTR_KEY = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
10
|
+
function escapeChannelAttr(value) {
|
|
11
|
+
return value
|
|
12
|
+
.replaceAll('&', '&')
|
|
13
|
+
.replaceAll('<', '<')
|
|
14
|
+
.replaceAll('>', '>')
|
|
15
|
+
.replaceAll('"', '"');
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Wrap a channel turn body in the native `<channel source="…" …>` envelope.
|
|
19
|
+
* Only safe attribute keys (`^[a-zA-Z_][a-zA-Z0-9_]*$`) are rendered and every
|
|
20
|
+
* value is XML-escaped.
|
|
21
|
+
*/
|
|
22
|
+
export function renderChannelBlock(source, attrs, body) {
|
|
23
|
+
const rendered = attrs
|
|
24
|
+
.filter(([key]) => SAFE_CHANNEL_ATTR_KEY.test(key))
|
|
25
|
+
.map(([key, value]) => ` ${key}="${escapeChannelAttr(value)}"`)
|
|
26
|
+
.join('');
|
|
27
|
+
return `<channel source="${escapeChannelAttr(source)}"${rendered}>\n${body}\n</channel>`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Render an inbound turn to delivery text. A channel-structured input (both
|
|
31
|
+
* `attrs` and `body` present) is wrapped into the `<channel>` block; a plain
|
|
32
|
+
* input (e.g. a system trigger turn) passes its `text` through unchanged.
|
|
33
|
+
*/
|
|
34
|
+
export function renderChannelInput(input) {
|
|
35
|
+
if (input.attrs === undefined || input.body === undefined) {
|
|
36
|
+
return input.text;
|
|
37
|
+
}
|
|
38
|
+
return renderChannelBlock(input.source ?? 'channel', input.attrs, input.body);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=turn-render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-render.js","sourceRoot":"","sources":["../../src/internal/turn-render.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,CAAC;AAErD,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAEzD,SAAS,iBAAiB,CAAC,KAAa;IACtC,OAAO,KAAK;SACT,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;SACxB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,KAA+C,EAC/C,IAAY;IAEZ,MAAM,QAAQ,GAAG,KAAK;SACnB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAClD,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,KAAK,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC;SAC9D,IAAI,CAAC,EAAE,CAAC,CAAC;IACZ,OAAO,oBAAoB,iBAAiB,CAAC,MAAM,CAAC,IAAI,QAAQ,MAAM,IAAI,cAAc,CAAC;AAC3F,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAuB;IACxD,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1D,OAAO,KAAK,CAAC,IAAI,CAAC;IACpB,CAAC;IACD,OAAO,kBAAkB,CAAC,KAAK,CAAC,MAAM,IAAI,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code MCP config document translation.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `codex/mcp-config.ts`: the same Dreamux MCP descriptors become
|
|
5
|
+
* Claude Code's native JSON document loaded via `--mcp-config <file>`.
|
|
6
|
+
*/
|
|
7
|
+
import type { AgentRuntimeMcpServer } from '@excitedjs/dreamux-types';
|
|
8
|
+
/** Claude Code MCP config document shape (`--mcp-config <file>`). */
|
|
9
|
+
export interface ClaudeCodeMcpConfig {
|
|
10
|
+
mcpServers: Record<string, {
|
|
11
|
+
command: string;
|
|
12
|
+
args: string[];
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
/** Translate Dreamux MCP descriptors into Claude Code's MCP config document. */
|
|
16
|
+
export declare function claudeCodeMcpConfig(servers: readonly AgentRuntimeMcpServer[]): ClaudeCodeMcpConfig;
|
|
17
|
+
/** Serialize the Claude Code MCP config for writing to disk. */
|
|
18
|
+
export declare function stringifyClaudeCodeMcpConfig(servers: readonly AgentRuntimeMcpServer[]): string;
|
|
19
|
+
//# sourceMappingURL=mcp-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-config.d.ts","sourceRoot":"","sources":["../src/mcp-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEtE,qEAAqE;AACrE,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CACjE;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,SAAS,qBAAqB,EAAE,GACxC,mBAAmB,CASrB;AAED,gEAAgE;AAChE,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,SAAS,qBAAqB,EAAE,GACxC,MAAM,CAER"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code MCP config document translation.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `codex/mcp-config.ts`: the same Dreamux MCP descriptors become
|
|
5
|
+
* Claude Code's native JSON document loaded via `--mcp-config <file>`.
|
|
6
|
+
*/
|
|
7
|
+
/** Translate Dreamux MCP descriptors into Claude Code's MCP config document. */
|
|
8
|
+
export function claudeCodeMcpConfig(servers) {
|
|
9
|
+
const mcpServers = {};
|
|
10
|
+
for (const server of servers) {
|
|
11
|
+
mcpServers[server.name] = {
|
|
12
|
+
command: server.command,
|
|
13
|
+
args: [...server.args],
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return { mcpServers };
|
|
17
|
+
}
|
|
18
|
+
/** Serialize the Claude Code MCP config for writing to disk. */
|
|
19
|
+
export function stringifyClaudeCodeMcpConfig(servers) {
|
|
20
|
+
return `${JSON.stringify(claudeCodeMcpConfig(servers), null, 2)}\n`;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=mcp-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-config.js","sourceRoot":"","sources":["../src/mcp-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,gFAAgF;AAChF,MAAM,UAAU,mBAAmB,CACjC,OAAyC;IAEzC,MAAM,UAAU,GAAsC,EAAE,CAAC;IACzD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG;YACxB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC;SACvB,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,4BAA4B,CAC1C,OAAyC;IAEzC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stable built-in provider ref this package ships behind. Dreamux core maps
|
|
3
|
+
* `builtin:claude-code` to `@excitedjs/agent-runtime-claude-code`; the ref string
|
|
4
|
+
* is the package's own public identity, so it is owned here rather than imported
|
|
5
|
+
* from core (which this package must never depend on).
|
|
6
|
+
*/
|
|
7
|
+
export declare const BUILTIN_CLAUDE_CODE_PROVIDER_REF = "builtin:claude-code";
|
|
8
|
+
//# sourceMappingURL=provider-ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-ref.d.ts","sourceRoot":"","sources":["../src/provider-ref.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stable built-in provider ref this package ships behind. Dreamux core maps
|
|
3
|
+
* `builtin:claude-code` to `@excitedjs/agent-runtime-claude-code`; the ref string
|
|
4
|
+
* is the package's own public identity, so it is owned here rather than imported
|
|
5
|
+
* from core (which this package must never depend on).
|
|
6
|
+
*/
|
|
7
|
+
export const BUILTIN_CLAUDE_CODE_PROVIDER_REF = 'builtin:claude-code';
|
|
8
|
+
//# sourceMappingURL=provider-ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-ref.js","sourceRoot":"","sources":["../src/provider-ref.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { dispatcherClaudeCodeConfig, type DispatcherClaudeCodeConfig } from './config.js';
|
|
2
|
+
import { type ClaudeCodeSessionFactory } from './supervisor.js';
|
|
3
|
+
import type { AgentRuntimeCapabilities, AgentRuntimeProvider, AgentRuntimeProviderDescriptor, AgentRuntimeProviderFactory, ProviderDescriptor, ProviderFactoryContext } from '@excitedjs/dreamux-types';
|
|
4
|
+
/**
|
|
5
|
+
* Construction options for the built-in Claude Code provider. Env injection now
|
|
6
|
+
* arrives on the NEUTRAL create context (`context.injectEnv`), not as a factory
|
|
7
|
+
* hook. What remains here is the `descriptor` and the test/host seams (the
|
|
8
|
+
* resident-session factory, an optional host bin resolver) that let core and
|
|
9
|
+
* tests wire behavior without changing the provider.
|
|
10
|
+
*/
|
|
11
|
+
export interface ClaudeCodeAgentRuntimeProviderOptions {
|
|
12
|
+
/**
|
|
13
|
+
* The registry descriptor for `builtin:claude-code`. Defaults to a minimal
|
|
14
|
+
* one. Accepted wide (`ProviderDescriptor`) so a host that resolved it from
|
|
15
|
+
* its registry need not pre-narrow the kind; the factory validates it is an
|
|
16
|
+
* `agentRuntime` descriptor.
|
|
17
|
+
*/
|
|
18
|
+
descriptor?: ProviderDescriptor;
|
|
19
|
+
/** Optional host-level bin resolver (default: identity on the config bin). */
|
|
20
|
+
resolveBinPath?: (bin: string) => string;
|
|
21
|
+
/** Override the resident-session factory (tests inject a fake). */
|
|
22
|
+
sessionFactory?: ClaudeCodeSessionFactory;
|
|
23
|
+
}
|
|
24
|
+
export declare const CLAUDE_CODE_AGENT_RUNTIME_CAPABILITIES: AgentRuntimeCapabilities;
|
|
25
|
+
/**
|
|
26
|
+
* Create the built-in Claude Code `AgentRuntimeProvider`. It implements the
|
|
27
|
+
* neutral `@excitedjs/dreamux-types` contract: `readConfig` parses Claude Code
|
|
28
|
+
* runtime config, `getCapabilities` reports its append/synthesized/plain-turn
|
|
29
|
+
* shape, and `createRuntime` builds a {@link ClaudeCodeRuntime} from the neutral
|
|
30
|
+
* create context plus the host-supplied options.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createClaudeCodeAgentRuntimeProvider(options?: ClaudeCodeAgentRuntimeProviderOptions): AgentRuntimeProvider<DispatcherClaudeCodeConfig>;
|
|
33
|
+
/** Re-export the typed accessor for a runtime's resolved claude-code config. */
|
|
34
|
+
export { dispatcherClaudeCodeConfig };
|
|
35
|
+
/**
|
|
36
|
+
* The context Dreamux core's generic provider package-loader passes to this
|
|
37
|
+
* package's factory export. A back-compat alias of the public
|
|
38
|
+
* {@link ProviderFactoryContext}, narrowed to the Agent Runtime descriptor kind
|
|
39
|
+
* so the factory assigns `descriptor` without a cast.
|
|
40
|
+
*/
|
|
41
|
+
export type ClaudeCodeProviderFactoryContext = ProviderFactoryContext<AgentRuntimeProviderDescriptor>;
|
|
42
|
+
/**
|
|
43
|
+
* Default export — the factory Dreamux core's generic provider-loader selects
|
|
44
|
+
* for the `builtin:claude-code` ref (it imports this package and calls the
|
|
45
|
+
* default export with `{ ref, descriptor }`). It returns a provider that runs on
|
|
46
|
+
* package defaults: the real resident-session factory, an identity bin resolver,
|
|
47
|
+
* and `process.env` base env.
|
|
48
|
+
*
|
|
49
|
+
* The Dreamux host does NOT use this bare path in production: its launcher still
|
|
50
|
+
* drives the host-shaped create context, so it constructs the provider through
|
|
51
|
+
* its own core-owned adapter (`@excitedjs/dreamux`
|
|
52
|
+
* `builtin/claude-code/provider.ts`) to map that context onto the neutral one
|
|
53
|
+
* AND inject its host contracts (the package-bin `PATH`, the durable state sink,
|
|
54
|
+
* the per-dispatcher path context). This default export keeps the package a
|
|
55
|
+
* first-class, loadable `AgentRuntimeProvider` for the generic loader and for
|
|
56
|
+
* external embedders.
|
|
57
|
+
*/
|
|
58
|
+
declare const claudeCodeAgentRuntimeProviderFactory: AgentRuntimeProviderFactory<DispatcherClaudeCodeConfig>;
|
|
59
|
+
export default claudeCodeAgentRuntimeProviderFactory;
|
|
60
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,0BAA0B,EAE1B,KAAK,0BAA0B,EAChC,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EACV,wBAAwB,EAGxB,oBAAoB,EACpB,8BAA8B,EAC9B,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,WAAW,qCAAqC;IACpD;;;;;OAKG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,8EAA8E;IAC9E,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,mEAAmE;IACnE,cAAc,CAAC,EAAE,wBAAwB,CAAC;CAC3C;AAED,eAAO,MAAM,sCAAsC,EAAE,wBAcpD,CAAC;AAyBF;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,GAAE,qCAA0C,GAClD,oBAAoB,CAAC,0BAA0B,CAAC,CAyDlD;AAED,gFAAgF;AAChF,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,MAAM,gCAAgC,GAC1C,sBAAsB,CAAC,8BAA8B,CAAC,CAAC;AAEzD;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,qCAAqC,EAAE,2BAA2B,CAAC,0BAA0B,CAEvB,CAAC;AAE7E,eAAe,qCAAqC,CAAC"}
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { ClaudeCodeRuntime, } from './runtime.js';
|
|
2
|
+
import { dispatcherClaudeCodeConfig, readDispatcherClaudeCodeConfig, } from './config.js';
|
|
3
|
+
import { createDefaultClaudeCodeSession, } from './supervisor.js';
|
|
4
|
+
import { BUILTIN_CLAUDE_CODE_PROVIDER_REF } from './provider-ref.js';
|
|
5
|
+
import { claudeCodeAgentRuntimeDiagnostic } from './diagnostic.js';
|
|
6
|
+
export const CLAUDE_CODE_AGENT_RUNTIME_CAPABILITIES = {
|
|
7
|
+
resume: { supported: true, checkpoint: 'claudeCodeSession' },
|
|
8
|
+
steer: { supported: true },
|
|
9
|
+
events: { kind: 'synthesized' },
|
|
10
|
+
last: { supported: true },
|
|
11
|
+
context: { supported: false },
|
|
12
|
+
systemPrompt: { mode: 'append' },
|
|
13
|
+
teammateCompletion: [
|
|
14
|
+
{
|
|
15
|
+
kind: 'claudeCodePlainTurn',
|
|
16
|
+
description: 'deliver the completion as a plain user turn (no task-notification harness path)',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
const DEFAULT_CLAUDE_CODE_DESCRIPTOR = {
|
|
21
|
+
id: 'claude-code',
|
|
22
|
+
kind: 'agentRuntime',
|
|
23
|
+
ref: {
|
|
24
|
+
source: 'builtin',
|
|
25
|
+
id: 'claude-code',
|
|
26
|
+
raw: BUILTIN_CLAUDE_CODE_PROVIDER_REF,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
/** Validate + narrow a seed descriptor to the Agent Runtime kind. */
|
|
30
|
+
function asAgentRuntimeDescriptor(descriptor) {
|
|
31
|
+
if (descriptor.kind !== 'agentRuntime') {
|
|
32
|
+
throw new Error(`@excitedjs/agent-runtime-claude-code: descriptor.kind must be ` +
|
|
33
|
+
`'agentRuntime' (got ${JSON.stringify(descriptor.kind)})`);
|
|
34
|
+
}
|
|
35
|
+
return { ...descriptor, kind: descriptor.kind };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create the built-in Claude Code `AgentRuntimeProvider`. It implements the
|
|
39
|
+
* neutral `@excitedjs/dreamux-types` contract: `readConfig` parses Claude Code
|
|
40
|
+
* runtime config, `getCapabilities` reports its append/synthesized/plain-turn
|
|
41
|
+
* shape, and `createRuntime` builds a {@link ClaudeCodeRuntime} from the neutral
|
|
42
|
+
* create context plus the host-supplied options.
|
|
43
|
+
*/
|
|
44
|
+
export function createClaudeCodeAgentRuntimeProvider(options = {}) {
|
|
45
|
+
const sessionFactory = options.sessionFactory ?? createDefaultClaudeCodeSession;
|
|
46
|
+
const resolveBinPath = options.resolveBinPath ?? ((bin) => bin);
|
|
47
|
+
return {
|
|
48
|
+
ref: BUILTIN_CLAUDE_CODE_PROVIDER_REF,
|
|
49
|
+
descriptor: options.descriptor === undefined
|
|
50
|
+
? DEFAULT_CLAUDE_CODE_DESCRIPTOR
|
|
51
|
+
: asAgentRuntimeDescriptor(options.descriptor),
|
|
52
|
+
getCapabilities: () => CLAUDE_CODE_AGENT_RUNTIME_CAPABILITIES,
|
|
53
|
+
diagnostic: claudeCodeAgentRuntimeDiagnostic,
|
|
54
|
+
readConfig(rawConfig, context) {
|
|
55
|
+
return readDispatcherClaudeCodeConfig(rawConfig, context.file, context.prefix);
|
|
56
|
+
},
|
|
57
|
+
createRuntime(context) {
|
|
58
|
+
if (context.state === undefined) {
|
|
59
|
+
throw new Error('claude-code runtime requires a state sink in the create context');
|
|
60
|
+
}
|
|
61
|
+
if (context.paths === undefined) {
|
|
62
|
+
throw new Error('claude-code runtime requires a path context in the create context');
|
|
63
|
+
}
|
|
64
|
+
const deps = {
|
|
65
|
+
config: context.config,
|
|
66
|
+
cwd: context.cwd,
|
|
67
|
+
state: context.state,
|
|
68
|
+
paths: context.paths,
|
|
69
|
+
mcpServers: context.mcpServers,
|
|
70
|
+
sessionFactory,
|
|
71
|
+
resolveBinPath,
|
|
72
|
+
...(context.injectEnv !== undefined
|
|
73
|
+
? { injectEnv: context.injectEnv }
|
|
74
|
+
: {}),
|
|
75
|
+
...(context.skillSources !== undefined
|
|
76
|
+
? { skillSources: context.skillSources }
|
|
77
|
+
: {}),
|
|
78
|
+
...(context.systemPromptContent !== undefined
|
|
79
|
+
? { systemPromptContent: context.systemPromptContent }
|
|
80
|
+
: {}),
|
|
81
|
+
...(context.onTurnSettled !== undefined
|
|
82
|
+
? { onTurnSettled: context.onTurnSettled }
|
|
83
|
+
: {}),
|
|
84
|
+
...(context.logger !== undefined ? { logger: context.logger } : {}),
|
|
85
|
+
};
|
|
86
|
+
return new ClaudeCodeRuntime(context.identity, deps);
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** Re-export the typed accessor for a runtime's resolved claude-code config. */
|
|
91
|
+
export { dispatcherClaudeCodeConfig };
|
|
92
|
+
/**
|
|
93
|
+
* Default export — the factory Dreamux core's generic provider-loader selects
|
|
94
|
+
* for the `builtin:claude-code` ref (it imports this package and calls the
|
|
95
|
+
* default export with `{ ref, descriptor }`). It returns a provider that runs on
|
|
96
|
+
* package defaults: the real resident-session factory, an identity bin resolver,
|
|
97
|
+
* and `process.env` base env.
|
|
98
|
+
*
|
|
99
|
+
* The Dreamux host does NOT use this bare path in production: its launcher still
|
|
100
|
+
* drives the host-shaped create context, so it constructs the provider through
|
|
101
|
+
* its own core-owned adapter (`@excitedjs/dreamux`
|
|
102
|
+
* `builtin/claude-code/provider.ts`) to map that context onto the neutral one
|
|
103
|
+
* AND inject its host contracts (the package-bin `PATH`, the durable state sink,
|
|
104
|
+
* the per-dispatcher path context). This default export keeps the package a
|
|
105
|
+
* first-class, loadable `AgentRuntimeProvider` for the generic loader and for
|
|
106
|
+
* external embedders.
|
|
107
|
+
*/
|
|
108
|
+
const claudeCodeAgentRuntimeProviderFactory = (context) => createClaudeCodeAgentRuntimeProvider({ descriptor: context.descriptor });
|
|
109
|
+
export default claudeCodeAgentRuntimeProviderFactory;
|
|
110
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAElB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,GAE/B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,8BAA8B,GAE/B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AAiCnE,MAAM,CAAC,MAAM,sCAAsC,GAA6B;IAC9E,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,mBAAmB,EAAE;IAC5D,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IAC1B,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;IAC/B,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IACzB,OAAO,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;IAC7B,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAChC,kBAAkB,EAAE;QAClB;YACE,IAAI,EAAE,qBAAqB;YAC3B,WAAW,EACT,iFAAiF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AAC;AAED,gFAAgF;AAChF,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAWtC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,qCAAqC,GACzC,CAAC,OAAO,EAAE,EAAE,CACV,oCAAoC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;AAE7E,eAAe,qCAAqC,CAAC"}
|
package/dist/rpc.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code stream-json turn RPC.
|
|
3
|
+
*
|
|
4
|
+
* The supervisor owns the child process. This class owns one in-flight turn,
|
|
5
|
+
* stdout line demux, turn aggregation, and defensive control-request replies.
|
|
6
|
+
*/
|
|
7
|
+
import type { Writable } from 'node:stream';
|
|
8
|
+
import type { TurnOutcome, TurnSubmitOptions } from './types.js';
|
|
9
|
+
export interface ClaudeCodeStreamRpcOptions {
|
|
10
|
+
turnTimeoutMs: number;
|
|
11
|
+
log?: (level: 'info' | 'warn' | 'error', msg: string, err?: unknown) => void;
|
|
12
|
+
reapOnTimeout: () => void;
|
|
13
|
+
onRemoteControlUrl?: (url: string) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare class ClaudeCodeStreamRpc {
|
|
16
|
+
private readonly stdin;
|
|
17
|
+
private readonly options;
|
|
18
|
+
private readonly lineBuf;
|
|
19
|
+
private pending;
|
|
20
|
+
private remoteControlRequestId;
|
|
21
|
+
constructor(stdin: Writable, options: ClaudeCodeStreamRpcOptions);
|
|
22
|
+
submitTurn(prompt: string, options?: TurnSubmitOptions): Promise<TurnOutcome>;
|
|
23
|
+
steerTurn(prompt: string, options?: TurnSubmitOptions): Promise<void>;
|
|
24
|
+
onStdoutChunk(chunk: string): void;
|
|
25
|
+
failPending(err: Error): void;
|
|
26
|
+
enableRemoteControl(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Detach the in-flight turn: clear its deadline timer and null `pending`,
|
|
29
|
+
* returning it so the caller can resolve or reject it exactly once.
|
|
30
|
+
*/
|
|
31
|
+
private settlePending;
|
|
32
|
+
/**
|
|
33
|
+
* (Re)arm the per-turn idle deadline. `turnTimeoutMs` is a *max-idle* window,
|
|
34
|
+
* not a total-turn cap: any inbound stream line for this turn pushes it out
|
|
35
|
+
* (see `onLine`). A genuinely wedged child (no stream activity for the whole
|
|
36
|
+
* window) is still reaped — preserving the #120 anti-hang intent — but a long
|
|
37
|
+
* but continuously-streaming turn never trips the deadline (#156).
|
|
38
|
+
*/
|
|
39
|
+
private armIdleTimer;
|
|
40
|
+
private onLine;
|
|
41
|
+
private deferSteeredResult;
|
|
42
|
+
private onControlRequest;
|
|
43
|
+
private onControlResponse;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=rpc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAY5C,OAAO,KAAK,EAAc,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAY7E,MAAM,WAAW,0BAA0B;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7E,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,qBAAa,mBAAmB;IAM5B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAN1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,sBA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