@zq-silk/yui 1.1.0 → 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 (67) hide show
  1. package/ARCHITECTURE.md +2 -1
  2. package/ARCHITECTURE.zh-CN.md +2 -1
  3. package/README.md +3 -1
  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 +6 -3
  27. package/dist/doctor/ptyProbe.js +74 -0
  28. package/dist/doctor/ptyProbeChild.js +90 -0
  29. package/dist/errors/cliError.js +4 -4
  30. package/dist/errors/cliFailure.js +213 -0
  31. package/dist/executor/fileRoleLaunchPlanner.js +1 -4
  32. package/dist/grant/capabilityGrant.js +13 -0
  33. package/dist/grant/taskAuthorization.js +127 -0
  34. package/dist/kernel/builtinCapabilities.js +60 -8
  35. package/dist/kernel/kernelPorts.js +2 -2
  36. package/dist/output/boundedRead.js +118 -0
  37. package/dist/release/releaseWorkflowEngine.js +8 -1
  38. package/dist/runtime/managedCaller.js +2 -2
  39. package/dist/runtime/runtimeCoherence.js +10 -8
  40. package/dist/storage/sqliteSchema.js +10 -0
  41. package/dist/storage/storageVersions.js +1 -1
  42. package/dist/storage/taskStore.js +3 -0
  43. package/dist/task/leaderArchive.js +111 -0
  44. package/dist/task/leaderArchiveAuthority.js +24 -0
  45. package/dist/tmux/commandExecutor.js +7 -5
  46. package/docs/architecture/README.md +1 -0
  47. package/docs/architecture/README.zh-CN.md +1 -0
  48. package/docs/cli-information-contract.md +107 -0
  49. package/docs/cli-information-contract.zh-CN.md +81 -0
  50. package/docs/managed-turn-and-session-runtime.md +9 -0
  51. package/docs/managed-turn-and-session-runtime.zh-CN.md +6 -0
  52. package/docs/plugin-sdk.md +7 -3
  53. package/docs/plugin-sdk.zh-CN.md +5 -2
  54. package/docs/release-workflow.md +19 -9
  55. package/docs/release-workflow.zh-CN.md +14 -7
  56. package/docs/storage-baseline.md +5 -0
  57. package/docs/testing/verification-levels.md +12 -2
  58. package/docs/testing/verification-levels.zh-CN.md +8 -0
  59. package/i18n/README.zh-CN.md +3 -1
  60. package/package.json +3 -3
  61. package/skills/yui-leader/SKILL.md +8 -1
  62. package/skills/yui-leader/references/authorization.md +64 -0
  63. package/skills/yui-leader/references/execution.md +18 -4
  64. package/skills/yui-leader/references/task-plugins.md +4 -2
  65. package/skills/yui-operator/SKILL.md +9 -2
  66. package/skills/yui-runtime/SKILL.md +51 -9
  67. package/skills/yui-runtime/references/publication.md +3 -1
@@ -0,0 +1,107 @@
1
+ # CLI information contracts
2
+
3
+ Yui separates a command's effect from discovery and full evidence. Queries
4
+ never consume Messages or start subsequent work. Mutation receipts describe
5
+ saved/requested/accepted/unknown facts; `ok: true` means the CLI invocation
6
+ succeeded, not that a Task, native Turn or remote delivery completed.
7
+
8
+ This is the current wire contract, not a compatibility mode. Stored Tasks,
9
+ Messages, results, Snapshots and Session histories are unchanged. No persistent
10
+ schema migration or new snapshot/cache store is introduced.
11
+
12
+ ## Daily read path
13
+
14
+ | Question | Entry | Default information / further reading |
15
+ | --- | --- | --- |
16
+ | Which Task? | `task list` | Existing bounded catalog, filters, attention and cursor |
17
+ | What is current? | `task context <task>` | Current Task/Brief/Role/Project/workspace facts, active work and Runs, open inputs, active decisions, unresolved jobs, recent Message references; no event or terminal-Run dump |
18
+ | What records exist? | `task context list <task> --store <family>` | One authorized family, summaries and exact digest-bearing references |
19
+ | What does it actually say? | `task context inspect <task> --store <family> --ref <id> --digest <digest>` | Exact current record, including original result expansion; long documents are paged |
20
+ | What changed? | `task context delta <task> --after <cursor>` | Immutable events with a fixed upper bound, not a snapshot of current mutable state |
21
+ | Which Global input? | `session context <role>` | Identity, profile, authority, current native Turn/retry and separate bounded pending/recent Message pages |
22
+ | Read Global input | `role message list <role> [--pending]`, `role message show <role> <id>` | Scoped discovery, then exact original; queue acceptance never erases history |
23
+ | What arrived in this wake? | `task wake show <task> <wake>` | Fixed window and Message/Run/Event read pointers, not duplicated bodies |
24
+ | What was assigned? | `task run context <task>/<run>` | Frozen authority and a single `pointers` inventory with summaries; changed identities in `deltaRefs`; current observations remain separate |
25
+ | Which configuration is real? | `task role session inspect <task> <role>` | Task/Role identity, desired binding, frozen Session, current Provider binding, retry and explicit Host observation; no full Task/Role copies or Provider conversation history |
26
+
27
+ Domain lists for Task Messages, events, WorkItems, Runs, decisions, milestones,
28
+ publications and InputRequests use the same summary/reference paging contract.
29
+ Task Role-status and wake-history lists also page, with explicit detail commands.
30
+ Role discovery reports `recordedHealth` and `hostObservation: "not-requested"`,
31
+ not live Host health. Even a normal recorded status cannot rule out a failed Host
32
+ or unacknowledged terminal; follow the row's `task role status` read to inspect it.
33
+ Context lists additionally expose candidates, reviews, jobs, Project Knowledge,
34
+ workspaces and other authorized record families. `--status`, `--after` and
35
+ `--work-item` narrow Context discovery; every continuation must retain filters.
36
+ Run listing accepts a Task or `task/work` target.
37
+
38
+ Current Context's `attention.messages` counts all authorized Messages, not only
39
+ undelivered input. `collections` counts and `omitted` explicitly describe
40
+ incomplete discovery. Recent samples are not proof that no older pending or
41
+ relevant input exists. Read the relevant fixed wake and original Messages;
42
+ use family discovery when a broader requirement/history audit is needed.
43
+
44
+ ## Budgets and continuations
45
+
46
+ - Discovery pages default to 20 items, accept 1–100, and reserve a 32 KiB
47
+ compact-JSON budget. Items contain summaries, never full Message/report bodies.
48
+ - Current Task Context has at most 64 records, with a 24 KiB record/attention
49
+ budget inside a 32 KiB response budget. Single inline values are at most
50
+ 2 KiB; large values and Message/Run/WorkItem/Knowledge bodies use references.
51
+ Each collection contributes at most eight sampled records at entry.
52
+ - Global entry samples up to eight pending and eight recent Messages separately.
53
+ They have independent continuations, so a long historical list cannot crowd
54
+ pending input out of the entry view.
55
+ - Detail documents up to 16 KiB remain ordinary JSON. Larger documents return
56
+ `contentPage`: exact source, SHA-256 digest, JSON-character offset, total bytes
57
+ and characters, text, completeness and a next cursor. Chunks contain at most
58
+ 4096 UTF-16 code units without splitting surrogate pairs, keeping escaped
59
+ wire output below 32 KiB. There is no 4 MiB cutoff that makes a legal original
60
+ permanently unreadable.
61
+ - Task metadata/next-action/remote-delivery, Brief, WorkItem, Message, Run,
62
+ decision/milestone/event, Role show/status/Session inspection, wake detail,
63
+ InputRequest, Run context and frozen expansion use bounded detail reads.
64
+
65
+ Use `--json` and read the top-level `data`. Run context and expansion use
66
+ `data.context`; Run Context delta uses `data.contextDelta`. For a long detail, repeat that same read with
67
+ `--cursor <contentPage.nextCursor>`. Concatenate `text` in offset order, checking
68
+ the same source and digest, and parse the combined JSON once. Do not parse
69
+ chunks individually or treat a first chunk as the complete report.
70
+
71
+ List responses carry `items`, `total`, `complete`, and `nextCursor`. Counts,
72
+ items and cursor validation occur inside the same authorized scope. Cursors
73
+ are opaque positions, not access tokens: every page reauthorizes. A changed
74
+ collection or document returns an explicit source-changed error; restart rather
75
+ than mix versions. No persisted pagination session is needed. Mutable collection
76
+ continuations intentionally do not promise uninterrupted traversal during
77
+ concurrent writes. For append-only event traversal use fixed-bound Context delta.
78
+ Discovery currently scans the selected authorized family to fingerprint it;
79
+ its output, not total storage-reading cost, is bounded.
80
+
81
+ ## Effects and exceptions
82
+
83
+ Message send/queue/steer receipts preserve identity, digest, body byte count and
84
+ the original submission/delivery/control states without echoing the body.
85
+ Brief updates return a saved reference. No new wait, retry, acknowledgement or
86
+ approval phase is added. Repeating a read cursor must never repeat a mutation.
87
+
88
+ Whole-transaction operations (activation, completion, integration and input
89
+ control) remain atomic business operations even when their mechanics have
90
+ several steps. Their state-specific receipts and existing unknown-effect
91
+ diagnostics are retained; they are not flattened into a generic “executed” flag.
92
+
93
+ This change covers daily Agent context, collaboration discovery and original
94
+ evidence reads, not every diagnostic or export in the product. Existing
95
+ specialized log-tail/artifact limits, Task catalog pagination and bounded error
96
+ diagnostics retain their contracts. Configuration catalogs, Project/config
97
+ administration, resource inventories, archive diagnostics, release operations,
98
+ and specialized integration/changeset reads remain purpose-specific; this
99
+ document does not claim a universal 32 KiB cap for them. Full-detail Web
100
+ projections are separate consumers, not silently replaced with CLI summaries.
101
+ Use targeted Context discovery for large Project Knowledge and Task evidence.
102
+
103
+ For a typical notification, read current Context once, read the fixed wake once,
104
+ then read each relevant original once (or its complete document pages).
105
+ Do not reread an aggregate to obtain a detail it intentionally omits.
106
+ Full-original reading costs additional calls only when the original exceeds
107
+ the inline budget; it is never replaced by a summary.
@@ -0,0 +1,81 @@
1
+ # CLI 信息契约
2
+
3
+ Yui 将命令的效果、发现和完整证据读取分开。查询不会消费 Message,也不启动后续工作。
4
+ 变更回执说明 saved/requested/accepted/unknown 等真实事实;`ok: true` 只说明这次
5
+ CLI 调用成功,不代表 Task、原生 Turn 或远端投递完成。
6
+
7
+ 这是当前通信契约,不是兼容模式。已保存的 Task、Message、结果、Snapshot 和 Session
8
+ 历史保持不变;没有持久 schema 迁移,也没有新增快照或缓存存储。
9
+
10
+ ## 日常读取路径
11
+
12
+ | 问题 | 入口 | 默认信息与下一步 |
13
+ | --- | --- | --- |
14
+ | 找哪个 Task? | `task list` | 既有有界目录、过滤器、attention 与游标 |
15
+ | 当前有什么? | `task context <task>` | 当前 Task/Brief/Role/Project/工作区事实、活跃工作与 Run、开放输入、有效决策、未解决 Job、近期 Message 引用;不倾倒事件或终态 Run |
16
+ | 有哪些记录? | `task context list <task> --store <family>` | 一种获授权的记录、摘要与带 digest 的确切引用 |
17
+ | 原文是什么? | `task context inspect <task> --store <family> --ref <id> --digest <digest>` | 确切当前记录,含原始结果展开;长文档分页 |
18
+ | 发生了什么变化? | `task context delta <task> --after <cursor>` | 固定上界内的不可变事件,不是可变当前状态的快照 |
19
+ | Global 收到了什么? | `session context <role>` | 身份、Profile、权限、当前原生 Turn/retry,以及分别有界的 pending/recent Message 页 |
20
+ | 读取 Global 输入 | `role message list <role> [--pending]`、`role message show <role> <id>` | 在自身范围内发现,再读完整原文;队列接受不删除历史 |
21
+ | 本次唤醒带来什么? | `task wake show <task> <wake>` | 固定窗口与 Message/Run/Event 读取指针,不重复正文 |
22
+ | 分配了什么? | `task run context <task>/<run>` | 冻结授权与一份带摘要的 `pointers` 目录;`deltaRefs` 表示变化身份;当前观察独立 |
23
+ | 实际配置是什么? | `task role session inspect <task> <role>` | Task/Role 身份、期望绑定、冻结 Session、当前 Provider 绑定、retry 与显式 Host 观察;不复制整个 Task/Role 或 Provider 会话历史 |
24
+
25
+ Task Message、事件、WorkItem、Run、决策、里程碑、publication 和 InputRequest 列表
26
+ 共用摘要/引用分页。Role 状态与 wake 历史列表也分页,并给出详情命令。
27
+ Role 发现返回 `recordedHealth` 与 `hostObservation: "not-requested"`,不是实时 Host
28
+ 健康度。记录状态正常也不能排除 Host 失败或终态未确认;需沿条目的 `task role status`
29
+ 读取指针检查。
30
+ Context 列表还暴露候选、Review、Job、Project Knowledge、工作区等获授权的记录。
31
+ `--status`、`--after`、`--work-item` 缩小发现范围;续读必须保留过滤条件。
32
+ Run 列表接受 Task 或 `task/work` 目标。
33
+
34
+ 当前 Context 的 `attention.messages` 统计全部获授权 Message,不仅是未投递输入。
35
+ `collections` 计数与 `omitted` 明确表达发现不完整。近期抽样不能证明没有更早的待处理
36
+ 或相关输入。读取相关固定 wake 与原始 Message;更广的需求/历史审计使用分类发现。
37
+
38
+ ## 预算与续读
39
+
40
+ - 发现页默认 20 条,可选 1–100,紧凑 JSON 预算 32 KiB。条目包含摘要,不含完整报告正文。
41
+ - 当前 Task Context 至多 64 条,记录与 attention 共 24 KiB,响应预算 32 KiB。
42
+ 单个内联值至多 2 KiB;大值及 Message/Run/WorkItem/Knowledge 正文用引用。
43
+ 入口每个集合最多抽样八条。
44
+ - Global 入口分别抽样八条 pending 与八条 recent;独立续读,历史不能挤掉待处理输入。
45
+ - 不超过 16 KiB 的详情保持普通 JSON。更大详情返回 `contentPage`:确切来源、
46
+ SHA-256 digest、JSON 字符偏移、总字节数/字符数、文本、完整性与下一游标。
47
+ 每块最多 4096 个 UTF-16 单元,不拆代理对,转义后的输出低于 32 KiB。
48
+ 不再因 4 MiB 上限而永久无法读取合法原文。
49
+ - Task 元信息/next-action/remote-delivery、Brief、WorkItem、Message、Run、
50
+ 决策/里程碑/事件、Role show/status/Session 检查、wake 详情、InputRequest、
51
+ Run Context 与冻结展开使用有界详情读取。
52
+
53
+ 使用 `--json` 读取顶层 `data`;Run Context 和展开使用 `data.context`,Run Context delta 使用 `data.contextDelta`。
54
+ 长详情用同一读取命令加 `--cursor <contentPage.nextCursor>` 继续。按 offset 顺序拼接
55
+ `text`,校验相同 source 与 digest,最后一次性解析 JSON。不要分别解析块,也不要把
56
+ 第一块当成完整报告。
57
+
58
+ 列表包含 `items`、`total`、`complete`、`nextCursor`。计数、条目和游标校验处于同一
59
+ 授权范围。游标是不透明位置,不是通行令牌:每页重新授权。集合或文档改变时明确报错,
60
+ 重新读取,不混合版本;无需持久分页 Session。可变集合不保证并发写入期间无中断遍历。
61
+ 追加事件遍历使用固定上界 Context delta。目前分类发现扫描选定的授权集合来计算指纹;
62
+ 有界的是输出,不是总存储读取成本。
63
+
64
+ ## 效果与例外
65
+
66
+ Message send/queue/steer 回执保留身份、digest、正文字节数及原有提交/投递/control
67
+ 状态,不回显正文。Brief 更新返回 saved 引用。没有新增等待、重试、确认或审批阶段。
68
+ 重复读游标绝不能重放变更。
69
+
70
+ 激活、完成、集成和输入控制仍是完整事务业务操作,即使内部有多步工程机制。
71
+ 其特定状态回执与已有未知效果诊断保留,不压平成通用“已执行”标志。
72
+
73
+ 本次覆盖日常 Agent Context、协作发现和原始证据读取,并非产品全部诊断或导出。
74
+ 既有日志尾部/artifact 限制、Task 目录分页、有界错误诊断保留各自契约。
75
+ 配置目录、Project/config 管理、资源清单、归档诊断、发布操作和专用集成/change-set
76
+ 读取仍有自己的用途契约;不宣称它们全部受 32 KiB 限制。Web 全详情投影是独立消费者,
77
+ 不会被 CLI 摘要悄悄替代。大 Project Knowledge 与 Task 证据用定向 Context 发现。
78
+
79
+ 典型通知读取一次当前 Context、一次固定 wake,再逐条读取相关原文(或其全部文档页)。
80
+ 不要为了入口故意省略的详情重复读聚合。只有原文超过内联预算才增加原文分页调用;
81
+ 摘要不能代替完整原文。
@@ -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
@@ -101,6 +101,8 @@ do not add prose-matching tests or claim model validation from static checks.
101
101
  `ci.yml` runs core plus one assembled-package normal-path smoke per supported
102
102
  platform (Linux x64, Mac Intel and Apple Silicon) on every PR, without another
103
103
  lint or broad regression suite.
104
+ Linux runs on Node 24 and 26; release fresh-install smoke covers Node 20, 22,
105
+ 24 and 26 on all three platforms.
104
106
  `node scripts/smoke-runtime-package.mjs --assembled .release-stage` exercises
105
107
  the actual CLI/Controller/Host/SQLite and isolated tmux, replacing only the
106
108
  external Provider with a deterministic fixture. It covers setup, durable input
@@ -118,6 +120,14 @@ freshly installed package through
118
120
  artifact and provenance boundaries. This validates runtime integration, not
119
121
  real-model behavior. Pure contract and safety tests remain in `test/core`;
120
122
  production wiring is exercised here rather than only through mocked ports.
123
+ The native dependency check launches a fixed local program through PTY and
124
+ requires its output and normal exit. Installed-package smoke explicitly checks
125
+ default Doctor's PTY results using dependencies resolved from the consumer.
126
+ On macOS it also tests a disposable copy with a non-executable spawn-helper:
127
+ Doctor must report the selected helper path and permissions without repairing it.
128
+ Doctor's isolated PTY probe waits up to 750 ms for output/exit, with a 1.5-second
129
+ outer native-process limit, and reports elapsed time. Existing Agent/Controller
130
+ diagnostics have their own costs; this is not a one-second whole-Doctor guarantee.
121
131
  The package smoke also checks unconditional status identity and update-owned
122
132
  resource/identity capture through the assembled package. Real lifecycle children
123
133
  stop the exact Controller and restore its captured launch identity while their
@@ -74,6 +74,8 @@ package-start 检查跟随已安装树中的本地 Skill 引用,包括跨 Role
74
74
 
75
75
  `ci.yml` 在每个 PR 上构建一次,运行 core 及一个组装包正常链路检查,不重复 lint,
76
76
  也不增加宽泛回归套件。
77
+ Linux CI 在 Node 24 和 26 上运行;发布时的全新安装 smoke 覆盖三个平台上的
78
+ Node 20、22、24 和 26。
77
79
  `node scripts/smoke-runtime-package.mjs --assembled .release-stage` 经过真实
78
80
  CLI/Controller/Host/SQLite 与隔离 tmux,仅用确定性夹具替换外部 Provider。它验证
79
81
  setup、输入跨重启持久化及幂等、scratch 激活、原生结果入库、完成后保留会话、
@@ -85,6 +87,12 @@ setup、输入跨重启持久化及幂等、scratch 激活、原生结果入库
85
87
  npm bin、依赖、受支持 Node 版本、产物和 provenance 边界。这证明运行时集成,不证明
86
88
  真实模型行为。纯契约与安全检查保留在 `test/core`,生产组件组装在这里验证,
87
89
  不只依赖模拟端口。
90
+ 原生依赖检查必须通过 PTY 启动固定本地程序,确认输出和正常退出。安装包 smoke
91
+ 明确断言默认 Doctor 的 PTY 检查成功,并从消费者安装目录解析依赖。macOS 还会
92
+ 在可丢弃的依赖副本中移除 spawn-helper 执行权限,验证 Doctor 报出实际 helper
93
+ 路径和权限原因且不自动修复。Doctor 的隔离 PTY 探针等待输出/退出最多 750 ms,
94
+ 外层原生进程限制为 1.5 秒,并报告耗时;原有 Agent/Controller 检查另有成本,
95
+ 这不是整个 Doctor 一秒内返回的保证。
88
96
  组装包检查还验证固定身份输出,以及升级侧通过组装包采集资源和精确 Controller 身份,
89
97
  并在父进程持有交接锁时,通过真实生命周期子进程停止精确 Controller、恢复其已捕获的
90
98
  启动身份。无关调用仍被锁阻止,锁保持由父进程持有,持久输入不变;
@@ -41,7 +41,7 @@ npm 包包含 Linux x64、Mac Intel 和 Apple Silicon 的 Yui 预编译程序。
41
41
  同一份包在三个平台验证后发布,运行时只选择对应平台的程序。
42
42
 
43
43
  需要 Linux x64 / glibc 或 macOS(x64 或 Apple Silicon)、Git、tmux,以及
44
- Node.js `^20.17.0`、`^22.9.0` 或 `^24.0.0`。macOS 上可用
44
+ Node.js `^20.17.0`、`^22.9.0`、`^24.0.0` 或 `^26.0.0`。macOS 上可用
45
45
  `brew install tmux` 安装 tmux。最简单的方式是先安装 Codex CLI 或 Claude
46
46
  Code CLI,并确保它已经可以使用你自己的账号正常工作。Yui 负责协调 Agent,
47
47
  不提供模型访问额度。
@@ -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.0",
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,
@@ -19,7 +19,7 @@
19
19
  "LICENSE"
20
20
  ],
21
21
  "engines": {
22
- "node": "^20.17.0 || ^22.9.0 || ^24.0.0"
22
+ "node": "^20.17.0 || ^22.9.0 || ^24.0.0 || ^26.0.0"
23
23
  },
24
24
  "os": [
25
25
  "linux",
@@ -49,7 +49,7 @@
49
49
  "@xterm/addon-fit": "^0.11.0",
50
50
  "@xterm/xterm": "^6.0.0",
51
51
  "better-sqlite3": "^12.11.1",
52
- "node-pty": "^1.1.0",
52
+ "node-pty": "1.2.0-beta.15",
53
53
  "smol-toml": "1.8.0",
54
54
  "ws": "^8.21.1"
55
55
  }
@@ -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.