@zq-silk/yui 0.11.2 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +23 -4
- package/README.md +80 -13
- package/dist/cli/commandCatalog.js +30 -5
- package/dist/cli.js +105 -43
- package/dist/commands/configCommands.js +12 -45
- package/dist/commands/executionAuditCommands.js +1 -1
- package/dist/commands/jobCommands.js +4 -10
- package/dist/commands/projectCommands.js +581 -2
- package/dist/commands/taskCommands.js +159 -172
- package/dist/commands/taskCompletionGate.js +29 -54
- package/dist/commands/taskContextCommand.js +55 -11
- package/dist/commands/taskInputCommands.js +8 -5
- package/dist/commands/taskIntegrationCommands.js +2 -1
- package/dist/commands/taskNextActionCommand.js +56 -6
- package/dist/commands/taskOverviewCommand.js +17 -31
- package/dist/commands/taskRoleRuntimeStatus.js +24 -0
- package/dist/commands/taskWorkspaceCommands.js +5 -2
- package/dist/config/configCatalog.js +2 -2
- package/dist/config/yuiConfig.js +3 -7
- package/dist/context/wakeNotification.js +20 -5
- package/dist/controller/agentRuntimeObserver.js +247 -51
- package/dist/controller/clientRuntime.js +1 -1
- package/dist/controller/controller.js +8 -12
- package/dist/controller/fileSchedulerStoreAdapter.js +146 -198
- package/dist/controller/runtime.js +3 -3
- package/dist/controller/runtimeEventInbox.js +17 -7
- package/dist/controller/runtimeEventProcessor.js +12 -19
- package/dist/controller/runtimeObservationHook.js +45 -0
- package/dist/execution/resourceBroker.js +5 -4
- package/dist/executor/agentExecutor.js +4 -4
- package/dist/executor/effectiveLaunch.js +8 -48
- package/dist/executor/fileRoleLaunchPlanner.js +36 -16
- package/dist/executor/workspacePreflightClassification.js +23 -2
- package/dist/interaction/operatorPresentation.js +33 -89
- package/dist/lifecycle/exactRunTerminalization.js +1 -2
- package/dist/lifecycle/taskRoleSessionReset.js +5 -13
- package/dist/observability/orchestrationMetrics.js +8 -3
- package/dist/profile/agentProfile.js +1 -1
- package/dist/release/cliHomeReleaseFence.js +123 -0
- package/dist/repository/checkoutSwap.js +61 -0
- package/dist/repository/gitWorkspace.js +36 -0
- package/dist/repository/project.js +53 -3
- package/dist/repository/taskWorkspacePreparer.js +176 -60
- package/dist/resources/sqliteResourceRegistry.js +1 -1
- package/dist/review/deltaRecheck.js +12 -51
- package/dist/review/reviewAcceptance.js +26 -0
- package/dist/review/reviewConfig.js +0 -31
- package/dist/review/reviewDecision.js +113 -0
- package/dist/review/reviewOutcomeClassifier.js +1 -1
- package/dist/review/reviewRound.js +1 -1
- package/dist/review/reviewerAvailability.js +69 -0
- package/dist/runtime/agentDriverObservation.js +24 -10
- package/dist/runtime/builtinAgentDrivers.js +4 -3
- package/dist/runtime/builtinTranscriptObserver.js +301 -64
- package/dist/runtime/builtinTranscriptUsage.js +9 -7
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/runtimeObservation.js +13 -0
- package/dist/runtime/runtimeProjection.js +16 -25
- package/dist/runtime/sessionTokenMetrics.js +181 -0
- package/dist/runtime/structuredProviderHost.js +7 -1
- package/dist/scheduler/activeRoleRunDelivery.js +4 -4
- package/dist/scheduler/activeTaskProgress.js +7 -6
- package/dist/scheduler/leaderWakeupProcessor.js +3 -5
- package/dist/scheduler/operatorEvent.js +34 -0
- package/dist/scheduler/operatorInputNotificationProcessor.js +54 -94
- package/dist/scheduler/roleRunStall.js +0 -14
- package/dist/scheduler/taskExecutionProjection.js +97 -76
- package/dist/scheduler/taskObservabilityProjection.js +10 -11
- package/dist/storage/migration/productionRegistry.js +467 -0
- package/dist/storage/sqliteSchema.js +18 -8
- package/dist/storage/sqliteStore.js +61 -21
- package/dist/storage/storeRpc.js +0 -1
- package/dist/storage/taskStore.js +47 -31
- package/dist/storage/upgrade/recordVersions.js +3 -2
- package/dist/storage/upgrade/sqliteMigrationTarget.js +30 -8
- package/dist/storage/upgrade/sqliteRecordMigrationTarget.js +23 -11
- package/dist/storage/upgrade/sqliteStateMigration.js +66 -8
- package/dist/task/completionReadiness.js +10 -6
- package/dist/task/nextAction.js +82 -24
- package/dist/telemetry/sqliteTelemetryStore.js +1 -1
- package/dist/web/assets/client/components.js +13 -3
- package/dist/web/assets/client/i18n.js +6 -2
- package/dist/web/webSnapshot.js +4 -0
- package/i18n/README.zh-CN.md +2 -2
- package/package.json +1 -1
- package/skills/yui-leader/SKILL.md +53 -16
- package/skills/yui-operator/SKILL.md +9 -0
- package/skills/yui-reviewer/SKILL.md +28 -7
- package/dist/context/sessionContextBudget.js +0 -71
- package/dist/lifecycle/contextBudgetRollover.js +0 -81
- package/dist/scheduler/operatorNotification.js +0 -59
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { enqueueWork } from "../coordination/workMailboxQueue.js";
|
|
2
|
-
import { validateRoleSessionSet } from "../executor/agentExecutor.js";
|
|
3
|
-
import { createTaskEvent } from "../event/taskEvent.js";
|
|
4
|
-
import { RUNTIME_CLEANUP_REQUIRED_REASON, runtimeLifecycleTarget } from "../runtime/lifecycleReservation.js";
|
|
5
|
-
/**
|
|
6
|
-
* Issue 04 (context token budget): retires one native Session generation that
|
|
7
|
-
* crossed the hard context budget so the next Leader wake starts a fresh
|
|
8
|
-
* generation. This is a controlled rollover, not a failure: the durable Task
|
|
9
|
-
* records are the checkpoint, the bounded context snapshot re-establishes
|
|
10
|
-
* working context for the new generation, and the retired Session is kept in
|
|
11
|
-
* history as `stopped` with an auditable event. The Controller separately
|
|
12
|
-
* owns verified process cleanup through the runtime cleanup lane.
|
|
13
|
-
*/
|
|
14
|
-
export const CONTEXT_BUDGET_ROLLOVER_REASON = "context-budget-hard-limit";
|
|
15
|
-
export function rolloverTaskRoleSessionForContextBudget(store, taskId, roleName, evidence, now) {
|
|
16
|
-
const task = store.getTask(taskId);
|
|
17
|
-
if (task === null)
|
|
18
|
-
throw new Error(`Task not found: ${taskId}.`);
|
|
19
|
-
if (task.status !== "active") {
|
|
20
|
-
throw new Error(`Task is not active: ${task.id}/${task.status}.`);
|
|
21
|
-
}
|
|
22
|
-
const role = store.getRole(task.id, roleName);
|
|
23
|
-
if (role === null)
|
|
24
|
-
throw new Error(`Role not found: ${task.id}/${roleName}.`);
|
|
25
|
-
const set = store.getTaskRoleSessionSet(task.id, role.name);
|
|
26
|
-
const current = set?.sessions[set.activeAgentId];
|
|
27
|
-
if (set === null || set === undefined || current === undefined) {
|
|
28
|
-
// No live generation to retire; the caller can launch fresh directly.
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const timestamp = now.toISOString();
|
|
32
|
-
const reason = `${CONTEXT_BUDGET_ROLLOVER_REASON} (peak ${evidence.peakTokens} >= hard ${evidence.hardTokens} tokens)`;
|
|
33
|
-
enqueueWork(store, runtimeLifecycleTarget({ scope: "task", taskId: task.id, roleName: role.name }), RUNTIME_CLEANUP_REQUIRED_REASON, now, [{ type: "task", id: task.id }]);
|
|
34
|
-
const retired = retireStoppedTaskRoleSession(set, timestamp);
|
|
35
|
-
store.saveTaskRoleSessionSet(retired);
|
|
36
|
-
const eventId = store.nextEventId(task.id);
|
|
37
|
-
store.saveEvent(task.id, createTaskEvent(eventId, task.id, "runtime.role-session-reset", {
|
|
38
|
-
roleName: role.name,
|
|
39
|
-
reason,
|
|
40
|
-
peakTokens: String(evidence.peakTokens),
|
|
41
|
-
hardTokens: String(evidence.hardTokens),
|
|
42
|
-
...(current.nativeSessionId === undefined
|
|
43
|
-
? {}
|
|
44
|
-
: { nativeSessionId: current.nativeSessionId }),
|
|
45
|
-
...(current.launchId === undefined ? {} : { launchId: current.launchId })
|
|
46
|
-
}, now));
|
|
47
|
-
return Object.freeze({
|
|
48
|
-
taskId: task.id,
|
|
49
|
-
roleName: role.name,
|
|
50
|
-
eventId,
|
|
51
|
-
...(current.nativeSessionId === undefined
|
|
52
|
-
? {}
|
|
53
|
-
: { retiredNativeSessionId: current.nativeSessionId }),
|
|
54
|
-
...(current.launchId === undefined ? {} : { retiredLaunchId: current.launchId })
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Retires the current generation to history as `stopped` (not `broken`:
|
|
59
|
-
* a budget rollover is not a Session failure) and clears the Turn fence so
|
|
60
|
-
* the next launch is a fresh generation.
|
|
61
|
-
*/
|
|
62
|
-
function retireStoppedTaskRoleSession(set, timestamp) {
|
|
63
|
-
validateRoleSessionSet(set);
|
|
64
|
-
const current = set.sessions[set.activeAgentId];
|
|
65
|
-
const sessions = { ...set.sessions };
|
|
66
|
-
delete sessions[set.activeAgentId];
|
|
67
|
-
const history = current === undefined
|
|
68
|
-
? set.history
|
|
69
|
-
: [
|
|
70
|
-
...(set.history ?? []),
|
|
71
|
-
{ ...current, status: "stopped", updatedAt: timestamp }
|
|
72
|
-
];
|
|
73
|
-
return validateRoleSessionSet({
|
|
74
|
-
...set,
|
|
75
|
-
sessions,
|
|
76
|
-
...(history === undefined ? {} : { history }),
|
|
77
|
-
inFlight: null,
|
|
78
|
-
providerBinding: null,
|
|
79
|
-
updatedAt: timestamp
|
|
80
|
-
});
|
|
81
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export const CURRENT_OPERATOR_NOTIFICATION_SCHEMA_VERSION = 1;
|
|
2
|
-
export function createLeaderRecoveryNotification(taskId, message, now, existing) {
|
|
3
|
-
const timestamp = now.toISOString();
|
|
4
|
-
return {
|
|
5
|
-
schemaVersion: CURRENT_OPERATOR_NOTIFICATION_SCHEMA_VERSION,
|
|
6
|
-
taskId: requiredText(taskId, "Task id"),
|
|
7
|
-
type: "leader-recovery-failed",
|
|
8
|
-
message: requiredText(message, "Operator notification message"),
|
|
9
|
-
createdAt: existing?.type === "leader-recovery-failed"
|
|
10
|
-
? existing.createdAt
|
|
11
|
-
: timestamp,
|
|
12
|
-
updatedAt: timestamp
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export function createTaskTerminalNotification(taskId, status, by, summary, now) {
|
|
16
|
-
const timestamp = now.toISOString();
|
|
17
|
-
return {
|
|
18
|
-
schemaVersion: CURRENT_OPERATOR_NOTIFICATION_SCHEMA_VERSION,
|
|
19
|
-
taskId: requiredText(taskId, "Task id"),
|
|
20
|
-
type: "task-terminal",
|
|
21
|
-
status,
|
|
22
|
-
by,
|
|
23
|
-
summary: requiredText(summary, "Task terminal summary"),
|
|
24
|
-
createdAt: timestamp,
|
|
25
|
-
updatedAt: timestamp
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export function createLeaderStallNotification(taskId, runId, progressAt, evidenceKey, now, existing) {
|
|
29
|
-
const timestamp = now.toISOString();
|
|
30
|
-
const previous = existing?.type === "leader-stalled"
|
|
31
|
-
&& existing.runId === runId
|
|
32
|
-
&& existing.progressAt === progressAt
|
|
33
|
-
? existing
|
|
34
|
-
: undefined;
|
|
35
|
-
return {
|
|
36
|
-
schemaVersion: CURRENT_OPERATOR_NOTIFICATION_SCHEMA_VERSION,
|
|
37
|
-
taskId: requiredText(taskId, "Task id"),
|
|
38
|
-
type: "leader-stalled",
|
|
39
|
-
message: requiredText([
|
|
40
|
-
`Leader Run ${runId} is truly stalled for Task ${taskId}.`,
|
|
41
|
-
`lastProgressAt=${progressAt}`,
|
|
42
|
-
`classification=truly-stalled`,
|
|
43
|
-
`evidence=${evidenceKey}`,
|
|
44
|
-
"Inspect the Task context and decide whether to continue, reset, retry, change Agent, or request user input; Controller performed no automatic action."
|
|
45
|
-
].join(" "), "Operator notification message"),
|
|
46
|
-
runId: requiredText(runId, "Leader Run id"),
|
|
47
|
-
progressAt: requiredText(progressAt, "Leader progress timestamp"),
|
|
48
|
-
classification: "truly-stalled",
|
|
49
|
-
evidenceKey: requiredText(evidenceKey, "Leader stall evidence"),
|
|
50
|
-
createdAt: previous?.createdAt ?? timestamp,
|
|
51
|
-
updatedAt: timestamp
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function requiredText(value, label) {
|
|
55
|
-
const normalized = value.trim();
|
|
56
|
-
if (normalized.length === 0)
|
|
57
|
-
throw new Error(`${label} is required.`);
|
|
58
|
-
return normalized;
|
|
59
|
-
}
|