@xrkseek/harness-cli 0.1.1 → 0.1.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/README.md +1 -1
- package/dist/commands/plugin.d.ts.map +1 -1
- package/dist/commands/plugin.js +9 -2
- package/dist/commands/plugin.js.map +1 -1
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +12 -2
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/install-client.d.ts +2 -0
- package/dist/plugin/install-client.d.ts.map +1 -1
- package/dist/plugin/install-client.js +24 -9
- package/dist/plugin/install-client.js.map +1 -1
- package/dist/plugin/staging-reconcile.d.ts +8 -0
- package/dist/plugin/staging-reconcile.d.ts.map +1 -0
- package/dist/plugin/staging-reconcile.js +67 -0
- package/dist/plugin/staging-reconcile.js.map +1 -0
- package/dist/port.d.ts.map +1 -1
- package/dist/port.js +1 -0
- package/dist/port.js.map +1 -1
- package/dist/product-paths.d.ts.map +1 -1
- package/dist/product-paths.js +8 -0
- package/dist/product-paths.js.map +1 -1
- package/package.json +3 -2
- package/product-web/assets/index-C_NG-17x.js +112 -0
- package/product-web/assets/index-C_NG-17x.js.map +1 -0
- package/product-web/boot.json +1 -1
- package/product-web/index.html +1 -1
- package/product-web/plugins/@xrkseek/client-connection/client.js +1276 -326
- package/product-web/plugins/@xrkseek/client-locale/client.js +4 -4
- package/product-web/plugins/@xrkseek/client-runtime/client.js +22 -19
- package/product-web/plugins/@xrkseek/client-ui-agent-preset/client.js +39 -39
- package/product-web/plugins/@xrkseek/client-ui-attachment/client.js +14 -14
- package/product-web/plugins/@xrkseek/client-ui-commands/client.js +8 -8
- package/product-web/plugins/@xrkseek/client-ui-conversation/client.js +174 -171
- package/product-web/plugins/@xrkseek/client-ui-deliverables/client.js +4 -4
- package/product-web/plugins/@xrkseek/client-ui-directory-picker-browse/client.js +26 -26
- package/product-web/plugins/@xrkseek/client-ui-goal/client.js +8 -8
- package/product-web/plugins/@xrkseek/client-ui-input-trigger/client.js +8 -8
- package/product-web/plugins/@xrkseek/client-ui-jobs/client.js +8 -8
- package/product-web/plugins/@xrkseek/client-ui-layout/client.js +3 -3
- package/product-web/plugins/@xrkseek/client-ui-message-feedback/client.js +5 -5
- package/product-web/plugins/@xrkseek/client-ui-model-selection/client.js +14 -14
- package/product-web/plugins/@xrkseek/client-ui-permission-presets/client.js +4 -4
- package/product-web/plugins/@xrkseek/client-ui-plan/client.js +2 -2
- package/product-web/plugins/@xrkseek/client-ui-settings-general/client.js +15 -15
- package/product-web/plugins/@xrkseek/client-ui-settings-models/client.js +53 -53
- package/product-web/plugins/@xrkseek/client-ui-settings-plugin-inventory/client.js +12 -12
- package/product-web/plugins/@xrkseek/client-ui-settings-plugins/client.js +40 -40
- package/product-web/plugins/@xrkseek/client-ui-sidebar/client.js +14 -14
- package/product-web/plugins/@xrkseek/client-ui-skill/client.js +12 -12
- package/product-web/plugins/@xrkseek/client-ui-subagent/client.js +21 -21
- package/product-web/plugins/@xrkseek/client-ui-theme/client.js +3 -3
- package/product-web/plugins/@xrkseek/client-ui-tool/client.js +37 -37
- package/product-web/plugins/@xrkseek/client-ui-trajectory/client.js +142 -142
- package/product-web/plugins/@xrkseek/client-ui-user-questions/client.js +28 -28
- package/product-web/plugins/@xrkseek/client-ui-workflow-run/client.js +14 -14
- package/product-web/plugins/@xrkseek/client-ui-workspace/client.js +55 -55
- package/product-web/assets/index-CHKZdZNt.js +0 -112
- package/product-web/assets/index-CHKZdZNt.js.map +0 -1
|
@@ -4,8 +4,6 @@ window.__ModuleLoader__.load({
|
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
-
let _xrkseek_xrk_llm_message = require("@xrkseek/xrk-llm/message");
|
|
8
|
-
let _xrkseek_xrk_llm_brand = require("@xrkseek/xrk-llm/brand");
|
|
9
7
|
//#region src/client/connection.ts
|
|
10
8
|
const CONNECTION_DEFAULTS = {
|
|
11
9
|
backoffBaseMs: 500,
|
|
@@ -147,16 +145,155 @@ window.__ModuleLoader__.load({
|
|
|
147
145
|
}
|
|
148
146
|
};
|
|
149
147
|
//#endregion
|
|
150
|
-
//#region ../../stubs/xrk-
|
|
148
|
+
//#region ../../stubs/xrk-llm/src/brand.ts
|
|
151
149
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
150
|
+
* Brand a message identifier.
|
|
151
|
+
* @param id - the opaque message identifier.
|
|
152
|
+
* @returns the same string, branded; no validation is performed.
|
|
153
|
+
*/
|
|
154
|
+
function MessageId(id) {
|
|
155
|
+
return id;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Brand a string as a {@link CallId}.
|
|
159
|
+
* @param id - the provider-issued (or synthesized) call id.
|
|
160
|
+
* @returns the same string, branded; no validation is performed.
|
|
161
|
+
*/
|
|
162
|
+
function CallId(id) {
|
|
163
|
+
return id;
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region ../../stubs/xrk-llm/src/call-config.ts
|
|
167
|
+
/**
|
|
168
|
+
* Deep-freeze a value in place with an iterative traversal, guarding cycles,
|
|
169
|
+
* so later mutation throws without imposing a JavaScript call-stack depth cap.
|
|
170
|
+
* {@link AbortSignal} objects are deliberately skipped because they are the
|
|
171
|
+
* request's live cancellation channel and freezing them breaks abort.
|
|
172
|
+
* @param value - the value to freeze in place.
|
|
173
|
+
* @returns the same value, frozen.
|
|
174
|
+
*/
|
|
175
|
+
function deepFreeze(value) {
|
|
176
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
177
|
+
const pending = [{
|
|
178
|
+
kind: "visit",
|
|
179
|
+
node: value
|
|
180
|
+
}];
|
|
181
|
+
while (pending.length > 0) {
|
|
182
|
+
const task = pending.pop();
|
|
183
|
+
/* v8 ignore next -- the loop condition guarantees one pending task. */
|
|
184
|
+
if (task === void 0) continue;
|
|
185
|
+
if (task.kind === "property") {
|
|
186
|
+
pending.push({
|
|
187
|
+
kind: "visit",
|
|
188
|
+
node: task.source[task.key]
|
|
189
|
+
});
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
const node = task.node;
|
|
193
|
+
if (node === null || typeof node !== "object") continue;
|
|
194
|
+
if (node instanceof AbortSignal) continue;
|
|
195
|
+
if (seen.has(node)) continue;
|
|
196
|
+
seen.add(node);
|
|
197
|
+
Object.freeze(node);
|
|
198
|
+
const keys = Object.keys(node);
|
|
199
|
+
for (let index = keys.length - 1; index >= 0; index--) {
|
|
200
|
+
const key = keys[index];
|
|
201
|
+
/* v8 ignore next -- the loop is bounded by the captured key count. */
|
|
202
|
+
if (key === void 0) continue;
|
|
203
|
+
pending.push({
|
|
204
|
+
kind: "property",
|
|
205
|
+
source: node,
|
|
206
|
+
key
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return value;
|
|
211
|
+
}
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region ../../stubs/xrk-llm/src/message.ts
|
|
214
|
+
/** Message value types, identity, and immutable construction helpers. */
|
|
215
|
+
/**
|
|
216
|
+
* Detach and deep-freeze a message whose identity already exists.
|
|
217
|
+
* @param message - complete message, including its stable identity.
|
|
218
|
+
* @returns an immutable snapshot that preserves the identity.
|
|
219
|
+
*/
|
|
220
|
+
function freezeMessage(message) {
|
|
221
|
+
return deepFreeze(structuredClone(message));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Create one identified message and freeze it before publication.
|
|
225
|
+
* @param input - complete role, content, and source for a new message.
|
|
226
|
+
* @returns an immutable message with a fresh stable identity.
|
|
227
|
+
*/
|
|
228
|
+
function createMessage(input) {
|
|
229
|
+
return freezeMessage({
|
|
230
|
+
...input,
|
|
231
|
+
id: MessageId(crypto.randomUUID())
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Create one identified user-role message and freeze it before publication.
|
|
236
|
+
* @param input - complete content and source for a new user message.
|
|
237
|
+
* @returns an immutable user message with a fresh stable identity.
|
|
238
|
+
*/
|
|
239
|
+
function createUserMessage(input) {
|
|
240
|
+
return createMessage({
|
|
241
|
+
...input,
|
|
242
|
+
role: "user"
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Create one identified model-produced assistant message and freeze it before publication.
|
|
247
|
+
* @param input - complete content plus the provider, model, and optional replay state for a new assistant message.
|
|
248
|
+
* @returns an immutable assistant message with fixed role/source tags and a fresh stable identity.
|
|
249
|
+
*/
|
|
250
|
+
function createAssistantMessage(input) {
|
|
251
|
+
return createMessage({
|
|
252
|
+
role: "assistant",
|
|
253
|
+
content: input.content,
|
|
254
|
+
source: {
|
|
255
|
+
kind: "model",
|
|
256
|
+
...input.source
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Create and freeze one identified tool-result message.
|
|
262
|
+
* @param input - call identity, raw result blocks, and outcome.
|
|
263
|
+
* @returns an immutable user-role tool-result message.
|
|
159
264
|
*/
|
|
265
|
+
function createToolResultMessage(input) {
|
|
266
|
+
return createUserMessage({
|
|
267
|
+
source: {
|
|
268
|
+
kind: "tool",
|
|
269
|
+
callId: input.callId
|
|
270
|
+
},
|
|
271
|
+
content: [{
|
|
272
|
+
type: "tool-result",
|
|
273
|
+
toolCallId: input.callId,
|
|
274
|
+
content: input.content,
|
|
275
|
+
isError: input.isError
|
|
276
|
+
}]
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Whether a stream chunk carries visible model output (the first-token
|
|
281
|
+
* boundary shared by client step timing and the whole-log sessionStats
|
|
282
|
+
* projection). Empty deltas (heartbeats, empty tool-call frames) do not count
|
|
283
|
+
* as a first token.
|
|
284
|
+
* @param chunk - the stream chunk to test.
|
|
285
|
+
* @returns true when the chunk contains a non-empty text/reasoning/tool delta.
|
|
286
|
+
*/
|
|
287
|
+
function isTokenDelta(chunk) {
|
|
288
|
+
switch (chunk.type) {
|
|
289
|
+
case "text-delta":
|
|
290
|
+
case "reasoning-delta": return chunk.text !== "";
|
|
291
|
+
case "tool-call-delta": return chunk.argumentsDelta !== "" || chunk.name !== void 0;
|
|
292
|
+
default: return false;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region ../../stubs/xrk-session/src/surface.ts
|
|
160
297
|
/** Runtime counterpart of the message-producing event union. */
|
|
161
298
|
const SURFACE_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
162
299
|
"user/message",
|
|
@@ -363,13 +500,7 @@ window.__ModuleLoader__.load({
|
|
|
363
500
|
};
|
|
364
501
|
}
|
|
365
502
|
//#endregion
|
|
366
|
-
//#region ../../stubs/xrk-host-apiproxy/
|
|
367
|
-
/**
|
|
368
|
-
* Four-quadrant RPC message model. Channels and messages are decoupled: HTTP,
|
|
369
|
-
* WebSocket, and in-process SSE are physical carriers, while logical messages
|
|
370
|
-
* are channel-independent and form a four-member discriminated union.
|
|
371
|
-
* api/ contract layer: zero Node dependencies, importable from the browser.
|
|
372
|
-
*/
|
|
503
|
+
//#region ../../stubs/xrk-host-apiproxy/src/api/rpc.ts
|
|
373
504
|
/**
|
|
374
505
|
* Brands a string as RpcId (same precedent as core `SessionId()`). Minted by the initiator:
|
|
375
506
|
* client-request → client mints; server-request → host mints (answerable frames get a stable
|
|
@@ -4735,7 +4866,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4735
4866
|
return /* @__PURE__ */ _superRefine(fn, params);
|
|
4736
4867
|
}
|
|
4737
4868
|
//#endregion
|
|
4738
|
-
//#region ../../stubs/xrk-host-apiproxy/
|
|
4869
|
+
//#region ../../stubs/xrk-host-apiproxy/src/api/rpc.schema.ts
|
|
4739
4870
|
/**
|
|
4740
4871
|
* Message-layer zod schemas: the four wire full forms + error body +
|
|
4741
4872
|
* carrier receipt. The payload slot is unknown in the full-form schemas — business payloads
|
|
@@ -4748,9 +4879,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4748
4879
|
* here would only turn a correlatable error report into a client-side parse
|
|
4749
4880
|
* failure (the handler substitutes a sentinel when a request's id is unreadable).
|
|
4750
4881
|
*/
|
|
4751
|
-
const rpcIdSchema = string();
|
|
4882
|
+
const rpcIdSchema$1 = string();
|
|
4752
4883
|
/** Error body: discriminated by code, per-branch details aligned to RpcErrorDetailsMap; details is required. */
|
|
4753
|
-
const rpcErrorSchema = discriminatedUnion("code", [
|
|
4884
|
+
const rpcErrorSchema$1 = discriminatedUnion("code", [
|
|
4754
4885
|
object({
|
|
4755
4886
|
code: literal("bad-request"),
|
|
4756
4887
|
message: string(),
|
|
@@ -5000,59 +5131,58 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5000
5131
|
* @param value - Schema for the business value.
|
|
5001
5132
|
* @returns Schema for RpcResult<T>.
|
|
5002
5133
|
*/
|
|
5003
|
-
function rpcResultSchema(value) {
|
|
5134
|
+
function rpcResultSchema$1(value) {
|
|
5004
5135
|
return union([object({
|
|
5005
5136
|
ok: literal(true),
|
|
5006
5137
|
value
|
|
5007
5138
|
}), object({
|
|
5008
5139
|
ok: literal(false),
|
|
5009
|
-
error: rpcErrorSchema
|
|
5140
|
+
error: rpcErrorSchema$1
|
|
5010
5141
|
})]);
|
|
5011
5142
|
}
|
|
5012
5143
|
/** ClientRequest full form (payload stays wide — the business layer runs the second parse). */
|
|
5013
|
-
const clientRequestSchema = object({
|
|
5144
|
+
const clientRequestSchema$1 = object({
|
|
5014
5145
|
type: literal("client-request"),
|
|
5015
|
-
rpcId: rpcIdSchema,
|
|
5146
|
+
rpcId: rpcIdSchema$1,
|
|
5016
5147
|
method: string(),
|
|
5017
5148
|
payload: unknown()
|
|
5018
5149
|
});
|
|
5019
5150
|
/** ServerResponse full form (result.value stays wide). */
|
|
5020
|
-
const serverResponseSchema = object({
|
|
5151
|
+
const serverResponseSchema$1 = object({
|
|
5021
5152
|
type: literal("server-response"),
|
|
5022
|
-
rpcId: rpcIdSchema,
|
|
5023
|
-
result: rpcResultSchema(unknown().optional())
|
|
5153
|
+
rpcId: rpcIdSchema$1,
|
|
5154
|
+
result: rpcResultSchema$1(unknown().optional())
|
|
5024
5155
|
});
|
|
5025
5156
|
/** ServerRequest full form (payload stays wide). */
|
|
5026
|
-
const serverRequestSchema = object({
|
|
5157
|
+
const serverRequestSchema$1 = object({
|
|
5027
5158
|
type: literal("server-request"),
|
|
5028
|
-
rpcId: rpcIdSchema,
|
|
5159
|
+
rpcId: rpcIdSchema$1,
|
|
5029
5160
|
method: string(),
|
|
5030
5161
|
payload: unknown()
|
|
5031
5162
|
});
|
|
5032
5163
|
discriminatedUnion("type", [
|
|
5033
|
-
clientRequestSchema,
|
|
5034
|
-
serverResponseSchema,
|
|
5035
|
-
serverRequestSchema,
|
|
5164
|
+
clientRequestSchema$1,
|
|
5165
|
+
serverResponseSchema$1,
|
|
5166
|
+
serverRequestSchema$1,
|
|
5036
5167
|
object({
|
|
5037
5168
|
type: literal("client-response"),
|
|
5038
|
-
rpcId: rpcIdSchema,
|
|
5039
|
-
result: rpcResultSchema(unknown().optional())
|
|
5169
|
+
rpcId: rpcIdSchema$1,
|
|
5170
|
+
result: rpcResultSchema$1(unknown().optional())
|
|
5040
5171
|
})
|
|
5041
5172
|
]);
|
|
5042
|
-
|
|
5043
|
-
const rpcReceiptSchema = union([object({ accepted: literal(true) }), object({
|
|
5173
|
+
union([object({ accepted: literal(true) }), object({
|
|
5044
5174
|
accepted: literal(false),
|
|
5045
5175
|
reason: union([literal("not-pending"), literal("bad-response")])
|
|
5046
5176
|
})]);
|
|
5047
5177
|
//#endregion
|
|
5048
|
-
//#region ../../stubs/xrk-host-apiproxy/
|
|
5178
|
+
//#region ../../stubs/xrk-host-apiproxy/src/api/session-search.ts
|
|
5049
5179
|
/**
|
|
5050
5180
|
* Return the longest prefix containing at most `maximum` Unicode code points.
|
|
5051
5181
|
* @param value - text to bound.
|
|
5052
5182
|
* @param maximum - non-negative code-point limit.
|
|
5053
5183
|
* @returns `value` unchanged when it fits, otherwise a code-point-safe prefix.
|
|
5054
5184
|
*/
|
|
5055
|
-
function truncateUnicodeCodePoints(value, maximum) {
|
|
5185
|
+
function truncateUnicodeCodePoints$1(value, maximum) {
|
|
5056
5186
|
let count = 0;
|
|
5057
5187
|
let end = 0;
|
|
5058
5188
|
for (const codePoint of value) {
|
|
@@ -5063,210 +5193,556 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5063
5193
|
return value;
|
|
5064
5194
|
}
|
|
5065
5195
|
//#endregion
|
|
5066
|
-
//#region ../../stubs/xrk-host-apiproxy/lib/types/api/
|
|
5196
|
+
//#region ../../stubs/xrk-host-apiproxy/lib/types/api/rpc.js
|
|
5067
5197
|
/**
|
|
5068
|
-
*
|
|
5069
|
-
*
|
|
5070
|
-
*
|
|
5071
|
-
*
|
|
5198
|
+
* Four-quadrant RPC message model. Channels and messages are decoupled: HTTP,
|
|
5199
|
+
* WebSocket, and in-process SSE are physical carriers, while logical messages
|
|
5200
|
+
* are channel-independent and form a four-member discriminated union.
|
|
5201
|
+
* api/ contract layer: zero Node dependencies, importable from the browser.
|
|
5072
5202
|
*/
|
|
5073
|
-
/** SessionId: one brand cast after schema validation (the only cast point in this domain). */
|
|
5074
|
-
const sessionIdSchema = string().min(1);
|
|
5075
|
-
/** MessageId: one brand cast after non-empty string validation. */
|
|
5076
|
-
const messageIdSchema$1 = string().min(1);
|
|
5077
5203
|
/**
|
|
5078
|
-
*
|
|
5079
|
-
*
|
|
5080
|
-
*
|
|
5081
|
-
*
|
|
5204
|
+
* Brands a string as RpcId (same precedent as core `SessionId()`). Minted by the initiator:
|
|
5205
|
+
* client-request → client mints; server-request → host mints (answerable frames get a stable
|
|
5206
|
+
* logical id, pure pushes mint a fresh one each time).
|
|
5207
|
+
* @param id - Raw id string (implementations mint UUIDs; tests may pass fixtures).
|
|
5208
|
+
* @returns The same string, branded (compile-time cast, zero runtime cost).
|
|
5082
5209
|
*/
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
time: number(),
|
|
5089
|
-
data: unknown(),
|
|
5090
|
-
sourceEventSeqs: array(number()).optional(),
|
|
5091
|
-
surfaceOp: unknown().optional(),
|
|
5092
|
-
ignorable: literal(true).optional()
|
|
5093
|
-
});
|
|
5094
|
-
/** SessionSummary row of session.list (`projections` reuses the history block's shape and schema). */
|
|
5095
|
-
const sessionSummarySchema = object({
|
|
5096
|
-
sessionId: sessionIdSchema,
|
|
5097
|
-
updatedAt: number(),
|
|
5098
|
-
running: boolean(),
|
|
5099
|
-
blank: boolean(),
|
|
5100
|
-
parentSessionId: sessionIdSchema.optional(),
|
|
5101
|
-
origin: literal("subagent").optional(),
|
|
5102
|
-
cwd: string().optional(),
|
|
5103
|
-
agentPreset: string().optional(),
|
|
5104
|
-
projections: lazy(() => sessionProjectionsBlockSchema).optional()
|
|
5105
|
-
});
|
|
5106
|
-
object({ cursor: string().optional() });
|
|
5107
|
-
/** session.list response value. */
|
|
5108
|
-
const sessionListValueSchema = object({ items: array(sessionSummarySchema) });
|
|
5109
|
-
object({ query: string().trim().min(1).max(500).refine((query) => !query.includes("\0"), { message: "search query must not contain NUL" }) });
|
|
5110
|
-
/** session.search response value. */
|
|
5111
|
-
const sessionSearchValueSchema = object({
|
|
5112
|
-
items: array(object({
|
|
5113
|
-
sessionId: sessionIdSchema,
|
|
5114
|
-
snippet: string().refine((snippet) => truncateUnicodeCodePoints(snippet, 240) === snippet, { message: `search snippet must contain at most 240 Unicode code points` })
|
|
5115
|
-
})).max(20),
|
|
5116
|
-
hasMore: boolean()
|
|
5117
|
-
});
|
|
5118
|
-
object({
|
|
5119
|
-
workspaceId: workspaceIdSchema.optional(),
|
|
5120
|
-
cwd: string().optional(),
|
|
5121
|
-
sessionId: sessionIdSchema.optional(),
|
|
5122
|
-
agentPreset: string().optional()
|
|
5123
|
-
}).refine((payload) => payload.workspaceId === void 0 || payload.cwd === void 0, { message: "session.create accepts workspaceId or cwd, not both" });
|
|
5124
|
-
/** session.create response value. */
|
|
5125
|
-
const sessionCreateValueSchema = object({
|
|
5126
|
-
sessionId: sessionIdSchema,
|
|
5127
|
-
agentPreset: string().optional()
|
|
5128
|
-
});
|
|
5129
|
-
object({
|
|
5130
|
-
sessionId: sessionIdSchema,
|
|
5131
|
-
title: string()
|
|
5132
|
-
});
|
|
5133
|
-
/** session.rename response value (the normalized accepted title and its event seq). */
|
|
5134
|
-
const sessionRenameValueSchema = object({
|
|
5135
|
-
title: string().min(1),
|
|
5136
|
-
seq: number().int().nonnegative()
|
|
5137
|
-
});
|
|
5138
|
-
object({
|
|
5139
|
-
sessionId: sessionIdSchema,
|
|
5140
|
-
atSeq: number().int().nonnegative().optional()
|
|
5141
|
-
});
|
|
5142
|
-
/** session.fork response value (the child session id). */
|
|
5143
|
-
const sessionForkValueSchema = object({ sessionId: sessionIdSchema });
|
|
5144
|
-
object({
|
|
5145
|
-
sessionId: sessionIdSchema,
|
|
5146
|
-
beforeSeq: number().int().nonnegative().optional(),
|
|
5147
|
-
maxMessages: number().int().positive().optional()
|
|
5148
|
-
});
|
|
5149
|
-
/** Complete provider/model selection. */
|
|
5150
|
-
const modelSelectionSchema = object({
|
|
5151
|
-
provider: string().min(1),
|
|
5152
|
-
model: string().min(1),
|
|
5153
|
-
reasoningEffort: string().min(1).optional()
|
|
5154
|
-
});
|
|
5155
|
-
/** Exact-model reasoning metadata. */
|
|
5156
|
-
const modelReasoningSchema = object({
|
|
5157
|
-
efforts: array(object({
|
|
5158
|
-
id: string().min(1),
|
|
5159
|
-
name: string().min(1),
|
|
5160
|
-
description: string().optional()
|
|
5161
|
-
})).min(1),
|
|
5162
|
-
defaultEffort: string().min(1).optional()
|
|
5163
|
-
});
|
|
5164
|
-
/** One advisory model entry inside a provider group. */
|
|
5165
|
-
const modelCatalogModelSchema = object({
|
|
5166
|
-
id: string().min(1),
|
|
5167
|
-
name: string().min(1),
|
|
5168
|
-
description: string().optional(),
|
|
5169
|
-
reasoning: modelReasoningSchema.optional()
|
|
5170
|
-
});
|
|
5171
|
-
/** One successfully loaded provider group. */
|
|
5172
|
-
const modelProviderGroupSchema = object({
|
|
5173
|
-
id: string().min(1),
|
|
5174
|
-
name: string().min(1),
|
|
5175
|
-
models: array(modelCatalogModelSchema)
|
|
5176
|
-
});
|
|
5177
|
-
/** One provider-local catalog failure. */
|
|
5178
|
-
const modelCatalogFailureSchema = object({
|
|
5179
|
-
id: string().min(1),
|
|
5180
|
-
name: string().min(1),
|
|
5181
|
-
message: string()
|
|
5182
|
-
});
|
|
5210
|
+
function RpcId$1(id) {
|
|
5211
|
+
return id;
|
|
5212
|
+
}
|
|
5213
|
+
//#endregion
|
|
5214
|
+
//#region ../../stubs/xrk-host-apiproxy/lib/types/api/rpc.schema.js
|
|
5183
5215
|
/**
|
|
5184
|
-
*
|
|
5185
|
-
*
|
|
5186
|
-
*
|
|
5187
|
-
*
|
|
5216
|
+
* Message-layer zod schemas: the four wire full forms + error body +
|
|
5217
|
+
* carrier receipt. The payload slot is unknown in the full-form schemas — business payloads
|
|
5218
|
+
* get a second parse dispatched by method (two-level parse discipline).
|
|
5219
|
+
* Brand cast point: rpcIdSchema, and only there.
|
|
5188
5220
|
*/
|
|
5189
|
-
const toolEventViewSchema = discriminatedUnion("for", [object({
|
|
5190
|
-
for: literal("call"),
|
|
5191
|
-
view: looseObject({ card: string() })
|
|
5192
|
-
}), object({
|
|
5193
|
-
for: literal("result"),
|
|
5194
|
-
view: looseObject({ card: string() })
|
|
5195
|
-
})]);
|
|
5196
|
-
/** One session.history item: the session event plus its optional host-computed tool view. */
|
|
5197
|
-
const historyEntrySchema = object({
|
|
5198
|
-
event: sessionEventSchema,
|
|
5199
|
-
view: toolEventViewSchema.optional()
|
|
5200
|
-
});
|
|
5201
5221
|
/**
|
|
5202
|
-
*
|
|
5203
|
-
*
|
|
5204
|
-
*
|
|
5222
|
+
* RpcId: one brand cast after schema validation (the only cast point in this
|
|
5223
|
+
* file). No min-length: the id is an opaque echo token, and rejecting values
|
|
5224
|
+
* here would only turn a correlatable error report into a client-side parse
|
|
5225
|
+
* failure (the handler substitutes a sentinel when a request's id is unreadable).
|
|
5205
5226
|
*/
|
|
5206
|
-
const
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5227
|
+
const rpcIdSchema = string();
|
|
5228
|
+
/** Error body: discriminated by code, per-branch details aligned to RpcErrorDetailsMap; details is required. */
|
|
5229
|
+
const rpcErrorSchema = discriminatedUnion("code", [
|
|
5230
|
+
object({
|
|
5231
|
+
code: literal("bad-request"),
|
|
5232
|
+
message: string(),
|
|
5233
|
+
details: object({ issues: array(custom()) })
|
|
5234
|
+
}),
|
|
5235
|
+
object({
|
|
5236
|
+
code: literal("cancelled"),
|
|
5237
|
+
message: string(),
|
|
5238
|
+
details: object({})
|
|
5239
|
+
}),
|
|
5240
|
+
object({
|
|
5241
|
+
code: literal("session-not-found"),
|
|
5242
|
+
message: string(),
|
|
5243
|
+
details: object({ sessionId: string() })
|
|
5244
|
+
}),
|
|
5245
|
+
object({
|
|
5246
|
+
code: literal("model-unavailable"),
|
|
5247
|
+
message: string(),
|
|
5248
|
+
details: object({
|
|
5249
|
+
provider: string(),
|
|
5250
|
+
model: string()
|
|
5251
|
+
})
|
|
5252
|
+
}),
|
|
5253
|
+
object({
|
|
5254
|
+
code: literal("session-conflict"),
|
|
5255
|
+
message: string(),
|
|
5256
|
+
details: object({
|
|
5257
|
+
sessionId: string(),
|
|
5258
|
+
requestedCwd: string(),
|
|
5259
|
+
existingCwd: string().optional()
|
|
5260
|
+
})
|
|
5261
|
+
}),
|
|
5262
|
+
object({
|
|
5263
|
+
code: literal("invalid-time-zone"),
|
|
5264
|
+
message: string(),
|
|
5265
|
+
details: object({ value: string() })
|
|
5266
|
+
}),
|
|
5267
|
+
object({
|
|
5268
|
+
code: literal("workspace-attach-failed"),
|
|
5269
|
+
message: string(),
|
|
5270
|
+
details: object({
|
|
5271
|
+
sessionId: string(),
|
|
5272
|
+
workspaceId: string()
|
|
5273
|
+
})
|
|
5274
|
+
}),
|
|
5275
|
+
object({
|
|
5276
|
+
code: literal("workspace-not-found"),
|
|
5277
|
+
message: string(),
|
|
5278
|
+
details: object({ workspaceId: string() })
|
|
5279
|
+
}),
|
|
5280
|
+
object({
|
|
5281
|
+
code: literal("workspace-invalid-path"),
|
|
5282
|
+
message: string(),
|
|
5283
|
+
details: object({ path: string() })
|
|
5284
|
+
}),
|
|
5285
|
+
object({
|
|
5286
|
+
code: literal("workspace-name-conflict"),
|
|
5287
|
+
message: string(),
|
|
5288
|
+
details: object({ name: string() })
|
|
5289
|
+
}),
|
|
5290
|
+
object({
|
|
5291
|
+
code: literal("workspace-move-invalid"),
|
|
5292
|
+
message: string(),
|
|
5293
|
+
details: object({
|
|
5294
|
+
workspaceId: string(),
|
|
5295
|
+
sessionId: string(),
|
|
5296
|
+
beforeSessionId: string().optional()
|
|
5297
|
+
})
|
|
5298
|
+
}),
|
|
5299
|
+
object({
|
|
5300
|
+
code: literal("directory-unreadable"),
|
|
5301
|
+
message: string(),
|
|
5302
|
+
details: object({ path: string() })
|
|
5303
|
+
}),
|
|
5304
|
+
object({
|
|
5305
|
+
code: literal("directory-exists"),
|
|
5306
|
+
message: string(),
|
|
5307
|
+
details: object({ path: string() })
|
|
5308
|
+
}),
|
|
5309
|
+
object({
|
|
5310
|
+
code: literal("directory-create-failed"),
|
|
5311
|
+
message: string(),
|
|
5312
|
+
details: object({ path: string() })
|
|
5313
|
+
}),
|
|
5314
|
+
object({
|
|
5315
|
+
code: literal("directory-picker-unavailable"),
|
|
5316
|
+
message: string(),
|
|
5317
|
+
details: object({ capability: string() })
|
|
5318
|
+
}),
|
|
5319
|
+
object({
|
|
5320
|
+
code: literal("agent-preset-read-only"),
|
|
5321
|
+
message: string(),
|
|
5322
|
+
details: object({
|
|
5323
|
+
agentPreset: string(),
|
|
5324
|
+
reason: string()
|
|
5325
|
+
})
|
|
5326
|
+
}),
|
|
5327
|
+
object({
|
|
5328
|
+
code: literal("agent-preset-locked"),
|
|
5329
|
+
message: string(),
|
|
5330
|
+
details: object({
|
|
5331
|
+
sessionId: string(),
|
|
5332
|
+
agentPreset: string()
|
|
5333
|
+
})
|
|
5334
|
+
}),
|
|
5335
|
+
object({
|
|
5336
|
+
code: literal("agent-preset-conflict"),
|
|
5337
|
+
message: string(),
|
|
5338
|
+
details: object({
|
|
5339
|
+
sessionId: string(),
|
|
5340
|
+
requestedPreset: string(),
|
|
5341
|
+
existingPreset: string().optional()
|
|
5342
|
+
})
|
|
5343
|
+
}),
|
|
5344
|
+
object({
|
|
5345
|
+
code: literal("agent-preset-not-found"),
|
|
5346
|
+
message: string(),
|
|
5347
|
+
details: object({
|
|
5348
|
+
agentPreset: string(),
|
|
5349
|
+
available: array(string())
|
|
5350
|
+
})
|
|
5351
|
+
}),
|
|
5352
|
+
object({
|
|
5353
|
+
code: literal("agent-preset-invalid"),
|
|
5354
|
+
message: string(),
|
|
5355
|
+
details: object({
|
|
5356
|
+
agentPreset: string(),
|
|
5357
|
+
reason: string()
|
|
5358
|
+
})
|
|
5359
|
+
}),
|
|
5360
|
+
object({
|
|
5361
|
+
code: literal("agent-busy"),
|
|
5362
|
+
message: string(),
|
|
5363
|
+
details: object({ reason: string() })
|
|
5364
|
+
}),
|
|
5365
|
+
object({
|
|
5366
|
+
code: literal("attachment-error"),
|
|
5367
|
+
message: string(),
|
|
5368
|
+
details: object({ reason: string() })
|
|
5369
|
+
}),
|
|
5370
|
+
object({
|
|
5371
|
+
code: literal("queue-item-not-found"),
|
|
5372
|
+
message: string(),
|
|
5373
|
+
details: object({ itemId: string() })
|
|
5374
|
+
}),
|
|
5375
|
+
object({
|
|
5376
|
+
code: literal("steer-unavailable"),
|
|
5377
|
+
message: string(),
|
|
5378
|
+
details: object({ itemId: string() })
|
|
5379
|
+
}),
|
|
5380
|
+
object({
|
|
5381
|
+
code: literal("command-error"),
|
|
5382
|
+
message: string(),
|
|
5383
|
+
details: object({})
|
|
5384
|
+
}),
|
|
5385
|
+
object({
|
|
5386
|
+
code: literal("unknown-command"),
|
|
5387
|
+
message: string(),
|
|
5388
|
+
details: object({})
|
|
5389
|
+
}),
|
|
5390
|
+
object({
|
|
5391
|
+
code: literal("settings-rejected"),
|
|
5392
|
+
message: string(),
|
|
5393
|
+
details: object({ ns: string() })
|
|
5394
|
+
}),
|
|
5395
|
+
object({
|
|
5396
|
+
code: literal("settings-conflict"),
|
|
5397
|
+
message: string(),
|
|
5398
|
+
details: object({
|
|
5399
|
+
ns: string(),
|
|
5400
|
+
expected: number(),
|
|
5401
|
+
actual: number()
|
|
5402
|
+
})
|
|
5403
|
+
}),
|
|
5404
|
+
object({
|
|
5405
|
+
code: literal("credential-rejected"),
|
|
5406
|
+
message: string(),
|
|
5407
|
+
details: object({ ref: string() })
|
|
5408
|
+
}),
|
|
5409
|
+
object({
|
|
5410
|
+
code: literal("model-discovery-failed"),
|
|
5411
|
+
message: string(),
|
|
5412
|
+
details: object({
|
|
5413
|
+
settingsNs: string(),
|
|
5414
|
+
baseURL: string().optional()
|
|
5415
|
+
})
|
|
5416
|
+
}),
|
|
5417
|
+
object({
|
|
5418
|
+
code: literal("title-invalid"),
|
|
5419
|
+
message: string(),
|
|
5420
|
+
details: object({ sessionId: string() })
|
|
5421
|
+
}),
|
|
5422
|
+
object({
|
|
5423
|
+
code: literal("fork-unavailable"),
|
|
5424
|
+
message: string(),
|
|
5425
|
+
details: object({ sessionId: string() })
|
|
5426
|
+
}),
|
|
5427
|
+
object({
|
|
5428
|
+
code: literal("subagent-parent-unavailable"),
|
|
5429
|
+
message: string(),
|
|
5430
|
+
details: object({ parentSessionId: string() })
|
|
5431
|
+
}),
|
|
5432
|
+
object({
|
|
5433
|
+
code: literal("subagent-not-found"),
|
|
5434
|
+
message: string(),
|
|
5435
|
+
details: object({
|
|
5436
|
+
parentSessionId: string(),
|
|
5437
|
+
childSessionId: string()
|
|
5438
|
+
})
|
|
5439
|
+
}),
|
|
5440
|
+
object({
|
|
5441
|
+
code: literal("subagent-catalog-diagnostic"),
|
|
5442
|
+
message: string(),
|
|
5443
|
+
details: object({
|
|
5444
|
+
parentSessionId: string(),
|
|
5445
|
+
childSessionId: string(),
|
|
5446
|
+
reason: union([
|
|
5447
|
+
literal("corrupt"),
|
|
5448
|
+
literal("unsupported"),
|
|
5449
|
+
literal("unavailable")
|
|
5450
|
+
])
|
|
5451
|
+
})
|
|
5452
|
+
}),
|
|
5453
|
+
object({
|
|
5454
|
+
code: literal("subagent-not-resumable"),
|
|
5455
|
+
message: string(),
|
|
5456
|
+
details: object({ childSessionId: string() })
|
|
5457
|
+
}),
|
|
5458
|
+
object({
|
|
5459
|
+
code: literal("subagent-unauthorized"),
|
|
5460
|
+
message: string(),
|
|
5461
|
+
details: object({ childSessionId: string() })
|
|
5462
|
+
}),
|
|
5463
|
+
object({
|
|
5464
|
+
code: literal("subagent-delivery-unavailable"),
|
|
5465
|
+
message: string(),
|
|
5466
|
+
details: object({ childSessionId: string() })
|
|
5467
|
+
}),
|
|
5468
|
+
object({
|
|
5469
|
+
code: literal("internal"),
|
|
5470
|
+
message: string(),
|
|
5471
|
+
details: object({})
|
|
5472
|
+
})
|
|
5473
|
+
]);
|
|
5474
|
+
/**
|
|
5475
|
+
* Business success/failure result schema (generic, reusable).
|
|
5476
|
+
* @param value - Schema for the business value.
|
|
5477
|
+
* @returns Schema for RpcResult<T>.
|
|
5478
|
+
*/
|
|
5479
|
+
function rpcResultSchema(value) {
|
|
5480
|
+
return union([object({
|
|
5481
|
+
ok: literal(true),
|
|
5482
|
+
value
|
|
5483
|
+
}), object({
|
|
5484
|
+
ok: literal(false),
|
|
5485
|
+
error: rpcErrorSchema
|
|
5486
|
+
})]);
|
|
5487
|
+
}
|
|
5488
|
+
/** ClientRequest full form (payload stays wide — the business layer runs the second parse). */
|
|
5489
|
+
const clientRequestSchema = object({
|
|
5490
|
+
type: literal("client-request"),
|
|
5491
|
+
rpcId: rpcIdSchema,
|
|
5492
|
+
method: string(),
|
|
5493
|
+
payload: unknown()
|
|
5494
|
+
});
|
|
5495
|
+
/** ServerResponse full form (result.value stays wide). */
|
|
5496
|
+
const serverResponseSchema = object({
|
|
5497
|
+
type: literal("server-response"),
|
|
5498
|
+
rpcId: rpcIdSchema,
|
|
5499
|
+
result: rpcResultSchema(unknown().optional())
|
|
5500
|
+
});
|
|
5501
|
+
/** ServerRequest full form (payload stays wide). */
|
|
5502
|
+
const serverRequestSchema = object({
|
|
5503
|
+
type: literal("server-request"),
|
|
5504
|
+
rpcId: rpcIdSchema,
|
|
5505
|
+
method: string(),
|
|
5506
|
+
payload: unknown()
|
|
5507
|
+
});
|
|
5508
|
+
discriminatedUnion("type", [
|
|
5509
|
+
clientRequestSchema,
|
|
5510
|
+
serverResponseSchema,
|
|
5511
|
+
serverRequestSchema,
|
|
5512
|
+
object({
|
|
5513
|
+
type: literal("client-response"),
|
|
5514
|
+
rpcId: rpcIdSchema,
|
|
5515
|
+
result: rpcResultSchema(unknown().optional())
|
|
5516
|
+
})
|
|
5517
|
+
]);
|
|
5518
|
+
/** Carrier receipt schema. */
|
|
5519
|
+
const rpcReceiptSchema = union([object({ accepted: literal(true) }), object({
|
|
5520
|
+
accepted: literal(false),
|
|
5521
|
+
reason: union([literal("not-pending"), literal("bad-response")])
|
|
5522
|
+
})]);
|
|
5523
|
+
//#endregion
|
|
5524
|
+
//#region ../../stubs/xrk-host-apiproxy/lib/types/api/session-search.js
|
|
5525
|
+
/**
|
|
5526
|
+
* Return the longest prefix containing at most `maximum` Unicode code points.
|
|
5527
|
+
* @param value - text to bound.
|
|
5528
|
+
* @param maximum - non-negative code-point limit.
|
|
5529
|
+
* @returns `value` unchanged when it fits, otherwise a code-point-safe prefix.
|
|
5530
|
+
*/
|
|
5531
|
+
function truncateUnicodeCodePoints(value, maximum) {
|
|
5532
|
+
let count = 0;
|
|
5533
|
+
let end = 0;
|
|
5534
|
+
for (const codePoint of value) {
|
|
5535
|
+
if (count === maximum) return value.slice(0, end);
|
|
5536
|
+
count++;
|
|
5537
|
+
end += codePoint.length;
|
|
5538
|
+
}
|
|
5539
|
+
return value;
|
|
5540
|
+
}
|
|
5541
|
+
//#endregion
|
|
5542
|
+
//#region ../../stubs/xrk-host-apiproxy/lib/types/api/sessions.schema.js
|
|
5543
|
+
/**
|
|
5544
|
+
* sessions domain zod schemas (names derived from map keys: sessionListRequestSchema /
|
|
5545
|
+
* sessionListValueSchema). SessionEvent passthrough = strict envelope (type/seq/time) + wide
|
|
5546
|
+
* data: the merge-extensible event API keeps an unknown-type branch at the union level,
|
|
5547
|
+
* with no field-level passthrough. SessionId brand cast point: sessionIdSchema, and only there.
|
|
5548
|
+
*/
|
|
5549
|
+
/** SessionId: one brand cast after schema validation (the only cast point in this domain). */
|
|
5550
|
+
const sessionIdSchema$1 = string().min(1);
|
|
5551
|
+
/** MessageId: one brand cast after non-empty string validation. */
|
|
5552
|
+
const messageIdSchema$2 = string().min(1);
|
|
5553
|
+
/**
|
|
5554
|
+
* WorkspaceId: the workspace domain's one brand cast. Hosted here rather
|
|
5555
|
+
* than in workspace.schema because session.create references it while
|
|
5556
|
+
* workspace.schema references sessionIdSchema — schema modules must stay a
|
|
5557
|
+
* DAG (both casts used at module top level; a cycle is a load-time TDZ).
|
|
5558
|
+
*/
|
|
5559
|
+
const workspaceIdSchema$1 = string().min(1);
|
|
5560
|
+
/** SessionEvent passthrough: strict envelope, wide data (the client fold handles unknown types via its documented default). */
|
|
5561
|
+
const sessionEventSchema$1 = object({
|
|
5562
|
+
type: string(),
|
|
5563
|
+
seq: number().int().nonnegative(),
|
|
5564
|
+
time: number(),
|
|
5565
|
+
data: unknown(),
|
|
5566
|
+
sourceEventSeqs: array(number()).optional(),
|
|
5567
|
+
surfaceOp: unknown().optional(),
|
|
5568
|
+
ignorable: literal(true).optional()
|
|
5569
|
+
});
|
|
5570
|
+
/** SessionSummary row of session.list (`projections` reuses the history block's shape and schema). */
|
|
5571
|
+
const sessionSummarySchema$1 = object({
|
|
5572
|
+
sessionId: sessionIdSchema$1,
|
|
5573
|
+
updatedAt: number(),
|
|
5574
|
+
running: boolean(),
|
|
5575
|
+
blank: boolean(),
|
|
5576
|
+
parentSessionId: sessionIdSchema$1.optional(),
|
|
5577
|
+
origin: literal("subagent").optional(),
|
|
5578
|
+
cwd: string().optional(),
|
|
5579
|
+
agentPreset: string().optional(),
|
|
5580
|
+
projections: lazy(() => sessionProjectionsBlockSchema$1).optional()
|
|
5581
|
+
});
|
|
5582
|
+
object({ cursor: string().optional() });
|
|
5583
|
+
/** session.list response value. */
|
|
5584
|
+
const sessionListValueSchema$1 = object({ items: array(sessionSummarySchema$1) });
|
|
5585
|
+
object({ query: string().trim().min(1).max(500).refine((query) => !query.includes("\0"), { message: "search query must not contain NUL" }) });
|
|
5586
|
+
/** session.search response value. */
|
|
5587
|
+
const sessionSearchValueSchema$1 = object({
|
|
5588
|
+
items: array(object({
|
|
5589
|
+
sessionId: sessionIdSchema$1,
|
|
5590
|
+
snippet: string().refine((snippet) => truncateUnicodeCodePoints(snippet, 240) === snippet, { message: `search snippet must contain at most 240 Unicode code points` })
|
|
5591
|
+
})).max(20),
|
|
5592
|
+
hasMore: boolean()
|
|
5593
|
+
});
|
|
5594
|
+
object({
|
|
5595
|
+
workspaceId: workspaceIdSchema$1.optional(),
|
|
5596
|
+
cwd: string().optional(),
|
|
5597
|
+
sessionId: sessionIdSchema$1.optional(),
|
|
5598
|
+
agentPreset: string().optional()
|
|
5599
|
+
}).refine((payload) => payload.workspaceId === void 0 || payload.cwd === void 0, { message: "session.create accepts workspaceId or cwd, not both" });
|
|
5600
|
+
/** session.create response value. */
|
|
5601
|
+
const sessionCreateValueSchema$1 = object({
|
|
5602
|
+
sessionId: sessionIdSchema$1,
|
|
5603
|
+
agentPreset: string().optional()
|
|
5604
|
+
});
|
|
5605
|
+
object({
|
|
5606
|
+
sessionId: sessionIdSchema$1,
|
|
5607
|
+
title: string()
|
|
5608
|
+
});
|
|
5609
|
+
/** session.rename response value (the normalized accepted title and its event seq). */
|
|
5610
|
+
const sessionRenameValueSchema$1 = object({
|
|
5611
|
+
title: string().min(1),
|
|
5612
|
+
seq: number().int().nonnegative()
|
|
5613
|
+
});
|
|
5614
|
+
object({
|
|
5615
|
+
sessionId: sessionIdSchema$1,
|
|
5616
|
+
atSeq: number().int().nonnegative().optional()
|
|
5617
|
+
});
|
|
5618
|
+
/** session.fork response value (the child session id). */
|
|
5619
|
+
const sessionForkValueSchema$1 = object({ sessionId: sessionIdSchema$1 });
|
|
5620
|
+
object({
|
|
5621
|
+
sessionId: sessionIdSchema$1,
|
|
5622
|
+
beforeSeq: number().int().nonnegative().optional(),
|
|
5623
|
+
maxMessages: number().int().positive().optional()
|
|
5624
|
+
});
|
|
5625
|
+
/** Complete provider/model selection. */
|
|
5626
|
+
const modelSelectionSchema$1 = object({
|
|
5627
|
+
provider: string().min(1),
|
|
5628
|
+
model: string().min(1),
|
|
5629
|
+
reasoningEffort: string().min(1).optional()
|
|
5630
|
+
});
|
|
5631
|
+
/** Exact-model reasoning metadata. */
|
|
5632
|
+
const modelReasoningSchema$1 = object({
|
|
5633
|
+
efforts: array(object({
|
|
5634
|
+
id: string().min(1),
|
|
5635
|
+
name: string().min(1),
|
|
5636
|
+
description: string().optional()
|
|
5637
|
+
})).min(1),
|
|
5638
|
+
defaultEffort: string().min(1).optional()
|
|
5639
|
+
});
|
|
5640
|
+
/** One advisory model entry inside a provider group. */
|
|
5641
|
+
const modelCatalogModelSchema$1 = object({
|
|
5642
|
+
id: string().min(1),
|
|
5643
|
+
name: string().min(1),
|
|
5644
|
+
description: string().optional(),
|
|
5645
|
+
reasoning: modelReasoningSchema$1.optional()
|
|
5646
|
+
});
|
|
5647
|
+
/** One successfully loaded provider group. */
|
|
5648
|
+
const modelProviderGroupSchema$1 = object({
|
|
5649
|
+
id: string().min(1),
|
|
5650
|
+
name: string().min(1),
|
|
5651
|
+
models: array(modelCatalogModelSchema$1)
|
|
5652
|
+
});
|
|
5653
|
+
/** One provider-local catalog failure. */
|
|
5654
|
+
const modelCatalogFailureSchema$1 = object({
|
|
5655
|
+
id: string().min(1),
|
|
5656
|
+
name: string().min(1),
|
|
5657
|
+
message: string()
|
|
5658
|
+
});
|
|
5659
|
+
/**
|
|
5660
|
+
* ToolEventView passthrough: lock only the `for` discriminant and the presence
|
|
5661
|
+
* of a card-tagged `view` object. The view interior is a host-computed product
|
|
5662
|
+
* the client reads without echoing back; deep-validating it would hand-copy
|
|
5663
|
+
* the dsh-tools vocabulary into this schema and drift with it.
|
|
5664
|
+
*/
|
|
5665
|
+
const toolEventViewSchema$1 = discriminatedUnion("for", [object({
|
|
5666
|
+
for: literal("call"),
|
|
5667
|
+
view: looseObject({ card: string() })
|
|
5668
|
+
}), object({
|
|
5669
|
+
for: literal("result"),
|
|
5670
|
+
view: looseObject({ card: string() })
|
|
5671
|
+
})]);
|
|
5672
|
+
/** One session.history item: the session event plus its optional host-computed tool view. */
|
|
5673
|
+
const historyEntrySchema$1 = object({
|
|
5674
|
+
event: sessionEventSchema$1,
|
|
5675
|
+
view: toolEventViewSchema$1.optional()
|
|
5676
|
+
});
|
|
5677
|
+
/**
|
|
5678
|
+
* Projection baseline passthrough: `values` stays a wide record — each value
|
|
5679
|
+
* was already parsed by its provider's own schema on the host side, and
|
|
5680
|
+
* deep-validating here would import every domain's schema into the carrier.
|
|
5681
|
+
*/
|
|
5682
|
+
const sessionProjectionsBlockSchema$1 = object({
|
|
5683
|
+
asOfSeq: number().int().min(-1),
|
|
5684
|
+
values: record(string(), unknown())
|
|
5685
|
+
});
|
|
5686
|
+
object({
|
|
5687
|
+
blank: boolean(),
|
|
5688
|
+
lastPromptAt: number().nullable()
|
|
5689
|
+
});
|
|
5690
|
+
object({
|
|
5691
|
+
maxImageBytes: number().int().positive(),
|
|
5692
|
+
maxImagesPerMessage: number().int().positive(),
|
|
5693
|
+
maxMessageImageBytes: number().int().positive(),
|
|
5694
|
+
maxImagePixels: number().int().positive(),
|
|
5695
|
+
mediaTypes: array(string())
|
|
5696
|
+
});
|
|
5697
|
+
/** session.history response value (projections rides the tail page only). */
|
|
5698
|
+
const sessionHistoryValueSchema$1 = object({
|
|
5699
|
+
events: array(historyEntrySchema$1),
|
|
5700
|
+
hasMore: boolean(),
|
|
5701
|
+
projections: sessionProjectionsBlockSchema$1.optional()
|
|
5702
|
+
});
|
|
5703
|
+
object({ sessionId: sessionIdSchema$1 });
|
|
5704
|
+
/** session.models response value. */
|
|
5705
|
+
const sessionModelsValueSchema$1 = object({
|
|
5706
|
+
current: modelSelectionSchema$1,
|
|
5707
|
+
routable: boolean(),
|
|
5708
|
+
groups: array(modelProviderGroupSchema$1),
|
|
5709
|
+
failures: array(modelCatalogFailureSchema$1)
|
|
5710
|
+
});
|
|
5711
|
+
object({
|
|
5712
|
+
sessionId: sessionIdSchema$1,
|
|
5713
|
+
provider: string().min(1),
|
|
5238
5714
|
model: string().min(1),
|
|
5239
5715
|
reasoningEffort: string().min(1).optional()
|
|
5240
5716
|
});
|
|
5241
5717
|
/** session.selectModel response value. */
|
|
5242
|
-
const sessionSelectModelValueSchema = object({ selected: modelSelectionSchema });
|
|
5718
|
+
const sessionSelectModelValueSchema$1 = object({ selected: modelSelectionSchema$1 });
|
|
5243
5719
|
/** ContentBlock passthrough: core is merge-extensible — the type discriminant envelope is strict, the rest stays wide. */
|
|
5244
|
-
const contentBlockSchema = looseObject({ type: string() });
|
|
5720
|
+
const contentBlockSchema$1 = looseObject({ type: string() });
|
|
5245
5721
|
/** Raster image media types accepted by the version-one browser wire. */
|
|
5246
|
-
const imageMediaTypeSchema = union([
|
|
5722
|
+
const imageMediaTypeSchema$1 = union([
|
|
5247
5723
|
literal("image/png"),
|
|
5248
5724
|
literal("image/jpeg"),
|
|
5249
5725
|
literal("image/webp"),
|
|
5250
5726
|
literal("image/gif")
|
|
5251
5727
|
]);
|
|
5252
5728
|
/** Prompt wire content is intentionally narrower than merge-extensible durable core content. */
|
|
5253
|
-
const promptContentPartSchema = discriminatedUnion("type", [object({
|
|
5729
|
+
const promptContentPartSchema$1 = discriminatedUnion("type", [object({
|
|
5254
5730
|
type: literal("text"),
|
|
5255
5731
|
text: string()
|
|
5256
5732
|
}), object({
|
|
5257
5733
|
type: literal("image"),
|
|
5258
|
-
mediaType: imageMediaTypeSchema,
|
|
5734
|
+
mediaType: imageMediaTypeSchema$1,
|
|
5259
5735
|
data: string(),
|
|
5260
5736
|
name: string().optional()
|
|
5261
5737
|
})]);
|
|
5262
5738
|
object({
|
|
5263
|
-
sessionId: sessionIdSchema,
|
|
5739
|
+
sessionId: sessionIdSchema$1,
|
|
5264
5740
|
mode: union([literal("queue"), literal("steer")]),
|
|
5265
|
-
content: array(promptContentPartSchema),
|
|
5741
|
+
content: array(promptContentPartSchema$1),
|
|
5266
5742
|
clientTimeZone: string().optional()
|
|
5267
5743
|
});
|
|
5268
5744
|
/** session.prompt response value (the command slot appears only when the prompt dispatched a slash command). */
|
|
5269
|
-
const sessionPromptValueSchema = object({
|
|
5745
|
+
const sessionPromptValueSchema$1 = object({
|
|
5270
5746
|
accepted: literal(true),
|
|
5271
5747
|
command: object({
|
|
5272
5748
|
kind: literal("success"),
|
|
@@ -5274,42 +5750,42 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5274
5750
|
}).optional()
|
|
5275
5751
|
});
|
|
5276
5752
|
/** Opaque attachment id after string-shape validation. */
|
|
5277
|
-
const attachmentIdSchema = string().min(1);
|
|
5753
|
+
const attachmentIdSchema$1 = string().min(1);
|
|
5278
5754
|
/** Durable image reference returned from the authenticated session lookup. */
|
|
5279
|
-
const imageAttachmentRefSchema = object({
|
|
5280
|
-
attachmentId: attachmentIdSchema,
|
|
5281
|
-
mediaType: imageMediaTypeSchema,
|
|
5755
|
+
const imageAttachmentRefSchema$1 = object({
|
|
5756
|
+
attachmentId: attachmentIdSchema$1,
|
|
5757
|
+
mediaType: imageMediaTypeSchema$1,
|
|
5282
5758
|
bytes: number().int().positive(),
|
|
5283
5759
|
width: number().int().positive(),
|
|
5284
5760
|
height: number().int().positive(),
|
|
5285
5761
|
name: string().optional()
|
|
5286
5762
|
});
|
|
5287
5763
|
object({
|
|
5288
|
-
sessionId: sessionIdSchema,
|
|
5289
|
-
attachmentId: attachmentIdSchema
|
|
5764
|
+
sessionId: sessionIdSchema$1,
|
|
5765
|
+
attachmentId: attachmentIdSchema$1
|
|
5290
5766
|
});
|
|
5291
5767
|
/** session.attachment response value. */
|
|
5292
|
-
const sessionAttachmentValueSchema = object({
|
|
5293
|
-
attachment: imageAttachmentRefSchema,
|
|
5768
|
+
const sessionAttachmentValueSchema$1 = object({
|
|
5769
|
+
attachment: imageAttachmentRefSchema$1,
|
|
5294
5770
|
data: string()
|
|
5295
5771
|
});
|
|
5296
5772
|
object({
|
|
5297
|
-
sessionId: sessionIdSchema,
|
|
5298
|
-
itemId: messageIdSchema$
|
|
5773
|
+
sessionId: sessionIdSchema$1,
|
|
5774
|
+
itemId: messageIdSchema$2,
|
|
5299
5775
|
action: discriminatedUnion("kind", [
|
|
5300
5776
|
object({
|
|
5301
5777
|
kind: literal("edit"),
|
|
5302
|
-
content: array(contentBlockSchema)
|
|
5778
|
+
content: array(contentBlockSchema$1)
|
|
5303
5779
|
}),
|
|
5304
5780
|
object({ kind: literal("remove") }),
|
|
5305
5781
|
object({ kind: literal("steer") })
|
|
5306
5782
|
])
|
|
5307
5783
|
});
|
|
5308
5784
|
/** session.updateQueue response value. */
|
|
5309
|
-
const sessionUpdateQueueValueSchema = object({ accepted: literal(true) });
|
|
5310
|
-
object({ sessionId: sessionIdSchema });
|
|
5785
|
+
const sessionUpdateQueueValueSchema$1 = object({ accepted: literal(true) });
|
|
5786
|
+
object({ sessionId: sessionIdSchema$1 });
|
|
5311
5787
|
/** session.cancel response value. */
|
|
5312
|
-
const sessionCancelValueSchema = object({ accepted: literal(true) });
|
|
5788
|
+
const sessionCancelValueSchema$1 = object({ accepted: literal(true) });
|
|
5313
5789
|
//#endregion
|
|
5314
5790
|
//#region ../../stubs/xrk-host-apiproxy/lib/types/api/approvals.schema.js
|
|
5315
5791
|
/**
|
|
@@ -5318,10 +5794,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5318
5794
|
* ApprovalRequestId brand cast point: one.
|
|
5319
5795
|
*/
|
|
5320
5796
|
/** ApprovalRequestId: one brand cast after schema validation (the only cast point in this domain). */
|
|
5321
|
-
const approvalRequestIdSchema = string().min(1);
|
|
5797
|
+
const approvalRequestIdSchema$1 = string().min(1);
|
|
5322
5798
|
object({
|
|
5323
|
-
sessionId: sessionIdSchema,
|
|
5324
|
-
approvalId: approvalRequestIdSchema,
|
|
5799
|
+
sessionId: sessionIdSchema$1,
|
|
5800
|
+
approvalId: approvalRequestIdSchema$1,
|
|
5325
5801
|
outcome: union([literal("allowed-once"), literal("rejected")])
|
|
5326
5802
|
});
|
|
5327
5803
|
/**
|
|
@@ -5329,7 +5805,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5329
5805
|
* extend the registry's kind map by declaration merging, so the closed set is
|
|
5330
5806
|
* not knowable at this boundary.
|
|
5331
5807
|
*/
|
|
5332
|
-
const taskViewSchema = object({
|
|
5808
|
+
const taskViewSchema$1 = object({
|
|
5333
5809
|
id: string().min(1),
|
|
5334
5810
|
kind: string().min(1),
|
|
5335
5811
|
label: string().min(1),
|
|
@@ -5352,51 +5828,51 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5352
5828
|
* is re-exported here as the domain-local name.
|
|
5353
5829
|
*/
|
|
5354
5830
|
/** WorkspaceView row of every workspace.* response. */
|
|
5355
|
-
const workspaceViewSchema = object({
|
|
5356
|
-
workspaceId: workspaceIdSchema,
|
|
5831
|
+
const workspaceViewSchema$1 = object({
|
|
5832
|
+
workspaceId: workspaceIdSchema$1,
|
|
5357
5833
|
path: string(),
|
|
5358
5834
|
title: string(),
|
|
5359
|
-
sessionIds: array(sessionIdSchema),
|
|
5835
|
+
sessionIds: array(sessionIdSchema$1),
|
|
5360
5836
|
createdAt: string(),
|
|
5361
5837
|
updatedAt: string()
|
|
5362
5838
|
});
|
|
5363
5839
|
object({});
|
|
5364
5840
|
/** workspace.list response value. */
|
|
5365
|
-
const workspaceListValueSchema = object({
|
|
5366
|
-
items: array(workspaceViewSchema),
|
|
5367
|
-
archivedSessionIds: array(sessionIdSchema)
|
|
5841
|
+
const workspaceListValueSchema$1 = object({
|
|
5842
|
+
items: array(workspaceViewSchema$1),
|
|
5843
|
+
archivedSessionIds: array(sessionIdSchema$1)
|
|
5368
5844
|
});
|
|
5369
5845
|
object({ path: string() });
|
|
5370
5846
|
/** workspace.create response value. */
|
|
5371
|
-
const workspaceCreateValueSchema = object({
|
|
5372
|
-
workspace: workspaceViewSchema,
|
|
5847
|
+
const workspaceCreateValueSchema$1 = object({
|
|
5848
|
+
workspace: workspaceViewSchema$1,
|
|
5373
5849
|
created: boolean()
|
|
5374
5850
|
});
|
|
5375
5851
|
object({
|
|
5376
|
-
workspaceId: workspaceIdSchema,
|
|
5852
|
+
workspaceId: workspaceIdSchema$1,
|
|
5377
5853
|
title: string()
|
|
5378
5854
|
}).refine((payload) => payload.title.trim() !== "", { message: "workspace.rename requires a non-blank title" });
|
|
5379
5855
|
/** workspace.rename response value. */
|
|
5380
|
-
const workspaceRenameValueSchema = object({ workspace: workspaceViewSchema });
|
|
5381
|
-
object({ workspaceId: workspaceIdSchema });
|
|
5856
|
+
const workspaceRenameValueSchema$1 = object({ workspace: workspaceViewSchema$1 });
|
|
5857
|
+
object({ workspaceId: workspaceIdSchema$1 });
|
|
5382
5858
|
/** workspace.delete response value. */
|
|
5383
|
-
const workspaceDeleteValueSchema = object({ deleted: literal(true) });
|
|
5859
|
+
const workspaceDeleteValueSchema$1 = object({ deleted: literal(true) });
|
|
5384
5860
|
object({
|
|
5385
|
-
workspaceId: workspaceIdSchema,
|
|
5386
|
-
beforeWorkspaceId: workspaceIdSchema.optional()
|
|
5861
|
+
workspaceId: workspaceIdSchema$1,
|
|
5862
|
+
beforeWorkspaceId: workspaceIdSchema$1.optional()
|
|
5387
5863
|
});
|
|
5388
5864
|
/** workspace.insertBefore response value: the complete durable display order. */
|
|
5389
|
-
const workspaceInsertBeforeValueSchema = object({ workspaceIds: array(workspaceIdSchema) });
|
|
5865
|
+
const workspaceInsertBeforeValueSchema$1 = object({ workspaceIds: array(workspaceIdSchema$1) });
|
|
5390
5866
|
object({
|
|
5391
|
-
workspaceId: workspaceIdSchema,
|
|
5392
|
-
sessionId: sessionIdSchema,
|
|
5393
|
-
beforeSessionId: sessionIdSchema.optional()
|
|
5867
|
+
workspaceId: workspaceIdSchema$1,
|
|
5868
|
+
sessionId: sessionIdSchema$1,
|
|
5869
|
+
beforeSessionId: sessionIdSchema$1.optional()
|
|
5394
5870
|
});
|
|
5395
5871
|
/** workspace.insertSessionBefore response value. */
|
|
5396
|
-
const workspaceInsertSessionBeforeValueSchema = object({ workspace: workspaceViewSchema });
|
|
5397
|
-
object({ sessionId: sessionIdSchema });
|
|
5872
|
+
const workspaceInsertSessionBeforeValueSchema$1 = object({ workspace: workspaceViewSchema$1 });
|
|
5873
|
+
object({ sessionId: sessionIdSchema$1 });
|
|
5398
5874
|
/** workspace.archiveSession response value: the full updated archive set. */
|
|
5399
|
-
const workspaceArchiveSessionValueSchema = object({ archivedSessionIds: array(sessionIdSchema) });
|
|
5875
|
+
const workspaceArchiveSessionValueSchema$1 = object({ archivedSessionIds: array(sessionIdSchema$1) });
|
|
5400
5876
|
//#endregion
|
|
5401
5877
|
//#region ../../stubs/xrk-host-apiproxy/lib/types/api/events.schema.js
|
|
5402
5878
|
/**
|
|
@@ -5405,7 +5881,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5405
5881
|
* a session/event frame reuses sessions.schema's strict-envelope + wide-data passthrough branch.
|
|
5406
5882
|
*/
|
|
5407
5883
|
/** Question fields validated strictly against core dsh-user-questions. */
|
|
5408
|
-
const askUserQuestionItemSchema = object({
|
|
5884
|
+
const askUserQuestionItemSchema$1 = object({
|
|
5409
5885
|
id: string(),
|
|
5410
5886
|
question: string(),
|
|
5411
5887
|
header: string().optional(),
|
|
@@ -5421,41 +5897,41 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5421
5897
|
})]).optional()
|
|
5422
5898
|
});
|
|
5423
5899
|
/** Unified message envelope carried by transient queue frames. */
|
|
5424
|
-
const messageSchema = object({
|
|
5900
|
+
const messageSchema$1 = object({
|
|
5425
5901
|
id: string().min(1),
|
|
5426
5902
|
role: union([
|
|
5427
5903
|
literal("system"),
|
|
5428
5904
|
literal("user"),
|
|
5429
5905
|
literal("assistant")
|
|
5430
5906
|
]),
|
|
5431
|
-
content: array(contentBlockSchema),
|
|
5907
|
+
content: array(contentBlockSchema$1),
|
|
5432
5908
|
source: looseObject({ kind: string() })
|
|
5433
5909
|
});
|
|
5434
5910
|
/** MuxFrame union (payload slot of a mux-stream ServerRequest). */
|
|
5435
|
-
const muxFrameSchema = discriminatedUnion("type", [
|
|
5911
|
+
const muxFrameSchema$1 = discriminatedUnion("type", [
|
|
5436
5912
|
object({
|
|
5437
5913
|
type: literal("session/event"),
|
|
5438
|
-
sessionId: sessionIdSchema,
|
|
5439
|
-
event: sessionEventSchema,
|
|
5440
|
-
view: toolEventViewSchema.optional()
|
|
5914
|
+
sessionId: sessionIdSchema$1,
|
|
5915
|
+
event: sessionEventSchema$1,
|
|
5916
|
+
view: toolEventViewSchema$1.optional()
|
|
5441
5917
|
}),
|
|
5442
5918
|
object({
|
|
5443
5919
|
type: literal("session/subscribed"),
|
|
5444
|
-
sessionId: sessionIdSchema,
|
|
5920
|
+
sessionId: sessionIdSchema$1,
|
|
5445
5921
|
lastSeq: number().int()
|
|
5446
5922
|
}),
|
|
5447
5923
|
object({
|
|
5448
5924
|
type: literal("approval/requested"),
|
|
5449
|
-
sessionId: sessionIdSchema,
|
|
5450
|
-
approvalId: approvalRequestIdSchema,
|
|
5925
|
+
sessionId: sessionIdSchema$1,
|
|
5926
|
+
approvalId: approvalRequestIdSchema$1,
|
|
5451
5927
|
toolName: string(),
|
|
5452
5928
|
callId: string().optional(),
|
|
5453
5929
|
reason: string().optional()
|
|
5454
5930
|
}),
|
|
5455
5931
|
object({
|
|
5456
5932
|
type: literal("approval/resolved"),
|
|
5457
|
-
sessionId: sessionIdSchema,
|
|
5458
|
-
approvalId: approvalRequestIdSchema,
|
|
5933
|
+
sessionId: sessionIdSchema$1,
|
|
5934
|
+
approvalId: approvalRequestIdSchema$1,
|
|
5459
5935
|
outcome: union([
|
|
5460
5936
|
literal("allowed-once"),
|
|
5461
5937
|
literal("rejected"),
|
|
@@ -5465,36 +5941,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5465
5941
|
}),
|
|
5466
5942
|
object({
|
|
5467
5943
|
type: literal("question/requested"),
|
|
5468
|
-
sessionId: sessionIdSchema,
|
|
5469
|
-
questions: array(askUserQuestionItemSchema).min(1)
|
|
5944
|
+
sessionId: sessionIdSchema$1,
|
|
5945
|
+
questions: array(askUserQuestionItemSchema$1).min(1)
|
|
5470
5946
|
}),
|
|
5471
5947
|
object({
|
|
5472
5948
|
type: literal("question/resolved"),
|
|
5473
|
-
sessionId: sessionIdSchema,
|
|
5949
|
+
sessionId: sessionIdSchema$1,
|
|
5474
5950
|
questionRpcId: rpcIdSchema,
|
|
5475
5951
|
outcome: union([literal("answered"), literal("cancelled")])
|
|
5476
5952
|
}),
|
|
5477
5953
|
object({
|
|
5478
5954
|
type: literal("session/queue"),
|
|
5479
|
-
sessionId: sessionIdSchema,
|
|
5955
|
+
sessionId: sessionIdSchema$1,
|
|
5480
5956
|
items: array(object({
|
|
5481
|
-
id: messageIdSchema$
|
|
5957
|
+
id: messageIdSchema$2,
|
|
5482
5958
|
placement: union([
|
|
5483
5959
|
literal("queued"),
|
|
5484
5960
|
literal("steering"),
|
|
5485
5961
|
literal("context")
|
|
5486
5962
|
]),
|
|
5487
|
-
message: messageSchema
|
|
5963
|
+
message: messageSchema$1
|
|
5488
5964
|
}))
|
|
5489
5965
|
}),
|
|
5490
5966
|
object({
|
|
5491
5967
|
type: literal("session/jobs"),
|
|
5492
|
-
sessionId: sessionIdSchema,
|
|
5493
|
-
jobs: array(taskViewSchema)
|
|
5968
|
+
sessionId: sessionIdSchema$1,
|
|
5969
|
+
jobs: array(taskViewSchema$1)
|
|
5494
5970
|
}),
|
|
5495
5971
|
object({
|
|
5496
5972
|
type: literal("session/projection"),
|
|
5497
|
-
sessionId: sessionIdSchema,
|
|
5973
|
+
sessionId: sessionIdSchema$1,
|
|
5498
5974
|
key: string().min(1),
|
|
5499
5975
|
value: unknown(),
|
|
5500
5976
|
seq: number().int().nonnegative()
|
|
@@ -5505,45 +5981,45 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5505
5981
|
})
|
|
5506
5982
|
]);
|
|
5507
5983
|
/** HostFrame union (payload slot of a host-stream ServerRequest). */
|
|
5508
|
-
const hostFrameSchema = discriminatedUnion("type", [
|
|
5984
|
+
const hostFrameSchema$1 = discriminatedUnion("type", [
|
|
5509
5985
|
object({
|
|
5510
5986
|
type: literal("host/session-added"),
|
|
5511
|
-
sessionId: sessionIdSchema,
|
|
5987
|
+
sessionId: sessionIdSchema$1,
|
|
5512
5988
|
blank: boolean(),
|
|
5513
|
-
parentSessionId: sessionIdSchema.optional(),
|
|
5989
|
+
parentSessionId: sessionIdSchema$1.optional(),
|
|
5514
5990
|
origin: literal("subagent").optional(),
|
|
5515
5991
|
cwd: string().optional(),
|
|
5516
5992
|
agentPreset: string().optional()
|
|
5517
5993
|
}),
|
|
5518
5994
|
object({
|
|
5519
5995
|
type: literal("host/session-removed"),
|
|
5520
|
-
sessionId: sessionIdSchema
|
|
5996
|
+
sessionId: sessionIdSchema$1
|
|
5521
5997
|
}),
|
|
5522
5998
|
object({
|
|
5523
5999
|
type: literal("host/session-status"),
|
|
5524
|
-
sessionId: sessionIdSchema,
|
|
6000
|
+
sessionId: sessionIdSchema$1,
|
|
5525
6001
|
running: boolean()
|
|
5526
6002
|
}),
|
|
5527
6003
|
object({
|
|
5528
6004
|
type: literal("host/agent-error"),
|
|
5529
|
-
sessionId: sessionIdSchema,
|
|
6005
|
+
sessionId: sessionIdSchema$1,
|
|
5530
6006
|
message: string()
|
|
5531
6007
|
}),
|
|
5532
6008
|
object({
|
|
5533
6009
|
type: literal("host/workspace-changed"),
|
|
5534
|
-
workspace: workspaceViewSchema
|
|
6010
|
+
workspace: workspaceViewSchema$1
|
|
5535
6011
|
}),
|
|
5536
6012
|
object({
|
|
5537
6013
|
type: literal("host/workspace-removed"),
|
|
5538
|
-
workspaceId: workspaceIdSchema
|
|
6014
|
+
workspaceId: workspaceIdSchema$1
|
|
5539
6015
|
}),
|
|
5540
6016
|
object({
|
|
5541
6017
|
type: literal("host/workspace-order-changed"),
|
|
5542
|
-
workspaceIds: array(workspaceIdSchema)
|
|
6018
|
+
workspaceIds: array(workspaceIdSchema$1)
|
|
5543
6019
|
}),
|
|
5544
6020
|
object({
|
|
5545
6021
|
type: literal("host/archived-sessions-changed"),
|
|
5546
|
-
archivedSessionIds: array(sessionIdSchema)
|
|
6022
|
+
archivedSessionIds: array(sessionIdSchema$1)
|
|
5547
6023
|
}),
|
|
5548
6024
|
object({
|
|
5549
6025
|
type: literal("host/remote-event"),
|
|
@@ -5605,7 +6081,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5605
6081
|
whenToUse: string().optional(),
|
|
5606
6082
|
modelInvocable: boolean()
|
|
5607
6083
|
});
|
|
5608
|
-
object({ sessionId: sessionIdSchema });
|
|
6084
|
+
object({ sessionId: sessionIdSchema$1 });
|
|
5609
6085
|
/** skill.list response value. */
|
|
5610
6086
|
const skillListValueSchema = object({ skills: array(skillEntrySchema) });
|
|
5611
6087
|
//#endregion
|
|
@@ -5631,7 +6107,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5631
6107
|
hasDocument: boolean()
|
|
5632
6108
|
});
|
|
5633
6109
|
object({
|
|
5634
|
-
sessionId: sessionIdSchema,
|
|
6110
|
+
sessionId: sessionIdSchema$1,
|
|
5635
6111
|
agentPreset: string().min(1)
|
|
5636
6112
|
});
|
|
5637
6113
|
/** agentPreset.select response value. */
|
|
@@ -5825,8 +6301,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5825
6301
|
object({});
|
|
5826
6302
|
/** llm.models response value. */
|
|
5827
6303
|
const llmModelsValueSchema = object({
|
|
5828
|
-
groups: array(modelProviderGroupSchema),
|
|
5829
|
-
failures: array(modelCatalogFailureSchema)
|
|
6304
|
+
groups: array(modelProviderGroupSchema$1),
|
|
6305
|
+
failures: array(modelCatalogFailureSchema$1)
|
|
5830
6306
|
});
|
|
5831
6307
|
/** DiscoveredModelView row of llm.discoverModels. */
|
|
5832
6308
|
const discoveredModelViewSchema = object({
|
|
@@ -5851,7 +6327,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5851
6327
|
const subagentListEntrySchema = union([
|
|
5852
6328
|
object({
|
|
5853
6329
|
kind: literal("child"),
|
|
5854
|
-
id: sessionIdSchema,
|
|
6330
|
+
id: sessionIdSchema$1,
|
|
5855
6331
|
mode: literal("one-shot"),
|
|
5856
6332
|
activity: union([literal("running"), literal("inactive")]),
|
|
5857
6333
|
hasChildren: boolean(),
|
|
@@ -5859,7 +6335,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5859
6335
|
}),
|
|
5860
6336
|
object({
|
|
5861
6337
|
kind: literal("child"),
|
|
5862
|
-
id: sessionIdSchema,
|
|
6338
|
+
id: sessionIdSchema$1,
|
|
5863
6339
|
mode: literal("continuable"),
|
|
5864
6340
|
activity: union([literal("running"), literal("inactive")]),
|
|
5865
6341
|
hasChildren: boolean(),
|
|
@@ -5867,7 +6343,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5867
6343
|
}),
|
|
5868
6344
|
object({
|
|
5869
6345
|
kind: literal("diagnostic"),
|
|
5870
|
-
id: sessionIdSchema,
|
|
6346
|
+
id: sessionIdSchema$1,
|
|
5871
6347
|
reason: union([
|
|
5872
6348
|
literal("corrupt"),
|
|
5873
6349
|
literal("unsupported"),
|
|
@@ -5875,35 +6351,35 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5875
6351
|
])
|
|
5876
6352
|
})
|
|
5877
6353
|
]);
|
|
5878
|
-
object({ parentSessionId: sessionIdSchema });
|
|
6354
|
+
object({ parentSessionId: sessionIdSchema$1 });
|
|
5879
6355
|
/** subagent.list response value. */
|
|
5880
6356
|
const subagentListValueSchema = object({
|
|
5881
6357
|
entries: array(subagentListEntrySchema),
|
|
5882
6358
|
parentAvailable: boolean()
|
|
5883
6359
|
});
|
|
5884
6360
|
object({
|
|
5885
|
-
parentSessionId: sessionIdSchema,
|
|
5886
|
-
childSessionId: sessionIdSchema,
|
|
6361
|
+
parentSessionId: sessionIdSchema$1,
|
|
6362
|
+
childSessionId: sessionIdSchema$1,
|
|
5887
6363
|
mode: union([literal("one-shot"), literal("continuable")]),
|
|
5888
6364
|
beforeSeq: number().int().nonnegative().optional(),
|
|
5889
6365
|
maxMessages: number().int().positive().optional()
|
|
5890
6366
|
});
|
|
5891
6367
|
/** subagent.history response value. */
|
|
5892
6368
|
const subagentHistoryValueSchema = object({
|
|
5893
|
-
events: array(historyEntrySchema),
|
|
6369
|
+
events: array(historyEntrySchema$1),
|
|
5894
6370
|
hasMore: boolean(),
|
|
5895
|
-
projections: sessionProjectionsBlockSchema.optional()
|
|
6371
|
+
projections: sessionProjectionsBlockSchema$1.optional()
|
|
5896
6372
|
});
|
|
5897
6373
|
object({
|
|
5898
|
-
parentSessionId: sessionIdSchema,
|
|
5899
|
-
childSessionId: sessionIdSchema,
|
|
6374
|
+
parentSessionId: sessionIdSchema$1,
|
|
6375
|
+
childSessionId: sessionIdSchema$1,
|
|
5900
6376
|
mode: literal("continuable"),
|
|
5901
|
-
content: array(contentBlockSchema),
|
|
6377
|
+
content: array(contentBlockSchema$1),
|
|
5902
6378
|
clientTimeZone: string().optional()
|
|
5903
6379
|
});
|
|
5904
6380
|
object({
|
|
5905
|
-
parentSessionId: sessionIdSchema,
|
|
5906
|
-
childSessionId: sessionIdSchema,
|
|
6381
|
+
parentSessionId: sessionIdSchema$1,
|
|
6382
|
+
childSessionId: sessionIdSchema$1,
|
|
5907
6383
|
mode: literal("continuable")
|
|
5908
6384
|
});
|
|
5909
6385
|
/** subagent.interrupt response value. */
|
|
@@ -5921,18 +6397,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5921
6397
|
* mirror of the handler's request table; key coverage compiler-enforced against RpcMethodMap).
|
|
5922
6398
|
*/
|
|
5923
6399
|
const UNARY_VALUE_SCHEMAS = {
|
|
5924
|
-
"session.list": sessionListValueSchema,
|
|
5925
|
-
"session.search": sessionSearchValueSchema,
|
|
5926
|
-
"session.create": sessionCreateValueSchema,
|
|
5927
|
-
"session.history": sessionHistoryValueSchema,
|
|
5928
|
-
"session.models": sessionModelsValueSchema,
|
|
5929
|
-
"session.selectModel": sessionSelectModelValueSchema,
|
|
5930
|
-
"session.rename": sessionRenameValueSchema,
|
|
5931
|
-
"session.fork": sessionForkValueSchema,
|
|
5932
|
-
"session.prompt": sessionPromptValueSchema,
|
|
5933
|
-
"session.attachment": sessionAttachmentValueSchema,
|
|
5934
|
-
"session.updateQueue": sessionUpdateQueueValueSchema,
|
|
5935
|
-
"session.cancel": sessionCancelValueSchema,
|
|
6400
|
+
"session.list": sessionListValueSchema$1,
|
|
6401
|
+
"session.search": sessionSearchValueSchema$1,
|
|
6402
|
+
"session.create": sessionCreateValueSchema$1,
|
|
6403
|
+
"session.history": sessionHistoryValueSchema$1,
|
|
6404
|
+
"session.models": sessionModelsValueSchema$1,
|
|
6405
|
+
"session.selectModel": sessionSelectModelValueSchema$1,
|
|
6406
|
+
"session.rename": sessionRenameValueSchema$1,
|
|
6407
|
+
"session.fork": sessionForkValueSchema$1,
|
|
6408
|
+
"session.prompt": sessionPromptValueSchema$1,
|
|
6409
|
+
"session.attachment": sessionAttachmentValueSchema$1,
|
|
6410
|
+
"session.updateQueue": sessionUpdateQueueValueSchema$1,
|
|
6411
|
+
"session.cancel": sessionCancelValueSchema$1,
|
|
5936
6412
|
"subagent.list": subagentListValueSchema,
|
|
5937
6413
|
"subagent.history": subagentHistoryValueSchema,
|
|
5938
6414
|
"subagent.prompt": object({ messageId: string() }),
|
|
@@ -5942,13 +6418,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5942
6418
|
"host.listDirectory": hostListDirectoryValueSchema,
|
|
5943
6419
|
"host.createDirectory": hostCreateDirectoryValueSchema,
|
|
5944
6420
|
"host.openPath": hostOpenPathValueSchema,
|
|
5945
|
-
"workspace.list": workspaceListValueSchema,
|
|
5946
|
-
"workspace.create": workspaceCreateValueSchema,
|
|
5947
|
-
"workspace.rename": workspaceRenameValueSchema,
|
|
5948
|
-
"workspace.delete": workspaceDeleteValueSchema,
|
|
5949
|
-
"workspace.insertBefore": workspaceInsertBeforeValueSchema,
|
|
5950
|
-
"workspace.insertSessionBefore": workspaceInsertSessionBeforeValueSchema,
|
|
5951
|
-
"workspace.archiveSession": workspaceArchiveSessionValueSchema,
|
|
6421
|
+
"workspace.list": workspaceListValueSchema$1,
|
|
6422
|
+
"workspace.create": workspaceCreateValueSchema$1,
|
|
6423
|
+
"workspace.rename": workspaceRenameValueSchema$1,
|
|
6424
|
+
"workspace.delete": workspaceDeleteValueSchema$1,
|
|
6425
|
+
"workspace.insertBefore": workspaceInsertBeforeValueSchema$1,
|
|
6426
|
+
"workspace.insertSessionBefore": workspaceInsertSessionBeforeValueSchema$1,
|
|
6427
|
+
"workspace.archiveSession": workspaceArchiveSessionValueSchema$1,
|
|
5952
6428
|
"skill.list": skillListValueSchema,
|
|
5953
6429
|
"agentPreset.list": agentPresetListValueSchema,
|
|
5954
6430
|
"agentPreset.select": agentPresetSelectValueSchema,
|
|
@@ -6032,7 +6508,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6032
6508
|
return loc?.origin !== void 0 && loc.origin !== "null" ? loc.origin : INTERNAL_BASE$1;
|
|
6033
6509
|
}
|
|
6034
6510
|
mintRpcId() {
|
|
6035
|
-
return RpcId(crypto.randomUUID());
|
|
6511
|
+
return RpcId$1(crypto.randomUUID());
|
|
6036
6512
|
}
|
|
6037
6513
|
/**
|
|
6038
6514
|
* Shared POST leg of both C→S carriers (callUnary/respond): JSON body,
|
|
@@ -6081,11 +6557,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6081
6557
|
}
|
|
6082
6558
|
/** Mux stream opener; virtual for the same override reason as callUnary. */
|
|
6083
6559
|
openMux(_payload, signal, onOpen) {
|
|
6084
|
-
return this.readSse("/api/events.mux", signal, muxFrameSchema, onOpen);
|
|
6560
|
+
return this.readSse("/api/events.mux", signal, muxFrameSchema$1, onOpen);
|
|
6085
6561
|
}
|
|
6086
6562
|
/** Host stream opener; virtual. */
|
|
6087
6563
|
openHost(_payload, signal, onOpen) {
|
|
6088
|
-
return this.readSse("/api/events.host", signal, hostFrameSchema, onOpen);
|
|
6564
|
+
return this.readSse("/api/events.host", signal, hostFrameSchema$1, onOpen);
|
|
6089
6565
|
}
|
|
6090
6566
|
/**
|
|
6091
6567
|
* SSE protocol path: streaming fetch (not EventSource), '\n\n' framing, ServerRequest envelope +
|
|
@@ -6243,13 +6719,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6243
6719
|
}];
|
|
6244
6720
|
}
|
|
6245
6721
|
function userMessage(content, source = { kind: "user" }) {
|
|
6246
|
-
return
|
|
6722
|
+
return createUserMessage({
|
|
6247
6723
|
content,
|
|
6248
6724
|
source
|
|
6249
6725
|
});
|
|
6250
6726
|
}
|
|
6251
6727
|
function assistantMessage(content, model = "fx-1") {
|
|
6252
|
-
return
|
|
6728
|
+
return createAssistantMessage({
|
|
6253
6729
|
content,
|
|
6254
6730
|
source: {
|
|
6255
6731
|
provider: "fixture",
|
|
@@ -6258,8 +6734,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6258
6734
|
});
|
|
6259
6735
|
}
|
|
6260
6736
|
function toolResultMessage(callId, content, isError) {
|
|
6261
|
-
return
|
|
6262
|
-
callId:
|
|
6737
|
+
return createToolResultMessage({
|
|
6738
|
+
callId: CallId(callId),
|
|
6263
6739
|
content,
|
|
6264
6740
|
isError
|
|
6265
6741
|
});
|
|
@@ -7358,7 +7834,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7358
7834
|
};
|
|
7359
7835
|
break;
|
|
7360
7836
|
case "assistant/chunk":
|
|
7361
|
-
if (openStep !== null && openStep.turn === event.data.turn && openStep.step === event.data.step && openStep.firstTokenTime === null &&
|
|
7837
|
+
if (openStep !== null && openStep.turn === event.data.turn && openStep.step === event.data.step && openStep.firstTokenTime === null && isTokenDelta(event.data.chunk)) openStep.firstTokenTime = event.time;
|
|
7362
7838
|
break;
|
|
7363
7839
|
case "assistant/message":
|
|
7364
7840
|
if (openStep === null || openStep.turn !== event.data.turn || openStep.step !== event.data.step) break;
|
|
@@ -9838,6 +10314,480 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9838
10314
|
};
|
|
9839
10315
|
}
|
|
9840
10316
|
//#endregion
|
|
10317
|
+
//#region ../../stubs/xrk-host-apiproxy/src/api/sessions.schema.ts
|
|
10318
|
+
/**
|
|
10319
|
+
* sessions domain zod schemas (names derived from map keys: sessionListRequestSchema /
|
|
10320
|
+
* sessionListValueSchema). SessionEvent passthrough = strict envelope (type/seq/time) + wide
|
|
10321
|
+
* data: the merge-extensible event API keeps an unknown-type branch at the union level,
|
|
10322
|
+
* with no field-level passthrough. SessionId brand cast point: sessionIdSchema, and only there.
|
|
10323
|
+
*/
|
|
10324
|
+
/** SessionId: one brand cast after schema validation (the only cast point in this domain). */
|
|
10325
|
+
const sessionIdSchema = string().min(1);
|
|
10326
|
+
/** MessageId: one brand cast after non-empty string validation. */
|
|
10327
|
+
const messageIdSchema = string().min(1);
|
|
10328
|
+
/**
|
|
10329
|
+
* WorkspaceId: the workspace domain's one brand cast. Hosted here rather
|
|
10330
|
+
* than in workspace.schema because session.create references it while
|
|
10331
|
+
* workspace.schema references sessionIdSchema — schema modules must stay a
|
|
10332
|
+
* DAG (both casts used at module top level; a cycle is a load-time TDZ).
|
|
10333
|
+
*/
|
|
10334
|
+
const workspaceIdSchema = string().min(1);
|
|
10335
|
+
/** SessionEvent passthrough: strict envelope, wide data (the client fold handles unknown types via its documented default). */
|
|
10336
|
+
const sessionEventSchema = object({
|
|
10337
|
+
type: string(),
|
|
10338
|
+
seq: number().int().nonnegative(),
|
|
10339
|
+
time: number(),
|
|
10340
|
+
data: unknown(),
|
|
10341
|
+
sourceEventSeqs: array(number()).optional(),
|
|
10342
|
+
surfaceOp: unknown().optional(),
|
|
10343
|
+
ignorable: literal(true).optional()
|
|
10344
|
+
});
|
|
10345
|
+
/** SessionSummary row of session.list (`projections` reuses the history block's shape and schema). */
|
|
10346
|
+
const sessionSummarySchema = object({
|
|
10347
|
+
sessionId: sessionIdSchema,
|
|
10348
|
+
updatedAt: number(),
|
|
10349
|
+
running: boolean(),
|
|
10350
|
+
blank: boolean(),
|
|
10351
|
+
parentSessionId: sessionIdSchema.optional(),
|
|
10352
|
+
origin: literal("subagent").optional(),
|
|
10353
|
+
cwd: string().optional(),
|
|
10354
|
+
agentPreset: string().optional(),
|
|
10355
|
+
projections: lazy(() => sessionProjectionsBlockSchema).optional()
|
|
10356
|
+
});
|
|
10357
|
+
object({ cursor: string().optional() });
|
|
10358
|
+
object({ items: array(sessionSummarySchema) });
|
|
10359
|
+
object({ query: string().trim().min(1).max(500).refine((query) => !query.includes("\0"), { message: "search query must not contain NUL" }) });
|
|
10360
|
+
object({
|
|
10361
|
+
items: array(object({
|
|
10362
|
+
sessionId: sessionIdSchema,
|
|
10363
|
+
snippet: string().refine((snippet) => truncateUnicodeCodePoints$1(snippet, 240) === snippet, { message: `search snippet must contain at most 240 Unicode code points` })
|
|
10364
|
+
})).max(20),
|
|
10365
|
+
hasMore: boolean()
|
|
10366
|
+
});
|
|
10367
|
+
object({
|
|
10368
|
+
workspaceId: workspaceIdSchema.optional(),
|
|
10369
|
+
cwd: string().optional(),
|
|
10370
|
+
sessionId: sessionIdSchema.optional(),
|
|
10371
|
+
agentPreset: string().optional()
|
|
10372
|
+
}).refine((payload) => payload.workspaceId === void 0 || payload.cwd === void 0, { message: "session.create accepts workspaceId or cwd, not both" });
|
|
10373
|
+
object({
|
|
10374
|
+
sessionId: sessionIdSchema,
|
|
10375
|
+
agentPreset: string().optional()
|
|
10376
|
+
});
|
|
10377
|
+
object({
|
|
10378
|
+
sessionId: sessionIdSchema,
|
|
10379
|
+
title: string()
|
|
10380
|
+
});
|
|
10381
|
+
object({
|
|
10382
|
+
title: string().min(1),
|
|
10383
|
+
seq: number().int().nonnegative()
|
|
10384
|
+
});
|
|
10385
|
+
object({
|
|
10386
|
+
sessionId: sessionIdSchema,
|
|
10387
|
+
atSeq: number().int().nonnegative().optional()
|
|
10388
|
+
});
|
|
10389
|
+
object({ sessionId: sessionIdSchema });
|
|
10390
|
+
object({
|
|
10391
|
+
sessionId: sessionIdSchema,
|
|
10392
|
+
beforeSeq: number().int().nonnegative().optional(),
|
|
10393
|
+
maxMessages: number().int().positive().optional()
|
|
10394
|
+
});
|
|
10395
|
+
/** Complete provider/model selection. */
|
|
10396
|
+
const modelSelectionSchema = object({
|
|
10397
|
+
provider: string().min(1),
|
|
10398
|
+
model: string().min(1),
|
|
10399
|
+
reasoningEffort: string().min(1).optional()
|
|
10400
|
+
});
|
|
10401
|
+
/** Exact-model reasoning metadata. */
|
|
10402
|
+
const modelReasoningSchema = object({
|
|
10403
|
+
efforts: array(object({
|
|
10404
|
+
id: string().min(1),
|
|
10405
|
+
name: string().min(1),
|
|
10406
|
+
description: string().optional()
|
|
10407
|
+
})).min(1),
|
|
10408
|
+
defaultEffort: string().min(1).optional()
|
|
10409
|
+
});
|
|
10410
|
+
/** One advisory model entry inside a provider group. */
|
|
10411
|
+
const modelCatalogModelSchema = object({
|
|
10412
|
+
id: string().min(1),
|
|
10413
|
+
name: string().min(1),
|
|
10414
|
+
description: string().optional(),
|
|
10415
|
+
reasoning: modelReasoningSchema.optional()
|
|
10416
|
+
});
|
|
10417
|
+
/** One successfully loaded provider group. */
|
|
10418
|
+
const modelProviderGroupSchema = object({
|
|
10419
|
+
id: string().min(1),
|
|
10420
|
+
name: string().min(1),
|
|
10421
|
+
models: array(modelCatalogModelSchema)
|
|
10422
|
+
});
|
|
10423
|
+
/** One provider-local catalog failure. */
|
|
10424
|
+
const modelCatalogFailureSchema = object({
|
|
10425
|
+
id: string().min(1),
|
|
10426
|
+
name: string().min(1),
|
|
10427
|
+
message: string()
|
|
10428
|
+
});
|
|
10429
|
+
/**
|
|
10430
|
+
* ToolEventView passthrough: lock only the `for` discriminant and the presence
|
|
10431
|
+
* of a card-tagged `view` object. The view interior is a host-computed product
|
|
10432
|
+
* the client reads without echoing back; deep-validating it would hand-copy
|
|
10433
|
+
* the dsh-tools vocabulary into this schema and drift with it.
|
|
10434
|
+
*/
|
|
10435
|
+
const toolEventViewSchema = discriminatedUnion("for", [object({
|
|
10436
|
+
for: literal("call"),
|
|
10437
|
+
view: looseObject({ card: string() })
|
|
10438
|
+
}), object({
|
|
10439
|
+
for: literal("result"),
|
|
10440
|
+
view: looseObject({ card: string() })
|
|
10441
|
+
})]);
|
|
10442
|
+
/** One session.history item: the session event plus its optional host-computed tool view. */
|
|
10443
|
+
const historyEntrySchema = object({
|
|
10444
|
+
event: sessionEventSchema,
|
|
10445
|
+
view: toolEventViewSchema.optional()
|
|
10446
|
+
});
|
|
10447
|
+
/**
|
|
10448
|
+
* Projection baseline passthrough: `values` stays a wide record — each value
|
|
10449
|
+
* was already parsed by its provider's own schema on the host side, and
|
|
10450
|
+
* deep-validating here would import every domain's schema into the carrier.
|
|
10451
|
+
*/
|
|
10452
|
+
const sessionProjectionsBlockSchema = object({
|
|
10453
|
+
asOfSeq: number().int().min(-1),
|
|
10454
|
+
values: record(string(), unknown())
|
|
10455
|
+
});
|
|
10456
|
+
object({
|
|
10457
|
+
blank: boolean(),
|
|
10458
|
+
lastPromptAt: number().nullable()
|
|
10459
|
+
});
|
|
10460
|
+
object({
|
|
10461
|
+
maxImageBytes: number().int().positive(),
|
|
10462
|
+
maxImagesPerMessage: number().int().positive(),
|
|
10463
|
+
maxMessageImageBytes: number().int().positive(),
|
|
10464
|
+
maxImagePixels: number().int().positive(),
|
|
10465
|
+
mediaTypes: array(string())
|
|
10466
|
+
});
|
|
10467
|
+
object({
|
|
10468
|
+
events: array(historyEntrySchema),
|
|
10469
|
+
hasMore: boolean(),
|
|
10470
|
+
projections: sessionProjectionsBlockSchema.optional()
|
|
10471
|
+
});
|
|
10472
|
+
object({ sessionId: sessionIdSchema });
|
|
10473
|
+
object({
|
|
10474
|
+
current: modelSelectionSchema,
|
|
10475
|
+
routable: boolean(),
|
|
10476
|
+
groups: array(modelProviderGroupSchema),
|
|
10477
|
+
failures: array(modelCatalogFailureSchema)
|
|
10478
|
+
});
|
|
10479
|
+
object({
|
|
10480
|
+
sessionId: sessionIdSchema,
|
|
10481
|
+
provider: string().min(1),
|
|
10482
|
+
model: string().min(1),
|
|
10483
|
+
reasoningEffort: string().min(1).optional()
|
|
10484
|
+
});
|
|
10485
|
+
object({ selected: modelSelectionSchema });
|
|
10486
|
+
/** ContentBlock passthrough: core is merge-extensible — the type discriminant envelope is strict, the rest stays wide. */
|
|
10487
|
+
const contentBlockSchema = looseObject({ type: string() });
|
|
10488
|
+
/** Raster image media types accepted by the version-one browser wire. */
|
|
10489
|
+
const imageMediaTypeSchema = union([
|
|
10490
|
+
literal("image/png"),
|
|
10491
|
+
literal("image/jpeg"),
|
|
10492
|
+
literal("image/webp"),
|
|
10493
|
+
literal("image/gif")
|
|
10494
|
+
]);
|
|
10495
|
+
/** Prompt wire content is intentionally narrower than merge-extensible durable core content. */
|
|
10496
|
+
const promptContentPartSchema = discriminatedUnion("type", [object({
|
|
10497
|
+
type: literal("text"),
|
|
10498
|
+
text: string()
|
|
10499
|
+
}), object({
|
|
10500
|
+
type: literal("image"),
|
|
10501
|
+
mediaType: imageMediaTypeSchema,
|
|
10502
|
+
data: string(),
|
|
10503
|
+
name: string().optional()
|
|
10504
|
+
})]);
|
|
10505
|
+
object({
|
|
10506
|
+
sessionId: sessionIdSchema,
|
|
10507
|
+
mode: union([literal("queue"), literal("steer")]),
|
|
10508
|
+
content: array(promptContentPartSchema),
|
|
10509
|
+
clientTimeZone: string().optional()
|
|
10510
|
+
});
|
|
10511
|
+
object({
|
|
10512
|
+
accepted: literal(true),
|
|
10513
|
+
command: object({
|
|
10514
|
+
kind: literal("success"),
|
|
10515
|
+
text: string().optional()
|
|
10516
|
+
}).optional()
|
|
10517
|
+
});
|
|
10518
|
+
/** Opaque attachment id after string-shape validation. */
|
|
10519
|
+
const attachmentIdSchema = string().min(1);
|
|
10520
|
+
/** Durable image reference returned from the authenticated session lookup. */
|
|
10521
|
+
const imageAttachmentRefSchema = object({
|
|
10522
|
+
attachmentId: attachmentIdSchema,
|
|
10523
|
+
mediaType: imageMediaTypeSchema,
|
|
10524
|
+
bytes: number().int().positive(),
|
|
10525
|
+
width: number().int().positive(),
|
|
10526
|
+
height: number().int().positive(),
|
|
10527
|
+
name: string().optional()
|
|
10528
|
+
});
|
|
10529
|
+
object({
|
|
10530
|
+
sessionId: sessionIdSchema,
|
|
10531
|
+
attachmentId: attachmentIdSchema
|
|
10532
|
+
});
|
|
10533
|
+
object({
|
|
10534
|
+
attachment: imageAttachmentRefSchema,
|
|
10535
|
+
data: string()
|
|
10536
|
+
});
|
|
10537
|
+
object({
|
|
10538
|
+
sessionId: sessionIdSchema,
|
|
10539
|
+
itemId: messageIdSchema,
|
|
10540
|
+
action: discriminatedUnion("kind", [
|
|
10541
|
+
object({
|
|
10542
|
+
kind: literal("edit"),
|
|
10543
|
+
content: array(contentBlockSchema)
|
|
10544
|
+
}),
|
|
10545
|
+
object({ kind: literal("remove") }),
|
|
10546
|
+
object({ kind: literal("steer") })
|
|
10547
|
+
])
|
|
10548
|
+
});
|
|
10549
|
+
object({ accepted: literal(true) });
|
|
10550
|
+
object({ sessionId: sessionIdSchema });
|
|
10551
|
+
object({ accepted: literal(true) });
|
|
10552
|
+
//#endregion
|
|
10553
|
+
//#region ../../stubs/xrk-host-apiproxy/src/api/approvals.schema.ts
|
|
10554
|
+
/**
|
|
10555
|
+
* approvals domain zod schemas (respond is a client-response; the payload schema serves
|
|
10556
|
+
* the /api/respond endpoint's second parse after routing via the pending table).
|
|
10557
|
+
* ApprovalRequestId brand cast point: one.
|
|
10558
|
+
*/
|
|
10559
|
+
/** ApprovalRequestId: one brand cast after schema validation (the only cast point in this domain). */
|
|
10560
|
+
const approvalRequestIdSchema = string().min(1);
|
|
10561
|
+
object({
|
|
10562
|
+
sessionId: sessionIdSchema,
|
|
10563
|
+
approvalId: approvalRequestIdSchema,
|
|
10564
|
+
outcome: union([literal("allowed-once"), literal("rejected")])
|
|
10565
|
+
});
|
|
10566
|
+
/**
|
|
10567
|
+
* One wire task view. `kind` stays an open string because producer plugins
|
|
10568
|
+
* extend the registry's kind map by declaration merging, so the closed set is
|
|
10569
|
+
* not knowable at this boundary.
|
|
10570
|
+
*/
|
|
10571
|
+
const taskViewSchema = object({
|
|
10572
|
+
id: string().min(1),
|
|
10573
|
+
kind: string().min(1),
|
|
10574
|
+
label: string().min(1),
|
|
10575
|
+
status: union([
|
|
10576
|
+
literal("running"),
|
|
10577
|
+
literal("stopping"),
|
|
10578
|
+
literal("completed"),
|
|
10579
|
+
literal("killed"),
|
|
10580
|
+
literal("failed")
|
|
10581
|
+
]),
|
|
10582
|
+
detail: string().optional(),
|
|
10583
|
+
startedAt: number().int().nonnegative(),
|
|
10584
|
+
finishedAt: number().int().nonnegative().optional()
|
|
10585
|
+
});
|
|
10586
|
+
//#endregion
|
|
10587
|
+
//#region ../../stubs/xrk-host-apiproxy/src/api/workspace.schema.ts
|
|
10588
|
+
/**
|
|
10589
|
+
* workspace domain zod schemas (names derived from map keys). The
|
|
10590
|
+
* WorkspaceId brand cast lives in sessions.schema (see the note there) and
|
|
10591
|
+
* is re-exported here as the domain-local name.
|
|
10592
|
+
*/
|
|
10593
|
+
/** WorkspaceView row of every workspace.* response. */
|
|
10594
|
+
const workspaceViewSchema = object({
|
|
10595
|
+
workspaceId: workspaceIdSchema,
|
|
10596
|
+
path: string(),
|
|
10597
|
+
title: string(),
|
|
10598
|
+
sessionIds: array(sessionIdSchema),
|
|
10599
|
+
createdAt: string(),
|
|
10600
|
+
updatedAt: string()
|
|
10601
|
+
});
|
|
10602
|
+
object({});
|
|
10603
|
+
object({
|
|
10604
|
+
items: array(workspaceViewSchema),
|
|
10605
|
+
archivedSessionIds: array(sessionIdSchema)
|
|
10606
|
+
});
|
|
10607
|
+
object({ path: string() });
|
|
10608
|
+
object({
|
|
10609
|
+
workspace: workspaceViewSchema,
|
|
10610
|
+
created: boolean()
|
|
10611
|
+
});
|
|
10612
|
+
object({
|
|
10613
|
+
workspaceId: workspaceIdSchema,
|
|
10614
|
+
title: string()
|
|
10615
|
+
}).refine((payload) => payload.title.trim() !== "", { message: "workspace.rename requires a non-blank title" });
|
|
10616
|
+
object({ workspace: workspaceViewSchema });
|
|
10617
|
+
object({ workspaceId: workspaceIdSchema });
|
|
10618
|
+
object({ deleted: literal(true) });
|
|
10619
|
+
object({
|
|
10620
|
+
workspaceId: workspaceIdSchema,
|
|
10621
|
+
beforeWorkspaceId: workspaceIdSchema.optional()
|
|
10622
|
+
});
|
|
10623
|
+
object({ workspaceIds: array(workspaceIdSchema) });
|
|
10624
|
+
object({
|
|
10625
|
+
workspaceId: workspaceIdSchema,
|
|
10626
|
+
sessionId: sessionIdSchema,
|
|
10627
|
+
beforeSessionId: sessionIdSchema.optional()
|
|
10628
|
+
});
|
|
10629
|
+
object({ workspace: workspaceViewSchema });
|
|
10630
|
+
object({ sessionId: sessionIdSchema });
|
|
10631
|
+
object({ archivedSessionIds: array(sessionIdSchema) });
|
|
10632
|
+
//#endregion
|
|
10633
|
+
//#region ../../stubs/xrk-host-apiproxy/src/api/events.schema.ts
|
|
10634
|
+
/**
|
|
10635
|
+
* events domain zod schemas: MuxFrame / HostFrame unions (discriminatedUnion('type')).
|
|
10636
|
+
* A frame is the payload slot of the ServerRequest full form; the SessionEvent inside
|
|
10637
|
+
* a session/event frame reuses sessions.schema's strict-envelope + wide-data passthrough branch.
|
|
10638
|
+
*/
|
|
10639
|
+
/** Question fields validated strictly against core dsh-user-questions. */
|
|
10640
|
+
const askUserQuestionItemSchema = object({
|
|
10641
|
+
id: string(),
|
|
10642
|
+
question: string(),
|
|
10643
|
+
header: string().optional(),
|
|
10644
|
+
detail: string().optional(),
|
|
10645
|
+
options: array(object({
|
|
10646
|
+
label: string(),
|
|
10647
|
+
description: string().optional()
|
|
10648
|
+
})).optional(),
|
|
10649
|
+
multiSelect: boolean().optional(),
|
|
10650
|
+
intent: discriminatedUnion("kind", [object({
|
|
10651
|
+
kind: literal("plan-review"),
|
|
10652
|
+
approve: string()
|
|
10653
|
+
})]).optional()
|
|
10654
|
+
});
|
|
10655
|
+
/** Unified message envelope carried by transient queue frames. */
|
|
10656
|
+
const messageSchema = object({
|
|
10657
|
+
id: string().min(1),
|
|
10658
|
+
role: union([
|
|
10659
|
+
literal("system"),
|
|
10660
|
+
literal("user"),
|
|
10661
|
+
literal("assistant")
|
|
10662
|
+
]),
|
|
10663
|
+
content: array(contentBlockSchema),
|
|
10664
|
+
source: looseObject({ kind: string() })
|
|
10665
|
+
});
|
|
10666
|
+
/** MuxFrame union (payload slot of a mux-stream ServerRequest). */
|
|
10667
|
+
const muxFrameSchema = discriminatedUnion("type", [
|
|
10668
|
+
object({
|
|
10669
|
+
type: literal("session/event"),
|
|
10670
|
+
sessionId: sessionIdSchema,
|
|
10671
|
+
event: sessionEventSchema,
|
|
10672
|
+
view: toolEventViewSchema.optional()
|
|
10673
|
+
}),
|
|
10674
|
+
object({
|
|
10675
|
+
type: literal("session/subscribed"),
|
|
10676
|
+
sessionId: sessionIdSchema,
|
|
10677
|
+
lastSeq: number().int()
|
|
10678
|
+
}),
|
|
10679
|
+
object({
|
|
10680
|
+
type: literal("approval/requested"),
|
|
10681
|
+
sessionId: sessionIdSchema,
|
|
10682
|
+
approvalId: approvalRequestIdSchema,
|
|
10683
|
+
toolName: string(),
|
|
10684
|
+
callId: string().optional(),
|
|
10685
|
+
reason: string().optional()
|
|
10686
|
+
}),
|
|
10687
|
+
object({
|
|
10688
|
+
type: literal("approval/resolved"),
|
|
10689
|
+
sessionId: sessionIdSchema,
|
|
10690
|
+
approvalId: approvalRequestIdSchema,
|
|
10691
|
+
outcome: union([
|
|
10692
|
+
literal("allowed-once"),
|
|
10693
|
+
literal("rejected"),
|
|
10694
|
+
literal("cancelled"),
|
|
10695
|
+
literal("unavailable")
|
|
10696
|
+
])
|
|
10697
|
+
}),
|
|
10698
|
+
object({
|
|
10699
|
+
type: literal("question/requested"),
|
|
10700
|
+
sessionId: sessionIdSchema,
|
|
10701
|
+
questions: array(askUserQuestionItemSchema).min(1)
|
|
10702
|
+
}),
|
|
10703
|
+
object({
|
|
10704
|
+
type: literal("question/resolved"),
|
|
10705
|
+
sessionId: sessionIdSchema,
|
|
10706
|
+
questionRpcId: rpcIdSchema$1,
|
|
10707
|
+
outcome: union([literal("answered"), literal("cancelled")])
|
|
10708
|
+
}),
|
|
10709
|
+
object({
|
|
10710
|
+
type: literal("session/queue"),
|
|
10711
|
+
sessionId: sessionIdSchema,
|
|
10712
|
+
items: array(object({
|
|
10713
|
+
id: messageIdSchema,
|
|
10714
|
+
placement: union([
|
|
10715
|
+
literal("queued"),
|
|
10716
|
+
literal("steering"),
|
|
10717
|
+
literal("context")
|
|
10718
|
+
]),
|
|
10719
|
+
message: messageSchema
|
|
10720
|
+
}))
|
|
10721
|
+
}),
|
|
10722
|
+
object({
|
|
10723
|
+
type: literal("session/jobs"),
|
|
10724
|
+
sessionId: sessionIdSchema,
|
|
10725
|
+
jobs: array(taskViewSchema)
|
|
10726
|
+
}),
|
|
10727
|
+
object({
|
|
10728
|
+
type: literal("session/projection"),
|
|
10729
|
+
sessionId: sessionIdSchema,
|
|
10730
|
+
key: string().min(1),
|
|
10731
|
+
value: unknown(),
|
|
10732
|
+
seq: number().int().nonnegative()
|
|
10733
|
+
}),
|
|
10734
|
+
object({
|
|
10735
|
+
type: literal("stream/error"),
|
|
10736
|
+
error: rpcErrorSchema$1
|
|
10737
|
+
})
|
|
10738
|
+
]);
|
|
10739
|
+
/** HostFrame union (payload slot of a host-stream ServerRequest). */
|
|
10740
|
+
const hostFrameSchema = discriminatedUnion("type", [
|
|
10741
|
+
object({
|
|
10742
|
+
type: literal("host/session-added"),
|
|
10743
|
+
sessionId: sessionIdSchema,
|
|
10744
|
+
blank: boolean(),
|
|
10745
|
+
parentSessionId: sessionIdSchema.optional(),
|
|
10746
|
+
origin: literal("subagent").optional(),
|
|
10747
|
+
cwd: string().optional(),
|
|
10748
|
+
agentPreset: string().optional()
|
|
10749
|
+
}),
|
|
10750
|
+
object({
|
|
10751
|
+
type: literal("host/session-removed"),
|
|
10752
|
+
sessionId: sessionIdSchema
|
|
10753
|
+
}),
|
|
10754
|
+
object({
|
|
10755
|
+
type: literal("host/session-status"),
|
|
10756
|
+
sessionId: sessionIdSchema,
|
|
10757
|
+
running: boolean()
|
|
10758
|
+
}),
|
|
10759
|
+
object({
|
|
10760
|
+
type: literal("host/agent-error"),
|
|
10761
|
+
sessionId: sessionIdSchema,
|
|
10762
|
+
message: string()
|
|
10763
|
+
}),
|
|
10764
|
+
object({
|
|
10765
|
+
type: literal("host/workspace-changed"),
|
|
10766
|
+
workspace: workspaceViewSchema
|
|
10767
|
+
}),
|
|
10768
|
+
object({
|
|
10769
|
+
type: literal("host/workspace-removed"),
|
|
10770
|
+
workspaceId: workspaceIdSchema
|
|
10771
|
+
}),
|
|
10772
|
+
object({
|
|
10773
|
+
type: literal("host/workspace-order-changed"),
|
|
10774
|
+
workspaceIds: array(workspaceIdSchema)
|
|
10775
|
+
}),
|
|
10776
|
+
object({
|
|
10777
|
+
type: literal("host/archived-sessions-changed"),
|
|
10778
|
+
archivedSessionIds: array(sessionIdSchema)
|
|
10779
|
+
}),
|
|
10780
|
+
object({
|
|
10781
|
+
type: literal("host/remote-event"),
|
|
10782
|
+
event: string().min(1),
|
|
10783
|
+
args: array(unknown())
|
|
10784
|
+
}),
|
|
10785
|
+
object({
|
|
10786
|
+
type: literal("stream/error"),
|
|
10787
|
+
error: rpcErrorSchema$1
|
|
10788
|
+
})
|
|
10789
|
+
]);
|
|
10790
|
+
//#endregion
|
|
9841
10791
|
//#region src/api-path.ts
|
|
9842
10792
|
/**
|
|
9843
10793
|
* The /api URL prefix — single source for both halves of the web transport.
|
|
@@ -9882,7 +10832,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9882
10832
|
let frame;
|
|
9883
10833
|
try {
|
|
9884
10834
|
if (typeof event.data !== "string") throw new Error("binary WebSocket frame");
|
|
9885
|
-
full = serverRequestSchema.parse(JSON.parse(event.data));
|
|
10835
|
+
full = serverRequestSchema$1.parse(JSON.parse(event.data));
|
|
9886
10836
|
frame = frameSchema.parse(full.payload);
|
|
9887
10837
|
} catch (error) {
|
|
9888
10838
|
console.error(`[client-connection] dropping malformed WebSocket frame on ${path}:`, error);
|
|
@@ -9955,7 +10905,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9955
10905
|
...signal === void 0 ? {} : { signal }
|
|
9956
10906
|
});
|
|
9957
10907
|
if (!response.ok) throw new Error(`transport failure for ${channel}/${endpoint}: HTTP ${response.status}`);
|
|
9958
|
-
const full = serverResponseSchema.parse(await response.json());
|
|
10908
|
+
const full = serverResponseSchema$1.parse(await response.json());
|
|
9959
10909
|
if (full.rpcId !== rpcId) throw new Error(`rpcId mismatch for ${endpoint}: sent ${rpcId}, got ${full.rpcId}`);
|
|
9960
10910
|
return full.result;
|
|
9961
10911
|
} };
|