@parall/claude-agent 1.26.2 → 1.27.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.
@@ -29,6 +29,7 @@ export declare class ClaudeCodeAdapter implements DispatchAdapter {
29
29
  }): void;
30
30
  dispatch({ event, bodyForAgent, sessionKey, context }: DispatchOpts): AsyncIterable<RuntimeEvent>;
31
31
  getBranchPoint(_sessionKey: string): string | undefined;
32
+ getSessionHistoryPath(sessionKey: string): string | undefined;
32
33
  forkSession({ sessionKey }: ForkOpts): import("@parall/agent-core").ForkSessionHandle | null;
33
34
  cleanupFork({ fork }: CleanupForkOpts): void;
34
35
  shutdown(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,YAAY,EACZ,QAAQ,EAER,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EACL,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAE9B,KAAK,wBAAwB,GAAG,IAAI,CAClC,iBAAiB,EACf,gBAAgB,GAChB,aAAa,GACb,cAAc,GACd,oBAAoB,GACpB,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,OAAO,GACP,gBAAgB,GAChB,cAAc,CACjB,GAAG;IACF,cAAc,EAAE,oBAAoB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3D,iDAAiD;IACjD,wBAAwB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3D,CAAC;AAEF,wBAAgB,aAAa,CAC3B,SAAS,E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AAY,IAAI,MAAM,GAAG,SAAS,CAAwB;IAC9D,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAA8B;IAErE,YAAY,CAAC,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI;IAYtE,QAAQ,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC;IAuBxG,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIvD,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAQ7D,WAAW,CAAC,EAAE,UAAU,EAAE,EAAE,QAAQ;IAIpC,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE,eAAe;IAQ/B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YAShB,OAAO;IAgFtB,OAAO,CAAC,aAAa;IAyBrB,OAAO,CAAC,YAAY;IA8CpB,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,SAAS;IAyCjB,OAAO,CAAC,uBAAuB;CAkBhC"}
package/dist/dispatch.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as fs from "node:fs";
1
2
  import * as path from "node:path";
2
3
  import { randomUUID } from "node:crypto";
3
4
  import { spawn } from "node:child_process";
@@ -74,10 +75,16 @@ export class ClaudeCodeAdapter {
74
75
  }
75
76
  }
76
77
  getBranchPoint(_sessionKey) {
77
- // Claude Code does not expose a branch-point API; fork scope prefix
78
- // provides the behavioral fallback for this runtime.
79
78
  return undefined;
80
79
  }
80
+ getSessionHistoryPath(sessionKey) {
81
+ const sessionId = this.opts.sessionManager.getSessionId(sessionKey);
82
+ if (!sessionId)
83
+ return undefined;
84
+ const projectSlug = this.opts.workspaceDir.replace(/[/.]/g, "-");
85
+ const filePath = path.join(this.opts.claudeHome, ".claude", "projects", projectSlug, `${sessionId}.jsonl`);
86
+ return fs.existsSync(filePath) ? filePath : undefined;
87
+ }
81
88
  forkSession({ sessionKey }) {
82
89
  return this.opts.sessionManager.createForkSession(sessionKey);
83
90
  }
@@ -134,6 +141,11 @@ export class ClaudeCodeAdapter {
134
141
  const parsed = next.value;
135
142
  if (parsed.type === "session_id") {
136
143
  this.opts.sessionManager.recordSessionId(sessionKey, parsed.sessionId);
144
+ yield {
145
+ type: "runtime_session",
146
+ runtimeSessionId: parsed.sessionId,
147
+ runtimeLaneKey: sessionKey,
148
+ };
137
149
  continue;
138
150
  }
139
151
  if (parsed.type === "turn_end") {
@@ -151,6 +163,10 @@ export class ClaudeCodeAdapter {
151
163
  yield { ...parsed, project: false, groupKey };
152
164
  continue;
153
165
  }
166
+ if (parsed.type === "runtime_session") {
167
+ yield parsed;
168
+ continue;
169
+ }
154
170
  yield { ...parsed, groupKey };
155
171
  }
156
172
  }
@@ -195,10 +211,14 @@ export class ClaudeCodeAdapter {
195
211
  stderrChunks.push(chunk.toString());
196
212
  });
197
213
  proc.stdin.on("error", () => {
198
- // Absorb async EPIPE / ERR_STREAM_WRITE_AFTER_END when the child
199
- // exits between our write check and the kernel delivering the data.
200
- // The next parser.next() will see the stream end and surface an error
201
- // RuntimeEvent through the normal turn-end path.
214
+ // stdin pipe broken: kill the process so parser.next() sees EOF
215
+ // instead of hanging forever on a process that's alive but can't
216
+ // accept input. If the process was already exiting (the common
217
+ // EPIPE-on-close race), kill is a harmless no-op.
218
+ proc.stdin.destroy();
219
+ if (proc.exitCode === null && proc.signalCode === null) {
220
+ proc.kill("SIGTERM");
221
+ }
202
222
  });
203
223
  const exitPromise = new Promise((resolve) => {
204
224
  proc.once("close", (code, signal) => resolve({ code, signal }));
@@ -19,6 +19,7 @@ export declare class ClaudeSessionManager {
19
19
  private readonly pendingForkParents;
20
20
  private readonly processes;
21
21
  constructor(mainSessionKey: string, stateFilePath: string, logger?: ClaudeSessionManagerLogger | undefined);
22
+ getSessionId(sessionKey: string): string | undefined;
22
23
  getResumeArgs(sessionKey: string): string[];
23
24
  recordSessionId(sessionKey: string, sessionId: string): void;
24
25
  createForkSession(parentSessionKey: string): ForkSessionHandle | null;
@@ -1 +1 @@
1
- {"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../src/session-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAO5D,KAAK,0BAA0B,GAAG;IAChC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,8BAA8B,CAAC;IACrC,WAAW,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAC7E,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,qBAAa,oBAAoB;IAM7B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAP1B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IACxD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA6B;IAChE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0C;gBAGjD,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,0BAA0B,YAAA;IAKtD,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE;IAU3C,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAQrD,iBAAiB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IAP1B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IACxD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA6B;IAChE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0C;gBAGjD,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,0BAA0B,YAAA;IAKtD,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIpD,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE;IAU3C,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAQrD,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI;IAYrE,WAAW,CAAC,UAAU,EAAE,MAAM;IAU9B,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAI/D,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB;IAsB/D,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,mBAAmB;IAO7D,qEAAqE;IACrE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAE5C,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;YAQpB,WAAW;IAuCzB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,WAAW;IAqBnB,OAAO,CAAC,OAAO;IAYf,OAAO,CAAC,OAAO;CAahB"}
@@ -14,6 +14,9 @@ export class ClaudeSessionManager {
14
14
  this.logger = logger;
15
15
  this.restore();
16
16
  }
17
+ getSessionId(sessionKey) {
18
+ return this.sessionIds.get(sessionKey);
19
+ }
17
20
  getResumeArgs(sessionKey) {
18
21
  const existing = this.sessionIds.get(sessionKey);
19
22
  if (existing)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/claude-agent",
3
- "version": "1.26.2",
3
+ "version": "1.27.0",
4
4
  "description": "Claude Code bridge runtime for self-hosted Parall agents",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,9 +25,9 @@
25
25
  "src"
26
26
  ],
27
27
  "dependencies": {
28
- "@parall/cli": "1.26.2",
29
- "@parall/sdk": "1.26.2",
30
- "@parall/agent-core": "1.26.2"
28
+ "@parall/cli": "1.27.0",
29
+ "@parall/sdk": "1.27.0",
30
+ "@parall/agent-core": "1.27.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^22.0.0",
package/src/dispatch.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as fs from "node:fs";
1
2
  import * as path from "node:path";
2
3
  import { randomUUID } from "node:crypto";
3
4
  import { spawn } from "node:child_process";
@@ -135,11 +136,17 @@ export class ClaudeCodeAdapter implements DispatchAdapter {
135
136
  }
136
137
 
137
138
  getBranchPoint(_sessionKey: string): string | undefined {
138
- // Claude Code does not expose a branch-point API; fork scope prefix
139
- // provides the behavioral fallback for this runtime.
140
139
  return undefined;
141
140
  }
142
141
 
142
+ getSessionHistoryPath(sessionKey: string): string | undefined {
143
+ const sessionId = this.opts.sessionManager.getSessionId(sessionKey);
144
+ if (!sessionId) return undefined;
145
+ const projectSlug = this.opts.workspaceDir.replace(/[/.]/g, "-");
146
+ const filePath = path.join(this.opts.claudeHome, ".claude", "projects", projectSlug, `${sessionId}.jsonl`);
147
+ return fs.existsSync(filePath) ? filePath : undefined;
148
+ }
149
+
143
150
  forkSession({ sessionKey }: ForkOpts) {
144
151
  return this.opts.sessionManager.createForkSession(sessionKey);
145
152
  }
@@ -206,6 +213,11 @@ export class ClaudeCodeAdapter implements DispatchAdapter {
206
213
 
207
214
  if (parsed.type === "session_id") {
208
215
  this.opts.sessionManager.recordSessionId(sessionKey, parsed.sessionId);
216
+ yield {
217
+ type: "runtime_session",
218
+ runtimeSessionId: parsed.sessionId,
219
+ runtimeLaneKey: sessionKey,
220
+ };
209
221
  continue;
210
222
  }
211
223
 
@@ -227,6 +239,11 @@ export class ClaudeCodeAdapter implements DispatchAdapter {
227
239
  continue;
228
240
  }
229
241
 
242
+ if (parsed.type === "runtime_session") {
243
+ yield parsed;
244
+ continue;
245
+ }
246
+
230
247
  yield { ...parsed, groupKey };
231
248
  }
232
249
  }
@@ -284,10 +301,14 @@ export class ClaudeCodeAdapter implements DispatchAdapter {
284
301
  stderrChunks.push(chunk.toString());
285
302
  });
286
303
  proc.stdin.on("error", () => {
287
- // Absorb async EPIPE / ERR_STREAM_WRITE_AFTER_END when the child
288
- // exits between our write check and the kernel delivering the data.
289
- // The next parser.next() will see the stream end and surface an error
290
- // RuntimeEvent through the normal turn-end path.
304
+ // stdin pipe broken: kill the process so parser.next() sees EOF
305
+ // instead of hanging forever on a process that's alive but can't
306
+ // accept input. If the process was already exiting (the common
307
+ // EPIPE-on-close race), kill is a harmless no-op.
308
+ proc.stdin.destroy();
309
+ if (proc.exitCode === null && proc.signalCode === null) {
310
+ proc.kill("SIGTERM");
311
+ }
291
312
  });
292
313
 
293
314
  const exitPromise = new Promise<{ code: number | null; signal: NodeJS.Signals | null }>((resolve) => {
@@ -32,6 +32,10 @@ export class ClaudeSessionManager {
32
32
  this.restore();
33
33
  }
34
34
 
35
+ getSessionId(sessionKey: string): string | undefined {
36
+ return this.sessionIds.get(sessionKey);
37
+ }
38
+
35
39
  getResumeArgs(sessionKey: string): string[] {
36
40
  const existing = this.sessionIds.get(sessionKey);
37
41
  if (existing) return ["--resume", existing];