@cydm/pie 1.0.20 → 1.0.21

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/dist/cli.js +35 -7
  2. package/package.json +2 -1
package/dist/cli.js CHANGED
@@ -45556,8 +45556,9 @@ async function listSessions(args) {
45556
45556
  }
45557
45557
  async function readSession(args) {
45558
45558
  const json = hasFlag(args, "--json");
45559
+ const includeMessage = hasFlag(args, "--raw") || hasFlag(args, "--include-message");
45559
45560
  const sessionId = positionalArgs(args, /* @__PURE__ */ new Set(["--limit", "--before"]))[0];
45560
- if (!sessionId) throw new Error("Usage: pie sessions read <sessionId> [--json] [--limit <n>] [--before <cursor>]");
45561
+ if (!sessionId) throw new Error("Usage: pie sessions read <sessionId> [--json] [--raw|--include-message] [--limit <n>] [--before <cursor>]");
45561
45562
  const limit = numericFlag(args, "--limit", 200);
45562
45563
  const before = stringFlag(args, "--before");
45563
45564
  const store = new FileSessionStore(getSessionsDir());
@@ -45572,7 +45573,7 @@ async function readSession(args) {
45572
45573
  session: sessionSummary(data.metadata),
45573
45574
  currentHead: data.metadata.activeEntryId,
45574
45575
  activeEntryId: data.metadata.activeEntryId,
45575
- events: page,
45576
+ events: json && !includeMessage ? page.map(stableTranscriptEvent) : page,
45576
45577
  hasMoreBefore: start > 0,
45577
45578
  nextBefore: start > 0 ? String(start) : void 0
45578
45579
  };
@@ -45694,7 +45695,7 @@ async function forkSession(args) {
45694
45695
  function printSessionsUsage() {
45695
45696
  console.log(`Usage:
45696
45697
  pie sessions list [--json] [--limit <n>] [--cursor <cursor>] [--cwd <path>]
45697
- pie sessions read <sessionId> [--json] [--limit <n>] [--before <cursor>]
45698
+ pie sessions read <sessionId> [--json] [--raw|--include-message] [--limit <n>] [--before <cursor>]
45698
45699
  pie sessions rename <sessionId> <name> [--json] [--cwd <path>]
45699
45700
  pie sessions rewind <sessionId> --to <entryId> [--json]
45700
45701
  pie sessions fork <sessionId> --from <entryId> --target <newSessionId> --name <name> [--cwd <path>] [--json]`);
@@ -45709,10 +45710,16 @@ function stringFlag(args, flag) {
45709
45710
  return value && !value.startsWith("-") ? value : void 0;
45710
45711
  }
45711
45712
  function numericFlag(args, flag, fallback) {
45712
- const value = stringFlag(args, flag);
45713
- if (!value) return fallback;
45713
+ const index = args.indexOf(flag);
45714
+ if (index < 0) return fallback;
45715
+ const value = args[index + 1];
45716
+ if (!value) throw new Error(`${flag} requires a value.`);
45714
45717
  const parsed = Number(value);
45715
- return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback;
45718
+ const max = 1e3;
45719
+ if (!Number.isInteger(parsed) || parsed <= 0 || parsed > max) {
45720
+ throw new Error(`${flag} must be a positive integer no greater than ${max}.`);
45721
+ }
45722
+ return parsed;
45716
45723
  }
45717
45724
  function positionalArgs(args, valueFlags) {
45718
45725
  const result = [];
@@ -45758,6 +45765,7 @@ function realpathOrInput(value) {
45758
45765
  function activeTranscriptEvents(entries) {
45759
45766
  return entries.map((entry, index) => {
45760
45767
  const role = isRecord2(entry.message) && typeof entry.message.role === "string" ? entry.message.role : void 0;
45768
+ const turnId = isRecord2(entry.message) && typeof entry.message.turnId === "string" ? entry.message.turnId : void 0;
45761
45769
  return {
45762
45770
  logicalSeq: index + 1,
45763
45771
  checkpointId: entry.id,
@@ -45767,11 +45775,26 @@ function activeTranscriptEvents(entries) {
45767
45775
  timestamp: entry.timestamp,
45768
45776
  occurredAt: entry.timestamp,
45769
45777
  role,
45778
+ turnId,
45770
45779
  content: textFromMessage(entry.message),
45771
45780
  message: entry.message ? cloneJson(entry.message) : void 0
45772
45781
  };
45773
45782
  });
45774
45783
  }
45784
+ function stableTranscriptEvent(event) {
45785
+ return {
45786
+ logicalSeq: event.logicalSeq,
45787
+ checkpointId: event.checkpointId,
45788
+ entryId: event.entryId,
45789
+ id: event.id,
45790
+ type: event.type,
45791
+ timestamp: event.timestamp,
45792
+ occurredAt: event.occurredAt,
45793
+ ...event.role ? { role: event.role } : {},
45794
+ ...event.turnId ? { turnId: event.turnId } : {},
45795
+ ...event.content ? { content: event.content } : {}
45796
+ };
45797
+ }
45775
45798
  function activePathEntries(data) {
45776
45799
  const activeEntryId = data.metadata.activeEntryId;
45777
45800
  if (!activeEntryId) return [];
@@ -59771,6 +59794,11 @@ var ToolExecutionComponent = class extends Container {
59771
59794
  const textBlocks = this.result.content?.filter((content) => content.type === "text") || [];
59772
59795
  return textBlocks.map((content) => (content.text || "").replace(/\r/g, "")).join("\n");
59773
59796
  }
59797
+ getExpandedOutputLineLimit(collapsedMaxLines) {
59798
+ if (!this.expanded) return collapsedMaxLines;
59799
+ const visibleOutputRows = Math.max(collapsedMaxLines, this.ui.terminal.rows - 15);
59800
+ return visibleOutputRows;
59801
+ }
59774
59802
  formatToolExecution() {
59775
59803
  let text = "";
59776
59804
  const invalidArg = theme.fg("error", "[invalid arg]");
@@ -60076,7 +60104,7 @@ ${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
60076
60104
  const output = this.getTextOutput().trim();
60077
60105
  if (output) {
60078
60106
  const lines = output.split("\n");
60079
- const maxLines = this.expanded ? lines.length : 5;
60107
+ const maxLines = this.getExpandedOutputLineLimit(5);
60080
60108
  const displayLines = lines.slice(0, maxLines);
60081
60109
  const remaining = lines.length - maxLines;
60082
60110
  text += "\n\n" + displayLines.map((line) => theme.fg("toolOutput", line)).join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/pie",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "Pie AI Agent CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,6 +17,7 @@
17
17
  "test": "npm run test:offline",
18
18
  "pretest:offline": "npm run build --workspace @pie/agent-framework && npm run build --workspace @pie/shared-headless-capabilities && npm run build",
19
19
  "test:offline": "node --test --import tsx test/core-services.test.ts test/cli.test.ts test/cli-auto-compaction.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-extension.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/hierarchical-command-system.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/files-utils.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/code-intel-typescript-provider.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/cross-host-parity.test.ts test/tool-name-rendering.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/daily-agent-smoke.terminal.test.ts",
20
+ "test:all": "npm run test:offline && npm run test:terminal:vitest",
20
21
  "test:terminal:vitest": "vitest run test/mention-file-select.terminal.test.ts test/tool-partial-display.terminal.test.ts test/viewport-position-final.test.ts",
21
22
  "test:todo-tui": "PIE_REAL_TODO_TUI=1 node --test --import tsx test/todo-closure.terminal.test.ts",
22
23
  "test:daily-tui": "npm run test:daily-tui:quick",