@zq-silk/yui 0.15.7 → 0.15.9
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 +194 -399
- package/ARCHITECTURE.zh-CN.md +151 -0
- package/README.md +306 -1131
- package/dist/agent/adapterCatalog.js +15 -2
- package/dist/agent/agent.js +23 -3
- package/dist/agent/argumentPolicy.js +7 -1
- package/dist/agent/connectionPlan.js +62 -0
- package/dist/agent/executionComponents.js +158 -0
- package/dist/agent/launchEnvironment.js +31 -3
- package/dist/agent/managedRuntimeEnvironment.js +3 -5
- package/dist/{turn/turn.js → agentRun/agentRun.js} +166 -109
- package/dist/{turn/turnIdentity.js → agentRun/runIdentity.js} +4 -4
- package/dist/artifacts/artifactCapability.js +74 -0
- package/dist/artifacts/artifactCommitLock.js +249 -0
- package/dist/artifacts/artifactPaths.js +151 -0
- package/dist/artifacts/gitArtifactRef.js +146 -0
- package/dist/artifacts/managedGit.js +332 -0
- package/dist/artifacts/taskArtifactRepository.js +277 -0
- package/dist/brief/taskBrief.js +12 -0
- package/dist/cli/agentConfigurationPicker.js +13 -0
- package/dist/cli/commandCatalog.js +165 -74
- package/dist/cli/interactionCandidates.js +5 -5
- package/dist/cli/interactionPolicy.js +38 -8
- package/dist/cli/invocationRouter.js +1 -1
- package/dist/cli/managedDiagnostics.js +28 -0
- package/dist/cli/operatorWizard.js +1 -7
- package/dist/cli/roleOptionOrder.js +27 -0
- package/dist/cli/roleWizard.js +50 -14
- package/dist/cli/updateOrchestrator.js +1 -1
- package/dist/cli/updatePorts.js +3 -4
- package/dist/cli.js +245 -95
- package/dist/commands/agentCommands.js +72 -14
- package/dist/commands/capabilityCommands.js +9 -6
- package/dist/commands/configCommands.js +20 -20
- package/dist/commands/deliveryGuardPreflight.js +2 -2
- package/dist/commands/executionAuditCommands.js +24 -24
- package/dist/commands/globalRoleCommands.js +1 -1
- package/dist/commands/grantCommands.js +4 -4
- package/dist/commands/operatorCommands.js +34 -9
- package/dist/commands/projectCommands.js +4 -4
- package/dist/commands/resourcesCommands.js +2 -2
- package/dist/commands/roleConfiguration.js +25 -5
- package/dist/commands/roleRuntimeGuard.js +4 -5
- package/dist/commands/sessionCommands.js +3 -7
- package/dist/commands/taskActivationCommands.js +281 -0
- package/dist/commands/taskActor.js +28 -49
- package/dist/commands/taskCommands.js +1461 -720
- package/dist/commands/taskContextCommand.js +39 -583
- package/dist/commands/taskExecutionCommands.js +32 -32
- package/dist/commands/taskInputCommands.js +40 -104
- package/dist/commands/taskIntegrationCommands.js +3 -2
- package/dist/commands/taskIntegrationQueueCommands.js +1 -1
- package/dist/commands/taskNextActionCommand.js +8 -8
- package/dist/commands/taskOverviewCommand.js +33 -45
- package/dist/commands/taskRemoteDeliveryCommand.js +2 -2
- package/dist/commands/taskRoleRuntimeStatus.js +133 -102
- package/dist/commands/telemetryCommands.js +36 -38
- package/dist/config/configCatalog.js +4 -4
- package/dist/config/yuiConfig.js +8 -8
- package/dist/context/contextSnapshot.js +10 -10
- package/dist/context/dispatchContext.js +11 -11
- package/dist/context/roleSessionContext.js +6 -3
- package/dist/context/{turnContextPack.js → runContextPack.js} +158 -81
- package/dist/context/{turnInputContract.js → runInputContract.js} +73 -60
- package/dist/context/sessionBootstrapManifest.js +21 -2
- package/dist/context/sourceRunContext.js +30 -0
- package/dist/context/taskContext.js +481 -0
- package/dist/context/wakeNotification.js +27 -27
- package/dist/controller/agentRuntimeObserver.js +21 -24
- package/dist/controller/capabilityBridge.js +17 -6
- package/dist/controller/clientRuntime.js +65 -92
- package/dist/controller/controller.js +120 -188
- package/dist/controller/fileSchedulerStoreAdapter.js +787 -887
- package/dist/controller/jobControl.js +54 -85
- package/dist/controller/resourceInventory.js +8 -27
- package/dist/controller/resourceInventoryLinux.js +12 -13
- package/dist/controller/runtime.js +529 -479
- package/dist/controller/runtimeEventInbox.js +55 -25
- package/dist/controller/runtimeEventProcessor.js +22 -31
- package/dist/controller/{runtimeHookTurnFence.js → runtimeHookRunFence.js} +91 -115
- package/dist/controller/runtimeLaunchCoordinator.js +80 -426
- package/dist/controller/runtimeObservationHook.js +14 -18
- package/dist/controller/sessionNotify.js +16 -24
- package/dist/controller/sessionOwnerReconciliation.js +168 -50
- package/dist/controller/structuredProviderObservation.js +138 -99
- package/dist/coordination/workMailbox.js +3 -3
- package/dist/coordination/workMailboxQueue.js +36 -33
- package/dist/core/boundedRpc.js +8 -1
- package/dist/core/controllerClient.js +20 -1
- package/dist/core/controllerServer.js +4 -4
- package/dist/doctor/doctor.js +13 -2
- package/dist/domain/agentResultTransport.js +9 -9
- package/dist/execution/codexThreadNaming.js +2 -8
- package/dist/execution/executionHealth.js +51 -63
- package/dist/execution/reviewMainRun.js +137 -0
- package/dist/execution/workItemExecution.js +28 -29
- package/dist/execution/workItemExecutionProjection.js +99 -107
- package/dist/execution/workItemMainRun.js +141 -0
- package/dist/executor/agentAdapter.js +227 -20
- package/dist/executor/agentConfigurationCatalog.js +126 -4
- package/dist/executor/agentConfigurationProbe.js +162 -4
- package/dist/executor/agentExecutor.js +79 -78
- package/dist/executor/effectiveLaunch.js +105 -18
- package/dist/executor/executorRegistry.js +29 -44
- package/dist/executor/fileRoleLaunchPlanner.js +229 -154
- package/dist/executor/workspacePreflightClassification.js +16 -16
- package/dist/grant/capabilityGrant.js +6 -3
- package/dist/input/inputRequest.js +12 -10
- package/dist/integration/gitIntegrationService.js +4 -11
- package/dist/integration/integrationQueueService.js +4 -4
- package/dist/interaction/operatorPresentation.js +1 -1
- package/dist/kernel/builtinCapabilities.js +255 -12
- package/dist/kernel/capabilityRegistry.js +64 -18
- package/dist/kernel/instanceHost.js +12 -1
- package/dist/kernel/kernelPorts.js +2 -2
- package/dist/lifecycle/canonicalLifecycleEvent.js +44 -49
- package/dist/lifecycle/exactRunTerminalization.js +449 -0
- package/dist/message/message.js +118 -6
- package/dist/message/messageContinuation.js +204 -0
- package/dist/observability/executionAudit.js +70 -72
- package/dist/observability/faultClassification.js +2 -2
- package/dist/observability/orchestrationMetrics.js +8 -8
- package/dist/operator/operatorSessionHistory.js +1 -7
- package/dist/output/agentConfigurationPresentation.js +8 -3
- package/dist/output/agentRunConfigurationPresentation.js +128 -0
- package/dist/output/rolePresentation.js +54 -3
- package/dist/plugins/pluginChild.js +104 -0
- package/dist/plugins/pluginIntent.js +26 -0
- package/dist/plugins/pluginInterpreter.js +43 -0
- package/dist/plugins/pluginPackage.js +101 -0
- package/dist/plugins/pluginProcess.js +112 -0
- package/dist/plugins/pluginService.js +388 -0
- package/dist/profile/agentProfile.js +1 -1
- package/dist/repository/gitWorkspace.js +26 -4
- package/dist/repository/project.js +19 -4
- package/dist/repository/taskBaseFreshness.js +13 -13
- package/dist/repository/taskWorkspaceCoordinator.js +20 -27
- package/dist/repository/taskWorkspacePreparer.js +344 -83
- package/dist/resources/autoResourceGc.js +3 -3
- package/dist/resources/liveReferences.js +3 -3
- package/dist/resources/projectResource.js +75 -0
- package/dist/resources/projectResourceService.js +343 -0
- package/dist/resources/resourceDiscovery.js +6 -6
- package/dist/resources/resourceGc.js +1 -1
- package/dist/resources/resourceRegistrar.js +1 -1
- package/dist/resources/resourceTypes.js +1 -1
- package/dist/review/deltaRecheck.js +3 -3
- package/dist/review/reviewAcceptance.js +16 -16
- package/dist/review/reviewDecision.js +7 -7
- package/dist/review/reviewRound.js +21 -20
- package/dist/review/reviewerAvailability.js +2 -2
- package/dist/role/role.js +51 -7
- package/dist/role/taskRoleUpdate.js +30 -0
- package/dist/runtime/acpProtocol.js +425 -0
- package/dist/runtime/acpSession.js +731 -0
- package/dist/runtime/acpSessionConfiguration.js +260 -0
- package/dist/runtime/agentDriver.js +30 -11
- package/dist/runtime/agentEndpoint.js +278 -0
- package/dist/runtime/agentEndpointIdentity.js +86 -0
- package/dist/runtime/agentEndpointOwnership.js +239 -0
- package/dist/runtime/agentError.js +2 -10
- package/dist/runtime/agentHost.js +565 -314
- package/dist/runtime/agentRunConfiguration.js +258 -0
- package/dist/runtime/builtinAgentDrivers.js +134 -18
- package/dist/runtime/builtinAgentErrorMappers.js +55 -3
- package/dist/runtime/builtinTranscriptUsage.js +1 -1
- package/dist/runtime/claude-process-owner +0 -0
- package/dist/runtime/codexAppServerRuntime.js +38 -30
- package/dist/runtime/codexInteractiveHost.js +41 -6
- package/dist/runtime/continuationManager.js +2 -6
- package/dist/runtime/executionEnvironment.js +30 -0
- package/dist/runtime/firstProgressAdvisory.js +11 -11
- package/dist/runtime/index.js +4 -3
- package/dist/runtime/jsonLineChannel.js +109 -0
- package/dist/runtime/launchBroker.js +91 -16
- package/dist/runtime/launchDiagnostics.js +2 -2
- package/dist/runtime/lifecycleReservation.js +10 -18
- package/dist/runtime/managedCaller.js +61 -17
- package/dist/runtime/nativeSessionControl.js +102 -0
- package/dist/runtime/ports.js +6 -21
- package/dist/runtime/processExitObservation.js +8 -7
- package/dist/runtime/promptEnvelope.js +17 -6
- package/dist/runtime/providerContinuation.js +3 -9
- package/dist/runtime/providerContinuationReconciliationService.js +4 -13
- package/dist/runtime/providerControl.js +2 -7
- package/dist/runtime/providerRuntimeIdentity.js +110 -222
- package/dist/runtime/providerRuntimeReconciler.js +5 -9
- package/dist/runtime/runtimeBinding.js +0 -1
- package/dist/runtime/runtimeContinuationProjection.js +4 -7
- package/dist/runtime/runtimeDeadlines.js +9 -0
- package/dist/runtime/runtimeHealthPolicy.js +1 -1
- package/dist/runtime/runtimeObservation.js +29 -65
- package/dist/runtime/runtimeProjection.js +43 -51
- package/dist/runtime/runtimeSessionCandidate.js +1 -3
- package/dist/runtime/sessionLaunchRequest.js +3 -7
- package/dist/runtime/sessionOwnerIdentity.js +7 -54
- package/dist/runtime/sessionOwnerRegistry.js +22 -17
- package/dist/runtime/sessionReconciliation.js +4 -8
- package/dist/runtime/sessionTerminationGuard.js +70 -259
- package/dist/runtime/sessionTokenMetrics.js +5 -16
- package/dist/runtime/structuredProviderHost.js +237 -117
- package/dist/runtime/taskRuntimeIsolation.js +39 -122
- package/dist/runtime/tmuxAdapters.js +39 -86
- package/dist/scheduler/activeRoleRunDelivery.js +354 -0
- package/dist/scheduler/leaderWakeupProcessor.js +75 -266
- package/dist/scheduler/operatorInputNotificationProcessor.js +1 -1
- package/dist/scheduler/ports.js +80 -9
- package/dist/scheduler/{roleTurnLiveness.js → roleRunLiveness.js} +26 -30
- package/dist/scheduler/{roleTurnStall.js → roleRunStall.js} +128 -139
- package/dist/scheduler/taskExecutionProjection.js +120 -124
- package/dist/scheduler/taskObservabilityProjection.js +29 -29
- package/dist/scheduler/taskWake.js +11 -4
- package/dist/scheduler/wakeReason.js +9 -1
- package/dist/setup/setupCommand.js +3 -7
- package/dist/storage/migrations/agentRunContract.js +159 -0
- package/dist/storage/migrations/artifactsToGit.js +338 -0
- package/dist/storage/migrations/removeRuntimeGeneration.js +207 -0
- package/dist/storage/migrations/submitIntent.js +126 -0
- package/dist/storage/sqliteSchema.js +467 -7
- package/dist/storage/sqliteStore.js +355 -220
- package/dist/storage/storageVersions.js +1 -1
- package/dist/storage/storeRpc.js +10 -5
- package/dist/storage/taskStore.js +13 -11
- package/dist/storage/upgrade/upgradeOrchestrator.js +5 -7
- package/dist/surface/surfaceContributions.js +102 -0
- package/dist/task/completionReadiness.js +32 -6
- package/dist/task/deliveryGuard.js +16 -16
- package/dist/task/draftPlan.js +72 -12
- package/dist/task/nextAction.js +144 -128
- package/dist/task/remoteDelivery.js +6 -6
- package/dist/task/task.js +184 -18
- package/dist/task/taskActivation.js +327 -0
- package/dist/task/taskActivationService.js +408 -0
- package/dist/task/taskRecordReference.js +5 -4
- package/dist/task/taskRecordRetirement.js +1 -1
- package/dist/task/taskSubmission.js +236 -0
- package/dist/telemetry/sqliteTelemetryStore.js +55 -68
- package/dist/telemetry/telemetryConfig.js +14 -14
- package/dist/telemetry/telemetryWiring.js +2 -2
- package/dist/web/assets/assetManifest.js +2 -0
- package/dist/web/assets/client/app.js +121 -20
- package/dist/web/assets/client/components.js +87 -54
- package/dist/web/assets/client/i18n.js +83 -41
- package/dist/web/assets/client/markdown.js +1 -1
- package/dist/web/assets/client/taskSurface.js +442 -0
- package/dist/web/assets/client/view.js +49 -44
- package/dist/web/assets/shell.js +1 -1
- package/dist/web/assets/styles/cards.js +22 -4
- package/dist/web/controllerWeb.js +60 -0
- package/dist/web/webMutation.js +28 -0
- package/dist/web/webServer.js +133 -8
- package/dist/web/webSnapshot.js +81 -74
- package/dist/web/webTaskSurface.js +64 -0
- package/dist/workItem/dependencyGate.js +1 -1
- package/dist/workItem/workItem.js +84 -48
- package/dist/workspace/workItemChangeSetManager.js +16 -9
- package/docs/agent-result-consumption.md +96 -0
- package/docs/agent-result-consumption.zh-CN.md +81 -0
- package/docs/agent-runtime-drivers.md +93 -0
- package/docs/agent-runtime-drivers.zh-CN.md +77 -0
- package/docs/architecture/README.md +50 -0
- package/docs/architecture/README.zh-CN.md +43 -0
- package/docs/architecture/capabilities-and-resources.md +118 -0
- package/docs/architecture/capabilities-and-resources.zh-CN.md +83 -0
- package/docs/managed-turn-and-session-runtime.md +224 -0
- package/docs/managed-turn-and-session-runtime.zh-CN.md +180 -0
- package/docs/observability/README.md +83 -0
- package/docs/observability/README.zh-CN.md +71 -0
- package/docs/plugin-sdk.md +393 -0
- package/docs/plugin-sdk.zh-CN.md +293 -0
- package/docs/provider-runtime.md +165 -0
- package/docs/provider-runtime.zh-CN.md +132 -0
- package/docs/release-workflow.md +305 -0
- package/docs/release-workflow.zh-CN.md +237 -0
- package/docs/roles-and-configuration.md +115 -0
- package/docs/roles-and-configuration.zh-CN.md +96 -0
- package/docs/sqlite-control-plane-design.md +78 -0
- package/docs/sqlite-control-plane-design.zh-CN.md +62 -0
- package/docs/task-dag-semantics.md +80 -0
- package/docs/task-dag-semantics.zh-CN.md +59 -0
- package/docs/task-delivery.md +105 -0
- package/docs/task-delivery.zh-CN.md +82 -0
- package/docs/task-local-identity.md +8 -6
- package/docs/task-local-identity.zh-CN.md +58 -0
- package/docs/testing/verification-levels.md +88 -0
- package/docs/testing/verification-levels.zh-CN.md +69 -0
- package/i18n/README.zh-CN.md +270 -722
- package/package.json +3 -2
- package/skills/yui-leader/SKILL.md +88 -304
- package/skills/yui-leader/references/execution.md +303 -0
- package/skills/yui-leader/references/integration.md +39 -0
- package/skills/yui-leader/references/planning.md +109 -0
- package/skills/yui-leader/references/replicated-execution.md +42 -0
- package/skills/yui-leader/references/task-plugins.md +37 -0
- package/skills/yui-operator/SKILL.md +46 -62
- package/skills/yui-reviewer/SKILL.md +35 -36
- package/skills/yui-runtime/SKILL.md +88 -24
- package/skills/yui-runtime/references/publication.md +22 -0
- package/skills/yui-runtime/references/recovery.md +64 -0
- package/skills/yui-worker/SKILL.md +37 -39
- package/dist/cli/roleOptionCatalog.js +0 -68
- package/dist/context/sourceTurnContext.js +0 -30
- package/dist/execution/reviewMainTurn.js +0 -161
- package/dist/execution/workItemMainTurn.js +0 -164
- package/dist/lifecycle/exactTurnTerminalization.js +0 -407
- package/dist/runtime/preallocatedNativeSession.js +0 -13
- package/dist/runtime/runtimeStopReceipt.js +0 -42
- package/dist/scheduler/activeRoleTurnDelivery.js +0 -315
|
@@ -2,16 +2,15 @@ import { isDeepStrictEqual } from "node:util";
|
|
|
2
2
|
import { normalizedUniqueIdentities, normalizedUniqueText, requireIdentity, requirePositiveInteger, requireText, requireTimestamp } from "../domain/validation.js";
|
|
3
3
|
import { validateContextSnapshotRef } from "../context/contextSnapshot.js";
|
|
4
4
|
import { validateEffectiveLaunchSnapshot } from "../executor/effectiveLaunch.js";
|
|
5
|
-
import {
|
|
5
|
+
import { MAX_SYNTHESIS_SOURCE_RUNS } from "../context/sourceRunContext.js";
|
|
6
6
|
export const WORK_ITEM_EXECUTION_GROUP_SCHEMA_VERSION = 2;
|
|
7
7
|
export const WORK_ITEM_EXECUTION_LANE_SCHEMA_VERSION = 2;
|
|
8
8
|
export const WORK_ITEM_EXECUTION_ASSIGNMENT_SCHEMA_VERSION = 1;
|
|
9
|
-
export const
|
|
9
|
+
export const MINIMUM_EXECUTION_GROUP_LANES = 2;
|
|
10
10
|
export const EXECUTION_GROUP_SCHEMA_VERSION = WORK_ITEM_EXECUTION_GROUP_SCHEMA_VERSION;
|
|
11
11
|
export const EXECUTION_LANE_SCHEMA_VERSION = WORK_ITEM_EXECUTION_LANE_SCHEMA_VERSION;
|
|
12
12
|
export const EXECUTION_ASSIGNMENT_SCHEMA_VERSION = WORK_ITEM_EXECUTION_ASSIGNMENT_SCHEMA_VERSION;
|
|
13
|
-
export const
|
|
14
|
-
export const MAXIMUM_SYNTHESIS_RESULTS = MAX_SYNTHESIS_SOURCE_TURNS;
|
|
13
|
+
export const MAXIMUM_SYNTHESIS_RESULTS = MAX_SYNTHESIS_SOURCE_RUNS;
|
|
15
14
|
export function createWorkItemExecutionAssignment(input) {
|
|
16
15
|
return validateWorkItemExecutionAssignment({
|
|
17
16
|
schemaVersion: WORK_ITEM_EXECUTION_ASSIGNMENT_SCHEMA_VERSION,
|
|
@@ -25,7 +24,7 @@ export function createReviewExecutionAssignment(input) {
|
|
|
25
24
|
});
|
|
26
25
|
}
|
|
27
26
|
export function createExecutionGroup(id, taskId, assignment, laneInputs, now) {
|
|
28
|
-
if (laneInputs.length <
|
|
27
|
+
if (laneInputs.length < MINIMUM_EXECUTION_GROUP_LANES) {
|
|
29
28
|
throw new Error("A replicated ExecutionGroup requires at least two Lanes.");
|
|
30
29
|
}
|
|
31
30
|
if (laneInputs.length > MAXIMUM_SYNTHESIS_RESULTS) {
|
|
@@ -51,7 +50,7 @@ export function createExecutionGroup(id, taskId, assignment, laneInputs, now) {
|
|
|
51
50
|
roleName: lane.roleName,
|
|
52
51
|
...(lane.effective === undefined ? {} : { effective: lane.effective }),
|
|
53
52
|
...(lane.workspace === undefined ? {} : { workspace: lane.workspace }),
|
|
54
|
-
...(lane.
|
|
53
|
+
...(lane.currentRunId === undefined ? {} : { currentRunId: lane.currentRunId }),
|
|
55
54
|
disposition: "open",
|
|
56
55
|
createdAt: timestamp,
|
|
57
56
|
updatedAt: timestamp
|
|
@@ -74,28 +73,28 @@ export function updateExecutionLane(group, laneId, patch, now) {
|
|
|
74
73
|
throw new Error(`Terminal ExecutionLane is immutable: ${laneId}.`);
|
|
75
74
|
}
|
|
76
75
|
const disposition = patch.disposition ?? current.disposition;
|
|
77
|
-
const
|
|
78
|
-
const
|
|
76
|
+
const currentRunId = patch.currentRunId ?? current.currentRunId;
|
|
77
|
+
const successfulRunId = patch.successfulRunId ?? current.successfulRunId;
|
|
79
78
|
const effective = patch.effective ?? current.effective;
|
|
80
79
|
const workspace = patch.workspace ?? current.workspace;
|
|
81
80
|
if ((effective === undefined) !== (workspace === undefined)) {
|
|
82
81
|
throw new Error("ExecutionLane launch facts are incomplete.");
|
|
83
82
|
}
|
|
84
83
|
if (disposition === "succeeded") {
|
|
85
|
-
if (
|
|
86
|
-
throw new Error("A succeeded Lane must identify its current successful
|
|
84
|
+
if (successfulRunId === undefined || successfulRunId !== currentRunId) {
|
|
85
|
+
throw new Error("A succeeded Lane must identify its current successful AgentRun.");
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
|
-
else if (
|
|
90
|
-
throw new Error("Only a succeeded Lane may identify a successful
|
|
88
|
+
else if (successfulRunId !== undefined) {
|
|
89
|
+
throw new Error("Only a succeeded Lane may identify a successful AgentRun.");
|
|
91
90
|
}
|
|
92
91
|
const timestamp = now.toISOString();
|
|
93
92
|
const updated = {
|
|
94
93
|
...current,
|
|
95
94
|
...(effective === undefined ? {} : { effective }),
|
|
96
95
|
...(workspace === undefined ? {} : { workspace }),
|
|
97
|
-
...(
|
|
98
|
-
...(
|
|
96
|
+
...(currentRunId === undefined ? {} : { currentRunId }),
|
|
97
|
+
...(successfulRunId === undefined ? {} : { successfulRunId }),
|
|
99
98
|
disposition,
|
|
100
99
|
updatedAt: timestamp,
|
|
101
100
|
...(disposition === "open" ? {} : { endedAt: timestamp })
|
|
@@ -114,7 +113,7 @@ export function updateWorkItemExecutionLane(group, laneId, patch, now) {
|
|
|
114
113
|
/**
|
|
115
114
|
* Reopen only failed Lanes for an explicit retry of the same semantic
|
|
116
115
|
* execution. Successful results remain settled, while each failed Lane
|
|
117
|
-
* returns to the same state produced by a naturally failed
|
|
116
|
+
* returns to the same state produced by a naturally failed AgentRun: open and
|
|
118
117
|
* still pointing at the failed attempt that dispatch must replace.
|
|
119
118
|
*
|
|
120
119
|
* This is the sole terminal-to-open Lane transition. Normal Lane updates keep
|
|
@@ -255,7 +254,7 @@ export function validateExecutionGroup(group) {
|
|
|
255
254
|
if (assignment.taskId !== group.taskId) {
|
|
256
255
|
throw new Error("ExecutionGroup Assignment Task does not match its Group.");
|
|
257
256
|
}
|
|
258
|
-
if (!Array.isArray(group.lanes) || group.lanes.length <
|
|
257
|
+
if (!Array.isArray(group.lanes) || group.lanes.length < MINIMUM_EXECUTION_GROUP_LANES) {
|
|
259
258
|
throw new Error("A replicated ExecutionGroup requires at least two Lanes.");
|
|
260
259
|
}
|
|
261
260
|
if (group.lanes.length > MAXIMUM_SYNTHESIS_RESULTS) {
|
|
@@ -353,8 +352,8 @@ export function summarizeExecutionGroup(group) {
|
|
|
353
352
|
roleName: lane.roleName,
|
|
354
353
|
ordinal: lane.ordinal,
|
|
355
354
|
disposition: lane.disposition,
|
|
356
|
-
...(lane.
|
|
357
|
-
...(lane.
|
|
355
|
+
...(lane.currentRunId === undefined ? {} : { currentRunId: lane.currentRunId }),
|
|
356
|
+
...(lane.successfulRunId === undefined ? {} : { successfulRunId: lane.successfulRunId }),
|
|
358
357
|
...(lane.effective === undefined ? {} : { effective: lane.effective })
|
|
359
358
|
}))
|
|
360
359
|
};
|
|
@@ -385,8 +384,8 @@ function validateWorkItemExecutionLane(lane, groupId, ordinal) {
|
|
|
385
384
|
"roleName",
|
|
386
385
|
"effective",
|
|
387
386
|
"workspace",
|
|
388
|
-
"
|
|
389
|
-
"
|
|
387
|
+
"currentRunId",
|
|
388
|
+
"successfulRunId",
|
|
390
389
|
"disposition",
|
|
391
390
|
"createdAt",
|
|
392
391
|
"updatedAt",
|
|
@@ -413,23 +412,23 @@ function validateWorkItemExecutionLane(lane, groupId, ordinal) {
|
|
|
413
412
|
requireText(lane.workspace.root, "ExecutionLane workspace root");
|
|
414
413
|
normalizedUniqueIdentities(lane.workspace.writableProjectIds, "ExecutionLane writable Project");
|
|
415
414
|
}
|
|
416
|
-
if (lane.
|
|
415
|
+
if (lane.currentRunId !== undefined && lane.effective === undefined) {
|
|
417
416
|
throw new Error("A dispatched ExecutionLane requires launch facts.");
|
|
418
417
|
}
|
|
419
|
-
if (lane.
|
|
420
|
-
requireIdentity(lane.
|
|
421
|
-
if (lane.
|
|
422
|
-
requireIdentity(lane.
|
|
418
|
+
if (lane.currentRunId !== undefined)
|
|
419
|
+
requireIdentity(lane.currentRunId, "ExecutionLane current AgentRun id");
|
|
420
|
+
if (lane.successfulRunId !== undefined)
|
|
421
|
+
requireIdentity(lane.successfulRunId, "ExecutionLane successful AgentRun id");
|
|
423
422
|
if (!["open", "succeeded", "failed"].includes(lane.disposition)) {
|
|
424
423
|
throw new Error(`ExecutionLane disposition is invalid: ${String(lane.disposition)}.`);
|
|
425
424
|
}
|
|
426
425
|
if (lane.disposition === "succeeded") {
|
|
427
|
-
if (lane.
|
|
428
|
-
throw new Error("A succeeded Lane must identify its current successful
|
|
426
|
+
if (lane.currentRunId === undefined || lane.successfulRunId !== lane.currentRunId) {
|
|
427
|
+
throw new Error("A succeeded Lane must identify its current successful AgentRun.");
|
|
429
428
|
}
|
|
430
429
|
}
|
|
431
|
-
else if (lane.
|
|
432
|
-
throw new Error("Only a succeeded Lane may identify a successful
|
|
430
|
+
else if (lane.successfulRunId !== undefined) {
|
|
431
|
+
throw new Error("Only a succeeded Lane may identify a successful AgentRun.");
|
|
433
432
|
}
|
|
434
433
|
requireTimestamp(lane.createdAt, "ExecutionLane createdAt");
|
|
435
434
|
requireTimestamp(lane.updatedAt, "ExecutionLane updatedAt");
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { governingWorkItemCandidate, currentWorkItemExecutionGroup } from "../workItem/workItem.js";
|
|
2
|
-
import {
|
|
3
|
-
export function projectWorkItemExecution(item,
|
|
2
|
+
import { synthesisSourceRunIds } from "../context/runContextPack.js";
|
|
3
|
+
export function projectWorkItemExecution(item, runs, sessionSets = [], sourceStore) {
|
|
4
4
|
const group = currentWorkItemExecutionGroup(item);
|
|
5
|
-
const
|
|
5
|
+
const relevantRuns = runs.filter((run) => run.workItemId === item.id);
|
|
6
6
|
const sessionsByRole = new Map(sessionSets.map((set) => [set.owner.roleName, set]));
|
|
7
7
|
const lanes = group === undefined
|
|
8
8
|
? []
|
|
9
9
|
: [...group.lanes]
|
|
10
10
|
.sort((left, right) => left.ordinal - right.ordinal || left.id.localeCompare(right.id))
|
|
11
|
-
.map((lane) => projectLane(item, group, lane,
|
|
11
|
+
.map((lane) => projectLane(item, group, lane, relevantRuns, sessionsByRole));
|
|
12
12
|
const laneCounts = Object.freeze({
|
|
13
13
|
running: lanes.filter(({ status }) => status === "running").length,
|
|
14
14
|
succeeded: lanes.filter(({ status }) => status === "succeeded").length,
|
|
@@ -16,9 +16,9 @@ export function projectWorkItemExecution(item, turns, sessionSets = []) {
|
|
|
16
16
|
failed: lanes.filter(({ status }) => status === "failed").length,
|
|
17
17
|
unknown: lanes.filter(({ status }) => status === "unknown").length
|
|
18
18
|
});
|
|
19
|
-
const
|
|
20
|
-
const synthesis = projectSynthesis(group, lanes,
|
|
21
|
-
const candidate = projectCandidate(item, group,
|
|
19
|
+
const mainRun = projectMainRun(item, group, relevantRuns, sessionsByRole);
|
|
20
|
+
const synthesis = projectSynthesis(group, lanes, mainRun);
|
|
21
|
+
const candidate = projectCandidate(item, group, relevantRuns, mainRun, sourceStore);
|
|
22
22
|
return Object.freeze({
|
|
23
23
|
schemaVersion: 1,
|
|
24
24
|
shape: group === undefined ? "direct" : "replicated",
|
|
@@ -26,15 +26,15 @@ export function projectWorkItemExecution(item, turns, sessionSets = []) {
|
|
|
26
26
|
lanes: Object.freeze(lanes),
|
|
27
27
|
laneCounts,
|
|
28
28
|
synthesis,
|
|
29
|
-
|
|
29
|
+
mainRun,
|
|
30
30
|
candidate,
|
|
31
|
-
nextAction: projectNextAction(item, lanes, synthesis,
|
|
31
|
+
nextAction: projectNextAction(item, lanes, synthesis, mainRun, candidate)
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
function projectLane(item, group, lane,
|
|
35
|
-
const current = lane.
|
|
34
|
+
function projectLane(item, group, lane, runs, sessionsByRole) {
|
|
35
|
+
const current = lane.currentRunId === undefined
|
|
36
36
|
? undefined
|
|
37
|
-
:
|
|
37
|
+
: runs.find(({ id }) => id === lane.currentRunId);
|
|
38
38
|
const exact = current !== undefined
|
|
39
39
|
&& current.taskId === item.taskId
|
|
40
40
|
&& current.workItemId === item.id
|
|
@@ -42,7 +42,7 @@ function projectLane(item, group, lane, turns, sessionsByRole) {
|
|
|
42
42
|
&& current.executionLaneId === lane.id
|
|
43
43
|
&& current.roleName === lane.roleName;
|
|
44
44
|
const session = exact
|
|
45
|
-
?
|
|
45
|
+
? runSessionStatus(current, sessionsByRole.get(lane.roleName))
|
|
46
46
|
: "unobserved";
|
|
47
47
|
if (lane.disposition === "failed") {
|
|
48
48
|
return Object.freeze({
|
|
@@ -50,14 +50,14 @@ function projectLane(item, group, lane, turns, sessionsByRole) {
|
|
|
50
50
|
ordinal: lane.ordinal,
|
|
51
51
|
roleName: lane.roleName,
|
|
52
52
|
status: "failed",
|
|
53
|
-
...(lane.
|
|
53
|
+
...(lane.currentRunId === undefined ? {} : { currentRunId: lane.currentRunId }),
|
|
54
54
|
session,
|
|
55
55
|
observation: exact ? "observed" : "unobserved"
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
if (lane.disposition === "succeeded") {
|
|
59
59
|
const producerObserved = exact
|
|
60
|
-
&& lane.
|
|
60
|
+
&& lane.successfulRunId === current.id
|
|
61
61
|
&& current.status === "completed"
|
|
62
62
|
&& current.result !== undefined;
|
|
63
63
|
return Object.freeze({
|
|
@@ -65,8 +65,8 @@ function projectLane(item, group, lane, turns, sessionsByRole) {
|
|
|
65
65
|
ordinal: lane.ordinal,
|
|
66
66
|
roleName: lane.roleName,
|
|
67
67
|
status: producerObserved ? "succeeded" : "unknown",
|
|
68
|
-
...(lane.
|
|
69
|
-
...(lane.
|
|
68
|
+
...(lane.currentRunId === undefined ? {} : { currentRunId: lane.currentRunId }),
|
|
69
|
+
...(lane.successfulRunId === undefined ? {} : { successfulRunId: lane.successfulRunId }),
|
|
70
70
|
session,
|
|
71
71
|
observation: producerObserved ? "observed" : "unobserved"
|
|
72
72
|
});
|
|
@@ -77,7 +77,7 @@ function projectLane(item, group, lane, turns, sessionsByRole) {
|
|
|
77
77
|
ordinal: lane.ordinal,
|
|
78
78
|
roleName: lane.roleName,
|
|
79
79
|
status: "unknown",
|
|
80
|
-
...(lane.
|
|
80
|
+
...(lane.currentRunId === undefined ? {} : { currentRunId: lane.currentRunId }),
|
|
81
81
|
session: "unobserved",
|
|
82
82
|
observation: "unobserved"
|
|
83
83
|
});
|
|
@@ -88,10 +88,10 @@ function projectLane(item, group, lane, turns, sessionsByRole) {
|
|
|
88
88
|
ordinal: lane.ordinal,
|
|
89
89
|
roleName: lane.roleName,
|
|
90
90
|
status: "needs-attention",
|
|
91
|
-
|
|
91
|
+
currentRunId: current.id,
|
|
92
92
|
session,
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
retryRunId: current.id,
|
|
94
|
+
settleRunId: current.id,
|
|
95
95
|
observation: "observed"
|
|
96
96
|
});
|
|
97
97
|
}
|
|
@@ -101,7 +101,8 @@ function projectLane(item, group, lane, turns, sessionsByRole) {
|
|
|
101
101
|
ordinal: lane.ordinal,
|
|
102
102
|
roleName: lane.roleName,
|
|
103
103
|
status: session === "ended" ? "needs-attention" : "running",
|
|
104
|
-
|
|
104
|
+
currentRunId: current.id,
|
|
105
|
+
delivery: observedAdmission(current, sessionsByRole.get(lane.roleName)),
|
|
105
106
|
session,
|
|
106
107
|
observation: "observed"
|
|
107
108
|
});
|
|
@@ -111,19 +112,19 @@ function projectLane(item, group, lane, turns, sessionsByRole) {
|
|
|
111
112
|
ordinal: lane.ordinal,
|
|
112
113
|
roleName: lane.roleName,
|
|
113
114
|
status: "unknown",
|
|
114
|
-
|
|
115
|
+
currentRunId: current.id,
|
|
115
116
|
session,
|
|
116
117
|
observation: "unobserved"
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
|
-
function
|
|
120
|
-
const candidates =
|
|
121
|
-
&&
|
|
122
|
-
&&
|
|
123
|
-
&&
|
|
124
|
-
&&
|
|
125
|
-
const
|
|
126
|
-
if (
|
|
120
|
+
function projectMainRun(item, group, runs, sessionsByRole) {
|
|
121
|
+
const candidates = runs.filter((run) => (run.purpose === "execution"
|
|
122
|
+
&& run.roleName === item.assignee
|
|
123
|
+
&& run.executionGroupId === undefined
|
|
124
|
+
&& run.executionLaneId === undefined
|
|
125
|
+
&& run.sourceExecutionGroupId === group?.id)).sort(compareRuns);
|
|
126
|
+
const run = candidates.at(-1);
|
|
127
|
+
if (run === undefined) {
|
|
127
128
|
return Object.freeze({
|
|
128
129
|
status: "not-started",
|
|
129
130
|
...(item.assignee === undefined ? {} : { roleName: item.assignee }),
|
|
@@ -132,65 +133,56 @@ function projectMainTurn(item, group, turns, sessionsByRole) {
|
|
|
132
133
|
observation: "unobserved"
|
|
133
134
|
});
|
|
134
135
|
}
|
|
135
|
-
const session =
|
|
136
|
+
const session = runSessionStatus(run, sessionsByRole.get(run.roleName));
|
|
136
137
|
const base = {
|
|
137
|
-
roleName:
|
|
138
|
-
|
|
139
|
-
...(
|
|
138
|
+
roleName: run.roleName,
|
|
139
|
+
runId: run.id,
|
|
140
|
+
...(run.sourceExecutionGroupId === undefined
|
|
140
141
|
? {}
|
|
141
|
-
: { sourceExecutionGroupId:
|
|
142
|
+
: { sourceExecutionGroupId: run.sourceExecutionGroupId }),
|
|
142
143
|
session
|
|
143
144
|
};
|
|
144
|
-
if (
|
|
145
|
+
if (run.status === "failed") {
|
|
145
146
|
return Object.freeze({
|
|
146
147
|
...base,
|
|
147
148
|
status: "needs-attention",
|
|
148
|
-
|
|
149
|
+
retryRunId: run.id,
|
|
149
150
|
observation: "observed"
|
|
150
151
|
});
|
|
151
152
|
}
|
|
152
|
-
if (
|
|
153
|
+
if (run.status === "active") {
|
|
153
154
|
return Object.freeze({
|
|
154
155
|
...base,
|
|
156
|
+
delivery: observedAdmission(run, sessionsByRole.get(run.roleName)),
|
|
155
157
|
status: session === "ended" ? "needs-attention" : "running",
|
|
156
158
|
observation: "observed"
|
|
157
159
|
});
|
|
158
160
|
}
|
|
159
161
|
return Object.freeze({
|
|
160
162
|
...base,
|
|
161
|
-
status:
|
|
162
|
-
observation:
|
|
163
|
+
status: run.result === undefined ? "unknown" : "succeeded",
|
|
164
|
+
observation: run.result === undefined ? "unobserved" : "observed"
|
|
163
165
|
});
|
|
164
166
|
}
|
|
165
|
-
function projectSynthesis(group, lanes,
|
|
167
|
+
function projectSynthesis(group, lanes, mainRun) {
|
|
166
168
|
if (group === undefined) {
|
|
167
169
|
return Object.freeze({
|
|
168
170
|
status: "not-applicable",
|
|
169
|
-
successfulLaneCount: 0
|
|
170
|
-
requiredSuccessfulLaneCount: MINIMUM_WORK_ITEM_SYNTHESIS_RESULTS
|
|
171
|
+
successfulLaneCount: 0
|
|
171
172
|
});
|
|
172
173
|
}
|
|
173
174
|
const successfulLaneCount = group.lanes.filter(({ disposition }) => disposition === "succeeded").length;
|
|
174
175
|
let status;
|
|
175
|
-
if (
|
|
176
|
-
status = "
|
|
176
|
+
if (mainRun.status === "not-started") {
|
|
177
|
+
status = "awaiting-selection";
|
|
177
178
|
}
|
|
178
|
-
else if (
|
|
179
|
-
status = "unknown";
|
|
180
|
-
}
|
|
181
|
-
else if (successfulLaneCount < MINIMUM_WORK_ITEM_SYNTHESIS_RESULTS) {
|
|
182
|
-
status = "insufficient-results";
|
|
183
|
-
}
|
|
184
|
-
else if (mainTurn.status === "not-started") {
|
|
185
|
-
status = "eligible";
|
|
186
|
-
}
|
|
187
|
-
else if (mainTurn.status === "running") {
|
|
179
|
+
else if (mainRun.status === "running") {
|
|
188
180
|
status = "main-running";
|
|
189
181
|
}
|
|
190
|
-
else if (
|
|
182
|
+
else if (mainRun.status === "needs-attention") {
|
|
191
183
|
status = "main-needs-attention";
|
|
192
184
|
}
|
|
193
|
-
else if (
|
|
185
|
+
else if (mainRun.status === "succeeded") {
|
|
194
186
|
status = "complete";
|
|
195
187
|
}
|
|
196
188
|
else {
|
|
@@ -198,16 +190,15 @@ function projectSynthesis(group, lanes, mainTurn) {
|
|
|
198
190
|
}
|
|
199
191
|
return Object.freeze({
|
|
200
192
|
status,
|
|
201
|
-
successfulLaneCount
|
|
202
|
-
requiredSuccessfulLaneCount: MINIMUM_WORK_ITEM_SYNTHESIS_RESULTS
|
|
193
|
+
successfulLaneCount
|
|
203
194
|
});
|
|
204
195
|
}
|
|
205
|
-
function projectCandidate(item, group,
|
|
196
|
+
function projectCandidate(item, group, runs, mainRun, sourceStore) {
|
|
206
197
|
const candidate = governingWorkItemCandidate(item);
|
|
207
198
|
if (candidate === undefined) {
|
|
208
199
|
return Object.freeze({
|
|
209
200
|
status: "none",
|
|
210
|
-
|
|
201
|
+
successfulLaneRuns: Object.freeze([]),
|
|
211
202
|
observation: "observed"
|
|
212
203
|
});
|
|
213
204
|
}
|
|
@@ -215,43 +206,43 @@ function projectCandidate(item, group, turns, lanes, mainTurn) {
|
|
|
215
206
|
const valid = group === undefined && item.assignee === undefined;
|
|
216
207
|
return candidateProjection(candidate, valid ? "observed" : "unknown", [], valid);
|
|
217
208
|
}
|
|
218
|
-
const
|
|
219
|
-
const
|
|
220
|
-
const
|
|
209
|
+
const sourceRunId = candidate.source.runId;
|
|
210
|
+
const sourceRun = runs.find(({ id }) => id === sourceRunId);
|
|
211
|
+
const laneRuns = group === undefined || sourceStore === undefined || sourceRun === undefined
|
|
221
212
|
? []
|
|
222
|
-
:
|
|
223
|
-
.
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
&&
|
|
230
|
-
&&
|
|
231
|
-
&&
|
|
232
|
-
&&
|
|
213
|
+
: synthesisSourceRunIds(sourceStore, sourceRun).flatMap((id) => {
|
|
214
|
+
const selected = runs.find((run) => run.id === id);
|
|
215
|
+
return selected?.executionLaneId === undefined ? [] : [{
|
|
216
|
+
laneId: selected.executionLaneId, successfulRunId: selected.id
|
|
217
|
+
}];
|
|
218
|
+
});
|
|
219
|
+
const valid = sourceRun !== undefined
|
|
220
|
+
&& sourceRun.id === mainRun.runId
|
|
221
|
+
&& sourceRun.status === "completed"
|
|
222
|
+
&& sourceRun.result !== undefined
|
|
223
|
+
&& sourceRun.executionGroupId === undefined
|
|
224
|
+
&& sourceRun.executionLaneId === undefined
|
|
225
|
+
&& sourceRun.sourceExecutionGroupId === group?.id
|
|
233
226
|
&& candidate.executionLaneId === undefined
|
|
234
227
|
&& candidate.executionGroupId === undefined
|
|
235
|
-
&& (group === undefined ||
|
|
236
|
-
|
|
237
|
-
.every(({ status }) => status === "succeeded")));
|
|
238
|
-
return candidateProjection(candidate, valid ? "observed" : "unknown", laneTurns, valid, group?.id);
|
|
228
|
+
&& (group === undefined || laneRuns.length > 0);
|
|
229
|
+
return candidateProjection(candidate, valid ? "observed" : "unknown", laneRuns, valid, group?.id);
|
|
239
230
|
}
|
|
240
|
-
function candidateProjection(candidate, status,
|
|
231
|
+
function candidateProjection(candidate, status, successfulLaneRuns, observed, sourceExecutionGroupId) {
|
|
241
232
|
return Object.freeze({
|
|
242
233
|
status,
|
|
243
234
|
candidateId: candidate.id,
|
|
244
235
|
sourceType: candidate.source.type,
|
|
245
|
-
...(candidate.source.type === "
|
|
236
|
+
...(candidate.source.type === "run" ? { mainRunId: candidate.source.runId } : {}),
|
|
246
237
|
...(sourceExecutionGroupId === undefined ? {} : { sourceExecutionGroupId }),
|
|
247
|
-
|
|
238
|
+
successfulLaneRuns: Object.freeze(successfulLaneRuns),
|
|
248
239
|
observation: observed ? "observed" : "unobserved"
|
|
249
240
|
});
|
|
250
241
|
}
|
|
251
|
-
function projectNextAction(item, lanes, synthesis,
|
|
252
|
-
if (["
|
|
242
|
+
function projectNextAction(item, lanes, synthesis, mainRun, candidate) {
|
|
243
|
+
if (["accepted", "retired"].includes(item.status))
|
|
253
244
|
return action("none", [], []);
|
|
254
|
-
if (item.status === "
|
|
245
|
+
if ((item.status === "open" && item.currentCandidateId !== undefined)) {
|
|
255
246
|
return candidate.status === "observed"
|
|
256
247
|
? action("decide-candidate", ["leader"], [candidate.candidateId])
|
|
257
248
|
: action("inspect-unknown", ["leader"], candidate.candidateId === undefined ? [] : [candidate.candidateId]);
|
|
@@ -261,35 +252,32 @@ function projectNextAction(item, lanes, synthesis, mainTurn, candidate) {
|
|
|
261
252
|
.filter(({ status }) => status === "unknown")
|
|
262
253
|
.map(({ laneId }) => laneId));
|
|
263
254
|
}
|
|
264
|
-
const recoveries = lanes.filter(({
|
|
255
|
+
const recoveries = lanes.filter(({ retryRunId }) => retryRunId !== undefined);
|
|
265
256
|
if (recoveries.length > 0) {
|
|
266
|
-
return action("retry-or-settle-lanes", ["leader"], recoveries.map(({
|
|
257
|
+
return action("retry-or-settle-lanes", ["leader"], recoveries.map(({ retryRunId }) => retryRunId));
|
|
267
258
|
}
|
|
268
259
|
const activeLanes = lanes.filter(({ status }) => status === "running");
|
|
269
260
|
if (activeLanes.length > 0) {
|
|
270
261
|
return action("wait-for-lanes", activeLanes.map(({ roleName }) => roleName), activeLanes.map(({ laneId }) => laneId));
|
|
271
262
|
}
|
|
272
|
-
if (synthesis.status === "
|
|
273
|
-
return action("
|
|
263
|
+
if (synthesis.status === "awaiting-selection") {
|
|
264
|
+
return action("select-synthesis-sources", ["leader"], [item.id]);
|
|
274
265
|
}
|
|
275
|
-
if (
|
|
276
|
-
return action("
|
|
266
|
+
if (mainRun.status === "running") {
|
|
267
|
+
return action("wait-for-main", mainRun.roleName === undefined ? [] : [mainRun.roleName], mainRun.runId === undefined ? [] : [mainRun.runId]);
|
|
277
268
|
}
|
|
278
|
-
if (
|
|
279
|
-
return
|
|
269
|
+
if (mainRun.status === "needs-attention") {
|
|
270
|
+
return mainRun.retryRunId === undefined
|
|
271
|
+
? action("inspect-unknown", ["leader"], mainRun.runId === undefined ? [] : [mainRun.runId])
|
|
272
|
+
: action("retry-main", ["leader"], [mainRun.retryRunId]);
|
|
280
273
|
}
|
|
281
|
-
if (
|
|
282
|
-
return
|
|
283
|
-
? action("inspect-unknown", ["leader"], mainTurn.turnId === undefined ? [] : [mainTurn.turnId])
|
|
284
|
-
: action("retry-main", ["leader"], [mainTurn.retryTurnId]);
|
|
274
|
+
if (mainRun.status === "succeeded" && item.status === "open") {
|
|
275
|
+
return action("submit-candidate", ["leader"], [mainRun.runId]);
|
|
285
276
|
}
|
|
286
|
-
if (
|
|
287
|
-
return action("
|
|
277
|
+
if (mainRun.status === "unknown" || synthesis.status === "unknown") {
|
|
278
|
+
return action("inspect-unknown", ["leader"], mainRun.runId === undefined ? [item.id] : [mainRun.runId]);
|
|
288
279
|
}
|
|
289
|
-
if (
|
|
290
|
-
return action("inspect-unknown", ["leader"], mainTurn.turnId === undefined ? [item.id] : [mainTurn.turnId]);
|
|
291
|
-
}
|
|
292
|
-
if (item.status === "pending" || item.status === "failed") {
|
|
280
|
+
if (item.status === "open") {
|
|
293
281
|
return action("dispatch-work", ["leader"], [item.id]);
|
|
294
282
|
}
|
|
295
283
|
return action("inspect-unknown", ["leader"], [item.id]);
|
|
@@ -301,9 +289,13 @@ function action(kind, owners, targetIds) {
|
|
|
301
289
|
targetIds: Object.freeze([...new Set(targetIds)])
|
|
302
290
|
});
|
|
303
291
|
}
|
|
304
|
-
function
|
|
305
|
-
return set?.sessions[
|
|
292
|
+
function runSessionStatus(run, set) {
|
|
293
|
+
return set?.sessions[run.effective.agentId]?.status ?? "unobserved";
|
|
294
|
+
}
|
|
295
|
+
function observedAdmission(run, sessions) {
|
|
296
|
+
const native = sessions?.providerBinding?.run;
|
|
297
|
+
return native?.runId === run.id ? native.status : "unobserved";
|
|
306
298
|
}
|
|
307
|
-
function
|
|
299
|
+
function compareRuns(left, right) {
|
|
308
300
|
return left.createdAt.localeCompare(right.createdAt) || left.id.localeCompare(right.id);
|
|
309
301
|
}
|