@zq-silk/yui 0.14.1 → 0.15.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 (185) hide show
  1. package/ARCHITECTURE.md +91 -47
  2. package/README.md +275 -145
  3. package/dist/agent/managedRuntimeEnvironment.js +5 -8
  4. package/dist/cli/commandCatalog.js +74 -109
  5. package/dist/cli/helpRenderer.js +1 -2
  6. package/dist/cli/interactionCandidates.js +10 -0
  7. package/dist/cli/interactionPolicy.js +76 -37
  8. package/dist/cli/roleWizard.js +5 -6
  9. package/dist/cli/updateCommand.js +17 -9
  10. package/dist/cli/updateOrchestrator.js +87 -19
  11. package/dist/cli/updatePorts.js +79 -13
  12. package/dist/cli/upgradeCommand.js +105 -23
  13. package/dist/cli.js +268 -231
  14. package/dist/commands/agentCommands.js +13 -0
  15. package/dist/commands/configCommands.js +7 -19
  16. package/dist/commands/configOverview.js +3 -2
  17. package/dist/commands/controllerCommands.js +1 -1
  18. package/dist/commands/durableJobCommands.js +1 -1
  19. package/dist/commands/executionAuditCommands.js +4 -9
  20. package/dist/commands/globalRoleCommands.js +17 -0
  21. package/dist/commands/profileCommands.js +200 -30
  22. package/dist/commands/sessionCommands.js +1 -1
  23. package/dist/commands/taskActor.js +29 -127
  24. package/dist/commands/taskChangeSetCommands.js +1 -3
  25. package/dist/commands/taskCommands.js +1771 -2107
  26. package/dist/commands/taskCompletionGate.js +27 -103
  27. package/dist/commands/taskContextCommand.js +47 -80
  28. package/dist/commands/taskExecutionCommands.js +9 -27
  29. package/dist/commands/taskInputCommands.js +10 -10
  30. package/dist/commands/taskIntegrationCommands.js +69 -61
  31. package/dist/commands/taskIntegrationQueueCommands.js +1 -1
  32. package/dist/commands/taskNextActionCommand.js +8 -29
  33. package/dist/commands/taskOverviewCommand.js +25 -3
  34. package/dist/commands/taskPublicationCommands.js +151 -85
  35. package/dist/commands/taskPublicationVerifyCommand.js +181 -0
  36. package/dist/commands/taskRemoteDeliveryCommand.js +134 -0
  37. package/dist/commands/taskRoleRuntimeStatus.js +5 -6
  38. package/dist/commands/taskUpstreamCommands.js +79 -95
  39. package/dist/config/configCatalog.js +1 -1
  40. package/dist/context/contextSnapshot.js +17 -2
  41. package/dist/context/sourceTurnContext.js +30 -0
  42. package/dist/context/turnContextPack.js +107 -48
  43. package/dist/context/turnInputContract.js +11 -4
  44. package/dist/context/wakeNotification.js +84 -22
  45. package/dist/controller/agentRuntimeObserver.js +9 -12
  46. package/dist/controller/clientRuntime.js +13 -13
  47. package/dist/controller/controller.js +11 -11
  48. package/dist/controller/fileSchedulerStoreAdapter.js +262 -219
  49. package/dist/controller/jobControl.js +11 -10
  50. package/dist/controller/resourceInventory.js +6 -6
  51. package/dist/controller/resourceInventoryLinux.js +2 -2
  52. package/dist/controller/runtime.js +18 -61
  53. package/dist/controller/runtimeEventInbox.js +57 -34
  54. package/dist/controller/runtimeEventProcessor.js +36 -96
  55. package/dist/controller/runtimeHookTurnFence.js +33 -57
  56. package/dist/controller/runtimeLaunchCoordinator.js +44 -40
  57. package/dist/controller/runtimeObservationHook.js +18 -12
  58. package/dist/controller/sessionNotify.js +43 -28
  59. package/dist/controller/sessionOwnerReconciliation.js +21 -21
  60. package/dist/controller/structuredProviderObservation.js +13 -16
  61. package/dist/coordination/workMailboxQueue.js +132 -0
  62. package/dist/core/controllerServer.js +6 -5
  63. package/dist/doctor/doctor.js +37 -14
  64. package/dist/domain/agentResultTransport.js +60 -0
  65. package/dist/execution/executionHealth.js +111 -118
  66. package/dist/execution/reviewMainTurn.js +161 -0
  67. package/dist/execution/workItemExecution.js +454 -0
  68. package/dist/execution/workItemExecutionProjection.js +309 -0
  69. package/dist/execution/workItemMainTurn.js +164 -0
  70. package/dist/executor/agentExecutor.js +19 -19
  71. package/dist/executor/executorRegistry.js +7 -28
  72. package/dist/executor/fileRoleLaunchPlanner.js +16 -82
  73. package/dist/external/githubPublicationVerifier.js +114 -0
  74. package/dist/external/gitlabPublicationVerifier.js +158 -0
  75. package/dist/external/pinnedCommandRunner.js +73 -0
  76. package/dist/integration/changeSetManifest.js +0 -3
  77. package/dist/integration/deliveryObligation.js +43 -6
  78. package/dist/integration/gitIntegrationService.js +284 -101
  79. package/dist/integration/integrationAttempt.js +64 -14
  80. package/dist/integration/integrationQueueEntry.js +5 -35
  81. package/dist/integration/integrationQueueService.js +65 -194
  82. package/dist/lifecycle/canonicalLifecycleEvent.js +16 -15
  83. package/dist/lifecycle/exactTurnTerminalization.js +100 -97
  84. package/dist/message/message.js +16 -0
  85. package/dist/observability/executionAudit.js +4 -25
  86. package/dist/observability/faultClassification.js +58 -70
  87. package/dist/observability/orchestrationMetrics.js +8 -50
  88. package/dist/observability/runtimeIdentity.js +48 -50
  89. package/dist/profile/agentProfile.js +60 -15
  90. package/dist/profile/agentProfileRuntime.js +100 -0
  91. package/dist/release/releaseWorkflowPorts.js +5 -68
  92. package/dist/release/runtimeRelease.js +9 -1
  93. package/dist/repository/executionLaneGitSnapshot.js +80 -0
  94. package/dist/repository/gitWorkspace.js +9 -67
  95. package/dist/repository/taskBaseFreshness.js +3 -1
  96. package/dist/repository/taskWorkspaceCoordinator.js +32 -4
  97. package/dist/repository/taskWorkspacePreparer.js +252 -411
  98. package/dist/resources/liveReferences.js +6 -55
  99. package/dist/resources/resourceDiscovery.js +1 -30
  100. package/dist/resources/resourceRegistrar.js +0 -23
  101. package/dist/review/deltaRecheck.js +8 -65
  102. package/dist/review/reviewAcceptance.js +22 -19
  103. package/dist/review/reviewConfig.js +0 -10
  104. package/dist/review/reviewDecision.js +2 -2
  105. package/dist/review/reviewRound.js +147 -273
  106. package/dist/review/reviewerAvailability.js +13 -23
  107. package/dist/role/role.js +3 -0
  108. package/dist/runtime/agentDriverObservation.js +1 -1
  109. package/dist/runtime/agentHost.js +51 -51
  110. package/dist/runtime/builtinAgentDrivers.js +9 -2
  111. package/dist/runtime/codexAppServerRuntime.js +23 -5
  112. package/dist/runtime/exactControlPlane.js +22 -296
  113. package/dist/runtime/firstProgressAdvisory.js +1 -1
  114. package/dist/runtime/index.js +1 -1
  115. package/dist/runtime/launchBroker.js +11 -11
  116. package/dist/runtime/lifecycleReservation.js +2 -2
  117. package/dist/runtime/managedCaller.js +111 -0
  118. package/dist/runtime/ports.js +16 -3
  119. package/dist/runtime/preallocatedNativeSession.js +2 -2
  120. package/dist/runtime/processExitObservation.js +3 -2
  121. package/dist/runtime/providerContinuationReconciliationService.js +1 -1
  122. package/dist/runtime/runtimeBinding.js +1 -1
  123. package/dist/runtime/runtimeObservation.js +33 -16
  124. package/dist/runtime/runtimeSessionCandidate.js +2 -2
  125. package/dist/runtime/runtimeStopReceipt.js +11 -11
  126. package/dist/runtime/sessionLaunchRequest.js +2 -2
  127. package/dist/runtime/sessionOwnerIdentity.js +9 -9
  128. package/dist/runtime/sessionOwnerRegistry.js +13 -13
  129. package/dist/runtime/sessionReconciliation.js +4 -4
  130. package/dist/runtime/sessionTerminationGuard.js +9 -9
  131. package/dist/runtime/sessionTokenMetrics.js +5 -7
  132. package/dist/runtime/structuredProviderHost.js +5 -5
  133. package/dist/runtime/taskRuntimeIsolation.js +24 -24
  134. package/dist/runtime/tmuxAdapters.js +32 -30
  135. package/dist/scheduler/activeRoleTurnDelivery.js +37 -15
  136. package/dist/scheduler/leaderWakeupProcessor.js +78 -55
  137. package/dist/scheduler/roleTurnLiveness.js +6 -6
  138. package/dist/scheduler/roleTurnStall.js +8 -9
  139. package/dist/scheduler/taskExecutionProjection.js +19 -41
  140. package/dist/scheduler/taskObservabilityProjection.js +75 -122
  141. package/dist/storage/currentTaskStore.js +6 -4
  142. package/dist/storage/sqliteSchema.js +135 -80
  143. package/dist/storage/sqliteStore.js +69 -52
  144. package/dist/storage/storageSchema.js +92 -230
  145. package/dist/storage/storageVersions.js +12 -13
  146. package/dist/storage/taskStore.js +8 -8
  147. package/dist/storage/upgrade/upgradeOrchestrator.js +276 -85
  148. package/dist/task/completionReadiness.js +17 -98
  149. package/dist/task/deliveryGuard.js +9 -11
  150. package/dist/task/draftPlan.js +142 -0
  151. package/dist/task/nextAction.js +179 -477
  152. package/dist/task/publicationVerification.js +1 -0
  153. package/dist/task/remoteDelivery.js +233 -0
  154. package/dist/task/task.js +108 -4
  155. package/dist/task/taskRecordReference.js +0 -1
  156. package/dist/turn/turn.js +109 -16
  157. package/dist/verification/verificationGateService.js +0 -26
  158. package/dist/version.js +3 -3
  159. package/dist/web/assets/client/components.js +99 -121
  160. package/dist/web/assets/client/i18n.js +136 -58
  161. package/dist/web/assets/client/view.js +44 -0
  162. package/dist/web/assets/styles/cards.js +3 -15
  163. package/dist/web/assets/styles/widgets.js +4 -0
  164. package/dist/web/webSnapshot.js +29 -14
  165. package/dist/workItem/dependencyGate.js +34 -0
  166. package/dist/workItem/workItem.js +99 -266
  167. package/dist/workspace/workItemChangeSetManager.js +15 -59
  168. package/docs/task-local-identity.md +9 -9
  169. package/i18n/README.zh-CN.md +189 -74
  170. package/package.json +1 -1
  171. package/skills/yui-leader/SKILL.md +272 -782
  172. package/skills/yui-operator/SKILL.md +190 -365
  173. package/skills/yui-reviewer/SKILL.md +40 -33
  174. package/skills/yui-runtime/SKILL.md +22 -0
  175. package/skills/yui-worker/SKILL.md +19 -6
  176. package/dist/execution/candidateConvergence.js +0 -623
  177. package/dist/execution/executionGroup.js +0 -854
  178. package/dist/execution/resourceBroker.js +0 -426
  179. package/dist/executor/launchPlan.js +0 -16
  180. package/dist/review/reviewFinding.js +0 -240
  181. package/dist/review/reviewFindingLedger.js +0 -550
  182. package/dist/review/reviewOutcomeClassifier.js +0 -255
  183. package/dist/scheduler/resourceQueueProjection.js +0 -71
  184. package/dist/storage/upgrade/recordVersions.js +0 -82
  185. package/dist/task/repairWave.js +0 -150
@@ -0,0 +1,142 @@
1
+ export function assertDraftTaskExecutionFree(store, task) {
2
+ if (task.status !== "draft") {
3
+ throw new Error(`Task is not a Draft: ${task.id}/${task.status}.`);
4
+ }
5
+ const executionFact = firstDraftExecutionFact(store, task);
6
+ if (executionFact !== undefined) {
7
+ throw new Error(`Draft Task ${task.id} has execution facts (${executionFact}); `
8
+ + "retire it and create a clean Draft instead of editing runtime history.");
9
+ }
10
+ }
11
+ export function validateDraftWorkItemEdit(store, task, candidate) {
12
+ assertDraftTaskExecutionFree(store, task);
13
+ const workItems = store.listWorkItems(task.id).map((item) => (item.id === candidate.id ? candidate : item));
14
+ const facts = draftPlanFacts(store, task, workItems);
15
+ validateWorkItemReferences(facts, candidate);
16
+ assertDraftWorkItemDependencyGraph(facts.workItems, candidate);
17
+ }
18
+ export function validateDraftTaskForActivation(store, task) {
19
+ assertDraftTaskExecutionFree(store, task);
20
+ const facts = draftPlanFacts(store, task, store.listWorkItems(task.id));
21
+ const current = facts.workItems.filter(({ status }) => status !== "retired");
22
+ for (const item of current)
23
+ validateWorkItemReferences(facts, item);
24
+ assertDraftWorkItemDependencyGraph(current);
25
+ }
26
+ /** Derive the first invalid edge in the current Draft dependency graph. */
27
+ export function draftWorkItemDependencyIssue(workItems, onlyItem) {
28
+ const current = workItems.filter(({ status }) => status !== "retired");
29
+ const byId = new Map(current.map((item) => [item.id, item]));
30
+ for (const item of onlyItem === undefined ? current : [onlyItem]) {
31
+ const dependencyId = item.dependsOn.find((id) => !byId.has(id));
32
+ if (dependencyId !== undefined) {
33
+ return { kind: "missing-or-retired", workItemId: item.id, dependencyId };
34
+ }
35
+ }
36
+ const visiting = new Set();
37
+ const visited = new Set();
38
+ const visit = (item) => {
39
+ visiting.add(item.id);
40
+ for (const dependencyId of item.dependsOn) {
41
+ if (visiting.has(dependencyId)) {
42
+ return { kind: "cycle", workItemId: item.id, dependencyId };
43
+ }
44
+ if (visited.has(dependencyId))
45
+ continue;
46
+ const dependency = byId.get(dependencyId);
47
+ if (dependency === undefined)
48
+ continue;
49
+ const issue = visit(dependency);
50
+ if (issue !== undefined)
51
+ return issue;
52
+ }
53
+ visiting.delete(item.id);
54
+ visited.add(item.id);
55
+ return undefined;
56
+ };
57
+ for (const item of current) {
58
+ if (visited.has(item.id))
59
+ continue;
60
+ const issue = visit(item);
61
+ if (issue !== undefined)
62
+ return issue;
63
+ }
64
+ return undefined;
65
+ }
66
+ function draftPlanFacts(store, task, workItems) {
67
+ const projects = new Map();
68
+ for (const binding of task.projectBindings) {
69
+ const project = store.getProject(binding.projectId);
70
+ if (project === null) {
71
+ throw new Error(`Task Project not found: ${binding.projectId}.`);
72
+ }
73
+ if (project.status !== "active") {
74
+ throw new Error(`Task Project is not active: ${project.id}/${project.status}.`);
75
+ }
76
+ projects.set(project.id, project);
77
+ }
78
+ return {
79
+ task,
80
+ workItems,
81
+ roleNames: new Set(store.listRoles(task.id).map(({ name }) => name)),
82
+ projects
83
+ };
84
+ }
85
+ function validateWorkItemReferences(facts, item) {
86
+ if (item.assignee !== undefined && !facts.roleNames.has(item.assignee)) {
87
+ throw new Error(`Work Item assignee Role not found: ${item.id}/${item.assignee}.`);
88
+ }
89
+ for (const projectId of item.writeProjectIds) {
90
+ if (!facts.projects.has(projectId)) {
91
+ throw new Error(`Work Item writable Project is not bound: ${item.id}/${projectId}.`);
92
+ }
93
+ }
94
+ for (const baseRef of item.baseRefs ?? []) {
95
+ if (!item.writeProjectIds.includes(baseRef.projectId)) {
96
+ throw new Error(`Work Item base-ref Project is not writable: ${item.id}/${baseRef.projectId}.`);
97
+ }
98
+ }
99
+ }
100
+ function assertDraftWorkItemDependencyGraph(workItems, onlyItem) {
101
+ const issue = draftWorkItemDependencyIssue(workItems, onlyItem);
102
+ if (issue === undefined)
103
+ return;
104
+ if (issue.kind === "missing-or-retired") {
105
+ throw new Error(`Work Item dependency is missing or retired: ${issue.workItemId}/${issue.dependencyId}.`);
106
+ }
107
+ throw new Error(`Work Item dependency cycle detected: ${issue.workItemId}/${issue.dependencyId}.`);
108
+ }
109
+ function firstDraftExecutionFact(store, task) {
110
+ if (task.workspaceIdentity !== undefined || task.cwd !== undefined)
111
+ return "Task workspace";
112
+ const hostOwner = store.listSessionOwners().find(({ owner }) => (owner.scope === "task" && owner.taskId === task.id));
113
+ if (hostOwner !== undefined)
114
+ return `Host owner (${hostOwner.runtimeGenerationId})`;
115
+ if (store.listTurns(task.id).length > 0)
116
+ return "Turn";
117
+ if (store.listRoleSessionSets(task.id).length > 0)
118
+ return "Role Session";
119
+ if (store.listDurableJobs(task.id).length > 0)
120
+ return "DurableJob";
121
+ if (store.listManagedWorkspaces(task.id).length > 0)
122
+ return "managed Workspace";
123
+ if (store.listReviewRounds(task.id).length > 0)
124
+ return "ReviewRound";
125
+ if (store.listIntegrationAttempts(task.id).length > 0)
126
+ return "Integration Attempt";
127
+ if (store.listChangeSets(task.id).length > 0)
128
+ return "ChangeSet";
129
+ const itemWithExecution = store.listWorkItems(task.id).find((item) => (item.executionGroups.length > 0
130
+ || item.currentExecutionGroupId !== undefined
131
+ || item.candidates.length > 0
132
+ || item.workspaceDisposition !== undefined
133
+ || !["pending", "retired"].includes(item.status)));
134
+ if (itemWithExecution !== undefined) {
135
+ return `Work Item execution (${itemWithExecution.id})`;
136
+ }
137
+ const runtimeEvent = store.listEvents(task.id).find(({ type }) => (type.startsWith("runtime.")
138
+ || type.startsWith("turn.")
139
+ || type.startsWith("review.")
140
+ || type.startsWith("integration.")));
141
+ return runtimeEvent === undefined ? undefined : `event ${runtimeEvent.id}/${runtimeEvent.type}`;
142
+ }