pi-ui-extend 0.1.49 → 0.1.51

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 (42) hide show
  1. package/dist/app/icons.d.ts +1 -0
  2. package/dist/app/icons.js +2 -0
  3. package/dist/app/input/autocomplete-controller.js +1 -1
  4. package/dist/app/input/input-controller.d.ts +1 -0
  5. package/dist/app/input/input-controller.js +7 -24
  6. package/dist/app/input/input-paste-handler.d.ts +1 -0
  7. package/dist/app/input/input-paste-handler.js +13 -16
  8. package/dist/app/rendering/conversation-tool-renderer.js +1 -0
  9. package/dist/app/rendering/popup-menu-renderer.js +2 -2
  10. package/dist/app/rendering/render-controller.js +10 -16
  11. package/dist/app/rendering/status-line-renderer.d.ts +0 -7
  12. package/dist/app/rendering/status-line-renderer.js +7 -79
  13. package/dist/app/rendering/tab-line-renderer.js +1 -1
  14. package/dist/app/rendering/toast-renderer.js +40 -15
  15. package/dist/app/rendering/tool-block-renderer.d.ts +2 -1
  16. package/dist/app/rendering/tool-block-renderer.js +44 -3
  17. package/dist/app/screen/mouse-controller.d.ts +1 -0
  18. package/dist/app/screen/mouse-controller.js +30 -76
  19. package/dist/app/session/lazy-session-manager.js +0 -7
  20. package/dist/app/session/queued-message-controller.d.ts +0 -1
  21. package/dist/app/session/queued-message-controller.js +5 -13
  22. package/dist/app/session/queued-message-entries.d.ts +1 -0
  23. package/dist/app/session/queued-message-entries.js +8 -0
  24. package/dist/app/session/tabs-controller.d.ts +2 -1
  25. package/dist/app/session/tabs-controller.js +67 -24
  26. package/dist/app/types.d.ts +1 -0
  27. package/dist/bundled-extensions/session-title/title-generation.js +1 -1
  28. package/dist/tool-renderers/compress.js +28 -7
  29. package/dist/tool-renderers/patch-normalize.js +4 -4
  30. package/dist/tool-renderers/types.d.ts +10 -0
  31. package/external/pi-tools-suite/package.json +3 -3
  32. package/external/pi-tools-suite/src/async-subagents/core/cleanup.ts +2 -2
  33. package/external/pi-tools-suite/src/async-subagents/core/paths.ts +12 -0
  34. package/external/pi-tools-suite/src/async-subagents/core/registry.ts +3 -4
  35. package/external/pi-tools-suite/src/async-subagents/core/routing.ts +1 -1
  36. package/external/pi-tools-suite/src/async-subagents/core/sessions.ts +2 -2
  37. package/external/pi-tools-suite/src/async-subagents/core/state.ts +3 -3
  38. package/external/pi-tools-suite/src/async-subagents/core/ultrawork-auto.ts +1 -1
  39. package/external/pi-tools-suite/src/async-subagents/lib.ts +1 -1
  40. package/external/pi-tools-suite/src/coding-discipline/index.ts +1 -1
  41. package/external/pi-tools-suite/src/dcp/auto-compress.ts +1 -1
  42. package/package.json +4 -4
@@ -110,10 +110,10 @@ function renderDiffOp(op) {
110
110
  return `-${op.text}`;
111
111
  if (op.type === "insert")
112
112
  return `+${op.text}`;
113
- // Context marker is a leading space. Loose `-`/`+` blocks carry the space
114
- // that separated the marker from the content (e.g. `- rule one`), so reuse
115
- // that space instead of emitting a second one.
116
- return op.text.startsWith(" ") ? op.text : ` ${op.text}`;
113
+ // Context marker is a leading space. Always emit it even when the content is
114
+ // already indented, so unchanged lines reserve the same marker column as `+`
115
+ // and `-` lines in the terminal diff view.
116
+ return ` ${op.text}`;
117
117
  }
118
118
  /** Minimal LCS-based line diff. */
119
119
  function diffLines(oldLines, newLines) {
@@ -23,6 +23,7 @@ export type ToolRenderInput = {
23
23
  export type ToolRenderResult = {
24
24
  toolName?: string;
25
25
  headerArgs?: string;
26
+ headerArgSegments?: readonly ToolHeaderSegment[];
26
27
  bodyLineStyles?: readonly ToolBodyLineStyle[];
27
28
  bodyStyle?: "diff";
28
29
  preserveAnsi?: boolean;
@@ -30,4 +31,13 @@ export type ToolRenderResult = {
30
31
  collapsedBody: string;
31
32
  expandedText: string;
32
33
  };
34
+ export type ToolHeaderSegment = {
35
+ start: number;
36
+ end: number;
37
+ foreground?: string;
38
+ background?: string;
39
+ bold?: boolean;
40
+ underline?: boolean;
41
+ strikethrough?: boolean;
42
+ };
33
43
  export type ToolRendererMiddleware = (input: ToolRenderInput) => ToolRenderResult | undefined;
@@ -38,9 +38,9 @@
38
38
  "vscode-languageserver-protocol": "^3.17.5"
39
39
  },
40
40
  "peerDependencies": {
41
- "@earendil-works/pi-ai": "0.79.10",
42
- "@earendil-works/pi-coding-agent": "0.79.10",
43
- "@earendil-works/pi-tui": "0.79.10",
41
+ "@earendil-works/pi-ai": "0.80.2",
42
+ "@earendil-works/pi-coding-agent": "0.80.2",
43
+ "@earendil-works/pi-tui": "0.80.2",
44
44
  "typebox": "*"
45
45
  },
46
46
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
- import { isDir } from "./paths.js";
3
+ import { hasLaunchedAgentPrompt, isDir } from "./paths.js";
4
4
 
5
5
  export function findCleanupCandidates(
6
6
  runRoot: string,
@@ -57,8 +57,8 @@ function isCompletedRun(runDir: string): boolean {
57
57
  let foundAgent = false;
58
58
  for (const entry of fs.readdirSync(runDir, { withFileTypes: true })) {
59
59
  if (!entry.isDirectory()) continue;
60
+ if (!hasLaunchedAgentPrompt(runDir, entry.name)) continue;
60
61
  const agentDir = path.join(runDir, entry.name);
61
- if (!fs.existsSync(path.join(agentDir, "prompt.md"))) continue;
62
62
  foundAgent = true;
63
63
  if (!fs.existsSync(path.join(agentDir, "exit_code"))) return false;
64
64
  }
@@ -33,6 +33,18 @@ export function isDir(p: string): boolean {
33
33
  }
34
34
  }
35
35
 
36
+ export function hasLaunchedAgentPrompt(runDir: string, agentId: string): boolean {
37
+ return fs.existsSync(path.join(runDir, agentId, "prompt.md"));
38
+ }
39
+
40
+ export function hasQueuedAgentPrompt(runDir: string, agentId: string): boolean {
41
+ return fs.existsSync(path.join(runDir, "prompts", `${agentId}.md`));
42
+ }
43
+
44
+ export function hasAgentPrompt(runDir: string, agentId: string): boolean {
45
+ return hasLaunchedAgentPrompt(runDir, agentId) || hasQueuedAgentPrompt(runDir, agentId);
46
+ }
47
+
36
48
  const SAFE_BASENAME = /^[A-Za-z0-9._-]+$/;
37
49
 
38
50
  export function validateBasename(value: string, label: string): void {
@@ -1,6 +1,6 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
- import { getRunRoot, isDir, resolveRunDir } from "./paths.js";
3
+ import { getRunRoot, hasAgentPrompt, hasLaunchedAgentPrompt, isDir, resolveRunDir } from "./paths.js";
4
4
 
5
5
  export const SUBAGENT_REGISTRY_FILE = "registry.json";
6
6
 
@@ -161,15 +161,14 @@ function looksLikeRunDir(runDir: string): boolean {
161
161
  if (isDir(path.join(runDir, "prompts"))) return true;
162
162
  try {
163
163
  return fs.readdirSync(runDir, { withFileTypes: true })
164
- .some((entry) => entry.isDirectory() && fs.existsSync(path.join(runDir, entry.name, "prompt.md")));
164
+ .some((entry) => entry.isDirectory() && hasLaunchedAgentPrompt(runDir, entry.name));
165
165
  } catch {
166
166
  return false;
167
167
  }
168
168
  }
169
169
 
170
170
  function hasAgentRecord(runDir: string, agentId: string): boolean {
171
- return fs.existsSync(path.join(runDir, agentId, "prompt.md"))
172
- || fs.existsSync(path.join(runDir, "prompts", `${agentId}.md`));
171
+ return hasAgentPrompt(runDir, agentId);
173
172
  }
174
173
 
175
174
  function normalizeRegistryRun(runId: string, value: unknown): SubagentRegistryRun | undefined {
@@ -1,4 +1,4 @@
1
- import { complete } from "@earendil-works/pi-ai";
1
+ import { complete } from "@earendil-works/pi-ai/compat";
2
2
  import type { Api, Model } from "@earendil-works/pi-ai";
3
3
  import type { AgentTask } from "./types.js";
4
4
  import {
@@ -1,6 +1,6 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
- import { isDir } from "./paths.js";
3
+ import { hasLaunchedAgentPrompt, isDir } from "./paths.js";
4
4
  import { listSubagentRunDirs } from "./registry.js";
5
5
  import { getAgentState } from "./state.js";
6
6
  import type { AgentState } from "./types.js";
@@ -105,7 +105,7 @@ export function listSubagentSessionRecords(cwd: string): SubagentSessionRecord[]
105
105
  for (const entry of fs.readdirSync(runDir, { withFileTypes: true })) {
106
106
  if (!entry.isDirectory()) continue;
107
107
  const agentDir = path.join(runDir, entry.name);
108
- if (!fs.existsSync(path.join(agentDir, "prompt.md"))) continue;
108
+ if (!hasLaunchedAgentPrompt(runDir, entry.name)) continue;
109
109
  records.push({
110
110
  runDir,
111
111
  runName: path.basename(runDir),
@@ -1,6 +1,6 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
- import { isDir } from "./paths.js";
3
+ import { hasLaunchedAgentPrompt, isDir } from "./paths.js";
4
4
  import { readStructuredResult } from "./structured-result.js";
5
5
  import type { AgentResult, AgentState, RpcEventRecord, RunState } from "./types.js";
6
6
 
@@ -23,7 +23,7 @@ export function getAgentState(
23
23
  ): AgentState | null {
24
24
  const agentDir = path.join(runDir, agentId);
25
25
  if (!isDir(agentDir)) return null;
26
- if (!fs.existsSync(path.join(agentDir, "prompt.md"))) return null;
26
+ if (!hasLaunchedAgentPrompt(runDir, agentId)) return null;
27
27
  const includeLineCounts = options.includeLineCounts ?? true;
28
28
  const checkRpcPromptFailure = options.checkRpcPromptFailure ?? true;
29
29
 
@@ -188,7 +188,7 @@ export function getRunState(
188
188
  // Read launched agent dirs
189
189
  for (const entry of fs.readdirSync(runDir, { withFileTypes: true })) {
190
190
  if (!entry.isDirectory()) continue;
191
- if (!fs.existsSync(path.join(runDir, entry.name, "prompt.md"))) continue;
191
+ if (!hasLaunchedAgentPrompt(runDir, entry.name)) continue;
192
192
  if (filterIds && !filterIds.includes(entry.name)) continue;
193
193
  const state = getAgentState(runDir, entry.name, options);
194
194
  if (state) {
@@ -1,4 +1,4 @@
1
- import { complete } from "@earendil-works/pi-ai";
1
+ import { complete } from "@earendil-works/pi-ai/compat";
2
2
  import type { Api, Model } from "@earendil-works/pi-ai";
3
3
  import { currentModelRef, resolveSubagentRoutingConfig, type SubagentConfig } from "./config.js";
4
4
 
@@ -11,7 +11,7 @@ export type {
11
11
  StructuredResult,
12
12
  } from "./core/types.js";
13
13
 
14
- export { createRunDir, getRunRoot, resolveRunDir, validateBasename } from "./core/paths.js";
14
+ export { createRunDir, getRunRoot, hasAgentPrompt, hasLaunchedAgentPrompt, hasQueuedAgentPrompt, resolveRunDir, validateBasename } from "./core/paths.js";
15
15
  export type { CopySubagentConfigSampleResult, ModelByParentEntry, ResolvedAgentTaskConfig, ResolvedSubagentRoutingConfig, ResolveAgentTaskOptions, SubagentConfig, SubagentPreset, SubagentRoutingConfig, SubagentTypeConfig, SubagentVisionConfig } from "./core/config.js";
16
16
  export {
17
17
  configFiles,
@@ -1,6 +1,6 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
- import { complete } from "@earendil-works/pi-ai";
3
+ import { complete } from "@earendil-works/pi-ai/compat";
4
4
  import type { Api, AssistantMessage, ImageContent, Model, TextContent } from "@earendil-works/pi-ai";
5
5
  import { Type } from "typebox";
6
6
 
@@ -13,7 +13,7 @@
13
13
  // automatic fallback to the programmatic digest on any failure/timeout.
14
14
  // ---------------------------------------------------------------------------
15
15
 
16
- import { complete } from "@earendil-works/pi-ai"
16
+ import { complete } from "@earendil-works/pi-ai/compat"
17
17
  import type { Model, Api } from "@earendil-works/pi-ai"
18
18
  import type { DcpState } from "./state.js"
19
19
  import type { DcpConfig } from "./config.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-ui-extend",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -64,9 +64,9 @@
64
64
  "prepublishOnly": "npm run check && npm run build:pix && npm run generate-schemas"
65
65
  },
66
66
  "dependencies": {
67
- "@earendil-works/pi-ai": "0.79.10",
68
- "@earendil-works/pi-coding-agent": "0.79.10",
69
- "@earendil-works/pi-tui": "0.79.10",
67
+ "@earendil-works/pi-ai": "0.80.2",
68
+ "@earendil-works/pi-coding-agent": "0.80.2",
69
+ "@earendil-works/pi-tui": "0.80.2",
70
70
  "@mariozechner/clipboard": "^0.3.9",
71
71
  "jsonc-parser": "3.3.1",
72
72
  "typebox": "1.1.38",