@zq-silk/yui 2.1.0 → 2.3.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 (135) hide show
  1. package/README.md +8 -2
  2. package/dist/cli/commandCatalog.js +32 -6
  3. package/dist/cli/commandDiscovery.js +4 -1
  4. package/dist/cli/interactionPolicy.js +4 -0
  5. package/dist/cli.js +23 -3078
  6. package/dist/commands/taskCommands.js +84 -28
  7. package/dist/commands/taskIntegrationCommands.js +8 -17
  8. package/dist/commands/taskUpstreamCommands.js +3 -1
  9. package/dist/context/runContextPack.js +132 -5
  10. package/dist/context/sourceRunContext.js +4 -2
  11. package/dist/context/taskContext.js +6 -1
  12. package/dist/controlPlaneCli.js +3099 -0
  13. package/dist/controller/clientRuntime.js +3 -2
  14. package/dist/controller/fileSchedulerStoreAdapter.js +19 -6
  15. package/dist/controller/jobControl.js +21 -0
  16. package/dist/executor/agentExecutor.js +1 -1
  17. package/dist/executor/effectiveLaunch.js +18 -5
  18. package/dist/executor/fileRoleLaunchPlanner.js +15 -19
  19. package/dist/integration/gitIntegrationService.js +58 -82
  20. package/dist/job/jobCleanupInspection.js +67 -0
  21. package/dist/message/messageContinuation.js +7 -2
  22. package/dist/nativeAgent/agent.js +176 -74
  23. package/dist/nativeAgent/cliDemo.js +37 -0
  24. package/dist/nativeAgent/codingTools.js +11 -0
  25. package/dist/nativeAgent/commandTool.js +215 -0
  26. package/dist/nativeAgent/compactionDemo.js +158 -0
  27. package/dist/nativeAgent/composition.js +71 -0
  28. package/dist/nativeAgent/context/budget.js +44 -0
  29. package/dist/nativeAgent/context/index.js +339 -0
  30. package/dist/nativeAgent/context/providerCompressor.js +103 -0
  31. package/dist/nativeAgent/demo.js +12 -1
  32. package/dist/nativeAgent/evaluation/cases.js +38 -0
  33. package/dist/nativeAgent/evaluation/checks.js +91 -0
  34. package/dist/nativeAgent/evaluation/demo.js +19 -0
  35. package/dist/nativeAgent/evaluation/files.js +54 -0
  36. package/dist/nativeAgent/evaluation/fixture.js +36 -0
  37. package/dist/nativeAgent/evaluation/index.js +239 -0
  38. package/dist/nativeAgent/executionOwner.js +209 -0
  39. package/dist/nativeAgent/filePatterns.js +170 -0
  40. package/dist/nativeAgent/fileToolsSupport.js +202 -0
  41. package/dist/nativeAgent/index.js +13 -0
  42. package/dist/nativeAgent/interaction/cli.js +358 -0
  43. package/dist/nativeAgent/interaction/contracts.js +1 -0
  44. package/dist/nativeAgent/interaction/index.js +3 -0
  45. package/dist/nativeAgent/interaction/memoryDemo.js +115 -0
  46. package/dist/nativeAgent/interaction/renderer.js +34 -0
  47. package/dist/nativeAgent/localSafety.js +258 -0
  48. package/dist/nativeAgent/model/anthropicMessages.js +204 -0
  49. package/dist/nativeAgent/model/chatCompletions.js +210 -0
  50. package/dist/nativeAgent/model/errors.js +47 -0
  51. package/dist/nativeAgent/model/gateway.js +423 -0
  52. package/dist/nativeAgent/model/index.js +7 -0
  53. package/dist/nativeAgent/model/observationAdapter.js +21 -0
  54. package/dist/nativeAgent/model/protocols.js +19 -0
  55. package/dist/nativeAgent/model/responses.js +263 -0
  56. package/dist/nativeAgent/model/types.js +1 -0
  57. package/dist/nativeAgent/model/wire.js +73 -0
  58. package/dist/nativeAgent/observability/index.js +220 -0
  59. package/dist/nativeAgent/product/catalog.js +82 -0
  60. package/dist/nativeAgent/product/config.js +295 -0
  61. package/dist/nativeAgent/product/facts.js +30 -0
  62. package/dist/nativeAgent/product/index.js +62 -0
  63. package/dist/nativeAgent/product/location.js +44 -0
  64. package/dist/nativeAgent/product/runtime.js +276 -0
  65. package/dist/nativeAgent/product/storage.js +49 -0
  66. package/dist/nativeAgent/product/tools.js +47 -0
  67. package/dist/nativeAgent/product/transport.js +54 -0
  68. package/dist/nativeAgent/projectGuidance/index.js +425 -0
  69. package/dist/nativeAgent/searchTools.js +305 -0
  70. package/dist/nativeAgent/session/backends.js +293 -0
  71. package/dist/nativeAgent/session/catalog.js +97 -0
  72. package/dist/nativeAgent/session/catalogDemo.js +87 -0
  73. package/dist/nativeAgent/session/contracts.js +1 -0
  74. package/dist/nativeAgent/session/format.js +269 -0
  75. package/dist/nativeAgent/session/index.js +5 -0
  76. package/dist/nativeAgent/session/location.js +36 -0
  77. package/dist/nativeAgent/session/sqliteFormat.js +134 -0
  78. package/dist/nativeAgent/session/store.js +248 -0
  79. package/dist/nativeAgent/textTools.js +270 -133
  80. package/dist/nativeAgent/toolManager/executor.js +290 -0
  81. package/dist/nativeAgent/toolManager/index.js +4 -0
  82. package/dist/nativeAgent/validation.js +2 -2
  83. package/dist/repository/gitWorkspace.js +41 -12
  84. package/dist/repository/taskWorkspaceCoordinator.js +72 -145
  85. package/dist/repository/taskWorkspacePreparer.js +39 -43
  86. package/dist/repository/workspaceCleanupInspection.js +88 -7
  87. package/dist/resources/resourceRegistrar.js +16 -10
  88. package/dist/runtime/integrationRuntimeIsolation.js +21 -0
  89. package/dist/runtime/taskRuntimeIsolation.js +91 -21
  90. package/dist/task/archiveDiagnostics.js +26 -8
  91. package/dist/task/archivePreflight.js +26 -9
  92. package/dist/task/leaderArchive.js +9 -15
  93. package/dist/task/taskAuthority.js +56 -0
  94. package/dist/web/assets/client/api.js +8 -0
  95. package/dist/web/assets/client/app.js +74 -9
  96. package/dist/web/assets/client/components.js +95 -36
  97. package/dist/web/assets/client/detail.js +110 -64
  98. package/dist/web/assets/client/dock.js +95 -11
  99. package/dist/web/assets/client/evidence.js +286 -94
  100. package/dist/web/assets/client/i18n.js +182 -62
  101. package/dist/web/assets/client/overview.js +9 -10
  102. package/dist/web/assets/client/records.js +142 -7
  103. package/dist/web/assets/client/sections.js +234 -198
  104. package/dist/web/assets/client/sidebar.js +31 -2
  105. package/dist/web/assets/icons.js +4 -0
  106. package/dist/web/assets/shell.js +2 -1
  107. package/dist/web/assets/styles/components.js +64 -15
  108. package/dist/web/assets/styles/layout.js +11 -4
  109. package/dist/web/assets/styles/responsive.js +16 -6
  110. package/dist/web/assets/styles/tokens.js +1 -1
  111. package/dist/web/assets/styles/views.js +62 -42
  112. package/dist/web/webServer.js +12 -1
  113. package/dist/web/webTaskSurface.js +8 -1
  114. package/docs/agent-result-consumption.md +16 -0
  115. package/docs/agent-result-consumption.zh-CN.md +13 -0
  116. package/docs/examples/agent-offline.mjs +194 -0
  117. package/docs/native-agent.md +283 -0
  118. package/docs/observability/README.md +13 -3
  119. package/docs/observability/README.zh-CN.md +10 -3
  120. package/docs/release-workflow.md +72 -9
  121. package/docs/release-workflow.zh-CN.md +55 -6
  122. package/docs/roles-and-configuration.md +32 -0
  123. package/docs/roles-and-configuration.zh-CN.md +26 -0
  124. package/docs/task-delivery.md +36 -8
  125. package/docs/task-delivery.zh-CN.md +24 -7
  126. package/i18n/README.zh-CN.md +3 -2
  127. package/package.json +1 -1
  128. package/skills/yui-leader/SKILL.md +9 -0
  129. package/skills/yui-leader/references/execution.md +2 -1
  130. package/skills/yui-leader/references/integration.md +20 -0
  131. package/skills/yui-operator/SKILL.md +4 -0
  132. package/skills/yui-reviewer/SKILL.md +8 -0
  133. package/skills/yui-runtime/SKILL.md +11 -0
  134. package/skills/yui-runtime/references/publication.md +20 -4
  135. package/skills/yui-worker/SKILL.md +3 -0
@@ -27,12 +27,61 @@ Agent 选择一个预先声明的计划,设施从持久状态驱动该计划
27
27
  发布 npm;每项外部效果仍需 Task 的实际授权。仅包含 PR、CI 和合并步骤也是合法的交付
28
28
  计划,`ReleaseWorkflow` 这个名称不授予包发布、全局 CLI 更新或 Controller 替换权限。
29
29
 
30
- 用户明确要求「发布新版本」但没有指定级别时,根据实际变更和项目版本规则,仅选择
31
- minor(中版本)或 patch(小版本)。major(大版本)必须得到用户对大版本或具体 major
32
- 版本号的明确授权。如果破坏性变更无法诚实地用 minor/patch 表达,说明兼容性冲突,
33
- 等待必要的明确用户选择:既不能静默发布 major,也不能把不兼容行为冒称为兼容。
34
- 这不要求为了回避选择而新增历史兼容机制。包发布版本与存储迁移版本是不同契约,
35
- 下文的存储规则不授予包发布权限。
30
+ 用户明确要求「发布新版本」时,新功能或接口/行为不兼容变更使用 minor(中版本),
31
+ 纯兼容修复可使用 patch(小版本)。不兼容本身不要求 major 或再次确认版本级别;
32
+ 只有用户明确要求 major(大版本)时才发布 major。
33
+
34
+ 这是 Yui 项目专属的编号约定,不是通常 SemVer 的向后兼容承诺:minor 也可能不兼容。
35
+ 用户升级前应阅读兼容性及迁移说明;发布说明必须列明受影响的契约与新接口用法,
36
+ 不能将不兼容冒称为兼容,也不为回避版本选择新增历史兼容机制。包版本与协议、
37
+ 持久存储契约仍然独立:兼容性检查和必要迁移要求不变,下文存储规则不授予发版权限。
38
+
39
+ ### 2.3.0 兼容性及迁移说明
40
+
41
+ 本次 minor 将 Task 验收与已核验的远端交付、不可变 Integration 历史、
42
+ 临时工作区清理分开。释放工作区后,Integration 历史仍可读取。
43
+
44
+ 此前把残留工作区一律视为归档阻塞的自动化,现在应分别检查业务结算、
45
+ 精确交付与运行时静默,以及物理清理结果。普通归档按子资源优先释放安全资源,
46
+ 保留脏、未知或仍存活的资源及其所有权、诊断。`--force` 需要单独明确授权;
47
+ 它不证明交付或静默,也不允许丢弃被保留的数据。
48
+
49
+ 普通 Integration 冲突应在原 attempt 的工作区解决并 stage,然后执行
50
+ `yui task integration continue <task>/<integration>`。不要仅因普通 Git 冲突
51
+ 另建 attempt 或要求 manual-resolution 决策。清理依赖精确所有权与 Git 登记;
52
+ 路径缺失本身不代表清理完成。
53
+
54
+ 这些是 Yui minor 编号约定下的行为变化。2.3.0 没有新的持久 schema 或存储迁移,
55
+ 保留现有 Task 与 Integration 证据。发布包本身不会安装全局 CLI、激活运行时
56
+ 或重启 Controller。从 2.1.0 升级的用户还需遵循下文 2.2.0 API 指引。
57
+
58
+ ### 2.2.0 兼容性及迁移说明
59
+
60
+ 本 minor 增加独立 `yui agent` 入口、显式模型/工具配置、持久本地会话、上下文压缩、
61
+ 离线评估,以及 Task 交接/Leader 写域修复和 Web 布局改善。
62
+
63
+ 2.1.0 独立 Agent 的公开 `createAgent({ onEvent })` 已被替换。
64
+ JavaScript 调用方继续传入 `onEvent` 时不会再触发该回调,Turn 仍可能完成,
65
+ 但事实仅保留在内存中。升级前必须调整调用方;虽然编号为 minor,这仍是不兼容变化。
66
+
67
+ 必要的有序记录使用 `recorder.record`:内核等待记录确认,拒绝会停止新增效果。
68
+ 可选展示/遥测使用同步 `observer.observe`:失败写入 `observerErrors`,不停止 Turn。
69
+ Observer 必须自行排队异步工作,不能返回 Promise。旧异步持久化回调应改为:
70
+
71
+ ```js
72
+ const agent = createAgent({
73
+ provider,
74
+ tools,
75
+ recorder: { record: persistEvent }, // async (event) => { await durableWrite(event); }
76
+ observer: { observe: renderEvent }, // 可选,同步
77
+ });
78
+ ```
79
+
80
+ 检查 `result.recording` 的记录证据及 `result.error`;记录失败代码由
81
+ `event_sink_failed` 改为 `recording_failed`。不要把必要持久化放入 Observer。
82
+ 已有 Task 和历史报告仍可读取,但新 Review 必须有冻结 Candidate/原报告证据,
83
+ 缺少的历史证据不会自动补造。上下文超预算时,压缩需要显式 compressor。
84
+ 上述说明不授予全局 CLI 安装、Home 迁移或 Controller 重启权限。
36
85
 
37
86
  下文操作及示例说明如何执行已经获授权的效果,不是 Task 完成或合并后默认运行的步骤。
38
87
 
@@ -62,6 +62,38 @@ different contracts. Provider bypass does not grant writes to another Project.
62
62
  Managed workspace owner, exact Assignment and resource grants enforce Yui
63
63
  operations; broad native permissions are not an OS sandbox.
64
64
 
65
+ A write-intent delivery Leader launched in its own Task-owned main workspace
66
+ captures that workspace's bound writable Projects without needing an open
67
+ WorkItem. Accepted results do not remove this direct-delivery scope. An explicit
68
+ Assignment (including an empty write scope) remains authoritative for assigned
69
+ execution. Planning, read-intent execution and global Roles do not acquire this
70
+ Task-main scope; Reviewer writes remain confined to their exact Review workspace.
71
+ Project effects recheck the current Session's frozen scope as well as Task
72
+ lifecycle and workspace ownership. The scope does not authorize stable Project
73
+ checkouts, other Tasks, private Worker/Review workspaces or Home mutations.
74
+
75
+ Managed Leader Integration targets must name the Task-main branch, and that
76
+ branch must actually be checked out in the captured Task-main directory.
77
+ Admission, checks and target CAS revalidate this boundary; `--target` does not
78
+ grant access to another worktree in the same repository.
79
+
80
+ `integration abort` may confirm an already-applied CAS as committed without
81
+ granting new Project writes. It still verifies current delivery identity,
82
+ captured Task-main ownership, actual checkout, candidate and check/Job evidence.
83
+ An unadvanced CAS remains a Project effect and requires the full write scope.
84
+
85
+ An existing empty-scope Session stays empty after a runtime update, including
86
+ ordinary failed-Run retries. Resume cannot change captured Profile access or
87
+ Project write scope. Inspect
88
+ `yui task role session inspect <task> leader --json` (`session.effective`), then
89
+ request `yui task role session new <task> leader --reason "<adopt new scope>"`.
90
+ When replacing your own Session, end the turn. After Yui confirms cleanup and
91
+ launches the successor, inspect its captured `executionAuthority`,
92
+ `profileAccess`, `writeProjectIds` and workspace before editing. A replacement
93
+ request is not proof of adoption. Exact Run Context and launch environment
94
+ derive their write scope from the same frozen effective snapshot; models,
95
+ effort, accepted Candidates and their acceptance history are unchanged.
96
+
65
97
  Yui supplies its generic Role Skills and Context pointers. Project Skills remain
66
98
  ordinary Project files discovered natively by the Agent. Project Knowledge is
67
99
  maintained under `YUI_HOME`; copying repository material into a prompt does not
@@ -52,6 +52,32 @@ Provider 权限策略、Profile 访问意图和 Project 写范围是不同的合
52
52
  不授予对另一个 Project 的写入。受管工作区 owner、精确 Assignment 和资源 grant
53
53
  落实 Yui 操作;宽泛的原生权限不是 OS 沙箱。
54
54
 
55
+ 以 write 意图在自己 Task-owned main 工作区启动的 delivery Leader,从该工作区
56
+ 捕获已绑定 Project 的写域,不要求存在 open WorkItem;已接受结果也不会移除这个
57
+ 直接交付写域。显式 Assignment(包括空写域)仍决定受派发执行的范围。
58
+ Planning、read 意图执行和全局 Role 不获得这个 Task-main 写域;Reviewer 仍只可写
59
+ 精确的 Review 工作区。Project 实际操作重新校验当前 Session 的冻结写域、Task
60
+ 生命周期和工作区 owner;它不授权稳定 Project checkout、其他 Task、私有
61
+ Worker/Review 工作区或 Home 修改。
62
+
63
+ 受管 Leader 的 Integration 目标必须是 Task-main 分支,且该分支实际 checkout
64
+ 在捕获的 Task-main 目录。入场、检查及目标 CAS 都重新校验此边界;
65
+ `--target` 不授予对同仓库另一工作区的写入。
66
+
67
+ `integration abort` 可以把已发生的 CAS 确认为 committed,而不授予新项目写域。
68
+ 结算仍校验当前 delivery 身份、捕获的 Task-main 归属、实际 checkout、
69
+ 候选及检查/Job 证据。未执行的 CAS 仍是项目写操作,必须具备完整写域。
70
+
71
+ 运行时更新后,旧的空写域 Session 仍保持空域,包括失败 Run 的普通 retry。
72
+ Resume 不改变捕获的 Profile 访问意图或项目写域。先用
73
+ `yui task role session inspect <task> leader --json` 读取 `session.effective`,
74
+ 再通过 `yui task role session new <task> leader --reason "<采用新写域>"`
75
+ 请求正式替换。替换自己时应结束当前 turn。Yui 确认清理并启动 successor 后,
76
+ 读回其 `executionAuthority`、`profileAccess`、`writeProjectIds` 和 workspace,
77
+ 确认后再编辑;替换请求本身不证明采用成功。精确 Run Context 与启动环境从同一
78
+ 冻结 effective snapshot 取得写域;模型、effort、accepted Candidate 和原验收
79
+ 历史保持不变。
80
+
55
81
  Yui 提供其通用 Role Skill 和 Context 指针。Project Skill 仍是由 Agent 原生发现的
56
82
  普通 Project 文件。Project Knowledge 维护在 `YUI_HOME` 下;把仓库材料复制进 prompt
57
83
  并不使其成为权威 Knowledge。
@@ -305,17 +305,21 @@ yui task archive <task> (--integrated|--abandon) --force
305
305
 
306
306
  ### Ordinary archive
307
307
 
308
- Active work and inputs must be settled, and managed resources clean and safely
309
- removable. WorkItem results must be integrated or deliberately abandoned;
308
+ Active work and inputs must be settled, and execution proven stopped.
309
+ WorkItem results must be integrated or deliberately abandoned;
310
310
  Review, Lane and Integration resources must be settled. With `--integrated`,
311
311
  each Project requiring code delivery needs a merged, verified Publication
312
312
  covering its accepted head, either exactly or through valid explicit candidate
313
313
  adoption. `--abandon` records deliberate non-delivery,
314
314
  not verified merge.
315
315
 
316
- Missing/stale coverage, unresolved execution or dirty worktrees prevent ordinary
317
- archive. Resolve the reported facts before an explicit retry; no implicit reset
316
+ Missing/stale coverage or unresolved execution prevents ordinary archive.
317
+ Dirty or otherwise unsafe temporary resources are retained after the logical
318
+ archive commit; they do not require force merely to archive. No implicit reset
318
319
  or force deletion occurs.
320
+ For `--abandon`, a clean Task-main at its exact recorded Project baseline can
321
+ be released without a Publication. New unverified commits remain protected.
322
+ Pending or running Reviews are unsettled business, not just retained directories.
319
323
 
320
324
  ### Explicit force archive
321
325
 
@@ -345,11 +349,22 @@ current ownership, not a second cleanup queue.
345
349
  An archive result with `archived=true` proves archival, not that cleanup fully
346
350
  succeeded. Even `cleanupFinished` means the foreground pass finished, not that
347
351
  every resource was removed. Repeating archive reports current facts and does
348
- not replay cleanup. After inspection, use explicit exact-owner resource
349
- operations for safe cleanup; no background retry or broader deletion authority
352
+ not replay cleanup. After inspection, use `yui task archive-cleanup <task>` to
353
+ retry safe exact-owner cleanup. `allResourcesReleased` reports the current pass
354
+ and remaining ownership separately from historical warnings; no background retry or broader deletion authority
350
355
  is implied. Both archive paths preserve Task history and recovery information.
351
356
  Archived Tasks cannot reopen.
352
357
 
358
+ Interrupted runtime cleanup may leave an adjacent `.cleanup-*` directory.
359
+ Retries inspect these claims as well as the original path: only an exact Owner
360
+ marker and no live process references permit deletion. Missing or mismatched
361
+ markers remain retained with their path for explicit diagnosis; absence of the
362
+ original directory alone never proves release. Unresolved claims also prevent
363
+ reactivating the same runtime. Executed-Job physical checks use that same claim
364
+ inventory before ordinary archive commits; acknowledgement does not bypass a
365
+ live or unverified renamed runtime. This uses the existing resource owner and receipt,
366
+ not a second cleanup queue.
367
+
353
368
  Resource GC is a separate, opt-in quarantine path. A runtime subtree moves once:
354
369
  the parent receipt owns recovery of its contents, and redundant child registry
355
370
  entries are removed in the same registry transaction. Independently owned Git
@@ -411,8 +426,21 @@ Preflight is an observation, not a removal permit. Cleanup reloads the same
411
426
  checks and Git verifies ownership/dirt again at removal. A Task-main clone's
412
427
  dependent registrations are expected before child cleanup and must be absent
413
428
  before clone removal. Archive preserves new dirt even in a failed Integration
414
- workspace; the separate explicit Integration cleanup command keeps its existing
415
- disposable-conflict behavior. A finished force cleanup means the foreground
429
+ workspace; explicit Integration cleanup also preserves dirt and durable logs.
430
+ An acknowledged unknown Job result remains unknown: cleanup additionally needs
431
+ fresh evidence that its exact runner generation and physical path references
432
+ are absent. Successful, failed, timed-out and cancelled executed Jobs need the
433
+ same physical evidence; a terminal result does not prove surviving children
434
+ stopped. Only Jobs cancelled/rejected before any execution effect bypass it.
435
+ Cleanup first checks Job results and exact runner exit, then stops only settled,
436
+ exactly owned Roles. It repeats full path-reference checks after that stop and
437
+ before deleting any child workspace or committing ordinary archive. An idle
438
+ reusable Role sharing the workspace is not itself a reason to skip its normal
439
+ stop; surviving or unverified references still prevent release.
440
+ Integration resource preflight also checks runtime ownership and cleanup claims
441
+ with the deletion inspector. Unverified physical material is retained without
442
+ turning it into a new ordinary-archive business gate.
443
+ A finished cleanup means the foreground
416
444
  attempt ended, not that every resource was released. Current retained references
417
445
  and exact physical runtime evidence remain separate from historical diagnostics.
418
446
 
@@ -138,7 +138,7 @@ Review 时跳过刷新,该新鲜度字段为 null。重复完成不重新观
138
138
  干净且已提交的 Task-main 快照。当有一条新的 user/Operator 消息仍在等待 Leader
139
139
  投递时,它也会拒绝完成。当前原生轮次必须结束,待处理的通知才能到达;随后 Leader
140
140
  读取原始消息并重新评估完成。这派生自既有的 Message 和 mailbox 投递,而不是第二套
141
- 确认或工作流状态。终态工作区清理在完成时可以只是建议。普通归档要求清理已结算;
141
+ 确认或工作流状态。终态工作区清理在完成时可以只是建议。普通归档要求业务及执行已结算;
142
142
  明确授权的 force 归档可以保留下文所述的未解决资源。被选作结果的 Artifact 必须是
143
143
  固定的、存在的且 Task 局部的。
144
144
 
@@ -235,13 +235,15 @@ yui task archive <task> (--integrated|--abandon) --force
235
235
 
236
236
  ### 普通归档
237
237
 
238
- 活动工作与输入必须已了结,受管资源干净且可安全移除。WorkItem 结果必须已集成或
238
+ 活动工作与输入必须已了结,并证明执行已停止。WorkItem 结果必须已集成或
239
239
  有意放弃;Review、Lane 和 Integration 资源必须已结算。使用 `--integrated` 时,
240
240
  每个需要代码交付的 Project 都要求已合并且已验证的 Publication,通过精确匹配
241
241
  或有效显式采用候选覆盖其验收 head。`--abandon` 记录有意不交付,而不是已验证合并。
242
242
 
243
- 缺失或陈旧的覆盖、未解决的执行或脏 worktree 会阻止普通归档。先解决报告的事实,
244
- 再显式重试;不会隐式 reset 或强制删除。
243
+ 缺失或陈旧的覆盖、未解决的执行会阻止普通归档。脏 worktree 或其他无法安全移除的
244
+ 临时资源在逻辑归档后保留,不会仅因这些残留而要求 force;不会隐式 reset 或强制删除。
245
+ `--abandon` 可释放 HEAD 精确等于已记录 Project 基线的干净 Task-main,无需 Publication;
246
+ 未验证的新增提交仍保留。pending/running Review 属于未结清业务,而不只是保留目录。
245
247
 
246
248
  ### 明确授权的 force 归档
247
249
 
@@ -265,9 +267,17 @@ Force 不验证合并、不验收工作、不证明物理静止、不丢弃脏
265
267
 
266
268
  归档结果中的 `archived=true` 证明已归档,不证明清理全部成功。即使 `cleanupFinished`
267
269
  也只代表前台清理已走完,不代表资源全部移除。重复归档只报告当前事实,不重放清理。
268
- 检查后通过显式的精确 owner 资源操作进行安全清理;不隐含后台重试或更广泛的删除
270
+ 检查后通过 `yui task archive-cleanup <task>` 显式重试精确 owner 的安全清理。
271
+ `allResourcesReleased` 将当前轮次及剩余所有权与历史警告分开报告;不隐含后台重试或更广泛的删除
269
272
  权限。两条归档路径都保留 Task 历史与恢复信息。已归档的 Task 不能重开。
270
273
 
274
+ runtime 清理中断可能留下相邻的 `.cleanup-*` 认领目录。重试同时检查这些目录和原路径,
275
+ 只有 Owner marker 精确匹配且没有存活进程引用时才删除。marker 缺失或不匹配时保留目录,
276
+ 并给出路径供显式诊断;原目录不存在本身不证明资源已释放。未解决的认领也阻止同一 runtime
277
+ 重新激活。此过程复用已有资源 owner 和回执,不引入第二套清理队列。
278
+ 实际启动过的 Job 的物理检查在普通归档提交前复用同一认领目录清单;
279
+ 确认未知结果不能跳过仍被进程引用或无法核实的重命名 runtime。
280
+
271
281
  资源 GC 是独立、显式启用的隔离路径。同一 runtime 子树只移动一次,由父目录
272
282
  回执负责恢复完整内容;重复的子目录 registry 记录在同一事务内移除。
273
283
  独立 Git worktree 或仍需保留的子资源会阻止移动其父目录,不删除 Task 记录或成果。
@@ -311,8 +321,15 @@ Task Leader reader 也可读取。这里的 `--force` 仅选择要检查的行
311
321
 
312
322
  预检是观察,不是删除凭据。清理会重新读取同一组检查,Git 删除时再验证身份和脏状态。
313
323
  Task-main clone 在子工作区清理前存在关联 Git 注册是正常现象,但移除 clone 前它们必须
314
- 已释放。归档会保留失败 Integration 工作区中新出现的脏文件;独立的显式 Integration
315
- 清理命令保留既有的可丢弃冲突现场合同。force 清理完成只表示这次前台尝试结束,不表示
324
+ 已释放。归档与独立的显式 Integration 清理均保留脏文件和持久日志。
325
+ 确认 unknown Job 不会改写其未知结果;清理还需重新验证精确 runner 进程代次及物理路径引用
326
+ 均已消失。成功、失败、超时或取消的已执行 Job 也要求同样的物理证据;终态结果不能证明
327
+ 存活子进程已停止。只有执行产生任何效果前已取消或拒绝的 Job 可跳过检查。
328
+ 清理先检查 Job 结果与精确 runner 退出,再停止执行已结算且归属精确的 Role;
329
+ 停止后、删除任何子工作区或提交普通归档前,重新执行完整路径引用检查。
330
+ 共享工作区的可复用空闲 Role 可以进入正常停止流程;残留或无法核实的引用仍阻止释放。
331
+ Integration 资源预检与删除共享 runtime 归属和认领目录检查;无法验证的物理材料保留,
332
+ 不会因此新增普通归档的业务准入门槛。清理完成只表示这次前台尝试结束,不表示
316
333
  全部资源已释放;当前保留引用、精确物理运行时证据与历史诊断仍是不同事实。
317
334
 
318
335
  清理前用每个命令的 `--help` 查看它确切的权限和选项;阅读一份生命周期文档不授权
@@ -137,8 +137,9 @@ Agent 可以重新读取任务上下文,继续兼容的 Session,或在必要
137
137
  想直观看进展,可以在另一个终端运行 `yui web`。本地 Web 展示同一份任务与
138
138
  待回答问题,也允许发送消息、回答问题,以及显式 queue、steer 或 interrupt Task 输入。
139
139
  这些经认证的 Task 控制复用 CLI 的相同操作,不是另一套需要同步的任务系统。
140
- 详情优先展示用户待办、原生会话活动、任务进展和关键结论;固定文件成果与交付证据
141
- 按需展开。详见[用户关注与进展](../docs/observability/README.zh-CN.md#web-用户关注与进展)。
140
+ 详情分为四个页签:概览(用户待办、任务进展和关键决定)、交付(工作项、评审、
141
+ 集成与远程交付,按需读取)、运行(Role、原生会话活动、进行中的执行和用量)、
142
+ 记录(决定、里程碑、执行与问题的时间线)。详见[用户关注与进展](../docs/observability/README.zh-CN.md#web-用户关注与进展)。
142
143
  详见 [Web 权限](../docs/architecture/capabilities-and-resources.zh-CN.md#cli-与-web)
143
144
  和[输入时机](../docs/managed-turn-and-session-runtime.zh-CN.md#输入时机queuesteer-与-interrupt)。
144
145
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zq-silk/yui",
3
- "version": "2.1.0",
3
+ "version": "2.3.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,6 +19,15 @@ not copied reports. Follow Runtime's `nextCursor` and `contentPage` rules:
19
19
  read the full relevant window and originals before disposition, without
20
20
  unconditionally walking unrelated history.
21
21
 
22
+ Before WorkItem dispatch, put the complete bounded requirements in the WorkItem
23
+ or explicitly select up to 16 relevant readable materials with repeated
24
+ `--context-ref <store/refId@digest>` on `task work dispatch`. Obtain exact IDs and
25
+ digests from current Task context list/inspect. Core freezes these selected
26
+ values after the existing caller-scope checks; mentioning a record in `--input`
27
+ does not select it or grant access. Missing, forbidden or changed references
28
+ refuse dispatch before Provider startup: correct the selection or make the
29
+ WorkItem self-contained, never ask the recipient to bypass expansion rejection.
30
+
22
31
  ## Select the applicable stage
23
32
 
24
33
  Use current lifecycle, latest intent and the Session's actual planning/delivery
@@ -378,7 +378,8 @@ After a ReviewRound is terminal, the Leader or authorized Operator owns
378
378
  `task work review cleanup <task>/<round>`. Preserve dirty diagnostic evidence
379
379
  and resolve it explicitly; do not ask a Reviewer to clean its own runtime
380
380
  after its final report. Cleanup can remain advisory at completion. Ordinary
381
- archive requires settled resources; explicitly authorized force archive preserves
381
+ archive requires settled business and stopped execution, not complete physical
382
+ release; safe resource retention is reported separately. Explicitly authorized force archive preserves
382
383
  unresolved resources and diagnostics under the shared
383
384
  [archive contract](../../yui-runtime/references/publication.md). The Leader
384
385
  does not gain independent archive authorization. An original explicit user
@@ -33,6 +33,10 @@ the files there, then run `integration continue`. No preceding
33
33
  `resolve --option manual-resolution` is required for an ordinary conflict.
34
34
  Core completes the matching Git operation, records the candidate, runs or
35
35
  recovers its exact checks and advances the original target by CAS.
36
+ Keep that same attempt for ordinary resolution and record its rationale in
37
+ the existing resolution/report evidence. A detached HEAD during a matching
38
+ rebase is normal. Start another attempt only for a real input/baseline change
39
+ or evidenced inability to resume safely, explaining that decision.
36
40
 
37
41
  Do not close the Task execution gate, stop unrelated work, create an
38
42
  InputRequest or end in passive waiting merely because Git conflicted.
@@ -86,6 +90,22 @@ Inspect all Jobs owned by the exact attempt, including an unbound Job;
86
90
  cancel and establish quiescence by exact identity before reusing or cleaning
87
91
  resources. Successful Job evidence and Task acceptance remain separate.
88
92
 
93
+ After terminal settlement, `task integration cleanup <task>/<integration>`
94
+ can release clean exact-owner temporary resources without waiting for Task
95
+ archive. Save necessary reports in Task artifacts/results first. Cleanup
96
+ preserves the attempt, fixed checks/logs and target receipts. Failure or abort
97
+ never authorizes deleting uncommitted resolutions; preserve dirty material
98
+ and resolve its disposition explicitly. Acknowledging an unknown Job is not
99
+ physical stop evidence: cleanup also rechecks the recorded runner generation
100
+ and physical workspace/log/runtime references. When those are proven absent,
101
+ the acknowledged unknown result remains historical evidence, not a permanent
102
+ physical-cleanup blocker.
103
+ The same physical checks apply to every executed terminal Job, including a
104
+ successful one: surviving child processes are not stopped by a result receipt.
105
+ Integration resource preflight includes runtime ownership and renamed cleanup
106
+ claims; retain unverified material for diagnosis without inferring new deletion
107
+ authority from Task archive admission.
108
+
89
109
  Direct Task-main delivery is an alternative only when current delivery
90
110
  authority, ownership and the Task contract already permit it, with no other
91
111
  writer or active check using that workspace. Do not edit managed refs or the
@@ -268,6 +268,10 @@ After an authorized PR/MR operation or before archive, read
268
268
  [publication and archive boundaries](../yui-runtime/references/publication.md).
269
269
  Record confirmed delivery facts promptly. Completion does not authorize
270
270
  archive, and ordinary archive approval does not authorize `--force`.
271
+ Distinguish settled business and stopped execution from safely retained
272
+ physical resources. Ordinary archive may retain the latter; follow the shared
273
+ archive diagnostics and exact cleanup actions instead of requesting force
274
+ merely for old terminal Integration worktrees or preserved diagnostics.
271
275
  When the user explicitly authorizes force archive for an eligible terminal
272
276
  Task, archive even if delivery proof or cleanup is incomplete. Report the
273
277
  warnings and retained resources without claiming merge verification or physical
@@ -28,6 +28,11 @@ WorkItem Develop workspace, and never become a ChangeSet source.
28
28
 
29
29
  For a dispatched Review, the AgentRun Context Pack identifies the ReviewRound,
30
30
  frozen Project commits, and assigned workspace. Inspect those exact commits.
31
+ For a Run-backed Candidate, read its frozen `source-run` reference whose
32
+ `evidenceOf` names that Candidate, including every content page of the original
33
+ report. A summary or a newer Run is not a replacement. Missing historical
34
+ evidence is a bounded infrastructure diagnosis, not permission to read outside
35
+ the inventory or require the Leader to manually copy a report.
31
36
  The current mutable Task-main checkout is context only and must never replace,
32
37
  widen, or silently update the assigned Review scope.
33
38
 
@@ -99,6 +104,9 @@ judgment; it does not accept the WorkItem or complete the Task. Preserve the
99
104
  ReviewRound record and workspace, and report any diagnostic changes. After
100
105
  the Round is terminal, an authorized Leader or Operator owns cleanup through
101
106
  Yui; do not attempt to terminate or delete your own managed runtime/workspace.
107
+ Keep scratch in the supplied runtime `TMPDIR` and put required diagnostic
108
+ evidence in durable results/artifacts; resource release must not erase the
109
+ frozen Review or its original report.
102
110
 
103
111
  A helpful default result layout is Conclusion, Material findings, Verification,
104
112
  Uncertainty, and Recommended next action. Markdown or JSON are both acceptable.
@@ -26,6 +26,10 @@ resource boundaries still apply; a planning Session does not gain delivery
26
26
  authority merely because the Task becomes active.
27
27
  Use the runtime-provided `TMPDIR` for temporary context or diagnostic files,
28
28
  not fixed shared `/tmp` names or the logical multi-Project workspace container.
29
+ Save durable reports in Task artifacts/results before releasing their temporary
30
+ workspace. Integration history and check evidence outlive its worktree; a
31
+ terminal attempt is not an unresolved business input merely because resources
32
+ remain. Cleanup inspects exact ownership and preserves unknown or dirty data.
29
33
 
30
34
  Ordinary commands use `yui` from the intended launch environment's PATH and
31
35
  `YUI_HOME`. Session/native identity, Task/Assignment/workspace authority and
@@ -178,6 +182,13 @@ public view. This offline view is only guidance, not an authenticated permission
178
182
  or a way to switch Roles. An incomplete or stale managed identity must not be
179
183
  cleared to obtain public execution authority.
180
184
 
185
+ For Codex, the native `CODEX_THREAD_ID` takes precedence over the transport's
186
+ `YUI_NATIVE_SESSION_ID`; a newly created thread can legitimately lack the latter.
187
+ Other adapters do not borrow Codex identity for offline discovery. A missing
188
+ transport variable or hidden help entry alone does not prove Session failure.
189
+ Discovery does not establish that a Session is current: actual execution still
190
+ revalidates Session, Task/Assignment, workspace, resource and Grant boundaries.
191
+
181
192
  When capability discovery appears in that view, use `capability search` for
182
193
  templates and `capability describe <name> --task
183
194
  <task-id> --input '<json>'` for supported exact authorization assessments.
@@ -94,6 +94,14 @@ the exact Task, checks archive eligibility, then uses `--integrated` for verifie
94
94
  merged delivery or `--abandon` for deliberate non-delivery. General archive
95
95
  approval never implies `--force` authority. Preserve the Task record.
96
96
 
97
+ Ordinary archive requires settled business, exact delivery (or authorized
98
+ abandonment), and proven stopped execution. It commits logical archive before
99
+ one foreground resource cleanup. Safe physical retention—dirty diagnostics,
100
+ missing-path recovery gaps, or remaining Git registrations—is not a reason to
101
+ force archive or rewrite old Integration outcomes. Terminal failed/superseded
102
+ Integration history stays readable; an active/conflicted attempt or unknown
103
+ execution still requires settlement.
104
+
97
105
  With explicit force authorization for a completed or cancelled (retired) Task, use
98
106
  `yui task archive <task> (--integrated|--abandon) --force`. Force commits the
99
107
  archive and stops new Task scheduling before attempting safe foreground cleanup.
@@ -108,10 +116,18 @@ cannot be safely released stay owned and traceable. Late runtime events remain
108
116
  source evidence, not authority to resume or settle unknown input.
109
117
 
110
118
  Read `task show <task> --json` for `data.archive.warnings`,
111
- `data.archive.retainedResources` and `data.archive.cleanupEvents`;
112
- `task context` also retains the original records/events. A successful archive
119
+ `data.archive.retainedResources` and `data.archive.cleanupEvents`. These bounded
120
+ views include counts and inspection actions; read the existing paginated
121
+ `task event list` and Task context resource inventory for omitted evidence.
122
+ A successful archive
113
123
  exit means `archived=true`, not that cleanup fully succeeded. `cleanupFinished`
114
124
  means the foreground pass finished, not that every resource was removed.
125
+ `allResourcesReleased` separately requires release evidence and no retained
126
+ resources. Historical warnings do not disappear after a successful later pass.
115
127
  If cleanup was interrupted, the Task stays archived. Repeating archive only
116
- reports current facts; use explicit, exact-owner resource operations after
117
- inspection instead of re-running broad cleanup. No background retry is implied.
128
+ reports current facts. After inspecting the exact retained owner/reason, use
129
+ `task archive-cleanup <task>` for one new bounded pass, or the reported
130
+ WorkItem/Review/Integration cleanup entry. Every pass rechecks current identity,
131
+ runtime and Git registration facts; it is not an atomic batch and does not
132
+ discard unknown material. Registry-only remnants require the existing resource
133
+ inspection route, not a global `worktree prune`. No background retry is implied.
@@ -109,3 +109,6 @@ reject it for missing headings or invalid JSON.
109
109
 
110
110
  Leave managed workspaces intact after handoff. Their owner lifecycle and
111
111
  cleanup belong to the Leader and Yui Core.
112
+ Keep disposable tools/cache in the supplied runtime `TMPDIR`, not the logical
113
+ multi-Project container. Preserve required handoff evidence in durable
114
+ results/artifacts before its temporary workspace is released.