@linxiraos/pi-wire 1.5.1 → 1.5.10
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 +11 -2
- package/THIRD-PARTY-NOTICES.txt +22 -11
- package/dist/types/index.d.ts +256 -4
- package/dist/types/tsp.d.ts +221 -6
- package/package.json +1 -1
- package/src/index.ts +286 -4
- package/src/tsp.ts +205 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
-
## [1.5.
|
|
3
|
+
## [1.5.10] - 2026-11-19
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Added optional picker icons for tooltips and accessible names, plus an option to control the placement of the search interface.
|
|
8
|
+
- Added buttons, menu, and document component kinds, including menu-row action state changes and document text editing, commenting, and uncommenting events.
|
|
9
|
+
|
|
10
|
+
## [1.5.2] - 2026-11-13
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Released as part of Zeta 1.5.2 asset review; no package-specific user-visible changes.
|
|
6
15
|
|
|
7
16
|
## [1.5.0] - 2026-11-09
|
|
8
17
|
|
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -19,20 +19,19 @@ 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
|
+
| `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*` |
|
|
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
|
-
| `web-app/` (`src/studio`, `src/vendor/*`) | OMP Studio
|
|
25
|
-
| `termide/` | TermIDE, https://github.com/termide/termide | tag `0.
|
|
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
|
+
| `termide/` | TermIDE, https://github.com/termide/termide | tag `0.49.0` = `057eb55e0a7c4ee969982fab62dc83bde028e052` | MIT | deviations listed in `termide/VENDOR.md` |
|
|
26
26
|
| `editor/npm/*` (`@linxiraos/editor*`) | TermIDE `panel-editor` | same tree as `termide/` | MIT | built as the editor-only bin `termide-editor` (`editor/npm/editor/VENDOR.md`) |
|
|
27
27
|
| `plugins/official/*` | per plugin | per plugin | per plugin | each directory carries `plugin.json`, README with source, and its license |
|
|
28
28
|
|
|
29
|
-
Why the fork renames things
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
existing installation does not silently break.
|
|
29
|
+
Why the fork renames things: Zeta keeps its product identity distinct from its
|
|
30
|
+
upstreams. Renames cover the product name, command names (`zetawork` /
|
|
31
|
+
`zetacode` / `zetaide`), the `zeta://` scheme, the npm scope `@linxiraos/*`, and
|
|
32
|
+
release asset names (`zeta-cli-*`). User-visible configuration uses Zeta names;
|
|
33
|
+
upstream status directories and retired configuration aliases are not loaded.
|
|
34
|
+
The component licenses below retain their original grants and notices.
|
|
36
35
|
|
|
37
36
|
Brand and assets:
|
|
38
37
|
|
|
@@ -48,6 +47,18 @@ Frozen counterpart constants (interoperability, not branding):
|
|
|
48
47
|
These are wire-compatible identifiers Zeta must keep, listed here so that a
|
|
49
48
|
brand sweep does not break them.
|
|
50
49
|
|
|
50
|
+
SHEETJS COMMUNITY EDITION 0.20.3
|
|
51
|
+
================================
|
|
52
|
+
|
|
53
|
+
Copyright (C) 2012-present SheetJS LLC. Licensed under Apache-2.0; the full
|
|
54
|
+
Apache License 2.0 is reproduced in this aggregate below. The unchanged official
|
|
55
|
+
distribution, including its LICENSE and source notices, is retained at
|
|
56
|
+
web-app/vendor/xlsx-0.20.3.tgz. Source: https://git.sheetjs.com/sheetjs/sheetjs
|
|
57
|
+
Official archive: https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz
|
|
58
|
+
SHA-512: oLDq3jw7AcLqKWH2AhCpVTZl8mf6X2YReP+Neh0SJUzV/BdZYjth94tG5toiMB1PPrYtxOCfaoUCkvtuH+3AJA==
|
|
59
|
+
Zeta changes dependency resolution to this local archive only; parser bytes
|
|
60
|
+
and the upstream license are unchanged (ADR-0059).
|
|
61
|
+
|
|
51
62
|
PYTHON DEPENDENCY DISTRIBUTION ROLE
|
|
52
63
|
===================================
|
|
53
64
|
|
|
@@ -432,7 +443,7 @@ SOFTWARE.
|
|
|
432
443
|
web-app/src/studio + web-app/src/vendor/* + web-ui/components/studio +
|
|
433
444
|
web-ui/styles/studio + web-ui/lib/studio-protocol
|
|
434
445
|
|
|
435
|
-
Ported UI surface and protocol types from OMP Studio 0.1.17
|
|
446
|
+
Ported UI surface and protocol types from OMP Studio (MIT): the original port was `0.1.17`; the current product renderer follows official `v0.2.1`, integrated 2026-11-16.
|
|
436
447
|
|
|
437
448
|
- `web-ui/components/studio/` and `web-ui/styles/studio/` are derived from the
|
|
438
449
|
OMP Studio renderer (`apps/renderer/src`).
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,263 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared wire
|
|
2
|
+
* Shared wire types for the Zeta live-session protocol.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Dependency-free JSON shapes produced by `@linxiraos/zeta`
|
|
5
|
+
* (`src/collab/protocol.ts` and friends). Browser and test clients import this
|
|
6
|
+
* package instead of depending on the coding-agent runtime; conformance is
|
|
7
|
+
* asserted type-only in `packages/coding-agent/test/collab/web-wire.types.ts`.
|
|
8
|
+
*
|
|
9
|
+
* Unknown entry/event variants arrive over the wire as plain JSON. The unions
|
|
10
|
+
* below cover only the variants this client renders; consumers cast at the
|
|
11
|
+
* JSON boundary and every `switch` keeps a tolerant `default:` branch.
|
|
6
12
|
*/
|
|
7
|
-
|
|
13
|
+
export interface TextContent {
|
|
14
|
+
type: "text";
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ImageContent {
|
|
18
|
+
type: "image";
|
|
19
|
+
/** Base64-encoded image data. */
|
|
20
|
+
data: string;
|
|
21
|
+
/** e.g. "image/png". */
|
|
22
|
+
mimeType: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ThinkingContent {
|
|
25
|
+
type: "thinking";
|
|
26
|
+
thinking: string;
|
|
27
|
+
}
|
|
28
|
+
export interface RedactedThinkingContent {
|
|
29
|
+
type: "redactedThinking";
|
|
30
|
+
data: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ToolCallContent {
|
|
33
|
+
type: "toolCall";
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
arguments: Record<string, unknown>;
|
|
37
|
+
intent?: string;
|
|
38
|
+
}
|
|
39
|
+
export type AssistantContent = TextContent | ThinkingContent | RedactedThinkingContent | ToolCallContent;
|
|
40
|
+
export type StopReason = "stop" | "length" | "toolUse" | "error" | "aborted";
|
|
41
|
+
export interface WireUsage {
|
|
42
|
+
input: number;
|
|
43
|
+
output: number;
|
|
44
|
+
cacheRead: number;
|
|
45
|
+
cacheWrite: number;
|
|
46
|
+
totalTokens: number;
|
|
47
|
+
cost: {
|
|
48
|
+
total: number;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface UserMessage {
|
|
52
|
+
role: "user";
|
|
53
|
+
content: string | (TextContent | ImageContent)[];
|
|
54
|
+
/** True if the message was injected by the system (e.g. auto-continue). */
|
|
55
|
+
synthetic?: boolean;
|
|
56
|
+
/** Unix timestamp in milliseconds. */
|
|
57
|
+
timestamp: number;
|
|
58
|
+
}
|
|
59
|
+
export interface DeveloperMessage {
|
|
60
|
+
role: "developer";
|
|
61
|
+
content: string | (TextContent | ImageContent)[];
|
|
62
|
+
timestamp: number;
|
|
63
|
+
}
|
|
64
|
+
export interface AssistantMessage {
|
|
65
|
+
role: "assistant";
|
|
66
|
+
content: AssistantContent[];
|
|
67
|
+
model: string;
|
|
68
|
+
usage: WireUsage;
|
|
69
|
+
stopReason: StopReason;
|
|
70
|
+
errorMessage?: string;
|
|
71
|
+
timestamp: number;
|
|
72
|
+
}
|
|
73
|
+
export interface ToolResultMessage {
|
|
74
|
+
role: "toolResult";
|
|
75
|
+
toolCallId: string;
|
|
76
|
+
toolName: string;
|
|
77
|
+
content: (TextContent | ImageContent)[];
|
|
78
|
+
details?: unknown;
|
|
79
|
+
isError: boolean;
|
|
80
|
+
timestamp: number;
|
|
81
|
+
}
|
|
82
|
+
export type WireMessage = UserMessage | DeveloperMessage | AssistantMessage | ToolResultMessage;
|
|
83
|
+
export interface SessionHeader {
|
|
84
|
+
type: "session";
|
|
85
|
+
id: string;
|
|
86
|
+
title?: string;
|
|
87
|
+
timestamp: string;
|
|
88
|
+
cwd: string;
|
|
89
|
+
}
|
|
90
|
+
export interface EntryBase {
|
|
91
|
+
id: string;
|
|
92
|
+
parentId: string | null;
|
|
93
|
+
timestamp: string;
|
|
94
|
+
}
|
|
95
|
+
export interface MessageEntry extends EntryBase {
|
|
96
|
+
type: "message";
|
|
97
|
+
message: WireMessage;
|
|
98
|
+
}
|
|
99
|
+
export interface CustomMessageEntry extends EntryBase {
|
|
100
|
+
type: "custom_message";
|
|
101
|
+
customType: string;
|
|
102
|
+
content: string | (TextContent | ImageContent)[];
|
|
103
|
+
details?: unknown;
|
|
104
|
+
display: boolean;
|
|
105
|
+
}
|
|
106
|
+
export interface CompactionEntry extends EntryBase {
|
|
107
|
+
type: "compaction";
|
|
108
|
+
summary: string;
|
|
109
|
+
shortSummary?: string;
|
|
110
|
+
firstKeptEntryId: string;
|
|
111
|
+
tokensBefore: number;
|
|
112
|
+
}
|
|
113
|
+
export interface BranchSummaryEntry extends EntryBase {
|
|
114
|
+
type: "branch_summary";
|
|
115
|
+
fromId: string;
|
|
116
|
+
summary: string;
|
|
117
|
+
}
|
|
118
|
+
export interface ModelChangeEntry extends EntryBase {
|
|
119
|
+
type: "model_change";
|
|
120
|
+
/** Model in "provider/modelId" format. */
|
|
121
|
+
model: string;
|
|
122
|
+
role?: string;
|
|
123
|
+
}
|
|
124
|
+
export interface ThinkingLevelChangeEntry extends EntryBase {
|
|
125
|
+
type: "thinking_level_change";
|
|
126
|
+
thinkingLevel?: string | null;
|
|
127
|
+
}
|
|
128
|
+
export type SessionEntry = MessageEntry | CustomMessageEntry | CompactionEntry | BranchSummaryEntry | ModelChangeEntry | ThinkingLevelChangeEntry;
|
|
129
|
+
export type AgentEvent = {
|
|
130
|
+
type: "agent_start";
|
|
131
|
+
} | {
|
|
132
|
+
type: "agent_end";
|
|
133
|
+
} | {
|
|
134
|
+
type: "turn_start";
|
|
135
|
+
} | {
|
|
136
|
+
type: "turn_end";
|
|
137
|
+
} | {
|
|
138
|
+
type: "message_start";
|
|
139
|
+
message: WireMessage;
|
|
140
|
+
}
|
|
141
|
+
/** Carries the FULL accumulating partial message — no delta tracking needed. */
|
|
142
|
+
| {
|
|
143
|
+
type: "message_update";
|
|
144
|
+
message: WireMessage;
|
|
145
|
+
} | {
|
|
146
|
+
type: "message_end";
|
|
147
|
+
message: WireMessage;
|
|
148
|
+
} | {
|
|
149
|
+
type: "tool_execution_start";
|
|
150
|
+
toolCallId: string;
|
|
151
|
+
toolName: string;
|
|
152
|
+
args: unknown;
|
|
153
|
+
intent?: string;
|
|
154
|
+
} | {
|
|
155
|
+
type: "tool_execution_update";
|
|
156
|
+
toolCallId: string;
|
|
157
|
+
toolName: string;
|
|
158
|
+
args: unknown;
|
|
159
|
+
partialResult: unknown;
|
|
160
|
+
} | {
|
|
161
|
+
type: "tool_execution_end";
|
|
162
|
+
toolCallId: string;
|
|
163
|
+
toolName: string;
|
|
164
|
+
result: unknown;
|
|
165
|
+
isError?: boolean;
|
|
166
|
+
} | {
|
|
167
|
+
type: "notice";
|
|
168
|
+
level: "info" | "warning" | "error";
|
|
169
|
+
message: string;
|
|
170
|
+
source?: string;
|
|
171
|
+
} | {
|
|
172
|
+
type: "auto_compaction_start";
|
|
173
|
+
reason: string;
|
|
174
|
+
action: string;
|
|
175
|
+
} | {
|
|
176
|
+
type: "auto_compaction_end";
|
|
177
|
+
aborted: boolean;
|
|
178
|
+
willRetry: boolean;
|
|
179
|
+
errorMessage?: string;
|
|
180
|
+
skipped?: boolean;
|
|
181
|
+
} | {
|
|
182
|
+
type: "auto_retry_start";
|
|
183
|
+
attempt: number;
|
|
184
|
+
maxAttempts: number;
|
|
185
|
+
delayMs: number;
|
|
186
|
+
errorMessage: string;
|
|
187
|
+
} | {
|
|
188
|
+
type: "auto_retry_end";
|
|
189
|
+
success: boolean;
|
|
190
|
+
attempt: number;
|
|
191
|
+
finalError?: string;
|
|
192
|
+
} | {
|
|
193
|
+
type: "thinking_level_changed";
|
|
194
|
+
thinkingLevel?: string;
|
|
195
|
+
};
|
|
196
|
+
export interface WireModel {
|
|
197
|
+
id: string;
|
|
198
|
+
name: string;
|
|
199
|
+
provider: string;
|
|
200
|
+
contextWindow: number | null;
|
|
201
|
+
}
|
|
202
|
+
export interface ContextUsage {
|
|
203
|
+
tokens: number | null;
|
|
204
|
+
contextWindow: number | null;
|
|
205
|
+
percent: number | null;
|
|
206
|
+
}
|
|
207
|
+
export interface Participant {
|
|
208
|
+
name: string;
|
|
209
|
+
role: "host" | "guest";
|
|
210
|
+
/** True when the guest joined through a read-only (view) link. */
|
|
211
|
+
readOnly?: boolean;
|
|
212
|
+
}
|
|
213
|
+
/** Parameter key used for intent tracing (e.g. prompt explanation/reasoning) */
|
|
8
214
|
export declare const INTENT_FIELD = "i";
|
|
215
|
+
/** Plaintext envelope prefix: `[4B uint32 BE peerId][sealed payload]`. */
|
|
216
|
+
export declare const ENVELOPE_HEADER_LENGTH = 4;
|
|
217
|
+
/**
|
|
218
|
+
* Prefix `sealed` with its envelope header. Host→relay: peerId 0 broadcasts to
|
|
219
|
+
* all guests, peerId N targets guest N. Guest→relay: always 0; the relay
|
|
220
|
+
* rewrites it to the sender's id.
|
|
221
|
+
*/
|
|
222
|
+
export declare function packEnvelope(peerId: number, sealed: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
223
|
+
/** Split an envelope into its peerId and sealed payload; `null` when shorter than the header. */
|
|
224
|
+
export declare function unpackEnvelope(data: Uint8Array): {
|
|
225
|
+
peerId: number;
|
|
226
|
+
payload: Uint8Array;
|
|
227
|
+
} | null;
|
|
228
|
+
/** Rewrite the peerId in place without copying the payload. */
|
|
229
|
+
export declare function rewriteEnvelopePeer(data: Uint8Array, peerId: number): void;
|
|
230
|
+
export declare const ROOM_ID_BYTES = 16;
|
|
231
|
+
/** AES-256-GCM room key; the seal key for every collab frame. */
|
|
232
|
+
export declare const ROOM_KEY_BYTES = 32;
|
|
233
|
+
/**
|
|
234
|
+
* Random write token appended to the room key in full links
|
|
235
|
+
* (`base64url(key ∥ token)`); view links carry the bare key. Possession
|
|
236
|
+
* proves prompt/abort/agent-cmd capability to the host.
|
|
237
|
+
*/
|
|
238
|
+
export declare const WRITE_TOKEN_BYTES = 16;
|
|
239
|
+
/**
|
|
240
|
+
* Each automatic rejoin costs the host a full snapshot, and a guest on a link
|
|
241
|
+
* too slow for the session is shed again after every one. Past the cap the
|
|
242
|
+
* guest stops rejoining on its own and leaves the decision to the user.
|
|
243
|
+
*/
|
|
244
|
+
export declare const MAX_AUTO_REJOINS = 3;
|
|
245
|
+
export declare const AUTO_REJOIN_WINDOW_MS: number;
|
|
246
|
+
/** Records an automatic rejoin in {@link history} if the window has room for one. */
|
|
247
|
+
export declare function takeAutoRejoin(history: number[], now?: number): boolean;
|
|
248
|
+
/** Default public relay; bare `<roomId>.<key>` links resolve against it. */
|
|
249
|
+
export declare const DEFAULT_RELAY_URL = "wss://my.omp.sh";
|
|
250
|
+
/** Default share viewer/upload base; `/share` links resolve against `<base>/<id>#<key>`. */
|
|
251
|
+
/** Relay → host control message. */
|
|
252
|
+
export type RelayControlToHost = {
|
|
253
|
+
t: "peer-joined" | "peer-left";
|
|
254
|
+
peer: number;
|
|
255
|
+
};
|
|
256
|
+
/** Relay → guest control message. */
|
|
257
|
+
export type RelayControlToGuest = {
|
|
258
|
+
t: "room-closed";
|
|
259
|
+
};
|
|
260
|
+
export type RelayControlMessage = RelayControlToHost | RelayControlToGuest;
|
|
9
261
|
export * from "./shell-trace.js";
|
|
10
262
|
export * from "./shell-viz.js";
|
|
11
263
|
export * from "./stream.js";
|
package/dist/types/tsp.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare const TSP_DEFAULT_CREDITS = 2;
|
|
|
27
27
|
/** One-letter message verb. */
|
|
28
28
|
export type TspVerb = "q" | "o" | "f" | "b" | "x" | "r" | "e";
|
|
29
29
|
/** Every component kind in the v1 vocabulary. */
|
|
30
|
-
export declare const TSP_KINDS: readonly ["col", "row", "card", "section", "rule", "spacer", "text", "md", "code", "diff", "ansi", "math", "image", "media", "kv", "table", "tree", "json", "badge", "kbd", "icon", "spinner", "shimmer", "elapsed", "progress", "rate", "list", "item", "tabs", "editor", "input", "button", "status", "seg", "overlay", "toast", "rows", "picker", "prefs", "tool", "checklist", "agent", "chart", "meter", "effort", "shell"];
|
|
30
|
+
export declare const TSP_KINDS: readonly ["col", "row", "card", "section", "rule", "spacer", "text", "md", "code", "diff", "ansi", "math", "image", "media", "web", "kv", "table", "tree", "json", "badge", "kbd", "icon", "spinner", "shimmer", "elapsed", "progress", "rate", "list", "item", "tabs", "editor", "input", "button", "buttons", "menu", "doc", "status", "seg", "overlay", "toast", "rows", "picker", "prefs", "tool", "checklist", "agent", "chart", "meter", "effort", "shell"];
|
|
31
31
|
export type TspKind = (typeof TSP_KINDS)[number];
|
|
32
32
|
/** Semantic colour of a node's chrome. */
|
|
33
33
|
export type TspTone = "neutral" | "accent" | "info" | "success" | "warning" | "error" | "pending" | "muted" | "user";
|
|
@@ -65,6 +65,21 @@ export type TspText = string | readonly TspSpan[];
|
|
|
65
65
|
* beside it) large in the terminal's viewer; it is an image's click by default.
|
|
66
66
|
*/
|
|
67
67
|
export type TspAction = "toggle" | "copy" | "open" | "zoom" | "select" | "activate" | (string & {});
|
|
68
|
+
/**
|
|
69
|
+
* One entry of `actions.menu` or `actions.hold`: an action name (labeled from it), `"-"` a separator, a dim
|
|
70
|
+
* `{ header }`, or a row running action `id`, with its `label`, `icon` and `detail` (the hold menu shows it dim
|
|
71
|
+
* at the row's end).
|
|
72
|
+
*/
|
|
73
|
+
export type TspMenuEntry = TspAction | {
|
|
74
|
+
header: string;
|
|
75
|
+
} | {
|
|
76
|
+
id: TspAction;
|
|
77
|
+
label?: string;
|
|
78
|
+
icon?: string;
|
|
79
|
+
detail?: string;
|
|
80
|
+
disabled?: boolean | string;
|
|
81
|
+
danger?: boolean;
|
|
82
|
+
};
|
|
68
83
|
/** Props every node accepts. */
|
|
69
84
|
export interface TspCommonProps {
|
|
70
85
|
role?: string;
|
|
@@ -82,10 +97,15 @@ export interface TspCommonProps {
|
|
|
82
97
|
w?: TspExtent;
|
|
83
98
|
h?: TspExtent;
|
|
84
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
* What a pointer does: `menu` lists what a right-click offers; `hold` what a long press on a touch screen
|
|
102
|
+
* offers (a phone's hold menu over the lifted node), which a desktop ignores.
|
|
103
|
+
*/
|
|
85
104
|
actions?: {
|
|
86
105
|
click?: TspAction;
|
|
87
106
|
dblclick?: TspAction;
|
|
88
|
-
menu?: readonly
|
|
107
|
+
menu?: readonly TspMenuEntry[];
|
|
108
|
+
hold?: readonly TspMenuEntry[];
|
|
89
109
|
};
|
|
90
110
|
title?: string;
|
|
91
111
|
/** Accessible name for icon-only or visual-only nodes. */
|
|
@@ -169,6 +189,34 @@ export interface TspMarkdownProps {
|
|
|
169
189
|
/** Literal runs drawn as these spans wherever they occur in prose (a sent prompt's chip tokens). */
|
|
170
190
|
marks?: readonly TspSpan[];
|
|
171
191
|
}
|
|
192
|
+
/** A comment drawn on a {@link TspDocProps} document, anchored to a quote of its source. */
|
|
193
|
+
export interface TspDocComment {
|
|
194
|
+
/** The program's comment id; `comment`/`uncomment` events name it. */
|
|
195
|
+
id: string;
|
|
196
|
+
/** The commented source text. */
|
|
197
|
+
quote: string;
|
|
198
|
+
/** UTF-16 offset of the quote's first char in `text`; the first occurrence of `quote` when it doesn't match there. */
|
|
199
|
+
at?: number;
|
|
200
|
+
note: string;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* A rich Markdown document the user reads, selects, edits in place (double-click, `edit`) and comments on
|
|
204
|
+
* (`comment`): edits arrive as `change` events with the full source, comments as `comment`/`uncomment`.
|
|
205
|
+
*/
|
|
206
|
+
export interface TspDocProps {
|
|
207
|
+
/** Markdown source in omp's dialect; the document's own current source is a no-op. */
|
|
208
|
+
text?: string;
|
|
209
|
+
/** Double-click enters in-place editing; Esc or a press outside leaves it. */
|
|
210
|
+
edit?: boolean;
|
|
211
|
+
/** A still, non-empty selection offers a Comment bubble. */
|
|
212
|
+
comment?: boolean;
|
|
213
|
+
comments?: readonly TspDocComment[];
|
|
214
|
+
/** Scroll heading number `heading` (0-based, document order, all levels) to the top; each new `n` scrolls again. */
|
|
215
|
+
jump?: {
|
|
216
|
+
heading: number;
|
|
217
|
+
n: number;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
172
220
|
/** One marked line of a {@link TspCodeProps.marks}. */
|
|
173
221
|
export interface TspCodeMark {
|
|
174
222
|
line: number;
|
|
@@ -290,6 +338,21 @@ export interface TspMediaProps {
|
|
|
290
338
|
h?: TspExtent;
|
|
291
339
|
};
|
|
292
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* A live web page shown inline (an `<iframe>` of a reply): passive until clicked, focused by a
|
|
343
|
+
* click, left with Escape, and replaced by a still of itself once idle. Programs check
|
|
344
|
+
* `cx.supports("web")` first.
|
|
345
|
+
*/
|
|
346
|
+
export interface TspWebProps {
|
|
347
|
+
/** The page: an `http(s)` or `file://` URL. */
|
|
348
|
+
url: string;
|
|
349
|
+
/** What the page is, until it reports its own title. */
|
|
350
|
+
title?: string;
|
|
351
|
+
/** Width as a CSS length (`"50%"`, `"400px"`, `"60vw"`, `"80ch"`, `"30em"`); default: the column's. */
|
|
352
|
+
w?: string;
|
|
353
|
+
/** Height as a CSS length; default: a 16:10 box of the width. */
|
|
354
|
+
h?: string;
|
|
355
|
+
}
|
|
293
356
|
export interface TspKvProps {
|
|
294
357
|
items: readonly {
|
|
295
358
|
k: TspText;
|
|
@@ -393,6 +456,62 @@ export interface TspItemProps {
|
|
|
393
456
|
disabled?: boolean;
|
|
394
457
|
value?: TspText;
|
|
395
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* One row of a {@link TspMenuProps} menu: `"-"` a separator, `{ header }` a dim section title, an action id
|
|
461
|
+
* (labeled from it), or an item sending its `id` as an `action` event's `act`.
|
|
462
|
+
*/
|
|
463
|
+
export type TspMenuItem = string | {
|
|
464
|
+
header: string;
|
|
465
|
+
} | {
|
|
466
|
+
id: string;
|
|
467
|
+
label?: string;
|
|
468
|
+
icon?: string;
|
|
469
|
+
/** Shortcut keys drawn at the row's right (display only). */
|
|
470
|
+
keys?: string | readonly string[];
|
|
471
|
+
/** A second line under the label (a rich row). */
|
|
472
|
+
detail?: string;
|
|
473
|
+
/** A check row, checked while true. */
|
|
474
|
+
checked?: boolean;
|
|
475
|
+
/** A radio row of this group. */
|
|
476
|
+
radio?: string;
|
|
477
|
+
/** Dimmed, not choosable; a string is the reason. */
|
|
478
|
+
disabled?: boolean | string;
|
|
479
|
+
danger?: boolean;
|
|
480
|
+
/** A submenu; the row itself sends nothing. */
|
|
481
|
+
items?: readonly TspMenuItem[];
|
|
482
|
+
};
|
|
483
|
+
/**
|
|
484
|
+
* A button opening a dropdown of commands. Choosing a row sends `action` (`act` = the row's id, `checked` for
|
|
485
|
+
* check/radio rows); opening or closing it sends `toggle` with `open`. As the last child of a split
|
|
486
|
+
* {@link TspButtonsProps} group it draws as the split's menu part. Pointer-only: it never takes focus.
|
|
487
|
+
*/
|
|
488
|
+
export interface TspMenuProps {
|
|
489
|
+
items?: readonly TspMenuItem[];
|
|
490
|
+
/** The trigger's label; without `text` and `icon` the trigger is a square … button. */
|
|
491
|
+
text?: string;
|
|
492
|
+
icon?: string;
|
|
493
|
+
trigger?: "default" | "quiet" | "primary";
|
|
494
|
+
/** A chevron after the label. */
|
|
495
|
+
caret?: boolean;
|
|
496
|
+
size?: "sm" | "md";
|
|
497
|
+
variant?: "default" | "dense";
|
|
498
|
+
/** Whether the menu shows; a change wins over the user's local open/close. */
|
|
499
|
+
open?: boolean;
|
|
500
|
+
/** The highlighted row's id (the program's keyboard cursor). */
|
|
501
|
+
active?: string;
|
|
502
|
+
/** Which trigger edge the menu lines up with. */
|
|
503
|
+
align?: "start" | "end";
|
|
504
|
+
/** The trigger is dimmed and does not open; a string is the reason. */
|
|
505
|
+
disabled?: boolean | string;
|
|
506
|
+
}
|
|
507
|
+
/** `button` children drawn as one control: joined, an action with its menu part (`split`), or a toolbar well. */
|
|
508
|
+
export interface TspButtonsProps {
|
|
509
|
+
variant?: "joined" | "split" | "toolbar";
|
|
510
|
+
/** The children's size, winning over their own. */
|
|
511
|
+
size?: "sm" | "md";
|
|
512
|
+
/** Accessible name of the group. */
|
|
513
|
+
label?: string;
|
|
514
|
+
}
|
|
396
515
|
export interface TspTabsProps {
|
|
397
516
|
items: readonly {
|
|
398
517
|
id: string;
|
|
@@ -428,6 +547,8 @@ export interface TspEditorDecoration {
|
|
|
428
547
|
to: number;
|
|
429
548
|
s: string;
|
|
430
549
|
fx?: TspEffect;
|
|
550
|
+
/** An image blob the range stands for (an attachment token): copying the range copies the image. */
|
|
551
|
+
blob?: string;
|
|
431
552
|
}
|
|
432
553
|
export interface TspEditorProps {
|
|
433
554
|
text?: string;
|
|
@@ -486,6 +607,10 @@ export interface TspToastProps {
|
|
|
486
607
|
text: string;
|
|
487
608
|
sub?: string;
|
|
488
609
|
ttl?: number;
|
|
610
|
+
/** A button after the text (Undo): clicking it takes the toast down and sends this action for the node. */
|
|
611
|
+
action?: TspAction;
|
|
612
|
+
/** The button's text; defaults to the action's name labeled (`undo` → Undo). */
|
|
613
|
+
label?: string;
|
|
489
614
|
}
|
|
490
615
|
export interface TspRowsProps {
|
|
491
616
|
/** Width the rows were rendered at. */
|
|
@@ -579,6 +704,30 @@ export interface TspPickerAction {
|
|
|
579
704
|
end?: boolean;
|
|
580
705
|
/** A toggle's state (`Task model ⌥P`): drawn pressed when true. */
|
|
581
706
|
on?: boolean;
|
|
707
|
+
/** Drawn in the head as an icon-only button before its esc keycap (`icon`, else the label's initial), its label and keys as tooltip; `on` tints it. */
|
|
708
|
+
head?: boolean;
|
|
709
|
+
/** A head action's icon name. */
|
|
710
|
+
icon?: string;
|
|
711
|
+
disabled?: string | true;
|
|
712
|
+
}
|
|
713
|
+
/** A picker's stepped slider. */
|
|
714
|
+
export interface TspPickerLevel {
|
|
715
|
+
/** What it sets ("Thinking"): shown, or with `icon` its tooltip and accessible name. */
|
|
716
|
+
label: string;
|
|
717
|
+
/** An icon drawn in place of the label. */
|
|
718
|
+
icon?: string;
|
|
719
|
+
/** A dim note after the value in its chip (the model switcher: the highlighted model's provider). */
|
|
720
|
+
detail?: string;
|
|
721
|
+
/** Its steps, low to high: the terminal heats the track up the ladder (color, then motion). */
|
|
722
|
+
steps: readonly {
|
|
723
|
+
id: string;
|
|
724
|
+
label: string;
|
|
725
|
+
}[];
|
|
726
|
+
/** The current step's id. */
|
|
727
|
+
value: string;
|
|
728
|
+
/** The keys the program binds to step it, shown in its tooltip (`["alt", "left", "right"]`). */
|
|
729
|
+
keys?: readonly string[];
|
|
730
|
+
/** Drawn but frozen, the reason as its tooltip. */
|
|
582
731
|
disabled?: string | true;
|
|
583
732
|
}
|
|
584
733
|
/** A group header inside a picker's `order`. */
|
|
@@ -602,6 +751,19 @@ export interface TspPickerProps {
|
|
|
602
751
|
/** Plural noun for counts and empty copy ("models", "sessions"). */
|
|
603
752
|
noun?: string;
|
|
604
753
|
size?: "md" | "lg" | "screen";
|
|
754
|
+
/**
|
|
755
|
+
* Where the sheet sits: absent, its size's place in the layer; `"composer"`, rising from the program's composer
|
|
756
|
+
* (its `composerPart: "composer"` column), left edges aligned — a drop-up for a picker acting on the draft, such as
|
|
757
|
+
* the model switcher. Placed as if absent while no composer is drawn, and on a phone.
|
|
758
|
+
*/
|
|
759
|
+
anchor?: "composer";
|
|
760
|
+
/**
|
|
761
|
+
* Where the search sits: the head (default), or `"list"`: no head row, the query leading the column heads' row
|
|
762
|
+
* (count and esc gone), head actions atop a `rail`. Ignored on a phone.
|
|
763
|
+
*/
|
|
764
|
+
search?: "head" | "list";
|
|
765
|
+
/** How tall rows run: regular (default), or `"snug"`: 30px rows and 26px group headers, the chrome tightened to match. Ignored on a phone. */
|
|
766
|
+
density?: "regular" | "snug";
|
|
605
767
|
layout?: "rows" | "cards" | "timeline" | "tree";
|
|
606
768
|
/** The program's search text (keys stay the program's); `null` hides the field. */
|
|
607
769
|
query?: string | null;
|
|
@@ -610,6 +772,8 @@ export interface TspPickerProps {
|
|
|
610
772
|
placeholder?: string;
|
|
611
773
|
scopes?: readonly TspPickerScope[];
|
|
612
774
|
scope?: string;
|
|
775
|
+
/** How `scopes` draw: a labeled column (default), or `"rail"`: icons only, label and count as the tooltip, kept on narrow sheets. A `group` change draws a separator. */
|
|
776
|
+
scopeStyle?: "column" | "rail";
|
|
613
777
|
tabs?: readonly {
|
|
614
778
|
id: string;
|
|
615
779
|
label: TspText;
|
|
@@ -645,6 +809,8 @@ export interface TspPickerProps {
|
|
|
645
809
|
}[];
|
|
646
810
|
selected?: string;
|
|
647
811
|
} | null;
|
|
812
|
+
/** A stepped slider docked above the action bar (the model switcher's thinking effort). A press or drag ending on another step sends `action {act:"level", value: <step id>}`. */
|
|
813
|
+
level?: TspPickerLevel | null;
|
|
648
814
|
state?: "ready" | "loading" | "error";
|
|
649
815
|
message?: TspText;
|
|
650
816
|
empty?: TspText;
|
|
@@ -976,12 +1142,15 @@ export interface TspShellProps {
|
|
|
976
1142
|
replayEpoch?: number;
|
|
977
1143
|
/** This mounted call received a real execution-start event, not a settled historical load. */
|
|
978
1144
|
liveOrigin?: boolean;
|
|
1145
|
+
/** The command text is still streaming in: the host marks its write head and the preview follows it. */
|
|
1146
|
+
stream?: boolean;
|
|
979
1147
|
/** Working directory shown ahead of the script when it differs from the project's. */
|
|
980
1148
|
cwd?: string;
|
|
981
1149
|
lang?: "bash" | "zsh";
|
|
982
1150
|
/**
|
|
983
|
-
* Clamp the command to
|
|
984
|
-
*
|
|
1151
|
+
* Clamp the command to `lines` drawn lines under an Expand button, the window following the write head
|
|
1152
|
+
* (`stream`), then the playhead, with the enclosing scope heads pinned; gives way inside an open
|
|
1153
|
+
* disclosure, and never applies in the inspector. The Raw/Pseudo switch and menu stay on the first visible line.
|
|
985
1154
|
*/
|
|
986
1155
|
preview?: {
|
|
987
1156
|
lines: number;
|
|
@@ -1003,6 +1172,7 @@ export interface TspPropsByKind {
|
|
|
1003
1172
|
math: TspMathProps;
|
|
1004
1173
|
image: TspImageProps;
|
|
1005
1174
|
media: TspMediaProps;
|
|
1175
|
+
web: TspWebProps;
|
|
1006
1176
|
kv: TspKvProps;
|
|
1007
1177
|
table: TspTableProps;
|
|
1008
1178
|
tree: TspTreeProps;
|
|
@@ -1021,6 +1191,9 @@ export interface TspPropsByKind {
|
|
|
1021
1191
|
editor: TspEditorProps;
|
|
1022
1192
|
input: TspInputProps;
|
|
1023
1193
|
button: TspButtonProps;
|
|
1194
|
+
buttons: TspButtonsProps;
|
|
1195
|
+
menu: TspMenuProps;
|
|
1196
|
+
doc: TspDocProps;
|
|
1024
1197
|
status: TspStatusProps;
|
|
1025
1198
|
seg: TspSegProps;
|
|
1026
1199
|
overlay: TspOverlayProps;
|
|
@@ -1055,7 +1228,7 @@ export type TspPropNode = {
|
|
|
1055
1228
|
};
|
|
1056
1229
|
}[TspKind];
|
|
1057
1230
|
/** Kinds whose primary text the `text` and `splice` ops address (the `text` prop). */
|
|
1058
|
-
export declare const TSP_TEXT_KINDS: readonly ["text", "md", "code", "ansi", "math", "editor", "input", "shimmer"];
|
|
1231
|
+
export declare const TSP_TEXT_KINDS: readonly ["text", "md", "code", "ansi", "math", "editor", "input", "shimmer", "doc"];
|
|
1059
1232
|
/** A node on the wire. */
|
|
1060
1233
|
export type TspNode = {
|
|
1061
1234
|
[K in TspKind]: {
|
|
@@ -1174,13 +1347,16 @@ export type TspEvent = {
|
|
|
1174
1347
|
sf: string;
|
|
1175
1348
|
id: string;
|
|
1176
1349
|
item: string;
|
|
1177
|
-
}
|
|
1350
|
+
}
|
|
1351
|
+
/** A click action; a `menu` check or radio row adds its new `checked` state. */
|
|
1352
|
+
| {
|
|
1178
1353
|
ev: "action";
|
|
1179
1354
|
sf: string;
|
|
1180
1355
|
id: string;
|
|
1181
1356
|
act: string;
|
|
1182
1357
|
value?: string;
|
|
1183
1358
|
mods?: readonly string[];
|
|
1359
|
+
checked?: boolean;
|
|
1184
1360
|
}
|
|
1185
1361
|
/** A typed value changed by pointer (prefs rows, picker toggles); `null` resets to the default. */
|
|
1186
1362
|
| {
|
|
@@ -1190,6 +1366,45 @@ export type TspEvent = {
|
|
|
1190
1366
|
item: string;
|
|
1191
1367
|
value: boolean | number | string | readonly string[] | null;
|
|
1192
1368
|
}
|
|
1369
|
+
/** The user edited a `doc` (~300 ms after typing pauses, and when editing ends): `text` is its full new source. */
|
|
1370
|
+
| {
|
|
1371
|
+
ev: "change";
|
|
1372
|
+
sf: string;
|
|
1373
|
+
id: string;
|
|
1374
|
+
text: string;
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* A comment on a `doc`: a new one on `quote` (`at` its UTF-16 offset in the source the user saw), or the
|
|
1378
|
+
* edited `note` of existing comment `comment`.
|
|
1379
|
+
*/
|
|
1380
|
+
| {
|
|
1381
|
+
ev: "comment";
|
|
1382
|
+
sf: string;
|
|
1383
|
+
id: string;
|
|
1384
|
+
quote: string;
|
|
1385
|
+
at: number;
|
|
1386
|
+
note: string;
|
|
1387
|
+
} | {
|
|
1388
|
+
ev: "comment";
|
|
1389
|
+
sf: string;
|
|
1390
|
+
id: string;
|
|
1391
|
+
comment: string;
|
|
1392
|
+
note: string;
|
|
1393
|
+
}
|
|
1394
|
+
/** Comment `comment` of a `doc` deleted. */
|
|
1395
|
+
| {
|
|
1396
|
+
ev: "uncomment";
|
|
1397
|
+
sf: string;
|
|
1398
|
+
id: string;
|
|
1399
|
+
comment: string;
|
|
1400
|
+
}
|
|
1401
|
+
/** In-place editing of a `doc` started (`on`) or ended. */
|
|
1402
|
+
| {
|
|
1403
|
+
ev: "editing";
|
|
1404
|
+
sf: string;
|
|
1405
|
+
id: string;
|
|
1406
|
+
on: boolean;
|
|
1407
|
+
}
|
|
1193
1408
|
/**
|
|
1194
1409
|
* An edit over the terminal's selection in an `editor`/`input` node: replace
|
|
1195
1410
|
* `[from, to)` with `text`, caret to `cursor` (UTF-16 offsets; `len` is the
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,13 +1,295 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared wire
|
|
2
|
+
* Shared wire types for the Zeta live-session protocol.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Dependency-free JSON shapes produced by `@linxiraos/zeta`
|
|
5
|
+
* (`src/collab/protocol.ts` and friends). Browser and test clients import this
|
|
6
|
+
* package instead of depending on the coding-agent runtime; conformance is
|
|
7
|
+
* asserted type-only in `packages/coding-agent/test/collab/web-wire.types.ts`.
|
|
8
|
+
*
|
|
9
|
+
* Unknown entry/event variants arrive over the wire as plain JSON. The unions
|
|
10
|
+
* below cover only the variants this client renders; consumers cast at the
|
|
11
|
+
* JSON boundary and every `switch` keeps a tolerant `default:` branch.
|
|
6
12
|
*/
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
15
|
+
// Content blocks
|
|
16
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
17
|
+
|
|
18
|
+
export interface TextContent {
|
|
19
|
+
type: "text";
|
|
20
|
+
text: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ImageContent {
|
|
24
|
+
type: "image";
|
|
25
|
+
/** Base64-encoded image data. */
|
|
26
|
+
data: string;
|
|
27
|
+
/** e.g. "image/png". */
|
|
28
|
+
mimeType: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ThinkingContent {
|
|
32
|
+
type: "thinking";
|
|
33
|
+
thinking: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface RedactedThinkingContent {
|
|
37
|
+
type: "redactedThinking";
|
|
38
|
+
data: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ToolCallContent {
|
|
42
|
+
type: "toolCall";
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
arguments: Record<string, unknown>;
|
|
46
|
+
intent?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type AssistantContent = TextContent | ThinkingContent | RedactedThinkingContent | ToolCallContent;
|
|
50
|
+
|
|
51
|
+
export type StopReason = "stop" | "length" | "toolUse" | "error" | "aborted";
|
|
52
|
+
|
|
53
|
+
export interface WireUsage {
|
|
54
|
+
input: number;
|
|
55
|
+
output: number;
|
|
56
|
+
cacheRead: number;
|
|
57
|
+
cacheWrite: number;
|
|
58
|
+
totalTokens: number;
|
|
59
|
+
cost: { total: number };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
63
|
+
// Messages
|
|
64
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
65
|
+
|
|
66
|
+
export interface UserMessage {
|
|
67
|
+
role: "user";
|
|
68
|
+
content: string | (TextContent | ImageContent)[];
|
|
69
|
+
/** True if the message was injected by the system (e.g. auto-continue). */
|
|
70
|
+
synthetic?: boolean;
|
|
71
|
+
/** Unix timestamp in milliseconds. */
|
|
72
|
+
timestamp: number;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface DeveloperMessage {
|
|
76
|
+
role: "developer";
|
|
77
|
+
content: string | (TextContent | ImageContent)[];
|
|
78
|
+
timestamp: number;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface AssistantMessage {
|
|
82
|
+
role: "assistant";
|
|
83
|
+
content: AssistantContent[];
|
|
84
|
+
model: string;
|
|
85
|
+
usage: WireUsage;
|
|
86
|
+
stopReason: StopReason;
|
|
87
|
+
errorMessage?: string;
|
|
88
|
+
timestamp: number;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface ToolResultMessage {
|
|
92
|
+
role: "toolResult";
|
|
93
|
+
toolCallId: string;
|
|
94
|
+
toolName: string;
|
|
95
|
+
content: (TextContent | ImageContent)[];
|
|
96
|
+
details?: unknown;
|
|
97
|
+
isError: boolean;
|
|
98
|
+
timestamp: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type WireMessage = UserMessage | DeveloperMessage | AssistantMessage | ToolResultMessage;
|
|
102
|
+
|
|
103
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
104
|
+
// Session entries (rendered subset; cast `as SessionEntry` at the JSON
|
|
105
|
+
// boundary and skip unknown `type`s in a tolerant `default:`)
|
|
106
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
107
|
+
|
|
108
|
+
export interface SessionHeader {
|
|
109
|
+
type: "session";
|
|
110
|
+
id: string;
|
|
111
|
+
title?: string;
|
|
112
|
+
timestamp: string;
|
|
113
|
+
cwd: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface EntryBase {
|
|
117
|
+
id: string;
|
|
118
|
+
parentId: string | null;
|
|
119
|
+
timestamp: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface MessageEntry extends EntryBase {
|
|
123
|
+
type: "message";
|
|
124
|
+
message: WireMessage;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface CustomMessageEntry extends EntryBase {
|
|
128
|
+
type: "custom_message";
|
|
129
|
+
customType: string;
|
|
130
|
+
content: string | (TextContent | ImageContent)[];
|
|
131
|
+
details?: unknown;
|
|
132
|
+
display: boolean;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface CompactionEntry extends EntryBase {
|
|
136
|
+
type: "compaction";
|
|
137
|
+
summary: string;
|
|
138
|
+
shortSummary?: string;
|
|
139
|
+
firstKeptEntryId: string;
|
|
140
|
+
tokensBefore: number;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface BranchSummaryEntry extends EntryBase {
|
|
144
|
+
type: "branch_summary";
|
|
145
|
+
fromId: string;
|
|
146
|
+
summary: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface ModelChangeEntry extends EntryBase {
|
|
150
|
+
type: "model_change";
|
|
151
|
+
/** Model in "provider/modelId" format. */
|
|
152
|
+
model: string;
|
|
153
|
+
role?: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface ThinkingLevelChangeEntry extends EntryBase {
|
|
157
|
+
type: "thinking_level_change";
|
|
158
|
+
thinkingLevel?: string | null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export type SessionEntry =
|
|
162
|
+
| MessageEntry
|
|
163
|
+
| CustomMessageEntry
|
|
164
|
+
| CompactionEntry
|
|
165
|
+
| BranchSummaryEntry
|
|
166
|
+
| ModelChangeEntry
|
|
167
|
+
| ThinkingLevelChangeEntry;
|
|
168
|
+
|
|
169
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
170
|
+
// Events (handled subset)
|
|
171
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
172
|
+
|
|
173
|
+
export type AgentEvent =
|
|
174
|
+
| { type: "agent_start" }
|
|
175
|
+
| { type: "agent_end" }
|
|
176
|
+
| { type: "turn_start" }
|
|
177
|
+
| { type: "turn_end" }
|
|
178
|
+
| { type: "message_start"; message: WireMessage }
|
|
179
|
+
/** Carries the FULL accumulating partial message — no delta tracking needed. */
|
|
180
|
+
| { type: "message_update"; message: WireMessage }
|
|
181
|
+
| { type: "message_end"; message: WireMessage }
|
|
182
|
+
| { type: "tool_execution_start"; toolCallId: string; toolName: string; args: unknown; intent?: string }
|
|
183
|
+
| { type: "tool_execution_update"; toolCallId: string; toolName: string; args: unknown; partialResult: unknown }
|
|
184
|
+
| { type: "tool_execution_end"; toolCallId: string; toolName: string; result: unknown; isError?: boolean }
|
|
185
|
+
| { type: "notice"; level: "info" | "warning" | "error"; message: string; source?: string }
|
|
186
|
+
| { type: "auto_compaction_start"; reason: string; action: string }
|
|
187
|
+
| { type: "auto_compaction_end"; aborted: boolean; willRetry: boolean; errorMessage?: string; skipped?: boolean }
|
|
188
|
+
| { type: "auto_retry_start"; attempt: number; maxAttempts: number; delayMs: number; errorMessage: string }
|
|
189
|
+
| { type: "auto_retry_end"; success: boolean; attempt: number; finalError?: string }
|
|
190
|
+
| { type: "thinking_level_changed"; thinkingLevel?: string };
|
|
191
|
+
|
|
192
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
193
|
+
// State & agents
|
|
194
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
195
|
+
|
|
196
|
+
export interface WireModel {
|
|
197
|
+
id: string;
|
|
198
|
+
name: string;
|
|
199
|
+
provider: string;
|
|
200
|
+
contextWindow: number | null;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface ContextUsage {
|
|
204
|
+
tokens: number | null;
|
|
205
|
+
contextWindow: number | null;
|
|
206
|
+
percent: number | null;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface Participant {
|
|
210
|
+
name: string;
|
|
211
|
+
role: "host" | "guest";
|
|
212
|
+
/** True when the guest joined through a read-only (view) link. */
|
|
213
|
+
readOnly?: boolean;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** Parameter key used for intent tracing (e.g. prompt explanation/reasoning) */
|
|
9
217
|
export const INTENT_FIELD = "i";
|
|
10
218
|
|
|
219
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
220
|
+
// Envelope & link constants
|
|
221
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
222
|
+
|
|
223
|
+
/** Plaintext envelope prefix: `[4B uint32 BE peerId][sealed payload]`. */
|
|
224
|
+
export const ENVELOPE_HEADER_LENGTH = 4;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Prefix `sealed` with its envelope header. Host→relay: peerId 0 broadcasts to
|
|
228
|
+
* all guests, peerId N targets guest N. Guest→relay: always 0; the relay
|
|
229
|
+
* rewrites it to the sender's id.
|
|
230
|
+
*/
|
|
231
|
+
export function packEnvelope(peerId: number, sealed: Uint8Array): Uint8Array<ArrayBuffer> {
|
|
232
|
+
const out = new Uint8Array(ENVELOPE_HEADER_LENGTH + sealed.byteLength);
|
|
233
|
+
new DataView(out.buffer).setUint32(0, peerId, false);
|
|
234
|
+
out.set(sealed, ENVELOPE_HEADER_LENGTH);
|
|
235
|
+
return out;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Split an envelope into its peerId and sealed payload; `null` when shorter than the header. */
|
|
239
|
+
export function unpackEnvelope(data: Uint8Array): { peerId: number; payload: Uint8Array } | null {
|
|
240
|
+
if (data.byteLength < ENVELOPE_HEADER_LENGTH) return null;
|
|
241
|
+
const peerId = new DataView(data.buffer, data.byteOffset, ENVELOPE_HEADER_LENGTH).getUint32(0, false);
|
|
242
|
+
return { peerId, payload: data.subarray(ENVELOPE_HEADER_LENGTH) };
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** Rewrite the peerId in place without copying the payload. */
|
|
246
|
+
export function rewriteEnvelopePeer(data: Uint8Array, peerId: number): void {
|
|
247
|
+
new DataView(data.buffer, data.byteOffset, ENVELOPE_HEADER_LENGTH).setUint32(0, peerId, false);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export const ROOM_ID_BYTES = 16;
|
|
251
|
+
|
|
252
|
+
/** AES-256-GCM room key; the seal key for every collab frame. */
|
|
253
|
+
export const ROOM_KEY_BYTES = 32;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Random write token appended to the room key in full links
|
|
257
|
+
* (`base64url(key ∥ token)`); view links carry the bare key. Possession
|
|
258
|
+
* proves prompt/abort/agent-cmd capability to the host.
|
|
259
|
+
*/
|
|
260
|
+
export const WRITE_TOKEN_BYTES = 16;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Each automatic rejoin costs the host a full snapshot, and a guest on a link
|
|
264
|
+
* too slow for the session is shed again after every one. Past the cap the
|
|
265
|
+
* guest stops rejoining on its own and leaves the decision to the user.
|
|
266
|
+
*/
|
|
267
|
+
export const MAX_AUTO_REJOINS = 3;
|
|
268
|
+
export const AUTO_REJOIN_WINDOW_MS = 5 * 60_000;
|
|
269
|
+
|
|
270
|
+
/** Records an automatic rejoin in {@link history} if the window has room for one. */
|
|
271
|
+
export function takeAutoRejoin(history: number[], now = Date.now()): boolean {
|
|
272
|
+
while (history.length > 0 && now - history[0]! >= AUTO_REJOIN_WINDOW_MS) history.shift();
|
|
273
|
+
if (history.length >= MAX_AUTO_REJOINS) return false;
|
|
274
|
+
history.push(now);
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** Default public relay; bare `<roomId>.<key>` links resolve against it. */
|
|
279
|
+
export const DEFAULT_RELAY_URL = "wss://my.omp.sh";
|
|
280
|
+
|
|
281
|
+
/** Default share viewer/upload base; `/share` links resolve against `<base>/<id>#<key>`. */
|
|
282
|
+
|
|
283
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
284
|
+
// Relay control messages (TEXT JSON, unencrypted, no session data)
|
|
285
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
286
|
+
|
|
287
|
+
/** Relay → host control message. */
|
|
288
|
+
export type RelayControlToHost = { t: "peer-joined" | "peer-left"; peer: number };
|
|
289
|
+
/** Relay → guest control message. */
|
|
290
|
+
export type RelayControlToGuest = { t: "room-closed" };
|
|
291
|
+
export type RelayControlMessage = RelayControlToHost | RelayControlToGuest;
|
|
292
|
+
|
|
11
293
|
export * from "./shell-trace";
|
|
12
294
|
export * from "./shell-viz";
|
|
13
295
|
export * from "./stream";
|
package/src/tsp.ts
CHANGED
|
@@ -50,6 +50,7 @@ export const TSP_KINDS = [
|
|
|
50
50
|
"math",
|
|
51
51
|
"image",
|
|
52
52
|
"media",
|
|
53
|
+
"web",
|
|
53
54
|
"kv",
|
|
54
55
|
"table",
|
|
55
56
|
"tree",
|
|
@@ -68,6 +69,9 @@ export const TSP_KINDS = [
|
|
|
68
69
|
"editor",
|
|
69
70
|
"input",
|
|
70
71
|
"button",
|
|
72
|
+
"buttons",
|
|
73
|
+
"menu",
|
|
74
|
+
"doc",
|
|
71
75
|
"status",
|
|
72
76
|
"seg",
|
|
73
77
|
"overlay",
|
|
@@ -129,6 +133,23 @@ export type TspText = string | readonly TspSpan[];
|
|
|
129
133
|
*/
|
|
130
134
|
export type TspAction = "toggle" | "copy" | "open" | "zoom" | "select" | "activate" | (string & {});
|
|
131
135
|
|
|
136
|
+
/**
|
|
137
|
+
* One entry of `actions.menu` or `actions.hold`: an action name (labeled from it), `"-"` a separator, a dim
|
|
138
|
+
* `{ header }`, or a row running action `id`, with its `label`, `icon` and `detail` (the hold menu shows it dim
|
|
139
|
+
* at the row's end).
|
|
140
|
+
*/
|
|
141
|
+
export type TspMenuEntry =
|
|
142
|
+
| TspAction
|
|
143
|
+
| { header: string }
|
|
144
|
+
| {
|
|
145
|
+
id: TspAction;
|
|
146
|
+
label?: string;
|
|
147
|
+
icon?: string;
|
|
148
|
+
detail?: string;
|
|
149
|
+
disabled?: boolean | string;
|
|
150
|
+
danger?: boolean;
|
|
151
|
+
};
|
|
152
|
+
|
|
132
153
|
/** Props every node accepts. */
|
|
133
154
|
export interface TspCommonProps {
|
|
134
155
|
role?: string;
|
|
@@ -140,7 +161,16 @@ export interface TspCommonProps {
|
|
|
140
161
|
basis?: "auto" | "content" | number;
|
|
141
162
|
min?: { w?: TspExtent; h?: TspExtent };
|
|
142
163
|
max?: { w?: TspExtent; h?: TspExtent };
|
|
143
|
-
|
|
164
|
+
/**
|
|
165
|
+
* What a pointer does: `menu` lists what a right-click offers; `hold` what a long press on a touch screen
|
|
166
|
+
* offers (a phone's hold menu over the lifted node), which a desktop ignores.
|
|
167
|
+
*/
|
|
168
|
+
actions?: {
|
|
169
|
+
click?: TspAction;
|
|
170
|
+
dblclick?: TspAction;
|
|
171
|
+
menu?: readonly TspMenuEntry[];
|
|
172
|
+
hold?: readonly TspMenuEntry[];
|
|
173
|
+
};
|
|
144
174
|
title?: string;
|
|
145
175
|
/** Accessible name for icon-only or visual-only nodes. */
|
|
146
176
|
aria?: string;
|
|
@@ -224,6 +254,31 @@ export interface TspMarkdownProps {
|
|
|
224
254
|
/** Literal runs drawn as these spans wherever they occur in prose (a sent prompt's chip tokens). */
|
|
225
255
|
marks?: readonly TspSpan[];
|
|
226
256
|
}
|
|
257
|
+
/** A comment drawn on a {@link TspDocProps} document, anchored to a quote of its source. */
|
|
258
|
+
export interface TspDocComment {
|
|
259
|
+
/** The program's comment id; `comment`/`uncomment` events name it. */
|
|
260
|
+
id: string;
|
|
261
|
+
/** The commented source text. */
|
|
262
|
+
quote: string;
|
|
263
|
+
/** UTF-16 offset of the quote's first char in `text`; the first occurrence of `quote` when it doesn't match there. */
|
|
264
|
+
at?: number;
|
|
265
|
+
note: string;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* A rich Markdown document the user reads, selects, edits in place (double-click, `edit`) and comments on
|
|
269
|
+
* (`comment`): edits arrive as `change` events with the full source, comments as `comment`/`uncomment`.
|
|
270
|
+
*/
|
|
271
|
+
export interface TspDocProps {
|
|
272
|
+
/** Markdown source in omp's dialect; the document's own current source is a no-op. */
|
|
273
|
+
text?: string;
|
|
274
|
+
/** Double-click enters in-place editing; Esc or a press outside leaves it. */
|
|
275
|
+
edit?: boolean;
|
|
276
|
+
/** A still, non-empty selection offers a Comment bubble. */
|
|
277
|
+
comment?: boolean;
|
|
278
|
+
comments?: readonly TspDocComment[];
|
|
279
|
+
/** Scroll heading number `heading` (0-based, document order, all levels) to the top; each new `n` scrolls again. */
|
|
280
|
+
jump?: { heading: number; n: number };
|
|
281
|
+
}
|
|
227
282
|
/** One marked line of a {@link TspCodeProps.marks}. */
|
|
228
283
|
export interface TspCodeMark {
|
|
229
284
|
line: number;
|
|
@@ -339,6 +394,21 @@ export interface TspMediaProps {
|
|
|
339
394
|
/** Size cap; the node otherwise fills its container. */
|
|
340
395
|
max?: { w?: TspExtent; h?: TspExtent };
|
|
341
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* A live web page shown inline (an `<iframe>` of a reply): passive until clicked, focused by a
|
|
399
|
+
* click, left with Escape, and replaced by a still of itself once idle. Programs check
|
|
400
|
+
* `cx.supports("web")` first.
|
|
401
|
+
*/
|
|
402
|
+
export interface TspWebProps {
|
|
403
|
+
/** The page: an `http(s)` or `file://` URL. */
|
|
404
|
+
url: string;
|
|
405
|
+
/** What the page is, until it reports its own title. */
|
|
406
|
+
title?: string;
|
|
407
|
+
/** Width as a CSS length (`"50%"`, `"400px"`, `"60vw"`, `"80ch"`, `"30em"`); default: the column's. */
|
|
408
|
+
w?: string;
|
|
409
|
+
/** Height as a CSS length; default: a 16:10 box of the width. */
|
|
410
|
+
h?: string;
|
|
411
|
+
}
|
|
342
412
|
export interface TspKvProps {
|
|
343
413
|
items: readonly { k: TspText; v: TspText }[];
|
|
344
414
|
layout?: "grid" | "inline";
|
|
@@ -430,6 +500,63 @@ export interface TspItemProps {
|
|
|
430
500
|
disabled?: boolean;
|
|
431
501
|
value?: TspText;
|
|
432
502
|
}
|
|
503
|
+
/**
|
|
504
|
+
* One row of a {@link TspMenuProps} menu: `"-"` a separator, `{ header }` a dim section title, an action id
|
|
505
|
+
* (labeled from it), or an item sending its `id` as an `action` event's `act`.
|
|
506
|
+
*/
|
|
507
|
+
export type TspMenuItem =
|
|
508
|
+
| string
|
|
509
|
+
| { header: string }
|
|
510
|
+
| {
|
|
511
|
+
id: string;
|
|
512
|
+
label?: string;
|
|
513
|
+
icon?: string;
|
|
514
|
+
/** Shortcut keys drawn at the row's right (display only). */
|
|
515
|
+
keys?: string | readonly string[];
|
|
516
|
+
/** A second line under the label (a rich row). */
|
|
517
|
+
detail?: string;
|
|
518
|
+
/** A check row, checked while true. */
|
|
519
|
+
checked?: boolean;
|
|
520
|
+
/** A radio row of this group. */
|
|
521
|
+
radio?: string;
|
|
522
|
+
/** Dimmed, not choosable; a string is the reason. */
|
|
523
|
+
disabled?: boolean | string;
|
|
524
|
+
danger?: boolean;
|
|
525
|
+
/** A submenu; the row itself sends nothing. */
|
|
526
|
+
items?: readonly TspMenuItem[];
|
|
527
|
+
};
|
|
528
|
+
/**
|
|
529
|
+
* A button opening a dropdown of commands. Choosing a row sends `action` (`act` = the row's id, `checked` for
|
|
530
|
+
* check/radio rows); opening or closing it sends `toggle` with `open`. As the last child of a split
|
|
531
|
+
* {@link TspButtonsProps} group it draws as the split's menu part. Pointer-only: it never takes focus.
|
|
532
|
+
*/
|
|
533
|
+
export interface TspMenuProps {
|
|
534
|
+
items?: readonly TspMenuItem[];
|
|
535
|
+
/** The trigger's label; without `text` and `icon` the trigger is a square … button. */
|
|
536
|
+
text?: string;
|
|
537
|
+
icon?: string;
|
|
538
|
+
trigger?: "default" | "quiet" | "primary";
|
|
539
|
+
/** A chevron after the label. */
|
|
540
|
+
caret?: boolean;
|
|
541
|
+
size?: "sm" | "md";
|
|
542
|
+
variant?: "default" | "dense";
|
|
543
|
+
/** Whether the menu shows; a change wins over the user's local open/close. */
|
|
544
|
+
open?: boolean;
|
|
545
|
+
/** The highlighted row's id (the program's keyboard cursor). */
|
|
546
|
+
active?: string;
|
|
547
|
+
/** Which trigger edge the menu lines up with. */
|
|
548
|
+
align?: "start" | "end";
|
|
549
|
+
/** The trigger is dimmed and does not open; a string is the reason. */
|
|
550
|
+
disabled?: boolean | string;
|
|
551
|
+
}
|
|
552
|
+
/** `button` children drawn as one control: joined, an action with its menu part (`split`), or a toolbar well. */
|
|
553
|
+
export interface TspButtonsProps {
|
|
554
|
+
variant?: "joined" | "split" | "toolbar";
|
|
555
|
+
/** The children's size, winning over their own. */
|
|
556
|
+
size?: "sm" | "md";
|
|
557
|
+
/** Accessible name of the group. */
|
|
558
|
+
label?: string;
|
|
559
|
+
}
|
|
433
560
|
export interface TspTabsProps {
|
|
434
561
|
items: readonly { id: string; label: TspText }[];
|
|
435
562
|
active?: string;
|
|
@@ -462,6 +589,8 @@ export interface TspEditorDecoration {
|
|
|
462
589
|
to: number;
|
|
463
590
|
s: string;
|
|
464
591
|
fx?: TspEffect;
|
|
592
|
+
/** An image blob the range stands for (an attachment token): copying the range copies the image. */
|
|
593
|
+
blob?: string;
|
|
465
594
|
}
|
|
466
595
|
export interface TspEditorProps {
|
|
467
596
|
text?: string;
|
|
@@ -517,6 +646,10 @@ export interface TspToastProps {
|
|
|
517
646
|
text: string;
|
|
518
647
|
sub?: string;
|
|
519
648
|
ttl?: number;
|
|
649
|
+
/** A button after the text (Undo): clicking it takes the toast down and sends this action for the node. */
|
|
650
|
+
action?: TspAction;
|
|
651
|
+
/** The button's text; defaults to the action's name labeled (`undo` → Undo). */
|
|
652
|
+
label?: string;
|
|
520
653
|
}
|
|
521
654
|
export interface TspRowsProps {
|
|
522
655
|
/** Width the rows were rendered at. */
|
|
@@ -608,6 +741,28 @@ export interface TspPickerAction {
|
|
|
608
741
|
end?: boolean;
|
|
609
742
|
/** A toggle's state (`Task model ⌥P`): drawn pressed when true. */
|
|
610
743
|
on?: boolean;
|
|
744
|
+
/** Drawn in the head as an icon-only button before its esc keycap (`icon`, else the label's initial), its label and keys as tooltip; `on` tints it. */
|
|
745
|
+
head?: boolean;
|
|
746
|
+
/** A head action's icon name. */
|
|
747
|
+
icon?: string;
|
|
748
|
+
disabled?: string | true;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/** A picker's stepped slider. */
|
|
752
|
+
export interface TspPickerLevel {
|
|
753
|
+
/** What it sets ("Thinking"): shown, or with `icon` its tooltip and accessible name. */
|
|
754
|
+
label: string;
|
|
755
|
+
/** An icon drawn in place of the label. */
|
|
756
|
+
icon?: string;
|
|
757
|
+
/** A dim note after the value in its chip (the model switcher: the highlighted model's provider). */
|
|
758
|
+
detail?: string;
|
|
759
|
+
/** Its steps, low to high: the terminal heats the track up the ladder (color, then motion). */
|
|
760
|
+
steps: readonly { id: string; label: string }[];
|
|
761
|
+
/** The current step's id. */
|
|
762
|
+
value: string;
|
|
763
|
+
/** The keys the program binds to step it, shown in its tooltip (`["alt", "left", "right"]`). */
|
|
764
|
+
keys?: readonly string[];
|
|
765
|
+
/** Drawn but frozen, the reason as its tooltip. */
|
|
611
766
|
disabled?: string | true;
|
|
612
767
|
}
|
|
613
768
|
|
|
@@ -633,6 +788,19 @@ export interface TspPickerProps {
|
|
|
633
788
|
/** Plural noun for counts and empty copy ("models", "sessions"). */
|
|
634
789
|
noun?: string;
|
|
635
790
|
size?: "md" | "lg" | "screen";
|
|
791
|
+
/**
|
|
792
|
+
* Where the sheet sits: absent, its size's place in the layer; `"composer"`, rising from the program's composer
|
|
793
|
+
* (its `composerPart: "composer"` column), left edges aligned — a drop-up for a picker acting on the draft, such as
|
|
794
|
+
* the model switcher. Placed as if absent while no composer is drawn, and on a phone.
|
|
795
|
+
*/
|
|
796
|
+
anchor?: "composer";
|
|
797
|
+
/**
|
|
798
|
+
* Where the search sits: the head (default), or `"list"`: no head row, the query leading the column heads' row
|
|
799
|
+
* (count and esc gone), head actions atop a `rail`. Ignored on a phone.
|
|
800
|
+
*/
|
|
801
|
+
search?: "head" | "list";
|
|
802
|
+
/** How tall rows run: regular (default), or `"snug"`: 30px rows and 26px group headers, the chrome tightened to match. Ignored on a phone. */
|
|
803
|
+
density?: "regular" | "snug";
|
|
636
804
|
layout?: "rows" | "cards" | "timeline" | "tree";
|
|
637
805
|
/** The program's search text (keys stay the program's); `null` hides the field. */
|
|
638
806
|
query?: string | null;
|
|
@@ -641,6 +809,8 @@ export interface TspPickerProps {
|
|
|
641
809
|
placeholder?: string;
|
|
642
810
|
scopes?: readonly TspPickerScope[];
|
|
643
811
|
scope?: string;
|
|
812
|
+
/** How `scopes` draw: a labeled column (default), or `"rail"`: icons only, label and count as the tooltip, kept on narrow sheets. A `group` change draws a separator. */
|
|
813
|
+
scopeStyle?: "column" | "rail";
|
|
644
814
|
tabs?: readonly { id: string; label: TspText; count?: number }[];
|
|
645
815
|
tab?: string;
|
|
646
816
|
columns?: readonly TspPickerColumn[];
|
|
@@ -667,6 +837,8 @@ export interface TspPickerProps {
|
|
|
667
837
|
items: readonly { id: string; label: TspText; on?: boolean; dot?: string }[];
|
|
668
838
|
selected?: string;
|
|
669
839
|
} | null;
|
|
840
|
+
/** A stepped slider docked above the action bar (the model switcher's thinking effort). A press or drag ending on another step sends `action {act:"level", value: <step id>}`. */
|
|
841
|
+
level?: TspPickerLevel | null;
|
|
670
842
|
state?: "ready" | "loading" | "error";
|
|
671
843
|
message?: TspText;
|
|
672
844
|
empty?: TspText;
|
|
@@ -947,12 +1119,15 @@ export interface TspShellProps {
|
|
|
947
1119
|
replayEpoch?: number;
|
|
948
1120
|
/** This mounted call received a real execution-start event, not a settled historical load. */
|
|
949
1121
|
liveOrigin?: boolean;
|
|
1122
|
+
/** The command text is still streaming in: the host marks its write head and the preview follows it. */
|
|
1123
|
+
stream?: boolean;
|
|
950
1124
|
/** Working directory shown ahead of the script when it differs from the project's. */
|
|
951
1125
|
cwd?: string;
|
|
952
1126
|
lang?: "bash" | "zsh";
|
|
953
1127
|
/**
|
|
954
|
-
* Clamp the command to
|
|
955
|
-
*
|
|
1128
|
+
* Clamp the command to `lines` drawn lines under an Expand button, the window following the write head
|
|
1129
|
+
* (`stream`), then the playhead, with the enclosing scope heads pinned; gives way inside an open
|
|
1130
|
+
* disclosure, and never applies in the inspector. The Raw/Pseudo switch and menu stay on the first visible line.
|
|
956
1131
|
*/
|
|
957
1132
|
preview?: { lines: number };
|
|
958
1133
|
}
|
|
@@ -973,6 +1148,7 @@ export interface TspPropsByKind {
|
|
|
973
1148
|
math: TspMathProps;
|
|
974
1149
|
image: TspImageProps;
|
|
975
1150
|
media: TspMediaProps;
|
|
1151
|
+
web: TspWebProps;
|
|
976
1152
|
kv: TspKvProps;
|
|
977
1153
|
table: TspTableProps;
|
|
978
1154
|
tree: TspTreeProps;
|
|
@@ -991,6 +1167,9 @@ export interface TspPropsByKind {
|
|
|
991
1167
|
editor: TspEditorProps;
|
|
992
1168
|
input: TspInputProps;
|
|
993
1169
|
button: TspButtonProps;
|
|
1170
|
+
buttons: TspButtonsProps;
|
|
1171
|
+
menu: TspMenuProps;
|
|
1172
|
+
doc: TspDocProps;
|
|
994
1173
|
status: TspStatusProps;
|
|
995
1174
|
seg: TspSegProps;
|
|
996
1175
|
overlay: TspOverlayProps;
|
|
@@ -1025,7 +1204,7 @@ export type TspPropNode = {
|
|
|
1025
1204
|
}[TspKind];
|
|
1026
1205
|
|
|
1027
1206
|
/** Kinds whose primary text the `text` and `splice` ops address (the `text` prop). */
|
|
1028
|
-
export const TSP_TEXT_KINDS = ["text", "md", "code", "ansi", "math", "editor", "input", "shimmer"] as const;
|
|
1207
|
+
export const TSP_TEXT_KINDS = ["text", "md", "code", "ansi", "math", "editor", "input", "shimmer", "doc"] as const;
|
|
1029
1208
|
|
|
1030
1209
|
/** A node on the wire. */
|
|
1031
1210
|
export type TspNode = {
|
|
@@ -1120,7 +1299,16 @@ export type TspEvent =
|
|
|
1120
1299
|
| { ev: "toggle"; sf: string; id: string; key?: string; collapsed: boolean }
|
|
1121
1300
|
| { ev: "select"; sf: string; id: string; item: string }
|
|
1122
1301
|
| { ev: "activate"; sf: string; id: string; item: string }
|
|
1123
|
-
|
|
1302
|
+
/** A click action; a `menu` check or radio row adds its new `checked` state. */
|
|
1303
|
+
| {
|
|
1304
|
+
ev: "action";
|
|
1305
|
+
sf: string;
|
|
1306
|
+
id: string;
|
|
1307
|
+
act: string;
|
|
1308
|
+
value?: string;
|
|
1309
|
+
mods?: readonly string[];
|
|
1310
|
+
checked?: boolean;
|
|
1311
|
+
}
|
|
1124
1312
|
/** A typed value changed by pointer (prefs rows, picker toggles); `null` resets to the default. */
|
|
1125
1313
|
| {
|
|
1126
1314
|
ev: "change";
|
|
@@ -1129,6 +1317,18 @@ export type TspEvent =
|
|
|
1129
1317
|
item: string;
|
|
1130
1318
|
value: boolean | number | string | readonly string[] | null;
|
|
1131
1319
|
}
|
|
1320
|
+
/** The user edited a `doc` (~300 ms after typing pauses, and when editing ends): `text` is its full new source. */
|
|
1321
|
+
| { ev: "change"; sf: string; id: string; text: string }
|
|
1322
|
+
/**
|
|
1323
|
+
* A comment on a `doc`: a new one on `quote` (`at` its UTF-16 offset in the source the user saw), or the
|
|
1324
|
+
* edited `note` of existing comment `comment`.
|
|
1325
|
+
*/
|
|
1326
|
+
| { ev: "comment"; sf: string; id: string; quote: string; at: number; note: string }
|
|
1327
|
+
| { ev: "comment"; sf: string; id: string; comment: string; note: string }
|
|
1328
|
+
/** Comment `comment` of a `doc` deleted. */
|
|
1329
|
+
| { ev: "uncomment"; sf: string; id: string; comment: string }
|
|
1330
|
+
/** In-place editing of a `doc` started (`on`) or ended. */
|
|
1331
|
+
| { ev: "editing"; sf: string; id: string; on: boolean }
|
|
1132
1332
|
/**
|
|
1133
1333
|
* An edit over the terminal's selection in an `editor`/`input` node: replace
|
|
1134
1334
|
* `[from, to)` with `text`, caret to `cursor` (UTF-16 offsets; `len` is the
|