@zq-silk/yui 0.13.9 → 0.14.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.
- package/ARCHITECTURE.md +69 -428
- package/README.md +108 -298
- package/dist/agent/managedRuntimeEnvironment.js +2 -2
- package/dist/cli/commandCatalog.js +39 -77
- package/dist/cli/interactionCandidates.js +4 -4
- package/dist/cli/interactionPolicy.js +7 -10
- package/dist/cli/invocationRouter.js +1 -1
- package/dist/cli/updateCommand.js +6 -27
- package/dist/cli/updateOrchestrator.js +63 -484
- package/dist/cli/updatePorts.js +15 -333
- package/dist/cli/upgradeCommand.js +8 -65
- package/dist/cli.js +57 -242
- package/dist/commands/configCommands.js +11 -62
- package/dist/commands/executionAuditCommands.js +23 -23
- package/dist/commands/globalRoleCommands.js +2 -7
- package/dist/commands/jobCommands.js +1 -4
- package/dist/commands/projectCommands.js +5 -5
- package/dist/commands/releaseCommands.js +3 -10
- package/dist/commands/resourcesCommands.js +2 -2
- package/dist/commands/sessionCommands.js +2 -2
- package/dist/commands/taskActor.js +31 -39
- package/dist/commands/taskChangeSetCommands.js +5 -12
- package/dist/commands/taskCommands.js +464 -1249
- package/dist/commands/taskContextCommand.js +35 -36
- package/dist/commands/taskExecutionCommands.js +33 -46
- package/dist/commands/taskInputCommands.js +20 -42
- package/dist/commands/taskNextActionCommand.js +9 -9
- package/dist/commands/taskOverviewCommand.js +56 -95
- package/dist/commands/taskRoleRuntimeStatus.js +77 -107
- package/dist/commands/taskUpstreamCommands.js +3 -3
- package/dist/commands/taskWorkspaceCommands.js +7 -79
- package/dist/commands/telemetryCommands.js +32 -124
- package/dist/commands/workflowCommands.js +3 -3
- package/dist/completion/fileCompletionManager.js +1 -1
- package/dist/config/configCatalog.js +4 -6
- package/dist/config/yuiConfig.js +6 -43
- package/dist/context/dispatchContext.js +14 -30
- package/dist/context/roleSessionContext.js +2 -2
- package/dist/context/sessionBootstrapManifest.js +2 -2
- package/dist/context/{runContextPack.js → turnContextPack.js} +58 -73
- package/dist/context/turnInputContract.js +204 -0
- package/dist/context/wakeNotification.js +2 -2
- package/dist/controller/agentRuntimeObserver.js +18 -18
- package/dist/controller/clientRuntime.js +13 -20
- package/dist/controller/controller.js +89 -116
- package/dist/controller/fileSchedulerStoreAdapter.js +511 -742
- package/dist/controller/jobControl.js +17 -17
- package/dist/controller/resourceInventory.js +6 -6
- package/dist/controller/resourceInventoryLinux.js +38 -59
- package/dist/controller/resourceInventoryRpc.js +3 -3
- package/dist/controller/resourceInventoryWorker.js +1 -1
- package/dist/controller/runtime.js +46 -53
- package/dist/controller/runtimeEventInbox.js +23 -31
- package/dist/controller/runtimeEventProcessor.js +15 -15
- package/dist/controller/{runtimeHookRunFence.js → runtimeHookTurnFence.js} +87 -81
- package/dist/controller/runtimeLaunchCoordinator.js +3 -3
- package/dist/controller/runtimeObservationHook.js +11 -8
- package/dist/controller/sessionNotify.js +11 -11
- package/dist/controller/structuredProviderObservation.js +89 -16
- package/dist/coordination/workMailbox.js +309 -579
- package/dist/coordination/workMailboxQueue.js +5 -6
- package/dist/core/controllerClient.js +1 -91
- package/dist/core/controllerServer.js +3 -6
- package/dist/doctor/doctor.js +51 -314
- package/dist/execution/candidateConvergence.js +3 -3
- package/dist/execution/executionGroup.js +32 -33
- package/dist/execution/executionHealth.js +36 -38
- package/dist/execution/resourceBroker.js +12 -12
- package/dist/executor/agentExecutor.js +30 -265
- package/dist/executor/effectiveLaunch.js +9 -19
- package/dist/executor/executorRegistry.js +43 -17
- package/dist/executor/fileRoleLaunchPlanner.js +56 -56
- package/dist/executor/launchPlan.js +3 -3
- package/dist/executor/workspacePreflightClassification.js +16 -16
- package/dist/grant/capabilityGrant.js +20 -25
- package/dist/input/inputRequest.js +12 -12
- package/dist/integration/changeSet.js +9 -13
- package/dist/integration/changeSetManifest.js +1 -1
- package/dist/integration/gitIntegrationService.js +2 -2
- package/dist/integration/integrationQueueService.js +5 -21
- package/dist/integration/overlapDiagnostics.js +2 -2
- package/dist/interaction/operatorPresentation.js +1 -1
- package/dist/job/jobRunner.js +1 -1
- package/dist/lifecycle/canonicalLifecycleEvent.js +25 -25
- package/dist/lifecycle/{exactRunTerminalization.js → exactTurnTerminalization.js} +116 -232
- package/dist/message/message.js +6 -6
- package/dist/observability/executionAudit.js +74 -86
- package/dist/observability/faultClassification.js +7 -24
- package/dist/observability/orchestrationMetrics.js +5 -5
- package/dist/observability/runtimeIdentity.js +34 -101
- package/dist/profile/agentProfile.js +1 -1
- package/dist/release/cliHomeReleaseFence.js +3 -3
- package/dist/release/releaseWorkflowEngine.js +6 -10
- package/dist/release/releaseWorkflowPorts.js +2 -2
- package/dist/release/workflowFileLock.js +1 -1
- package/dist/repository/checkoutSwap.js +1 -1
- package/dist/repository/gitWorkspace.js +0 -13
- package/dist/repository/project.js +1 -1
- package/dist/repository/projectMaintenanceLock.js +1 -2
- package/dist/repository/taskBaseFreshness.js +13 -13
- package/dist/repository/taskWorkspaceCoordinator.js +21 -25
- package/dist/repository/taskWorkspaceIdentity.js +8 -21
- package/dist/repository/taskWorkspacePreparer.js +63 -620
- package/dist/resources/autoResourceGc.js +3 -3
- package/dist/resources/liveReferences.js +1 -1
- package/dist/resources/resourceGc.js +1 -1
- package/dist/resources/sqliteResourceRegistry.js +1 -1
- package/dist/review/reviewDecision.js +7 -7
- package/dist/review/reviewFindingLedger.js +1 -1
- package/dist/review/reviewOutcomeClassifier.js +35 -50
- package/dist/review/reviewRound.js +14 -25
- package/dist/review/reviewerAvailability.js +4 -4
- package/dist/review/taskFinalReviewContractResolution.js +41 -0
- package/dist/role/role.js +6 -3
- package/dist/runtime/agentDriver.js +4 -0
- package/dist/runtime/agentHost.js +151 -36
- package/dist/runtime/builtinAgentDrivers.js +79 -2
- package/dist/runtime/codexAppServerRuntime.js +122 -0
- package/dist/runtime/continuationManager.js +3 -5
- package/dist/runtime/exactControlPlane.js +17 -42
- package/dist/runtime/firstProgressAdvisory.js +1 -1
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/launchDiagnostics.js +2 -2
- package/dist/runtime/lifecycleReservation.js +4 -4
- package/dist/runtime/processExitObservation.js +1 -1
- package/dist/runtime/processExitOutbox.js +0 -32
- package/dist/runtime/promptEnvelope.js +9 -9
- package/dist/runtime/providerContinuation.js +2 -2
- package/dist/runtime/providerContinuationReconciliationService.js +2 -2
- package/dist/runtime/providerRuntimeIdentity.js +76 -24
- package/dist/runtime/recentTurnIds.js +38 -0
- package/dist/runtime/runtimeContinuationProjection.js +2 -2
- package/dist/runtime/runtimeHealthPolicy.js +1 -1
- package/dist/runtime/runtimeObservation.js +58 -21
- package/dist/runtime/runtimeProjection.js +19 -27
- package/dist/runtime/sessionLaunchRequest.js +2 -2
- package/dist/runtime/structuredProviderHost.js +177 -12
- package/dist/runtime/tmuxAdapters.js +46 -11
- package/dist/scheduler/activeRoleTurnDelivery.js +245 -0
- package/dist/scheduler/leaderWakeupProcessor.js +147 -445
- package/dist/scheduler/operatorEvent.js +4 -6
- package/dist/scheduler/resourceQueueProjection.js +71 -0
- package/dist/scheduler/{roleRunLiveness.js → roleTurnLiveness.js} +24 -28
- package/dist/scheduler/{roleRunStall.js → roleTurnStall.js} +162 -247
- package/dist/scheduler/taskExecutionProjection.js +99 -99
- package/dist/scheduler/taskObservabilityProjection.js +10 -10
- package/dist/scheduler/taskWake.js +4 -4
- package/dist/scheduler/wakeReason.js +6 -10
- package/dist/scheduler/wakeupQueue.js +0 -9
- package/dist/setup/setupCommand.js +2 -2
- package/dist/storage/currentTaskStore.js +46 -0
- package/dist/storage/persistenceWorker.js +1 -1
- package/dist/storage/sqliteSchema.js +81 -485
- package/dist/storage/sqliteStore.js +206 -365
- package/dist/storage/storageSchema.js +1 -15
- package/dist/storage/storageVersions.js +8 -9
- package/dist/storage/storeRpc.js +10 -34
- package/dist/storage/taskStore.js +63 -3415
- package/dist/storage/upgrade/recordVersions.js +55 -149
- package/dist/storage/upgrade/upgradeOrchestrator.js +89 -1752
- package/dist/task/completionReadiness.js +5 -5
- package/dist/task/deliveryGuard.js +10 -10
- package/dist/task/nextAction.js +74 -77
- package/dist/task/task.js +2 -4
- package/dist/task/taskRecordReference.js +3 -3
- package/dist/task/taskRecordRetirement.js +1 -1
- package/dist/telemetry/sqliteTelemetryStore.js +53 -53
- package/dist/telemetry/telemetryConfig.js +14 -14
- package/dist/telemetry/telemetryWiring.js +8 -14
- package/dist/turn/turn.js +356 -0
- package/dist/{run/runIdentity.js → turn/turnIdentity.js} +4 -4
- package/dist/verification/gateArtifactStore.js +2 -2
- package/dist/web/assets/client/app.js +1 -1
- package/dist/web/assets/client/components.js +29 -54
- package/dist/web/assets/client/i18n.js +17 -37
- package/dist/web/assets/client/view.js +37 -37
- package/dist/web/assets/shell.js +1 -1
- package/dist/web/assets/styles/cards.js +5 -5
- package/dist/web/assets/styles/widgets.js +1 -2
- package/dist/web/webSnapshot.js +65 -60
- package/dist/workItem/workItem.js +11 -11
- package/dist/workspace/workItemChangeSetManager.js +1 -1
- package/docs/task-local-identity.md +5 -5
- package/i18n/README.zh-CN.md +41 -54
- package/package.json +1 -1
- package/skills/yui-leader/SKILL.md +85 -83
- package/skills/yui-operator/SKILL.md +16 -16
- package/skills/yui-reviewer/SKILL.md +10 -10
- package/skills/yui-runtime/SKILL.md +17 -18
- package/skills/yui-worker/SKILL.md +16 -18
- package/dist/context/runContextContract.js +0 -162
- package/dist/executor/turnCompletion.js +0 -126
- package/dist/review/taskFinalReviewContractEvent.js +0 -1
- package/dist/review/taskFinalReviewContractRebind.js +0 -367
- package/dist/run/agentRun.js +0 -356
- package/dist/run/rejectedYieldAttempt.js +0 -221
- package/dist/run/runControlRequest.js +0 -50
- package/dist/run/yieldReceipt.js +0 -65
- package/dist/runtime/turnCompletion.js +0 -3
- package/dist/scheduler/actionability.js +0 -323
- package/dist/scheduler/activeRoleRunDelivery.js +0 -868
- package/dist/scheduler/activeTaskProgress.js +0 -126
- package/dist/storage/compatibleTaskStore.js +0 -248
- package/dist/storage/migration/baseline.js +0 -78
- package/dist/storage/migration/classifier.js +0 -51
- package/dist/storage/migration/compatibleCodec.js +0 -53
- package/dist/storage/migration/engine.js +0 -147
- package/dist/storage/migration/index.js +0 -33
- package/dist/storage/migration/planner.js +0 -154
- package/dist/storage/migration/productionRegistry.js +0 -3931
- package/dist/storage/migration/registry.js +0 -169
- package/dist/storage/migration/report.js +0 -54
- package/dist/storage/migration/types.js +0 -31
- package/dist/storage/upgrade/homeClassification.js +0 -353
- package/dist/storage/upgrade/homeMigrationTarget.js +0 -595
- package/dist/storage/upgrade/migrationReceipt.js +0 -67
- package/dist/storage/upgrade/offlineUpgradeInventory.js +0 -453
- package/dist/storage/upgrade/productionMigrationRegistry.js +0 -6
- package/dist/storage/upgrade/pseudoLayoutRepair.js +0 -241
- package/dist/storage/upgrade/recordVersionScan.js +0 -176
- package/dist/storage/upgrade/sqliteFileSet.js +0 -50
- package/dist/storage/upgrade/sqliteMigrationTarget.js +0 -375
- package/dist/storage/upgrade/sqliteRecordMigrationTarget.js +0 -305
- package/dist/storage/upgrade/sqliteStateMigration.js +0 -918
- package/dist/storage/upgrade/switchProgress.js +0 -80
- package/dist/storage/upgrade/upgradeReceipt.js +0 -161
- package/dist/storage/upgradeCoordination.js +0 -187
- package/dist/storage/upgradeFence.js +0 -366
- package/dist/telemetry/telemetryCompaction.js +0 -252
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,6 @@ import { readFileSync } from "node:fs";
|
|
|
4
4
|
import { join, resolve } from "node:path";
|
|
5
5
|
import { createInterface } from "node:readline/promises";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { isDeepStrictEqual } from "node:util";
|
|
8
7
|
import { renderCommandHelp } from "./cli/helpRenderer.js";
|
|
9
8
|
import { describeCommandTree, findCommandNode } from "./cli/commandCatalog.js";
|
|
10
9
|
import { routeInvocation } from "./cli/invocationRouter.js";
|
|
@@ -37,10 +36,9 @@ import { runResourcesCommand } from "./commands/resourcesCommands.js";
|
|
|
37
36
|
import { applyOperatorSessionControl, runOperatorCommand } from "./commands/operatorCommands.js";
|
|
38
37
|
import { runProjectCommand } from "./commands/projectCommands.js";
|
|
39
38
|
import { runProfileCommand } from "./commands/profileCommands.js";
|
|
40
|
-
import { dispatchPreparedReviewRound, failPendingReviewRound, preserveReviewRoundWorkspace, parseTaskCompletionRequest,
|
|
39
|
+
import { dispatchPreparedReviewRound, failPendingReviewRound, preserveReviewRoundWorkspace, parseTaskCompletionRequest, preflightTaskCompletion, runTaskCommand, normalizedExecutionLanePlan, resolvedExecutionStageRetryGroup, validateTaskArchiveRequest } from "./commands/taskCommands.js";
|
|
41
40
|
import { taskActor } from "./commands/taskActor.js";
|
|
42
41
|
import { parseTaskExecutionStartRequest, parseTaskExecutionStopRequest, finalizeStoppedTaskExecution, startTaskExecutionCommand, stopTaskExecutionCommand } from "./commands/taskExecutionCommands.js";
|
|
43
|
-
import { isCurrentGlobalOperator } from "./commands/taskInputCommands.js";
|
|
44
42
|
import { runTaskIntegrationCommand } from "./commands/taskIntegrationCommands.js";
|
|
45
43
|
import { runTaskChangeSetCommand } from "./commands/taskChangeSetCommands.js";
|
|
46
44
|
import { runTaskOverlapCommand } from "./commands/taskOverlapCommands.js";
|
|
@@ -74,7 +72,7 @@ import { FileTaskWorkspacePreparer } from "./repository/taskWorkspacePreparer.js
|
|
|
74
72
|
import { inspectStorageSchema } from "./storage/storageSchema.js";
|
|
75
73
|
import { collectRuntimeBuildIdentity, collectStorageIdentity, countDroppedInboxEvents, createProductionRuntimeIdentityPorts, evaluateStorageHealth, resolveStatusIdentityEnabled } from "./observability/runtimeIdentity.js";
|
|
76
74
|
import { resolveYuiHome } from "./storage/taskStore.js";
|
|
77
|
-
import {
|
|
75
|
+
import { openCurrentTaskStore, validateCurrentTaskStore } from "./storage/currentTaskStore.js";
|
|
78
76
|
import { resolveTaskRecordReference } from "./task/taskRecordReference.js";
|
|
79
77
|
import { runSetupCommand, validateSetupInvocation } from "./setup/setupCommand.js";
|
|
80
78
|
import { NodeCommandExecutor } from "./tmux/commandExecutor.js";
|
|
@@ -90,7 +88,7 @@ import { YUI_CONTROL_PLANE_DESCRIPTOR, YUI_TASK_RUNTIME_DESCRIPTOR, assertCompat
|
|
|
90
88
|
import { readSessionBootstrapManifest, refreshManagedSessionCliWrappers } from "./context/sessionBootstrapManifest.js";
|
|
91
89
|
import { builtinAgentDriverRegistry } from "./runtime/builtinAgentDrivers.js";
|
|
92
90
|
import { createTaskFinalReviewContract, extractTaskFinalReviewRequest } from "./review/taskFinalReviewContract.js";
|
|
93
|
-
import {
|
|
91
|
+
import { resolveRecordedTaskFinalReviewContract } from "./review/taskFinalReviewContractResolution.js";
|
|
94
92
|
import { assessDeltaRecheck } from "./review/deltaRecheck.js";
|
|
95
93
|
import { isAcceptedTaskReviewBaseline } from "./review/reviewAcceptance.js";
|
|
96
94
|
import { NodeGitWorkspace } from "./repository/gitWorkspace.js";
|
|
@@ -262,7 +260,7 @@ export async function main() {
|
|
|
262
260
|
// detached per-Home Controller even when setup began with no Controller;
|
|
263
261
|
// read-only commands and failed setup still remain non-starting paths.
|
|
264
262
|
await ensureFileTaskController(home, { environment: process.env });
|
|
265
|
-
const refresh = await refreshRunningFileTaskControllerEnvironment(home,
|
|
263
|
+
const refresh = await refreshRunningFileTaskControllerEnvironment(home, openCurrentTaskStore(home), process.env);
|
|
266
264
|
emit(withControllerRefreshWarning(output, refresh, "Agent environment"));
|
|
267
265
|
return;
|
|
268
266
|
}
|
|
@@ -300,46 +298,10 @@ export async function main() {
|
|
|
300
298
|
return;
|
|
301
299
|
}
|
|
302
300
|
if (args[0] === "upgrade") {
|
|
303
|
-
//
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
const externalFenceOwner = externallyQuiesced
|
|
308
|
-
? process.env.YUI_UPDATE_HANDOVER_OWNER_PID
|
|
309
|
-
: undefined;
|
|
310
|
-
const externalUpgradeFenceOwnerPid = externalFenceOwner === undefined
|
|
311
|
-
? undefined
|
|
312
|
-
: Number(externalFenceOwner);
|
|
313
|
-
if (externalUpgradeFenceOwnerPid !== undefined
|
|
314
|
-
&& (!Number.isSafeInteger(externalUpgradeFenceOwnerPid)
|
|
315
|
-
|| externalUpgradeFenceOwnerPid < 1)) {
|
|
316
|
-
throw runtimeError("Update storage-fence owner PID is invalid.");
|
|
317
|
-
}
|
|
318
|
-
const handover = ownsHandover ? acquireHandoverLock(home) : undefined;
|
|
319
|
-
try {
|
|
320
|
-
const result = await runUpgradeCommand(args.slice(1), home, externallyQuiesced
|
|
321
|
-
? {
|
|
322
|
-
controllerLifecycle: "externally-quiesced",
|
|
323
|
-
...(externalUpgradeFenceOwnerPid === undefined
|
|
324
|
-
? {}
|
|
325
|
-
: { externalUpgradeFenceOwnerPid })
|
|
326
|
-
}
|
|
327
|
-
: {});
|
|
328
|
-
// Public execute upgrades leave the Home operational even when no
|
|
329
|
-
// Controller existed before the command. Dry-run and the staged updater's
|
|
330
|
-
// externally-quiesced preflight must remain read-only/lifecycle-neutral.
|
|
331
|
-
if (ownsHandover && result.exitCode === 0) {
|
|
332
|
-
await ensureFileTaskController(home, {
|
|
333
|
-
environment: process.env,
|
|
334
|
-
handoverOwnerPid: process.pid
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
process.exitCode = result.exitCode;
|
|
338
|
-
emit(result.output, false, result.data);
|
|
339
|
-
}
|
|
340
|
-
finally {
|
|
341
|
-
handover?.release();
|
|
342
|
-
}
|
|
301
|
+
// Admission diagnostic only: never quiesces, repairs, or switches storage.
|
|
302
|
+
const result = await runUpgradeCommand(args.slice(1), home);
|
|
303
|
+
process.exitCode = result.exitCode;
|
|
304
|
+
emit(result.output, false, result.data);
|
|
343
305
|
return;
|
|
344
306
|
}
|
|
345
307
|
if (args[0] === "internal") {
|
|
@@ -349,7 +311,7 @@ export async function main() {
|
|
|
349
311
|
throw usageError("Managed Session CLI refresh may be run only by the user or global Operator.");
|
|
350
312
|
}
|
|
351
313
|
const result = refreshManagedSessionCliWrappers(home, currentInvocationControlPlane(home));
|
|
352
|
-
emit(`Refreshed ${result.refreshed}
|
|
314
|
+
emit(`Refreshed ${result.refreshed} managed Session CLI wrapper(s); `
|
|
353
315
|
+ `${result.current} already current, ${result.skipped} skipped.`, false, result);
|
|
354
316
|
return;
|
|
355
317
|
}
|
|
@@ -382,7 +344,7 @@ export async function main() {
|
|
|
382
344
|
}
|
|
383
345
|
if (args[0] === "session" && args[1] === "reconcile") {
|
|
384
346
|
const options = parseSessionReconcileOptions(args.slice(2));
|
|
385
|
-
const store =
|
|
347
|
+
const store = openCurrentTaskStore(home);
|
|
386
348
|
const tmux = new TmuxManager(resolveTmuxBin(store.getConfig().tmuxBin), new NodeCommandExecutor(), {
|
|
387
349
|
yuiHome: home,
|
|
388
350
|
historyLimit: resolveTmuxHistoryLimit(store.getConfig().tmuxHistoryLimit)
|
|
@@ -428,21 +390,9 @@ export async function main() {
|
|
|
428
390
|
return;
|
|
429
391
|
}
|
|
430
392
|
if (method === "identity" && args.length === 2) {
|
|
431
|
-
//
|
|
432
|
-
//
|
|
433
|
-
|
|
434
|
-
// (a Controller that predates this feature), fall back to the
|
|
435
|
-
// authenticated socket identity so the command stays useful during
|
|
436
|
-
// rollout step 1.
|
|
437
|
-
let receipt = null;
|
|
438
|
-
try {
|
|
439
|
-
receipt = readRuntimeIdentity(home);
|
|
440
|
-
}
|
|
441
|
-
catch {
|
|
442
|
-
// A corrupt or stale receipt (for example one written by an older
|
|
443
|
-
// Controller that predates the launch-identity fields) falls back to
|
|
444
|
-
// the live socket identity, which always carries the exact argv.
|
|
445
|
-
}
|
|
393
|
+
// The receipt survives a Controller stop. If it has never been written,
|
|
394
|
+
// ask the authenticated live Controller for the same current identity.
|
|
395
|
+
const receipt = readRuntimeIdentity(home);
|
|
446
396
|
if (receipt !== null) {
|
|
447
397
|
emit("", false, receipt);
|
|
448
398
|
return;
|
|
@@ -506,9 +456,7 @@ export async function main() {
|
|
|
506
456
|
inventoryRssBytes: snapshot.summary.rssBytes
|
|
507
457
|
});
|
|
508
458
|
emit(`${renderControllerResourceStatus(snapshot, options.verbose)}\n\n${identitySection}`, false, { ...snapshot, identity: { build, storage, runtime, mismatch } });
|
|
509
|
-
//
|
|
510
|
-
// (pseudo-layout-7) is degraded but still readable via the file store,
|
|
511
|
-
// so it exits 0 with a DEGRADED health line and a precise repair action.
|
|
459
|
+
// The exact current storage contract fails closed on contradictions.
|
|
512
460
|
if (evaluateStorageHealth(storage).status === "fail")
|
|
513
461
|
process.exitCode = 5;
|
|
514
462
|
return;
|
|
@@ -554,7 +502,7 @@ export async function main() {
|
|
|
554
502
|
throw usageError("Controller usage: yui controller status [--all] [--verbose] | "
|
|
555
503
|
+ "cleanup [--all] | stop | restart.");
|
|
556
504
|
}
|
|
557
|
-
|
|
505
|
+
validateCurrentTaskStore(home);
|
|
558
506
|
const controllerMethod = method;
|
|
559
507
|
const updateHandoverOwner = process.env.YUI_UPDATE_HANDOVER_OWNER_PID;
|
|
560
508
|
// A pre-fix updater cannot pass the owner environment variable to the
|
|
@@ -583,7 +531,7 @@ export async function main() {
|
|
|
583
531
|
}
|
|
584
532
|
if (args[0] === "resources") {
|
|
585
533
|
await assertFileTaskControllerStorageCompatible(home);
|
|
586
|
-
const resourcesStore =
|
|
534
|
+
const resourcesStore = openCurrentTaskStore(home);
|
|
587
535
|
const result = await runResourcesCommand(args.slice(1), resourcesStore);
|
|
588
536
|
emit(result.output, false, result.data);
|
|
589
537
|
return;
|
|
@@ -596,7 +544,7 @@ export async function main() {
|
|
|
596
544
|
const store = verifiedStore !== undefined
|
|
597
545
|
&& resolve(verifiedStore.rootDirectory()) === resolve(home)
|
|
598
546
|
? verifiedStore
|
|
599
|
-
:
|
|
547
|
+
: openCurrentTaskStore(home);
|
|
600
548
|
const catalogs = new AgentConfigurationCatalogService(home, {
|
|
601
549
|
environment: process.env
|
|
602
550
|
});
|
|
@@ -894,9 +842,7 @@ export async function main() {
|
|
|
894
842
|
emit(result.output, false, result.data);
|
|
895
843
|
return;
|
|
896
844
|
}
|
|
897
|
-
if (resolved[1] === "
|
|
898
|
-
|| resolved[1] === "history"
|
|
899
|
-
|| resolved[1] === "replace") {
|
|
845
|
+
if (resolved[1] === "replace") {
|
|
900
846
|
const result = await runTaskWorkspaceCommand(resolved.slice(1), store, workspacePreparer);
|
|
901
847
|
emit(result.output, false, result.data);
|
|
902
848
|
return;
|
|
@@ -1077,7 +1023,7 @@ export async function main() {
|
|
|
1077
1023
|
const task = item === null ? null : store.getTask(item.taskId);
|
|
1078
1024
|
// A rejected Candidate starts a new execution iteration. Release every
|
|
1079
1025
|
// terminal Lane Role runtime before preparing the new Lane workspaces;
|
|
1080
|
-
// durable
|
|
1026
|
+
// durable Turns, Groups, Candidates, and workspace owners remain intact.
|
|
1081
1027
|
if (item?.status === "failed"
|
|
1082
1028
|
&& currentWorkItemExecutionGroup(item)?.resolution !== undefined) {
|
|
1083
1029
|
await workspaceCoordinator.cleanupWorkItemRuntime(item.taskId, item.id);
|
|
@@ -1088,12 +1034,13 @@ export async function main() {
|
|
|
1088
1034
|
if (item !== null && task !== null) {
|
|
1089
1035
|
await workspacePreparer.prepareTaskWorkspace(task.id);
|
|
1090
1036
|
}
|
|
1091
|
-
//
|
|
1092
|
-
// Lane
|
|
1093
|
-
//
|
|
1037
|
+
// A Project-backed Worker WorkItem gets an isolated Develop owner before
|
|
1038
|
+
// its Lane is prepared. A Leader-owned WorkItem intentionally executes
|
|
1039
|
+
// in the Task main worktree and must not enter this isolation path.
|
|
1094
1040
|
if (item !== null
|
|
1095
1041
|
&& task !== null
|
|
1096
1042
|
&& task.projectBindings.length > 0
|
|
1043
|
+
&& item.assignee !== "leader"
|
|
1097
1044
|
&& store.getWorkItemWorkspace(task.id, item.id) === null) {
|
|
1098
1045
|
await workspaceCoordinator.isolateWorkItem(item.taskId, item.id);
|
|
1099
1046
|
}
|
|
@@ -1173,58 +1120,12 @@ export async function main() {
|
|
|
1173
1120
|
}
|
|
1174
1121
|
}
|
|
1175
1122
|
}
|
|
1176
|
-
let
|
|
1177
|
-
let taskFinalReviewRebindRequest;
|
|
1178
|
-
let releaseTaskFinalReviewHandoverLock;
|
|
1179
|
-
if (resolved[1] === "review" && resolved[2] === "rebind") {
|
|
1180
|
-
if (!isCurrentGlobalOperator(store, process.env)) {
|
|
1181
|
-
throw usageError("Task-final Review contract rebind requires the authenticated global Operator session.");
|
|
1182
|
-
}
|
|
1183
|
-
if (exactCurrentControlPlane === undefined) {
|
|
1184
|
-
throw usageError("Task-final Review contract rebind requires the exact current global Session CLI.");
|
|
1185
|
-
}
|
|
1186
|
-
taskFinalReviewRebindRequest = parseTaskFinalReviewContractRebindRequest(resolved.slice(3));
|
|
1187
|
-
}
|
|
1123
|
+
let releaseReviewHandoverLock;
|
|
1188
1124
|
if ((resolved[1] === "review"
|
|
1189
|
-
&& ["request", "force-fresh", "retry"
|
|
1125
|
+
&& ["request", "force-fresh", "retry"].includes(resolved[2] ?? ""))
|
|
1190
1126
|
|| resolved[1] === "complete") {
|
|
1191
1127
|
const handoverLock = acquireHandoverLock(home);
|
|
1192
|
-
|
|
1193
|
-
}
|
|
1194
|
-
if (taskFinalReviewRebindRequest !== undefined) {
|
|
1195
|
-
const request = taskFinalReviewRebindRequest;
|
|
1196
|
-
try {
|
|
1197
|
-
taskFinalReviewRebindProof = prepareTaskFinalReviewContractRebindProof({
|
|
1198
|
-
home,
|
|
1199
|
-
taskId: request.taskId,
|
|
1200
|
-
fromControlPlaneDigest: request.fromControlPlaneDigest,
|
|
1201
|
-
toControlPlaneDigest: request.toControlPlaneDigest,
|
|
1202
|
-
fromReleaseId: request.fromReleaseId,
|
|
1203
|
-
toReleaseId: request.toReleaseId,
|
|
1204
|
-
currentControlPlane: exactCurrentControlPlane.descriptor
|
|
1205
|
-
});
|
|
1206
|
-
const workItems = store.listWorkItems(request.taskId);
|
|
1207
|
-
const reviewRounds = store.listReviewRounds(request.taskId);
|
|
1208
|
-
const resolution = resolveRecordedTaskFinalReviewContract(request.taskId, workItems, reviewRounds, store.listEvents(request.taskId));
|
|
1209
|
-
const activeRound = reviewRounds.find((round) => ((round.scope ?? "work-item") === "task"
|
|
1210
|
-
&& (round.status === "pending" || round.status === "running")));
|
|
1211
|
-
// An exact replay is a true no-op, even when the target Leader is live.
|
|
1212
|
-
// Invalid/stale source tuples also reach the command unchanged so its
|
|
1213
|
-
// transactional diagnosis cannot stop a healthy target runtime.
|
|
1214
|
-
if (resolution?.effective.controlPlaneDigest === request.fromControlPlaneDigest
|
|
1215
|
-
&& activeRound === undefined) {
|
|
1216
|
-
// The contract event and wake must never target a Provider
|
|
1217
|
-
// Conversation launched by the source release. Active Runs fail
|
|
1218
|
-
// closed; otherwise stop and retire that runtime under the handover
|
|
1219
|
-
// lock before the transactional event+wake commit.
|
|
1220
|
-
await workspaceCoordinator.cleanupTaskRoleRuntime(request.taskId, "leader");
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
catch (error) {
|
|
1224
|
-
releaseTaskFinalReviewHandoverLock();
|
|
1225
|
-
releaseTaskFinalReviewHandoverLock = undefined;
|
|
1226
|
-
throw error;
|
|
1227
|
-
}
|
|
1128
|
+
releaseReviewHandoverLock = handoverLock.release;
|
|
1228
1129
|
}
|
|
1229
1130
|
let candidateMaterialization;
|
|
1230
1131
|
let candidateMaterializationCommitted = false;
|
|
@@ -1242,11 +1143,6 @@ export async function main() {
|
|
|
1242
1143
|
const directTaskMainSnapshot = await directTaskMainSnapshotForTaskCommand(resolved, store, workspacePreparer, process.env, taskFinalReviewContract);
|
|
1243
1144
|
const actualTaskReviewCandidate = await actualTaskReviewCandidateForTaskCommand(resolved, store, workspacePreparer, process.env);
|
|
1244
1145
|
const deltaRecheckPreflight = await deltaRecheckPreflightForTaskCommand(resolved.slice(1), store, actualTaskReviewCandidate);
|
|
1245
|
-
const reviewWorkspaceResult = await reviewWorkspaceResultForTaskCommand(resolved, store, workspacePreparer, process.env);
|
|
1246
|
-
const executionLaneGitSnapshot = await executionLaneGitSnapshotForTaskCommand(resolved, store, workspacePreparer, process.env);
|
|
1247
|
-
const laneSnapshotPreflight = executionLaneGitSnapshot === undefined
|
|
1248
|
-
? undefined
|
|
1249
|
-
: executionLaneGitSnapshot;
|
|
1250
1146
|
// Physical preparation may precede the durable write, but Task status,
|
|
1251
1147
|
// workspace identity/cwd, and ManagedWorkspace ownership are adopted by
|
|
1252
1148
|
// one transaction. A failed attempt therefore leaves the Task Draft and
|
|
@@ -1266,9 +1162,6 @@ export async function main() {
|
|
|
1266
1162
|
...(taskFinalReviewContract === undefined
|
|
1267
1163
|
? {}
|
|
1268
1164
|
: { taskFinalReviewContract }),
|
|
1269
|
-
...(taskFinalReviewRebindProof === undefined
|
|
1270
|
-
? {}
|
|
1271
|
-
: { taskFinalReviewRebindProof }),
|
|
1272
1165
|
...(completionSummary === undefined ? {} : { completionSummary }),
|
|
1273
1166
|
...(completionPublishedTreeProof === undefined
|
|
1274
1167
|
? {}
|
|
@@ -1288,8 +1181,6 @@ export async function main() {
|
|
|
1288
1181
|
...(deltaRecheckPreflight === undefined
|
|
1289
1182
|
? {}
|
|
1290
1183
|
: { deltaRecheckPreflight }),
|
|
1291
|
-
...(reviewWorkspaceResult === undefined ? {} : { reviewWorkspaceResult }),
|
|
1292
|
-
...(laneSnapshotPreflight === undefined ? {} : { executionLaneGitSnapshot: laneSnapshotPreflight }),
|
|
1293
1184
|
...(taskRetirementProof === undefined ? {} : { taskRetirementProof })
|
|
1294
1185
|
});
|
|
1295
1186
|
// The dispatch transaction has now adopted (or rejected) the prepared
|
|
@@ -1311,11 +1202,11 @@ export async function main() {
|
|
|
1311
1202
|
let reviewData;
|
|
1312
1203
|
const resumesReviewDispatch = (resolved[1] === "review" && resolved[2] === "request")
|
|
1313
1204
|
|| (resolved[1] === "work" && resolved[2] === "review")
|
|
1314
|
-
|| (resolved[1] === "
|
|
1205
|
+
|| (resolved[1] === "turn" && resolved[2] === "retry");
|
|
1315
1206
|
const reviewDispatchNeeded = requestedRound?.status === "pending"
|
|
1316
1207
|
|| (requestedRound?.status === "running"
|
|
1317
1208
|
&& resumesReviewDispatch
|
|
1318
|
-
&& persistedRequestedRound?.executionGroup?.lanes.some((lane) => (lane.status === "pending" && lane.
|
|
1209
|
+
&& persistedRequestedRound?.executionGroup?.lanes.some((lane) => (lane.status === "pending" && lane.turnId === undefined)) === true);
|
|
1319
1210
|
if (reviewDispatchNeeded) {
|
|
1320
1211
|
try {
|
|
1321
1212
|
const workspace = requestedRound.status === "running"
|
|
@@ -1367,7 +1258,7 @@ export async function main() {
|
|
|
1367
1258
|
kind: "started",
|
|
1368
1259
|
reviewerRoleName: requestedRound.reviewerRoleName,
|
|
1369
1260
|
reviewRoundId: requestedRound.id,
|
|
1370
|
-
|
|
1261
|
+
turnId: run.id
|
|
1371
1262
|
},
|
|
1372
1263
|
reviewRound: store.getReviewRound(requestedRound.taskId, requestedRound.id),
|
|
1373
1264
|
...(run === null ? {} : { reviewRun: run }),
|
|
@@ -1408,7 +1299,7 @@ export async function main() {
|
|
|
1408
1299
|
: { command: result.data, ...reviewData });
|
|
1409
1300
|
return;
|
|
1410
1301
|
}
|
|
1411
|
-
if (jsonOutput) {
|
|
1302
|
+
if (jsonOutput && result.kind !== "session-stop") {
|
|
1412
1303
|
throw usageError("Task Role view/takeover requires an interactive terminal.");
|
|
1413
1304
|
}
|
|
1414
1305
|
if (result.kind === "session-stop") {
|
|
@@ -1527,9 +1418,9 @@ export async function main() {
|
|
|
1527
1418
|
throw error;
|
|
1528
1419
|
}
|
|
1529
1420
|
finally {
|
|
1530
|
-
if (
|
|
1531
|
-
|
|
1532
|
-
|
|
1421
|
+
if (releaseReviewHandoverLock !== undefined) {
|
|
1422
|
+
releaseReviewHandoverLock();
|
|
1423
|
+
releaseReviewHandoverLock = undefined;
|
|
1533
1424
|
}
|
|
1534
1425
|
}
|
|
1535
1426
|
}
|
|
@@ -1555,7 +1446,7 @@ export async function main() {
|
|
|
1555
1446
|
}));
|
|
1556
1447
|
return;
|
|
1557
1448
|
}
|
|
1558
|
-
throw usageError(`Command is not connected to the
|
|
1449
|
+
throw usageError(`Command is not connected to the current TaskStore command routing: ${resolved[0]}.`, renderCommandHelp(invocation.node, VERSION));
|
|
1559
1450
|
}
|
|
1560
1451
|
function explicitReleaseActivationDriver() {
|
|
1561
1452
|
if (args.length !== 3
|
|
@@ -1575,11 +1466,11 @@ async function preflightManagedTaskControlPlane() {
|
|
|
1575
1466
|
}
|
|
1576
1467
|
const serializedControl = process.env[YUI_CONTROL_PLANE_DESCRIPTOR];
|
|
1577
1468
|
const serializedRuntime = process.env[YUI_TASK_RUNTIME_DESCRIPTOR];
|
|
1578
|
-
const
|
|
1579
|
-
if (process.env.YUI_SESSION_SCOPE === "task" && !
|
|
1469
|
+
const exactAgentRuntime = serializedControl !== undefined || serializedRuntime !== undefined;
|
|
1470
|
+
if (process.env.YUI_SESSION_SCOPE === "task" && !exactAgentRuntime) {
|
|
1580
1471
|
throw new Error("Exact control-plane invocation requires both frozen descriptors in a managed Task runtime.");
|
|
1581
1472
|
}
|
|
1582
|
-
if (!
|
|
1473
|
+
if (!exactAgentRuntime) {
|
|
1583
1474
|
if (exactControlInvocation.digest !== undefined
|
|
1584
1475
|
|| process.env.YUI_SESSION_SCOPE === "global") {
|
|
1585
1476
|
return await preflightManagedGlobalControlPlane(exactControlInvocation.digest);
|
|
@@ -1637,9 +1528,9 @@ async function preflightManagedTaskControlPlane() {
|
|
|
1637
1528
|
&& process.env.YUI_DRIVER_ID !== undefined
|
|
1638
1529
|
? builtinAgentDriverRegistry().require(process.env.YUI_DRIVER_ID)
|
|
1639
1530
|
: undefined;
|
|
1640
|
-
const verifiedStore =
|
|
1531
|
+
const verifiedStore = openCurrentTaskStore(control.yuiHome);
|
|
1641
1532
|
// Runtime Hooks have their own event-aware fence, including the valid case
|
|
1642
|
-
// where a Provider terminal arrives after its Yui
|
|
1533
|
+
// where a Provider terminal arrives after its Yui Turn has completed and a
|
|
1643
1534
|
// later wake is pending. Ordinary managed commands still require the exact
|
|
1644
1535
|
// current mutable runtime before routing.
|
|
1645
1536
|
if (runtimeDriverCallback === undefined) {
|
|
@@ -1659,7 +1550,7 @@ async function preflightManagedTaskControlPlane() {
|
|
|
1659
1550
|
if (request.taskId !== runtime.taskId) {
|
|
1660
1551
|
throw new Error(`Task final-review contract Task id mismatch: expected ${runtime.taskId}, found ${request.taskId}.`);
|
|
1661
1552
|
}
|
|
1662
|
-
const recordedContract = resolveRecordedTaskFinalReviewContract(runtime.taskId, verifiedStore.listWorkItems(runtime.taskId), verifiedStore.listReviewRounds(runtime.taskId)
|
|
1553
|
+
const recordedContract = resolveRecordedTaskFinalReviewContract(runtime.taskId, verifiedStore.listWorkItems(runtime.taskId), verifiedStore.listReviewRounds(runtime.taskId))?.effective;
|
|
1663
1554
|
if (recordedContract !== undefined
|
|
1664
1555
|
&& recordedContract.reviewerRoleName !== request.reviewerRoleName) {
|
|
1665
1556
|
throw new Error(`Task final-review Reviewer mismatch: expected ${recordedContract.reviewerRoleName}, `
|
|
@@ -1728,7 +1619,7 @@ async function preflightManagedGlobalControlPlane(digest) {
|
|
|
1728
1619
|
return {
|
|
1729
1620
|
contract: undefined,
|
|
1730
1621
|
controlPlane: { digest: commandDigest, descriptor: commandControl },
|
|
1731
|
-
verifiedStore:
|
|
1622
|
+
verifiedStore: openCurrentTaskStore(home)
|
|
1732
1623
|
};
|
|
1733
1624
|
}
|
|
1734
1625
|
function currentInvocationControlPlane(home) {
|
|
@@ -1789,7 +1680,7 @@ function cliTaskRecordReference(value, kind, environment) {
|
|
|
1789
1680
|
try {
|
|
1790
1681
|
return resolveTaskRecordReference(value, {
|
|
1791
1682
|
kind,
|
|
1792
|
-
label: kind === "
|
|
1683
|
+
label: kind === "turn" ? "Turn reference" : "ReviewRound reference",
|
|
1793
1684
|
...(environment.YUI_TASK_ID === undefined
|
|
1794
1685
|
? {}
|
|
1795
1686
|
: { contextTaskId: environment.YUI_TASK_ID })
|
|
@@ -1802,7 +1693,7 @@ function cliTaskRecordReference(value, kind, environment) {
|
|
|
1802
1693
|
async function candidateSnapshotForTaskCommand(args, store, preparer, environment, taskFinalReviewContract) {
|
|
1803
1694
|
if (args[0] !== "task")
|
|
1804
1695
|
return undefined;
|
|
1805
|
-
const reviewableCandidateCommand = (args[1] === "
|
|
1696
|
+
const reviewableCandidateCommand = (args[1] === "work" && args[2] === "update"
|
|
1806
1697
|
&& args[3] !== undefined && args[4] === "done") || (args[1] === "work" && args[2] === "group" && args[3] === "resolve"
|
|
1807
1698
|
&& args[4] !== undefined);
|
|
1808
1699
|
// Explicit Task-final review requests must remain independent of the
|
|
@@ -1813,36 +1704,6 @@ async function candidateSnapshotForTaskCommand(args, store, preparer, environmen
|
|
|
1813
1704
|
|| (groupResolve && args.includes("--decision") && args[args.indexOf("--decision") + 1] !== "accept")) {
|
|
1814
1705
|
return undefined;
|
|
1815
1706
|
}
|
|
1816
|
-
if (args[1] === "run" && args[2] === "yield" && args[3] !== undefined) {
|
|
1817
|
-
const reference = cliTaskRecordReference(args[3], "agentRun", environment);
|
|
1818
|
-
const run = store.getAgentRun(reference.taskId, reference.localId);
|
|
1819
|
-
if (run === null || run.purpose !== "execution" || run.workItemId === undefined) {
|
|
1820
|
-
return undefined;
|
|
1821
|
-
}
|
|
1822
|
-
if (run.workspace === undefined) {
|
|
1823
|
-
// Gitless execution has no workspace or Git snapshot to capture. The
|
|
1824
|
-
// command layer still records the yielded Lane/Candidate evidence.
|
|
1825
|
-
return undefined;
|
|
1826
|
-
}
|
|
1827
|
-
// Group-backed Runs yield Lane evidence first; the Leader's later group
|
|
1828
|
-
// resolution performs the one Candidate snapshot after selected Lane
|
|
1829
|
-
// outputs have been materialized into the WorkItem workspace.
|
|
1830
|
-
if (run.executionGroupId !== undefined || run.workspace.owner.type === "execution-lane") {
|
|
1831
|
-
const item = store.getWorkItem(run.taskId, run.workItemId);
|
|
1832
|
-
const group = item === null || run.executionGroupId === undefined
|
|
1833
|
-
? undefined
|
|
1834
|
-
: workItemExecutionGroupById(item, run.executionGroupId);
|
|
1835
|
-
const fixedSingleLane = group?.strategy.mode === "fixed"
|
|
1836
|
-
&& group.strategy.count === 1
|
|
1837
|
-
&& group.lanes.length === 1
|
|
1838
|
-
&& group.stage === undefined
|
|
1839
|
-
&& run.workspace.owner.type === "work-item";
|
|
1840
|
-
if (fixedSingleLane)
|
|
1841
|
-
return preparer.snapshotCandidateWorkspace(run.workspace);
|
|
1842
|
-
return undefined;
|
|
1843
|
-
}
|
|
1844
|
-
return preparer.snapshotCandidateWorkspace(run.workspace);
|
|
1845
|
-
}
|
|
1846
1707
|
if (args[1] === "work" && args[2] === "update"
|
|
1847
1708
|
&& args[3] !== undefined && args[4] === "done") {
|
|
1848
1709
|
const reference = cliWorkItemReference(args[3], environment);
|
|
@@ -1890,7 +1751,7 @@ async function candidateMaterializationForTaskCommand(args, store, preparer, env
|
|
|
1890
1751
|
const selected = args.flatMap((value, index) => value === "--lane" && args[index + 1] !== undefined ? [args[index + 1]] : []);
|
|
1891
1752
|
const materializedLaneIds = selected.length === 0
|
|
1892
1753
|
? group.lanes
|
|
1893
|
-
.filter((lane) => lane.status === "
|
|
1754
|
+
.filter((lane) => lane.status === "completed")
|
|
1894
1755
|
.map(({ id }) => id)
|
|
1895
1756
|
: selected;
|
|
1896
1757
|
if (group.stage?.convergence !== undefined
|
|
@@ -1907,7 +1768,7 @@ async function candidateMaterializationForTaskCommand(args, store, preparer, env
|
|
|
1907
1768
|
}
|
|
1908
1769
|
async function prepareExecutionLaneWorkspacesForCommand(args, store, preparer, environment) {
|
|
1909
1770
|
const isDispatch = args[0] === "task" && args[1] === "work" && args[2] === "dispatch" && args[3] !== undefined;
|
|
1910
|
-
const isRetry = args[0] === "task" && args[1] === "
|
|
1771
|
+
const isRetry = args[0] === "task" && args[1] === "turn" && args[2] === "retry" && args[3] !== undefined;
|
|
1911
1772
|
if (!isDispatch && !isRetry)
|
|
1912
1773
|
return undefined;
|
|
1913
1774
|
const itemRef = isDispatch
|
|
@@ -1915,15 +1776,15 @@ async function prepareExecutionLaneWorkspacesForCommand(args, store, preparer, e
|
|
|
1915
1776
|
: null;
|
|
1916
1777
|
const item = itemRef === null
|
|
1917
1778
|
? (() => {
|
|
1918
|
-
const runRef = cliTaskRecordReference(args[3], "
|
|
1919
|
-
const run = store.
|
|
1779
|
+
const runRef = cliTaskRecordReference(args[3], "turn", environment);
|
|
1780
|
+
const run = store.getTurn(runRef.taskId, runRef.localId);
|
|
1920
1781
|
return run?.workItemId === undefined ? null : store.getWorkItem(run.taskId, run.workItemId);
|
|
1921
1782
|
})()
|
|
1922
1783
|
: store.getWorkItem(itemRef.taskId, itemRef.localId);
|
|
1923
1784
|
if (item === null)
|
|
1924
1785
|
return undefined;
|
|
1925
1786
|
const retryRun = isRetry
|
|
1926
|
-
? store.
|
|
1787
|
+
? store.getTurn(item.taskId, cliTaskRecordReference(args[3], "turn", environment).localId)
|
|
1927
1788
|
: null;
|
|
1928
1789
|
const currentGroup = currentWorkItemExecutionGroup(item);
|
|
1929
1790
|
const group = retryRun?.executionGroupId === undefined
|
|
@@ -1946,7 +1807,7 @@ async function prepareExecutionLaneWorkspacesForCommand(args, store, preparer, e
|
|
|
1946
1807
|
throw usageError(`Invalid execution strategy: ${value}.`);
|
|
1947
1808
|
})();
|
|
1948
1809
|
const retryLaneId = isRetry
|
|
1949
|
-
? store.
|
|
1810
|
+
? store.getTurn(item.taskId, cliTaskRecordReference(args[3], "turn", environment).localId)?.executionLaneId
|
|
1950
1811
|
: undefined;
|
|
1951
1812
|
const plan = normalizedExecutionLanePlan({
|
|
1952
1813
|
assignee: item.assignee ?? "",
|
|
@@ -1957,7 +1818,7 @@ async function prepareExecutionLaneWorkspacesForCommand(args, store, preparer, e
|
|
|
1957
1818
|
? resolvedExecutionStageRetryGroup(currentGroup)
|
|
1958
1819
|
: undefined,
|
|
1959
1820
|
status: item.status,
|
|
1960
|
-
nextGroupId: `execution-group-${store.
|
|
1821
|
+
nextGroupId: `execution-group-${store.peekNextTurnId(item.taskId)}`,
|
|
1961
1822
|
retryLaneId,
|
|
1962
1823
|
phase: isRetry ? "retry" : "dispatch"
|
|
1963
1824
|
});
|
|
@@ -1978,7 +1839,7 @@ async function prepareExecutionLaneWorkspacesForCommand(args, store, preparer, e
|
|
|
1978
1839
|
const needsIsolation = adaptive || laneCount > 1 || (group?.lanes.length ?? 0) > 1;
|
|
1979
1840
|
if (!needsIsolation)
|
|
1980
1841
|
return undefined;
|
|
1981
|
-
const groupId = group?.id ?? `execution-group-${store.
|
|
1842
|
+
const groupId = group?.id ?? `execution-group-${store.peekNextTurnId(item.taskId)}`;
|
|
1982
1843
|
const laneIds = plan.laneIds;
|
|
1983
1844
|
// A new Group's Lanes are not yet durable, so their worktrees would be
|
|
1984
1845
|
// unadopted between preparation and the dispatch transaction. Hold ONE
|
|
@@ -2121,11 +1982,11 @@ async function actualTaskReviewCandidateForTaskCommand(args, store, preparer, en
|
|
|
2121
1982
|
taskId = reference.taskId;
|
|
2122
1983
|
}
|
|
2123
1984
|
}
|
|
2124
|
-
else if (args[1] === "
|
|
1985
|
+
else if (args[1] === "turn"
|
|
2125
1986
|
&& (args[2] === "retry" || args[2] === "settle")
|
|
2126
1987
|
&& args[3] !== undefined) {
|
|
2127
|
-
const reference = cliTaskRecordReference(args[3], "
|
|
2128
|
-
const run = store.
|
|
1988
|
+
const reference = cliTaskRecordReference(args[3], "turn", environment);
|
|
1989
|
+
const run = store.getTurn(reference.taskId, reference.localId);
|
|
2129
1990
|
const round = run?.reviewRoundId === undefined
|
|
2130
1991
|
? null
|
|
2131
1992
|
: store.getReviewRound(reference.taskId, run.reviewRoundId);
|
|
@@ -2232,52 +2093,6 @@ async function deltaRecheckPreflightForTaskCommand(args, store, actualTaskReview
|
|
|
2232
2093
|
}
|
|
2233
2094
|
return assessment.preflight;
|
|
2234
2095
|
}
|
|
2235
|
-
async function reviewWorkspaceResultForTaskCommand(args, store, preparer, environment) {
|
|
2236
|
-
if (args[0] !== "task" || args[1] !== "run" || args[2] !== "yield"
|
|
2237
|
-
|| args[3] === undefined)
|
|
2238
|
-
return undefined;
|
|
2239
|
-
const reference = cliTaskRecordReference(args[3], "agentRun", environment);
|
|
2240
|
-
const run = store.getAgentRun(reference.taskId, reference.localId);
|
|
2241
|
-
if (run === null || run.purpose !== "review" || run.reviewRoundId === undefined) {
|
|
2242
|
-
return undefined;
|
|
2243
|
-
}
|
|
2244
|
-
return preparer.snapshotReviewRunResult(reference.taskId, run);
|
|
2245
|
-
}
|
|
2246
|
-
async function executionLaneGitSnapshotForTaskCommand(args, store, preparer, environment) {
|
|
2247
|
-
if (args[0] !== "task" || args[1] !== "run" || args[2] !== "yield"
|
|
2248
|
-
|| args[3] === undefined)
|
|
2249
|
-
return undefined;
|
|
2250
|
-
const reference = cliTaskRecordReference(args[3], "agentRun", environment);
|
|
2251
|
-
const run = store.getAgentRun(reference.taskId, reference.localId);
|
|
2252
|
-
if (run === null || run.executionGroupId === undefined
|
|
2253
|
-
|| run.executionLaneId === undefined
|
|
2254
|
-
// Review output has a distinct evidence contract: diagnostic work may
|
|
2255
|
-
// remain uncommitted, and snapshotReviewRunResult validates its exact
|
|
2256
|
-
// ReviewRound/Lane owner. It must not also pass the Develop Candidate
|
|
2257
|
-
// snapshot preflight, which requires a clean committed worktree.
|
|
2258
|
-
|| run.purpose === "review") {
|
|
2259
|
-
return undefined;
|
|
2260
|
-
}
|
|
2261
|
-
if (run.workspace === undefined)
|
|
2262
|
-
return null;
|
|
2263
|
-
const stored = store.getManagedWorkspace(run.workspace.owner);
|
|
2264
|
-
if (stored === null || !isDeepStrictEqual(stored, run.workspace)) {
|
|
2265
|
-
throw usageError(`Execution Lane managed workspace changed before yield: ${run.id}.`);
|
|
2266
|
-
}
|
|
2267
|
-
// A Gitless fixed(1) Lane runs from the durable Task-owned empty view. It
|
|
2268
|
-
// has no writable Project boundary, so there is no Lane Git snapshot to
|
|
2269
|
-
// freeze; keep the normal Candidate path metadata-only.
|
|
2270
|
-
if (run.workspace.owner.type === "task" && run.workspace.entries.length === 0) {
|
|
2271
|
-
return null;
|
|
2272
|
-
}
|
|
2273
|
-
try {
|
|
2274
|
-
return (await preparer.snapshotExecutionLaneWorkspace(run.workspace)) ?? null;
|
|
2275
|
-
}
|
|
2276
|
-
catch (error) {
|
|
2277
|
-
throw usageError(`Execution Lane Git snapshot preflight failed for ${run.id}: `
|
|
2278
|
-
+ `${error instanceof Error ? error.message : String(error)}`);
|
|
2279
|
-
}
|
|
2280
|
-
}
|
|
2281
2096
|
function reviewRoundFromCommandData(data) {
|
|
2282
2097
|
if (typeof data !== "object" || data === null || !("reviewRound" in data))
|
|
2283
2098
|
return undefined;
|
|
@@ -2421,7 +2236,7 @@ async function completionCommand(home, node) {
|
|
|
2421
2236
|
if (args.length > (shell === undefined ? 2 : 3)) {
|
|
2422
2237
|
throw usageError("Completion usage: yui config completion [bash|zsh|fish]");
|
|
2423
2238
|
}
|
|
2424
|
-
const store =
|
|
2239
|
+
const store = openCurrentTaskStore(home);
|
|
2425
2240
|
const ioHandle = terminalIo();
|
|
2426
2241
|
try {
|
|
2427
2242
|
const manager = new FileCompletionManager(store, process.env, resolveCliIdentity(process.env));
|
|
@@ -2583,7 +2398,7 @@ function selectionCall(store, catalogs, method, params) {
|
|
|
2583
2398
|
: store.listInputRequests(taskId);
|
|
2584
2399
|
return params.all === true ? requests : requests.filter((request) => request.status === "open");
|
|
2585
2400
|
}
|
|
2586
|
-
case "task.
|
|
2401
|
+
case "task.turn.list": return callOptional(reader, "listTurns", [params.taskId]);
|
|
2587
2402
|
case "task.decision.list": return callOptional(reader, "listDecisions", [params.taskId]);
|
|
2588
2403
|
case "task.milestone.list": return presentSelectionTimes(callOptional(reader, "listMilestones", [params.taskId]), store);
|
|
2589
2404
|
case "task.event.list": return presentSelectionTimes(callOptional(reader, "listEvents", [params.taskId]), store);
|
|
@@ -2612,7 +2427,7 @@ function callOptional(reader, method, args = []) {
|
|
|
2612
2427
|
return operation === undefined ? [] : Reflect.apply(operation, reader, args);
|
|
2613
2428
|
}
|
|
2614
2429
|
function readableStore(home) {
|
|
2615
|
-
return
|
|
2430
|
+
return openCurrentTaskStore(home);
|
|
2616
2431
|
}
|
|
2617
2432
|
function completionSelectionPorts(home) {
|
|
2618
2433
|
if (inspectStorageSchema(home).status === "uninitialized") {
|