@linkshell/wire 0.2.2 → 0.2.3
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/dist/computer-preview.d.ts +35 -0
- package/dist/computer-preview.js +51 -0
- package/dist/computer-preview.js.map +1 -0
- package/dist/goal.d.ts +66 -0
- package/dist/goal.js +19 -0
- package/dist/goal.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/model.d.ts +92 -14
- package/dist/model.js +31 -0
- package/dist/model.js.map +1 -1
- package/dist/rpc.d.ts +1654 -511
- package/dist/rpc.js +41 -1
- package/dist/rpc.js.map +1 -1
- package/dist/updates.d.ts +560 -248
- package/dist/updates.js +11 -1
- package/dist/updates.js.map +1 -1
- package/dist/workflow.d.ts +8 -8
- package/package.json +1 -1
- package/src/computer-preview.ts +49 -0
- package/src/goal.ts +22 -0
- package/src/index.ts +2 -0
- package/src/model.ts +35 -0
- package/src/rpc.ts +41 -0
- package/src/updates.ts +11 -1
package/dist/updates.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { sessionGoalSchema } from "./goal.js";
|
|
3
|
+
import { backgroundTaskSchema, permissionOptionSchema, questionAnswerSchema, questionSchema, sessionDriverSchema, sessionStateSchema, toolKindSchema } from "./model.js";
|
|
3
4
|
import { workflowAgentStateSchema, workflowSchema } from "./workflow.js";
|
|
4
5
|
// Session updates mirror ACP's `SessionUpdate` shapes (discriminated by
|
|
5
6
|
// `sessionUpdate`) so one renderer works for every agent. LinkShell-specific
|
|
@@ -134,6 +135,10 @@ export const sessionUpdateSchema = z.discriminatedUnion("sessionUpdate", [
|
|
|
134
135
|
sessionUpdate: z.literal("plan"),
|
|
135
136
|
entries: z.array(planEntrySchema),
|
|
136
137
|
}),
|
|
138
|
+
z.object({
|
|
139
|
+
sessionUpdate: z.literal("ls_goal"),
|
|
140
|
+
goal: sessionGoalSchema.nullable(),
|
|
141
|
+
}),
|
|
137
142
|
z.object({
|
|
138
143
|
sessionUpdate: z.literal("available_commands_update"),
|
|
139
144
|
availableCommands: z.array(z.object({ name: z.string(), description: z.string(), hint: z.string().optional() })),
|
|
@@ -208,6 +213,11 @@ export const sessionUpdateSchema = z.discriminatedUnion("sessionUpdate", [
|
|
|
208
213
|
sessionUpdate: z.literal("ls_status"),
|
|
209
214
|
state: sessionStateSchema,
|
|
210
215
|
}),
|
|
216
|
+
/** A background task as it is now (the whole record each time: the latest for its id holds). */
|
|
217
|
+
z.object({
|
|
218
|
+
sessionUpdate: z.literal("ls_task"),
|
|
219
|
+
task: backgroundTaskSchema,
|
|
220
|
+
}),
|
|
211
221
|
z.object({
|
|
212
222
|
sessionUpdate: z.literal("ls_error"),
|
|
213
223
|
code: z.string(),
|
package/dist/updates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updates.js","sourceRoot":"","sources":["../src/updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"updates.js","sourceRoot":"","sources":["../src/updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACzK,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEzE,wEAAwE;AACxE,6EAA6E;AAC7E,gCAAgC;AAEh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z.ZodObject<{
|
|
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
|
21
21
|
id: string;
|
|
22
22
|
title: string;
|
|
23
|
-
state: "
|
|
23
|
+
state: "unknown" | "paused" | "running" | "completed" | "failed" | "stopped" | "pending";
|
|
24
24
|
toolCallId?: string | undefined;
|
|
25
25
|
phaseId?: string | undefined;
|
|
26
26
|
model?: string | undefined;
|
|
@@ -33,7 +33,7 @@ export declare const workflowAgentSchema: z.ZodObject<{
|
|
|
33
33
|
}, {
|
|
34
34
|
id: string;
|
|
35
35
|
title: string;
|
|
36
|
-
state: "
|
|
36
|
+
state: "unknown" | "paused" | "running" | "completed" | "failed" | "stopped" | "pending";
|
|
37
37
|
toolCallId?: string | undefined;
|
|
38
38
|
phaseId?: string | undefined;
|
|
39
39
|
model?: string | undefined;
|
|
@@ -101,7 +101,7 @@ export declare const workflowSchema: z.ZodObject<{
|
|
|
101
101
|
}, "strip", z.ZodTypeAny, {
|
|
102
102
|
id: string;
|
|
103
103
|
title: string;
|
|
104
|
-
state: "
|
|
104
|
+
state: "unknown" | "paused" | "running" | "completed" | "failed" | "stopped" | "pending";
|
|
105
105
|
toolCallId?: string | undefined;
|
|
106
106
|
phaseId?: string | undefined;
|
|
107
107
|
model?: string | undefined;
|
|
@@ -114,7 +114,7 @@ export declare const workflowSchema: z.ZodObject<{
|
|
|
114
114
|
}, {
|
|
115
115
|
id: string;
|
|
116
116
|
title: string;
|
|
117
|
-
state: "
|
|
117
|
+
state: "unknown" | "paused" | "running" | "completed" | "failed" | "stopped" | "pending";
|
|
118
118
|
toolCallId?: string | undefined;
|
|
119
119
|
phaseId?: string | undefined;
|
|
120
120
|
model?: string | undefined;
|
|
@@ -127,7 +127,7 @@ export declare const workflowSchema: z.ZodObject<{
|
|
|
127
127
|
}>, "many">>;
|
|
128
128
|
}, "strip", z.ZodTypeAny, {
|
|
129
129
|
completed?: number | undefined;
|
|
130
|
-
state?: "
|
|
130
|
+
state?: "paused" | "running" | "completed" | "failed" | "stopped" | undefined;
|
|
131
131
|
tokens?: number | undefined;
|
|
132
132
|
durationMs?: number | undefined;
|
|
133
133
|
startedAt?: number | undefined;
|
|
@@ -143,7 +143,7 @@ export declare const workflowSchema: z.ZodObject<{
|
|
|
143
143
|
agents?: {
|
|
144
144
|
id: string;
|
|
145
145
|
title: string;
|
|
146
|
-
state: "
|
|
146
|
+
state: "unknown" | "paused" | "running" | "completed" | "failed" | "stopped" | "pending";
|
|
147
147
|
toolCallId?: string | undefined;
|
|
148
148
|
phaseId?: string | undefined;
|
|
149
149
|
model?: string | undefined;
|
|
@@ -156,7 +156,7 @@ export declare const workflowSchema: z.ZodObject<{
|
|
|
156
156
|
}[] | undefined;
|
|
157
157
|
}, {
|
|
158
158
|
completed?: number | undefined;
|
|
159
|
-
state?: "
|
|
159
|
+
state?: "paused" | "running" | "completed" | "failed" | "stopped" | undefined;
|
|
160
160
|
tokens?: number | undefined;
|
|
161
161
|
durationMs?: number | undefined;
|
|
162
162
|
startedAt?: number | undefined;
|
|
@@ -172,7 +172,7 @@ export declare const workflowSchema: z.ZodObject<{
|
|
|
172
172
|
agents?: {
|
|
173
173
|
id: string;
|
|
174
174
|
title: string;
|
|
175
|
-
state: "
|
|
175
|
+
state: "unknown" | "paused" | "running" | "completed" | "failed" | "stopped" | "pending";
|
|
176
176
|
toolCallId?: string | undefined;
|
|
177
177
|
phaseId?: string | undefined;
|
|
178
178
|
model?: string | undefined;
|
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const PREVIEW_MAX_BYTES = 48 * 1024;
|
|
4
|
+
export const previewFrameSchema = z.object({
|
|
5
|
+
id: z.string().regex(/^[a-f0-9]{64}$/),
|
|
6
|
+
target: z.string().max(1024),
|
|
7
|
+
capturedAt: z.number().finite().nonnegative(),
|
|
8
|
+
width: z.number().int().positive().max(2048),
|
|
9
|
+
height: z.number().int().positive().max(2048),
|
|
10
|
+
mimeType: z.literal("image/webp"),
|
|
11
|
+
});
|
|
12
|
+
export type PreviewFrameInfo = z.infer<typeof previewFrameSchema>;
|
|
13
|
+
export interface PreviewFrame extends PreviewFrameInfo { bytes: Uint8Array }
|
|
14
|
+
|
|
15
|
+
/** Length-prefixed metadata and image bytes, inside an authenticated proxy stream. */
|
|
16
|
+
export function encodePreviewFrame(frame: PreviewFrame): Uint8Array {
|
|
17
|
+
const { bytes, ...info } = frame;
|
|
18
|
+
const metadata = new TextEncoder().encode(JSON.stringify(previewFrameSchema.parse(info)));
|
|
19
|
+
if (bytes.length > PREVIEW_MAX_BYTES) throw new Error("preview image too large");
|
|
20
|
+
const packet = new Uint8Array(8 + metadata.length + bytes.length);
|
|
21
|
+
const header = new DataView(packet.buffer);
|
|
22
|
+
header.setUint32(0, metadata.length);
|
|
23
|
+
header.setUint32(4, bytes.length);
|
|
24
|
+
packet.set(metadata, 8);
|
|
25
|
+
packet.set(bytes, 8 + metadata.length);
|
|
26
|
+
return packet;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Handles split TCP/data-channel chunks without accepting unbounded allocations. */
|
|
30
|
+
export class PreviewFrameDecoder {
|
|
31
|
+
private held = new Uint8Array(0);
|
|
32
|
+
push(chunk: Uint8Array): PreviewFrame[] {
|
|
33
|
+
if (this.held.length + chunk.length > PREVIEW_MAX_BYTES + 4104) throw new Error("preview buffer too large");
|
|
34
|
+
const next = new Uint8Array(this.held.length + chunk.length);
|
|
35
|
+
next.set(this.held); next.set(chunk, this.held.length); this.held = next;
|
|
36
|
+
const frames: PreviewFrame[] = [];
|
|
37
|
+
while (this.held.length >= 8) {
|
|
38
|
+
const header = new DataView(this.held.buffer, this.held.byteOffset);
|
|
39
|
+
const meta = header.getUint32(0), size = header.getUint32(4);
|
|
40
|
+
if (meta > 4096 || size > PREVIEW_MAX_BYTES || !meta || !size) throw new Error("invalid preview frame");
|
|
41
|
+
const total = 8 + meta + size;
|
|
42
|
+
if (this.held.length < total) break;
|
|
43
|
+
const info = previewFrameSchema.parse(JSON.parse(new TextDecoder().decode(this.held.subarray(8, 8 + meta))));
|
|
44
|
+
frames.push({ ...info, bytes: this.held.slice(8 + meta, total) });
|
|
45
|
+
this.held = this.held.slice(total);
|
|
46
|
+
}
|
|
47
|
+
return frames;
|
|
48
|
+
}
|
|
49
|
+
}
|
package/src/goal.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/** Native agent state, not inferred from prose or a completed turn. */
|
|
4
|
+
export const sessionGoalSchema = z.object({
|
|
5
|
+
objective: z.string(),
|
|
6
|
+
status: z.enum(["active", "paused", "blocked", "usageLimited", "budgetLimited", "complete"]),
|
|
7
|
+
tokenBudget: z.number().nonnegative().nullable().optional(),
|
|
8
|
+
tokensUsed: z.number().nonnegative().optional(),
|
|
9
|
+
timeUsedSeconds: z.number().nonnegative().optional(),
|
|
10
|
+
iterations: z.number().int().nonnegative().optional(),
|
|
11
|
+
lastReason: z.string().nullable().optional(),
|
|
12
|
+
});
|
|
13
|
+
export type SessionGoal = z.infer<typeof sessionGoalSchema>;
|
|
14
|
+
|
|
15
|
+
export const goalChangeSchema = z.discriminatedUnion("action", [
|
|
16
|
+
z.object({ action: z.literal("get") }),
|
|
17
|
+
z.object({ action: z.literal("set"), objective: z.string().trim().min(1).max(4000), tokenBudget: z.number().int().positive().max(Number.MAX_SAFE_INTEGER).optional() }),
|
|
18
|
+
z.object({ action: z.literal("pause") }),
|
|
19
|
+
z.object({ action: z.literal("resume") }),
|
|
20
|
+
z.object({ action: z.literal("clear") }),
|
|
21
|
+
]);
|
|
22
|
+
export type GoalChange = z.infer<typeof goalChangeSchema>;
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./model.js";
|
|
2
|
+
export * from "./goal.js";
|
|
2
3
|
export * from "./updates.js";
|
|
3
4
|
export * from "./workflow.js";
|
|
4
5
|
export * from "./rpc.js";
|
|
@@ -8,3 +9,4 @@ export * from "./crypto.js";
|
|
|
8
9
|
export * from "./relay.js";
|
|
9
10
|
export * from "./relay-client.js";
|
|
10
11
|
export * from "./direct.js";
|
|
12
|
+
export * from "./computer-preview.js";
|
package/src/model.ts
CHANGED
|
@@ -166,6 +166,39 @@ export const subagentInfoSchema = z.object({
|
|
|
166
166
|
});
|
|
167
167
|
export type SubagentInfo = z.infer<typeof subagentInfoSchema>;
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* A command the agent left running after its call returned (a background
|
|
171
|
+
* shell, a dev server, a watcher). Sub-agents and workflows are not tasks:
|
|
172
|
+
* they have their own records (`SubagentInfo`).
|
|
173
|
+
*/
|
|
174
|
+
export const backgroundTaskStateSchema = z.enum(["running", "completed", "failed", "stopped", "unknown"]);
|
|
175
|
+
export type BackgroundTaskState = z.infer<typeof backgroundTaskStateSchema>;
|
|
176
|
+
|
|
177
|
+
export const backgroundTaskSchema = z.object({
|
|
178
|
+
/** The agent's own id for it. */
|
|
179
|
+
id: z.string(),
|
|
180
|
+
/** shell: a command; monitor: a command whose output the agent is told about as it comes. */
|
|
181
|
+
kind: z.enum(["shell", "monitor"]),
|
|
182
|
+
/** The tool call that started it. */
|
|
183
|
+
toolCallId: z.string().optional(),
|
|
184
|
+
title: z.string(),
|
|
185
|
+
command: z.string().optional(),
|
|
186
|
+
/** `unknown`: it was running when the host lost track of it (its agent quit without saying how it ended). */
|
|
187
|
+
state: backgroundTaskStateSchema,
|
|
188
|
+
startedAt: z.number(),
|
|
189
|
+
endedAt: z.number().optional(),
|
|
190
|
+
/** How it ended, or the latest thing it reported, as the agent says it. */
|
|
191
|
+
summary: z.string().optional(),
|
|
192
|
+
exitCode: z.number().int().optional(),
|
|
193
|
+
/** Its output can be read (`sessions.taskOutput`). */
|
|
194
|
+
output: z.boolean().optional(),
|
|
195
|
+
/** It can be stopped from here (`sessions.stopTask`). */
|
|
196
|
+
canStop: z.boolean().optional(),
|
|
197
|
+
/** Orders list snapshots against events arriving while the request is in flight. */
|
|
198
|
+
lastSeq: z.number().int().nonnegative().optional(),
|
|
199
|
+
});
|
|
200
|
+
export type BackgroundTask = z.infer<typeof backgroundTaskSchema>;
|
|
201
|
+
|
|
169
202
|
export const sessionSummarySchema = z.object({
|
|
170
203
|
/** `${agent}:${nativeId}` — stable across daemon restarts and rediscovery. */
|
|
171
204
|
id: z.string().min(1),
|
|
@@ -198,6 +231,8 @@ export const sessionSummarySchema = z.object({
|
|
|
198
231
|
worktree: z.object({ branch: z.string(), source: z.string() }).optional(),
|
|
199
232
|
/** Live only, for sessions that started sub-agents: how many, and how many are working now (`sessions.subagents` lists them). */
|
|
200
233
|
subagents: z.object({ total: z.number().int(), running: z.number().int() }).optional(),
|
|
234
|
+
/** Live only, for sessions that left commands running: how many, and how many still run (`sessions.tasks` lists them). */
|
|
235
|
+
tasks: z.object({ total: z.number().int(), running: z.number().int() }).optional(),
|
|
201
236
|
});
|
|
202
237
|
export type SessionSummary = z.infer<typeof sessionSummarySchema>;
|
|
203
238
|
|
package/src/rpc.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { goalChangeSchema, sessionGoalSchema } from "./goal.js";
|
|
2
3
|
import {
|
|
4
|
+
backgroundTaskSchema,
|
|
3
5
|
gatewayStatusSchema,
|
|
4
6
|
machineInfoSchema,
|
|
5
7
|
portInfoSchema,
|
|
@@ -159,6 +161,40 @@ export const methods = {
|
|
|
159
161
|
params: z.object({ sessionId: z.string().min(1), toolCallId: z.string().min(1), lazyImages: z.boolean().optional() }),
|
|
160
162
|
result: z.object({ events: z.array(sessionEventSchema) }),
|
|
161
163
|
},
|
|
164
|
+
/** The commands this session left running in the background, and the ones that have ended; newest first. */
|
|
165
|
+
"sessions.tasks": {
|
|
166
|
+
params: z.object({ sessionId: z.string().min(1) }),
|
|
167
|
+
result: z.object({ tasks: z.array(backgroundTaskSchema) }),
|
|
168
|
+
},
|
|
169
|
+
/**
|
|
170
|
+
* A background task's output, a piece at a time from the end: the text
|
|
171
|
+
* before byte `before` (default: the end), at most `limit` bytes. `start` is
|
|
172
|
+
* where that text begins (0: the beginning); `size` is the whole output's.
|
|
173
|
+
*/
|
|
174
|
+
"sessions.taskOutput": {
|
|
175
|
+
params: z.object({
|
|
176
|
+
sessionId: z.string().min(1),
|
|
177
|
+
taskId: z.string().min(1),
|
|
178
|
+
before: z.number().int().nonnegative().optional(),
|
|
179
|
+
limit: z.number().int().positive().max(256 * 1024).optional(),
|
|
180
|
+
}),
|
|
181
|
+
result: z.object({ text: z.string(), start: z.number().int().nonnegative(), size: z.number().int().nonnegative() }),
|
|
182
|
+
},
|
|
183
|
+
/** Stops one background task, leaving the session's turn and its other tasks alone. */
|
|
184
|
+
"sessions.stopTask": {
|
|
185
|
+
params: z.object({ sessionId: z.string().min(1), taskId: z.string().min(1) }),
|
|
186
|
+
result: empty,
|
|
187
|
+
},
|
|
188
|
+
/** Opens a read-only computer-use preview through the existing bulk-stream transport. */
|
|
189
|
+
"sessions.preview": {
|
|
190
|
+
params: z.object({ sessionId: z.string().min(1), direct: z.boolean().optional() }),
|
|
191
|
+
result: z.object({ port: z.number().int().positive(), token: z.string() }),
|
|
192
|
+
},
|
|
193
|
+
/** Explicit local user action; normal frame updates never reopen a dismissed preview. */
|
|
194
|
+
"desktop.preview.show": {
|
|
195
|
+
params: z.object({ sessionId: z.string().min(1) }),
|
|
196
|
+
result: empty,
|
|
197
|
+
},
|
|
162
198
|
/** The picture behind a `linkshell-event:` uri. */
|
|
163
199
|
"sessions.image": {
|
|
164
200
|
params: z.object({ sessionId: z.string().min(1), uri: z.string().min(1) }),
|
|
@@ -206,6 +242,10 @@ export const methods = {
|
|
|
206
242
|
params: z.object({ sessionId: z.string().min(1), requestId: z.string().min(1), answers: z.array(questionAnswerSchema).max(50) }),
|
|
207
243
|
result: empty,
|
|
208
244
|
},
|
|
245
|
+
"sessions.goal": {
|
|
246
|
+
params: z.object({ sessionId: z.string(), change: goalChangeSchema }),
|
|
247
|
+
result: z.object({ goal: sessionGoalSchema.nullable() }),
|
|
248
|
+
},
|
|
209
249
|
"sessions.setConfig": {
|
|
210
250
|
params: z.object({
|
|
211
251
|
sessionId: z.string().min(1),
|
|
@@ -541,6 +581,7 @@ export const notifications = {
|
|
|
541
581
|
"session.summary": z.object({ session: sessionSummarySchema }),
|
|
542
582
|
/** A session was deleted (from any device, or natively by the agent). */
|
|
543
583
|
"session.removed": z.object({ sessionId: z.string() }),
|
|
584
|
+
"session.preview.show": z.object({ sessionId: z.string() }),
|
|
544
585
|
/** To a desktop shim: a device is taking over; exit the native UI, then call desktop.yielded. */
|
|
545
586
|
"desktop.yield": z.object({ sessionId: z.string() }),
|
|
546
587
|
/** To a desktop shim: progress from the remote driver, to show in the terminal. */
|
package/src/updates.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { sessionGoalSchema } from "./goal.js";
|
|
3
|
+
import { backgroundTaskSchema, permissionOptionSchema, questionAnswerSchema, questionSchema, sessionDriverSchema, sessionStateSchema, toolKindSchema } from "./model.js";
|
|
3
4
|
import { workflowAgentStateSchema, workflowSchema } from "./workflow.js";
|
|
4
5
|
|
|
5
6
|
// Session updates mirror ACP's `SessionUpdate` shapes (discriminated by
|
|
@@ -152,6 +153,10 @@ export const sessionUpdateSchema = z.discriminatedUnion("sessionUpdate", [
|
|
|
152
153
|
sessionUpdate: z.literal("plan"),
|
|
153
154
|
entries: z.array(planEntrySchema),
|
|
154
155
|
}),
|
|
156
|
+
z.object({
|
|
157
|
+
sessionUpdate: z.literal("ls_goal"),
|
|
158
|
+
goal: sessionGoalSchema.nullable(),
|
|
159
|
+
}),
|
|
155
160
|
z.object({
|
|
156
161
|
sessionUpdate: z.literal("available_commands_update"),
|
|
157
162
|
availableCommands: z.array(
|
|
@@ -228,6 +233,11 @@ export const sessionUpdateSchema = z.discriminatedUnion("sessionUpdate", [
|
|
|
228
233
|
sessionUpdate: z.literal("ls_status"),
|
|
229
234
|
state: sessionStateSchema,
|
|
230
235
|
}),
|
|
236
|
+
/** A background task as it is now (the whole record each time: the latest for its id holds). */
|
|
237
|
+
z.object({
|
|
238
|
+
sessionUpdate: z.literal("ls_task"),
|
|
239
|
+
task: backgroundTaskSchema,
|
|
240
|
+
}),
|
|
231
241
|
z.object({
|
|
232
242
|
sessionUpdate: z.literal("ls_error"),
|
|
233
243
|
code: z.string(),
|