scripts
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDurable Scripts
持久化脚本
This skill's launcher lives inside this skill directory
and calls the identity-bound daemon through .
Execute the launcher when command execution is available. If it is unavailable,
return the exact command instead; never claim a script was queued, scheduled,
rerun, cancelled, or removed unless the command succeeded.
scripts/scripts.shTARIBOY_TOOLS_SOCKETRun once with . Queue it exactly once,
finish the iteration, and consume the later message instead of
waiting in the current iteration.
scripts/scripts.sh run <name> -- <command>script.resultRun repeatedly with .
Runs never overlap. A run that exits with ()
publishes nothing and keeps the schedule; it is the only outcome that does.
The daemon exports the code to every run, so a shell command stays quiet with
and a Python one with
.
scripts/scripts.sh schedule <name> --every <seconds> -- <command>$TARIBOY_QUIET_EXIT111exit "${TARIBOY_QUIET_EXIT:-111}"sys.exit(int(os.environ.get("TARIBOY_QUIET_EXIT", "111")))Inspect with , , and
; use ,
, or for lifecycle control.
scripts/scripts.sh lsscripts/scripts.sh runsscripts/scripts.sh logsscripts/scripts.sh rerunscripts/scripts.sh cancelscripts/scripts.sh rm此 skill 的 启动器位于此 skill 目录内,并通过 调用与身份绑定的 daemon。
如果可以执行命令,请运行该启动器。如果无法执行,则原样返回确切命令;除非命令成功执行,否则绝不能声称脚本已排队、调度、重新运行、取消或删除。
scripts/scripts.shTARIBOY_TOOLS_SOCKET使用 运行一次。恰好将其入队一次,完成本次迭代,并消费后续的 消息,而不要在当前迭代中等待。
scripts/scripts.sh run <name> -- <command>script.result使用 定期重复运行。
各次运行绝不重叠。以 ()退出的运行不会发布任何消息,并会保持调度继续运行;只有这种结果会如此。
daemon 会将该退出码导出给每次运行,因此 shell 命令可以使用 保持静默,Python 命令则可以使用 。
scripts/scripts.sh schedule <name> --every <seconds> -- <command>$TARIBOY_QUIET_EXIT111exit "${TARIBOY_QUIET_EXIT:-111}"sys.exit(int(os.environ.get("TARIBOY_QUIET_EXIT", "111")))使用 、 和 进行检查;使用 、 或 进行生命周期控制。
scripts/scripts.sh lsscripts/scripts.sh runsscripts/scripts.sh logsscripts/scripts.sh rerunscripts/scripts.sh cancelscripts/scripts.sh rmAddress every definition by its script ID
使用 script ID 定位每个定义
REQUIRED: , , and accept only the script ID
or a run ID. Names are not unique and are not resolved: passing one
fails with , and creates a second
definition instead of resuming the stopped one.
reruncancelrmscr-...srun-...not foundrun <name> -- <command>Take the ID from the field of the message that woke
you, from the creation output, or from . Record the
script ID, not only the name, wherever a durable monitor is recorded.
script_idscript.resultscripts/scripts.sh ls必需: 、 和 仅接受 script ID 或 run ID。名称并不唯一,也不会被解析:传入名称会因 而失败; 会创建第二个定义,而不会恢复已停止的定义。
reruncancelrmscr-...srun-...not foundrun <name> -- <command>从唤醒你的 消息的 字段、创建输出或 中获取 ID。在任何持久化监控记录中,都应记录 script ID,而不只是名称。
script.resultscript_idscripts/scripts.sh lsA published result stops the schedule
发布结果会停止调度
A recurring definition keeps its schedule only while every run stays quiet.
The moment a run publishes a message, the daemon sets the
definition to and clears its next run: the agent is notified once
instead of repeatedly, and no further runs happen until it is resumed.
script.resultcompletedThis covers every published outcome:
| Event | Effect on the recurring definition |
|---|---|
Run exits with | No message; schedule keeps running |
| Run exits with any other code, success or failure | Result published; definition stopped |
A command that never exits with | Every run publishes, so the schedule stops after the first run |
| That run still publishes a result, so the definition stops too |
| A run interrupted by a daemon restart | Recovery publishes the interrupted result, so the definition stops |
| Definition cancelled; it can never run again |
循环定义仅在每次运行都保持静默时才会继续执行调度。一旦某次运行发布 消息,daemon 就会将定义设置为 并清除下一次运行:Agent 只会被通知一次,而不是反复收到通知;并且在恢复之前不会继续运行。
script.resultcompleted这适用于所有已发布的结果:
| 事件 | 对循环定义的影响 |
|---|---|
运行以 | 不发布消息;调度继续运行 |
| 运行以其他任何代码退出,无论成功还是失败 | 发布结果;定义停止 |
命令从未以 | 每次运行都会发布结果,因此调度在首次运行后停止 |
对一次活动运行执行 | 该运行仍会发布结果,因此定义也会停止 |
| 运行被 daemon 重启中断 | 恢复流程会发布中断运行的结果,因此定义停止 |
执行 | 定义被取消;此后永远无法再次运行 |
Handling a script.result
for a recurring definition
script.result处理循环定义的 script.result
script.resultREQUIRED: Process the result, then close it with exactly one of these two
decisions before the iteration ends. Doing neither silently ends the
observation.
-
Still needed — resume the same definition:bash
scripts/scripts.sh rerun <script-id>runs it now and returns the definition torerun, so its fixed delay continues afterwards. Never create a replacement schedule for work the stopped definition already describes.active -
No longer needed — remove it:bash
scripts/scripts.sh rm <script-id>The published result already stopped it, so nois needed. Runcancelfirst only whenscripts/scripts.sh cancel <script-id>still reportsls.state: active
A stopped definition is not a wait object. Never end an iteration describing a
definition that published its result as an active monitor: either it was
resumed with in this iteration, or the iteration's wait object is
something else.
rerun必需: 处理结果后,在迭代结束前必须恰好采用以下两种决定之一来关闭它。两种决定都不采用会静默结束观察。
-
仍然需要 — 恢复同一定义:bash
scripts/scripts.sh rerun <script-id>会立即运行它,并将定义恢复为rerun,之后固定延迟会继续生效。对于已停止定义所描述的工作,绝不能创建替代调度。active -
不再需要 — 删除它:bash
scripts/scripts.sh rm <script-id>已发布的结果已经停止了该定义,因此无需。仅当cancel仍报告ls时,才需要先运行state: active。scripts/scripts.sh cancel <script-id>
已停止的定义不是等待对象。迭代结束时,绝不能将已经发布结果的定义描述为仍处于活动状态的监控对象:要么它已在本迭代中通过 恢复,要么本迭代的等待对象是其他对象。
rerunExternal prerequisite failures
外部前置条件失败
REQUIRED: A recurring schedule whose command cannot succeed until an
external prerequisite changes, such as a missing credential, binary, or
dependency, is no longer a valid wait object. Its failing result already
stopped it, so take branch 2 above and never it:
rerunbash
scripts/scripts.sh rm <script-id>Run before it only when still
reports . Then, for a Native Task:
scripts/scripts.sh cancel <script-id>lsstate: active- Mention the customer and ask one blocking question. Reuse a matching unanswered question instead of creating or repeating it.
- Set the task to if it is not already there and record the question as the only resume event.
wait_customer - As the final action, finish the iteration through the skill with
loop.scripts/loop.sh done
The failure is handled only after the definition is removed, the task has one
customer-answer wait, and the iteration is finished. An action trace that omits
any of these is incomplete.
Pausing or disabling leaves the useless definition behind; it does not complete
this sequence. Do not rerun the command, create a replacement schedule, or
repeat the failure comment while the question remains unanswered.
必需: 如果循环调度的命令在外部前置条件发生变化之前无法成功执行,例如缺少凭据、二进制文件或依赖项,那么该调度就不再是有效的等待对象。其失败结果已经停止了它,因此应采用上面的分支 2,绝不能 它:
rerunbash
scripts/scripts.sh rm <script-id>仅当 仍报告 时,才需要在删除前运行 。随后,对于 Native Task:
lsstate: activescripts/scripts.sh cancel <script-id>- 向客户说明情况并提出一个阻塞性问题。如果已有匹配且未回答的问题,应复用该问题,而不是新建或重复提问。
- 如果任务尚未处于 状态,则将其设置为该状态,并将该问题记录为唯一的恢复事件。
wait_customer - 作为最后一个操作,通过 skill 执行
loop来结束本次迭代。scripts/loop.sh done
只有在定义已删除、任务包含且仅包含一个等待客户回答的事件,并且迭代已结束后,才算处理了此次失败。缺少任一步骤的操作轨迹都是不完整的。
暂停或禁用只会留下无效定义,并不算完成此流程。在客户问题得到回答之前,不要重新运行命令、创建替代调度或重复发布失败说明。
Red flags
危险信号
| Thought | Reality |
|---|---|
| "The schedule keeps running, so I can just finish." | Any published result stopped it. Resume with |
| "Cancelling one run leaves the schedule intact." | That run still publishes a result, which stops the definition. |
| "I will schedule it again to resume monitoring." | A second definition duplicates the work. |
" | Names are not resolved; only |
| "It succeeded, so nothing stopped." | Success is not quiet. Only |
| 想法 | 实际情况 |
|---|---|
| "调度会继续运行,所以我可以直接结束。" | 任何已发布的结果都会停止它。使用 |
| "取消一次运行后,调度仍然完好。" | 该运行仍会发布结果,从而停止定义。 |
| "我会重新调度它,以恢复监控。" | 第二个定义会造成工作重复。 |
"使用 | 名称不会被解析;只有 |
| "它成功了,所以没有任何东西停止。" | 成功并不表示静默。只有 |