@h-rig/cli 0.0.6-alpha.27 → 0.0.6-alpha.280

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 (52) hide show
  1. package/README.md +6 -28
  2. package/package.json +11 -28
  3. package/dist/bin/build-rig-binaries.js +0 -107
  4. package/dist/bin/rig.js +0 -11321
  5. package/dist/src/commands/_authority-runs.js +0 -111
  6. package/dist/src/commands/_cli-format.js +0 -164
  7. package/dist/src/commands/_connection-state.js +0 -123
  8. package/dist/src/commands/_doctor-checks.js +0 -507
  9. package/dist/src/commands/_help-catalog.js +0 -203
  10. package/dist/src/commands/_operator-surface.js +0 -204
  11. package/dist/src/commands/_operator-view.js +0 -1147
  12. package/dist/src/commands/_parsers.js +0 -107
  13. package/dist/src/commands/_paths.js +0 -50
  14. package/dist/src/commands/_pi-frontend.js +0 -843
  15. package/dist/src/commands/_pi-install.js +0 -185
  16. package/dist/src/commands/_pi-worker-bridge-extension.js +0 -761
  17. package/dist/src/commands/_policy.js +0 -79
  18. package/dist/src/commands/_preflight.js +0 -403
  19. package/dist/src/commands/_probes.js +0 -13
  20. package/dist/src/commands/_run-driver-helpers.js +0 -289
  21. package/dist/src/commands/_server-client.js +0 -514
  22. package/dist/src/commands/_snapshot-upload.js +0 -318
  23. package/dist/src/commands/_task-picker.js +0 -76
  24. package/dist/src/commands/agent.js +0 -499
  25. package/dist/src/commands/browser.js +0 -890
  26. package/dist/src/commands/connect.js +0 -288
  27. package/dist/src/commands/dist.js +0 -402
  28. package/dist/src/commands/doctor.js +0 -517
  29. package/dist/src/commands/github.js +0 -281
  30. package/dist/src/commands/inbox.js +0 -160
  31. package/dist/src/commands/init.js +0 -1563
  32. package/dist/src/commands/inspect.js +0 -174
  33. package/dist/src/commands/inspector.js +0 -256
  34. package/dist/src/commands/plugin.js +0 -167
  35. package/dist/src/commands/profile-and-review.js +0 -178
  36. package/dist/src/commands/queue.js +0 -198
  37. package/dist/src/commands/remote.js +0 -507
  38. package/dist/src/commands/repo-git-harness.js +0 -221
  39. package/dist/src/commands/run.js +0 -1688
  40. package/dist/src/commands/server.js +0 -571
  41. package/dist/src/commands/setup.js +0 -687
  42. package/dist/src/commands/task-report-bug.js +0 -1083
  43. package/dist/src/commands/task-run-driver.js +0 -2600
  44. package/dist/src/commands/task.js +0 -2200
  45. package/dist/src/commands/test.js +0 -39
  46. package/dist/src/commands/workspace.js +0 -123
  47. package/dist/src/commands.js +0 -11000
  48. package/dist/src/index.js +0 -11339
  49. package/dist/src/launcher.js +0 -133
  50. package/dist/src/report-bug.js +0 -260
  51. package/dist/src/runner.js +0 -273
  52. package/dist/src/withMutedConsole.js +0 -42
@@ -1,203 +0,0 @@
1
- // @bun
2
- // packages/cli/src/commands/_help-catalog.ts
3
- import pc from "picocolors";
4
- var PRIMARY_GROUPS = [
5
- {
6
- name: "init",
7
- summary: "Set up Rig for this repo: server, GitHub auth, checkout strategy, task source, and Pi wiring.",
8
- usage: ["rig init [--yes] [--server local|remote] [--repo owner/repo] [--remote-url <url>]"],
9
- commands: [
10
- { command: "init", description: "Interactive setup wizard for a new or existing Rig repo.", primary: true },
11
- { command: "init --yes", description: "Non-interactive setup using detected/default settings.", primary: true },
12
- { command: "init --server remote --remote-url <url>", description: "Link this repo to a remote Rig server.", primary: true },
13
- { command: "init --repair", description: "Repair missing private state without replacing project config." }
14
- ],
15
- examples: [
16
- "rig init",
17
- "rig init --yes --repo humanity-org/humanwork",
18
- "rig init --server remote --remote-url https://where.rig-does.work --repo owner/repo"
19
- ],
20
- next: ["After init, run `rig server status`.", "Then use `rig task list` and `rig task run --next` for day-to-day work."]
21
- },
22
- {
23
- name: "server",
24
- summary: "Choose, inspect, and start the Rig server that owns tasks and runs.",
25
- usage: ["rig server <status|list|add|use|start> [options]"],
26
- commands: [
27
- { command: "status", description: "Show the selected server for this repo.", primary: true },
28
- { command: "list", description: "List saved local/remote server aliases.", primary: true },
29
- { command: "add <alias> <url>", description: "Save a remote Rig server URL.", primary: true },
30
- { command: "use [alias|local]", description: "Select a server; prompts in an interactive TTY.", primary: true },
31
- { command: "start [--host <host>] [--port <n>]", description: "Start a local rig-server process.", primary: true }
32
- ],
33
- examples: [
34
- "rig server status",
35
- "rig server add prod https://where.rig-does.work",
36
- "rig server use prod",
37
- "rig server use local",
38
- "rig server start --port 3773"
39
- ],
40
- next: ["Use `rig task list` to see server-owned work.", "Use `rig run list` or `rig run attach <id> --follow` to monitor runs."],
41
- advanced: ["Compatibility alias: `rig connect ...` remains callable."]
42
- },
43
- {
44
- name: "task",
45
- summary: "Find work, start Pi-backed runs, and validate task results.",
46
- usage: ["rig task <list|next|show|run> [options]"],
47
- commands: [
48
- { command: "list [--assignee <login|@me>] [--state open|closed]", description: "List tasks from the selected server/source.", primary: true },
49
- { command: "next [filters]", description: "Pick the next matching task.", primary: true },
50
- { command: "show <id>|--task <id>", description: "Show task details.", primary: true },
51
- { command: "run [#<issue>|<task-id>|--next|--task <id>]", description: "Submit a task run; interactive follows with bundled Pi.", primary: true },
52
- { command: "validate|verify [--task <id>]", description: "Run configured task checks/review gates." },
53
- { command: "artifacts|artifact-dir|artifact-write", description: "Inspect or write task artifacts." },
54
- { command: "report-bug", description: "Create a structured bug report/task." }
55
- ],
56
- examples: [
57
- "rig task list --assignee @me --limit 20",
58
- "rig task run --next",
59
- "rig task run #123 --runtime-adapter pi",
60
- "rig task run --title 'Investigate deploy drift' --initial-prompt 'Check server health'"
61
- ],
62
- next: ["Use `--detach` to submit without attaching.", "Use `rig run attach <run-id> --follow` to rejoin a live run."]
63
- },
64
- {
65
- name: "run",
66
- summary: "Observe, attach to, and control Rig runs.",
67
- usage: ["rig run <list|status|show|attach|stop> [options]"],
68
- commands: [
69
- { command: "list", description: "List recent runs from the selected server or local state.", primary: true },
70
- { command: "status", description: "Summarize active and recent runs.", primary: true },
71
- { command: "show --run <id>", description: "Show one run record.", primary: true },
72
- { command: "attach <run-id>|--run <id> [--follow]", description: "Attach to the run; `--follow` launches native bundled Pi for live Pi runs.", primary: true },
73
- { command: "stop [<run-id>|--run <id>]", description: "Request stop for one run or local active runs.", primary: true },
74
- { command: "timeline --run <id> [--follow]", description: "Stream raw run timeline events." },
75
- { command: "delete|cleanup", description: "Remove completed run records/artifacts." }
76
- ],
77
- examples: [
78
- "rig run list",
79
- "rig run attach 01234567-89ab-cdef-0123-456789abcdef --follow",
80
- "rig run show --run <run-id>",
81
- "rig run stop <run-id>"
82
- ],
83
- next: ["Use `rig task run --next` to create a new run.", "Use `--json` when scripts need the full structured record."]
84
- }
85
- ];
86
- var ADVANCED_GROUPS = [
87
- { name: "connect", summary: "Compatibility alias for `rig server` selection commands.", usage: ["rig connect <status|list|add|use>"], commands: [{ command: "status|list|add|use", description: "Use `rig server ...` for the primary UX." }] },
88
- { name: "github", summary: "GitHub auth helpers.", usage: ["rig github auth <status|import-gh|token>"], commands: [{ command: "auth status", description: "Show GitHub auth state." }] },
89
- { name: "doctor", summary: "Diagnostics for project/server/GitHub/Pi state.", usage: ["rig doctor [check|run|shared|...]"], commands: [{ command: "check", description: "Run diagnostics." }] },
90
- { name: "setup", summary: "Bootstrap/check local setup.", usage: ["rig setup <bootstrap|check|preflight>"], commands: [{ command: "bootstrap|check|preflight", description: "Setup helpers." }] },
91
- { name: "inspect", summary: "Inspect logs, artifacts, graphs, failures.", usage: ["rig inspect <logs|artifacts|failures|graph|audit|diff>"], commands: [{ command: "logs --task <id>", description: "Inspect task logs." }] },
92
- { name: "repo", summary: "Repository sync/baseline helpers.", usage: ["rig repo <sync|reset-baseline>"], commands: [{ command: "sync", description: "Sync project repository state." }] },
93
- { name: "profile", summary: "Runtime profile/model defaults.", usage: ["rig profile <show|set>"], commands: [{ command: "show", description: "Show active profile." }] },
94
- { name: "review", summary: "Review policy configuration.", usage: ["rig review <show|set>"], commands: [{ command: "show", description: "Show review settings." }] },
95
- { name: "browser", summary: "Browser/app diagnostics.", usage: ["rig browser <help|explain|demo|app>"], commands: [{ command: "help", description: "Browser command help." }] },
96
- { name: "plugin", summary: "Plugin validation/listing.", usage: ["rig plugin <list|validate>"], commands: [{ command: "list", description: "List plugins." }] },
97
- { name: "queue", summary: "Run task queues locally.", usage: ["rig queue run [options]"], commands: [{ command: "run", description: "Process queue work." }] },
98
- { name: "agent", summary: "Runtime agent workspace helpers.", usage: ["rig agent <list|prepare|run|cleanup>"], commands: [{ command: "list", description: "List prepared agents." }] },
99
- { name: "inspector", summary: "Event stream and drift scanners.", usage: ["rig inspector <stream|scan-upstream-drift>"], commands: [{ command: "stream", description: "Stream events." }] },
100
- { name: "dist", summary: "Build/install packaged Rig CLI.", usage: ["rig dist <build|install|doctor>"], commands: [{ command: "build", description: "Build distribution." }] },
101
- { name: "workspace", summary: "Workspace topology/service helpers.", usage: ["rig workspace <summary|topology|remote-hosts>"], commands: [{ command: "summary", description: "Show workspace summary." }] },
102
- { name: "remote", summary: "Legacy remote orchestration controls.", usage: ["rig remote <status|watch|pause|resume|...>"], commands: [{ command: "status", description: "Show remote state." }] },
103
- { name: "inbox", summary: "Approval/input inbox for blocked runs.", usage: ["rig inbox <approvals|approve|inputs|respond>"], commands: [{ command: "approvals", description: "List pending approvals." }] },
104
- { name: "git", summary: "Pass through to Rig git-flow helper.", usage: ["rig git <args...>"], commands: [{ command: "<args...>", description: "Advanced git flow operations." }] },
105
- { name: "harness", summary: "Pass through to runtime harness CLI.", usage: ["rig harness <args...>"], commands: [{ command: "<args...>", description: "Advanced harness operations." }] },
106
- { name: "test", summary: "Project test wrappers.", usage: ["rig test <unit|e2e|all>"], commands: [{ command: "all", description: "Run configured project tests." }] }
107
- ];
108
- var ALL_GROUPS = [...PRIMARY_GROUPS, ...ADVANCED_GROUPS];
109
- function heading(title) {
110
- return pc.bold(pc.cyan(title));
111
- }
112
- function commandLine(command, description) {
113
- const commandColumn = command.length >= 34 ? `${command} ` : command.padEnd(34);
114
- return `${pc.dim("\u2502")} ${pc.bold(commandColumn)} ${description}`;
115
- }
116
- function renderGroup(group) {
117
- const lines = [
118
- `${heading(`rig ${group.name}`)} \u2014 ${group.summary}`,
119
- "",
120
- pc.bold("Usage"),
121
- ...group.usage.map((line) => ` ${line}`),
122
- "",
123
- pc.bold("Commands"),
124
- ...group.commands.map((entry) => commandLine(entry.command, entry.description))
125
- ];
126
- if (group.examples?.length) {
127
- lines.push("", pc.bold("Examples"), ...group.examples.map((line) => ` ${pc.dim("$")} ${line}`));
128
- }
129
- if (group.next?.length) {
130
- lines.push("", pc.bold("Next steps"), ...group.next.map((line) => ` ${pc.dim("\u203A")} ${line}`));
131
- }
132
- if (group.advanced?.length) {
133
- lines.push("", pc.bold("Compatibility / advanced"), ...group.advanced.map((line) => ` ${pc.dim("\u203A")} ${line}`));
134
- }
135
- return lines.join(`
136
- `);
137
- }
138
- function renderTopLevelHelp() {
139
- return [
140
- `${heading("rig")} ${pc.dim("\u2014 server-owned task/run control plane for Pi-backed engineering work")}`,
141
- pc.dim("A repo-local CLI for setup, server selection, task runs, live attach, and completion review."),
142
- "",
143
- `${pc.bold(pc.magenta("\u25C7 Start here"))} \u2014 ${pc.dim("bootstrap a repo and choose where Rig runs")}`,
144
- commandLine("rig init", "Interactive setup: project config, GitHub auth, task source, server, checkout, Pi."),
145
- commandLine("rig init --yes", "Non-interactive setup using detected defaults; good for repeatable installs."),
146
- commandLine("rig server status", "Show whether this repo is using local Rig or a remote server."),
147
- commandLine("rig server use <alias|local>", "Switch the server that owns task/run state for this repo."),
148
- "",
149
- `${pc.bold(pc.magenta("\u25C7 Daily task loop"))} \u2014 ${pc.dim("find work, start a worker, and rejoin it later")}`,
150
- commandLine("rig task list", "List tasks from the selected task source/server with status, labels, and source."),
151
- commandLine("rig task next", "Pick the next matching task without starting it."),
152
- commandLine("rig task run --next", "Start the next task and attach to the live bundled Pi frontend."),
153
- commandLine("rig task run #123 --detach", "Submit a specific issue/task and return immediately."),
154
- "",
155
- `${pc.bold(pc.magenta("\u25C7 Live run control"))} \u2014 ${pc.dim("observe, steer, stop, or inspect active runs")}`,
156
- commandLine("rig run list", "Show recent/active runs from the selected server or local state."),
157
- commandLine("rig run attach <run-id> --follow", "Open the native Pi live view for a worker-backed run."),
158
- commandLine("rig run show --run <id>", "Print one run record; add `--json` for automation."),
159
- commandLine("rig run stop <run-id>", "Request cancellation for a running worker."),
160
- "",
161
- `${pc.bold(pc.magenta("\u25C7 Core groups"))} \u2014 ${pc.dim("run `rig <group> --help` for detailed commands and examples")}`,
162
- ...PRIMARY_GROUPS.map((group) => commandLine(group.name, group.summary)),
163
- commandLine("doctor", "Diagnose project/server/GitHub/task/Pi wiring when setup or runs misbehave."),
164
- "",
165
- `${pc.bold(pc.magenta("\u25C7 More"))}`,
166
- commandLine("rig help --advanced", "Legacy, dev, diagnostics, browser, queue, agent, remote, git, harness commands."),
167
- commandLine("rig <group> --help", "Rich per-group help with usage, descriptions, examples, and next steps."),
168
- commandLine("rig --version", "Print the installed Rig CLI version."),
169
- "",
170
- `${pc.bold(pc.magenta("\u25C7 Global options"))}`,
171
- commandLine("--project <path>", "Use a project root instead of auto-discovery."),
172
- commandLine("--json", "Emit structured output for scripts/agents."),
173
- commandLine("--dry-run", "Print the command plan without mutating state.")
174
- ].join(`
175
- `);
176
- }
177
- function renderAdvancedHelp() {
178
- return [
179
- `${heading("rig advanced")} \u2014 legacy, dev, and compatibility groups`,
180
- "",
181
- pc.bold("Primary groups are still"),
182
- " init, server, task, run",
183
- "",
184
- pc.bold("Advanced groups"),
185
- ...ADVANCED_GROUPS.map((group) => commandLine(group.name, group.summary)),
186
- "",
187
- pc.dim("All groups remain callable. Prefer `rig server`, `rig task`, and `rig run` for day-to-day work.")
188
- ].join(`
189
- `);
190
- }
191
- function renderGroupHelp(groupName) {
192
- const group = ALL_GROUPS.find((candidate) => candidate.name === groupName);
193
- return group ? renderGroup(group) : null;
194
- }
195
- function listHelpGroups() {
196
- return ALL_GROUPS.map((group) => group.name);
197
- }
198
- export {
199
- renderTopLevelHelp,
200
- renderGroupHelp,
201
- renderAdvancedHelp,
202
- listHelpGroups
203
- };
@@ -1,204 +0,0 @@
1
- // @bun
2
- // packages/cli/src/commands/_operator-surface.ts
3
- import { createInterface } from "readline";
4
- import { createInterface as createPromptInterface } from "readline/promises";
5
- var CANONICAL_STAGES = [
6
- "Connect",
7
- "GitHub/task sync",
8
- "Prepare workspace",
9
- "Launch Pi",
10
- "Plan",
11
- "Implement",
12
- "Validate",
13
- "Commit",
14
- "Open PR",
15
- "Review/CI",
16
- "Merge",
17
- "Complete"
18
- ];
19
- function logDetail(log) {
20
- return typeof log.detail === "string" ? log.detail.trim() : "";
21
- }
22
- function parseProviderProtocolLog(title, detail) {
23
- if (title.trim().toLowerCase() !== "agent output")
24
- return null;
25
- if (!detail.startsWith("{") || !detail.endsWith("}"))
26
- return null;
27
- try {
28
- const record = JSON.parse(detail);
29
- if (!record || typeof record !== "object" || Array.isArray(record))
30
- return null;
31
- const type = record.type;
32
- return typeof type === "string" && [
33
- "assistant",
34
- "message_start",
35
- "message_update",
36
- "message_end",
37
- "stream_event",
38
- "tool_result",
39
- "tool_execution_start",
40
- "tool_execution_update",
41
- "tool_execution_end",
42
- "turn_start",
43
- "turn_end"
44
- ].includes(type) ? record : null;
45
- } catch {
46
- return null;
47
- }
48
- }
49
- function renderProviderProtocolLog(record) {
50
- const type = typeof record.type === "string" ? record.type : "";
51
- if (type === "tool_execution_start" || type === "tool_execution_update" || type === "tool_execution_end") {
52
- const toolName = String(record.toolName ?? record.name ?? "tool");
53
- const status = type === "tool_execution_start" ? "started" : type === "tool_execution_end" ? record.isError === true || record.result && typeof record.result === "object" && !Array.isArray(record.result) && record.result.isError === true ? "failed" : "completed" : "running";
54
- return `[Pi tool] ${toolName} ${status}`;
55
- }
56
- return null;
57
- }
58
- function entryId(entry, fallback) {
59
- return typeof entry.id === "string" && entry.id.trim() ? entry.id : fallback;
60
- }
61
- function renderOperatorSnapshot(snapshot) {
62
- const run = snapshot.run.run && typeof snapshot.run.run === "object" ? snapshot.run.run : snapshot.run;
63
- const runId = String(run.runId ?? run.id ?? "run");
64
- const status = String(run.status ?? "unknown");
65
- const logs = snapshot.logs ?? [];
66
- const latestByStage = new Map;
67
- for (const log of logs) {
68
- const title = String(log.title ?? "").toLowerCase();
69
- const stageName = String(log.stage ?? "").toLowerCase();
70
- const stage = CANONICAL_STAGES.find((candidate) => candidate.toLowerCase() === title || candidate.toLowerCase() === stageName);
71
- if (stage)
72
- latestByStage.set(stage, log);
73
- }
74
- const stageLines = CANONICAL_STAGES.flatMap((stage) => {
75
- const match = latestByStage.get(stage);
76
- return match ? [`${stage}: ${String(match.status ?? status)}${logDetail(match) ? ` \u2014 ${logDetail(match)}` : ""}`] : [];
77
- });
78
- return [`Rig run ${runId}: ${status}`, ...stageLines].join(`
79
- `);
80
- }
81
- function createPiRunStreamRenderer(output = process.stdout) {
82
- let lastSnapshot = "";
83
- const assistantTextById = new Map;
84
- const seenTimeline = new Set;
85
- const seenLogs = new Set;
86
- const writeLine = (line) => output.write(`${line}
87
- `);
88
- return {
89
- renderSnapshot(snapshot) {
90
- const rendered = renderOperatorSnapshot(snapshot);
91
- if (rendered && rendered !== lastSnapshot) {
92
- writeLine(rendered);
93
- lastSnapshot = rendered;
94
- }
95
- },
96
- renderTimeline(entries) {
97
- for (const [index, entry] of entries.entries()) {
98
- const id = entryId(entry, `timeline:${index}:${String(entry.cursor ?? "")}`);
99
- if (entry.type === "assistant_message" && typeof entry.text === "string") {
100
- const text = entry.text;
101
- const previousText = assistantTextById.get(id) ?? "";
102
- if (!previousText && text.trim()) {
103
- writeLine("[Pi assistant]");
104
- }
105
- if (text.startsWith(previousText)) {
106
- const delta = text.slice(previousText.length);
107
- if (delta)
108
- output.write(delta);
109
- } else if (text.trim() && text !== previousText) {
110
- if (previousText)
111
- writeLine(`
112
- [Pi assistant]`);
113
- output.write(text);
114
- }
115
- assistantTextById.set(id, text);
116
- continue;
117
- }
118
- if (seenTimeline.has(id))
119
- continue;
120
- seenTimeline.add(id);
121
- if (entry.type === "tool_execution_start" || entry.type === "tool_execution_update" || entry.type === "tool_execution_end" || entry.type === "mcp_tool_call") {
122
- writeLine(`[Pi tool] ${String(entry.toolName ?? entry.name ?? entry.title ?? entry.type)} ${String(entry.status ?? entry.state ?? "")}`.trim());
123
- continue;
124
- }
125
- if (entry.type === "timeline_warning") {
126
- writeLine(`[Rig timeline] ${String(entry.detail ?? entry.message ?? "timeline unavailable")}`);
127
- }
128
- }
129
- },
130
- renderLogs(entries) {
131
- for (const [index, entry] of entries.entries()) {
132
- const id = entryId(entry, `log:${index}:${String(entry.createdAt ?? "")}:${String(entry.title ?? "")}`);
133
- if (seenLogs.has(id))
134
- continue;
135
- seenLogs.add(id);
136
- const title = String(entry.title ?? "");
137
- if (CANONICAL_STAGES.some((stage) => stage.toLowerCase() === title.toLowerCase()))
138
- continue;
139
- const detail = logDetail(entry);
140
- if (!detail)
141
- continue;
142
- const protocolRecord = parseProviderProtocolLog(title, detail);
143
- if (protocolRecord) {
144
- const protocolLine = renderProviderProtocolLog(protocolRecord);
145
- if (protocolLine)
146
- writeLine(protocolLine);
147
- continue;
148
- }
149
- writeLine(`[${title || "Rig log"}] ${detail}`);
150
- }
151
- }
152
- };
153
- }
154
- function createOperatorSurface(options = {}) {
155
- const input = options.input ?? process.stdin;
156
- const output = options.output ?? process.stdout;
157
- const errorOutput = options.errorOutput ?? process.stderr;
158
- const renderer = createPiRunStreamRenderer(output);
159
- const writeLine = (line) => output.write(`${line}
160
- `);
161
- return {
162
- mode: "pi-compatible-text",
163
- ...renderer,
164
- info: writeLine,
165
- error: (message) => errorOutput.write(`${message}
166
- `),
167
- attachCommandInput(handler) {
168
- if (options.interactive === false || !input.isTTY)
169
- return null;
170
- const rl = createInterface({ input, output: process.stdout, terminal: false });
171
- rl.on("line", (line) => {
172
- Promise.resolve(handler(line)).catch((error) => writeLine(`Operator command failed: ${error instanceof Error ? error.message : String(error)}`));
173
- });
174
- return { close: () => rl.close() };
175
- }
176
- };
177
- }
178
- function taskId(task) {
179
- return typeof task.id === "string" && task.id.trim() ? task.id : "<unknown>";
180
- }
181
- function taskTitle(task) {
182
- return typeof task.title === "string" && task.title.trim() ? task.title : "Untitled task";
183
- }
184
- function taskStatus(task) {
185
- return typeof task.status === "string" && task.status.trim() ? task.status : "unknown";
186
- }
187
- function renderTaskPickerRows(tasks) {
188
- return tasks.map((task, index) => `${index + 1}. ${taskId(task)} \xB7 ${taskStatus(task)} \xB7 ${taskTitle(task)}`);
189
- }
190
- async function promptForTaskSelection(question) {
191
- const rl = createPromptInterface({ input: process.stdin, output: process.stdout });
192
- try {
193
- return await rl.question(question);
194
- } finally {
195
- rl.close();
196
- }
197
- }
198
- export {
199
- renderTaskPickerRows,
200
- renderOperatorSnapshot,
201
- promptForTaskSelection,
202
- createPiRunStreamRenderer,
203
- createOperatorSurface
204
- };