@zq-silk/yui 0.14.0 → 0.14.2

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 (179) hide show
  1. package/ARCHITECTURE.md +64 -35
  2. package/README.md +258 -125
  3. package/dist/agent/argumentPolicy.js +2 -1
  4. package/dist/agent/managedRuntimeEnvironment.js +5 -8
  5. package/dist/cli/commandCatalog.js +74 -109
  6. package/dist/cli/helpRenderer.js +1 -2
  7. package/dist/cli/interactionCandidates.js +10 -0
  8. package/dist/cli/interactionPolicy.js +76 -37
  9. package/dist/cli/roleWizard.js +5 -6
  10. package/dist/cli/updateOrchestrator.js +10 -8
  11. package/dist/cli/updatePorts.js +17 -13
  12. package/dist/cli/upgradeCommand.js +2 -5
  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/durableJobCommands.js +1 -1
  18. package/dist/commands/executionAuditCommands.js +4 -9
  19. package/dist/commands/globalRoleCommands.js +17 -0
  20. package/dist/commands/profileCommands.js +200 -30
  21. package/dist/commands/sessionCommands.js +1 -1
  22. package/dist/commands/taskActor.js +29 -127
  23. package/dist/commands/taskChangeSetCommands.js +1 -3
  24. package/dist/commands/taskCommands.js +1771 -2107
  25. package/dist/commands/taskCompletionGate.js +27 -103
  26. package/dist/commands/taskContextCommand.js +47 -80
  27. package/dist/commands/taskExecutionCommands.js +9 -27
  28. package/dist/commands/taskInputCommands.js +10 -10
  29. package/dist/commands/taskIntegrationCommands.js +69 -61
  30. package/dist/commands/taskIntegrationQueueCommands.js +1 -1
  31. package/dist/commands/taskNextActionCommand.js +8 -29
  32. package/dist/commands/taskOverviewCommand.js +25 -3
  33. package/dist/commands/taskPublicationCommands.js +151 -85
  34. package/dist/commands/taskPublicationVerifyCommand.js +181 -0
  35. package/dist/commands/taskRemoteDeliveryCommand.js +134 -0
  36. package/dist/commands/taskRoleRuntimeStatus.js +5 -6
  37. package/dist/commands/taskUpstreamCommands.js +79 -95
  38. package/dist/config/configCatalog.js +1 -1
  39. package/dist/context/contextSnapshot.js +17 -2
  40. package/dist/context/sessionBootstrapManifest.js +18 -1
  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 +1 -0
  63. package/dist/domain/agentResultTransport.js +60 -0
  64. package/dist/execution/executionHealth.js +111 -118
  65. package/dist/execution/reviewMainTurn.js +161 -0
  66. package/dist/execution/workItemExecution.js +454 -0
  67. package/dist/execution/workItemExecutionProjection.js +309 -0
  68. package/dist/execution/workItemMainTurn.js +164 -0
  69. package/dist/executor/agentExecutor.js +19 -19
  70. package/dist/executor/executorRegistry.js +7 -28
  71. package/dist/executor/fileRoleLaunchPlanner.js +51 -83
  72. package/dist/external/githubPublicationVerifier.js +114 -0
  73. package/dist/external/gitlabPublicationVerifier.js +158 -0
  74. package/dist/external/pinnedCommandRunner.js +73 -0
  75. package/dist/integration/changeSetManifest.js +0 -3
  76. package/dist/integration/deliveryObligation.js +43 -6
  77. package/dist/integration/gitIntegrationService.js +284 -101
  78. package/dist/integration/integrationAttempt.js +64 -14
  79. package/dist/integration/integrationQueueEntry.js +5 -35
  80. package/dist/integration/integrationQueueService.js +65 -194
  81. package/dist/lifecycle/canonicalLifecycleEvent.js +16 -15
  82. package/dist/lifecycle/exactTurnTerminalization.js +100 -97
  83. package/dist/message/message.js +16 -0
  84. package/dist/observability/executionAudit.js +4 -25
  85. package/dist/observability/faultClassification.js +58 -70
  86. package/dist/observability/orchestrationMetrics.js +8 -50
  87. package/dist/profile/agentProfile.js +60 -15
  88. package/dist/profile/agentProfileRuntime.js +100 -0
  89. package/dist/release/releaseWorkflowPorts.js +5 -68
  90. package/dist/repository/executionLaneGitSnapshot.js +80 -0
  91. package/dist/repository/gitWorkspace.js +9 -67
  92. package/dist/repository/taskBaseFreshness.js +3 -1
  93. package/dist/repository/taskWorkspaceCoordinator.js +32 -4
  94. package/dist/repository/taskWorkspacePreparer.js +252 -411
  95. package/dist/resources/liveReferences.js +6 -55
  96. package/dist/resources/resourceDiscovery.js +1 -30
  97. package/dist/resources/resourceRegistrar.js +0 -23
  98. package/dist/review/deltaRecheck.js +8 -65
  99. package/dist/review/reviewAcceptance.js +22 -19
  100. package/dist/review/reviewConfig.js +0 -10
  101. package/dist/review/reviewDecision.js +2 -2
  102. package/dist/review/reviewRound.js +147 -273
  103. package/dist/review/reviewerAvailability.js +13 -23
  104. package/dist/role/role.js +3 -0
  105. package/dist/runtime/agentDriverObservation.js +1 -1
  106. package/dist/runtime/agentHost.js +51 -51
  107. package/dist/runtime/builtinAgentDrivers.js +9 -2
  108. package/dist/runtime/codexAppServerRuntime.js +23 -5
  109. package/dist/runtime/exactControlPlane.js +2 -267
  110. package/dist/runtime/firstProgressAdvisory.js +1 -1
  111. package/dist/runtime/index.js +1 -1
  112. package/dist/runtime/launchBroker.js +11 -11
  113. package/dist/runtime/lifecycleReservation.js +2 -2
  114. package/dist/runtime/managedCaller.js +111 -0
  115. package/dist/runtime/ports.js +16 -3
  116. package/dist/runtime/preallocatedNativeSession.js +2 -2
  117. package/dist/runtime/processExitObservation.js +3 -2
  118. package/dist/runtime/providerContinuationReconciliationService.js +1 -1
  119. package/dist/runtime/runtimeBinding.js +1 -1
  120. package/dist/runtime/runtimeObservation.js +33 -16
  121. package/dist/runtime/runtimeSessionCandidate.js +2 -2
  122. package/dist/runtime/runtimeStopReceipt.js +11 -11
  123. package/dist/runtime/sessionLaunchRequest.js +2 -2
  124. package/dist/runtime/sessionOwnerIdentity.js +9 -9
  125. package/dist/runtime/sessionOwnerRegistry.js +13 -13
  126. package/dist/runtime/sessionReconciliation.js +4 -4
  127. package/dist/runtime/sessionTerminationGuard.js +9 -9
  128. package/dist/runtime/sessionTokenMetrics.js +5 -7
  129. package/dist/runtime/structuredProviderHost.js +5 -5
  130. package/dist/runtime/taskRuntimeIsolation.js +24 -24
  131. package/dist/runtime/tmuxAdapters.js +32 -30
  132. package/dist/scheduler/activeRoleTurnDelivery.js +37 -15
  133. package/dist/scheduler/leaderWakeupProcessor.js +78 -55
  134. package/dist/scheduler/roleTurnLiveness.js +6 -6
  135. package/dist/scheduler/roleTurnStall.js +8 -9
  136. package/dist/scheduler/taskExecutionProjection.js +19 -41
  137. package/dist/scheduler/taskObservabilityProjection.js +75 -122
  138. package/dist/storage/sqliteSchema.js +1 -21
  139. package/dist/storage/sqliteStore.js +62 -47
  140. package/dist/storage/storageSchema.js +1 -8
  141. package/dist/storage/storageVersions.js +7 -4
  142. package/dist/storage/taskStore.js +8 -8
  143. package/dist/storage/upgrade/upgradeOrchestrator.js +112 -83
  144. package/dist/task/completionReadiness.js +17 -98
  145. package/dist/task/deliveryGuard.js +9 -11
  146. package/dist/task/draftPlan.js +142 -0
  147. package/dist/task/nextAction.js +179 -477
  148. package/dist/task/publicationVerification.js +1 -0
  149. package/dist/task/remoteDelivery.js +233 -0
  150. package/dist/task/task.js +108 -4
  151. package/dist/task/taskRecordReference.js +0 -1
  152. package/dist/turn/turn.js +109 -16
  153. package/dist/verification/verificationGateService.js +0 -26
  154. package/dist/web/assets/client/components.js +99 -121
  155. package/dist/web/assets/client/i18n.js +136 -58
  156. package/dist/web/assets/client/view.js +44 -0
  157. package/dist/web/assets/styles/cards.js +3 -15
  158. package/dist/web/assets/styles/widgets.js +4 -0
  159. package/dist/web/webSnapshot.js +29 -14
  160. package/dist/workItem/dependencyGate.js +34 -0
  161. package/dist/workItem/workItem.js +99 -266
  162. package/dist/workspace/workItemChangeSetManager.js +15 -59
  163. package/docs/task-local-identity.md +1 -1
  164. package/i18n/README.zh-CN.md +165 -59
  165. package/package.json +1 -1
  166. package/skills/yui-leader/SKILL.md +272 -782
  167. package/skills/yui-operator/SKILL.md +190 -365
  168. package/skills/yui-reviewer/SKILL.md +40 -33
  169. package/skills/yui-runtime/SKILL.md +27 -6
  170. package/skills/yui-worker/SKILL.md +19 -6
  171. package/dist/execution/candidateConvergence.js +0 -623
  172. package/dist/execution/executionGroup.js +0 -854
  173. package/dist/execution/resourceBroker.js +0 -426
  174. package/dist/executor/launchPlan.js +0 -16
  175. package/dist/review/reviewFinding.js +0 -240
  176. package/dist/review/reviewFindingLedger.js +0 -550
  177. package/dist/review/reviewOutcomeClassifier.js +0 -255
  178. package/dist/scheduler/resourceQueueProjection.js +0 -71
  179. package/dist/task/repairWave.js +0 -150
@@ -1,10 +1,8 @@
1
1
  /**
2
2
  * Side-by-side `yui update` orchestration for the current storage contract.
3
3
  *
4
- * The staged binary may only prove that the target Home already implements the
5
- * exact current contract. Updating never rewrites, normalizes, migrates, or
6
- * repairs storage. An older Home stays untouched so an Operator can inspect it
7
- * with its original Yui version and create a new current Task explicitly.
4
+ * The staged binary proves an exact-current Home before the exact Controller
5
+ * is stopped and the replacement is activated, verified, and restarted.
8
6
  */
9
7
  export function runUpdate(ports, options) {
10
8
  let staged;
@@ -105,14 +103,15 @@ function activateAndVerify(ports, staged, home, lifecycle) {
105
103
  ports.verify(staged, home);
106
104
  }
107
105
  catch (error) {
108
- return restoreControllerOrReport(ports, home, lifecycle, {
106
+ const failure = {
109
107
  outcome: "aborted",
110
108
  phase: "post-verify",
111
109
  message: `Post-update health check failed: ${messageOf(error)}`,
112
110
  action: binaryHealthUncertainAction(),
113
111
  recoverable: false,
114
112
  version: staged.version
115
- });
113
+ };
114
+ return restoreControllerOrReport(ports, home, lifecycle, failure);
116
115
  }
117
116
  if (lifecycle.ensureRunning) {
118
117
  try {
@@ -140,7 +139,10 @@ function activateAndVerify(ports, staged, home, lifecycle) {
140
139
  : restoreControllerOrReport(ports, home, lifecycle, failure);
141
140
  }
142
141
  }
143
- return { outcome: "updated", version: staged.version, path: "current-fast" };
142
+ return {
143
+ outcome: "updated",
144
+ version: staged.version
145
+ };
144
146
  }
145
147
  function captureControllerLifecycle(ports, version, home) {
146
148
  const supplied = [
@@ -186,7 +188,7 @@ function captureControllerLifecycle(ports, version, home) {
186
188
  return { lifecycle: { ensureRunning: true, wasRunning: false } };
187
189
  }
188
190
  if (!isPositivePid(status.pid) || !isControllerIdentity(status.identity)) {
189
- return malformedControllerResult(version, "The running Controller did not expose an exact PID and launch identity.");
191
+ return malformedControllerResult(version, "The running Controller did not expose an exact PID and runtime generation identity.");
190
192
  }
191
193
  let stopped;
192
194
  try {
@@ -7,10 +7,9 @@
7
7
  * `npm install --global --prefix <tmp>`, so the live global install is never
8
8
  * touched until the binary-activation step. Preflight invokes the STAGED binary's
9
9
  * internal `yui upgrade --update-preflight` contract so the target version
10
- * proves that the Home already implements the exact current contract. After
11
- * the parent stops the exact old Controller, only the binary is promoted;
12
- * update never rewrites or switches storage. Post-verify invokes the actually
13
- * activated global binary.
10
+ * proves that the Home exactly matches its current storage contract. After the
11
+ * parent stops the exact old Controller, the binary is promoted and the
12
+ * activated binary verifies the unchanged Home.
14
13
  *
15
14
  * Two hardening guarantees this module enforces:
16
15
  *
@@ -514,6 +513,9 @@ function runControllerCommand(home, environment, spawn, method, cliBinary) {
514
513
  env: {
515
514
  ...environment,
516
515
  YUI_HOME: home,
516
+ // Lifecycle capture needs the schema-independent resource inventory,
517
+ // not the optional current-schema identity health verdict.
518
+ YUI_STATUS_IDENTITY: "0",
517
519
  // This exact lifecycle child is part of the update process that owns
518
520
  // the handover lock. Managed Sessions never receive this bypass.
519
521
  YUI_UPDATE_HANDOVER_OWNER_PID: String(process.pid)
@@ -693,7 +695,7 @@ function assertActivatedControllerIdentity(identity, activatedBinary, activatedV
693
695
  if (identity.executablePath !== process.execPath
694
696
  || identity.args.length !== 1
695
697
  || identity.args[0] !== expectedEntrypoint) {
696
- throw new Error("Replacement Controller launch identity does not match the activated global binary "
698
+ throw new Error("Replacement Controller runtime generation identity does not match the activated global binary "
697
699
  + "runtime/entrypoint; refusing readiness.");
698
700
  }
699
701
  }
@@ -782,19 +784,21 @@ function interpretPreflight(result) {
782
784
  ...(data.sceneUnchanged === true ? { sceneUnchanged: true } : {})
783
785
  };
784
786
  }
785
- /** Only the exact current storage contract is a green update preflight. */
787
+ /** Accept only an exact current Home. */
786
788
  function parseUpdatePreflightResult(data) {
787
- if (data.status !== "already-current" || data.stepCount !== 0)
789
+ if (data.status !== "already-current"
790
+ || !Number.isSafeInteger(data.stepCount)
791
+ || data.stepCount !== 0
792
+ || !Array.isArray(data.steps)
793
+ || data.steps.length !== 0)
788
794
  return null;
789
795
  const homeClassification = data.classification;
790
796
  if (!isRecord(homeClassification) || !isRecord(homeClassification.classification))
791
797
  return null;
792
798
  const classification = homeClassification.classification;
793
- if (classification.verdict !== "USABLE"
794
- || classification.status !== "current") {
799
+ if (classification.verdict !== "USABLE" || classification.status !== "current")
795
800
  return null;
796
- }
797
- return { status: "already-current" };
801
+ return { status: "already-current", stepCount: 0 };
798
802
  }
799
803
  function parseUpdateBlockers(value) {
800
804
  if (value === undefined)
@@ -806,7 +810,7 @@ function parseUpdateBlockers(value) {
806
810
  if (!isRecord(item) || typeof item.reason !== "string" || item.reason.length === 0) {
807
811
  return undefined;
808
812
  }
809
- const optional = ["taskId", "roleName", "turnId", "nativeSessionId", "launchId"];
813
+ const optional = ["taskId", "roleName", "turnId", "nativeSessionId", "runtimeGenerationId"];
810
814
  if (optional.some((key) => item[key] !== undefined && typeof item[key] !== "string")) {
811
815
  return undefined;
812
816
  }
@@ -817,7 +821,7 @@ function parseUpdateBlockers(value) {
817
821
  ...(typeof item.nativeSessionId === "string"
818
822
  ? { nativeSessionId: item.nativeSessionId }
819
823
  : {}),
820
- ...(typeof item.launchId === "string" ? { launchId: item.launchId } : {}),
824
+ ...(typeof item.runtimeGenerationId === "string" ? { runtimeGenerationId: item.runtimeGenerationId } : {}),
821
825
  reason: item.reason
822
826
  });
823
827
  }
@@ -1,7 +1,4 @@
1
- /**
2
- * `yui upgrade` is now a read-only storage admission diagnostic. This release
3
- * opens only its exact current contract and never rewrites an historical Home.
4
- */
1
+ /** `yui upgrade` validates the exact storage contract supported by this release. */
5
2
  import { latestStorageVersionState } from "../storage/upgrade/recordVersions.js";
6
3
  import { runStorageUpgrade } from "../storage/upgrade/upgradeOrchestrator.js";
7
4
  import { usageError } from "../errors/cliError.js";
@@ -41,7 +38,7 @@ export function renderUpgradeResult(result, mode) {
41
38
  case "already-current":
42
39
  return `${header}\nStorage is already at the current version; nothing to upgrade.`;
43
40
  case "update-preflight":
44
- return `${header}\nUpdate preflight: already-current (0 steps). Storage was not modified.`;
41
+ return `${header}\nUpdate preflight: ${result.status} (${result.stepCount} steps). Storage was not modified.`;
45
42
  case "blocked": {
46
43
  return [
47
44
  header,