Release 2.7.0: executable handbooks and native user-site workflows

This commit is contained in:
cflmy committed 2026-11-10 17:03:06 +08:00
1 parent aa0c4d0f55
commit d9aef957f7
562 files changed
+21064 -20387

No files matched your search

+371
View File
@@ -0,0 +1,371 @@
---
markup: occlusion
title: Engineering boundaries for executable handbooks
import:
plugin: lib/plugin.mq.md
sys: lib/sys.mq.md
paths: lib/path.mq.md
table: lib/table.mq.md
result: lib/result.mq.md
---
This extension supplies the small OS and service boundaries used by executable
engineering handbooks. File reads/writes, JSON/TOML, data decisions, retries and
release ordering remain Marqdo code. The native plugin provides bounded argv
process execution, private authenticated GitHub HTTPS, ZIP inspection and R2
Signature V4 uploads. No Python interpreter or generated shell program is used.
Read the task contract before calling it. Process children and native plugins
have the calling OS user's authority; a plugin grant is broader than a native
filesystem grant. The root parameter selects a working/artifact directory, not
an OS sandbox. Never treat reading this file as authorization to push refs,
change a release, upload assets or run arbitrary commands.
Build this repository's marqdo_plugin_engineering crate before first use; the
development handbook's prepare_engineering task performs that bootstrap through
marqdo call. MARQDO_ENGINEERING_PLUGIN may select a locally built library. Installed
packs use the same plugin resolver as other official extensions. This boundary
is native-only; browser WASM cannot start processes or load this library.
The public operation definitions and private request helper below share one
implementation. For the complete release workflow, read
[the executable release handbook](../../skills/marqdo-release/index.mq.md).
Normal filesystem work uses [the native file tools](../../skills/marqdo-dev/files.mq.md);
this extension is not an alternate file-write API.
## _load
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | Load the installed or locally built engineering plugin |
Resolve the library through the existing extension resolver so an installed
pack and a development build share the same public calls. A missing library
produces the normal plugin diagnostic; build or install it rather than hiding
the failure behind a fixed success result. Repeated loads use the host loader's
existing ownership rules. This private boundary requires plugin effects and
never guesses a Python replacement or invents an external interpreter.
We **path = [Resolve the engineering native library](plugin.native_path(name="engineering"))**.
After locating it we return *[Load the bounded engineering operations](plugin.load(path=`path`))*.
## request
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| operation | text | required | command, git_inspect, github, archive, analyze, gzip_text or r2_put |
| payload | map | required | Operation-specific ordinary data; never credential values |
| root | text | "." | Existing working/artifact root for this operation |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result.ok/value/error from the selected boundary |
Use `operation`, `payload` and `root`="." only at a documented native boundary.
Inputs travel as structured plugin values, not strings containing a generated
program. Failed process setup, HTTP, archive validation or signing remains a
failed Result. A successful command request still requires checking value.code
and value.timed_out. No private credential becomes a tool argument or result;
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.
`request_data` =
| operation | payload | root |
|---|---|---|
| `operation` | `payload` | `resolved_root` |
Return *[Perform the explicit native boundary operation](engineering_request(request=`request_data`))*.
## run
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| argv | list | required | Executable followed by individual text arguments |
| cwd | text | "." | Existing directory inside root |
| timeout_ms | number | 120000 | Positive limit through 3600000 milliseconds |
| max_output | number | 262144 | Per-stream capture limit through 16777216 bytes |
| stdin | any | None | Optional text sent to child stdin, then closed |
| env | any | None | Optional child-only text environment values |
| root | text | "." | Root used to resolve cwd and local Git identity |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result containing code/stdout/stderr/timed_out/truncated |
Use `argv`, `cwd`=".", `timeout_ms`=120000, `max_output`=262144, `stdin`=None,
`env`=None and `root`="." to invoke an existing OS tool. Arguments are passed
individually even when they contain quotes, spaces or shell metacharacters.
Inline shell programs, forced Git updates and hook bypass are rejected; a
checked-in packaging script remains a normal explicit external-tool invocation.
The return distinguishes transport completion from child success. Inspect code
and timed_out before consuming stdout. Output is drained concurrently and kept
within the requested cap so noisy children cannot deadlock their own pipes.
On Unix, timeout kills the child process group; Windows attempts taskkill's tree
termination. Output retained by surviving descendants cannot cause unbounded
waiting. A process environment is child-local and does not mutate the parent.
`payload` =
| argv | cwd | timeout_ms | max_output | stdin | env |
|---|---|---|---|---|---|
| `argv` | `cwd` | `timeout_ms` | `max_output` | `stdin` | `env` |
Return *[Execute the explicit argument vector with bounded capture](request(operation="command", payload=`payload`, root=`root`))*.
## github
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| path | text | required | API path under /repos/cflmy/marqdo/ |
| method | text | "GET" | GET, PATCH or POST; mutations need the user's task instruction |
| data | any | None | JSON body; no authentication data |
| missing | bool | False | Treat GET 404 as a successful None |
| root | text | "." | Checkout used by credential helpers |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result containing service JSON, None or a redacted transport error |
Use `path`, `method`="GET", `data`=None, `missing`=False and `root`=".".
The plugin resolves GH_TOKEN/GITHUB_TOKEN, Git's configured credential helper or
the checkout owner's existing gh store privately. It tries the configured
GitHub proxy before direct HTTPS. An uncertain POST is not replayed; a caller
must observe whether publication occurred before deciding to retry a mutation.
Only this repository's API paths are accepted. HTTP errors report their status
without reflecting credentials, signed URLs or arbitrary response bodies.
Missing evidence stays missing; a network failure is not a synthetic empty
release. Test endpoint overrides are explicit environment configuration and
belong only in isolated fixture runs.
`payload` =
| path | method | data | missing |
|---|---|---|---|
| `path` | `method` | `data` | `missing` |
Return *[Request private-authenticated repository service JSON](request(operation="github", payload=`payload`, root=`root`))*.
## inspect_zip
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| path | text | required | Existing ZIP or VSIX inside root |
| root | text | "." | Artifact root; symlink escapes are refused |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result with entries and selected UTF-8 package metadata |
Use `path` and `root`="." to inspect a binary format without extraction.
The plugin caps entry count and total expanded size, rejects escaping paths and
symlinks, and reads every entry to validate its content/CRC. It retains only
bounded VERSION, Cargo and VSIX metadata text for Marqdo's role-specific checks.
Hashing the archive itself remains lib/fs.file_hash, not an alternate Python IO
path. ZIP metadata cannot prove plugin ABI compatibility or execute a program.
We **payload = [Name the one archive path field](table.put(in=None, at="path", value=`path`))**.
Return *[Inspect the archive format without writing extracted files](request(operation="archive", payload=`payload`, root=`root`))*.
## put_file
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| path | text | required | Verified upload file inside root |
| key | text | required | Explicit R2 key such as vX.Y.Z/filename.zip |
| sha256 | text | required | Previously verified SHA256; changed bytes are rejected |
| root | text | "." | Root containing the local upload file |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result with written key, SHA256 and byte count |
Use `path`, `key`, `sha256` and `root`="." for an authorized publication.
The plugin transfers this bounded file across the authenticated service boundary
and rechecks its digest before signing; Marqdo decides which files and keys are
required. Credentials stay in existing R2 environment settings or ~/.marqdo/r2.env.
A configured credential home can select the maintainer's store when running under
another OS identity. Key material is never a parameter, result or command argument.
This is an external write. Successful PUT is evidence for that key only; public
CDN parity is checked separately. The release handbook uploads every pack before
writing VERSION pointers and never sweeps unrelated files from dist. A timeout
remains uncertain publication, so inspect the public object before retrying.
`payload` =
| path | key | sha256 |
|---|---|---|
| `path` | `key` | `sha256` |
Return *[Upload exactly the verified artifact with private R2 signing](request(operation="r2_put", payload=`payload`, root=`root`))*.
## put_text
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| key | text | required | Explicit VERSION key selected by the release workflow |
| text | text | required | Small UTF-8 pointer body with its intended trailing newline |
| root | text | "." | Checkout used to locate existing credential stores |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result with written key, SHA256 and byte count |
Use `key`, `text` and `root`="." only after all required publication bytes are
verified. This operation signs a small UTF-8 service body; it does not write a
local file or infer which version should become latest. The calling Marqdo
workflow owns that decision and its ordering. Keys remain explicit so a replay
cannot silently publish a different version from environment state.
As with put_file, service completion does not substitute for reading the public
pointer and checking the associated download hashes.
`payload` =
| key | text |
|---|---|
| `key` | `text` |
Return *[Write the explicitly selected publication pointer](request(operation="r2_put", payload=`payload`, root=`root`))*.
## analyze
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| source | text | required | Exact source text already read through lib/fs |
| include_body | bool | False | Include compiler AST debug evidence for migration review |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result with compiler functions, contracts, diagnostics and narrative ratios |
Use `source` and `include_body`=False to inspect an authored document
without executing it. File access belongs to the caller's native filesystem
step; this operation receives text and uses the actual Marqdo parser and checker.
It does not invent a regular-expression grammar, load imports, run main, open
network resources or infer permission from prose. Full dependency checks still
use marqdo check on the real file.
The returned parameter names, defaults, heading spans and contracts support
editing without guessing the syntax. Narrative ratios come from the same
implementation used by the repository gate. AST debug evidence is optional
because it is large and intended for mechanical migration comparisons, while
the normal result remains a compact source description.
`payload` =
| source | include_body |
|---|---|
| `source` | `include_body` |
Return *[Inspect this text with the real compiler](request(operation="analyze", payload=`payload`))*.
## gzip_text
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| data | map | required | Portable bytes returned by net.get(response="bytes") |
| max_bytes | number | 16777216 | Positive expanded UTF-8 limit, at most 64 MiB |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result containing decoded UTF-8 text or bounded format failure |
Use `data` and `max_bytes`=16777216 at a compressed data boundary.
Native net.get owns the network read and returns portable bytes; this operation
only interprets their gzip format. It accepts concatenated gzip members, validates
their checksums, caps compressed input and expanded output, and rejects non-UTF-8
text. No temporary file, shell pipeline or Python process is involved.
This is useful for a published apt Packages.gz index. A successful HTTP response
alone cannot establish its package version; decode and inspect its real stanzas.
Malformed data or an expansion beyond the cap remains an error. Binary payloads
are outside this text contract. Calling requires plugin, while the caller's
earlier download independently requires network.read.
`payload` =
| data | max_bytes |
|---|---|
| `data` | `max_bytes` |
Return *[Decode the bounded compressed text format](request(operation="gzip_text", payload=`payload`))*.
## check_exit
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| outcome | map | required | Actual Result returned by engineering.run or its command boundary |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Observed process Result; failure retains its complete bounded execution evidence |
Use `outcome` from an actual process call. Starting a process successfully is
different from that process succeeding: command transport can return ok=true
with a nonzero child code. This pure adapter requires code zero and no timeout.
It never starts or retries a process, changes a command or discards failed output.
A setup/transport failure is retained unchanged. A nonzero exit or timeout becomes
a failed Result with the original execution record in value, including stdout,
stderr and truncation flags. This makes --require-ok useful for a complete
callable workflow without treating CLI transport success as a passed build.
Bounded output can be truncated even when the command succeeds; inspect that
flag before describing it as a full log.
This function only classifies supplied observations. It cannot prove that an
arbitrary caller-provided map came from a real command. Development tasks call
run and then this adapter in the same source flow, retaining their actual argv
and result. Release ordering and retry policy remain the caller's responsibility.
1. not access(`outcome`, "ok")
Return *outcome* with its original native setup failure.
We **execution = [Read the actual bounded process observation](access(outcome, "value"))**.
1. access(`execution`, "code") != 0 or access(`execution`, "timed_out")
We **failed = [Distinguish child failure from successful transport](result.error(code="engineering.process_failed", message="nonzero exit or timeout; inspect the actual execution in value", operation="check_exit"))**.
Return *[Keep all observed process evidence on failure](table.put(in=`failed`, at="value", value=`execution`))*.
Return *outcome* after the observed child exits successfully.
## checked
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| argv | list | required | Existing executable and individual text arguments |
| cwd | text | "." | Existing working directory within root |
| timeout_ms | number | 120000 | Positive child duration limit up to one hour |
| max_output | number | 262144 | Bounded bytes retained per stdout/stderr stream |
| stdin | any | None | Optional text sent to child standard input |
| env | any | None | Optional child-only text environment record |
| root | text | "." | Working root matching the intended checkout |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result requiring a zero child exit; actual execution evidence is retained |
Use `argv`, `cwd`=".", `timeout_ms`=120000, `max_output`=262144,
`stdin`=None, `env`=None and `root`="." to execute one existing tool and require
its success in the same callable workflow. It composes run and check_exit rather
than regenerating process management, credential handling or a shell program.
The parameter vector, directory and resource limits keep their existing meaning.
A setup failure, nonzero exit or timeout returns ok=false. Its actual stdout,
stderr and truncation state remain available for diagnosis. A successful result
means the observed child exited successfully; interpreting its business output
still belongs to the caller. Use --require-ok when this single call controls a
dependent external automation. No retry or publication is implied.
This operation requires plugin. Its child retains normal OS authority, and the
native boundary keeps its existing argv guards and private credential rules.
For example, a unit-test task can pass cargo, test, --lib and --offline as four
separate text elements without needing a new generated command script.
After the bounded execution we return *[Require the actual child outcome and preserve all evidence](check_exit(outcome=run(argv=`argv`, cwd=`cwd`, timeout_ms=`timeout_ms`, max_output=`max_output`, stdin=`stdin`, env=`env`, root=`root`)))*.
+182
View File
@@ -0,0 +1,182 @@
---
markup: occlusion
title: 工程拓展:让开发与发版操作成为可调用手册
import:
工程: ./index.mq.md
---
本文件是 [英文工程入口](index.mq.md) 的中文门面,复用同一个原生插件与行为。开发中的文件读取、撰写、哈希与数据处理应先使用标准库;本拓展只补齐进程、私密认证与压缩格式边界。任务的条件、重试和步骤顺序写在 mq.md 中,不再生成 Python 编排器。
首次使用前通过 skills/marqdo-dev/index.mq.md 的 prepare_engineering 构建本机开发解释器和插件。读取库文档不代表授权发布;推送、修改发布说明和上传对象必须属于用户已授权的任务。结果沿用 ok/value/error 字段,进程结果还要检查 code 和 timed_out,不能只根据请求成功就继续依赖步骤。
可在仓库根目录运行 marqdo call ext/engineering/索引.mq.md 运行 '参数=["git","--version"]' --effects plugin --fs-root . --json。完整发版流程位于 skills/marqdo-release/index.mq.md;普通文件操作位于开发目录的 files.mq.md。本地原生插件与子进程具有当前系统用户的权限,浏览器 WASM 不支持这些边界。
## 运行
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 参数 | list | required | 程序名与逐项文本参数,不是 shell 源码 |
| 目录 | text | "." | 根目录内的实际工作目录 |
| 超时毫秒 | number | 120000 | 1 到 3600000 毫秒 |
| 输出上限 | number | 262144 | 每个输出流的字节上限,最多 16 MiB |
| 输入 | any | None | 写入子进程标准输入后关闭;None 表示无输入 |
| 环境 | any | None | 仅影响子进程的文本环境映射 |
| 根目录 | text | "." | 与 --fs-root 一致的工程根目录;插件不提供操作系统沙箱 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result:包含 code、stdout、stderr、timed_out 与 truncated |
使用`参数`,工作`目录`=".",`超时毫秒`=120000,`输出上限`=262144,`输入`=None,`环境`=None,`根目录`="."。参数逐项传递,空格、美元符号和引号不会被再次当作 shell 程序求值。命令入口拒绝内联 shell、强推和跳过钩子。
进程启动成功与命令执行成功是两个状态:必须检查 value.code 为零且 timed_out 为 False。输出并发读取并有界保存,避免大量日志堵住子进程。超时会尝试终止进程树,诊断信息保留已知凭据脱敏后的文本。调用需要 plugin;外部工具自己的文件和网络权限仍由操作系统决定。
完成该边界调用后返回*[按明确参数执行维护中的工具](工程.run(argv=`参数`, cwd=`目录`, timeout_ms=`超时毫秒`, max_output=`输出上限`, stdin=`输入`, env=`环境`, root=`根目录`))*。
## 分析源码
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 源码 | text | required | 已经通过固有文件库读取的完整源码 |
| 包含正文 | bool | False | 是否附带大体积 AST 调试证据 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result:真实编译器的函数、契约、诊断和叙述比例 |
接收`源码`和`包含正文`=False,仅分析传入文本,不替调用者读取文件。这里复用解释器的真实解析与检查实现,不建立一套正则表达式语法。分析不会加载导入文件、执行 main 或请求外部服务。
参数顺序、默认值和源位置可以支持审阅式迁移;叙述比例采用仓库检查器的相同规则。附加正文仅适合需要逐语句核对的迁移诊断,普通使用先读契约与简要诊断。完整依赖正确性仍需对实际文件执行 marqdo check。调用需要 plugin,并不因源码描述了某个操作就授权执行该操作。
读到分析结果后返回*[用真实编译器检查这段文本](工程.analyze(source=`源码`, include_body=`包含正文`))*。
## 检查压缩包
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 路径 | text | required | 根目录内实际存在的 ZIP 或 VSIX |
| 根目录 | text | "." | 与 --fs-root 一致的工程根目录;插件不提供操作系统沙箱 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result:包内条目与有界保存的版本元数据 |
使用`路径`与`根目录`=".",读取格式并校验每个条目的 CRC,整个过程不解压、不执行文件。插件拒绝越界路径、重复名称、软链接和超限展开量;标准库负责压缩包本身的大小与 SHA256。
检查格式通过不代表版本正确、插件 ABI 匹配或业务测试通过。调用者应继续核对具体产物角色、所需条目及 GitHub 提供的摘要。元数据文本有体积与 UTF-8 限制,缺失内容不能被当作已经验证。调用需要 plugin;根目录是工作位置,不能据此推断插件具有文件沙箱。
完成格式校验后返回*[检查真实压缩条目及其 CRC](工程.inspect_zip(path=`路径`, root=`根目录`))*。
## 解码gzip文本
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 数据 | map | required | 固有网络库返回的 portable bytes |
| 上限 | number | 16777216 | 展开后 UTF-8 字节上限,最多 64 MiB |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result:解码文本或真实格式、编码、体积错误 |
输入`数据`,设置`上限`=16777216。此任务只解释已经读取的 gzip 字节格式,不下载、不创建临时文件。它支持连接的 gzip 成员、校验校验和,并同时限制压缩输入与展开结果;非 UTF-8 数据也会返回失败。
Ubuntu 的 Packages.gz 就需要这一格式边界。HTTP 请求成功后仍要解码实际索引并查找目标包,不能把 200 状态直接当作可安装证据。文件与网络读取仍由固有库完成,压缩格式缺口由拓展承接;调用需要 plugin,不需要 Python 或 shell 解压流水线。
解码完成后返回*[有界解码已经读取的压缩文本](工程.gzip_text(data=`数据`, max_bytes=`上限`))*。
## GitHub请求
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 路径 | text | required | 本项目 /repos/cflmy/marqdo/ 下的 API 路径 |
| 方法 | text | "GET" | GET 只读;PATCH 与 POST 属于外部写入 |
| 数据 | any | None | 结构化 JSON 请求体,不包含凭据 |
| 允许缺失 | bool | False | GET 的 404 是否表示成功的 None |
| 根目录 | text | "." | 与 --fs-root 一致的工程根目录;插件不提供操作系统沙箱 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result:服务 JSON、允许的 None 或脱敏后的失败 |
使用`路径`,`方法`="GET",`数据`=None,`允许缺失`=False,`根目录`="."。原生边界私密读取现有 GitHub 认证存储,先尝试已配置代理再直连;凭据不能成为工具参数或返回值。此接口仅用于本项目服务路径。
POST 的不确定响应不会自动重放,避免重复发布。调用者需要先观察远端是否已经出现目标资源,再决定恢复操作。网络错误保留错误,只有明确允许的 GET 404 才变成 None。调用需要 plugin;读取本手册本身不授权 PATCH 或 POST,具体写入必须来自用户当前任务。
服务请求完成后返回*[通过私密认证边界请求项目服务](工程.github(path=`路径`, method=`方法`, data=`数据`, missing=`允许缺失`, root=`根目录`))*。
## 上传文件
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 路径 | text | required | 根目录内已经验证的上传文件 |
| 对象名 | text | required | 明确的 R2 对象名 |
| 摘要 | text | required | 预先通过固有文件库计算的 SHA256 |
| 根目录 | text | "." | 与 --fs-root 一致的工程根目录;插件不提供操作系统沙箱 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result:已写对象、SHA256 与字节数 |
使用`路径`、`对象名`、`摘要`及`根目录`=".",只上传用户已授权发布的具体文件。插件在签名前再次检查摘要,防止校验后文件已经改变。R2 密钥留在既有环境与私密配置中,不传给模型、不写入源码。
此任务只证明这个对象的上传状态,不决定 latest,也不更新 VERSION。发布流程应先验证全部压缩包并上传,再写指针,最后读取公共 CDN 对比实际摘要。超时表示状态不确定,应观察对象而非立即假设没有上传。调用需要 plugin,原生文件整理与摘要计算仍由固有库完成。
完成明确对象的上传后返回*[上传仍与预验摘要一致的文件](工程.put_file(path=`路径`, key=`对象名`, sha256=`摘要`, root=`根目录`))*。
## 上传文本
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 对象名 | text | required | 发布流程明确选择的 VERSION 对象名 |
| 正文 | text | required | 包含预期换行的小体积 UTF-8 指针文本 |
| 根目录 | text | "." | 与 --fs-root 一致的工程根目录;插件不提供操作系统沙箱 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result:已写对象、SHA256 与字节数 |
使用`对象名`、`正文`和`根目录`=".",在全部相关压缩包已经验证并上传后更新指定指针。此任务不选择版本,也不判断是否应该成为 latest;这些顺序和决策在发版 mq.md 中公开表达。
凭据仍由私密认证边界处理,正文不是本地文件写入的替代接口。请求成功之后还要读取公共指针及其对应压缩包,缓存延迟必须保持未完成状态,不能把另一次上传当作验证。调用需要 plugin,并且必须属于用户授权的发布任务;单纯阅读文档不能触发对象写入。
完成该指针写入后返回*[写入流程已经确定的发布指针](工程.put_text(key=`对象名`, text=`正文`, root=`根目录`))*。
## 检查退出
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 结果 | map | required | 运行任务返回的真实 Result 与子进程观察 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result:只接受零退出且未超时的观察,失败仍保留输出 |
接收`结果`之后,按工程边界已有规则检查退出码和超时状态。进程成功启动不代表编译或测试通过,因此这里把非零退出转成失败 Result,标准输出、错误输出和截断标记仍保留在 value 中。启动失败则沿用原来的诊断。
这个纯函数不再执行、重试或发布任何东西,也不能证明任意传入记录来自真实命令。需要完整的一次调用流程时,使用下方运行并检查,由它在同一份源码里连接真实执行与状态判断。
检查结束后返回*[按实际子进程结果保留成功或失败证据](工程.check_exit(outcome=`结果`))*。
## 运行并检查
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 参数 | list | required | 已维护程序名及逐项文本参数 |
| 目录 | text | "." | 根目录内的实际工作目录 |
| 超时毫秒 | number | 120000 | 正数,最多 3600000 毫秒 |
| 输出上限 | number | 262144 | 每个输出流的有界字节数,最多 16 MiB |
| 输入 | any | None | 可选标准输入文本,发送后关闭 |
| 环境 | any | None | 仅影响子进程的文本环境记录 |
| 根目录 | text | "." | 实际工作根目录;不是操作系统沙箱 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result:要求真实子进程成功,失败保留 code/stdout/stderr 等观察 |
使用`参数`,工作`目录`=".",`超时毫秒`=120000,`输出上限`=262144,`输入`=None,`环境`=None,`根目录`="."。这里复用运行与检查退出两个已经实现的步骤,不再让智能体撰写另一份命令脚本。参数、私密凭据、进程树超时和输出上限都沿用已有原生边界。
调用需要 plugin。启动失败、非零退出或超时返回 ok=False;配合 --require-ok 可以阻止后续自动化继续。成功只表示这次子进程按零退出结束,具体业务结果仍由调用者判断。子进程拥有正常操作系统权限,不能把根目录参数当作沙箱,也不能把阅读本文当作发布授权。
执行结束后返回*[运行维护中的工具并检查其真实结果](工程.checked(argv=`参数`, cwd=`目录`, timeout_ms=`超时毫秒`, max_output=`输出上限`, stdin=`输入`, env=`环境`, root=`根目录`))*。