oira666_pi-subagent 0.2.13 → 0.2.14

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/runner.ts +1 -29
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oira666_pi-subagent",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "Subagent extension for Pi coding agent. Delegate tasks to specialized agents.",
5
5
  "type": "module",
6
6
  "main": "index.ts",
package/runner.ts CHANGED
@@ -311,11 +311,6 @@ function hasMessage(result: SingleResult, message: Message): boolean {
311
311
  return result.messages.some((existing) => messageDedupKey(existing) === key);
312
312
  }
313
313
 
314
- function resultHasStarted(result: SingleResult | undefined): boolean {
315
- if (!result) return false;
316
- return result.messages.length > 0 || result.completedTurns > 0 || result.liveLog.length > 0 || Object.keys(result.toolCalls).length > 0;
317
- }
318
-
319
314
  function sessionDirExists(dir: string | undefined): boolean {
320
315
  if (!dir) return false;
321
316
  try {
@@ -550,30 +545,7 @@ export async function runAgentSubprocess(opts: RunAgentOptions): Promise<SingleR
550
545
  };
551
546
  }
552
547
 
553
- let shouldContinueSession = resumeSession;
554
- if (resumeSession && sessionDir && !sessionDirExists(sessionDir)) {
555
- if (resultHasStarted(initialResult)) {
556
- const errorMessage = `Cannot resume subagent session: session directory does not exist: ${sessionDir}`;
557
- return {
558
- agent: agentName,
559
- agentSource: agent.source,
560
- task,
561
- exitCode: 1,
562
- messages: initialResult?.messages ? [...initialResult.messages] : [],
563
- stderr: errorMessage,
564
- usage: initialResult?.usage ? { ...initialResult.usage } : emptyUsage(),
565
- toolCalls: initialResult?.toolCalls ? { ...initialResult.toolCalls } : {},
566
- model: initialResult?.model ?? agent.model,
567
- stopReason: "error",
568
- errorMessage,
569
- completedTurns: initialResult?.completedTurns ?? 0,
570
- turnInProgress: false,
571
- liveLog: initialResult?.liveLog ? [...initialResult.liveLog] : [],
572
- sessionDir,
573
- };
574
- }
575
- shouldContinueSession = false;
576
- }
548
+ const shouldContinueSession = resumeSession && (!sessionDir || sessionDirExists(sessionDir));
577
549
 
578
550
  const result: SingleResult = {
579
551
  agent: agentName,