4ddec0ba2f
The wire response now carries only the matched bit — CommandExecuteResult is deleted from the api, schema, and client mirrors (pre-release, no shim); outcomes ride the durably logged command/run/command/done pair broadcast on the mux stream and render as flow nodes. ui-command's runDetached→noticeFor outcome routing is retired: admitted commands surface nothing through the composer, while admission misses (matched:false, syntax feedback) and transport failures keep their immediate notice. The connection fixture mirrors the host: an admitted command appends the lifecycle pair to the session log instead of returning result text.
39 lines
1.5 KiB
TypeScript
39 lines
1.5 KiB
TypeScript
/**
|
|
* commands domain zod schemas (names derived from map keys: commandListRequestSchema /
|
|
* commandListValueSchema / commandExecuteRequestSchema / commandExecuteValueSchema).
|
|
*/
|
|
|
|
import { z } from 'zod'
|
|
import type { RequestPayload, ResponseValue } from './rpc-map.ts'
|
|
import type { Wire } from './rpc.schema.ts'
|
|
import { sessionIdSchema } from './sessions.schema.ts'
|
|
import type { CommandDescriptor } from './commands.ts'
|
|
|
|
/** CommandDescriptor row of command.list. */
|
|
export const commandDescriptorSchema = z.object({
|
|
name: z.string().min(1),
|
|
description: z.string(),
|
|
input: z.object({ hint: z.string() }).optional(),
|
|
}) satisfies z.ZodType<Wire<CommandDescriptor>>
|
|
|
|
/** command.list request payload. */
|
|
export const commandListRequestSchema = z.object({
|
|
sessionId: sessionIdSchema,
|
|
}) satisfies z.ZodType<Wire<RequestPayload<'command.list'>>>
|
|
|
|
/** command.list response value. */
|
|
export const commandListValueSchema = z.object({
|
|
commands: z.array(commandDescriptorSchema),
|
|
}) satisfies z.ZodType<Wire<ResponseValue<'command.list'>>>
|
|
|
|
/** command.execute request payload. */
|
|
export const commandExecuteRequestSchema = z.object({
|
|
sessionId: sessionIdSchema,
|
|
line: z.string(),
|
|
}) satisfies z.ZodType<Wire<RequestPayload<'command.execute'>>>
|
|
|
|
/** command.execute response value: pure admission — outcomes ride the logged lifecycle events, never this response. */
|
|
export const commandExecuteValueSchema = z.object({
|
|
matched: z.boolean(),
|
|
}) satisfies z.ZodType<Wire<ResponseValue<'command.execute'>>>
|