@zq-silk/yui 0.15.6 → 0.15.8

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 (282) hide show
  1. package/ARCHITECTURE.md +192 -399
  2. package/README.md +127 -1149
  3. package/dist/agent/adapterCatalog.js +15 -2
  4. package/dist/agent/agent.js +23 -3
  5. package/dist/agent/argumentPolicy.js +7 -1
  6. package/dist/agent/connectionPlan.js +62 -0
  7. package/dist/agent/executionComponents.js +158 -0
  8. package/dist/agent/launchEnvironment.js +31 -3
  9. package/dist/agent/managedRuntimeEnvironment.js +3 -5
  10. package/dist/{turn/turn.js → agentRun/agentRun.js} +166 -109
  11. package/dist/{turn/turnIdentity.js → agentRun/runIdentity.js} +4 -4
  12. package/dist/brief/taskBrief.js +12 -0
  13. package/dist/cli/agentConfigurationPicker.js +13 -0
  14. package/dist/cli/commandCatalog.js +167 -70
  15. package/dist/cli/interactionCandidates.js +5 -5
  16. package/dist/cli/interactionPolicy.js +38 -8
  17. package/dist/cli/invocationRouter.js +1 -1
  18. package/dist/cli/managedDiagnostics.js +28 -0
  19. package/dist/cli/operatorWizard.js +1 -7
  20. package/dist/cli/roleOptionOrder.js +27 -0
  21. package/dist/cli/roleWizard.js +50 -14
  22. package/dist/cli/updateOrchestrator.js +1 -1
  23. package/dist/cli/updatePorts.js +3 -4
  24. package/dist/cli.js +188 -95
  25. package/dist/commands/agentCommands.js +72 -14
  26. package/dist/commands/capabilityCommands.js +57 -0
  27. package/dist/commands/configCommands.js +20 -20
  28. package/dist/commands/deliveryGuardPreflight.js +2 -2
  29. package/dist/commands/executionAuditCommands.js +24 -24
  30. package/dist/commands/globalRoleCommands.js +1 -1
  31. package/dist/commands/grantCommands.js +4 -4
  32. package/dist/commands/operatorCommands.js +1 -7
  33. package/dist/commands/projectCommands.js +4 -4
  34. package/dist/commands/resourcesCommands.js +2 -2
  35. package/dist/commands/roleConfiguration.js +25 -5
  36. package/dist/commands/roleRuntimeGuard.js +4 -5
  37. package/dist/commands/sessionCommands.js +3 -7
  38. package/dist/commands/taskActivationCommands.js +259 -0
  39. package/dist/commands/taskActor.js +28 -49
  40. package/dist/commands/taskCommands.js +1216 -730
  41. package/dist/commands/taskContextCommand.js +39 -583
  42. package/dist/commands/taskExecutionCommands.js +32 -32
  43. package/dist/commands/taskInputCommands.js +40 -104
  44. package/dist/commands/taskIntegrationCommands.js +3 -2
  45. package/dist/commands/taskIntegrationQueueCommands.js +1 -1
  46. package/dist/commands/taskNextActionCommand.js +8 -8
  47. package/dist/commands/taskOverviewCommand.js +33 -45
  48. package/dist/commands/taskRemoteDeliveryCommand.js +2 -2
  49. package/dist/commands/taskRoleRuntimeStatus.js +133 -102
  50. package/dist/commands/telemetryCommands.js +36 -38
  51. package/dist/config/configCatalog.js +4 -4
  52. package/dist/config/yuiConfig.js +8 -8
  53. package/dist/context/contextSnapshot.js +10 -10
  54. package/dist/context/dispatchContext.js +11 -11
  55. package/dist/context/roleSessionContext.js +6 -3
  56. package/dist/context/{turnContextPack.js → runContextPack.js} +146 -81
  57. package/dist/context/{turnInputContract.js → runInputContract.js} +73 -60
  58. package/dist/context/sessionBootstrapManifest.js +21 -2
  59. package/dist/context/sourceRunContext.js +30 -0
  60. package/dist/context/taskContext.js +458 -0
  61. package/dist/context/wakeNotification.js +27 -27
  62. package/dist/controller/agentRuntimeObserver.js +21 -24
  63. package/dist/controller/capabilityBridge.js +77 -0
  64. package/dist/controller/clientRuntime.js +65 -92
  65. package/dist/controller/controller.js +127 -188
  66. package/dist/controller/fileSchedulerStoreAdapter.js +787 -887
  67. package/dist/controller/jobControl.js +54 -85
  68. package/dist/controller/resourceInventory.js +8 -27
  69. package/dist/controller/resourceInventoryLinux.js +12 -13
  70. package/dist/controller/runtime.js +530 -476
  71. package/dist/controller/runtimeEventInbox.js +55 -25
  72. package/dist/controller/runtimeEventProcessor.js +22 -31
  73. package/dist/controller/{runtimeHookTurnFence.js → runtimeHookRunFence.js} +91 -115
  74. package/dist/controller/runtimeLaunchCoordinator.js +80 -426
  75. package/dist/controller/runtimeObservationHook.js +14 -18
  76. package/dist/controller/sessionNotify.js +16 -24
  77. package/dist/controller/sessionOwnerReconciliation.js +168 -50
  78. package/dist/controller/structuredProviderObservation.js +138 -99
  79. package/dist/coordination/workMailbox.js +3 -3
  80. package/dist/coordination/workMailboxQueue.js +36 -33
  81. package/dist/core/boundedRpc.js +8 -1
  82. package/dist/core/controllerClient.js +20 -1
  83. package/dist/core/controllerServer.js +4 -4
  84. package/dist/doctor/doctor.js +13 -2
  85. package/dist/domain/agentResultTransport.js +9 -9
  86. package/dist/execution/codexThreadNaming.js +2 -8
  87. package/dist/execution/executionHealth.js +51 -63
  88. package/dist/execution/reviewMainRun.js +137 -0
  89. package/dist/execution/workItemExecution.js +28 -29
  90. package/dist/execution/workItemExecutionProjection.js +99 -107
  91. package/dist/execution/workItemMainRun.js +141 -0
  92. package/dist/executor/agentAdapter.js +227 -20
  93. package/dist/executor/agentConfigurationCatalog.js +126 -4
  94. package/dist/executor/agentConfigurationProbe.js +162 -4
  95. package/dist/executor/agentExecutor.js +79 -78
  96. package/dist/executor/effectiveLaunch.js +105 -18
  97. package/dist/executor/executorRegistry.js +29 -44
  98. package/dist/executor/fileRoleLaunchPlanner.js +229 -154
  99. package/dist/executor/workspacePreflightClassification.js +16 -16
  100. package/dist/grant/capabilityGrant.js +6 -3
  101. package/dist/input/inputRequest.js +12 -10
  102. package/dist/integration/gitIntegrationService.js +4 -11
  103. package/dist/integration/integrationQueueService.js +4 -4
  104. package/dist/interaction/operatorPresentation.js +1 -1
  105. package/dist/kernel/builtinCapabilities.js +423 -0
  106. package/dist/kernel/capabilityRegistry.js +314 -0
  107. package/dist/kernel/capabilitySchema.js +91 -0
  108. package/dist/kernel/instanceHost.js +18 -1
  109. package/dist/kernel/kernelPorts.js +4 -1
  110. package/dist/lifecycle/canonicalLifecycleEvent.js +44 -49
  111. package/dist/lifecycle/exactRunTerminalization.js +449 -0
  112. package/dist/message/message.js +62 -6
  113. package/dist/message/messageContinuation.js +204 -0
  114. package/dist/observability/executionAudit.js +70 -72
  115. package/dist/observability/faultClassification.js +2 -2
  116. package/dist/observability/orchestrationMetrics.js +8 -8
  117. package/dist/operator/operatorSessionHistory.js +1 -7
  118. package/dist/output/agentConfigurationPresentation.js +8 -3
  119. package/dist/output/agentRunConfigurationPresentation.js +128 -0
  120. package/dist/output/rolePresentation.js +54 -3
  121. package/dist/plugins/pluginChild.js +104 -0
  122. package/dist/plugins/pluginIntent.js +26 -0
  123. package/dist/plugins/pluginInterpreter.js +43 -0
  124. package/dist/plugins/pluginPackage.js +101 -0
  125. package/dist/plugins/pluginProcess.js +112 -0
  126. package/dist/plugins/pluginService.js +380 -0
  127. package/dist/profile/agentProfile.js +1 -1
  128. package/dist/repository/gitWorkspace.js +26 -4
  129. package/dist/repository/project.js +19 -4
  130. package/dist/repository/taskBaseFreshness.js +13 -13
  131. package/dist/repository/taskWorkspaceCoordinator.js +20 -27
  132. package/dist/repository/taskWorkspacePreparer.js +344 -83
  133. package/dist/resources/autoResourceGc.js +3 -3
  134. package/dist/resources/liveReferences.js +3 -3
  135. package/dist/resources/projectResource.js +123 -0
  136. package/dist/resources/projectResourceService.js +421 -0
  137. package/dist/resources/resourceDiscovery.js +6 -6
  138. package/dist/resources/resourceGc.js +1 -1
  139. package/dist/resources/resourceRegistrar.js +1 -1
  140. package/dist/resources/resourceTypes.js +1 -1
  141. package/dist/review/deltaRecheck.js +3 -3
  142. package/dist/review/reviewAcceptance.js +16 -16
  143. package/dist/review/reviewDecision.js +7 -7
  144. package/dist/review/reviewRound.js +21 -20
  145. package/dist/review/reviewerAvailability.js +2 -2
  146. package/dist/role/role.js +51 -7
  147. package/dist/role/taskRoleUpdate.js +30 -0
  148. package/dist/runtime/acpProtocol.js +425 -0
  149. package/dist/runtime/acpSession.js +731 -0
  150. package/dist/runtime/acpSessionConfiguration.js +260 -0
  151. package/dist/runtime/agentDriver.js +30 -11
  152. package/dist/runtime/agentEndpoint.js +278 -0
  153. package/dist/runtime/agentEndpointIdentity.js +86 -0
  154. package/dist/runtime/agentEndpointOwnership.js +239 -0
  155. package/dist/runtime/agentError.js +2 -10
  156. package/dist/runtime/agentHost.js +565 -314
  157. package/dist/runtime/agentRunConfiguration.js +258 -0
  158. package/dist/runtime/builtinAgentDrivers.js +134 -18
  159. package/dist/runtime/builtinAgentErrorMappers.js +55 -3
  160. package/dist/runtime/builtinTranscriptUsage.js +1 -1
  161. package/dist/runtime/claude-process-owner +0 -0
  162. package/dist/runtime/codexAppServerRuntime.js +38 -30
  163. package/dist/runtime/codexInteractiveHost.js +41 -6
  164. package/dist/runtime/continuationManager.js +2 -6
  165. package/dist/runtime/executionEnvironment.js +30 -0
  166. package/dist/runtime/firstProgressAdvisory.js +11 -11
  167. package/dist/runtime/index.js +4 -3
  168. package/dist/runtime/jsonLineChannel.js +109 -0
  169. package/dist/runtime/launchBroker.js +91 -16
  170. package/dist/runtime/launchDiagnostics.js +2 -2
  171. package/dist/runtime/lifecycleReservation.js +10 -18
  172. package/dist/runtime/managedCaller.js +61 -17
  173. package/dist/runtime/nativeSessionControl.js +102 -0
  174. package/dist/runtime/ports.js +6 -21
  175. package/dist/runtime/processExitObservation.js +8 -7
  176. package/dist/runtime/promptEnvelope.js +17 -6
  177. package/dist/runtime/providerContinuation.js +3 -9
  178. package/dist/runtime/providerContinuationReconciliationService.js +4 -13
  179. package/dist/runtime/providerControl.js +2 -7
  180. package/dist/runtime/providerRuntimeIdentity.js +110 -222
  181. package/dist/runtime/providerRuntimeReconciler.js +5 -9
  182. package/dist/runtime/runtimeBinding.js +0 -1
  183. package/dist/runtime/runtimeContinuationProjection.js +4 -7
  184. package/dist/runtime/runtimeDeadlines.js +9 -0
  185. package/dist/runtime/runtimeHealthPolicy.js +1 -1
  186. package/dist/runtime/runtimeObservation.js +29 -65
  187. package/dist/runtime/runtimeProjection.js +43 -51
  188. package/dist/runtime/runtimeSessionCandidate.js +1 -3
  189. package/dist/runtime/sessionLaunchRequest.js +3 -7
  190. package/dist/runtime/sessionOwnerIdentity.js +7 -54
  191. package/dist/runtime/sessionOwnerRegistry.js +22 -17
  192. package/dist/runtime/sessionReconciliation.js +4 -8
  193. package/dist/runtime/sessionTerminationGuard.js +70 -259
  194. package/dist/runtime/sessionTokenMetrics.js +5 -16
  195. package/dist/runtime/structuredProviderHost.js +237 -117
  196. package/dist/runtime/taskRuntimeIsolation.js +39 -122
  197. package/dist/runtime/tmuxAdapters.js +39 -86
  198. package/dist/scheduler/activeRoleRunDelivery.js +354 -0
  199. package/dist/scheduler/leaderWakeupProcessor.js +75 -266
  200. package/dist/scheduler/operatorInputNotificationProcessor.js +1 -1
  201. package/dist/scheduler/ports.js +80 -9
  202. package/dist/scheduler/{roleTurnLiveness.js → roleRunLiveness.js} +26 -30
  203. package/dist/scheduler/{roleTurnStall.js → roleRunStall.js} +128 -139
  204. package/dist/scheduler/taskExecutionProjection.js +120 -124
  205. package/dist/scheduler/taskObservabilityProjection.js +29 -29
  206. package/dist/scheduler/taskWake.js +11 -4
  207. package/dist/scheduler/wakeReason.js +9 -1
  208. package/dist/setup/setupCommand.js +1 -0
  209. package/dist/storage/migrations/agentRunContract.js +159 -0
  210. package/dist/storage/migrations/removeRuntimeGeneration.js +207 -0
  211. package/dist/storage/sqliteSchema.js +431 -5
  212. package/dist/storage/sqliteStore.js +375 -220
  213. package/dist/storage/storageVersions.js +1 -1
  214. package/dist/storage/storeRpc.js +10 -5
  215. package/dist/storage/taskStore.js +13 -11
  216. package/dist/storage/upgrade/upgradeOrchestrator.js +5 -7
  217. package/dist/surface/surfaceContributions.js +102 -0
  218. package/dist/task/completionReadiness.js +32 -6
  219. package/dist/task/deliveryGuard.js +16 -16
  220. package/dist/task/draftPlan.js +72 -12
  221. package/dist/task/nextAction.js +144 -128
  222. package/dist/task/remoteDelivery.js +6 -6
  223. package/dist/task/task.js +184 -18
  224. package/dist/task/taskActivation.js +301 -0
  225. package/dist/task/taskActivationService.js +392 -0
  226. package/dist/task/taskRecordReference.js +5 -4
  227. package/dist/task/taskRecordRetirement.js +1 -1
  228. package/dist/telemetry/sqliteTelemetryStore.js +55 -68
  229. package/dist/telemetry/telemetryConfig.js +14 -14
  230. package/dist/telemetry/telemetryWiring.js +2 -2
  231. package/dist/web/assets/assetManifest.js +2 -0
  232. package/dist/web/assets/client/app.js +120 -20
  233. package/dist/web/assets/client/components.js +87 -54
  234. package/dist/web/assets/client/i18n.js +83 -41
  235. package/dist/web/assets/client/markdown.js +1 -1
  236. package/dist/web/assets/client/taskSurface.js +353 -0
  237. package/dist/web/assets/client/view.js +49 -44
  238. package/dist/web/assets/shell.js +1 -1
  239. package/dist/web/assets/styles/cards.js +22 -4
  240. package/dist/web/controllerWeb.js +60 -0
  241. package/dist/web/webMutation.js +28 -0
  242. package/dist/web/webServer.js +118 -8
  243. package/dist/web/webSnapshot.js +81 -74
  244. package/dist/web/webTaskSurface.js +64 -0
  245. package/dist/workItem/dependencyGate.js +1 -1
  246. package/dist/workItem/workItem.js +80 -48
  247. package/dist/workspace/workItemChangeSetManager.js +16 -9
  248. package/docs/agent-result-consumption.md +94 -0
  249. package/docs/agent-runtime-drivers.md +91 -0
  250. package/docs/architecture/README.md +38 -0
  251. package/docs/architecture/capabilities-and-resources.md +79 -0
  252. package/docs/managed-turn-and-session-runtime.md +222 -0
  253. package/docs/observability/README.md +81 -0
  254. package/docs/plugin-sdk.md +290 -0
  255. package/docs/provider-runtime.md +163 -0
  256. package/docs/release-workflow.md +303 -0
  257. package/docs/roles-and-configuration.md +113 -0
  258. package/docs/sqlite-control-plane-design.md +76 -0
  259. package/docs/task-dag-semantics.md +57 -0
  260. package/docs/task-delivery.md +103 -0
  261. package/docs/task-local-identity.md +6 -6
  262. package/docs/testing/verification-levels.md +86 -0
  263. package/i18n/README.zh-CN.md +98 -739
  264. package/package.json +5 -5
  265. package/skills/yui-leader/SKILL.md +130 -103
  266. package/skills/yui-leader/references/integration.md +39 -0
  267. package/skills/yui-leader/references/replicated-execution.md +42 -0
  268. package/skills/yui-leader/references/task-plugins.md +33 -0
  269. package/skills/yui-operator/SKILL.md +30 -59
  270. package/skills/yui-reviewer/SKILL.md +35 -36
  271. package/skills/yui-runtime/SKILL.md +88 -24
  272. package/skills/yui-runtime/references/publication.md +22 -0
  273. package/skills/yui-runtime/references/recovery.md +64 -0
  274. package/skills/yui-worker/SKILL.md +37 -39
  275. package/dist/cli/roleOptionCatalog.js +0 -68
  276. package/dist/context/sourceTurnContext.js +0 -30
  277. package/dist/execution/reviewMainTurn.js +0 -161
  278. package/dist/execution/workItemMainTurn.js +0 -164
  279. package/dist/lifecycle/exactTurnTerminalization.js +0 -407
  280. package/dist/runtime/preallocatedNativeSession.js +0 -13
  281. package/dist/runtime/runtimeStopReceipt.js +0 -42
  282. package/dist/scheduler/activeRoleTurnDelivery.js +0 -315
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zq-silk/yui",
3
- "version": "0.15.6",
3
+ "version": "0.15.8",
4
4
  "description": "Local control plane for long-running native agent CLI sessions backed by tmux.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -39,18 +39,18 @@
39
39
  ],
40
40
  "repository": {
41
41
  "type": "git",
42
- "url": "git+https://github.com/zhangqian-silk/Yui.git"
42
+ "url": "git+https://github.com/zhangqian-silk/yui.git"
43
43
  },
44
44
  "bugs": {
45
- "url": "https://github.com/zhangqian-silk/Yui/issues"
45
+ "url": "https://github.com/zhangqian-silk/yui/issues"
46
46
  },
47
- "homepage": "https://github.com/zhangqian-silk/Yui#readme",
47
+ "homepage": "https://github.com/zhangqian-silk/yui#readme",
48
48
  "dependencies": {
49
49
  "@xterm/addon-fit": "^0.11.0",
50
50
  "@xterm/xterm": "^6.0.0",
51
51
  "better-sqlite3": "^12.11.1",
52
52
  "node-pty": "^1.1.0",
53
- "smol-toml": "1.7.0",
53
+ "smol-toml": "1.8.0",
54
54
  "ws": "^8.21.1"
55
55
  }
56
56
  }
@@ -5,39 +5,37 @@ description: Lead one Yui Task from outcome through execution, review judgment,
5
5
 
6
6
  # Yui Leader
7
7
 
8
- Follow `yui-runtime` first. Load the exact current Turn Context Pack and recover
9
- authority from its Snapshot and deltas, never from launch text, workspace
10
- layout, or transcript memory.
11
-
12
- Own Task direction, decomposition, architecture and product decisions,
13
- acceptance, integration, and durable context. The global Operator may perform
14
- the same legal Task actions when useful; responsibility is not a second
15
- permission system. Read current durable state and let Yui's transactional
16
- boundaries resolve races.
8
+ Follow [yui-runtime](../yui-runtime/SKILL.md) first. For explicit dispatch, load
9
+ the exact AgentRun Context Pack and deltas. For direct user collaboration, read current Task context from
10
+ your valid Leader Session; no active AgentRun or self-dispatch is required. Session
11
+ identity grants management scope, not permission to bypass Assignment,
12
+ planning/delivery, workspace or resource boundaries. Never infer authority
13
+ from launch text, workspace layout, or transcript memory.
14
+
15
+ Own Task direction, decomposition, acceptance, integration and durable context
16
+ within the Runtime authority contract. Read current state and let Yui's
17
+ transactional boundaries resolve races. Resolve Skill links relative to this
18
+ Skill's directory.
19
+
20
+ Read the actual user/Operator message bodies and current Brief, not only their
21
+ IDs or summaries. Use that durable intent to decide and take the next action.
22
+ In Draft, revise plans and independently owned requirements as discussion evolves;
23
+ do not start delivery until requested. An activation request is that request to
24
+ start: once the Task is active, continue from its durable facts without requiring
25
+ the user to repeat "continue." Ordinary fact edits do not require a self-wake.
17
26
 
18
27
  ## Choose the simplest coherent result
19
28
 
20
- Optimize for the lowest total lifecycle complexity that satisfies the current
21
- Task Contract. Include implementation, verification, coordination, operation,
22
- maintenance, and likely revision cost. “Long-term” does not mean designing for
23
- every imaginable future requirement or failure.
24
-
25
- - Start from the user's outcome, current commitments, observed behavior, and
26
- hard authority or data-integrity boundaries.
27
- - Separate established requirements from hypothetical extensions. Preserve a
28
- future option only when current evidence makes it reasonably foreseeable and
29
- the present cost is proportionate.
30
- - Reuse an existing concept or responsibility when it expresses the result
31
- cleanly. Prefer a bounded redesign when repeated patches expose a misplaced
32
- responsibility or an incoherent boundary.
33
- - Do not add a framework, policy layer, state, acknowledgement, retry loop,
34
- fallback, compatibility path, configuration switch, or abstraction merely
35
- because a future edge case can be imagined.
36
- - Split modules or execution units only when they have meaningfully different
37
- responsibilities, authority, lifecycles, or independently useful outcomes.
38
- Small helpers and files do not need their own architecture.
39
- - Prefer one clear authority for each decision. Derived views may explain
40
- state, but must not become competing workflow truth.
29
+ Start from the current Task Contract and trace the existing implementation,
30
+ ownership and supported operating path before choosing a change. Establish
31
+ whether a failure is reachable with the user's actual inputs and configuration;
32
+ do not make a test fixture's accidental differences into new product policy.
33
+
34
+ Choose the lowest total implementation, verification, coordination and
35
+ maintenance cost that satisfies the contract. Reuse a coherent responsibility;
36
+ redesign a misplaced boundary when that lowers the complete cost. Add a
37
+ mechanism only for a demonstrated requirement or hard boundary that existing
38
+ primitives cannot satisfy. Derived views must not become competing truth.
41
39
 
42
40
  Make routine legal choices yourself. Do not ask the user to choose among
43
41
  implementation patterns, scheduling options, review routing, or recoverable
@@ -57,26 +55,19 @@ Choose the smallest useful executor:
57
55
  2. **Native subagent** for bounded specialist attention or parallel
58
56
  investigation inside the current Agent Session when a best-effort child
59
57
  result is sufficient.
60
- 3. **Task Role Turn** when work needs independent durable ownership, a distinct
58
+ 3. **Task Role AgentRun** when work needs independent durable ownership, a distinct
61
59
  Agent/provider or credential set, a managed workspace, or a separately
62
- recoverable Session and Turn lifecycle.
60
+ recoverable Session and AgentRun lifecycle.
63
61
 
64
62
  Create multiple WorkItems only when their requirements can make useful
65
63
  independent progress, normally in parallel, and the coordination and
66
64
  Integration cost is lower than keeping one coherent owner. Keep coupled
67
65
  changes together.
68
66
 
69
- An ordinary assigned WorkItem uses its existing owner or assignee directly.
70
- Dispatch it without `--lane-role`. Request replicated execution only when
71
- multiple independent attempts at the same frozen Assignment have concrete
72
- value that exceeds their comparison and Integration cost. Review lanes are a
73
- separate decision and default to one Reviewer.
74
-
75
- Configured Leader, Worker, Reviewer, and native child Agents are normal
76
- execution resources. Their ordinary development and review work does not
77
- become a real-resource validation merely because they use a real model. Follow
78
- the separate validation boundary in `yui-runtime`; do not create an
79
- InputRequest for routine Agent allocation.
67
+ An ordinary WorkItem uses its assignee directly; dispatch without `--lane-role`.
68
+ Use [replicated execution](references/replicated-execution.md) only when
69
+ independent attempts over the same frozen Assignment repay their coordination
70
+ cost. Direct managed execution already provides durable ownership.
80
71
 
81
72
  ## Give Agents outcomes, not premature implementations
82
73
 
@@ -102,17 +93,26 @@ and test rules in that Project-owned layer.
102
93
  Use `yui task context <task-id>` and `yui task next-action <task-id>` as
103
94
  decision support. They expose current facts, exact refs, and legal
104
95
  alternatives; they do not replace Leader judgment.
96
+ An empty WorkItem list does not mean the user requested direct execution.
97
+ Honor explicit delegation and independent Review requirements in the user's
98
+ messages and Task Brief. Neither `next-action` nor a disabled default review
99
+ policy authorizes dropping them to make completion easier.
100
+
101
+ An Integration Job's success is not the final target update. For that
102
+ notification, read [Integration](references/integration.md) and finish the same
103
+ attempt; do not start a duplicate operation.
105
104
 
106
105
  Before dispatch, Review, Integration, or completion, inspect
107
- `liveTaskState.activeTurns` and `liveTaskState.activeTaskReviews` in the current
106
+ `liveTaskState.activeRuns` and `liveTaskState.activeTaskReviews` in the current
108
107
  Context Pack. They report work in flight but gate nothing by themselves; reason
109
108
  from each exact binding and frozen candidate instead of treating activity as a
110
109
  global Task lock.
111
110
 
112
111
  Maintain only context that changes future decisions:
113
112
 
114
- - Keep the Brief's objective, boundaries, approach, current focus, and Leader
115
- summary current after material semantic progress.
113
+ - Keep the Brief current after material semantic progress. Use
114
+ `task brief update` with only intended fields; same-field edits use the last
115
+ explicit write. Read `task event list` before deliberately restoring a value.
116
116
  - Record a Decision when a material product or technical choice changes future
117
117
  work.
118
118
  - Add a Milestone for an independently meaningful phase result.
@@ -120,12 +120,34 @@ Maintain only context that changes future decisions:
120
120
  impact, risk, acceptance decision, or changed plan.
121
121
  - Propose Project Knowledge only for a stable conclusion useful across Tasks.
122
122
 
123
- Do not turn Messages, WorkItems, Decisions, or Milestones into a scheduler log
123
+ Do not run Messages, WorkItems, Decisions, or Milestones into a scheduler log
124
124
  or transcript. Unchanged waits, dispatches, heartbeats, and routine tool use do
125
125
  not need narrative records.
126
126
 
127
127
  ## Execute the chosen path
128
128
 
129
+ Dispatch establishes the first owner and frozen Assignment. For ordinary
130
+ clarification, feedback or a continuation of that same work, send a Message:
131
+
132
+ ```sh
133
+ yui task message send <task> "<clarification or continuation>" --to <role> --work-item <work-id>
134
+ yui task message send <task> "<review clarification>" --to <role> --review-round <round-id>
135
+ ```
136
+
137
+ Busy execution queues the Message. Its terminal triggers continuation in the
138
+ same compatible Session and workspace; do not fabricate a failure, submit an
139
+ unfinished Candidate, or change WorkItem status merely to answer a question.
140
+ Read Message delivery and the exact resulting AgentRun separately from business
141
+ acceptance. A Message never expands scope, applies desired configuration, or
142
+ changes a Review's frozen candidate. An ownership change preserves the original
143
+ recipient; transfer still-pending input only with explicit `task message handoff`.
144
+ Late input to terminal work or an obsolete Review remains visible with a bounded
145
+ nondelivery reason. Use the existing formal operation for new scope or Review.
146
+
147
+ For unknown delivery or Session replacement, read
148
+ [runtime recovery](../yui-runtime/references/recovery.md). Preserve the original
149
+ input; do not replay uncertainty or treat it as a global Task lock.
150
+
129
151
  For direct work, change only Task main, keep it on its managed branch, commit
130
152
  the result, and leave it clean. Run the smallest check that can catch the
131
153
  changed behavior while implementing.
@@ -149,15 +171,20 @@ its actual result:
149
171
  ```sh
150
172
  yui task work update <work-id> running
151
173
  yui task work update <work-id> done --summary "<result and evidence>"
174
+ yui task work accept <work-id> --summary "<explicit acceptance and evidence>"
152
175
  ```
153
176
 
154
- For a native child, keep the WorkItem roleless, mark it running, select the
155
- closest applicable Profile, pass its constraints in the brief, and use the
156
- provider's native child tools. Native children inherit the current Turn's
157
- authority and gain no Yui Role, Turn, Session, or broader workspace. Their
177
+ For a native child, pass a bounded brief and applicable Profile constraints
178
+ through the provider's child tools. A small investigation needs no synthetic
179
+ WorkItem. If the child implements an existing Leader-owned WorkItem, keep that
180
+ WorkItem roleless and mark it running. Native children inherit only current
181
+ parent authority and gain no Yui Role, AgentRun, Session or broader workspace. Their
158
182
  results are best-effort until Yui externalizes them; use a managed Task Role
159
183
  when independent durability matters. Inspect the returned result before
160
- recording `done` or `failed`. A Profile's runtime source applies when
184
+ submitting `done` or recording failure progress. `done` creates a Candidate;
185
+ `work accept` records the separate acceptance. WorkItem responsibility remains
186
+ open through execution failure and becomes accepted only on that decision.
187
+ A Profile's runtime source applies when
161
188
  materializing a Task Role, not when launching a native child. The child
162
189
  inherits the Leader Agent; apply a Profile model or effort only when the native
163
190
  tool actually supports and confirms that override.
@@ -185,6 +212,15 @@ different owners. Never edit stable Project checkouts, managed refs, Yui state
185
212
  files, or another owner's workspace. A Task's recorded base is durable; do not
186
213
  silently replace it merely because its remote branch later moves.
187
214
 
215
+ ## Extend capabilities within this Task's authority
216
+
217
+ Use `capability search`, `describe`, and `call` to inspect current tools.
218
+ Prefer existing tools, composition or a one-off script when sufficient.
219
+ For reusable Task-local capabilities, read [Task plugins](references/task-plugins.md)
220
+ before creation, validation or activation. Plugin management permission does
221
+ not grant code execution or broader external effects. Never issue your own
222
+ grants, impersonate Operator, or modify the core installation to obtain a tool.
223
+
188
224
  ## Validate and make the review judgment
189
225
 
190
226
  Use the smallest evidence that establishes the accepted behavior and material
@@ -201,21 +237,17 @@ review would add useful evidence:
201
237
  - rely on an already completed applicable Review.
202
238
 
203
239
  This is Leader judgment inside the acceptance decision, not a separate record,
204
- checklist, or workflow phase. A managed Reviewer is optional. Do not create a
240
+ checklist, or workflow phase. A managed Reviewer is optional unless the user,
241
+ Project or Task Contract requires it. Do not create a
205
242
  Reviewer Role or ReviewRound for ceremony. Honor an existing Candidate's
206
243
  snapshotted `always` policy and any immutable Task-final Review contract.
207
244
  Otherwise choose whether another review adds enough evidence to justify its
208
245
  cost.
209
246
 
210
- Use direct Review by default: one main Reviewer Turn owns the authoritative
211
- result without an ExecutionGroup or Lane. Choose replicated Review only when
212
- independent inspection of the same frozen Assignment materially improves the
213
- evidence enough to repay its coordination cost. It requires at least two
214
- distinct Producer Lane Roles plus a separate main Reviewer. Wait for every
215
- Producer to settle and at least two to succeed; their results are durable
216
- evidence only. The main Reviewer receives all successful results, resolves
217
- disagreement against the frozen sources, and submits one original result.
218
- Automatic policy-triggered Candidate Review remains direct.
247
+ Use one direct main Reviewer by default. If independent replicas materially
248
+ improve evidence, read [replicated execution](references/replicated-execution.md)
249
+ before dispatch or synthesis. Honor required review contracts even when a
250
+ cheaper execution path is otherwise available.
219
251
 
220
252
  When several WorkItems contribute to one outcome, prefer one independent
221
253
  Task-final Review after their accepted results are integrated over repeating a
@@ -223,8 +255,8 @@ complete Review for every WorkItem. Request an earlier WorkItem Review only
223
255
  when that frozen Candidate has a specific risk that should be resolved before
224
256
  Integration.
225
257
 
226
- When a Worker or Reviewer result arrives, resolve its exact Turn and read the
227
- complete original `TurnResult.output` before starting new work or waiting
258
+ When a Worker or Reviewer result arrives, resolve its exact AgentRun and read the
259
+ complete original `AgentRunResult.output` before starting new work or waiting
228
260
  again. Treat headings or JSON fields only as communication aids; never infer
229
261
  that Core parsed or accepted them. Decide whether to accept, repair, review
230
262
  again, retry execution, or ask for a genuinely user-owned decision. Route
@@ -233,44 +265,33 @@ directly; create a Repair WorkItem only when the repair is itself a substantial
233
265
  independently owned requirement.
234
266
 
235
267
  A failed ReviewRound is an execution failure, not an automatic retry or repair
236
- wave. Inspect its exact Round, Turn, candidate, Core failure, and
268
+ wave. Inspect its exact Round, AgentRun, candidate, Core failure, and
237
269
  `task next-action` facts, then choose the smallest recovery that preserves the
238
270
  frozen boundary. Do not invent a retry loop or silently replace the Reviewer
239
- Session. For a replicated Task-final Round below quorum before main synthesis,
240
- retry the Round so only unsettled or failed Producers rerun. Retry a failed
241
- main synthesis through its exact Turn.
271
+ Session. For replicated execution, choose whether to retry a failed Producer,
272
+ settle that Lane, or synthesize selected available results. Retry a failed
273
+ main synthesis through its exact AgentRun, preserving its selected source snapshot.
242
274
 
243
275
  ## Accept, integrate, and complete
244
276
 
245
- A Worker or Reviewer Turn result is evidence, not acceptance. Inspect the
277
+ A Worker or Reviewer AgentRun result is evidence, not acceptance. Inspect the
246
278
  result, diff, checks, and current Candidate before deciding.
247
279
 
248
- If a WorkItem result is insufficient, reject it with bounded feedback and
249
- redispatch the same WorkItem and Role while its scope remains valid. If it is
250
- acceptable and contains isolated Git changes, capture and integrate its latest
251
- Candidate before acceptance:
280
+ If a result is insufficient, reject it with bounded feedback and redispatch
281
+ the same WorkItem and Role while scope remains valid. Before accepting isolated
282
+ Git changes, read [Integration](references/integration.md) to capture and
283
+ integrate the latest Candidate. Do not edit managed refs or bypass Yui's
284
+ compare-and-swap boundary.
252
285
 
253
- ```sh
254
- yui task work capture <work-id>
255
- yui task integration start <task-id> --project <project> \
256
- --change-set <change-set-id> \
257
- --check "<Project Policy command>"
258
- yui task work accept <work-id> --summary "<decision and evidence>"
259
- ```
286
+ After an authorized PR/MR operation, follow
287
+ [publication recording](../yui-runtime/references/publication.md).
288
+ External delivery and Task completion remain separate facts.
260
289
 
261
- Resolve a failed Integration from its exact conflict or check evidence. Do not
262
- bypass compare-and-swap, update managed refs manually, or create a replacement
263
- WorkItem for an ordinary Integration correction.
264
-
265
- Immediately after creating, updating, closing, reopening, or merging a PR/MR,
266
- record the confirmed fact with `yui task publication upsert`; do not wait for
267
- another Role to infer it. Supply only information already known from the
268
- operation itself. When the current authorization covers an external provider
269
- read, use `yui task publication verify` after the merge; otherwise preserve
270
- reported evidence and state the gap. Track PR/MR identity, state, commits, URL,
271
- merge time, and evidence—not CI or deployment state. Publication describes
272
- external delivery and never replaces Candidate, Review, Integration,
273
- acceptance, or completion.
290
+ After a ReviewRound is terminal, the Leader or authorized Operator owns
291
+ `task work review cleanup <task>/<round>`. Preserve dirty diagnostic evidence
292
+ and resolve it explicitly; do not ask a Reviewer to clean its own runtime
293
+ after its final report. Cleanup can remain advisory at completion, but all
294
+ required resources must be settled before user-authorized archive.
274
295
 
275
296
  Complete only when the Task outcome is satisfied, required checks and review
276
297
  contracts are settled, WorkItems are accepted or deliberately retired, latest
@@ -284,12 +305,19 @@ yui task complete <task-id> \
284
305
  Completion records the exact Project heads. Archive is a separate,
285
306
  user-authorized Operator action.
286
307
 
287
- ## Finish every Leader Turn
308
+ If completion reports `pending-user-input`, new user intent has not yet reached
309
+ the current notification window. End this native turn so the next notification
310
+ can be delivered, then read the original messages and reassess the outcome.
311
+ Do not spin on completion, drop messages, or manufacture another Run to proceed.
312
+ A current Leader Session can create a formal InputRequest during an ordinary
313
+ notification; no active AgentRun is required.
314
+
315
+ ## Finish every Leader AgentRun
288
316
 
289
- Before ending the Turn:
317
+ Before ending the AgentRun:
290
318
 
291
- 1. Inspect the wake delta, resolve every referenced Worker or Reviewer Turn
292
- with `yui task turn show`, read each original result in full, and make the
319
+ 1. Inspect the wake delta, resolve every referenced Worker or Reviewer AgentRun
320
+ with `yui task run show`, read each original result in full, and make the
293
321
  next decision.
294
322
  2. Persist actual WorkItem lifecycle and material Brief, Decision, Milestone,
295
323
  Message, or Knowledge changes.
@@ -301,10 +329,9 @@ Before ending the Turn:
301
329
 
302
330
  Do not claim completion only in prose when durable Task or WorkItem state still
303
331
  needs updating. Do not poll managed Roles or emit waiting Messages. Managed
304
- results wake a later Leader Turn; an unchanged active Task remains quiet.
332
+ results enter a later Leader notification; that notification is not an implicit
333
+ AgentRun and requires no separate execution report. An unchanged active Task remains quiet.
305
334
 
306
- For a runtime failure, inspect the exact `runtime.agent-error`, Turn, and
307
- Session facts. Retry the failed Turn on the same recoverable Session when useful.
308
- Replace a Session only when the Driver proves it cannot continue. After
309
- repeated replacement failures, report the evidence and bounded options instead
310
- of adding another recovery mechanism.
335
+ Use the shared [runtime recovery](../yui-runtime/references/recovery.md) contract
336
+ for failed execution. Persist successor context before replacing yourself,
337
+ then end this turn; engineering cleanup is not discarded Task intent.
@@ -0,0 +1,39 @@
1
+ # Integrate an isolated result
2
+
3
+ Read this before integrating a WorkItem Candidate or handling an Integration
4
+ notification. Inspect the original result, diff, checks and exact Candidate.
5
+ If insufficient, return bounded feedback to the owning WorkItem/Role while
6
+ its scope remains valid.
7
+
8
+ For acceptable isolated Git changes, capture and integrate the latest Candidate
9
+ before acceptance:
10
+
11
+ ```sh
12
+ yui task work capture <work-id>
13
+ yui task integration start <task> --project <project> \
14
+ --change-set <change-set-id> \
15
+ --check "<Project Policy command>"
16
+ yui task work accept <work-id> --summary "<decision and evidence>"
17
+ ```
18
+
19
+ These are distinct decisions; confirm Integration succeeded before acceptance.
20
+ Preserve each managed workspace's owner and the Task's recorded base. Do not
21
+ silently advance that base because a remote branch moved.
22
+
23
+ ## Finish the same attempt
24
+
25
+ For direct Integration checks running as a DurableJob, Job success is not
26
+ the final target update. Read the terminal result, then use:
27
+
28
+ ```sh
29
+ yui task integration continue <task>/<integration>
30
+ ```
31
+
32
+ This also applies when no manual conflict resolution was needed. Do not start
33
+ a duplicate Integration or wait for an empty queue to finalize it.
34
+
35
+ Resolve failures using the exact conflict or check evidence and the supplied
36
+ Integration workspace. Never bypass compare-and-swap, update managed refs by
37
+ hand, or create a replacement WorkItem for ordinary Integration correction.
38
+ Recheck changed behavior or unresolved failures; do not rerun unchanged
39
+ successful validation without a current reason.
@@ -0,0 +1,42 @@
1
+ # Replicated execution and synthesis
2
+
3
+ Read this only when choosing replication or executing a Producer/main
4
+ synthesis assignment. Ordinary assigned WorkItems and direct Reviews do not
5
+ need an ExecutionGroup or Lane.
6
+
7
+ ## Leader selection
8
+
9
+ Replication means independent attempts at the same frozen Assignment, not
10
+ different WorkItems executing in parallel. Choose it only when the extra
11
+ evidence repays comparison, coordination and Integration cost.
12
+
13
+ Use at least two distinct Producer Lane Roles. Replicated Review also has a
14
+ separate main Reviewer for authoritative synthesis. Automatic policy-triggered
15
+ Candidate Review stays direct. Do not treat a success count or a majority vote
16
+ as Core acceptance.
17
+
18
+ Select the original source AgentRuns explicitly:
19
+
20
+ ```sh
21
+ yui task review synthesize <task>/<round> --source-run <task>/<run> ...
22
+ yui task work synthesize <task>/<work> --source-run <task>/<run> ...
23
+ ```
24
+
25
+ Lane completion or settlement does not dispatch synthesis automatically.
26
+ A Lane retry remains the same replica. On failure, choose whether to retry
27
+ that Producer, settle the Lane, or synthesize selected available results.
28
+ Retry main synthesis through its exact AgentRun, preserving the source snapshot.
29
+
30
+ ## Producer and main Agent responsibilities
31
+
32
+ A Producer independently inspects or implements its exact frozen Assignment
33
+ in the supplied Lane workspace and returns one complete original result.
34
+ Its evidence does not authorize a Candidate, ChangeSet, Integration or
35
+ acceptance decision outside the assigned protocol.
36
+
37
+ The main synthesis Agent reads every selected source AgentRun's original
38
+ result, checks it against the frozen sources, resolves disagreement through
39
+ judgment, and returns one authoritative report. Do not mutate source results,
40
+ omit selected evidence, rerun Producers, or substitute a winning Lane for
41
+ synthesis. A Review report remains evidence for Task acceptance, not acceptance
42
+ itself.
@@ -0,0 +1,33 @@
1
+ # Task-local capabilities
2
+
3
+ Read this before creating, validating or activating a Task-local plugin.
4
+ Use the stable Session CLI's capability directory and read the exact schema
5
+ before each unfamiliar operation. Prefer an existing tool, composition or
6
+ one-off script unless a reusable named capability is useful.
7
+
8
+ The authenticated Leader can create, scan, validate, activate and disable
9
+ Task-local plugins through `plugin.*` in an adopted writable environment.
10
+ `plugin.scan` reports the package digest without execution;
11
+ `plugin.validation` reads saved evidence; `plugin.inspect` distinguishes
12
+ persistent enable intent from the Host's loaded implementation.
13
+
14
+ Management permission does not authorize execution. Trusted-local build,
15
+ validation, activation or calls require an existing `plugin.execute` grant for
16
+ the exact plugin id, digest, environment, trust and phase, within its remaining
17
+ uses and validity. A source change cannot inherit an old digest's grant.
18
+ Trusted-local subprocesses are not an OS sandbox.
19
+
20
+ Never issue your own grants, impersonate Operator, change global configuration,
21
+ or modify the core installation, namespace or carrying Endpoint to obtain a
22
+ tool. Request only a genuinely missing resource or trust boundary, not authority
23
+ already available. Plugin grants do not authorize unrelated external effects.
24
+
25
+ Preserve validation failures and operation receipts. An unknown or partial
26
+ external effect does not authorize rerunning the action chain. After activation,
27
+ query the directory again and use the new capability through the same bridge
28
+ and native Session; no native tool-schema change or Controller restart is needed.
29
+
30
+ Save the actual business result through `artifact.save` and retain the reference
31
+ in Task results. Plugin source or successful loading alone is not delivery.
32
+ Historical Artifacts remain readable after disable or restart; saved enable
33
+ intent does not automatically execute code on restart.