@cydm/pie 1.0.32 → 1.0.33

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.
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createAskUserCapability
4
- } from "../../../chunks/chunk-MPZSDREV.js";
4
+ } from "../../../chunks/chunk-MGZHZSHB.js";
5
5
  import "../../../chunks/chunk-4B42ZU4B.js";
6
6
  import "../../../chunks/chunk-64XJIKVK.js";
7
7
  import "../../../chunks/chunk-TG2EQLX2.js";
@@ -7,7 +7,7 @@ import {
7
7
  isPlanModeSafeCommand,
8
8
  markCompletedPlanSteps,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-MPZSDREV.js";
10
+ } from "../../../chunks/chunk-MGZHZSHB.js";
11
11
  import "../../../chunks/chunk-4B42ZU4B.js";
12
12
  import "../../../chunks/chunk-64XJIKVK.js";
13
13
  import "../../../chunks/chunk-TG2EQLX2.js";
@@ -1,11 +1,11 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createCliHostCapabilities
4
- } from "../../../chunks/chunk-PJWPGKQK.js";
4
+ } from "../../../chunks/chunk-QXTAEPLR.js";
5
5
  import {
6
6
  createSharedFileSystemTools,
7
7
  createSubagentCapability
8
- } from "../../../chunks/chunk-MPZSDREV.js";
8
+ } from "../../../chunks/chunk-MGZHZSHB.js";
9
9
  import "../../../chunks/chunk-4B42ZU4B.js";
10
10
  import "../../../chunks/chunk-64XJIKVK.js";
11
11
  import "../../../chunks/chunk-TG2EQLX2.js";
@@ -7,7 +7,7 @@ import {
7
7
  executeManageTodoList,
8
8
  executionStateToTodos,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-MPZSDREV.js";
10
+ } from "../../../chunks/chunk-MGZHZSHB.js";
11
11
  import "../../../chunks/chunk-4B42ZU4B.js";
12
12
  import "../../../chunks/chunk-64XJIKVK.js";
13
13
  import "../../../chunks/chunk-TG2EQLX2.js";
@@ -4387,8 +4387,18 @@ function summarizeToolFailureSignature(result) {
4387
4387
  }
4388
4388
  return summary.slice(-TOOL_FAILURE_SIGNATURE_CHARS);
4389
4389
  }
4390
+ function toolOutcomeKind(event) {
4391
+ const result = event.result && typeof event.result === "object" ? event.result : void 0;
4392
+ const kind = result?.details?.outcome?.kind;
4393
+ return typeof kind === "string" ? kind : void 0;
4394
+ }
4395
+ function isCommandNonzero(event) {
4396
+ return event.toolName === "bash" && toolOutcomeKind(event) === "command_nonzero";
4397
+ }
4390
4398
  function isStateChangingSuccess(event) {
4391
4399
  if (event.isError) return false;
4400
+ const outcomeKind = toolOutcomeKind(event);
4401
+ if (outcomeKind === "command_nonzero" || outcomeKind === "timeout" || outcomeKind === "signal") return false;
4392
4402
  if (event.toolName === "edit_file" || event.toolName === "write_file") return true;
4393
4403
  const details = event.result && typeof event.result === "object" ? event.result.details : void 0;
4394
4404
  return event.toolName === "bash" && details?.commandClass === "filesystem_write";
@@ -4448,7 +4458,8 @@ var AgentSessionRuntimeGuard = class {
4448
4458
  }
4449
4459
  }
4450
4460
  recordToolExecutionEnd(event) {
4451
- if (!event.isError) {
4461
+ const commandNonzero = isCommandNonzero(event);
4462
+ if (!event.isError && !commandNonzero) {
4452
4463
  if (isStateChangingSuccess(event)) {
4453
4464
  this.repeatedToolFailures.clear();
4454
4465
  return;
@@ -4462,14 +4473,15 @@ var AgentSessionRuntimeGuard = class {
4462
4473
  return;
4463
4474
  }
4464
4475
  const resultSummary = summarizeToolFailureSignature(event.result);
4465
- const key = `${event.toolName}:${stableStringify(event.args)}:${resultSummary}`;
4476
+ const reason = commandNonzero ? "repeated_command_nonzero" : "repeated_tool_error";
4477
+ const key = `${event.toolName}:${reason}:${stableStringify(event.args)}:${resultSummary}`;
4466
4478
  const repeatCount = (this.repeatedToolFailures.get(key) ?? 0) + 1;
4467
4479
  this.repeatedToolFailures.set(key, repeatCount);
4468
4480
  if (repeatCount < 3 || this.isTriggered) {
4469
4481
  return;
4470
4482
  }
4471
4483
  this.isTriggered = true;
4472
- this.trigger(event.toolName, repeatCount, "repeated_tool_error");
4484
+ this.trigger(event.toolName, repeatCount, reason);
4473
4485
  }
4474
4486
  };
4475
4487
 
@@ -10768,7 +10780,8 @@ function summarizeToolResultDetails(result) {
10768
10780
  "costEstimate",
10769
10781
  "browserReadSummary",
10770
10782
  "guardFindings",
10771
- "timedOut"
10783
+ "timedOut",
10784
+ "outcome"
10772
10785
  ];
10773
10786
  const summary = {};
10774
10787
  for (const key of keys) {
@@ -11355,6 +11368,7 @@ var SessionTraceController = class {
11355
11368
  target.status = isError ? "failed" : "completed";
11356
11369
  target.endedAt = Date.now();
11357
11370
  target.resultSummary = summarizeToolResult(result);
11371
+ target.outcome = isRecord3(result) && isRecord3(result.details) ? result.details.outcome : void 0;
11358
11372
  if (!existing) {
11359
11373
  this.trace.activeTurn.toolCalls.push(target);
11360
11374
  }
@@ -8,7 +8,7 @@ import {
8
8
  createSharedWebSearchTool,
9
9
  interpretShellExit,
10
10
  requestInteraction
11
- } from "./chunk-MPZSDREV.js";
11
+ } from "./chunk-MGZHZSHB.js";
12
12
  import {
13
13
  Type
14
14
  } from "./chunk-64XJIKVK.js";
@@ -462,6 +462,45 @@ function buildBashRecoveryHint(command, output) {
462
462
  }
463
463
  return void 0;
464
464
  }
465
+ function classifyBashOutcome(params) {
466
+ if (params.timedOut) {
467
+ return {
468
+ kind: "timeout",
469
+ toolFailure: true,
470
+ summary: "command timed out"
471
+ };
472
+ }
473
+ if (params.exitCode === 0) {
474
+ return {
475
+ kind: "success",
476
+ toolFailure: false,
477
+ summary: "command succeeded"
478
+ };
479
+ }
480
+ if (params.exitCode !== null) {
481
+ if (!params.semanticIsError) {
482
+ return {
483
+ kind: "semantic_non_error",
484
+ toolFailure: false,
485
+ summary: params.semanticExitMeaning ?? `command exited with code ${params.exitCode}`
486
+ };
487
+ }
488
+ return {
489
+ kind: "command_nonzero",
490
+ toolFailure: false,
491
+ summary: params.semanticExitMeaning ?? `command exited with code ${params.exitCode}`
492
+ };
493
+ }
494
+ return {
495
+ kind: "signal",
496
+ toolFailure: true,
497
+ summary: params.signal ? `command terminated by signal ${params.signal}` : "command exited without a numeric status"
498
+ };
499
+ }
500
+ function formatCommandNonzeroHint(outcome) {
501
+ if (outcome.kind !== "command_nonzero") return void 0;
502
+ return `[Command outcome: ${outcome.summary}. The shell tool ran correctly; inspect this as command/test output, not as a tool malfunction.]`;
503
+ }
465
504
  function killProcessTree(pid) {
466
505
  if (process.platform === "win32") {
467
506
  try {
@@ -726,9 +765,23 @@ ${fullOutput}`;
726
765
  if (resolvedShell === "powershell" && code === 0 && /^\s*(?:diff|Compare-Object)\b/i.test(effectiveCommand) && /\bSideIndicator\b/.test(fullOutput)) {
727
766
  details.semanticExitMeaning = "files differ";
728
767
  }
768
+ const outcome = classifyBashOutcome({
769
+ exitCode: code,
770
+ signal: sig?.toString() ?? null,
771
+ timedOut,
772
+ semanticIsError: semantic.isError,
773
+ semanticExitMeaning: details.semanticExitMeaning
774
+ });
775
+ details.outcome = outcome;
729
776
  if (semantic.isError && !timedOut && fullOutput.trim().length === 0) {
730
777
  outputText += "\n\n[Empty failure hint: command exited non-zero without output. If this was a chained diagnostic, an earlier command may be missing; split the check or print explicit fallback output.]";
731
778
  }
779
+ const commandNonzeroHint = formatCommandNonzeroHint(outcome);
780
+ if (commandNonzeroHint) {
781
+ outputText += `
782
+
783
+ ${commandNonzeroHint}`;
784
+ }
732
785
  if (truncation.truncated) {
733
786
  details.truncation = {
734
787
  truncated: true,
@@ -774,7 +827,7 @@ ${fullOutput}`;
774
827
  }
775
828
  const content = [{ type: "text", text: outputText }];
776
829
  settled = true;
777
- resolve3({ content, details, isError: timedOut || semantic.isError });
830
+ resolve3({ content, details, isError: outcome.toolFailure });
778
831
  } catch (error) {
779
832
  discardOutputArtifact(tempFilePath, tempFileStream);
780
833
  settled = true;
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  getThemesDir,
20
20
  migrateConfigFromAgentDir,
21
21
  truncateHeadTail
22
- } from "./chunks/chunk-PJWPGKQK.js";
22
+ } from "./chunks/chunk-QXTAEPLR.js";
23
23
  import {
24
24
  AGENTS_CONTEXT_FILE_NAME,
25
25
  AgentSessionController,
@@ -69,7 +69,7 @@ import {
69
69
  setExtensionEnabledInSettings,
70
70
  shouldPreserveExecutionStateForUserText,
71
71
  supersedeExecutionState
72
- } from "./chunks/chunk-MPZSDREV.js";
72
+ } from "./chunks/chunk-MGZHZSHB.js";
73
73
  import "./chunks/chunk-4B42ZU4B.js";
74
74
  import {
75
75
  Deref,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/pie",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "description": "Pie AI Agent CLI",
5
5
  "type": "module",
6
6
  "bin": {