@zq-silk/yui 0.15.9 → 0.15.12

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 (160) hide show
  1. package/ARCHITECTURE.md +8 -4
  2. package/ARCHITECTURE.zh-CN.md +5 -2
  3. package/README.md +13 -5
  4. package/dist/agent/launchEnvironment.js +7 -0
  5. package/dist/agentRun/agentRun.js +3 -0
  6. package/dist/cli/commandCatalog.js +64 -16
  7. package/dist/cli/interactionPolicy.js +7 -3
  8. package/dist/cli/managedDiagnostics.js +1 -1
  9. package/dist/cli/updateOrchestrator.js +24 -1
  10. package/dist/cli/updatePorts.js +7 -3
  11. package/dist/cli/upgradeCommand.js +42 -2
  12. package/dist/cli.js +381 -107
  13. package/dist/commands/executionAuditCommands.js +10 -0
  14. package/dist/commands/globalRoleCommands.js +339 -4
  15. package/dist/commands/projectCommands.js +50 -22
  16. package/dist/commands/releaseCommands.js +18 -0
  17. package/dist/commands/taskActor.js +25 -0
  18. package/dist/commands/taskCommands.js +586 -96
  19. package/dist/commands/taskIntegrationCommands.js +19 -39
  20. package/dist/commands/taskIntegrationQueueCommands.js +1 -1
  21. package/dist/commands/taskOverviewCommand.js +4 -3
  22. package/dist/commands/taskPublicationAdoptCommand.js +127 -0
  23. package/dist/commands/taskPublicationCommands.js +11 -2
  24. package/dist/commands/taskPublicationVerifyCommand.js +23 -39
  25. package/dist/commands/taskRemoteDeliveryCommand.js +22 -11
  26. package/dist/commands/taskRoleRuntimeStatus.js +35 -0
  27. package/dist/context/runContextPack.js +3 -0
  28. package/dist/context/taskCatalog.js +187 -0
  29. package/dist/context/taskContext.js +55 -6
  30. package/dist/controller/agentHostObservation.js +155 -0
  31. package/dist/controller/clientRuntime.js +17 -2
  32. package/dist/controller/controller.js +14 -2
  33. package/dist/controller/fileSchedulerStoreAdapter.js +519 -25
  34. package/dist/controller/globalInputDelivery.js +132 -0
  35. package/dist/controller/jobControl.js +6 -2
  36. package/dist/controller/providerRetryAdmission.js +100 -0
  37. package/dist/controller/providerRetryDelivery.js +218 -0
  38. package/dist/controller/resourceInventory.js +14 -4
  39. package/dist/controller/resourceInventoryLinux.js +2 -6
  40. package/dist/controller/runtime.js +117 -7
  41. package/dist/controller/runtimeEventInbox.js +32 -3
  42. package/dist/controller/runtimeEventProcessor.js +26 -6
  43. package/dist/controller/runtimeHookRunFence.js +75 -19
  44. package/dist/controller/structuredProviderObservation.js +133 -70
  45. package/dist/coordination/workMailboxQueue.js +5 -0
  46. package/dist/execution/workItemExecutionProjection.js +1 -1
  47. package/dist/executor/agentExecutor.js +64 -4
  48. package/dist/executor/executorRegistry.js +3 -0
  49. package/dist/executor/fileRoleLaunchPlanner.js +78 -118
  50. package/dist/integration/deliveryObligation.js +2 -1
  51. package/dist/integration/gitIntegrationService.js +329 -386
  52. package/dist/integration/integrationAttempt.js +30 -4
  53. package/dist/integration/integrationQueueService.js +7 -7
  54. package/dist/integration/integrationSourceApplication.js +323 -0
  55. package/dist/lifecycle/exactRunTerminalization.js +4 -1
  56. package/dist/message/globalInterrupt.js +33 -0
  57. package/dist/message/globalProviderRetry.js +15 -0
  58. package/dist/message/inputControlResolution.js +106 -0
  59. package/dist/message/message.js +367 -0
  60. package/dist/message/messageContinuation.js +126 -3
  61. package/dist/message/taskInterrupt.js +34 -0
  62. package/dist/observability/executionAudit.js +19 -0
  63. package/dist/observability/orchestrationMetrics.js +1 -1
  64. package/dist/release/releaseHandover.js +22 -0
  65. package/dist/release/releaseWorkflowPorts.js +15 -7
  66. package/dist/repository/gitWorkspace.js +430 -107
  67. package/dist/repository/projectMaintenanceLock.js +75 -18
  68. package/dist/repository/taskWorkspaceCoordinator.js +182 -101
  69. package/dist/repository/taskWorkspacePreparer.js +205 -72
  70. package/dist/repository/workItemCandidateSnapshot.js +34 -0
  71. package/dist/repository/workspaceCleanupInspection.js +187 -0
  72. package/dist/resources/resourceDiscovery.js +3 -2
  73. package/dist/runtime/agentError.js +5 -3
  74. package/dist/runtime/agentHost.js +179 -82
  75. package/dist/runtime/agentHostCompatibility.js +127 -0
  76. package/dist/runtime/agentHostProtocol.js +53 -0
  77. package/dist/runtime/builtinAgentErrorMappers.js +91 -0
  78. package/dist/runtime/codexAppServerRuntime.js +34 -3
  79. package/dist/runtime/executionEnvironment.js +0 -19
  80. package/dist/runtime/launchBroker.js +6 -0
  81. package/dist/runtime/providerControl.js +5 -1
  82. package/dist/runtime/providerRetry.js +198 -0
  83. package/dist/runtime/providerRuntimeIdentity.js +28 -2
  84. package/dist/runtime/sessionReconciliation.js +4 -4
  85. package/dist/runtime/sessionTokenMetrics.js +15 -5
  86. package/dist/runtime/structuredProviderHost.js +6 -2
  87. package/dist/runtime/taskRuntimeIsolation.js +30 -6
  88. package/dist/runtime/taskUsageMetrics.js +275 -0
  89. package/dist/runtime/tmuxAdapters.js +5 -3
  90. package/dist/scheduler/activeRoleRunDelivery.js +12 -0
  91. package/dist/scheduler/leaderWakeupProcessor.js +5 -0
  92. package/dist/scheduler/operatorEvent.js +4 -0
  93. package/dist/scheduler/taskExecutionProjection.js +38 -6
  94. package/dist/scheduler/taskObservabilityProjection.js +6 -44
  95. package/dist/scheduler/wakeReason.js +7 -1
  96. package/dist/scheduler/wakeupQueue.js +2 -0
  97. package/dist/setup/setupCommand.js +26 -8
  98. package/dist/storage/homeLayout.js +130 -0
  99. package/dist/storage/migrations/collapseWorktreeLayout.js +963 -0
  100. package/dist/storage/migrations/integrationContinuation.js +104 -0
  101. package/dist/storage/migrations/unifyHomeLayout.js +925 -0
  102. package/dist/storage/sqliteSchema.js +167 -4
  103. package/dist/storage/sqliteStore.js +57 -1
  104. package/dist/storage/storageVersions.js +1 -1
  105. package/dist/storage/storeRpc.js +2 -0
  106. package/dist/storage/taskCatalog.js +123 -0
  107. package/dist/storage/taskStore.js +2 -0
  108. package/dist/storage/upgrade/upgradeOrchestrator.js +95 -2
  109. package/dist/task/archiveDiagnostics.js +129 -0
  110. package/dist/task/archivePreflight.js +124 -0
  111. package/dist/task/nextAction.js +44 -11
  112. package/dist/task/publicationAdoption.js +56 -0
  113. package/dist/task/publicationReference.js +10 -0
  114. package/dist/task/remoteDelivery.js +31 -16
  115. package/dist/web/assets/client/app.js +147 -17
  116. package/dist/web/assets/client/components.js +56 -13
  117. package/dist/web/assets/client/i18n.js +78 -4
  118. package/dist/web/assets/client/taskSurface.js +108 -1
  119. package/dist/web/assets/client/view.js +39 -8
  120. package/dist/web/assets/shell.js +29 -0
  121. package/dist/web/assets/styles/layout.js +8 -1
  122. package/dist/web/assets/styles/widgets.js +12 -0
  123. package/dist/web/webServer.js +131 -4
  124. package/dist/web/webSnapshot.js +16 -6
  125. package/dist/web/webTaskSurface.js +222 -5
  126. package/dist/workspace/cleanupInspection.js +63 -0
  127. package/dist/workspace/workItemChangeSetManager.js +111 -35
  128. package/docs/agent-result-consumption.md +4 -0
  129. package/docs/agent-result-consumption.zh-CN.md +3 -0
  130. package/docs/agent-runtime-drivers.md +7 -0
  131. package/docs/agent-runtime-drivers.zh-CN.md +5 -0
  132. package/docs/architecture/README.md +2 -0
  133. package/docs/architecture/README.zh-CN.md +3 -1
  134. package/docs/architecture/capabilities-and-resources.md +30 -5
  135. package/docs/architecture/capabilities-and-resources.zh-CN.md +23 -3
  136. package/docs/managed-turn-and-session-runtime.md +47 -0
  137. package/docs/managed-turn-and-session-runtime.zh-CN.md +40 -0
  138. package/docs/observability/README.md +62 -0
  139. package/docs/observability/README.zh-CN.md +47 -0
  140. package/docs/project-refresh.md +77 -0
  141. package/docs/project-refresh.zh-CN.md +59 -0
  142. package/docs/provider-retry.md +70 -0
  143. package/docs/release-workflow.md +39 -0
  144. package/docs/release-workflow.zh-CN.md +29 -0
  145. package/docs/sqlite-control-plane-design.md +223 -1
  146. package/docs/task-delivery.md +133 -13
  147. package/docs/task-delivery.zh-CN.md +99 -10
  148. package/docs/task-discovery.md +102 -0
  149. package/docs/task-discovery.zh-CN.md +86 -0
  150. package/docs/testing/verification-levels.md +40 -0
  151. package/docs/testing/verification-levels.zh-CN.md +23 -0
  152. package/i18n/README.zh-CN.md +13 -7
  153. package/package.json +1 -1
  154. package/skills/yui-leader/references/execution.md +154 -51
  155. package/skills/yui-leader/references/integration.md +52 -2
  156. package/skills/yui-operator/SKILL.md +19 -3
  157. package/skills/yui-reviewer/SKILL.md +4 -0
  158. package/skills/yui-runtime/SKILL.md +42 -0
  159. package/skills/yui-runtime/references/publication.md +42 -0
  160. package/skills/yui-runtime/references/recovery.md +24 -0
@@ -0,0 +1,102 @@
1
+ <p align="right"><strong>English</strong> | <a href="./task-discovery.zh-CN.md">简体中文</a></p>
2
+
3
+ # Bounded Task discovery
4
+
5
+ Agents discover candidates with `yui task list --view compact --json`, then
6
+ read the selected Task's Context and original Messages. The catalog is a
7
+ current read, not a summary database, a Context snapshot, an acknowledgement,
8
+ or an execution/acceptance decision.
9
+
10
+ The explicit compact view keeps `task list --json` and `--verbose` detailed
11
+ outputs unchanged for existing consumers. The built-in Operator uses compact;
12
+ internal interactive selectors retain their complete `{id,title,status}` array
13
+ and read only those columns. Web uses the same compact query at
14
+ `GET /api/dashboard?view=compact`; its existing dashboard and Task detail
15
+ endpoints retain execution, observability, usage and remote-delivery fields.
16
+ No storage schema or migration changes are required.
17
+
18
+ ## Query and page contract
19
+
20
+ ```sh
21
+ yui task list --view compact --project project-1 --status active --limit 20 --json
22
+ yui task list --view compact --attention openInputs --json
23
+ yui task list --view compact --search "candidate title" --json
24
+ yui task context task-1 --json
25
+ yui task context inspect task-1 --store task --ref task-1 --digest <digest> --json
26
+ yui task message show task-1/message-1 --json
27
+ ```
28
+
29
+ `--project` accepts an exact Project ID. Search matches ID, title, tags and
30
+ Project name using SQLite substring comparison (ASCII case-insensitive;
31
+ non-ASCII characters compare literally). Default scope excludes archived
32
+ Tasks; `--all` or `--status archived` includes them. Counts declare that scope,
33
+ not an invisible global total. Status/search/Project/attention filters apply
34
+ to `total` and the returned Tasks, not the scope-wide attention summary.
35
+
36
+ The default limit is 20, maximum 100. Successful JSON responses, including the
37
+ CLI envelope, fit 32 KiB. UTF-8 summaries are at most 512 bytes; titles are
38
+ at most 256 bytes. Truncation is explicit. IDs, digests and cursors are never
39
+ truncated. Oversized mandatory metadata produces a bounded error, not a
40
+ non-progressing successful page. A missing Brief is reported as missing.
41
+
42
+ Order is ascending `(createdAt, id)` with SQLite binary ID ordering. Repeat
43
+ all filters and the limit with `--cursor <nextCursor>`. A null cursor ends the
44
+ page sequence; byte limits can end a page before its requested item limit.
45
+ The first page fixes the largest matching creation key. Newer creation keys
46
+ are excluded until refresh. Each later page reads current facts: lifecycle or
47
+ filter membership changes can affect the enumeration. This is not a frozen
48
+ snapshot, and unrelated runtime events do not invalidate a cursor.
49
+
50
+ Each Task and attention sample has a real Task Context ref
51
+ (`taskId, store, refId, revision, digest`). The digest covers the original
52
+ Task, not the clipped preview or Brief. Read Task Context for the current
53
+ Brief and use Context inspect for a digest-checked original. A changed digest
54
+ is rejected; a ref never grants authority or implies the requirement was read.
55
+
56
+ ## Attention without full history
57
+
58
+ Every page, including a filtered empty page, reports the same authorized
59
+ catalog's current attention. Each category contains a record/signal count,
60
+ affected-Task count, up to four exact Task refs, omitted-Task-ref count, and a
61
+ filter for enumerating all affected Tasks:
62
+
63
+ Start that attention query without the previous status/search/Project filters
64
+ and retain its `all` flag. This preserves the declared catalog scope, including
65
+ archived Tasks when explicitly included.
66
+
67
+ | Category | Current stored facts |
68
+ | --- | --- |
69
+ | `openInputs` | Open InputRequests |
70
+ | `pendingOperations` | Queued/running durable Jobs |
71
+ | `unknownOperations` | Jobs with `unknown-needs-attention` |
72
+ | `executionSignals` | For active/draft Tasks: live Runs, open WorkItems or accepted WorkItems retaining a current replicated group, unresolved/failed Integrations, pending/running/failed Reviews, Leader failure, and pending/processing Leader mailbox |
73
+
74
+ `executionSignals` is deliberately conservative discovery, **not** the detailed
75
+ execution-status classifier. Healthy live work is included so runtime identity,
76
+ stall, failed-work and recovery attention cannot be hidden behind pagination
77
+ or require scanning every Task's historical events. Counts must not be read as
78
+ failure counts. Open the affected Task for its precise execution state and
79
+ source records; no report text is parsed into status. Web explicitly labels
80
+ these facts and offers category navigation. Selected detail survives paging,
81
+ filtering and refresh; only the detail read can establish absence.
82
+
83
+ Task Leader Sessions see only their own Task. Assignment-scoped Workers and
84
+ Reviewers use existing authorized Run Context instead of whole-Task discovery;
85
+ the catalog rejects their request before counting. Global non-Operator and
86
+ incomplete managed identities are rejected. Historical Leader diagnostic reads
87
+ retain their original Task scope. A cursor is scope/filter-bound continuation,
88
+ not a credential. Read operations do not consume messages, acknowledge jobs,
89
+ wake Roles or query providers.
90
+
91
+ ## Cost boundary
92
+
93
+ SQLite queries existing catalog/status indexes and aggregates narrow facts
94
+ before selecting page rows. It does not decode all Task payloads, Runs,
95
+ Messages or Events into JavaScript, build all overviews and delete fields, or
96
+ construct per-Task Context. Only selected Tasks and bounded attention samples
97
+ are decoded and hashed for original refs.
98
+
99
+ Output and materialized rows are bounded. Database work still scales with
100
+ authorized Tasks and relevant index rows; search can inspect Task/Project JSON
101
+ inside SQLite. Exact refs still cost the selected original Task's payload size.
102
+ These are local cost boundaries, not constant-time or model-effect claims.
@@ -0,0 +1,86 @@
1
+ <p align="right"><a href="./task-discovery.md">English</a> | <strong>简体中文</strong></p>
2
+
3
+ # 有界任务发现
4
+
5
+ Agent 使用 `yui task list --view compact --json` 发现候选任务,再读取目标
6
+ Task Context 和原始 Message。目录是当前事实的只读视图,不是摘要数据库、
7
+ Context 快照、消息确认、执行判断或验收结论。
8
+
9
+ 显式 compact 视图不改变既有 `task list --json`、`--verbose` 详细输出。
10
+ 内建 Operator 采用 compact;交互选择器保持完整的 `{id,title,status}` 数组,
11
+ 只读取这些窄字段。Web 通过 `GET /api/dashboard?view=compact` 使用同一查询;
12
+ 原 dashboard 和 Task 详情接口保留执行、观测、用量和远端交付字段。
13
+ 本功能不改变持久 schema,无需迁移。
14
+
15
+ ## 查询和分页合同
16
+
17
+ ```sh
18
+ yui task list --view compact --project project-1 --status active --limit 20 --json
19
+ yui task list --view compact --attention openInputs --json
20
+ yui task list --view compact --search "候选标题" --json
21
+ yui task context task-1 --json
22
+ yui task context inspect task-1 --store task --ref task-1 --digest <digest> --json
23
+ yui task message show task-1/message-1 --json
24
+ ```
25
+
26
+ `--project` 接受精确 Project ID。搜索按 SQLite 子串匹配 ID、标题、标签和
27
+ Project 名称:ASCII 不区分大小写,非 ASCII 字符按字面比较。缺省范围排除
28
+ 归档 Task;`--all` 或 `--status archived` 纳入归档。计数明确属于该范围,
29
+ 不泄漏不可见的全局总数。状态、搜索、Project 和关注分类只筛选 `total`
30
+ 及任务行,不缩小范围内的关注汇总。
31
+
32
+ 缺省每页 20 项,最多 100 项。成功 JSON 响应连同 CLI envelope 不超过
33
+ 32 KiB;摘要最多 512 UTF-8 字节,标题最多 256 字节,裁剪明确标记。
34
+ ID、digest 和 cursor 不裁剪。必要元数据过长时返回有界错误,不成功返回
35
+ 无法前进的空页。Brief 缺失会明确显示。
36
+
37
+ 顺序是 `(createdAt,id)` 升序,ID 按 SQLite binary 排序。后续请求带
38
+ `--cursor <nextCursor>`,并保留全部筛选参数和 limit。null cursor 表示结束;
39
+ 字节预算可能使实际条数少于 limit。首页固定最大匹配创建键,较新创建键
40
+ 留到刷新后读取。各页仍读取当前状态:生命周期和筛选成员变化可能影响枚举;
41
+ 这不是冻结快照,不会因为无关运行时事件而作废游标。
42
+
43
+ 每个任务和关注样本携带真实 Task Context ref:
44
+ `taskId,store,refId,revision,digest`。digest 覆盖原 Task,不是裁剪预览或
45
+ Brief。当前 Brief 通过 Task Context 读取;Context inspect 可校验 digest
46
+ 后展开原文。digest 变化会拒绝旧引用;引用不赋予权限,也不表示需求已读。
47
+
48
+ ## 不扫描全历史也不遗漏关注入口
49
+
50
+ 每页(包括筛选后无匹配的空页)都返回同一授权目录范围的当前关注事实。
51
+ 每类包括记录/信号数量、涉及 Task 数量、最多四个精确 Task ref、
52
+ 省略的 Task ref 数量,以及枚举全部相关 Task 的筛选入口:
53
+
54
+ 启动该关注查询时清除先前的状态、搜索、Project 筛选,并保留其 `all` 标记,
55
+ 从而保持声明的目录范围,包括此前明确纳入的归档任务。
56
+
57
+ | 分类 | 当前存储事实 |
58
+ | --- | --- |
59
+ | `openInputs` | 未解决 InputRequest |
60
+ | `pendingOperations` | queued/running durable Job |
61
+ | `unknownOperations` | unknown-needs-attention Job |
62
+ | `executionSignals` | active/draft Task 中的活跃 Run、open WorkItem 或仍含当前复制执行组的 accepted WorkItem、未解决或失败 Integration、pending/running/failed Review、Leader failure、pending/processing Leader mailbox |
63
+
64
+ `executionSignals` 是保守的发现入口,**不是**详情的执行状态分类器。
65
+ 健康的活跃工作也会被包括,从而不会因为分页而藏住运行身份、停滞、
66
+ 工作失败或恢复相关的关注入口,也不必先扫描所有 Task 历史 Event。
67
+ 这些计数不是失败计数;请打开任务读取精确执行状态和来源记录。
68
+ 不解析报告正文推导状态。Web 明确标示这些事实并提供分类导航。
69
+ 已选详情不因分页、筛选或刷新而丢失;只有详情读取可以确认目标不存在。
70
+
71
+ Task Leader Session 只能发现自己的 Task。Assignment-scoped Worker 和
72
+ Reviewer 使用既有授权 Run Context,目录会在计数前拒绝其全 Task 发现请求。
73
+ 非 Operator 的 Global Session 和不完整的受管身份也会被拒绝。
74
+ 历史 Leader 的诊断读取保持原 Task 范围。游标绑定范围及参数,不是凭证。
75
+ 读取不会消费 Message、确认 Job、唤醒 Role 或查询外部 provider。
76
+
77
+ ## 成本边界
78
+
79
+ SQLite 在现有目录及状态索引上聚合窄事实,再选取当前页。
80
+ 不会在 JavaScript 中解码全部 Task 正文、Run、Message、Event,不会先
81
+ 构造所有重型 Overview 再删字段,也不逐 Task 构造 Context。
82
+ 仅当前页和有界关注样本会解码原 Task,并计算精确 ref。
83
+
84
+ 输出和物化行有界;数据库工作量仍随授权 Task 和相关索引行增加,
85
+ 搜索可能在 SQLite 内检查 Task/Project JSON。精确引用仍需承担选中
86
+ Task 原正文大小的成本。这些是本机成本边界,不是恒定时间或模型效果承诺。
@@ -53,12 +53,52 @@ regressions, and fast regressions do not establish real-model behavior.
53
53
  authentication helpers, rewritten approval records, or secrets forwarded
54
54
  to unrelated adapters; native authentication selection stays with Claude. Environment refresh
55
55
  removes revoked keys and keeps values out of durable Task/Role records.
56
+ 15. ordinary Integration conflicts continue without a decision gate; exact Git
57
+ receipts and an admitted Job resume interrupted delivery without replay.
58
+ Validation settlement distinguishes current check conditions from an
59
+ already-applied CAS. Migration preserves provable old bound FF Jobs and
60
+ classifies old conflicts without inventing successful checks.
61
+ 16. explicit force archive commits before cleanup and preserves uncertain
62
+ delivery/runtime evidence; partial cleanup and late results remain traceable,
63
+ while archived runtime resources never become automatically safe to delete.
64
+ Archive preflight preserves durable records and the Git index, distinguishes
65
+ frozen-result differences, and cleanup rechecks moved heads, owner branches
66
+ and new dirt. Read-only Git status never executes configured clean filters.
67
+ 17. Host facts reach the existing Inbox even when its compiled store cannot
68
+ read the Home; Controller-side fencing, ACK-loss replay, and legacy-Host
69
+ upgrade refusal preserve the original execution. A frozen independent v1
70
+ protocol producer remains the same process across a real 19→22 migration,
71
+ authenticates RPCs to both Controllers through refreshed discovery, and
72
+ retains facts during the disconnected window. Production launch planning
73
+ also preserves scoped startup evidence before native Session adoption
74
+ without exporting a Run ID into the Session environment.
75
+ This fixture is the minimum supported new wire contract, not a claim that
76
+ pre-fix released Hosts can be hot-patched.
77
+ Archive racing Host ingress retains the complete source envelope without
78
+ reopening the Task or settling original uncertain input.
79
+ 18. Project maintenance waiters yield to the holder, use a shared 60-second
80
+ monotonic budget with independent 200–500ms jitter, and cancel on Controller
81
+ stop without losing activation intent. Disposable lock/SQLite/Git fixtures
82
+ cover exclusion, partial release and under-lock revalidation; injected time
83
+ checks the minute-long deadline without sleeping for a minute. Competing
84
+ activations each adopt their own workspace without replaying Git work.
85
+ 19. Task usage distinguishes zero, partial and unknown across exact requests,
86
+ cumulative baselines, Session replacement and native child overlap. A small
87
+ event fixture checks direct Leader/parallel time semantics and the shared
88
+ CLI/Web/audit lifetime projection without collecting Provider data.
56
89
 
57
90
  Keep the test phase seconds-scale; measure TypeScript build separately. Record
58
91
  incremental runtime when adding a critical regression. The seven recovery boundary
59
92
  cases initially add about 0.4 seconds of test bodies (about 0.6 seconds standalone,
60
93
  including module startup) on the development host. Avoid sleep-based checks or
61
94
  mandatory model/daemon launches in the permanent suite.
95
+ The Integration continuation regressions use disposable Git repositories,
96
+ SQLite and fake Jobs, without a provider or shared Home. Their test bodies
97
+ take about 3 seconds on the development host; validation settlement adds
98
+ about 1.4 seconds to the initial 1.5-second coverage.
99
+ Archive preflight adds three small disposable Git/SQLite scenarios (about
100
+ one second of test bodies); broader owner/diagnostic combinations remain
101
+ temporary validation evidence, not a second permanent matrix.
62
102
 
63
103
  ## Skill and instruction changes
64
104
 
@@ -43,10 +43,33 @@ Yui 是一个单用户本地产品。永久验证保护关键的 happy path 和
43
43
  14. Claude 收到其原生环境和 settings 路径,而没有被注入的认证 helper、被改写的批准
44
44
  记录,也没有把 secret 转发给无关适配器;原生认证选择仍归 Claude。环境刷新移除
45
45
  已撤销的 key,并把值挡在持久 Task/Role 记录之外。
46
+ 15. 普通 Integration 冲突可直接继续;准确 Git 与 Job 证据恢复中断交付,
47
+ 不重放已执行的步骤,也不把已发生的 CAS 与新的验证条件混为一谈。
48
+ 16. 明确授权的 force archive 先提交归档,再独立记录清理;不确定输入与晚到
49
+ 结果仍可追溯,归档不使保留资源自动变得可删除。归档预检不改变持久记录或
50
+ Git index,区分冻结结果差异;清理重查 HEAD、owner 分支和新增脏状态。
51
+ 只读 Git 状态检查不执行配置的 clean filter。
52
+ 17. 即使 Host 编译版本的存储代码无法读取 Home,事实仍先进入现有 Inbox;
53
+ Controller 侧归属校验、ACK 丢失重放和 legacy Host 升级拒绝保护原始执行。
54
+ 独立冻结的 v1 协议生产者在真实 19→22 迁移前后保持同一进程,通过新 discovery
55
+ 分别向两个 Controller 发出认证 RPC,并在断线窗口保留事实。生产 launch 路径
56
+ 在不向 Session 环境导出 Run ID 的前提下保留 scoped 启动证据。该 fixture 代表最低
57
+ 支持的新线协议,不声称已发布的修复前 Host 可以原地热更新。
58
+ 归档与 Host 消费交错时保留完整来源 envelope,不重新打开 Task 或结算原不确定输入。
59
+ 18. Project 维护锁等待不阻塞持锁者,使用共享的 60 秒单调时钟预算与每次独立的
60
+ 200–500ms 随机间隔;Controller 停止时取消等待,不丢失激活意图。
61
+ 可丢弃锁、SQLite 和 Git fixture 覆盖排他、部分锁释放及取锁后重校验,
62
+ 注入时钟验证一分钟截止逻辑,不实际等待一分钟;竞争激活各自采用工作区,
63
+ 不重放 Git 操作。
64
+ 19. Task 用量在精确请求、累计基线、Session 替换和原生子执行重叠下区分真实零、
65
+ 部分与未知。小型事件 fixture 覆盖直接 Leader/并行耗时,以及 CLI/Web/audit
66
+ 共享的全生命周期投影,不采集 Provider 数据。
46
67
 
47
68
  把测试阶段保持在秒级;单独度量 TypeScript 构建。新增一个关键回归时记录其增量运行
48
69
  时长。这七个恢复边界用例在开发主机上最初约增加 0.4 秒的测试体(独立运行约 0.6 秒,
49
70
  含模块启动)。避免在永久套件中使用基于 sleep 的检查或强制的模型/daemon 启动。
71
+ 归档预检新增三个可丢弃 Git/SQLite 场景,测试体约一秒;更广的 owner/诊断组合
72
+ 保留为临时验证证据,不形成第二套永久矩阵。
50
73
 
51
74
  ## Skill 与指令变更
52
75
 
@@ -27,7 +27,7 @@ Yui 是面向编程 Agent 的本地控制面。你只需用自然语言把目标
27
27
  - **自带 Agent** —— Codex CLI、Claude Code CLI 和 ACP 通过统一边界接入,
28
28
  可替换而不丢失 Task。
29
29
  - **本地优先、私有** —— 一切运行在你自己的机器上,面向单个受信任用户;
30
- Web 视图仅本地回环、只读。
30
+ Web 仅本地回环,包含只读视图和经认证的用户控制。
31
31
  - **默认隔离** —— 仓库改动发生在受管 Git worktree 中,稳定 checkout 保持只读。
32
32
 
33
33
  > **状态:** 尚未发布 1.0(0.15.x)。CLI 与配置在版本之间仍可能变化;每次升级
@@ -122,7 +122,10 @@ Agent 可以重新读取任务上下文,继续兼容的 Session,或在必要
122
122
  进程失败不会抹掉任务,结果不确定的投递也不会被静默重复。
123
123
 
124
124
  想直观看进展,可以在另一个终端运行 `yui web`。本地 Web 展示同一份任务与
125
- 待回答问题,不是另一套需要同步的任务系统。
125
+ 待回答问题,也允许发送消息、回答问题,以及显式 queue、steer 或 interrupt Task 输入。
126
+ 这些经认证的 Task 控制复用 CLI 的相同操作,不是另一套需要同步的任务系统。
127
+ 详见 [Web 权限](../docs/architecture/capabilities-and-resources.zh-CN.md#cli-与-web)
128
+ 和[输入时机](../docs/managed-turn-and-session-runtime.zh-CN.md#输入时机queuesteer-与-interrupt)。
126
129
 
127
130
  ## 架构
128
131
 
@@ -225,7 +228,7 @@ Yui 为你组织的东西 —— 是持久对象,而不是进程:
225
228
  它负责搬运工作、记录事实——但从不判断回答好坏
226
229
 
227
230
  Agent 在 Project 中工作:只读 checkout + 隔离 worktree。
228
- Web 视图(yui web):对存储的本地回环、只读投影。
231
+ Web(yui web):本地回环视图 + 经认证的用户控制。
229
232
  ```
230
233
 
231
234
  ### 分层设计
@@ -234,7 +237,7 @@ Yui 为你组织的东西 —— 是持久对象,而不是进程:
234
237
 
235
238
  ```text
236
239
  体验层 Experience — 你如何交互
237
- CLI(Operator)· Web(本地回环、只读)· 原生 Agent 会话
240
+ CLI(Operator)· Web(本地回环、经认证)· 原生 Agent 会话
238
241
  采集输入 · 展示事实 · 确认操作 · 调用能力
239
242
  ▼
240
243
  决策层 Intelligence — 谁来决定
@@ -270,9 +273,12 @@ Yui 为你组织的东西 —— 是持久对象,而不是进程:
270
273
  WorkItem open ─▶ accepted ─▶ retired
271
274
 
272
275
  Draft 只保存规划;激活后才采用交付工作区。
273
- 归档需要工作已了结、worktree 干净,且不可重新打开。
276
+ 普通归档需要工作已了结、worktree 干净,且不可重新打开。
274
277
  ```
275
278
 
279
+ 明确授权的 force 归档可以保留未解决证据与不安全资源;它不证明交付,也不授权删除
280
+ 这些资源。详见[归档合同](../docs/task-delivery.zh-CN.md#归档)。
281
+
276
282
  ## 设计原则
277
283
 
278
284
  ### Agent 做判断,Yui 保存工作事实
@@ -321,8 +327,8 @@ Yui 面向一个受信任本地用户,不是 OS 沙箱,也不是远程多用
321
327
 
322
328
  ## 深入了解
323
329
 
324
- [总体架构](../ARCHITECTURE.md)介绍端到端设计,
325
- [文档导航](../docs/architecture/README.md)提供配置、执行、交付、存储和插件的
330
+ [总体架构](../ARCHITECTURE.zh-CN.md)介绍端到端设计,
331
+ [文档导航](../docs/architecture/README.zh-CN.md)提供配置、执行、交付、存储和插件的
326
332
  当前合同。想直接操作 CLI 时,使用 `yui --help` 查看命令。
327
333
 
328
334
  Yui 默认将控制面数据保存在 `~/.yui`,通过 `YUI_HOME` 选择另一个实例。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zq-silk/yui",
3
- "version": "0.15.9",
3
+ "version": "0.15.12",
4
4
  "description": "Local control plane for long-running native agent CLI sessions backed by tmux.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -22,29 +22,56 @@ implementation patterns, scheduling options, review routing, or recoverable
22
22
  runtime actions. Create an InputRequest only for a real product choice, new
23
23
  authority, irreversible external effect, or unavailable external fact.
24
24
 
25
- ## Choose execution topology from ownership
26
-
27
- A WorkItem is one substantial requirement with an independent owner and useful
28
- acceptance boundary. It is not a container for every phase, file, test,
29
- finding, repair, or progress update. Task type, risk labels, file count, and
30
- subsystem names do not determine topology.
31
-
32
- Choose the smallest useful executor:
33
-
34
- 1. **Leader directly** when current context, authority, and tools are enough.
35
- 2. **Native subagent** for bounded specialist attention or parallel
36
- investigation inside the current Agent Session when a best-effort child
37
- result is sufficient.
38
- 3. **Task Role AgentRun** when work needs independent durable ownership, a distinct
39
- Agent/provider or credential set, a managed workspace, or a separately
40
- recoverable Session and AgentRun lifecycle.
41
-
42
- Create multiple WorkItems only when their requirements can make useful
43
- independent progress, normally in parallel, and the coordination and
44
- Integration cost is lower than keeping one coherent owner. Keep coupled
45
- changes together.
46
-
47
- An ordinary WorkItem uses its assignee directly; dispatch without `--lane-role`.
25
+ ## Separate the work unit, executor, and concurrency
26
+
27
+ Honor the user's explicit choice of direct work or delegation. Otherwise make
28
+ three independent judgments; Review is a fourth judgment below.
29
+
30
+ **Does this result need its own management and acceptance boundary?** A WorkItem
31
+ is a substantial result worth managing and accepting separately inside the Task.
32
+ It need not have a different person, an independent release, or parallel execution.
33
+ Use zero WorkItems when the Task already holds one coherent outcome. One WorkItem
34
+ can be Leader-owned or hold a justified whole-result managed Assignment and
35
+ Candidate. Copying the Task unchanged or displaying progress is not a reason
36
+ to create it. Do not split analysis, editing, testing, Review, and ordinary
37
+ repairs into phase-shaped WorkItems.
38
+
39
+ **Who should execute?** Direct Leader execution is the default viable path for
40
+ one coupled result when current context, delivery authority, and tools suffice.
41
+ A native child can supply bounded specialist attention or parallel investigation
42
+ inside this Session when a best-effort result suffices; it creates no Yui identity,
43
+ authority, or WorkItem by itself.
44
+
45
+ Choose a managed Worker only for a concrete benefit that repays requirement
46
+ restatement, context reload, startup, waiting, inspection/rework, Integration,
47
+ and lifecycle management. Benefits include safely parallel independent results,
48
+ a needed capability or execution environment, a genuinely necessary separately
49
+ recoverable lifecycle, freeing the Leader for another actual responsibility,
50
+ or explicit user delegation. An available Worker, cheaper/different model,
51
+ many files, high risk, long duration, or generic maintainability alone is not
52
+ enough. Risk can justify independent Review without delegating implementation.
53
+ When delegation involves a material tradeoff, leave one sentence of concrete
54
+ benefit in the existing Brief; no form, approval, or separate decision record
55
+ is needed.
56
+
57
+ **Should separate units run concurrently?** Multiple WorkItems may run serially
58
+ because of a real dependency, or concurrently when their results can advance
59
+ independently and the net benefit exceeds coordination and Integration cost.
60
+ Neither a single WorkItem nor multiple executors proves parallelism. Keep
61
+ coupled changes together.
62
+
63
+ For example, fix one coupled behavior directly in Task main, even when it touches
64
+ many files. Delegate an independent import tool while the Leader implements its
65
+ consumer when the two have a stable boundary and useful parallel progress.
66
+ Keep two separately accepted stages serial when the second genuinely needs the
67
+ first result. Do not wrap a whole Task in an `implementer` WorkItem merely because
68
+ that Role exists.
69
+
70
+ Apply these choices to new work. Do not automatically cancel an existing Worker,
71
+ reassign/retire WorkItems, or move workspaces to conform to a new default; preserve
72
+ their current ownership and evidence until a justified explicit change.
73
+
74
+ An ordinary managed dispatch uses the WorkItem assignee; omit `--lane-role`.
48
75
  Use [replicated execution](replicated-execution.md) only when
49
76
  independent attempts over the same frozen Assignment repay their coordination
50
77
  cost. Direct managed execution already provides durable ownership.
@@ -79,8 +106,9 @@ messages and Task Brief. Neither `next-action` nor a disabled default review
79
106
  policy authorizes dropping them to make completion easier.
80
107
 
81
108
  An Integration Job's success is not the final target update. For that
82
- notification, read [Integration](integration.md) and finish the same
83
- attempt; do not start a duplicate operation.
109
+ notification, read [Integration](integration.md) and continue from its exact
110
+ evidence; do not start a duplicate operation. Read that guidance also for an
111
+ ordinary Git conflict or an attempt that cannot be reliably resumed.
84
112
 
85
113
  Before dispatch, Review, Integration, or completion, inspect
86
114
  `liveTaskState.activeRuns` and `liveTaskState.activeTaskReviews` in the current
@@ -90,7 +118,36 @@ global Task lock.
90
118
 
91
119
  ## Execute the chosen path
92
120
 
93
- Dispatch establishes the first owner and frozen Assignment. For ordinary
121
+ ### Choose input timing without changing intent
122
+
123
+ Submission intent (`record`, `discuss`, `develop`) and delivery timing are
124
+ different facts. Input controls do not activate a Task, expand an Assignment,
125
+ or elevate a planning Session. Keep the submission contract when using `send`;
126
+ choose queue, steer or interrupt from the user's intent and current facts:
127
+
128
+ ```sh
129
+ yui task message queue <task> "<continuation>" --request-id <id> --to <role> --work-item <work-id>
130
+ yui task message steer <task> "<current-turn correction>" --request-id <id> --to leader --expected-target <turn>
131
+ yui task role interrupt <task> <role> --expected-target <turn> [--then-message <task/message>] [--request-id <id>]
132
+ ```
133
+
134
+ Queue waits for the next legal opportunity. Steer addresses only the exact
135
+ current native Turn; Worker/Reviewer steer also needs its existing WorkItem or
136
+ ReviewRound. Bare interrupt stores a control request, not a new Message.
137
+ `interrupt-requested` is not a terminal or proof that background resources
138
+ stopped. Then names an already-saved input and reserves its next opportunity
139
+ only within the original Session/writer boundary.
140
+
141
+ Read `task role session inspect` first. Unsupported and proven-unsubmitted
142
+ steer may be composed with interrupt when the user's intent permits stopping;
143
+ accepted, pending or unknown steer must not be resent through another action
144
+ or request id. Never silently cancel, replace a Session or downgrade to queue.
145
+
146
+ Global inputs use `role message queue|steer <role>` and `role interrupt <role>`
147
+ with their own owner, not a fabricated Task/Run. See
148
+ [Runtime](../../yui-runtime/SKILL.md) for scope and controlled-console boundaries.
149
+
150
+ Managed dispatch freezes the Assignment for its assignee. For ordinary
94
151
  clarification, feedback or a continuation of that same work, send a Message:
95
152
 
96
153
  ```sh
@@ -112,37 +169,72 @@ For unknown delivery or Session replacement, read
112
169
  [runtime recovery](../../yui-runtime/references/recovery.md). Preserve the original
113
170
  input; do not replay uncertainty or treat it as a global Task lock.
114
171
 
115
- For direct work, change only Task main, keep it on its managed branch, commit
116
- the result, and leave it clean. Run the smallest check that can catch the
117
- changed behavior while implementing.
172
+ ### Direct delivery with zero WorkItems
118
173
 
119
- For a substantial delegated requirement:
174
+ The current delivery Leader needs no self-dispatched AgentRun or placeholder
175
+ WorkItem. Read the full Task requirements and relevant Messages, then implement,
176
+ verify, and fix the coherent result in Task main on its managed branch. Commit
177
+ and leave it clean. Run focused checks while changing behavior and the required
178
+ Project delivery checks on the final result.
120
179
 
121
- ```sh
122
- yui task work create <task-id> "<title>" \
123
- --project <project-to-modify> \
124
- --objective "<bounded outcome>" \
125
- --accept "<observable criterion>"
126
- ```
180
+ Keep the Brief as a current summary, not a replacement for Task requirements.
181
+ Preserve changed intent and reasons in Messages/Decisions, substantial documents
182
+ in Task artifacts, and code and verification evidence in the actual delivery.
183
+ Zero WorkItems reduces coordination records, not requirements or evidence.
127
184
 
128
- Add `--after` only for a real dependency. Likely file overlap is not by itself
129
- a dependency. A Worker may read the complete authorized Task context but may
130
- write only its WorkItem Projects and workspace.
185
+ Inspect the complete final diff and decide Review separately. If a Task-final
186
+ Review is required or adds useful evidence, request it against the clean Task
187
+ heads using `yui task review request <task> --role <reviewer>`. No WorkItem is
188
+ needed. Consume the original result, fix reachable findings directly in Task
189
+ main, and decide whether the changed result needs another Review. Honor immutable
190
+ Review contracts and explicit user/Project requirements even if a default is
191
+ disabled. Once the outcome and obligations are satisfied, use `task complete`
192
+ with the outcome, checks, and remaining risk; a final chat message is not completion.
193
+
194
+ ### Leader-owned WorkItem
131
195
 
132
- For a Leader-owned WorkItem, mark it running, complete it directly, then record
133
- its actual result:
196
+ Use this only when the result merits separate management/acceptance. Omit
197
+ `--role` for direct execution: the Leader owns coordination and performs the
198
+ work without a managed executor Assignment. `--role leader` instead selects the
199
+ Leader Role as a **managed AgentRun executor**; it is not how to label direct
200
+ ownership. Do not self-dispatch merely to gain execution authority.
201
+
202
+ For a writable Project result, create and inspect its WorkItem-owned workspace
203
+ before editing. The Leader can work there directly; isolation does not require a
204
+ Worker. Task main, WorkItem Develop, and Review workspaces remain distinct owners.
134
205
 
135
206
  ```sh
207
+ yui task work create <task> "<separately accepted result>" \
208
+ --project <project> --objective "<outcome>" --accept "<criterion>"
209
+ yui task work isolate <work-id>
136
210
  yui task work update <work-id> running
211
+ # Implement and verify in the returned WorkItem workspace; commit and leave it clean.
137
212
  yui task work update <work-id> done --summary "<result and evidence>"
138
- yui task work accept <work-id> --summary "<explicit acceptance and evidence>"
139
213
  ```
140
214
 
215
+ `done` freezes a direct Candidate, not an AgentRun result or acceptance.
216
+ Inspect it, then integrate the exact isolated result before acceptance:
217
+
218
+ ```sh
219
+ yui task integration start <task> --work-item <work-id> \
220
+ --project <project> --strategy <ff|cherry-pick|merge|manual>
221
+ # Inspect the attempt and finish it through Integration's normal checks/continuation.
222
+ yui task work accept <work-id> --summary "<decision and evidence>"
223
+ ```
224
+
225
+ Read [Integration](integration.md) for checks, continuation, and recovery.
226
+ Keep the same unit through ordinary fixes.
227
+ A read-only or Gitless result with no writable Projects needs no Git isolation;
228
+ submit its actual evidence and accept it explicitly. Existing exact Task-final
229
+ metadata-only Candidates retain their contract; do not establish a special Review
230
+ contract merely to avoid the ordinary writable WorkItem isolation boundary.
231
+
141
232
  For a native child, pass a bounded brief and applicable Profile constraints
142
233
  through the provider's child tools. A small investigation needs no synthetic
143
234
  WorkItem. If the child implements an existing Leader-owned WorkItem, keep that
144
- WorkItem roleless and mark it running. Native children inherit only current
145
- parent authority and gain no Yui Role, AgentRun, Session or broader workspace. Their
235
+ WorkItem roleless, supply its exact workspace and scope, and mark it running.
236
+ Native children inherit only current parent authority and gain no Yui Role,
237
+ AgentRun, Session or broader workspace. Their
146
238
  results are best-effort until Yui externalizes them; use a managed Task Role
147
239
  when independent durability matters. Inspect the returned result before
148
240
  submitting `done` or recording failure progress. `done` creates a Candidate;
@@ -153,20 +245,27 @@ materializing a Task Role, not when launching a native child. The child
153
245
  inherits the Leader Agent; apply a Profile model or effort only when the native
154
246
  tool actually supports and confirms that override.
155
247
 
156
- For a managed Task Role:
248
+ ### Managed Task Role
157
249
 
158
250
  ```sh
159
251
  yui task role add <task-id> <role> --profile <profile>
160
252
  yui task role show <task-id> <role>
161
- yui task work create <task-id> "<outcome>" --role <role>
253
+ yui task work create <task-id> "<outcome>" --role <role> \
254
+ --project <project> --objective "<bounded outcome>" --accept "<criterion>"
162
255
  yui task work dispatch <work-id> --input "<decision-complete brief>"
163
256
  ```
164
257
 
258
+ Add `--after` only for a real dependency. Likely file overlap is not by itself
259
+ a dependency. A Worker may read the complete authorized Task context but may
260
+ write only its WorkItem Projects and workspace. Dispatch prepares that isolated
261
+ workspace and freezes the Assignment; inspect the completed original AgentRun
262
+ result before submitting its exact Candidate, integrating, and accepting.
263
+
165
264
  Profiles carry portable behavior plus either a dynamic Global Worker runtime
166
265
  source or an explicit Agent with optional model and effort. Applying a Profile
167
266
  to a Task Role resolves and freezes the complete binding; later Profile or
168
267
  Global Worker changes do not rewrite that Role. Before dispatch, use
169
- `profile show` and `task role show` to read the exact behavior, Agent, model,
268
+ `config profile show` and `task role show` to read the exact behavior, Agent, model,
170
269
  effort, Profile, and workspace. Do not reconstruct or guess launch
171
270
  configuration. Use the WorkItem assignee directly unless replicated execution
172
271
  was deliberately selected.
@@ -228,8 +327,9 @@ reachable issues to the original execution owner. Fix a small Task-main issue
228
327
  directly; create a Repair WorkItem only when the repair is itself a substantial
229
328
  independently owned requirement.
230
329
 
231
- A failed ReviewRound is an execution failure, not an automatic retry or repair
232
- wave. Inspect its exact Round, AgentRun, candidate, Core failure, and
330
+ A failed ReviewRound is an execution failure, not a repair wave. First read
331
+ its Provider retry projection: bounded infrastructure recovery may already own
332
+ the successor. Otherwise inspect its exact Round, AgentRun, candidate, Core failure, and
233
333
  `task next-action` facts, then choose the smallest recovery that preserves the
234
334
  frozen boundary. Do not invent a retry loop or silently replace the Reviewer
235
335
  Session. For replicated execution, choose whether to retry a failed Producer,
@@ -254,8 +354,11 @@ External delivery and Task completion remain separate facts.
254
354
  After a ReviewRound is terminal, the Leader or authorized Operator owns
255
355
  `task work review cleanup <task>/<round>`. Preserve dirty diagnostic evidence
256
356
  and resolve it explicitly; do not ask a Reviewer to clean its own runtime
257
- after its final report. Cleanup can remain advisory at completion, but all
258
- required resources must be settled before user-authorized archive.
357
+ after its final report. Cleanup can remain advisory at completion. Ordinary
358
+ archive requires settled resources; explicitly authorized force archive preserves
359
+ unresolved resources and diagnostics under the shared
360
+ [archive contract](../../yui-runtime/references/publication.md). The Leader
361
+ does not gain independent archive authorization.
259
362
 
260
363
  Complete only when the Task outcome is satisfied, required checks and review
261
364
  contracts are settled, WorkItems are accepted or deliberately retired, latest