@zq-silk/yui 1.1.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/ARCHITECTURE.md +2 -1
  2. package/ARCHITECTURE.zh-CN.md +2 -1
  3. package/README.md +2 -0
  4. package/dist/cli/commandCatalog.js +66 -54
  5. package/dist/cli/managedDiagnostics.js +2 -1
  6. package/dist/cli/updatePorts.js +0 -5
  7. package/dist/cli.js +113 -107
  8. package/dist/commands/controllerCommands.js +2 -1
  9. package/dist/commands/globalRoleCommands.js +84 -43
  10. package/dist/commands/grantCommands.js +48 -8
  11. package/dist/commands/taskCommands.js +146 -196
  12. package/dist/commands/taskContextCommand.js +29 -6
  13. package/dist/commands/taskFactCommands.js +10 -69
  14. package/dist/commands/taskInputCommands.js +26 -35
  15. package/dist/commands/taskPublicationCommands.js +2 -35
  16. package/dist/commands/taskPublicationVerifyCommand.js +1 -2
  17. package/dist/commands/taskUpstreamCommands.js +2 -1
  18. package/dist/context/runContextPack.js +8 -29
  19. package/dist/context/sessionBootstrapManifest.js +5 -101
  20. package/dist/context/taskContext.js +98 -39
  21. package/dist/controller/clientRuntime.js +16 -8
  22. package/dist/controller/fileSchedulerStoreAdapter.js +24 -0
  23. package/dist/controller/runtime.js +6 -0
  24. package/dist/core/controllerClient.js +46 -21
  25. package/dist/core/protocol.js +12 -7
  26. package/dist/doctor/doctor.js +4 -3
  27. package/dist/errors/cliError.js +4 -4
  28. package/dist/errors/cliFailure.js +213 -0
  29. package/dist/executor/fileRoleLaunchPlanner.js +1 -4
  30. package/dist/grant/capabilityGrant.js +13 -0
  31. package/dist/grant/taskAuthorization.js +127 -0
  32. package/dist/kernel/builtinCapabilities.js +60 -8
  33. package/dist/kernel/kernelPorts.js +2 -2
  34. package/dist/output/boundedRead.js +118 -0
  35. package/dist/release/releaseWorkflowEngine.js +8 -1
  36. package/dist/runtime/managedCaller.js +2 -2
  37. package/dist/runtime/runtimeCoherence.js +10 -8
  38. package/dist/storage/sqliteSchema.js +10 -0
  39. package/dist/storage/storageVersions.js +1 -1
  40. package/dist/storage/taskStore.js +3 -0
  41. package/dist/task/leaderArchive.js +111 -0
  42. package/dist/task/leaderArchiveAuthority.js +24 -0
  43. package/dist/tmux/commandExecutor.js +7 -5
  44. package/docs/architecture/README.md +1 -0
  45. package/docs/architecture/README.zh-CN.md +1 -0
  46. package/docs/cli-information-contract.md +107 -0
  47. package/docs/cli-information-contract.zh-CN.md +81 -0
  48. package/docs/managed-turn-and-session-runtime.md +9 -0
  49. package/docs/managed-turn-and-session-runtime.zh-CN.md +6 -0
  50. package/docs/plugin-sdk.md +7 -3
  51. package/docs/plugin-sdk.zh-CN.md +5 -2
  52. package/docs/release-workflow.md +19 -9
  53. package/docs/release-workflow.zh-CN.md +14 -7
  54. package/docs/storage-baseline.md +5 -0
  55. package/docs/testing/verification-levels.md +2 -2
  56. package/i18n/README.zh-CN.md +2 -0
  57. package/package.json +1 -1
  58. package/skills/yui-leader/SKILL.md +8 -1
  59. package/skills/yui-leader/references/authorization.md +64 -0
  60. package/skills/yui-leader/references/execution.md +18 -4
  61. package/skills/yui-leader/references/task-plugins.md +4 -2
  62. package/skills/yui-operator/SKILL.md +9 -2
  63. package/skills/yui-runtime/SKILL.md +51 -9
  64. package/skills/yui-runtime/references/publication.md +3 -1
@@ -41,6 +41,7 @@ automatically create Runs. Explicit dispatch loads one exact Run Context Pack.
41
41
 
42
42
  ```sh
43
43
  yui task context <task> --json
44
+ yui task context list <task> --store <store> [--cursor <cursor>]
44
45
  yui task context delta <task> --after <coreCursor>
45
46
  yui task context inspect <task> --store <store> --ref <id>
46
47
  yui task run context <task/run> --json
@@ -52,6 +53,14 @@ Delta pages immutable events through a fixed upper bound; inspect expands a
52
53
  current record and can require an exact digest. Runtime observations state their
53
54
  own coverage and do not become another durable snapshot.
54
55
 
56
+ Entry Context samples current facts; it is not a complete historical inventory.
57
+ List one authorized record family, then inspect the relevant originals. Large
58
+ details use `contentPage` and `--cursor`; concatenate all exact text chunks before
59
+ parsing. Global `session context` likewise separates bounded pending/recent
60
+ discovery from `role message show`. See the
61
+ [CLI information contract](cli-information-contract.md) for budgets, scope,
62
+ continuations and the complete-original reading protocol.
63
+
55
64
  Run Context freezes Assignment, source references, effective configuration and
56
65
  workspace boundaries. A Role edit does not rewrite an existing Assignment.
57
66
  Reading either Context does not acknowledge input or create execution authority.
@@ -33,6 +33,7 @@ Run Context Pack。
33
33
 
34
34
  ```sh
35
35
  yui task context <task> --json
36
+ yui task context list <task> --store <store> [--cursor <cursor>]
36
37
  yui task context delta <task> --after <coreCursor>
37
38
  yui task context inspect <task> --store <store> --ref <id>
38
39
  yui task run context <task/run> --json
@@ -43,6 +44,11 @@ Task Context 是一个有界的、获授权的工作集,带有当前 core 游
43
44
  上界内分页不可变事件;inspect 展开一条当前记录,并可要求确切摘要。运行时观察声明
44
45
  自己的覆盖范围,不会成为另一份持久快照。
45
46
 
47
+ 入口 Context 抽样当前事实,不是完整历史目录。先列出一种获授权的记录,再展开相关原文。
48
+ 长详情使用 `contentPage` 与 `--cursor`;必须拼接全部确切文本分块后再解析 JSON。
49
+ Global `session context` 同样把有界 pending/recent 发现与 `role message show` 原文分开。
50
+ 预算、范围、续读及完整原文协议见 [CLI 信息契约](cli-information-contract.zh-CN.md)。
51
+
46
52
  Run Context 冻结 Assignment、来源引用、生效配置和工作区边界。一次 Role 编辑不改写
47
53
  既有 Assignment。读取任一 Context 都不确认输入或创建执行权限。每一条受管输入都指向
48
54
  确切的 Session Manifest 和 CLI 入口。Run Pack 是一个参考目录:动手前先读相关的需求
@@ -87,7 +87,9 @@ changed source does not inherit an old digest's authorization. The boundaries
87
87
  around resources, network, global configuration and the core namespace are
88
88
  unchanged; when existing authority is sufficient it is not re-approved, and when a
89
89
  new permission is missing the specific gap is reported rather than impersonating
90
- the Operator or self-issuing a grant.
90
+ the Operator or inventing user authorization. An original user authorization
91
+ can support a bounded [Leader grant](../skills/yui-leader/references/authorization.md)
92
+ without another Operator signature.
91
93
 
92
94
  On validation failure the Agent preserves the original error and judges the fix;
93
95
  an unknown or partial effect must not be auto-rerun. After using a new capability
@@ -323,8 +325,10 @@ Because trusted-local does not bound direct host effects, this grant must allow
323
325
  statement that every call actually produces an irreversible effect. `none` or
324
326
  `reversible` must not be read as unlimited local execution authority.
325
327
 
326
- An Operator explicitly authorized by the user uses the original grant ingress,
327
- for example to allow a single validation:
328
+ An Operator explicitly authorized by the user uses the original grant ingress.
329
+ A current delivery Leader can use that same ingress with `--source-message`,
330
+ a verbatim `--purpose`, stable `--request-id`, expiry and finite uses, limited
331
+ to the user's actual authorization. For example, the Operator path for a single validation:
328
332
 
329
333
  ```text
330
334
  <checkout>/output/dev/bin/yui task grant issue T --action plugin.execute --param pluginId=demo --param digest=SOURCE_SHA256 --param environmentRef=T/P --param trust=trusted-local --param phase=validate --max-uses 1 --irreversibility-ceiling irreversible
@@ -66,7 +66,8 @@ Leader 先通过稳定 `capability search/describe` 读取当前目录和契约
66
66
  Task-local 管理权限不等于执行信任:可执行包仍逐阶段核对下面定义的精确
67
67
  `plugin.execute` grant,源码改变后不会继承旧摘要授权。资源、网络、全局
68
68
  配置及核心 namespace 的边界不变;已有授权充分时不重复批准,缺少新权限则
69
- 报告具体缺口,不冒充 Operator 或自己签发 grant。
69
+ 报告具体缺口,不冒充 Operator 或虚构授权。原始用户授权已覆盖时,可使用
70
+ [有界 Leader Grant](../skills/yui-leader/references/authorization.md),无需 Operator 再次签字。
70
71
 
71
72
  验证失败由 Agent 保存原错误并判断修复;不可把 unknown/部分效果自动重跑。
72
73
  使用新增能力取得实际业务结果后,通过 `artifact.save` 将独立内容保存为文件产物
@@ -245,7 +246,9 @@ package scope 替代资源授信。因 trusted-local 不约束直接宿主效果
245
246
  必须允许 `irreversibilityCeiling: irreversible`:这是能力上限,不表示每次调用
246
247
  实际产生不可逆效果。`none/reversible` 不得解释为无限本机执行权。
247
248
 
248
- 由获用户明确授权的 Operator 使用原 grant 入口,例如只允许一次验证:
249
+ 获明确授权的 Operator 保留原 grant 入口;当前 delivery Leader 也可使用同一入口,
250
+ 附上 `--source-message`、逐字授权引文 `--purpose`、稳定 `--request-id`、有效期及有限次数,
251
+ 范围必须来自真实用户授权。以下是 Operator 只允许一次验证的示例:
249
252
 
250
253
  ```text
251
254
  <checkout>/output/dev/bin/yui task grant issue T --action plugin.execute --param pluginId=demo --param digest=SOURCE_SHA256 --param environmentRef=T/P --param trust=trusted-local --param phase=validate --max-uses 1 --irreversibility-ceiling irreversible
@@ -149,9 +149,12 @@ protection remain enforced.
149
149
 
150
150
  Storage upgrades are limited to the current major's explicit minor steps.
151
151
  Cross-major conversion is independently authorized and is not a runtime fallback.
152
- Session CLI refresh only retargets the current two-argument quoted wrapper
153
- named by a valid Manifest. It does not convert retired wrapper forms. Runtime
154
- diagnostics do not interpret `schema.json`, `state.json`, or a whole-map release
152
+ New Sessions use the ordinary `yui` entry from their launch environment; updates
153
+ do not generate or retarget per-Session CLI scripts. Global Context commands
154
+ remain self-contained for remote TUI/Desktop use. Correct PATH and Home selection
155
+ are required: protocol/storage checks do not distinguish every same-contract
156
+ installation. Development uses an explicit isolated checkout entry.
157
+ Runtime diagnostics do not interpret `schema.json`, `state.json`, or a whole-map release
155
158
  idempotency file; current SQLite data and per-key release receipts remain the
156
159
  authorities, and unrelated files are left untouched.
157
160
 
@@ -275,18 +278,25 @@ grouped by Role/AgentRun, and process owners use PID/start identity. Storage
275
278
  changes follow the [single explicit upgrade boundary](sqlite-control-plane-design.md);
276
279
  ordinary commands never rewrite the Home schema.
277
280
 
278
- Grant issue and revoke are irreversible-authority operations. They require
281
+ Operator grant issue and revoke retain their existing authority. They require
279
282
  the current registered global Operator conversation. Its native session ID
280
283
  must match the durable live session binding: Codex commands use `CODEX_THREAD_ID`
281
284
  when present, otherwise `YUI_NATIVE_SESSION_ID`; Claude uses `YUI_NATIVE_SESSION_ID`.
282
285
  Host generation and launch-time Agent labels are not caller identity. Resuming
283
286
  the same conversation through another entry point does not revoke its authority.
284
287
  An unregistered, replaced, or ended conversation has no such authority.
285
- A managed Task Agent cannot self-issue or
286
- self-revoke a grant, and clearing the child-process environment does not
287
- confer user authority. The recorded granter/revoker is bound to that
288
- Operator session (`operator:<agent-id>`); there is no `--granter`/`--by`
289
- label to spoof.
288
+ A current delivery Leader can instead issue finite, expiring grants for its own
289
+ Task from an original user/Operator Message, using `--source-message`,
290
+ `--purpose` (a verbatim authorization quotation), and `--request-id`. It must
291
+ choose only the actions actually authorized by that source. Source validation
292
+ is not natural-language approval; development intent is not publication intent.
293
+ Release scope requires Task Projects and their repositories; package/version
294
+ effects also need explicit package/version bounds. Global update, Controller
295
+ replacement and migration remain Operator-only. The Leader may revoke only
296
+ Leader-issued grants in its Task. Empty environments, Worker/Reviewer or
297
+ planning/replaced Sessions confer no such authority. Granter/revoker attribution
298
+ comes from the current Session; there is no `--granter`/`--by` label to spoof.
299
+ See the [complete source/ordinary archive contract](../skills/yui-leader/references/authorization.md).
290
300
 
291
301
  ```sh
292
302
  # 1. The Operator session issues the authority for the release chain.
@@ -113,8 +113,10 @@ Controller RPC 版本 1。Host 不打开 Home 数据库,包括进程归属、
113
113
 
114
114
  存储升级仅包含同主版本内明确的小版本步骤。跨主版本转换独立授权,
115
115
  不构成运行时回退。
116
- Session CLI 刷新只重定位有效 Manifest 指向的当前双参数引号 wrapper,不转换
117
- 退役形态。运行时诊断不解释 `schema.json`、`state.json` 或整表 release 幂等文件;
116
+ 新 Session 使用启动环境中的普通 `yui` 入口;升级不生成或重定向会话 CLI 脚本。
117
+ Global Context 命令保持自足,供远端 TUI/Desktop 使用。必须正确选择 PATH 和 Home:
118
+ 协议及存储校验不能区分所有同合约安装;开发使用显式隔离的 checkout 入口。
119
+ 运行时诊断不解释 `schema.json`、`state.json` 或整表 release 幂等文件;
118
120
  当前 SQLite 与逐 key release 回执仍是权威,无关文件保持原样。
119
121
 
120
122
  `task role status`、`task role list` 和 `task role session inspect` 在持久 Run 状态旁
@@ -209,14 +211,19 @@ Session 权威依据当前持久绑定检查。Telemetry 按 Role/AgentRun 分
209
211
  PID/start 身份。存储变更遵循[唯一的显式升级边界](sqlite-control-plane-design.zh-CN.md);
210
212
  普通命令绝不改写 Home schema。
211
213
 
212
- grant 的签发与撤销是不可逆权威操作。它们需要当前已登记的全局 Operator 对话。它的
214
+ Operator 的 grant 签发与撤销保留现有权威边界,需要当前已登记的全局 Operator 对话。它的
213
215
  原生 session ID 必须与持久的活动 session 绑定匹配:Codex 命令在存在时使用
214
216
  `CODEX_THREAD_ID`,否则使用 `YUI_NATIVE_SESSION_ID`;Claude 使用 `YUI_NATIVE_SESSION_ID`。
215
217
  Host generation 和启动时的 Agent 标签不是调用者身份。通过另一个入口恢复同一段对话
216
- 不撤销其权威。一个未登记、被替换或已结束的对话没有这种权威。一个受管的 Task Agent
217
- 不能自签发或自撤销 grant,清空子进程环境也不赋予用户权威。被记录的授权者/撤销者
218
- 绑定到那个 Operator session(`operator:<agent-id>`);不存在可伪造的 `--granter`/`--by`
219
- 标签。
218
+ 不撤销其权威。未登记、被替换或已结束的对话没有这种权威。
219
+ 本 Task 当前 delivery Leader 也可引用真实用户/Operator 原消息,以
220
+ `--source-message`、`--purpose`(逐字授权引文)、`--request-id` 签发有有效期及有限次数的
221
+ 有界 Grant,并撤销本 Task 的 Leader Grant。语义判断仍由 Agent 负责:引文匹配只是来源
222
+ 验证,开发指令不是发布许可。发布必须限定 Task Project/repository,包与版本操作另须明确
223
+ package/version 边界;全局升级、共享 Controller 替换、迁移仍不开放。
224
+ Worker/Reviewer、规划/失效 Session 和清空环境不获得授权;身份来自当前持久 Session,
225
+ 不存在可伪造的 `--granter`/`--by` 标签。参见
226
+ [完整来源与普通归档契约](../skills/yui-leader/references/authorization.md)。
220
227
 
221
228
  ```sh
222
229
  # 1. Operator session 为发布链签发权威。
@@ -2,6 +2,11 @@
2
2
 
3
3
  # Storage baseline 1.0
4
4
 
5
+ Current storage is 1.2. The declared 1.1 → 1.2 transition adds optional
6
+ CapabilityGrant authorization-source evidence and native-human input/archive
7
+ audit records. Existing valid Operator grants remain unchanged; migration does
8
+ not infer or invent past user authority. The SQL layout is unchanged.
9
+
5
10
  Yui 1.0.0 starts from one clean persistent contract. The package version,
6
11
  storage schema, record envelopes and Controller protocol are separate
7
12
  identities; none is inferred from another.
@@ -50,12 +50,12 @@ is required.
50
50
  ## Permanent core smoke
51
51
 
52
52
  `npm test` and `npm run test:core` build the checkout and run the maintained suite.
53
- The stable suite owns current storage 1.1 and its declared 1.0 minor
53
+ The stable suite owns current storage 1.2 and its declared 1.0/1.1 minor
54
54
  transition. It contains no undeclared historical format compatibility path.
55
55
 
56
56
  Current coverage includes:
57
57
 
58
- 1. Fresh storage 1.1, exact schema/record validation, no initialization over
58
+ 1. Fresh storage 1.2, exact schema/record validation, no initialization over
59
59
  unknown data, and rejection of old integer formats without mutation.
60
60
  2. Exact-version staging, mismatched-target refusal, same-major contiguous
61
61
  minor preflight, explicit maintenance-owner identity across handover, and
@@ -345,6 +345,8 @@ Yui 面向一个受信任本地用户,不是 OS 沙箱,也不是远程多用
345
345
  [总体架构](../ARCHITECTURE.zh-CN.md)介绍端到端设计,
346
346
  [文档导航](../docs/architecture/README.zh-CN.md)提供配置、执行、交付、存储和插件的
347
347
  当前合同。想直接操作 CLI 时,使用 `yui --help` 查看命令。
348
+ [CLI 信息契约](../docs/cli-information-contract.zh-CN.md)说明当前 Context、分页发现、
349
+ 完整原文读取和变更回执。
348
350
 
349
351
  Yui 默认将控制面数据保存在 `~/.yui`,通过 `YUI_HOME` 选择另一个实例。
350
352
  切换构建或更新已有 Home 前,请查看[存储与升级](../docs/sqlite-control-plane-design.md)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zq-silk/yui",
3
- "version": "1.1.2",
3
+ "version": "2.0.0",
4
4
  "description": "Local control plane for long-running native agent CLI sessions backed by tmux.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -7,11 +7,18 @@ description: Lead one Yui Task through authorized planning, activation handoff,
7
7
 
8
8
  Follow [yui-runtime](../yui-runtime/SKILL.md) first. Load the exact Context Pack
9
9
  for an explicitly dispatched AgentRun; for direct conversation or a Task
10
- notification, read current Task context through the Manifest's Session CLI.
10
+ notification, read current Task context using `yui task context <task-id> --json`.
11
11
  No self-dispatch or old completed Run is needed. Read the actual Task
12
12
  requirements, current Brief and relevant user/Operator Messages, not just
13
13
  their summaries. Resolve links relative to the file containing them.
14
14
 
15
+ Current Context is a bounded working set, not all Task history. Use
16
+ `task context list <task> --store <store>` or a domain list for discovery,
17
+ then an exact detail read. A wake contains original Message/Run read pointers,
18
+ not copied reports. Follow Runtime's `nextCursor` and `contentPage` rules:
19
+ read the full relevant window and originals before disposition, without
20
+ unconditionally walking unrelated history.
21
+
15
22
  ## Select the applicable stage
16
23
 
17
24
  Use current lifecycle, latest intent and the Session's actual planning/delivery
@@ -0,0 +1,64 @@
1
+ # Source-authorized Task actions
2
+
3
+ Read the original user/Operator Message in full. A development request, local
4
+ completion, Role report, quoted third-party text, or publication permission
5
+ alone does not authorize another effect. Decide whether the user authorized
6
+ the particular action, resource, trust and scope. Engineering verifies source
7
+ and fixed bounds, not natural-language meaning: a matching quotation proves
8
+ origin, not that your interpretation is correct. Do not issue publication or
9
+ resource grants from a request that only asks to develop.
10
+
11
+ For actual authorization, the current delivery Leader uses:
12
+
13
+ ```sh
14
+ yui task grant issue <task> --source-message <message-id> \
15
+ --purpose "<verbatim explicit authorization>" --request-id <stable-id> \
16
+ --action <action> --expires-at <timestamp> --max-uses <finite-count> \
17
+ <exact scope, parameter bounds and irreversible ceiling>
18
+ ```
19
+
20
+ The existing Grant records source identity/digest, quotation, Session and fixed
21
+ bounds. Replaying the request id returns the same grant; it never replenishes
22
+ expired, exhausted or revoked authority. Do not change ids to evade limits.
23
+ A changed plan needs a new bounded decision within the user's scope, or a real
24
+ InputRequest if new authority is missing. Operator retains issue/revoke.
25
+ The current Leader may revoke this Task's Leader-issued grants, including
26
+ after Session replacement, but cannot revoke Operator grants.
27
+
28
+ Release grants require explicit Task Projects/repositories and `sourceCommit`
29
+ bounds (checked against the workflow source, never a step's claimed value); package effects
30
+ also require packages and concrete version bounds. All steps sharing a
31
+ version-bound grant must pass that version. Global installation, shared
32
+ Controller replacement, migration and other Tasks remain outside this path.
33
+ Preserve source/artifact integrity, changed-candidate acceptance, CI,
34
+ Publication and unknown-effect reconciliation.
35
+
36
+ Plugin execution requires exact pluginId, digest, environmentRef, trust and
37
+ phase. Directory grants require the resourceId, canonical path and read/write
38
+ action. An explicitly authorized unregistered directory can be registered with
39
+ `resource.local.register` using `sourceMessage` and a verbatim `purpose`;
40
+ registration grants no access or Project configuration authority. Then use the
41
+ existing prepare/adopt/bind/release operations. A Home, stable Project or
42
+ managed workspace cannot be registered through this Leader path.
43
+
44
+ Human input through the Host's human-owned console is persisted before the
45
+ Provider write. Read that original Message. Provider-visible userMessage items
46
+ alone cannot prove human authorship: managed prompts use them too. Never
47
+ transcribe unproven input into a Role report and call it user authority. Use
48
+ the authenticated user input surface when transport provenance is unavailable.
49
+
50
+ For an explicitly authorized ordinary archive, first save acceptance/delivery
51
+ evidence and complete the Task:
52
+
53
+ ```sh
54
+ yui task archive <task> --integrated --source-message <message-id> \
55
+ --purpose "<verbatim archive authorization>" --request-id <stable-id>
56
+ ```
57
+
58
+ This single Controller operation checks settlement, delivery and clean
59
+ workspaces, records the source, stops the requesting Leader and applies normal
60
+ cleanup/archive checks. The conversation can end before the CLI response.
61
+ Inspect `task.leader-archive-started`, `task.leader-archive-result`,
62
+ `task.archived` and cleanup receipts. A started operation without a result is
63
+ uncertain; inspect its effects before recovery, never replay with a new id.
64
+ No automatic retry, force or abandonment authority is implied.
@@ -22,6 +22,17 @@ implementation patterns, scheduling options, review routing, or recoverable
22
22
  runtime actions. Create an InputRequest only for a real product choice, new
23
23
  authority, irreversible external effect, or unavailable external fact.
24
24
 
25
+ Task Messages and the Brief are durable records, not delivery receipts to the
26
+ Operator. For a genuinely missing user choice, resource, credential or scope,
27
+ use `task input request`; the Controller notifies the Operator through the
28
+ existing durable notification path with references to the original records.
29
+ Completion and existing blocked-work notifications use that same path. Do not
30
+ invent an InputRequest just to announce progress or ask again for authority
31
+ already granted. A failed global input call does not mean Task notifications
32
+ are broken: a Task Leader must not call global `role message queue`, `steer`
33
+ or `role interrupt`, impersonate Operator, or clear identity environment
34
+ variables to bypass that boundary.
35
+
25
36
  ## Separate the work unit, executor, and concurrency
26
37
 
27
38
  Honor the user's explicit choice of direct work or delegation. Otherwise make
@@ -286,8 +297,9 @@ Use `capability search`, `describe`, and `call` to inspect current tools.
286
297
  Prefer existing tools, composition or a one-off script when sufficient.
287
298
  For reusable Task-local capabilities, read [Task plugins](task-plugins.md)
288
299
  before creation, validation or activation. Plugin management permission does
289
- not grant code execution or broader external effects. Never issue your own
290
- grants, impersonate Operator, or modify the core installation to obtain a tool.
300
+ not grant code execution or broader external effects. Use
301
+ [source-authorized capabilities](authorization.md) for existing explicit user
302
+ authority. Never invent authorization, impersonate Operator, or modify the core installation to obtain a tool.
291
303
 
292
304
  ## Validate and make the review judgment
293
305
 
@@ -369,7 +381,9 @@ after its final report. Cleanup can remain advisory at completion. Ordinary
369
381
  archive requires settled resources; explicitly authorized force archive preserves
370
382
  unresolved resources and diagnostics under the shared
371
383
  [archive contract](../../yui-runtime/references/publication.md). The Leader
372
- does not gain independent archive authorization.
384
+ does not gain independent archive authorization. An original explicit user
385
+ archive request can authorize the Controller-owned ordinary archive described
386
+ in [source-authorized capabilities](authorization.md).
373
387
 
374
388
  Complete only when the Task outcome is satisfied, required checks and review
375
389
  contracts are settled, WorkItems are accepted or deliberately retired, latest
@@ -381,7 +395,7 @@ yui task complete <task-id> \
381
395
  ```
382
396
 
383
397
  Completion records the exact Project heads. Archive is a separate,
384
- user-authorized Operator action.
398
+ user-authorized action, never an implication of completion or publication.
385
399
 
386
400
  Completion is offline by default. `--refresh-remote` only refreshes remote
387
401
  freshness observations; neither path rebases or starts Integration checks.
@@ -1,7 +1,7 @@
1
1
  # Task-local capabilities
2
2
 
3
3
  Read this before creating, validating or activating a Task-local plugin.
4
- Use the stable Session CLI's capability directory and read the exact schema
4
+ Use the `yui` CLI's capability directory and read the exact schema
5
5
  before each unfamiliar operation. Prefer an existing tool, composition or
6
6
  one-off script unless a reusable named capability is useful.
7
7
 
@@ -17,7 +17,9 @@ the exact plugin id, digest, environment, trust and phase, within its remaining
17
17
  uses and validity. A source change cannot inherit an old digest's grant.
18
18
  Trusted-local subprocesses are not an OS sandbox.
19
19
 
20
- Never issue your own grants, impersonate Operator, change global configuration,
20
+ Use [source-authorized capabilities](authorization.md) when original user input
21
+ already authorizes the exact Task plugin/resource. Never invent grants,
22
+ impersonate Operator, change global configuration,
21
23
  or modify the core installation, namespace or carrying Endpoint to obtain a
22
24
  tool. Request only a genuinely missing resource or trust boundary, not authority
23
25
  already available. Plugin grants do not authorize unrelated external effects.
@@ -227,8 +227,15 @@ a dormant Role and verify the complete binding before the next launch.
227
227
 
228
228
  ## Present current progress
229
229
 
230
- Use JSON reads and their top-level `data` field. Report the facts needed to
231
- understand the outcome:
230
+ Use JSON reads and their top-level `data` field.
231
+ Use Global Context's `pending`/`recent` pages to find Messages, then
232
+ `role message show operator <id>` for the original. A successful send receipt
233
+ contains saved identity and delivery/control facts, not another copy of the
234
+ submitted body. Follow Runtime's bounded-read contract for list continuations
235
+ and long `contentPage` details; do not decode `output` as nested JSON or print
236
+ an entire Context again merely to extract one already-returned reference.
237
+
238
+ Report the facts needed to understand the outcome:
232
239
 
233
240
  - Task ID, Projects, recorded bases, and lifecycle;
234
241
  - current WorkItems, ownership, dependencies, and acceptance state;
@@ -17,8 +17,8 @@ workspace layout, native transcript, or an earlier AgentRun.
17
17
  ## Enter through the current context
18
18
 
19
19
  There are two normal Task entry points. A user may continue directly with the
20
- current, unrevoked Leader Session: read current context using the Session CLI
21
- with `task context <task-id> --json`. Do not request a self-wake, reopen a Task,
20
+ current, unrevoked Leader Session: read current context using
21
+ `yui task context <task-id> --json`. Do not request a self-wake, reopen a Task,
22
22
  or reuse an old completed AgentRun snapshot merely to obtain authority. Pending
23
23
  delivery, unknown execution evidence and missing reports do not themselves
24
24
  revoke Session authority. Task lifecycle, scope, Assignment, workspace and
@@ -27,26 +27,35 @@ authority merely because the Task becomes active.
27
27
  Use the runtime-provided `TMPDIR` for temporary context or diagnostic files,
28
28
  not fixed shared `/tmp` names or the logical multi-Project workspace container.
29
29
 
30
+ Ordinary commands use `yui` from the intended launch environment's PATH and
31
+ `YUI_HOME`. Session/native identity, Task/Assignment/workspace authority and
32
+ Controller protocol/storage checks still apply; they do not distinguish every
33
+ installation with the same protocol and storage versions. If the entry or Home
34
+ is wrong or unavailable, report that fact and use the explicitly authorized
35
+ entry/environment; do not guess another installation or clear Session identity.
36
+
30
37
  For every explicitly dispatched managed Task AgentRun:
31
38
 
32
39
  1. Read the exact AgentRun identity from the newest Bootstrap Envelope.
33
- 2. Before acting, load its authorized pack with the Session CLI named by the
34
- current Session Manifest:
40
+ 2. Before acting, load its authorized pack using the current Session Manifest's
41
+ Context command and the exact Task/Run identity:
35
42
 
36
43
  ```sh
37
- "$YUI_SESSION_CLI" task run context "$YUI_TASK_ID/<run-id>" --json
44
+ yui task run context "<task-id>/<run-id>" --json
38
45
  ```
39
46
 
40
47
  3. Verify that the returned Task, AgentRun, Role, purpose, Snapshot digest, workspace,
41
48
  and Adapter match the Envelope and Session Manifest. Stop and report a
42
49
  context-load failure if the pack is missing, stale, unauthorized, malformed,
43
50
  or mismatched. Never request an inline/full-prompt fallback.
44
- 4. Use pack summaries and pointers first. Expand only an authorized ref when
51
+ 4. Use the pack's `pointers` (including each pointer's summary) first. They are
52
+ the single readable-ref inventory; `deltaRefs` contains only changed identities.
53
+ Expand only an authorized ref when
45
54
  its full value is needed, selecting it by the pointer's exact `store` and
46
55
  `refId`:
47
56
 
48
57
  ```sh
49
- "$YUI_SESSION_CLI" task run context expand "$YUI_TASK_ID/<run-id>" <ref-id> --store <store> --mode full --json
58
+ yui task run context expand "<task-id>/<run-id>" <ref-id> --store <store> --mode full --json
50
59
  ```
51
60
 
52
61
  `--store` is required, even when the ref id is unique. Select both fields
@@ -119,14 +128,47 @@ TUI, with the configured Agent, permissions and workspace unchanged. A live
119
128
  unmanaged Session is not silently replaced or adopted; use an explicit Session
120
129
  lifecycle action before enabling controlled delivery.
121
130
 
122
- Context reads never consume queue entries. Read the referenced Message in full
123
- from Session Context. Native/transport acceptance is not implementation, and
131
+ Context reads never consume queue entries. Global Context returns bounded
132
+ `pending` and `recent` discovery pages, not Message bodies. Read a referenced
133
+ original with `role message show <role> <message-id> --json`. Follow a pending
134
+ page's `nextCursor` using `role message list <role> --pending --cursor <cursor>`
135
+ when it is incomplete; accepted delivery does not erase the Message from the
136
+ separate all-message list. Native/transport acceptance is not implementation, and
124
137
  `interrupt-requested` is not a stopped Turn or stopped background resources.
138
+ Saving a Task Message or Brief is not notification delivery to Operator. A
139
+ Task Role uses the existing Task InputRequest path for a genuinely missing
140
+ user decision, not global Role input controls or fabricated progress questions.
125
141
  Only an exact terminal and the original Session/writer boundary can release a
126
142
  then handoff. An accepted or unconfirmed steer must not be submitted again by
127
143
  changing its request id or composing then. A conclusive rejection permits an
128
144
  explicit new control attempt; uncertainty does not.
129
145
 
146
+ ## Read bounded information completely when required
147
+
148
+ Structured CLI results live in the top-level `data`, not a JSON-encoded
149
+ `output` string. Task current Context includes bounded current facts and
150
+ message references; it does not include event or terminal Run history.
151
+ `collections` and `attention` identify incomplete discovery. Use
152
+ `task context list <task> --store <store> [--cursor <cursor>]` to discover one
153
+ family, then `task context inspect <task> --store <store> --ref <refId>
154
+ --digest <digest>` to read its exact current value. Common Task lists use the
155
+ same `items`, `total`, `complete`, and `nextCursor` contract. Do not treat the
156
+ first page or a summary as complete requirements.
157
+
158
+ Long detail reads return `contentPage` instead of the ordinary value (under
159
+ `data.context` for Run context/expand, `data.contextDelta` for Run Context delta). Repeat the same read with
160
+ `--cursor <contentPage.nextCursor>` until `complete: true`. Concatenate `text`
161
+ in offset order and parse the combined JSON once, retaining the same source
162
+ and digest. A source-change error requires a fresh read, not mixing old and
163
+ new chunks. Never use a read cursor to repeat a mutation.
164
+
165
+ Read all pages of a relevant original requirement, result, or authorization
166
+ before acting on it. For a wake, read its complete fixed window and the
167
+ referenced original Messages; the wake itself contains pointers, not reports.
168
+ For unrelated discovery, stop once the necessary evidence is found. Task
169
+ event deltas retain their fixed upper bound and are history, not replacement
170
+ current state. No read acknowledges implementation or consumes a queue.
171
+
130
172
  ## Preserve intent and authority
131
173
 
132
174
  An analysis, diagnosis, or review request is read-only unless the user also
@@ -87,7 +87,9 @@ is not Candidate acceptance, Review, Integration or Task completion.
87
87
 
88
88
  ## Archive separately
89
89
 
90
- Completion does not authorize archive. The Operator obtains authorization for
90
+ Completion does not authorize archive. A delivery Leader with original user
91
+ authorization may use [ordinary archive](../../yui-leader/references/authorization.md);
92
+ this grants no force or abandonment authority. Otherwise the Operator obtains authorization for
91
93
  the exact Task, checks archive eligibility, then uses `--integrated` for verified
92
94
  merged delivery or `--abandon` for deliberate non-delivery. General archive
93
95
  approval never implies `--force` authority. Preserve the Task record.