Repository navigation
Minor Changes
-
fe0cc42:
@fro.bot/space-bus/coregains a browser-safe message-correlation primitive for dispatched prompts, plus typed partial-failure handles for dispatch:createDispatchMessageId()— generates an OpenCode-compatible ascending user message id (msg_+ a 12-character lowercase-hex timestamp/counter prefix + 14 random base62 characters), using onlyDate.now()and Web Crypto'scrypto.getRandomValues— no Node builtins, no dependency. IDs generated in the same millisecond sort ascending by an internal per-millisecond counter, matching OpenCode's own id ordering.dispatch()/toDispatchArgs()accept an optionalmessageIdonDispatchArgs.toDispatchArgsvalidates a caller-supplied id against the exactmsg_+ 12-hex + 14-alphanumeric shape and rejects anything else — including oversized or injection-like input — with a single stable, genericResulterror that never echoes the rejected value.dispatch()re-validates independently as defense in depth for callers that constructDispatchArgsdirectly.- When
messageIdis supplied,newandfollow-updispatch modes include it as the OpenCodemessageIDfield alongside the prompt'spartsand echo it back asmessageIdon the result. The key is omitted entirely — not sent asnull— whenever nomessageIdis given, andblocked/question-replyresults never carry amessageIdsince no ordinary prompt message is sent on those branches. - New
DispatchFailuretype and optionaldispatchFailurefield on dispatch'sResulterror branch give callers a typed handle for partial failures:phase: "not_sent"for failures verified to precede any mutation (e.g. pending-question verification failing under theblockedpolicy), andphase: "indeterminate"for failures where a mutating request (session create, prompt send, question reply) may already have reached OpenCode despite an error response. Known-safe fields (project, andsessionId/messageIdwhen known) are included; unknown fields are omitted rather than sent asundefined. Every other core function'sResulterror shape is unchanged. dispatchMetadata()(shared by the MCP and plugin tool surfaces) and thebus_taskMCP tool'soutputSchemagain the same optionalmessageId, included fornew/follow-upwhen supplied and omitted otherwise.bus_task's plugin and MCPmessageIdinput parameter is optional and validated the same way asdispatch(). Human-readable dispatch text output is unchanged.
All additions preserve the existing
Result<T>/DispatchResultcontract and the browser-safe/coreimport lane.