imcodes 2026.4.1874-dev.1860 → 2026.4.1881-dev.1865
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/effort-levels.d.ts +4 -2
- package/dist/shared/effort-levels.d.ts.map +1 -1
- package/dist/shared/effort-levels.js +16 -2
- package/dist/shared/effort-levels.js.map +1 -1
- package/dist/src/context/materialization-coordinator.d.ts.map +1 -1
- package/dist/src/context/materialization-coordinator.js +94 -51
- package/dist/src/context/materialization-coordinator.js.map +1 -1
- package/dist/src/daemon/jsonl-parse-core.d.ts +79 -0
- package/dist/src/daemon/jsonl-parse-core.d.ts.map +1 -0
- package/dist/src/daemon/jsonl-parse-core.js +400 -0
- package/dist/src/daemon/jsonl-parse-core.js.map +1 -0
- package/dist/src/daemon/jsonl-parse-pool.d.ts +52 -0
- package/dist/src/daemon/jsonl-parse-pool.d.ts.map +1 -0
- package/dist/src/daemon/jsonl-parse-pool.js +173 -0
- package/dist/src/daemon/jsonl-parse-pool.js.map +1 -0
- package/dist/src/daemon/jsonl-parse-worker-bootstrap.mjs +30 -0
- package/dist/src/daemon/jsonl-parse-worker-types.d.ts +36 -0
- package/dist/src/daemon/jsonl-parse-worker-types.d.ts.map +1 -0
- package/dist/src/daemon/jsonl-parse-worker-types.js +2 -0
- package/dist/src/daemon/jsonl-parse-worker-types.js.map +1 -0
- package/dist/src/daemon/jsonl-parse-worker.d.ts +12 -0
- package/dist/src/daemon/jsonl-parse-worker.d.ts.map +1 -0
- package/dist/src/daemon/jsonl-parse-worker.js +47 -0
- package/dist/src/daemon/jsonl-parse-worker.js.map +1 -0
- package/dist/src/daemon/jsonl-watcher.d.ts.map +1 -1
- package/dist/src/daemon/jsonl-watcher.js +72 -412
- package/dist/src/daemon/jsonl-watcher.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bootstrap entry for the JSONL parse worker.
|
|
3
|
+
*
|
|
4
|
+
* Why this file exists: `new Worker(url)` spawns a fresh Node process whose
|
|
5
|
+
* loader hooks are NOT inherited from the parent. Under `tsx` (dev / vitest)
|
|
6
|
+
* this means the worker can't resolve our `.js`-suffixed TypeScript siblings.
|
|
7
|
+
*
|
|
8
|
+
* This file is plain ESM JavaScript — loadable by Node without any TS support.
|
|
9
|
+
* It best-effort registers the tsx loader inside the worker, then dynamically
|
|
10
|
+
* imports the real worker module. In production (where the whole tree is
|
|
11
|
+
* compiled to JS), the register call silently no-ops and the `.js` import
|
|
12
|
+
* works directly.
|
|
13
|
+
*
|
|
14
|
+
* We ship this file as-is via the Docker/build step — no TS transpilation
|
|
15
|
+
* needed or wanted (that would defeat the purpose of a bootstrap).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
// Best-effort: register tsx's ESM loader so imports below can resolve .ts files.
|
|
19
|
+
// Wrapped in try/catch so production builds (no `tsx` in node_modules) silently
|
|
20
|
+
// continue with the pre-compiled .js worker.
|
|
21
|
+
try {
|
|
22
|
+
const { register } = await import('tsx/esm/api');
|
|
23
|
+
register();
|
|
24
|
+
} catch {
|
|
25
|
+
// tsx not installed — we're running pre-compiled JS, which is fine.
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// The worker's real implementation. In dev, tsx resolves this to .ts;
|
|
29
|
+
// in prod, Node loads the compiled .js directly.
|
|
30
|
+
await import('./jsonl-parse-worker.js');
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ParseLinesRequest, ParseLinesResult } from './jsonl-parse-core.js';
|
|
2
|
+
/**
|
|
3
|
+
* Message envelope for the JSONL parse worker.
|
|
4
|
+
* Mirrors the shape used by timeline-projection-types.ts so the two clients
|
|
5
|
+
* can share a mental model (and, if we ever want to, share transport code).
|
|
6
|
+
*/
|
|
7
|
+
export interface JsonlParseRequestMap {
|
|
8
|
+
parseLines: ParseLinesRequest;
|
|
9
|
+
forgetSession: {
|
|
10
|
+
sessionName: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface JsonlParseResponseMap {
|
|
14
|
+
parseLines: ParseLinesResult;
|
|
15
|
+
forgetSession: true;
|
|
16
|
+
}
|
|
17
|
+
export type JsonlParseRequestType = keyof JsonlParseRequestMap;
|
|
18
|
+
export interface JsonlParseEnvelope<T extends JsonlParseRequestType = JsonlParseRequestType> {
|
|
19
|
+
id: number;
|
|
20
|
+
type: T;
|
|
21
|
+
payload: JsonlParseRequestMap[T];
|
|
22
|
+
}
|
|
23
|
+
export interface JsonlParseSuccess<T extends JsonlParseRequestType = JsonlParseRequestType> {
|
|
24
|
+
id: number;
|
|
25
|
+
ok: true;
|
|
26
|
+
type: T;
|
|
27
|
+
result: JsonlParseResponseMap[T];
|
|
28
|
+
}
|
|
29
|
+
export interface JsonlParseFailure<T extends JsonlParseRequestType = JsonlParseRequestType> {
|
|
30
|
+
id: number;
|
|
31
|
+
ok: false;
|
|
32
|
+
type: T;
|
|
33
|
+
error: string;
|
|
34
|
+
}
|
|
35
|
+
export type JsonlParseResponse = JsonlParseSuccess | JsonlParseFailure;
|
|
36
|
+
//# sourceMappingURL=jsonl-parse-worker-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl-parse-worker-types.d.ts","sourceRoot":"","sources":["../../../src/daemon/jsonl-parse-worker-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEjF;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,aAAa,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CACxC;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,aAAa,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,qBAAqB,GAAG,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB;IACzF,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB;IACxF,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB;IACxF,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,KAAK,CAAC;IACV,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl-parse-worker-types.js","sourceRoot":"","sources":["../../../src/daemon/jsonl-parse-worker-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker thread that runs the Claude-Code JSONL parser off the main event loop.
|
|
3
|
+
*
|
|
4
|
+
* Protocol: see `jsonl-parse-worker-types.ts`.
|
|
5
|
+
* Parse logic: see `jsonl-parse-core.ts` (pure, shared with the main-thread fallback).
|
|
6
|
+
*
|
|
7
|
+
* The worker holds a single `ParseContext` for the whole daemon lifetime; the
|
|
8
|
+
* pending tool-call correlation map is keyed by sessionName, so concurrent
|
|
9
|
+
* sessions don't step on each other.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=jsonl-parse-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl-parse-worker.d.ts","sourceRoot":"","sources":["../../../src/daemon/jsonl-parse-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker thread that runs the Claude-Code JSONL parser off the main event loop.
|
|
3
|
+
*
|
|
4
|
+
* Protocol: see `jsonl-parse-worker-types.ts`.
|
|
5
|
+
* Parse logic: see `jsonl-parse-core.ts` (pure, shared with the main-thread fallback).
|
|
6
|
+
*
|
|
7
|
+
* The worker holds a single `ParseContext` for the whole daemon lifetime; the
|
|
8
|
+
* pending tool-call correlation map is keyed by sessionName, so concurrent
|
|
9
|
+
* sessions don't step on each other.
|
|
10
|
+
*/
|
|
11
|
+
import { parentPort } from 'node:worker_threads';
|
|
12
|
+
import { createParseContext, forgetSession as forgetSessionInCtx, parseLines as parseLinesInCtx, } from './jsonl-parse-core.js';
|
|
13
|
+
const ctx = createParseContext();
|
|
14
|
+
function handleRequest(message) {
|
|
15
|
+
switch (message.type) {
|
|
16
|
+
case 'parseLines':
|
|
17
|
+
return parseLinesInCtx(ctx, message.payload);
|
|
18
|
+
case 'forgetSession':
|
|
19
|
+
forgetSessionInCtx(ctx, message.payload.sessionName);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (!parentPort) {
|
|
24
|
+
throw new Error('jsonl-parse-worker requires parentPort');
|
|
25
|
+
}
|
|
26
|
+
parentPort.on('message', (message) => {
|
|
27
|
+
try {
|
|
28
|
+
const result = handleRequest(message);
|
|
29
|
+
const response = {
|
|
30
|
+
id: message.id,
|
|
31
|
+
type: message.type,
|
|
32
|
+
ok: true,
|
|
33
|
+
result,
|
|
34
|
+
};
|
|
35
|
+
parentPort?.postMessage(response);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
const response = {
|
|
39
|
+
id: message.id,
|
|
40
|
+
type: message.type,
|
|
41
|
+
ok: false,
|
|
42
|
+
error: err instanceof Error ? err.message : String(err),
|
|
43
|
+
};
|
|
44
|
+
parentPort?.postMessage(response);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=jsonl-parse-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl-parse-worker.js","sourceRoot":"","sources":["../../../src/daemon/jsonl-parse-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACL,kBAAkB,EAClB,aAAa,IAAI,kBAAkB,EACnC,UAAU,IAAI,eAAe,GAC9B,MAAM,uBAAuB,CAAC;AAW/B,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;AAEjC,SAAS,aAAa,CAAC,OAAsB;IAC3C,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,YAAY;YACf,OAAO,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC/C,KAAK,eAAe;YAClB,kBAAkB,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACrD,OAAO,IAAa,CAAC;IACzB,CAAC;AACH,CAAC;AAED,IAAI,CAAC,UAAU,EAAE,CAAC;IAChB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;AAC5D,CAAC;AAED,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAsB,EAAE,EAAE;IAClD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAuB;YACnC,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,EAAE,EAAE,IAAI;YACR,MAAM;SACe,CAAC;QACxB,UAAU,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,QAAQ,GAAuB;YACnC,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SACxD,CAAC;QACF,UAAU,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-watcher.d.ts","sourceRoot":"","sources":["../../../src/daemon/jsonl-watcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH,OAAO,EAAoD,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"jsonl-watcher.d.ts","sourceRoot":"","sources":["../../../src/daemon/jsonl-watcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH,OAAO,EAAoD,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAa9G;;sCAEsC;AACtC,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAKD,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGxD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBxE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoC7F;AAmDD,KAAK,aAAa,GAAG,kBAAkB,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAmE5E,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAOxE;AAyBD;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkG5F;AA4BD,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CA+BvH;AAED,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAEvE;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAmBtD;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CA2F5H;AA8KD;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAKjF"}
|