Module calls
Expand description
The call protocol every tool speaks: a method name and JSON arguments,
answered with a JSON value or an error. Server mode relays these calls
to the worker that holds a run’s shard; the HTTP API turns its routes
into them; an SDK’s engine answers them on its own thread through a
Relay.
| Method | Arguments | Answer |
|---|---|---|
start | type, id, input, version, options: {timeout, idPolicy} | null |
updateWithStart | the same, and name, arg, updateId | the update’s result |
signal | id, name, value | null |
query | id, name, arg | the answer |
update | id, name, arg, updateId | the result |
result | id | the result |
cancel, terminate | id, reason | null |
editState | id (<type>/<key>), edit (see crate::object::edit), updateId | {version, changed} |
resume | id | null (refused if nothing is paused) |
reset | id, beforeStep, reapplySignals, version | null |
complete | token, value | null |
fail | token, error (a failure envelope or text) | null |
list | where, limit | run summaries |
describe | id | a summary with journal (and, for a key of an object type, objectDetail) |
streamRead | id, run, name, from, waitMs | a stream batch |
types | registered workflow types and their versions | |
metrics | { total, shards } counters | |
info | what serves the calls |
An error answers {"error": message, "kind": snake_case code, "code": Code}; one that carries a failure sends its envelope as error.
Structs§
- Namespaced
- Calls limited to one namespace, a prefix of the workflow ID: what a
namespace’s token reaches. Calls on a run need its ID under
<namespace>/, a completion token must be for such a run, lists show only those runs, and of the calls on the engine as a whole onlyinfo,typesandlimitsanswer (schedules and objects, whose IDs start with their own prefixes, need the full token). - Relay
- Calls for an engine that lives on another thread (an SDK’s): the HTTP
thread queues each call and wakes the engine’s thread, which takes them
with
nextand answers withreply. - Relayed
Call - One call waiting for an SDK’s engine to answer it.
- Stamped
- Calls that name their requester: the HTTP API’s token or proxy
identity goes into the arguments of the
AUDITEDcalls asby(replacing any the request gave), so it reaches the engine that runs them, across a server too.
Constants§
- AUDITED
- The calls that change a run, whose records name who asked (audit).
- MAX_
STREAM_ WAIT_ MS - The longest a relayed stream read waits.
- OUTSIDE_
NAMESPACE - How a refusal for a namespace’s token begins (answered with 403).
- RELAY_
BASE - Relay IDs start here, above a server connection’s, so one host can answer both.
Traits§
- Calls
- Something that answers protocol calls: an engine, a relay to an SDK’s engine, a server.
Functions§
- answer
- A result as a call answers it:
{"value": ...}or the error. - base64
- Standard base64 (for files inside JSON answers).
- decode_
answer - An answer, as a value or the error it carried.
- decode_
error - The error an answer carried.
- edit_
state_ call - An
editStatecall as the call it is:updateWithStartof the key’s edit handler (starting the key’s run if it has none), with who asked in the edit, which itsUpdaterecord keeps. - error_
json - An error as a call answers it.
- error_
kind - The error’s kind as calls carry it.
- is_
traceparent - A W3C
traceparent(00-<32 hex>-<16 hex>-<2 hex>); anything else is not recorded. - run_
call - Answers one call against a Rust engine.
- start_
options - A start’s options from a call’s arguments.
- summary_
json - A run’s summary as calls carry it.
- unbase64
- Decodes standard base64.
- wire_
options - A start’s options as calls carry them.