Expand description
khive-request — request-DSL parser, transport-agnostic.
§Scope
Conceptually every transport into khive walks the same pipeline:
request string → parse → ParsedRequest → dispatch (VerbRegistry) → resultThis crate owns only the parse step. The AST it produces (ParsedRequest,
ParsedOp) is consumed by transports (MCP today; HTTP gateway, FFI, CLI
in future) which then dispatch through khive-runtime’s [VerbRegistry].
Keeping the parser in its own crate frees us to grow the syntax — pipe
chains, $prev substitution, LNDL-style natural-language declarations,
bash-flavoured redirections — without touching the runtime layering.
§Today’s syntax (ADR-016)
- Single op:
tool_name(arg=value, arg=value)—ExecutionMode::Single - Parallel batch:
[tool_name(...), tool_name(...)]—ExecutionMode::Parallel - Sequential chain:
op1(...) | op2(id=$prev.id)—ExecutionMode::Chain - JSON form:
[{"tool":"...", "args": {...}}, ...](or a single object)
Argument values are JSON literals — strings, numbers, booleans, null,
arrays, objects. Chain-only: $prev and $prev.field.path references resolve
at dispatch time against the preceding op’s result.
Structs§
- Parsed
Op - A single parsed operation: tool name + named argument bag.
- Parsed
Request - Result of parsing a
requestinput string (ADR-016).
Enums§
- ArgValue
- An argument value in a
ParsedOp. - DslError
- Parser error — surfaced as
invalid_paramsat the MCP boundary. - Execution
Mode - Execution mode for a
ParsedRequest(ADR-016).
Constants§
- MAX_OPS
- Hard cap on operations per request. ADR-016 §Why-100.
Functions§
- check_
write_ key_ conflicts - Check a parsed batch for write-key conflicts (ADR-038 preflight).
- parse_
request - Parse a request input string, returning either a single op or a batch.
- write_
keys_ for_ op_ pub - Extract write-conflict keys from a single op for preflight conflict detection (ADR-038).