@openscout/scout 0.2.70 → 0.2.73

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.
Files changed (46) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +59 -3
  3. package/bin/openscout-runtime.mjs +23 -2
  4. package/bin/scout +34 -0
  5. package/bin/scout.mjs +195 -18
  6. package/bin/scoutd +0 -0
  7. package/dist/client/apple-touch-icon.png +0 -0
  8. package/dist/client/assets/RepoDiffViewer-D8gg36W3.js +56 -0
  9. package/dist/client/assets/{addon-fit-BNV7JPhj.js → addon-fit-D4KdY-pj.js} +1 -1
  10. package/dist/client/assets/{addon-webgl-B-_Y5L3F.js → addon-webgl-Bo_tmKBp.js} +1 -1
  11. package/dist/client/assets/arc.es-D0gujIKy.js +188 -0
  12. package/dist/client/assets/embed-entry-CUVNwyB_.js +1 -0
  13. package/dist/client/assets/index-CRkjiso5.js +257 -0
  14. package/dist/client/assets/index-D_RX2cRb.css +1 -0
  15. package/dist/client/assets/{xterm-Cx1oABPt.js → xterm-RfflDFod.js} +1 -1
  16. package/dist/client/favicon-16.png +0 -0
  17. package/dist/client/favicon-32.png +0 -0
  18. package/dist/client/favicon.ico +0 -0
  19. package/dist/client/favicon.svg +48 -0
  20. package/dist/client/index.html +42 -2
  21. package/dist/client/openscout-icon.png +0 -0
  22. package/dist/client/site.webmanifest +19 -0
  23. package/dist/client/web-app-icon-192.png +0 -0
  24. package/dist/client/web-app-icon-512.png +0 -0
  25. package/dist/drizzle/0000_curly_iron_monger.sql +592 -0
  26. package/dist/drizzle/0001_invocation-status-columns.sql +7 -0
  27. package/dist/drizzle/0002_invocation-flight-metadata.sql +21 -0
  28. package/dist/drizzle/README.md +81 -0
  29. package/dist/drizzle/meta/0000_snapshot.json +4575 -0
  30. package/dist/drizzle/meta/0001_snapshot.json +4624 -0
  31. package/dist/drizzle/meta/0002_snapshot.json +4631 -0
  32. package/dist/drizzle/meta/_journal.json +27 -0
  33. package/dist/main.mjs +77080 -60152
  34. package/dist/node/main.mjs +7607 -0
  35. package/dist/openscout-terminal-relay.mjs +3830 -152
  36. package/dist/{pair-supervisor.mjs → pairing-runtime-controller.mjs} +50837 -41212
  37. package/dist/runtime/base-daemon.mjs +2219 -488
  38. package/dist/runtime/broker-daemon.mjs +39082 -25118
  39. package/dist/runtime/broker-process-manager.mjs +2048 -392
  40. package/dist/runtime/mesh-discover.mjs +2012 -391
  41. package/dist/scout-control-plane-web.mjs +58128 -34736
  42. package/dist/scout-web-server.mjs +58128 -34736
  43. package/dist/statusline.mjs +287 -0
  44. package/package.json +8 -4
  45. package/dist/client/assets/index-BJri_z5a.css +0 -1
  46. package/dist/client/assets/index-Ccjo5BZz.js +0 -199
@@ -0,0 +1,81 @@
1
+ # Control-plane managed migrations
2
+
3
+ Authoring runbook for the Drizzle-managed migration chain that builds and
4
+ upgrades the control-plane SQLite database. Read this before your first schema
5
+ change on these rails.
6
+
7
+ ## What this folder is
8
+
9
+ Managed migrations for the control-plane schema: a journal (`meta/_journal.json`)
10
+ plus versioned SQL files (`NNNN_<name>.sql`, starting at the baseline
11
+ `0000_curly_iron_monger.sql`). drizzle-kit generates these from the declarative
12
+ model in `../src/drizzle-schema.ts`; the boot migrator
13
+ (`applyControlPlaneDrizzleMigrations` in `../src/control-plane-migrations.ts`)
14
+ applies any pending migrations when a database is opened.
15
+
16
+ This chain is **append-only**. Never edit or delete an already-committed
17
+ migration or its `meta/NNNN_snapshot.json`: the ledger keys off the file hash
18
+ (`__drizzle_migrations`, hash from drizzle-orm's `readMigrationFiles`), so
19
+ changing a committed file re-hashes it and desyncs every database that already
20
+ recorded the old hash. Fix mistakes with a new migration, not an edit.
21
+
22
+ ## How to make a schema change
23
+
24
+ Run these from `packages/runtime`.
25
+
26
+ 1. **Edit the model** in `../src/drizzle-schema.ts`, and only the model. Never
27
+ author schema in the raw string (`CONTROL_PLANE_SQLITE_SCHEMA`) or the
28
+ imperative array (`CONTROL_PLANE_SCHEMA_MIGRATIONS`); those follow the model.
29
+ 2. **Generate** the migration: `bun run db:generate`
30
+ (`drizzle-kit generate`, reading `drizzle.config.ts`, whose `schema` points at
31
+ `src/schema.ts`, which re-exports the model). Review the generated
32
+ `NNNN_*.sql` before committing.
33
+ 3. **Hand-fix `sql`-literal index expressions** if the change touches one.
34
+ drizzle-kit 0.31.x comma-splits any `sql`-literal index body when it renders
35
+ the migration, so the generated statement will be mangled. Rewrite it to the
36
+ correct DDL; follow the precedent comment and the corrected
37
+ `idx_durable_actions_kind_due_at_updated_at` statement in
38
+ `0000_curly_iron_monger.sql`, whose canonical form is the exported constant
39
+ `DURABLE_ACTIONS_DUE_AT_INDEX_SQL` in `../src/drizzle-schema.ts`.
40
+ 4. **Mirror into the repair layer.** Apply the same change to
41
+ `CONTROL_PLANE_SQLITE_SCHEMA` in `../src/schema.ts` (the idempotent repair
42
+ layer for existing databases), and bump `CONTROL_PLANE_SCHEMA_VERSION` when
43
+ the change warrants a new stamped version.
44
+ 5. **Run the gates:**
45
+ `bun test src/drizzle-schema-parity.test.ts src/control-plane-migrations.test.ts`
46
+ The parity gates fail on any drift between the model, the raw string, and the
47
+ checked-in migration chain, so a green run proves all three agree. The
48
+ boot-path test pins virgin-boot, seeding, and downgrade-guard behavior.
49
+ 6. **Commit together, in one commit:** the generated `NNNN_*.sql`,
50
+ `meta/_journal.json`, `meta/NNNN_snapshot.json`, the `drizzle-schema.ts` edit,
51
+ and the `CONTROL_PLANE_SQLITE_SCHEMA` mirror.
52
+
53
+ ## Constraints that keep existing installs safe
54
+
55
+ - The migrator applies each pending migration in a transaction, so a partial
56
+ migration does not leave a half-applied schema.
57
+ - A generated migration's plain `ALTER`/`CREATE` statements only ever execute on
58
+ databases sitting at the prior ledger position. Baseline seeding
59
+ (`seedControlPlaneDrizzleBaseline`) records the baseline as already-applied for
60
+ any pre-baseline database that already has tables, so those databases skip the
61
+ baseline's `CREATE TABLE`s entirely; only a truly virgin database runs the
62
+ baseline for real.
63
+ - Column ADDs that must also repair very old databases do **not** belong in a
64
+ generated migration; a `CREATE TABLE IF NOT EXISTS` repair layer cannot add a
65
+ column to a table that already exists. Put those in the guarded imperative
66
+ array `CONTROL_PLANE_SCHEMA_MIGRATIONS` (`../src/control-plane-migrations.ts`),
67
+ each guarded by a `hasColumn` check. See the `briefings-markdown-column` entry.
68
+ - When in doubt: generated migration for the new-database shape, plus an
69
+ imperative-array entry for old-database repair.
70
+
71
+ ## Version pin
72
+
73
+ drizzle-kit is pinned exactly to `0.31.10` (`../package.json` devDependencies).
74
+ Do not bump it casually: the `db:generate` output format and the comma-split
75
+ workaround above are both sensitive to the drizzle-kit version.
76
+
77
+ ## Pointers
78
+
79
+ - ADR: `../../../docs/eng/sco-075-drizzle-managed-migrations.md`.
80
+ - Gates: `../src/drizzle-schema-parity.test.ts` (model vs raw string vs
81
+ checked-in chain) and `../src/control-plane-migrations.test.ts` (boot path).