@zq-silk/yui 0.16.0 → 0.16.2

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 (114) hide show
  1. package/ARCHITECTURE.md +12 -0
  2. package/ARCHITECTURE.zh-CN.md +8 -0
  3. package/README.md +3 -0
  4. package/dist/agent/managedRuntimeEnvironment.js +0 -4
  5. package/dist/agentRun/agentRun.js +7 -17
  6. package/dist/cli/agentConfigurationPicker.js +24 -21
  7. package/dist/cli/commandCatalog.js +18 -10
  8. package/dist/cli/roleWizard.js +41 -30
  9. package/dist/cli/updateCommand.js +35 -13
  10. package/dist/cli/updateOrchestrator.js +73 -33
  11. package/dist/cli/updatePorts.js +51 -20
  12. package/dist/cli.js +35 -26
  13. package/dist/commands/controllerCommands.js +1 -1
  14. package/dist/commands/executionAuditCommands.js +2 -2
  15. package/dist/commands/projectCommands.js +1 -1
  16. package/dist/commands/releaseCommands.js +9 -38
  17. package/dist/commands/taskCommands.js +84 -81
  18. package/dist/commands/taskCompletionGate.js +0 -117
  19. package/dist/commands/taskRoleRuntimeStatus.js +1 -1
  20. package/dist/commands/taskUpstreamCommands.js +93 -54
  21. package/dist/context/runContextPack.js +30 -54
  22. package/dist/context/runInputContract.js +9 -0
  23. package/dist/context/sessionBootstrapManifest.js +11 -19
  24. package/dist/controller/agentHostObservation.js +4 -2
  25. package/dist/controller/controller.js +8 -6
  26. package/dist/controller/fileSchedulerStoreAdapter.js +85 -18
  27. package/dist/controller/globalInputDelivery.js +28 -7
  28. package/dist/controller/globalRuntimeAttention.js +34 -0
  29. package/dist/controller/operatorNotification.js +31 -0
  30. package/dist/controller/providerRetryAdmission.js +3 -1
  31. package/dist/controller/providerRetryDelivery.js +10 -3
  32. package/dist/controller/runtime.js +1 -27
  33. package/dist/controller/sessionOwnerReconciliation.js +42 -24
  34. package/dist/controller/structuredProviderObservation.js +27 -0
  35. package/dist/controller/updateReconciliation.js +72 -20
  36. package/dist/doctor/doctor.js +2 -1
  37. package/dist/executor/agentAdapter.js +28 -96
  38. package/dist/executor/agentConfigurationCatalog.js +13 -68
  39. package/dist/executor/agentConfigurationFields.js +120 -0
  40. package/dist/executor/agentConfigurationProbe.js +55 -80
  41. package/dist/executor/agentExecutor.js +5 -2
  42. package/dist/executor/executorRegistry.js +0 -9
  43. package/dist/executor/fileRoleLaunchPlanner.js +12 -11
  44. package/dist/interaction/operatorPresentation.js +2 -1
  45. package/dist/message/messageContinuation.js +8 -9
  46. package/dist/observability/executionAudit.js +1 -10
  47. package/dist/observability/runtimeIdentity.js +0 -23
  48. package/dist/output/agentConfigurationPresentation.js +4 -2
  49. package/dist/release/releaseHandover.js +2 -2
  50. package/dist/release/releaseIdempotencyStore.js +0 -23
  51. package/dist/release/releaseWorkflowPorts.js +8 -4
  52. package/dist/repository/gitWorkspace.js +66 -19
  53. package/dist/repository/taskWorkspacePreparer.js +75 -68
  54. package/dist/resources/resourceRegistry.js +90 -44
  55. package/dist/resources/sqliteResourceRegistry.js +3 -5
  56. package/dist/runtime/acpSession.js +21 -5
  57. package/dist/runtime/agentEndpoint.js +4 -1
  58. package/dist/runtime/agentHost.js +22 -62
  59. package/dist/runtime/agentHostCleanup.js +85 -0
  60. package/dist/runtime/agentHostProtocol.js +1 -1
  61. package/dist/runtime/builtinAgentDrivers.js +46 -119
  62. package/dist/runtime/builtinTranscriptObserver.js +10 -6
  63. package/dist/runtime/codexAppServerRuntime.js +55 -89
  64. package/dist/runtime/jsonLineChannel.js +35 -7
  65. package/dist/runtime/providerContinuationReconciliationService.js +42 -3
  66. package/dist/runtime/providerRetry.js +15 -0
  67. package/dist/runtime/providerRuntimeReconciler.js +12 -2
  68. package/dist/runtime/structuredProviderHost.js +106 -81
  69. package/dist/scheduler/activeRoleRunDelivery.js +5 -1
  70. package/dist/scheduler/operatorInputNotificationProcessor.js +7 -17
  71. package/dist/storage/upgrade/upgradeOrchestrator.js +0 -10
  72. package/dist/task/nextAction.js +33 -23
  73. package/dist/task/task.js +2 -1
  74. package/dist/web/assets/assetManifest.js +2 -0
  75. package/dist/web/assets/client/app.js +72 -3
  76. package/dist/web/assets/client/components.js +2 -1
  77. package/dist/web/assets/client/i18n.js +2 -0
  78. package/dist/web/assets/client/taskSummary.js +345 -0
  79. package/dist/web/assets/client/taskSurface.js +44 -26
  80. package/dist/web/assets/client/view.js +33 -0
  81. package/dist/web/assets/shell.js +1 -0
  82. package/dist/web/assets/styles/cards.js +21 -0
  83. package/dist/web/webServer.js +39 -5
  84. package/dist/web/webSessions.js +165 -0
  85. package/dist/web/webSnapshot.js +23 -0
  86. package/dist/web/webTaskSurface.js +23 -0
  87. package/docs/managed-turn-and-session-runtime.md +31 -0
  88. package/docs/managed-turn-and-session-runtime.zh-CN.md +23 -0
  89. package/docs/observability/README.md +47 -0
  90. package/docs/observability/README.zh-CN.md +37 -0
  91. package/docs/project-refresh.md +9 -0
  92. package/docs/project-refresh.zh-CN.md +8 -0
  93. package/docs/provider-retry.md +35 -0
  94. package/docs/release-workflow.md +139 -20
  95. package/docs/release-workflow.zh-CN.md +115 -14
  96. package/docs/roles-and-configuration.md +30 -0
  97. package/docs/roles-and-configuration.zh-CN.md +20 -0
  98. package/docs/task-delivery.md +109 -0
  99. package/docs/task-delivery.zh-CN.md +80 -0
  100. package/docs/task-discovery.md +9 -0
  101. package/docs/task-discovery.zh-CN.md +6 -0
  102. package/docs/testing/verification-levels.md +33 -12
  103. package/docs/testing/verification-levels.zh-CN.md +28 -8
  104. package/i18n/README.zh-CN.md +2 -0
  105. package/package.json +1 -1
  106. package/skills/yui-leader/SKILL.md +11 -0
  107. package/skills/yui-leader/references/execution.md +22 -0
  108. package/skills/yui-leader/references/planning.md +6 -2
  109. package/skills/yui-operator/SKILL.md +45 -13
  110. package/skills/yui-operator/references/task-delivery.md +99 -0
  111. package/skills/yui-runtime/SKILL.md +5 -3
  112. package/skills/yui-runtime/references/publication.md +56 -5
  113. package/skills/yui-runtime/references/recovery.md +12 -2
  114. package/dist/runtime/agentHostCompatibility.js +0 -127
@@ -2,6 +2,15 @@
2
2
 
3
3
  # Session, AgentRun and notifications
4
4
 
5
+ Global Session stop/replacement uses the same exact native-execution quiescence
6
+ boundary as Task Sessions. A departed Host or archived Session alone is not
7
+ proof that an accepted input ended: its retained Provider binding is inspected
8
+ and stopped before settling occupancy. Global stop evidence is retained as a
9
+ record-only system Message, without submitting another native input. Pending
10
+ notifications cannot restart an explicitly stopped Session; normal Host detach
11
+ preserves an active Session and remains reconnectable. A switch after a partial
12
+ failure still settles the retained input before selecting a new conversation.
13
+
5
14
  ## Authority
6
15
 
7
16
  Task, WorkItem, Message, Decision, Artifact and Project Knowledge preserve
@@ -28,6 +37,7 @@ yui task context <task> --json
28
37
  yui task context delta <task> --after <coreCursor>
29
38
  yui task context inspect <task> --store <store> --ref <id>
30
39
  yui task run context <task/run> --json
40
+ yui task run context expand <task/run> <ref-id> --store <store> --mode full --json
31
41
  ```
32
42
 
33
43
  Task Context is a bounded authorized working set with a current core cursor.
@@ -43,6 +53,22 @@ Run Pack is a reference directory: read the relevant requirement and message
43
53
  bodies before acting, rather than treating a successful load as the deliverable.
44
54
  Planning Packs expose no Project write scope or Task-completion permission.
45
55
 
56
+ Every new Run, including planning, Review and continuation, binds an explicit
57
+ frozen Snapshot before dispatch. Context reads validate its full identity and
58
+ content digest, then read its stored values without rebuilding current Task
59
+ records. Synthesis reads the selected Producer results from that Snapshot.
60
+ Writable Projects come from the Run's captured effective authority; live
61
+ activity is a separate observation, not part of the frozen contract.
62
+ Expansion always requires both `store` and `refId`, even for a unique id.
63
+
64
+ Historical Run records without a Snapshot remain readable through `run show`
65
+ for audit, but cannot supply execution Context, be submitted or retried.
66
+ Missing/drifted Snapshot evidence fails explicitly; it is never synthesized
67
+ from today's Task. Subsequent observed/steered input records may legitimately
68
+ omit their own Snapshot because they do not establish a new Assignment.
69
+ No stored layout or payload changes: storage remains 37 with the complete
70
+ 1→37 migration chain unchanged.
71
+
46
72
  Current Task reads also expose untargeted user/Operator messages to the Task's
47
73
  current Worker and Reviewer Sessions, including requirements added after their
48
74
  Run snapshot was frozen. Use `task message list/show` or Task Context inspect
@@ -294,6 +320,11 @@ yui task execution start <task>
294
320
  yui task execution stop <task> --force --reason <reason>
295
321
  ```
296
322
 
323
+ `task run retire` accepts only `--expected-progress-at` for its progress fence;
324
+ the former `--progress-at` alias is removed. Retiring an active Run still requires
325
+ its exact progress, Agent/Adapter and, when bound, native Session identity;
326
+ the renamed entry does not relax quiescence or retirement authority.
327
+
297
328
  Task execution start/stop controls Task admission, not Task acceptance.
298
329
  Stop first fences new Yui work, then interrupts each exact owned native input
299
330
  and confirms its terminal before removing the attachment. This also covers
@@ -2,6 +2,12 @@
2
2
 
3
3
  # Session、AgentRun 与通知
4
4
 
5
+ Global Session 停止/替换与 Task Session 共用精确的原生执行静止确认边界。
6
+ Host 消失或 Session 已入历史不代表已接受输入结束:须先检查并停止保留的
7
+ Provider binding,再结算执行占用。Global 停止证据保存为仅记录的 system Message,
8
+ 不触发新的原生输入。待投递通知不能重启已明确停止的 Session;普通 Host 脱离仍
9
+ 保留 active Session,可正常重连。部分切换失败后,仍须先结算旧输入再选择新会话。
10
+
5
11
  ## 权威
6
12
 
7
13
  Task、WorkItem、Message、Decision、Artifact 和 Project Knowledge 保存持久工作。
@@ -25,6 +31,7 @@ yui task context <task> --json
25
31
  yui task context delta <task> --after <coreCursor>
26
32
  yui task context inspect <task> --store <store> --ref <id>
27
33
  yui task run context <task/run> --json
34
+ yui task run context expand <task/run> <ref-id> --store <store> --mode full --json
28
35
  ```
29
36
 
30
37
  Task Context 是一个有界的、获授权的工作集,带有当前 core 游标。delta 在一个固定
@@ -37,6 +44,18 @@ Run Context 冻结 Assignment、来源引用、生效配置和工作区边界。
37
44
  和消息正文,而不是把加载成功当成交付物。规划 Pack 不暴露 Project 写范围或 Task 完成
38
45
  权限。
39
46
 
47
+ 新 Run(包括规划、Review 和消息续接)必须在派发前绑定明确冻结的 Snapshot。
48
+ Context 读取校验完整身份与内容 digest,然后直接读取已保存的值,不重新收集当前
49
+ Task 记录。聚合执行从该 Snapshot 读取已选择的 Producer 结果;可写 Project 来自
50
+ Run 捕获的生效授权。当前活动状态仍是独立观察,不属于冻结合同。
51
+ 展开引用必须同时指定 `store` 与 `refId`,即使 id 唯一也不能省略 store。
52
+
53
+ 缺少 Snapshot 的历史 Run 仍可通过 `run show` 审计,但不能提供执行 Context、
54
+ 提交给 Provider 或用于重试。Snapshot 缺失或漂移时明确失败,不用今天的 Task
55
+ 事实补造历史。后续观察到的原生输入或 steer 记录可以没有独立 Snapshot,因为
56
+ 它们不建立新的 Assignment。本次不改变存储布局或记录载荷:storage 仍为 37,
57
+ 完整的 1→37 迁移链保持不变。
58
+
40
59
  当前 Task 读取也会把无定向目标的 user/Operator 消息暴露给该 Task 当前的 Worker 和
41
60
  Reviewer Session,包括在它们 Run 快照冻结之后新增的需求。用 `task message list/show`
42
61
  或 Task Context inspect 来读取那些原始记录。这不改写冻结的 Assignment,也不授予投递
@@ -239,6 +258,10 @@ yui task execution start <task>
239
258
  yui task execution stop <task> --force --reason <reason>
240
259
  ```
241
260
 
261
+ `task run retire` 的进度围栏只接受 `--expected-progress-at`,移除旧的
262
+ `--progress-at` 别名。退役活动 Run 仍要求精确进度、Agent/Adapter 及已绑定的
263
+ 原生 Session 身份,不放宽静止性检查或退役权限。
264
+
242
265
  Task execution start/stop 控制 Task 准入,而不是 Task 验收。stop 先围住新的 Yui 工作,
243
266
  然后中断每一条被拥有的确切原生输入,并在移除 attachment 之前确认其终态。这也覆盖没有
244
267
  Run 的普通 Leader 通知。未知的原生状态阻塞清理;仅停止一个代理绝不证明一个共享 Turn
@@ -56,6 +56,53 @@ Claude execution process dying closes its exact input and marks its Session
56
56
  failed, even while the supervising Host remains alive. A deliberately stopped
57
57
  Session with settled native input is idle rather than a false runtime failure.
58
58
 
59
+ ## Web attention and progress
60
+
61
+ Task detail prioritizes **needs your input**, **Session activity**, **Task progress**
62
+ and **key conclusions**. InputRequests retain their original answer controls and
63
+ bounded Context counts; a partial read is not an empty inbox. Technical attention
64
+ names the owner from the existing execution projection. An assigned owner does
65
+ not imply work started, and a diagnostic hint is not new user authorization.
66
+
67
+ Session observations include direct chat and notifications without an AgentRun.
68
+ The selected native identity is counted once; foreground activity must match its
69
+ exact current input. Earlier Turns and replaced Sessions cannot supply its
70
+ activity. Waiting, quiet, diagnostic-needed, unknown, stopped, ended and unsettled
71
+ background work remain distinct. An operation without a terminal is not an
72
+ everlasting heartbeat. Quiet/diagnostic windows come from the existing runtime
73
+ policy; the read time is not a new activity timestamp. This is a recorded selected
74
+ Session view, not a live process probe or an inventory of historical resources.
75
+ Controller-owned bounded Provider retry waits remain waiting, not stopped or
76
+ waiting for user approval. A successor's activity uses its own exact input.
77
+
78
+ Progress comes from the original Brief and completion record, with source time;
79
+ activity and tokens do not create a percentage, ETA or semantic checkpoint.
80
+ Current Decisions show their rationale/source; superseded ones remain in history.
81
+ Reports and recommendations are not relabelled as user approval. Core Context
82
+ remains readable when its independent observation fails.
83
+
84
+ **Results and evidence** reads files only on request. A selected commit-pinned
85
+ text survives refresh and newer file listings; switching versions is explicit.
86
+ A missing revision fails visibly, never substitutes HEAD. HTML/scripts stay
87
+ text, never an executing preview. Copying a source sends nothing; discussion
88
+ uses the original Message form, explicit intent and receipt. Unsent inputs remain
89
+ protected across automatic refresh.
90
+
91
+ Delivery reuses Publication coverage, including adoption, and keeps
92
+ reported/verified, missing/stale/head-unavailable distinct. On-demand evidence
93
+ shows original Integration checks, fixed Review candidates and original Reviewer
94
+ reports. Review completion is not semantic approval; skipped/missing checks are
95
+ not passes. Workspace ownership does not prove cleanup safety: the existing
96
+ read-only `task archive-preflight` is referenced, not automatically run. There
97
+ are no new accept, publish or archive buttons. Usage retains known/partial/unknown.
98
+
99
+ All routes use the local Web token and Task boundary.
100
+ `GET /api/tasks/<id>/artifacts` lists a fixed repository revision;
101
+ `?path=<relative-path>&commit=<full-commit>` reads its exact text file.
102
+ `GET /api/tasks/<id>/evidence` reads original check/Review/workspace records.
103
+ These reads do not start a runtime, fetch a remote, write business state, require
104
+ a migration, or introduce a new persistent protocol.
105
+
59
106
  ## Execution audit
60
107
 
61
108
  `execution audit` aggregates existing Task, Run, wake, Session, Review,
@@ -49,6 +49,43 @@ AgentRun,Role 状态也包含其原生准入/活动;当某个 WorkItem 处
49
49
  监督它的 Host 仍存活。一个已被有意停止、且原生输入已结算的 Session 是空闲状态,
50
50
  而不是虚假的运行时失败。
51
51
 
52
+ ## Web 用户关注与进展
53
+
54
+ Task 详情优先展示「需要你处理」「会话活动」「任务进展」「关键结论」。
55
+ InputRequest 保留原回答入口和有界 Context 计数;部分读取不等于空待办。
56
+ 技术关注从既有执行投影取得负责人;有负责人不代表已开始处理,诊断提示
57
+ 也不自动成为新的用户授权。
58
+
59
+ 会话观察包含没有 AgentRun 的直聊与通知。选用的原生身份只计一次,前台活动
60
+ 必须匹配当前精确输入;旧 Turn、旧 Session 的活动不能借给新输入。
61
+ 等待、安静、需诊断、未知、停止、该轮结束和后台未结清保持区分;
62
+ 没有终态的操作不是永久心跳。时间窗复用既有 runtime policy,读取时间不冒充
63
+ 活动时间。这是已记录选用会话的视图,不是实时进程探测或历史资源盘点。
64
+ Controller 已负责的有界 Provider 重试显示为等待,不误称停止或等待用户审批;
65
+ 后继输入的活动仍须匹配它自己的精确身份。
66
+
67
+ 进度来自原 Brief 和完成记录,标注来源时间;活动、token 不产生百分比、
68
+ ETA 或实质检查点。当前 Decision 展示理由与来源,已替代决定留在历史;
69
+ 报告与建议不改称用户批准。独立观察失败时,核心 Context 仍可读取。
70
+
71
+ 「成果与证据」仅按需读文件。固定提交的文本阅读在刷新和读取新列表后仍保留,
72
+ 切换版本必须显式选择;固定版本缺失就报错,不回退 HEAD。
73
+ HTML/脚本只作为文本,不执行预览。复制来源不发送内容,讨论仍走原 Message
74
+ 表单、显式意图及回执;自动刷新保留未提交输入。
75
+
76
+ 交付复用 Publication 覆盖及采用记录,区分 reported/verified 和
77
+ missing/stale/head-unavailable。按需证据展示原 Integration 检查、
78
+ 固定 Review 候选及原始 Reviewer 报告;Review completed 不等于语义通过,
79
+ skipped/缺失检查不算通过。工作区所有权不证明可清理;既有只读
80
+ `task archive-preflight` 仅作为操作指引,不自动运行。没有新增验收、发布、
81
+ 归档按钮,用量仍保留 known/partial/unknown。
82
+
83
+ 所有入口沿用本地 Web token 与 Task 边界。
84
+ `GET /api/tasks/<id>/artifacts` 列出固定仓库版本;
85
+ `?path=<relative-path>&commit=<full-commit>` 读取该版本文本;
86
+ `GET /api/tasks/<id>/evidence` 读取原检查/Review/工作区记录。
87
+ 读取不启动运行时、不访问远端、不写业务状态、不引入迁移或新持久协议。
88
+
52
89
  ## 执行审计
53
90
 
54
91
  `execution audit` 汇总既有的 Task、Run、wake、Session、Review、Integration、
@@ -7,6 +7,15 @@ the Project's configured remote and stable branch. Stable and development
7
7
  branches must match. The per-Project maintenance fence covers the operation;
8
8
  Task workspaces and their recorded bases are not refreshed by this command.
9
9
 
10
+ ## Project ownership
11
+
12
+ `yui project clone <name> <remote>` creates a Home-managed checkout by default.
13
+ Add `--external` to clone into `<configured defaultWorkspace>/<name>` and retain
14
+ external ownership. This is a supported public option in help and completion;
15
+ it does not remove the existing confirmation, branch verification or workspace
16
+ isolation boundaries. `project add` can bind an existing external checkout;
17
+ `project migrate` explicitly moves one into Home-managed storage.
18
+
10
19
  ## Two separate facts
11
20
 
12
21
  The checkout HEAD and a local remote-tracking ref are distinct observations.
@@ -6,6 +6,14 @@
6
6
  规范 checkout。stable 与 development branch 必须一致。操作全程持有 per-Project
7
7
  maintenance fence;不会刷新 Task 工作区或改写其记录的基线。
8
8
 
9
+ ## Project 所有权
10
+
11
+ `yui project clone <name> <remote>` 默认创建 Home 管理的 checkout。
12
+ 添加 `--external` 会克隆到 `<已配置的 defaultWorkspace>/<name>`,保留 external
13
+ 所有权。这是帮助和补全中公开支持的选项,不绕过现有确认、分支校验或工作区隔离
14
+ 边界。`project add` 可绑定已有 external checkout;`project migrate` 可明确将其
15
+ 迁入 Home 管理的存储。
16
+
9
17
  ## 两个独立事实
10
18
 
11
19
  checkout HEAD 与本地 remote-tracking ref 是不同的观察。refresh 将精确分支获取到
@@ -48,6 +48,41 @@ panel. `cancel` withdraws this recovery chain; `disable` also disables future
48
48
  chains on the current Provider binding. Neither interrupts an admitted Turn.
49
49
  `enable` does not replay historical failures. Existing Task/Role authority applies.
50
50
 
51
+ ## Failure evidence and Agent handoff
52
+
53
+ The retry projection includes the original input reference (never copied console
54
+ text), exact Session/attempt identities, the preserved error, the latest Turn
55
+ failure and earlier chain references. A changed error that still satisfies the
56
+ same safe retry rule continues within the original budget. Loss of that rule,
57
+ authority or budget stops automatic submission.
58
+
59
+ Task errors retain their original `runtime.agent-error` evidence and notify the
60
+ Leader, or the Operator when the affected Role is the Leader. Global failures
61
+ retain record-only Messages in their own Role inbox, including intermediate
62
+ failed attempts; these are evidence, not new input that cancels recovery.
63
+ When Global recovery stops or its effect is unknown, a deduplicated system
64
+ Message carries the facts to the existing Operator. If the Operator itself
65
+ failed, or no Operator is configured, the notice remains visible for the user
66
+ or successor without submitting a self-recovery prompt.
67
+
68
+ Malformed JSON frames and failing protocol listeners close the affected channel
69
+ with the original cause. Unrelated valid protocol notifications remain ignorable.
70
+ The existing Host Inbox carries the diagnostic to Task/Global consumers without
71
+ inventing a native terminal, clearing a writer fence or replaying input.
72
+
73
+ Endpoint cleanup preserves stop/close errors, the exact implementation and client
74
+ identities, last observed drain facts and pending effects. A failed inspection is
75
+ not an empty resource list. Later owned cleanup steps, including control-socket
76
+ closure, still run; cleanup failures retain their causes and produce a failing
77
+ Host exit rather than silent success. Timeout reports never claim quiescence.
78
+
79
+ The optional detached-child metadata reconciler retains its existing bounded
80
+ query, backoff and circuit pause. Unavailable observations preserve writer
81
+ ownership and expose their original error, exact targets and sampling count.
82
+ The first failure and circuit-limit crossing use existing deduplicated error
83
+ events; metadata sampling does not start model work or declare a parent result.
84
+ No new default metadata collector, retry worker or durable state schema is added.
85
+
51
86
  ## Supported boundary and adoption
52
87
 
53
88
  Current controlled Codex Hosts advertise exact recovery support. The native
@@ -27,6 +27,121 @@ system sits behind `ReleaseWorkflowPorts`
27
27
  external ports exercise recovery without real GitHub, npm, git, Controller,
28
28
  or model effects.
29
29
 
30
+ ## Final historical bridge: 0.16.2
31
+
32
+ | Release | Home storage | Responsibility |
33
+ | --- | --- | --- |
34
+ | **0.16.2** | Historical v37, supported floor v1 | Last complete historical upgrade chain (v1 through v37). |
35
+ | **1.0.0-alpha.1** (planned) | A distinct new 1.0 baseline | Publish an independent, explicit offline converter from verified historical v37. |
36
+ | **1.0.0** (planned) | The same verified 1.x contract as the final prerelease | Remove converter source after durable publication; never reset storage again. |
37
+
38
+ 0.16.2 supersedes the 0.99.0 release designation without reverting its functional
39
+ changes or Git history. Both use the same v37 endpoint. Publish and verify this
40
+ replacement before withdrawing the 0.99.0 registry version, Release and tag.
41
+ Do not automatically downgrade a local installation or change its Home.
42
+ Stable releases explicitly publish to npm `latest`; prereleases publish to
43
+ `next`, so the new baseline is opt-in.
44
+
45
+ 0.16.2 freezes the historical endpoint at **37**. It does not append a no-op
46
+ migration, rewrite released SQL/data migrations, reset record-local schema or
47
+ protocol versions, or reinterpret historical evidence. Fresh and upgraded Homes
48
+ use the same contract. Ordinary opens still reject historical formats; only
49
+ explicit `upgrade` / `update` may migrate them.
50
+
51
+ ### Select the bridge explicitly
52
+
53
+ In 0.16.2, `yui update --version 0.16.2` selects an exact published
54
+ package; no argument still selects `latest`. Tags and ranges are not accepted
55
+ as explicit selectors. The actual staged version must equal the requested
56
+ version before preflight or Controller handover. A mismatch cleans only the
57
+ owned staging prefix, leaving the installed binary and database unchanged.
58
+
59
+ Older CLIs do not acquire this option until updated. Once 0.16.2 is published,
60
+ use a separately staged, exact 0.16.2 CLI to drive the update against an explicit
61
+ `YUI_HOME`. For example, npm can stage it without replacing the global install:
62
+
63
+ ```sh
64
+ YUI_HOME=/absolute/path/to/home npm exec --yes --package=@zq-silk/yui@0.16.2 -- \
65
+ yui update --version 0.16.2
66
+ ```
67
+
68
+ Do not replace the live global binary first or assume `latest` will continue
69
+ to select the bridge. Preserve target-owned `upgrade --update-preflight` /
70
+ `--update-apply`: refusal happens before activation, and preflight is repeated
71
+ under the handover fence after draining the exact Controller. The older-updater
72
+ recovery guidance below still applies when invoking an older updater.
73
+
74
+ ### Inspect and preserve the old endpoint
75
+
76
+ With the published 0.16.2 CLI and the intended `YUI_HOME`, use the existing
77
+ `yui --json version`, `yui --json upgrade --dry-run`, `yui --json doctor`,
78
+ `yui --json controller status`, and `yui session reconcile --report` reads.
79
+ After the old-chain upgrade, the upgrade report must be `already-current` at
80
+ storage 37; `upgrade-plan` only describes pending migrations. Neither report
81
+ proves physical quiescence or readiness for the new storage 1.0 cutover.
82
+ Do not add a durable "ready for 1.0" flag or a second version authority.
83
+
84
+ Before the later offline cutover, settle active work using its original
85
+ contract. `yui session stop --all` explicitly stops idle managed Sessions and
86
+ the Controller; it is not a force stop or proof that detached Jobs and unknown
87
+ resources have exited. Inspect exact ownership and pending effects. Never mark
88
+ Tasks complete, acknowledge uncertain work, or delete resources just to pass an
89
+ upgrade. The future converter must recheck quiescence under its fence.
90
+
91
+ Retain the **exact published 0.16.2 package**, its existing release manifest,
92
+ registry integrity, tag/source commit, and this guide as the historical bridge.
93
+ The existing package inventory pins compiled migrations and their helpers;
94
+ an expiring CI artifact alone is not a long-term distribution. This release
95
+ introduces no additional Home metadata or migration registry.
96
+
97
+ The 1.0.0-alpha.1 converter must preserve old ledger/audit bytes, Home identity,
98
+ business IDs, records, Knowledge, workspaces (including dirty files), and
99
+ unconfirmed external effects. A database-only backup cannot fully roll back old
100
+ layout migrations with filesystem/Git effects. Unknown or malformed old formats
101
+ remain blockers. New storage 1.0 must have a distinct baseline identity, never the old
102
+ `v0.15.0-baseline`. Its SQL/fingerprint and final conversion tool belong to
103
+ 1.0.0-alpha.1, **not this release**; it accepts verified old v37 rather than carrying
104
+ the complete old chain.
105
+
106
+ The new storage uses major.minor versions; default upgrades allow only explicit,
107
+ contiguous minor steps within the same major. Any persistent change during
108
+ prereleases must declare a new minor transition, never silently rewrite a
109
+ published baseline. The stable release reuses the final verified contract.
110
+ Publish the converter and checksum as durable prerelease attachments before
111
+ removing their source. Never include conversion code in the runtime tarball or imports, retaining current
112
+ initialization, validation, unknown-format rejection, exact runtime identity and
113
+ normal safety/recovery. Users skipping the bridge must still use the frozen
114
+ tools; 1.0.0 must never guess an old format.
115
+
116
+ ## Controller handover fix in 0.16.1
117
+
118
+ Controller status and storage preflight are observations, not cleanup. The
119
+ authorized updater explicitly runs its bounded current-Home reconciliation
120
+ under the handover fence before capture/stop. It retains the existing four-pass
121
+ rule and process-start/inode checks, preserving current Controllers and excluding
122
+ Agent/tmux/app/foreign-Home resources.
123
+
124
+ Update results and release-step logs retain reconciliation targets, completed
125
+ actions, original cleanup errors, the last inventory with its observation time,
126
+ and failed observations or lock release. Captured-identity restoration reports
127
+ success or unknown effects separately. An uncertain cleanup/restore is not a
128
+ stopped Controller or replayable failure; inspect the exact resource before
129
+ choosing recovery. No new recovery worker or persistent protocol is introduced.
130
+ The staged `--update-preflight` / `--update-apply` contract is unchanged.
131
+
132
+ The updater's stop and exact-identity restoration children now explicitly receive
133
+ the parent updater's handover-lock owner identity. They no longer wait on their
134
+ own parent's lock; unrelated callers remain fenced. Storage remains at version 37.
135
+
136
+ An already-installed older updater, including 0.15.12 or 0.16.0, cannot gain this
137
+ fix merely by staging the new package. If it reports `CONTROLLER_HANDOVER_TIMEOUT`
138
+ before activation, inspect the original Controller and lock ownership. Once the
139
+ failed updater has released its own lock and the original Controller is confirmed
140
+ healthy, normally stop it with that installed release's `yui controller stop`,
141
+ then retry `yui update`. This preserves managed Agent Sessions and retains the
142
+ normal preflight, backup, migration and verification boundaries. Do not delete
143
+ an active lock or force-kill a Controller to bypass the failure.
144
+
30
145
  ## Pre-1.0 contract cleanup
31
146
 
32
147
  Version 0.16.0 retires runtime compatibility before the final
@@ -132,7 +247,7 @@ configuration, and explicitly retry the rejected notification.
132
247
  Before rollout, replace Sessions whose old Manifest still names `task turn`,
133
248
  and explicitly remove/archive old `yui-dev` completion blocks before installing
134
249
  current `yui` completion. User shell files are never rewritten by storage migration.
135
- Host control/event compatibility and updater handover safety remain unchanged.
250
+ Current Host control/event validation and updater handover safety remain enforced.
136
251
 
137
252
  Storage 33→34 removes Message `wakePolicy` and activation `origin` from current
138
253
  records, preserving their original representations in audit Events. Historical
@@ -255,7 +370,7 @@ Candidate and Task-final ReviewRound records must all carry that one contract.
255
370
  Conflicting records fail closed; there is no rebind event, recovery command, or
256
371
  second contract state machine.
257
372
 
258
- ## Persistent Agent Host compatibility
373
+ ## Current Agent Host boundary
259
374
 
260
375
  A running Host keeps its original Endpoint implementation. It records exact
261
376
  Session/attempt/native-Turn facts in the existing durable Inbox before contacting
@@ -269,24 +384,28 @@ the long-lived Session environment. This preserves pre-adoption evidence even
269
384
  when the frozen Run workspace differs from the Role's default; later activity
270
385
  and terminal facts still resolve solely by their own native input identities.
271
386
 
272
- The supported Host boundary is control `yui-agent-host/v5`, event source
273
- `yui-agent-host-events/v1`, and Controller RPC version 4. Hosts advertising
274
- `storage=controller-owned` do not open the Home database, including for process
275
- custody, native account locations, or execution-environment checks. Home 22
276
- declares the additive Inbox source envelope; valid older Inbox v1 facts and
277
- domain history remain readable. Future changes must retain this wire boundary
278
- or reject incompatible live producers before changing storage. CLI wrapper
279
- refresh and a successful new `doctor` are not Host compatibility proofs.
280
-
281
- `upgrade`, the staged target's `update` preflight, and release activation inspect
282
- live Host capabilities independently. An old Host without this capability,
283
- including an idle Host or one whose response is unconfirmed, blocks adoption.
284
- Checks are repeated at the existing fenced/quiesced handover boundary before
285
- migration or promotion. No Host is killed, replaced, or reloaded by these checks.
286
- Let existing work settle and preserve original pending input/result evidence;
287
- then an authorized Operator can select a safe Session replacement/cleanup before
288
- retrying. Installing this change cannot repair already-loaded legacy Host code
289
- or collect a terminal that that code never durably emitted.
387
+ The current Host boundary is control `yui-agent-host/v5`, event source
388
+ `yui-agent-host-events/v1`, and Controller RPC version 4. Hosts do not open the
389
+ Home database, including for process custody, native account locations, or
390
+ execution-environment checks. Only the Controller owns storage and resolves
391
+ durable facts; malformed current input fails at its normal protocol boundary.
392
+
393
+ Breaking upgrades do not inherit historical Hosts or processes. Runtime startup,
394
+ `upgrade`, `update`, and release activation no longer scan old Host sockets or
395
+ processes, infer their capabilities, or negotiate a compatibility handoff. Use a
396
+ clean runtime environment; this is not permission to discard pending work or
397
+ kill resources of uncertain ownership. Current Controller restart, exact
398
+ process-generation checks, handover locks, Session authority and event replay
399
+ protection remain enforced.
400
+
401
+ Storage migration is separate: the complete 1..37 chain and updater
402
+ `--update-preflight` / `--update-apply` contract remain. Storage preflight is
403
+ rechecked at the fenced/quiesced boundary; no published migration is rewritten.
404
+ Session CLI refresh only retargets the current two-argument quoted wrapper
405
+ named by a valid Manifest. It does not convert retired wrapper forms. Runtime
406
+ diagnostics do not interpret `schema.json`, `state.json`, or a whole-map release
407
+ idempotency file; current SQLite data and per-key release receipts remain the
408
+ authorities, and unrelated files are left untouched.
290
409
 
291
410
  `task role status`, `task role list`, and `task role session inspect` expose Host
292
411
  reporting alongside durable Run state. Pending native results or known reporting
@@ -2,6 +2,81 @@
2
2
 
3
3
  # 获授权的发布操作
4
4
 
5
+ ## 最后的历史桥接版:0.16.2
6
+
7
+ | 版本 | Home 存储 | 职责 |
8
+ | --- | --- | --- |
9
+ | **0.16.2** | 旧 v37,最低支持旧 v1 | 最后一次保留完整 v1→v37 历史升级链。 |
10
+ | **1.0.0-alpha.1**(计划) | 身份独立的新 1.0 | 独立发布严格验证后的旧 v37→新 1.0 离线转换器。 |
11
+ | **1.0.0**(计划) | 与最终预发布版相同的已验证 1.x 契约 | 转换器持久发布后删除其源码,不再重置存储。 |
12
+
13
+ 0.16.2 承接 0.99.0 的有效改进,只替代发布编号,不回退功能或改写 Git 历史;
14
+ 两者使用同一 v37 终点。先发布并验证替代版本,再撤下 0.99.0 的 npm 版本、
15
+ Release 和 tag。不自动降级本地安装或修改 Home。
16
+ 正式版显式发布到 npm `latest`,预发布版发布到 `next`,新基线必须主动选择。
17
+
18
+ 0.16.2 将旧链终点冻结在 **37**,不追加空迁移、不改写已发布 SQL 或
19
+ 数据迁移,也不重置记录内的 schemaVersion、运行协议和审计版本。
20
+ 新建及升级后的 Home 使用同一当前契约;普通读取不解释历史格式,
21
+ 只有显式 `upgrade` / `update` 可以迁移。
22
+
23
+ ### 明确选择桥接版本
24
+
25
+ 在 0.16.2 中,`yui update --version 0.16.2` 选择精确的已发布版本;
26
+ 无参数仍选择 `latest`。显式版本不接受标签或范围。暂存包的实际版本必须
27
+ 等于指定版本,才可进入预检和 Controller 交接;不匹配时只清理本次暂存目录,
28
+ 不改变当前安装和数据库。
29
+
30
+ 旧 CLI 尚不支持此参数。0.16.2 发布后,可先独立暂存精确的 0.16.2 CLI,
31
+ 再由它针对明确指定的 `YUI_HOME` 执行升级。例如用 npm 暂存 CLI,
32
+ 而不是先覆盖全局安装:
33
+
34
+ ```sh
35
+ YUI_HOME=/absolute/path/to/home npm exec --yes --package=@zq-silk/yui@0.16.2 -- \
36
+ yui update --version 0.16.2
37
+ ```
38
+
39
+ 不要假定未来的 `latest` 仍指向桥接版。保留目标包驱动的
40
+ `upgrade --update-preflight` / `--update-apply` 契约:拒绝发生在激活前,
41
+ 并在 handover fence 内、精确 Controller 停止后重新预检。
42
+ 若仍使用旧 updater,下文旧版本的交接恢复说明依然适用。
43
+
44
+ ### 检查并保留旧链终点
45
+
46
+ 用已发布的 0.16.2 CLI 和明确的 `YUI_HOME` 读取:
47
+ `yui --json version`、`yui --json upgrade --dry-run`、
48
+ `yui --json doctor`、`yui --json controller status`、
49
+ `yui session reconcile --report`。
50
+ 旧链升级完成后,upgrade 报告应为存储 37 的 `already-current`;
51
+ `upgrade-plan` 只表示尚待执行的旧链迁移。两者都不证明运行资源静止,
52
+ 更不表示已通过新存储 1.0 的转换预检。不新增“可进入 1.0”持久化标记
53
+ 或第二套版本权威。
54
+
55
+ 后续离线切换前,先按原契约结算正在执行的工作。
56
+ `yui session stop --all` 是停止空闲受管 Session 和 Controller 的显式操作,
57
+ 不是强制停止,也不证明所有独立 Job 或未知资源已退出。必须检查精确所有权
58
+ 和待确认效果,不能为了升级而伪造 Task 完成、确认未知工作或删除资源;
59
+ 未来转换器仍须在 fence 内重新检查静止条件。
60
+
61
+ 长期保留**精确的 0.16.2 发布包**、已有 release manifest、registry integrity、
62
+ tag/源码提交及本指南。现有包清单会固定编译后的迁移实现和辅助模块;
63
+ 会过期的 CI artifact 不能作为唯一长期分发渠道。本版不新增 Home 元数据
64
+ 或迁移注册表。
65
+
66
+ 1.0.0-alpha.1 的一次性转换必须保留旧账本和审计原始内容、Home 身份、业务 ID、
67
+ 记录、Knowledge、工作区(含未提交文件)及未确认的外部效果。
68
+ 旧布局迁移还涉及文件系统和 Git,单独备份数据库不足以证明完整可回滚。
69
+ 未知或损坏格式直接阻塞,不猜测修复。新存储 1.0 必须具有独立身份,
70
+ 不能复用旧 `v0.15.0-baseline`。新 SQL/指纹及最终转换工具属于 1.0.0-alpha.1,
71
+ **不在本版提前实现**;它只接受已验证的旧 v37,不再携带整条旧链。
72
+
73
+ 新存储采用主版本.小版本,默认只允许同主版本内显式、连续的小版本升级。
74
+ 预发布期间如需改变持久化契约,必须声明新的小版本迁移,不能静默改写已发布基线;
75
+ 正式版复用最终已验证契约。转换器及校验和必须作为持久的预发布附件发布后,
76
+ 才可删除其源码。正常运行 tarball 和导入链始终不包含转换器,
77
+ 保留当前初始化、校验、未知格式拒绝、精确运行身份和正常安全恢复。
78
+ 跳过桥接版的用户仍需使用冻结工具,1.0.0 不解释旧格式。
79
+
5
80
  发布工作流是一段被显式选择、获授权的外部发布效果序列——pull request、CI 确认、
6
81
  合并、版本 tag、npm 发布、全新安装冒烟、CLI 更新、Controller 替换、Project 迁移和
7
82
  后置验证。它是一个专用的外部效果设施,而不是 Yui 的 Task 规划或 Agent 执行模型。
@@ -20,6 +95,29 @@ Agent 选择一个预先声明的计划,设施从持久状态驱动该计划
20
95
  (`src/release/releaseWorkflowPorts.ts`)之后。可用临时 SQLite 和确定性的外部端口测试
21
96
  恢复逻辑,无需真实 GitHub、npm、git、Controller 或模型效果。
22
97
 
98
+ ## 0.16.1 的 Controller 交接修复
99
+
100
+ Controller 状态与存储预检只负责观测,不暗中清理。已授权的升级流程在交接保护下、
101
+ 捕获和停止当前 Controller 之前,显式执行当前 Home 的有界 reconciliation。
102
+ 保留最多四轮和进程启动身份/inode 检查;当前 Controller、Agent/tmux/app 和其他
103
+ Home 的资源不在此清理范围。
104
+
105
+ 升级结果与发布步骤日志保留清理目标、已完成动作、原始清理错误、带观测时间的最后
106
+ 资源现场,以及观测或锁释放失败。原 Controller 的精确身份恢复单独报告成功或效果
107
+ 未知。清理/恢复效果未知不等于 Controller 已停止,也不是可直接重放的失败;先检查
108
+ 确切对象再选择恢复。不新增后台恢复或持久协议,暂存二进制的
109
+ `--update-preflight` / `--update-apply` 合同不变。
110
+
111
+ 升级器的停止与精确身份恢复子进程,现在显式接收父升级进程的交接锁归属身份,
112
+ 不再等待自己父进程持有的锁;无关调用仍被阻止。存储版本保持 37。
113
+
114
+ 已经安装的旧升级器(包括 0.15.12、0.16.0)不会因为暂存新包而提前获得此修复。
115
+ 若其在激活前报告 `CONTROLLER_HANDOVER_TIMEOUT`,先检查原 Controller 和锁的归属。
116
+ 确认失败的升级器已释放自己的锁、原 Controller 仍健康后,使用已安装版本的
117
+ `yui controller stop` 正常停止 Controller,再重试 `yui update`。此操作保留受管
118
+ Agent Session,仍完整执行预检、备份、迁移和验证;不要删除活动锁或强杀 Controller
119
+ 来绕过失败。
120
+
23
121
  ## 1.0 前的契约清理
24
122
 
25
123
  版本 `0.16.0` 先清退运行时兼容分支,尚未执行最终 1.0 基线切换,也不重置
@@ -95,7 +193,7 @@ Session 归属统一使用 SQLite。旧 `launch-env` owner 行或 `runtime/sessi
95
193
 
96
194
  不再支持 `task turn` 和 `yui-dev` 补全身份。上线前应替换仍依赖 `task turn`
97
195
  Manifest 的 Session;明确卸载/归档旧 `yui-dev` 补全块后,再安装现行 `yui` 补全。
98
- 存储迁移不会修改用户 shell 文件。Host 控制/事件兼容与 updater 交接安全检查保持不变。
196
+ 存储迁移不会修改用户 shell 文件。当前 Host 控制/事件校验与 updater 交接安全检查继续生效。
99
197
 
100
198
  存储 `33→34` 从当前记录移除 Message `wakePolicy` 与激活 `origin`,原始表达
101
199
  保存在审计事件。旧的仅记录消息转换为 `intent: record`,其他缺少意图的
@@ -192,7 +290,7 @@ Session 使用普通的 `yui` 命令,兼容性由协议和存储身份检查
192
290
  Task-final 的 ReviewRound 记录必须全部携带那唯一的合同。冲突的记录 fail closed;
193
291
  不存在重新绑定事件、恢复命令或第二套合同状态机。
194
292
 
195
- ## 常驻 Agent Host 升级兼容
293
+ ## 当前 Agent Host 边界
196
294
 
197
295
  存活 Host 保持原 Endpoint 实现,先把准确的 Session/attempt/nativeTurn 事实写入现有
198
296
  持久 Inbox,再联系 Controller。只有当前 Controller 解析 Run 归属、校验权限、工作区、
@@ -203,18 +301,21 @@ ACK 不会重放用户输入或模型工作。
203
301
  环境。即使冻结的 Run 工作区不同于 Role 默认值,登记前的证据也能保留;后续活动和
204
302
  终态仍只按各自的原生输入身份解析归属。
205
303
 
206
- 支持边界为控制协议 `yui-agent-host/v5`、事件来源协议 `yui-agent-host-events/v1`、
207
- Controller RPC 版本 4。声明 `storage=controller-owned` 的 Host 不打开 Home 数据库,
208
- 包括进程归属、原生账号位置和执行环境校验。Home 22 声明 Inbox 的新增来源字段,
209
- 不改写有效历史事实与业务记录。后续版本要么保留该线协议,要么在修改存储前拒绝不兼容
210
- 的存活生产者。刷新 Session CLI wrapper 或新 `doctor` 成功都不能证明旧 Host 兼容。
211
-
212
- `upgrade`、`update` 的目标版本预检及 release activation 独立检查存活 Host。
213
- 没有此能力的 legacy Host(包括 idle)以及兼容响应不确定的 Host 都阻止采用;
214
- 在既有隔离/静默交接边界再次检查,先于迁移或发布切换。检查不会 kill、替换或 reload
215
- Host。先让原有工作结束并保留原始未决输入/结果证据,再由获授权的 Operator 在安全
216
- 边界选择 Session 替换或清理,之后重试。安装新代码不能修改已加载的 legacy Host 内存,
217
- 也不能回收它从未持久投递过的终态。
304
+ 当前边界为控制协议 `yui-agent-host/v5`、事件来源协议 `yui-agent-host-events/v1`、
305
+ Controller RPC 版本 4Host 不打开 Home 数据库,包括进程归属、原生账号位置和
306
+ 执行环境校验。只有 Controller 拥有存储并解析持久事实;非法当前输入在正常协议
307
+ 边界得到明确错误。
308
+
309
+ 破坏性升级不承接历史 Host 或进程。启动、`upgrade`、`update` 和 release activation
310
+ 不再扫描旧 Host socket/进程、推断旧能力或协商兼容交接。使用干净的运行时环境;
311
+ 这不授权丢弃未决工作或终止归属不确定的资源。当前 Controller 正常重启、准确进程
312
+ 代际校验、交接锁、Session 权限与事件防重放继续生效。
313
+
314
+ 存储迁移是独立边界:保留完整 1..37 迁移链和 updater `--update-preflight`/
315
+ `--update-apply` 合同,在隔离/静默边界重查存储预检,不改写已发布迁移。
316
+ Session CLI 刷新只重定位有效 Manifest 指向的当前双参数引号 wrapper,不转换
317
+ 退役形态。运行时诊断不解释 `schema.json`、`state.json` 或整表 release 幂等文件;
318
+ 当前 SQLite 与逐 key release 回执仍是权威,无关文件保持原样。
218
319
 
219
320
  `task role status`、`task role list` 和 `task role session inspect` 在持久 Run 状态旁
220
321
  显示 Host 上报观测。原生结果待落库或已知上报故障需要关注,但不代表 Provider 失败、