@substrate-ai/core 0.20.97 → 0.20.98
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/dist/persistence/schema.d.ts +1 -1
- package/dist/persistence/schema.js +1 -1
- package/dist/persistence/state-schema.d.ts +9 -4
- package/dist/persistence/state-schema.d.ts.map +1 -1
- package/dist/persistence/state-schema.js +19 -34
- package/dist/persistence/state-schema.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - core-schema.ts — sessions, tasks, plans, execution log, cost entries, signals, schema_migrations + ready_tasks/session_cost_summary views
|
|
9
9
|
* - pipeline-schema.ts — pipeline_runs, decisions, requirements, constraints, artifacts, token_usage, run_metrics, story_metrics
|
|
10
10
|
* - monitor-schema.ts — task_metrics, performance_aggregates, routing_recommendations (main DB; monitor.db is separate)
|
|
11
|
-
* - state-schema.ts — stories, contracts, metrics, dispatch_log, build_results, review_verdicts
|
|
11
|
+
* - state-schema.ts — stories, contracts, metrics, dispatch_log, build_results, review_verdicts (legacy; Ship 7 deleted _schema_version)
|
|
12
12
|
* - repo-map-schema.ts — repo_map_symbols, repo_map_meta
|
|
13
13
|
* - telemetry-schema.ts — turn_analysis, efficiency_scores, recommendations, category_stats, consumer_stats
|
|
14
14
|
* - work-graph-schema.ts — wg_stories, story_dependencies, ready_stories view
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - core-schema.ts — sessions, tasks, plans, execution log, cost entries, signals, schema_migrations + ready_tasks/session_cost_summary views
|
|
9
9
|
* - pipeline-schema.ts — pipeline_runs, decisions, requirements, constraints, artifacts, token_usage, run_metrics, story_metrics
|
|
10
10
|
* - monitor-schema.ts — task_metrics, performance_aggregates, routing_recommendations (main DB; monitor.db is separate)
|
|
11
|
-
* - state-schema.ts — stories, contracts, metrics, dispatch_log, build_results, review_verdicts
|
|
11
|
+
* - state-schema.ts — stories, contracts, metrics, dispatch_log, build_results, review_verdicts (legacy; Ship 7 deleted _schema_version)
|
|
12
12
|
* - repo-map-schema.ts — repo_map_symbols, repo_map_meta
|
|
13
13
|
* - telemetry-schema.ts — turn_analysis, efficiency_scores, recommendations, category_stats, consumer_stats
|
|
14
14
|
* - work-graph-schema.ts — wg_stories, story_dependencies, ready_stories view
|
|
@@ -2,19 +2,24 @@
|
|
|
2
2
|
* Legacy state schema — pre-2026-Q1 orchestrator state tables.
|
|
3
3
|
*
|
|
4
4
|
* Owns: stories, contracts, metrics, dispatch_log, build_results,
|
|
5
|
-
* review_verdicts
|
|
5
|
+
* review_verdicts.
|
|
6
6
|
*
|
|
7
7
|
* Empirical status: these tables had ZERO rows in every audited production
|
|
8
8
|
* project (ynab, quant). The orchestrator wires `FileStateStore` (in-memory),
|
|
9
9
|
* not DoltStateStore — so the write code paths that target these tables never
|
|
10
10
|
* fired in production. Ship 1 excised the corresponding DoltStateStore CRUD
|
|
11
11
|
* methods; Ship 3 ported the DDL out of schema.sql into initSchema; Ship 5
|
|
12
|
-
*
|
|
12
|
+
* moved them to this module; Ship 7 (2026-05) deleted the vestigial
|
|
13
|
+
* `_schema_version` table that used to live here.
|
|
13
14
|
*
|
|
14
|
-
* Ship 7
|
|
15
|
+
* Ship 7 also added the `DROP TABLE IF EXISTS _schema_version` cleanup at the
|
|
16
|
+
* start of this function so existing repos (ynab, quant) lose the table on
|
|
17
|
+
* next `substrate run`. The cosmetic "version row lag" the user originally
|
|
18
|
+
* flagged (ynab showed v=5 despite v=9 schema) is closed by removing the
|
|
19
|
+
* table itself rather than maintaining a misleading version row.
|
|
15
20
|
*/
|
|
16
21
|
import type { DatabaseAdapter } from './types.js';
|
|
17
22
|
/** Tables owned by this subsystem (Ship 6 ownership contract). */
|
|
18
|
-
export declare const stateSchemaTables: readonly ["stories", "contracts", "metrics", "dispatch_log", "build_results", "review_verdicts"
|
|
23
|
+
export declare const stateSchemaTables: readonly ["stories", "contracts", "metrics", "dispatch_log", "build_results", "review_verdicts"];
|
|
19
24
|
export declare function initStateSchema(adapter: DatabaseAdapter): Promise<void>;
|
|
20
25
|
//# sourceMappingURL=state-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-schema.d.ts","sourceRoot":"","sources":["../../src/persistence/state-schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"state-schema.d.ts","sourceRoot":"","sources":["../../src/persistence/state-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,kEAAkE;AAClE,eAAO,MAAM,iBAAiB,kGAOpB,CAAA;AAEV,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAwF7E"}
|
|
@@ -2,16 +2,21 @@
|
|
|
2
2
|
* Legacy state schema — pre-2026-Q1 orchestrator state tables.
|
|
3
3
|
*
|
|
4
4
|
* Owns: stories, contracts, metrics, dispatch_log, build_results,
|
|
5
|
-
* review_verdicts
|
|
5
|
+
* review_verdicts.
|
|
6
6
|
*
|
|
7
7
|
* Empirical status: these tables had ZERO rows in every audited production
|
|
8
8
|
* project (ynab, quant). The orchestrator wires `FileStateStore` (in-memory),
|
|
9
9
|
* not DoltStateStore — so the write code paths that target these tables never
|
|
10
10
|
* fired in production. Ship 1 excised the corresponding DoltStateStore CRUD
|
|
11
11
|
* methods; Ship 3 ported the DDL out of schema.sql into initSchema; Ship 5
|
|
12
|
-
*
|
|
12
|
+
* moved them to this module; Ship 7 (2026-05) deleted the vestigial
|
|
13
|
+
* `_schema_version` table that used to live here.
|
|
13
14
|
*
|
|
14
|
-
* Ship 7
|
|
15
|
+
* Ship 7 also added the `DROP TABLE IF EXISTS _schema_version` cleanup at the
|
|
16
|
+
* start of this function so existing repos (ynab, quant) lose the table on
|
|
17
|
+
* next `substrate run`. The cosmetic "version row lag" the user originally
|
|
18
|
+
* flagged (ynab showed v=5 despite v=9 schema) is closed by removing the
|
|
19
|
+
* table itself rather than maintaining a misleading version row.
|
|
15
20
|
*/
|
|
16
21
|
/** Tables owned by this subsystem (Ship 6 ownership contract). */
|
|
17
22
|
export const stateSchemaTables = [
|
|
@@ -21,9 +26,19 @@ export const stateSchemaTables = [
|
|
|
21
26
|
'dispatch_log',
|
|
22
27
|
'build_results',
|
|
23
28
|
'review_verdicts',
|
|
24
|
-
'_schema_version',
|
|
25
29
|
];
|
|
26
30
|
export async function initStateSchema(adapter) {
|
|
31
|
+
// Ship 7 cleanup: drop the vestigial `_schema_version` table for existing
|
|
32
|
+
// repos. The table held 9 seed rows but was never read by any production
|
|
33
|
+
// code path; the user-visible "version row lag" between ynab (v=5) and the
|
|
34
|
+
// current v=9 schema was purely cosmetic. Idempotent on fresh repos.
|
|
35
|
+
// Note: this is distinct from monitor-database.ts's `_schema_version` which
|
|
36
|
+
// lives in `.substrate/monitor.db` with a different schema (version_id +
|
|
37
|
+
// applied_at) and is managed independently.
|
|
38
|
+
try {
|
|
39
|
+
await adapter.exec('DROP TABLE IF EXISTS _schema_version');
|
|
40
|
+
}
|
|
41
|
+
catch { /* table absent or adapter lacks DROP support */ }
|
|
27
42
|
await adapter.exec(`
|
|
28
43
|
CREATE TABLE IF NOT EXISTS stories (
|
|
29
44
|
story_key VARCHAR(100) NOT NULL,
|
|
@@ -96,35 +111,5 @@ export async function initStateSchema(adapter) {
|
|
|
96
111
|
PRIMARY KEY (story_key, timestamp)
|
|
97
112
|
)
|
|
98
113
|
`);
|
|
99
|
-
await adapter.exec(`
|
|
100
|
-
CREATE TABLE IF NOT EXISTS _schema_version (
|
|
101
|
-
version INT NOT NULL,
|
|
102
|
-
applied_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
103
|
-
description VARCHAR(500),
|
|
104
|
-
PRIMARY KEY (version)
|
|
105
|
-
)
|
|
106
|
-
`);
|
|
107
|
-
// _schema_version seed rows — preserved verbatim from schema.sql for
|
|
108
|
-
// backward-compat with operators inspecting the version table. Ship 7
|
|
109
|
-
// will decide whether to keep the table or delete it.
|
|
110
|
-
const seeds = [
|
|
111
|
-
[1, 'Initial substrate state schema'],
|
|
112
|
-
[2, 'Add turn_analysis table (Epic 27-4)'],
|
|
113
|
-
[3, 'Add category_stats and consumer_stats tables (Epic 27-5)'],
|
|
114
|
-
[4, 'Add recommendations table (Epic 27-7)'],
|
|
115
|
-
[5, 'Add repo_map_symbols and repo_map_meta tables (Epic 28-2)'],
|
|
116
|
-
[6, 'Add dependencies JSON column to repo_map_symbols (Epic 28-3)'],
|
|
117
|
-
[7, 'Add wg_stories, story_dependencies tables and ready_stories view (Epic 31-1)'],
|
|
118
|
-
[8, 'Add task_type, phase, dispatch_id columns to turn_analysis (Story 30-1)'],
|
|
119
|
-
[9, 'Add dispatch_id, task_type, phase columns to efficiency_scores (Story 30-3)'],
|
|
120
|
-
];
|
|
121
|
-
for (const [version, description] of seeds) {
|
|
122
|
-
try {
|
|
123
|
-
await adapter.exec(`INSERT IGNORE INTO _schema_version (version, description) VALUES (${version}, '${description.replace(/'/g, "''")}')`);
|
|
124
|
-
}
|
|
125
|
-
catch {
|
|
126
|
-
// InMemory adapter does not support INSERT IGNORE — silently skip.
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
114
|
}
|
|
130
115
|
//# sourceMappingURL=state-schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-schema.js","sourceRoot":"","sources":["../../src/persistence/state-schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"state-schema.js","sourceRoot":"","sources":["../../src/persistence/state-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,kEAAkE;AAClE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS;IACT,WAAW;IACX,SAAS;IACT,cAAc;IACd,eAAe;IACf,iBAAiB;CACT,CAAA;AAEV,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAwB;IAC5D,0EAA0E;IAC1E,yEAAyE;IACzE,2EAA2E;IAC3E,qEAAqE;IACrE,4EAA4E;IAC5E,yEAAyE;IACzE,4CAA4C;IAC5C,IAAI,CAAC;QAAC,MAAM,OAAO,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAA;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,gDAAgD,CAAC,CAAC;IAE7H,MAAM,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;GAalB,CAAC,CAAA;IAEF,MAAM,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;GAUlB,CAAC,CAAA;IAEF,MAAM,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;GAgBlB,CAAC,CAAA;IAEF,MAAM,OAAO,CAAC,IAAI,CAAC;;;;;;;;;GASlB,CAAC,CAAA;IAEF,MAAM,OAAO,CAAC,IAAI,CAAC;;;;;;;;;GASlB,CAAC,CAAA;IAEF,MAAM,OAAO,CAAC,IAAI,CAAC;;;;;;;;;GASlB,CAAC,CAAA;AAEJ,CAAC"}
|