@zq-silk/yui 0.15.12 → 0.16.1

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 (236) hide show
  1. package/ARCHITECTURE.md +3 -2
  2. package/ARCHITECTURE.zh-CN.md +3 -2
  3. package/dist/artifacts/artifactCommitLock.js +16 -55
  4. package/dist/artifacts/taskArtifactRepository.js +3 -3
  5. package/dist/cli/agentConfigurationPicker.js +1 -1
  6. package/dist/cli/commandCatalog.js +57 -41
  7. package/dist/cli/completion.js +18 -18
  8. package/dist/cli/completionWizard.js +1 -1
  9. package/dist/cli/dynamicCompletion.js +1 -1
  10. package/dist/cli/interactionPolicy.js +7 -3
  11. package/dist/cli/invocationAuthority.js +64 -0
  12. package/dist/cli/managedDiagnostics.js +1 -1
  13. package/dist/cli/parseRepeatable.js +35 -0
  14. package/dist/cli/updatePorts.js +37 -8
  15. package/dist/cli.js +1280 -1243
  16. package/dist/commands/agentCommands.js +4 -4
  17. package/dist/commands/capabilityCommands.js +1 -1
  18. package/dist/commands/configCommands.js +6 -57
  19. package/dist/commands/configOverview.js +2 -2
  20. package/dist/commands/durableJobCommands.js +12 -6
  21. package/dist/commands/globalRoleCommands.js +53 -29
  22. package/dist/commands/grantCommands.js +0 -3
  23. package/dist/commands/jobCommands.js +1 -4
  24. package/dist/commands/operatorCommands.js +3 -3
  25. package/dist/commands/projectCommands.js +1 -10
  26. package/dist/commands/resourcesCommands.js +10 -40
  27. package/dist/commands/roleConfiguration.js +2 -6
  28. package/dist/commands/taskActivationCommands.js +4 -8
  29. package/dist/commands/taskAgentCapabilities.js +9 -0
  30. package/dist/commands/taskCommandSupport.js +155 -0
  31. package/dist/commands/taskCommandTypes.js +1 -0
  32. package/dist/commands/taskCommands.js +271 -710
  33. package/dist/commands/taskCompletionGate.js +1 -1
  34. package/dist/commands/taskExecutionCommands.js +1 -1
  35. package/dist/commands/taskFactCommands.js +325 -0
  36. package/dist/commands/taskInputCommands.js +12 -42
  37. package/dist/commands/taskIntegrationCommands.js +17 -57
  38. package/dist/commands/taskNextActionCommand.js +7 -6
  39. package/dist/commands/taskPublicationAdoptCommand.js +3 -3
  40. package/dist/commands/taskPublicationCommands.js +1 -1
  41. package/dist/commands/taskPublicationVerifyCommand.js +1 -1
  42. package/dist/commands/taskRemoteDeliveryCommand.js +2 -94
  43. package/dist/commands/taskUpstreamCommands.js +19 -8
  44. package/dist/commands/workflowCommands.js +6 -1
  45. package/dist/completion/completionInstaller.js +26 -26
  46. package/dist/completion/completionState.js +26 -26
  47. package/dist/completion/fileCompletionManager.js +6 -11
  48. package/dist/config/configCatalog.js +0 -2
  49. package/dist/config/timeZone.js +14 -0
  50. package/dist/config/yuiConfig.js +0 -29
  51. package/dist/context/runContextPack.js +2 -3
  52. package/dist/context/taskCatalog.js +3 -5
  53. package/dist/context/taskContext.js +139 -151
  54. package/dist/context/wakeRunReferences.js +11 -0
  55. package/dist/controller/agentCapabilities.js +58 -0
  56. package/dist/controller/agentRuntimeObserver.js +6 -11
  57. package/dist/controller/clientRuntime.js +22 -14
  58. package/dist/controller/controller.js +9 -22
  59. package/dist/controller/fileSchedulerStoreAdapter.js +117 -212
  60. package/dist/controller/jobClient.js +4 -4
  61. package/dist/controller/jobControl.js +60 -25
  62. package/dist/controller/jobSupervisor.js +4 -4
  63. package/dist/controller/providerRetryDelivery.js +7 -7
  64. package/dist/controller/runtime.js +51 -44
  65. package/dist/controller/runtimeEventProcessor.js +0 -5
  66. package/dist/controller/sessionOwnerReconciliation.js +5 -0
  67. package/dist/controller/taskAgentError.js +35 -0
  68. package/dist/coordination/workMailboxQueue.js +2 -24
  69. package/dist/core/controllerClient.js +2 -2
  70. package/dist/core/fileLockOwner.js +74 -0
  71. package/dist/decision/decision.js +17 -0
  72. package/dist/doctor/doctor.js +18 -9
  73. package/dist/event/taskEvent.js +12 -0
  74. package/dist/execution/workItemExecutionProjection.js +2 -2
  75. package/dist/executor/agentCapabilityConfig.js +43 -0
  76. package/dist/executor/agentConfigurationCatalog.js +49 -11
  77. package/dist/executor/agentExecutor.js +5 -8
  78. package/dist/executor/fileRoleLaunchPlanner.js +11 -53
  79. package/dist/executor/taskAgentCapabilities.js +64 -0
  80. package/dist/integration/deliveryObligation.js +1 -69
  81. package/dist/integration/gitIntegrationService.js +60 -84
  82. package/dist/integration/integrationAttempt.js +3 -14
  83. package/dist/integration/integrationSourceApplication.js +4 -12
  84. package/dist/integration/manifestTags.js +2 -2
  85. package/dist/job/durableJob.js +4 -25
  86. package/dist/job/jobAssignmentScope.js +22 -0
  87. package/dist/job/jobOperation.js +16 -0
  88. package/dist/job/jobRunner.js +2 -1
  89. package/dist/job/stepDirectory.js +15 -0
  90. package/dist/kernel/builtinCapabilities.js +15 -11
  91. package/dist/kernel/kernelPorts.js +1 -17
  92. package/dist/lifecycle/exactRunTerminalization.js +1 -9
  93. package/dist/message/inputControlResolution.js +3 -4
  94. package/dist/message/message.js +17 -20
  95. package/dist/message/messageContinuation.js +1 -1
  96. package/dist/milestone/milestone.js +11 -0
  97. package/dist/observability/orchestrationMetrics.js +24 -1
  98. package/dist/observability/runtimeIdentity.js +1 -17
  99. package/dist/output/agentConfigurationPresentation.js +2 -0
  100. package/dist/output/timePresentation.js +1 -14
  101. package/dist/plugins/pluginService.js +12 -4
  102. package/dist/release/releaseWorkflowPorts.js +45 -96
  103. package/dist/release/runtimeRelease.js +9 -15
  104. package/dist/repository/projectMaintenanceLock.js +23 -64
  105. package/dist/repository/taskBaseFreshness.js +1 -1
  106. package/dist/repository/taskWorkspaceCoordinator.js +13 -22
  107. package/dist/repository/taskWorkspacePreparer.js +29 -25
  108. package/dist/repository/workspaceCleanupInspection.js +5 -5
  109. package/dist/resources/autoResourceGc.js +4 -77
  110. package/dist/resources/liveReferences.js +7 -54
  111. package/dist/resources/resourceDiscovery.js +5 -118
  112. package/dist/resources/resourceGc.js +233 -181
  113. package/dist/resources/resourceRegistrar.js +5 -4
  114. package/dist/resources/resourceRegistry.js +3 -37
  115. package/dist/resources/resourceRegistryStore.js +13 -36
  116. package/dist/resources/sqliteResourceRegistry.js +43 -26
  117. package/dist/review/deltaRecheck.js +1 -1
  118. package/dist/review/reviewAcceptance.js +1 -1
  119. package/dist/review/reviewDecision.js +1 -1
  120. package/dist/review/reviewRound.js +8 -7
  121. package/dist/review/taskFinalReviewContractResolution.js +1 -1
  122. package/dist/runtime/acpProtocol.js +4 -51
  123. package/dist/runtime/acpSession.js +10 -75
  124. package/dist/runtime/acpSessionConfiguration.js +1 -8
  125. package/dist/runtime/agentEndpoint.js +3 -2
  126. package/dist/runtime/agentFailureContext.js +43 -0
  127. package/dist/runtime/agentHost.js +15 -15
  128. package/dist/runtime/codexInteractiveHost.js +2 -2
  129. package/dist/runtime/index.js +0 -1
  130. package/dist/runtime/managedCaller.js +21 -1
  131. package/dist/runtime/providerErrors.js +38 -0
  132. package/dist/runtime/runtimeObservation.js +0 -5
  133. package/dist/runtime/runtimeSessionCandidate.js +2 -3
  134. package/dist/runtime/sessionOwnerIdentity.js +1 -1
  135. package/dist/runtime/structuredProviderHost.js +4 -41
  136. package/dist/runtime/tmuxAdapters.js +6 -8
  137. package/dist/scheduler/activeRoleRunDelivery.js +7 -7
  138. package/dist/scheduler/leaderWakeupProcessor.js +19 -6
  139. package/dist/scheduler/operatorEvent.js +12 -20
  140. package/dist/scheduler/operatorInputNotificationProcessor.js +1 -1
  141. package/dist/scheduler/ports.js +5 -8
  142. package/dist/scheduler/roleRunLiveness.js +4 -4
  143. package/dist/scheduler/roleRunStall.js +16 -23
  144. package/dist/scheduler/taskExecutionProjection.js +25 -33
  145. package/dist/scheduler/taskObservabilityProjection.js +0 -1
  146. package/dist/scheduler/taskWake.js +5 -10
  147. package/dist/scheduler/wakeReason.js +2 -0
  148. package/dist/scheduler/wakeupQueue.js +2 -4
  149. package/dist/setup/setupCommand.js +1 -1
  150. package/dist/storage/contextRecords.js +106 -0
  151. package/dist/storage/currentTaskStore.js +1 -1
  152. package/dist/storage/homeLayout.js +13 -17
  153. package/dist/storage/migrations/agentFailureContext.js +22 -0
  154. package/dist/storage/migrations/currentInputContract.js +86 -0
  155. package/dist/storage/migrations/currentRuntimeContract.js +228 -0
  156. package/dist/storage/migrations/historicalVerificationPlan.js +35 -0
  157. package/dist/storage/migrations/integrationContinuation.js +5 -4
  158. package/dist/storage/migrations/narrowAgentFailureContext.js +65 -0
  159. package/dist/storage/migrations/notificationOnlyWakes.js +74 -0
  160. package/dist/storage/migrations/verificationPlanV1.js +162 -0
  161. package/dist/storage/migrations/verificationPolicy.js +74 -0
  162. package/dist/storage/migrations/workItemHistory.js +46 -0
  163. package/dist/storage/persistenceWorker.js +12 -4
  164. package/dist/storage/recordValidation.js +87 -0
  165. package/dist/storage/sqliteSchema.js +142 -1
  166. package/dist/storage/sqliteStore.js +156 -162
  167. package/dist/storage/storageSchema.js +2 -14
  168. package/dist/storage/storageVersions.js +1 -1
  169. package/dist/storage/storeRpc.js +15 -7
  170. package/dist/storage/taskStore.js +3 -7
  171. package/dist/storage/upgrade/upgradeOrchestrator.js +25 -37
  172. package/dist/task/completionReadiness.js +5 -24
  173. package/dist/task/draftPlan.js +0 -53
  174. package/dist/task/nextAction.js +7 -13
  175. package/dist/task/remoteDeliveryService.js +89 -0
  176. package/dist/task/taskActivation.js +2 -25
  177. package/dist/task/taskActivationService.js +0 -2
  178. package/dist/task/taskRecordReference.js +0 -1
  179. package/dist/task/taskSubmission.js +3 -14
  180. package/dist/telemetry/sqliteTelemetryBatch.js +29 -0
  181. package/dist/telemetry/sqliteTelemetryStore.js +49 -49
  182. package/dist/telemetry/telemetryWiring.js +4 -3
  183. package/dist/tmux/tmuxManager.js +29 -20
  184. package/dist/verification/gateArtifact.js +15 -24
  185. package/dist/verification/gateArtifactStore.js +14 -7
  186. package/dist/verification/verificationGateService.js +29 -88
  187. package/dist/verification/verificationPlan.js +27 -72
  188. package/dist/web/assets/client/app.js +1 -1
  189. package/dist/web/assets/client/taskSurface.js +4 -4
  190. package/dist/web/webServer.js +4 -6
  191. package/dist/web/webSnapshot.js +3 -83
  192. package/dist/web/webTaskSurface.js +17 -46
  193. package/dist/workItem/workItem.js +1 -12
  194. package/docs/architecture/capabilities-and-resources.md +14 -2
  195. package/docs/architecture/capabilities-and-resources.zh-CN.md +11 -1
  196. package/docs/managed-turn-and-session-runtime.md +83 -10
  197. package/docs/managed-turn-and-session-runtime.zh-CN.md +65 -11
  198. package/docs/plugin-sdk.md +4 -2
  199. package/docs/provider-runtime.md +3 -1
  200. package/docs/provider-runtime.zh-CN.md +4 -2
  201. package/docs/release-workflow.md +205 -7
  202. package/docs/release-workflow.zh-CN.md +151 -5
  203. package/docs/roles-and-configuration.md +29 -0
  204. package/docs/roles-and-configuration.zh-CN.md +21 -0
  205. package/docs/sqlite-control-plane-design.md +16 -3
  206. package/docs/sqlite-control-plane-design.zh-CN.md +13 -2
  207. package/docs/task-dag-semantics.md +3 -3
  208. package/docs/task-dag-semantics.zh-CN.md +2 -2
  209. package/docs/task-delivery.md +91 -5
  210. package/docs/task-delivery.zh-CN.md +72 -4
  211. package/docs/task-discovery.md +10 -11
  212. package/docs/task-discovery.zh-CN.md +8 -9
  213. package/docs/testing/verification-levels.md +148 -9
  214. package/docs/testing/verification-levels.zh-CN.md +105 -8
  215. package/package.json +1 -1
  216. package/skills/yui-leader/SKILL.md +5 -0
  217. package/skills/yui-leader/references/integration.md +9 -5
  218. package/skills/yui-leader/references/planning.md +9 -3
  219. package/skills/yui-operator/SKILL.md +15 -10
  220. package/skills/yui-runtime/SKILL.md +6 -6
  221. package/skills/yui-runtime/references/recovery.md +47 -0
  222. package/dist/agent/agentRegistry.js +0 -10
  223. package/dist/agentRun/runIdentity.js +0 -22
  224. package/dist/commands/deliveryGuardPreflight.js +0 -30
  225. package/dist/commands/taskIntegrationQueueCommands.js +0 -226
  226. package/dist/commands/taskOverviewCommand.js +0 -377
  227. package/dist/completion/completionWizard.js +0 -125
  228. package/dist/context/dispatchContext.js +0 -110
  229. package/dist/context/wakeNotification.js +0 -144
  230. package/dist/integration/integrationCheckEvidenceReuse.js +0 -53
  231. package/dist/integration/integrationQueueEntry.js +0 -191
  232. package/dist/integration/integrationQueueService.js +0 -810
  233. package/dist/release/fakeReleasePorts.js +0 -55
  234. package/dist/runtime/sessionOwnerRegistry.js +0 -137
  235. package/dist/task/deliveryGuard.js +0 -226
  236. /package/dist/{commands/taskActor.js → task/taskAuthority.js} +0 -0
@@ -0,0 +1,35 @@
1
+ import { usageError } from "../errors/cliError.js";
2
+ export function parseRepeatable(args, repeatable, singular, usage, flags = new Set()) {
3
+ const positionals = [];
4
+ const many = new Map();
5
+ const one = new Map();
6
+ for (let index = 0; index < args.length; index += 1) {
7
+ const value = args[index];
8
+ if (!value.startsWith("--")) {
9
+ positionals.push(value);
10
+ continue;
11
+ }
12
+ if (flags.has(value)) {
13
+ if (one.has(value))
14
+ throw usageError(`Option may only be specified once: ${value}.`, usage);
15
+ one.set(value, "true");
16
+ continue;
17
+ }
18
+ if (!repeatable.has(value) && !singular.has(value)) {
19
+ throw usageError(`Unsupported option: ${value}.`, usage);
20
+ }
21
+ if (singular.has(value) && one.has(value)) {
22
+ throw usageError(`Option may only be specified once: ${value}.`, usage);
23
+ }
24
+ const optionValue = args[index + 1];
25
+ if (optionValue === undefined || optionValue.startsWith("--")) {
26
+ throw usageError(`${value} is required.`, usage);
27
+ }
28
+ if (repeatable.has(value))
29
+ many.set(value, [...(many.get(value) ?? []), optionValue]);
30
+ else
31
+ one.set(value, optionValue);
32
+ index += 1;
33
+ }
34
+ return { positionals, many, one };
35
+ }
@@ -238,6 +238,7 @@ export function createUpdatePorts(environment, spawn = spawnSync, stagingRoot =
238
238
  }
239
239
  const UPDATE_CLI_PATH = fileURLToPath(new URL("../cli.js", import.meta.url));
240
240
  const UPDATE_CLIENT_RUNTIME_PATH = fileURLToPath(new URL("../controller/clientRuntime.js", import.meta.url));
241
+ const UPDATE_INVENTORY_PATH = fileURLToPath(new URL("../controller/resourceInventoryLinux.js", import.meta.url));
241
242
  const UPDATE_CONTROLLER_RECONCILIATION_PATH = fileURLToPath(new URL("../controller/updateReconciliation.js", import.meta.url));
242
243
  /**
243
244
  * Capture running state plus an authenticated exact process identity before
@@ -354,6 +355,7 @@ function stopReplacementControllerForUpdate(home, expectedPid, environment, spaw
354
355
  function runSchemaIndependentControllerStop(home, environment, spawn, expectedPid) {
355
356
  const helper = [
356
357
  "const values = process.argv.slice(1);",
358
+ "const handoverOwnerPid = Number(values.pop());",
357
359
  "const expectedPid = values.length === 3 ? Number(values.pop()) : undefined;",
358
360
  "const home = values.pop();",
359
361
  "const runtimeModule = values.pop();",
@@ -361,6 +363,7 @@ function runSchemaIndependentControllerStop(home, environment, spawn, expectedPi
361
363
  " const { stopFileTaskController } = await import(runtimeModule);",
362
364
  " const data = await stopFileTaskController(home, {",
363
365
  " environment: process.env,",
366
+ " handoverOwnerPid,",
364
367
  " ...(expectedPid === undefined ? {} : { expectedPid })",
365
368
  " });",
366
369
  " process.stdout.write(JSON.stringify({ ok: true, data }));",
@@ -376,7 +379,10 @@ function runSchemaIndependentControllerStop(home, environment, spawn, expectedPi
376
379
  helper,
377
380
  UPDATE_CLIENT_RUNTIME_PATH,
378
381
  home,
379
- ...(expectedPid === undefined ? [] : [String(expectedPid)])
382
+ ...(expectedPid === undefined ? [] : [String(expectedPid)]),
383
+ // The runtime validates the existing lock owner; the child must identify
384
+ // its owning updater instead of waiting on the parent's lock as foreign.
385
+ String(process.pid)
380
386
  ], { cwd: process.cwd(), env: { ...environment, YUI_HOME: home }, shell: false });
381
387
  if (result.error !== undefined || result.status !== 0) {
382
388
  const detail = result.stderr.toString("utf8").trim();
@@ -490,10 +496,11 @@ function restoreControllerIdentity(home, identity, environment, spawn) {
490
496
  // Spawn a detached child through a short-lived Node helper so the synchronous
491
497
  // update process can still use the authenticated, bounded readiness handshake
492
498
  // shared by Controller startup. No retry, sleep, or new identity inference is
493
- // hidden here.
499
+ // hidden here. Restoration participates in the same parent-owned lock.
494
500
  const helper = [
495
501
  "const { spawn } = require('node:child_process');",
496
502
  "const values = process.argv.slice(1);",
503
+ "const handoverOwnerPid = Number(values.pop());",
497
504
  "const version = values.pop();",
498
505
  "const args = JSON.parse(values.pop());",
499
506
  "const executable = values.pop();",
@@ -503,6 +510,7 @@ function restoreControllerIdentity(home, identity, environment, spawn) {
503
510
  " const { ensureFileTaskControllerIdentity } = await import(runtimeModule);",
504
511
  " await ensureFileTaskControllerIdentity(home, { executablePath: executable, args, version }, {",
505
512
  " environment: process.env,",
513
+ " handoverOwnerPid,",
506
514
  " spawnController: (_home, launchEnv) => {",
507
515
  " const child = spawn(executable, args, { detached: true, stdio: 'ignore', env: launchEnv });",
508
516
  " child.unref();",
@@ -517,23 +525,44 @@ function restoreControllerIdentity(home, identity, environment, spawn) {
517
525
  home,
518
526
  identity.executablePath,
519
527
  JSON.stringify(identity.args),
520
- identity.version
528
+ identity.version,
529
+ String(process.pid)
521
530
  ], { cwd: process.cwd(), env: launchEnvironment, shell: false, stdio: "pipe" });
522
531
  assertSpawnOk(result, "restore the previously running Controller identity");
523
532
  }
524
533
  function runControllerCommand(home, environment, spawn, method, cliBinary) {
525
- const command = cliBinary ?? process.execPath;
526
- const args = cliBinary === undefined
534
+ let command = cliBinary ?? process.execPath;
535
+ let args = cliBinary === undefined
527
536
  ? [UPDATE_CLI_PATH, "--json", "controller", method]
528
537
  : ["--json", "controller", method];
538
+ if (method === "status") {
539
+ // Lifecycle capture consumes the resource collector, not public status's
540
+ // current-schema health verdict. This is the same schema-independent seam
541
+ // used for update-owned stop/reconciliation, with no environment bypass.
542
+ const inventoryModule = cliBinary === undefined
543
+ ? UPDATE_INVENTORY_PATH
544
+ : join(dirname(activatedControllerEntrypoint(cliBinary)), "resourceInventoryLinux.js");
545
+ const helper = [
546
+ "(async () => {",
547
+ " const { pathToFileURL } = await import('node:url');",
548
+ " const { scanControllerResourceInventory } = await import(pathToFileURL(process.argv[1]).href);",
549
+ " const data = await scanControllerResourceInventory({",
550
+ " currentHome: process.argv[2], scope: 'current', environment: process.env",
551
+ " });",
552
+ " process.stdout.write(JSON.stringify({ ok: true, data }));",
553
+ "})().catch(error => {",
554
+ " process.stderr.write(JSON.stringify({ ok: false, code: error.code ?? 'RUNTIME_ERROR', message: error.message }));",
555
+ " process.exitCode = 5;",
556
+ "});"
557
+ ].join(" ");
558
+ command = process.execPath;
559
+ args = ["-e", helper, inventoryModule, home];
560
+ }
529
561
  const result = spawn(command, args, {
530
562
  cwd: process.cwd(),
531
563
  env: {
532
564
  ...environment,
533
565
  YUI_HOME: home,
534
- // Lifecycle capture needs the schema-independent resource inventory,
535
- // not the optional current-schema identity health verdict.
536
- YUI_STATUS_IDENTITY: "0",
537
566
  // This exact lifecycle child is part of the update process that owns
538
567
  // the handover lock. Managed Sessions never receive this bypass.
539
568
  YUI_UPDATE_HANDOVER_OWNER_PID: String(process.pid)