@linxiraos/pi-wire 1.0.0 → 1.0.2
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 +7 -3
- package/package.json +53 -54
- package/dist/types/index.d.ts +0 -456
package/CHANGELOG.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- Reset the version to 1.0.0 and republished under the `@linxiraos/*` scope, breaking from the `@oh-my-pi` version lineage.
|
|
5
|
+
## [1.0.2] - 2026-08-15
|
|
8
6
|
|
|
9
7
|
## [16.3.0] - 2026-07-02
|
|
10
8
|
|
|
@@ -42,3 +40,9 @@
|
|
|
42
40
|
### Added
|
|
43
41
|
|
|
44
42
|
- Added shared collab live-session wire contracts for the host CLI and browser guest client.
|
|
43
|
+
|
|
44
|
+
## [1.0.0] - 2026-08-13
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- Reset the version to 1.0.0 and republished under the `@linxiraos/*` scope, breaking from the `@oh-my-pi` version lineage.
|
package/package.json
CHANGED
|
@@ -1,56 +1,55 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
2
|
+
"type": "module",
|
|
3
|
+
"name": "@linxiraos/pi-wire",
|
|
4
|
+
"version": "1.0.2",
|
|
5
|
+
"description": "Shared wire protocol types for Oh My Pi packages",
|
|
6
|
+
"homepage": "https://linxira-os.github.io",
|
|
7
|
+
"author": "Can Boluk",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/Linxira-OS/linxira-zeta.git",
|
|
12
|
+
"directory": "packages/wire"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/can1357/oh-my-pi/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"wire",
|
|
19
|
+
"protocol",
|
|
20
|
+
"types",
|
|
21
|
+
"collab"
|
|
22
|
+
],
|
|
23
|
+
"main": "./src/index.ts",
|
|
24
|
+
"types": "./src/index.ts",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"check": "biome check . && bun run check:types",
|
|
27
|
+
"check:types": "tsgo -p tsconfig.json --noEmit",
|
|
28
|
+
"lint": "biome lint .",
|
|
29
|
+
"fix": "biome check --write --unsafe .",
|
|
30
|
+
"fmt": "biome format --write .",
|
|
31
|
+
"test": "bun test --parallel"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/bun": "catalog:"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"bun": ">=1.3.14"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"src",
|
|
41
|
+
"README.md",
|
|
42
|
+
"CHANGELOG.md"
|
|
43
|
+
],
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"types": "./src/index.ts",
|
|
47
|
+
"import": "./src/index.ts"
|
|
48
|
+
},
|
|
49
|
+
"./*": {
|
|
50
|
+
"types": "./src/*.ts",
|
|
51
|
+
"import": "./src/*.ts"
|
|
52
|
+
},
|
|
53
|
+
"./*.js": "./src/*.ts"
|
|
54
|
+
}
|
|
56
55
|
}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,456 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared wire types for the omp collab live-session protocol.
|
|
3
|
-
*
|
|
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.
|
|
12
|
-
*/
|
|
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
|
-
/** 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
|
-
}
|
|
135
|
-
export type AgentEvent = {
|
|
136
|
-
type: "agent_start";
|
|
137
|
-
} | {
|
|
138
|
-
type: "agent_end";
|
|
139
|
-
} | {
|
|
140
|
-
type: "turn_start";
|
|
141
|
-
} | {
|
|
142
|
-
type: "turn_end";
|
|
143
|
-
} | {
|
|
144
|
-
type: "message_start";
|
|
145
|
-
message: WireMessage;
|
|
146
|
-
}
|
|
147
|
-
/** Carries the FULL accumulating partial message — no delta tracking needed. */
|
|
148
|
-
| {
|
|
149
|
-
type: "message_update";
|
|
150
|
-
message: WireMessage;
|
|
151
|
-
} | {
|
|
152
|
-
type: "message_end";
|
|
153
|
-
message: WireMessage;
|
|
154
|
-
} | {
|
|
155
|
-
type: "tool_execution_start";
|
|
156
|
-
toolCallId: string;
|
|
157
|
-
toolName: string;
|
|
158
|
-
args: unknown;
|
|
159
|
-
intent?: string;
|
|
160
|
-
} | {
|
|
161
|
-
type: "tool_execution_update";
|
|
162
|
-
toolCallId: string;
|
|
163
|
-
toolName: string;
|
|
164
|
-
args: unknown;
|
|
165
|
-
partialResult: unknown;
|
|
166
|
-
} | {
|
|
167
|
-
type: "tool_execution_end";
|
|
168
|
-
toolCallId: string;
|
|
169
|
-
toolName: string;
|
|
170
|
-
result: unknown;
|
|
171
|
-
isError?: boolean;
|
|
172
|
-
} | {
|
|
173
|
-
type: "notice";
|
|
174
|
-
level: "info" | "warning" | "error";
|
|
175
|
-
message: string;
|
|
176
|
-
source?: string;
|
|
177
|
-
} | {
|
|
178
|
-
type: "auto_compaction_start";
|
|
179
|
-
reason: string;
|
|
180
|
-
action: string;
|
|
181
|
-
} | {
|
|
182
|
-
type: "auto_compaction_end";
|
|
183
|
-
aborted: boolean;
|
|
184
|
-
willRetry: boolean;
|
|
185
|
-
errorMessage?: string;
|
|
186
|
-
skipped?: boolean;
|
|
187
|
-
} | {
|
|
188
|
-
type: "auto_retry_start";
|
|
189
|
-
attempt: number;
|
|
190
|
-
maxAttempts: number;
|
|
191
|
-
delayMs: number;
|
|
192
|
-
errorMessage: string;
|
|
193
|
-
} | {
|
|
194
|
-
type: "auto_retry_end";
|
|
195
|
-
success: boolean;
|
|
196
|
-
attempt: number;
|
|
197
|
-
finalError?: string;
|
|
198
|
-
} | {
|
|
199
|
-
type: "thinking_level_changed";
|
|
200
|
-
thinkingLevel?: string;
|
|
201
|
-
};
|
|
202
|
-
export interface WireModel {
|
|
203
|
-
id: string;
|
|
204
|
-
name: string;
|
|
205
|
-
provider: string;
|
|
206
|
-
contextWindow: number | null;
|
|
207
|
-
}
|
|
208
|
-
export interface ContextUsage {
|
|
209
|
-
tokens: number | null;
|
|
210
|
-
contextWindow: number | null;
|
|
211
|
-
percent: number | null;
|
|
212
|
-
}
|
|
213
|
-
export interface Participant {
|
|
214
|
-
name: string;
|
|
215
|
-
role: "host" | "guest";
|
|
216
|
-
/** True when the guest joined through a read-only (view) link. */
|
|
217
|
-
readOnly?: boolean;
|
|
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
|
-
currentToolStartMs?: number;
|
|
254
|
-
recentTools: {
|
|
255
|
-
tool: string;
|
|
256
|
-
args: string;
|
|
257
|
-
endMs: number;
|
|
258
|
-
}[];
|
|
259
|
-
recentOutput: string[];
|
|
260
|
-
toolCount: number;
|
|
261
|
-
requests: number;
|
|
262
|
-
tokens: number;
|
|
263
|
-
contextTokens?: number;
|
|
264
|
-
contextWindow?: number;
|
|
265
|
-
cost: number;
|
|
266
|
-
durationMs: number;
|
|
267
|
-
resolvedModel?: string;
|
|
268
|
-
}
|
|
269
|
-
export interface SubagentProgressPayload {
|
|
270
|
-
index: number;
|
|
271
|
-
agent: string;
|
|
272
|
-
task: string;
|
|
273
|
-
parentToolCallId?: string;
|
|
274
|
-
assignment?: string;
|
|
275
|
-
progress: AgentProgress;
|
|
276
|
-
sessionFile?: string;
|
|
277
|
-
}
|
|
278
|
-
export interface SubagentLifecyclePayload {
|
|
279
|
-
id: string;
|
|
280
|
-
agent: string;
|
|
281
|
-
description?: string;
|
|
282
|
-
status: "started" | "completed" | "failed" | "aborted";
|
|
283
|
-
sessionFile?: string;
|
|
284
|
-
parentToolCallId?: string;
|
|
285
|
-
index: number;
|
|
286
|
-
}
|
|
287
|
-
export type CollabUiSelectItem = string | {
|
|
288
|
-
label: string;
|
|
289
|
-
description?: string;
|
|
290
|
-
};
|
|
291
|
-
export type CollabUiResponseValue = string | undefined;
|
|
292
|
-
export type CollabUiRequestDraft = {
|
|
293
|
-
kind: "select";
|
|
294
|
-
title: string;
|
|
295
|
-
options: CollabUiSelectItem[];
|
|
296
|
-
initialIndex?: number;
|
|
297
|
-
selectionMarker?: "radio" | "checkbox";
|
|
298
|
-
checkedIndices?: number[];
|
|
299
|
-
markableCount?: number;
|
|
300
|
-
helpText?: string;
|
|
301
|
-
} | {
|
|
302
|
-
kind: "editor";
|
|
303
|
-
title: string;
|
|
304
|
-
prefill?: string;
|
|
305
|
-
};
|
|
306
|
-
export type CollabUiRequest = CollabUiRequestDraft & {
|
|
307
|
-
reqId: number;
|
|
308
|
-
};
|
|
309
|
-
export type GuestFrame = {
|
|
310
|
-
t: "hello";
|
|
311
|
-
proto: number;
|
|
312
|
-
name: string;
|
|
313
|
-
/**
|
|
314
|
-
* base64url write token proving full-link possession; absent for
|
|
315
|
-
* read-only (view) links. The host marks peers without a valid token
|
|
316
|
-
* read-only and rejects their mutating frames.
|
|
317
|
-
*/
|
|
318
|
-
writeToken?: string;
|
|
319
|
-
} | {
|
|
320
|
-
t: "prompt";
|
|
321
|
-
text: string;
|
|
322
|
-
images?: ImageContent[];
|
|
323
|
-
} | {
|
|
324
|
-
t: "ui-response";
|
|
325
|
-
reqId: number;
|
|
326
|
-
value?: CollabUiResponseValue;
|
|
327
|
-
} | {
|
|
328
|
-
t: "abort";
|
|
329
|
-
} | {
|
|
330
|
-
t: "agent-cmd";
|
|
331
|
-
cmd: "chat" | "kill" | "revive";
|
|
332
|
-
agentId: string;
|
|
333
|
-
text?: string;
|
|
334
|
-
} | {
|
|
335
|
-
t: "fetch-transcript";
|
|
336
|
-
reqId: number;
|
|
337
|
-
agentId: string;
|
|
338
|
-
fromByte: number;
|
|
339
|
-
};
|
|
340
|
-
/** EventBus channels mirrored to guests (task subagent traffic only). */
|
|
341
|
-
export type BusChannel = "task:subagent:progress" | "task:subagent:lifecycle";
|
|
342
|
-
export type HostFrame = {
|
|
343
|
-
t: "welcome";
|
|
344
|
-
proto: number;
|
|
345
|
-
header: SessionHeader;
|
|
346
|
-
state: SessionState;
|
|
347
|
-
agents: AgentSnapshot[];
|
|
348
|
-
/**
|
|
349
|
-
* Total number of `SessionEntry` items the host will deliver in the
|
|
350
|
-
* `snapshot-chunk` frames that follow. Guests stay in the loading
|
|
351
|
-
* phase until they have accumulated all of them (or a chunk arrives
|
|
352
|
-
* with `final: true`).
|
|
353
|
-
*/
|
|
354
|
-
entryCount: number;
|
|
355
|
-
/** True when this peer joined through a read-only (view) link. */
|
|
356
|
-
readOnly?: boolean;
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* Targeted snapshot fragment delivered after `welcome`. Hosts split the
|
|
360
|
-
* transcript into chunks bounded by byte size so a multi-MB session is not
|
|
361
|
-
* forced through one giant frame the relay may stall on. The last chunk
|
|
362
|
-
* carries `final: true`; guests finalize the replica on that frame.
|
|
363
|
-
*/
|
|
364
|
-
| {
|
|
365
|
-
t: "snapshot-chunk";
|
|
366
|
-
entries: SessionEntry[];
|
|
367
|
-
final: boolean;
|
|
368
|
-
} | {
|
|
369
|
-
t: "entry";
|
|
370
|
-
entry: SessionEntry;
|
|
371
|
-
} | {
|
|
372
|
-
t: "event";
|
|
373
|
-
event: AgentEvent;
|
|
374
|
-
} | {
|
|
375
|
-
t: "state";
|
|
376
|
-
state: SessionState;
|
|
377
|
-
}
|
|
378
|
-
/** Mirrored EventBus traffic (task subagent lifecycle/progress channels only). */
|
|
379
|
-
| {
|
|
380
|
-
t: "bus";
|
|
381
|
-
channel: BusChannel;
|
|
382
|
-
data: unknown;
|
|
383
|
-
} | {
|
|
384
|
-
t: "agents";
|
|
385
|
-
agents: AgentSnapshot[];
|
|
386
|
-
} | {
|
|
387
|
-
t: "ui-request";
|
|
388
|
-
request: CollabUiRequest;
|
|
389
|
-
} | {
|
|
390
|
-
t: "ui-request-end";
|
|
391
|
-
reqId: number;
|
|
392
|
-
}
|
|
393
|
-
/** Targeted reply to fetch-transcript; `text` is decoded JSONL from `fromByte`, `newSize` the next offset base. */
|
|
394
|
-
| {
|
|
395
|
-
t: "transcript";
|
|
396
|
-
reqId: number;
|
|
397
|
-
text: string;
|
|
398
|
-
newSize: number;
|
|
399
|
-
error?: string;
|
|
400
|
-
} | {
|
|
401
|
-
t: "bye";
|
|
402
|
-
reason: string;
|
|
403
|
-
} | {
|
|
404
|
-
t: "error";
|
|
405
|
-
message: string;
|
|
406
|
-
};
|
|
407
|
-
export type WireFrame = GuestFrame | HostFrame;
|
|
408
|
-
/**
|
|
409
|
-
* Wire protocol version carried in `hello`; the host rejects mismatches.
|
|
410
|
-
*
|
|
411
|
-
* - `1` (legacy): `welcome` carried the full `entries` array inline.
|
|
412
|
-
* - `2`: `welcome` carries only metadata (header/state/agents/entryCount);
|
|
413
|
-
* transcript entries follow in `snapshot-chunk` frames, so multi-MB
|
|
414
|
-
* sessions are not gated on a single welcome frame fitting under the
|
|
415
|
-
* guest's first-welcome timeout.
|
|
416
|
-
* - `3`: host asks guests through `ui-request`/`ui-request-end` host frames
|
|
417
|
-
* answered by the `ui-response` guest frame. Guests that predate the
|
|
418
|
-
* grammar would silently drop `ui-request` (asks hang forever on the
|
|
419
|
-
* host), so they must be rejected at hello.
|
|
420
|
-
*/
|
|
421
|
-
export declare const COLLAB_PROTO = 3;
|
|
422
|
-
/** Parameter key used for intent tracing (e.g. prompt explanation/reasoning) */
|
|
423
|
-
export declare const INTENT_FIELD = "i";
|
|
424
|
-
/** Plaintext envelope prefix: `[4B uint32 BE peerId][sealed payload]`. */
|
|
425
|
-
export declare const ENVELOPE_HEADER_LENGTH = 4;
|
|
426
|
-
export declare const ROOM_ID_BYTES = 16;
|
|
427
|
-
/** AES-256-GCM room key; the seal key for every collab frame. */
|
|
428
|
-
export declare const ROOM_KEY_BYTES = 32;
|
|
429
|
-
/**
|
|
430
|
-
* Random write token appended to the room key in full links
|
|
431
|
-
* (`base64url(key ∥ token)`); view links carry the bare key. Possession
|
|
432
|
-
* proves prompt/abort/agent-cmd capability to the host.
|
|
433
|
-
*/
|
|
434
|
-
export declare const WRITE_TOKEN_BYTES = 16;
|
|
435
|
-
/** Default public relay; bare `<roomId>.<key>` links resolve against it. */
|
|
436
|
-
export declare const DEFAULT_RELAY_URL = "wss://my.omp.sh";
|
|
437
|
-
/** Default share viewer/upload base; `/share` links resolve against `<base>/<id>#<key>`. */
|
|
438
|
-
export declare const DEFAULT_SHARE_URL = "https://my.omp.sh/s";
|
|
439
|
-
export interface ParsedCollabLink {
|
|
440
|
-
/** wss://host[:port]/r/<roomId> — no query, no fragment. */
|
|
441
|
-
wsUrl: string;
|
|
442
|
-
roomId: string;
|
|
443
|
-
key: Uint8Array;
|
|
444
|
-
/** Write token from a full link; absent for read-only (view) links. */
|
|
445
|
-
writeToken?: Uint8Array;
|
|
446
|
-
}
|
|
447
|
-
/** Relay → host control message. */
|
|
448
|
-
export type RelayControlToHost = {
|
|
449
|
-
t: "peer-joined" | "peer-left";
|
|
450
|
-
peer: number;
|
|
451
|
-
};
|
|
452
|
-
/** Relay → guest control message. */
|
|
453
|
-
export type RelayControlToGuest = {
|
|
454
|
-
t: "room-closed";
|
|
455
|
-
};
|
|
456
|
-
export type RelayControlMessage = RelayControlToHost | RelayControlToGuest;
|