@zq-silk/yui 0.14.1 → 0.15.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 +91 -47
- package/README.md +275 -145
- package/dist/agent/managedRuntimeEnvironment.js +5 -8
- package/dist/cli/commandCatalog.js +74 -109
- package/dist/cli/helpRenderer.js +1 -2
- package/dist/cli/interactionCandidates.js +10 -0
- package/dist/cli/interactionPolicy.js +76 -37
- package/dist/cli/roleWizard.js +5 -6
- package/dist/cli/updateCommand.js +17 -9
- package/dist/cli/updateOrchestrator.js +87 -19
- package/dist/cli/updatePorts.js +79 -13
- package/dist/cli/upgradeCommand.js +105 -23
- package/dist/cli.js +268 -231
- package/dist/commands/agentCommands.js +13 -0
- package/dist/commands/configCommands.js +7 -19
- package/dist/commands/configOverview.js +3 -2
- package/dist/commands/controllerCommands.js +1 -1
- package/dist/commands/durableJobCommands.js +1 -1
- package/dist/commands/executionAuditCommands.js +4 -9
- package/dist/commands/globalRoleCommands.js +17 -0
- package/dist/commands/profileCommands.js +200 -30
- package/dist/commands/sessionCommands.js +1 -1
- package/dist/commands/taskActor.js +29 -127
- package/dist/commands/taskChangeSetCommands.js +1 -3
- package/dist/commands/taskCommands.js +1771 -2107
- package/dist/commands/taskCompletionGate.js +27 -103
- package/dist/commands/taskContextCommand.js +47 -80
- package/dist/commands/taskExecutionCommands.js +9 -27
- package/dist/commands/taskInputCommands.js +10 -10
- package/dist/commands/taskIntegrationCommands.js +69 -61
- package/dist/commands/taskIntegrationQueueCommands.js +1 -1
- package/dist/commands/taskNextActionCommand.js +8 -29
- package/dist/commands/taskOverviewCommand.js +25 -3
- package/dist/commands/taskPublicationCommands.js +151 -85
- package/dist/commands/taskPublicationVerifyCommand.js +181 -0
- package/dist/commands/taskRemoteDeliveryCommand.js +134 -0
- package/dist/commands/taskRoleRuntimeStatus.js +5 -6
- package/dist/commands/taskUpstreamCommands.js +79 -95
- package/dist/config/configCatalog.js +1 -1
- package/dist/context/contextSnapshot.js +17 -2
- package/dist/context/sourceTurnContext.js +30 -0
- package/dist/context/turnContextPack.js +107 -48
- package/dist/context/turnInputContract.js +11 -4
- package/dist/context/wakeNotification.js +84 -22
- package/dist/controller/agentRuntimeObserver.js +9 -12
- package/dist/controller/clientRuntime.js +13 -13
- package/dist/controller/controller.js +11 -11
- package/dist/controller/fileSchedulerStoreAdapter.js +262 -219
- package/dist/controller/jobControl.js +11 -10
- package/dist/controller/resourceInventory.js +6 -6
- package/dist/controller/resourceInventoryLinux.js +2 -2
- package/dist/controller/runtime.js +18 -61
- package/dist/controller/runtimeEventInbox.js +57 -34
- package/dist/controller/runtimeEventProcessor.js +36 -96
- package/dist/controller/runtimeHookTurnFence.js +33 -57
- package/dist/controller/runtimeLaunchCoordinator.js +44 -40
- package/dist/controller/runtimeObservationHook.js +18 -12
- package/dist/controller/sessionNotify.js +43 -28
- package/dist/controller/sessionOwnerReconciliation.js +21 -21
- package/dist/controller/structuredProviderObservation.js +13 -16
- package/dist/coordination/workMailboxQueue.js +132 -0
- package/dist/core/controllerServer.js +6 -5
- package/dist/doctor/doctor.js +37 -14
- package/dist/domain/agentResultTransport.js +60 -0
- package/dist/execution/executionHealth.js +111 -118
- package/dist/execution/reviewMainTurn.js +161 -0
- package/dist/execution/workItemExecution.js +454 -0
- package/dist/execution/workItemExecutionProjection.js +309 -0
- package/dist/execution/workItemMainTurn.js +164 -0
- package/dist/executor/agentExecutor.js +19 -19
- package/dist/executor/executorRegistry.js +7 -28
- package/dist/executor/fileRoleLaunchPlanner.js +16 -82
- package/dist/external/githubPublicationVerifier.js +114 -0
- package/dist/external/gitlabPublicationVerifier.js +158 -0
- package/dist/external/pinnedCommandRunner.js +73 -0
- package/dist/integration/changeSetManifest.js +0 -3
- package/dist/integration/deliveryObligation.js +43 -6
- package/dist/integration/gitIntegrationService.js +284 -101
- package/dist/integration/integrationAttempt.js +64 -14
- package/dist/integration/integrationQueueEntry.js +5 -35
- package/dist/integration/integrationQueueService.js +65 -194
- package/dist/lifecycle/canonicalLifecycleEvent.js +16 -15
- package/dist/lifecycle/exactTurnTerminalization.js +100 -97
- package/dist/message/message.js +16 -0
- package/dist/observability/executionAudit.js +4 -25
- package/dist/observability/faultClassification.js +58 -70
- package/dist/observability/orchestrationMetrics.js +8 -50
- package/dist/observability/runtimeIdentity.js +48 -50
- package/dist/profile/agentProfile.js +60 -15
- package/dist/profile/agentProfileRuntime.js +100 -0
- package/dist/release/releaseWorkflowPorts.js +5 -68
- package/dist/release/runtimeRelease.js +9 -1
- package/dist/repository/executionLaneGitSnapshot.js +80 -0
- package/dist/repository/gitWorkspace.js +9 -67
- package/dist/repository/taskBaseFreshness.js +3 -1
- package/dist/repository/taskWorkspaceCoordinator.js +32 -4
- package/dist/repository/taskWorkspacePreparer.js +252 -411
- package/dist/resources/liveReferences.js +6 -55
- package/dist/resources/resourceDiscovery.js +1 -30
- package/dist/resources/resourceRegistrar.js +0 -23
- package/dist/review/deltaRecheck.js +8 -65
- package/dist/review/reviewAcceptance.js +22 -19
- package/dist/review/reviewConfig.js +0 -10
- package/dist/review/reviewDecision.js +2 -2
- package/dist/review/reviewRound.js +147 -273
- package/dist/review/reviewerAvailability.js +13 -23
- package/dist/role/role.js +3 -0
- package/dist/runtime/agentDriverObservation.js +1 -1
- package/dist/runtime/agentHost.js +51 -51
- package/dist/runtime/builtinAgentDrivers.js +9 -2
- package/dist/runtime/codexAppServerRuntime.js +23 -5
- package/dist/runtime/exactControlPlane.js +22 -296
- package/dist/runtime/firstProgressAdvisory.js +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/launchBroker.js +11 -11
- package/dist/runtime/lifecycleReservation.js +2 -2
- package/dist/runtime/managedCaller.js +111 -0
- package/dist/runtime/ports.js +16 -3
- package/dist/runtime/preallocatedNativeSession.js +2 -2
- package/dist/runtime/processExitObservation.js +3 -2
- package/dist/runtime/providerContinuationReconciliationService.js +1 -1
- package/dist/runtime/runtimeBinding.js +1 -1
- package/dist/runtime/runtimeObservation.js +33 -16
- package/dist/runtime/runtimeSessionCandidate.js +2 -2
- package/dist/runtime/runtimeStopReceipt.js +11 -11
- package/dist/runtime/sessionLaunchRequest.js +2 -2
- package/dist/runtime/sessionOwnerIdentity.js +9 -9
- package/dist/runtime/sessionOwnerRegistry.js +13 -13
- package/dist/runtime/sessionReconciliation.js +4 -4
- package/dist/runtime/sessionTerminationGuard.js +9 -9
- package/dist/runtime/sessionTokenMetrics.js +5 -7
- package/dist/runtime/structuredProviderHost.js +5 -5
- package/dist/runtime/taskRuntimeIsolation.js +24 -24
- package/dist/runtime/tmuxAdapters.js +32 -30
- package/dist/scheduler/activeRoleTurnDelivery.js +37 -15
- package/dist/scheduler/leaderWakeupProcessor.js +78 -55
- package/dist/scheduler/roleTurnLiveness.js +6 -6
- package/dist/scheduler/roleTurnStall.js +8 -9
- package/dist/scheduler/taskExecutionProjection.js +19 -41
- package/dist/scheduler/taskObservabilityProjection.js +75 -122
- package/dist/storage/currentTaskStore.js +6 -4
- package/dist/storage/sqliteSchema.js +135 -80
- package/dist/storage/sqliteStore.js +69 -52
- package/dist/storage/storageSchema.js +92 -230
- package/dist/storage/storageVersions.js +12 -13
- package/dist/storage/taskStore.js +8 -8
- package/dist/storage/upgrade/upgradeOrchestrator.js +276 -85
- package/dist/task/completionReadiness.js +17 -98
- package/dist/task/deliveryGuard.js +9 -11
- package/dist/task/draftPlan.js +142 -0
- package/dist/task/nextAction.js +179 -477
- package/dist/task/publicationVerification.js +1 -0
- package/dist/task/remoteDelivery.js +233 -0
- package/dist/task/task.js +108 -4
- package/dist/task/taskRecordReference.js +0 -1
- package/dist/turn/turn.js +109 -16
- package/dist/verification/verificationGateService.js +0 -26
- package/dist/version.js +3 -3
- package/dist/web/assets/client/components.js +99 -121
- package/dist/web/assets/client/i18n.js +136 -58
- package/dist/web/assets/client/view.js +44 -0
- package/dist/web/assets/styles/cards.js +3 -15
- package/dist/web/assets/styles/widgets.js +4 -0
- package/dist/web/webSnapshot.js +29 -14
- package/dist/workItem/dependencyGate.js +34 -0
- package/dist/workItem/workItem.js +99 -266
- package/dist/workspace/workItemChangeSetManager.js +15 -59
- package/docs/task-local-identity.md +9 -9
- package/i18n/README.zh-CN.md +189 -74
- package/package.json +1 -1
- package/skills/yui-leader/SKILL.md +272 -782
- package/skills/yui-operator/SKILL.md +190 -365
- package/skills/yui-reviewer/SKILL.md +40 -33
- package/skills/yui-runtime/SKILL.md +22 -0
- package/skills/yui-worker/SKILL.md +19 -6
- package/dist/execution/candidateConvergence.js +0 -623
- package/dist/execution/executionGroup.js +0 -854
- package/dist/execution/resourceBroker.js +0 -426
- package/dist/executor/launchPlan.js +0 -16
- package/dist/review/reviewFinding.js +0 -240
- package/dist/review/reviewFindingLedger.js +0 -550
- package/dist/review/reviewOutcomeClassifier.js +0 -255
- package/dist/scheduler/resourceQueueProjection.js +0 -71
- package/dist/storage/upgrade/recordVersions.js +0 -82
- package/dist/task/repairWave.js +0 -150
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
export const
|
|
3
|
+
import Database from "better-sqlite3";
|
|
4
|
+
import { inspectSqliteSchemaMigrations, storageMigrationPlan } from "./sqliteSchema.js";
|
|
5
|
+
import { CURRENT_STORAGE_VERSION, MIN_SUPPORTED_STORAGE_VERSION } from "./storageVersions.js";
|
|
6
|
+
export { CURRENT_STORAGE_VERSION, MIN_SUPPORTED_STORAGE_VERSION } from "./storageVersions.js";
|
|
7
|
+
export const CURRENT_DATABASE_FILENAME = "yui.db";
|
|
8
8
|
export class StorageSchemaError extends Error {
|
|
9
9
|
code;
|
|
10
10
|
constructor(code, message, options) {
|
|
@@ -13,257 +13,119 @@ export class StorageSchemaError extends Error {
|
|
|
13
13
|
this.code = code;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Inspect the one authoritative SQLite migration head without changing it.
|
|
18
|
+
*
|
|
19
|
+
* `schema.json` and `state.json` are recognized only to prevent setup from
|
|
20
|
+
* overwriting an old Home whose SQLite authority is missing. They are not
|
|
21
|
+
* version authorities for current Homes.
|
|
22
|
+
*/
|
|
16
23
|
export function inspectStorageSchema(rootDir) {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
24
|
+
const databasePath = join(rootDir, CURRENT_DATABASE_FILENAME);
|
|
25
|
+
const hasPreBaselineEvidence = existsSync(join(rootDir, "schema.json")) || existsSync(join(rootDir, "state.json"));
|
|
26
|
+
if (hasPreBaselineEvidence) {
|
|
20
27
|
return {
|
|
21
|
-
status: "
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
status: "unsupported",
|
|
29
|
+
direction: "older",
|
|
30
|
+
currentVersion: 0,
|
|
31
|
+
latestVersion: CURRENT_STORAGE_VERSION,
|
|
32
|
+
minimumSupportedVersion: MIN_SUPPORTED_STORAGE_VERSION,
|
|
33
|
+
databasePath
|
|
26
34
|
};
|
|
27
35
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
if (!existsSync(databasePath)) {
|
|
37
|
+
if (existsSync(rootDir)) {
|
|
38
|
+
try {
|
|
39
|
+
if (readdirSync(rootDir).length > 0) {
|
|
40
|
+
return invalid(databasePath, new Error("The authoritative yui.db is missing from a non-empty Home."));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return invalid(databasePath, error);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
33
47
|
return {
|
|
34
|
-
status: "
|
|
35
|
-
latestVersion:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
manifestPath,
|
|
39
|
-
detail: error instanceof Error ? error.message : String(error)
|
|
48
|
+
status: "uninitialized",
|
|
49
|
+
latestVersion: CURRENT_STORAGE_VERSION,
|
|
50
|
+
minimumSupportedVersion: MIN_SUPPORTED_STORAGE_VERSION,
|
|
51
|
+
databasePath
|
|
40
52
|
};
|
|
41
53
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
incompatibleComponent: "layout",
|
|
46
|
-
direction: manifest.storageVersion < CURRENT_STORAGE_LAYOUT_VERSION ? "older" : "newer",
|
|
47
|
-
currentVersion: manifest.storageVersion,
|
|
48
|
-
latestVersion: CURRENT_STORAGE_LAYOUT_VERSION,
|
|
49
|
-
currentLayoutVersion: manifest.storageVersion,
|
|
50
|
-
latestLayoutVersion: CURRENT_STORAGE_LAYOUT_VERSION,
|
|
51
|
-
currentAggregateSchemaVersion: manifest.aggregateSchemaVersion,
|
|
52
|
-
latestAggregateSchemaVersion: CURRENT_AGGREGATE_SCHEMA_VERSION,
|
|
53
|
-
manifestPath
|
|
54
|
-
};
|
|
54
|
+
let database;
|
|
55
|
+
try {
|
|
56
|
+
database = new Database(databasePath, { readonly: true, fileMustExist: true });
|
|
55
57
|
}
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
-
status: "unsupported",
|
|
59
|
-
incompatibleComponent: "aggregate",
|
|
60
|
-
direction: manifest.aggregateSchemaVersion < CURRENT_AGGREGATE_SCHEMA_VERSION
|
|
61
|
-
? "older"
|
|
62
|
-
: "newer",
|
|
63
|
-
currentVersion: manifest.aggregateSchemaVersion,
|
|
64
|
-
latestVersion: CURRENT_AGGREGATE_SCHEMA_VERSION,
|
|
65
|
-
currentLayoutVersion: manifest.storageVersion,
|
|
66
|
-
latestLayoutVersion: CURRENT_STORAGE_LAYOUT_VERSION,
|
|
67
|
-
currentAggregateSchemaVersion: manifest.aggregateSchemaVersion,
|
|
68
|
-
latestAggregateSchemaVersion: CURRENT_AGGREGATE_SCHEMA_VERSION,
|
|
69
|
-
manifestPath
|
|
70
|
-
};
|
|
58
|
+
catch (error) {
|
|
59
|
+
return invalid(databasePath, error);
|
|
71
60
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
latestVersion: 1,
|
|
80
|
-
currentLayoutVersion: manifest.storageVersion,
|
|
81
|
-
latestLayoutVersion: CURRENT_STORAGE_LAYOUT_VERSION,
|
|
82
|
-
currentAggregateSchemaVersion: manifest.aggregateSchemaVersion,
|
|
83
|
-
latestAggregateSchemaVersion: CURRENT_AGGREGATE_SCHEMA_VERSION,
|
|
84
|
-
manifestPath
|
|
61
|
+
try {
|
|
62
|
+
const migration = inspectSqliteSchemaMigrations(database);
|
|
63
|
+
const fields = {
|
|
64
|
+
currentVersion: migration.currentVersion,
|
|
65
|
+
latestVersion: CURRENT_STORAGE_VERSION,
|
|
66
|
+
minimumSupportedVersion: MIN_SUPPORTED_STORAGE_VERSION,
|
|
67
|
+
databasePath
|
|
85
68
|
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
return {
|
|
91
|
-
status: "unsupported",
|
|
92
|
-
incompatibleComponent: "record",
|
|
93
|
-
direction: "older",
|
|
94
|
-
currentVersion: 0,
|
|
95
|
-
latestVersion: currentEntry.version,
|
|
96
|
-
currentLayoutVersion: manifest.storageVersion,
|
|
97
|
-
latestLayoutVersion: CURRENT_STORAGE_LAYOUT_VERSION,
|
|
98
|
-
currentAggregateSchemaVersion: manifest.aggregateSchemaVersion,
|
|
99
|
-
latestAggregateSchemaVersion: CURRENT_AGGREGATE_SCHEMA_VERSION,
|
|
100
|
-
recordFamily: kind,
|
|
101
|
-
manifestPath
|
|
102
|
-
};
|
|
69
|
+
if (migration.currentVersion === CURRENT_STORAGE_VERSION) {
|
|
70
|
+
return { status: "current", ...fields };
|
|
71
|
+
}
|
|
72
|
+
if (migration.currentVersion > CURRENT_STORAGE_VERSION) {
|
|
73
|
+
return { status: "unsupported", direction: "newer", ...fields };
|
|
103
74
|
}
|
|
104
|
-
if (
|
|
75
|
+
if (migration.currentVersion < MIN_SUPPORTED_STORAGE_VERSION) {
|
|
76
|
+
return { status: "unsupported", direction: "older", ...fields };
|
|
77
|
+
}
|
|
78
|
+
const plan = storageMigrationPlan(migration.currentVersion);
|
|
79
|
+
if (plan === null) {
|
|
105
80
|
return {
|
|
106
|
-
status: "
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
latestLayoutVersion: CURRENT_STORAGE_LAYOUT_VERSION,
|
|
113
|
-
currentAggregateSchemaVersion: manifest.aggregateSchemaVersion,
|
|
114
|
-
latestAggregateSchemaVersion: CURRENT_AGGREGATE_SCHEMA_VERSION,
|
|
115
|
-
recordFamily: kind,
|
|
116
|
-
manifestPath
|
|
81
|
+
status: "invalid",
|
|
82
|
+
latestVersion: CURRENT_STORAGE_VERSION,
|
|
83
|
+
minimumSupportedVersion: MIN_SUPPORTED_STORAGE_VERSION,
|
|
84
|
+
databasePath,
|
|
85
|
+
detail: `Storage migration registry has no complete path from `
|
|
86
|
+
+ `${migration.currentVersion} to ${CURRENT_STORAGE_VERSION}.`
|
|
117
87
|
};
|
|
118
88
|
}
|
|
89
|
+
return {
|
|
90
|
+
status: "upgradeable",
|
|
91
|
+
pendingVersions: plan.map(({ toVersion }) => toVersion),
|
|
92
|
+
...fields
|
|
93
|
+
};
|
|
119
94
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
currentVersion: manifest.storageVersion,
|
|
123
|
-
latestVersion: CURRENT_STORAGE_LAYOUT_VERSION,
|
|
124
|
-
currentLayoutVersion: manifest.storageVersion,
|
|
125
|
-
latestLayoutVersion: CURRENT_STORAGE_LAYOUT_VERSION,
|
|
126
|
-
currentAggregateSchemaVersion: manifest.aggregateSchemaVersion,
|
|
127
|
-
latestAggregateSchemaVersion: CURRENT_AGGREGATE_SCHEMA_VERSION,
|
|
128
|
-
manifestPath
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
export function ensureStorageSchema(rootDir, now = new Date()) {
|
|
132
|
-
const state = inspectStorageSchema(rootDir);
|
|
133
|
-
if (state.status === "uninitialized") {
|
|
134
|
-
writeCurrentStorageManifest(rootDir, now);
|
|
135
|
-
return;
|
|
95
|
+
catch (error) {
|
|
96
|
+
return invalid(databasePath, error);
|
|
136
97
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
export function requireStorageSchema(rootDir) {
|
|
140
|
-
requireInspectedSchema(inspectStorageSchema(rootDir));
|
|
141
|
-
}
|
|
142
|
-
/** Persist the current three-axis manifest through the existing atomic-file seam. */
|
|
143
|
-
export function writeCurrentStorageManifest(rootDir, now = new Date()) {
|
|
144
|
-
const recordVersions = {};
|
|
145
|
-
for (const [kind, entry] of Object.entries(currentRecordVersions())) {
|
|
146
|
-
recordVersions[kind] = entry.version;
|
|
98
|
+
finally {
|
|
99
|
+
database.close();
|
|
147
100
|
}
|
|
148
|
-
const manifest = {
|
|
149
|
-
schemaVersion: 1,
|
|
150
|
-
storageVersion: CURRENT_STORAGE_LAYOUT_VERSION,
|
|
151
|
-
aggregateSchemaVersion: CURRENT_AGGREGATE_SCHEMA_VERSION,
|
|
152
|
-
recordVersions,
|
|
153
|
-
updatedAt: now.toISOString()
|
|
154
|
-
};
|
|
155
|
-
writeTextFileAtomically(join(rootDir, STORAGE_SCHEMA_FILE), `${JSON.stringify(manifest, null, 2)}\n`);
|
|
156
101
|
}
|
|
157
|
-
|
|
102
|
+
/** Require the current storage contract without normalizing historical data. */
|
|
103
|
+
export function requireCurrentStorageSchema(rootDir) {
|
|
104
|
+
const state = inspectStorageSchema(rootDir);
|
|
158
105
|
switch (state.status) {
|
|
159
106
|
case "current":
|
|
160
107
|
return;
|
|
161
108
|
case "uninitialized":
|
|
162
109
|
throw new StorageSchemaError("STORAGE_UNINITIALIZED", "Yui storage is not initialized. Run `yui setup`.");
|
|
163
110
|
case "invalid":
|
|
164
|
-
throw new StorageSchemaError("STORAGE_SCHEMA_INVALID", `Invalid storage
|
|
111
|
+
throw new StorageSchemaError("STORAGE_SCHEMA_INVALID", `Invalid storage at ${state.databasePath}: ${state.detail}`);
|
|
112
|
+
case "upgradeable":
|
|
113
|
+
throw new StorageSchemaError("STORAGE_SCHEMA_UNSUPPORTED", `Storage version ${state.currentVersion} requires an explicit upgrade to `
|
|
114
|
+
+ `${state.latestVersion}. Run \`yui upgrade\` or \`yui update\`.`);
|
|
165
115
|
case "unsupported":
|
|
166
|
-
throw
|
|
116
|
+
throw new StorageSchemaError("STORAGE_SCHEMA_UNSUPPORTED", state.direction === "newer"
|
|
117
|
+
? `Storage version ${state.currentVersion} is newer than supported `
|
|
118
|
+
+ `${state.latestVersion}; use a newer Yui release.`
|
|
119
|
+
: `Storage version ${state.currentVersion} is older than the minimum supported `
|
|
120
|
+
+ `${state.minimumSupportedVersion}.`);
|
|
167
121
|
}
|
|
168
122
|
}
|
|
169
|
-
function
|
|
170
|
-
if (component === "record" && recordFamily === undefined) {
|
|
171
|
-
return new StorageSchemaError("STORAGE_SCHEMA_UNSUPPORTED", "This Home predates the current record-version manifest. Preserve it for inspection and initialize a new Home.");
|
|
172
|
-
}
|
|
173
|
-
const label = component === "layout"
|
|
174
|
-
? "Storage layout"
|
|
175
|
-
: component === "aggregate"
|
|
176
|
-
? "Aggregate schema"
|
|
177
|
-
: `Record family '${recordFamily}'`;
|
|
178
|
-
if (current < required) {
|
|
179
|
-
return new StorageSchemaError("STORAGE_SCHEMA_UNSUPPORTED", `${label} ${current} is older than required ${component} version ${required}; no migration is available in this Yui release.`);
|
|
180
|
-
}
|
|
181
|
-
return new StorageSchemaError("STORAGE_SCHEMA_UNSUPPORTED", `${label} ${current} is newer than supported ${component} version ${required}; use a newer Yui release.`);
|
|
182
|
-
}
|
|
183
|
-
function parseStorageManifest(raw) {
|
|
184
|
-
const value = parseJsonObject(raw, "Storage schema manifest");
|
|
185
|
-
return parseStorageSchemaManifest(value);
|
|
186
|
-
}
|
|
187
|
-
/** Strictly parse one already-decoded manifest object through the shared contract. */
|
|
188
|
-
export function parseStorageSchemaManifest(value) {
|
|
189
|
-
if (!isRecord(value))
|
|
190
|
-
throw new Error("Storage schema manifest must be an object");
|
|
191
|
-
assertKeys(value, ["schemaVersion", "storageVersion", "aggregateSchemaVersion", "updatedAt"], ["recordVersions"], "Storage schema manifest");
|
|
192
|
-
if (value.schemaVersion !== 1)
|
|
193
|
-
throw new Error("schemaVersion must be 1");
|
|
194
|
-
if (!Number.isInteger(value.storageVersion) || value.storageVersion < 1) {
|
|
195
|
-
throw new Error("storageVersion must be a positive integer");
|
|
196
|
-
}
|
|
197
|
-
const aggregateSchemaVersion = value.aggregateSchemaVersion;
|
|
198
|
-
if (!Number.isInteger(aggregateSchemaVersion) || aggregateSchemaVersion < 1) {
|
|
199
|
-
throw new Error("aggregateSchemaVersion must be a positive integer");
|
|
200
|
-
}
|
|
201
|
-
if (typeof value.updatedAt !== "string" || !Number.isFinite(Date.parse(value.updatedAt))) {
|
|
202
|
-
throw new Error("updatedAt must be an ISO timestamp");
|
|
203
|
-
}
|
|
204
|
-
let recordVersions;
|
|
205
|
-
if (Object.hasOwn(value, "recordVersions")) {
|
|
206
|
-
if (!isRecord(value.recordVersions))
|
|
207
|
-
throw new Error("recordVersions must be an object");
|
|
208
|
-
const known = currentRecordVersions();
|
|
209
|
-
const kinds = Object.keys(value.recordVersions);
|
|
210
|
-
const unknown = kinds.filter((kind) => !Object.hasOwn(known, kind));
|
|
211
|
-
if (unknown.length > 0) {
|
|
212
|
-
throw new Error(`recordVersions has unknown family: ${unknown[0]}`);
|
|
213
|
-
}
|
|
214
|
-
const parsed = {};
|
|
215
|
-
for (const kind of kinds) {
|
|
216
|
-
const version = value.recordVersions[kind];
|
|
217
|
-
if (!Number.isInteger(version) || version < 1) {
|
|
218
|
-
throw new Error(`recordVersions['${kind}'] must be a positive integer`);
|
|
219
|
-
}
|
|
220
|
-
parsed[kind] = version;
|
|
221
|
-
}
|
|
222
|
-
recordVersions = Object.freeze(parsed);
|
|
223
|
-
}
|
|
123
|
+
function invalid(databasePath, error) {
|
|
224
124
|
return {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
125
|
+
status: "invalid",
|
|
126
|
+
latestVersion: CURRENT_STORAGE_VERSION,
|
|
127
|
+
minimumSupportedVersion: MIN_SUPPORTED_STORAGE_VERSION,
|
|
128
|
+
databasePath,
|
|
129
|
+
detail: error instanceof Error ? error.message : String(error)
|
|
230
130
|
};
|
|
231
131
|
}
|
|
232
|
-
/** Read and strictly parse the durable manifest through the same contract. */
|
|
233
|
-
export function readStorageSchemaManifest(rootDir) {
|
|
234
|
-
return parseStorageManifest(readFileSync(join(rootDir, STORAGE_SCHEMA_FILE), "utf8"));
|
|
235
|
-
}
|
|
236
|
-
function parseJsonObject(raw, label) {
|
|
237
|
-
let value;
|
|
238
|
-
try {
|
|
239
|
-
value = JSON.parse(raw);
|
|
240
|
-
}
|
|
241
|
-
catch (error) {
|
|
242
|
-
throw new Error(`${label} is not valid JSON`, { cause: error });
|
|
243
|
-
}
|
|
244
|
-
if (!isRecord(value))
|
|
245
|
-
throw new Error(`${label} must be an object`);
|
|
246
|
-
return value;
|
|
247
|
-
}
|
|
248
|
-
function assertKeys(value, requiredKeys, optionalKeys, label) {
|
|
249
|
-
const expected = new Set([...requiredKeys, ...optionalKeys]);
|
|
250
|
-
const unknown = Object.keys(value).filter((key) => !expected.has(key));
|
|
251
|
-
const missing = requiredKeys.filter((key) => !Object.hasOwn(value, key));
|
|
252
|
-
if (unknown.length > 0)
|
|
253
|
-
throw new Error(`${label} has unknown field: ${unknown[0]}`);
|
|
254
|
-
if (missing.length > 0)
|
|
255
|
-
throw new Error(`${label} is missing field: ${missing[0]}`);
|
|
256
|
-
}
|
|
257
|
-
function readOptionalText(path) {
|
|
258
|
-
try {
|
|
259
|
-
return readFileSync(path, "utf8");
|
|
260
|
-
}
|
|
261
|
-
catch (error) {
|
|
262
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
263
|
-
return null;
|
|
264
|
-
throw error;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
function isRecord(value) {
|
|
268
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
269
|
-
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The one durable compatibility axis for a Yui Home.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Version of the on-disk layout (`schema.json` plus the SQLite database).
|
|
4
|
+
* Version 1 is the clean baseline introduced by Yui 0.15.0: SQLite's migration
|
|
5
|
+
* ledger is authoritative and the historical layout/aggregate/record-version
|
|
6
|
+
* manifest is not part of the active Home. Pre-0.15.0 Homes are outside this
|
|
7
|
+
* compatibility line and remain untouched.
|
|
10
8
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* Runtime code reads only {@link CURRENT_STORAGE_VERSION}. The explicit
|
|
10
|
+
* upgrade boundary carries every forward migration from
|
|
11
|
+
* {@link MIN_SUPPORTED_STORAGE_VERSION} to the current version so one target
|
|
12
|
+
* CLI can upgrade any valid Home in that interval without installing
|
|
13
|
+
* intermediate Yui releases.
|
|
14
14
|
*/
|
|
15
|
-
export const
|
|
16
|
-
|
|
17
|
-
export const CURRENT_AGGREGATE_SCHEMA_VERSION = 21;
|
|
15
|
+
export const MIN_SUPPORTED_STORAGE_VERSION = 1;
|
|
16
|
+
export const CURRENT_STORAGE_VERSION = 1;
|
|
@@ -13,18 +13,18 @@ export const CURRENT_CONFIG_SCHEMA_VERSION = 6;
|
|
|
13
13
|
/** Current SQLite payload-family versions owned by this storage boundary. */
|
|
14
14
|
export const CURRENT_CONFIGURED_AGENT_SCHEMA_VERSION = 2;
|
|
15
15
|
export const CURRENT_PROJECT_SCHEMA_VERSION = 5;
|
|
16
|
-
export const CURRENT_AGENT_PROFILE_SCHEMA_VERSION =
|
|
16
|
+
export const CURRENT_AGENT_PROFILE_SCHEMA_VERSION = 3;
|
|
17
17
|
export const CURRENT_GLOBAL_ROLE_SCHEMA_VERSION = 3;
|
|
18
|
-
export const CURRENT_GLOBAL_ROLE_SESSION_SET_SCHEMA_VERSION =
|
|
19
|
-
export const CURRENT_TASK_SCHEMA_VERSION =
|
|
18
|
+
export const CURRENT_GLOBAL_ROLE_SESSION_SET_SCHEMA_VERSION = 5;
|
|
19
|
+
export const CURRENT_TASK_SCHEMA_VERSION = 7;
|
|
20
20
|
export const CURRENT_TASK_BRIEF_SCHEMA_VERSION = 2;
|
|
21
21
|
export const CURRENT_CONTEXT_SNAPSHOT_SCHEMA_VERSION = 1;
|
|
22
22
|
export const CURRENT_TASK_ROLE_SCHEMA_VERSION = 4;
|
|
23
23
|
export const CURRENT_MANAGED_WORKSPACE_SCHEMA_VERSION = 2;
|
|
24
|
-
export const CURRENT_WORK_ITEM_SCHEMA_VERSION =
|
|
25
|
-
export const CURRENT_REVIEW_ROUND_SCHEMA_VERSION =
|
|
24
|
+
export const CURRENT_WORK_ITEM_SCHEMA_VERSION = 15;
|
|
25
|
+
export const CURRENT_REVIEW_ROUND_SCHEMA_VERSION = 8;
|
|
26
26
|
export const CURRENT_CHANGE_SET_SCHEMA_VERSION = 4;
|
|
27
|
-
export const CURRENT_INTEGRATION_ATTEMPT_SCHEMA_VERSION =
|
|
27
|
+
export const CURRENT_INTEGRATION_ATTEMPT_SCHEMA_VERSION = 6;
|
|
28
28
|
export const CURRENT_MESSAGE_SCHEMA_VERSION = 3;
|
|
29
29
|
export const CURRENT_INPUT_REQUEST_SCHEMA_VERSION = 3;
|
|
30
30
|
export const CURRENT_DECISION_SCHEMA_VERSION = 1;
|
|
@@ -65,8 +65,8 @@ export function executionLaneActiveTurnKeyParts(key) {
|
|
|
65
65
|
/**
|
|
66
66
|
* Nested-record versions consumed by the current SQLite payload validators.
|
|
67
67
|
*/
|
|
68
|
-
export const CURRENT_TASK_ROLE_SESSION_SET_SCHEMA_VERSION =
|
|
69
|
-
export const CURRENT_TURN_SCHEMA_VERSION =
|
|
68
|
+
export const CURRENT_TASK_ROLE_SESSION_SET_SCHEMA_VERSION = 12;
|
|
69
|
+
export const CURRENT_TURN_SCHEMA_VERSION = 5;
|
|
70
70
|
export const CURRENT_INTEGRATION_QUEUE_SCHEMA_VERSION = 1;
|
|
71
71
|
export class StorageRecordError extends Error {
|
|
72
72
|
constructor(message) { super(message); this.name = "StorageRecordError"; }
|