@zq-silk/yui 0.15.11 → 0.16.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 +11 -6
- package/ARCHITECTURE.zh-CN.md +8 -4
- package/README.md +13 -5
- package/dist/agentRun/agentRun.js +3 -0
- package/dist/artifacts/artifactCommitLock.js +16 -55
- package/dist/artifacts/taskArtifactRepository.js +3 -3
- package/dist/cli/agentConfigurationPicker.js +1 -1
- package/dist/cli/commandCatalog.js +92 -48
- package/dist/cli/completion.js +18 -18
- package/dist/cli/completionWizard.js +1 -1
- package/dist/cli/dynamicCompletion.js +1 -1
- package/dist/cli/interactionPolicy.js +11 -3
- package/dist/cli/invocationAuthority.js +64 -0
- package/dist/cli/managedDiagnostics.js +2 -2
- package/dist/cli/parseRepeatable.js +35 -0
- package/dist/cli/updatePorts.js +26 -5
- package/dist/cli.js +1303 -1235
- package/dist/commands/agentCommands.js +4 -4
- package/dist/commands/capabilityCommands.js +1 -1
- package/dist/commands/configCommands.js +6 -57
- package/dist/commands/configOverview.js +2 -2
- package/dist/commands/durableJobCommands.js +12 -6
- package/dist/commands/executionAuditCommands.js +10 -0
- package/dist/commands/globalRoleCommands.js +78 -29
- package/dist/commands/grantCommands.js +0 -3
- package/dist/commands/jobCommands.js +1 -4
- package/dist/commands/operatorCommands.js +3 -3
- package/dist/commands/projectCommands.js +45 -25
- package/dist/commands/resourcesCommands.js +10 -40
- package/dist/commands/roleConfiguration.js +2 -6
- package/dist/commands/taskActivationCommands.js +4 -8
- package/dist/commands/taskAgentCapabilities.js +9 -0
- package/dist/commands/taskCommandSupport.js +155 -0
- package/dist/commands/taskCommandTypes.js +1 -0
- package/dist/commands/taskCommands.js +355 -732
- package/dist/commands/taskCompletionGate.js +1 -1
- package/dist/commands/taskExecutionCommands.js +1 -1
- package/dist/commands/taskFactCommands.js +325 -0
- package/dist/commands/taskInputCommands.js +12 -42
- package/dist/commands/taskIntegrationCommands.js +20 -58
- package/dist/commands/taskNextActionCommand.js +7 -6
- package/dist/commands/taskPublicationAdoptCommand.js +127 -0
- package/dist/commands/taskPublicationCommands.js +12 -3
- package/dist/commands/taskPublicationVerifyCommand.js +24 -40
- package/dist/commands/taskRemoteDeliveryCommand.js +5 -86
- package/dist/commands/taskUpstreamCommands.js +19 -8
- package/dist/commands/workflowCommands.js +6 -1
- package/dist/completion/completionInstaller.js +26 -26
- package/dist/completion/completionState.js +26 -26
- package/dist/completion/fileCompletionManager.js +6 -11
- package/dist/config/configCatalog.js +0 -2
- package/dist/config/timeZone.js +14 -0
- package/dist/config/yuiConfig.js +0 -29
- package/dist/context/runContextPack.js +5 -3
- package/dist/context/taskCatalog.js +185 -0
- package/dist/context/taskContext.js +152 -151
- package/dist/context/wakeRunReferences.js +11 -0
- package/dist/controller/agentCapabilities.js +58 -0
- package/dist/controller/agentRuntimeObserver.js +6 -11
- package/dist/controller/clientRuntime.js +22 -14
- package/dist/controller/controller.js +20 -24
- package/dist/controller/fileSchedulerStoreAdapter.js +191 -225
- package/dist/controller/globalInputDelivery.js +13 -0
- package/dist/controller/jobClient.js +4 -4
- package/dist/controller/jobControl.js +60 -25
- package/dist/controller/jobSupervisor.js +4 -4
- package/dist/controller/providerRetryAdmission.js +100 -0
- package/dist/controller/providerRetryDelivery.js +218 -0
- package/dist/controller/runtime.js +85 -43
- package/dist/controller/runtimeEventProcessor.js +0 -5
- package/dist/controller/sessionOwnerReconciliation.js +5 -0
- package/dist/controller/taskAgentError.js +35 -0
- package/dist/coordination/workMailboxQueue.js +2 -24
- package/dist/core/controllerClient.js +2 -2
- package/dist/core/fileLockOwner.js +74 -0
- package/dist/decision/decision.js +17 -0
- package/dist/doctor/doctor.js +18 -9
- package/dist/event/taskEvent.js +12 -0
- package/dist/execution/workItemExecutionProjection.js +2 -2
- package/dist/executor/agentCapabilityConfig.js +43 -0
- package/dist/executor/agentConfigurationCatalog.js +49 -11
- package/dist/executor/agentExecutor.js +5 -8
- package/dist/executor/fileRoleLaunchPlanner.js +11 -53
- package/dist/executor/taskAgentCapabilities.js +64 -0
- package/dist/integration/deliveryObligation.js +1 -69
- package/dist/integration/gitIntegrationService.js +79 -90
- package/dist/integration/integrationAttempt.js +3 -14
- package/dist/integration/integrationSourceApplication.js +4 -12
- package/dist/integration/manifestTags.js +2 -2
- package/dist/job/durableJob.js +4 -25
- package/dist/job/jobAssignmentScope.js +22 -0
- package/dist/job/jobOperation.js +16 -0
- package/dist/job/jobRunner.js +2 -1
- package/dist/job/stepDirectory.js +15 -0
- package/dist/kernel/builtinCapabilities.js +15 -11
- package/dist/kernel/kernelPorts.js +1 -17
- package/dist/lifecycle/exactRunTerminalization.js +5 -10
- package/dist/message/globalProviderRetry.js +15 -0
- package/dist/message/inputControlResolution.js +3 -4
- package/dist/message/message.js +17 -20
- package/dist/message/messageContinuation.js +1 -1
- package/dist/milestone/milestone.js +11 -0
- package/dist/observability/executionAudit.js +19 -0
- package/dist/observability/orchestrationMetrics.js +24 -1
- package/dist/observability/runtimeIdentity.js +1 -17
- package/dist/output/agentConfigurationPresentation.js +2 -0
- package/dist/output/timePresentation.js +1 -14
- package/dist/plugins/pluginService.js +12 -4
- package/dist/release/releaseWorkflowPorts.js +45 -96
- package/dist/release/runtimeRelease.js +9 -15
- package/dist/repository/gitWorkspace.js +371 -105
- package/dist/repository/projectMaintenanceLock.js +98 -82
- package/dist/repository/taskBaseFreshness.js +1 -1
- package/dist/repository/taskWorkspaceCoordinator.js +82 -144
- package/dist/repository/taskWorkspacePreparer.js +113 -47
- package/dist/repository/workspaceCleanupInspection.js +187 -0
- package/dist/resources/autoResourceGc.js +4 -77
- package/dist/resources/liveReferences.js +7 -54
- package/dist/resources/resourceDiscovery.js +5 -118
- package/dist/resources/resourceGc.js +233 -181
- package/dist/resources/resourceRegistrar.js +5 -4
- package/dist/resources/resourceRegistry.js +3 -37
- package/dist/resources/resourceRegistryStore.js +13 -36
- package/dist/resources/sqliteResourceRegistry.js +43 -26
- package/dist/review/deltaRecheck.js +1 -1
- package/dist/review/reviewAcceptance.js +1 -1
- package/dist/review/reviewDecision.js +1 -1
- package/dist/review/reviewRound.js +8 -7
- package/dist/review/taskFinalReviewContractResolution.js +1 -1
- package/dist/runtime/acpProtocol.js +4 -51
- package/dist/runtime/acpSession.js +10 -75
- package/dist/runtime/acpSessionConfiguration.js +1 -8
- package/dist/runtime/agentEndpoint.js +3 -2
- package/dist/runtime/agentError.js +5 -3
- package/dist/runtime/agentFailureContext.js +43 -0
- package/dist/runtime/agentHost.js +42 -25
- package/dist/runtime/builtinAgentErrorMappers.js +91 -0
- package/dist/runtime/codexAppServerRuntime.js +34 -3
- package/dist/runtime/codexInteractiveHost.js +2 -2
- package/dist/runtime/index.js +0 -1
- package/dist/runtime/managedCaller.js +21 -1
- package/dist/runtime/providerControl.js +5 -1
- package/dist/runtime/providerErrors.js +38 -0
- package/dist/runtime/providerRetry.js +198 -0
- package/dist/runtime/providerRuntimeIdentity.js +28 -2
- package/dist/runtime/runtimeObservation.js +0 -5
- package/dist/runtime/runtimeSessionCandidate.js +2 -3
- package/dist/runtime/sessionOwnerIdentity.js +1 -1
- package/dist/runtime/sessionTokenMetrics.js +15 -5
- package/dist/runtime/structuredProviderHost.js +10 -43
- package/dist/runtime/taskUsageMetrics.js +275 -0
- package/dist/runtime/tmuxAdapters.js +6 -8
- package/dist/scheduler/activeRoleRunDelivery.js +19 -7
- package/dist/scheduler/leaderWakeupProcessor.js +24 -6
- package/dist/scheduler/operatorEvent.js +12 -20
- package/dist/scheduler/operatorInputNotificationProcessor.js +1 -1
- package/dist/scheduler/ports.js +5 -8
- package/dist/scheduler/roleRunLiveness.js +4 -4
- package/dist/scheduler/roleRunStall.js +16 -23
- package/dist/scheduler/taskExecutionProjection.js +49 -36
- package/dist/scheduler/taskObservabilityProjection.js +6 -45
- package/dist/scheduler/taskWake.js +5 -10
- package/dist/scheduler/wakeReason.js +2 -0
- package/dist/scheduler/wakeupQueue.js +2 -4
- package/dist/setup/setupCommand.js +1 -1
- package/dist/storage/contextRecords.js +106 -0
- package/dist/storage/currentTaskStore.js +1 -1
- package/dist/storage/homeLayout.js +13 -17
- package/dist/storage/migrations/agentFailureContext.js +22 -0
- package/dist/storage/migrations/currentInputContract.js +86 -0
- package/dist/storage/migrations/currentRuntimeContract.js +228 -0
- package/dist/storage/migrations/historicalVerificationPlan.js +35 -0
- package/dist/storage/migrations/integrationContinuation.js +5 -4
- package/dist/storage/migrations/narrowAgentFailureContext.js +65 -0
- package/dist/storage/migrations/notificationOnlyWakes.js +74 -0
- package/dist/storage/migrations/verificationPlanV1.js +162 -0
- package/dist/storage/migrations/verificationPolicy.js +74 -0
- package/dist/storage/migrations/workItemHistory.js +46 -0
- package/dist/storage/persistenceWorker.js +12 -4
- package/dist/storage/recordValidation.js +87 -0
- package/dist/storage/sqliteSchema.js +173 -1
- package/dist/storage/sqliteStore.js +172 -161
- package/dist/storage/storageSchema.js +2 -14
- package/dist/storage/storageVersions.js +1 -1
- package/dist/storage/storeRpc.js +16 -7
- package/dist/storage/taskCatalog.js +123 -0
- package/dist/storage/taskStore.js +5 -7
- package/dist/storage/upgrade/upgradeOrchestrator.js +25 -37
- package/dist/task/archiveDiagnostics.js +1 -0
- package/dist/task/archivePreflight.js +124 -0
- package/dist/task/completionReadiness.js +5 -24
- package/dist/task/draftPlan.js +0 -53
- package/dist/task/nextAction.js +7 -13
- package/dist/task/publicationAdoption.js +56 -0
- package/dist/task/publicationReference.js +10 -0
- package/dist/task/remoteDelivery.js +31 -16
- package/dist/task/remoteDeliveryService.js +89 -0
- package/dist/task/taskActivation.js +2 -25
- package/dist/task/taskActivationService.js +0 -2
- package/dist/task/taskRecordReference.js +0 -1
- package/dist/task/taskSubmission.js +3 -14
- package/dist/telemetry/sqliteTelemetryBatch.js +29 -0
- package/dist/telemetry/sqliteTelemetryStore.js +49 -49
- package/dist/telemetry/telemetryWiring.js +4 -3
- package/dist/tmux/tmuxManager.js +29 -20
- package/dist/verification/gateArtifact.js +15 -24
- package/dist/verification/gateArtifactStore.js +14 -7
- package/dist/verification/verificationGateService.js +29 -88
- package/dist/verification/verificationPlan.js +27 -72
- package/dist/web/assets/client/app.js +92 -17
- package/dist/web/assets/client/components.js +55 -13
- package/dist/web/assets/client/i18n.js +72 -4
- package/dist/web/assets/client/taskSurface.js +6 -5
- package/dist/web/assets/client/view.js +35 -7
- package/dist/web/assets/shell.js +6 -0
- package/dist/web/assets/styles/layout.js +7 -0
- package/dist/web/webServer.js +12 -3
- package/dist/web/webSnapshot.js +14 -85
- package/dist/web/webTaskSurface.js +17 -46
- package/dist/workItem/workItem.js +1 -12
- package/dist/workspace/cleanupInspection.js +63 -0
- package/dist/workspace/workItemChangeSetManager.js +110 -50
- package/docs/agent-result-consumption.md +4 -0
- package/docs/agent-result-consumption.zh-CN.md +3 -0
- package/docs/agent-runtime-drivers.md +7 -0
- package/docs/agent-runtime-drivers.zh-CN.md +5 -0
- package/docs/architecture/README.md +2 -0
- package/docs/architecture/README.zh-CN.md +3 -1
- package/docs/architecture/capabilities-and-resources.md +42 -5
- package/docs/architecture/capabilities-and-resources.zh-CN.md +33 -3
- package/docs/managed-turn-and-session-runtime.md +121 -1
- package/docs/managed-turn-and-session-runtime.zh-CN.md +96 -2
- package/docs/observability/README.md +62 -0
- package/docs/observability/README.zh-CN.md +47 -0
- package/docs/plugin-sdk.md +4 -2
- package/docs/project-refresh.md +77 -0
- package/docs/project-refresh.zh-CN.md +59 -0
- package/docs/provider-retry.md +70 -0
- package/docs/provider-runtime.md +3 -1
- package/docs/provider-runtime.zh-CN.md +4 -2
- package/docs/release-workflow.md +190 -7
- package/docs/release-workflow.zh-CN.md +139 -5
- package/docs/roles-and-configuration.md +29 -0
- package/docs/roles-and-configuration.zh-CN.md +21 -0
- package/docs/sqlite-control-plane-design.md +16 -3
- package/docs/sqlite-control-plane-design.zh-CN.md +13 -2
- package/docs/task-dag-semantics.md +3 -3
- package/docs/task-dag-semantics.zh-CN.md +2 -2
- package/docs/task-delivery.md +223 -17
- package/docs/task-delivery.zh-CN.md +171 -14
- package/docs/task-discovery.md +101 -0
- package/docs/task-discovery.zh-CN.md +85 -0
- package/docs/testing/verification-levels.md +161 -9
- package/docs/testing/verification-levels.zh-CN.md +116 -9
- package/i18n/README.zh-CN.md +13 -7
- package/package.json +1 -1
- package/skills/yui-leader/SKILL.md +5 -0
- package/skills/yui-leader/references/execution.md +3 -2
- package/skills/yui-leader/references/integration.md +9 -5
- package/skills/yui-leader/references/planning.md +9 -3
- package/skills/yui-operator/SKILL.md +24 -8
- package/skills/yui-reviewer/SKILL.md +4 -0
- package/skills/yui-runtime/SKILL.md +17 -2
- package/skills/yui-runtime/references/publication.md +26 -4
- package/skills/yui-runtime/references/recovery.md +71 -0
- package/dist/agent/agentRegistry.js +0 -10
- package/dist/agentRun/runIdentity.js +0 -22
- package/dist/commands/deliveryGuardPreflight.js +0 -30
- package/dist/commands/taskIntegrationQueueCommands.js +0 -226
- package/dist/commands/taskOverviewCommand.js +0 -376
- package/dist/completion/completionWizard.js +0 -125
- package/dist/context/dispatchContext.js +0 -110
- package/dist/context/wakeNotification.js +0 -144
- package/dist/integration/integrationCheckEvidenceReuse.js +0 -53
- package/dist/integration/integrationQueueEntry.js +0 -191
- package/dist/integration/integrationQueueService.js +0 -810
- package/dist/release/fakeReleasePorts.js +0 -55
- package/dist/runtime/sessionOwnerRegistry.js +0 -137
- package/dist/task/deliveryGuard.js +0 -226
- /package/dist/{commands/taskActor.js → task/taskAuthority.js} +0 -0
|
@@ -2,18 +2,18 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { findLiveControllerProcessForHome, inspectLiveControllerProcess } from "../core/controllerProcessIdentity.js";
|
|
4
4
|
import { readHomeFilesystemId } from "../core/homeFilesystemIdentity.js";
|
|
5
|
+
import { AGENT_OPERATIONAL_ENVIRONMENT_NAMES, nativeAgentEnvironmentNames, operationalAgentEnvironment, selectEnvironment, YUI_MANAGED_RUNTIME_ENVIRONMENT_NAMES } from "../agent/launchEnvironment.js";
|
|
5
6
|
import { callController, ControllerClientError, readControllerDiscovery, stopOrphanedFileTaskController } from "../core/controllerClient.js";
|
|
6
7
|
import { FILE_TASK_CONTROLLER_PROTOCOL_VERSION } from "../core/protocol.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import { isForeignHandoverLockHeld } from "../release/runtimeRelease.js";
|
|
9
|
+
import { WorkspaceCleanupBlockedError } from "../repository/taskWorkspacePreparer.js";
|
|
9
10
|
import { hasRuntimeLifecycleWork } from "../runtime/lifecycleReservation.js";
|
|
10
11
|
import { assertControllerStatusIdentity } from "../runtime/runtimeCoherence.js";
|
|
11
|
-
import {
|
|
12
|
+
import { CONTROLLER_SHUTDOWN_TIMEOUT_MS, LIFECYCLE_REQUEST_TIMEOUT_MS } from "../runtime/runtimeDeadlines.js";
|
|
13
|
+
import { openCurrentTaskStore } from "../storage/currentTaskStore.js";
|
|
12
14
|
import { yuiVersionIdentity } from "../version.js";
|
|
15
|
+
import { EPHEMERAL_DOMAIN_ENVIRONMENT_NAMES } from "./domainIdentity.js";
|
|
13
16
|
import { SessionOwnerReconciliation } from "./sessionOwnerReconciliation.js";
|
|
14
|
-
import { WorkspaceCleanupBlockedError } from "../repository/taskWorkspacePreparer.js";
|
|
15
|
-
import { CONTROLLER_SHUTDOWN_TIMEOUT_MS, LIFECYCLE_REQUEST_TIMEOUT_MS } from "../runtime/runtimeDeadlines.js";
|
|
16
|
-
import { isForeignHandoverLockHeld } from "../release/runtimeRelease.js";
|
|
17
17
|
const STARTUP_TIMEOUT_MS = 5_000;
|
|
18
18
|
const POLL_INTERVAL_MS = 50;
|
|
19
19
|
const ENVIRONMENT_REFRESH_TIMEOUT_MS = 500;
|
|
@@ -166,7 +166,7 @@ function assertCompatibleControllerStatus(status, expectedVersion) {
|
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
function spawnDetachedFileTaskController(
|
|
169
|
+
function spawnDetachedFileTaskController(_home, environment) {
|
|
170
170
|
const child = spawn(process.execPath, [fileURLToPath(new URL("./controllerMain.js", import.meta.url))], {
|
|
171
171
|
env: environment,
|
|
172
172
|
detached: true,
|
|
@@ -439,9 +439,6 @@ export class FileTaskWorkflowRuntime {
|
|
|
439
439
|
this.workspacePreparer = workspacePreparer;
|
|
440
440
|
this.clientOptions = clientOptions;
|
|
441
441
|
}
|
|
442
|
-
notifyStateChanged(taskId) {
|
|
443
|
-
void this.notifyMailboxChanged({ kind: "task", taskId });
|
|
444
|
-
}
|
|
445
442
|
notifyMailboxChanged(target) {
|
|
446
443
|
const pending = callFileTaskController(this.home, "scheduler.signal", { key: controllerMailboxKey(target) }, this.clientOptions).then(() => { });
|
|
447
444
|
void pending.catch(this.clientOptions.onError ?? (() => { }));
|
|
@@ -577,6 +574,17 @@ export class FileTaskWorkflowRuntime {
|
|
|
577
574
|
+ blockers.map((entry) => (`${entry.owner.roleName}/${entry.nativeSessionId ?? "unknown-session"}`
|
|
578
575
|
+ ` (pid ${entry.physical?.alive === true ? entry.physical.pid : "?"})`)).join("; "));
|
|
579
576
|
}
|
|
577
|
+
/** Archive cleanup is stronger than a read-only proof that no process is live. */
|
|
578
|
+
async releaseTaskTerminals(taskId) {
|
|
579
|
+
await this.assertTaskPhysicalResourcesReleased(taskId);
|
|
580
|
+
// A Home's server is shared with other Tasks and the Operator. Remove only
|
|
581
|
+
// this Task's session group; exited panes still own scrollback memory.
|
|
582
|
+
await this.tmux.stopTaskAsync(taskId);
|
|
583
|
+
const remaining = this.tmux.inspectTaskRolePanes(taskId);
|
|
584
|
+
if (remaining.length > 0) {
|
|
585
|
+
throw new WorkspaceCleanupBlockedError("physical-resource-live", `task:${taskId}`, true, `Task terminals remain after cleanup: ${remaining.map(pane => pane.roleName).join(", ")}.`);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
580
588
|
async stopGlobalRoleSession(roleName) {
|
|
581
589
|
if (this.store.getGlobalRole(roleName) === null) {
|
|
582
590
|
throw new Error(`Global Role not found: ${roleName}.`);
|
|
@@ -678,11 +686,11 @@ function runtimeOwnerLabel(owner) {
|
|
|
678
686
|
}
|
|
679
687
|
const MANAGED_RUNTIME_ENVIRONMENT = new Set(YUI_MANAGED_RUNTIME_ENVIRONMENT_NAMES);
|
|
680
688
|
function foregroundGlobalRoleEnvironment(store, roleName, source) {
|
|
681
|
-
const role = store.getGlobalRole
|
|
682
|
-
if (role === null
|
|
689
|
+
const role = store.getGlobalRole(roleName);
|
|
690
|
+
if (role === null)
|
|
683
691
|
return undefined;
|
|
684
|
-
const agent = store.getConfiguredAgent
|
|
685
|
-
if (agent === null
|
|
692
|
+
const agent = store.getConfiguredAgent(role.activeAgentId);
|
|
693
|
+
if (agent === null)
|
|
686
694
|
return undefined;
|
|
687
695
|
const declaredSources = new Set(agent.environment.map((binding) => binding.sourceName));
|
|
688
696
|
for (const name of MANAGED_RUNTIME_ENVIRONMENT)
|
|
@@ -16,7 +16,6 @@ import { nearestDeadlineBatch } from "../coordination/deadlineScheduler.js";
|
|
|
16
16
|
import { mailboxHasWork, nextPendingBatch } from "../coordination/workMailbox.js";
|
|
17
17
|
import { hasRuntimeCleanupObligation } from "../runtime/lifecycleReservation.js";
|
|
18
18
|
import { formatTaskRecordReference } from "../task/taskRecordReference.js";
|
|
19
|
-
import { activationRequestIsControllerAdoptable } from "../task/taskActivation.js";
|
|
20
19
|
import { parseDurableJobAcknowledgeParams, parseDurableJobCancelParams, parseDurableJobRefParams, parseDurableJobStartParams } from "./jobControl.js";
|
|
21
20
|
const DEFAULT_RECONCILIATION_INTERVAL_MS = reconciliationIntervalMilliseconds();
|
|
22
21
|
const DEFAULT_SIGNAL_WINDOW_MS = 100;
|
|
@@ -217,8 +216,7 @@ async function processSelectedRoleRuntimeCleanups(store, delivery, lifecycleHost
|
|
|
217
216
|
if (!await lifecycleHost.stopOwner(owner)) {
|
|
218
217
|
throw new Error(`Role runtime cleanup could not confirm the host stopped: ${runtimeOwnerLabel(owner)}.`);
|
|
219
218
|
}
|
|
220
|
-
if (store.completeRuntimeCleanup
|
|
221
|
-
|| !store.completeRuntimeCleanup(target, now)) {
|
|
219
|
+
if (!store.completeRuntimeCleanup(target, now)) {
|
|
222
220
|
throw new Error(`Role runtime cleanup mailbox changed: ${runtimeOwnerLabel(owner)}.`);
|
|
223
221
|
}
|
|
224
222
|
forgetPreparedRuntimeOwner(delivery, owner);
|
|
@@ -252,7 +250,7 @@ function selectedTaskIdsForBoundedPass(store, selection) {
|
|
|
252
250
|
return new Set(selectedActiveSchedulerTasks(store, selection).map((task) => task.id));
|
|
253
251
|
}
|
|
254
252
|
function selectedReadyWorkMailboxes(store) {
|
|
255
|
-
return store.listReadyWorkMailboxes
|
|
253
|
+
return store.listReadyWorkMailboxes();
|
|
256
254
|
}
|
|
257
255
|
function selectedRuntimeLifecycleTargets(store, scope, blockedTaskIds = new Set()) {
|
|
258
256
|
if (scope.kind === "full") {
|
|
@@ -456,9 +454,9 @@ export function compileReconcileSelection(scope) {
|
|
|
456
454
|
};
|
|
457
455
|
}
|
|
458
456
|
/**
|
|
459
|
-
*
|
|
457
|
+
* Continues admitted activation requests once their execution boundaries allow it.
|
|
460
458
|
*
|
|
461
|
-
*
|
|
459
|
+
* A planning deferral is released only by its Turn ending. This phase therefore
|
|
462
460
|
* re-reads the request instead of trusting the signal that woke it: a request
|
|
463
461
|
* cancelled, or a Task retired or stopped, while the Turn was still running is
|
|
464
462
|
* left alone rather than replayed as historical intent. Adoption itself belongs
|
|
@@ -475,10 +473,7 @@ async function adoptReleasedTaskActivations(store, workspace, selection, onError
|
|
|
475
473
|
if (workspace === undefined)
|
|
476
474
|
return;
|
|
477
475
|
const candidates = selection.full
|
|
478
|
-
?
|
|
479
|
-
?? store.listTasks().flatMap((task) => (task.status === "draft" && task.activationRequest?.disposition === "pending"
|
|
480
|
-
? [task.id]
|
|
481
|
-
: [])))
|
|
476
|
+
? store.listPendingActivationRequestTaskIds()
|
|
482
477
|
: selection.taskIds;
|
|
483
478
|
for (const taskId of candidates) {
|
|
484
479
|
if (selection.blockedTaskIds?.has(taskId))
|
|
@@ -489,20 +484,14 @@ async function adoptReleasedTaskActivations(store, workspace, selection, onError
|
|
|
489
484
|
const request = task.activationRequest;
|
|
490
485
|
if (request?.disposition !== "pending")
|
|
491
486
|
continue;
|
|
492
|
-
//
|
|
493
|
-
//
|
|
494
|
-
// develop submission accepted while unplanned). This admits legal
|
|
495
|
-
// Operator/user immediate requests the old actor filter dropped, while
|
|
496
|
-
// still refusing origin-less historical requests, which stay behind the
|
|
497
|
-
// explicit `yui task activate` boundary.
|
|
498
|
-
if (!activationRequestIsControllerAdoptable(request))
|
|
499
|
-
continue;
|
|
487
|
+
// The request was authorized at admission. Recheck its current execution
|
|
488
|
+
// and Session boundaries without a second provenance-based workflow gate.
|
|
500
489
|
// Later Draft discussion is a Session notification, not another AgentRun.
|
|
501
490
|
// Its durable activation intent is sufficient once the exact native input
|
|
502
491
|
// is settled. Never create a synthetic Run merely to release that intent.
|
|
503
492
|
if (store.getActiveRun(taskId, "leader") !== null)
|
|
504
493
|
continue;
|
|
505
|
-
const provider = store.getTaskRoleSessionSet
|
|
494
|
+
const provider = store.getTaskRoleSessionSet(taskId, "leader")?.providerBinding;
|
|
506
495
|
if (provider?.run != null
|
|
507
496
|
&& ["submitting", "accepted", "delivery-unknown"].includes(provider.run.status))
|
|
508
497
|
continue;
|
|
@@ -663,7 +652,6 @@ function mergeControllerSchedulerResults(results) {
|
|
|
663
652
|
export class FileTaskController {
|
|
664
653
|
store;
|
|
665
654
|
delivery;
|
|
666
|
-
#startedAt;
|
|
667
655
|
#intervalMs;
|
|
668
656
|
#now;
|
|
669
657
|
#onError;
|
|
@@ -702,6 +690,7 @@ export class FileTaskController {
|
|
|
702
690
|
#leaderWakeFence;
|
|
703
691
|
#jobSupervisor;
|
|
704
692
|
#globalInputDelivery;
|
|
693
|
+
#providerRetry;
|
|
705
694
|
#continuationReconciler;
|
|
706
695
|
#current;
|
|
707
696
|
#operatorCurrent;
|
|
@@ -711,6 +700,7 @@ export class FileTaskController {
|
|
|
711
700
|
#operatorStartupRetryArmed = false;
|
|
712
701
|
#lastOperatorSignalIdentity;
|
|
713
702
|
#stopped = false;
|
|
703
|
+
#workspaceWaitAbort = new AbortController();
|
|
714
704
|
#lastRuntimeDrain;
|
|
715
705
|
#runtimeDrainPasses = 0;
|
|
716
706
|
#runtimeListedEvents = 0;
|
|
@@ -722,9 +712,12 @@ export class FileTaskController {
|
|
|
722
712
|
this.delivery = delivery;
|
|
723
713
|
this.#intervalMs = positiveInteger(options.intervalMs, DEFAULT_RECONCILIATION_INTERVAL_MS, "Controller reconciliation interval");
|
|
724
714
|
this.#now = options.now ?? (() => new Date());
|
|
725
|
-
this.#startedAt = this.#now();
|
|
726
715
|
this.#onError = options.onError ?? (() => { });
|
|
727
|
-
|
|
716
|
+
const workspacePreparer = options.workspacePreparer;
|
|
717
|
+
this.#workspacePreparer = workspacePreparer === undefined ? undefined : {
|
|
718
|
+
prepareTaskWorkspace: (taskId) => workspacePreparer.prepareTaskWorkspace(taskId, this.#workspaceWaitAbort.signal),
|
|
719
|
+
activateTaskWorkspace: (taskId, environment) => workspacePreparer.activateTaskWorkspace(taskId, environment, this.#workspaceWaitAbort.signal)
|
|
720
|
+
};
|
|
728
721
|
this.#deliveryRetryMs = positiveInteger(options.deliveryRetryMs, DEFAULT_DELIVERY_RETRY_MS, "Controller delivery retry delay");
|
|
729
722
|
this.#deliveryRetryLimit = positiveInteger(options.deliveryRetryLimit, DEFAULT_DELIVERY_RETRY_LIMIT, "Controller delivery retry limit");
|
|
730
723
|
this.#deliveryTimeoutMs = positiveInteger(options.deliveryTimeoutMs, DEFAULT_DELIVERY_TIMEOUT_MS, "Controller delivery timeout");
|
|
@@ -749,6 +742,7 @@ export class FileTaskController {
|
|
|
749
742
|
this.#jobSupervisor = options.jobSupervisor;
|
|
750
743
|
this.#continuationReconciler = options.continuationReconciler;
|
|
751
744
|
this.#globalInputDelivery = options.globalInputDelivery;
|
|
745
|
+
this.#providerRetry = options.providerRetry;
|
|
752
746
|
this.#signalScheduler = new MailboxScheduler(async (keys) => { await this.#requestPass({ kind: "dirty", keys }); }, {
|
|
753
747
|
windowMs: options.signalWindowMs ?? DEFAULT_SIGNAL_WINDOW_MS,
|
|
754
748
|
onError: this.#onError,
|
|
@@ -846,6 +840,7 @@ export class FileTaskController {
|
|
|
846
840
|
}
|
|
847
841
|
stop() {
|
|
848
842
|
this.#stopped = true;
|
|
843
|
+
this.#workspaceWaitAbort.abort(new Error("Controller stopped while waiting for Project maintenance."));
|
|
849
844
|
this.#signalScheduler.stop();
|
|
850
845
|
this.#operatorSignalScheduler.stop();
|
|
851
846
|
if (this.#deadlineTimer !== undefined) {
|
|
@@ -988,6 +983,7 @@ export class FileTaskController {
|
|
|
988
983
|
}
|
|
989
984
|
}
|
|
990
985
|
const firstRuntimeDrain = await this.#drainRuntimeEvents();
|
|
986
|
+
await this.#providerRetry?.reconcile();
|
|
991
987
|
await this.#globalInputDelivery?.();
|
|
992
988
|
for (const taskId of runtimeTaskFailureIds(firstRuntimeDrain)) {
|
|
993
989
|
runtimeFailedTaskIds.add(taskId);
|
|
@@ -1331,7 +1327,7 @@ export class FileTaskController {
|
|
|
1331
1327
|
at: Date.parse(request.policy.timeoutAt)
|
|
1332
1328
|
}]
|
|
1333
1329
|
: []);
|
|
1334
|
-
const nearest = nearestDeadlineBatch(deadlines);
|
|
1330
|
+
const nearest = nearestDeadlineBatch([...deadlines, ...(this.#providerRetry?.deadlines() ?? [])]);
|
|
1335
1331
|
if (nearest === null)
|
|
1336
1332
|
return;
|
|
1337
1333
|
const now = this.#now().getTime();
|
|
@@ -1640,7 +1636,7 @@ export async function startFileTaskController(home, store, delivery, dispatcher,
|
|
|
1640
1636
|
}
|
|
1641
1637
|
if (method === "job.get") {
|
|
1642
1638
|
const ref = parseDurableJobRefParams(params);
|
|
1643
|
-
const job = control.getJob(ref.taskId, ref.jobId);
|
|
1639
|
+
const job = control.getJob(ref.taskId, ref.jobId, ref.caller);
|
|
1644
1640
|
if (job === null) {
|
|
1645
1641
|
throw controllerApplicationError("NOT_FOUND", `DurableJob not found: ${ref.taskId}/${ref.jobId}.`);
|
|
1646
1642
|
}
|