@linxiraos/pi-wire 1.5.13 → 1.5.15

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 CHANGED
@@ -1,34 +1,14 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [1.5.13] - 2026-11-21
3
+ ## [1.5.15] - 2026-11-27
4
4
 
5
5
  ### Changed
6
6
 
7
+ - Aligned with the OMP 19.2 runtime merge and the Zeta 1.5.15 version line.
8
+ - Included in Zeta 1.5.14; no package-specific user-visible changes.
7
9
  - Included in Zeta 1.5.13; no package-specific user-visible changes.
8
-
9
- ## [1.5.12] - 2026-11-20
10
-
11
- ### Changed
12
-
13
10
  - Included in Zeta 1.5.12; no package-specific user-visible changes.
14
-
15
- ## [1.5.11] - 2026-11-20
16
-
17
- ### Changed
18
-
19
11
  - Released as part of Zeta 1.5.11; no package-specific user-visible changes.
20
-
21
- ## [1.5.10] - 2026-11-19
22
-
23
- ### Added
24
-
25
- - Added optional picker icons for tooltips and accessible names, plus an option to control the placement of the search interface.
26
- - Added buttons, menu, and document component kinds, including menu-row action state changes and document text editing, commenting, and uncommenting events.
27
-
28
- ## [1.5.2] - 2026-11-13
29
-
30
- ### Changed
31
-
32
12
  - Released as part of Zeta 1.5.2 asset review; no package-specific user-visible changes.
33
13
 
34
14
  ## [1.5.0] - 2026-11-09
@@ -19,7 +19,7 @@ Forked application trees:
19
19
 
20
20
  | Path | Upstream | Snapshot | License | What Zeta changed |
21
21
  |---|---|---|---|---|
22
- | `packages/ main/ crates/ python/ lsp/ sdk/ types/ skills/` | oh-my-pi (OMP), https://github.com/can1357/oh-my-pi | integrated through tag `v18.22.0` (`document/upstream-sync.md`) | see upstream files | product name, paths, command names and env prefixes; branded assets; internal identifiers renamed to `__zeta*` |
22
+ | `packages/ main/ crates/ python/ lsp/ sdk/ types/ skills/` | oh-my-pi (OMP), https://github.com/Linxira-OS/linxira-zeta | integrated through tag `v18.22.0` (`document/upstream-sync.md`) | see upstream files | product name, paths, command names and env prefixes; branded assets; internal identifiers renamed to `__zeta*` |
23
23
  | `web-ui/` | OMP Web, https://github.com/17380936778/omp-web | frozen snapshot, **abandoned 2026-11-05** (`document/upstream-sync.md`) | see upstream files | third-party UI, not maintained by Zeta: frozen as received, no builds, no fixes; the product renderer is `web-app/` (`Differences from Upstream` in README) |
24
24
  | `web-app/` (`src/studio`, `src/vendor/*`) | OMP Studio, https://github.com/the-snowpear/omp-studio | official `v0.2.1` (`6d0b764bb9eac88c1671c0380229823c5630cc74`) integrated 2026-11-16; `web-ui/` is a separate frozen OMP Web snapshot | MIT | maintained by Zeta now: the host contract is reimplemented in `studio-host` (pair/CSRF/query/command/events), the renderer was rebranded (`zeta-studio` wire name, Zeta links/fixtures), and Zeta adds windowed transcripts, precompressed static serving, the plugin registry, and the usage dashboard |
25
25
  | `termide/` | TermIDE, https://github.com/termide/termide | tag `0.49.0` = `057eb55e0a7c4ee969982fab62dc83bde028e052` | MIT | deviations listed in `termide/VENDOR.md` |
@@ -126,6 +126,12 @@ export interface ThinkingLevelChangeEntry extends EntryBase {
126
126
  thinkingLevel?: string | null;
127
127
  }
128
128
  export type SessionEntry = MessageEntry | CustomMessageEntry | CompactionEntry | BranchSummaryEntry | ModelChangeEntry | ThinkingLevelChangeEntry;
129
+ /** customType of collab guest prompts injected on the host. */
130
+ export declare const COLLAB_PROMPT_MESSAGE_TYPE = "collab-prompt";
131
+ /** `details` shape of `custom_message` entries with `customType === "collab-prompt"`. */
132
+ export interface CollabPromptDetails {
133
+ from?: string;
134
+ }
129
135
  export type AgentEvent = {
130
136
  type: "agent_start";
131
137
  } | {
@@ -210,8 +216,239 @@ export interface Participant {
210
216
  /** True when the guest joined through a read-only (view) link. */
211
217
  readOnly?: boolean;
212
218
  }
219
+ /** Debounced footer snapshot broadcast by the host. */
220
+ export interface SessionState {
221
+ isStreaming: boolean;
222
+ queuedMessageCount: number;
223
+ sessionName?: string;
224
+ /** Host cwd — display only; the guest never chdirs. */
225
+ cwd: string;
226
+ model?: WireModel;
227
+ thinkingLevel?: string;
228
+ contextUsage?: ContextUsage;
229
+ participants: Participant[];
230
+ isAborting?: boolean;
231
+ }
232
+ export interface AgentSnapshot {
233
+ id: string;
234
+ displayName: string;
235
+ kind: "main" | "sub";
236
+ parentId?: string;
237
+ status: "running" | "idle" | "parked" | "aborted";
238
+ /** Whether the host has a transcript file for this agent (gates remote transcript fetch). */
239
+ hasSessionFile: boolean;
240
+ createdAt: number;
241
+ lastActivity: number;
242
+ }
243
+ export interface AgentProgress {
244
+ index: number;
245
+ id: string;
246
+ agent: string;
247
+ status: "pending" | "running" | "completed" | "failed" | "aborted";
248
+ task: string;
249
+ description?: string;
250
+ lastIntent?: string;
251
+ currentTool?: string;
252
+ currentToolArgs?: string;
253
+ /** Argument key selected for the display preview, when known. */
254
+ currentToolArgsKey?: string;
255
+ /** Intent the model attached to the current call; undefined when that call carried none. */
256
+ currentToolIntent?: string;
257
+ currentToolStartMs?: number;
258
+ recentTools: {
259
+ tool: string;
260
+ args: string;
261
+ argsKey?: string;
262
+ intent?: string;
263
+ isError?: boolean;
264
+ /** Lines an edit call added and removed, by its diff; absent for other calls and failed ones. */
265
+ added?: number;
266
+ removed?: number;
267
+ endMs: number;
268
+ }[];
269
+ recentOutput: string[];
270
+ toolCount: number;
271
+ requests: number;
272
+ tokens: number;
273
+ contextTokens?: number;
274
+ contextWindow?: number;
275
+ cost: number;
276
+ durationMs: number;
277
+ resolvedModel?: string;
278
+ }
279
+ export interface SubagentProgressPayload {
280
+ index: number;
281
+ agent: string;
282
+ task: string;
283
+ parentToolCallId?: string;
284
+ assignment?: string;
285
+ progress: AgentProgress;
286
+ sessionFile?: string;
287
+ }
288
+ export interface SubagentLifecyclePayload {
289
+ id: string;
290
+ agent: string;
291
+ description?: string;
292
+ status: "started" | "completed" | "failed" | "aborted";
293
+ sessionFile?: string;
294
+ parentToolCallId?: string;
295
+ index: number;
296
+ }
297
+ export type CollabUiSelectItem = string | {
298
+ label: string;
299
+ description?: string;
300
+ };
301
+ export type CollabUiResponseValue = string | undefined;
302
+ export type CollabUiRequestDraft = {
303
+ kind: "select";
304
+ title: string;
305
+ options: CollabUiSelectItem[];
306
+ initialIndex?: number;
307
+ selectionMarker?: "radio" | "checkbox";
308
+ checkedIndices?: number[];
309
+ markableCount?: number;
310
+ helpText?: string;
311
+ /** The select asks for a permission (a tool approval, a settings change), not an answer. */
312
+ approval?: boolean;
313
+ } | {
314
+ kind: "editor";
315
+ title: string;
316
+ prefill?: string;
317
+ };
318
+ export type CollabUiRequest = CollabUiRequestDraft & {
319
+ reqId: number;
320
+ };
321
+ export type GuestFrame = {
322
+ t: "hello";
323
+ proto: number;
324
+ name: string;
325
+ /**
326
+ * base64url write token proving full-link possession; absent for
327
+ * read-only (view) links. The host marks peers without a valid token
328
+ * read-only and rejects their mutating frames.
329
+ */
330
+ writeToken?: string;
331
+ }
332
+ /** `followUp`: wait for the running turn to finish instead of steering it (the TUI's Ctrl+Enter). */
333
+ | {
334
+ t: "prompt";
335
+ text: string;
336
+ images?: ImageContent[];
337
+ followUp?: true;
338
+ } | {
339
+ t: "ui-response";
340
+ reqId: number;
341
+ value?: CollabUiResponseValue;
342
+ } | {
343
+ t: "abort";
344
+ }
345
+ /** The `.`/`c` continue shortcut: resume the agent, interrupting a running turn first. */
346
+ | {
347
+ t: "resume";
348
+ }
349
+ /** Empty Enter: interrupt a run that has queued input and continue it with that input. */
350
+ | {
351
+ t: "deliver-queue";
352
+ } | {
353
+ t: "agent-cmd";
354
+ cmd: "chat" | "kill" | "revive";
355
+ agentId: string;
356
+ text?: string;
357
+ } | {
358
+ t: "fetch-transcript";
359
+ reqId: number;
360
+ agentId: string;
361
+ fromByte: number;
362
+ };
363
+ /** EventBus channels mirrored to guests (task subagent traffic only). */
364
+ export type BusChannel = "task:subagent:progress" | "task:subagent:lifecycle";
365
+ export type HostFrame = {
366
+ t: "welcome";
367
+ proto: number;
368
+ header: SessionHeader;
369
+ state: SessionState;
370
+ agents: AgentSnapshot[];
371
+ /**
372
+ * Total number of `SessionEntry` items the host will deliver in the
373
+ * `snapshot-chunk` frames that follow. Guests stay in the loading
374
+ * phase until they have accumulated all of them (or a chunk arrives
375
+ * with `final: true`).
376
+ */
377
+ entryCount: number;
378
+ /** True when this peer joined through a read-only (view) link. */
379
+ readOnly?: boolean;
380
+ }
381
+ /**
382
+ * Targeted snapshot fragment delivered after `welcome`. Hosts split the
383
+ * transcript into chunks bounded by byte size so a multi-MB session is not
384
+ * forced through one giant frame the relay may stall on. The last chunk
385
+ * carries `final: true`; guests finalize the replica on that frame.
386
+ */
387
+ | {
388
+ t: "snapshot-chunk";
389
+ entries: SessionEntry[];
390
+ final: boolean;
391
+ } | {
392
+ t: "entry";
393
+ entry: SessionEntry;
394
+ } | {
395
+ t: "event";
396
+ event: AgentEvent;
397
+ } | {
398
+ t: "state";
399
+ state: SessionState;
400
+ }
401
+ /** Mirrored EventBus traffic (task subagent lifecycle/progress channels only). */
402
+ | {
403
+ t: "bus";
404
+ channel: BusChannel;
405
+ data: unknown;
406
+ } | {
407
+ t: "agents";
408
+ agents: AgentSnapshot[];
409
+ } | {
410
+ t: "ui-request";
411
+ request: CollabUiRequest;
412
+ } | {
413
+ t: "ui-request-end";
414
+ reqId: number;
415
+ }
416
+ /** Targeted reply to fetch-transcript; `text` is decoded JSONL from `fromByte`, `newSize` the next offset base. */
417
+ | {
418
+ t: "transcript";
419
+ reqId: number;
420
+ text: string;
421
+ newSize: number;
422
+ error?: string;
423
+ } | {
424
+ t: "bye";
425
+ reason: string;
426
+ }
427
+ /** `resync`: the host no longer counts this guest as joined; the guest should send `hello` again. */
428
+ | {
429
+ t: "error";
430
+ message: string;
431
+ resync?: true;
432
+ };
433
+ export type WireFrame = GuestFrame | HostFrame;
434
+ /**
435
+ * Wire protocol version carried in `hello`; the host rejects mismatches.
436
+ *
437
+ * - `1` (legacy): `welcome` carried the full `entries` array inline.
438
+ * - `2`: `welcome` carries only metadata (header/state/agents/entryCount);
439
+ * transcript entries follow in `snapshot-chunk` frames, so multi-MB
440
+ * sessions are not gated on a single welcome frame fitting under the
441
+ * guest's first-welcome timeout.
442
+ * - `3`: host asks guests through `ui-request`/`ui-request-end` host frames
443
+ * answered by the `ui-response` guest frame. Guests that predate the
444
+ * grammar would silently drop `ui-request` (asks hang forever on the
445
+ * host), so they must be rejected at hello.
446
+ */
447
+ export declare const COLLAB_PROTO = 3;
213
448
  /** Parameter key used for intent tracing (e.g. prompt explanation/reasoning) */
214
449
  export declare const INTENT_FIELD = "i";
450
+ /** Activity label before the first colon-space in a tool intent; preserves bare labels and embedded URL or file:line references. */
451
+ export declare function toolIntentLabel(intent: string): string;
215
452
  /** Plaintext envelope prefix: `[4B uint32 BE peerId][sealed payload]`. */
216
453
  export declare const ENVELOPE_HEADER_LENGTH = 4;
217
454
  /**
@@ -246,8 +483,17 @@ export declare const AUTO_REJOIN_WINDOW_MS: number;
246
483
  /** Records an automatic rejoin in {@link history} if the window has room for one. */
247
484
  export declare function takeAutoRejoin(history: number[], now?: number): boolean;
248
485
  /** Default public relay; bare `<roomId>.<key>` links resolve against it. */
249
- export declare const DEFAULT_RELAY_URL = "wss://my.omp.sh";
486
+ export declare const DEFAULT_RELAY_URL = "ws://127.0.0.1:9222";
487
+ export declare const DEFAULT_SHARE_URL = "https://linxira-os.github.io/s";
250
488
  /** Default share viewer/upload base; `/share` links resolve against `<base>/<id>#<key>`. */
489
+ export interface ParsedCollabLink {
490
+ /** wss://host[:port]/r/<roomId> — no query, no fragment. */
491
+ wsUrl: string;
492
+ roomId: string;
493
+ key: Uint8Array;
494
+ /** Write token from a full link; absent for read-only (view) links. */
495
+ writeToken?: Uint8Array;
496
+ }
251
497
  /** Relay → host control message. */
252
498
  export type RelayControlToHost = {
253
499
  t: "peer-joined" | "peer-left";
@@ -1,6 +1,6 @@
1
1
  /**
2
- * `ShellTrace`: the live model of one embedded-shell run, produced by pi-shell's
3
- * `RunTrace` (`crates/pi-shell/src/bash/trace.rs`), polled over napi, carried in
2
+ * `ShellTrace`: the live model of one embedded-shell run, produced by omp-shell's
3
+ * `RunTrace` (`crates/shell/src/bash/trace.rs`), polled over napi, carried in
4
4
  * the bash tool's `details.trace`, and forwarded verbatim to Tern as the `shell`
5
5
  * node's props. Every offset is a BYTE offset; UIs convert bytes to characters
6
6
  * when the script is not ASCII. Fields at their default are omitted.
@@ -81,12 +81,17 @@ export interface ShellTraceUnit {
81
81
  bytes?: number;
82
82
  /** The unit's source; present only for unlocated units (an eval or function body). */
83
83
  source?: ShellTraceBytes;
84
- /** Opaque canonical native syntax archive. Only pi-shell may interpret it. */
84
+ /** Opaque canonical native syntax archive. Only omp-shell may interpret it. */
85
85
  syntax?: unknown;
86
86
  /** Compiler-known wrapper bytes removed from this unit's displayed source. */
87
87
  projection?: number;
88
88
  /** Script a callout (`timeout`, `git`, `xargs`, …) ran for its operands; its calling command stands for it. */
89
89
  callout?: boolean;
90
+ /** Command (unit index, node id) that ran this unit's script when the script is not literal in it: `eval "$x"`, `.`, a nested shell's file. */
91
+ runner?: {
92
+ unit: number;
93
+ node: number;
94
+ };
90
95
  nodes: ShellTraceNode[];
91
96
  }
92
97
  /** Exact output/execution identity; repeated visits to one node have distinct seq values. */
@@ -129,6 +129,20 @@ export interface TspCommonProps {
129
129
  * that don't know it ignore it and keep showing `title`.
130
130
  */
131
131
  hovercard?: TspPropNode;
132
+ /**
133
+ * `layout` makes the node a layout-transition container: descendants carrying a {@link motionKey} glide to
134
+ * their new place and size when an update moves, resizes, adds or removes them; new keys fade in, leaving
135
+ * ones fade out. Reduced motion turns it off.
136
+ */
137
+ transition?: "layout";
138
+ /** A `transition` container's duration in ms (200 by default, at most 1000; 0 snaps). */
139
+ transitionMs?: number;
140
+ /**
141
+ * The node's identity in its nearest `transition` container. Unlike `key`, it survives a move to another
142
+ * parent, so the node glides there; give two shapes of one thing (a folded and an open question) the
143
+ * same one so it resizes instead of swapping.
144
+ */
145
+ motionKey?: string;
132
146
  }
133
147
  /** A {@link TspCommonProps.mark}. */
134
148
  export type TspMark = "pick" | "drop";
@@ -141,12 +155,60 @@ export type TspPreview = {
141
155
  export interface TspColProps {
142
156
  gap?: TspSpace;
143
157
  align?: "start" | "center" | "end" | "stretch";
144
- }
158
+ /**
159
+ * On a dock composer's container: fold it to its compact row now, as an unfocused pane's composer folds,
160
+ * while the keys are elsewhere in the document (a question above it).
161
+ */
162
+ folded?: boolean;
163
+ /** On `omp.tray`: a counter the program bumps to move keyboard focus into the tray (acted on a change, never on first sight). */
164
+ focus?: number;
165
+ /** On `omp.tray`: the `ref` of the card its `omp.tray.peek` child belongs to. */
166
+ peek?: string;
167
+ /** On `omp.tray` (sent while it has cards): what the main agent is doing. */
168
+ main?: TspTrayMain;
169
+ /**
170
+ * On `omp.tray`: it holds only finished work (nothing queued, running or failed). The host keeps a
171
+ * quiet tray out of sight until the user asks for it.
172
+ */
173
+ quiet?: boolean;
174
+ /** On `omp.tray.card`: what the card stands for. */
175
+ item?: TspTrayItem;
176
+ /** On `omp.tray.card` and `omp.tray.peek`: the item's id (an agent id, a job id, or `done`). */
177
+ ref?: string;
178
+ /** On `omp.tray.card`: the item's state. */
179
+ status?: TspTrayStatus;
180
+ /**
181
+ * On an agent's `omp.tray.card` while `running`: the call it is in only waits on its own agents or
182
+ * jobs (`wait`, `vibe_wait`), so it does no work of its own until that call returns.
183
+ */
184
+ waiting?: boolean;
185
+ /** On an agent's `omp.tray.card`: epoch ms of its last operation (its latest tool call start, or when it settled). */
186
+ acted?: number;
187
+ /** On `omp.tray.card`: `false` when its closer look would add nothing to its face (`tray.peek` on it is ignored). */
188
+ look?: boolean;
189
+ }
190
+ /** What an `omp.tray.card` stands for. */
191
+ export type TspTrayItem = "agent" | "job" | "done";
192
+ /** The state of an `omp.tray.card`. */
193
+ export type TspTrayStatus = "queued" | "running" | "done" | "failed" | "stopped";
194
+ /**
195
+ * The main agent on `omp.tray`: `idle` once it has yielded (no turn runs, or the run waits only on
196
+ * outside work); `waiting` while every call it executes only blocks on its agents or jobs (a `wait`,
197
+ * a `vibe_wait`, a `task` call running an agent inline), or its last calls were such and it has
198
+ * started nothing else since; `working` otherwise.
199
+ */
200
+ export type TspTrayMain = "idle" | "working" | "waiting";
145
201
  export interface TspRowProps {
146
202
  gap?: TspSpace;
147
203
  align?: "start" | "center" | "baseline" | "end" | "stretch";
148
204
  justify?: "start" | "between" | "end";
149
205
  wrap?: boolean;
206
+ /** On `omp.tray.ev`: how the operation went, or `run` while it is in flight. */
207
+ state?: "ok" | "err" | "run";
208
+ /** On `omp.tray.done.item`: the finished agent's id. */
209
+ ref?: string;
210
+ /** On `omp.tray.done.item`: how the agent ended, which colors its dot. */
211
+ status?: "done" | "failed" | "stopped";
150
212
  }
151
213
  export interface TspCardProps {
152
214
  /** Header content, inline. */
@@ -292,6 +354,8 @@ export interface TspDiffProps {
292
354
  /** A language overriding the one `path` gives. */
293
355
  lang?: string;
294
356
  mode?: "unified" | "split" | "auto";
357
+ /** Long lines wrap inside their rows (absent: `true`); `false` keeps a line per row, scrolled sideways together. */
358
+ wrap?: boolean;
295
359
  }
296
360
  export interface TspAnsiProps {
297
361
  /** Raw terminal output (SGR, OSC 8, `\r`, `\b` allowed). */
@@ -1155,6 +1219,18 @@ export interface TspShellProps {
1155
1219
  preview?: {
1156
1220
  lines: number;
1157
1221
  };
1222
+ /**
1223
+ * Step mode: every segment with an execution node (`executionNode ?? node ?? row.node`) is a click target
1224
+ * (pointer, `role=button`, Enter/Space) sending the `shell-viz` action `select:<executionNode>`; hovering one
1225
+ * highlights every segment of that step. Chips with `expanded` keep sending `expand:<node>` only. No details
1226
+ * panel and no gutter Inspect command button; effect chips and annotations keep their text as a tooltip.
1227
+ */
1228
+ steps?: boolean;
1229
+ /**
1230
+ * Execution-node keys of the step whose output the host shows now: every segment drawn under one of them is
1231
+ * marked focused, re-applied whenever this changes even when the rows did not.
1232
+ */
1233
+ focus?: readonly string[];
1158
1234
  }
1159
1235
  /** Kind-specific props, indexed by kind. */
1160
1236
  export interface TspPropsByKind {
@@ -1327,16 +1403,35 @@ export type TspEvent = {
1327
1403
  } | {
1328
1404
  ev: "motion";
1329
1405
  reduce: boolean;
1406
+ }
1407
+ /** The terminal's features changed (a setting: Tern's Agents tray drops `tray`); the list replaces `hello.features`. */
1408
+ | {
1409
+ ev: "features";
1410
+ features: readonly string[];
1330
1411
  } | {
1331
1412
  ev: "visible";
1332
1413
  sf?: string;
1333
1414
  visible: boolean;
1415
+ }
1416
+ /** The window reads and shows this pane's checkout (branch, changes, pull request) itself: show them from `shown` and read none of it yourself while `true`. */
1417
+ | {
1418
+ ev: "checkout";
1419
+ sf?: string;
1420
+ shown: boolean;
1334
1421
  } | {
1335
1422
  ev: "toggle";
1336
1423
  sf: string;
1337
1424
  id: string;
1338
1425
  key?: string;
1339
1426
  collapsed: boolean;
1427
+ }
1428
+ /** Menu opening/closing; a toggle of a named sub-item also reports its id. */
1429
+ | {
1430
+ ev: "toggle";
1431
+ sf: string;
1432
+ id: string;
1433
+ open: boolean;
1434
+ item?: string;
1340
1435
  } | {
1341
1436
  ev: "select";
1342
1437
  sf: string;
@@ -1460,7 +1555,9 @@ export type TspEvent = {
1460
1555
  s?: number;
1461
1556
  op?: number;
1462
1557
  msg: string;
1463
- } | {
1558
+ }
1559
+ /** A lost surface, or (scoped to `sf`) settled main children dropped under the retention budget. */
1560
+ | {
1464
1561
  ev: "gone";
1465
1562
  sf?: string;
1466
1563
  ids: readonly string[];
package/package.json CHANGED
@@ -1,40 +1,24 @@
1
1
  {
2
- "type": "module",
3
2
  "name": "@linxiraos/pi-wire",
4
- "version": "1.5.13",
3
+ "version": "1.5.15",
5
4
  "description": "Shared wire protocol types for omp packages",
5
+ "keywords": [
6
+ "collab",
7
+ "protocol",
8
+ "types",
9
+ "wire"
10
+ ],
6
11
  "homepage": "https://linxira-os.github.io/zeta/",
7
- "author": "Can Boluk",
12
+ "bugs": {
13
+ "url": "https://github.com/Linxira-OS/linxira-zeta/issues"
14
+ },
8
15
  "license": "MIT",
16
+ "author": "Can Boluk",
9
17
  "repository": {
10
18
  "type": "git",
11
19
  "url": "git+https://github.com/Linxira-OS/linxira-zeta.git",
12
20
  "directory": "packages/wire"
13
21
  },
14
- "bugs": {
15
- "url": "https://github.com/Linxira-OS/linxira-zeta/issues"
16
- },
17
- "keywords": [
18
- "wire",
19
- "protocol",
20
- "types",
21
- "collab"
22
- ],
23
- "main": "./src/index.ts",
24
- "types": "./dist/types/index.d.ts",
25
- "scripts": {
26
- "check": "oxlint . && oxfmt --check --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts' && bun run check:types",
27
- "check:types": "bun check --no-script -p tsconfig.json",
28
- "lint": "oxlint .",
29
- "fix": "oxlint --fix --fix-suggestions . && bun run fmt",
30
- "fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
31
- },
32
- "devDependencies": {
33
- "@types/bun": "1.4.4"
34
- },
35
- "engines": {
36
- "bun": ">=1.4.4"
37
- },
38
22
  "files": [
39
23
  "src",
40
24
  "README.md",
@@ -43,6 +27,9 @@
43
27
  "THIRD-PARTY-NOTICES.txt",
44
28
  "dist/types"
45
29
  ],
30
+ "type": "module",
31
+ "main": "./src/index.ts",
32
+ "types": "./dist/types/index.d.ts",
46
33
  "exports": {
47
34
  ".": {
48
35
  "types": "./dist/types/index.d.ts",
@@ -53,5 +40,18 @@
53
40
  "import": "./src/*.ts"
54
41
  },
55
42
  "./*.js": "./src/*.ts"
43
+ },
44
+ "scripts": {
45
+ "check": "oxlint . && oxfmt --check --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts' && bun run check:types",
46
+ "check:types": "bun check --no-script -p tsconfig.json",
47
+ "lint": "oxlint .",
48
+ "fix": "oxlint --fix --fix-suggestions . && bun run fmt",
49
+ "fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
50
+ },
51
+ "devDependencies": {
52
+ "@types/bun": "1.4.4"
53
+ },
54
+ "engines": {
55
+ "bun": ">=1.4.4"
56
56
  }
57
57
  }
package/src/index.ts CHANGED
@@ -166,6 +166,14 @@ export type SessionEntry =
166
166
  | ModelChangeEntry
167
167
  | ThinkingLevelChangeEntry;
168
168
 
169
+ /** customType of collab guest prompts injected on the host. */
170
+ export const COLLAB_PROMPT_MESSAGE_TYPE = "collab-prompt";
171
+
172
+ /** `details` shape of `custom_message` entries with `customType === "collab-prompt"`. */
173
+ export interface CollabPromptDetails {
174
+ from?: string;
175
+ }
176
+
169
177
  // ═══════════════════════════════════════════════════════════════════════════
170
178
  // Events (handled subset)
171
179
  // ═══════════════════════════════════════════════════════════════════════════
@@ -213,9 +221,212 @@ export interface Participant {
213
221
  readOnly?: boolean;
214
222
  }
215
223
 
224
+ /** Debounced footer snapshot broadcast by the host. */
225
+ export interface SessionState {
226
+ isStreaming: boolean;
227
+ queuedMessageCount: number;
228
+ sessionName?: string;
229
+ /** Host cwd — display only; the guest never chdirs. */
230
+ cwd: string;
231
+ model?: WireModel;
232
+ thinkingLevel?: string;
233
+ contextUsage?: ContextUsage;
234
+ participants: Participant[];
235
+ isAborting?: boolean;
236
+ }
237
+
238
+ export interface AgentSnapshot {
239
+ id: string;
240
+ displayName: string;
241
+ kind: "main" | "sub";
242
+ parentId?: string;
243
+ status: "running" | "idle" | "parked" | "aborted";
244
+ /** Whether the host has a transcript file for this agent (gates remote transcript fetch). */
245
+ hasSessionFile: boolean;
246
+ createdAt: number;
247
+ lastActivity: number;
248
+ }
249
+
250
+ // ═══════════════════════════════════════════════════════════════════════════
251
+ // Bus payloads (task subagent lifecycle/progress channels)
252
+ // ═══════════════════════════════════════════════════════════════════════════
253
+
254
+ export interface AgentProgress {
255
+ index: number;
256
+ id: string;
257
+ agent: string;
258
+ status: "pending" | "running" | "completed" | "failed" | "aborted";
259
+ task: string;
260
+ description?: string;
261
+ lastIntent?: string;
262
+ currentTool?: string;
263
+ currentToolArgs?: string;
264
+ /** Argument key selected for the display preview, when known. */
265
+ currentToolArgsKey?: string;
266
+ /** Intent the model attached to the current call; undefined when that call carried none. */
267
+ currentToolIntent?: string;
268
+ currentToolStartMs?: number;
269
+ recentTools: {
270
+ tool: string;
271
+ args: string;
272
+ argsKey?: string;
273
+ intent?: string;
274
+ isError?: boolean;
275
+ /** Lines an edit call added and removed, by its diff; absent for other calls and failed ones. */
276
+ added?: number;
277
+ removed?: number;
278
+ endMs: number;
279
+ }[];
280
+ recentOutput: string[];
281
+ toolCount: number;
282
+ requests: number;
283
+ tokens: number;
284
+ contextTokens?: number;
285
+ contextWindow?: number;
286
+ cost: number;
287
+ durationMs: number;
288
+ resolvedModel?: string;
289
+ }
290
+
291
+ export interface SubagentProgressPayload {
292
+ index: number;
293
+ agent: string;
294
+ task: string;
295
+ parentToolCallId?: string;
296
+ assignment?: string;
297
+ progress: AgentProgress;
298
+ sessionFile?: string;
299
+ }
300
+
301
+ export interface SubagentLifecyclePayload {
302
+ id: string;
303
+ agent: string;
304
+ description?: string;
305
+ status: "started" | "completed" | "failed" | "aborted";
306
+ sessionFile?: string;
307
+ parentToolCallId?: string;
308
+ index: number;
309
+ }
310
+
311
+ // ═══════════════════════════════════════════════════════════════════════════
312
+ // Frames (JSON inside the AES-GCM seal)
313
+ // ═══════════════════════════════════════════════════════════════════════════
314
+
315
+ export type CollabUiSelectItem = string | { label: string; description?: string };
316
+
317
+ export type CollabUiResponseValue = string | undefined;
318
+
319
+ export type CollabUiRequestDraft =
320
+ | {
321
+ kind: "select";
322
+ title: string;
323
+ options: CollabUiSelectItem[];
324
+ initialIndex?: number;
325
+ selectionMarker?: "radio" | "checkbox";
326
+ checkedIndices?: number[];
327
+ markableCount?: number;
328
+ helpText?: string;
329
+ /** The select asks for a permission (a tool approval, a settings change), not an answer. */
330
+ approval?: boolean;
331
+ }
332
+ | {
333
+ kind: "editor";
334
+ title: string;
335
+ prefill?: string;
336
+ };
337
+
338
+ export type CollabUiRequest = CollabUiRequestDraft & { reqId: number };
339
+
340
+ export type GuestFrame =
341
+ | {
342
+ t: "hello";
343
+ proto: number;
344
+ name: string;
345
+ /**
346
+ * base64url write token proving full-link possession; absent for
347
+ * read-only (view) links. The host marks peers without a valid token
348
+ * read-only and rejects their mutating frames.
349
+ */
350
+ writeToken?: string;
351
+ }
352
+ /** `followUp`: wait for the running turn to finish instead of steering it (the TUI's Ctrl+Enter). */
353
+ | { t: "prompt"; text: string; images?: ImageContent[]; followUp?: true }
354
+ | { t: "ui-response"; reqId: number; value?: CollabUiResponseValue }
355
+ | { t: "abort" }
356
+ /** The `.`/`c` continue shortcut: resume the agent, interrupting a running turn first. */
357
+ | { t: "resume" }
358
+ /** Empty Enter: interrupt a run that has queued input and continue it with that input. */
359
+ | { t: "deliver-queue" }
360
+ | { t: "agent-cmd"; cmd: "chat" | "kill" | "revive"; agentId: string; text?: string }
361
+ | { t: "fetch-transcript"; reqId: number; agentId: string; fromByte: number };
362
+
363
+ /** EventBus channels mirrored to guests (task subagent traffic only). */
364
+ export type BusChannel = "task:subagent:progress" | "task:subagent:lifecycle";
365
+
366
+ export type HostFrame =
367
+ | {
368
+ t: "welcome";
369
+ proto: number;
370
+ header: SessionHeader;
371
+ state: SessionState;
372
+ agents: AgentSnapshot[];
373
+ /**
374
+ * Total number of `SessionEntry` items the host will deliver in the
375
+ * `snapshot-chunk` frames that follow. Guests stay in the loading
376
+ * phase until they have accumulated all of them (or a chunk arrives
377
+ * with `final: true`).
378
+ */
379
+ entryCount: number;
380
+ /** True when this peer joined through a read-only (view) link. */
381
+ readOnly?: boolean;
382
+ }
383
+ /**
384
+ * Targeted snapshot fragment delivered after `welcome`. Hosts split the
385
+ * transcript into chunks bounded by byte size so a multi-MB session is not
386
+ * forced through one giant frame the relay may stall on. The last chunk
387
+ * carries `final: true`; guests finalize the replica on that frame.
388
+ */
389
+ | { t: "snapshot-chunk"; entries: SessionEntry[]; final: boolean }
390
+ | { t: "entry"; entry: SessionEntry }
391
+ | { t: "event"; event: AgentEvent }
392
+ | { t: "state"; state: SessionState }
393
+ /** Mirrored EventBus traffic (task subagent lifecycle/progress channels only). */
394
+ | { t: "bus"; channel: BusChannel; data: unknown }
395
+ | { t: "agents"; agents: AgentSnapshot[] }
396
+ | { t: "ui-request"; request: CollabUiRequest }
397
+ | { t: "ui-request-end"; reqId: number }
398
+ /** Targeted reply to fetch-transcript; `text` is decoded JSONL from `fromByte`, `newSize` the next offset base. */
399
+ | { t: "transcript"; reqId: number; text: string; newSize: number; error?: string }
400
+ | { t: "bye"; reason: string }
401
+ /** `resync`: the host no longer counts this guest as joined; the guest should send `hello` again. */
402
+ | { t: "error"; message: string; resync?: true };
403
+
404
+ export type WireFrame = GuestFrame | HostFrame;
405
+
406
+ /**
407
+ * Wire protocol version carried in `hello`; the host rejects mismatches.
408
+ *
409
+ * - `1` (legacy): `welcome` carried the full `entries` array inline.
410
+ * - `2`: `welcome` carries only metadata (header/state/agents/entryCount);
411
+ * transcript entries follow in `snapshot-chunk` frames, so multi-MB
412
+ * sessions are not gated on a single welcome frame fitting under the
413
+ * guest's first-welcome timeout.
414
+ * - `3`: host asks guests through `ui-request`/`ui-request-end` host frames
415
+ * answered by the `ui-response` guest frame. Guests that predate the
416
+ * grammar would silently drop `ui-request` (asks hang forever on the
417
+ * host), so they must be rejected at hello.
418
+ */
419
+ export const COLLAB_PROTO = 3;
420
+
216
421
  /** Parameter key used for intent tracing (e.g. prompt explanation/reasoning) */
217
422
  export const INTENT_FIELD = "i";
218
423
 
424
+ /** Activity label before the first colon-space in a tool intent; preserves bare labels and embedded URL or file:line references. */
425
+ export function toolIntentLabel(intent: string): string {
426
+ const separator = intent.search(/:(?=\s|$)/);
427
+ return separator > 0 ? intent.slice(0, separator).trim() || intent : intent;
428
+ }
429
+
219
430
  // ═══════════════════════════════════════════════════════════════════════════
220
431
  // Envelope & link constants
221
432
  // ═══════════════════════════════════════════════════════════════════════════
@@ -276,10 +487,21 @@ export function takeAutoRejoin(history: number[], now = Date.now()): boolean {
276
487
  }
277
488
 
278
489
  /** Default public relay; bare `<roomId>.<key>` links resolve against it. */
279
- export const DEFAULT_RELAY_URL = "wss://my.omp.sh";
490
+ export const DEFAULT_RELAY_URL = "ws://127.0.0.1:9222";
491
+
492
+ export const DEFAULT_SHARE_URL = "https://linxira-os.github.io/s";
280
493
 
281
494
  /** Default share viewer/upload base; `/share` links resolve against `<base>/<id>#<key>`. */
282
495
 
496
+ export interface ParsedCollabLink {
497
+ /** wss://host[:port]/r/<roomId> — no query, no fragment. */
498
+ wsUrl: string;
499
+ roomId: string;
500
+ key: Uint8Array;
501
+ /** Write token from a full link; absent for read-only (view) links. */
502
+ writeToken?: Uint8Array;
503
+ }
504
+
283
505
  // ═══════════════════════════════════════════════════════════════════════════
284
506
  // Relay control messages (TEXT JSON, unencrypted, no session data)
285
507
  // ═══════════════════════════════════════════════════════════════════════════
@@ -1,6 +1,6 @@
1
1
  /**
2
- * `ShellTrace`: the live model of one embedded-shell run, produced by pi-shell's
3
- * `RunTrace` (`crates/pi-shell/src/bash/trace.rs`), polled over napi, carried in
2
+ * `ShellTrace`: the live model of one embedded-shell run, produced by omp-shell's
3
+ * `RunTrace` (`crates/shell/src/bash/trace.rs`), polled over napi, carried in
4
4
  * the bash tool's `details.trace`, and forwarded verbatim to Tern as the `shell`
5
5
  * node's props. Every offset is a BYTE offset; UIs convert bytes to characters
6
6
  * when the script is not ASCII. Fields at their default are omitted.
@@ -116,12 +116,14 @@ export interface ShellTraceUnit {
116
116
  bytes?: number;
117
117
  /** The unit's source; present only for unlocated units (an eval or function body). */
118
118
  source?: ShellTraceBytes;
119
- /** Opaque canonical native syntax archive. Only pi-shell may interpret it. */
119
+ /** Opaque canonical native syntax archive. Only omp-shell may interpret it. */
120
120
  syntax?: unknown;
121
121
  /** Compiler-known wrapper bytes removed from this unit's displayed source. */
122
122
  projection?: number;
123
123
  /** Script a callout (`timeout`, `git`, `xargs`, …) ran for its operands; its calling command stands for it. */
124
124
  callout?: boolean;
125
+ /** Command (unit index, node id) that ran this unit's script when the script is not literal in it: `eval "$x"`, `.`, a nested shell's file. */
126
+ runner?: { unit: number; node: number };
125
127
  nodes: ShellTraceNode[];
126
128
  }
127
129
 
package/src/tsp.ts CHANGED
@@ -193,6 +193,20 @@ export interface TspCommonProps {
193
193
  * that don't know it ignore it and keep showing `title`.
194
194
  */
195
195
  hovercard?: TspPropNode;
196
+ /**
197
+ * `layout` makes the node a layout-transition container: descendants carrying a {@link motionKey} glide to
198
+ * their new place and size when an update moves, resizes, adds or removes them; new keys fade in, leaving
199
+ * ones fade out. Reduced motion turns it off.
200
+ */
201
+ transition?: "layout";
202
+ /** A `transition` container's duration in ms (200 by default, at most 1000; 0 snaps). */
203
+ transitionMs?: number;
204
+ /**
205
+ * The node's identity in its nearest `transition` container. Unlike `key`, it survives a move to another
206
+ * parent, so the node glides there; give two shapes of one thing (a folded and an open question) the
207
+ * same one so it resizes instead of swapping.
208
+ */
209
+ motionKey?: string;
196
210
  }
197
211
 
198
212
  /** A {@link TspCommonProps.mark}. */
@@ -206,12 +220,60 @@ export type TspPreview = { lines: number } | "auto";
206
220
  export interface TspColProps {
207
221
  gap?: TspSpace;
208
222
  align?: "start" | "center" | "end" | "stretch";
209
- }
223
+ /**
224
+ * On a dock composer's container: fold it to its compact row now, as an unfocused pane's composer folds,
225
+ * while the keys are elsewhere in the document (a question above it).
226
+ */
227
+ folded?: boolean;
228
+ /** On `omp.tray`: a counter the program bumps to move keyboard focus into the tray (acted on a change, never on first sight). */
229
+ focus?: number;
230
+ /** On `omp.tray`: the `ref` of the card its `omp.tray.peek` child belongs to. */
231
+ peek?: string;
232
+ /** On `omp.tray` (sent while it has cards): what the main agent is doing. */
233
+ main?: TspTrayMain;
234
+ /**
235
+ * On `omp.tray`: it holds only finished work (nothing queued, running or failed). The host keeps a
236
+ * quiet tray out of sight until the user asks for it.
237
+ */
238
+ quiet?: boolean;
239
+ /** On `omp.tray.card`: what the card stands for. */
240
+ item?: TspTrayItem;
241
+ /** On `omp.tray.card` and `omp.tray.peek`: the item's id (an agent id, a job id, or `done`). */
242
+ ref?: string;
243
+ /** On `omp.tray.card`: the item's state. */
244
+ status?: TspTrayStatus;
245
+ /**
246
+ * On an agent's `omp.tray.card` while `running`: the call it is in only waits on its own agents or
247
+ * jobs (`wait`, `vibe_wait`), so it does no work of its own until that call returns.
248
+ */
249
+ waiting?: boolean;
250
+ /** On an agent's `omp.tray.card`: epoch ms of its last operation (its latest tool call start, or when it settled). */
251
+ acted?: number;
252
+ /** On `omp.tray.card`: `false` when its closer look would add nothing to its face (`tray.peek` on it is ignored). */
253
+ look?: boolean;
254
+ }
255
+ /** What an `omp.tray.card` stands for. */
256
+ export type TspTrayItem = "agent" | "job" | "done";
257
+ /** The state of an `omp.tray.card`. */
258
+ export type TspTrayStatus = "queued" | "running" | "done" | "failed" | "stopped";
259
+ /**
260
+ * The main agent on `omp.tray`: `idle` once it has yielded (no turn runs, or the run waits only on
261
+ * outside work); `waiting` while every call it executes only blocks on its agents or jobs (a `wait`,
262
+ * a `vibe_wait`, a `task` call running an agent inline), or its last calls were such and it has
263
+ * started nothing else since; `working` otherwise.
264
+ */
265
+ export type TspTrayMain = "idle" | "working" | "waiting";
210
266
  export interface TspRowProps {
211
267
  gap?: TspSpace;
212
268
  align?: "start" | "center" | "baseline" | "end" | "stretch";
213
269
  justify?: "start" | "between" | "end";
214
270
  wrap?: boolean;
271
+ /** On `omp.tray.ev`: how the operation went, or `run` while it is in flight. */
272
+ state?: "ok" | "err" | "run";
273
+ /** On `omp.tray.done.item`: the finished agent's id. */
274
+ ref?: string;
275
+ /** On `omp.tray.done.item`: how the agent ended, which colors its dot. */
276
+ status?: "done" | "failed" | "stopped";
215
277
  }
216
278
  export interface TspCardProps {
217
279
  /** Header content, inline. */
@@ -354,6 +416,8 @@ export interface TspDiffProps {
354
416
  /** A language overriding the one `path` gives. */
355
417
  lang?: string;
356
418
  mode?: "unified" | "split" | "auto";
419
+ /** Long lines wrap inside their rows (absent: `true`); `false` keeps a line per row, scrolled sideways together. */
420
+ wrap?: boolean;
357
421
  }
358
422
  export interface TspAnsiProps {
359
423
  /** Raw terminal output (SGR, OSC 8, `\r`, `\b` allowed). */
@@ -1130,6 +1194,18 @@ export interface TspShellProps {
1130
1194
  * disclosure, and never applies in the inspector. The Raw/Pseudo switch and menu stay on the first visible line.
1131
1195
  */
1132
1196
  preview?: { lines: number };
1197
+ /**
1198
+ * Step mode: every segment with an execution node (`executionNode ?? node ?? row.node`) is a click target
1199
+ * (pointer, `role=button`, Enter/Space) sending the `shell-viz` action `select:<executionNode>`; hovering one
1200
+ * highlights every segment of that step. Chips with `expanded` keep sending `expand:<node>` only. No details
1201
+ * panel and no gutter Inspect command button; effect chips and annotations keep their text as a tooltip.
1202
+ */
1203
+ steps?: boolean;
1204
+ /**
1205
+ * Execution-node keys of the step whose output the host shows now: every segment drawn under one of them is
1206
+ * marked focused, re-applied whenever this changes even when the rows did not.
1207
+ */
1208
+ focus?: readonly string[];
1133
1209
  }
1134
1210
 
1135
1211
  /** Kind-specific props, indexed by kind. */
@@ -1295,8 +1371,14 @@ export type TspEvent =
1295
1371
  | { ev: "resize"; sf?: string; cols: number; cell?: { w: number; h: number }; visible?: boolean }
1296
1372
  | { ev: "theme"; dark: boolean }
1297
1373
  | { ev: "motion"; reduce: boolean }
1374
+ /** The terminal's features changed (a setting: Tern's Agents tray drops `tray`); the list replaces `hello.features`. */
1375
+ | { ev: "features"; features: readonly string[] }
1298
1376
  | { ev: "visible"; sf?: string; visible: boolean }
1377
+ /** The window reads and shows this pane's checkout (branch, changes, pull request) itself: show them from `shown` and read none of it yourself while `true`. */
1378
+ | { ev: "checkout"; sf?: string; shown: boolean }
1299
1379
  | { ev: "toggle"; sf: string; id: string; key?: string; collapsed: boolean }
1380
+ /** Menu opening/closing; a toggle of a named sub-item also reports its id. */
1381
+ | { ev: "toggle"; sf: string; id: string; open: boolean; item?: string }
1300
1382
  | { ev: "select"; sf: string; id: string; item: string }
1301
1383
  | { ev: "activate"; sf: string; id: string; item: string }
1302
1384
  /** A click action; a `menu` check or radio row adds its new `checked` state. */
@@ -1358,4 +1440,5 @@ export type TspEvent =
1358
1440
  */
1359
1441
  | { ev: "focus"; sf: string; id: string }
1360
1442
  | { ev: "error"; sf?: string; s?: number; op?: number; msg: string }
1443
+ /** A lost surface, or (scoped to `sf`) settled main children dropped under the retention budget. */
1361
1444
  | { ev: "gone"; sf?: string; ids: readonly string[] };