@opengsd/gsd-pi 1.10.0-dev.a5e42e99 → 1.11.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/README.md +10 -10
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/gsd/db/engine.js +8 -2
- package/dist/resources/extensions/gsd/db-canonical-foundation-schema.js +120 -0
- package/dist/resources/extensions/gsd/db-migration-steps.js +4 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +5 -5
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/required-server-files.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/mcp-connections/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/mcp-connections/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +5 -5
- package/dist/web/standalone/.next/server/chunks/2842.js +4 -4
- package/dist/web/standalone/.next/server/chunks/8357.js +2 -2
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware.js +3 -3
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/app/_not-found/page-49f565245e1e4afe.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/{layout-4ae2d68984392bbf.js → layout-b35cbfff38aaf4cf.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-bc4c723c6a19c6f0.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{main-app-90d1d8d5e5d2dc6b.js → main-app-590a74400e35f685.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ec3eaffc9785ba48.js +1 -0
- package/dist/web/standalone/node_modules/@gsd/native/package.json +1 -1
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
- package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
- package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
- package/dist/web/standalone/server.js +1 -1
- package/integrations/hermes/open_gsd_hermes/gsd_client.py +1 -1
- package/integrations/hermes/pyproject.toml +1 -1
- package/package.json +6 -6
- package/packages/cloud-mcp-gateway/package.json +2 -2
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/package.json +4 -4
- package/packages/gsd-agent-core/package.json +5 -5
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/gsd-cloud/package.json +1 -1
- package/packages/mcp-server/package.json +4 -4
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-coding-agent/package.json +7 -7
- package/packages/pi-tui/package.json +2 -2
- package/packages/rpc-client/package.json +2 -2
- package/pkg/package.json +1 -1
- package/src/resources/extensions/gsd/db/engine.ts +9 -1
- package/src/resources/extensions/gsd/db-canonical-foundation-schema.ts +129 -0
- package/src/resources/extensions/gsd/db-migration-steps.ts +5 -0
- package/src/resources/extensions/gsd/tests/db-canonical-foundation.test.ts +459 -0
- package/src/resources/extensions/gsd/tests/db-engine-migrate-guards.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/single-writer-invariant.test.ts +1 -0
- package/dist/web/standalone/.next/static/chunks/app/_not-found/page-a6fb1847f67f167c.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/page-72a856634ad14c10.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-1115d46ac61b9823.js +0 -1
- /package/dist/web/standalone/.next/static/{xwUaOqui04jIIFVsIBLiL → 8ub6oiEp2YnlOHQU20LJr}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{xwUaOqui04jIIFVsIBLiL → 8ub6oiEp2YnlOHQU20LJr}/_ssgManifest.js +0 -0
package/README.md
CHANGED
|
@@ -28,16 +28,16 @@ See [CHANGELOG.md](./CHANGELOG.md) for release-by-release fixes and [Legacy Rele
|
|
|
28
28
|
## Latest Release Highlights
|
|
29
29
|
|
|
30
30
|
<!-- release-highlights:start -->
|
|
31
|
-
Latest release: **v1.
|
|
32
|
-
|
|
33
|
-
- **
|
|
34
|
-
- **gsd:**
|
|
35
|
-
- **
|
|
36
|
-
- **
|
|
37
|
-
- **
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
31
|
+
Latest release: **v1.11.0**
|
|
32
|
+
|
|
33
|
+
- **gsd:** Add canonical database foundation (#1426).
|
|
34
|
+
- **gsd-cloud:** Add macOS cloud monitor app and runtime telemetry (#1399).
|
|
35
|
+
- **Added:** Add workflow authority baseline gate (#1422).
|
|
36
|
+
- **issue:** [Feature]: Support using pi-llama-cpp for local models (#1425).
|
|
37
|
+
- **issue:** [Bug]: GPT-5.6 ships as the nonexistent bare `gpt-5.6` slug — the real routable models are gpt-5.6-sol/terra/luna (#1424).
|
|
38
|
+
- **issue:** Fix(doctor): artifact_file_missing false positive for active-worktree artifacts; checkbox_db_status_divergence regression on plan-slice re-dispatch (#1420).
|
|
39
|
+
- **issue:** Planning_subagents should support user-defined planning agents.
|
|
40
|
+
- **issue:** Auto-verification.js writes VERIFY.json to legacy tasks/ subdir in flat-phase projects.
|
|
41
41
|
|
|
42
42
|
<!-- release-highlights:end -->
|
|
43
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2b84d39575210a02
|
|
@@ -18,7 +18,8 @@ import { createBaseSchemaObjects } from "../db-base-schema.js";
|
|
|
18
18
|
import { createCoordinationTablesV24 } from "../db-coordination-schema.js";
|
|
19
19
|
import { createDbConnectionCache } from "../db-connection-cache.js";
|
|
20
20
|
import { backupDatabaseBeforeMigration, isMigrationBackupError } from "../db-migration-backup.js";
|
|
21
|
-
import { applyMigrationV2Artifacts, applyMigrationV3Memories, applyMigrationV4DecisionMadeBy, applyMigrationV5HierarchyTables, applyMigrationV6SliceSummaries, applyMigrationV7Dependencies, applyMigrationV8PlanningFields, applyMigrationV9Ordering, applyMigrationV10ReplanTrigger, applyMigrationV11TaskPlanning, applyMigrationV12QualityGates, applyMigrationV13HotPathIndexes, applyMigrationV14SliceDependencies, applyMigrationV15AuditTables, applyMigrationV16EscalationSource, applyMigrationV17TaskEscalation, applyMigrationV18MemorySources, applyMigrationV19MemoryFts, applyMigrationV20MemoryRelations, applyMigrationV21StructuredMemories, applyMigrationV22QualityGateRepair, applyMigrationV23MilestoneQueue, applyMigrationV26MilestoneCommitAttributions, applyMigrationV27ArtifactHash, applyMigrationV28MemoryLastHitAt, applyMigrationV29RepositoryTargets, applyMigrationV30ReworkBriefs, } from "../db-migration-steps.js";
|
|
21
|
+
import { applyMigrationV2Artifacts, applyMigrationV3Memories, applyMigrationV4DecisionMadeBy, applyMigrationV5HierarchyTables, applyMigrationV6SliceSummaries, applyMigrationV7Dependencies, applyMigrationV8PlanningFields, applyMigrationV9Ordering, applyMigrationV10ReplanTrigger, applyMigrationV11TaskPlanning, applyMigrationV12QualityGates, applyMigrationV13HotPathIndexes, applyMigrationV14SliceDependencies, applyMigrationV15AuditTables, applyMigrationV16EscalationSource, applyMigrationV17TaskEscalation, applyMigrationV18MemorySources, applyMigrationV19MemoryFts, applyMigrationV20MemoryRelations, applyMigrationV21StructuredMemories, applyMigrationV22QualityGateRepair, applyMigrationV23MilestoneQueue, applyMigrationV26MilestoneCommitAttributions, applyMigrationV27ArtifactHash, applyMigrationV28MemoryLastHitAt, applyMigrationV29RepositoryTargets, applyMigrationV30ReworkBriefs, applyMigrationV31CanonicalFoundation, } from "../db-migration-steps.js";
|
|
22
|
+
import { createCanonicalFoundationSchemaV31 } from "../db-canonical-foundation-schema.js";
|
|
22
23
|
import { isMemoriesFtsAvailableSchema, rebuildMemoriesFtsSchemaOnce, tryCreateMemoriesFtsSchema, } from "../db-memory-fts-schema.js";
|
|
23
24
|
import { createDbOpenState } from "../db-open-state.js";
|
|
24
25
|
import { createRuntimeKvTableV25 } from "../db-runtime-kv-schema.js";
|
|
@@ -58,7 +59,7 @@ const providerLoader = createSqliteProviderLoader({
|
|
|
58
59
|
nodeVersion: process.versions.node,
|
|
59
60
|
writeStderr: (message) => process.stderr.write(message),
|
|
60
61
|
});
|
|
61
|
-
export const SCHEMA_VERSION =
|
|
62
|
+
export const SCHEMA_VERSION = 31;
|
|
62
63
|
function initSchema(db, fileBacked, dbPath) {
|
|
63
64
|
const conservativeFilePragmas = fileBacked && _isLikelyWslDrvFsPathForTest(dbPath);
|
|
64
65
|
if (fileBacked)
|
|
@@ -104,6 +105,7 @@ function initSchema(db, fileBacked, dbPath) {
|
|
|
104
105
|
else {
|
|
105
106
|
createCoordinationTablesV24(db);
|
|
106
107
|
createRuntimeKvTableV25(db);
|
|
108
|
+
createCanonicalFoundationSchemaV31(db);
|
|
107
109
|
// Fresh install — all tables are created above with the full current schema,
|
|
108
110
|
// so it is safe to create all migration-specific indexes here. For existing
|
|
109
111
|
// databases these indexes are created inside the individual migration guards
|
|
@@ -318,6 +320,10 @@ function migrateSchema(db, dbPath) {
|
|
|
318
320
|
applyMigrationV30ReworkBriefs(db);
|
|
319
321
|
recordSchemaVersion(db, 30);
|
|
320
322
|
}
|
|
323
|
+
if (currentVersion < 31) {
|
|
324
|
+
applyMigrationV31CanonicalFoundation(db);
|
|
325
|
+
recordSchemaVersion(db, 31);
|
|
326
|
+
}
|
|
321
327
|
if (_migrationFaultForTest)
|
|
322
328
|
throw new Error("migration fault injected for test");
|
|
323
329
|
db.exec("COMMIT");
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// Project/App: gsd-pi
|
|
2
|
+
// File Purpose: Additive v31 authority, operation provenance, domain event, and outbox schema.
|
|
3
|
+
/**
|
|
4
|
+
* v31 mapping:
|
|
5
|
+
* - schema_version remains DDL compatibility, not the domain revision.
|
|
6
|
+
* - audit_events remains optional operational telemetry, not domain history.
|
|
7
|
+
* - milestone_commit_attributions remains Git-specific, not operation provenance.
|
|
8
|
+
* - command_queue and runtime_kv remain coordination/cache surfaces, not an outbox.
|
|
9
|
+
*/
|
|
10
|
+
export function createCanonicalFoundationSchemaV31(db) {
|
|
11
|
+
db.exec(`
|
|
12
|
+
CREATE TABLE IF NOT EXISTS project_authority (
|
|
13
|
+
singleton INTEGER PRIMARY KEY CHECK (singleton = 1),
|
|
14
|
+
project_id TEXT NOT NULL UNIQUE,
|
|
15
|
+
project_root_realpath TEXT NOT NULL DEFAULT '',
|
|
16
|
+
revision INTEGER NOT NULL DEFAULT 0 CHECK (revision >= 0),
|
|
17
|
+
authority_epoch INTEGER NOT NULL DEFAULT 0 CHECK (authority_epoch >= 0),
|
|
18
|
+
created_at TEXT NOT NULL DEFAULT '',
|
|
19
|
+
updated_at TEXT NOT NULL DEFAULT ''
|
|
20
|
+
)
|
|
21
|
+
`);
|
|
22
|
+
db.exec(`
|
|
23
|
+
CREATE TABLE IF NOT EXISTS workflow_operations (
|
|
24
|
+
operation_id TEXT PRIMARY KEY,
|
|
25
|
+
project_id TEXT NOT NULL,
|
|
26
|
+
operation_type TEXT NOT NULL,
|
|
27
|
+
idempotency_key TEXT NOT NULL,
|
|
28
|
+
expected_revision INTEGER NOT NULL CHECK (expected_revision >= 0),
|
|
29
|
+
resulting_revision INTEGER NOT NULL CHECK (resulting_revision = expected_revision + 1),
|
|
30
|
+
expected_authority_epoch INTEGER NOT NULL CHECK (expected_authority_epoch >= 0),
|
|
31
|
+
resulting_authority_epoch INTEGER NOT NULL CHECK (
|
|
32
|
+
resulting_authority_epoch = expected_authority_epoch OR
|
|
33
|
+
resulting_authority_epoch = expected_authority_epoch + 1
|
|
34
|
+
),
|
|
35
|
+
actor_type TEXT NOT NULL,
|
|
36
|
+
actor_id TEXT DEFAULT NULL,
|
|
37
|
+
source_transport TEXT NOT NULL,
|
|
38
|
+
trace_id TEXT DEFAULT NULL,
|
|
39
|
+
turn_id TEXT DEFAULT NULL,
|
|
40
|
+
request_hash TEXT NOT NULL,
|
|
41
|
+
created_at TEXT NOT NULL,
|
|
42
|
+
UNIQUE (project_id, idempotency_key),
|
|
43
|
+
UNIQUE (project_id, resulting_revision),
|
|
44
|
+
UNIQUE (operation_id, project_id, resulting_revision, resulting_authority_epoch),
|
|
45
|
+
FOREIGN KEY (project_id) REFERENCES project_authority(project_id)
|
|
46
|
+
)
|
|
47
|
+
`);
|
|
48
|
+
db.exec(`
|
|
49
|
+
CREATE TABLE IF NOT EXISTS workflow_domain_events (
|
|
50
|
+
event_id TEXT PRIMARY KEY,
|
|
51
|
+
operation_id TEXT NOT NULL,
|
|
52
|
+
event_index INTEGER NOT NULL DEFAULT 0 CHECK (event_index >= 0),
|
|
53
|
+
project_id TEXT NOT NULL,
|
|
54
|
+
project_revision INTEGER NOT NULL CHECK (project_revision > 0),
|
|
55
|
+
authority_epoch INTEGER NOT NULL CHECK (authority_epoch >= 0),
|
|
56
|
+
event_type TEXT NOT NULL,
|
|
57
|
+
entity_type TEXT NOT NULL,
|
|
58
|
+
entity_id TEXT NOT NULL,
|
|
59
|
+
caused_by_event_id TEXT DEFAULT NULL,
|
|
60
|
+
payload_json TEXT NOT NULL DEFAULT '{}',
|
|
61
|
+
created_at TEXT NOT NULL,
|
|
62
|
+
UNIQUE (operation_id, event_index),
|
|
63
|
+
FOREIGN KEY (operation_id, project_id, project_revision, authority_epoch)
|
|
64
|
+
REFERENCES workflow_operations(
|
|
65
|
+
operation_id, project_id, resulting_revision, resulting_authority_epoch
|
|
66
|
+
),
|
|
67
|
+
FOREIGN KEY (caused_by_event_id) REFERENCES workflow_domain_events(event_id)
|
|
68
|
+
)
|
|
69
|
+
`);
|
|
70
|
+
db.exec(`
|
|
71
|
+
CREATE TRIGGER IF NOT EXISTS trg_workflow_domain_events_immutable_update
|
|
72
|
+
BEFORE UPDATE ON workflow_domain_events
|
|
73
|
+
BEGIN
|
|
74
|
+
SELECT RAISE(ABORT, 'workflow domain events are immutable');
|
|
75
|
+
END
|
|
76
|
+
`);
|
|
77
|
+
db.exec(`
|
|
78
|
+
CREATE TRIGGER IF NOT EXISTS trg_workflow_domain_events_immutable_delete
|
|
79
|
+
BEFORE DELETE ON workflow_domain_events
|
|
80
|
+
BEGIN
|
|
81
|
+
SELECT RAISE(ABORT, 'workflow domain events are immutable');
|
|
82
|
+
END
|
|
83
|
+
`);
|
|
84
|
+
db.exec(`
|
|
85
|
+
CREATE TABLE IF NOT EXISTS workflow_outbox (
|
|
86
|
+
outbox_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
87
|
+
event_id TEXT NOT NULL,
|
|
88
|
+
destination TEXT NOT NULL,
|
|
89
|
+
available_at TEXT NOT NULL DEFAULT '',
|
|
90
|
+
attempt_count INTEGER NOT NULL DEFAULT 0 CHECK (attempt_count >= 0),
|
|
91
|
+
claimed_by TEXT DEFAULT NULL,
|
|
92
|
+
claim_expires_at TEXT DEFAULT NULL,
|
|
93
|
+
delivered_at TEXT DEFAULT NULL,
|
|
94
|
+
last_error TEXT DEFAULT NULL,
|
|
95
|
+
UNIQUE (event_id, destination),
|
|
96
|
+
FOREIGN KEY (event_id) REFERENCES workflow_domain_events(event_id)
|
|
97
|
+
)
|
|
98
|
+
`);
|
|
99
|
+
db.exec(`
|
|
100
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_operations_created
|
|
101
|
+
ON workflow_operations(project_id, created_at, operation_id)
|
|
102
|
+
`);
|
|
103
|
+
db.exec(`
|
|
104
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_domain_events_entity
|
|
105
|
+
ON workflow_domain_events(project_id, entity_type, entity_id, project_revision, event_index)
|
|
106
|
+
`);
|
|
107
|
+
db.exec(`
|
|
108
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_outbox_pending
|
|
109
|
+
ON workflow_outbox(delivered_at, available_at, outbox_id)
|
|
110
|
+
`);
|
|
111
|
+
db.exec(`
|
|
112
|
+
INSERT OR IGNORE INTO project_authority (
|
|
113
|
+
singleton, project_id, project_root_realpath,
|
|
114
|
+
revision, authority_epoch, created_at, updated_at
|
|
115
|
+
) VALUES (
|
|
116
|
+
1, lower(hex(randomblob(16))), '',
|
|
117
|
+
0, 0, '', ''
|
|
118
|
+
)
|
|
119
|
+
`);
|
|
120
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Project/App: gsd-pi
|
|
2
2
|
// File Purpose: Schema migration DDL steps for the GSD database facade.
|
|
3
|
+
import { createCanonicalFoundationSchemaV31 } from "./db-canonical-foundation-schema.js";
|
|
3
4
|
import { ensureColumn } from "./db-schema-metadata.js";
|
|
4
5
|
export function applyMigrationV2Artifacts(db) {
|
|
5
6
|
db.exec(`
|
|
@@ -448,3 +449,6 @@ export function applyMigrationV30ReworkBriefs(db) {
|
|
|
448
449
|
db.exec("CREATE INDEX IF NOT EXISTS idx_rework_briefs_task ON rework_briefs(milestone_id, slice_id, task_id)");
|
|
449
450
|
db.exec("CREATE INDEX IF NOT EXISTS idx_rework_findings_status ON rework_brief_findings(brief_id, severity, status)");
|
|
450
451
|
}
|
|
452
|
+
export function applyMigrationV31CanonicalFoundation(db) {
|
|
453
|
+
createCanonicalFoundationSchemaV31(db);
|
|
454
|
+
}
|