@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
|
@@ -3,7 +3,7 @@ import { currentWorkItemExecutionGroup } from "../workItem/workItem.js";
|
|
|
3
3
|
import { mailboxBatches } from "../coordination/workMailbox.js";
|
|
4
4
|
import { actionableExecutionLaneRecoveries, summarizeExecutionGroupHealth } from "../execution/executionHealth.js";
|
|
5
5
|
import { buildTaskObservabilityProjection } from "./taskObservabilityProjection.js";
|
|
6
|
-
import {
|
|
6
|
+
import { isRoleTurnStalled, latestStallProgressAt } from "./roleTurnStall.js";
|
|
7
7
|
import { resolveRuntimeHealth } from "../config/yuiConfig.js";
|
|
8
8
|
import { projectSessionTokenMetrics, resolveSessionTokenIdentity } from "../runtime/sessionTokenMetrics.js";
|
|
9
9
|
/**
|
|
@@ -17,7 +17,7 @@ export function buildTaskExecutionProjection(store, taskId, taskOverride, now =
|
|
|
17
17
|
return null;
|
|
18
18
|
const roles = store.listRoles?.(taskId) ?? [];
|
|
19
19
|
const events = store.listEvents?.(taskId) ?? [];
|
|
20
|
-
const
|
|
20
|
+
const turns = operationalTaskRecords(store.listTurns?.(taskId) ?? [], events, "turn");
|
|
21
21
|
const leaderMailbox = store.getWorkMailbox?.({
|
|
22
22
|
kind: "role",
|
|
23
23
|
taskId,
|
|
@@ -32,7 +32,7 @@ export function buildTaskExecutionProjection(store, taskId, taskOverride, now =
|
|
|
32
32
|
return projectTaskExecution({
|
|
33
33
|
task,
|
|
34
34
|
roles,
|
|
35
|
-
|
|
35
|
+
turns,
|
|
36
36
|
executionGroups: store.listWorkItems === undefined && store.listReviewRounds === undefined
|
|
37
37
|
? []
|
|
38
38
|
: collectExecutionGroups(store.listWorkItems?.(taskId) ?? [], store.listReviewRounds?.(taskId) ?? []),
|
|
@@ -71,21 +71,19 @@ export function projectTaskExecutionFromFacts(facts) {
|
|
|
71
71
|
?? collectExecutionGroups(facts.workItems ?? [], facts.reviewRounds ?? []);
|
|
72
72
|
return projectTaskExecution({
|
|
73
73
|
...facts,
|
|
74
|
-
|
|
74
|
+
turns: operationalTaskRecords(facts.turns, facts.events ?? [], "turn"),
|
|
75
75
|
executionGroups
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
/** Alias kept intentionally small for scheduler callers and external read models. */
|
|
79
|
-
export const deriveTaskExecutionProjection = projectTaskExecution;
|
|
80
78
|
export function projectTaskExecution(facts) {
|
|
81
|
-
const { task, roles,
|
|
79
|
+
const { task, roles, turns, workItems = [], inputRequests = [], reviewRounds = [], integrations = [], events = [], pendingWakeup = null, leaderMailbox = null, leaderFailure = null, roleSessions = [], executionGroups = [] } = facts;
|
|
82
80
|
const now = facts.now ?? new Date();
|
|
83
81
|
const groupSummaries = executionGroups.map((group) => {
|
|
84
82
|
const stageGroups = workItems.find((item) => (item.executionGroups.some(({ id }) => id === group.id)))?.executionGroups;
|
|
85
83
|
return summarizeExecutionGroupHealth({
|
|
86
84
|
group,
|
|
87
85
|
...(stageGroups === undefined ? {} : { stageGroups }),
|
|
88
|
-
|
|
86
|
+
turns,
|
|
89
87
|
sessions: roleSessions,
|
|
90
88
|
events,
|
|
91
89
|
now,
|
|
@@ -108,7 +106,7 @@ export function projectTaskExecution(facts) {
|
|
|
108
106
|
workItems,
|
|
109
107
|
executionGroups: observabilityGroups,
|
|
110
108
|
groupSummaries,
|
|
111
|
-
|
|
109
|
+
turns,
|
|
112
110
|
events,
|
|
113
111
|
contextSnapshots: facts.contextSnapshots,
|
|
114
112
|
sessionTokens,
|
|
@@ -120,17 +118,20 @@ export function projectTaskExecution(facts) {
|
|
|
120
118
|
executionGroups: groupSummaries,
|
|
121
119
|
observability
|
|
122
120
|
});
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
...(
|
|
121
|
+
const activeTurns = turns.filter((turn) => turn.status === "active");
|
|
122
|
+
const turnHasSession = (turn) => roleSessions.some((session) => (session.roleName === turn.roleName
|
|
123
|
+
&& session.agentId === turn.effective.agentId
|
|
124
|
+
&& session.status !== "ended"));
|
|
125
|
+
const activeTurnViews = activeTurns.map((turn) => ({
|
|
126
|
+
id: turn.id,
|
|
127
|
+
roleName: turn.roleName,
|
|
128
|
+
purpose: turn.purpose,
|
|
129
|
+
providerSession: turnHasSession(turn) ? "active" : "starting",
|
|
130
|
+
status: turn.status,
|
|
131
|
+
...(turn.workItemId === undefined ? {} : { workItemId: turn.workItemId }),
|
|
132
|
+
...(turn.reviewRoundId === undefined ? {} : { reviewRoundId: turn.reviewRoundId }),
|
|
133
|
+
...(turn.executionGroupId === undefined ? {} : { executionGroupId: turn.executionGroupId }),
|
|
134
|
+
...(turn.executionLaneId === undefined ? {} : { executionLaneId: turn.executionLaneId })
|
|
134
135
|
}));
|
|
135
136
|
const monitoring = task.executionGate.state === "stopped"
|
|
136
137
|
|| task.status === "completed"
|
|
@@ -149,7 +150,7 @@ export function projectTaskExecution(facts) {
|
|
|
149
150
|
reason: "execution-stopped",
|
|
150
151
|
monitoring,
|
|
151
152
|
failClosed: false,
|
|
152
|
-
|
|
153
|
+
activeTurns: activeTurnViews,
|
|
153
154
|
attention: [],
|
|
154
155
|
blockers: [],
|
|
155
156
|
pendingWakeup
|
|
@@ -165,7 +166,7 @@ export function projectTaskExecution(facts) {
|
|
|
165
166
|
reason: "task-terminal",
|
|
166
167
|
monitoring,
|
|
167
168
|
failClosed: false,
|
|
168
|
-
|
|
169
|
+
activeTurns: activeTurnViews,
|
|
169
170
|
attention: [],
|
|
170
171
|
blockers: [],
|
|
171
172
|
pendingWakeup
|
|
@@ -174,7 +175,7 @@ export function projectTaskExecution(facts) {
|
|
|
174
175
|
const attention = collectAttention({
|
|
175
176
|
task,
|
|
176
177
|
roles,
|
|
177
|
-
|
|
178
|
+
activeTurns,
|
|
178
179
|
events,
|
|
179
180
|
leaderFailure,
|
|
180
181
|
roleSessions,
|
|
@@ -182,16 +183,15 @@ export function projectTaskExecution(facts) {
|
|
|
182
183
|
});
|
|
183
184
|
const openInputs = inputRequests.filter((request) => request.status === "open");
|
|
184
185
|
const blockers = collectBlockers(workItems, reviewRounds, integrations, openInputs, task);
|
|
185
|
-
const
|
|
186
|
-
const
|
|
187
|
-
const activeDelegatedExecutions =
|
|
188
|
-
const
|
|
189
|
-
&& !attention.some((item) => item.
|
|
190
|
-
const activeLeader =
|
|
191
|
-
const
|
|
186
|
+
const activeExecutionTurns = activeTurns.filter((turn) => turn.purpose === "execution");
|
|
187
|
+
const activeReviewTurns = activeTurns.filter((turn) => turn.purpose === "review");
|
|
188
|
+
const activeDelegatedExecutions = activeExecutionTurns.filter((turn) => (turn.roleName !== "leader"));
|
|
189
|
+
const healthyActiveTurns = activeTurns.filter((turn) => (turnHasSession(turn)
|
|
190
|
+
&& !attention.some((item) => item.turnId === turn.id)));
|
|
191
|
+
const activeLeader = activeTurns.find((turn) => turn.roleName === "leader");
|
|
192
|
+
const pendingDeliveryTurns = activeTurns.filter((turn) => !turnHasSession(turn));
|
|
192
193
|
const hasPendingLeaderWork = pendingWakeup !== null
|
|
193
|
-
|| leaderMailbox
|
|
194
|
-
|| leaderMailbox.pending.userCorrection !== null);
|
|
194
|
+
|| leaderMailbox?.pending !== null;
|
|
195
195
|
const recoveryPending = isRecoveryPending(pendingWakeup, leaderMailbox, leaderFailure);
|
|
196
196
|
const failedWork = workItems.some((item) => item.status === "failed");
|
|
197
197
|
const candidateReady = workItems.some((item) => item.status === "awaiting_acceptance");
|
|
@@ -205,19 +205,19 @@ export function projectTaskExecution(facts) {
|
|
|
205
205
|
if (first === undefined)
|
|
206
206
|
throw new Error("Task execution attention disappeared.");
|
|
207
207
|
const progressingWithAttention = first.kind === "checkpoint-overdue"
|
|
208
|
-
&&
|
|
208
|
+
&& healthyActiveTurns.length > 0;
|
|
209
209
|
return render({
|
|
210
210
|
task,
|
|
211
211
|
status: progressingWithAttention ? "progressing-with-attention" : "attention",
|
|
212
212
|
owner: first.owner,
|
|
213
213
|
action: "inspect-attention",
|
|
214
214
|
summary: progressingWithAttention
|
|
215
|
-
? `${
|
|
215
|
+
? `${healthyActiveTurns.length} healthy active Turn(s) remain while ${first.summary}`
|
|
216
216
|
: first.summary,
|
|
217
217
|
reason: progressingWithAttention ? "progressing-with-attention" : first.kind,
|
|
218
218
|
monitoring,
|
|
219
219
|
failClosed: hasLeaderMismatch || attention.some((item) => item.failClosed === true),
|
|
220
|
-
|
|
220
|
+
activeTurns: activeTurnViews,
|
|
221
221
|
attention,
|
|
222
222
|
blockers,
|
|
223
223
|
pendingWakeup
|
|
@@ -236,7 +236,7 @@ export function projectTaskExecution(facts) {
|
|
|
236
236
|
reason: "open-input-request",
|
|
237
237
|
monitoring,
|
|
238
238
|
failClosed: false,
|
|
239
|
-
|
|
239
|
+
activeTurns: activeTurnViews,
|
|
240
240
|
attention,
|
|
241
241
|
blockers,
|
|
242
242
|
pendingWakeup
|
|
@@ -252,11 +252,11 @@ export function projectTaskExecution(facts) {
|
|
|
252
252
|
action: "recover-execution",
|
|
253
253
|
summary: `Execution Lane ${laneRecovery.laneId} in ${laneRecovery.groupId}`
|
|
254
254
|
+ ` requires ${laneRecovery.recovery}`
|
|
255
|
-
+ (laneRecovery.
|
|
255
|
+
+ (laneRecovery.turnId === undefined ? "." : ` for exact Turn ${laneRecovery.turnId}.`),
|
|
256
256
|
reason: `execution-lane-${laneRecovery.recovery}`,
|
|
257
257
|
monitoring,
|
|
258
258
|
failClosed: false,
|
|
259
|
-
|
|
259
|
+
activeTurns: activeTurnViews,
|
|
260
260
|
attention,
|
|
261
261
|
blockers,
|
|
262
262
|
pendingWakeup
|
|
@@ -275,7 +275,7 @@ export function projectTaskExecution(facts) {
|
|
|
275
275
|
reason: blockedIntegration ? "integration-blocked" : failedWork ? "work-failed" : "identity-mismatch",
|
|
276
276
|
monitoring,
|
|
277
277
|
failClosed: hasLeaderMismatch,
|
|
278
|
-
|
|
278
|
+
activeTurns: activeTurnViews,
|
|
279
279
|
attention,
|
|
280
280
|
blockers,
|
|
281
281
|
pendingWakeup
|
|
@@ -292,24 +292,24 @@ export function projectTaskExecution(facts) {
|
|
|
292
292
|
reason: leaderFailure === null ? "recovery-pending" : "leader-recovery-failed",
|
|
293
293
|
monitoring,
|
|
294
294
|
failClosed: leaderFailure !== null,
|
|
295
|
-
|
|
295
|
+
activeTurns: activeTurnViews,
|
|
296
296
|
attention,
|
|
297
297
|
blockers,
|
|
298
298
|
pendingWakeup
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
const leaderDeliveryPending =
|
|
301
|
+
const leaderDeliveryPending = pendingDeliveryTurns.some((turn) => turn.roleName === "leader");
|
|
302
302
|
if (leaderDeliveryPending) {
|
|
303
303
|
return render({
|
|
304
304
|
task,
|
|
305
305
|
status: "recovering",
|
|
306
306
|
owner: "leader",
|
|
307
307
|
action: "recover-leader",
|
|
308
|
-
summary: "The active Leader
|
|
308
|
+
summary: "The active Leader Turn is awaiting provider acceptance; delivery remains fail-closed.",
|
|
309
309
|
reason: "delivery-pending",
|
|
310
310
|
monitoring,
|
|
311
311
|
failClosed: false,
|
|
312
|
-
|
|
312
|
+
activeTurns: activeTurnViews,
|
|
313
313
|
attention,
|
|
314
314
|
blockers,
|
|
315
315
|
pendingWakeup
|
|
@@ -317,14 +317,14 @@ export function projectTaskExecution(facts) {
|
|
|
317
317
|
}
|
|
318
318
|
if (activeLeader !== undefined) {
|
|
319
319
|
const concurrentExecutionCount = activeDelegatedExecutions.length;
|
|
320
|
-
const concurrentReviewCount =
|
|
320
|
+
const concurrentReviewCount = activeReviewTurns.length;
|
|
321
321
|
const concurrentSummary = [
|
|
322
322
|
concurrentExecutionCount === 0
|
|
323
323
|
? null
|
|
324
|
-
: `${concurrentExecutionCount} delegated execution
|
|
324
|
+
: `${concurrentExecutionCount} delegated execution Turn(s)`,
|
|
325
325
|
concurrentReviewCount === 0
|
|
326
326
|
? null
|
|
327
|
-
: `${concurrentReviewCount} Review
|
|
327
|
+
: `${concurrentReviewCount} Review Turn(s)`
|
|
328
328
|
].filter((value) => value !== null).join(" and ");
|
|
329
329
|
return render({
|
|
330
330
|
task,
|
|
@@ -332,12 +332,12 @@ export function projectTaskExecution(facts) {
|
|
|
332
332
|
owner: "leader",
|
|
333
333
|
action: "advance-task",
|
|
334
334
|
summary: concurrentSummary.length === 0
|
|
335
|
-
? "Leader
|
|
336
|
-
: `Leader
|
|
337
|
-
reason: concurrentSummary.length === 0 ? "leader-
|
|
335
|
+
? "Leader Turn is actively advancing the Task."
|
|
336
|
+
: `Leader Turn is actively advancing the Task alongside ${concurrentSummary}.`,
|
|
337
|
+
reason: concurrentSummary.length === 0 ? "leader-turn-active" : "leader-and-agents-active",
|
|
338
338
|
monitoring,
|
|
339
339
|
failClosed: false,
|
|
340
|
-
|
|
340
|
+
activeTurns: activeTurnViews,
|
|
341
341
|
attention,
|
|
342
342
|
blockers,
|
|
343
343
|
pendingWakeup
|
|
@@ -349,62 +349,62 @@ export function projectTaskExecution(facts) {
|
|
|
349
349
|
status: "needs-leader-action",
|
|
350
350
|
owner: "leader",
|
|
351
351
|
action: "advance-task",
|
|
352
|
-
summary: "A durable Leader wake is pending; concurrent
|
|
352
|
+
summary: "A durable Leader wake is pending; concurrent Turns remain visible but do not suppress it.",
|
|
353
353
|
reason: "leader-wake-pending",
|
|
354
354
|
monitoring,
|
|
355
355
|
failClosed: false,
|
|
356
|
-
|
|
356
|
+
activeTurns: activeTurnViews,
|
|
357
357
|
attention,
|
|
358
358
|
blockers,
|
|
359
359
|
pendingWakeup
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
|
-
if (
|
|
362
|
+
if (pendingDeliveryTurns.length > 0) {
|
|
363
363
|
return render({
|
|
364
364
|
task,
|
|
365
365
|
status: "recovering",
|
|
366
366
|
owner: "leader",
|
|
367
367
|
action: "recover-execution",
|
|
368
|
-
summary: `${
|
|
368
|
+
summary: `${pendingDeliveryTurns.length} active delegated Turn(s) are awaiting provider acceptance; delivery remains fail-closed.`,
|
|
369
369
|
reason: "delivery-pending",
|
|
370
370
|
monitoring,
|
|
371
371
|
failClosed: false,
|
|
372
|
-
|
|
372
|
+
activeTurns: activeTurnViews,
|
|
373
373
|
attention,
|
|
374
374
|
blockers,
|
|
375
375
|
pendingWakeup
|
|
376
376
|
});
|
|
377
377
|
}
|
|
378
378
|
if (activeDelegatedExecutions.length > 0) {
|
|
379
|
-
const reviewSuffix =
|
|
379
|
+
const reviewSuffix = activeReviewTurns.length === 0
|
|
380
380
|
? ""
|
|
381
|
-
: `; ${
|
|
381
|
+
: `; ${activeReviewTurns.length} Review Turn(s) are also active`;
|
|
382
382
|
return render({
|
|
383
383
|
task,
|
|
384
384
|
status: "waiting-on-agents",
|
|
385
385
|
owner: roleOwner(activeDelegatedExecutions[0].roleName),
|
|
386
386
|
action: "wait-for-agents",
|
|
387
|
-
summary: `${activeDelegatedExecutions.length} delegated execution
|
|
387
|
+
summary: `${activeDelegatedExecutions.length} delegated execution Turn(s) are active${reviewSuffix}.`,
|
|
388
388
|
reason: "delegated-work-active",
|
|
389
389
|
monitoring,
|
|
390
390
|
failClosed: false,
|
|
391
|
-
|
|
391
|
+
activeTurns: activeTurnViews,
|
|
392
392
|
attention,
|
|
393
393
|
blockers,
|
|
394
394
|
pendingWakeup
|
|
395
395
|
});
|
|
396
396
|
}
|
|
397
|
-
if (
|
|
397
|
+
if (activeReviewTurns.length > 0) {
|
|
398
398
|
return render({
|
|
399
399
|
task,
|
|
400
400
|
status: "waiting-on-agents",
|
|
401
401
|
owner: "reviewer",
|
|
402
402
|
action: "wait-for-agents",
|
|
403
|
-
summary: `${
|
|
403
|
+
summary: `${activeReviewTurns.length} Review Turn(s) are evaluating frozen candidates; newer facts can still wake the Leader.`,
|
|
404
404
|
reason: "review-active",
|
|
405
405
|
monitoring,
|
|
406
406
|
failClosed: false,
|
|
407
|
-
|
|
407
|
+
activeTurns: activeTurnViews,
|
|
408
408
|
attention,
|
|
409
409
|
blockers,
|
|
410
410
|
pendingWakeup
|
|
@@ -424,7 +424,7 @@ export function projectTaskExecution(facts) {
|
|
|
424
424
|
: "integration-pending",
|
|
425
425
|
monitoring,
|
|
426
426
|
failClosed: false,
|
|
427
|
-
|
|
427
|
+
activeTurns: activeTurnViews,
|
|
428
428
|
attention,
|
|
429
429
|
blockers,
|
|
430
430
|
pendingWakeup
|
|
@@ -439,7 +439,7 @@ export function projectTaskExecution(facts) {
|
|
|
439
439
|
reason: "no-executor",
|
|
440
440
|
monitoring,
|
|
441
441
|
failClosed: false,
|
|
442
|
-
|
|
442
|
+
activeTurns: activeTurnViews,
|
|
443
443
|
attention,
|
|
444
444
|
blockers,
|
|
445
445
|
pendingWakeup
|
|
@@ -456,7 +456,7 @@ function projection(input) {
|
|
|
456
456
|
reason: input.reason,
|
|
457
457
|
monitoring: input.monitoring,
|
|
458
458
|
failClosed: input.failClosed,
|
|
459
|
-
|
|
459
|
+
activeTurns: input.activeTurns,
|
|
460
460
|
executionGroups: input.executionGroups ?? [],
|
|
461
461
|
observability: input.observability,
|
|
462
462
|
attention: input.attention,
|
|
@@ -516,7 +516,7 @@ function collectExecutionGroups(workItems, reviewRounds) {
|
|
|
516
516
|
}
|
|
517
517
|
function collectAttention(input) {
|
|
518
518
|
const result = [];
|
|
519
|
-
const { task,
|
|
519
|
+
const { task, activeTurns, events, leaderFailure } = input;
|
|
520
520
|
if (leaderFailure !== null) {
|
|
521
521
|
result.push({
|
|
522
522
|
kind: "leader-recovery",
|
|
@@ -526,82 +526,82 @@ function collectAttention(input) {
|
|
|
526
526
|
failClosed: true
|
|
527
527
|
});
|
|
528
528
|
}
|
|
529
|
-
for (const
|
|
530
|
-
const role = input.roles.find((candidate) => candidate.name ===
|
|
531
|
-
const session = input.roleSessions.find((candidate) => candidate.roleName ===
|
|
529
|
+
for (const turn of activeTurns) {
|
|
530
|
+
const role = input.roles.find((candidate) => candidate.name === turn.roleName);
|
|
531
|
+
const session = input.roleSessions.find((candidate) => candidate.roleName === turn.roleName);
|
|
532
532
|
if (role !== undefined
|
|
533
|
-
&& ((role.activeAgentId !== undefined && role.activeAgentId !==
|
|
534
|
-
|| (role.adapterId !== undefined && role.adapterId !==
|
|
533
|
+
&& ((role.activeAgentId !== undefined && role.activeAgentId !== turn.effective?.agentId)
|
|
534
|
+
|| (role.adapterId !== undefined && role.adapterId !== turn.effective?.adapterId))) {
|
|
535
535
|
result.push({
|
|
536
536
|
kind: "identity-mismatch",
|
|
537
|
-
id: `identity:${
|
|
537
|
+
id: `identity:${turn.id}`,
|
|
538
538
|
owner: "leader",
|
|
539
|
-
summary: `
|
|
540
|
-
|
|
541
|
-
roleName:
|
|
539
|
+
summary: `Turn ${turn.id} does not match the current ${turn.roleName} Agent/adapter fence.`,
|
|
540
|
+
turnId: turn.id,
|
|
541
|
+
roleName: turn.roleName,
|
|
542
542
|
failClosed: true
|
|
543
543
|
});
|
|
544
544
|
}
|
|
545
545
|
if (session !== undefined
|
|
546
|
-
&& (session.agentId !==
|
|
546
|
+
&& (session.agentId !== turn.effective?.agentId || session.adapterId !== turn.effective?.adapterId)) {
|
|
547
547
|
result.push({
|
|
548
548
|
kind: "identity-mismatch",
|
|
549
|
-
id: `session:${
|
|
549
|
+
id: `session:${turn.id}`,
|
|
550
550
|
owner: "leader",
|
|
551
|
-
summary: `
|
|
552
|
-
|
|
553
|
-
roleName:
|
|
551
|
+
summary: `Turn ${turn.id} has a provider/session identity mismatch; monitoring fails closed.`,
|
|
552
|
+
turnId: turn.id,
|
|
553
|
+
roleName: turn.roleName,
|
|
554
554
|
failClosed: true
|
|
555
555
|
});
|
|
556
556
|
}
|
|
557
|
-
if (
|
|
558
|
-
if (
|
|
559
|
-
const progressAt = latestStallProgressAt(events,
|
|
557
|
+
if (isRoleTurnStalled(events, turn.id)) {
|
|
558
|
+
if (turn.roleName === "leader") {
|
|
559
|
+
const progressAt = latestStallProgressAt(events, turn.id) ?? "unknown";
|
|
560
560
|
result.push({
|
|
561
561
|
kind: "leader-stalled",
|
|
562
|
-
id: `leader-stall:${
|
|
562
|
+
id: `leader-stall:${turn.id}:${progressAt}`,
|
|
563
563
|
owner: "operator",
|
|
564
|
-
summary: `Leader
|
|
565
|
-
|
|
566
|
-
roleName:
|
|
564
|
+
summary: `Leader Turn ${turn.id} has an unresolved no-progress attention.`,
|
|
565
|
+
turnId: turn.id,
|
|
566
|
+
roleName: turn.roleName
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
569
|
else {
|
|
570
570
|
result.push({
|
|
571
571
|
kind: "checkpoint-overdue",
|
|
572
|
-
id: `checkpoint-overdue:${
|
|
572
|
+
id: `checkpoint-overdue:${turn.id}`,
|
|
573
573
|
owner: "leader",
|
|
574
|
-
summary: `Delegated
|
|
575
|
-
|
|
576
|
-
roleName:
|
|
574
|
+
summary: `Delegated Turn ${turn.id} has an unresolved checkpoint-overdue signal.`,
|
|
575
|
+
turnId: turn.id,
|
|
576
|
+
roleName: turn.roleName
|
|
577
577
|
});
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
for (const request of input.inputRequests.filter(({ status }) => status === "open")) {
|
|
582
582
|
const requester = request.requester;
|
|
583
|
-
const
|
|
583
|
+
const turn = requester === undefined
|
|
584
584
|
? undefined
|
|
585
|
-
:
|
|
585
|
+
: activeTurns.find(({ id }) => id === requester.turnId);
|
|
586
586
|
const role = requester === undefined
|
|
587
587
|
? undefined
|
|
588
588
|
: input.roles.find(({ name }) => name === requester.roleName);
|
|
589
589
|
const session = requester === undefined
|
|
590
590
|
? undefined
|
|
591
591
|
: input.roleSessions.find(({ roleName }) => roleName === requester.roleName);
|
|
592
|
-
if (
|
|
593
|
-
||
|
|
592
|
+
if (turn === undefined
|
|
593
|
+
|| turn.roleName !== "leader"
|
|
594
594
|
|| requester === undefined
|
|
595
|
-
||
|
|
596
|
-
|| (role?.adapterId !== undefined && role.adapterId !==
|
|
595
|
+
|| turn.effective?.agentId !== requester.agentId
|
|
596
|
+
|| (role?.adapterId !== undefined && role.adapterId !== turn.effective?.adapterId)
|
|
597
597
|
|| (requester.nativeSessionId !== undefined
|
|
598
598
|
&& session?.nativeSessionId !== requester.nativeSessionId)) {
|
|
599
599
|
result.push({
|
|
600
600
|
kind: "identity-mismatch",
|
|
601
601
|
id: `input:${request.id}`,
|
|
602
602
|
owner: "leader",
|
|
603
|
-
summary: `InputRequest ${request.id} does not match the active Leader
|
|
604
|
-
...(requester?.
|
|
603
|
+
summary: `InputRequest ${request.id} does not match the active Leader Turn/session; it is held fail-closed.`,
|
|
604
|
+
...(requester?.turnId === undefined ? {} : { turnId: requester.turnId }),
|
|
605
605
|
roleName: "leader",
|
|
606
606
|
failClosed: true
|
|
607
607
|
});
|
|
@@ -32,8 +32,8 @@ export function buildTaskObservabilityProjection(input) {
|
|
|
32
32
|
...(summary?.resources === undefined ? {} : { resources: summary.resources })
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
|
-
const itemCost = projectCost(groups, input.
|
|
36
|
-
const itemContext = projectContext(groups, input.
|
|
35
|
+
const itemCost = projectCost(groups, input.turns, input.events, now);
|
|
36
|
+
const itemContext = projectContext(groups, input.turns, input.contextSnapshots);
|
|
37
37
|
const evidence = groups.flatMap((group) => group.lanes.flatMap((lane) => (lane.result?.evidence ?? [])));
|
|
38
38
|
const openFindingCount = groups.reduce((count, group) => count + group.lanes.reduce((laneCount, lane) => laneCount + (lane.result?.findings ?? [])
|
|
39
39
|
.filter(({ status }) => status === "open").length, 0), 0);
|
|
@@ -51,8 +51,8 @@ export function buildTaskObservabilityProjection(input) {
|
|
|
51
51
|
openFindingCount
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
|
-
const cost = projectCost(input.executionGroups, input.
|
|
55
|
-
const context = projectContext(input.executionGroups, input.
|
|
54
|
+
const cost = projectCost(input.executionGroups, input.turns, input.events, now);
|
|
55
|
+
const context = projectContext(input.executionGroups, input.turns, input.contextSnapshots);
|
|
56
56
|
return Object.freeze({
|
|
57
57
|
dag,
|
|
58
58
|
workItems,
|
|
@@ -159,7 +159,7 @@ function resolveDependency(id, byId) {
|
|
|
159
159
|
}
|
|
160
160
|
return current;
|
|
161
161
|
}
|
|
162
|
-
function projectCost(groups,
|
|
162
|
+
function projectCost(groups, turns, events, now) {
|
|
163
163
|
const stageGroups = latestStageGroups(groups);
|
|
164
164
|
let tokens = 0;
|
|
165
165
|
let toolCalls = 0;
|
|
@@ -170,7 +170,7 @@ function projectCost(groups, runs, events, now) {
|
|
|
170
170
|
let retryCount = 0;
|
|
171
171
|
for (const group of stageGroups) {
|
|
172
172
|
const lineage = groups.filter((candidate) => sameStage(candidate, group));
|
|
173
|
-
const usage = observedExecutionResourceUsage({ group, stageGroups: lineage,
|
|
173
|
+
const usage = observedExecutionResourceUsage({ group, stageGroups: lineage, turns, events });
|
|
174
174
|
tokens += usage.tokens;
|
|
175
175
|
toolCalls += usage.toolCalls;
|
|
176
176
|
tokensObservable = tokensObservable && (usage.tokensObservable ?? true);
|
|
@@ -192,15 +192,15 @@ function projectCost(groups, runs, events, now) {
|
|
|
192
192
|
marginalValueStatus: "unavailable"
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
|
-
function projectContext(groups,
|
|
195
|
+
function projectContext(groups, turns, snapshots) {
|
|
196
196
|
const refs = new Map();
|
|
197
197
|
for (const group of groups) {
|
|
198
198
|
const ref = group.stage?.contextSnapshotRef;
|
|
199
199
|
if (ref !== undefined)
|
|
200
200
|
refs.set(ref.id, ref);
|
|
201
201
|
}
|
|
202
|
-
for (const
|
|
203
|
-
const ref =
|
|
202
|
+
for (const turn of turns) {
|
|
203
|
+
const ref = turn.inputs[0].input.contextSnapshotRef;
|
|
204
204
|
if (ref !== undefined)
|
|
205
205
|
refs.set(ref.id, ref);
|
|
206
206
|
}
|
|
@@ -277,5 +277,5 @@ function stageDurationSeconds(groups, now) {
|
|
|
277
277
|
return Math.max(0, Math.floor((end - Math.min(...started)) / 1_000));
|
|
278
278
|
}
|
|
279
279
|
function isTerminalLane(status) {
|
|
280
|
-
return status === "
|
|
280
|
+
return status === "completed" || status === "failed" || status === "skipped";
|
|
281
281
|
}
|
|
@@ -11,7 +11,7 @@ export function createTaskWake(input) {
|
|
|
11
11
|
fromCursor: requireTimestamp(input.fromCursor, "Wake fromCursor"),
|
|
12
12
|
toCursor: requireTimestamp(input.toCursor, "Wake toCursor"),
|
|
13
13
|
status: "dispatched",
|
|
14
|
-
|
|
14
|
+
turnId: requireIdentity(input.turnId, "Wake Turn id"),
|
|
15
15
|
createdAt: input.now.toISOString()
|
|
16
16
|
};
|
|
17
17
|
validateTaskWake(wake);
|
|
@@ -55,12 +55,12 @@ export function latestTaskWake(wakes) {
|
|
|
55
55
|
return latest;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* The delta lower bound for a Task's first wake: the last Leader
|
|
58
|
+
* The delta lower bound for a Task's first wake: the last Leader Turn's
|
|
59
59
|
* creation time, preserving the pre-ledger watermark semantics. When no
|
|
60
|
-
* Leader
|
|
60
|
+
* Leader Turn exists, the Task's own creation time bounds the window.
|
|
61
61
|
*/
|
|
62
62
|
export function fallbackWakeCursor(input) {
|
|
63
|
-
return input.
|
|
63
|
+
return input.leaderTurnCreatedAt ?? input.taskCreatedAt;
|
|
64
64
|
}
|
|
65
65
|
function wakeSequence(id) {
|
|
66
66
|
const prefix = `${TASK_RECORD_ID_PREFIXES.taskWake}-`;
|
|
@@ -8,32 +8,28 @@
|
|
|
8
8
|
* queue — the wake layer owns the meaning of its tags.
|
|
9
9
|
*
|
|
10
10
|
* Tag wire format: `<kind>` or `<kind>:<ref>`. The ref is an exact record
|
|
11
|
-
* identifier (InputRequest id,
|
|
11
|
+
* identifier (InputRequest id, Turn id, ...) or, for `force-wake`, the
|
|
12
12
|
* operator-supplied text. Unknown kinds parse losslessly so a newer producer
|
|
13
13
|
* can never wedge an older reader.
|
|
14
14
|
*/
|
|
15
15
|
export const WAKE_REASON_KINDS = Object.freeze([
|
|
16
16
|
"role-result",
|
|
17
|
-
"task-orphaned",
|
|
18
17
|
"input-timeout",
|
|
19
|
-
"role-
|
|
18
|
+
"role-turn-stalled",
|
|
20
19
|
"agent-error",
|
|
21
20
|
"agent-session-recovery",
|
|
22
21
|
"review-failed",
|
|
23
22
|
"task-reopened",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"leader-run-failed",
|
|
27
|
-
"role-run-failed",
|
|
23
|
+
"leader-turn-failed",
|
|
24
|
+
"role-turn-failed",
|
|
28
25
|
"job-finished",
|
|
29
26
|
"published-tree-authorized",
|
|
30
|
-
"review-contract-rebound",
|
|
31
27
|
"force-wake"
|
|
32
28
|
]);
|
|
33
29
|
const IMMEDIATE_KINDS = new Set([
|
|
34
30
|
"task-reopened",
|
|
35
|
-
"leader-
|
|
36
|
-
"role-
|
|
31
|
+
"leader-turn-failed",
|
|
32
|
+
"role-turn-failed"
|
|
37
33
|
]);
|
|
38
34
|
export function wakeReason(kind, ref) {
|
|
39
35
|
if (ref === undefined)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { mergePendingWakeup } from "./pendingWakeup.js";
|
|
2
|
-
import { wakeReason } from "./wakeReason.js";
|
|
3
2
|
export function queueLeaderWakeup(store, taskId, reason, now) {
|
|
4
3
|
if (store.enqueueLeaderWakeup !== undefined) {
|
|
5
4
|
return store.enqueueLeaderWakeup(taskId, reason, now);
|
|
@@ -8,11 +7,3 @@ export function queueLeaderWakeup(store, taskId, reason, now) {
|
|
|
8
7
|
store.savePendingWakeup(pending);
|
|
9
8
|
return pending;
|
|
10
9
|
}
|
|
11
|
-
export function queueLeaderWakeupAfterYield(store, task, run, now) {
|
|
12
|
-
if (run.taskId !== task.id)
|
|
13
|
-
throw new Error(`AgentRun belongs to another Task: ${run.taskId}.`);
|
|
14
|
-
if (task.status !== "active" || task.executionGate.state !== "enabled" || run.roleName === "leader") {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return queueLeaderWakeup(store, task.id, wakeReason("role-result"), now);
|
|
18
|
-
}
|
|
@@ -7,7 +7,7 @@ import { resolveTmuxBin } from "../config/yuiConfig.js";
|
|
|
7
7
|
import { usageError } from "../errors/cliError.js";
|
|
8
8
|
import { createGlobalRole, createRoleAgentBinding, updateGlobalRole } from "../role/role.js";
|
|
9
9
|
import { SYSTEM_LEADER_ROLE, SYSTEM_OPERATOR_ROLE } from "../role/systemRoles.js";
|
|
10
|
-
import {
|
|
10
|
+
import { initializeCurrentTaskStore } from "../storage/currentTaskStore.js";
|
|
11
11
|
import { ensureYuiHome, resolveYuiHome } from "../storage/taskStore.js";
|
|
12
12
|
const BUILTIN_AGENTS = Object.freeze([
|
|
13
13
|
Object.freeze({
|
|
@@ -36,7 +36,7 @@ export async function runSetupCommand(args, env, executor, io = {}) {
|
|
|
36
36
|
const question = createSetupQuestion(readline, io);
|
|
37
37
|
const home = resolveYuiHome(env);
|
|
38
38
|
ensureYuiHome(home);
|
|
39
|
-
const store =
|
|
39
|
+
const store = initializeCurrentTaskStore(home);
|
|
40
40
|
const tmuxBin = resolveTmuxBin(store.getConfig().tmuxBin);
|
|
41
41
|
assertTmuxAvailable(executor, tmuxBin);
|
|
42
42
|
const choices = availableAgentChoices(store, env);
|