@claudexor/core 1.0.0
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 +7 -0
- package/dist/adapter.d.ts +56 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +8 -0
- package/dist/adapter.js.map +1 -0
- package/dist/browser-mcp.d.ts +18 -0
- package/dist/browser-mcp.d.ts.map +1 -0
- package/dist/browser-mcp.js +32 -0
- package/dist/browser-mcp.js.map +1 -0
- package/dist/capabilities.d.ts +4 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +8 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/conformance.d.ts +25 -0
- package/dist/conformance.d.ts.map +1 -0
- package/dist/conformance.js +60 -0
- package/dist/conformance.js.map +1 -0
- package/dist/diff.d.ts +71 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +325 -0
- package/dist/diff.js.map +1 -0
- package/dist/doctor.d.ts +7 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +75 -0
- package/dist/doctor.js.map +1 -0
- package/dist/effort.d.ts +18 -0
- package/dist/effort.d.ts.map +1 -0
- package/dist/effort.js +49 -0
- package/dist/effort.js.map +1 -0
- package/dist/env-scope.d.ts +38 -0
- package/dist/env-scope.d.ts.map +1 -0
- package/dist/env-scope.js +139 -0
- package/dist/env-scope.js.map +1 -0
- package/dist/errors.d.ts +16 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +17 -0
- package/dist/errors.js.map +1 -0
- package/dist/inactivity.d.ts +31 -0
- package/dist/inactivity.d.ts.map +1 -0
- package/dist/inactivity.js +77 -0
- package/dist/inactivity.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/model.d.ts +23 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +21 -0
- package/dist/model.js.map +1 -0
- package/dist/proc.d.ts +68 -0
- package/dist/proc.d.ts.map +1 -0
- package/dist/proc.js +283 -0
- package/dist/proc.js.map +1 -0
- package/dist/process-registry.d.ts +8 -0
- package/dist/process-registry.d.ts.map +1 -0
- package/dist/process-registry.js +20 -0
- package/dist/process-registry.js.map +1 -0
- package/dist/runloop.d.ts +35 -0
- package/dist/runloop.d.ts.map +1 -0
- package/dist/runloop.js +156 -0
- package/dist/runloop.js.map +1 -0
- package/dist/runtime-env.d.ts +16 -0
- package/dist/runtime-env.d.ts.map +1 -0
- package/dist/runtime-env.js +51 -0
- package/dist/runtime-env.js.map +1 -0
- package/package.json +40 -0
package/dist/proc.js
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { registerChildProcess, unregisterChildProcess } from "./process-registry.js";
|
|
3
|
+
import { createInterface } from "node:readline";
|
|
4
|
+
import { composeBaseEnv } from "./env-scope.js";
|
|
5
|
+
/**
|
|
6
|
+
* Spawn a process and stream stdout/stderr lines as they arrive, ending with an
|
|
7
|
+
* `exit` event. Throws (rejects the iterator) if the binary cannot be spawned
|
|
8
|
+
* (e.g. ENOENT) so callers can detect an unavailable harness.
|
|
9
|
+
*/
|
|
10
|
+
export async function* spawnProcess(cmd, args, opts = {}) {
|
|
11
|
+
const env = composeBaseEnv(opts.inheritEnv ?? "mirror_native");
|
|
12
|
+
for (const [key, value] of Object.entries(opts.env ?? {})) {
|
|
13
|
+
if (value === undefined || value === null)
|
|
14
|
+
delete env[key];
|
|
15
|
+
else
|
|
16
|
+
env[key] = value;
|
|
17
|
+
}
|
|
18
|
+
const child = spawn(cmd, args, {
|
|
19
|
+
cwd: opts.cwd,
|
|
20
|
+
env,
|
|
21
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
22
|
+
// Put the child in its own process group so we can signal the WHOLE tree.
|
|
23
|
+
// Harnesses spawn grandchildren (shell tools, MCP servers); without this a
|
|
24
|
+
// cancel/timeout signals only the direct child and grandchildren leak,
|
|
25
|
+
// keep writing to the worktree, or hang the run forever.
|
|
26
|
+
detached: true,
|
|
27
|
+
});
|
|
28
|
+
if (typeof child.pid === "number")
|
|
29
|
+
registerChildProcess(child.pid, cmd);
|
|
30
|
+
// Signal the child's process GROUP (negative pid) so grandchildren die too;
|
|
31
|
+
// fall back to the direct child if the group is already gone.
|
|
32
|
+
const killTree = (signal) => {
|
|
33
|
+
try {
|
|
34
|
+
if (typeof child.pid === "number")
|
|
35
|
+
process.kill(-child.pid, signal);
|
|
36
|
+
else
|
|
37
|
+
child.kill(signal);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
try {
|
|
41
|
+
child.kill(signal);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
/* already gone */
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
// A child can exit before/while stdin is written (e.g. a failing `git apply`).
|
|
49
|
+
// Without a handler the resulting EPIPE becomes an unhandled 'error' event and
|
|
50
|
+
// can crash the host process; the exit event already carries the real outcome.
|
|
51
|
+
child.stdin.on("error", () => { });
|
|
52
|
+
if (opts.input !== undefined) {
|
|
53
|
+
child.stdin.write(opts.input);
|
|
54
|
+
}
|
|
55
|
+
if (opts.keepStdinOpen) {
|
|
56
|
+
opts.onSpawn?.({
|
|
57
|
+
write: (data) => {
|
|
58
|
+
try {
|
|
59
|
+
child.stdin.write(data);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
/* child already gone; exit event carries the outcome */
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
end: () => {
|
|
66
|
+
try {
|
|
67
|
+
child.stdin.end();
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
/* already closed */
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
child.stdin.end();
|
|
77
|
+
}
|
|
78
|
+
const queue = [];
|
|
79
|
+
let wake = null;
|
|
80
|
+
let finished = false;
|
|
81
|
+
let spawnError = null;
|
|
82
|
+
const push = (e) => {
|
|
83
|
+
queue.push(e);
|
|
84
|
+
if (wake) {
|
|
85
|
+
wake();
|
|
86
|
+
wake = null;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const rlOut = createInterface({ input: child.stdout });
|
|
90
|
+
const rlErr = createInterface({ input: child.stderr });
|
|
91
|
+
rlOut.on("line", (line) => push({ type: "stdout", line }));
|
|
92
|
+
rlErr.on("line", (line) => push({ type: "stderr", line }));
|
|
93
|
+
child.on("error", (err) => {
|
|
94
|
+
if (typeof child.pid === "number")
|
|
95
|
+
unregisterChildProcess(child.pid);
|
|
96
|
+
spawnError = err;
|
|
97
|
+
finished = true;
|
|
98
|
+
if (wake) {
|
|
99
|
+
wake();
|
|
100
|
+
wake = null;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
child.on("close", (code, signal) => {
|
|
104
|
+
if (typeof child.pid === "number")
|
|
105
|
+
unregisterChildProcess(child.pid);
|
|
106
|
+
push({ type: "exit", code, signal });
|
|
107
|
+
finished = true;
|
|
108
|
+
if (wake) {
|
|
109
|
+
wake();
|
|
110
|
+
wake = null;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
let timer;
|
|
114
|
+
if (opts.timeoutMs && opts.timeoutMs > 0) {
|
|
115
|
+
timer = setTimeout(() => killTree("SIGKILL"), opts.timeoutMs);
|
|
116
|
+
}
|
|
117
|
+
let killTimer;
|
|
118
|
+
const requestCancel = () => {
|
|
119
|
+
if (finished)
|
|
120
|
+
return;
|
|
121
|
+
killTree(opts.cancelSignal ?? "SIGINT");
|
|
122
|
+
const killDelay = opts.cancelKillDelayMs ?? 1_000;
|
|
123
|
+
if (killDelay >= 0 && !killTimer) {
|
|
124
|
+
// Escalate to SIGKILL of the whole group if the cooperative signal is
|
|
125
|
+
// ignored. NOT unref'd: the escalation must actually fire (a prior
|
|
126
|
+
// unref let an ignoring child outlive the parent). It is cleared on a
|
|
127
|
+
// clean finish below.
|
|
128
|
+
killTimer = setTimeout(() => {
|
|
129
|
+
if (!finished)
|
|
130
|
+
killTree("SIGKILL");
|
|
131
|
+
}, killDelay);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const abortSignal = opts.abortSignal;
|
|
135
|
+
if (abortSignal) {
|
|
136
|
+
if (abortSignal.aborted)
|
|
137
|
+
requestCancel();
|
|
138
|
+
else
|
|
139
|
+
abortSignal.addEventListener("abort", requestCancel, { once: true });
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
for (;;) {
|
|
143
|
+
if (queue.length > 0) {
|
|
144
|
+
yield queue.shift();
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (spawnError)
|
|
148
|
+
throw spawnError;
|
|
149
|
+
if (finished)
|
|
150
|
+
return;
|
|
151
|
+
await new Promise((resolve) => {
|
|
152
|
+
wake = resolve;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
finally {
|
|
157
|
+
if (timer)
|
|
158
|
+
clearTimeout(timer);
|
|
159
|
+
abortSignal?.removeEventListener("abort", requestCancel);
|
|
160
|
+
if (!finished) {
|
|
161
|
+
requestCancel();
|
|
162
|
+
}
|
|
163
|
+
if (finished && killTimer)
|
|
164
|
+
clearTimeout(killTimer);
|
|
165
|
+
rlOut.close();
|
|
166
|
+
rlErr.close();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/** Run a process to completion, capturing stdout/stderr. Throws on spawn error. */
|
|
170
|
+
export async function runCapture(cmd, args, opts = {}) {
|
|
171
|
+
let stdout = "";
|
|
172
|
+
let stderr = "";
|
|
173
|
+
let code = null;
|
|
174
|
+
let signal = null;
|
|
175
|
+
for await (const ev of spawnProcess(cmd, args, opts)) {
|
|
176
|
+
if (ev.type === "stdout")
|
|
177
|
+
stdout += ev.line + "\n";
|
|
178
|
+
else if (ev.type === "stderr")
|
|
179
|
+
stderr += ev.line + "\n";
|
|
180
|
+
else {
|
|
181
|
+
code = ev.code;
|
|
182
|
+
signal = ev.signal;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return { code, signal, stdout, stderr };
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* BYTE-FAITHFUL capture: `runCapture` rides readline, which splits
|
|
189
|
+
* on lone `\r` too and rejoins with `\n` — destroying CR bytes in CRLF file
|
|
190
|
+
* content and fabricating trailing newlines. Diff-carrying git output MUST
|
|
191
|
+
* come through here, or `final/patch.diff` is corrupted at the source and
|
|
192
|
+
* fails `git apply` downstream. Raw buffers, no line splitting, no
|
|
193
|
+
* fabrication; the same spawn machinery (process group, abort, timeout).
|
|
194
|
+
*/
|
|
195
|
+
export async function runCaptureRaw(cmd, args, opts = {}) {
|
|
196
|
+
const env = composeBaseEnv(opts.inheritEnv ?? "mirror_native");
|
|
197
|
+
for (const [key, value] of Object.entries(opts.env ?? {})) {
|
|
198
|
+
if (value === undefined || value === null)
|
|
199
|
+
delete env[key];
|
|
200
|
+
else
|
|
201
|
+
env[key] = value;
|
|
202
|
+
}
|
|
203
|
+
const child = spawn(cmd, args, {
|
|
204
|
+
cwd: opts.cwd,
|
|
205
|
+
env,
|
|
206
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
207
|
+
detached: true,
|
|
208
|
+
});
|
|
209
|
+
if (typeof child.pid === "number")
|
|
210
|
+
registerChildProcess(child.pid, cmd);
|
|
211
|
+
const killTree = (signal) => {
|
|
212
|
+
try {
|
|
213
|
+
if (typeof child.pid === "number")
|
|
214
|
+
process.kill(-child.pid, signal);
|
|
215
|
+
else
|
|
216
|
+
child.kill(signal);
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
try {
|
|
220
|
+
child.kill(signal);
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
/* already gone */
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
child.stdin.on("error", () => { });
|
|
228
|
+
if (opts.input !== undefined)
|
|
229
|
+
child.stdin.write(opts.input);
|
|
230
|
+
child.stdin.end();
|
|
231
|
+
const stdoutChunks = [];
|
|
232
|
+
const stderrChunks = [];
|
|
233
|
+
child.stdout.on("data", (c) => stdoutChunks.push(c));
|
|
234
|
+
child.stderr.on("data", (c) => stderrChunks.push(c));
|
|
235
|
+
let killTimer;
|
|
236
|
+
const requestCancel = () => {
|
|
237
|
+
killTree(opts.cancelSignal ?? "SIGINT");
|
|
238
|
+
const killDelay = opts.cancelKillDelayMs ?? 1_000;
|
|
239
|
+
if (killDelay >= 0 && !killTimer) {
|
|
240
|
+
killTimer = setTimeout(() => killTree("SIGKILL"), killDelay);
|
|
241
|
+
killTimer.unref?.();
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
let timer;
|
|
245
|
+
if (opts.timeoutMs && opts.timeoutMs > 0) {
|
|
246
|
+
timer = setTimeout(() => killTree("SIGKILL"), opts.timeoutMs);
|
|
247
|
+
}
|
|
248
|
+
const abortSignal = opts.abortSignal;
|
|
249
|
+
if (abortSignal) {
|
|
250
|
+
if (abortSignal.aborted)
|
|
251
|
+
requestCancel();
|
|
252
|
+
else
|
|
253
|
+
abortSignal.addEventListener("abort", requestCancel, { once: true });
|
|
254
|
+
}
|
|
255
|
+
try {
|
|
256
|
+
const [code, signal] = await new Promise((resolve, reject) => {
|
|
257
|
+
child.on("error", (err) => {
|
|
258
|
+
if (typeof child.pid === "number")
|
|
259
|
+
unregisterChildProcess(child.pid);
|
|
260
|
+
reject(err);
|
|
261
|
+
});
|
|
262
|
+
child.on("close", (c, s) => {
|
|
263
|
+
if (typeof child.pid === "number")
|
|
264
|
+
unregisterChildProcess(child.pid);
|
|
265
|
+
resolve([c, s]);
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
return {
|
|
269
|
+
code,
|
|
270
|
+
signal,
|
|
271
|
+
stdout: Buffer.concat(stdoutChunks).toString("utf8"),
|
|
272
|
+
stderr: Buffer.concat(stderrChunks).toString("utf8"),
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
finally {
|
|
276
|
+
if (timer)
|
|
277
|
+
clearTimeout(timer);
|
|
278
|
+
if (killTimer)
|
|
279
|
+
clearTimeout(killTimer);
|
|
280
|
+
abortSignal?.removeEventListener("abort", requestCancel);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=proc.js.map
|
package/dist/proc.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proc.js","sourceRoot":"","sources":["../src/proc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AA0ChD;;;;GAIG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,YAAY,CACjC,GAAW,EACX,IAAc,EACd,OAAqB,EAAE;IAEvB,MAAM,GAAG,GAAsB,cAAc,CAAC,IAAI,CAAC,UAAU,IAAI,eAAe,CAAC,CAAC;IAClF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,CAAC;QAC1D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;;YACtD,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACxB,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE;QAC7B,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,GAAG;QACH,KAAK,EAAE,CAAC,MAAM,EAA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CAAC,EAAE,CAAC,EAAE,EAAE;gBACzB,IAAI,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;oBAAE,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACrE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO;YACL,IAAI;YACJ,MAAM;YACN,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;YACpD,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;SACrD,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,SAAS;YAAE,YAAY,CAAC,SAAS,CAAC,CAAC;QACvC,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function registerChildProcess(pid: number, cmd: string): void;
|
|
2
|
+
export declare function unregisterChildProcess(pid: number): void;
|
|
3
|
+
/** Snapshot of currently-live child process groups: pid + command name. */
|
|
4
|
+
export declare function liveChildProcesses(): {
|
|
5
|
+
pid: number;
|
|
6
|
+
cmd: string;
|
|
7
|
+
}[];
|
|
8
|
+
//# sourceMappingURL=process-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-registry.d.ts","sourceRoot":"","sources":["../src/process-registry.ts"],"names":[],"mappings":"AAUA,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAEnE;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAExD;AAED,2EAA2E;AAC3E,wBAAgB,kBAAkB,IAAI;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAEnE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passive registry of live harness child process groups. Every
|
|
3
|
+
* `spawnProcess` child registers on spawn and unregisters on close; the
|
|
4
|
+
* daemon snapshots the registry into a pids file so a crashed/killed daemon
|
|
5
|
+
* can REAP surviving orphans on the next start (children live in their own
|
|
6
|
+
* process groups by design, so they outlive the daemon). Purely
|
|
7
|
+
* observational: adapters gain no orchestration behavior.
|
|
8
|
+
*/
|
|
9
|
+
const live = new Map();
|
|
10
|
+
export function registerChildProcess(pid, cmd) {
|
|
11
|
+
live.set(pid, cmd);
|
|
12
|
+
}
|
|
13
|
+
export function unregisterChildProcess(pid) {
|
|
14
|
+
live.delete(pid);
|
|
15
|
+
}
|
|
16
|
+
/** Snapshot of currently-live child process groups: pid + command name. */
|
|
17
|
+
export function liveChildProcesses() {
|
|
18
|
+
return [...live.entries()].map(([pid, cmd]) => ({ pid, cmd }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=process-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-registry.js","sourceRoot":"","sources":["../src/process-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEvC,MAAM,UAAU,oBAAoB,CAAC,GAAW,EAAE,GAAW;IAC3D,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,kBAAkB;IAChC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { HarnessEvent, HarnessRunSpec } from "@claudexor/schema";
|
|
2
|
+
import { type ChildStdin } from "./proc.js";
|
|
3
|
+
export declare function abortSignalFromSpec(spec: HarnessRunSpec): AbortSignal | undefined;
|
|
4
|
+
export interface CliRunLoopOptions {
|
|
5
|
+
bin: string;
|
|
6
|
+
args: string[];
|
|
7
|
+
spec: HarnessRunSpec;
|
|
8
|
+
/**
|
|
9
|
+
* Translate one parsed JSON stdout object into normalized events.
|
|
10
|
+
* Return `null` for UNRECOGNIZED shapes (counted as dropped) and `[]` for
|
|
11
|
+
* recognized-but-intentionally-skipped events (progress ticks etc.).
|
|
12
|
+
*/
|
|
13
|
+
parseEvent: (obj: unknown, sessionId: string) => HarnessEvent[] | null;
|
|
14
|
+
env?: Record<string, string | null | undefined>;
|
|
15
|
+
/** Label used in synthesized error messages; defaults to `bin`. */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** Redactor applied to stderr detail before it is surfaced. */
|
|
18
|
+
redact?: (text: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Bidirectional session support (e.g. Claude's stream-json control
|
|
21
|
+
* protocol). When set, stdin stays open, `initialStdin` is written at spawn,
|
|
22
|
+
* frames matching `matches` are routed to `handle` (an async generator that
|
|
23
|
+
* may yield normalized events and write control responses via the stdin
|
|
24
|
+
* handle), and stdin is closed when `closeStdinOn` matches a frame —
|
|
25
|
+
* the cooperative end of a streaming session.
|
|
26
|
+
*/
|
|
27
|
+
session?: {
|
|
28
|
+
initialStdin?: string;
|
|
29
|
+
matches: (obj: unknown) => boolean;
|
|
30
|
+
handle: (obj: unknown, io: ChildStdin) => AsyncGenerator<HarnessEvent>;
|
|
31
|
+
closeStdinOn?: (obj: unknown) => boolean;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export declare function runCliHarness(opts: CliRunLoopOptions): AsyncGenerator<HarnessEvent>;
|
|
35
|
+
//# sourceMappingURL=runloop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runloop.d.ts","sourceRoot":"","sources":["../src/runloop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAwB1D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,cAAc,GAAG,WAAW,GAAG,SAAS,CAOjF;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,cAAc,CAAC;IACrB;;;;OAIG;IACH,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,YAAY,EAAE,GAAG,IAAI,CAAC;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAChD,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAClC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE;QACR,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC;QACnC,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,KAAK,cAAc,CAAC,YAAY,CAAC,CAAC;QACvE,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC;KAC1C,CAAC;CACH;AAED,wBAAuB,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,cAAc,CAAC,YAAY,CAAC,CAqH1F"}
|
package/dist/runloop.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { spawnProcess } from "./proc.js";
|
|
2
|
+
/**
|
|
3
|
+
* Shared CLI adapter run loop.
|
|
4
|
+
*
|
|
5
|
+
* Every local-CLI adapter (claude/codex/cursor/opencode) streams NDJSON from a
|
|
6
|
+
* spawned binary and translates lines into normalized HarnessEvents. This loop
|
|
7
|
+
* owns the parts that previously drifted between four copy-pasted variants:
|
|
8
|
+
*
|
|
9
|
+
* - stderr is captured (bounded ring buffer) and surfaced on failure instead of
|
|
10
|
+
* being silently dropped;
|
|
11
|
+
* - unparseable stdout lines and recognized-but-unmapped native events are
|
|
12
|
+
* COUNTED and reported on the terminal `completed` event payload
|
|
13
|
+
* (`dropped_unparsed_lines` / `dropped_unrecognized_events`), never silently
|
|
14
|
+
* discarded;
|
|
15
|
+
* - a terminal `completed` event is guaranteed exactly once on every path
|
|
16
|
+
* (clean exit, nonzero exit, spawn failure, abort);
|
|
17
|
+
* - abort is honored via the duck-typed AbortSignal smuggled in `spec.extra`
|
|
18
|
+
* (instanceof checks break across module realms).
|
|
19
|
+
*/
|
|
20
|
+
const STDERR_RING_MAX = 40;
|
|
21
|
+
const STDERR_DETAIL_MAX = 1000;
|
|
22
|
+
export function abortSignalFromSpec(spec) {
|
|
23
|
+
const signal = spec.extra?.["abortSignal"];
|
|
24
|
+
if (!signal || typeof signal !== "object")
|
|
25
|
+
return undefined;
|
|
26
|
+
const candidate = signal;
|
|
27
|
+
return typeof candidate.aborted === "boolean" && typeof candidate.addEventListener === "function"
|
|
28
|
+
? signal
|
|
29
|
+
: undefined;
|
|
30
|
+
}
|
|
31
|
+
export async function* runCliHarness(opts) {
|
|
32
|
+
const { spec } = opts;
|
|
33
|
+
const label = opts.label ?? opts.bin;
|
|
34
|
+
const redact = opts.redact ?? ((text) => text);
|
|
35
|
+
const ts = () => new Date().toISOString();
|
|
36
|
+
const stderrRing = [];
|
|
37
|
+
let droppedUnparsedLines = 0;
|
|
38
|
+
let droppedUnrecognizedEvents = 0;
|
|
39
|
+
let sawError = false;
|
|
40
|
+
let exitCode = null;
|
|
41
|
+
let exitSignal = null;
|
|
42
|
+
const abortSignal = abortSignalFromSpec(spec);
|
|
43
|
+
const stderrTail = () => redact(stderrRing.join("\n")).slice(-STDERR_DETAIL_MAX).trim();
|
|
44
|
+
// Box the stdin handle: it is assigned inside the onSpawn callback, which
|
|
45
|
+
// TypeScript's control-flow narrowing cannot see through a plain let.
|
|
46
|
+
const session = { io: null };
|
|
47
|
+
try {
|
|
48
|
+
for await (const ev of spawnProcess(opts.bin, opts.args, {
|
|
49
|
+
cwd: spec.cwd,
|
|
50
|
+
env: opts.env,
|
|
51
|
+
inheritEnv: spec.env_inheritance,
|
|
52
|
+
abortSignal,
|
|
53
|
+
...(opts.session
|
|
54
|
+
? {
|
|
55
|
+
keepStdinOpen: true,
|
|
56
|
+
onSpawn: (io) => {
|
|
57
|
+
session.io = io;
|
|
58
|
+
if (opts.session?.initialStdin)
|
|
59
|
+
io.write(opts.session.initialStdin);
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
: {}),
|
|
63
|
+
})) {
|
|
64
|
+
if (ev.type === "stderr") {
|
|
65
|
+
stderrRing.push(ev.line);
|
|
66
|
+
if (stderrRing.length > STDERR_RING_MAX)
|
|
67
|
+
stderrRing.shift();
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (ev.type === "exit") {
|
|
71
|
+
exitCode = ev.code;
|
|
72
|
+
exitSignal = ev.signal;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
let obj;
|
|
76
|
+
try {
|
|
77
|
+
obj = JSON.parse(ev.line);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
droppedUnparsedLines += 1;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (opts.session && session.io && opts.session.matches(obj)) {
|
|
84
|
+
for await (const out of opts.session.handle(obj, session.io)) {
|
|
85
|
+
if (out.type === "error")
|
|
86
|
+
sawError = true;
|
|
87
|
+
yield out;
|
|
88
|
+
}
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const events = opts.parseEvent(obj, spec.session_id);
|
|
92
|
+
if (opts.session && session.io && opts.session.closeStdinOn?.(obj)) {
|
|
93
|
+
// The native terminal frame arrived; close stdin so the streaming
|
|
94
|
+
// session ends cooperatively instead of waiting for more input.
|
|
95
|
+
session.io.end();
|
|
96
|
+
session.io = null;
|
|
97
|
+
}
|
|
98
|
+
if (events === null) {
|
|
99
|
+
droppedUnrecognizedEvents += 1;
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
for (const out of events) {
|
|
103
|
+
if (out.type === "error")
|
|
104
|
+
sawError = true;
|
|
105
|
+
yield out;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
sawError = true;
|
|
111
|
+
yield {
|
|
112
|
+
type: "error",
|
|
113
|
+
session_id: spec.session_id,
|
|
114
|
+
ts: ts(),
|
|
115
|
+
error: `${label} failed to start: ${err instanceof Error ? err.message : String(err)}`,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
session.io?.end();
|
|
120
|
+
session.io = null;
|
|
121
|
+
}
|
|
122
|
+
const aborted = abortSignal?.aborted === true;
|
|
123
|
+
if (!sawError && !aborted && exitCode !== null && exitCode !== 0) {
|
|
124
|
+
const tail = stderrTail();
|
|
125
|
+
yield {
|
|
126
|
+
type: "error",
|
|
127
|
+
session_id: spec.session_id,
|
|
128
|
+
ts: ts(),
|
|
129
|
+
error: `${label} exited with code ${exitCode}${tail ? `: ${tail}` : ""}`,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
else if (!sawError && !aborted && exitCode === null && exitSignal) {
|
|
133
|
+
yield {
|
|
134
|
+
type: "error",
|
|
135
|
+
session_id: spec.session_id,
|
|
136
|
+
ts: ts(),
|
|
137
|
+
error: `${label} was killed by signal ${exitSignal}`,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
const payload = {};
|
|
141
|
+
if (droppedUnparsedLines > 0)
|
|
142
|
+
payload["dropped_unparsed_lines"] = droppedUnparsedLines;
|
|
143
|
+
if (droppedUnrecognizedEvents > 0)
|
|
144
|
+
payload["dropped_unrecognized_events"] = droppedUnrecognizedEvents;
|
|
145
|
+
if (aborted)
|
|
146
|
+
payload["aborted"] = true;
|
|
147
|
+
if (exitCode !== null)
|
|
148
|
+
payload["exit_code"] = exitCode;
|
|
149
|
+
yield {
|
|
150
|
+
type: "completed",
|
|
151
|
+
session_id: spec.session_id,
|
|
152
|
+
ts: ts(),
|
|
153
|
+
...(Object.keys(payload).length > 0 ? { payload } : {}),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=runloop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runloop.js","sourceRoot":"","sources":["../src/runloop.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAmB,MAAM,WAAW,CAAC;AAE1D;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,MAAM,UAAU,mBAAmB,CAAC,IAAoB;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,aAAa,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC5D,MAAM,SAAS,GAAG,MAA8B,CAAC;IACjD,OAAO,OAAO,SAAS,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,SAAS,CAAC,gBAAgB,KAAK,UAAU;QAC/F,CAAC,CAAE,MAAsB;QACzB,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ACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single producer for the PATH every local harness discovery/run surface should
|
|
3
|
+
* use. Surfaces may still inherit other env vars, but binary resolution must not
|
|
4
|
+
* depend on whether the daemon was launched from a GUI app, login shell, or CLI.
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizedHarnessPath(source?: NodeJS.ProcessEnv): string;
|
|
7
|
+
export declare function harnessRuntimeEnv(source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
8
|
+
/**
|
|
9
|
+
* Advisory when the Node binary running Claudexor is one macOS's code-signing
|
|
10
|
+
* monitor is known to SIGKILL (Homebrew's adhoc-signed node). The daemon spawns
|
|
11
|
+
* its harness children with this same execPath, so a GUI/launchd-launched daemon
|
|
12
|
+
* on at-risk node can die mid-run. Returns null when not applicable. Diagnostic
|
|
13
|
+
* only (doctor surfaces it); never gates a run.
|
|
14
|
+
*/
|
|
15
|
+
export declare function atRiskNodeAdvisory(execPath?: string, platform?: NodeJS.Platform): string | null;
|
|
16
|
+
//# sourceMappingURL=runtime-env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-env.d.ts","sourceRoot":"","sources":["../src/runtime-env.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAuBrF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAAC,UAAU,CAE5F;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,GAAE,MAAyB,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,MAAM,GAAG,IAAI,CAKnI"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Single producer for the PATH every local harness discovery/run surface should
|
|
5
|
+
* use. Surfaces may still inherit other env vars, but binary resolution must not
|
|
6
|
+
* depend on whether the daemon was launched from a GUI app, login shell, or CLI.
|
|
7
|
+
*/
|
|
8
|
+
export function normalizedHarnessPath(source = process.env) {
|
|
9
|
+
const home = source.HOME || homedir();
|
|
10
|
+
const preferred = [
|
|
11
|
+
join(home, ".claudexor", "node", "bin"),
|
|
12
|
+
join(home, ".local", "bin"),
|
|
13
|
+
join(home, ".npm-global", "bin"),
|
|
14
|
+
join(home, ".bun", "bin"),
|
|
15
|
+
"/opt/homebrew/bin",
|
|
16
|
+
"/usr/local/bin",
|
|
17
|
+
"/usr/bin",
|
|
18
|
+
"/bin",
|
|
19
|
+
"/usr/sbin",
|
|
20
|
+
"/sbin",
|
|
21
|
+
];
|
|
22
|
+
const inherited = (source.PATH ?? "").split(":").filter(Boolean);
|
|
23
|
+
const seen = new Set();
|
|
24
|
+
return [...preferred, ...inherited]
|
|
25
|
+
.filter((entry) => {
|
|
26
|
+
if (!entry || seen.has(entry))
|
|
27
|
+
return false;
|
|
28
|
+
seen.add(entry);
|
|
29
|
+
return true;
|
|
30
|
+
})
|
|
31
|
+
.join(":");
|
|
32
|
+
}
|
|
33
|
+
export function harnessRuntimeEnv(source = process.env) {
|
|
34
|
+
return { ...source, PATH: normalizedHarnessPath(source) };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Advisory when the Node binary running Claudexor is one macOS's code-signing
|
|
38
|
+
* monitor is known to SIGKILL (Homebrew's adhoc-signed node). The daemon spawns
|
|
39
|
+
* its harness children with this same execPath, so a GUI/launchd-launched daemon
|
|
40
|
+
* on at-risk node can die mid-run. Returns null when not applicable. Diagnostic
|
|
41
|
+
* only (doctor surfaces it); never gates a run.
|
|
42
|
+
*/
|
|
43
|
+
export function atRiskNodeAdvisory(execPath = process.execPath, platform = process.platform) {
|
|
44
|
+
if (platform !== "darwin")
|
|
45
|
+
return null;
|
|
46
|
+
const atRisk = execPath.includes("/Cellar/node") || execPath.startsWith("/opt/homebrew/") || execPath.startsWith("/usr/local/Cellar/");
|
|
47
|
+
if (!atRisk)
|
|
48
|
+
return null;
|
|
49
|
+
return `node at ${execPath} is Homebrew-signed and may be SIGKILLed by macOS; install a notarized Node (e.g. under ~/.claudexor/node/bin) and put it first on PATH`;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=runtime-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-env.js","sourceRoot":"","sources":["../src/runtime-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAA4B,OAAO,CAAC,GAAG;IAC3E,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,EAAE,CAAC;IACtC,MAAM,SAAS,GAAG;QAChB,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC;QACvC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC;QAC3B,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,CAAC;QAChC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC;QACzB,mBAAmB;QACnB,gBAAgB;QAChB,UAAU;QACV,MAAM;QACN,WAAW;QACX,OAAO;KACR,CAAC;IACF,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO,CAAC,GAAG,SAAS,EAAE,GAAG,SAAS,CAAC;SAChC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QAChB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,SAA4B,OAAO,CAAC,GAAG;IACvE,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB,OAAO,CAAC,QAAQ,EAAE,WAA4B,OAAO,CAAC,QAAQ;IAClH,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACvI,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,OAAO,WAAW,QAAQ,yIAAyI,CAAC;AACtK,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@claudexor/core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "HarnessAdapter contract, process helpers, typed errors, and low-level execution utilities.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@claudexor/schema": "1.0.0"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/razzant/claudexor.git",
|
|
24
|
+
"directory": "packages/core"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/razzant/claudexor#readme",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/razzant/claudexor/issues"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=20.19"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc",
|
|
38
|
+
"typecheck": "tsc --noEmit"
|
|
39
|
+
}
|
|
40
|
+
}
|