@ahggg/dsh-side-chat 0.7.3 → 1.0.1
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/README.md +52 -20
- package/README.zh-CN.md +52 -20
- package/lib/client/apply.js +48 -32
- package/lib/client/contracts.d.ts +3 -58
- package/lib/client/dsh/ReadOnlyConversation.d.ts +10 -0
- package/lib/client/dsh/ReadOnlyConversation.js +99 -0
- package/lib/client/dsh/SideChatOverlay.d.ts +7 -0
- package/lib/client/{rc6/Rc6SideChatOverlay.js → dsh/SideChatOverlay.js} +26 -56
- package/lib/client/{rc6 → dsh}/context.d.ts +4 -6
- package/lib/client/dsh/conversation-store.d.ts +22 -0
- package/lib/client/dsh/conversation-store.js +19 -0
- package/lib/client/dsh/primitive-labels.d.ts +2 -0
- package/lib/client/dsh/primitive-labels.js +4 -0
- package/lib/client/{rc6 → dsh}/remote-adapter.d.ts +2 -2
- package/lib/client/dsh/remote-adapter.js +22 -0
- package/lib/client/dsh/sessions-adapter.d.ts +56 -0
- package/lib/client/dsh/sessions-adapter.js +185 -0
- package/lib/client/index.d.ts +2 -2
- package/lib/client/panel/SelectionQuote.js +8 -1
- package/lib/client/panel/SideChatErrorState.js +1 -1
- package/lib/client/panel/SideChatModelSelect.d.ts +2 -1
- package/lib/client/panel/SideChatModelSelect.js +43 -24
- package/lib/client/panel/SideChatPanel.js +12 -5
- package/lib/client/panel/messages.d.ts +1 -1
- package/lib/client/panel/messages.js +8 -8
- package/lib/client/parent-composer/ParentConversationAnnotations.d.ts +3 -2
- package/lib/client/parent-composer/ParentConversationAnnotations.js +50 -30
- package/lib/client/parent-composer/add-to-conversation.d.ts +14 -28
- package/lib/client/parent-composer/add-to-conversation.js +131 -545
- package/lib/client/parent-composer/annotation-persistence.d.ts +8 -8
- package/lib/client/parent-composer/annotation-persistence.js +106 -102
- package/lib/client/parent-composer/composer-reference.d.ts +17 -55
- package/lib/client/parent-composer/composer-reference.js +20 -72
- package/lib/client/parent-composer/referenced-conversation.d.ts +5 -7
- package/lib/client/parent-composer/referenced-conversation.js +21 -73
- package/lib/client/selection/ConversationAnnotationMarkers.js +5 -1
- package/lib/client/selection/SelectionActions.js +2 -1
- package/lib/client/selection/conversation-dom.d.ts +5 -0
- package/lib/client/selection/conversation-dom.js +24 -0
- package/lib/client/selection/selection-controller.d.ts +1 -1
- package/lib/client/selection/selection-controller.js +7 -3
- package/lib/client/selection/selection-normalizer.js +1 -1
- package/lib/client/side-chat-controller.d.ts +28 -41
- package/lib/client/side-chat-controller.js +247 -337
- package/lib/client.js +84 -54
- package/lib/host/index.d.ts +1 -1
- package/lib/host/index.js +1 -1
- package/lib/host/read-only-chat-service.d.ts +30 -0
- package/lib/host/read-only-chat-service.js +315 -0
- package/lib/index.d.ts +16 -8
- package/lib/index.js +34 -13
- package/lib/remote.d.ts +23 -14
- package/lib/remote.js +2 -5
- package/lib/shared/constants.d.ts +0 -13
- package/lib/shared/constants.js +0 -13
- package/lib/shared/contracts.d.ts +52 -19
- package/lib/shared/contracts.js +2 -3
- package/lib/shared/error-codes.d.ts +1 -1
- package/lib/shared/error-codes.js +2 -2
- package/lib/shared/{archived-wire.d.ts → side-chat-wire.d.ts} +109 -20
- package/lib/shared/side-chat-wire.js +34 -0
- package/lib/typert.d.ts +3 -68
- package/lib/typert.js +60 -4
- package/package.json +76 -56
- package/lib/client/rc6/ArchivedConversation.d.ts +0 -14
- package/lib/client/rc6/ArchivedConversation.js +0 -231
- package/lib/client/rc6/Rc6SideChatOverlay.d.ts +0 -7
- package/lib/client/rc6/SideChatTool.d.ts +0 -22
- package/lib/client/rc6/SideChatTool.js +0 -404
- package/lib/client/rc6/primitive-labels.d.ts +0 -7
- package/lib/client/rc6/primitive-labels.js +0 -60
- package/lib/client/rc6/remote-adapter.js +0 -34
- package/lib/client/rc6/runtime-compat.d.ts +0 -120
- package/lib/client/rc6/runtime-compat.js +0 -187
- package/lib/client/rc6/sessions-adapter.d.ts +0 -64
- package/lib/client/rc6/sessions-adapter.js +0 -387
- package/lib/host/archived-fork-service.d.ts +0 -28
- package/lib/host/archived-fork-service.js +0 -309
- package/lib/shared/archived-wire.js +0 -47
- /package/lib/client/{rc6 → dsh}/context.js +0 -0
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { installModelSelection } from '@deepseek-ai/dsh-agent';
|
|
3
|
-
import { ReasoningEffortId } from '@deepseek-ai/dsh-llm';
|
|
4
|
-
import { foldRequestHeader, SessionId as dshSessionId } from '@deepseek-ai/dsh-session';
|
|
5
|
-
import { SessionId as clientSessionId } from '../shared/contracts.js';
|
|
6
|
-
function failure(code, message, recoverable = false) {
|
|
7
|
-
return { ok: false, error: { code, message, recoverable } };
|
|
8
|
-
}
|
|
9
|
-
function wireSelection(selection) {
|
|
10
|
-
if (selection === undefined)
|
|
11
|
-
return undefined;
|
|
12
|
-
return {
|
|
13
|
-
provider: selection.provider,
|
|
14
|
-
model: selection.model,
|
|
15
|
-
...(selection.reasoningEffort === undefined ? {} : { reasoningEffort: String(selection.reasoningEffort) }),
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function persistenceNotFound(error) {
|
|
19
|
-
if (!(error instanceof Error))
|
|
20
|
-
return false;
|
|
21
|
-
const candidate = error;
|
|
22
|
-
return candidate.name === 'SessionPersistenceNotFoundError'
|
|
23
|
-
|| candidate.code === 'session/not-found'
|
|
24
|
-
|| /^session ["'].+["'] not found$/iu.test(candidate.message);
|
|
25
|
-
}
|
|
26
|
-
function sessionPreset(header, events) {
|
|
27
|
-
for (let index = events.length - 1; index >= 0; index -= 1) {
|
|
28
|
-
const event = events[index];
|
|
29
|
-
if (event?.type !== 'agent-preset/selected')
|
|
30
|
-
continue;
|
|
31
|
-
const value = event.data.agentPreset;
|
|
32
|
-
if (typeof value === 'string' && value.length > 0)
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
35
|
-
return header.agentPreset;
|
|
36
|
-
}
|
|
37
|
-
function inheritedSelection(source) {
|
|
38
|
-
const config = (source.live?.session.requestHeader() ?? foldRequestHeader(source.events))?.config;
|
|
39
|
-
if (config !== undefined) {
|
|
40
|
-
return {
|
|
41
|
-
provider: config.provider,
|
|
42
|
-
model: config.model,
|
|
43
|
-
...(config.reasoningEffort === undefined ? {} : { reasoningEffort: config.reasoningEffort }),
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
const provider = source.live?.options.provider;
|
|
47
|
-
const model = source.live?.options.model;
|
|
48
|
-
return provider === undefined || model === undefined ? undefined : { provider, model };
|
|
49
|
-
}
|
|
50
|
-
function boundaryCut(events, atSeq) {
|
|
51
|
-
const anchor = Math.floor(atSeq);
|
|
52
|
-
const lastSeq = events.at(-1)?.seq ?? -1;
|
|
53
|
-
let boundaryIndex = events.findIndex(event => event.type === 'turn/end' && event.seq >= anchor);
|
|
54
|
-
if (boundaryIndex < 0 && anchor > lastSeq) {
|
|
55
|
-
boundaryIndex = events.findLastIndex(event => event.type === 'turn/end');
|
|
56
|
-
}
|
|
57
|
-
const boundary = events[boundaryIndex];
|
|
58
|
-
if (boundaryIndex < 0 || boundary?.type !== 'turn/end')
|
|
59
|
-
return undefined;
|
|
60
|
-
let cut = boundaryIndex + 1;
|
|
61
|
-
while (cut < events.length && events[cut]?.type !== 'turn/start')
|
|
62
|
-
cut += 1;
|
|
63
|
-
return {
|
|
64
|
-
boundarySeq: boundary.seq,
|
|
65
|
-
cut,
|
|
66
|
-
inheritedThroughSeq: events[cut - 1]?.seq ?? boundary.seq,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/** Stock rc.6 implementation backed by one ordinary archived Session fork. */
|
|
70
|
-
export class ArchivedForkSideChatService {
|
|
71
|
-
ctx;
|
|
72
|
-
records = new Map();
|
|
73
|
-
pendingCreates = new Set();
|
|
74
|
-
disposed = false;
|
|
75
|
-
constructor(ctx) {
|
|
76
|
-
this.ctx = ctx;
|
|
77
|
-
}
|
|
78
|
-
async create(request) {
|
|
79
|
-
if (this.disposed)
|
|
80
|
-
return failure('transport_error', 'The Side Chat service is unloading.', true);
|
|
81
|
-
const operation = this.createFork(request);
|
|
82
|
-
this.pendingCreates.add(operation);
|
|
83
|
-
try {
|
|
84
|
-
return await operation;
|
|
85
|
-
}
|
|
86
|
-
finally {
|
|
87
|
-
this.pendingCreates.delete(operation);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
async selectModel(request) {
|
|
91
|
-
const record = this.records.get(request.childSessionId);
|
|
92
|
-
if (record === undefined)
|
|
93
|
-
return failure('side_chat_not_found', 'The Side Chat no longer exists.');
|
|
94
|
-
if (this.disposed || record.closeOperation !== undefined) {
|
|
95
|
-
return failure('side_chat_model_failed', 'The Side Chat is closing.', true);
|
|
96
|
-
}
|
|
97
|
-
try {
|
|
98
|
-
const selected = await this.resolveModelSelection(request);
|
|
99
|
-
if (this.records.get(request.childSessionId) !== record || this.disposed) {
|
|
100
|
-
return failure('side_chat_not_found', 'The Side Chat no longer exists.');
|
|
101
|
-
}
|
|
102
|
-
if (record.closeOperation !== undefined) {
|
|
103
|
-
return failure('side_chat_model_failed', 'The Side Chat is closing.', true);
|
|
104
|
-
}
|
|
105
|
-
record.selection.current = selected;
|
|
106
|
-
return { ok: true, value: { selected: wireSelection(selected) } };
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
return failure('side_chat_model_failed', error instanceof Error ? error.message : `The model could not be selected: ${String(error)}`, true);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
async close(request) {
|
|
113
|
-
const record = this.records.get(request.childSessionId);
|
|
114
|
-
if (record === undefined)
|
|
115
|
-
return failure('side_chat_not_found', 'The Side Chat no longer exists.');
|
|
116
|
-
const operation = record.closeOperation ?? this.closeRecord(record);
|
|
117
|
-
record.closeOperation = operation;
|
|
118
|
-
const result = await operation;
|
|
119
|
-
if (!result.ok && record.closeOperation === operation)
|
|
120
|
-
delete record.closeOperation;
|
|
121
|
-
return result;
|
|
122
|
-
}
|
|
123
|
-
async dispose() {
|
|
124
|
-
if (this.disposed)
|
|
125
|
-
return;
|
|
126
|
-
this.disposed = true;
|
|
127
|
-
await Promise.allSettled(this.pendingCreates);
|
|
128
|
-
await Promise.allSettled([...this.records.values()].map(async (record) => {
|
|
129
|
-
if (record.closeOperation !== undefined)
|
|
130
|
-
await record.closeOperation;
|
|
131
|
-
if (this.records.has(record.childSessionId))
|
|
132
|
-
await this.closeRecord(record);
|
|
133
|
-
}));
|
|
134
|
-
}
|
|
135
|
-
async createFork(request) {
|
|
136
|
-
let source;
|
|
137
|
-
try {
|
|
138
|
-
source = await this.readParent(request.parentSessionId);
|
|
139
|
-
}
|
|
140
|
-
catch (error) {
|
|
141
|
-
if (persistenceNotFound(error)) {
|
|
142
|
-
return failure('parent_session_missing', 'The parent session could not be found.');
|
|
143
|
-
}
|
|
144
|
-
this.ctx.logger.warn(`archived Side Chat source read failed: ${String(error)}`);
|
|
145
|
-
return failure('internal_error', 'The parent session could not be read.', true);
|
|
146
|
-
}
|
|
147
|
-
const boundary = boundaryCut(source.events, request.atSeq);
|
|
148
|
-
if (boundary === undefined) {
|
|
149
|
-
return failure('fork_unavailable', 'Wait for the selected response to finish before opening a Side Chat.', true);
|
|
150
|
-
}
|
|
151
|
-
let selected;
|
|
152
|
-
try {
|
|
153
|
-
selected = request.modelSelection === undefined
|
|
154
|
-
? inheritedSelection(source)
|
|
155
|
-
: await this.resolveModelSelection(request.modelSelection);
|
|
156
|
-
}
|
|
157
|
-
catch (error) {
|
|
158
|
-
return failure('side_chat_model_failed', error instanceof Error ? error.message : `The model could not be selected: ${String(error)}`, true);
|
|
159
|
-
}
|
|
160
|
-
const childDshId = dshSessionId(`session-${randomUUID()}`);
|
|
161
|
-
const childSessionId = clientSessionId(childDshId);
|
|
162
|
-
const selection = { current: selected, assembled: undefined };
|
|
163
|
-
let handle;
|
|
164
|
-
try {
|
|
165
|
-
const composition = await this.resolveComposition(source);
|
|
166
|
-
const agentOptions = source.live === undefined ? {} : { ...source.live.options };
|
|
167
|
-
const setup = async (childCtx) => {
|
|
168
|
-
installModelSelection(childCtx, selection);
|
|
169
|
-
if (composition.setup !== undefined)
|
|
170
|
-
await composition.setup(childCtx);
|
|
171
|
-
};
|
|
172
|
-
const seed = source.events.slice(0, boundary.cut);
|
|
173
|
-
const commonMeta = {
|
|
174
|
-
...(source.header.cwd === undefined ? {} : { cwd: source.header.cwd }),
|
|
175
|
-
parentSession: source.id,
|
|
176
|
-
...(composition.agentPreset === undefined ? {} : { agentPreset: composition.agentPreset }),
|
|
177
|
-
};
|
|
178
|
-
const createOptions = source.api === 'split'
|
|
179
|
-
? {
|
|
180
|
-
sessionId: childDshId,
|
|
181
|
-
seed,
|
|
182
|
-
inheritedEventCount: boundary.cut,
|
|
183
|
-
meta: { ...commonMeta, isSeeded: true },
|
|
184
|
-
agentOptions,
|
|
185
|
-
setup,
|
|
186
|
-
}
|
|
187
|
-
: {
|
|
188
|
-
sessionId: childDshId,
|
|
189
|
-
seed,
|
|
190
|
-
meta: { ...commonMeta, seedLength: boundary.cut },
|
|
191
|
-
agentOptions,
|
|
192
|
-
setup,
|
|
193
|
-
};
|
|
194
|
-
handle = await this.ctx.agents.create(createOptions);
|
|
195
|
-
const cwd = source.header.cwd;
|
|
196
|
-
const workspace = cwd === undefined ? undefined : await this.ctx.workspaceRegistry.resolveByPath(cwd);
|
|
197
|
-
await workspace?.attachSession(childDshId);
|
|
198
|
-
}
|
|
199
|
-
catch (error) {
|
|
200
|
-
if (handle !== undefined)
|
|
201
|
-
await this.archiveAndDispose(childSessionId, handle);
|
|
202
|
-
this.ctx.logger.warn(`archived Side Chat fork failed: ${String(error)}`);
|
|
203
|
-
return failure('internal_error', 'The Side Chat fork could not be created.', true);
|
|
204
|
-
}
|
|
205
|
-
if (this.disposed) {
|
|
206
|
-
await this.archiveAndDispose(childSessionId, handle);
|
|
207
|
-
return failure('transport_error', 'The Side Chat service unloaded while creating the fork.', true);
|
|
208
|
-
}
|
|
209
|
-
this.records.set(childSessionId, {
|
|
210
|
-
parentSessionId: request.parentSessionId,
|
|
211
|
-
childSessionId,
|
|
212
|
-
handle,
|
|
213
|
-
selection,
|
|
214
|
-
});
|
|
215
|
-
const modelSelection = wireSelection(selected);
|
|
216
|
-
return {
|
|
217
|
-
ok: true,
|
|
218
|
-
value: {
|
|
219
|
-
parentSessionId: request.parentSessionId,
|
|
220
|
-
childSessionId,
|
|
221
|
-
boundarySeq: boundary.boundarySeq,
|
|
222
|
-
inheritedThroughSeq: boundary.inheritedThroughSeq,
|
|
223
|
-
...(modelSelection === undefined ? {} : { modelSelection }),
|
|
224
|
-
},
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
async resolveModelSelection(selection) {
|
|
228
|
-
const resolved = await this.ctx.llm.resolveCallConfig({
|
|
229
|
-
provider: selection.provider,
|
|
230
|
-
model: selection.model,
|
|
231
|
-
...(selection.reasoningEffort === undefined
|
|
232
|
-
? {}
|
|
233
|
-
: { reasoningEffort: ReasoningEffortId(selection.reasoningEffort) }),
|
|
234
|
-
});
|
|
235
|
-
return {
|
|
236
|
-
provider: resolved.provider,
|
|
237
|
-
model: resolved.model,
|
|
238
|
-
...(resolved.reasoningEffort === undefined ? {} : { reasoningEffort: resolved.reasoningEffort }),
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
async readParent(parentSessionId) {
|
|
242
|
-
const id = dshSessionId(parentSessionId);
|
|
243
|
-
const live = this.ctx.agents.get(id);
|
|
244
|
-
if (live !== undefined) {
|
|
245
|
-
const session = live.session;
|
|
246
|
-
const snapshotEvents = session.snapshotEvents;
|
|
247
|
-
const split = typeof snapshotEvents === 'function';
|
|
248
|
-
const events = split
|
|
249
|
-
? snapshotEvents.call(session)
|
|
250
|
-
: session.events ?? [];
|
|
251
|
-
return {
|
|
252
|
-
id,
|
|
253
|
-
header: session.header,
|
|
254
|
-
events: [...events],
|
|
255
|
-
api: split ? 'split' : 'legacy',
|
|
256
|
-
live,
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
const persistence = this.ctx.get('sessionPersistence');
|
|
260
|
-
if (persistence === undefined)
|
|
261
|
-
throw new Error('Session persistence is unavailable.');
|
|
262
|
-
const inspected = await persistence.inspect(id);
|
|
263
|
-
return {
|
|
264
|
-
id: inspected.meta.id,
|
|
265
|
-
header: inspected.meta,
|
|
266
|
-
events: inspected.events,
|
|
267
|
-
api: inspected.inheritedEventCount === undefined ? 'legacy' : 'split',
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
async resolveComposition(source) {
|
|
271
|
-
const presets = this.ctx.get('agentPresets');
|
|
272
|
-
if (presets === undefined)
|
|
273
|
-
return {};
|
|
274
|
-
const live = source.live;
|
|
275
|
-
if (live !== undefined) {
|
|
276
|
-
const agentPreset = presets.composedPreset(live.ctx);
|
|
277
|
-
return {
|
|
278
|
-
...(agentPreset === undefined ? {} : { agentPreset }),
|
|
279
|
-
setup: (childCtx) => { presets.composeFrom(childCtx, live.ctx); },
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
const resolved = await presets.resolve(sessionPreset(source.header, source.events));
|
|
283
|
-
return {
|
|
284
|
-
agentPreset: resolved.id,
|
|
285
|
-
setup: async (childCtx) => { await presets.mount(childCtx, resolved.id); },
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
async closeRecord(record) {
|
|
289
|
-
try {
|
|
290
|
-
if (record.handle.agent.status === 'running') {
|
|
291
|
-
record.handle.agent.cancel({ kind: 'user' });
|
|
292
|
-
await record.handle.agent.whenIdle();
|
|
293
|
-
}
|
|
294
|
-
await this.ctx.workspaceRegistry.archiveSession(dshSessionId(record.childSessionId));
|
|
295
|
-
await record.handle.dispose();
|
|
296
|
-
}
|
|
297
|
-
catch (error) {
|
|
298
|
-
this.ctx.logger.warn(`archived Side Chat close failed: ${String(error)}`);
|
|
299
|
-
return failure('side_chat_destroy_failed', 'The Side Chat could not be archived and released.', true);
|
|
300
|
-
}
|
|
301
|
-
this.records.delete(record.childSessionId);
|
|
302
|
-
return { ok: true, value: { closed: true } };
|
|
303
|
-
}
|
|
304
|
-
async archiveAndDispose(childSessionId, handle) {
|
|
305
|
-
await this.ctx.workspaceRegistry.archiveSession(dshSessionId(childSessionId)).catch(() => undefined);
|
|
306
|
-
await handle.dispose().catch(() => undefined);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
export { boundaryCut as resolveArchivedForkBoundary };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { SIDE_CHAT_ERROR_CODES } from './error-codes.js';
|
|
3
|
-
const id = z.string().min(1).max(512);
|
|
4
|
-
const modelSelectionSchema = z.object({
|
|
5
|
-
provider: id,
|
|
6
|
-
model: id,
|
|
7
|
-
reasoningEffort: id.optional(),
|
|
8
|
-
}).strict();
|
|
9
|
-
export const sideChatWireErrorSchema = z.object({
|
|
10
|
-
code: z.enum(SIDE_CHAT_ERROR_CODES),
|
|
11
|
-
message: z.string(),
|
|
12
|
-
recoverable: z.boolean(),
|
|
13
|
-
}).strict();
|
|
14
|
-
export const archivedCreateRequestSchema = z.object({
|
|
15
|
-
parentSessionId: id,
|
|
16
|
-
atSeq: z.number().finite().nonnegative(),
|
|
17
|
-
modelSelection: modelSelectionSchema.optional(),
|
|
18
|
-
}).strict();
|
|
19
|
-
export const archivedSelectModelRequestSchema = z.object({
|
|
20
|
-
childSessionId: id,
|
|
21
|
-
provider: id,
|
|
22
|
-
model: id,
|
|
23
|
-
reasoningEffort: id.optional(),
|
|
24
|
-
}).strict();
|
|
25
|
-
export const archivedCloseRequestSchema = z.object({
|
|
26
|
-
childSessionId: id,
|
|
27
|
-
}).strict();
|
|
28
|
-
const createValueSchema = z.object({
|
|
29
|
-
parentSessionId: id,
|
|
30
|
-
childSessionId: id,
|
|
31
|
-
boundarySeq: z.number().int().nonnegative(),
|
|
32
|
-
inheritedThroughSeq: z.number().int().nonnegative(),
|
|
33
|
-
modelSelection: modelSelectionSchema.optional(),
|
|
34
|
-
}).strict();
|
|
35
|
-
const selectModelValueSchema = z.object({
|
|
36
|
-
selected: modelSelectionSchema,
|
|
37
|
-
}).strict();
|
|
38
|
-
const closeValueSchema = z.object({ closed: z.literal(true) }).strict();
|
|
39
|
-
function resultSchema(value) {
|
|
40
|
-
return z.discriminatedUnion('ok', [
|
|
41
|
-
z.object({ ok: z.literal(true), value }).strict(),
|
|
42
|
-
z.object({ ok: z.literal(false), error: sideChatWireErrorSchema }).strict(),
|
|
43
|
-
]);
|
|
44
|
-
}
|
|
45
|
-
export const archivedCreateResultSchema = resultSchema(createValueSchema);
|
|
46
|
-
export const archivedSelectModelResultSchema = resultSchema(selectModelValueSchema);
|
|
47
|
-
export const archivedCloseResultSchema = resultSchema(closeValueSchema);
|
|
File without changes
|