pi-subagentura 1.0.9 → 1.0.11

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/helpers.ts +16 -0
  2. package/package.json +1 -1
package/helpers.ts CHANGED
@@ -462,10 +462,16 @@ export async function startSubagentJob(
462
462
  liveStatus.turn++;
463
463
  liveStatus.usage.turns = liveStatus.turn;
464
464
  liveStatus.output = "";
465
+ debugLog("info", "turn_start", { jobId, turn: liveStatus.turn });
465
466
  onUpdate?.(buildLiveUpdate(liveStatus, modelLabel));
466
467
  break;
467
468
  }
468
469
  case "tool_execution_start": {
470
+ debugLog("info", "tool_start", {
471
+ jobId,
472
+ toolName: event.toolName,
473
+ args: event.args as Record<string, unknown>,
474
+ });
469
475
  setActiveToolDebounced({
470
476
  name: event.toolName,
471
477
  args: event.args as Record<string, unknown>,
@@ -473,10 +479,12 @@ export async function startSubagentJob(
473
479
  break;
474
480
  }
475
481
  case "tool_execution_end": {
482
+ debugLog("info", "tool_end", { jobId, toolName: liveStatus.activeTool?.name });
476
483
  setActiveToolDebounced(undefined);
477
484
  break;
478
485
  }
479
486
  case "turn_end": {
487
+ debugLog("info", "turn_end", { jobId, turn: liveStatus.turn });
480
488
  if (activeToolTimer) {
481
489
  clearTimeout(activeToolTimer);
482
490
  activeToolTimer = undefined;
@@ -552,6 +560,7 @@ export async function startSubagentJob(
552
560
  };
553
561
  } catch (err) {
554
562
  const msg = err instanceof Error ? err.message : String(err);
563
+ debugLog("error", "subagent_error", { jobId, error: msg });
555
564
  result = {
556
565
  output: `Sub-agent crashed: ${msg}`,
557
566
  usage: {
@@ -567,6 +576,13 @@ export async function startSubagentJob(
567
576
  errorMessage: msg,
568
577
  };
569
578
  } finally {
579
+ debugLog("info", "job_complete", {
580
+ jobId,
581
+ outputLength: result.output.length,
582
+ isError: result.isError,
583
+ errorMessage: result.errorMessage ?? null,
584
+ usage: result.usage,
585
+ });
570
586
  if (activeToolTimer) {
571
587
  clearTimeout(activeToolTimer);
572
588
  activeToolTimer = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-subagentura",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Public Pi package that adds in-process sub-agents via the SDK",
5
5
  "main": "subagent.ts",
6
6
  "type": "module",