pi-fast-subagent 0.1.0 → 0.1.2

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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/index.ts +21 -8
  3. package/package.json +18 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tuansondinh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/index.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  */
11
11
 
12
12
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
13
- import { Text } from "@mariozechner/pi-tui";
13
+ import { truncateToWidth } from "@mariozechner/pi-tui";
14
14
  import {
15
15
  AuthStorage,
16
16
  createAgentSession,
@@ -368,22 +368,35 @@ export default function (pi: ExtensionAPI) {
368
368
  model?: string;
369
369
  };
370
370
 
371
- let status = "";
371
+ const statusLines: string[] = [];
372
372
  if (details.running) {
373
373
  const statusParts: string[] = ["running"];
374
374
  if (details.usage?.turns) statusParts.push(`${details.usage.turns} turn${details.usage.turns > 1 ? "s" : ""}`);
375
375
  if (details.elapsedMs !== undefined) statusParts.push(formatDuration(details.elapsedMs));
376
376
  if (details.model) statusParts.push(details.model);
377
- status = `\n${statusParts.join(" · ")}`;
377
+ statusLines.push(statusParts.join(" · "));
378
378
  } else if (details.usage) {
379
379
  const usageStr = formatUsage(details.usage, details.model);
380
- if (usageStr) status = `\n${usageStr}`;
380
+ if (usageStr) statusLines.push(usageStr);
381
381
  }
382
382
 
383
- if (isPartial) {
384
- return new Text(theme.fg("dim", (text || "Running...") + status), 0, 0);
385
- }
386
- return new Text(text + status, 0, 0);
383
+ // Apply dim per-line rather than across the whole block to avoid ANSI codes spanning
384
+ // newlines, which confuses wrapTextWithAnsi ANSI state tracking.
385
+ const textLines = (text || (isPartial ? "Running..." : "")).split("\n");
386
+ const styledLines = isPartial
387
+ ? [...textLines.map((l) => theme.fg("dim", l)), ...statusLines]
388
+ : [...textLines, ...statusLines];
389
+
390
+ // Use a custom component with truncateToWidth per line instead of Text + wrapTextWithAnsi.
391
+ // visibleWidth (used by wrapTextWithAnsi) undercounts wide chars (emoji/CJK), causing the
392
+ // TUI to crash with "Rendered line exceeds terminal width". truncateToWidth uses
393
+ // graphemeWidth internally and correctly measures wide chars.
394
+ return {
395
+ invalidate() {},
396
+ render(width: number): string[] {
397
+ return styledLines.map((line) => truncateToWidth(line, width, "...", true));
398
+ },
399
+ };
387
400
  },
388
401
 
389
402
  async execute(_id, params, signal, onUpdate, ctx) {
package/package.json CHANGED
@@ -1,9 +1,23 @@
1
1
  {
2
2
  "name": "pi-fast-subagent",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "In-process subagent delegation for pi with single, parallel, and chain modes",
5
5
  "type": "module",
6
- "keywords": ["pi-package", "pi", "subagent", "agents", "extension"],
6
+ "keywords": [
7
+ "pi-package",
8
+ "pi",
9
+ "subagent",
10
+ "agents",
11
+ "extension"
12
+ ],
13
+ "homepage": "https://github.com/tuansondinh/pi-fast-subagent#readme",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/tuansondinh/pi-fast-subagent.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/tuansondinh/pi-fast-subagent/issues"
20
+ },
7
21
  "files": [
8
22
  "index.ts",
9
23
  "agents.ts",
@@ -19,5 +33,6 @@
19
33
  "@mariozechner/pi-coding-agent": "*",
20
34
  "@mariozechner/pi-tui": "*",
21
35
  "@sinclair/typebox": "*"
22
- }
36
+ },
37
+ "license": "MIT"
23
38
  }