Skip to content
docsv0.1.0

ProcessInstantiateTool

`process_instantiate` — starts a new process instance from a named process definition (resolved through the injected {@see ProcessDefinitionRegistry}) and auto-advances it (via {@see ProcessRunner}) up to its first human decision point or terminal state. `inputs` is declared `array` with `#[Param(type: 'object')]` (tool-runtime 0.6): the wire value arrives as a plain associative PHP array (the host's JSON decode already produced it), so no manual `json_decode()` is needed in this method body — see {@see Param}'s own docblock for why a bare `array $inputs` (without the `type: 'object'` override) would infer JSON-Schema `type: array` instead, rejecting an associative payload like `{"post_id": 1}`.

ProcessInstantiateTool::__construct()

public function __construct(Milpa\EventStore\EventStoreInterface $store, Milpa\Orchestrator\HumanGate $gate, Milpa\Orchestrator\ProcessRunner $runner, Milpa\Orchestrator\ProcessDefinitionRegistry $registry):

Parameters

Parameters of __construct()
NameTypeDescription
$storeMilpa\EventStore\EventStoreInterface
$gateMilpa\Orchestrator\HumanGate
$runnerMilpa\Orchestrator\ProcessRunner
$registryMilpa\Orchestrator\ProcessDefinitionRegistry

ProcessInstantiateTool::setCurrentContext()

public function setCurrentContext(Milpa\ToolRuntime\Contracts\ToolContext $ctx): void

Captures the calling {@see ToolContext} — the tool scanner injects it when this method exists.

Parameters

Parameters of setCurrentContext()
NameTypeDescription
$ctxMilpa\ToolRuntime\Contracts\ToolContext

ProcessInstantiateTool::instantiate()

public function instantiate(string $definition, array $inputs): Milpa\ToolRuntime\ToolResult

Starts `$definition` with `$inputs` and auto-advances it to its first gate or terminal state.

Parameters

Parameters of instantiate()
NameTypeDescription
$definitionstring
$inputsarray<string, mixed>

Returns

with data `{instance_id: string, current_state: string}` on success