@xrkseek/harness-cli 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/port.d.ts.map +1 -1
- package/dist/port.js +1 -0
- package/dist/port.js.map +1 -1
- package/node_modules/@xrkseek/preset-server/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/xrk-file-reference/dist/grammar.d.ts +33 -0
- package/node_modules/@xrkseek/xrk-file-reference/dist/grammar.d.ts.map +1 -0
- package/node_modules/@xrkseek/xrk-file-reference/dist/grammar.js +43 -0
- package/node_modules/@xrkseek/xrk-file-reference/dist/grammar.js.map +1 -0
- package/node_modules/@xrkseek/xrk-file-reference/dist/types.d.ts +13 -0
- package/node_modules/@xrkseek/xrk-file-reference/dist/types.d.ts.map +1 -0
- package/node_modules/@xrkseek/xrk-file-reference/dist/types.js +7 -0
- package/node_modules/@xrkseek/xrk-file-reference/dist/types.js.map +1 -0
- package/node_modules/@xrkseek/xrk-file-reference/package.json +9 -46
- package/node_modules/@xrkseek/xrk-file-reference-local/dist/search.d.ts +52 -0
- package/node_modules/@xrkseek/xrk-file-reference-local/dist/search.d.ts.map +1 -0
- package/node_modules/@xrkseek/xrk-file-reference-local/dist/search.js +258 -0
- package/node_modules/@xrkseek/xrk-file-reference-local/dist/search.js.map +1 -0
- package/node_modules/@xrkseek/xrk-file-reference-local/package.json +7 -34
- package/node_modules/@xrkseek/xrk-session-reference/dist/config.d.ts +25 -0
- package/node_modules/@xrkseek/xrk-session-reference/dist/config.d.ts.map +1 -0
- package/node_modules/@xrkseek/xrk-session-reference/dist/config.js +18 -0
- package/node_modules/@xrkseek/xrk-session-reference/dist/config.js.map +1 -0
- package/node_modules/@xrkseek/xrk-session-reference/dist/types.d.ts +70 -0
- package/node_modules/@xrkseek/xrk-session-reference/dist/types.d.ts.map +1 -0
- package/node_modules/@xrkseek/xrk-session-reference/dist/types.js +11 -0
- package/node_modules/@xrkseek/xrk-session-reference/dist/types.js.map +1 -0
- package/node_modules/@xrkseek/xrk-session-reference/dist/uri.d.ts +40 -0
- package/node_modules/@xrkseek/xrk-session-reference/dist/uri.d.ts.map +1 -0
- package/node_modules/@xrkseek/xrk-session-reference/dist/uri.js +81 -0
- package/node_modules/@xrkseek/xrk-session-reference/dist/uri.js.map +1 -0
- package/node_modules/@xrkseek/xrk-session-reference/package.json +13 -53
- package/package.json +3 -2
- package/product-web/boot.json +1 -1
- package/product-web/plugins/@xrkseek/client-connection/client.js +1160 -367
- package/product-web/plugins/@xrkseek/client-locale/client.js +3 -3
- package/product-web/plugins/@xrkseek/client-runtime/client.js +4 -13
- package/product-web/plugins/@xrkseek/client-ui-agent-preset/client.js +38 -38
- package/product-web/plugins/@xrkseek/client-ui-attachment/client.js +15 -15
- package/product-web/plugins/@xrkseek/client-ui-commands/client.js +8 -8
- package/product-web/plugins/@xrkseek/client-ui-conversation/client.js +169 -169
- 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 +7 -7
- package/product-web/plugins/@xrkseek/client-ui-input-trigger/client.js +8 -8
- package/product-web/plugins/@xrkseek/client-ui-jobs/client.js +7 -7
- package/product-web/plugins/@xrkseek/client-ui-layout/client.js +3 -3
- package/product-web/plugins/@xrkseek/client-ui-message-feedback/client.js +4 -4
- package/product-web/plugins/@xrkseek/client-ui-model-selection/client.js +17 -17
- package/product-web/plugins/@xrkseek/client-ui-permission-presets/client.js +4 -4
- package/product-web/plugins/@xrkseek/client-ui-plan/client.js +3 -3
- package/product-web/plugins/@xrkseek/client-ui-settings-general/client.js +14 -14
- package/product-web/plugins/@xrkseek/client-ui-settings-models/client.js +57 -57
- 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 +41 -41
- package/product-web/plugins/@xrkseek/client-ui-sidebar/client.js +13 -13
- package/product-web/plugins/@xrkseek/client-ui-skill/client.js +10 -10
- 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 +40 -40
- package/product-web/plugins/@xrkseek/client-ui-trajectory/client.js +141 -141
- package/product-web/plugins/@xrkseek/client-ui-user-questions/client.js +27 -27
- package/product-web/plugins/@xrkseek/client-ui-workflow-run/client.js +14 -14
- package/product-web/plugins/@xrkseek/client-ui-workspace/client.js +54 -54
|
@@ -145,18 +145,7 @@ window.__ModuleLoader__.load({
|
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
//#endregion
|
|
148
|
-
//#region ../../stubs/xrk-llm/
|
|
149
|
-
/**
|
|
150
|
-
* dsh-llm's owned branded ids: tool-call correlation and provider request
|
|
151
|
-
* diagnostics.
|
|
152
|
-
*
|
|
153
|
-
* The `Branded<B>` primitive itself lives in `@xrkseek/xrk-brand` (a
|
|
154
|
-
* zero-dependency type-only package) so every owner of a cross-boundary id can
|
|
155
|
-
* brand it without depending on dsh-llm; see that package's README for the
|
|
156
|
-
* nominal-typing policy.
|
|
157
|
-
*
|
|
158
|
-
* @module @xrkseek/xrk-llm/brand
|
|
159
|
-
*/
|
|
148
|
+
//#region ../../stubs/xrk-llm/src/brand.ts
|
|
160
149
|
/**
|
|
161
150
|
* Brand a message identifier.
|
|
162
151
|
* @param id - the opaque message identifier.
|
|
@@ -174,7 +163,7 @@ window.__ModuleLoader__.load({
|
|
|
174
163
|
return id;
|
|
175
164
|
}
|
|
176
165
|
//#endregion
|
|
177
|
-
//#region ../../stubs/xrk-llm/
|
|
166
|
+
//#region ../../stubs/xrk-llm/src/call-config.ts
|
|
178
167
|
/**
|
|
179
168
|
* Deep-freeze a value in place with an iterative traversal, guarding cycles,
|
|
180
169
|
* so later mutation throws without imposing a JavaScript call-stack depth cap.
|
|
@@ -221,7 +210,7 @@ window.__ModuleLoader__.load({
|
|
|
221
210
|
return value;
|
|
222
211
|
}
|
|
223
212
|
//#endregion
|
|
224
|
-
//#region ../../stubs/xrk-llm/
|
|
213
|
+
//#region ../../stubs/xrk-llm/src/message.ts
|
|
225
214
|
/** Message value types, identity, and immutable construction helpers. */
|
|
226
215
|
/**
|
|
227
216
|
* Detach and deep-freeze a message whose identity already exists.
|
|
@@ -304,16 +293,7 @@ window.__ModuleLoader__.load({
|
|
|
304
293
|
}
|
|
305
294
|
}
|
|
306
295
|
//#endregion
|
|
307
|
-
//#region ../../stubs/xrk-session/
|
|
308
|
-
/**
|
|
309
|
-
* Surface layer on top of the session event log: an ordered view of events
|
|
310
|
-
* that produce LLM messages. The append-only log remains the source of truth.
|
|
311
|
-
*
|
|
312
|
-
* Browser-safe: web clients consume this subpath export, so it must stay free
|
|
313
|
-
* of `node:` imports (they break the vite bundle).
|
|
314
|
-
*
|
|
315
|
-
* @module @xrkseek/xrk-session/surface
|
|
316
|
-
*/
|
|
296
|
+
//#region ../../stubs/xrk-session/src/surface.ts
|
|
317
297
|
/** Runtime counterpart of the message-producing event union. */
|
|
318
298
|
const SURFACE_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
319
299
|
"user/message",
|
|
@@ -520,13 +500,7 @@ window.__ModuleLoader__.load({
|
|
|
520
500
|
};
|
|
521
501
|
}
|
|
522
502
|
//#endregion
|
|
523
|
-
//#region ../../stubs/xrk-host-apiproxy/
|
|
524
|
-
/**
|
|
525
|
-
* Four-quadrant RPC message model. Channels and messages are decoupled: HTTP,
|
|
526
|
-
* WebSocket, and in-process SSE are physical carriers, while logical messages
|
|
527
|
-
* are channel-independent and form a four-member discriminated union.
|
|
528
|
-
* api/ contract layer: zero Node dependencies, importable from the browser.
|
|
529
|
-
*/
|
|
503
|
+
//#region ../../stubs/xrk-host-apiproxy/src/api/rpc.ts
|
|
530
504
|
/**
|
|
531
505
|
* Brands a string as RpcId (same precedent as core `SessionId()`). Minted by the initiator:
|
|
532
506
|
* client-request → client mints; server-request → host mints (answerable frames get a stable
|
|
@@ -4892,7 +4866,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4892
4866
|
return /* @__PURE__ */ _superRefine(fn, params);
|
|
4893
4867
|
}
|
|
4894
4868
|
//#endregion
|
|
4895
|
-
//#region ../../stubs/xrk-host-apiproxy/
|
|
4869
|
+
//#region ../../stubs/xrk-host-apiproxy/src/api/rpc.schema.ts
|
|
4896
4870
|
/**
|
|
4897
4871
|
* Message-layer zod schemas: the four wire full forms + error body +
|
|
4898
4872
|
* carrier receipt. The payload slot is unknown in the full-form schemas — business payloads
|
|
@@ -4905,9 +4879,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4905
4879
|
* here would only turn a correlatable error report into a client-side parse
|
|
4906
4880
|
* failure (the handler substitutes a sentinel when a request's id is unreadable).
|
|
4907
4881
|
*/
|
|
4908
|
-
const rpcIdSchema = string();
|
|
4882
|
+
const rpcIdSchema$1 = string();
|
|
4909
4883
|
/** Error body: discriminated by code, per-branch details aligned to RpcErrorDetailsMap; details is required. */
|
|
4910
|
-
const rpcErrorSchema = discriminatedUnion("code", [
|
|
4884
|
+
const rpcErrorSchema$1 = discriminatedUnion("code", [
|
|
4911
4885
|
object({
|
|
4912
4886
|
code: literal("bad-request"),
|
|
4913
4887
|
message: string(),
|
|
@@ -5157,59 +5131,58 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5157
5131
|
* @param value - Schema for the business value.
|
|
5158
5132
|
* @returns Schema for RpcResult<T>.
|
|
5159
5133
|
*/
|
|
5160
|
-
function rpcResultSchema(value) {
|
|
5134
|
+
function rpcResultSchema$1(value) {
|
|
5161
5135
|
return union([object({
|
|
5162
5136
|
ok: literal(true),
|
|
5163
5137
|
value
|
|
5164
5138
|
}), object({
|
|
5165
5139
|
ok: literal(false),
|
|
5166
|
-
error: rpcErrorSchema
|
|
5140
|
+
error: rpcErrorSchema$1
|
|
5167
5141
|
})]);
|
|
5168
5142
|
}
|
|
5169
5143
|
/** ClientRequest full form (payload stays wide — the business layer runs the second parse). */
|
|
5170
|
-
const clientRequestSchema = object({
|
|
5144
|
+
const clientRequestSchema$1 = object({
|
|
5171
5145
|
type: literal("client-request"),
|
|
5172
|
-
rpcId: rpcIdSchema,
|
|
5146
|
+
rpcId: rpcIdSchema$1,
|
|
5173
5147
|
method: string(),
|
|
5174
5148
|
payload: unknown()
|
|
5175
5149
|
});
|
|
5176
5150
|
/** ServerResponse full form (result.value stays wide). */
|
|
5177
|
-
const serverResponseSchema = object({
|
|
5151
|
+
const serverResponseSchema$1 = object({
|
|
5178
5152
|
type: literal("server-response"),
|
|
5179
|
-
rpcId: rpcIdSchema,
|
|
5180
|
-
result: rpcResultSchema(unknown().optional())
|
|
5153
|
+
rpcId: rpcIdSchema$1,
|
|
5154
|
+
result: rpcResultSchema$1(unknown().optional())
|
|
5181
5155
|
});
|
|
5182
5156
|
/** ServerRequest full form (payload stays wide). */
|
|
5183
|
-
const serverRequestSchema = object({
|
|
5157
|
+
const serverRequestSchema$1 = object({
|
|
5184
5158
|
type: literal("server-request"),
|
|
5185
|
-
rpcId: rpcIdSchema,
|
|
5159
|
+
rpcId: rpcIdSchema$1,
|
|
5186
5160
|
method: string(),
|
|
5187
5161
|
payload: unknown()
|
|
5188
5162
|
});
|
|
5189
5163
|
discriminatedUnion("type", [
|
|
5190
|
-
clientRequestSchema,
|
|
5191
|
-
serverResponseSchema,
|
|
5192
|
-
serverRequestSchema,
|
|
5164
|
+
clientRequestSchema$1,
|
|
5165
|
+
serverResponseSchema$1,
|
|
5166
|
+
serverRequestSchema$1,
|
|
5193
5167
|
object({
|
|
5194
5168
|
type: literal("client-response"),
|
|
5195
|
-
rpcId: rpcIdSchema,
|
|
5196
|
-
result: rpcResultSchema(unknown().optional())
|
|
5169
|
+
rpcId: rpcIdSchema$1,
|
|
5170
|
+
result: rpcResultSchema$1(unknown().optional())
|
|
5197
5171
|
})
|
|
5198
5172
|
]);
|
|
5199
|
-
|
|
5200
|
-
const rpcReceiptSchema = union([object({ accepted: literal(true) }), object({
|
|
5173
|
+
union([object({ accepted: literal(true) }), object({
|
|
5201
5174
|
accepted: literal(false),
|
|
5202
5175
|
reason: union([literal("not-pending"), literal("bad-response")])
|
|
5203
5176
|
})]);
|
|
5204
5177
|
//#endregion
|
|
5205
|
-
//#region ../../stubs/xrk-host-apiproxy/
|
|
5178
|
+
//#region ../../stubs/xrk-host-apiproxy/src/api/session-search.ts
|
|
5206
5179
|
/**
|
|
5207
5180
|
* Return the longest prefix containing at most `maximum` Unicode code points.
|
|
5208
5181
|
* @param value - text to bound.
|
|
5209
5182
|
* @param maximum - non-negative code-point limit.
|
|
5210
5183
|
* @returns `value` unchanged when it fits, otherwise a code-point-safe prefix.
|
|
5211
5184
|
*/
|
|
5212
|
-
function truncateUnicodeCodePoints(value, maximum) {
|
|
5185
|
+
function truncateUnicodeCodePoints$1(value, maximum) {
|
|
5213
5186
|
let count = 0;
|
|
5214
5187
|
let end = 0;
|
|
5215
5188
|
for (const codePoint of value) {
|
|
@@ -5220,253 +5193,599 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5220
5193
|
return value;
|
|
5221
5194
|
}
|
|
5222
5195
|
//#endregion
|
|
5223
|
-
//#region ../../stubs/xrk-host-apiproxy/lib/types/api/
|
|
5196
|
+
//#region ../../stubs/xrk-host-apiproxy/lib/types/api/rpc.js
|
|
5224
5197
|
/**
|
|
5225
|
-
*
|
|
5226
|
-
*
|
|
5227
|
-
*
|
|
5228
|
-
*
|
|
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.
|
|
5229
5202
|
*/
|
|
5230
|
-
/** SessionId: one brand cast after schema validation (the only cast point in this domain). */
|
|
5231
|
-
const sessionIdSchema = string().min(1);
|
|
5232
|
-
/** MessageId: one brand cast after non-empty string validation. */
|
|
5233
|
-
const messageIdSchema$1 = string().min(1);
|
|
5234
5203
|
/**
|
|
5235
|
-
*
|
|
5236
|
-
*
|
|
5237
|
-
*
|
|
5238
|
-
*
|
|
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).
|
|
5239
5209
|
*/
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
time: number(),
|
|
5246
|
-
data: unknown(),
|
|
5247
|
-
sourceEventSeqs: array(number()).optional(),
|
|
5248
|
-
surfaceOp: unknown().optional(),
|
|
5249
|
-
ignorable: literal(true).optional()
|
|
5250
|
-
});
|
|
5251
|
-
/** SessionSummary row of session.list (`projections` reuses the history block's shape and schema). */
|
|
5252
|
-
const sessionSummarySchema = object({
|
|
5253
|
-
sessionId: sessionIdSchema,
|
|
5254
|
-
updatedAt: number(),
|
|
5255
|
-
running: boolean(),
|
|
5256
|
-
blank: boolean(),
|
|
5257
|
-
parentSessionId: sessionIdSchema.optional(),
|
|
5258
|
-
origin: literal("subagent").optional(),
|
|
5259
|
-
cwd: string().optional(),
|
|
5260
|
-
agentPreset: string().optional(),
|
|
5261
|
-
projections: lazy(() => sessionProjectionsBlockSchema).optional()
|
|
5262
|
-
});
|
|
5263
|
-
object({ cursor: string().optional() });
|
|
5264
|
-
/** session.list response value. */
|
|
5265
|
-
const sessionListValueSchema = object({ items: array(sessionSummarySchema) });
|
|
5266
|
-
object({ query: string().trim().min(1).max(500).refine((query) => !query.includes("\0"), { message: "search query must not contain NUL" }) });
|
|
5267
|
-
/** session.search response value. */
|
|
5268
|
-
const sessionSearchValueSchema = object({
|
|
5269
|
-
items: array(object({
|
|
5270
|
-
sessionId: sessionIdSchema,
|
|
5271
|
-
snippet: string().refine((snippet) => truncateUnicodeCodePoints(snippet, 240) === snippet, { message: `search snippet must contain at most 240 Unicode code points` })
|
|
5272
|
-
})).max(20),
|
|
5273
|
-
hasMore: boolean()
|
|
5274
|
-
});
|
|
5275
|
-
object({
|
|
5276
|
-
workspaceId: workspaceIdSchema.optional(),
|
|
5277
|
-
cwd: string().optional(),
|
|
5278
|
-
sessionId: sessionIdSchema.optional(),
|
|
5279
|
-
agentPreset: string().optional()
|
|
5280
|
-
}).refine((payload) => payload.workspaceId === void 0 || payload.cwd === void 0, { message: "session.create accepts workspaceId or cwd, not both" });
|
|
5281
|
-
/** session.create response value. */
|
|
5282
|
-
const sessionCreateValueSchema = object({
|
|
5283
|
-
sessionId: sessionIdSchema,
|
|
5284
|
-
agentPreset: string().optional()
|
|
5285
|
-
});
|
|
5286
|
-
object({
|
|
5287
|
-
sessionId: sessionIdSchema,
|
|
5288
|
-
title: string()
|
|
5289
|
-
});
|
|
5290
|
-
/** session.rename response value (the normalized accepted title and its event seq). */
|
|
5291
|
-
const sessionRenameValueSchema = object({
|
|
5292
|
-
title: string().min(1),
|
|
5293
|
-
seq: number().int().nonnegative()
|
|
5294
|
-
});
|
|
5295
|
-
object({
|
|
5296
|
-
sessionId: sessionIdSchema,
|
|
5297
|
-
atSeq: number().int().nonnegative().optional()
|
|
5298
|
-
});
|
|
5299
|
-
/** session.fork response value (the child session id). */
|
|
5300
|
-
const sessionForkValueSchema = object({ sessionId: sessionIdSchema });
|
|
5301
|
-
object({
|
|
5302
|
-
sessionId: sessionIdSchema,
|
|
5303
|
-
beforeSeq: number().int().nonnegative().optional(),
|
|
5304
|
-
maxMessages: number().int().positive().optional()
|
|
5305
|
-
});
|
|
5306
|
-
/** Complete provider/model selection. */
|
|
5307
|
-
const modelSelectionSchema = object({
|
|
5308
|
-
provider: string().min(1),
|
|
5309
|
-
model: string().min(1),
|
|
5310
|
-
reasoningEffort: string().min(1).optional()
|
|
5311
|
-
});
|
|
5312
|
-
/** Exact-model reasoning metadata. */
|
|
5313
|
-
const modelReasoningSchema = object({
|
|
5314
|
-
efforts: array(object({
|
|
5315
|
-
id: string().min(1),
|
|
5316
|
-
name: string().min(1),
|
|
5317
|
-
description: string().optional()
|
|
5318
|
-
})).min(1),
|
|
5319
|
-
defaultEffort: string().min(1).optional()
|
|
5320
|
-
});
|
|
5321
|
-
/** One advisory model entry inside a provider group. */
|
|
5322
|
-
const modelCatalogModelSchema = object({
|
|
5323
|
-
id: string().min(1),
|
|
5324
|
-
name: string().min(1),
|
|
5325
|
-
description: string().optional(),
|
|
5326
|
-
reasoning: modelReasoningSchema.optional()
|
|
5327
|
-
});
|
|
5328
|
-
/** One successfully loaded provider group. */
|
|
5329
|
-
const modelProviderGroupSchema = object({
|
|
5330
|
-
id: string().min(1),
|
|
5331
|
-
name: string().min(1),
|
|
5332
|
-
models: array(modelCatalogModelSchema)
|
|
5333
|
-
});
|
|
5334
|
-
/** One provider-local catalog failure. */
|
|
5335
|
-
const modelCatalogFailureSchema = object({
|
|
5336
|
-
id: string().min(1),
|
|
5337
|
-
name: string().min(1),
|
|
5338
|
-
message: string()
|
|
5339
|
-
});
|
|
5210
|
+
function RpcId$1(id) {
|
|
5211
|
+
return id;
|
|
5212
|
+
}
|
|
5213
|
+
//#endregion
|
|
5214
|
+
//#region ../../stubs/xrk-host-apiproxy/lib/types/api/rpc.schema.js
|
|
5340
5215
|
/**
|
|
5341
|
-
*
|
|
5342
|
-
*
|
|
5343
|
-
*
|
|
5344
|
-
*
|
|
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.
|
|
5345
5220
|
*/
|
|
5346
|
-
const toolEventViewSchema = discriminatedUnion("for", [object({
|
|
5347
|
-
for: literal("call"),
|
|
5348
|
-
view: looseObject({ card: string() })
|
|
5349
|
-
}), object({
|
|
5350
|
-
for: literal("result"),
|
|
5351
|
-
view: looseObject({ card: string() })
|
|
5352
|
-
})]);
|
|
5353
|
-
/** One session.history item: the session event plus its optional host-computed tool view. */
|
|
5354
|
-
const historyEntrySchema = object({
|
|
5355
|
-
event: sessionEventSchema,
|
|
5356
|
-
view: toolEventViewSchema.optional()
|
|
5357
|
-
});
|
|
5358
5221
|
/**
|
|
5359
|
-
*
|
|
5360
|
-
*
|
|
5361
|
-
*
|
|
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).
|
|
5362
5226
|
*/
|
|
5363
|
-
const
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
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),
|
|
5714
|
+
model: string().min(1),
|
|
5715
|
+
reasoningEffort: string().min(1).optional()
|
|
5716
|
+
});
|
|
5717
|
+
/** session.selectModel response value. */
|
|
5718
|
+
const sessionSelectModelValueSchema$1 = object({ selected: modelSelectionSchema$1 });
|
|
5719
|
+
/** ContentBlock passthrough: core is merge-extensible — the type discriminant envelope is strict, the rest stays wide. */
|
|
5720
|
+
const contentBlockSchema$1 = looseObject({ type: string() });
|
|
5721
|
+
/** Raster image media types accepted by the version-one browser wire. */
|
|
5722
|
+
const imageMediaTypeSchema$1 = union([
|
|
5723
|
+
literal("image/png"),
|
|
5724
|
+
literal("image/jpeg"),
|
|
5725
|
+
literal("image/webp"),
|
|
5726
|
+
literal("image/gif")
|
|
5727
|
+
]);
|
|
5728
|
+
/** Prompt wire content is intentionally narrower than merge-extensible durable core content. */
|
|
5729
|
+
const promptContentPartSchema$1 = discriminatedUnion("type", [object({
|
|
5730
|
+
type: literal("text"),
|
|
5731
|
+
text: string()
|
|
5732
|
+
}), object({
|
|
5733
|
+
type: literal("image"),
|
|
5734
|
+
mediaType: imageMediaTypeSchema$1,
|
|
5735
|
+
data: string(),
|
|
5736
|
+
name: string().optional()
|
|
5737
|
+
})]);
|
|
5738
|
+
object({
|
|
5739
|
+
sessionId: sessionIdSchema$1,
|
|
5740
|
+
mode: union([literal("queue"), literal("steer")]),
|
|
5741
|
+
content: array(promptContentPartSchema$1),
|
|
5742
|
+
clientTimeZone: string().optional()
|
|
5743
|
+
});
|
|
5744
|
+
/** session.prompt response value (the command slot appears only when the prompt dispatched a slash command). */
|
|
5745
|
+
const sessionPromptValueSchema$1 = object({
|
|
5746
|
+
accepted: literal(true),
|
|
5747
|
+
command: object({
|
|
5748
|
+
kind: literal("success"),
|
|
5749
|
+
text: string().optional()
|
|
5750
|
+
}).optional()
|
|
5751
|
+
});
|
|
5752
|
+
/** Opaque attachment id after string-shape validation. */
|
|
5753
|
+
const attachmentIdSchema$1 = string().min(1);
|
|
5754
|
+
/** Durable image reference returned from the authenticated session lookup. */
|
|
5755
|
+
const imageAttachmentRefSchema$1 = object({
|
|
5756
|
+
attachmentId: attachmentIdSchema$1,
|
|
5757
|
+
mediaType: imageMediaTypeSchema$1,
|
|
5439
5758
|
bytes: number().int().positive(),
|
|
5440
5759
|
width: number().int().positive(),
|
|
5441
5760
|
height: number().int().positive(),
|
|
5442
5761
|
name: string().optional()
|
|
5443
5762
|
});
|
|
5444
5763
|
object({
|
|
5445
|
-
sessionId: sessionIdSchema,
|
|
5446
|
-
attachmentId: attachmentIdSchema
|
|
5764
|
+
sessionId: sessionIdSchema$1,
|
|
5765
|
+
attachmentId: attachmentIdSchema$1
|
|
5447
5766
|
});
|
|
5448
5767
|
/** session.attachment response value. */
|
|
5449
|
-
const sessionAttachmentValueSchema = object({
|
|
5450
|
-
attachment: imageAttachmentRefSchema,
|
|
5768
|
+
const sessionAttachmentValueSchema$1 = object({
|
|
5769
|
+
attachment: imageAttachmentRefSchema$1,
|
|
5451
5770
|
data: string()
|
|
5452
5771
|
});
|
|
5453
5772
|
object({
|
|
5454
|
-
sessionId: sessionIdSchema,
|
|
5455
|
-
itemId: messageIdSchema$
|
|
5773
|
+
sessionId: sessionIdSchema$1,
|
|
5774
|
+
itemId: messageIdSchema$2,
|
|
5456
5775
|
action: discriminatedUnion("kind", [
|
|
5457
5776
|
object({
|
|
5458
5777
|
kind: literal("edit"),
|
|
5459
|
-
content: array(contentBlockSchema)
|
|
5778
|
+
content: array(contentBlockSchema$1)
|
|
5460
5779
|
}),
|
|
5461
5780
|
object({ kind: literal("remove") }),
|
|
5462
5781
|
object({ kind: literal("steer") })
|
|
5463
5782
|
])
|
|
5464
5783
|
});
|
|
5465
5784
|
/** session.updateQueue response value. */
|
|
5466
|
-
const sessionUpdateQueueValueSchema = object({ accepted: literal(true) });
|
|
5467
|
-
object({ sessionId: sessionIdSchema });
|
|
5785
|
+
const sessionUpdateQueueValueSchema$1 = object({ accepted: literal(true) });
|
|
5786
|
+
object({ sessionId: sessionIdSchema$1 });
|
|
5468
5787
|
/** session.cancel response value. */
|
|
5469
|
-
const sessionCancelValueSchema = object({ accepted: literal(true) });
|
|
5788
|
+
const sessionCancelValueSchema$1 = object({ accepted: literal(true) });
|
|
5470
5789
|
//#endregion
|
|
5471
5790
|
//#region ../../stubs/xrk-host-apiproxy/lib/types/api/approvals.schema.js
|
|
5472
5791
|
/**
|
|
@@ -5475,10 +5794,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5475
5794
|
* ApprovalRequestId brand cast point: one.
|
|
5476
5795
|
*/
|
|
5477
5796
|
/** ApprovalRequestId: one brand cast after schema validation (the only cast point in this domain). */
|
|
5478
|
-
const approvalRequestIdSchema = string().min(1);
|
|
5797
|
+
const approvalRequestIdSchema$1 = string().min(1);
|
|
5479
5798
|
object({
|
|
5480
|
-
sessionId: sessionIdSchema,
|
|
5481
|
-
approvalId: approvalRequestIdSchema,
|
|
5799
|
+
sessionId: sessionIdSchema$1,
|
|
5800
|
+
approvalId: approvalRequestIdSchema$1,
|
|
5482
5801
|
outcome: union([literal("allowed-once"), literal("rejected")])
|
|
5483
5802
|
});
|
|
5484
5803
|
/**
|
|
@@ -5486,7 +5805,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5486
5805
|
* extend the registry's kind map by declaration merging, so the closed set is
|
|
5487
5806
|
* not knowable at this boundary.
|
|
5488
5807
|
*/
|
|
5489
|
-
const taskViewSchema = object({
|
|
5808
|
+
const taskViewSchema$1 = object({
|
|
5490
5809
|
id: string().min(1),
|
|
5491
5810
|
kind: string().min(1),
|
|
5492
5811
|
label: string().min(1),
|
|
@@ -5509,51 +5828,51 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5509
5828
|
* is re-exported here as the domain-local name.
|
|
5510
5829
|
*/
|
|
5511
5830
|
/** WorkspaceView row of every workspace.* response. */
|
|
5512
|
-
const workspaceViewSchema = object({
|
|
5513
|
-
workspaceId: workspaceIdSchema,
|
|
5831
|
+
const workspaceViewSchema$1 = object({
|
|
5832
|
+
workspaceId: workspaceIdSchema$1,
|
|
5514
5833
|
path: string(),
|
|
5515
5834
|
title: string(),
|
|
5516
|
-
sessionIds: array(sessionIdSchema),
|
|
5835
|
+
sessionIds: array(sessionIdSchema$1),
|
|
5517
5836
|
createdAt: string(),
|
|
5518
5837
|
updatedAt: string()
|
|
5519
5838
|
});
|
|
5520
5839
|
object({});
|
|
5521
5840
|
/** workspace.list response value. */
|
|
5522
|
-
const workspaceListValueSchema = object({
|
|
5523
|
-
items: array(workspaceViewSchema),
|
|
5524
|
-
archivedSessionIds: array(sessionIdSchema)
|
|
5841
|
+
const workspaceListValueSchema$1 = object({
|
|
5842
|
+
items: array(workspaceViewSchema$1),
|
|
5843
|
+
archivedSessionIds: array(sessionIdSchema$1)
|
|
5525
5844
|
});
|
|
5526
5845
|
object({ path: string() });
|
|
5527
5846
|
/** workspace.create response value. */
|
|
5528
|
-
const workspaceCreateValueSchema = object({
|
|
5529
|
-
workspace: workspaceViewSchema,
|
|
5847
|
+
const workspaceCreateValueSchema$1 = object({
|
|
5848
|
+
workspace: workspaceViewSchema$1,
|
|
5530
5849
|
created: boolean()
|
|
5531
5850
|
});
|
|
5532
5851
|
object({
|
|
5533
|
-
workspaceId: workspaceIdSchema,
|
|
5852
|
+
workspaceId: workspaceIdSchema$1,
|
|
5534
5853
|
title: string()
|
|
5535
5854
|
}).refine((payload) => payload.title.trim() !== "", { message: "workspace.rename requires a non-blank title" });
|
|
5536
5855
|
/** workspace.rename response value. */
|
|
5537
|
-
const workspaceRenameValueSchema = object({ workspace: workspaceViewSchema });
|
|
5538
|
-
object({ workspaceId: workspaceIdSchema });
|
|
5856
|
+
const workspaceRenameValueSchema$1 = object({ workspace: workspaceViewSchema$1 });
|
|
5857
|
+
object({ workspaceId: workspaceIdSchema$1 });
|
|
5539
5858
|
/** workspace.delete response value. */
|
|
5540
|
-
const workspaceDeleteValueSchema = object({ deleted: literal(true) });
|
|
5859
|
+
const workspaceDeleteValueSchema$1 = object({ deleted: literal(true) });
|
|
5541
5860
|
object({
|
|
5542
|
-
workspaceId: workspaceIdSchema,
|
|
5543
|
-
beforeWorkspaceId: workspaceIdSchema.optional()
|
|
5861
|
+
workspaceId: workspaceIdSchema$1,
|
|
5862
|
+
beforeWorkspaceId: workspaceIdSchema$1.optional()
|
|
5544
5863
|
});
|
|
5545
5864
|
/** workspace.insertBefore response value: the complete durable display order. */
|
|
5546
|
-
const workspaceInsertBeforeValueSchema = object({ workspaceIds: array(workspaceIdSchema) });
|
|
5865
|
+
const workspaceInsertBeforeValueSchema$1 = object({ workspaceIds: array(workspaceIdSchema$1) });
|
|
5547
5866
|
object({
|
|
5548
|
-
workspaceId: workspaceIdSchema,
|
|
5549
|
-
sessionId: sessionIdSchema,
|
|
5550
|
-
beforeSessionId: sessionIdSchema.optional()
|
|
5867
|
+
workspaceId: workspaceIdSchema$1,
|
|
5868
|
+
sessionId: sessionIdSchema$1,
|
|
5869
|
+
beforeSessionId: sessionIdSchema$1.optional()
|
|
5551
5870
|
});
|
|
5552
5871
|
/** workspace.insertSessionBefore response value. */
|
|
5553
|
-
const workspaceInsertSessionBeforeValueSchema = object({ workspace: workspaceViewSchema });
|
|
5554
|
-
object({ sessionId: sessionIdSchema });
|
|
5872
|
+
const workspaceInsertSessionBeforeValueSchema$1 = object({ workspace: workspaceViewSchema$1 });
|
|
5873
|
+
object({ sessionId: sessionIdSchema$1 });
|
|
5555
5874
|
/** workspace.archiveSession response value: the full updated archive set. */
|
|
5556
|
-
const workspaceArchiveSessionValueSchema = object({ archivedSessionIds: array(sessionIdSchema) });
|
|
5875
|
+
const workspaceArchiveSessionValueSchema$1 = object({ archivedSessionIds: array(sessionIdSchema$1) });
|
|
5557
5876
|
//#endregion
|
|
5558
5877
|
//#region ../../stubs/xrk-host-apiproxy/lib/types/api/events.schema.js
|
|
5559
5878
|
/**
|
|
@@ -5562,7 +5881,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5562
5881
|
* a session/event frame reuses sessions.schema's strict-envelope + wide-data passthrough branch.
|
|
5563
5882
|
*/
|
|
5564
5883
|
/** Question fields validated strictly against core dsh-user-questions. */
|
|
5565
|
-
const askUserQuestionItemSchema = object({
|
|
5884
|
+
const askUserQuestionItemSchema$1 = object({
|
|
5566
5885
|
id: string(),
|
|
5567
5886
|
question: string(),
|
|
5568
5887
|
header: string().optional(),
|
|
@@ -5578,41 +5897,41 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5578
5897
|
})]).optional()
|
|
5579
5898
|
});
|
|
5580
5899
|
/** Unified message envelope carried by transient queue frames. */
|
|
5581
|
-
const messageSchema = object({
|
|
5900
|
+
const messageSchema$1 = object({
|
|
5582
5901
|
id: string().min(1),
|
|
5583
5902
|
role: union([
|
|
5584
5903
|
literal("system"),
|
|
5585
5904
|
literal("user"),
|
|
5586
5905
|
literal("assistant")
|
|
5587
5906
|
]),
|
|
5588
|
-
content: array(contentBlockSchema),
|
|
5907
|
+
content: array(contentBlockSchema$1),
|
|
5589
5908
|
source: looseObject({ kind: string() })
|
|
5590
5909
|
});
|
|
5591
5910
|
/** MuxFrame union (payload slot of a mux-stream ServerRequest). */
|
|
5592
|
-
const muxFrameSchema = discriminatedUnion("type", [
|
|
5911
|
+
const muxFrameSchema$1 = discriminatedUnion("type", [
|
|
5593
5912
|
object({
|
|
5594
5913
|
type: literal("session/event"),
|
|
5595
|
-
sessionId: sessionIdSchema,
|
|
5596
|
-
event: sessionEventSchema,
|
|
5597
|
-
view: toolEventViewSchema.optional()
|
|
5914
|
+
sessionId: sessionIdSchema$1,
|
|
5915
|
+
event: sessionEventSchema$1,
|
|
5916
|
+
view: toolEventViewSchema$1.optional()
|
|
5598
5917
|
}),
|
|
5599
5918
|
object({
|
|
5600
5919
|
type: literal("session/subscribed"),
|
|
5601
|
-
sessionId: sessionIdSchema,
|
|
5920
|
+
sessionId: sessionIdSchema$1,
|
|
5602
5921
|
lastSeq: number().int()
|
|
5603
5922
|
}),
|
|
5604
5923
|
object({
|
|
5605
5924
|
type: literal("approval/requested"),
|
|
5606
|
-
sessionId: sessionIdSchema,
|
|
5607
|
-
approvalId: approvalRequestIdSchema,
|
|
5925
|
+
sessionId: sessionIdSchema$1,
|
|
5926
|
+
approvalId: approvalRequestIdSchema$1,
|
|
5608
5927
|
toolName: string(),
|
|
5609
5928
|
callId: string().optional(),
|
|
5610
5929
|
reason: string().optional()
|
|
5611
5930
|
}),
|
|
5612
5931
|
object({
|
|
5613
5932
|
type: literal("approval/resolved"),
|
|
5614
|
-
sessionId: sessionIdSchema,
|
|
5615
|
-
approvalId: approvalRequestIdSchema,
|
|
5933
|
+
sessionId: sessionIdSchema$1,
|
|
5934
|
+
approvalId: approvalRequestIdSchema$1,
|
|
5616
5935
|
outcome: union([
|
|
5617
5936
|
literal("allowed-once"),
|
|
5618
5937
|
literal("rejected"),
|
|
@@ -5622,36 +5941,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5622
5941
|
}),
|
|
5623
5942
|
object({
|
|
5624
5943
|
type: literal("question/requested"),
|
|
5625
|
-
sessionId: sessionIdSchema,
|
|
5626
|
-
questions: array(askUserQuestionItemSchema).min(1)
|
|
5944
|
+
sessionId: sessionIdSchema$1,
|
|
5945
|
+
questions: array(askUserQuestionItemSchema$1).min(1)
|
|
5627
5946
|
}),
|
|
5628
5947
|
object({
|
|
5629
5948
|
type: literal("question/resolved"),
|
|
5630
|
-
sessionId: sessionIdSchema,
|
|
5949
|
+
sessionId: sessionIdSchema$1,
|
|
5631
5950
|
questionRpcId: rpcIdSchema,
|
|
5632
5951
|
outcome: union([literal("answered"), literal("cancelled")])
|
|
5633
5952
|
}),
|
|
5634
5953
|
object({
|
|
5635
5954
|
type: literal("session/queue"),
|
|
5636
|
-
sessionId: sessionIdSchema,
|
|
5955
|
+
sessionId: sessionIdSchema$1,
|
|
5637
5956
|
items: array(object({
|
|
5638
|
-
id: messageIdSchema$
|
|
5957
|
+
id: messageIdSchema$2,
|
|
5639
5958
|
placement: union([
|
|
5640
5959
|
literal("queued"),
|
|
5641
5960
|
literal("steering"),
|
|
5642
5961
|
literal("context")
|
|
5643
5962
|
]),
|
|
5644
|
-
message: messageSchema
|
|
5963
|
+
message: messageSchema$1
|
|
5645
5964
|
}))
|
|
5646
5965
|
}),
|
|
5647
5966
|
object({
|
|
5648
5967
|
type: literal("session/jobs"),
|
|
5649
|
-
sessionId: sessionIdSchema,
|
|
5650
|
-
jobs: array(taskViewSchema)
|
|
5968
|
+
sessionId: sessionIdSchema$1,
|
|
5969
|
+
jobs: array(taskViewSchema$1)
|
|
5651
5970
|
}),
|
|
5652
5971
|
object({
|
|
5653
5972
|
type: literal("session/projection"),
|
|
5654
|
-
sessionId: sessionIdSchema,
|
|
5973
|
+
sessionId: sessionIdSchema$1,
|
|
5655
5974
|
key: string().min(1),
|
|
5656
5975
|
value: unknown(),
|
|
5657
5976
|
seq: number().int().nonnegative()
|
|
@@ -5662,45 +5981,45 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5662
5981
|
})
|
|
5663
5982
|
]);
|
|
5664
5983
|
/** HostFrame union (payload slot of a host-stream ServerRequest). */
|
|
5665
|
-
const hostFrameSchema = discriminatedUnion("type", [
|
|
5984
|
+
const hostFrameSchema$1 = discriminatedUnion("type", [
|
|
5666
5985
|
object({
|
|
5667
5986
|
type: literal("host/session-added"),
|
|
5668
|
-
sessionId: sessionIdSchema,
|
|
5987
|
+
sessionId: sessionIdSchema$1,
|
|
5669
5988
|
blank: boolean(),
|
|
5670
|
-
parentSessionId: sessionIdSchema.optional(),
|
|
5989
|
+
parentSessionId: sessionIdSchema$1.optional(),
|
|
5671
5990
|
origin: literal("subagent").optional(),
|
|
5672
5991
|
cwd: string().optional(),
|
|
5673
5992
|
agentPreset: string().optional()
|
|
5674
5993
|
}),
|
|
5675
5994
|
object({
|
|
5676
5995
|
type: literal("host/session-removed"),
|
|
5677
|
-
sessionId: sessionIdSchema
|
|
5996
|
+
sessionId: sessionIdSchema$1
|
|
5678
5997
|
}),
|
|
5679
5998
|
object({
|
|
5680
5999
|
type: literal("host/session-status"),
|
|
5681
|
-
sessionId: sessionIdSchema,
|
|
6000
|
+
sessionId: sessionIdSchema$1,
|
|
5682
6001
|
running: boolean()
|
|
5683
6002
|
}),
|
|
5684
6003
|
object({
|
|
5685
6004
|
type: literal("host/agent-error"),
|
|
5686
|
-
sessionId: sessionIdSchema,
|
|
6005
|
+
sessionId: sessionIdSchema$1,
|
|
5687
6006
|
message: string()
|
|
5688
6007
|
}),
|
|
5689
6008
|
object({
|
|
5690
6009
|
type: literal("host/workspace-changed"),
|
|
5691
|
-
workspace: workspaceViewSchema
|
|
6010
|
+
workspace: workspaceViewSchema$1
|
|
5692
6011
|
}),
|
|
5693
6012
|
object({
|
|
5694
6013
|
type: literal("host/workspace-removed"),
|
|
5695
|
-
workspaceId: workspaceIdSchema
|
|
6014
|
+
workspaceId: workspaceIdSchema$1
|
|
5696
6015
|
}),
|
|
5697
6016
|
object({
|
|
5698
6017
|
type: literal("host/workspace-order-changed"),
|
|
5699
|
-
workspaceIds: array(workspaceIdSchema)
|
|
6018
|
+
workspaceIds: array(workspaceIdSchema$1)
|
|
5700
6019
|
}),
|
|
5701
6020
|
object({
|
|
5702
6021
|
type: literal("host/archived-sessions-changed"),
|
|
5703
|
-
archivedSessionIds: array(sessionIdSchema)
|
|
6022
|
+
archivedSessionIds: array(sessionIdSchema$1)
|
|
5704
6023
|
}),
|
|
5705
6024
|
object({
|
|
5706
6025
|
type: literal("host/remote-event"),
|
|
@@ -5762,7 +6081,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5762
6081
|
whenToUse: string().optional(),
|
|
5763
6082
|
modelInvocable: boolean()
|
|
5764
6083
|
});
|
|
5765
|
-
object({ sessionId: sessionIdSchema });
|
|
6084
|
+
object({ sessionId: sessionIdSchema$1 });
|
|
5766
6085
|
/** skill.list response value. */
|
|
5767
6086
|
const skillListValueSchema = object({ skills: array(skillEntrySchema) });
|
|
5768
6087
|
//#endregion
|
|
@@ -5788,7 +6107,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5788
6107
|
hasDocument: boolean()
|
|
5789
6108
|
});
|
|
5790
6109
|
object({
|
|
5791
|
-
sessionId: sessionIdSchema,
|
|
6110
|
+
sessionId: sessionIdSchema$1,
|
|
5792
6111
|
agentPreset: string().min(1)
|
|
5793
6112
|
});
|
|
5794
6113
|
/** agentPreset.select response value. */
|
|
@@ -5982,8 +6301,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5982
6301
|
object({});
|
|
5983
6302
|
/** llm.models response value. */
|
|
5984
6303
|
const llmModelsValueSchema = object({
|
|
5985
|
-
groups: array(modelProviderGroupSchema),
|
|
5986
|
-
failures: array(modelCatalogFailureSchema)
|
|
6304
|
+
groups: array(modelProviderGroupSchema$1),
|
|
6305
|
+
failures: array(modelCatalogFailureSchema$1)
|
|
5987
6306
|
});
|
|
5988
6307
|
/** DiscoveredModelView row of llm.discoverModels. */
|
|
5989
6308
|
const discoveredModelViewSchema = object({
|
|
@@ -6008,7 +6327,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6008
6327
|
const subagentListEntrySchema = union([
|
|
6009
6328
|
object({
|
|
6010
6329
|
kind: literal("child"),
|
|
6011
|
-
id: sessionIdSchema,
|
|
6330
|
+
id: sessionIdSchema$1,
|
|
6012
6331
|
mode: literal("one-shot"),
|
|
6013
6332
|
activity: union([literal("running"), literal("inactive")]),
|
|
6014
6333
|
hasChildren: boolean(),
|
|
@@ -6016,7 +6335,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6016
6335
|
}),
|
|
6017
6336
|
object({
|
|
6018
6337
|
kind: literal("child"),
|
|
6019
|
-
id: sessionIdSchema,
|
|
6338
|
+
id: sessionIdSchema$1,
|
|
6020
6339
|
mode: literal("continuable"),
|
|
6021
6340
|
activity: union([literal("running"), literal("inactive")]),
|
|
6022
6341
|
hasChildren: boolean(),
|
|
@@ -6024,7 +6343,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6024
6343
|
}),
|
|
6025
6344
|
object({
|
|
6026
6345
|
kind: literal("diagnostic"),
|
|
6027
|
-
id: sessionIdSchema,
|
|
6346
|
+
id: sessionIdSchema$1,
|
|
6028
6347
|
reason: union([
|
|
6029
6348
|
literal("corrupt"),
|
|
6030
6349
|
literal("unsupported"),
|
|
@@ -6032,35 +6351,35 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6032
6351
|
])
|
|
6033
6352
|
})
|
|
6034
6353
|
]);
|
|
6035
|
-
object({ parentSessionId: sessionIdSchema });
|
|
6354
|
+
object({ parentSessionId: sessionIdSchema$1 });
|
|
6036
6355
|
/** subagent.list response value. */
|
|
6037
6356
|
const subagentListValueSchema = object({
|
|
6038
6357
|
entries: array(subagentListEntrySchema),
|
|
6039
6358
|
parentAvailable: boolean()
|
|
6040
6359
|
});
|
|
6041
6360
|
object({
|
|
6042
|
-
parentSessionId: sessionIdSchema,
|
|
6043
|
-
childSessionId: sessionIdSchema,
|
|
6361
|
+
parentSessionId: sessionIdSchema$1,
|
|
6362
|
+
childSessionId: sessionIdSchema$1,
|
|
6044
6363
|
mode: union([literal("one-shot"), literal("continuable")]),
|
|
6045
6364
|
beforeSeq: number().int().nonnegative().optional(),
|
|
6046
6365
|
maxMessages: number().int().positive().optional()
|
|
6047
6366
|
});
|
|
6048
6367
|
/** subagent.history response value. */
|
|
6049
6368
|
const subagentHistoryValueSchema = object({
|
|
6050
|
-
events: array(historyEntrySchema),
|
|
6369
|
+
events: array(historyEntrySchema$1),
|
|
6051
6370
|
hasMore: boolean(),
|
|
6052
|
-
projections: sessionProjectionsBlockSchema.optional()
|
|
6371
|
+
projections: sessionProjectionsBlockSchema$1.optional()
|
|
6053
6372
|
});
|
|
6054
6373
|
object({
|
|
6055
|
-
parentSessionId: sessionIdSchema,
|
|
6056
|
-
childSessionId: sessionIdSchema,
|
|
6374
|
+
parentSessionId: sessionIdSchema$1,
|
|
6375
|
+
childSessionId: sessionIdSchema$1,
|
|
6057
6376
|
mode: literal("continuable"),
|
|
6058
|
-
content: array(contentBlockSchema),
|
|
6377
|
+
content: array(contentBlockSchema$1),
|
|
6059
6378
|
clientTimeZone: string().optional()
|
|
6060
6379
|
});
|
|
6061
6380
|
object({
|
|
6062
|
-
parentSessionId: sessionIdSchema,
|
|
6063
|
-
childSessionId: sessionIdSchema,
|
|
6381
|
+
parentSessionId: sessionIdSchema$1,
|
|
6382
|
+
childSessionId: sessionIdSchema$1,
|
|
6064
6383
|
mode: literal("continuable")
|
|
6065
6384
|
});
|
|
6066
6385
|
/** subagent.interrupt response value. */
|
|
@@ -6078,18 +6397,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6078
6397
|
* mirror of the handler's request table; key coverage compiler-enforced against RpcMethodMap).
|
|
6079
6398
|
*/
|
|
6080
6399
|
const UNARY_VALUE_SCHEMAS = {
|
|
6081
|
-
"session.list": sessionListValueSchema,
|
|
6082
|
-
"session.search": sessionSearchValueSchema,
|
|
6083
|
-
"session.create": sessionCreateValueSchema,
|
|
6084
|
-
"session.history": sessionHistoryValueSchema,
|
|
6085
|
-
"session.models": sessionModelsValueSchema,
|
|
6086
|
-
"session.selectModel": sessionSelectModelValueSchema,
|
|
6087
|
-
"session.rename": sessionRenameValueSchema,
|
|
6088
|
-
"session.fork": sessionForkValueSchema,
|
|
6089
|
-
"session.prompt": sessionPromptValueSchema,
|
|
6090
|
-
"session.attachment": sessionAttachmentValueSchema,
|
|
6091
|
-
"session.updateQueue": sessionUpdateQueueValueSchema,
|
|
6092
|
-
"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,
|
|
6093
6412
|
"subagent.list": subagentListValueSchema,
|
|
6094
6413
|
"subagent.history": subagentHistoryValueSchema,
|
|
6095
6414
|
"subagent.prompt": object({ messageId: string() }),
|
|
@@ -6099,13 +6418,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6099
6418
|
"host.listDirectory": hostListDirectoryValueSchema,
|
|
6100
6419
|
"host.createDirectory": hostCreateDirectoryValueSchema,
|
|
6101
6420
|
"host.openPath": hostOpenPathValueSchema,
|
|
6102
|
-
"workspace.list": workspaceListValueSchema,
|
|
6103
|
-
"workspace.create": workspaceCreateValueSchema,
|
|
6104
|
-
"workspace.rename": workspaceRenameValueSchema,
|
|
6105
|
-
"workspace.delete": workspaceDeleteValueSchema,
|
|
6106
|
-
"workspace.insertBefore": workspaceInsertBeforeValueSchema,
|
|
6107
|
-
"workspace.insertSessionBefore": workspaceInsertSessionBeforeValueSchema,
|
|
6108
|
-
"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,
|
|
6109
6428
|
"skill.list": skillListValueSchema,
|
|
6110
6429
|
"agentPreset.list": agentPresetListValueSchema,
|
|
6111
6430
|
"agentPreset.select": agentPresetSelectValueSchema,
|
|
@@ -6189,7 +6508,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6189
6508
|
return loc?.origin !== void 0 && loc.origin !== "null" ? loc.origin : INTERNAL_BASE$1;
|
|
6190
6509
|
}
|
|
6191
6510
|
mintRpcId() {
|
|
6192
|
-
return RpcId(crypto.randomUUID());
|
|
6511
|
+
return RpcId$1(crypto.randomUUID());
|
|
6193
6512
|
}
|
|
6194
6513
|
/**
|
|
6195
6514
|
* Shared POST leg of both C→S carriers (callUnary/respond): JSON body,
|
|
@@ -6238,11 +6557,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6238
6557
|
}
|
|
6239
6558
|
/** Mux stream opener; virtual for the same override reason as callUnary. */
|
|
6240
6559
|
openMux(_payload, signal, onOpen) {
|
|
6241
|
-
return this.readSse("/api/events.mux", signal, muxFrameSchema, onOpen);
|
|
6560
|
+
return this.readSse("/api/events.mux", signal, muxFrameSchema$1, onOpen);
|
|
6242
6561
|
}
|
|
6243
6562
|
/** Host stream opener; virtual. */
|
|
6244
6563
|
openHost(_payload, signal, onOpen) {
|
|
6245
|
-
return this.readSse("/api/events.host", signal, hostFrameSchema, onOpen);
|
|
6564
|
+
return this.readSse("/api/events.host", signal, hostFrameSchema$1, onOpen);
|
|
6246
6565
|
}
|
|
6247
6566
|
/**
|
|
6248
6567
|
* SSE protocol path: streaming fetch (not EventSource), '\n\n' framing, ServerRequest envelope +
|
|
@@ -9995,6 +10314,480 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9995
10314
|
};
|
|
9996
10315
|
}
|
|
9997
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
|
|
9998
10791
|
//#region src/api-path.ts
|
|
9999
10792
|
/**
|
|
10000
10793
|
* The /api URL prefix — single source for both halves of the web transport.
|
|
@@ -10039,7 +10832,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10039
10832
|
let frame;
|
|
10040
10833
|
try {
|
|
10041
10834
|
if (typeof event.data !== "string") throw new Error("binary WebSocket frame");
|
|
10042
|
-
full = serverRequestSchema.parse(JSON.parse(event.data));
|
|
10835
|
+
full = serverRequestSchema$1.parse(JSON.parse(event.data));
|
|
10043
10836
|
frame = frameSchema.parse(full.payload);
|
|
10044
10837
|
} catch (error) {
|
|
10045
10838
|
console.error(`[client-connection] dropping malformed WebSocket frame on ${path}:`, error);
|
|
@@ -10112,7 +10905,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10112
10905
|
...signal === void 0 ? {} : { signal }
|
|
10113
10906
|
});
|
|
10114
10907
|
if (!response.ok) throw new Error(`transport failure for ${channel}/${endpoint}: HTTP ${response.status}`);
|
|
10115
|
-
const full = serverResponseSchema.parse(await response.json());
|
|
10908
|
+
const full = serverResponseSchema$1.parse(await response.json());
|
|
10116
10909
|
if (full.rpcId !== rpcId) throw new Error(`rpcId mismatch for ${endpoint}: sent ${rpcId}, got ${full.rpcId}`);
|
|
10117
10910
|
return full.result;
|
|
10118
10911
|
} };
|