@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
@@ -136,6 +136,36 @@ requests for the same scope share the active probe, including refresh requests;
136
136
  once it settles, an explicit refresh probes again. Retained results are labelled
137
137
  as cached rather than as a new live response. No cleanup timer or worker is added.
138
138
 
139
+ Catalog `source` describes the metadata query: `live` is a successful current
140
+ query, `cache` reuses an identity-matched observation, and `fallback` has no
141
+ usable native observation. It does **not** confirm every configuration field.
142
+ The same catalog can combine native model/help enumeration, local profile names,
143
+ and declared static adapter inputs. Field `reason` and catalog `warnings` identify
144
+ these boundaries; `available: false` marks an unavailable native enumeration or
145
+ capability, not permission to guess values. `allowCustom` permits explicit input,
146
+ not a promise of Provider acceptance.
147
+
148
+ Missing or unparseable help enums stay empty. Known static contracts (such as
149
+ Yui's permission strategies and supported configuration syntax) remain available
150
+ with an explicit static label; they are not described as server-discovered options.
151
+ The permission picker never supplies its own list when a field is absent, and
152
+ retains an existing value as an explicitly unreported current setting. A query
153
+ does not change configuration, permissions, model, or account.
154
+
155
+ Cache responses retain the original `fetchedAt`, last probe `attemptedAt`, field
156
+ reasons, warnings, and any failed refresh's error. Identity matching is not a
157
+ freshness guarantee: native files, account entitlements and remote policy may
158
+ change, so use explicit refresh when needed. The discovery contract is part of
159
+ cache identity; older derived caches that could contain guessed help values are
160
+ not reused by this contract. Durable Home schemas and migration history are
161
+ unchanged.
162
+
163
+ Doctor inspects installation and help only, using the same declared fields and
164
+ enum parser. Its field counts distinguish help-observed, static/unverified, and
165
+ unavailable fields; it does not enumerate account models. The retained minimum
166
+ versions and latest offline producer evidence have different meanings; see
167
+ the source repository's `docs/provider-protocol-contracts.md`.
168
+
139
169
  On Role creation, explicit Agent settings require `--agent`. On update, omitted
140
170
  `--agent` targets the active binding; a named binding is updated without being
141
171
  activated. `task role bind` changes selection. A live Session requires the
@@ -110,6 +110,26 @@ yui task role session new <task> <role> --reason "<why a fresh Session is useful
110
110
  正在进行的查询,结束后显式刷新才重新查询。缓存命中标为缓存,不冒充新的实时响应。
111
111
  这不增加清理定时器或后台 worker。
112
112
 
113
+ 目录的 `source` 描述元数据查询来源:`live` 是本次查询成功,`cache` 是复用身份
114
+ 匹配的历史观测,`fallback` 表示没有可用原生观测;它不表示每个配置字段都已获
115
+ 原生确认。同一目录可同时包含原生模型/help 枚举、本地 profile 名称及明确声明的
116
+ adapter 静态输入合同。字段 `reason` 和目录 `warnings` 说明这些边界;
117
+ `available: false` 表示原生枚举或能力不可用,不允许据此猜测值;`allowCustom`
118
+ 只允许显式输入,不承诺 Provider 会接受。
119
+
120
+ help 枚举缺失或解析失败时保持为空。Yui 权限策略、支持的配置语法等确定静态合同
121
+ 仍可使用,但明确标为静态,不冒充服务端枚举。权限选择器不再为缺失字段自行补列表;
122
+ 已有设置可作为“本次目录未报告的当前值”保留。查询不修改配置、权限、模型或账号。
123
+
124
+ 缓存返回保留原始 `fetchedAt`、最后一次查询的 `attemptedAt`、字段说明、警告和刷新
125
+ 失败原因。身份匹配不等于实时有效:原生文件、账户权限、远端策略仍可能变化,需要时
126
+ 显式刷新。发现合同也参与缓存身份,因此可能包含猜测 help 值的旧派生缓存不再复用;
127
+ Home 持久 schema 与迁移历史不变。
128
+
129
+ Doctor 只检查安装和 help,复用相同静态字段和枚举解析,分别统计 help 已观测、
130
+ 静态/未确认、不可用字段,不枚举账户模型。保留的最低支持版本与最新离线生产者
131
+ 证据含义不同,详见源仓库的 `docs/provider-protocol-contracts.md`。
132
+
113
133
  创建 Role 时,显式的 Agent 设置需要 `--agent`。更新时,省略 `--agent` 针对活动
114
134
  绑定;一个具名绑定会被更新但不被激活。`task role bind` 更改选择。在更改期望设置
115
135
  之前,活动 Session 需要该命令的显式确认。
@@ -143,6 +143,33 @@ infer that unrecorded WorkItems mean direct execution was requested.
143
143
 
144
144
  ## Completion and remote delivery
145
145
 
146
+ `task complete` is offline by default and never integrates upstream commits or
147
+ changes Git HEAD. `--refresh-remote` only fetches remote objects in Task-owned
148
+ repositories to report freshness; it does not rebase, start Integration checks,
149
+ or update the stable Project checkout. A behind/diverged/unknown remote remains
150
+ an advisory for local completion, not a claim of remote delivery. Refresh failure
151
+ is reported as unknown with its error and never as fresh success. To inspect
152
+ without completing or preparing Review, use `task base status <task> [--refresh]`.
153
+
154
+ Choose any necessary upstream integration explicitly before completion.
155
+ `task upstream integrate <task> (--latest|--project <project>)` requests a fixed
156
+ rebase/check/CAS sequence. It returns each Integration and admitted Job, separating
157
+ the candidate from the committed HEAD. A blocked batch preserves prior results,
158
+ the failing Project/phase, any uncertain attempt and unattempted Projects; inspect
159
+ and continue exact attempts instead of replaying the whole batch. It neither
160
+ requests Review nor completes the Task.
161
+
162
+ Completion still prepares/dispatches an already-established final Review without
163
+ another approval. Without that contract it does not create a Reviewer.
164
+ JSON `stage` distinguishes `completed`, `already-completed`, `review-pending`,
165
+ `review-running`, and `review-blocked`; Review stages leave the Task active.
166
+ `projectHeads` identifies the inspected heads, and the ReviewRound carries its
167
+ separate frozen candidate and exact Run reference. After dispatch, the top-level
168
+ stage reflects its result while `command` retains the earlier preparation result.
169
+ `baseFreshness` and `warnings` expose the observation and its limitations;
170
+ freshness is null when skipped for a completed Task or existing Review.
171
+ An already-completed response does not re-observe or invent delivery heads.
172
+
146
173
  Completion checks the current WorkItems, latest captured/integrated results,
147
174
  applicable Review contract and exact clean committed Task-main snapshot.
148
175
  It also refuses completion while a new user/Operator message is still awaiting
@@ -201,6 +228,67 @@ Cancelled intent does not prove the runtime stopped. User/Operator may reopen
201
228
  cancelled Tasks; Leader may reopen completed Tasks. Reopening requires fresh
202
229
  explicit input/work selection and never replays previous delivery requests.
203
230
 
231
+ ### Route follow-up delivery to the owning Leader
232
+
233
+ Development, local acceptance, PR/MR submission, merge and ordinary corrections
234
+ are normally stages of the same result, not reasons for new Tasks. The Operator
235
+ routes the authorized request to the owning Leader, verifies evidence and reports
236
+ to the user. For several serial deliveries, inspect each Task's original request,
237
+ current authority, Publication and dependencies; send only the current Leader its
238
+ repository/target branch, authorized effects, limits and expected proof. That
239
+ Leader synchronizes and validates in its own legal managed workspace, performs
240
+ the authorized delivery, and records Publication there. Advance the next Leader
241
+ only after verifying the exact merge and accepted-result coverage. Do not default
242
+ to a common delivery Task, Global implementation, or duplicate PR registration
243
+ across Tasks. Submission acceptance, a Run terminal and Task completion are not
244
+ merge evidence.
245
+
246
+ For an active, execution-enabled Task, use
247
+ `operator submit "<request>" --task <task> --intent develop --request-id <id>` or
248
+ unaddressed `task message send <task> "<request>" --intent develop --request-id <id>`.
249
+ Choose one and retain its receipt. Ordinary Leader input omits `--to leader`;
250
+ explicit recipients require an existing WorkItem/ReviewRound Assignment.
251
+ External-effect authorization must be explicit: development does not grant
252
+ push/PR/merge, and merge does not grant release, production update or archive.
253
+
254
+ When the user explicitly requests further implementation or delivery of the same
255
+ completed, unarchived result, the Operator may perform the necessary
256
+ `task reopen <task>` before submitting the new scoped request. The user need not
257
+ add a mechanical “reopen” confirmation. These existing operations suffice; no
258
+ auto-reopen option or post-completion execution protocol is needed. Ordinary
259
+ send/queue/submit, including `--intent develop`, still refuses a completed Task
260
+ before saving new input. Queries, record-only input and discussion do not grant
261
+ reopening authority.
262
+
263
+ Reopen returns the Task to active and clears current completion metadata while
264
+ preserving original events, fixed heads/reports and Publication history. The
265
+ Leader separately verifies and accepts the new result; old validation does not
266
+ automatically cover it. Reopen preserves an independent execution stop: only the
267
+ authorized `task execution start` path can lift that gate after cleanup.
268
+ Cancelled intent requires separate restoration authority; archived Tasks cannot
269
+ reopen, and retained workspaces or Session replacement do not bypass lifecycle.
270
+
271
+ Reopening and submitting are two atomic operations with separate outcomes.
272
+ Inspect the lifecycle result and saved/queued receipt; if submission fails,
273
+ read current state and continue only the unapplied step within the same authority.
274
+ Keep the same key for a matching submission retry, never replay unknown effects,
275
+ and do not reopen again merely to retry after another completion or cancellation.
276
+ The reopen notification can arrive before the new Message: the Leader waits for
277
+ the actual request, without rerunning accepted work or immediately completing
278
+ again. Once the request arrives, it proceeds without another “continue.”
279
+
280
+ Publication upsert, diff/adopt and verify remain separate, authorized atomic
281
+ operations for completed, unarchived results. They need no reopening when no new
282
+ execution is requested. After reopened work, record its new completion without
283
+ rewriting the earlier baseline, then apply the existing candidate adoption and
284
+ verification rules where relevant.
285
+
286
+ An independently acceptable, deliverable and reversible new outcome, or an
287
+ explicit user request for a new Task, can justify a new Task; explain that reason.
288
+ Completed status, revalidation, shared files or the need for a PR alone cannot.
289
+ Configuration, authorized lifecycle actions and urgent safety interventions
290
+ remain Operator responsibilities and do not each require a new Task.
291
+
204
292
  ## Archive
205
293
 
206
294
  Archive requires independent user/Operator authorization for an exact completed
@@ -276,6 +364,27 @@ Task or new durable owner prevents quarantine/deletion; uncertainty retains the
276
364
  resource with a diagnosis. Reopened quarantined resources can be restored.
277
365
  This adds neither a retry worker nor another persistent ownership protocol.
278
366
 
367
+ Current Resource records are read strictly: required safety fields, enum values,
368
+ and every active reference must be valid. A malformed record or mismatched
369
+ SQLite/payload identity is reported without supplying defaults, dropping refs,
370
+ or rewriting stored evidence. This enforces the existing record contract;
371
+ storage remains at version 37.
372
+
373
+ Failed preparation compensates only its unadopted resources. Standalone Task
374
+ clones use exact clone identity/cleanliness checks before direct deletion;
375
+ linked worktrees use their captured path, branch, commit and own Git common
376
+ directory. A Git error (including a lock) never falls through to recursive
377
+ deletion. Same-operation temporary clone cleanup first proves its reserved
378
+ directory identity. Already-adopted workspaces remain outside compensation.
379
+ Failures preserve the original error, completed removals and exact remaining
380
+ targets, whose failed-command effects may be unknown.
381
+
382
+ An Agent may still choose direct `rm` for an exact resource within its existing
383
+ authority after inspecting ownership and contents, including when Git metadata
384
+ is unavailable. That is an explicit recovery choice, not a generic automatic
385
+ fallback or a new approval workflow. Keep Task records, other owners' resources
386
+ and unknown live processes outside that deletion.
387
+
279
388
  `yui task archive-preflight <task> (--integrated|--abandon) [--force] [--json]`
280
389
  reads current admission, delivery and exact-owner cleanup checks in one report.
281
390
  It is available before and after archive, including to the Task's authorized
@@ -113,6 +113,27 @@ Reviewer Run 持有报告;执行成功不等于语义通过。验收归 Leader
113
113
 
114
114
  ## 完成与远程交付
115
115
 
116
+ `task complete` 默认离线,绝不集成上游提交或改变 Git HEAD。
117
+ `--refresh-remote` 仅在 Task 自有仓库中获取远端对象并报告新鲜度,不会 rebase、
118
+ 启动 Integration 检查或更新稳定 Project checkout。远端落后、分叉或未知仍是本地
119
+ 完成的提示,不是远端交付证明;刷新失败返回 unknown 和原始错误,不伪装成最新成功。
120
+ 只想查询而不完成或准备 Review 时,使用 `task base status <task> [--refresh]`。
121
+
122
+ 需要上游集成时,由 Agent 在完成前显式选择。
123
+ `task upstream integrate <task> (--latest|--project <project>)` 请求固定的
124
+ rebase/检查/CAS 步骤,返回每个 Integration 和已接纳的 Job,并区分候选与已提交
125
+ HEAD。批处理中途受阻仍保留先前结果、失败的 Project/阶段、效果需查证的尝试以及
126
+ 尚未尝试的 Project;应检查和续作确切尝试,不重放整个批次。此命令既不请求 Review,
127
+ 也不完成 Task。
128
+
129
+ 完成仍会按已建立的 final Review 合同准备/派发 Review,不要求重复批准;
130
+ 没有该合同时不会创建 Reviewer。JSON 的 `stage` 区分 `completed`、
131
+ `already-completed`、`review-pending`、`review-running` 和 `review-blocked`,
132
+ Review 阶段保持 Task active。`projectHeads` 标明本次检查的 head,ReviewRound
133
+ 独立携带冻结候选及确切 Run 引用。派发后顶层阶段反映实际结果,`command` 保留先前
134
+ 准备阶段的部分结果。`baseFreshness` 和 `warnings` 暴露观察与限制;已完成或已有
135
+ Review 时跳过刷新,该新鲜度字段为 null。重复完成不重新观察或补造交付 head。
136
+
116
137
  完成会检查当前的 WorkItem、最新捕获/集成的结果、适用的 Review 合同以及确切的、
117
138
  干净且已提交的 Task-main 快照。当有一条新的 user/Operator 消息仍在等待 Leader
118
139
  投递时,它也会拒绝完成。当前原生轮次必须结束,待处理的通知才能到达;随后 Leader
@@ -155,6 +176,51 @@ CLI、当前 Leader Context 和 Web 从同一组事实推导覆盖,不联网
155
176
  取消意图不证明运行时已停止。user/Operator 可以重开已取消的 Task;Leader 可以重开
156
177
  已完成的 Task。重开需要全新的显式输入/工作选择,绝不重放先前的交付请求。
157
178
 
179
+ ### 后续交付路由给原 Task Leader
180
+
181
+ 开发、本地验收、提交 PR/MR、合并和普通修正,通常是同一成果的不同阶段,不是
182
+ 新建 Task 的理由。Operator 将获授权的请求交给原 Task Leader,核验结果并向用户
183
+ 汇报。多个 Task 串行交付时,先读各自原始请求、当前权限、Publication 与依赖,
184
+ 只给当前那一个 Leader 发送仓库/目标分支、授权效果、边界和预期证据。Leader 在自己
185
+ 合法的受管工作区同步、验证、执行获授权交付,并在原 Task 记录 Publication。
186
+ 核实精确合并与已验收成果覆盖后,才推进下一个 Leader。不要默认新建统一交付 Task、
187
+ 由 Global 接管实现,或跨 Task 重复登记同一 PR。投递接受、Run 终态与 Task 完成
188
+ 都不等于合并证据。
189
+
190
+ 对于 active 且 execution enabled 的 Task,使用
191
+ `operator submit "<请求>" --task <task> --intent develop --request-id <id>` 或
192
+ 不带收件人的 `task message send <task> "<请求>" --intent develop --request-id <id>`。
193
+ 二选一并保留回执。普通 Leader 输入省略 `--to leader`;显式收件人要求已有
194
+ WorkItem/ReviewRound Assignment。外部效果必须明确获授权:开发不授予
195
+ push/PR/merge,合并不授予发版、生产升级或归档。
196
+
197
+ 用户明确要求继续同一个已完成、未归档成果的实现或交付时,Operator 可以先执行必要的
198
+ `task reopen <task>`,再提交这次有界请求。用户无需机械地额外确认“重开”。
199
+ 现有两步即可满足目标,不需要自动重开开关或后完成执行协议。普通 send/queue/submit
200
+ (包括 `--intent develop`)仍会在保存新输入前拒绝 completed Task;只读查询、
201
+ record-only 输入和讨论本身不授予重开权限。
202
+
203
+ 重开回到 active,撤下当前完成元数据,同时保留原事件、固定 head/报告和 Publication
204
+ 历史。Leader 对新结果单独验证与验收,不能把旧验证直接宣称为新结果的证据。
205
+ 重开保留独立的执行停止决定;只有获授权且完成清理的 `task execution start` 路径
206
+ 可以解除 gate。恢复 cancelled 意图需要单独明确授权;archived Task 不能重开,
207
+ 保留工作区或 Session 替换都不能绕过生命周期。
208
+
209
+ 重开与提交是两个有独立结果的原子操作。分别检查生命周期结果和 saved/queued 回执;
210
+ 提交失败时读取当前状态,仅在权限未变时继续尚未生效的那一步。相同提交重试保留原 key,
211
+ 不重放效果未知的操作,也不因重试而再次重开已经重新完成或取消的 Task。
212
+ 重开通知可能先于新 Message 到达:Leader 等待具体新请求,不重跑已验收工作,
213
+ 也不立即再次 complete;请求到达后不再要求额外“继续”。
214
+
215
+ Publication upsert、diff/adopt、verify 仍是未归档已完成成果的独立授权原子操作,
216
+ 没有新执行请求时不必重开。重开后的工作记录自己的新完成证据,不改写旧基线,
217
+ 再按需应用现有 candidate 采用与验证规则。
218
+
219
+ 真正可独立验收、交付、回滚的新成果,或用户明确要求新建 Task,可以成为例外,
220
+ 但应说明实质理由。仅因 completed、重新验证、共用文件或需要 PR 都不成立。
221
+ 配置、获授权的生命周期动作与紧急安全干预仍由 Operator 负责,不要求每个原子管理
222
+ 操作都新建 Task。
223
+
158
224
  ## 归档
159
225
 
160
226
  归档需要针对确切的 completed 或 cancelled(retired)Task 获得独立的 user/Operator
@@ -214,6 +280,20 @@ Session 进程归属只读取 SQLite `session_owners`,并校验存活 PID 和
214
280
  保留资源并给出原因。已经隔离、随后重新打开的资源可以恢复。
215
281
  不增加后台重试 worker 或第二套持久所有权协议。
216
282
 
283
+ 当前 Resource 记录严格验证必需安全字段、枚举和每条活动引用。损坏记录或 SQLite
284
+ 主键与 payload 身份不符会明确报错,不补默认值、不丢弃坏引用、不改写原始证据。
285
+ 这是执行既有记录合同,存储版本保持 37。
286
+
287
+ 准备失败只补偿未采用的资源:独立 Task clone 经精确身份、干净状态检查后直接
288
+ 删除;linked worktree 使用准备时捕获的路径、分支、提交和自身 Git common directory。
289
+ 任何 Git 错误(包括锁定)都不会自动转为递归删除。同一次 clone 的临时补偿先验证
290
+ 预留目录身份;已采用工作区不进入补偿。失败保留原始错误、已完成删除和剩余精确
291
+ 目标,失败命令的效果可能仍未知。
292
+
293
+ Agent 仍可在既有授权内,检查归属和内容后主动选择对精确资源执行 `rm`,包括 Git
294
+ 元数据已不可用的情况。这是显式恢复选择,不是通用自动回退,也不新增审批流程。
295
+ Task 记录、其他 owner 的资源和存活状态不明的进程不因此获得处置授权。
296
+
217
297
  `yui task archive-preflight <task> (--integrated|--abandon) [--force] [--json]`
218
298
  一次读取归档条件、交付覆盖与各精确 owner 的清理检查。归档前后都可用,获授权的
219
299
  Task Leader reader 也可读取。这里的 `--force` 仅选择要检查的行为,不会归档、
@@ -14,6 +14,15 @@ same query at `GET /api/dashboard`. The per-Task detail endpoint retains
14
14
  execution, observability, usage and remote-delivery fields. Discovery itself
15
15
  does not change persistent records.
16
16
 
17
+ Web labels catalog-wide attention separately from filtered/page-local lists.
18
+ Native Session activity is an explicit optional read at
19
+ `GET /api/dashboard/sessions` with the same compact page parameters. It observes
20
+ only that returned page, includes direct inputs without AgentRuns and shows its
21
+ own read time. It is not part of the compact query or its 32 KiB budget, and never
22
+ claims a global running-Session count. Changing page membership clears this
23
+ observation. Task status counts and raw signals remain separate from activity
24
+ and semantic progress.
25
+
17
26
  ## Query and page contract
18
27
 
19
28
  ```sh
@@ -11,6 +11,12 @@ Context 快照、消息确认、执行判断或验收结论。
11
11
  Web 通过 `GET /api/dashboard` 使用同一查询;单个 Task 的详情接口继续保留
12
12
  执行、观测、用量和远端交付字段。目录查询本身不改变持久记录。
13
13
 
14
+ Web 将目录级关注计数与过滤后/当前页列表明确区分。原生会话活动通过
15
+ `GET /api/dashboard/sessions` 携带相同紧凑页参数显式按需读取,只观察该返回页,
16
+ 包含无 AgentRun 的直接输入,并标注独立读取时间。该观察不进入紧凑查询及其
17
+ 32 KiB 预算,不冒充全局运行会话数;页成员变化时清除观察。Task 状态数量、
18
+ 原始执行信号仍与活动和实质进展分开。
19
+
14
20
  ## 查询和分页合同
15
21
 
16
22
  ```sh
@@ -89,16 +89,12 @@ is required.
89
89
  Archive preflight preserves durable records and the Git index, distinguishes
90
90
  frozen-result differences, and cleanup rechecks moved heads, owner branches
91
91
  and new dirt. Read-only Git status never executes configured clean filters.
92
- 17. Host facts reach the existing Inbox even when its compiled store cannot
93
- read the Home; Controller-side fencing, ACK-loss replay, and legacy-Host
94
- upgrade refusal preserve the original execution. A frozen independent v1
95
- protocol producer remains the same process across a real 19→22 migration,
96
- authenticates RPCs to both Controllers through refreshed discovery, and
97
- retains facts during the disconnected window. Production launch planning
98
- also preserves scoped startup evidence before native Session adoption
99
- without exporting a Run ID into the Session environment.
100
- This fixture is the minimum supported new wire contract, not a claim that
101
- pre-fix released Hosts can be hot-patched.
92
+ 17. Host facts reach the existing Inbox without opening Controller-owned storage;
93
+ Controller-side fencing and ACK-loss replay preserve the original execution.
94
+ Production launch planning preserves scoped startup evidence before native
95
+ Session adoption without exporting a Run ID into the Session environment.
96
+ Historical Host detection and cross-version live-runtime fixtures are not
97
+ part of the current contract; supported historical storage migrations remain tested.
102
98
  Archive racing Host ingress retains the complete source envelope without
103
99
  reopening the Task or settling original uncertain input.
104
100
  18. Project maintenance waiters yield to the holder, use a shared 60-second
@@ -198,6 +194,27 @@ is required.
198
194
  submission rejection creates one error and one supervisor notice through
199
195
  the shared writer. A small injected cache proves completed-result eviction,
200
196
  pending-request coalescing, explicit refresh and truthful cache provenance.
197
+ 38. Current Session wrappers retarget only their exact generated shell form,
198
+ preserving immutable Manifests and leaving unknown scripts untouched.
199
+ Per-key release receipts survive reopen and reject invalid current records.
200
+ A storage blocker after Controller drain restores the captured identity
201
+ without activating a package or migrating data.
202
+ 39. Global Session replacement proves native quiescence before settling retained
203
+ input, including when a prior attempt has already archived the Session.
204
+ Unknown execution and changed Turn identity remain fenced. Existing Messages
205
+ and stop evidence survive; queued notifications cannot revive an explicitly
206
+ stopped Session or submit across cleanup admitted during Host preparation.
207
+ 40. Configuration metadata distinguishes native help enumeration, static adapter
208
+ contracts and missing fields. A disposable metadata-only producer checks
209
+ partial discovery, exact cache reuse and failed-refresh provenance; the
210
+ permission picker cannot invent choices or erase explicit current values.
211
+ Doctor uses the same help interpretation without guessing model aliases.
212
+ 41. Operator attention transfers atomically to one Global Message per batch,
213
+ without overlapping new events while busy. SQLite reopen, rollback and exact
214
+ receipt reuse preserve the pending suffix and undelivered evidence. A local
215
+ fake Host control port checks unknown/rejected delivery, successor inputs,
216
+ and the Controller's dirty signal without a live model. Existing Global
217
+ control tests retain interrupt-then and exact Session/authority coverage.
201
218
 
202
219
  Keep the test phase seconds-scale; measure TypeScript build separately. Record
203
220
  incremental runtime when adding a critical regression. The seven recovery boundary
@@ -234,7 +251,8 @@ on every PR, without another lint or broad regression suite.
234
251
  the actual CLI/Controller/Host/SQLite and isolated tmux, replacing only the
235
252
  external Provider with a deterministic fixture. It covers setup, durable input
236
253
  and idempotency across restart, scratch activation, native result ingestion,
237
- completion preserving the conversation, and archive releasing live/dead panes
254
+ completion preserving the conversation, explicit reopen followed by one
255
+ idempotent Operator request and its exact native result, and archive releasing live/dead panes
238
256
  and grouped viewers without affecting a similarly named neighboring session.
239
257
  The fixture owns a fresh Home and its PATH, installs cleanup before setup,
240
258
  and never calls an installed model Agent.
@@ -245,7 +263,10 @@ artifact and provenance boundaries. This validates runtime integration, not
245
263
  real-model behavior. Pure contract and safety tests remain in `test/core`;
246
264
  production wiring is exercised here rather than only through mocked ports.
247
265
  The package smoke also checks unconditional status identity and update-owned
248
- resource/identity capture through the assembled package, without an installation
266
+ resource/identity capture through the assembled package. Real lifecycle children
267
+ stop the exact Controller and restore its captured launch identity while their
268
+ parent holds the handover lock. Unrelated callers remain fenced, the lock stays
269
+ owned by the parent, and durable input survives. These checks have no installation
249
270
  or publication effect.
250
271
 
251
272
  Configured Agents acting as developers or reviewers are ordinary execution
@@ -64,12 +64,11 @@ Yui 是一个单用户本地产品。永久验证保护关键的 happy path 和
64
64
  结果仍可追溯,归档不使保留资源自动变得可删除。归档预检不改变持久记录或
65
65
  Git index,区分冻结结果差异;清理重查 HEAD、owner 分支和新增脏状态。
66
66
  只读 Git 状态检查不执行配置的 clean filter。
67
- 17. 即使 Host 编译版本的存储代码无法读取 Home,事实仍先进入现有 Inbox;
68
- Controller 侧归属校验、ACK 丢失重放和 legacy Host 升级拒绝保护原始执行。
69
- 独立冻结的 v1 协议生产者在真实 19→22 迁移前后保持同一进程,通过新 discovery
70
- 分别向两个 Controller 发出认证 RPC,并在断线窗口保留事实。生产 launch 路径
71
- 在不向 Session 环境导出 Run ID 的前提下保留 scoped 启动证据。该 fixture 代表最低
72
- 支持的新线协议,不声称已发布的修复前 Host 可以原地热更新。
67
+ 17. Host 不打开 Controller 拥有的存储,事实仍先进入现有 Inbox;
68
+ Controller 侧归属校验和 ACK 丢失重放保护原始执行。生产 launch 路径
69
+ 在不向 Session 环境导出 Run ID 的前提下保留 scoped 启动证据。
70
+ 历史 Host 识别和跨版本存活运行时 fixture 不属于当前合同;
71
+ 有效历史存储的迁移测试仍然保留。
73
72
  归档与 Host 消费交错时保留完整来源 envelope,不重新打开 Task 或结算原不确定输入。
74
73
  18. Project 维护锁等待不阻塞持锁者,使用共享的 60 秒单调时钟预算与每次独立的
75
74
  200–500ms 随机间隔;Controller 停止时取消等待,不丢失激活意图。
@@ -150,6 +149,24 @@ Agent 绑定,支持显式刷新并标明缓存。Controller 提供原生账户
150
149
  重复原生提交拒绝通过共同写入入口只产生一个错误和一条上级通知。小容量注入测试
151
150
  验证结果淘汰、进行中查询合并、显式刷新以及真实的缓存来源标记。
152
151
 
152
+ 当前 Session wrapper 只重定位明确生成的 Shell 形态,保留不可变 Manifest 与未知
153
+ 脚本。逐 key release 回执重开后可复用成功,非法当前记录仍明确报错。Controller
154
+ 停止后的存储阻塞恢复已捕获身份,不激活新包或迁移数据。
155
+
156
+ Global Session 替换回归验证:即使旧 Session 已被先前失败的切换移入历史,也必须
157
+ 先确认原生执行静止再结算保留的输入;未知执行和并发 Turn 身份变化仍拒绝结算。
158
+ 原始 Message 与停止证据保留。队列通知不能重启已明确停止的 Session,也不能越过
159
+ Host 准备期间新出现的 cleanup 义务。
160
+
161
+ 配置元数据回归区分原生 help 枚举、静态 adapter 合同与缺失字段。一次性、仅返回
162
+ 元数据的测试程序验证部分发现、精确缓存复用和刷新失败来源;权限选择器不能猜测
163
+ 选项或抹去用户已有值,Doctor 共用 help 解析且不补造模型别名。
164
+
165
+ Operator attention 按批次原子交接给一条 Global Message,忙时新事件不与已交出事件重叠。
166
+ SQLite 重开、回滚和精确 receipt 重用保留后到批次及未投递证据。本地假 Host control 入口
167
+ 检查 unknown/rejected 投递、后继输入及 Controller dirty signal,不调用真实模型;既有
168
+ Global 控制测试继续保护 interrupt-then 和精确 Session/authority。
169
+
153
170
  ## Skill 与指令变更
154
171
 
155
172
  一并审阅共享的 Runtime 合同和受影响的 Role/Project Skill。用几个相关场景检查指令
@@ -166,7 +183,8 @@ package-start 检查跟随已安装树中的本地 Skill 引用,包括跨 Role
166
183
  也不增加宽泛回归套件。
167
184
  `node scripts/smoke-runtime-package.mjs --assembled .release-stage` 经过真实
168
185
  CLI/Controller/Host/SQLite 与隔离 tmux,仅用确定性夹具替换外部 Provider。它验证
169
- setup、输入跨重启持久化及幂等、scratch 激活、原生结果入库、完成后保留会话,以及
186
+ setup、输入跨重启持久化及幂等、scratch 激活、原生结果入库、完成后保留会话、
187
+ 显式重开后的一条幂等 Operator 请求及其精确原生结果,以及
170
188
  归档释放活/死 pane 和附属查看 session,且不影响相似名称的相邻 session。
171
189
  夹具拥有新建 Home 和独立 PATH,在 setup 前建立清理责任,不调用安装的真实模型 Agent。
172
190
 
@@ -175,7 +193,9 @@ npm bin、依赖、受支持 Node 版本、产物和 provenance 边界。这证
175
193
  真实模型行为。纯契约与安全检查保留在 `test/core`,生产组件组装在这里验证,
176
194
  不只依赖模拟端口。
177
195
  组装包检查还验证固定身份输出,以及升级侧通过组装包采集资源和精确 Controller 身份,
178
- 不执行安装或发布效果。
196
+ 并在父进程持有交接锁时,通过真实生命周期子进程停止精确 Controller、恢复其已捕获的
197
+ 启动身份。无关调用仍被锁阻止,锁保持由父进程持有,持久输入不变;
198
+ 这些检查不执行安装或发布效果。
179
199
 
180
200
  作为开发者或审查者的已配置 Agent 是普通执行资源。把一个真实 provider 或模型作为验证
181
201
  对象则不同:付费 API、共享 Home、生产系统、真实账号额度以及其他不可丢弃的外部效果,
@@ -124,6 +124,8 @@ Agent 可以重新读取任务上下文,继续兼容的 Session,或在必要
124
124
  想直观看进展,可以在另一个终端运行 `yui web`。本地 Web 展示同一份任务与
125
125
  待回答问题,也允许发送消息、回答问题,以及显式 queue、steer 或 interrupt Task 输入。
126
126
  这些经认证的 Task 控制复用 CLI 的相同操作,不是另一套需要同步的任务系统。
127
+ 详情优先展示用户待办、原生会话活动、任务进展和关键结论;固定文件成果与交付证据
128
+ 按需展开。详见[用户关注与进展](../docs/observability/README.zh-CN.md#web-用户关注与进展)。
127
129
  详见 [Web 权限](../docs/architecture/capabilities-and-resources.zh-CN.md#cli-与-web)
128
130
  和[输入时机](../docs/managed-turn-and-session-runtime.zh-CN.md#输入时机queuesteer-与-interrupt)。
129
131
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zq-silk/yui",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
4
4
  "description": "Local control plane for long-running native agent CLI sessions backed by tmux.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -42,11 +42,22 @@ or planning work; the routes below do not override those restrictions.
42
42
  been authorized and is legal. A conversation does not reopen, reactivate or
43
43
  resume execution. If new implementation is requested, identify the needed
44
44
  lifecycle/authority action for the Operator; do not manufacture a Run.
45
+ An explicit same-result follow-up on a completed, unarchived Task can authorize
46
+ the Operator's necessary reopen and submission without a second mechanical
47
+ confirmation. Read the
48
+ [post-completion routing boundary](../yui-runtime/references/publication.md#post-completion-routing-boundary).
49
+ Publication recording/adoption is not a way to start terminal-Task execution.
45
50
 
46
51
  These are instruction routes, not new lifecycle states or a scheduling
47
52
  protocol. Where facts disagree or authority is missing, preserve intent and
48
53
  report the exact boundary rather than choosing a more permissive route.
49
54
 
55
+ A `task-reopened` notification can arrive before its follow-up Message. Read the
56
+ prior completion and current Messages; if only lifecycle changed, wait for the
57
+ new request. Do not rerun accepted work, infer external authority, or immediately
58
+ complete again. Once the scoped request arrives, continue it in this Task without
59
+ asking for another “continue”; preserve the original acceptance evidence.
60
+
50
61
  Handle a failed Worker/Reviewer launch through the shared
51
62
  [configuration recovery guidance](../yui-runtime/references/recovery.md#configuration-and-model-name-failures).
52
63
  Read its original failure and scoped metadata before choosing a correction;
@@ -105,6 +105,11 @@ Honor explicit delegation and independent Review requirements in the user's
105
105
  messages and Task Brief. Neither `next-action` nor a disabled default review
106
106
  policy authorizes dropping them to make completion easier.
107
107
 
108
+ Missing or cyclic dependencies identify conflicting records, not the correct
109
+ business repair. Read the related requirements, preserve valid edges, then
110
+ explicitly revise the intended dependency set or retire genuinely obsolete work.
111
+ Do not clear all dependencies merely to make a mechanical gate pass.
112
+
108
113
  An Integration Job's success is not the final target update. For that
109
114
  notification, read [Integration](integration.md) and continue from its exact
110
115
  evidence; do not start a duplicate operation. Read that guidance also for an
@@ -350,6 +355,12 @@ compare-and-swap boundary.
350
355
  After an authorized PR/MR operation, follow
351
356
  [publication recording](../../yui-runtime/references/publication.md).
352
357
  External delivery and Task completion remain separate facts.
358
+ Keep authorized follow-up delivery of this result in this Task and its legal
359
+ managed workspace: synchronize, resolve necessary conflicts, validate, perform
360
+ only the authorized external operations, and record their exact evidence.
361
+ Do not refer ordinary delivery to a new Task. When remote delivery is part of
362
+ the current requirement, a local commit or completed Run does not satisfy it;
363
+ report a real blocker rather than declaring that requirement complete.
353
364
 
354
365
  After a ReviewRound is terminal, the Leader or authorized Operator owns
355
366
  `task work review cleanup <task>/<round>`. Preserve dirty diagnostic evidence
@@ -372,6 +383,17 @@ yui task complete <task-id> \
372
383
  Completion records the exact Project heads. Archive is a separate,
373
384
  user-authorized Operator action.
374
385
 
386
+ Completion is offline by default. `--refresh-remote` only refreshes remote
387
+ freshness observations; neither path rebases or starts Integration checks.
388
+ For observation alone use `task base status <task> [--refresh]`. If upstream
389
+ changes need integration, choose it explicitly before completion:
390
+ `task upstream integrate <task> (--latest|--project <project>)` requests rebase
391
+ and the configured checks/CAS. Consume its exact Integration/Job and partial
392
+ results; a prepared candidate is not an advanced Task HEAD.
393
+ An established final Review is still prepared/dispatched by completion without
394
+ renewed approval. Inspect the returned stage and exact ReviewRound/Run: a
395
+ Review-pending, running or blocked result is not Task completion.
396
+
375
397
  If completion reports `pending-user-input`, new user intent has not yet reached
376
398
  the current notification window. End this native turn so the next notification
377
399
  can be delivered, then read the original messages and reassess the outcome.
@@ -38,10 +38,14 @@ User/Operator submissions use `--intent record|discuss|develop` on
38
38
  or activate; the routing result is `planned-needs-manual-activation`.
39
39
 
40
40
  Read the returned routing/feedback and current context before taking the next
41
- action. Active submissions do not downgrade or reactivate the Task; terminal
42
- submissions do not reopen it. A stopped execution gate is not permission to
41
+ action. Active submissions do not downgrade or reactivate the Task; ordinary
42
+ terminal-Task submissions are refused, not saved for later execution or used to
43
+ reopen it. A stopped execution gate is not permission to
43
44
  resume. `--request-id <key>` on submissions preserves the original result on a
44
45
  matching retry, not permission to replay uncertain work or change its content.
46
+ For expressly requested continuation of a completed result, use the existing
47
+ [authorized reopen and submission path](../../yui-runtime/references/publication.md#post-completion-routing-boundary),
48
+ not Draft activation or an implicit transition inferred from `--intent develop`.
45
49
 
46
50
  Once planning has been entered, starting delivery requires a distinct,
47
51
  explicit activation authorization. A development remark during discussion,