@trim21/personal-pi-extensions 0.1.626 → 0.1.627

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/src/spawn-agent.ts +15 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trim21/personal-pi-extensions",
3
- "version": "0.1.626",
3
+ "version": "0.1.627",
4
4
  "type": "module",
5
5
  "description": "Custom pi coding-agent extensions: bwrap sandbox, workspace guard, opencode edit, and more",
6
6
  "keywords": [
@@ -16,9 +16,11 @@
16
16
  * `MAX_PROGRESS_LINES` lines. Consecutive tool calls are merged into a
17
17
  * single `tool:` line (`read x 2, glob`) and over-long line content is
18
18
  * folded to the first/last 9 chars joined by `…`, so a burst of tool calls
19
- * or a long text block does not flood the window; any text block starts a
20
- * new line. Line content is sanitized first: markdown marker characters are
21
- * stripped and whitespace (including newlines) is collapsed to single spaces,
19
+ * or a long text block does not flood the window; only a text block starts
20
+ * a new line — thinking is a transient status line, so it does not break the
21
+ * merge across turn boundaries. Line content is sanitized first: markdown
22
+ * marker characters are stripped and whitespace (including newlines) is
23
+ * collapsed to single spaces,
22
24
  * so one log entry is always exactly one rendered line. The final line is
23
25
  * always the subagent name as a code span (`` `scout` ``), followed by the
24
26
  * live usage stats when there are any; it rides outside the rolling window so
@@ -91,8 +93,11 @@ export const SUBAGENT_DEFAULT_SANDBOX: BwrapConfig = completeBwrapConfig({
91
93
  fs: { mode: "readonly" },
92
94
  network: { mode: "block" },
93
95
  });
94
- /** Progress log keeps only the most recent lines (rolling window). */
95
- const MAX_PROGRESS_LINES = 5;
96
+ /**
97
+ * Progress log keeps only the most recent lines (rolling window).
98
+ * 展开后面板最多 6 行内容:4 行日志 + 可能的一行瞬态 thinking + 固定的 metadata 行。
99
+ */
100
+ const MAX_PROGRESS_LINES = 4;
96
101
  /** Progress line content (without the `tool:` / `text:` prefix) is capped at 21 chars; longer text is folded to the first/last 9 chars joined by ` … `. */
97
102
  const MAX_PROGRESS_CHARS_PER_LINE = 21;
98
103
  /**
@@ -464,7 +469,8 @@ export async function runAgent(
464
469
  let logLines: string[] = [];
465
470
  // 工具调用行合并:连续的 tool_execution_start 事件合并在同一 `tool:` 行
466
471
  // (如 `tool: read x 2, glob`),相同工具名连续出现时计为 `name x N`,
467
- // 不同名按调用顺序罗列;任何非工具行都会打断合并。
472
+ // 不同名按调用顺序罗列;只有写入日志行的事件(text 块)打断合并,thinking
473
+ // 不写日志行、也不打断合并。
468
474
  let toolLineSegments: string[] = [];
469
475
  let toolLine: { name: string; count: number } | undefined;
470
476
  // 思考中状态:thinking_start 打开、thinking_delta 累计字符数、thinking_end
@@ -476,7 +482,7 @@ export async function runAgent(
476
482
  if (logLines.length > MAX_PROGRESS_LINES) {
477
483
  logLines = logLines.slice(-MAX_PROGRESS_LINES);
478
484
  }
479
- // 任何非工具行都会打断工具调用合并,下一批调用另起一行。
485
+ // 写进日志的新行都会打断工具调用合并,下一批调用另起一行。
480
486
  toolLine = undefined;
481
487
  };
482
488
 
@@ -537,8 +543,8 @@ export async function runAgent(
537
543
  break;
538
544
  }
539
545
  case "thinking_start": {
540
- // 思考横跨轮次边界:打断工具行合并,下一批工具调用另起一行。
541
- toolLine = undefined;
546
+ // thinking 不产生日志行,因此不打断工具行合并:跨轮次的连续工具调用
547
+ // 仍累加到同一 `tool:` 行。
542
548
  thinkingChars = 0;
543
549
  emitUpdate();
544
550
  break;