@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
package/dist/web/webSnapshot.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isRoleRunStalled, latestRunDurableProgressAt } from "../scheduler/roleRunStall.js";
|
|
2
2
|
import { retiredTaskRecordIds } from "../task/taskRecordRetirement.js";
|
|
3
3
|
import { buildTaskExecutionProjection } from "../scheduler/taskExecutionProjection.js";
|
|
4
4
|
import { projectWorkItemExecution } from "../execution/workItemExecutionProjection.js";
|
|
5
5
|
import { classifyRuntimeHealth, projectRuntimeTaskEvents } from "../runtime/runtimeProjection.js";
|
|
6
6
|
import { builtinDriverIdForAdapter } from "../runtime/builtinAgentDrivers.js";
|
|
7
|
-
import {
|
|
7
|
+
import { formatRunReceiptId } from "../task/taskRecordReference.js";
|
|
8
|
+
import { runExecutionObservation } from "../agentRun/agentRun.js";
|
|
8
9
|
import { resolveRuntimeHealth } from "../config/yuiConfig.js";
|
|
9
10
|
import { projectSessionTokenMetrics, resolveSessionTokenIdentity } from "../runtime/sessionTokenMetrics.js";
|
|
10
11
|
import { projectTaskRemoteDelivery } from "../task/remoteDelivery.js";
|
|
@@ -14,7 +15,7 @@ export function buildWebDashboardSnapshot(store, now = new Date()) {
|
|
|
14
15
|
draft: 0,
|
|
15
16
|
active: 0,
|
|
16
17
|
completed: 0,
|
|
17
|
-
|
|
18
|
+
cancelled: 0,
|
|
18
19
|
archived: 0
|
|
19
20
|
};
|
|
20
21
|
const projectNames = new Map(reader.listProjects().map((project) => [project.id, project.name]));
|
|
@@ -31,8 +32,8 @@ export function buildWebDashboardSnapshot(store, now = new Date()) {
|
|
|
31
32
|
attention.push({ taskId: task.id, taskTitle: task.title, request });
|
|
32
33
|
}
|
|
33
34
|
const events = reader.listEvents?.(task.id) ?? [];
|
|
34
|
-
const needsAttentionCount = reader.
|
|
35
|
-
.filter((
|
|
35
|
+
const needsAttentionCount = reader.listRuns(task.id)
|
|
36
|
+
.filter((run) => run.status === "active" && isRoleRunStalled(events, run.id))
|
|
36
37
|
.length;
|
|
37
38
|
const execution = buildTaskExecutionProjection(reader, task.id, task, now);
|
|
38
39
|
const names = task.projectBindings.flatMap(({ projectId }) => {
|
|
@@ -69,41 +70,51 @@ export function buildWebTaskDetail(store, taskId, now = new Date()) {
|
|
|
69
70
|
const name = projectNamesById.get(projectId);
|
|
70
71
|
return name === undefined ? [] : [name];
|
|
71
72
|
});
|
|
72
|
-
const
|
|
73
|
+
const runs = reader.listRuns(taskId);
|
|
73
74
|
const events = reader.listEvents?.(taskId) ?? [];
|
|
74
75
|
const retiredMessageIds = retiredTaskRecordIds(events, "message");
|
|
75
|
-
const
|
|
76
|
-
.filter((
|
|
77
|
-
.map((
|
|
78
|
-
|
|
79
|
-
roleName:
|
|
80
|
-
progressAt: latestStallProgress(events,
|
|
81
|
-
kind: latestStallField(events,
|
|
82
|
-
classification: latestStallField(events,
|
|
76
|
+
const needsAttentionRuns = runs
|
|
77
|
+
.filter((run) => run.status === "active" && isRoleRunStalled(events, run.id))
|
|
78
|
+
.map((run) => ({
|
|
79
|
+
runId: run.id,
|
|
80
|
+
roleName: run.roleName,
|
|
81
|
+
progressAt: latestStallProgress(events, run.id),
|
|
82
|
+
kind: latestStallField(events, run.id, "kind") ?? "workflow-not-progressing",
|
|
83
|
+
classification: latestStallField(events, run.id, "classification") ?? "truly-stalled"
|
|
83
84
|
}));
|
|
84
|
-
const
|
|
85
|
-
.filter((
|
|
86
|
-
.map((
|
|
87
|
-
const
|
|
88
|
-
.filter((
|
|
89
|
-
.map((
|
|
85
|
+
const activeRuns = new Map(runs
|
|
86
|
+
.filter((run) => run.status === "active")
|
|
87
|
+
.map((run) => [run.roleName, run]));
|
|
88
|
+
const activeRunHealth = runs
|
|
89
|
+
.filter((run) => run.status === "active")
|
|
90
|
+
.map((run) => projectWebRunRuntimeHealth(reader, taskId, run, events, now, resolveRuntimeHealth(reader.getConfig().runtimeHealth)));
|
|
90
91
|
const roles = reader.listRoles(taskId).map((role) => {
|
|
91
|
-
const
|
|
92
|
+
const activeRun = activeRuns.get(role.name);
|
|
92
93
|
const sessions = reader.getTaskRoleSessionSet(taskId, role.name);
|
|
93
|
-
const activeSession = sessions?.sessions[sessions.activeAgentId];
|
|
94
|
-
const effectiveLaunch =
|
|
94
|
+
const activeSession = sessions?.sessions[activeRun?.effective.agentId ?? sessions.activeAgentId];
|
|
95
|
+
const effectiveLaunch = activeRun?.effective ?? activeSession?.effective ?? null;
|
|
96
|
+
const delivery = sessions?.providerBinding?.run?.status;
|
|
95
97
|
return {
|
|
96
98
|
...role,
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
// An open record is not proof that its Agent is running.
|
|
100
|
+
status: delivery === "accepted" ? "running"
|
|
101
|
+
: delivery === "submitting" || delivery === "deferred" ? "waiting"
|
|
102
|
+
: activeSession === undefined && activeRun === undefined ? "idle" : "unknown",
|
|
100
103
|
sessionTokens: projectSessionTokenMetrics(events, resolveSessionTokenIdentity(activeSession === undefined
|
|
101
104
|
? null
|
|
102
105
|
: { taskId, roleName: role.name, ...activeSession })),
|
|
103
106
|
effectiveLaunch,
|
|
104
|
-
|
|
107
|
+
observedAt: now.toISOString(),
|
|
108
|
+
runtimeSession: activeSession === undefined ? null : {
|
|
109
|
+
agentId: activeSession.agentId,
|
|
110
|
+
adapterId: activeSession.adapterId,
|
|
111
|
+
nativeSessionId: activeSession.nativeSessionId ?? null,
|
|
112
|
+
status: activeSession.status,
|
|
113
|
+
endpointImplementation: activeSession.endpointImplementation ?? null
|
|
114
|
+
},
|
|
115
|
+
effectiveLaunchSource: activeRun === undefined
|
|
105
116
|
? activeSession === undefined ? null : "session"
|
|
106
|
-
: "
|
|
117
|
+
: "run",
|
|
107
118
|
launchDrift: effectiveLaunch !== null
|
|
108
119
|
&& effectiveLaunch.sourceDesiredRevision !== role.launchRevision
|
|
109
120
|
};
|
|
@@ -128,10 +139,10 @@ export function buildWebTaskDetail(store, taskId, now = new Date()) {
|
|
|
128
139
|
workItems: workItems.map((item) => ({
|
|
129
140
|
...item,
|
|
130
141
|
observability: workItemObservability.get(item.id),
|
|
131
|
-
execution: projectWorkItemExecution(item,
|
|
142
|
+
execution: projectWorkItemExecution(item, runs, roleSessionSets, reader)
|
|
132
143
|
})),
|
|
133
|
-
|
|
134
|
-
runtimeHealth: {
|
|
144
|
+
runs: runs.map((run) => ({ ...run, execution: runExecutionObservation(run, reader.getTaskRoleSessionSet(taskId, run.roleName)?.providerBinding, events) })),
|
|
145
|
+
runtimeHealth: { needsAttentionRuns, activeRuns: activeRunHealth },
|
|
135
146
|
reviewRounds: reader.listReviewRounds(taskId),
|
|
136
147
|
openInputs: inputs.filter((request) => request.status === "open"),
|
|
137
148
|
messages: reader.listMessages(taskId).map((message) => ({
|
|
@@ -149,69 +160,68 @@ function webRemoteDelivery(reader, task) {
|
|
|
149
160
|
events: reader.listEvents?.(task.id) ?? [],
|
|
150
161
|
publications: reader.listPublicationReferences(task.id),
|
|
151
162
|
managedWorkspaces: reader.listManagedWorkspaces(task.id),
|
|
152
|
-
|
|
163
|
+
runs: reader.listRuns(task.id),
|
|
153
164
|
currentCandidate: null
|
|
154
165
|
});
|
|
155
166
|
}
|
|
156
|
-
function latestStallProgress(events,
|
|
157
|
-
return latestStallField(events,
|
|
167
|
+
function latestStallProgress(events, runId) {
|
|
168
|
+
return latestStallField(events, runId, "progressAt");
|
|
158
169
|
}
|
|
159
170
|
/**
|
|
160
|
-
* Layered runtime health for one active
|
|
171
|
+
* Layered runtime health for one active AgentRun, computed from the same stored
|
|
161
172
|
* observations and durable semantic fold as the CLI status projection. The
|
|
162
173
|
* Web snapshot has no live tmux pane, so host state stays "unknown"; the
|
|
163
174
|
* classifier still surfaces session/turn/operation/observer layers and the
|
|
164
175
|
* scheduler's durable `turn.stalled` episode is surfaced as
|
|
165
176
|
* `stalled-candidate`.
|
|
166
177
|
*/
|
|
167
|
-
function
|
|
168
|
-
const stalled =
|
|
169
|
-
const sessions = reader.getTaskRoleSessionSet(taskId,
|
|
170
|
-
const session = sessions?.sessions[
|
|
171
|
-
const stallReason = "the live active
|
|
172
|
-
if (session?.
|
|
178
|
+
function projectWebRunRuntimeHealth(reader, taskId, run, events, now, policy) {
|
|
179
|
+
const stalled = isRoleRunStalled(events, run.id);
|
|
180
|
+
const sessions = reader.getTaskRoleSessionSet(taskId, run.roleName);
|
|
181
|
+
const session = sessions?.sessions[run.effective.agentId];
|
|
182
|
+
const stallReason = "the live active AgentRun has no durable progress in the configured stall window";
|
|
183
|
+
if (session?.nativeSessionId === undefined) {
|
|
173
184
|
return {
|
|
174
|
-
|
|
175
|
-
roleName:
|
|
185
|
+
runId: run.id,
|
|
186
|
+
roleName: run.roleName,
|
|
176
187
|
layer: stalled ? "stalled-candidate" : "awaiting-provider-acceptance",
|
|
177
|
-
reason: stalled ? stallReason : "the active
|
|
188
|
+
reason: stalled ? stallReason : "the active AgentRun is awaiting a Provider Session",
|
|
178
189
|
stalled,
|
|
179
|
-
lastSemanticProgressAt:
|
|
190
|
+
lastSemanticProgressAt: run.createdAt
|
|
180
191
|
};
|
|
181
192
|
}
|
|
182
193
|
let driverId;
|
|
183
194
|
try {
|
|
184
|
-
driverId = builtinDriverIdForAdapter(
|
|
195
|
+
driverId = builtinDriverIdForAdapter(run.effective.adapterId);
|
|
185
196
|
}
|
|
186
197
|
catch {
|
|
187
198
|
return {
|
|
188
|
-
|
|
189
|
-
roleName:
|
|
199
|
+
runId: run.id,
|
|
200
|
+
roleName: run.roleName,
|
|
190
201
|
layer: stalled ? "stalled-candidate" : "runtime-unobservable",
|
|
191
202
|
reason: stalled ? stallReason : "the Agent Driver is not a built-in driver",
|
|
192
203
|
stalled,
|
|
193
|
-
lastSemanticProgressAt:
|
|
204
|
+
lastSemanticProgressAt: run.createdAt
|
|
194
205
|
};
|
|
195
206
|
}
|
|
196
|
-
const providerTurn = sessions?.providerBinding?.
|
|
207
|
+
const providerTurn = sessions?.providerBinding?.run;
|
|
197
208
|
const fence = {
|
|
198
209
|
taskId,
|
|
199
|
-
roleName:
|
|
200
|
-
|
|
201
|
-
agentId:
|
|
210
|
+
roleName: run.roleName,
|
|
211
|
+
runId: run.id,
|
|
212
|
+
agentId: run.effective.agentId,
|
|
202
213
|
driverId,
|
|
203
|
-
runtimeGenerationId: session.runtimeGenerationId,
|
|
204
214
|
nativeSessionId: session.nativeSessionId,
|
|
205
|
-
nativeTurnId: providerTurn?.
|
|
206
|
-
? providerTurn.nativeTurnId ??
|
|
207
|
-
:
|
|
208
|
-
receiptId: providerTurn?.
|
|
215
|
+
nativeTurnId: providerTurn?.runId === run.id
|
|
216
|
+
? providerTurn.nativeTurnId ?? run.id
|
|
217
|
+
: run.id,
|
|
218
|
+
receiptId: providerTurn?.runId === run.id
|
|
209
219
|
? providerTurn.attemptId
|
|
210
|
-
:
|
|
220
|
+
: formatRunReceiptId(taskId, run.id)
|
|
211
221
|
};
|
|
212
|
-
const projection = projectRuntimeTaskEvents(fence,
|
|
222
|
+
const projection = projectRuntimeTaskEvents(fence, run.createdAt, events);
|
|
213
223
|
const view = {
|
|
214
|
-
|
|
224
|
+
getRun: (taskId, runId) => reader.listRuns(taskId).find((candidate) => candidate.id === runId) ?? null,
|
|
215
225
|
listEvents: () => events,
|
|
216
226
|
getWorkItem: (workItemTaskId, workItemId) => reader.listWorkItems(workItemTaskId).find((item) => item.id === workItemId) ?? null,
|
|
217
227
|
listReviewRounds: (taskId) => reader.listReviewRounds(taskId),
|
|
@@ -219,8 +229,8 @@ function projectWebTurnRuntimeHealth(reader, taskId, turn, events, now, policy)
|
|
|
219
229
|
listIntegrationAttempts: (taskId) => reader.listIntegrationAttempts(taskId),
|
|
220
230
|
listInputRequests: (taskId) => reader.listInputRequests(taskId)
|
|
221
231
|
};
|
|
222
|
-
const semanticProgress =
|
|
223
|
-
?? { progressAt:
|
|
232
|
+
const semanticProgress = latestRunDurableProgressAt(view, taskId, run.roleName, run.id)
|
|
233
|
+
?? { progressAt: run.createdAt };
|
|
224
234
|
const classification = classifyRuntimeHealth({
|
|
225
235
|
projection,
|
|
226
236
|
semanticProgressAt: semanticProgress.progressAt,
|
|
@@ -228,8 +238,8 @@ function projectWebTurnRuntimeHealth(reader, taskId, turn, events, now, policy)
|
|
|
228
238
|
policy
|
|
229
239
|
});
|
|
230
240
|
return {
|
|
231
|
-
|
|
232
|
-
roleName:
|
|
241
|
+
runId: run.id,
|
|
242
|
+
roleName: run.roleName,
|
|
233
243
|
layer: stalled ? "stalled-candidate" : classification.layer,
|
|
234
244
|
reason: stalled ? stallReason : classification.reason,
|
|
235
245
|
stalled,
|
|
@@ -239,10 +249,10 @@ function projectWebTurnRuntimeHealth(reader, taskId, turn, events, now, policy)
|
|
|
239
249
|
lastSemanticProgressAt: classification.lastSemanticProgressAt
|
|
240
250
|
};
|
|
241
251
|
}
|
|
242
|
-
function latestStallField(events,
|
|
252
|
+
function latestStallField(events, runId, field) {
|
|
243
253
|
const stalled = events
|
|
244
|
-
.filter((event) => event.type === "
|
|
245
|
-
&& event.payload.
|
|
254
|
+
.filter((event) => event.type === "run.stalled"
|
|
255
|
+
&& event.payload.runId === runId
|
|
246
256
|
&& event.payload.status !== "diagnostic-only")
|
|
247
257
|
.sort((left, right) => Date.parse(right.createdAt) - Date.parse(left.createdAt))[0];
|
|
248
258
|
return stalled?.payload[field];
|
|
@@ -250,11 +260,8 @@ function latestStallField(events, turnId, field) {
|
|
|
250
260
|
function countWorkItems(items) {
|
|
251
261
|
const counts = {
|
|
252
262
|
total: items.length,
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
awaiting_acceptance: 0,
|
|
256
|
-
completed: 0,
|
|
257
|
-
failed: 0,
|
|
263
|
+
open: 0,
|
|
264
|
+
accepted: 0,
|
|
258
265
|
retired: 0
|
|
259
266
|
};
|
|
260
267
|
const mutable = counts;
|
|
@@ -268,7 +275,7 @@ function compareDashboardTasks(left, right) {
|
|
|
268
275
|
active: 0,
|
|
269
276
|
draft: 1,
|
|
270
277
|
completed: 2,
|
|
271
|
-
|
|
278
|
+
cancelled: 3,
|
|
272
279
|
archived: 4
|
|
273
280
|
};
|
|
274
281
|
return statusOrder[left.status] - statusOrder[right.status]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { readTaskContext, readTaskContextDelta, inspectTaskContext, withContextObservations } from "../context/taskContext.js";
|
|
2
|
+
import { BUILTIN_CAPABILITIES } from "../kernel/builtinCapabilities.js";
|
|
3
|
+
import { capabilitySchemaError } from "../kernel/capabilitySchema.js";
|
|
4
|
+
import { updateTaskMetadataCommand, sendTaskMessageCommand } from "../commands/taskCommands.js";
|
|
5
|
+
import { webLocalMutation, WebRequestRejected } from "./webMutation.js";
|
|
6
|
+
import { runTaskInputCommand } from "../commands/taskInputCommands.js";
|
|
7
|
+
/** Installed only by the local-user Web composition root. HTTP authenticates
|
|
8
|
+
* its token before using this port; input never supplies a caller or Role.
|
|
9
|
+
* Managed capability RPC keeps its own Session authentication unchanged.
|
|
10
|
+
*/
|
|
11
|
+
export function createWebTaskSurface(store, options = {}, observations = []) {
|
|
12
|
+
const environment = {};
|
|
13
|
+
const commandOptions = { ...options, environment, runtime: undefined };
|
|
14
|
+
// Notifications are after the outer transaction. Their failure must not be
|
|
15
|
+
// reclassified as a rejection of a mutation that already committed.
|
|
16
|
+
const notify = (taskId, leader = false) => {
|
|
17
|
+
if (options.runtime?.notifyMailboxChanged) {
|
|
18
|
+
void options.runtime.notifyMailboxChanged(leader
|
|
19
|
+
? { kind: "role", taskId, roleName: "leader" } : { kind: "task", taskId });
|
|
20
|
+
}
|
|
21
|
+
else
|
|
22
|
+
options.runtime?.notifyStateChanged(taskId);
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
message: (taskId, body, intent, requestId) => {
|
|
26
|
+
// With no explicit intent the Web surface submits `discuss` like every other
|
|
27
|
+
// client (§2.5), through the one shared service; the requestId is threaded as
|
|
28
|
+
// the submission key (§2.3) and the structured feedback is returned verbatim.
|
|
29
|
+
const { message, task, queuedForLeader, feedback } = webLocalMutation(store, (tx) => sendTaskMessageCommand(tx, taskId, body, undefined, commandOptions, undefined, intent, requestId));
|
|
30
|
+
notify(taskId, queuedForLeader);
|
|
31
|
+
return { record: message, revision: message.createdAt,
|
|
32
|
+
disposition: queuedForLeader ? "queued" : "saved",
|
|
33
|
+
planning: task.status === "draft",
|
|
34
|
+
...(feedback === undefined ? {} : { submission: feedback }),
|
|
35
|
+
target: { scope: "task", taskId, roleName: "leader" } };
|
|
36
|
+
},
|
|
37
|
+
read: async (taskId) => withContextObservations(readTaskContext(store, taskId, environment), observations),
|
|
38
|
+
delta: (taskId, input) => readTaskContextDelta(store, taskId, input, environment),
|
|
39
|
+
inspect: (taskId, input) => inspectTaskContext(store, taskId, input, environment),
|
|
40
|
+
update: (taskId, input) => {
|
|
41
|
+
const descriptor = BUILTIN_CAPABILITIES.find((entry) => entry.name === "task.update");
|
|
42
|
+
const error = capabilitySchemaError(descriptor.inputSchema, { taskId, patch: input });
|
|
43
|
+
if (error)
|
|
44
|
+
throw new WebRequestRejected(error);
|
|
45
|
+
const patch = input;
|
|
46
|
+
const record = webLocalMutation(store, (tx) => updateTaskMetadataCommand(tx, taskId, {
|
|
47
|
+
...patch,
|
|
48
|
+
...(patch.description === "" ? { description: null } : {}),
|
|
49
|
+
...(patch.tags?.length === 0 ? { tags: null } : {})
|
|
50
|
+
}, commandOptions));
|
|
51
|
+
notify(taskId);
|
|
52
|
+
return { record, revision: record.updatedAt };
|
|
53
|
+
},
|
|
54
|
+
answer: (taskId, inputId, answer) => {
|
|
55
|
+
const result = webLocalMutation(store, (tx) => runTaskInputCommand([
|
|
56
|
+
"answer", inputId, "--task", taskId,
|
|
57
|
+
...("choiceKey" in answer ? ["--choice", answer.choiceKey] : ["--text", answer.text])
|
|
58
|
+
], tx, commandOptions));
|
|
59
|
+
const data = result.data;
|
|
60
|
+
notify(taskId, true);
|
|
61
|
+
return data.request;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -21,7 +21,7 @@ export class WorkItemDependencyGateError extends Error {
|
|
|
21
21
|
export function assertWorkItemDependenciesCompleted(store, item) {
|
|
22
22
|
const unmetDependencies = item.dependsOn.flatMap((dependencyId) => {
|
|
23
23
|
const dependency = store.getWorkItem(item.taskId, dependencyId);
|
|
24
|
-
if (dependency?.status === "
|
|
24
|
+
if (dependency?.status === "accepted")
|
|
25
25
|
return [];
|
|
26
26
|
return [{
|
|
27
27
|
id: dependencyId,
|