@zq-silk/yui 0.15.11 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/ARCHITECTURE.md +11 -6
  2. package/ARCHITECTURE.zh-CN.md +8 -4
  3. package/README.md +13 -5
  4. package/dist/agentRun/agentRun.js +3 -0
  5. package/dist/artifacts/artifactCommitLock.js +16 -55
  6. package/dist/artifacts/taskArtifactRepository.js +3 -3
  7. package/dist/cli/agentConfigurationPicker.js +1 -1
  8. package/dist/cli/commandCatalog.js +92 -48
  9. package/dist/cli/completion.js +18 -18
  10. package/dist/cli/completionWizard.js +1 -1
  11. package/dist/cli/dynamicCompletion.js +1 -1
  12. package/dist/cli/interactionPolicy.js +11 -3
  13. package/dist/cli/invocationAuthority.js +64 -0
  14. package/dist/cli/managedDiagnostics.js +2 -2
  15. package/dist/cli/parseRepeatable.js +35 -0
  16. package/dist/cli/updatePorts.js +26 -5
  17. package/dist/cli.js +1303 -1235
  18. package/dist/commands/agentCommands.js +4 -4
  19. package/dist/commands/capabilityCommands.js +1 -1
  20. package/dist/commands/configCommands.js +6 -57
  21. package/dist/commands/configOverview.js +2 -2
  22. package/dist/commands/durableJobCommands.js +12 -6
  23. package/dist/commands/executionAuditCommands.js +10 -0
  24. package/dist/commands/globalRoleCommands.js +78 -29
  25. package/dist/commands/grantCommands.js +0 -3
  26. package/dist/commands/jobCommands.js +1 -4
  27. package/dist/commands/operatorCommands.js +3 -3
  28. package/dist/commands/projectCommands.js +45 -25
  29. package/dist/commands/resourcesCommands.js +10 -40
  30. package/dist/commands/roleConfiguration.js +2 -6
  31. package/dist/commands/taskActivationCommands.js +4 -8
  32. package/dist/commands/taskAgentCapabilities.js +9 -0
  33. package/dist/commands/taskCommandSupport.js +155 -0
  34. package/dist/commands/taskCommandTypes.js +1 -0
  35. package/dist/commands/taskCommands.js +355 -732
  36. package/dist/commands/taskCompletionGate.js +1 -1
  37. package/dist/commands/taskExecutionCommands.js +1 -1
  38. package/dist/commands/taskFactCommands.js +325 -0
  39. package/dist/commands/taskInputCommands.js +12 -42
  40. package/dist/commands/taskIntegrationCommands.js +20 -58
  41. package/dist/commands/taskNextActionCommand.js +7 -6
  42. package/dist/commands/taskPublicationAdoptCommand.js +127 -0
  43. package/dist/commands/taskPublicationCommands.js +12 -3
  44. package/dist/commands/taskPublicationVerifyCommand.js +24 -40
  45. package/dist/commands/taskRemoteDeliveryCommand.js +5 -86
  46. package/dist/commands/taskUpstreamCommands.js +19 -8
  47. package/dist/commands/workflowCommands.js +6 -1
  48. package/dist/completion/completionInstaller.js +26 -26
  49. package/dist/completion/completionState.js +26 -26
  50. package/dist/completion/fileCompletionManager.js +6 -11
  51. package/dist/config/configCatalog.js +0 -2
  52. package/dist/config/timeZone.js +14 -0
  53. package/dist/config/yuiConfig.js +0 -29
  54. package/dist/context/runContextPack.js +5 -3
  55. package/dist/context/taskCatalog.js +185 -0
  56. package/dist/context/taskContext.js +152 -151
  57. package/dist/context/wakeRunReferences.js +11 -0
  58. package/dist/controller/agentCapabilities.js +58 -0
  59. package/dist/controller/agentRuntimeObserver.js +6 -11
  60. package/dist/controller/clientRuntime.js +22 -14
  61. package/dist/controller/controller.js +20 -24
  62. package/dist/controller/fileSchedulerStoreAdapter.js +191 -225
  63. package/dist/controller/globalInputDelivery.js +13 -0
  64. package/dist/controller/jobClient.js +4 -4
  65. package/dist/controller/jobControl.js +60 -25
  66. package/dist/controller/jobSupervisor.js +4 -4
  67. package/dist/controller/providerRetryAdmission.js +100 -0
  68. package/dist/controller/providerRetryDelivery.js +218 -0
  69. package/dist/controller/runtime.js +85 -43
  70. package/dist/controller/runtimeEventProcessor.js +0 -5
  71. package/dist/controller/sessionOwnerReconciliation.js +5 -0
  72. package/dist/controller/taskAgentError.js +35 -0
  73. package/dist/coordination/workMailboxQueue.js +2 -24
  74. package/dist/core/controllerClient.js +2 -2
  75. package/dist/core/fileLockOwner.js +74 -0
  76. package/dist/decision/decision.js +17 -0
  77. package/dist/doctor/doctor.js +18 -9
  78. package/dist/event/taskEvent.js +12 -0
  79. package/dist/execution/workItemExecutionProjection.js +2 -2
  80. package/dist/executor/agentCapabilityConfig.js +43 -0
  81. package/dist/executor/agentConfigurationCatalog.js +49 -11
  82. package/dist/executor/agentExecutor.js +5 -8
  83. package/dist/executor/fileRoleLaunchPlanner.js +11 -53
  84. package/dist/executor/taskAgentCapabilities.js +64 -0
  85. package/dist/integration/deliveryObligation.js +1 -69
  86. package/dist/integration/gitIntegrationService.js +79 -90
  87. package/dist/integration/integrationAttempt.js +3 -14
  88. package/dist/integration/integrationSourceApplication.js +4 -12
  89. package/dist/integration/manifestTags.js +2 -2
  90. package/dist/job/durableJob.js +4 -25
  91. package/dist/job/jobAssignmentScope.js +22 -0
  92. package/dist/job/jobOperation.js +16 -0
  93. package/dist/job/jobRunner.js +2 -1
  94. package/dist/job/stepDirectory.js +15 -0
  95. package/dist/kernel/builtinCapabilities.js +15 -11
  96. package/dist/kernel/kernelPorts.js +1 -17
  97. package/dist/lifecycle/exactRunTerminalization.js +5 -10
  98. package/dist/message/globalProviderRetry.js +15 -0
  99. package/dist/message/inputControlResolution.js +3 -4
  100. package/dist/message/message.js +17 -20
  101. package/dist/message/messageContinuation.js +1 -1
  102. package/dist/milestone/milestone.js +11 -0
  103. package/dist/observability/executionAudit.js +19 -0
  104. package/dist/observability/orchestrationMetrics.js +24 -1
  105. package/dist/observability/runtimeIdentity.js +1 -17
  106. package/dist/output/agentConfigurationPresentation.js +2 -0
  107. package/dist/output/timePresentation.js +1 -14
  108. package/dist/plugins/pluginService.js +12 -4
  109. package/dist/release/releaseWorkflowPorts.js +45 -96
  110. package/dist/release/runtimeRelease.js +9 -15
  111. package/dist/repository/gitWorkspace.js +371 -105
  112. package/dist/repository/projectMaintenanceLock.js +98 -82
  113. package/dist/repository/taskBaseFreshness.js +1 -1
  114. package/dist/repository/taskWorkspaceCoordinator.js +82 -144
  115. package/dist/repository/taskWorkspacePreparer.js +113 -47
  116. package/dist/repository/workspaceCleanupInspection.js +187 -0
  117. package/dist/resources/autoResourceGc.js +4 -77
  118. package/dist/resources/liveReferences.js +7 -54
  119. package/dist/resources/resourceDiscovery.js +5 -118
  120. package/dist/resources/resourceGc.js +233 -181
  121. package/dist/resources/resourceRegistrar.js +5 -4
  122. package/dist/resources/resourceRegistry.js +3 -37
  123. package/dist/resources/resourceRegistryStore.js +13 -36
  124. package/dist/resources/sqliteResourceRegistry.js +43 -26
  125. package/dist/review/deltaRecheck.js +1 -1
  126. package/dist/review/reviewAcceptance.js +1 -1
  127. package/dist/review/reviewDecision.js +1 -1
  128. package/dist/review/reviewRound.js +8 -7
  129. package/dist/review/taskFinalReviewContractResolution.js +1 -1
  130. package/dist/runtime/acpProtocol.js +4 -51
  131. package/dist/runtime/acpSession.js +10 -75
  132. package/dist/runtime/acpSessionConfiguration.js +1 -8
  133. package/dist/runtime/agentEndpoint.js +3 -2
  134. package/dist/runtime/agentError.js +5 -3
  135. package/dist/runtime/agentFailureContext.js +43 -0
  136. package/dist/runtime/agentHost.js +42 -25
  137. package/dist/runtime/builtinAgentErrorMappers.js +91 -0
  138. package/dist/runtime/codexAppServerRuntime.js +34 -3
  139. package/dist/runtime/codexInteractiveHost.js +2 -2
  140. package/dist/runtime/index.js +0 -1
  141. package/dist/runtime/managedCaller.js +21 -1
  142. package/dist/runtime/providerControl.js +5 -1
  143. package/dist/runtime/providerErrors.js +38 -0
  144. package/dist/runtime/providerRetry.js +198 -0
  145. package/dist/runtime/providerRuntimeIdentity.js +28 -2
  146. package/dist/runtime/runtimeObservation.js +0 -5
  147. package/dist/runtime/runtimeSessionCandidate.js +2 -3
  148. package/dist/runtime/sessionOwnerIdentity.js +1 -1
  149. package/dist/runtime/sessionTokenMetrics.js +15 -5
  150. package/dist/runtime/structuredProviderHost.js +10 -43
  151. package/dist/runtime/taskUsageMetrics.js +275 -0
  152. package/dist/runtime/tmuxAdapters.js +6 -8
  153. package/dist/scheduler/activeRoleRunDelivery.js +19 -7
  154. package/dist/scheduler/leaderWakeupProcessor.js +24 -6
  155. package/dist/scheduler/operatorEvent.js +12 -20
  156. package/dist/scheduler/operatorInputNotificationProcessor.js +1 -1
  157. package/dist/scheduler/ports.js +5 -8
  158. package/dist/scheduler/roleRunLiveness.js +4 -4
  159. package/dist/scheduler/roleRunStall.js +16 -23
  160. package/dist/scheduler/taskExecutionProjection.js +49 -36
  161. package/dist/scheduler/taskObservabilityProjection.js +6 -45
  162. package/dist/scheduler/taskWake.js +5 -10
  163. package/dist/scheduler/wakeReason.js +2 -0
  164. package/dist/scheduler/wakeupQueue.js +2 -4
  165. package/dist/setup/setupCommand.js +1 -1
  166. package/dist/storage/contextRecords.js +106 -0
  167. package/dist/storage/currentTaskStore.js +1 -1
  168. package/dist/storage/homeLayout.js +13 -17
  169. package/dist/storage/migrations/agentFailureContext.js +22 -0
  170. package/dist/storage/migrations/currentInputContract.js +86 -0
  171. package/dist/storage/migrations/currentRuntimeContract.js +228 -0
  172. package/dist/storage/migrations/historicalVerificationPlan.js +35 -0
  173. package/dist/storage/migrations/integrationContinuation.js +5 -4
  174. package/dist/storage/migrations/narrowAgentFailureContext.js +65 -0
  175. package/dist/storage/migrations/notificationOnlyWakes.js +74 -0
  176. package/dist/storage/migrations/verificationPlanV1.js +162 -0
  177. package/dist/storage/migrations/verificationPolicy.js +74 -0
  178. package/dist/storage/migrations/workItemHistory.js +46 -0
  179. package/dist/storage/persistenceWorker.js +12 -4
  180. package/dist/storage/recordValidation.js +87 -0
  181. package/dist/storage/sqliteSchema.js +173 -1
  182. package/dist/storage/sqliteStore.js +172 -161
  183. package/dist/storage/storageSchema.js +2 -14
  184. package/dist/storage/storageVersions.js +1 -1
  185. package/dist/storage/storeRpc.js +16 -7
  186. package/dist/storage/taskCatalog.js +123 -0
  187. package/dist/storage/taskStore.js +5 -7
  188. package/dist/storage/upgrade/upgradeOrchestrator.js +25 -37
  189. package/dist/task/archiveDiagnostics.js +1 -0
  190. package/dist/task/archivePreflight.js +124 -0
  191. package/dist/task/completionReadiness.js +5 -24
  192. package/dist/task/draftPlan.js +0 -53
  193. package/dist/task/nextAction.js +7 -13
  194. package/dist/task/publicationAdoption.js +56 -0
  195. package/dist/task/publicationReference.js +10 -0
  196. package/dist/task/remoteDelivery.js +31 -16
  197. package/dist/task/remoteDeliveryService.js +89 -0
  198. package/dist/task/taskActivation.js +2 -25
  199. package/dist/task/taskActivationService.js +0 -2
  200. package/dist/task/taskRecordReference.js +0 -1
  201. package/dist/task/taskSubmission.js +3 -14
  202. package/dist/telemetry/sqliteTelemetryBatch.js +29 -0
  203. package/dist/telemetry/sqliteTelemetryStore.js +49 -49
  204. package/dist/telemetry/telemetryWiring.js +4 -3
  205. package/dist/tmux/tmuxManager.js +29 -20
  206. package/dist/verification/gateArtifact.js +15 -24
  207. package/dist/verification/gateArtifactStore.js +14 -7
  208. package/dist/verification/verificationGateService.js +29 -88
  209. package/dist/verification/verificationPlan.js +27 -72
  210. package/dist/web/assets/client/app.js +92 -17
  211. package/dist/web/assets/client/components.js +55 -13
  212. package/dist/web/assets/client/i18n.js +72 -4
  213. package/dist/web/assets/client/taskSurface.js +6 -5
  214. package/dist/web/assets/client/view.js +35 -7
  215. package/dist/web/assets/shell.js +6 -0
  216. package/dist/web/assets/styles/layout.js +7 -0
  217. package/dist/web/webServer.js +12 -3
  218. package/dist/web/webSnapshot.js +14 -85
  219. package/dist/web/webTaskSurface.js +17 -46
  220. package/dist/workItem/workItem.js +1 -12
  221. package/dist/workspace/cleanupInspection.js +63 -0
  222. package/dist/workspace/workItemChangeSetManager.js +110 -50
  223. package/docs/agent-result-consumption.md +4 -0
  224. package/docs/agent-result-consumption.zh-CN.md +3 -0
  225. package/docs/agent-runtime-drivers.md +7 -0
  226. package/docs/agent-runtime-drivers.zh-CN.md +5 -0
  227. package/docs/architecture/README.md +2 -0
  228. package/docs/architecture/README.zh-CN.md +3 -1
  229. package/docs/architecture/capabilities-and-resources.md +42 -5
  230. package/docs/architecture/capabilities-and-resources.zh-CN.md +33 -3
  231. package/docs/managed-turn-and-session-runtime.md +121 -1
  232. package/docs/managed-turn-and-session-runtime.zh-CN.md +96 -2
  233. package/docs/observability/README.md +62 -0
  234. package/docs/observability/README.zh-CN.md +47 -0
  235. package/docs/plugin-sdk.md +4 -2
  236. package/docs/project-refresh.md +77 -0
  237. package/docs/project-refresh.zh-CN.md +59 -0
  238. package/docs/provider-retry.md +70 -0
  239. package/docs/provider-runtime.md +3 -1
  240. package/docs/provider-runtime.zh-CN.md +4 -2
  241. package/docs/release-workflow.md +190 -7
  242. package/docs/release-workflow.zh-CN.md +139 -5
  243. package/docs/roles-and-configuration.md +29 -0
  244. package/docs/roles-and-configuration.zh-CN.md +21 -0
  245. package/docs/sqlite-control-plane-design.md +16 -3
  246. package/docs/sqlite-control-plane-design.zh-CN.md +13 -2
  247. package/docs/task-dag-semantics.md +3 -3
  248. package/docs/task-dag-semantics.zh-CN.md +2 -2
  249. package/docs/task-delivery.md +223 -17
  250. package/docs/task-delivery.zh-CN.md +171 -14
  251. package/docs/task-discovery.md +101 -0
  252. package/docs/task-discovery.zh-CN.md +85 -0
  253. package/docs/testing/verification-levels.md +161 -9
  254. package/docs/testing/verification-levels.zh-CN.md +116 -9
  255. package/i18n/README.zh-CN.md +13 -7
  256. package/package.json +1 -1
  257. package/skills/yui-leader/SKILL.md +5 -0
  258. package/skills/yui-leader/references/execution.md +3 -2
  259. package/skills/yui-leader/references/integration.md +9 -5
  260. package/skills/yui-leader/references/planning.md +9 -3
  261. package/skills/yui-operator/SKILL.md +24 -8
  262. package/skills/yui-reviewer/SKILL.md +4 -0
  263. package/skills/yui-runtime/SKILL.md +17 -2
  264. package/skills/yui-runtime/references/publication.md +26 -4
  265. package/skills/yui-runtime/references/recovery.md +71 -0
  266. package/dist/agent/agentRegistry.js +0 -10
  267. package/dist/agentRun/runIdentity.js +0 -22
  268. package/dist/commands/deliveryGuardPreflight.js +0 -30
  269. package/dist/commands/taskIntegrationQueueCommands.js +0 -226
  270. package/dist/commands/taskOverviewCommand.js +0 -376
  271. package/dist/completion/completionWizard.js +0 -125
  272. package/dist/context/dispatchContext.js +0 -110
  273. package/dist/context/wakeNotification.js +0 -144
  274. package/dist/integration/integrationCheckEvidenceReuse.js +0 -53
  275. package/dist/integration/integrationQueueEntry.js +0 -191
  276. package/dist/integration/integrationQueueService.js +0 -810
  277. package/dist/release/fakeReleasePorts.js +0 -55
  278. package/dist/runtime/sessionOwnerRegistry.js +0 -137
  279. package/dist/task/deliveryGuard.js +0 -226
  280. /package/dist/{commands/taskActor.js → task/taskAuthority.js} +0 -0
@@ -1,5 +1,6 @@
1
1
  import { isDeepStrictEqual } from "node:util";
2
- import { lstat } from "node:fs/promises";
2
+ import { lstat, realpath } from "node:fs/promises";
3
+ import { join } from "node:path";
3
4
  import { createWorkItemChangeSet } from "../integration/changeSet.js";
4
5
  import { createChangeSetManifest } from "../integration/changeSetManifest.js";
5
6
  import { deriveManifestTags } from "../integration/manifestTags.js";
@@ -8,6 +9,7 @@ import { sameTaskFinalReviewContract } from "../review/taskFinalReviewContract.j
8
9
  import { governingWorkItemCandidate } from "../workItem/workItem.js";
9
10
  import { managedWorkspaceKey } from "../worktree/managedWorkspace.js";
10
11
  import { captureManagedGitChanges } from "./gitChangeSetCapture.js";
12
+ import { CleanupInspectionError, cleanupCheckFromError, workspacePathValue } from "./cleanupInspection.js";
11
13
  const CAPTURABLE_WORK_ITEM_STATUSES = new Set([
12
14
  "open",
13
15
  "accepted",
@@ -45,6 +47,12 @@ export class WorkItemChangeSetManager {
45
47
  return captured;
46
48
  }
47
49
  async assertIntegrated(taskId, workItemId, candidateId) {
50
+ const inspection = await this.inspectIntegrated(taskId, workItemId, candidateId);
51
+ if (inspection.checks.length > 0)
52
+ throw new CleanupInspectionError(inspection.checks);
53
+ return inspection.proof;
54
+ }
55
+ async inspectIntegrated(taskId, workItemId, candidateId) {
48
56
  const item = this.store.getWorkItem(taskId, workItemId);
49
57
  if (item === null)
50
58
  throw new Error(`Work item not found: ${taskId}/${workItemId}.`);
@@ -54,62 +62,114 @@ export class WorkItemChangeSetManager {
54
62
  throw new Error(`Candidate not found: ${taskId}/${workItemId}/${candidateId}.`);
55
63
  }
56
64
  const workspace = this.store.getWorkItemWorkspace(item.taskId, item.id);
57
- if (workspace === null
58
- || workspace.owner.type !== "work-item"
59
- || workspace.owner.workItemId !== item.id)
60
- return null;
65
+ if (workspace === null)
66
+ return { proof: null, checks: [] };
61
67
  const git = new NodeGitWorkspace();
62
68
  const projects = [];
63
- for (const entry of writableEntries(workspace)) {
64
- const path = await lstat(entry.path).catch(error => {
65
- if (error.code === "ENOENT")
66
- return null;
67
- throw error;
68
- });
69
- if (path?.isSymbolicLink())
70
- throw new Error(`WorkItem path is a symbolic link: ${entry.path}.`);
71
- if (path !== null && !await git.isClean(entry.path)) {
72
- throw new Error(`WorkItem Project workspace is not clean: ${item.id}/${entry.projectId}.`);
69
+ const checks = [];
70
+ const sources = [`work-item:${taskId}/${workItemId}`,
71
+ `candidate:${taskId}/${workItemId}/${candidate?.id ?? "missing"}`, managedWorkspaceKey(workspace.owner)];
72
+ const actions = [`yui task work show ${taskId}/${workItemId}`, `yui task integration list ${taskId}`];
73
+ const add = (resource, reason, detail, expected, observed) => {
74
+ checks.push({ resource, reason, detail, expected, observed, status: "blocked", sources, actions });
75
+ };
76
+ const resource = `work-item:${taskId}/${workItemId}`;
77
+ if (workspace.owner.type !== "work-item" || workspace.owner.taskId !== taskId || workspace.owner.workItemId !== item.id) {
78
+ add(resource, "workspace-identity-mismatch", "Managed workspace is not owned by this WorkItem.", { type: "work-item", taskId, workItemId }, "different owner");
79
+ return { proof: null, checks };
80
+ }
81
+ if (candidate?.workspace === undefined) {
82
+ add(resource, "candidate-workspace-missing", "The governing Candidate has no frozen workspace.", "frozen WorkItem workspace", null);
83
+ }
84
+ else if (!isDeepStrictEqual(candidate.workspace, workspace)) {
85
+ const frozen = candidate.workspace;
86
+ if (!isDeepStrictEqual(frozen.owner, workspace.owner)) {
87
+ add(resource, "workspace-identity-mismatch", "Frozen and current workspace owners differ.", frozen.owner, workspace.owner);
88
+ }
89
+ // Paths remain frozen evidence. A path-shaped difference alone is NOT a
90
+ // receipt proving that migration moved this exact Candidate safely.
91
+ if (frozen.root !== workspace.root) {
92
+ add(resource, "workspace-path-mismatch", "Workspace roots differ; relocation is not proven.", workspacePathValue(workspace, frozen.root), workspacePathValue(workspace, workspace.root));
93
+ }
94
+ if (!isDeepStrictEqual(frozen.entries.map(e => e.projectId), workspace.entries.map(e => e.projectId))) {
95
+ add(resource, "workspace-identity-mismatch", "Frozen and current Project scope/order differ.", frozen.entries.map(e => e.projectId), workspace.entries.map(e => e.projectId));
96
+ }
97
+ for (const entry of workspace.entries) {
98
+ const previous = frozen.entries.find(e => e.projectId === entry.projectId);
99
+ if (previous === undefined)
100
+ continue;
101
+ const entryResource = `${resource}/${entry.projectId}`;
102
+ if (previous.path !== entry.path) {
103
+ add(entryResource, "workspace-path-mismatch", "Frozen and current Project paths differ; no relocation receipt is available. Historical evidence is unchanged.", workspacePathValue(workspace, previous.path), workspacePathValue(workspace, entry.path));
104
+ }
105
+ for (const key of ["directory", "access", "branch", "baseRef", "baseCommit"]) {
106
+ if (previous[key] !== entry[key])
107
+ add(entryResource, "workspace-identity-mismatch", `Frozen and current ${key} differ.`, { [key]: previous[key] }, { [key]: entry[key] });
108
+ }
109
+ }
110
+ for (const key of ["schemaVersion", "createdAt", "updatedAt"]) {
111
+ if (frozen[key] !== workspace[key])
112
+ add(resource, "workspace-metadata-mismatch", `Frozen and current ${key} differ.`, { [key]: frozen[key] }, { [key]: workspace[key] });
73
113
  }
114
+ }
115
+ for (const entry of writableEntries(workspace)) {
116
+ const projectResource = `${resource}/${entry.projectId}`;
74
117
  const resultCommit = candidate?.gitSnapshot?.projects.find(({ projectId }) => projectId === entry.projectId)?.commit;
75
- // Absence is a filesystem fact, not proof of integration or Git cleanup.
76
- // Check any retained branch against the same frozen Candidate; the
77
- // cleanup primitive separately removes its exact Git registration.
78
- const repository = this.store.getTaskWorkspace(taskId)?.entries.find(e => e.projectId === entry.projectId);
79
- const workspaceHeadCommit = path !== null ? (await git.inspect(entry.path, "HEAD")).baseCommit
80
- : repository !== undefined && await git.refExists(repository.path, entry.branch)
81
- ? (await git.inspect(repository.path, entry.branch)).baseCommit
82
- : resultCommit;
83
- if (candidate?.workspace === undefined
84
- || !isDeepStrictEqual(candidate.workspace, workspace)
85
- || resultCommit === undefined
86
- || (candidateId === undefined && resultCommit !== workspaceHeadCommit)) {
87
- throw new Error(`WorkItem Project no longer matches its frozen result: ${item.id}/${entry.projectId}.`);
118
+ if (resultCommit === undefined)
119
+ add(projectResource, "frozen-commit-missing", "The governing Candidate has no frozen Project commit.", "frozen commit", null);
120
+ if (resultCommit !== undefined) {
121
+ // An explicit historical selection is proved against its immutable
122
+ // integrated commit, not mislabeled as the workspace's current HEAD.
123
+ const integrated = this.store.listIntegrationAttempts(item.taskId).some(integration => integration.status === "committed"
124
+ && integration.projectId === entry.projectId
125
+ && integration.source.kind === "work-item"
126
+ && integration.source.workItemId === item.id
127
+ && integration.source.startCommit === entry.baseCommit
128
+ && integration.source.resultCommit === resultCommit);
129
+ if (!integrated) {
130
+ add(projectResource, "result-not-integrated", "WorkItem result is not integrated.", { baseCommit: entry.baseCommit, resultCommit }, "no committed Integration with these exact commits");
131
+ }
132
+ projects.push({ projectId: entry.projectId, baseCommit: entry.baseCommit, headCommit: resultCommit });
88
133
  }
89
- // An explicit historical selection is proved against its immutable
90
- // integrated commit, not mislabeled as the workspace's current HEAD.
91
- const headCommit = resultCommit;
92
- const integrated = this.store.listIntegrationAttempts(item.taskId).some((integration) => (integration.status === "committed"
93
- && integration.projectId === entry.projectId
94
- && integration.source.kind === "work-item"
95
- && integration.source.workItemId === item.id
96
- && integration.source.startCommit === entry.baseCommit
97
- && integration.source.resultCommit === headCommit));
98
- if (!integrated) {
99
- throw new Error(`WorkItem result is not integrated: ${item.id}/${entry.projectId}.`);
134
+ if (entry.path !== join(workspace.root, entry.directory)) {
135
+ add(projectResource, "workspace-path-mismatch", "Current path differs from the exact owner-root/Project location.", workspacePathValue(workspace, join(workspace.root, entry.directory)), workspacePathValue(workspace, entry.path));
136
+ continue;
137
+ }
138
+ try {
139
+ const path = await lstat(entry.path).catch(error => {
140
+ if (error.code === "ENOENT")
141
+ return null;
142
+ throw error;
143
+ });
144
+ if (path !== null && (path.isSymbolicLink() || await realpath(entry.path) !== entry.path)) {
145
+ add(projectResource, "workspace-identity-mismatch", "WorkItem path resolves through a symbolic link.", "real owned directory", "symbolic link");
146
+ continue;
147
+ }
148
+ // Absence is a filesystem fact, not proof of integration or Git cleanup.
149
+ // Check any retained branch against the same frozen Candidate; the
150
+ // cleanup primitive separately removes its exact Git registration.
151
+ const repository = this.store.getTaskWorkspace(taskId)?.entries.find(e => e.projectId === entry.projectId);
152
+ const workspaceHeadCommit = path !== null ? (await git.inspect(entry.path, "HEAD")).baseCommit
153
+ : repository !== undefined && await git.refExists(repository.path, entry.branch)
154
+ ? (await git.inspect(repository.path, entry.branch)).baseCommit
155
+ : resultCommit;
156
+ if (candidateId === undefined && resultCommit !== undefined && resultCommit !== workspaceHeadCommit) {
157
+ add(projectResource, "head-mismatch", "Current HEAD no longer matches the frozen result.", resultCommit, workspaceHeadCommit ?? null);
158
+ }
159
+ if (path !== null && !await git.inspectClean(entry.path)) {
160
+ add(projectResource, "dirty-worktree", "WorkItem Project workspace is not clean.", "clean", "dirty");
161
+ }
162
+ }
163
+ catch (error) {
164
+ checks.push(...cleanupCheckFromError(error, projectResource, sources, actions));
100
165
  }
101
- projects.push({
102
- projectId: entry.projectId,
103
- baseCommit: entry.baseCommit,
104
- headCommit
105
- });
106
166
  }
107
- return {
108
- workItemId: item.id,
109
- ...(item.assignee === undefined ? {} : { assignee: item.assignee }),
110
- workspace,
111
- projects
112
- };
167
+ return { checks, proof: checks.length > 0 ? null : {
168
+ workItemId: item.id,
169
+ ...(item.assignee === undefined ? {} : { assignee: item.assignee }),
170
+ workspace,
171
+ projects
172
+ } };
113
173
  }
114
174
  /**
115
175
  * Fail-closed proof that retiring the aggregate will not hide unrecorded Git
@@ -2,6 +2,10 @@
2
2
 
3
3
  # Agent result consumption
4
4
 
5
+ For candidate discovery before reading original results, use the
6
+ [bounded Task catalog](task-discovery.md). A catalog summary never replaces a
7
+ requirement or the original result.
8
+
5
9
  Every explicitly dispatched AgentRun produces one durable original result.
6
10
  Ordinary notification and native conversation do not implicitly create Runs.
7
11
  The next Agent in the ownership chain reads the exact result and decides what
@@ -2,6 +2,9 @@
2
2
 
3
3
  # Agent 结果消费
4
4
 
5
+ 读取原始结果前,可用[有界 Task 目录](task-discovery.zh-CN.md)发现候选任务。
6
+ 目录摘要不替代需求正文或原始结果。
7
+
5
8
  每一次显式派发的 AgentRun 都产生一个持久的原始结果。普通通知和原生对话不会
6
9
  隐式创建 Run。所有权链上的下一个 Agent 读取这个精确结果并判断它意味着什么。
7
10
 
@@ -67,6 +67,13 @@ than guessed. Incremental observers report health and coverage; sampling does
67
67
  not block lifecycle events. Metrics never trigger model selection, wake, retry,
68
68
  resource release or acceptance.
69
69
 
70
+ [Task usage and time](observability/README.md#task-usage-and-time) reuse this
71
+ reducer across historical Sessions. Task-fenced observations are not a billing
72
+ completeness guarantee. Native child counters are excluded from parent Session
73
+ totals without an explicit non-overlap contract; they are never extra requests.
74
+ Raw cumulative Session counters and safely attributable Task increments remain
75
+ distinct, and only exact request/Run bindings support WorkItem allocation.
76
+
70
77
  ## Native children
71
78
 
72
79
  Native subagents are collaboration inside a parent conversation, not Yui Roles,
@@ -56,6 +56,11 @@ Task 完成。
56
56
  和覆盖度;采样不阻塞生命周期事件。度量绝不触发模型选择、唤醒、重试、资源释放
57
57
  或接受。
58
58
 
59
+ [Task 用量与耗时](observability/README.zh-CN.md#task-用量与耗时)跨历史 Session
60
+ 复用此 reducer。Task 围栏内的观察不是完整账单保证。缺少明确互斥合同时,原生
61
+ 子计数不加入父 Session 总量,也不作为额外请求。原始 Session 累计值与安全归属
62
+ 的 Task 增量分开;仅精确请求/Run 绑定支持 WorkItem 分配。
63
+
59
64
  ## 原生子代
60
65
 
61
66
  原生 subagent 是父对话内部的协作,不是 Yui Role、Lane 或独立的受管工作区 owner。
@@ -20,11 +20,13 @@ not a claim that every real Provider scenario has been validated.
20
20
  | Question | Current document |
21
21
  | --- | --- |
22
22
  | How do Session, AgentRun, messages and activation fit together? | [Session and AgentRun runtime](../managed-turn-and-session-runtime.md) |
23
+ | What can Web control, and how do queue, steer and interrupt differ? | [Web permissions](capabilities-and-resources.md#cli-and-web) · [Input timing](../managed-turn-and-session-runtime.md#input-timing-queue-steer-and-interrupt) |
23
24
  | Who consumes results, synthesis and review? | [Result consumption](../agent-result-consumption.md) |
24
25
  | When is a WorkItem dependency satisfied? | [Task dependencies](../task-dag-semantics.md) |
25
26
  | How are records referenced inside a Task? | [Task-local identity](../task-local-identity.md) |
26
27
  | How do Roles, Profiles and run configuration take effect? | [Roles and configuration](../roles-and-configuration.md) |
27
28
  | How do delivery, integration and archive work? | [Task delivery](../task-delivery.md) |
29
+ | What does Project refresh synchronize, and how are partial failures reported? | [Project refresh](../project-refresh.md) |
28
30
  | How do Provider, ACP and configuration facts connect? | [Provider runtime](../provider-runtime.md) |
29
31
  | Who interprets runtime observations and errors? | [Agent Drivers](../agent-runtime-drivers.md) |
30
32
  | How are plugins created, validated and adopted? | [Plugin SDK](../plugin-sdk.md) |
@@ -8,7 +8,7 @@
8
8
 
9
9
  - [English README](../../README.md):安装、配置和日常使用。
10
10
  - [中文 README](../../i18n/README.zh-CN.md):同一产品入口的中文说明。
11
- - [总体架构](../../ARCHITECTURE.md):职责、权威和端到端流程(英文)。
11
+ - [总体架构](../../ARCHITECTURE.zh-CN.md):职责、权威和端到端流程。
12
12
  - [能力、资源与 Surface](capabilities-and-resources.zh-CN.md):扩展入口、实例所有权和资源效果。
13
13
 
14
14
  ## 领域合同
@@ -16,11 +16,13 @@
16
16
  | 问题 | 当前文档 |
17
17
  | --- | --- |
18
18
  | Session、AgentRun、消息和激活如何配合? | [执行与会话](../managed-turn-and-session-runtime.zh-CN.md) |
19
+ | Web 可以控制什么,queue、steer 和 interrupt 有何区别? | [Web 权限](capabilities-and-resources.zh-CN.md#cli-与-web) · [输入时机](../managed-turn-and-session-runtime.zh-CN.md#输入时机queuesteer-与-interrupt) |
19
20
  | 谁消费结果、综合与审查? | [结果消费](../agent-result-consumption.zh-CN.md) |
20
21
  | WorkItem 依赖何时满足? | [Task 依赖](../task-dag-semantics.zh-CN.md) |
21
22
  | Task 内记录如何引用? | [局部身份](../task-local-identity.zh-CN.md) |
22
23
  | Role、Profile 与运行配置如何生效? | [角色与配置](../roles-and-configuration.zh-CN.md) |
23
24
  | 怎样交付、集成和归档? | [交付生命周期](../task-delivery.zh-CN.md) |
25
+ | Project refresh 同步什么,怎样报告部分失败? | [Project refresh](../project-refresh.zh-CN.md) |
24
26
  | Provider、ACP 与配置事实如何接入? | [Provider Runtime](../provider-runtime.zh-CN.md) |
25
27
  | 运行观察和错误由谁解释? | [Agent Drivers](../agent-runtime-drivers.zh-CN.md) |
26
28
  | 如何创建、验证与采用插件? | [插件 SDK](../plugin-sdk.zh-CN.md) |
@@ -105,14 +105,51 @@ failure contract.
105
105
 
106
106
  ## CLI and Web
107
107
 
108
+ Ordinary Global CLI operations require the Role's current native Session;
109
+ an old Manifest is a context pointer, not continuing write authority. Historical
110
+ self-context reads and the explicit offline diagnostic/recovery routes remain
111
+ available. Home configuration and resource-GC mutations belong to the user or
112
+ current Operator, never a Task Worker. Configuration reads remain available.
113
+
114
+ Managed Task commands cannot name a different Task. Independent Brief,
115
+ Decision, Milestone, Event and Job reads share Context's readable references;
116
+ an Assignment does not gain a wider view by selecting another query command.
117
+ Job read RPCs carry an explicit caller, and the Controller enforces the scope.
118
+ Current WorkItem Jobs remain visible to their assigned Worker.
119
+
108
120
  A Surface contribution is derived from the Registry's currently authorized
109
121
  catalog; there is no second catalog or Host. A CLI contribution uses the
110
122
  capability's original name. A Web panel accepts only controlled text, an HTTP(S)
111
123
  link or a JSON query description — not author scripts or arbitrary HTML.
112
124
 
113
125
  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.
126
+ only (`127.0.0.1`, `::1` or `localhost`; default port 4173). `yui web` opens this
127
+ local surface, not a remote multi-user service or an OS sandbox.
128
+
129
+ The page supplies a token that authenticates all HTTP API reads and writes via
130
+ `x-yui-web-token`; the server also checks the loopback Host. These controls act
131
+ as the trusted local user, not a Role selected by the request body. They support
132
+ Task metadata edits, messages, InputRequest answers, and explicit
133
+ `queue / steer / interrupt` for Task or Global Roles. Managed Agent capability
134
+ RPC retains its own Session authentication and scope; a browser token is not
135
+ a way for an Agent or plugin to bypass those boundaries.
136
+
137
+ Read-only dashboard, Context and query-panel projections remain separate from
138
+ these mutations. A query panel cannot borrow the browser's user authority to
139
+ mutate state or manage plugins. Task controls share the public CLI's domain
140
+ commands; Global Role controls share the Global handler with
141
+ `yui role message queue/steer` and `yui role interrupt`. Message submission intent
142
+ (`record / discuss / develop`, default `discuss`) is
143
+ separate from [input timing](../managed-turn-and-session-runtime.md#input-timing-queue-steer-and-interrupt).
144
+ Transport acceptance does not establish implementation or Task acceptance.
145
+
146
+ A browser write uses an existing domain transaction. Errors distinguish proven
147
+ `not-submitted` from `unknown`, which can include an already-committed Message
148
+ whose native delivery failed or is unconfirmed. Read the original Message,
149
+ control receipt and current Session before choosing recovery; do not blindly
150
+ resubmit under a new request ID or switch actions.
151
+
152
+ A terminal WebSocket checks the token and same-origin handshake. It attaches a
153
+ client without taking over durable conversation ownership, and respects the
154
+ connection's `readOnly` flag. A terminal attachment is not a grant to control a
155
+ different Session.
@@ -74,10 +74,40 @@ actual 可以为空,必须显式激活。原 Task 可以发现并调用新能
74
74
 
75
75
  ## CLI 与 Web
76
76
 
77
+ 普通 Global CLI 操作要求 Role 当前的原生 Session;旧 Manifest 只是 Context
78
+ 指针,不是持续写权限。历史 Session 的自身 Context 读取,以及明确的离线诊断、
79
+ 恢复入口仍可使用。Home 配置与资源 GC 修改属于用户或当前 Operator,不能由
80
+ Task Worker 执行;配置读取保持可用。
81
+
82
+ 受管 Task 命令不能指定其他 Task。独立的 Brief、Decision、Milestone、Event
83
+ 和 Job 查询复用 Context 的可读引用,不能通过换查询入口扩大 Assignment
84
+ 视图。Job 读取 RPC 必须携带调用者,由 Controller 执行范围检查;
85
+ Worker 仍可读取其当前 WorkItem 的 Job。
86
+
77
87
  Surface contribution 由 Registry 当前获授权目录派生,没有第二份目录或 Host。
78
88
  CLI contribution 使用能力原名称。Web panel 只接受受控 text、HTTP(S) link 或
79
89
  JSON query 描述,不接受作者脚本或任意 HTML。
80
90
 
81
- Web listener 由 Controller 启停,仅允许 loopback。浏览器写入通过现有领域
82
- 事务,错误区分确定未提交与提交结果未知。查询面板不能借浏览器身份执行 mutation
83
- 或插件管理。终端连接只 attach 客户端,不接管原生对话的持久所有权。
91
+ Web listener 由 Controller 启停,仅允许 loopback(`127.0.0.1`、`::1` 或
92
+ `localhost`;默认端口 4173)。`yui web` 打开的是本地 Surface,不是远程多用户
93
+ 服务或 OS 沙箱。
94
+
95
+ 页面提供 token,通过 `x-yui-web-token` 认证所有 HTTP API 读取与写入;服务端
96
+ 也检查 loopback Host。这些控制使用受信任本地用户身份,不由请求正文选择 Role。
97
+ 它们支持修改 Task 元数据、发送消息、回答 InputRequest,以及对 Task 或 Global
98
+ Role 显式 `queue / steer / interrupt`。受管 Agent 的能力 RPC 仍使用自身 Session
99
+ 认证与范围;浏览器 token 不是 Agent 或插件绕过这些边界的途径。
100
+
101
+ 只读 dashboard、Context 和查询面板投影与这些修改分开。查询面板不能借浏览器的
102
+ 用户权限修改状态或管理插件。Task 控制复用公开 CLI 领域命令;Global Role 控制复用
103
+ Global 处理器,与 `yui role message queue/steer` 和 `yui role interrupt` 共用入口。消息提交意图
104
+ (`record / discuss / develop`,默认 `discuss`)与
105
+ [输入时机](../managed-turn-and-session-runtime.zh-CN.md#输入时机queuesteer-与-interrupt)
106
+ 分开。传输接受不证明需求已实施或 Task 已验收。
107
+
108
+ 浏览器写入使用现有领域事务。错误区分已证明的 `not-submitted` 与 `unknown`;
109
+ 后者可能包含已经提交、但原生投递失败或未确认的 Message。选择恢复动作前先读
110
+ 原始 Message、控制回执和当前 Session,不盲目换 request ID 重发或切换动作。
111
+
112
+ 终端 WebSocket 校验 token 和同源握手。它只 attach 客户端,不接管对话的持久
113
+ 所有权,并遵守连接的 `readOnly` 标记。附着终端不授予控制其他 Session 的权限。
@@ -98,6 +98,42 @@ candidates retain visible nondelivery reasons. Explicit handoff only targets an
98
98
  already-dispatched successor for the same work. Replicated Producer/synthesis
99
99
  lineage is not silently rewritten by a message.
100
100
 
101
+ Rejected Leader notifications retain their original input and failure diagnosis.
102
+ Deterministic startup failures do not automatically retry; only typed runtime
103
+ contention remains deferred. New messages and a Controller restart do not replay
104
+ the rejected claim. After correcting the cause, explicitly retry its exact wake:
105
+
106
+ ```sh
107
+ yui task wake show <task> <wake>
108
+ yui task wake retry <task> <wake> --reason "<what was corrected>"
109
+ ```
110
+
111
+ Retry returns the rejected batch and later queued input to the existing mailbox;
112
+ it does not rewrite the old wake as accepted or replace a Session. Current runtime
113
+ authority and readiness checks still apply. Model/effort validation rejections show the
114
+ native model options and a command to inspect the full current catalog.
115
+
116
+ Pre-Run launch failures and native Provider rejections both retain a
117
+ `runtime.agent-error` fact. Notification delivery references that original error
118
+ instead of creating a second copy of the cause. `task event show` supplies the
119
+ scoped capability-query pointer in both human and JSON output; `wake show`
120
+ links the same fact. An unavailable Leader notifies the existing Operator
121
+ channel once; Worker/Reviewer failures use the existing Leader channel. No new
122
+ recovery Agent is started, and there need not be a Run or Session to record the
123
+ failure.
124
+
125
+ Storage 35→36 archives original historical error payloads and marks their
126
+ unrecorded launch configuration as unavailable. It never reconstructs old model,
127
+ account or settings choices from current Roles.
128
+
129
+ Storage 36→37 narrows that context to native metadata selectors and the requested
130
+ model/effort. Full old snapshots remain in migration audit, not in the active
131
+ reader. Reading a failure's model options does not validate Task permissions,
132
+ Review state, workspace entries or the current Session bootstrap protocol.
133
+ The three failure ingresses retain their native fencing/classification, while
134
+ record creation and deduplication share one writer and supervisor notices use
135
+ the existing event-routing boundary.
136
+
101
137
  Unknown Leader notifications preserve their wake and input window:
102
138
 
103
139
  ```sh
@@ -109,6 +145,86 @@ Resolve releases the claim after native-effect fences are clear. It neither
109
145
  replays the notification nor invents acceptance or completion. Independent
110
146
  Role work and legal local facts are not a Task-wide recovery lock.
111
147
 
148
+ Wake status records notification delivery, not Message implementation. For
149
+ ordinary Leader notifications, `consumed` means native acceptance. Native Turn
150
+ completion and Task delivery need their own runtime evidence and durable results.
151
+ A rejected wake stays `dispatched` with its claim until explicit retry or Session
152
+ replacement; an explicitly released historical wake can remain `dispatched`
153
+ without a claim. Unknown acceptance cannot use `wake retry`.
154
+ Session replacement preserves queued input for a new wake and current Context;
155
+ it does not retroactively mark an old wake accepted. Late receipts cannot settle
156
+ the successor's batch. While Session cleanup is pending, new input remains queued.
157
+ Inspect the wake, `notification.delivery` events, current mailbox and Session
158
+ together; do not require one final response per historical wake.
159
+
160
+ Current wakes are notification-only. Run completion cannot consume a wake, and
161
+ the first notification window starts at Task creation. Retired Run-linked wake
162
+ records remain in Task events with their original ID and payload, not as a
163
+ second active wake format.
164
+
165
+ ## Input timing: queue, steer and interrupt
166
+
167
+ Submission intent (`record / discuss / develop`) decides how a requirement is
168
+ routed. Input timing decides when an already-authorized input reaches a Role;
169
+ it does not activate a Task, expand an Assignment or upgrade planning authority.
170
+ Save-only input uses `message send --intent record`; `--wake-policy` is removed.
171
+ Unkeyed Draft Message edits preserve submission intent. `record` and `develop`
172
+ edits never start planning or create/retry activation; `discuss` edits use the
173
+ same activation/planning routing as a discussion submission. A pending or failed
174
+ activation therefore keeps the edited discussion waiting.
175
+
176
+ A Message with a submission key, queue/steer request, or interrupt-then handoff
177
+ has immutable content: submit a new Message with a new request ID to change it.
178
+ This preserves the original retry comparison and receipt without adding a
179
+ second stored representation of input. Updating to the identical body is a
180
+ no-op, with no event, queue change or Controller notification. Current stored
181
+ user/operator Messages always have an intent; changing that intent also requires
182
+ a new explicit submission.
183
+ The [authenticated Web controls](architecture/capabilities-and-resources.md#cli-and-web)
184
+ use the same three operations as the CLI.
185
+
186
+ | Action | Effect | What it does not prove |
187
+ | --- | --- | --- |
188
+ | `queue` | Saves a Message for the recipient's next legal opportunity, idempotently by request ID | Reading Context or accepting delivery is not implementation |
189
+ | `steer` | Saves a Message and attempts native steering of the exact current Turn | Unsupported, stale or unconfirmed steering is not a queued continuation |
190
+ | `interrupt` | Records a control request and asks the Provider to cancel the exact current Turn | A stop request is not a terminal or proof that background resources stopped |
191
+
192
+ Inspect the Session before selecting a live target:
193
+
194
+ ```sh
195
+ yui task role session inspect <task> <role>
196
+ yui task message queue <task> "<continuation>" --request-id <id>
197
+ yui task message steer <task> "<correction>" --request-id <id> --to leader --expected-target <turn>
198
+ yui task role interrupt <task> <role> --expected-target <turn> --request-id <id> [--then-message <task/message>]
199
+ ```
200
+
201
+ Ordinary Leader `queue` input omits `--to`. An explicit `--to <role>` (including
202
+ `leader`) addresses an existing Assignment and requires `--work-item` or
203
+ `--review-round`; a Message cannot establish that Assignment. `steer` still
204
+ requires an explicit Role and exact live target.
205
+ Reusing a request ID with different content or a different target
206
+ is a conflict. `steer` and `interrupt` never silently retarget, replace a Session,
207
+ kill a process or fall back to another action. No live managed Turn yields
208
+ `NO_ACTIVE_TURN`; stale targets and unsupported control remain explicit outcomes.
209
+
210
+ Bare interrupt creates no Message. Optional `--then-message` names an already-saved,
211
+ eligible input and reserves its next opportunity only after an exact terminal,
212
+ within the original Session/writer boundary. It is not a fourth action or a way
213
+ to replay accepted, pending or unknown steering. A conclusive non-delivery can
214
+ permit an explicit new control choice when the user's intent authorizes it;
215
+ uncertainty cannot.
216
+
217
+ Global Roles use the same three actions with their own owner and Session,
218
+ without inventing a Task or Run. The local-user Web surface exposes them through
219
+ the shared Global Role handler. The public CLI exposes
220
+ `yui role message queue|steer <role> <text>` and `yui role interrupt <role>`.
221
+ Queue/steer require `--request-id`; steer/interrupt require `--expected-target`.
222
+ These commands retain the caller's existing Session authority; do not fabricate
223
+ a Task/Run or borrow the browser's user authority. Configuration remains under
224
+ `config role`, lifecycle under `session`. New controlled Global Sessions use the Host console.
225
+ A live unmanaged Session is not silently adopted; an explicit Session lifecycle
226
+ action is needed first.
227
+
112
228
  ## Exact results
113
229
 
114
230
  The native terminal settles only the matching execution. Known native Turn IDs
@@ -141,7 +257,7 @@ preserve execution history; external edits notify the Leader, while its own
141
257
  planning edits do not create a self-wake.
142
258
 
143
259
  New Draft Roles use a Task-specific planning directory under
144
- `<YUI_HOME>.task-runtimes/planning`, outside the control Home and delivery trees.
260
+ `<YUI_HOME>/runtime/task-runtimes/planning`, separate from durable control data and delivery trees.
145
261
  A planning Run can use `task activation request` to persist intent and return an
146
262
  `afterPlanningRun` reference immediately. Its terminal releases the request for
147
263
  Controller admission; cancelled intent is not resurrected.
@@ -154,6 +270,10 @@ the Projects still receive managed worktrees. `scratch` selects a Task-owned
154
270
  directory. `local` requires a registered local Resource and its grant; a Project
155
271
  ID is not a local Resource ID.
156
272
 
273
+ `task activate` is foreground adoption of an existing request, not an alternative
274
+ way to create activation intent. A request-free Draft is rejected before resource
275
+ preparation; the command does not invent an environment plan or request ID.
276
+
157
277
  Resource preparation precedes the atomic adoption of Task status and workspace
158
278
  ownership. A failed adoption records a failed request and notifies the Leader
159
279
  with durable facts; it does not repeatedly prepare resources on unchanged