@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
|
@@ -2,7 +2,7 @@ import { join } from "node:path";
|
|
|
2
2
|
import { usageError } from "../errors/cliError.js";
|
|
3
3
|
import { CURRENT_CONFIG_SCHEMA_VERSION } from "../storage/taskStore.js";
|
|
4
4
|
import { CURRENT_DATABASE_FILENAME as COMMITTED_DATABASE_FILENAME } from "../storage/currentTaskStore.js";
|
|
5
|
-
import { DEFAULT_TERMINAL_KEEP,
|
|
5
|
+
import { DEFAULT_TERMINAL_KEEP, resolveRunCap, resolveTerminalKeep } from "../telemetry/telemetryConfig.js";
|
|
6
6
|
import { resolveTelemetryEnabled } from "../config/yuiConfig.js";
|
|
7
7
|
import { SqliteTelemetryStore } from "../telemetry/sqliteTelemetryStore.js";
|
|
8
8
|
/** Read the durable config, falling back to defaults when no store is available. */
|
|
@@ -24,7 +24,7 @@ export async function runTelemetryCommand(args, options) {
|
|
|
24
24
|
? "Telemetry command is required: status, prune, or read."
|
|
25
25
|
: `Unknown command: telemetry ${command}`, "yui telemetry status [--json]\n"
|
|
26
26
|
+ "yui telemetry prune [--task <id>] [--keep <n>] [--dry-run] [--json]\n"
|
|
27
|
-
+ "yui telemetry read --task <id> [--
|
|
27
|
+
+ "yui telemetry read --task <id> [--run <id>] [--aggregate] [--limit <n>] [--offset <n>]");
|
|
28
28
|
}
|
|
29
29
|
// -- status ---------------------------------------------------------------------
|
|
30
30
|
function telemetryStatus(args, options) {
|
|
@@ -33,7 +33,7 @@ function telemetryStatus(args, options) {
|
|
|
33
33
|
const telemetry = new SqliteTelemetryStore(options.home, {
|
|
34
34
|
mode,
|
|
35
35
|
terminalKeep: resolveTerminalKeep(storeConfig(options).telemetryTerminalKeep),
|
|
36
|
-
|
|
36
|
+
runCap: resolveRunCap(storeConfig(options).telemetryRunCap)
|
|
37
37
|
});
|
|
38
38
|
try {
|
|
39
39
|
const health = telemetry.health();
|
|
@@ -43,7 +43,7 @@ function telemetryStatus(args, options) {
|
|
|
43
43
|
: store.listTasks().map((task) => ({
|
|
44
44
|
taskId: task.id,
|
|
45
45
|
rows: telemetry.count(task.id),
|
|
46
|
-
|
|
46
|
+
runs: telemetry.listRunAggregates(task.id).length
|
|
47
47
|
}));
|
|
48
48
|
const report = {
|
|
49
49
|
mode,
|
|
@@ -54,7 +54,7 @@ function telemetryStatus(args, options) {
|
|
|
54
54
|
lastError: health.lastError,
|
|
55
55
|
totalRows: health.rows,
|
|
56
56
|
terminalKeep: resolveTerminalKeep(storeConfig(options).telemetryTerminalKeep),
|
|
57
|
-
|
|
57
|
+
runCap: resolveRunCap(storeConfig(options).telemetryRunCap),
|
|
58
58
|
tasks: perTask
|
|
59
59
|
};
|
|
60
60
|
if (options.json || flags.has("json"))
|
|
@@ -68,10 +68,10 @@ function telemetryStatus(args, options) {
|
|
|
68
68
|
`Coalesced: ${health.coalesced}`,
|
|
69
69
|
...(health.lastError === null ? [] : [`Last error: ${health.lastError}`]),
|
|
70
70
|
`Terminal keep: ${report.terminalKeep}`,
|
|
71
|
-
`
|
|
71
|
+
`AgentRun cap: ${report.runCap}`
|
|
72
72
|
];
|
|
73
73
|
for (const task of perTask) {
|
|
74
|
-
lines.push(` ${task.taskId}: ${task.rows} rows across ${task.
|
|
74
|
+
lines.push(` ${task.taskId}: ${task.rows} rows across ${task.runs} AgentRun turn(s)`);
|
|
75
75
|
}
|
|
76
76
|
return lines.join("\n");
|
|
77
77
|
}
|
|
@@ -85,12 +85,12 @@ function telemetryPrune(args, options) {
|
|
|
85
85
|
const taskId = stringOption(args, "--task");
|
|
86
86
|
const keep = integerOption(args, "--keep", DEFAULT_TERMINAL_KEEP);
|
|
87
87
|
const dryRun = flags.has("dry-run");
|
|
88
|
-
const cap =
|
|
88
|
+
const cap = resolveRunCap(storeConfig(options).telemetryRunCap);
|
|
89
89
|
const store = requireStore(options);
|
|
90
90
|
const telemetry = new SqliteTelemetryStore(options.home, {
|
|
91
91
|
mode: telemetryMode(storeConfig(options)),
|
|
92
92
|
terminalKeep: keep,
|
|
93
|
-
|
|
93
|
+
runCap: cap
|
|
94
94
|
});
|
|
95
95
|
try {
|
|
96
96
|
const tasks = taskId === undefined
|
|
@@ -98,36 +98,34 @@ function telemetryPrune(args, options) {
|
|
|
98
98
|
: [taskId];
|
|
99
99
|
const report = [];
|
|
100
100
|
for (const id of tasks) {
|
|
101
|
-
const
|
|
101
|
+
const terminalRuns = new Set(store.listRuns(id)
|
|
102
102
|
.filter((run) => run.status !== "active")
|
|
103
103
|
.map((run) => run.id));
|
|
104
|
-
const entry = { taskId: id, terminalPruned: 0, activeCapped: 0,
|
|
105
|
-
for (const aggregate of telemetry.
|
|
106
|
-
if (
|
|
107
|
-
const before = telemetry.count(id, aggregate.
|
|
104
|
+
const entry = { taskId: id, terminalPruned: 0, activeCapped: 0, runs: [] };
|
|
105
|
+
for (const aggregate of telemetry.listRunAggregates(id)) {
|
|
106
|
+
if (terminalRuns.has(aggregate.runId)) {
|
|
107
|
+
const before = telemetry.count(id, aggregate.runId);
|
|
108
108
|
const deleted = dryRun
|
|
109
109
|
? Math.max(0, before - keep)
|
|
110
|
-
: telemetry.
|
|
110
|
+
: telemetry.pruneRun(aggregate.taskId, aggregate.roleName, aggregate.runId, keep);
|
|
111
111
|
entry.terminalPruned += deleted;
|
|
112
|
-
entry.
|
|
113
|
-
|
|
114
|
-
generation: aggregate.generation,
|
|
112
|
+
entry.runs.push({
|
|
113
|
+
runId: aggregate.runId,
|
|
115
114
|
kept: Math.min(before, keep),
|
|
116
115
|
deleted
|
|
117
116
|
});
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
|
-
for (const run of store.
|
|
119
|
+
for (const run of store.listRuns(id)) {
|
|
121
120
|
if (run.status !== "active")
|
|
122
121
|
continue;
|
|
123
122
|
const before = telemetry.count(id, run.id);
|
|
124
123
|
if (before <= cap)
|
|
125
124
|
continue;
|
|
126
|
-
const deleted = dryRun ? before - cap : telemetry.
|
|
125
|
+
const deleted = dryRun ? before - cap : telemetry.capRun(id, run.id, cap);
|
|
127
126
|
entry.activeCapped += deleted;
|
|
128
|
-
entry.
|
|
129
|
-
|
|
130
|
-
generation: "*",
|
|
127
|
+
entry.runs.push({
|
|
128
|
+
runId: run.id,
|
|
131
129
|
kept: Math.min(before, cap),
|
|
132
130
|
deleted
|
|
133
131
|
});
|
|
@@ -143,15 +141,15 @@ function telemetryPrune(args, options) {
|
|
|
143
141
|
return JSON.stringify(result, null, 2);
|
|
144
142
|
const lines = [
|
|
145
143
|
`Telemetry prune (${dryRun ? "dry-run" : "applied"}):`,
|
|
146
|
-
` terminal
|
|
147
|
-
` active
|
|
144
|
+
` terminal runs pruned: ${totals.terminalPruned} row(s) (keep ${keep})`,
|
|
145
|
+
` active AgentRuns capped: ${totals.activeCapped} row(s) (cap ${cap})`
|
|
148
146
|
];
|
|
149
147
|
for (const entry of report) {
|
|
150
|
-
if (entry.
|
|
148
|
+
if (entry.runs.length === 0)
|
|
151
149
|
continue;
|
|
152
150
|
lines.push(` ${entry.taskId}:`);
|
|
153
|
-
for (const
|
|
154
|
-
lines.push(` ${
|
|
151
|
+
for (const run of entry.runs) {
|
|
152
|
+
lines.push(` ${run.runId}: kept ${run.kept}, deleted ${run.deleted}`);
|
|
155
153
|
}
|
|
156
154
|
}
|
|
157
155
|
return lines.join("\n");
|
|
@@ -165,33 +163,33 @@ function telemetryRead(args, options) {
|
|
|
165
163
|
const flags = parseFlags(args, new Set(["aggregate", "json"]));
|
|
166
164
|
const taskId = stringOption(args, "--task");
|
|
167
165
|
if (taskId === undefined) {
|
|
168
|
-
throw usageError("telemetry read requires --task <id>.", "yui telemetry read --task <id> [--
|
|
166
|
+
throw usageError("telemetry read requires --task <id>.", "yui telemetry read --task <id> [--run <id>] [--aggregate]");
|
|
169
167
|
}
|
|
170
|
-
const
|
|
168
|
+
const runId = stringOption(args, "--run");
|
|
171
169
|
const limit = integerOption(args, "--limit", 100);
|
|
172
170
|
const offset = integerOption(args, "--offset", 0);
|
|
173
171
|
const telemetry = new SqliteTelemetryStore(options.home, {
|
|
174
172
|
mode: telemetryMode(storeConfig(options)),
|
|
175
173
|
terminalKeep: resolveTerminalKeep(storeConfig(options).telemetryTerminalKeep),
|
|
176
|
-
|
|
174
|
+
runCap: resolveRunCap(storeConfig(options).telemetryRunCap)
|
|
177
175
|
});
|
|
178
176
|
try {
|
|
179
177
|
if (flags.has("aggregate")) {
|
|
180
|
-
if (
|
|
181
|
-
const aggregates = telemetry.
|
|
178
|
+
if (runId === undefined) {
|
|
179
|
+
const aggregates = telemetry.listRunAggregates(taskId);
|
|
182
180
|
if (options.json || flags.has("json"))
|
|
183
181
|
return JSON.stringify(aggregates, null, 2);
|
|
184
182
|
return aggregates.map((aggregate) => formatAggregate(aggregate)).join("\n") || "(no telemetry)";
|
|
185
183
|
}
|
|
186
|
-
const aggregate = telemetry.aggregate(taskId,
|
|
184
|
+
const aggregate = telemetry.aggregate(taskId, runId);
|
|
187
185
|
if (options.json || flags.has("json"))
|
|
188
186
|
return JSON.stringify(aggregate, null, 2);
|
|
189
|
-
return aggregate === null ? "(no telemetry for this
|
|
187
|
+
return aggregate === null ? "(no telemetry for this AgentRun)" : formatAggregate(aggregate);
|
|
190
188
|
}
|
|
191
|
-
const page = telemetry.list(taskId,
|
|
189
|
+
const page = telemetry.list(taskId, runId, { limit, offset });
|
|
192
190
|
if (options.json || flags.has("json"))
|
|
193
191
|
return JSON.stringify(page, null, 2);
|
|
194
|
-
const lines = page.items.map((entry) => `${entry.receivedAt} ${entry.
|
|
192
|
+
const lines = page.items.map((entry) => `${entry.receivedAt} ${entry.runId}/${entry.progressId}`
|
|
195
193
|
+ `${entry.sequence === undefined ? "" : ` seq=${entry.sequence}`}`);
|
|
196
194
|
if (page.nextOffset !== null)
|
|
197
195
|
lines.push(`(next offset: ${page.nextOffset})`);
|
|
@@ -240,5 +238,5 @@ function integerOption(args, name, fallback) {
|
|
|
240
238
|
return value;
|
|
241
239
|
}
|
|
242
240
|
function formatAggregate(aggregate) {
|
|
243
|
-
return `${aggregate.
|
|
241
|
+
return `${aggregate.runId}/: count=${aggregate.count} first=${aggregate.firstAt} last=${aggregate.lastAt} maxSequence=${aggregate.maxSequence === null ? "-" : aggregate.maxSequence} errors=${aggregate.errorCount}`;
|
|
244
242
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MAX_RUN_CAP } from "../telemetry/telemetryConfig.js";
|
|
2
2
|
export const CONFIG_DOMAINS = ["system", "runtime", "workflow", "resources", "tools"];
|
|
3
3
|
/**
|
|
4
4
|
* Public durable configuration contract. CLI help, completion, config show,
|
|
@@ -15,7 +15,7 @@ export const CONFIG_DEFINITIONS = Object.freeze([
|
|
|
15
15
|
{ key: "agent-launch-inactivity-timeout-seconds", domain: "runtime", property: "agentLaunchInactivityTimeoutSeconds", label: "Agent launch inactivity timeout", summary: "Maximum launch silence before startup fails, 15-3600 seconds (default: 300).", takesEffect: "After the Controller restarts." },
|
|
16
16
|
{ key: "delivery-timeout-seconds", domain: "runtime", property: "deliveryTimeoutSeconds", label: "Delivery timeout", summary: "Total control-plane delivery retry budget, 5-600 seconds (default: 120).", takesEffect: "After the Controller restarts; internal retry cadence remains automatic." },
|
|
17
17
|
{ key: "leader-next-action", domain: "workflow", property: "leaderNextActionMode", label: "Leader next-action mode", summary: "Leader next-action mode: display, warn, or enforce (default: display).", takesEffect: "The next Leader next-action projection or gate." },
|
|
18
|
-
{ key: "leader-semantic-budget-
|
|
18
|
+
{ key: "leader-semantic-budget-runs", domain: "workflow", property: "leaderSemanticBudgetRuns", label: "Leader semantic budget", summary: "Consecutive completed Leader AgentRuns without durable delivery progress before warning, 1-20 (default: 3).", takesEffect: "The next Leader delivery guard evaluation." },
|
|
19
19
|
{ key: "review", domain: "workflow", property: "review", label: "Review", summary: "Optional global WorkItem review rule: a configured Role plus always, leader, or final trigger. Setup leaves it disabled so the Leader may review directly or delegate selectively.", takesEffect: "The next Candidate snapshot; in-flight Candidates and ReviewRounds keep their policy." },
|
|
20
20
|
{ key: "resources-gc-mode", domain: "resources", property: "resourcesGcMode", label: "Resources GC mode", summary: "Resource GC mode: report or quarantine (default: report).", takesEffect: "The next resource GC operation." },
|
|
21
21
|
{ key: "resources-gc-auto-quarantine", domain: "resources", property: "resourcesGcAutoQuarantine", label: "Resources GC auto-quarantine", summary: "Automatically quarantine eligible terminal Task resources (default: false).", takesEffect: "The next eligible automatic resource GC operation." },
|
|
@@ -23,8 +23,8 @@ export const CONFIG_DEFINITIONS = Object.freeze([
|
|
|
23
23
|
{ key: "tmux-bin", domain: "tools", property: "tmuxBin", label: "Tmux bin", summary: "Command or path to the tmux binary (default: tmux).", takesEffect: "The next CLI-owned tmux invocation; restart the Controller for Controller-owned launches." },
|
|
24
24
|
{ key: "tmux-history-limit", domain: "tools", property: "tmuxHistoryLimit", label: "Tmux history limit", summary: "History lines retained for newly created tmux sessions, 1000-1000000 (default: 100000).", takesEffect: "New tmux sessions; existing sessions report drift until recreated." },
|
|
25
25
|
{ key: "telemetry-enabled", domain: "tools", property: "telemetryEnabled", label: "Diagnostic telemetry", summary: "Enable the optional SQLite diagnostic telemetry projection (default: false); requires a SQLite Home.", takesEffect: "Standalone telemetry commands immediately; scheduler writes after Controller restart." },
|
|
26
|
-
{ key: "telemetry-terminal-keep", domain: "tools", property: "telemetryTerminalKeep", label: "Telemetry terminal keep", summary: "Positive-integer rows retained per terminal
|
|
27
|
-
{ key: "telemetry-
|
|
26
|
+
{ key: "telemetry-terminal-keep", domain: "tools", property: "telemetryTerminalKeep", label: "Telemetry terminal keep", summary: "Positive-integer rows retained per terminal AgentRun (default: 200).", takesEffect: "Explicit retention immediately; automatic retention after the Controller restarts." },
|
|
27
|
+
{ key: "telemetry-run-cap", domain: "tools", property: "telemetryRunCap", label: "Telemetry AgentRun cap", summary: `Positive-integer maximum rows retained per AgentRun, at most ${MAX_RUN_CAP} (default: 50000).`, takesEffect: "Explicit retention immediately; automatic write-time capping after the Controller restarts." }
|
|
28
28
|
]);
|
|
29
29
|
export const CONFIG_KEYS = Object.freeze(CONFIG_DEFINITIONS.map(({ key }) => key));
|
|
30
30
|
export function configDefinitionsForDomain(domain) {
|
package/dist/config/yuiConfig.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DEFAULT_RUN_CAP, DEFAULT_TERMINAL_KEEP, MAX_RUN_CAP } from "../telemetry/telemetryConfig.js";
|
|
2
2
|
import { DEFAULT_RUNTIME_HEALTH_POLICY } from "../runtime/runtimeHealthPolicy.js";
|
|
3
3
|
export const DEFAULT_RECONCILIATION_INTERVAL_SECONDS = 120;
|
|
4
4
|
export const MIN_RECONCILIATION_INTERVAL_SECONDS = 5;
|
|
@@ -99,14 +99,14 @@ export function resolveTelemetryTerminalKeep(value) {
|
|
|
99
99
|
}
|
|
100
100
|
return value;
|
|
101
101
|
}
|
|
102
|
-
export function
|
|
102
|
+
export function resolveTelemetryRunCap(value) {
|
|
103
103
|
if (value === undefined || value === null)
|
|
104
|
-
return
|
|
104
|
+
return DEFAULT_RUN_CAP;
|
|
105
105
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1) {
|
|
106
106
|
throw new TypeError("telemetryTurnCap must be a positive integer.");
|
|
107
107
|
}
|
|
108
|
-
if (value >
|
|
109
|
-
throw new TypeError(`telemetryTurnCap must not exceed ${
|
|
108
|
+
if (value > MAX_RUN_CAP) {
|
|
109
|
+
throw new TypeError(`telemetryTurnCap must not exceed ${MAX_RUN_CAP.toLocaleString("en-US")} (retention cannot be disabled).`);
|
|
110
110
|
}
|
|
111
111
|
return value;
|
|
112
112
|
}
|
|
@@ -115,7 +115,7 @@ export const DEFAULT_CONTROLLER_TASK_CONCURRENCY = 4;
|
|
|
115
115
|
export const MAX_CONTROLLER_TASK_CONCURRENCY = 32;
|
|
116
116
|
export const DEFAULT_AGENT_LAUNCH_INACTIVITY_TIMEOUT_SECONDS = 300;
|
|
117
117
|
export const DEFAULT_DELIVERY_TIMEOUT_SECONDS = 120;
|
|
118
|
-
export const
|
|
118
|
+
export const DEFAULT_LEADER_SEMANTIC_BUDGET_RUNS = 3;
|
|
119
119
|
export const DEFAULT_TMUX_HISTORY_LIMIT = 100_000;
|
|
120
120
|
export function resolveRuntimeHealth(configured) {
|
|
121
121
|
if (configured === undefined || configured === null)
|
|
@@ -141,8 +141,8 @@ export function resolveAgentLaunchInactivityTimeoutSeconds(value) {
|
|
|
141
141
|
export function resolveDeliveryTimeoutSeconds(value) {
|
|
142
142
|
return resolveBoundedPositiveInteger(value, DEFAULT_DELIVERY_TIMEOUT_SECONDS, 5, 600, "deliveryTimeoutSeconds");
|
|
143
143
|
}
|
|
144
|
-
export function
|
|
145
|
-
return resolveBoundedPositiveInteger(value,
|
|
144
|
+
export function resolveLeaderSemanticBudgetRuns(value) {
|
|
145
|
+
return resolveBoundedPositiveInteger(value, DEFAULT_LEADER_SEMANTIC_BUDGET_RUNS, 1, 20, "leaderSemanticBudgetRuns");
|
|
146
146
|
}
|
|
147
147
|
export function resolveTmuxHistoryLimit(value) {
|
|
148
148
|
return resolveBoundedPositiveInteger(value, DEFAULT_TMUX_HISTORY_LIMIT, 1_000, 1_000_000, "tmuxHistoryLimit");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { normalizedUniqueText, optionalText, requireIdentity, requirePositiveInteger, requireText, requireTimestamp } from "../domain/validation.js";
|
|
3
|
-
import {
|
|
3
|
+
import { MAX_CONTEXT_SOURCE_RUN_BYTES, MAX_CONTEXT_SOURCE_RUNS } from "./sourceRunContext.js";
|
|
4
4
|
export const CONTEXT_SNAPSHOT_SCHEMA_VERSION = 1;
|
|
5
5
|
export const CONTEXT_SNAPSHOT_MAX_RESOURCES = 256;
|
|
6
6
|
export const CONTEXT_SNAPSHOT_MAX_RESOURCE_BYTES = 4 * 1024 * 1024;
|
|
@@ -185,16 +185,16 @@ function validateContextRef(value) {
|
|
|
185
185
|
function normalizeSnapshotResources(values, refs) {
|
|
186
186
|
if (!Array.isArray(values))
|
|
187
187
|
throw new Error("Context Snapshot resources must be an array.");
|
|
188
|
-
const
|
|
188
|
+
const sourceRunCount = values.filter((resource) => (resource !== null
|
|
189
189
|
&& typeof resource === "object"
|
|
190
190
|
&& !Array.isArray(resource)
|
|
191
191
|
&& resource.ref !== null
|
|
192
192
|
&& typeof resource.ref === "object"
|
|
193
|
-
&& resource.ref.store === "source-
|
|
194
|
-
if (
|
|
195
|
-
throw new Error(`Context Snapshot exceeds ${
|
|
193
|
+
&& resource.ref.store === "source-run")).length;
|
|
194
|
+
if (sourceRunCount > MAX_CONTEXT_SOURCE_RUNS) {
|
|
195
|
+
throw new Error(`Context Snapshot exceeds ${MAX_CONTEXT_SOURCE_RUNS} source AgentRuns.`);
|
|
196
196
|
}
|
|
197
|
-
if (values.length -
|
|
197
|
+
if (values.length - sourceRunCount > CONTEXT_SNAPSHOT_MAX_RESOURCES) {
|
|
198
198
|
throw new Error(`Context Snapshot exceeds ${CONTEXT_SNAPSHOT_MAX_RESOURCES} resources.`);
|
|
199
199
|
}
|
|
200
200
|
const byRef = new Map(refs.map((ref) => [contextRefKey(ref), ref]));
|
|
@@ -220,13 +220,13 @@ function normalizeSnapshotResources(values, refs) {
|
|
|
220
220
|
|| new Set(resources.map(({ ref }) => contextRefKey(ref))).size !== refs.length) {
|
|
221
221
|
throw new Error("Context Snapshot resources must cover every ref exactly once.");
|
|
222
222
|
}
|
|
223
|
-
const ordinary = resources.filter(({ ref }) => ref.store !== "source-
|
|
224
|
-
const
|
|
223
|
+
const ordinary = resources.filter(({ ref }) => ref.store !== "source-run");
|
|
224
|
+
const sourceRuns = resources.filter(({ ref }) => ref.store === "source-run");
|
|
225
225
|
if (Buffer.byteLength(JSON.stringify(ordinary), "utf8") > CONTEXT_SNAPSHOT_MAX_BYTES) {
|
|
226
226
|
throw new Error(`Context Snapshot resources exceed ${CONTEXT_SNAPSHOT_MAX_BYTES} bytes.`);
|
|
227
227
|
}
|
|
228
|
-
if (Buffer.byteLength(JSON.stringify(
|
|
229
|
-
throw new Error(`Context Snapshot source
|
|
228
|
+
if (Buffer.byteLength(JSON.stringify(sourceRuns), "utf8") > MAX_CONTEXT_SOURCE_RUN_BYTES) {
|
|
229
|
+
throw new Error(`Context Snapshot source AgentRuns exceed ${MAX_CONTEXT_SOURCE_RUN_BYTES} bytes.`);
|
|
230
230
|
}
|
|
231
231
|
return Object.freeze(resources);
|
|
232
232
|
}
|
|
@@ -9,28 +9,28 @@ export function buildLeaderContext(context) {
|
|
|
9
9
|
export function buildWorkerContext(context) {
|
|
10
10
|
return renderDispatchContext("worker", context);
|
|
11
11
|
}
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
12
|
+
const WORKER_RUN_COMPLETION_MARKER = "Yui Role AgentRun result requirement:";
|
|
13
|
+
const WORKER_RUN_COMPLETION_REQUIREMENT = [
|
|
14
|
+
WORKER_RUN_COMPLETION_MARKER,
|
|
15
15
|
"End the Provider turn with a truthful final report. Yui records that native turn result "
|
|
16
|
-
+ "for the current
|
|
16
|
+
+ "for the current AgentRun automatically; no completion command is required.",
|
|
17
17
|
"If you cannot finally determine success, failure, completeness, or the correct "
|
|
18
18
|
+ "disposition, do not guess, silently stop, or hide uncertainty behind a success "
|
|
19
19
|
+ "summary. Label the final report uncertain, incomplete, "
|
|
20
20
|
+ "blocked, or requiring Leader judgment.",
|
|
21
|
-
"Report the most complete truthful evidence available and, when applicable: exact
|
|
21
|
+
"Report the most complete truthful evidence available and, when applicable: exact AgentRun, "
|
|
22
22
|
+ "WorkItem, and native Session identity; actions actually performed; changed paths "
|
|
23
23
|
+ "and commit/worktree state; checks actually run and their outcomes; provider, runtime, "
|
|
24
24
|
+ "or permission errors; the last confirmed lifecycle boundary; work not performed; "
|
|
25
25
|
+ "unresolved assumptions or decisions; residual risks; confidence; and bounded next options.",
|
|
26
|
-
"The Provider turn ending closes only this
|
|
27
|
-
+ "WorkItem completion, ChangeSet capture, Integration, or Task completion. Review
|
|
26
|
+
"The Provider turn ending closes only this AgentRun. It does not imply Leader acceptance, "
|
|
27
|
+
+ "WorkItem completion, ChangeSet capture, Integration, or Task completion. Review AgentRuns "
|
|
28
28
|
+ "report findings, verification gaps, and limits; the Leader decides disposition."
|
|
29
29
|
].join("\n");
|
|
30
|
-
export function
|
|
31
|
-
return input.endsWith(`\n\n${
|
|
30
|
+
export function ensureWorkerRunCompletionRequirement(input) {
|
|
31
|
+
return input.endsWith(`\n\n${WORKER_RUN_COMPLETION_REQUIREMENT}`)
|
|
32
32
|
? input
|
|
33
|
-
: `${input}\n\n${
|
|
33
|
+
: `${input}\n\n${WORKER_RUN_COMPLETION_REQUIREMENT}`;
|
|
34
34
|
}
|
|
35
35
|
function renderDispatchContext(kind, context) {
|
|
36
36
|
const profile = context.role;
|
|
@@ -58,7 +58,7 @@ function renderDispatchContext(kind, context) {
|
|
|
58
58
|
].filter((section) => section !== null && section.length > 0)
|
|
59
59
|
.join("\n\n");
|
|
60
60
|
return kind === "worker"
|
|
61
|
-
?
|
|
61
|
+
? ensureWorkerRunCompletionRequirement(rendered)
|
|
62
62
|
: rendered;
|
|
63
63
|
}
|
|
64
64
|
function renderContextLayers(context, kind) {
|
|
@@ -12,7 +12,7 @@ const BUILTIN_YUI_SKILLS = new Set([
|
|
|
12
12
|
]);
|
|
13
13
|
/**
|
|
14
14
|
* Compiles stable Role policy for an Agent-native instruction channel.
|
|
15
|
-
* Dynamic wakeups and
|
|
15
|
+
* Dynamic wakeups and AgentRun assignments deliberately remain outside this value.
|
|
16
16
|
*/
|
|
17
17
|
export function compileRoleSessionContext(yuiHome, role, owner, options = {}) {
|
|
18
18
|
const kind = roleSessionKind(role, owner, options.purpose ?? "execution");
|
|
@@ -48,6 +48,9 @@ export function roleSessionKind(role, owner, purpose) {
|
|
|
48
48
|
}
|
|
49
49
|
if (purpose === "review")
|
|
50
50
|
return "reviewer";
|
|
51
|
+
// Planning is the same logical Leader as execution, so it deliberately
|
|
52
|
+
// resolves to the same kind and the same compatibility identity. Activation
|
|
53
|
+
// must not force a new Session just because the Task left Draft.
|
|
51
54
|
return role.name === SYSTEM_LEADER_ROLE ? "leader" : "worker";
|
|
52
55
|
}
|
|
53
56
|
function renderRoleCore(kind, role, owner) {
|
|
@@ -66,13 +69,13 @@ function renderRoleCore(kind, role, owner) {
|
|
|
66
69
|
case "leader":
|
|
67
70
|
return [
|
|
68
71
|
`You are the Yui Leader for Task ${owner.scope === "task" ? owner.taskId : role.name}.`,
|
|
69
|
-
"Own Task
|
|
72
|
+
"Own the Task outcome; do bounded work directly or delegate independently owned requirements when useful.",
|
|
70
73
|
"Follow the injected yui-leader Skill for Yui coordination."
|
|
71
74
|
];
|
|
72
75
|
case "reviewer":
|
|
73
76
|
return [
|
|
74
77
|
`You are Yui review Role ${role.name} for Task ${owner.scope === "task" ? owner.taskId : role.name}.`,
|
|
75
|
-
"Review only the exact frozen ReviewRound scope assigned to this
|
|
78
|
+
"Review only the exact frozen ReviewRound scope assigned to this AgentRun.",
|
|
76
79
|
"Follow the injected yui-reviewer Skill while reviewing Yui work."
|
|
77
80
|
];
|
|
78
81
|
case "worker":
|