merge: reconcile 2.9.0 proof release with latest native AI extension updates
This commit is contained in:
commit
c952765845
30 files changed
+3418
-67
No files matched your search
@@ -0,0 +1,113 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: AI context — short, explicit source scopes
|
||||
description: Pack user input and caller-provided file/class/function excerpts.
|
||||
import:
|
||||
agent: ext/ai/agent.mq.md
|
||||
plugin: lib/plugin.mq.md
|
||||
json: lib/json.mq.md
|
||||
---
|
||||
|
||||
Pass only the documentation that the next model decision needs. The supplied
|
||||
file/class/function snippets are data; they do not execute as Marqdo source.
|
||||
A future compiler-backed selector can supply these arguments from AST spans.
|
||||
This helper does not yet infer class/function scopes automatically.
|
||||
|
||||
## pack
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| user | text | required | Latest user input |
|
||||
| file | text | "" | File-level description excerpt |
|
||||
| class | text | "" | Current class excerpt |
|
||||
| function | text | "" | Current function excerpt |
|
||||
| budget_tokens | number | 2048 | Small-model context budget |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Bounded ContextPackV2 and compaction evidence |
|
||||
|
||||
Use `user`, `file`="", `class`="", `function`="", `budget_tokens`=2048 as the inputs for this operation.
|
||||
|
||||
Keep the latest request and current function first. Low-priority file context
|
||||
may be dropped under pressure; any important constraint must be in a retained
|
||||
field, not in a discardable tool transcript.
|
||||
|
||||
`items` =
|
||||
|
||||
| @ | origin | trust | priority | text | retain |
|
||||
|---|---|---|---|---|---|
|
||||
| 1 | user | user | 0 | `user` | True |
|
||||
| 2 | function | unknown | 1 | `function` | True |
|
||||
| 3 | class | unknown | 2 | `class` | False |
|
||||
| 4 | file | unknown | 3 | `file` | False |
|
||||
|
||||
Return *[Pack the supplied scopes and compact redundant context](agent.context_pack_compact(items=`items`, budget_tokens=`budget_tokens`, goal=`user`))*.
|
||||
|
||||
|
||||
## scope
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| scope | text | "function" | file / class / function / tool |
|
||||
| class | text | None | Class heading for disambiguation |
|
||||
| function | text | None | Function/tool heading |
|
||||
| source | text | None | Source override; otherwise current entry module |
|
||||
| max_chars | number | 1600 | Maximum Unicode characters |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Exact source excerpt, line range, or explicit ambiguity |
|
||||
|
||||
Use `scope`="function", `class`=None, `function`=None, `source`=None, `max_chars`=1600 as the inputs for this operation.
|
||||
|
||||
The native selector respects Markdown headings and ignores fenced-code heading
|
||||
lookalikes. Repeated function names require a class; missing/ambiguous scopes
|
||||
return an error value, never an unrelated or whole-file fallback.
|
||||
|
||||
We retain **p = [Locate native agent plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load native agent plugin](plugin.load(path=`p`))**.
|
||||
2. *
|
||||
Return *[No native parser available](json.parse(text="{\"ok\":false,\"status\":\"unavailable\",\"text\":null}"))*.
|
||||
|
||||
Return *[Project the requested document scope](agent_context_scope(source=`source`, scope=`scope`, class=`class`, function=`function`, max_chars=`max_chars`))*.
|
||||
|
||||
|
||||
## compose
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| user | text | required | Latest user input |
|
||||
| class | text | required | Current class name |
|
||||
| function | text | required | Current function name |
|
||||
| source | text | None | Override current entry source |
|
||||
| budget_tokens | number | 2048 | Small-model context budget |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | ContextPackV2 or an explicit failed selector |
|
||||
|
||||
Use `user`, `class`, `function`, `source`=None, `budget_tokens`=2048 as the inputs for this operation.
|
||||
|
||||
Project file, class and function scopes independently. Refuse ambiguous names
|
||||
rather than silently importing an unrelated class or the entire source. The
|
||||
latest user input stays in the retained portion of the resulting context pack.
|
||||
|
||||
We retain **f = [Select file preface](scope(scope="file", source=`source`, max_chars=500))**.
|
||||
We retain **c = [Select current class](scope(scope="class", class=`class`, source=`source`, max_chars=800))**.
|
||||
We retain **n = [Select current function](scope(scope="function", class=`class`, function=`function`, source=`source`, max_chars=1500))**.
|
||||
We retain **f_ok = [Check file selection](json.get(value=`f`, key="ok"))**.
|
||||
We retain **c_ok = [Check class selection](json.get(value=`c`, key="ok"))**.
|
||||
We retain **n_ok = [Check function selection](json.get(value=`n`, key="ok"))**.
|
||||
1. not `f_ok`
|
||||
Return *f*.
|
||||
2. not `c_ok`
|
||||
Return *c*.
|
||||
3. not `n_ok`
|
||||
Return *n*.
|
||||
4. *
|
||||
We retain **ft = [Read file preface](json.get(value=`f`, key="text"))**.
|
||||
We retain **ct = [Read class explanation](json.get(value=`c`, key="text"))**.
|
||||
We retain **nt = [Read function explanation](json.get(value=`n`, key="text"))**.
|
||||
Return *[Compact only the selected scopes](pack(user=`user`, file=`ft`, class=`ct`, function=`nt`, budget_tokens=`budget_tokens`))*.
|
||||
@@ -0,0 +1,246 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: AI flow — small-model choices and bounded subtasks
|
||||
description: Short model decisions, verified options and concurrent Marqdo documents.
|
||||
import:
|
||||
llm: ext/ai/llm.mq.md
|
||||
json: lib/json.mq.md
|
||||
plugin: lib/plugin.mq.md
|
||||
subtask: lib/subtask.mq.md
|
||||
---
|
||||
|
||||
This is the thin author-facing layer. A model returns a candidate; Marqdo checks
|
||||
it before routing. Invalid choices are not SKILL paths and never execute.
|
||||
Only the requested function and its inputs need to be in the model prompt.
|
||||
|
||||
## parse_choice
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| reply | text | required | Raw model reply, treated as data |
|
||||
| options | list | required | Allowed names, not paths or commands |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | {ok,value,status} or {ok:false,error} |
|
||||
|
||||
Use `reply`, `options` as the inputs for this operation.
|
||||
|
||||
Parsing accepts one exact name, a labeled name, a fenced name or a 1-based
|
||||
index. Ambiguous prose fails closed. Parsing never runs a tool or SKILL.
|
||||
|
||||
We retain **p = [Locate the installed agent plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load the agent plugin](plugin.load(path=`p`))**.
|
||||
2. *
|
||||
Return *[Missing native parser](json.parse(text="{\"ok\":false,\"status\":\"unavailable\",\"value\":null}"))*.
|
||||
|
||||
Return *[Parse and verify the choice](agent_choice_parse(reply=`reply`, options=`options`))*.
|
||||
|
||||
## choose
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| input | text | required | Current user request or local decision |
|
||||
| options | list | required | Small list of registered option names |
|
||||
| model | any | None | Existing provider model identifier |
|
||||
| repair | bool | True | Allow one format-only repair attempt |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Verified choice result, or explicit failure |
|
||||
|
||||
Use `input`, `options`, `model`=None, `repair`=True as the inputs for this operation.
|
||||
|
||||
Only ask for the option name. A failed first parse can receive one short
|
||||
format correction; never silently select the nearest-looking option.
|
||||
|
||||
We retain **opts = [Encode allowed values](json.stringify(value=`options`))**.
|
||||
We retain **prompt = "Choose exactly one of these options. Return its name only, no explanation:\n" + opts + "\nInput:\n" + input**.
|
||||
We retain **m = [Build one model handle](llm.create(model=`model`))**.
|
||||
We retain **turn = [Ask the model once](m.ask(prompt=`prompt`))**.
|
||||
We retain **err = [Check model transport error](json.get(value=`turn`, key="error"))**.
|
||||
1. `err`
|
||||
Return *turn*.
|
||||
2. *
|
||||
We retain **reply = [Read model answer](json.get(value=`turn`, key="text"))**.
|
||||
We retain **parsed = [Validate the model reply](parse_choice(reply=`reply`, options=`options`))**.
|
||||
We retain **ok = [Read validation status](json.get(value=`parsed`, key="ok"))**.
|
||||
1. `ok`
|
||||
Return *parsed*.
|
||||
2. `repair`
|
||||
We retain **fix = "Your answer was not an exact allowed option. Return only ONE option name from:\n" + opts**.
|
||||
We retain **fixed = [Retry the format only once](m.ask(prompt=`fix`))**.
|
||||
We retain **repair_error = [Read transport error](json.get(value=`fixed`, key="error"))**.
|
||||
1. `repair_error`
|
||||
Return *fixed*.
|
||||
2. *
|
||||
We retain **again = [Read corrected answer](json.get(value=`fixed`, key="text"))**.
|
||||
Return *[Validate the repaired reply](parse_choice(reply=`again`, options=`options`))*.
|
||||
3. *
|
||||
Return *parsed*.
|
||||
|
||||
## parallel
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| tasks | list | required | Existing .mq.md file tasks with arguments |
|
||||
| limit | number | 2 | Maximum simultaneously running tasks |
|
||||
| timeout_ms | number | 30000 | Execution timeout in milliseconds |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Succeeded, partial, failed or uncertain child outcomes |
|
||||
|
||||
Use `tasks`, `limit`=2, `timeout_ms`=30000 as the inputs for this operation.
|
||||
|
||||
Reuse the built-in subtask scheduler. Each child document returns via its
|
||||
`# main`, and successful siblings remain visible if another child fails.
|
||||
|
||||
We retain **results = [Run bounded Marqdo document tasks](subtask.run_many(tasks=`tasks`, limit=`limit`, timeout_ms=`timeout_ms`))**.
|
||||
We retain **p = [Locate native agent plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load native agent plugin](plugin.load(path=`p`))**.
|
||||
Return *[Preserve success, failure and uncertain child outcomes](agent_parallel_report(results=`results`))*.
|
||||
2. *
|
||||
Return *[Native result classifier unavailable](json.parse(text="{\"ok\":false,\"status\":\"unavailable\"}"))*.
|
||||
|
||||
|
||||
## input
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Stable step ID |
|
||||
| question | text | required | User-visible question |
|
||||
| options | list | required | User-visible choices |
|
||||
| source_revision | text | required | Pinned Marqdo source revision |
|
||||
| session_id | text | None | Host-attested session |
|
||||
| principal_ref | text | None | Host-attested user scope |
|
||||
| freeform | bool | True | Allow custom user reply |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | waiting_input or previously committed reply |
|
||||
|
||||
Use `id`, `question`, `options`, `source_revision`, `session_id`=None, `principal_ref`=None, `freeform`=True as the inputs for this operation.
|
||||
|
||||
This does not park an interpreter stack. The caller persists a step-boundary
|
||||
checkpoint, displays the question, and on a new turn uses reply to continue.
|
||||
The host, not the LLM, must attest session and principal IDs.
|
||||
|
||||
We retain **p = [Locate native agent plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load native agent plugin](plugin.load(path=`p`))**.
|
||||
2. *
|
||||
Return *[No native gate available](json.parse(text="{\"ok\":false,\"status\":\"unavailable\"}"))*.
|
||||
|
||||
Return *[Persist one waiting input gate](agent_input_open(id=`id`, question=`question`, options=`options`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, freeform=`freeform`))*.
|
||||
|
||||
## reply
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Existing waiting step |
|
||||
| reply | text | required | New user response |
|
||||
| source_revision | text | required | Current pinned source revision |
|
||||
| session_id | text | None | Host-attested session |
|
||||
| principal_ref | text | None | Host-attested user scope |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Resolved answer, invalid reply or explicit conflict |
|
||||
|
||||
Use `id`, `reply`, `source_revision`, `session_id`=None, `principal_ref`=None as the inputs for this operation.
|
||||
|
||||
Matching repeated replies are idempotent. A conflicting reply, changed document
|
||||
or changed session fails without executing any SKILL or side effect.
|
||||
|
||||
We retain **p = [Locate native agent plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load native agent plugin](plugin.load(path=`p`))**.
|
||||
2. *
|
||||
Return *[No native gate available](json.parse(text="{\"ok\":false,\"status\":\"unavailable\"}"))*.
|
||||
|
||||
Return *[Commit the verified user reply](agent_input_resume(id=`id`, reply=`reply`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`))*.
|
||||
|
||||
|
||||
## enter
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| skill | text | required | Model-selected registered name |
|
||||
| registry | map | required | Trusted name → path mapping |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Subtask result, or blocked unknown skill |
|
||||
|
||||
Use `skill`, `registry` as the inputs for this operation.
|
||||
|
||||
Never execute a raw model-generated path. Resolve a registered skill name to
|
||||
an author-controlled document, then call its `# main` through the normal Marqdo
|
||||
subtask and effect permissions. The caller must provide a trusted registry.
|
||||
|
||||
We retain **path = [Resolve registered SKILL](json.get(value=`registry`, key=`skill`))**.
|
||||
1. not `path`
|
||||
Return *[Unknown skill is blocked](json.parse(text="{\"ok\":false,\"status\":\"unsupported_skill\"}"))*.
|
||||
2. *
|
||||
We retain **task = [Spawn registered Marqdo document](subtask.spawn(path=`path`))**.
|
||||
Return *[Await the subtask result](subtask.wait(id=`task`))*.
|
||||
|
||||
|
||||
## ask
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| prompt | text | required | Short local prompt |
|
||||
| model | any | None | Configured model selection |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | text | Model reply (not yet a verified tool call) |
|
||||
|
||||
Use `prompt`, `model`=None as the inputs for this operation.
|
||||
|
||||
Ask only what the current function needs. The reply remains data until an
|
||||
explicit verifier accepts it. The LLM adapter owns provider configuration.
|
||||
|
||||
Return *[Ask the configured model](llm.ask(prompt=`prompt`, model=`model`))*.
|
||||
|
||||
## start
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| path | text | required | Trusted registered Marqdo document |
|
||||
| args | list | None | Optional child CLI arguments |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | number | Child task handle |
|
||||
|
||||
Use `path`, `args`=None as the inputs for this operation.
|
||||
|
||||
Start an isolated SKILL document asynchronously, after the calling host has
|
||||
validated its path and required process.exec permission. No model-generated
|
||||
raw path is a valid grant.
|
||||
|
||||
Return *[Start one Marqdo document](subtask.spawn(path=`path`, args=`args`))*.
|
||||
|
||||
## wait
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | number | required | Child task handle |
|
||||
| timeout_ms | number | 30000 | Maximum wait time |
|
||||
| cancel | bool | False | Cancel on timeout |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Child result, timeout or cancellation |
|
||||
|
||||
Use `id`, `timeout_ms`=30000, `cancel`=False as the inputs for this operation.
|
||||
|
||||
A successful wait protocol is not proof of a successful child execution:
|
||||
inspect the child exit code before using its result.
|
||||
|
||||
Return *[Wait for the child](subtask.wait_timeout(id=`id`, timeout_ms=`timeout_ms`, cancel=`cancel`))*.
|
||||
+7
-1
@@ -9,7 +9,13 @@ Start here to choose an AI task. [Model calls](llm.mq.md) own prompts, model con
|
||||
stream collection and usage; [provider adapters](llm/index.mq.md) describe OpenAI-compatible
|
||||
and Ollama requests. [Agents](agent.mq.md) own call-site context, the explicit tool registry,
|
||||
policy routing, observations, workbook planning and continuation. [CoW trials](sandbox.mq.md)
|
||||
own isolated file changes and promotion. [Step routing](policies/step-route.mq.md) is readable
|
||||
own isolated file changes and promotion. [Native flow](flow.mq.md) provides short, verified model choices and bounded document
|
||||
concurrency; [workflow](workflow.mq.md) drives a durable forward-only step plan with
|
||||
`inspect`/`list` progress queries and failed-only read recovery; [context](context.mq.md)
|
||||
packs explicit source scopes; [recovery](recovery.mq.md)
|
||||
uses the native error policy and versioned checkpoints. These are lightweight
|
||||
interfaces, not a second agent runtime.
|
||||
[Step routing](policies/step-route.mq.md) is readable
|
||||
policy data, not a second agent language. Chinese users can start at [索引](索引.mq.md).
|
||||
|
||||
Begin with this offline stream example; it does not request credentials, install a plugin or
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: AI recovery — safe defaults for short SKILL functions
|
||||
description: Reuse the native error policy, durable checkpoints and effect ledger.
|
||||
import:
|
||||
agent: ext/ai/agent.mq.md
|
||||
---
|
||||
|
||||
Error handling belongs to Marqdo, not the model's prompt. The native policy
|
||||
never blindly repeats uncertain writes. Every resume must revalidate the
|
||||
current permission and source revision; a saved checkpoint is not authorization.
|
||||
|
||||
## decide
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| error | map | required | Structured AgentErrorV1 |
|
||||
| attempts | number | 0 | Number of attempts already made |
|
||||
| effect_class | text | "read" | Declared tool effect |
|
||||
| cancelled | bool | False | Parent cancellation status |
|
||||
| fingerprint_repeats | number | 0 | Identical failures without new evidence |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Safe recovery action with budget |
|
||||
|
||||
Use `error`, `attempts`=0, `effect_class`="read", `cancelled`=False, `fingerprint_repeats`=0 as the inputs for this operation.
|
||||
|
||||
This returns an action, not an automatic retry or permission to execute. For
|
||||
write or unknown effect, consult the effect ledger before taking another step.
|
||||
|
||||
Return *[Select a bounded recovery action](agent.error_decide_retry(error=`error`, attempts=`attempts`, effect_class=`effect_class`, cancelled=`cancelled`, fingerprint_repeats=`fingerprint_repeats`))*.
|
||||
|
||||
## save
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Stable logical run ID |
|
||||
| task | any | None | Current task or user request |
|
||||
| status | text | "waiting_input" | Current run status |
|
||||
| effect_ledger_watermark | any | None | Durable ledger boundary if available |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | CheckpointV2 write result |
|
||||
|
||||
Use `id`, `task`=None, `status`="waiting_input", `effect_ledger_watermark`=None as the inputs for this operation.
|
||||
|
||||
Use the existing atomic checkpoint writer. When ledger evidence is absent,
|
||||
a resumed writer requires manual review rather than automatic repetition.
|
||||
This function saves metadata; it does not suspend a Rust execution frame.
|
||||
|
||||
Return *[Save a versioned checkpoint](agent.resume_save(id=`id`, task=`task`, status=`status`, checkpoint_v2=True, effect_ledger_watermark=`effect_ledger_watermark`))*.
|
||||
|
||||
## load
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Previously saved logical run ID |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Checkpoint or missing/unsafe recovery status |
|
||||
|
||||
Use `id` as the inputs for this operation.
|
||||
|
||||
Loading a checkpoint does not execute any saved step. The caller must inspect
|
||||
recovery_mode and write_auto_resume before dispatching any effectful operation.
|
||||
|
||||
Return *[Inspect the saved checkpoint](agent.resume_load(id=`id`))*.
|
||||
@@ -0,0 +1,330 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: Native AI workflow — durable, short, one-step-at-a-time execution
|
||||
description: Plugin-managed checkpointed decision flow without an external agent runtime.
|
||||
import:
|
||||
plugin: lib/plugin.mq.md
|
||||
json: lib/json.mq.md
|
||||
flow: ext/ai/flow.mq.md
|
||||
subtask: lib/subtask.mq.md
|
||||
---
|
||||
|
||||
Every step is an explicit commit boundary. The plugin stores accepted outputs,
|
||||
refuses stale documents and conflicting decisions, and exposes the next action.
|
||||
The caller must supply trusted session, principal and source revision fields;
|
||||
model text is never an identity or permission token. `resume_dir` is a
|
||||
host-relative checkpoint directory, never an absolute client path.
|
||||
|
||||
## open
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Stable run ID |
|
||||
| steps | list | required | 1–128 ordered step records |
|
||||
| source_revision | text | required | Pinned source revision |
|
||||
| session_id | text | None | Trusted session |
|
||||
| principal_ref | text | None | Trusted principal |
|
||||
| resume_dir | text | ".marqdo/agent-resume" | Host-relative checkpoint directory |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Created, resumed, or explicit conflict |
|
||||
|
||||
Use `id`, `steps`, `source_revision`, `session_id`=None, `principal_ref`=None, `resume_dir`=".marqdo/agent-resume" as the inputs for this operation.
|
||||
|
||||
Opening the same ID with the same steps, source revision, session and principal
|
||||
returns the current action instead of resetting progress. Reusing an ID with a
|
||||
different plan or identity fails closed.
|
||||
|
||||
We retain **p = [Locate the Agent ABI plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load Agent ABI plugin](plugin.load(path=`p`))**.
|
||||
Return *[Open durable workflow](agent_workflow_open(id=`id`, steps=`steps`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
2. *
|
||||
Return *[Missing ABI plugin](json.parse(text="{\"ok\":false,\"status\":\"unavailable\"}"))*.
|
||||
|
||||
## next
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Stable run ID |
|
||||
| source_revision | text | required | Pinned source revision |
|
||||
| session_id | text | None | Trusted session |
|
||||
| principal_ref | text | None | Trusted principal |
|
||||
| resume_dir | text | ".marqdo/agent-resume" | Host-relative checkpoint directory |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Current action or terminal state |
|
||||
|
||||
Use `id`, `source_revision`, `session_id`=None, `principal_ref`=None, `resume_dir`=".marqdo/agent-resume" as the inputs for this operation.
|
||||
|
||||
`next` is read-only: it does not call a model, run a child document or consume
|
||||
the current step. Stopped states (`blocked`, `uncertain`, `cancelled`) and
|
||||
unclassified child effects are reported explicitly.
|
||||
|
||||
We retain **p = [Locate the Agent ABI plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load Agent ABI plugin](plugin.load(path=`p`))**.
|
||||
Return *[Find the next committed boundary](agent_workflow_next(id=`id`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
2. *
|
||||
Return *[Missing ABI plugin](json.parse(text="{\"ok\":false,\"status\":\"unavailable\"}"))*.
|
||||
|
||||
## inspect
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Stable run ID |
|
||||
| source_revision | text | required | Pinned source revision |
|
||||
| session_id | text | None | Trusted session |
|
||||
| principal_ref | text | None | Trusted principal |
|
||||
| resume_dir | text | ".marqdo/agent-resume" | Host-relative checkpoint directory |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Progress summary with cursor, step and partial results |
|
||||
|
||||
Use `id`, `source_revision`, `session_id`=None, `principal_ref`=None, `resume_dir`=".marqdo/agent-resume" as the inputs for this operation.
|
||||
|
||||
Use inspect for a UI progress panel or an operator audit. It returns the
|
||||
durable checkpoint `status`, the next `action` (for example `waiting_model`),
|
||||
cursor, total and completed step counts, the current step, and retained partial
|
||||
child results without advancing the workflow.
|
||||
|
||||
We retain **p = [Locate the Agent ABI plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load Agent ABI plugin](plugin.load(path=`p`))**.
|
||||
Return *[Read workflow progress](agent_workflow_inspect(id=`id`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
2. *
|
||||
Return *[Missing ABI plugin](json.parse(text="{\"ok\":false,\"status\":\"unavailable\"}"))*.
|
||||
|
||||
## list
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| session_id | text | None | Trusted session filter |
|
||||
| principal_ref | text | None | Trusted principal filter |
|
||||
| resume_dir | text | ".marqdo/agent-resume" | Host-relative checkpoint directory |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Workflow summaries, newest metadata included separately |
|
||||
|
||||
Use `session_id`=None, `principal_ref`=None, `resume_dir`=".marqdo/agent-resume" as the inputs for this operation.
|
||||
|
||||
Only native workflow checkpoints are listed; unrelated resume records and
|
||||
corrupt files are omitted. Pass host-attested filters to keep one session or
|
||||
principal from seeing another's run identifiers.
|
||||
|
||||
We retain **p = [Locate the Agent ABI plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load Agent ABI plugin](plugin.load(path=`p`))**.
|
||||
Return *[List workflow checkpoints](agent_workflow_list(session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
2. *
|
||||
Return *[Missing ABI plugin](json.parse(text="{\"ok\":false,\"status\":\"unavailable\"}"))*.
|
||||
|
||||
## commit
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Stable run ID |
|
||||
| step_id | text | required | Exact current step |
|
||||
| response | any | required | Completed step output |
|
||||
| source_revision | text | required | Pinned source revision |
|
||||
| session_id | text | None | Trusted session |
|
||||
| principal_ref | text | None | Trusted principal |
|
||||
| resume_dir | text | ".marqdo/agent-resume" | Host-relative checkpoint directory |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Committed next step or explicit failure |
|
||||
|
||||
Use `id`, `step_id`, `response`, `source_revision`, `session_id`=None, `principal_ref`=None, `resume_dir`=".marqdo/agent-resume" as the inputs for this operation.
|
||||
|
||||
A completed step cannot be committed twice. Replaying the same value returns
|
||||
the already-committed result; a different value for the same step conflicts.
|
||||
|
||||
We retain **p = [Locate the Agent ABI plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load Agent ABI plugin](plugin.load(path=`p`))**.
|
||||
Return *[Validate and commit one step](agent_workflow_commit(id=`id`, step_id=`step_id`, response=`response`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
2. *
|
||||
Return *[Missing ABI plugin](json.parse(text="{\"ok\":false,\"status\":\"unavailable\"}"))*.
|
||||
|
||||
## cancel
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Stable run ID |
|
||||
| source_revision | text | required | Pinned source revision |
|
||||
| session_id | text | None | Trusted session |
|
||||
| principal_ref | text | None | Trusted principal |
|
||||
| resume_dir | text | ".marqdo/agent-resume" | Host-relative checkpoint directory |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Cancelled checkpoint status |
|
||||
|
||||
Use `id`, `source_revision`, `session_id`=None, `principal_ref`=None, `resume_dir`=".marqdo/agent-resume" as the inputs for this operation.
|
||||
|
||||
Cancelling prevents future commits. It does not claim that children already
|
||||
started by the supervisor were rolled back.
|
||||
|
||||
We retain **p = [Locate the Agent ABI plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load Agent ABI plugin](plugin.load(path=`p`))**.
|
||||
Return *[Commit cancellation](agent_workflow_cancel(id=`id`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
2. *
|
||||
Return *[Missing ABI plugin](json.parse(text="{\"ok\":false,\"status\":\"unavailable\"}"))*.
|
||||
|
||||
|
||||
## tick
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Running workflow |
|
||||
| source_revision | text | required | Pinned source revision |
|
||||
| registry | map | None | Trusted SKILL registry |
|
||||
| model | any | None | Configured LLM |
|
||||
| session_id | text | None | Host-attested session |
|
||||
| principal_ref | text | None | Host-attested principal |
|
||||
| resume_dir | text | ".marqdo/agent-resume" | Host-relative checkpoint directory |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | New checkpoint state, or waiting_input for the UI |
|
||||
|
||||
Use `id`, `source_revision`, `registry`=None, `model`=None, `session_id`=None, `principal_ref`=None, `resume_dir`=".marqdo/agent-resume" as the inputs for this operation.
|
||||
|
||||
Advance at most one step. Model text is a candidate, never direct
|
||||
execution. Waiting for a user returns immediately without holding a thread.
|
||||
A caller repeats tick after verified completion; UI replies use commit.
|
||||
|
||||
`tick` is the only wrapper that may execute a document child, and it only does
|
||||
so after the checkpoint reports a read-only `ready_tool` step. When the action
|
||||
is `waiting_input`, return the state unchanged so the host can display the
|
||||
question and commit the attested answer on a later call. A blocked, uncertain
|
||||
or cancelled checkpoint is returned as-is; recovery must use `retry_plan` or an
|
||||
operator decision instead of silently ticking again. The returned state always
|
||||
describes the committed boundary, not an optimistic guess about a running
|
||||
child.
|
||||
|
||||
We retain **state = [Load the next action](next(id=`id`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))**.
|
||||
We retain **status = [Read action status](json.get(value=`state`, key="status"))**.
|
||||
1. `status` == "waiting_model"
|
||||
We retain **step = [Read model step](json.get(value=`state`, key="step"))**.
|
||||
We retain **step_id = [Read step identifier](json.get(value=`step`, key="id"))**.
|
||||
We retain **prompt = [Read local prompt](json.get(value=`step`, key="prompt"))**.
|
||||
We retain **options = [Read allowed decisions](json.get(value=`step`, key="options"))**.
|
||||
We retain **answer = [Make a bounded choice](flow.choose(input=`prompt`, options=`options`, model=`model`))**.
|
||||
We retain **valid = [Check model decision](json.get(value=`answer`, key="ok"))**.
|
||||
1. `valid`
|
||||
We retain **chosen = [Read verified model answer](json.get(value=`answer`, key="value"))**.
|
||||
Return *[Commit the model choice](commit(id=`id`, step_id=`step_id`, response=`chosen`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
2. *
|
||||
Return *answer*.
|
||||
2. `status` == "ready_tool"
|
||||
We retain **step = [Read tool step](json.get(value=`state`, key="step"))**.
|
||||
We retain **kind = [Read operation kind](json.get(value=`step`, key="kind"))**.
|
||||
We retain **step_id = [Read step identifier](json.get(value=`step`, key="id"))**.
|
||||
1. `kind` == "parallel"
|
||||
We retain **tasks = [Read child tasks](json.get(value=`step`, key="tasks"))**.
|
||||
We retain **report = [Run bounded parallel documents](flow.parallel(tasks=`tasks`))**.
|
||||
Return *[Commit all child outcomes](commit(id=`id`, step_id=`step_id`, response=`report`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
2. `kind` == "skill"
|
||||
We retain **name = [Read registered skill name](json.get(value=`step`, key="skill"))**.
|
||||
We retain **out = [Run registered SKILL only](flow.enter(skill=`name`, registry=`registry`))**.
|
||||
Return *[Commit verified child result](commit(id=`id`, step_id=`step_id`, response=`out`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
3. *
|
||||
Return *state*.
|
||||
3. `status` == "ready_return"
|
||||
We retain **step = [Read return step](json.get(value=`state`, key="step"))**.
|
||||
We retain **step_id = [Read step identifier](json.get(value=`step`, key="id"))**.
|
||||
We retain **value = [Read final value](json.get(value=`step`, key="value"))**.
|
||||
Return *[Commit the completed workflow](commit(id=`id`, step_id=`step_id`, response=`value`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
4. *
|
||||
Return *state*.
|
||||
|
||||
|
||||
## retry_plan
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Blocked workflow ID |
|
||||
| source_revision | text | required | Pinned source revision |
|
||||
| session_id | text | None | Trusted session |
|
||||
| principal_ref | text | None | Trusted principal |
|
||||
| resume_dir | text | ".marqdo/agent-resume" | Host-relative checkpoint directory |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Failed-only read-task list or manual_review |
|
||||
|
||||
Use `id`, `source_revision`, `session_id`=None, `principal_ref`=None, `resume_dir`=".marqdo/agent-resume" as the inputs for this operation.
|
||||
|
||||
Only a parallel step explicitly declared read-only and with no uncertain
|
||||
effects may return a retry plan. Completed siblings are not included.
|
||||
|
||||
We retain **p = [Locate Agent ABI plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load Agent ABI plugin](plugin.load(path=`p`))**.
|
||||
Return *[Select failed read-only children](agent_workflow_retry_plan(id=`id`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
2. *
|
||||
Return *[Native plugin unavailable](json.parse(text="{\"ok\":false,\"status\":\"unavailable\"}"))*.
|
||||
|
||||
## retry_commit
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Blocked workflow ID |
|
||||
| results | list | required | New outcomes for failed children only |
|
||||
| source_revision | text | required | Pinned source revision |
|
||||
| session_id | text | None | Trusted session |
|
||||
| principal_ref | text | None | Trusted principal |
|
||||
| resume_dir | text | ".marqdo/agent-resume" | Host-relative checkpoint directory |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Merged persistent report, or still blocked |
|
||||
|
||||
Use `id`, `results`, `source_revision`, `session_id`=None, `principal_ref`=None, `resume_dir`=".marqdo/agent-resume" as the inputs for this operation.
|
||||
|
||||
Re-use successful child results from the checkpoint. New results fill failed
|
||||
slots only, in original order; a newly uncertain outcome blocks further work.
|
||||
|
||||
We retain **p = [Locate Agent ABI plugin](plugin.native_path(name="agent"))**.
|
||||
1. `p`
|
||||
We **[Load Agent ABI plugin](plugin.load(path=`p`))**.
|
||||
Return *[Merge verified read-only retries](agent_workflow_retry_commit(id=`id`, results=`results`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
2. *
|
||||
Return *[Native plugin unavailable](json.parse(text="{\"ok\":false,\"status\":\"unavailable\"}"))*.
|
||||
|
||||
## retry_failed
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Blocked workflow ID |
|
||||
| source_revision | text | required | Pinned source revision |
|
||||
| session_id | text | None | Trusted session |
|
||||
| principal_ref | text | None | Trusted principal |
|
||||
| limit | number | 2 | Max concurrent failed children |
|
||||
| timeout_ms | number | 30000 | Child timeout |
|
||||
| resume_dir | text | ".marqdo/agent-resume" | Host-relative checkpoint directory |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Recovered workflow, partial results or manual review |
|
||||
|
||||
Use `id`, `source_revision`, `session_id`=None, `principal_ref`=None, `limit`=2, `timeout_ms`=30000, `resume_dir`=".marqdo/agent-resume" as the inputs for this operation.
|
||||
|
||||
Run only the failed read-only tasks returned by the native checkpoint checker.
|
||||
Unknown external writes never reach this path.
|
||||
|
||||
We retain **plan = [Inspect safe retry manifest](retry_plan(id=`id`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))**.
|
||||
We retain **can_retry = [Check permitted recovery](json.get(value=`plan`, key="ok"))**.
|
||||
1. `can_retry`
|
||||
We retain **tasks = [Read failed-only children](json.get(value=`plan`, key="tasks"))**.
|
||||
We retain **outcomes = [Execute failed read-only children only](subtask.run_many(tasks=`tasks`, limit=`limit`, timeout_ms=`timeout_ms`))**.
|
||||
Return *[Merge with preserved completed children](retry_commit(id=`id`, results=`outcomes`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`, resume_dir=`resume_dir`))*.
|
||||
2. *
|
||||
Return *plan*.
|
||||
@@ -71,7 +71,7 @@ authentication is resolved inside the plugin from existing stores.
|
||||
We **loaded = [Load this package's native boundary](_load())** and
|
||||
**base = [Read the granted runtime working root](sys.cwd())** and **resolved_root = root**.
|
||||
1. not [The requested root is already absolute](paths.is_absolute(path=`root`))
|
||||
We **resolved_root = base + "/" + root** so process and native filesystem locations agree.
|
||||
We **resolved_root = [Join the runtime cwd with the relative grant](paths.join(a=`base`, b=`root`))** so Windows and Unix separators stay native.
|
||||
|
||||
`request_data` =
|
||||
|
||||
|
||||
Reference in new issue
Block a user