terminal-pilot 0.0.46 → 0.0.48

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 (56) hide show
  1. package/dist/cli.d.ts +5 -0
  2. package/dist/cli.js +179 -28
  3. package/dist/cli.js.map +4 -4
  4. package/dist/commands/close-session.js.map +1 -1
  5. package/dist/commands/create-session.js.map +1 -1
  6. package/dist/commands/daemon-runtime.js.map +1 -1
  7. package/dist/commands/fill.js.map +1 -1
  8. package/dist/commands/get-session.js.map +1 -1
  9. package/dist/commands/index.js +17 -0
  10. package/dist/commands/index.js.map +3 -3
  11. package/dist/commands/install.js +17 -0
  12. package/dist/commands/install.js.map +3 -3
  13. package/dist/commands/installer.js +17 -0
  14. package/dist/commands/installer.js.map +3 -3
  15. package/dist/commands/list-sessions.js.map +1 -1
  16. package/dist/commands/press-key.js.map +1 -1
  17. package/dist/commands/read-history.js.map +1 -1
  18. package/dist/commands/read-screen.js.map +1 -1
  19. package/dist/commands/resize.js.map +1 -1
  20. package/dist/commands/runtime.js.map +1 -1
  21. package/dist/commands/screenshot.js.map +1 -1
  22. package/dist/commands/send-signal.js.map +1 -1
  23. package/dist/commands/type.js.map +1 -1
  24. package/dist/commands/uninstall.js +17 -0
  25. package/dist/commands/uninstall.js.map +3 -3
  26. package/dist/commands/wait-for-exit.js.map +1 -1
  27. package/dist/commands/wait-for.js.map +1 -1
  28. package/dist/composition.json +1 -1
  29. package/dist/testing/cli-repl.js +177 -27
  30. package/dist/testing/cli-repl.js.map +4 -4
  31. package/dist/testing/qa-cli.js +177 -27
  32. package/dist/testing/qa-cli.js.map +4 -4
  33. package/node_modules/@poe-code/agent-defs/README.md +1 -1
  34. package/node_modules/@poe-code/agent-defs/dist/agents/index.d.ts +1 -0
  35. package/node_modules/@poe-code/agent-defs/dist/agents/index.js +1 -0
  36. package/node_modules/@poe-code/agent-defs/dist/agents/pi.d.ts +2 -0
  37. package/node_modules/@poe-code/agent-defs/dist/agents/pi.js +14 -0
  38. package/node_modules/@poe-code/agent-defs/dist/index.d.ts +1 -1
  39. package/node_modules/@poe-code/agent-defs/dist/index.js +1 -1
  40. package/node_modules/@poe-code/agent-defs/dist/registry.js +2 -1
  41. package/node_modules/@poe-code/agent-defs/dist/types.d.ts +1 -1
  42. package/node_modules/@poe-code/agent-defs/package.json +0 -2
  43. package/node_modules/@poe-code/agent-skill-config/package.json +0 -2
  44. package/node_modules/@poe-code/config-mutations/package.json +0 -2
  45. package/node_modules/@poe-code/frontmatter/package.json +0 -2
  46. package/node_modules/toolcraft-design/dist/components/help-formatter-plain.js +1 -1
  47. package/node_modules/toolcraft-design/dist/components/help-formatter.d.ts +2 -0
  48. package/node_modules/toolcraft-design/dist/components/help-formatter.js +1 -1
  49. package/node_modules/toolcraft-design/dist/explorer/actions.d.ts +1 -0
  50. package/node_modules/toolcraft-design/dist/explorer/actions.js +1 -0
  51. package/node_modules/toolcraft-design/dist/explorer/reducer.js +1 -0
  52. package/node_modules/toolcraft-design/dist/explorer/runtime.js +21 -2
  53. package/node_modules/toolcraft-design/dist/explorer/state.d.ts +6 -0
  54. package/node_modules/toolcraft-design/dist/explorer/state.js +9 -6
  55. package/node_modules/toolcraft-design/package.json +0 -2
  56. package/package.json +3 -3
@@ -23,7 +23,7 @@ const codex = allAgents.find((agent) => agent.id === "codex");
23
23
  - `parseAgentSpecifier(input)`: parses `agent` or `agent:model` input.
24
24
  - `formatAgentSpecifier(specifier)`: formats an agent specifier.
25
25
  - `normalizeAgentId(input)`: normalizes the agent part through the registry.
26
- - Agent definition exports such as `codexAgent`, `claudeCodeAgent`, and `geminiCliAgent`.
26
+ - Agent definition exports such as `codexAgent`, `claudeCodeAgent`, `geminiCliAgent`, and `piAgent`.
27
27
 
28
28
  ## Config Options
29
29
 
@@ -6,4 +6,5 @@ export { geminiCliAgent } from "./gemini-cli.js";
6
6
  export { openCodeAgent } from "./opencode.js";
7
7
  export { kimiAgent } from "./kimi.js";
8
8
  export { gooseAgent } from "./goose.js";
9
+ export { piAgent } from "./pi.js";
9
10
  export { poeAgentAgent } from "./poe-agent.js";
@@ -6,4 +6,5 @@ export { geminiCliAgent } from "./gemini-cli.js";
6
6
  export { openCodeAgent } from "./opencode.js";
7
7
  export { kimiAgent } from "./kimi.js";
8
8
  export { gooseAgent } from "./goose.js";
9
+ export { piAgent } from "./pi.js";
9
10
  export { poeAgentAgent } from "./poe-agent.js";
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from "../types.js";
2
+ export declare const piAgent: AgentDefinition;
@@ -0,0 +1,14 @@
1
+ export const piAgent = {
2
+ id: "pi",
3
+ name: "pi",
4
+ aliases: ["pi-agent"],
5
+ label: "Pi",
6
+ summary: "Pi coding agent (spawn-only; uses local Pi auth/settings).",
7
+ binaryName: "pi",
8
+ branding: {
9
+ colors: {
10
+ dark: "#F2F2F2",
11
+ light: "#242424"
12
+ }
13
+ }
14
+ };
@@ -1,5 +1,5 @@
1
1
  export type { AgentDefinition, ApiShapeId, OtelCaptureDefinition } from "./types.js";
2
2
  export type { AgentSpecifier } from "./specifier.js";
3
- export { claudeCodeAgent, claudeDesktopAgent, codexAgent, cursorAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, poeAgentAgent } from "./agents/index.js";
3
+ export { claudeCodeAgent, claudeDesktopAgent, codexAgent, cursorAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, piAgent, poeAgentAgent } from "./agents/index.js";
4
4
  export { allAgents, resolveAgentId } from "./registry.js";
5
5
  export { parseAgentSpecifier, formatAgentSpecifier, normalizeAgentId } from "./specifier.js";
@@ -1,3 +1,3 @@
1
- export { claudeCodeAgent, claudeDesktopAgent, codexAgent, cursorAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, poeAgentAgent } from "./agents/index.js";
1
+ export { claudeCodeAgent, claudeDesktopAgent, codexAgent, cursorAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, piAgent, poeAgentAgent } from "./agents/index.js";
2
2
  export { allAgents, resolveAgentId } from "./registry.js";
3
3
  export { parseAgentSpecifier, formatAgentSpecifier, normalizeAgentId } from "./specifier.js";
@@ -1,4 +1,4 @@
1
- import { claudeCodeAgent, claudeDesktopAgent, codexAgent, cursorAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, poeAgentAgent } from "./agents/index.js";
1
+ import { claudeCodeAgent, claudeDesktopAgent, codexAgent, cursorAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, piAgent, poeAgentAgent } from "./agents/index.js";
2
2
  function freezeAgent(agent) {
3
3
  if (agent.aliases !== undefined) {
4
4
  Object.freeze(agent.aliases);
@@ -25,6 +25,7 @@ export const allAgents = Object.freeze([
25
25
  freezeAgent(openCodeAgent),
26
26
  freezeAgent(kimiAgent),
27
27
  freezeAgent(gooseAgent),
28
+ freezeAgent(piAgent),
28
29
  freezeAgent(poeAgentAgent)
29
30
  ]);
30
31
  const lookup = new Map();
@@ -13,7 +13,7 @@ export interface AgentDefinition {
13
13
  binaryName?: string;
14
14
  readonly apiShapes?: readonly ApiShapeId[];
15
15
  readonly otelCapture?: OtelCaptureDefinition;
16
- configPath: string;
16
+ configPath?: string;
17
17
  readonly configPaths?: {
18
18
  readonly darwin: string;
19
19
  readonly linux: string;
@@ -1,6 +1,4 @@
1
1
  {
2
- "name": "@poe-code/agent-defs",
3
- "version": "0.0.1",
4
2
  "private": true,
5
3
  "license": "MIT",
6
4
  "type": "module",
@@ -1,6 +1,4 @@
1
1
  {
2
- "name": "@poe-code/agent-skill-config",
3
- "version": "0.0.1",
4
2
  "private": true,
5
3
  "license": "MIT",
6
4
  "type": "module",
@@ -1,6 +1,4 @@
1
1
  {
2
- "name": "@poe-code/config-mutations",
3
- "version": "0.0.1",
4
2
  "private": true,
5
3
  "license": "MIT",
6
4
  "type": "module",
@@ -1,6 +1,4 @@
1
1
  {
2
- "name": "@poe-code/frontmatter",
3
- "version": "0.0.1",
4
2
  "private": true,
5
3
  "license": "MIT",
6
4
  "type": "module",
@@ -117,7 +117,7 @@ export function formatColumns(opts) {
117
117
  export function formatCommandList(commands) {
118
118
  return formatColumns({
119
119
  rows: commands.map((cmd) => ({
120
- left: cmd.name,
120
+ left: `${" ".repeat((cmd.depth ?? 0) * 2)}${cmd.name}`,
121
121
  right: cmd.description
122
122
  }))
123
123
  });
@@ -1,6 +1,8 @@
1
1
  export interface CommandInfo {
2
2
  name: string;
3
3
  description: string;
4
+ /** Nesting depth relative to the help target. Depth 0 is a direct child. */
5
+ depth?: number;
4
6
  }
5
7
  export interface OptionInfo {
6
8
  flags: string;
@@ -190,7 +190,7 @@ export function formatOption(flags, description) {
190
190
  export function formatCommandList(commands) {
191
191
  return formatColumns({
192
192
  rows: commands.map((cmd) => ({
193
- left: text.command(cmd.name),
193
+ left: `${" ".repeat((cmd.depth ?? 0) * 2)}${text.command(cmd.name)}`,
194
194
  right: cmd.description
195
195
  }))
196
196
  });
@@ -6,6 +6,7 @@ type ExplorerKeypressEvent = Extract<ExplorerEvent, {
6
6
  }>["key"];
7
7
  export type ActionRuntimeHandles = {
8
8
  refresh: () => Promise<void>;
9
+ reloadDetail: (rowId?: string) => void;
9
10
  suspendAnd: <T>(fn: () => Promise<T>) => Promise<T>;
10
11
  openModal: (content: {
11
12
  title: string;
@@ -19,6 +19,7 @@ export function buildActionContext(state, _action, source, runtimeHandles, rowsO
19
19
  item: source === "detail" ? currentDetailItem(state) : undefined,
20
20
  filter: state.filter,
21
21
  refresh: runtimeHandles.refresh,
22
+ reloadDetail: runtimeHandles.reloadDetail,
22
23
  suspendAnd: runtimeHandles.suspendAnd,
23
24
  openModal: runtimeHandles.openModal,
24
25
  toast: runtimeHandles.toast,
@@ -4,6 +4,7 @@ import { REGION_ALL, REGION_DETAIL, REGION_FOOTER, REGION_HEADER, REGION_LIST, R
4
4
  const NO_EFFECTS = [];
5
5
  const DEFAULT_ACTION_HANDLES = {
6
6
  refresh: async () => undefined,
7
+ reloadDetail: () => undefined,
7
8
  suspendAnd: async (fn) => fn(),
8
9
  openModal: () => undefined,
9
10
  toast: () => undefined,
@@ -44,6 +44,9 @@ class ExplorerRuntime {
44
44
  refresh: async () => {
45
45
  await this.refreshRowsFromSource();
46
46
  },
47
+ reloadDetail: (rowId) => {
48
+ this.reloadFocusedDetail(rowId);
49
+ },
47
50
  suspendAnd: async (fn) => this.suspendAnd(fn),
48
51
  openModal: (content) => {
49
52
  this.dispatch({ type: "modalOpened", title: content.title, content: content.content });
@@ -62,6 +65,10 @@ class ExplorerRuntime {
62
65
  this.settle = { resolve, reject };
63
66
  try {
64
67
  this.startTerminal();
68
+ if (this.config.initialRows !== undefined && this.config.initialRows.length > 0) {
69
+ // Seed list/detail before first paint so callers with known rows avoid an empty flash.
70
+ this.dispatch({ type: "rowsLoaded", rows: this.config.initialRows });
71
+ }
65
72
  this.render();
66
73
  this.loadRows().catch((error) => {
67
74
  this.fail(error);
@@ -145,13 +152,25 @@ class ExplorerRuntime {
145
152
  rows: this.state.size.rows,
146
153
  detailHidden: this.state.layout === "narrow-list-only" || this.state.layout === "too-narrow"
147
154
  });
148
- void this.detailJobs.schedule(rowId, (ctx) => this.config.detail.items(row, ctx), {
155
+ const reloadDetail = () => this.reloadFocusedDetail(rowId);
156
+ void this.detailJobs.schedule(rowId, (ctx) => this.config.detail.items(row, { ...ctx, reloadDetail }), {
149
157
  width: layout.detail.width,
150
158
  height: layout.detail.height,
151
159
  row,
152
- signal: new AbortController().signal
160
+ signal: new AbortController().signal,
161
+ reloadDetail
153
162
  });
154
163
  }
164
+ reloadFocusedDetail(rowId) {
165
+ const focusedId = this.state.detail.rowId;
166
+ if (focusedId === null) {
167
+ return;
168
+ }
169
+ if (rowId !== undefined && rowId !== focusedId) {
170
+ return;
171
+ }
172
+ this.renderDetail(focusedId);
173
+ }
155
174
  loadDetailContent(rowId, token, items) {
156
175
  const row = this.state.rows.find((candidate) => candidate.id === rowId);
157
176
  if (row === undefined) {
@@ -30,6 +30,8 @@ export interface DetailCtx {
30
30
  height: number;
31
31
  signal: AbortSignal;
32
32
  row: Row;
33
+ /** Re-run detail.items for the focused row and repaint the preview pane. */
34
+ reloadDetail?: () => void;
33
35
  }
34
36
  export interface Action<R> {
35
37
  id: string;
@@ -47,6 +49,8 @@ export interface ActionContext<R> {
47
49
  item?: DetailItem;
48
50
  filter: string;
49
51
  refresh: () => Promise<void>;
52
+ /** Re-run detail.items for the focused row and repaint the preview pane. */
53
+ reloadDetail: () => void;
50
54
  suspendAnd: <T>(fn: () => Promise<T>) => Promise<T>;
51
55
  openModal: (content: {
52
56
  title: string;
@@ -73,6 +77,8 @@ export interface ExplorerConfig<R> {
73
77
  keybindOverrides?: Record<string, string | string[]>;
74
78
  emptyHint?: string;
75
79
  initialFilter?: string;
80
+ /** Synchronous first paint rows; still refreshed via `rows()` after start. */
81
+ initialRows?: Row[];
76
82
  }
77
83
  export declare const REGION_HEADER: number;
78
84
  export declare const REGION_LIST: number;
@@ -17,23 +17,26 @@ export function createInitialState(config, size) {
17
17
  rows: normalizeSize(size.rows)
18
18
  };
19
19
  const multiSelect = config.multiSelect ?? true;
20
+ const initialRows = config.initialRows ?? [];
21
+ const initialFilter = config.initialFilter ?? "";
22
+ // Defer filtering to first rowsLoaded when empty; seed list immediately when provided.
20
23
  return {
21
24
  title: config.title,
22
25
  emptyHint: config.emptyHint ?? "No detail",
23
- rows: [],
24
- filtered: [],
26
+ rows: initialRows,
27
+ filtered: initialRows.map((_, index) => index),
25
28
  matchPositions: new Map(),
26
29
  cursor: 0,
27
- filter: config.initialFilter ?? "",
30
+ filter: initialFilter,
28
31
  filterFocused: false,
29
32
  focused: "list",
30
33
  detail: {
31
- rowId: null,
34
+ rowId: initialRows[0]?.id ?? null,
32
35
  items: null,
33
36
  cursor: 0,
34
37
  scroll: 0,
35
- token: 0,
36
- loading: false
38
+ token: initialRows.length > 0 ? 1 : 0,
39
+ loading: initialRows.length > 0
37
40
  },
38
41
  selected: new Set(),
39
42
  multiSelect,
@@ -1,6 +1,4 @@
1
1
  {
2
- "name": "toolcraft-design",
3
- "version": "0.0.2",
4
2
  "private": true,
5
3
  "license": "MIT",
6
4
  "type": "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminal-pilot",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "description": "Playwright-like SDK and CLI for automating interactive CLI apps through a real PTY",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -64,6 +64,7 @@
64
64
  "node-pty": "^1.1.0",
65
65
  "sisteransi": "^1.0.5",
66
66
  "smol-toml": "^1.6.0",
67
+ "terminal-png": "^0.1.0",
67
68
  "toolcraft": "^0.0.51",
68
69
  "yaml": "^2.8.2"
69
70
  },
@@ -87,7 +88,6 @@
87
88
  "@poe-code/frontmatter": "*"
88
89
  },
89
90
  "devDependencies": {
90
- "toolcraft-schema": "*",
91
- "terminal-png": "*"
91
+ "toolcraft-schema": "*"
92
92
  }
93
93
  }