@zq-silk/yui 0.15.7 → 0.15.8
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 +192 -399
- package/README.md +127 -1149
- 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/brief/taskBrief.js +12 -0
- package/dist/cli/agentConfigurationPicker.js +13 -0
- package/dist/cli/commandCatalog.js +157 -70
- 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 +178 -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 +1 -7
- 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 +259 -0
- package/dist/commands/taskActor.js +28 -49
- package/dist/commands/taskCommands.js +1188 -710
- 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} +146 -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 +458 -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 +114 -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 +247 -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 +62 -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 +380 -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 +123 -0
- package/dist/resources/projectResourceService.js +421 -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 +1 -0
- package/dist/storage/migrations/agentRunContract.js +159 -0
- package/dist/storage/migrations/removeRuntimeGeneration.js +207 -0
- package/dist/storage/sqliteSchema.js +431 -5
- package/dist/storage/sqliteStore.js +375 -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 +301 -0
- package/dist/task/taskActivationService.js +392 -0
- package/dist/task/taskRecordReference.js +5 -4
- package/dist/task/taskRecordRetirement.js +1 -1
- 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 +120 -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 +353 -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 +118 -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 +80 -48
- package/dist/workspace/workItemChangeSetManager.js +16 -9
- package/docs/agent-result-consumption.md +94 -0
- package/docs/agent-runtime-drivers.md +91 -0
- package/docs/architecture/README.md +38 -0
- package/docs/architecture/capabilities-and-resources.md +79 -0
- package/docs/managed-turn-and-session-runtime.md +222 -0
- package/docs/observability/README.md +81 -0
- package/docs/plugin-sdk.md +290 -0
- package/docs/provider-runtime.md +163 -0
- package/docs/release-workflow.md +303 -0
- package/docs/roles-and-configuration.md +113 -0
- package/docs/sqlite-control-plane-design.md +76 -0
- package/docs/task-dag-semantics.md +57 -0
- package/docs/task-delivery.md +103 -0
- package/docs/task-local-identity.md +6 -6
- package/docs/testing/verification-levels.md +86 -0
- package/i18n/README.zh-CN.md +98 -739
- package/package.json +2 -2
- package/skills/yui-leader/SKILL.md +130 -103
- package/skills/yui-leader/references/integration.md +39 -0
- package/skills/yui-leader/references/replicated-execution.md +42 -0
- package/skills/yui-leader/references/task-plugins.md +33 -0
- package/skills/yui-operator/SKILL.md +30 -59
- 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
|
@@ -5,8 +5,7 @@ import { validateManagedWorkspace } from "../worktree/managedWorkspace.js";
|
|
|
5
5
|
import { validateTaskRecordReference } from "../task/taskRecordReference.js";
|
|
6
6
|
import { assertWorkItemExecutionGroupTransition, validateWorkItemExecutionGroup as validateExecutionGroupRecord, workItemExecutionGroupSettled } from "../execution/workItemExecution.js";
|
|
7
7
|
const TERMINAL_STATUSES = [
|
|
8
|
-
"
|
|
9
|
-
"failed",
|
|
8
|
+
"accepted",
|
|
10
9
|
"retired"
|
|
11
10
|
];
|
|
12
11
|
export function createWorkItem(id, taskId, input, now) {
|
|
@@ -31,21 +30,18 @@ export function createWorkItem(id, taskId, input, now) {
|
|
|
31
30
|
...(input.assignee === undefined
|
|
32
31
|
? {}
|
|
33
32
|
: { assignee: requireIdentity(input.assignee, "Work item assignee") }),
|
|
34
|
-
status: "
|
|
33
|
+
status: "open",
|
|
35
34
|
candidates: [],
|
|
36
35
|
createdAt: timestamp,
|
|
37
36
|
updatedAt: timestamp
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
|
-
/**
|
|
41
|
-
|
|
39
|
+
/** Edit current open-work requirements; frozen Assignments are separate records.
|
|
40
|
+
* The command boundary owns Task authority and workspace/assignee constraints. */
|
|
41
|
+
export function editWorkItemDefinition(workItem, update, now) {
|
|
42
42
|
validateWorkItem(workItem);
|
|
43
|
-
if (workItem.status !== "
|
|
44
|
-
|
|
45
|
-
|| workItem.candidates.length > 0
|
|
46
|
-
|| workItem.disposition !== undefined
|
|
47
|
-
|| workItem.workspaceDisposition !== undefined) {
|
|
48
|
-
throw new Error(`Work Item has execution or retirement facts: ${workItem.id}.`);
|
|
43
|
+
if (workItem.status !== "open") {
|
|
44
|
+
throw new Error(`Only open Work Item definitions may change: ${workItem.id} (${workItem.status}).`);
|
|
49
45
|
}
|
|
50
46
|
const next = {
|
|
51
47
|
...workItem,
|
|
@@ -87,7 +83,7 @@ export function editDraftWorkItemDefinition(workItem, update, now) {
|
|
|
87
83
|
}
|
|
88
84
|
export function submitWorkItemCandidate(workItem, input, now) {
|
|
89
85
|
validateWorkItem(workItem);
|
|
90
|
-
if (workItem.status !== "
|
|
86
|
+
if (workItem.status !== "open") {
|
|
91
87
|
throw new Error(`Work Item candidate can only be submitted from running: ${workItem.id}/${workItem.status}.`);
|
|
92
88
|
}
|
|
93
89
|
const revision = workItem.revision + 1;
|
|
@@ -116,26 +112,28 @@ export function submitWorkItemCandidate(workItem, input, now) {
|
|
|
116
112
|
...(input.taskMainSnapshot === undefined
|
|
117
113
|
? {}
|
|
118
114
|
: { taskMainSnapshot: input.taskMainSnapshot }),
|
|
115
|
+
...(input.artifactRefs === undefined ? {} : { artifactRefs: input.artifactRefs.map((ref) => ({ ...ref })) }),
|
|
119
116
|
createdAt: now.toISOString()
|
|
120
117
|
});
|
|
121
118
|
const { outcome: _outcome, endedAt: _endedAt, ...base } = workItem;
|
|
122
119
|
return validateWorkItem({
|
|
123
120
|
...base,
|
|
124
|
-
status: "
|
|
121
|
+
status: "open",
|
|
125
122
|
candidates: [...workItem.candidates, candidate],
|
|
123
|
+
currentCandidateId: candidate.id,
|
|
126
124
|
revision,
|
|
127
125
|
updatedAt: now.toISOString()
|
|
128
126
|
});
|
|
129
127
|
}
|
|
130
|
-
export function updateWorkItemStatus(workItem, status, now, outcome) {
|
|
128
|
+
export function updateWorkItemStatus(workItem, status, now, outcome, candidateId) {
|
|
131
129
|
validateWorkItem(workItem);
|
|
132
130
|
validateStatus(status);
|
|
133
131
|
const alreadyTerminal = isTerminalStatus(workItem.status);
|
|
134
132
|
if (workItem.disposition !== undefined && status !== workItem.status) {
|
|
135
133
|
throw new Error(`Retired Work Item status cannot change: ${workItem.id}.`);
|
|
136
134
|
}
|
|
137
|
-
const
|
|
138
|
-
if (alreadyTerminal && status !== workItem.status && !
|
|
135
|
+
const withdrawingAcceptance = workItem.status === "accepted" && status === "open";
|
|
136
|
+
if (alreadyTerminal && status !== workItem.status && !withdrawingAcceptance) {
|
|
139
137
|
throw new Error(`Terminal Work Item status cannot change: ${workItem.id}.`);
|
|
140
138
|
}
|
|
141
139
|
const terminal = isTerminalStatus(status);
|
|
@@ -154,16 +152,19 @@ export function updateWorkItemStatus(workItem, status, now, outcome) {
|
|
|
154
152
|
updatedAt: timestamp
|
|
155
153
|
});
|
|
156
154
|
}
|
|
157
|
-
const { endedAt: _endedAt, outcome: _outcome, workspaceDisposition, ...base } = workItem;
|
|
155
|
+
const { endedAt: _endedAt, outcome: _outcome, workspaceDisposition, acceptedCandidateId, currentCandidateId, ...base } = workItem;
|
|
158
156
|
return validateWorkItem({
|
|
159
157
|
...base,
|
|
160
158
|
status,
|
|
161
159
|
revision: workItem.revision + 1,
|
|
162
160
|
...(normalizedOutcome === undefined ? {} : { outcome: normalizedOutcome }),
|
|
163
161
|
// Isolated workspace cleanup remains durable evidence after retirement.
|
|
164
|
-
...(
|
|
162
|
+
...(workspaceDisposition !== undefined
|
|
165
163
|
? { workspaceDisposition }
|
|
166
164
|
: {}),
|
|
165
|
+
...(status === "accepted" && (candidateId ?? acceptedCandidateId ?? currentCandidateId) !== undefined
|
|
166
|
+
? { acceptedCandidateId: candidateId ?? acceptedCandidateId ?? currentCandidateId } : {}),
|
|
167
|
+
...(status === "open" && !withdrawingAcceptance && currentCandidateId !== undefined ? { currentCandidateId } : {}),
|
|
167
168
|
updatedAt: timestamp,
|
|
168
169
|
...(terminal ? { endedAt: timestamp } : {})
|
|
169
170
|
});
|
|
@@ -172,7 +173,7 @@ export function updateWorkItemStatus(workItem, status, now, outcome) {
|
|
|
172
173
|
export function attachWorkItemExecutionGroup(workItem, executionGroup, now) {
|
|
173
174
|
validateWorkItem(workItem);
|
|
174
175
|
const checked = validateWorkItemExecutionGroup(executionGroup, workItem.taskId, workItem.id);
|
|
175
|
-
if (workItem.status
|
|
176
|
+
if (workItem.status !== "open") {
|
|
176
177
|
throw new Error(`A terminal Work Item cannot attach an ExecutionGroup: ${workItem.id}.`);
|
|
177
178
|
}
|
|
178
179
|
const existing = workItemExecutionGroupById(workItem, checked.id);
|
|
@@ -235,11 +236,10 @@ export function retireWorkItem(workItem, input, now) {
|
|
|
235
236
|
}
|
|
236
237
|
throw new Error(`Work Item already has an explicit disposition: ${workItem.id}.`);
|
|
237
238
|
}
|
|
238
|
-
if (workItem.status === "
|
|
239
|
+
if (workItem.status === "accepted") {
|
|
239
240
|
throw new Error(`Completed Work Item cannot be retired: ${workItem.id}.`);
|
|
240
241
|
}
|
|
241
242
|
if (isTerminalStatus(workItem.status)
|
|
242
|
-
&& workItem.status !== "failed"
|
|
243
243
|
&& workItem.status !== "retired") {
|
|
244
244
|
throw new Error(`Terminal Work Item status cannot change: ${workItem.id}.`);
|
|
245
245
|
}
|
|
@@ -254,15 +254,15 @@ export function retireWorkItem(workItem, input, now) {
|
|
|
254
254
|
endedAt: timestamp
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
|
-
export function
|
|
257
|
+
export function prepareWorkItemDispatch(workItem, now) {
|
|
258
258
|
validateWorkItem(workItem);
|
|
259
|
-
if (workItem.status !== "
|
|
259
|
+
if (workItem.status !== "open") {
|
|
260
260
|
throw new Error(`Work item is not retryable from ${workItem.status}: ${workItem.id}.`);
|
|
261
261
|
}
|
|
262
262
|
if (workItem.workspaceDisposition !== undefined) {
|
|
263
263
|
throw new Error(`Work item workspace is already settled: ${workItem.id}.`);
|
|
264
264
|
}
|
|
265
|
-
const { outcome: _outcome, endedAt: _endedAt, ...base } = workItem;
|
|
265
|
+
const { outcome: _outcome, endedAt: _endedAt, currentCandidateId: _candidate, ...base } = workItem;
|
|
266
266
|
// Keep every historical Group. A settled current Group is cleared only as
|
|
267
267
|
// the current pointer; redispatch appends a fresh immutable Group.
|
|
268
268
|
const current = currentWorkItemExecutionGroup(workItem);
|
|
@@ -271,7 +271,7 @@ export function retryFailedWorkItem(workItem, now) {
|
|
|
271
271
|
: (({ currentExecutionGroupId: _currentExecutionGroupId, ...history }) => history)(base);
|
|
272
272
|
return validateWorkItem({
|
|
273
273
|
...retryBase,
|
|
274
|
-
status: "
|
|
274
|
+
status: "open",
|
|
275
275
|
revision: workItem.revision + 1,
|
|
276
276
|
updatedAt: now.toISOString()
|
|
277
277
|
});
|
|
@@ -316,7 +316,10 @@ export function validateWorkItem(workItem) {
|
|
|
316
316
|
"workspaceDisposition",
|
|
317
317
|
"createdAt",
|
|
318
318
|
"updatedAt",
|
|
319
|
-
"endedAt"
|
|
319
|
+
"endedAt",
|
|
320
|
+
"acceptedCandidateId",
|
|
321
|
+
"currentCandidateId",
|
|
322
|
+
"historicalState"
|
|
320
323
|
], "WorkItem");
|
|
321
324
|
if (workItem.schemaVersion !== 15)
|
|
322
325
|
throw new Error("WorkItem must use schemaVersion 15.");
|
|
@@ -381,9 +384,27 @@ export function validateWorkItem(workItem) {
|
|
|
381
384
|
throw new Error("Work Item candidate revision cannot exceed the Work Item revision.");
|
|
382
385
|
}
|
|
383
386
|
});
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
throw new Error("
|
|
387
|
+
if (workItem.acceptedCandidateId !== undefined
|
|
388
|
+
&& !candidateIds.has(workItem.acceptedCandidateId))
|
|
389
|
+
throw new Error("Accepted Candidate is missing.");
|
|
390
|
+
if (workItem.acceptedCandidateId !== undefined && workItem.status !== "accepted") {
|
|
391
|
+
throw new Error("Only an accepted Work Item may select an accepted Candidate.");
|
|
392
|
+
}
|
|
393
|
+
if (workItem.status === "accepted" && workItem.candidates.length > 0 && workItem.acceptedCandidateId === undefined) {
|
|
394
|
+
throw new Error("Accepted Work Item must identify its selected Candidate.");
|
|
395
|
+
}
|
|
396
|
+
if (workItem.currentCandidateId !== undefined
|
|
397
|
+
&& !candidateIds.has(workItem.currentCandidateId))
|
|
398
|
+
throw new Error("Current Candidate is missing.");
|
|
399
|
+
if (workItem.historicalState !== undefined) {
|
|
400
|
+
const historical = workItem.historicalState;
|
|
401
|
+
if (!["pending", "running", "awaiting_acceptance", "completed", "failed", "retired"].includes(historical.status)) {
|
|
402
|
+
throw new Error("Historical Work Item status is invalid.");
|
|
403
|
+
}
|
|
404
|
+
if (historical.outcome !== undefined)
|
|
405
|
+
requireText(historical.outcome, "Historical outcome");
|
|
406
|
+
if (historical.endedAt !== undefined)
|
|
407
|
+
requireTimestamp(historical.endedAt, "Historical endedAt");
|
|
387
408
|
}
|
|
388
409
|
if (workItem.outcome !== undefined)
|
|
389
410
|
requireText(workItem.outcome, "Work item outcome");
|
|
@@ -406,9 +427,6 @@ export function validateWorkItem(workItem) {
|
|
|
406
427
|
if (!["integrated", "abandoned"].includes(workItem.workspaceDisposition)) {
|
|
407
428
|
throw new Error("Work item workspaceDisposition is invalid.");
|
|
408
429
|
}
|
|
409
|
-
if (!terminal) {
|
|
410
|
-
throw new Error("Only a terminal Work Item can record workspace cleanup.");
|
|
411
|
-
}
|
|
412
430
|
}
|
|
413
431
|
if (workItem.disposition !== undefined) {
|
|
414
432
|
validateDisposition(workItem.disposition);
|
|
@@ -433,7 +451,7 @@ export function workItemExecutionGroupById(workItem, executionGroupId) {
|
|
|
433
451
|
return workItem.executionGroups.find(({ id }) => id === executionGroupId);
|
|
434
452
|
}
|
|
435
453
|
/**
|
|
436
|
-
* True when a
|
|
454
|
+
* True when a AgentRun failure belongs to the WorkItem's current unresolved Lane.
|
|
437
455
|
* Such a failure is Lane-bounded: the WorkItem remains running so the Leader
|
|
438
456
|
* can reuse completed siblings and retry only this failed attempt.
|
|
439
457
|
*/
|
|
@@ -445,7 +463,7 @@ export function workItemOwnsUnresolvedExecutionLane(workItem, executionGroupId,
|
|
|
445
463
|
const group = workItem.executionGroups.find(({ id }) => id === executionGroupId);
|
|
446
464
|
return group !== undefined
|
|
447
465
|
&& !workItemExecutionGroupSettled(group)
|
|
448
|
-
&& group.lanes.some(({ id, disposition,
|
|
466
|
+
&& group.lanes.some(({ id, disposition, currentRunId }) => (id === executionLaneId && disposition === "open" && currentRunId !== undefined));
|
|
449
467
|
}
|
|
450
468
|
function validateWorkItemExecutionGroup(group, taskId, workItemId) {
|
|
451
469
|
validateExecutionGroupRecord(group);
|
|
@@ -481,17 +499,33 @@ export function validateWorkItemCandidate(candidate) {
|
|
|
481
499
|
throw new Error("Work Item candidate revision must be a positive integer.");
|
|
482
500
|
}
|
|
483
501
|
requireText(candidate.summary, "Work Item candidate summary");
|
|
502
|
+
if (candidate.artifactRefs !== undefined) {
|
|
503
|
+
if (!Array.isArray(candidate.artifactRefs))
|
|
504
|
+
throw new Error("Candidate Artifact refs must be an array.");
|
|
505
|
+
const ids = new Set();
|
|
506
|
+
for (const ref of candidate.artifactRefs) {
|
|
507
|
+
requireIdentity(ref.artifactId, "Candidate Artifact id");
|
|
508
|
+
if (ref.taskId !== candidate.taskId || !["content", "external-version", "receipt"].includes(ref.kind)
|
|
509
|
+
|| ids.has(ref.artifactId))
|
|
510
|
+
throw new Error("Candidate Artifact scope, kind or identity is invalid.");
|
|
511
|
+
if ((ref.kind !== "external-version" || ref.digest !== undefined)
|
|
512
|
+
&& (typeof ref.digest !== "string" || !/^[a-f0-9]{64}$/u.test(ref.digest))) {
|
|
513
|
+
throw new Error("Candidate Artifact digest is invalid.");
|
|
514
|
+
}
|
|
515
|
+
ids.add(ref.artifactId);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
484
518
|
if (typeof candidate.source !== "object" || candidate.source === null) {
|
|
485
519
|
throw new Error("Work Item candidate source is required.");
|
|
486
520
|
}
|
|
487
|
-
if (candidate.source.type !== "direct" && candidate.source.type !== "
|
|
521
|
+
if (candidate.source.type !== "direct" && candidate.source.type !== "run") {
|
|
488
522
|
throw new Error("Work Item candidate source is invalid.");
|
|
489
523
|
}
|
|
490
|
-
if (candidate.source.type === "
|
|
524
|
+
if (candidate.source.type === "run") {
|
|
491
525
|
validateTaskRecordReference({
|
|
492
526
|
taskId: candidate.taskId,
|
|
493
|
-
localId: candidate.source.
|
|
494
|
-
}, "
|
|
527
|
+
localId: candidate.source.runId
|
|
528
|
+
}, "run");
|
|
495
529
|
}
|
|
496
530
|
if ((candidate.executionGroupId === undefined) !== (candidate.executionLaneId === undefined)) {
|
|
497
531
|
throw new Error("Work Item candidate execution lineage is incomplete.");
|
|
@@ -647,8 +681,8 @@ function requireCommit(value, label) {
|
|
|
647
681
|
return commit;
|
|
648
682
|
}
|
|
649
683
|
export function currentWorkItemCandidate(workItem) {
|
|
650
|
-
return workItem.status === "
|
|
651
|
-
? workItem.candidates.
|
|
684
|
+
return workItem.status === "open"
|
|
685
|
+
? workItem.candidates.find(({ id }) => id === workItem.currentCandidateId)
|
|
652
686
|
: undefined;
|
|
653
687
|
}
|
|
654
688
|
/**
|
|
@@ -659,9 +693,10 @@ export function currentWorkItemCandidate(workItem) {
|
|
|
659
693
|
* Candidates on the same WorkItem are superseded by its latest Candidate.
|
|
660
694
|
*/
|
|
661
695
|
export function governingWorkItemCandidate(workItem) {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
696
|
+
if (workItem.status === "accepted" && workItem.acceptedCandidateId !== undefined) {
|
|
697
|
+
return workItem.candidates.find(({ id }) => id === workItem.acceptedCandidateId);
|
|
698
|
+
}
|
|
699
|
+
return currentWorkItemCandidate(workItem);
|
|
665
700
|
}
|
|
666
701
|
export function updateWorkItemWriteProjects(workItem, writeProjectIds, now) {
|
|
667
702
|
validateWorkItem(workItem);
|
|
@@ -690,11 +725,8 @@ function isTerminalStatus(status) {
|
|
|
690
725
|
}
|
|
691
726
|
function validateStatus(status) {
|
|
692
727
|
if (![
|
|
693
|
-
"
|
|
694
|
-
"
|
|
695
|
-
"awaiting_acceptance",
|
|
696
|
-
"completed",
|
|
697
|
-
"failed",
|
|
728
|
+
"open",
|
|
729
|
+
"accepted",
|
|
698
730
|
"retired"
|
|
699
731
|
].includes(status)) {
|
|
700
732
|
throw new Error(`Work Item status is invalid: ${String(status)}.`);
|
|
@@ -8,9 +8,8 @@ import { governingWorkItemCandidate } from "../workItem/workItem.js";
|
|
|
8
8
|
import { managedWorkspaceKey } from "../worktree/managedWorkspace.js";
|
|
9
9
|
import { captureManagedGitChanges } from "./gitChangeSetCapture.js";
|
|
10
10
|
const CAPTURABLE_WORK_ITEM_STATUSES = new Set([
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"failed",
|
|
11
|
+
"open",
|
|
12
|
+
"accepted",
|
|
14
13
|
"retired"
|
|
15
14
|
]);
|
|
16
15
|
export class WorkItemChangeSetManager {
|
|
@@ -44,10 +43,15 @@ export class WorkItemChangeSetManager {
|
|
|
44
43
|
}
|
|
45
44
|
return captured;
|
|
46
45
|
}
|
|
47
|
-
async assertIntegrated(taskId, workItemId) {
|
|
46
|
+
async assertIntegrated(taskId, workItemId, candidateId) {
|
|
48
47
|
const item = this.store.getWorkItem(taskId, workItemId);
|
|
49
48
|
if (item === null)
|
|
50
49
|
throw new Error(`Work item not found: ${taskId}/${workItemId}.`);
|
|
50
|
+
const candidate = candidateId === undefined ? governingWorkItemCandidate(item)
|
|
51
|
+
: item.candidates.find(({ id }) => id === candidateId);
|
|
52
|
+
if (candidateId !== undefined && candidate === undefined) {
|
|
53
|
+
throw new Error(`Candidate not found: ${taskId}/${workItemId}/${candidateId}.`);
|
|
54
|
+
}
|
|
51
55
|
const workspace = this.store.getWorkItemWorkspace(item.taskId, item.id);
|
|
52
56
|
if (workspace === null
|
|
53
57
|
|| workspace.owner.type !== "work-item"
|
|
@@ -59,14 +63,17 @@ export class WorkItemChangeSetManager {
|
|
|
59
63
|
if (!await git.isClean(entry.path)) {
|
|
60
64
|
throw new Error(`WorkItem Project workspace is not clean: ${item.id}/${entry.projectId}.`);
|
|
61
65
|
}
|
|
62
|
-
const
|
|
63
|
-
const candidate = governingWorkItemCandidate(item);
|
|
66
|
+
const workspaceHeadCommit = (await git.inspect(entry.path, "HEAD")).baseCommit;
|
|
64
67
|
const resultCommit = candidate?.gitSnapshot?.projects.find(({ projectId }) => projectId === entry.projectId)?.commit;
|
|
65
68
|
if (candidate?.workspace === undefined
|
|
66
69
|
|| !isDeepStrictEqual(candidate.workspace, workspace)
|
|
67
|
-
|| resultCommit
|
|
70
|
+
|| resultCommit === undefined
|
|
71
|
+
|| (candidateId === undefined && resultCommit !== workspaceHeadCommit)) {
|
|
68
72
|
throw new Error(`WorkItem Project no longer matches its frozen result: ${item.id}/${entry.projectId}.`);
|
|
69
73
|
}
|
|
74
|
+
// An explicit historical selection is proved against its immutable
|
|
75
|
+
// integrated commit, not mislabeled as the workspace's current HEAD.
|
|
76
|
+
const headCommit = resultCommit;
|
|
70
77
|
const integrated = this.store.listIntegrationAttempts(item.taskId).some((integration) => (integration.status === "committed"
|
|
71
78
|
&& integration.projectId === entry.projectId
|
|
72
79
|
&& integration.source.kind === "work-item"
|
|
@@ -282,7 +289,7 @@ function requireCapturableContext(store, taskId, workItemId, taskFinalReviewCont
|
|
|
282
289
|
if (taskFinalReviewContract === undefined) {
|
|
283
290
|
throw new Error(`Work item has no managed workspace: ${item.id}.`);
|
|
284
291
|
}
|
|
285
|
-
const candidate = item
|
|
292
|
+
const candidate = governingWorkItemCandidate(item);
|
|
286
293
|
if (candidate === undefined
|
|
287
294
|
|| !sameTaskFinalReviewContract(candidate.taskFinalReviewContract, taskFinalReviewContract)) {
|
|
288
295
|
throw new Error(`Work item has no matching exact Task-final direct Candidate: ${item.id}.`);
|
|
@@ -346,7 +353,7 @@ function assertCaptureStillCurrent(store, expected) {
|
|
|
346
353
|
const workspace = expected.source === "task-main"
|
|
347
354
|
? store.getTaskWorkspace(expected.taskId)
|
|
348
355
|
: store.getWorkItemWorkspace(expected.taskId, expected.workItemId);
|
|
349
|
-
const candidate = item
|
|
356
|
+
const candidate = item === null ? undefined : governingWorkItemCandidate(item);
|
|
350
357
|
if (task?.status !== "active"
|
|
351
358
|
|| item === null
|
|
352
359
|
|| item.revision !== expected.expectedRevision
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Agent result consumption
|
|
2
|
+
|
|
3
|
+
Every explicitly dispatched AgentRun produces one durable original result.
|
|
4
|
+
Ordinary notification and native conversation do not implicitly create Runs.
|
|
5
|
+
The next Agent in the ownership chain reads the exact result and decides what
|
|
6
|
+
it means.
|
|
7
|
+
|
|
8
|
+
## One original result
|
|
9
|
+
|
|
10
|
+
`AgentRunResult.output` is the Agent-authored report. Core preserves its bytes
|
|
11
|
+
and does not parse, classify or validate semantic content. Markdown, JSON and
|
|
12
|
+
ordinary prose are all legal; omitted headings or an unconvincing conclusion are
|
|
13
|
+
quality evidence, not a runtime failure.
|
|
14
|
+
|
|
15
|
+
Core separately records Provider identity/status, completion time, diagnostics,
|
|
16
|
+
failure reasons and system-owned workspace evidence. Non-empty output must fit
|
|
17
|
+
the current transport limit and contain no NUL. Missing or untransportable text
|
|
18
|
+
fails the Run without fabricated prose. An arrived report can remain on a failed
|
|
19
|
+
Run when a later Core-owned boundary fails.
|
|
20
|
+
|
|
21
|
+
One reference Message is saved with the terminal result.
|
|
22
|
+
`task message show <task/message>` and Context inspect expand the same
|
|
23
|
+
`resultRef`. ReviewRound does not hold a second report. Files and durable
|
|
24
|
+
business outputs belong to Artifacts or managed Git results.
|
|
25
|
+
|
|
26
|
+
## Execution is not acceptance
|
|
27
|
+
|
|
28
|
+
Run lifecycle is `active / completed / failed`. Provider outcome, input
|
|
29
|
+
acceptance and resource quiescence are separate facts. A completed Run means
|
|
30
|
+
its required Core execution boundaries succeeded, not that its answer is
|
|
31
|
+
correct or the WorkItem accepted.
|
|
32
|
+
|
|
33
|
+
Writable replicated Lanes require their exact Core-owned workspace evidence.
|
|
34
|
+
A wrong branch, dirty snapshot, mismatched owner or scope fails that boundary
|
|
35
|
+
without replacing an already arrived original report.
|
|
36
|
+
|
|
37
|
+
Only the Leader decides whether evidence warrants acceptance, further work,
|
|
38
|
+
another review or abandonment. Core never derives findings, votes or repair
|
|
39
|
+
topology from Agent text.
|
|
40
|
+
|
|
41
|
+
## Direct and replicated execution
|
|
42
|
+
|
|
43
|
+
Direct WorkItem execution uses one main Run and no ExecutionGroup. Direct
|
|
44
|
+
Review likewise uses one main Reviewer Run.
|
|
45
|
+
|
|
46
|
+
Replicated execution uses distinct Producer Lanes over one frozen Assignment.
|
|
47
|
+
Each Producer retains its own original result and exact lineage. Leader
|
|
48
|
+
explicitly supplies distinct terminal source Run references to synthesis.
|
|
49
|
+
Sources must belong to the exact Group/Lane and have a result; they may be
|
|
50
|
+
completed or failed. There is no automatic synthesis, vote, minimum successful
|
|
51
|
+
Producer count or requirement to wait for all Lanes before choosing sources.
|
|
52
|
+
|
|
53
|
+
The synthesis snapshot retains the selected source order and bounded views of
|
|
54
|
+
their original outputs, diagnostics and provenance. It does not copy complete
|
|
55
|
+
transcripts. Only the main synthesis result can supply the WorkItem Candidate
|
|
56
|
+
or authoritative replicated Review result. Producers never enter Integration
|
|
57
|
+
or acceptance directly. Retry targets the failed exact execution; it does not
|
|
58
|
+
silently rerun successful Producers.
|
|
59
|
+
|
|
60
|
+
## Review
|
|
61
|
+
|
|
62
|
+
ReviewRound owns frozen Candidate or Task-head identity, workspace provenance,
|
|
63
|
+
execution topology, exact main Reviewer Run, lifecycle and Core diagnostics.
|
|
64
|
+
Its completed state is structural execution evidence, not a “pass” extracted
|
|
65
|
+
from the report.
|
|
66
|
+
|
|
67
|
+
Candidate review follows its captured review rule. Task-final review can be
|
|
68
|
+
explicitly requested or required by the immutable final-review contract. A
|
|
69
|
+
requested review is evidence, not an automatic new policy requiring review
|
|
70
|
+
after every subsequent change. When current delivery requires a review, it
|
|
71
|
+
must cover the exact governing candidate or heads and completed main Run.
|
|
72
|
+
|
|
73
|
+
The Reviewer should inspect the complete bounded scope and report material
|
|
74
|
+
findings together. The Leader reads the full report, routes findings to the
|
|
75
|
+
original owner, fixes small Task-main issues directly, and creates a new
|
|
76
|
+
WorkItem only for substantial independent work.
|
|
77
|
+
|
|
78
|
+
## Leader consumption
|
|
79
|
+
|
|
80
|
+
Wake windows point to result-bearing events, including a Run created before
|
|
81
|
+
the window but completed inside it. Read the exact source:
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
yui task wake show <task> <wake>
|
|
85
|
+
yui task run show <task/run>
|
|
86
|
+
yui task message show <task/message>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
An optional report layout is outcome, changes/findings, verification, uncertainty
|
|
90
|
+
and next action. It is communication guidance, not a machine protocol.
|
|
91
|
+
|
|
92
|
+
Acceptance and Task completion remain explicit operations with current Git,
|
|
93
|
+
review, scope and resource checks. See [Session and AgentRun](managed-turn-and-session-runtime.md)
|
|
94
|
+
and [Task dependencies](task-dag-semantics.md).
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Agent runtime Drivers
|
|
2
|
+
|
|
3
|
+
AgentEndpoint supplies the common execution boundary. Drivers translate native
|
|
4
|
+
events, errors and supported observation sources into `RuntimeObservation`;
|
|
5
|
+
Controller, Store, CLI and Web consume that shared contract.
|
|
6
|
+
|
|
7
|
+
## Responsibilities
|
|
8
|
+
|
|
9
|
+
The connection implementation owns launch, protocol, prompt delivery, resume and
|
|
10
|
+
interrupt. Driver owns native identity extraction, observation capabilities,
|
|
11
|
+
event/error mapping and usage normalization. Core owns authority, exact request
|
|
12
|
+
correlation, durable folding and projections; Agents choose recovery and judge
|
|
13
|
+
semantic progress.
|
|
14
|
+
|
|
15
|
+
Built-in Driver identities are `openai/codex`, `anthropic/claude-code` and
|
|
16
|
+
`acp/agent-client-protocol`. ACP is a protocol Driver, not a product label.
|
|
17
|
+
Adding an ACP peer does not require another business-state model.
|
|
18
|
+
|
|
19
|
+
Capabilities must be stated truthfully. Unknown resume, cancellation, activity
|
|
20
|
+
or usage behavior cannot be inferred from a product name.
|
|
21
|
+
|
|
22
|
+
## Observation path
|
|
23
|
+
|
|
24
|
+
Native structured facts pass the exact Session/request fence, enter the runtime
|
|
25
|
+
inbox, and fold into durable observations and original results. A separately
|
|
26
|
+
sampled usage source can feed the same canonical contract. Driver cannot choose
|
|
27
|
+
another actor, assign a successor Run, or bypass the fence.
|
|
28
|
+
|
|
29
|
+
Yui Run identity and Provider native Turn identity are not interchangeable.
|
|
30
|
+
An explicitly dispatched Run retains its accepted native correlation; direct
|
|
31
|
+
native chat is not another implicit Run. Replay is deduplicated by exact fact
|
|
32
|
+
identity, and late events cannot terminalize a successor.
|
|
33
|
+
|
|
34
|
+
Managed Codex uses App Server events. Claude maps its structured stream and
|
|
35
|
+
supported Hook/source payloads. ACP maps protocol Session updates and prompt
|
|
36
|
+
responses. Terminal text, trust dialogs and prompt glyphs are not lifecycle facts.
|
|
37
|
+
|
|
38
|
+
## State and error evidence
|
|
39
|
+
|
|
40
|
+
Persistent Run lifecycle is `active / completed / failed`. Input disposition,
|
|
41
|
+
native waiting/activity, Goal, Session lifecycle and process presence answer
|
|
42
|
+
different questions. UI projections must not present a queued request as proof
|
|
43
|
+
that the Agent is busy, or a live process as acceptance.
|
|
44
|
+
|
|
45
|
+
Standard Agent errors preserve source, phase, category, code, input disposition,
|
|
46
|
+
Session disposition and the serialized native error. Categories include
|
|
47
|
+
availability, rate-limit, transport, access, invalid-request, context, session,
|
|
48
|
+
runtime, conflict, cancelled and unknown. A mapping reports evidence, not a
|
|
49
|
+
retry policy. Unrecognized errors stay unknown.
|
|
50
|
+
|
|
51
|
+
Runtime activity and workflow progress use separate evidence. A tool boundary
|
|
52
|
+
may show native activity; a durable accepted result shows semantic progress.
|
|
53
|
+
Tokens, CPU, RSS and pane presence cannot substitute for either acceptance or
|
|
54
|
+
Task completion.
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
Usage is read-only and scoped to the exact native Session. Input/output totals
|
|
59
|
+
are distinguished from cache/reasoning breakdowns, request context and remaining
|
|
60
|
+
capacity. Stable activity IDs deduplicate request snapshots; cumulative deltas
|
|
61
|
+
are used only with valid ordered same-Session evidence.
|
|
62
|
+
|
|
63
|
+
Missing, partial, mixed or rolled-back observations remain unobserved rather
|
|
64
|
+
than guessed. Incremental observers report health and coverage; sampling does
|
|
65
|
+
not block lifecycle events. Metrics never trigger model selection, wake, retry,
|
|
66
|
+
resource release or acceptance.
|
|
67
|
+
|
|
68
|
+
## Native children
|
|
69
|
+
|
|
70
|
+
Native subagents are collaboration inside a parent conversation, not Yui Roles,
|
|
71
|
+
Lanes or independent managed workspace owners. Continuation observations may
|
|
72
|
+
record lineage and result references when the Provider exposes them.
|
|
73
|
+
|
|
74
|
+
Best-effort child results return through the parent. Only a persisted content
|
|
75
|
+
receipt justifies `durable-result`; a live child or claimed success does not.
|
|
76
|
+
Reported results remain untrusted data. A lost best-effort conversation may
|
|
77
|
+
require redoing the work. Choose a managed WorkItem execution when independent
|
|
78
|
+
durability and acceptance are needed; replication is a separate choice.
|
|
79
|
+
|
|
80
|
+
## Integration and validation
|
|
81
|
+
|
|
82
|
+
A new connection implementation must supply truthful control/observation
|
|
83
|
+
capabilities and pair them with exact identity, error and terminal mapping.
|
|
84
|
+
Provider-specific protocol details stay at the edge, not in Task planning,
|
|
85
|
+
Store semantics or Web business rules.
|
|
86
|
+
|
|
87
|
+
Change-specific disposable evidence should cover the changed correlation,
|
|
88
|
+
permission, cancellation or observation boundary. Keep permanent tests to the
|
|
89
|
+
primary paths in the [verification policy](testing/verification-levels.md).
|
|
90
|
+
Real Provider/model validation requires explicit authorization and must distinguish
|
|
91
|
+
native process evidence from fixture output.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# 当前架构与文档导航
|
|
2
|
+
|
|
3
|
+
以下文档描述当前源码合同。能力边界不等于所有真实 Provider 场景已经验证。
|
|
4
|
+
|
|
5
|
+
## 阅读入口
|
|
6
|
+
|
|
7
|
+
- [README](../../README.md):安装、配置和日常使用。
|
|
8
|
+
- [中文 README](../../i18n/README.zh-CN.md):同一产品入口的中文说明。
|
|
9
|
+
- [总体架构](../../ARCHITECTURE.md):职责、权威和端到端流程。
|
|
10
|
+
- [能力、资源与 Surface](capabilities-and-resources.md):扩展入口、实例所有权和资源效果。
|
|
11
|
+
|
|
12
|
+
## 领域合同
|
|
13
|
+
|
|
14
|
+
| 问题 | 当前文档 |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| Session、AgentRun、消息和激活如何配合? | [执行与会话](../managed-turn-and-session-runtime.md) |
|
|
17
|
+
| 谁消费结果、综合与审查? | [结果消费](../agent-result-consumption.md) |
|
|
18
|
+
| WorkItem 依赖何时满足? | [Task 依赖](../task-dag-semantics.md) |
|
|
19
|
+
| Task 内记录如何引用? | [局部身份](../task-local-identity.md) |
|
|
20
|
+
| Role、Profile 与运行配置如何生效? | [角色与配置](../roles-and-configuration.md) |
|
|
21
|
+
| 怎样交付、集成和归档? | [交付生命周期](../task-delivery.md) |
|
|
22
|
+
| Provider、ACP 与配置事实如何接入? | [Provider Runtime](../provider-runtime.md) |
|
|
23
|
+
| 运行观察和错误由谁解释? | [Agent Drivers](../agent-runtime-drivers.md) |
|
|
24
|
+
| 如何创建、验证与采用插件? | [插件 SDK](../plugin-sdk.md) |
|
|
25
|
+
| 数据、升级与并发的边界是什么? | [SQLite Store](../sqlite-control-plane-design.md) |
|
|
26
|
+
| 如何执行获授权的发布操作? | [发布流程](../release-workflow.md) |
|
|
27
|
+
| 如何查看当前运行证据? | [可观察性](../observability/README.md) |
|
|
28
|
+
| 哪些验证应长期保留? | [验证策略](../testing/verification-levels.md) |
|
|
29
|
+
|
|
30
|
+
## 维护约定
|
|
31
|
+
|
|
32
|
+
行为变更同步修改所属合同和必要的入口说明。具体 CLI 参数以
|
|
33
|
+
`src/cli/commandCatalog.ts` 和命令处理器为准;公开领域类型以运行源码为准,
|
|
34
|
+
不另外维护一套目标模型或生成的离线副本。
|
|
35
|
+
|
|
36
|
+
Project Skill 管理 Yui 的开发与验证规则;通用 Role Skills 管理 Agent 使用
|
|
37
|
+
Yui 的职责。仓库文档不替代 `YUI_HOME` 中维护的 Project Knowledge,也不授予
|
|
38
|
+
共享环境、真实模型或外部系统的执行权限。
|