@zq-silk/yui 0.15.7 → 0.15.9

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 (308) hide show
  1. package/ARCHITECTURE.md +194 -399
  2. package/ARCHITECTURE.zh-CN.md +151 -0
  3. package/README.md +306 -1131
  4. package/dist/agent/adapterCatalog.js +15 -2
  5. package/dist/agent/agent.js +23 -3
  6. package/dist/agent/argumentPolicy.js +7 -1
  7. package/dist/agent/connectionPlan.js +62 -0
  8. package/dist/agent/executionComponents.js +158 -0
  9. package/dist/agent/launchEnvironment.js +31 -3
  10. package/dist/agent/managedRuntimeEnvironment.js +3 -5
  11. package/dist/{turn/turn.js → agentRun/agentRun.js} +166 -109
  12. package/dist/{turn/turnIdentity.js → agentRun/runIdentity.js} +4 -4
  13. package/dist/artifacts/artifactCapability.js +74 -0
  14. package/dist/artifacts/artifactCommitLock.js +249 -0
  15. package/dist/artifacts/artifactPaths.js +151 -0
  16. package/dist/artifacts/gitArtifactRef.js +146 -0
  17. package/dist/artifacts/managedGit.js +332 -0
  18. package/dist/artifacts/taskArtifactRepository.js +277 -0
  19. package/dist/brief/taskBrief.js +12 -0
  20. package/dist/cli/agentConfigurationPicker.js +13 -0
  21. package/dist/cli/commandCatalog.js +165 -74
  22. package/dist/cli/interactionCandidates.js +5 -5
  23. package/dist/cli/interactionPolicy.js +38 -8
  24. package/dist/cli/invocationRouter.js +1 -1
  25. package/dist/cli/managedDiagnostics.js +28 -0
  26. package/dist/cli/operatorWizard.js +1 -7
  27. package/dist/cli/roleOptionOrder.js +27 -0
  28. package/dist/cli/roleWizard.js +50 -14
  29. package/dist/cli/updateOrchestrator.js +1 -1
  30. package/dist/cli/updatePorts.js +3 -4
  31. package/dist/cli.js +245 -95
  32. package/dist/commands/agentCommands.js +72 -14
  33. package/dist/commands/capabilityCommands.js +9 -6
  34. package/dist/commands/configCommands.js +20 -20
  35. package/dist/commands/deliveryGuardPreflight.js +2 -2
  36. package/dist/commands/executionAuditCommands.js +24 -24
  37. package/dist/commands/globalRoleCommands.js +1 -1
  38. package/dist/commands/grantCommands.js +4 -4
  39. package/dist/commands/operatorCommands.js +34 -9
  40. package/dist/commands/projectCommands.js +4 -4
  41. package/dist/commands/resourcesCommands.js +2 -2
  42. package/dist/commands/roleConfiguration.js +25 -5
  43. package/dist/commands/roleRuntimeGuard.js +4 -5
  44. package/dist/commands/sessionCommands.js +3 -7
  45. package/dist/commands/taskActivationCommands.js +281 -0
  46. package/dist/commands/taskActor.js +28 -49
  47. package/dist/commands/taskCommands.js +1461 -720
  48. package/dist/commands/taskContextCommand.js +39 -583
  49. package/dist/commands/taskExecutionCommands.js +32 -32
  50. package/dist/commands/taskInputCommands.js +40 -104
  51. package/dist/commands/taskIntegrationCommands.js +3 -2
  52. package/dist/commands/taskIntegrationQueueCommands.js +1 -1
  53. package/dist/commands/taskNextActionCommand.js +8 -8
  54. package/dist/commands/taskOverviewCommand.js +33 -45
  55. package/dist/commands/taskRemoteDeliveryCommand.js +2 -2
  56. package/dist/commands/taskRoleRuntimeStatus.js +133 -102
  57. package/dist/commands/telemetryCommands.js +36 -38
  58. package/dist/config/configCatalog.js +4 -4
  59. package/dist/config/yuiConfig.js +8 -8
  60. package/dist/context/contextSnapshot.js +10 -10
  61. package/dist/context/dispatchContext.js +11 -11
  62. package/dist/context/roleSessionContext.js +6 -3
  63. package/dist/context/{turnContextPack.js → runContextPack.js} +158 -81
  64. package/dist/context/{turnInputContract.js → runInputContract.js} +73 -60
  65. package/dist/context/sessionBootstrapManifest.js +21 -2
  66. package/dist/context/sourceRunContext.js +30 -0
  67. package/dist/context/taskContext.js +481 -0
  68. package/dist/context/wakeNotification.js +27 -27
  69. package/dist/controller/agentRuntimeObserver.js +21 -24
  70. package/dist/controller/capabilityBridge.js +17 -6
  71. package/dist/controller/clientRuntime.js +65 -92
  72. package/dist/controller/controller.js +120 -188
  73. package/dist/controller/fileSchedulerStoreAdapter.js +787 -887
  74. package/dist/controller/jobControl.js +54 -85
  75. package/dist/controller/resourceInventory.js +8 -27
  76. package/dist/controller/resourceInventoryLinux.js +12 -13
  77. package/dist/controller/runtime.js +529 -479
  78. package/dist/controller/runtimeEventInbox.js +55 -25
  79. package/dist/controller/runtimeEventProcessor.js +22 -31
  80. package/dist/controller/{runtimeHookTurnFence.js → runtimeHookRunFence.js} +91 -115
  81. package/dist/controller/runtimeLaunchCoordinator.js +80 -426
  82. package/dist/controller/runtimeObservationHook.js +14 -18
  83. package/dist/controller/sessionNotify.js +16 -24
  84. package/dist/controller/sessionOwnerReconciliation.js +168 -50
  85. package/dist/controller/structuredProviderObservation.js +138 -99
  86. package/dist/coordination/workMailbox.js +3 -3
  87. package/dist/coordination/workMailboxQueue.js +36 -33
  88. package/dist/core/boundedRpc.js +8 -1
  89. package/dist/core/controllerClient.js +20 -1
  90. package/dist/core/controllerServer.js +4 -4
  91. package/dist/doctor/doctor.js +13 -2
  92. package/dist/domain/agentResultTransport.js +9 -9
  93. package/dist/execution/codexThreadNaming.js +2 -8
  94. package/dist/execution/executionHealth.js +51 -63
  95. package/dist/execution/reviewMainRun.js +137 -0
  96. package/dist/execution/workItemExecution.js +28 -29
  97. package/dist/execution/workItemExecutionProjection.js +99 -107
  98. package/dist/execution/workItemMainRun.js +141 -0
  99. package/dist/executor/agentAdapter.js +227 -20
  100. package/dist/executor/agentConfigurationCatalog.js +126 -4
  101. package/dist/executor/agentConfigurationProbe.js +162 -4
  102. package/dist/executor/agentExecutor.js +79 -78
  103. package/dist/executor/effectiveLaunch.js +105 -18
  104. package/dist/executor/executorRegistry.js +29 -44
  105. package/dist/executor/fileRoleLaunchPlanner.js +229 -154
  106. package/dist/executor/workspacePreflightClassification.js +16 -16
  107. package/dist/grant/capabilityGrant.js +6 -3
  108. package/dist/input/inputRequest.js +12 -10
  109. package/dist/integration/gitIntegrationService.js +4 -11
  110. package/dist/integration/integrationQueueService.js +4 -4
  111. package/dist/interaction/operatorPresentation.js +1 -1
  112. package/dist/kernel/builtinCapabilities.js +255 -12
  113. package/dist/kernel/capabilityRegistry.js +64 -18
  114. package/dist/kernel/instanceHost.js +12 -1
  115. package/dist/kernel/kernelPorts.js +2 -2
  116. package/dist/lifecycle/canonicalLifecycleEvent.js +44 -49
  117. package/dist/lifecycle/exactRunTerminalization.js +449 -0
  118. package/dist/message/message.js +118 -6
  119. package/dist/message/messageContinuation.js +204 -0
  120. package/dist/observability/executionAudit.js +70 -72
  121. package/dist/observability/faultClassification.js +2 -2
  122. package/dist/observability/orchestrationMetrics.js +8 -8
  123. package/dist/operator/operatorSessionHistory.js +1 -7
  124. package/dist/output/agentConfigurationPresentation.js +8 -3
  125. package/dist/output/agentRunConfigurationPresentation.js +128 -0
  126. package/dist/output/rolePresentation.js +54 -3
  127. package/dist/plugins/pluginChild.js +104 -0
  128. package/dist/plugins/pluginIntent.js +26 -0
  129. package/dist/plugins/pluginInterpreter.js +43 -0
  130. package/dist/plugins/pluginPackage.js +101 -0
  131. package/dist/plugins/pluginProcess.js +112 -0
  132. package/dist/plugins/pluginService.js +388 -0
  133. package/dist/profile/agentProfile.js +1 -1
  134. package/dist/repository/gitWorkspace.js +26 -4
  135. package/dist/repository/project.js +19 -4
  136. package/dist/repository/taskBaseFreshness.js +13 -13
  137. package/dist/repository/taskWorkspaceCoordinator.js +20 -27
  138. package/dist/repository/taskWorkspacePreparer.js +344 -83
  139. package/dist/resources/autoResourceGc.js +3 -3
  140. package/dist/resources/liveReferences.js +3 -3
  141. package/dist/resources/projectResource.js +75 -0
  142. package/dist/resources/projectResourceService.js +343 -0
  143. package/dist/resources/resourceDiscovery.js +6 -6
  144. package/dist/resources/resourceGc.js +1 -1
  145. package/dist/resources/resourceRegistrar.js +1 -1
  146. package/dist/resources/resourceTypes.js +1 -1
  147. package/dist/review/deltaRecheck.js +3 -3
  148. package/dist/review/reviewAcceptance.js +16 -16
  149. package/dist/review/reviewDecision.js +7 -7
  150. package/dist/review/reviewRound.js +21 -20
  151. package/dist/review/reviewerAvailability.js +2 -2
  152. package/dist/role/role.js +51 -7
  153. package/dist/role/taskRoleUpdate.js +30 -0
  154. package/dist/runtime/acpProtocol.js +425 -0
  155. package/dist/runtime/acpSession.js +731 -0
  156. package/dist/runtime/acpSessionConfiguration.js +260 -0
  157. package/dist/runtime/agentDriver.js +30 -11
  158. package/dist/runtime/agentEndpoint.js +278 -0
  159. package/dist/runtime/agentEndpointIdentity.js +86 -0
  160. package/dist/runtime/agentEndpointOwnership.js +239 -0
  161. package/dist/runtime/agentError.js +2 -10
  162. package/dist/runtime/agentHost.js +565 -314
  163. package/dist/runtime/agentRunConfiguration.js +258 -0
  164. package/dist/runtime/builtinAgentDrivers.js +134 -18
  165. package/dist/runtime/builtinAgentErrorMappers.js +55 -3
  166. package/dist/runtime/builtinTranscriptUsage.js +1 -1
  167. package/dist/runtime/claude-process-owner +0 -0
  168. package/dist/runtime/codexAppServerRuntime.js +38 -30
  169. package/dist/runtime/codexInteractiveHost.js +41 -6
  170. package/dist/runtime/continuationManager.js +2 -6
  171. package/dist/runtime/executionEnvironment.js +30 -0
  172. package/dist/runtime/firstProgressAdvisory.js +11 -11
  173. package/dist/runtime/index.js +4 -3
  174. package/dist/runtime/jsonLineChannel.js +109 -0
  175. package/dist/runtime/launchBroker.js +91 -16
  176. package/dist/runtime/launchDiagnostics.js +2 -2
  177. package/dist/runtime/lifecycleReservation.js +10 -18
  178. package/dist/runtime/managedCaller.js +61 -17
  179. package/dist/runtime/nativeSessionControl.js +102 -0
  180. package/dist/runtime/ports.js +6 -21
  181. package/dist/runtime/processExitObservation.js +8 -7
  182. package/dist/runtime/promptEnvelope.js +17 -6
  183. package/dist/runtime/providerContinuation.js +3 -9
  184. package/dist/runtime/providerContinuationReconciliationService.js +4 -13
  185. package/dist/runtime/providerControl.js +2 -7
  186. package/dist/runtime/providerRuntimeIdentity.js +110 -222
  187. package/dist/runtime/providerRuntimeReconciler.js +5 -9
  188. package/dist/runtime/runtimeBinding.js +0 -1
  189. package/dist/runtime/runtimeContinuationProjection.js +4 -7
  190. package/dist/runtime/runtimeDeadlines.js +9 -0
  191. package/dist/runtime/runtimeHealthPolicy.js +1 -1
  192. package/dist/runtime/runtimeObservation.js +29 -65
  193. package/dist/runtime/runtimeProjection.js +43 -51
  194. package/dist/runtime/runtimeSessionCandidate.js +1 -3
  195. package/dist/runtime/sessionLaunchRequest.js +3 -7
  196. package/dist/runtime/sessionOwnerIdentity.js +7 -54
  197. package/dist/runtime/sessionOwnerRegistry.js +22 -17
  198. package/dist/runtime/sessionReconciliation.js +4 -8
  199. package/dist/runtime/sessionTerminationGuard.js +70 -259
  200. package/dist/runtime/sessionTokenMetrics.js +5 -16
  201. package/dist/runtime/structuredProviderHost.js +237 -117
  202. package/dist/runtime/taskRuntimeIsolation.js +39 -122
  203. package/dist/runtime/tmuxAdapters.js +39 -86
  204. package/dist/scheduler/activeRoleRunDelivery.js +354 -0
  205. package/dist/scheduler/leaderWakeupProcessor.js +75 -266
  206. package/dist/scheduler/operatorInputNotificationProcessor.js +1 -1
  207. package/dist/scheduler/ports.js +80 -9
  208. package/dist/scheduler/{roleTurnLiveness.js → roleRunLiveness.js} +26 -30
  209. package/dist/scheduler/{roleTurnStall.js → roleRunStall.js} +128 -139
  210. package/dist/scheduler/taskExecutionProjection.js +120 -124
  211. package/dist/scheduler/taskObservabilityProjection.js +29 -29
  212. package/dist/scheduler/taskWake.js +11 -4
  213. package/dist/scheduler/wakeReason.js +9 -1
  214. package/dist/setup/setupCommand.js +3 -7
  215. package/dist/storage/migrations/agentRunContract.js +159 -0
  216. package/dist/storage/migrations/artifactsToGit.js +338 -0
  217. package/dist/storage/migrations/removeRuntimeGeneration.js +207 -0
  218. package/dist/storage/migrations/submitIntent.js +126 -0
  219. package/dist/storage/sqliteSchema.js +467 -7
  220. package/dist/storage/sqliteStore.js +355 -220
  221. package/dist/storage/storageVersions.js +1 -1
  222. package/dist/storage/storeRpc.js +10 -5
  223. package/dist/storage/taskStore.js +13 -11
  224. package/dist/storage/upgrade/upgradeOrchestrator.js +5 -7
  225. package/dist/surface/surfaceContributions.js +102 -0
  226. package/dist/task/completionReadiness.js +32 -6
  227. package/dist/task/deliveryGuard.js +16 -16
  228. package/dist/task/draftPlan.js +72 -12
  229. package/dist/task/nextAction.js +144 -128
  230. package/dist/task/remoteDelivery.js +6 -6
  231. package/dist/task/task.js +184 -18
  232. package/dist/task/taskActivation.js +327 -0
  233. package/dist/task/taskActivationService.js +408 -0
  234. package/dist/task/taskRecordReference.js +5 -4
  235. package/dist/task/taskRecordRetirement.js +1 -1
  236. package/dist/task/taskSubmission.js +236 -0
  237. package/dist/telemetry/sqliteTelemetryStore.js +55 -68
  238. package/dist/telemetry/telemetryConfig.js +14 -14
  239. package/dist/telemetry/telemetryWiring.js +2 -2
  240. package/dist/web/assets/assetManifest.js +2 -0
  241. package/dist/web/assets/client/app.js +121 -20
  242. package/dist/web/assets/client/components.js +87 -54
  243. package/dist/web/assets/client/i18n.js +83 -41
  244. package/dist/web/assets/client/markdown.js +1 -1
  245. package/dist/web/assets/client/taskSurface.js +442 -0
  246. package/dist/web/assets/client/view.js +49 -44
  247. package/dist/web/assets/shell.js +1 -1
  248. package/dist/web/assets/styles/cards.js +22 -4
  249. package/dist/web/controllerWeb.js +60 -0
  250. package/dist/web/webMutation.js +28 -0
  251. package/dist/web/webServer.js +133 -8
  252. package/dist/web/webSnapshot.js +81 -74
  253. package/dist/web/webTaskSurface.js +64 -0
  254. package/dist/workItem/dependencyGate.js +1 -1
  255. package/dist/workItem/workItem.js +84 -48
  256. package/dist/workspace/workItemChangeSetManager.js +16 -9
  257. package/docs/agent-result-consumption.md +96 -0
  258. package/docs/agent-result-consumption.zh-CN.md +81 -0
  259. package/docs/agent-runtime-drivers.md +93 -0
  260. package/docs/agent-runtime-drivers.zh-CN.md +77 -0
  261. package/docs/architecture/README.md +50 -0
  262. package/docs/architecture/README.zh-CN.md +43 -0
  263. package/docs/architecture/capabilities-and-resources.md +118 -0
  264. package/docs/architecture/capabilities-and-resources.zh-CN.md +83 -0
  265. package/docs/managed-turn-and-session-runtime.md +224 -0
  266. package/docs/managed-turn-and-session-runtime.zh-CN.md +180 -0
  267. package/docs/observability/README.md +83 -0
  268. package/docs/observability/README.zh-CN.md +71 -0
  269. package/docs/plugin-sdk.md +393 -0
  270. package/docs/plugin-sdk.zh-CN.md +293 -0
  271. package/docs/provider-runtime.md +165 -0
  272. package/docs/provider-runtime.zh-CN.md +132 -0
  273. package/docs/release-workflow.md +305 -0
  274. package/docs/release-workflow.zh-CN.md +237 -0
  275. package/docs/roles-and-configuration.md +115 -0
  276. package/docs/roles-and-configuration.zh-CN.md +96 -0
  277. package/docs/sqlite-control-plane-design.md +78 -0
  278. package/docs/sqlite-control-plane-design.zh-CN.md +62 -0
  279. package/docs/task-dag-semantics.md +80 -0
  280. package/docs/task-dag-semantics.zh-CN.md +59 -0
  281. package/docs/task-delivery.md +105 -0
  282. package/docs/task-delivery.zh-CN.md +82 -0
  283. package/docs/task-local-identity.md +8 -6
  284. package/docs/task-local-identity.zh-CN.md +58 -0
  285. package/docs/testing/verification-levels.md +88 -0
  286. package/docs/testing/verification-levels.zh-CN.md +69 -0
  287. package/i18n/README.zh-CN.md +270 -722
  288. package/package.json +3 -2
  289. package/skills/yui-leader/SKILL.md +88 -304
  290. package/skills/yui-leader/references/execution.md +303 -0
  291. package/skills/yui-leader/references/integration.md +39 -0
  292. package/skills/yui-leader/references/planning.md +109 -0
  293. package/skills/yui-leader/references/replicated-execution.md +42 -0
  294. package/skills/yui-leader/references/task-plugins.md +37 -0
  295. package/skills/yui-operator/SKILL.md +46 -62
  296. package/skills/yui-reviewer/SKILL.md +35 -36
  297. package/skills/yui-runtime/SKILL.md +88 -24
  298. package/skills/yui-runtime/references/publication.md +22 -0
  299. package/skills/yui-runtime/references/recovery.md +64 -0
  300. package/skills/yui-worker/SKILL.md +37 -39
  301. package/dist/cli/roleOptionCatalog.js +0 -68
  302. package/dist/context/sourceTurnContext.js +0 -30
  303. package/dist/execution/reviewMainTurn.js +0 -161
  304. package/dist/execution/workItemMainTurn.js +0 -164
  305. package/dist/lifecycle/exactTurnTerminalization.js +0 -407
  306. package/dist/runtime/preallocatedNativeSession.js +0 -13
  307. package/dist/runtime/runtimeStopReceipt.js +0 -42
  308. package/dist/scheduler/activeRoleTurnDelivery.js +0 -315
@@ -0,0 +1,77 @@
1
+ <p align="right"><a href="./agent-runtime-drivers.md">English</a> | <strong>简体中文</strong></p>
2
+
3
+ # Agent 运行时 Driver
4
+
5
+ AgentEndpoint 提供通用执行边界。Driver 把原生事件、错误和受支持的观察来源翻译
6
+ 成 `RuntimeObservation`;Controller、Store、CLI 和 Web 消费这份共享合同。
7
+
8
+ ## 职责
9
+
10
+ 连接实现拥有启动、协议、prompt 投递、resume 和中断。Driver 拥有原生身份提取、
11
+ 观察能力、事件/错误映射和用量归一化。Core 拥有权威、精确的请求关联、持久归并
12
+ 和投影;Agent 选择恢复方式并判断语义进展。
13
+
14
+ 内置 Driver 身份为 `openai/codex`、`anthropic/claude-code` 和
15
+ `acp/agent-client-protocol`。ACP 是协议 Driver,不是产品标签。接入一个 ACP peer
16
+ 不需要另一套业务状态模型。
17
+
18
+ 能力必须如实声明。未知的 resume、取消、活动或用量行为不能从产品名推断。
19
+
20
+ ## 观察路径
21
+
22
+ 原生结构化事实通过精确的 Session/请求围栏,进入运行时收件箱,并归并为持久观察
23
+ 和原始结果。一个单独采样的用量来源可以馈入同一份规范合同。Driver 不能选择另一个
24
+ actor、指派后继 Run,也不能绕过围栏。
25
+
26
+ Yui Run 身份与 Provider 原生 Turn 身份不可互换。一个显式派发的 Run 保留其已接受
27
+ 的原生关联;直接的原生对话不是另一个隐式 Run。重放按精确事实身份去重,迟到事件
28
+ 不能终结一个后继。
29
+
30
+ 受管 Codex 使用 App Server 事件。Claude 映射其结构化流以及受支持的 Hook/来源
31
+ 负载。ACP 映射协议 Session 更新和 prompt 响应。终端文本、信任对话框和 prompt
32
+ 字形都不是生命周期事实。
33
+
34
+ ## 状态与错误证据
35
+
36
+ 持久 Run 生命周期是 `active / completed / failed`。输入处置、原生等待/活动、Goal、
37
+ Session 生命周期和进程存在回答的是不同问题。UI 投影不得把一个排队中的请求当作
38
+ Agent 忙碌的证明,也不得把一个存活进程当作接受。
39
+
40
+ 标准 Agent 错误保留 source、phase、category、code、输入处置、Session 处置以及
41
+ 序列化的原生错误。类别包括 availability、rate-limit、transport、access、
42
+ invalid-request、context、session、runtime、conflict、cancelled 和 unknown。
43
+ 映射报告证据,而不是重试策略。无法识别的错误保持 unknown。
44
+
45
+ 运行时活动与工作流进展使用彼此独立的证据。一个工具边界可能显示原生活动;一个
46
+ 持久且被接受的结果才显示语义进展。token、CPU、RSS 和面板存在都不能替代接受或
47
+ Task 完成。
48
+
49
+ ## 用量
50
+
51
+ 用量是只读的,范围限定在确切的原生 Session。输入/输出总量与缓存/推理分解、请求
52
+ 上下文和剩余容量区分开来。稳定的 activity ID 对请求快照去重;累计增量只在具备
53
+ 有效有序的同 Session 证据时使用。
54
+
55
+ 缺失、部分、混合或已回滚的观察保持“未观察”,而不是猜测。增量观察者报告健康度
56
+ 和覆盖度;采样不阻塞生命周期事件。度量绝不触发模型选择、唤醒、重试、资源释放
57
+ 或接受。
58
+
59
+ ## 原生子代
60
+
61
+ 原生 subagent 是父对话内部的协作,不是 Yui Role、Lane 或独立的受管工作区 owner。
62
+ 当 Provider 暴露血缘和结果引用时,continuation 观察可以记录它们。
63
+
64
+ 尽力而为的子代结果通过父代返回。只有持久化的内容回执才支持 `durable-result`;
65
+ 存活的子代或声称的成功都不行。被报告的结果仍是不受信任数据。一段丢失的尽力而为
66
+ 对话可能需要重做工作。当需要独立的持久性和验收时,选择受管的 WorkItem 执行;
67
+ 复制是另一个单独的选择。
68
+
69
+ ## 接入与验证
70
+
71
+ 一个新的连接实现必须提供如实的控制/观察能力,并把它们与精确的身份、错误和终态
72
+ 映射配对。Provider 专有的协议细节留在边缘,不进入 Task 规划、Store 语义或 Web
73
+ 业务规则。
74
+
75
+ 针对变更的一次性证据应覆盖被改动的关联、权限、取消或观察边界。永久测试保持在
76
+ [验证策略](testing/verification-levels.zh-CN.md)中的主要路径。真实
77
+ Provider/模型验证需要显式授权,并且必须把原生进程证据与夹具输出区分开。
@@ -0,0 +1,50 @@
1
+ <p align="right"><strong>English</strong> | <a href="./README.zh-CN.md">简体中文</a></p>
2
+
3
+ # Architecture and documentation map
4
+
5
+ These documents describe the current source contracts. A capability boundary is
6
+ not a claim that every real Provider scenario has been validated.
7
+
8
+ ## Start here
9
+
10
+ - [README](../../README.md): install, configure and everyday use.
11
+ - [Chinese README](../../i18n/README.zh-CN.md): the same product entry in
12
+ Simplified Chinese.
13
+ - [Architecture overview](../../ARCHITECTURE.md): responsibilities, authority and
14
+ the end-to-end flow.
15
+ - [Capabilities, resources and Surfaces](capabilities-and-resources.md): the
16
+ extension ingress, instance ownership and resource effects.
17
+
18
+ ## Domain contracts
19
+
20
+ | Question | Current document |
21
+ | --- | --- |
22
+ | How do Session, AgentRun, messages and activation fit together? | [Session and AgentRun runtime](../managed-turn-and-session-runtime.md) |
23
+ | Who consumes results, synthesis and review? | [Result consumption](../agent-result-consumption.md) |
24
+ | When is a WorkItem dependency satisfied? | [Task dependencies](../task-dag-semantics.md) |
25
+ | How are records referenced inside a Task? | [Task-local identity](../task-local-identity.md) |
26
+ | How do Roles, Profiles and run configuration take effect? | [Roles and configuration](../roles-and-configuration.md) |
27
+ | How do delivery, integration and archive work? | [Task delivery](../task-delivery.md) |
28
+ | How do Provider, ACP and configuration facts connect? | [Provider runtime](../provider-runtime.md) |
29
+ | Who interprets runtime observations and errors? | [Agent Drivers](../agent-runtime-drivers.md) |
30
+ | How are plugins created, validated and adopted? | [Plugin SDK](../plugin-sdk.md) |
31
+ | What are the data, upgrade and concurrency boundaries? | [SQLite control plane](../sqlite-control-plane-design.md) |
32
+ | How do authorized release operations run? | [Release workflow](../release-workflow.md) |
33
+ | How do I read current runtime evidence? | [Observability](../observability/README.md) |
34
+ | Which checks should be kept permanently? | [Verification policy](../testing/verification-levels.md) |
35
+
36
+ ## Maintenance conventions
37
+
38
+ When behavior changes, update the owning contract and any entry-point text in the
39
+ same change. The exact CLI flags are defined by `src/cli/commandCatalog.ts` and
40
+ the command handlers; public domain types follow the running source. We do not
41
+ maintain a separate target model or a generated offline copy.
42
+
43
+ Each document is bilingual: `X.md` is the English version and `X.zh-CN.md` is the
44
+ Simplified Chinese one. When behavior changes, update both language versions
45
+ together so they stay in sync.
46
+
47
+ The Project Skill owns Yui's development and validation rules; the generic Role
48
+ Skills own how an Agent uses Yui. Repository documents do not replace the Project
49
+ Knowledge maintained under `YUI_HOME`, and they do not grant execution access to
50
+ shared environments, real models or external systems.
@@ -0,0 +1,43 @@
1
+ <p align="right"><a href="./README.md">English</a> | <strong>简体中文</strong></p>
2
+
3
+ # 当前架构与文档导航
4
+
5
+ 以下文档描述当前源码合同。能力边界不等于所有真实 Provider 场景已经验证。
6
+
7
+ ## 阅读入口
8
+
9
+ - [English README](../../README.md):安装、配置和日常使用。
10
+ - [中文 README](../../i18n/README.zh-CN.md):同一产品入口的中文说明。
11
+ - [总体架构](../../ARCHITECTURE.md):职责、权威和端到端流程(英文)。
12
+ - [能力、资源与 Surface](capabilities-and-resources.zh-CN.md):扩展入口、实例所有权和资源效果。
13
+
14
+ ## 领域合同
15
+
16
+ | 问题 | 当前文档 |
17
+ | --- | --- |
18
+ | Session、AgentRun、消息和激活如何配合? | [执行与会话](../managed-turn-and-session-runtime.zh-CN.md) |
19
+ | 谁消费结果、综合与审查? | [结果消费](../agent-result-consumption.zh-CN.md) |
20
+ | WorkItem 依赖何时满足? | [Task 依赖](../task-dag-semantics.zh-CN.md) |
21
+ | Task 内记录如何引用? | [局部身份](../task-local-identity.zh-CN.md) |
22
+ | Role、Profile 与运行配置如何生效? | [角色与配置](../roles-and-configuration.zh-CN.md) |
23
+ | 怎样交付、集成和归档? | [交付生命周期](../task-delivery.zh-CN.md) |
24
+ | Provider、ACP 与配置事实如何接入? | [Provider Runtime](../provider-runtime.zh-CN.md) |
25
+ | 运行观察和错误由谁解释? | [Agent Drivers](../agent-runtime-drivers.zh-CN.md) |
26
+ | 如何创建、验证与采用插件? | [插件 SDK](../plugin-sdk.zh-CN.md) |
27
+ | 数据、升级与并发的边界是什么? | [SQLite Store](../sqlite-control-plane-design.zh-CN.md) |
28
+ | 如何执行获授权的发布操作? | [发布流程](../release-workflow.zh-CN.md) |
29
+ | 如何查看当前运行证据? | [可观察性](../observability/README.zh-CN.md) |
30
+ | 哪些验证应长期保留? | [验证策略](../testing/verification-levels.zh-CN.md) |
31
+
32
+ ## 维护约定
33
+
34
+ 行为变更同步修改所属合同和必要的入口说明。具体 CLI 参数以
35
+ `src/cli/commandCatalog.ts` 和命令处理器为准;公开领域类型以运行源码为准,
36
+ 不另外维护一套目标模型或生成的离线副本。
37
+
38
+ 每篇文档保持中英双语:`X.md` 为英文,`X.zh-CN.md` 为对应中文。行为变更时
39
+ 一并更新两种语言版本,保持内容一致。
40
+
41
+ Project Skill 管理 Yui 的开发与验证规则;通用 Role Skills 管理 Agent 使用
42
+ Yui 的职责。仓库文档不替代 `YUI_HOME` 中维护的 Project Knowledge,也不授予
43
+ 共享环境、真实模型或外部系统的执行权限。
@@ -0,0 +1,118 @@
1
+ <p align="right"><strong>English</strong> | <a href="./capabilities-and-resources.zh-CN.md">简体中文</a></p>
2
+
3
+ # Capabilities, resources and Surfaces
4
+
5
+ ## One ingress, original facts
6
+
7
+ The Controller hosts the CapabilityRegistry and InstanceHost. `capability
8
+ search`, `describe` and `call` use one authenticated ingress: it first resolves
9
+ the current Session identity and Task scope, then checks capability and resource
10
+ permissions. An actor supplied in the input, or a self-declared user scope,
11
+ cannot grant permission.
12
+
13
+ A descriptor carries its name, contract version, Provider, scope, input/output
14
+ schema, effect and requiredPermissions. A query shows only the authorized
15
+ catalog; when a Provider or version is ambiguous, the caller selects explicitly
16
+ rather than relying on load order. The schema is a bounded dialect, and unknown
17
+ keywords are rejected.
18
+
19
+ The current catalog covers context, message, artifact, environment, resource,
20
+ project, plugin and selected task/job operations. Task lifecycle and some CLI/Web
21
+ writes share domain commands directly; these are not a second business state and
22
+ do not pretend to have run through the Registry.
23
+
24
+ ## Effects and operation facts
25
+
26
+ A capability's return value is separate from its real effect. A call can produce
27
+ a confirmed sub-operation even when its output validation fails, so the returned
28
+ result must preserve the original owner's operationRef and receipt. Unknown must
29
+ not be read as "did not run," and there is no automatic fallback.
30
+
31
+ A nested call rechecks current permissions and cannot widen the permissions or
32
+ effect the parent call declared. A requestId identifies the call; it does not
33
+ supply universal idempotency for every downstream operation — an owner such as a
34
+ Job runs its own exact idempotency contract. After an error, read the original
35
+ operation facts before deciding the next step.
36
+
37
+ ## Implementation instances
38
+
39
+ InstanceHost manages attach, acquire, release, detach and the actual references.
40
+ After a replacement is published, new calls select the new implementation while
41
+ existing references stay bound to the original one and can be disposed only once
42
+ drained. A query is an observation; it does not start or recover code. A cleanup
43
+ failure keeps its diagnosis, does not reverse a new publication into a failure,
44
+ and does not fake a drain.
45
+
46
+ A Session's long-lived reference is pinned by the actual AgentHost to the
47
+ implementation it loaded. The Controller carries an existing pin forward and does
48
+ not silently move a live Session onto different code. Ending a client and the
49
+ shared Provider's physical quiescence are judged separately.
50
+
51
+ ## Projects and workspaces
52
+
53
+ A Project stores its reference checkout, Knowledge and resource references. The
54
+ stable checkout is read-only; Task delivery happens in a managed worktree. A
55
+ multi-Project Task uses independent Git roots and explicit write scopes. A
56
+ workspace owner is a Task, WorkItem, ReviewRound or IntegrationAttempt. A Role
57
+ only selects execution configuration; it does not independently own a separate
58
+ workspace state.
59
+
60
+ Git integration captures an exact ChangeSet and advances the target by
61
+ compare-and-swap after its checks pass in a candidate worktree. A conflict,
62
+ failed check, moved target or rejection never advances the target, and the Agent
63
+ chooses the next action.
64
+
65
+ ## Artifacts and environments
66
+
67
+ - `artifact.save/read/list` maintains file/directory deliverables — complete
68
+ plans, prototypes, charts, reports — in the Task's own local-only Git
69
+ repository. `save` writes a `relativePath` and commits exactly that path,
70
+ returning a self-certifying `commit + relativePath` reference; `read` resolves
71
+ HEAD or a pinned commit for frozen evidence; `list` is an ordinary current
72
+ read. A reference is not a fixed delivery result; a final result cannot select
73
+ a missing or cross-Task artifact.
74
+ - `environment.prepare` prepares an empty, scratch or authorized local directory
75
+ without adopting it automatically.
76
+ - `environment.adopt` rechecks identity, resource intent, permissions and
77
+ conflicts, then records ownership.
78
+ - `environment.bind` selects a Role's next native execution environment; `null`
79
+ returns to the managed workspace.
80
+ - `environment.release` checks the real references and quiescence evidence and
81
+ never deletes a user directory.
82
+
83
+ An adopted native launch retains the directory's identity, access, isolation and
84
+ preparation reference, and rechecks them at launch, resume and the Yui input
85
+ boundary. Revoking a grant cannot silently re-adopt an old environment on the
86
+ strength of a new grant. Read-only environment support depends on the adapter; a
87
+ directory access label is not a general OS sandbox.
88
+
89
+ ## Plugins and self-extension
90
+
91
+ A Task Leader or the global Operator can manage that Task's plugins; a
92
+ Worker/Reviewer cannot self-manage or self-trust them. A declarative plugin runs
93
+ no arbitrary code; executing a trusted-local plugin additionally requires a grant
94
+ scoped to the exact source or artifact digest, environment and phase.
95
+
96
+ The Store keeps the enabled intent and validation artifacts, and the Host keeps
97
+ the actual instances. After a restart the enabled selection is still readable,
98
+ the actual instance can be empty, and activation must be explicit. The original
99
+ Task can discover and call the new capability without rewriting its own native
100
+ tool schema. A business result should be saved as an Artifact rather than
101
+ depending on the plugin staying alive.
102
+
103
+ See the [Plugin SDK](../plugin-sdk.md) for the full authoring, authorization and
104
+ failure contract.
105
+
106
+ ## CLI and Web
107
+
108
+ A Surface contribution is derived from the Registry's currently authorized
109
+ catalog; there is no second catalog or Host. A CLI contribution uses the
110
+ capability's original name. A Web panel accepts only controlled text, an HTTP(S)
111
+ link or a JSON query description — not author scripts or arbitrary HTML.
112
+
113
+ The Web listener is started and stopped by the Controller and allows loopback
114
+ only. A browser write goes through an existing domain transaction, and its error
115
+ distinguishes a definite non-commit from a committed-but-unknown result. A query
116
+ panel cannot use the browser's identity to run a mutation or manage plugins. A
117
+ terminal connection only attaches a client; it does not take over durable
118
+ ownership of the native conversation.
@@ -0,0 +1,83 @@
1
+ <p align="right"><a href="./capabilities-and-resources.md">English</a> | <strong>简体中文</strong></p>
2
+
3
+ # 能力、资源与 Surface
4
+
5
+ ## 唯一入口与原始事实
6
+
7
+ Controller 承载 CapabilityRegistry 和 InstanceHost。`capability search`、
8
+ `describe`、`call` 使用同一认证入口,先解析当前 Session 身份和 Task 范围,
9
+ 再检查能力与资源权限。输入中的 actor 或自称的 user scope 不能授予权限。
10
+
11
+ 描述符包含名称、合同版本、Provider、scope、输入输出 schema、effect 和
12
+ requiredPermissions。查询只展示获授权的目录;同名 Provider 或版本有歧义时,
13
+ 调用者明确选择,不按加载顺序决定。Schema 是有界方言,未知关键词拒绝。
14
+
15
+ 当前目录覆盖 context、message、artifact、environment、resource、project、
16
+ plugin 和部分 task/job 操作。Task 生命周期与部分 CLI/Web 写入直接共享
17
+ 领域命令;这些不是另一份业务状态,也不假称已经通过 Registry 执行。
18
+
19
+ ## 效果与操作事实
20
+
21
+ 能力返回值与真实效果分开。一次调用即使输出校验失败,也可能已产生确认的
22
+ 子操作;返回结果必须保留原 owner 的 operationRef 和 receipt。Unknown
23
+ 不能解释为未执行,不进行自动 fallback。
24
+
25
+ 嵌套调用重新检查当前权限,不能扩大父调用声明的权限与效果。requestId 标识
26
+ 调用,不自动提供所有业务的通用幂等性;Job 等 owner 执行自己的精确幂等合同。
27
+ 错误后先读取原操作事实再决定下一步。
28
+
29
+ ## 实现实例
30
+
31
+ InstanceHost 管理 attach、acquire、release、detach 与实际引用。替换发布后,
32
+ 新调用选择新实现;已有引用继续绑定原实现,排空后才能 dispose。查询是观察,
33
+ 不启动或恢复代码。清理失败保留诊断,不把新发布反转为失败,也不伪造排空。
34
+
35
+ Session 的长引用由实际 AgentHost 固定到所加载实现。Controller 传递已有 pin,
36
+ 不把活 Session 静默搬到另一份代码。结束客户端与共享 Provider 物理静止分别判断。
37
+
38
+ ## Project 与工作区
39
+
40
+ Project 保存参考 checkout、Knowledge 与资源引用。稳定 checkout 只读;Task
41
+ 交付发生在受管 worktree。多 Project Task 使用独立 Git 根和明确写范围。
42
+ 工作区 owner 属于 Task、WorkItem、ReviewRound 或 IntegrationAttempt。
43
+ Role 仅选择执行配置,不独立拥有另一份工作区状态。
44
+
45
+ Git 集成捕获精确 ChangeSet,在候选 worktree 检查后 CAS 推进目标。
46
+ 冲突、检查失败、目标移动与拒绝都不更新目标,Agent 决定下一次操作。
47
+
48
+ ## Artifact 与环境
49
+
50
+ - `artifact.save/read/list` 在 Task 自有的本地专用 Git 仓库中维护文件/目录交付物
51
+ (完整方案、原型、图表、报告)。`save` 写入 `relativePath` 并只提交该路径,
52
+ 返回自证的 `commit + relativePath` 引用;`read` 解析 HEAD 或固定 commit 以取冻结证据;
53
+ `list` 为普通当前读取。Reference 不等于固定交付成果;最终结果不能选择缺失或跨 Task Artifact。
54
+ - `environment.prepare` 准备 empty、scratch 或获授权 local 目录,不自动采用。
55
+ - `environment.adopt` 复核身份、资源意图、权限与冲突后保存所有权。
56
+ - `environment.bind` 选择 Role 下一次原生执行环境;`null` 返回 managed workspace。
57
+ - `environment.release` 检查真实引用和静止证据,不删除用户目录。
58
+
59
+ Adopted native launch 保留目录身份、access、isolation 与 preparation 引用,
60
+ 在 launch、resume 和 Yui 输入边界复核。撤权不能靠新 grant 静默重新采用旧环境。
61
+ Read-only 环境的支持取决于实现;不能将目录 access 标签视为通用 OS 沙箱。
62
+
63
+ ## 插件与自扩展
64
+
65
+ Task Leader 或 global Operator 可以管理该 Task 的插件;Worker/Reviewer 不能
66
+ 自行管理或授信。声明式插件不执行任意代码;trusted-local 插件执行还需要精确
67
+ 源码或产物摘要、环境和阶段的 grant。
68
+
69
+ Store 保存 enabled 意图及验证产物,Host 保存实际实例。重启后 enabled 仍可读,
70
+ actual 可以为空,必须显式激活。原 Task 可以发现并调用新能力,不必修改自身
71
+ 原生工具 schema。业务结果应保存为 Artifact,而不是依赖插件继续存活。
72
+
73
+ 完整作者、授权及失败合同见[插件 SDK](../plugin-sdk.zh-CN.md)。
74
+
75
+ ## CLI 与 Web
76
+
77
+ Surface contribution 由 Registry 当前获授权目录派生,没有第二份目录或 Host。
78
+ CLI contribution 使用能力原名称。Web panel 只接受受控 text、HTTP(S) link 或
79
+ JSON query 描述,不接受作者脚本或任意 HTML。
80
+
81
+ Web listener 由 Controller 启停,仅允许 loopback。浏览器写入通过现有领域
82
+ 事务,错误区分确定未提交与提交结果未知。查询面板不能借浏览器身份执行 mutation
83
+ 或插件管理。终端连接只 attach 客户端,不接管原生对话的持久所有权。
@@ -0,0 +1,224 @@
1
+ <p align="right"><strong>English</strong> | <a href="./managed-turn-and-session-runtime.zh-CN.md">简体中文</a></p>
2
+
3
+ # Session, AgentRun and notifications
4
+
5
+ ## Authority
6
+
7
+ Task, WorkItem, Message, Decision, Artifact and Project Knowledge preserve
8
+ durable work. Session identifies a native conversation and its captured
9
+ authority. AgentRun records an explicitly requested execution and original
10
+ result. AgentHost is a disposable attachment, not the owner of Task truth.
11
+
12
+ A current, non-revoked Leader Session can read Context and save scoped Task
13
+ facts, including a formal InputRequest, without an active Run. Its exact
14
+ Session is the request's origin; an actual Run is included when present.
15
+ The question survives that execution ending and remains open until answered
16
+ or cancelled. Worker and Reviewer commands retain exact
17
+ Assignment checks. Session replacement, Role binding, Task scope and resource
18
+ grants are checked at their respective boundaries. An active Run pointer is not
19
+ proof that an unrelated command in the same Session came from that Run.
20
+
21
+ Native chat, Goal continuations and ordinary Leader notifications do not
22
+ automatically create Runs. Explicit dispatch loads one exact Run Context Pack.
23
+
24
+ ## Context
25
+
26
+ ```sh
27
+ yui task context <task> --json
28
+ yui task context delta <task> --after <coreCursor>
29
+ yui task context inspect <task> --store <store> --ref <id>
30
+ yui task run context <task/run> --json
31
+ ```
32
+
33
+ Task Context is a bounded authorized working set with a current core cursor.
34
+ Delta pages immutable events through a fixed upper bound; inspect expands a
35
+ current record and can require an exact digest. Runtime observations state their
36
+ own coverage and do not become another durable snapshot.
37
+
38
+ Run Context freezes Assignment, source references, effective configuration and
39
+ workspace boundaries. A Role edit does not rewrite an existing Assignment.
40
+ Reading either Context does not acknowledge input or create execution authority.
41
+ Every managed input points to the exact Session Manifest and CLI entry. The
42
+ Run Pack is a reference directory: read the relevant requirement and message
43
+ bodies before acting, rather than treating a successful load as the deliverable.
44
+ Planning Packs expose no Project write scope or Task-completion permission.
45
+
46
+ Current Task reads also expose untargeted user/Operator messages to the Task's
47
+ current Worker and Reviewer Sessions, including requirements added after their
48
+ Run snapshot was frozen. Use `task message list/show` or Task Context inspect
49
+ to read those original records. This does not rewrite the frozen Assignment or
50
+ grant delivery authority. Directed messages, other Roles' results and other
51
+ Tasks remain outside the caller's scope unless its Assignment authorizes them.
52
+
53
+ ## Dispatch and notification
54
+
55
+ An explicit dispatch persists execution intent before native submission.
56
+ Ordinary Leader wake instead claims a fixed TaskWake/mailbox batch and submits
57
+ a notification through the same Host/Endpoint. Confirmed acceptance consumes
58
+ only that batch; later input remains pending. A notification requires no final
59
+ execution report and does not force steer into a busy native conversation.
60
+
61
+ Leader-local edits preserve durable events but do not create self-wakes.
62
+ Other sources' input remains durable while the Leader is busy or unavailable.
63
+ Operator notifications likewise carry TaskEvent/InputRequest read pointers,
64
+ not duplicated Task narrative.
65
+ Human input, explicit execution entry and activation failure are delivered
66
+ promptly through the existing wake mechanism. Worker results retain their
67
+ aggregation window. Busy native input still preserves pending messages.
68
+
69
+ | Evidence | Disposition |
70
+ | --- | --- |
71
+ | Busy with proven non-acceptance | Preserve input; a new transport attempt may use the same Session |
72
+ | Native acceptance | Never resend; wait for the exact terminal if this is an execution |
73
+ | Transport write only | Retain transport evidence; do not claim native acceptance |
74
+ | Explicit rejection | Retain the original cause and settle the corresponding admission |
75
+ | Unknown acceptance/effect | Retain the attempt and conflicting-resource fences; do not replay or switch Session |
76
+
77
+ Missing receipt after a crash is not proof of non-acceptance. Structured
78
+ `SESSION_BUSY` is evidence; text containing “busy” is not a retry contract.
79
+
80
+ ## Continue existing work
81
+
82
+ ```sh
83
+ yui task message send <task> "Continue with the clarified requirement" \
84
+ --to <role> --work-item <work-item>
85
+ yui task message handoff <task/message> --to <successor-role>
86
+ ```
87
+
88
+ Review clarification uses `--review-round` instead of `--work-item`.
89
+ Message retains recipient, work association and owner Run. When the Role is
90
+ busy, saving returns without interrupting it. Once it becomes available, a
91
+ bounded ordered batch can create a continuation Run atomically associated with
92
+ those messages. The existing Assignment, effective permissions, workspace and
93
+ unfinished files remain; the snapshot adds authorized messages and the preceding
94
+ original result. Duplicate terminals cannot assign the messages twice.
95
+
96
+ Ownership changes, incompatible Sessions, terminal work and obsolete Review
97
+ candidates retain visible nondelivery reasons. Explicit handoff only targets an
98
+ already-dispatched successor for the same work. Replicated Producer/synthesis
99
+ lineage is not silently rewritten by a message.
100
+
101
+ Unknown Leader notifications preserve their wake and input window:
102
+
103
+ ```sh
104
+ yui task wake show <task> <wake>
105
+ yui task wake resolve <task> <wake> --reason <quiescence-evidence>
106
+ ```
107
+
108
+ Resolve releases the claim after native-effect fences are clear. It neither
109
+ replays the notification nor invents acceptance or completion. Independent
110
+ Role work and legal local facts are not a Task-wide recovery lock.
111
+
112
+ ## Exact results
113
+
114
+ The native terminal settles only the matching execution. Known native Turn IDs
115
+ must match; a serialized stream may use proven local attempt correlation.
116
+ Message UUIDs are not native Turn IDs. Unrelated native chat in the same Session
117
+ cannot complete the pending Yui request.
118
+
119
+ The terminal transaction saves one AgentRunResult and a reference Message.
120
+ `resultRef: { type: "agent-run-result", runId: "run-12" }` expands the original
121
+ report rather than copying it. Candidate and ReviewRound retain provenance;
122
+ Core does not derive semantic acceptance from prose.
123
+
124
+ Cancellation requests do not prove physical quiescence. Exact terminal evidence
125
+ preserves partial output and settles the original execution only. Host exit
126
+ does not imply shared Provider or descendant processes have stopped.
127
+
128
+ ## Draft planning and activation
129
+
130
+ `EffectiveLaunchSnapshot.executionAuthority` captures `planning | delivery`.
131
+ It is not recalculated from the Task's current lifecycle. Planning permits
132
+ local planning facts, not delivery dispatch, candidate adoption, integration or
133
+ delivery workspace Jobs.
134
+
135
+ The initial Draft planning dispatch creates a planning Run and binds only its
136
+ initial message batch. Acceptance or an exact terminal consumes that batch;
137
+ failure does not repeatedly recreate the same planning execution. Subsequent ordinary
138
+ messages in the existing planning Session remain notifications. Operator submit
139
+ and direct Task messages both reach that Session. Draft plan/WorkItem edits
140
+ preserve execution history; external edits notify the Leader, while its own
141
+ planning edits do not create a self-wake.
142
+
143
+ New Draft Roles use a Task-specific planning directory under
144
+ `<YUI_HOME>.task-runtimes/planning`, outside the control Home and delivery trees.
145
+ A planning Run can use `task activation request` to persist intent and return an
146
+ `afterPlanningRun` reference immediately. Its terminal releases the request for
147
+ Controller admission; cancelled intent is not resurrected.
148
+ The Leader can also request activation during ordinary discussion without an
149
+ AgentRun: the Controller adopts its durable intent once the native input is
150
+ settled. No synthetic Run or extra user “continue” is required.
151
+
152
+ For bound Git Projects, `--environment empty` means no additional environment:
153
+ the Projects still receive managed worktrees. `scratch` selects a Task-owned
154
+ directory. `local` requires a registered local Resource and its grant; a Project
155
+ ID is not a local Resource ID.
156
+
157
+ Resource preparation precedes the atomic adoption of Task status and workspace
158
+ ownership. A failed adoption records a failed request and notifies the Leader
159
+ with durable facts; it does not repeatedly prepare resources on unchanged
160
+ failure. The Leader chooses an explicit retry or corrected request. Successful
161
+ activation likewise leaves a delivery notification for the Leader.
162
+ Activation never mutates the live Session into delivery authority. A changed
163
+ launch must pass the existing Session replacement/environment boundary.
164
+ Planning authority is a CLI guarantee, not a hostile-code filesystem sandbox.
165
+
166
+ ## Inspection and lifecycle
167
+
168
+ ```sh
169
+ yui task run list <task>
170
+ yui task run show <task/run> --json
171
+ yui task message show <task/message>
172
+ yui task role session inspect <task> <role>
173
+ yui task execution start <task>
174
+ yui task execution stop <task> --force --reason <reason>
175
+ ```
176
+
177
+ Task execution start/stop controls Task admission, not Task acceptance.
178
+ Stop first fences new Yui work, then interrupts each exact owned native input
179
+ and confirms its terminal before removing the attachment. This also covers
180
+ ordinary Leader notifications without Runs. Unknown native state blocks cleanup;
181
+ stopping a proxy alone never proves a shared Turn ended. Start preserves durable
182
+ progress and admits new input after the old occupancy is settled.
183
+ Draft planning can be paused/resumed, and a failed planning Run retries with
184
+ planning authority. An authorized user/Operator can stop an idle Draft Session
185
+ through `task role session stop`; it need not activate the Task merely to recover.
186
+ `task role session new <task> <role> --reason <reason>` persists an explicit
187
+ replacement request. Reuse is a preference, not a requirement to prove the old
188
+ conversation unrecoverable. The request is legal while an AgentRun is active,
189
+ the Session is ended, or previous cleanup is pending. A Leader may also request
190
+ its own replacement and end its current turn.
191
+
192
+ `task role session stop` can also stop a running Role without first changing
193
+ its Run status. It retains the native conversation for possible reuse. Pending
194
+ Messages remain intent and may start a continuation after the stop; use Task
195
+ execution stop when the whole Task must remain paused. For self-replacement,
196
+ use the asynchronous `session new` request rather than a synchronous self-stop.
197
+
198
+ The existing runtime cleanup path stops the exact native execution, closes this
199
+ Role's remaining engineering attempts as cancelled, retains Session/Run history
200
+ and workspaces, and selects a fresh conversation. Other Roles and Task acceptance
201
+ remain unchanged. The Leader receives a new context notification; it decides
202
+ which Worker/Reviewer attempts to retry. Pending input references survive the
203
+ replacement, including records older than the new notification's time window.
204
+
205
+ An absent Host does not remove the recovery entry point. Codex can be inspected
206
+ and interrupted through a disposable native control connection without starting
207
+ a model. Dedicated Claude process custody is persisted independently of the
208
+ Host. Real unconfirmed execution still prevents conflicting resource reuse;
209
+ cleanup failure is a durable diagnostic routed to the supervisor, not a reason
210
+ to invent acceptance or delete the Task. A preallocated ID alone is not proof
211
+ a conversation exists.
212
+ Codex may retain `systemError` after a failed native Turn. That label alone
213
+ neither proves activity nor authorizes cleanup: Yui checks the latest native
214
+ Turn's terminal metadata and drains background execution before replacing the
215
+ Session. Unknown or still-running native work remains protected.
216
+
217
+ Released Leaders retain scoped diagnostic reads of their own Task and context,
218
+ but cannot mutate it or read another Task. Operator diagnostics and Controller
219
+ restart do not first require a healthy Controller; explicit restart can stop
220
+ only the exact same-Home process using PID/start identity when RPC is unavailable.
221
+ Operator storage diagnosis/upgrade also reaches the dedicated migration entry
222
+ without first requiring the Home to already have the target storage version.
223
+ Completion, cancellation and archive have distinct authority and resource
224
+ boundaries. Storage changes use the single [upgrade contract](sqlite-control-plane-design.md).