@zq-silk/yui 0.7.0 → 0.8.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 (49) hide show
  1. package/README.md +42 -23
  2. package/dist/cli/commandCatalog.js +234 -122
  3. package/dist/cli/completion.js +3 -3
  4. package/dist/cli/helpRenderer.js +3 -0
  5. package/dist/cli/interactionPolicy.js +44 -23
  6. package/dist/cli/interactiveSelection.js +1 -1
  7. package/dist/cli/invocationRouter.js +1 -1
  8. package/dist/cli/roleWizard.js +8 -8
  9. package/dist/cli.js +116 -72
  10. package/dist/commands/agentCommands.js +5 -5
  11. package/dist/commands/configCommands.js +351 -104
  12. package/dist/commands/configOverview.js +60 -0
  13. package/dist/commands/deliveryGuardPreflight.js +2 -2
  14. package/dist/commands/globalRoleCommands.js +9 -9
  15. package/dist/commands/profileCommands.js +8 -8
  16. package/dist/commands/resourcesCommands.js +6 -5
  17. package/dist/commands/taskCommands.js +3 -6
  18. package/dist/commands/taskRoleRuntimeStatus.js +3 -1
  19. package/dist/commands/telemetryCommands.js +11 -6
  20. package/dist/config/configCatalog.js +42 -0
  21. package/dist/config/yuiConfig.js +80 -35
  22. package/dist/context/sessionBootstrapManifest.js +1 -1
  23. package/dist/controller/clientRuntime.js +0 -2
  24. package/dist/controller/controller.js +21 -9
  25. package/dist/controller/fileSchedulerStoreAdapter.js +20 -9
  26. package/dist/controller/runtime.js +32 -18
  27. package/dist/coordination/workMailbox.js +25 -22
  28. package/dist/doctor/doctor.js +2 -2
  29. package/dist/resources/autoResourceGc.js +3 -1
  30. package/dist/review/reviewConfig.js +0 -2
  31. package/dist/run/providerRetry.js +29 -16
  32. package/dist/run/providerRetryConfig.js +5 -3
  33. package/dist/runtime/launchDiagnostics.js +1 -1
  34. package/dist/scheduler/roleRunStall.js +12 -9
  35. package/dist/setup/setupCommand.js +153 -492
  36. package/dist/storage/compatibleTaskStore.js +9 -5
  37. package/dist/storage/migration/productionRegistry.js +58 -0
  38. package/dist/storage/sqliteStore.js +9 -2
  39. package/dist/storage/taskStore.js +21 -2
  40. package/dist/telemetry/sqliteTelemetryStore.js +9 -1
  41. package/dist/telemetry/telemetryConfig.js +1 -18
  42. package/dist/telemetry/telemetryStore.js +2 -2
  43. package/dist/telemetry/telemetryWiring.js +6 -5
  44. package/dist/web/webSnapshot.js +5 -3
  45. package/i18n/README.zh-CN.md +37 -32
  46. package/package.json +1 -1
  47. package/skills/yui-leader/SKILL.md +12 -5
  48. package/skills/yui-operator/SKILL.md +44 -6
  49. package/skills/yui-runtime/SKILL.md +1 -1
@@ -51,6 +51,8 @@ export function clearMatchingLeaderStallAttention(store, taskId, runId) {
51
51
  */
52
52
  export function projectRoleRunHealth(input) {
53
53
  const windowMs = input.windowMs ?? DEFAULT_STALL_WINDOW_MS;
54
+ const diagnosticAfterMs = input.diagnosticAfterMs
55
+ ?? DEFAULT_WORKFLOW_STALL_CANDIDATE_AGE_MS;
54
56
  if (!Number.isFinite(windowMs) || windowMs <= 0) {
55
57
  throw new Error("Role run stall window must be a positive number of milliseconds.");
56
58
  }
@@ -65,7 +67,7 @@ export function projectRoleRunHealth(input) {
65
67
  const candidate = Number.isFinite(candidateAge)
66
68
  && (input.deliveredAt === undefined
67
69
  ? candidateAge >= windowMs
68
- : candidateAge >= DEFAULT_WORKFLOW_STALL_CANDIDATE_AGE_MS);
70
+ : candidateAge >= diagnosticAfterMs);
69
71
  const providerAcceptance = input.providerAcceptance
70
72
  ?? (input.deliveredAt === undefined ? "ambiguous" : "accepted");
71
73
  const hostLiveness = input.hostLiveness;
@@ -84,7 +86,7 @@ export function projectRoleRunHealth(input) {
84
86
  : "matching";
85
87
  const resourceActivity = hostLiveness === "present"
86
88
  && nativeSession === "matching"
87
- && resourceEvidenceIsFresh(input.resource, input.now, windowMs)
89
+ && resourceEvidenceIsFresh(input.resource, input.now, windowMs, diagnosticAfterMs)
88
90
  // Residency/RSS and an unchanged cumulative counter are not progress.
89
91
  && input.resource?.active === true
90
92
  && input.resource?.changed === true;
@@ -494,7 +496,7 @@ export function isRoleRunStalled(events, runId) {
494
496
  * structured waiting/working facts. No branch sends terminal bytes, retries,
495
497
  * replaces a Session, or changes Run status.
496
498
  */
497
- export async function reconcileStalledRoleRuns(store, delivery, now, selection, windowMs = DEFAULT_STALL_WINDOW_MS, liveStatuses, resourceEvidence) {
499
+ export async function reconcileStalledRoleRuns(store, delivery, now, selection, windowMs = DEFAULT_STALL_WINDOW_MS, liveStatuses, resourceEvidence, diagnosticAfterMs = DEFAULT_WORKFLOW_STALL_CANDIDATE_AGE_MS) {
498
500
  // Dirty mailbox passes are intentionally not a second scheduler. Full
499
501
  // reconcile owns the all-active-Run scan; dirty passes may still route the
500
502
  // existing mailbox work without manufacturing another episode.
@@ -519,7 +521,7 @@ export async function reconcileStalledRoleRuns(store, delivery, now, selection,
519
521
  session: store.getRoleSession(task.id, role.name, run.effective.agentId)
520
522
  }];
521
523
  })));
522
- const stallCandidates = candidates.filter(({ run }) => isStallCandidate(run, now, windowMs));
524
+ const stallCandidates = candidates.filter(({ run }) => isStallCandidate(run, now, windowMs, diagnosticAfterMs));
523
525
  if (stallCandidates.length === 0)
524
526
  return [];
525
527
  const stallCandidateKeys = new Set(stallCandidates.map(({ task, role }) => (`${task.id}\0${role.name}`)));
@@ -689,7 +691,7 @@ export async function reconcileStalledRoleRuns(store, delivery, now, selection,
689
691
  && sessionUsable
690
692
  && expectedResourceIdentity !== undefined
691
693
  && resourceEvidenceMatchesCurrentRun(resourceSnapshot, expectedResourceIdentity, progressAt)
692
- && resourceEvidenceIsFresh(resourceSnapshot, now, windowMs);
694
+ && resourceEvidenceIsFresh(resourceSnapshot, now, windowMs, diagnosticAfterMs);
693
695
  const resource = resourceIsCurrent ? resourceSnapshot : undefined;
694
696
  const health = projectRoleRunHealth({
695
697
  progressAt,
@@ -699,6 +701,7 @@ export async function reconcileStalledRoleRuns(store, delivery, now, selection,
699
701
  : { deliveredAt: candidate.run.deliveredAt }),
700
702
  now,
701
703
  windowMs,
704
+ diagnosticAfterMs,
702
705
  hostLiveness: live,
703
706
  nativeSession: candidate.session,
704
707
  providerAcceptance: candidate.run.deliveredAt === undefined
@@ -825,7 +828,7 @@ export async function reconcileStalledRoleRuns(store, delivery, now, selection,
825
828
  }
826
829
  return raised;
827
830
  }
828
- function isStallCandidate(run, now, windowMs) {
831
+ function isStallCandidate(run, now, windowMs, diagnosticAfterMs) {
829
832
  const startAt = run.deliveredAt ?? run.createdAt;
830
833
  const ageMs = now.getTime() - Date.parse(startAt);
831
834
  if (!Number.isFinite(ageMs))
@@ -834,7 +837,7 @@ function isStallCandidate(run, now, windowMs) {
834
837
  // window, but they never enter workflow-stall candidate filtering.
835
838
  return run.deliveredAt === undefined
836
839
  ? ageMs >= windowMs
837
- : ageMs >= DEFAULT_WORKFLOW_STALL_CANDIDATE_AGE_MS;
840
+ : ageMs >= diagnosticAfterMs;
838
841
  }
839
842
  function classifyLeaderStall(store, taskId, observed, now, windowMs) {
840
843
  if (store.hasOpenInputRequest(taskId))
@@ -1020,7 +1023,7 @@ function resourceEvidenceMatchesCurrentRun(resource, expected, progressAt) {
1020
1023
  function hasResourceIdentityText(value) {
1021
1024
  return typeof value === "string" && value.trim().length > 0;
1022
1025
  }
1023
- function resourceEvidenceIsFresh(evidence, now, windowMs) {
1026
+ function resourceEvidenceIsFresh(evidence, now, windowMs, diagnosticAfterMs = DEFAULT_WORKFLOW_STALL_CANDIDATE_AGE_MS) {
1024
1027
  if (evidence === undefined)
1025
1028
  return false;
1026
1029
  const observedAt = Date.parse(evidence.observedAt);
@@ -1028,5 +1031,5 @@ function resourceEvidenceIsFresh(evidence, now, windowMs) {
1028
1031
  return false;
1029
1032
  // A sample from an earlier scheduler window is not a current health signal.
1030
1033
  return observedAt <= now.getTime()
1031
- && now.getTime() - observedAt < Math.max(windowMs, DEFAULT_WORKFLOW_STALL_CANDIDATE_AGE_MS);
1034
+ && now.getTime() - observedAt < Math.max(windowMs, diagnosticAfterMs);
1032
1035
  }