@oh-my-pi/pi-tui 18.2.11 → 18.3.0
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.
- package/CHANGELOG.md +20 -0
- package/THIRD-PARTY-NOTICES.txt +1 -1
- package/dist/types/apps/ps-data.d.ts +1 -1
- package/dist/types/apps/ps-top.d.ts +1 -1
- package/dist/types/chat/chat-transcript-builder.d.ts +1 -1
- package/dist/types/overlays/annotation-overlay.d.ts +30 -0
- package/dist/types/overlays/annotation-types.d.ts +84 -0
- package/dist/types/overlays/copy-selector.d.ts +30 -2
- package/dist/types/overlays/copy-targets.d.ts +2 -0
- package/dist/types/overlays/model-hub.d.ts +2 -2
- package/dist/types/overlays/oauth-selector.d.ts +3 -6
- package/dist/types/overlays/usage-dashboard.d.ts +2 -0
- package/dist/types/prompt/image-source.d.ts +9 -8
- package/dist/types/status-line/context-usage.d.ts +3 -1
- package/dist/types/theme/mermaid-cache.d.ts +4 -6
- package/dist/types/tools/bash.d.ts +7 -0
- package/dist/types/tools/daemon.d.ts +46 -0
- package/dist/types/tools/irc.d.ts +30 -0
- package/dist/types/tools/line-ranges.d.ts +1 -1
- package/dist/types/tools/proc-render.d.ts +34 -0
- package/dist/types/tools/read.d.ts +4 -1
- package/dist/types/tools/wait.d.ts +131 -0
- package/dist/types/tools/write.d.ts +4 -0
- package/dist/types/tools/xd-url.d.ts +8 -0
- package/dist/types/windows-altgr.d.ts +54 -0
- package/package.json +13 -10
- package/src/apps/debug/protocol-probe.ts +1 -1
- package/src/apps/ps-data.ts +1 -1
- package/src/apps/ps-top.ts +1 -1
- package/src/chat/chat-transcript-builder.ts +4 -4
- package/src/chat/tool-execution.ts +8 -8
- package/src/chat/transcript-render-helpers.ts +3 -3
- package/src/components/markdown.ts +1 -1
- package/src/desktop-notify.ts +1 -1
- package/src/overlays/annotation-overlay.ts +1145 -0
- package/src/overlays/annotation-types.ts +78 -0
- package/src/overlays/copy-selector.ts +45 -19
- package/src/overlays/copy-targets.ts +3 -3
- package/src/overlays/model-hub.ts +5 -4
- package/src/overlays/oauth-selector.ts +8 -12
- package/src/overlays/plan-review-overlay.ts +213 -40
- package/src/overlays/usage-dashboard.ts +22 -1
- package/src/prompt/image-source.ts +9 -8
- package/src/setup/scenes/sign-in.ts +1 -1
- package/src/status-line/context-usage.ts +15 -3
- package/src/terminal-capabilities.ts +2 -2
- package/src/terminal.ts +8 -1
- package/src/theme/mermaid-cache.ts +83 -25
- package/src/tools/bash.ts +14 -1
- package/src/tools/daemon.ts +51 -0
- package/src/tools/index.ts +2 -2
- package/src/tools/irc.ts +33 -0
- package/src/tools/line-ranges.ts +13 -3
- package/src/tools/proc-render.ts +294 -0
- package/src/tools/read.ts +22 -1
- package/src/tools/wait.ts +595 -0
- package/src/tools/write.ts +76 -0
- package/src/tools/xd-url.ts +9 -0
- package/src/windows-altgr.ts +227 -0
- package/dist/types/tools/hub.d.ts +0 -342
- package/src/tools/hub.ts +0 -1492
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
import type { Component } from "../tui.js";
|
|
2
|
-
import type { Theme } from "../theme/theme.js";
|
|
3
|
-
import { type OutputMeta } from "./output-meta.js";
|
|
4
|
-
import { type ConfiguredThinkingLevel } from "../render/render-utils.js";
|
|
5
|
-
import type { StructuredSubagentOutput } from "./task.js";
|
|
6
|
-
import type { RenderResultOptions, ToolActivitySummary } from "./renderer.js";
|
|
7
|
-
/** Whether a wait snapshot contains only running jobs and no cancellations. */
|
|
8
|
-
export declare function isWaitingPollDetails(details: unknown): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Hub operations: messaging (`send`/`wait`/`inbox`/`list`), jobs
|
|
11
|
-
* (`wait`/`cancel`/`jobs`), and process supervision (`start`/`ps`/`logs`/
|
|
12
|
-
* `stop`/`restart`/`describe`, plus `send`/`wait` when they carry `name`).
|
|
13
|
-
*/
|
|
14
|
-
export type HubOp = "send" | "wait" | "inbox" | "list" | "jobs" | "cancel" | "start" | "ps" | "logs" | "stop" | "restart" | "describe";
|
|
15
|
-
/** Peer row surfaced by `op:"list"`. */
|
|
16
|
-
export interface HubPeerInfo {
|
|
17
|
-
id: string;
|
|
18
|
-
displayName: string;
|
|
19
|
-
kind: string;
|
|
20
|
-
status: string;
|
|
21
|
-
parentId?: string;
|
|
22
|
-
unread: number;
|
|
23
|
-
lastActivity: number;
|
|
24
|
-
activity?: string;
|
|
25
|
-
}
|
|
26
|
-
/** Status values `op:"list"` can filter on. Advisor is a kind, not a status. */
|
|
27
|
-
export type HubListStatus = "running" | "idle" | "parked";
|
|
28
|
-
/** Model-facing roster bounds shared by the hub schema and executor. */
|
|
29
|
-
export declare const DEFAULT_HUB_LIST_LIMIT = 32;
|
|
30
|
-
/** Maximum number of peers in a hub roster page. */
|
|
31
|
-
export declare const MAX_HUB_LIST_LIMIT = 100;
|
|
32
|
-
/** Addressable roster tallies always returned by `op:"list"`. */
|
|
33
|
-
export interface HubRosterCounts {
|
|
34
|
-
running: number;
|
|
35
|
-
idle: number;
|
|
36
|
-
parked: number;
|
|
37
|
-
shown: number;
|
|
38
|
-
truncated: number;
|
|
39
|
-
}
|
|
40
|
-
/** Background-job row surfaced by `wait`/`cancel`/`jobs` results. */
|
|
41
|
-
export interface JobSnapshot {
|
|
42
|
-
id: string;
|
|
43
|
-
type: "bash" | "task" | "eval";
|
|
44
|
-
status: "running" | "completed" | "failed" | "cancelled";
|
|
45
|
-
label: string;
|
|
46
|
-
durationMs: number;
|
|
47
|
-
/** Process exit status when the job reports one. */
|
|
48
|
-
exitCode?: number;
|
|
49
|
-
/** Effective task model selector, including an explicit reasoning suffix when configured. */
|
|
50
|
-
resolvedModel?: string;
|
|
51
|
-
/** Provider/id including routing, with no added thinking suffix. */
|
|
52
|
-
resolvedModelIdentity?: string;
|
|
53
|
-
/** Explicit thinking metadata, independent of the model identity. */
|
|
54
|
-
resolvedThinkingLevel?: ConfiguredThinkingLevel;
|
|
55
|
-
/** True when the task progress reports an attached live advisor. */
|
|
56
|
-
advisor?: boolean;
|
|
57
|
-
resultText?: string;
|
|
58
|
-
errorText?: string;
|
|
59
|
-
/** Source-output metadata retained for per-job warnings and persisted row rendering. */
|
|
60
|
-
meta?: OutputMeta;
|
|
61
|
-
/** Capture error in historical snapshots; new snapshots store source metadata in `meta`. */
|
|
62
|
-
artifactError?: OutputMeta["artifactError"];
|
|
63
|
-
structured?: StructuredSubagentOutput;
|
|
64
|
-
/**
|
|
65
|
-
* `agent://<id>` handle backing this job's artifacts — the job-row's
|
|
66
|
-
* registry `agentId` when the manager disambiguated a requested job id
|
|
67
|
-
* on collision, else the job id itself. See {@link AsyncJob.agentId}.
|
|
68
|
-
*/
|
|
69
|
-
agentUrlId?: string;
|
|
70
|
-
}
|
|
71
|
-
/** Outcome of cancelling one background job. */
|
|
72
|
-
export type CancelStatus = "cancelled" | "not_found" | "already_completed";
|
|
73
|
-
/** Cancellation outcome and its model-facing explanation. */
|
|
74
|
-
export interface CancelOutcome {
|
|
75
|
-
id: string;
|
|
76
|
-
status: CancelStatus;
|
|
77
|
-
message: string;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* A live subagent from the AgentRegistry that has no backing job in the
|
|
81
|
-
* AsyncJobManager — e.g. an idle agent woken (or a parked agent revived) via
|
|
82
|
-
* a hub message, or a spawn owned by another agent. Surfaced by `jobs` and
|
|
83
|
-
* empty-wait snapshots so the hub's picture matches the UI's running-agent
|
|
84
|
-
* count.
|
|
85
|
-
*/
|
|
86
|
-
export interface AgentActivitySnapshot {
|
|
87
|
-
id: string;
|
|
88
|
-
parentId?: string;
|
|
89
|
-
/** Latest activity gist recorded by the registry (display-only). */
|
|
90
|
-
activity?: string;
|
|
91
|
-
/** Time since the agent was registered. */
|
|
92
|
-
ageMs: number;
|
|
93
|
-
/**
|
|
94
|
-
* Whether an attached session corroborates the `running` claim. False marks
|
|
95
|
-
* a ref that says `running` with no turn in flight — either a spawn still
|
|
96
|
-
* wiring up or a stale registration that `hub cancel <id>` clears (#8634).
|
|
97
|
-
*/
|
|
98
|
-
live: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Acceptance time of the agent's final result, when the registry recorded
|
|
101
|
-
* one. With `live: false` this is an accepted run the parent may cancel
|
|
102
|
-
* instead of waiting on (#11079).
|
|
103
|
-
*/
|
|
104
|
-
acceptedAt?: number;
|
|
105
|
-
}
|
|
106
|
-
/** Result details for messaging and job ops; fields are disjoint per op. */
|
|
107
|
-
export interface CoordinationDetails {
|
|
108
|
-
meta?: OutputMeta;
|
|
109
|
-
op: HubOp;
|
|
110
|
-
from?: string;
|
|
111
|
-
to?: string;
|
|
112
|
-
receipts?: IrcDeliveryReceipt[];
|
|
113
|
-
/** Message consumed by `wait` / `send await:true`; null when the wait timed out. */
|
|
114
|
-
waited?: IrcMessage | null;
|
|
115
|
-
inbox?: IrcMessage[];
|
|
116
|
-
peers?: HubPeerInfo[];
|
|
117
|
-
/** Present on `op:"list"`: addressable running/idle/parked plus page size. */
|
|
118
|
-
counts?: HubRosterCounts;
|
|
119
|
-
jobs?: JobSnapshot[];
|
|
120
|
-
cancelled?: {
|
|
121
|
-
id: string;
|
|
122
|
-
status: CancelStatus;
|
|
123
|
-
}[];
|
|
124
|
-
/** Running subagents not represented by a job row in this result. */
|
|
125
|
-
agents?: AgentActivitySnapshot[];
|
|
126
|
-
}
|
|
127
|
-
/** Hub result details: coordination snapshots or launch (process) state. */
|
|
128
|
-
export type HubDetails = CoordinationDetails | LaunchToolDetails;
|
|
129
|
-
/** Partially-streamed hub call arguments, as seen by the renderers. */
|
|
130
|
-
export type HubRenderArgs = {
|
|
131
|
-
op?: string;
|
|
132
|
-
to?: string;
|
|
133
|
-
message?: string;
|
|
134
|
-
replyTo?: string;
|
|
135
|
-
await?: boolean;
|
|
136
|
-
from?: string;
|
|
137
|
-
peek?: boolean;
|
|
138
|
-
ids?: string[];
|
|
139
|
-
} & Partial<Omit<LaunchParams, "op">>;
|
|
140
|
-
/** Stable lifecycle states exposed by the launch tool. */
|
|
141
|
-
export type DaemonState = "starting" | "running" | "ready" | "restarting" | "stopping" | "exited" | "failed";
|
|
142
|
-
/** Restart behavior applied after an unexpected daemon exit. */
|
|
143
|
-
export type DaemonRestartPolicy = "no" | "on-failure" | "always";
|
|
144
|
-
/** Readiness conditions; every configured condition must pass. */
|
|
145
|
-
export interface DaemonReadySpec {
|
|
146
|
-
log?: string;
|
|
147
|
-
port?: number;
|
|
148
|
-
host?: string;
|
|
149
|
-
timeoutMs: number;
|
|
150
|
-
}
|
|
151
|
-
/** Immutable launch specification retained for restart and inspection. */
|
|
152
|
-
export interface DaemonSpec {
|
|
153
|
-
name: string;
|
|
154
|
-
application: string;
|
|
155
|
-
args: string[];
|
|
156
|
-
env: Record<string, string>;
|
|
157
|
-
cwd: string;
|
|
158
|
-
pty: boolean;
|
|
159
|
-
ready?: DaemonReadySpec;
|
|
160
|
-
restart: DaemonRestartPolicy;
|
|
161
|
-
persist: boolean;
|
|
162
|
-
detached: boolean;
|
|
163
|
-
}
|
|
164
|
-
/** Serializable daemon state visible to every client in one broker scope. */
|
|
165
|
-
export interface DaemonSnapshot {
|
|
166
|
-
name: string;
|
|
167
|
-
id: string;
|
|
168
|
-
state: DaemonState;
|
|
169
|
-
pid?: number;
|
|
170
|
-
createdAt: number;
|
|
171
|
-
startedAt: number;
|
|
172
|
-
readyAt?: number;
|
|
173
|
-
exitedAt?: number;
|
|
174
|
-
exitCode?: number;
|
|
175
|
-
exitReason?: string;
|
|
176
|
-
restartCount: number;
|
|
177
|
-
outputBytes: number;
|
|
178
|
-
owner?: string;
|
|
179
|
-
readyMatch?: string;
|
|
180
|
-
/** Readiness conditions still unmet while `state` is `starting`; absent once ready or without a ready spec. */
|
|
181
|
-
readyPending?: ("log" | "port")[];
|
|
182
|
-
persist: boolean;
|
|
183
|
-
detached: boolean;
|
|
184
|
-
}
|
|
185
|
-
/** Serializable peer message retained in hub result snapshots. */
|
|
186
|
-
export interface IrcMessage {
|
|
187
|
-
id: string;
|
|
188
|
-
/** Sender agent id. */
|
|
189
|
-
from: string;
|
|
190
|
-
/** Recipient agent id (resolved; "all" is expanded by the tool, not stored). */
|
|
191
|
-
to: string;
|
|
192
|
-
body: string;
|
|
193
|
-
ts: number;
|
|
194
|
-
/** Message id being answered. */
|
|
195
|
-
replyTo?: string;
|
|
196
|
-
/**
|
|
197
|
-
* Automated wake-turn relay of a woken subagent's stop output (task executor
|
|
198
|
-
* `relayWakeTurnOutput`). Relays are answers, never wake sources: the
|
|
199
|
-
* recipient's own wake-turn relay must skip them or two idle peers
|
|
200
|
-
* ping-pong forever.
|
|
201
|
-
*/
|
|
202
|
-
wakeRelay?: boolean;
|
|
203
|
-
}
|
|
204
|
-
/** Delivery outcome for one peer recipient. */
|
|
205
|
-
export interface IrcDeliveryReceipt {
|
|
206
|
-
to: string;
|
|
207
|
-
outcome: "injected" | "woken" | "revived" | "failed";
|
|
208
|
-
error?: string;
|
|
209
|
-
}
|
|
210
|
-
/** Broker-facing launch parameters; the hub adapts its `ps` op to `list` before calling in. */
|
|
211
|
-
export interface LaunchParams {
|
|
212
|
-
op: "start" | "list" | "logs" | "wait" | "send" | "stop" | "restart" | "describe";
|
|
213
|
-
name?: string;
|
|
214
|
-
application?: string;
|
|
215
|
-
args?: string[];
|
|
216
|
-
env?: Record<string, string>;
|
|
217
|
-
cwd?: string;
|
|
218
|
-
pty?: boolean;
|
|
219
|
-
ready?: {
|
|
220
|
-
log?: string;
|
|
221
|
-
port?: number;
|
|
222
|
-
host?: string;
|
|
223
|
-
timeout?: number;
|
|
224
|
-
};
|
|
225
|
-
restart?: "no" | "on-failure" | "always";
|
|
226
|
-
persist?: boolean;
|
|
227
|
-
detached?: boolean;
|
|
228
|
-
lines?: number;
|
|
229
|
-
head?: boolean;
|
|
230
|
-
grep?: string;
|
|
231
|
-
follow?: boolean;
|
|
232
|
-
cursor?: number;
|
|
233
|
-
for?: "ready" | "exit";
|
|
234
|
-
pattern?: string;
|
|
235
|
-
text?: string;
|
|
236
|
-
enter?: boolean;
|
|
237
|
-
keys?: string[];
|
|
238
|
-
signal?: "SIGINT" | "SIGTERM" | "SIGHUP" | "SIGQUIT" | "SIGKILL";
|
|
239
|
-
timeout?: number;
|
|
240
|
-
}
|
|
241
|
-
/** Structured launch state retained for compact TUI rendering. */
|
|
242
|
-
export interface LaunchToolDetails {
|
|
243
|
-
op: LaunchParams["op"];
|
|
244
|
-
daemon?: DaemonSnapshot;
|
|
245
|
-
daemons?: DaemonSnapshot[];
|
|
246
|
-
cursor?: number;
|
|
247
|
-
timedOut?: boolean;
|
|
248
|
-
/** logs: daemon lifecycle state at read time. */
|
|
249
|
-
state?: DaemonState;
|
|
250
|
-
/** logs: virtual terminal rows for display; model-facing content remains sanitized text. */
|
|
251
|
-
terminalRows?: string[];
|
|
252
|
-
/** wait: output line that satisfied the pattern. */
|
|
253
|
-
matched?: string;
|
|
254
|
-
/** describe: immutable launch spec backing the command/cwd detail lines. */
|
|
255
|
-
spec?: DaemonSpec;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Human sentences for the readiness conditions still unmet, e.g.
|
|
259
|
-
* `port 5173 on 127.0.0.1 never accepted connections`. `ready` (from the start
|
|
260
|
-
* params) adds the concrete pattern/port; absent it falls back to generic labels.
|
|
261
|
-
*/
|
|
262
|
-
export declare function readyPendingSummary(daemon: DaemonSnapshot, ready?: LaunchParams["ready"]): string[];
|
|
263
|
-
/**
|
|
264
|
-
* What a timed-out `wait` was actually blocked on: the output `pattern`, the
|
|
265
|
-
* process exiting (`for: "exit"`, the default), or the unmet readiness
|
|
266
|
-
* conditions (`for: "ready"`). Never reports readiness for an exit/pattern
|
|
267
|
-
* wait — the process may well be ready and simply still running.
|
|
268
|
-
*/
|
|
269
|
-
export declare function waitPendingSummary(daemon: DaemonSnapshot, params: Pick<LaunchParams, "for" | "pattern">): string[];
|
|
270
|
-
/** Hub roster ordering (running before idle before parked) shared with the child prompt's live-row cap. */
|
|
271
|
-
export declare const LIST_STATUS_ORDER: Record<string, number>;
|
|
272
|
-
/** Pending-call frame for job ops (wait/cancel/jobs). */
|
|
273
|
-
export declare function jobsRenderCall(args: HubRenderArgs, _options: RenderResultOptions, uiTheme: Theme): Component;
|
|
274
|
-
/** Result frame for job snapshots (wait/cancel/jobs and the agents roster). */
|
|
275
|
-
export declare function jobsRenderResult(result: {
|
|
276
|
-
content: Array<{
|
|
277
|
-
type: string;
|
|
278
|
-
text?: string;
|
|
279
|
-
}>;
|
|
280
|
-
details?: CoordinationDetails;
|
|
281
|
-
isError?: boolean;
|
|
282
|
-
}, options: RenderResultOptions, uiTheme: Theme, hubArgs?: HubRenderArgs): Component;
|
|
283
|
-
/** Args shape visible to the renderer, possibly mid-stream (every field optional). */
|
|
284
|
-
export type LaunchRenderArgs = Partial<Omit<LaunchParams, "op">> & {
|
|
285
|
-
op?: string;
|
|
286
|
-
};
|
|
287
|
-
/** Pending-call frame for launch ops; consumes the spinner while the broker call is live. */
|
|
288
|
-
export declare function launchRenderCall(args: LaunchRenderArgs, options: RenderResultOptions, theme: Theme): Component;
|
|
289
|
-
/** Result frame: one status header per op, meta from structured details, capped body lines. */
|
|
290
|
-
export declare function launchRenderResult(result: {
|
|
291
|
-
content: Array<{
|
|
292
|
-
type: string;
|
|
293
|
-
text?: string;
|
|
294
|
-
}>;
|
|
295
|
-
details?: LaunchToolDetails;
|
|
296
|
-
isError?: boolean;
|
|
297
|
-
}, options: RenderResultOptions, theme: Theme, args?: LaunchRenderArgs): Component;
|
|
298
|
-
/**
|
|
299
|
-
* Display-only transcript card for live IRC traffic: `irc:incoming` DMs
|
|
300
|
-
* delivered to this session, `irc:autoreply` side-channel replies sent on
|
|
301
|
-
* this session's behalf, and `irc:relay` observations of agent↔agent
|
|
302
|
-
* traffic. Shares the tool renderer's glyph + quote-border conventions so
|
|
303
|
-
* cards and hub messaging output look identical in the transcript.
|
|
304
|
-
*/
|
|
305
|
-
export declare function createIrcMessageCard(card: {
|
|
306
|
-
kind: "incoming" | "autoreply" | "relay" | "workpool";
|
|
307
|
-
from?: string;
|
|
308
|
-
to?: string;
|
|
309
|
-
body?: string;
|
|
310
|
-
replyTo?: string;
|
|
311
|
-
timestamp?: number;
|
|
312
|
-
pool?: string;
|
|
313
|
-
mode?: string;
|
|
314
|
-
}, getExpanded: () => boolean, uiTheme: Theme): Component;
|
|
315
|
-
/** Pending-call frame for messaging ops (send/wait-from/inbox/list). */
|
|
316
|
-
export declare function messagingRenderCall(args: HubRenderArgs, _options: RenderResultOptions, uiTheme: Theme): Component;
|
|
317
|
-
/** Result frame for messaging ops and message-carrying `wait` results. */
|
|
318
|
-
export declare function messagingRenderResult(result: {
|
|
319
|
-
content: Array<{
|
|
320
|
-
type: string;
|
|
321
|
-
text?: string;
|
|
322
|
-
}>;
|
|
323
|
-
details?: CoordinationDetails;
|
|
324
|
-
isError?: boolean;
|
|
325
|
-
}, options: RenderResultOptions, uiTheme: Theme, args?: HubRenderArgs): Component;
|
|
326
|
-
/** Renders hub messaging, jobs, and supervised processes. */
|
|
327
|
-
export declare const hubToolRenderer: {
|
|
328
|
-
inline: true;
|
|
329
|
-
mergeCallAndResult: true;
|
|
330
|
-
/** Compact one-line activity: op plus its peer, process, or job target. */
|
|
331
|
-
activitySummary(args: unknown): ToolActivitySummary;
|
|
332
|
-
animatedPendingPreview: (args: unknown) => boolean;
|
|
333
|
-
renderCall(args: HubRenderArgs, options: RenderResultOptions, uiTheme: Theme): Component;
|
|
334
|
-
renderResult(result: {
|
|
335
|
-
content: Array<{
|
|
336
|
-
type: string;
|
|
337
|
-
text?: string;
|
|
338
|
-
}>;
|
|
339
|
-
details?: HubDetails;
|
|
340
|
-
isError?: boolean;
|
|
341
|
-
}, options: RenderResultOptions, uiTheme: Theme, args?: HubRenderArgs): Component;
|
|
342
|
-
};
|