@starlove/orbit 1.4.1 → 2.0.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/Dockerfile +10 -8
- package/README.md +146 -164
- package/dist/full/csp.txt +1 -0
- package/dist/full/fonts/JetBrains_Mono/JetBrainsMono-subset.woff2 +0 -0
- package/dist/full/fonts/JetBrains_Mono/README.txt +5 -0
- package/dist/full/fonts/Mona_Sans/MonaSans-subset.woff2 +0 -0
- package/{public/fonts/Open_Sans → dist/full/fonts/Mona_Sans}/OFL.txt +93 -93
- package/dist/full/fonts/Mona_Sans/README.txt +10 -0
- package/{public/fonts/JetBrains_Mono → dist/full/fonts/Newsreader}/OFL.txt +93 -93
- package/dist/full/fonts/Newsreader/README.txt +8 -0
- package/dist/full/fonts/Newsreader/newsreader.woff2 +0 -0
- package/dist/full/index.html +36 -653
- package/dist/full/js/app.BmuponPJ.js +32 -0
- package/dist/full/js/app.BmuponPJ.js.map +1 -0
- package/dist/full/js/chunk.1fJGQGbW.js +2 -0
- package/dist/full/js/chunk.1fJGQGbW.js.map +1 -0
- package/dist/full/js/chunk.5D7JO2zp.js +2 -0
- package/dist/full/js/chunk.5D7JO2zp.js.map +1 -0
- package/dist/full/js/chunk.BrNn_D79.js +2 -0
- package/dist/full/js/chunk.BrNn_D79.js.map +1 -0
- package/dist/full/js/chunk.CokJXIqM.js +2 -0
- package/dist/full/js/chunk.CokJXIqM.js.map +1 -0
- package/dist/full/js/chunk.D_Haqy6R.js +2 -0
- package/dist/full/js/chunk.D_Haqy6R.js.map +1 -0
- package/dist/full/js/chunk.RO0jsH6I.js +15 -0
- package/dist/full/js/chunk.RO0jsH6I.js.map +1 -0
- package/dist/full/js/chunk.dqWOEtBM.js +2 -0
- package/dist/full/js/chunk.dqWOEtBM.js.map +1 -0
- package/dist/full/js/warm.f260bbbc.js +15 -0
- package/dist/full/orbits-favicon.png +0 -0
- package/dist/full/orbits-logo-bg-wide.png +0 -0
- package/dist/full/orbits-logo-bg.png +0 -0
- package/dist/full/orbits-logo.png +0 -0
- package/dist/full/styles.2b154ffe.css +1 -0
- package/dist/full/vendor/starlove-ui/theme-init.js +66 -0
- package/dist/full/version.json +2 -2
- package/docs/AGENT_GUIDE.md +114 -0
- package/docs/UPDATING.md +249 -64
- package/lib/adapters/indexeddb/blobs.d.ts +3 -0
- package/lib/adapters/indexeddb/blobs.js +54 -0
- package/lib/adapters/indexeddb/database.d.ts +60 -0
- package/lib/adapters/indexeddb/database.js +126 -0
- package/lib/adapters/indexeddb/index.d.ts +5 -0
- package/lib/adapters/indexeddb/index.js +3 -0
- package/lib/adapters/indexeddb/locks.d.ts +14 -0
- package/lib/adapters/indexeddb/locks.js +40 -0
- package/lib/adapters/indexeddb/store.d.ts +40 -0
- package/lib/adapters/indexeddb/store.js +424 -0
- package/lib/adapters/indexeddb/tables.d.ts +43 -0
- package/lib/adapters/indexeddb/tables.js +127 -0
- package/lib/adapters/memory/blobs.d.ts +3 -0
- package/lib/adapters/memory/blobs.js +44 -0
- package/lib/adapters/memory/board.d.ts +41 -0
- package/lib/adapters/memory/board.js +521 -0
- package/lib/adapters/memory/index.d.ts +2 -0
- package/lib/adapters/memory/index.js +2 -0
- package/lib/adapters/memory/search.d.ts +6 -0
- package/lib/adapters/memory/search.js +30 -0
- package/lib/adapters/memory/store.d.ts +34 -0
- package/lib/adapters/memory/store.js +266 -0
- package/lib/adapters/sqlite/backups.d.ts +53 -0
- package/lib/adapters/sqlite/backups.js +232 -0
- package/lib/adapters/sqlite/blobs.d.ts +14 -0
- package/lib/adapters/sqlite/blobs.js +109 -0
- package/lib/adapters/sqlite/board.d.ts +77 -0
- package/lib/adapters/sqlite/board.js +328 -0
- package/lib/adapters/sqlite/database.d.ts +67 -0
- package/lib/adapters/sqlite/database.js +285 -0
- package/lib/adapters/sqlite/index.d.ts +3 -0
- package/lib/adapters/sqlite/index.js +2 -0
- package/lib/adapters/sqlite/lock.d.ts +11 -0
- package/lib/adapters/sqlite/lock.js +34 -0
- package/lib/adapters/sqlite/records.d.ts +54 -0
- package/lib/adapters/sqlite/records.js +546 -0
- package/lib/adapters/sqlite/schema.d.ts +54 -0
- package/lib/adapters/sqlite/schema.js +276 -0
- package/lib/adapters/sqlite/store.d.ts +39 -0
- package/lib/adapters/sqlite/store.js +385 -0
- package/lib/browser/in-page.d.ts +31 -0
- package/lib/browser/in-page.js +46 -0
- package/lib/browser/old-preview.d.ts +13 -0
- package/lib/browser/old-preview.js +80 -0
- package/lib/browser/preview-board.d.ts +8 -0
- package/lib/browser/preview-board.js +69 -0
- package/lib/cli/main.d.ts +7 -0
- package/lib/cli/main.js +343 -0
- package/lib/cli/orbit.d.ts +8 -0
- package/lib/cli/orbit.js +25 -0
- package/lib/client/http.d.ts +38 -0
- package/lib/client/http.js +334 -0
- package/lib/client/local.d.ts +26 -0
- package/lib/client/local.js +190 -0
- package/lib/client/object-url.d.ts +8 -0
- package/lib/client/object-url.js +21 -0
- package/lib/client/types.d.ts +268 -0
- package/lib/client/types.js +8 -0
- package/lib/commands/agent-tools.d.ts +31 -0
- package/lib/commands/agent-tools.js +100 -0
- package/lib/commands/index.d.ts +56 -0
- package/lib/commands/index.js +298 -0
- package/lib/commands/parse.d.ts +73 -0
- package/lib/commands/parse.js +231 -0
- package/lib/commands/present.d.ts +134 -0
- package/lib/commands/present.js +198 -0
- package/lib/commands/session.d.ts +85 -0
- package/lib/commands/session.js +138 -0
- package/lib/commands/verbs.d.ts +35 -0
- package/lib/commands/verbs.js +842 -0
- package/lib/core/actors.d.ts +18 -0
- package/lib/core/actors.js +45 -0
- package/lib/core/agent.d.ts +128 -0
- package/lib/core/agent.js +323 -0
- package/lib/core/boards.d.ts +113 -0
- package/lib/core/boards.js +288 -0
- package/lib/core/bootstrap.d.ts +47 -0
- package/lib/core/bootstrap.js +100 -0
- package/lib/core/bytes.d.ts +10 -0
- package/lib/core/bytes.js +52 -0
- package/lib/core/card-paths.d.ts +25 -0
- package/lib/core/card-paths.js +44 -0
- package/lib/core/context.d.ts +60 -0
- package/lib/core/context.js +42 -0
- package/lib/core/cross-board.d.ts +81 -0
- package/lib/core/cross-board.js +228 -0
- package/lib/core/describe.d.ts +21 -0
- package/lib/core/describe.js +81 -0
- package/lib/core/errors.d.ts +159 -0
- package/lib/core/errors.js +160 -0
- package/lib/core/files.d.ts +79 -0
- package/lib/core/files.js +262 -0
- package/lib/core/history.d.ts +20 -0
- package/lib/core/history.js +53 -0
- package/lib/core/image-types.d.ts +16 -0
- package/lib/core/image-types.js +36 -0
- package/lib/core/model.d.ts +263 -0
- package/lib/core/model.js +34 -0
- package/lib/core/nebula-link.d.ts +14 -0
- package/lib/core/nebula-link.js +39 -0
- package/lib/core/relations.d.ts +58 -0
- package/lib/core/relations.js +112 -0
- package/lib/core/search.d.ts +38 -0
- package/lib/core/search.js +92 -0
- package/lib/core/sessions.d.ts +44 -0
- package/lib/core/sessions.js +158 -0
- package/lib/core/snapshot-schema.d.ts +295 -0
- package/lib/core/snapshot-schema.js +82 -0
- package/lib/core/snapshots.d.ts +75 -0
- package/lib/core/snapshots.js +409 -0
- package/lib/core/states.d.ts +25 -0
- package/lib/core/states.js +126 -0
- package/lib/core/text.d.ts +40 -0
- package/lib/core/text.js +113 -0
- package/lib/core/tickets.d.ts +69 -0
- package/lib/core/tickets.js +311 -0
- package/lib/core/trello.d.ts +17 -0
- package/lib/core/trello.js +269 -0
- package/lib/core/verdicts.d.ts +28 -0
- package/lib/core/verdicts.js +92 -0
- package/lib/core/views.d.ts +95 -0
- package/lib/core/views.js +186 -0
- package/lib/http/app.d.ts +46 -0
- package/lib/http/app.js +491 -0
- package/lib/mcp-server.d.ts +10 -0
- package/lib/mcp-server.js +120 -0
- package/lib/node/assets.d.ts +7 -0
- package/lib/node/assets.js +68 -0
- package/lib/node/data-folder.d.ts +21 -0
- package/lib/node/data-folder.js +34 -0
- package/lib/node/env.d.ts +38 -0
- package/lib/node/env.js +49 -0
- package/lib/node/host-check.d.ts +24 -0
- package/lib/node/host-check.js +53 -0
- package/lib/node/host-services.d.ts +9 -0
- package/lib/node/host-services.js +150 -0
- package/lib/node/local.d.ts +22 -0
- package/lib/node/local.js +61 -0
- package/lib/node/migrate.d.ts +53 -0
- package/lib/node/migrate.js +635 -0
- package/lib/node/package.d.ts +7 -0
- package/lib/node/package.js +14 -0
- package/lib/node/repo-board.d.ts +49 -0
- package/lib/node/repo-board.js +245 -0
- package/lib/node/serve.d.ts +8 -0
- package/lib/node/serve.js +106 -0
- package/lib/orbit.d.ts +47 -0
- package/lib/orbit.js +44 -0
- package/lib/quiet-sqlite-warning.d.ts +1 -0
- package/lib/quiet-sqlite-warning.js +18 -0
- package/lib/store/blob-path.d.ts +6 -0
- package/lib/store/blob-path.js +12 -0
- package/lib/store/conformance.d.ts +52 -0
- package/lib/store/conformance.js +1449 -0
- package/lib/store/search-words.d.ts +10 -0
- package/lib/store/search-words.js +19 -0
- package/lib/store/types.d.ts +452 -0
- package/lib/store/types.js +34 -0
- package/llms.txt +63 -0
- package/package.json +109 -25
- package/src/cli/orbit.js +11 -658
- package/src/mcp-server.js +16 -876
- package/SKILL-ORBIT.md +0 -151
- package/build.mjs +0 -210
- package/dist/full/js/app.4e6fbe20.js +0 -952
- package/dist/full/js/app.4e6fbe20.js.map +0 -7
- package/dist/full/styles.4e60d824.css +0 -1
- package/docs/AGENT_PROTOCOL.md +0 -424
- package/docs/MCP_SETUP.md +0 -54
- package/docs/ORBIT_DISPATCH.md +0 -280
- package/docs/SS-Orbit-Dark.png +0 -0
- package/docs/SS-Orbit-Light.png +0 -0
- package/docs/mcp-client.example.json +0 -13
- package/docs/setup/orbit-init-wizard.md +0 -174
- package/public/apple-touch-icon.png +0 -0
- package/public/cursors/live_arrow.cur +0 -0
- package/public/cursors/live_link.cur +0 -0
- package/public/cursors/live_move.cur +0 -0
- package/public/cursors/live_select.cur +0 -0
- package/public/cursors/live_unavail.cur +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/fonts/Chakra_Petch/ChakraPetch-Bold.ttf +0 -0
- package/public/fonts/Chakra_Petch/ChakraPetch-BoldItalic.ttf +0 -0
- package/public/fonts/Chakra_Petch/ChakraPetch-Italic.ttf +0 -0
- package/public/fonts/Chakra_Petch/ChakraPetch-Light.ttf +0 -0
- package/public/fonts/Chakra_Petch/ChakraPetch-LightItalic.ttf +0 -0
- package/public/fonts/Chakra_Petch/ChakraPetch-Medium.ttf +0 -0
- package/public/fonts/Chakra_Petch/ChakraPetch-MediumItalic.ttf +0 -0
- package/public/fonts/Chakra_Petch/ChakraPetch-Regular.ttf +0 -0
- package/public/fonts/Chakra_Petch/ChakraPetch-SemiBold.ttf +0 -0
- package/public/fonts/Chakra_Petch/ChakraPetch-SemiBoldItalic.ttf +0 -0
- package/public/fonts/Chakra_Petch/OFL.txt +0 -93
- package/public/fonts/Inter/Inter-Italic-VariableFont_opsz,wght.ttf +0 -0
- package/public/fonts/Inter/Inter-VariableFont_opsz,wght.ttf +0 -0
- package/public/fonts/Inter/OFL.txt +0 -93
- package/public/fonts/Inter/README.txt +0 -118
- package/public/fonts/JetBrains_Mono/JetBrainsMono-Italic-VariableFont_wght.ttf +0 -0
- package/public/fonts/JetBrains_Mono/JetBrainsMono-VariableFont_wght.ttf +0 -0
- package/public/fonts/JetBrains_Mono/README.txt +0 -79
- package/public/fonts/OpenRing-Regular.ttf +0 -0
- package/public/fonts/Open_Sans/OpenSans-Italic-VariableFont_wdth,wght.ttf +0 -0
- package/public/fonts/Open_Sans/OpenSans-VariableFont_wdth,wght.ttf +0 -0
- package/public/fonts/Open_Sans/README.txt +0 -100
- package/public/fonts/Orbitron/OFL.txt +0 -93
- package/public/fonts/Orbitron/Orbitron-VariableFont_wght.ttf +0 -0
- package/public/fonts/Orbitron/README.txt +0 -68
- package/public/fonts/Rajdhani/OFL.txt +0 -93
- package/public/fonts/Rajdhani/Rajdhani-Bold.ttf +0 -0
- package/public/fonts/Rajdhani/Rajdhani-Light.ttf +0 -0
- package/public/fonts/Rajdhani/Rajdhani-Medium.ttf +0 -0
- package/public/fonts/Rajdhani/Rajdhani-Regular.ttf +0 -0
- package/public/fonts/Rajdhani/Rajdhani-SemiBold.ttf +0 -0
- package/public/fonts/runescape-uf.ttf +0 -0
- package/public/index.html +0 -769
- package/public/js/actor-labels.js +0 -65
- package/public/js/api.js +0 -39
- package/public/js/app.js +0 -45
- package/public/js/artifact-drawer.js +0 -79
- package/public/js/board-export.js +0 -161
- package/public/js/board-menu.js +0 -374
- package/public/js/card-actions.js +0 -545
- package/public/js/config.js +0 -20
- package/public/js/create-card.js +0 -190
- package/public/js/dom.js +0 -19
- package/public/js/drawer.js +0 -273
- package/public/js/font-preference.js +0 -230
- package/public/js/format.js +0 -433
- package/public/js/help-menu.js +0 -31
- package/public/js/icons.js +0 -16
- package/public/js/kanban.js +0 -694
- package/public/js/local-backend.js +0 -1015
- package/public/js/main.js +0 -161
- package/public/js/modal.js +0 -33
- package/public/js/motion-preference.js +0 -64
- package/public/js/panel.js +0 -58
- package/public/js/router.js +0 -134
- package/public/js/search.js +0 -56
- package/public/js/settings-tabs.js +0 -7
- package/public/js/settings.js +0 -1634
- package/public/js/sse.js +0 -159
- package/public/js/starscape.js +0 -332
- package/public/js/state.js +0 -129
- package/public/js/text-editing.js +0 -128
- package/public/js/theme-preference.js +0 -95
- package/public/js/ticket-detail.js +0 -1516
- package/public/js/ticket-typeahead.js +0 -49
- package/public/js/toast.js +0 -89
- package/public/js/topbar-notes.js +0 -155
- package/public/js/transport.js +0 -22
- package/public/js/typeahead.js +0 -206
- package/public/js/unread.js +0 -121
- package/public/js/update-check.js +0 -58
- package/public/js/url-routes.js +0 -94
- package/public/orbits-favicon.png +0 -0
- package/public/orbits-logo-bg-wide.png +0 -0
- package/public/orbits-logo-bg.png +0 -0
- package/public/orbits-logo.png +0 -0
- package/public/styles.css +0 -7709
- package/src/core/agent.js +0 -387
- package/src/core/agents-md.js +0 -109
- package/src/core/artifacts.js +0 -149
- package/src/core/attachments.js +0 -238
- package/src/core/auth.js +0 -85
- package/src/core/backups.js +0 -142
- package/src/core/board.js +0 -148
- package/src/core/boards.js +0 -409
- package/src/core/bootstrap.js +0 -170
- package/src/core/css-bundle.js +0 -30
- package/src/core/db.js +0 -315
- package/src/core/delete-board.js +0 -163
- package/src/core/dispatch.js +0 -1007
- package/src/core/events.js +0 -314
- package/src/core/http.js +0 -115
- package/src/core/migrate.js +0 -198
- package/src/core/paths.js +0 -55
- package/src/core/provision-repo-board.js +0 -119
- package/src/core/queries.js +0 -246
- package/src/core/registry.js +0 -211
- package/src/core/relations.js +0 -163
- package/src/core/review-verdicts.js +0 -138
- package/src/core/router.js +0 -556
- package/src/core/search.js +0 -183
- package/src/core/seed.js +0 -234
- package/src/core/snapshots.js +0 -692
- package/src/core/states.js +0 -167
- package/src/core/system-picker.js +0 -109
- package/src/core/tickets.js +0 -400
- package/src/core/util.js +0 -106
- package/src/core/version-check.js +0 -154
- package/src/mcp/orbit-client.js +0 -287
- package/src/server.js +0 -115
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SQLite adapter's schema: every table Orbit 2.0 keeps on a computer or
|
|
3
|
+
* server, top to bottom. A data folder holds two kinds of database:
|
|
4
|
+
*
|
|
5
|
+
* registry.db the list of boards and this Orbit's settings
|
|
6
|
+
* boards/<folder>/board.db one board's records, one file per board
|
|
7
|
+
*
|
|
8
|
+
* with each board's images and markdown beside its board.db (the blob store,
|
|
9
|
+
* ./blobs.ts) and copies under backups/ (./backups.ts).
|
|
10
|
+
*
|
|
11
|
+
* Every file carries two numbers in its header: `application_id`, which says
|
|
12
|
+
* the file is Orbit's, and `user_version`, the version of the schema below.
|
|
13
|
+
* A file without them was written by Orbit 1.x or the first 2.0 (same tables,
|
|
14
|
+
* no version), and the adapter refuses to open it rather than change it: the
|
|
15
|
+
* migration brings such folders over.
|
|
16
|
+
*
|
|
17
|
+
* Conventions:
|
|
18
|
+
*
|
|
19
|
+
* - Field names are the records' own (src/core/model.ts), so a row and its
|
|
20
|
+
* record read the same.
|
|
21
|
+
* - A board's database holds one board, so its rows carry no `board_id`: the
|
|
22
|
+
* adapter adds the board's id when it hands a record out, and refuses a
|
|
23
|
+
* record naming another board.
|
|
24
|
+
* - `seq INTEGER PRIMARY KEY` keeps the order records were written, which the
|
|
25
|
+
* port's lists fall back on ("then by when it was written"). It is an
|
|
26
|
+
* explicit column because VACUUM (and so every backup) may renumber an
|
|
27
|
+
* implicit rowid. The record's own id is `UNIQUE` beside it.
|
|
28
|
+
* - Foreign keys hold the board together (`PRAGMA foreign_keys` is on for
|
|
29
|
+
* every connection): a comment's card exists, deleting a card deletes what
|
|
30
|
+
* belongs to it, a lane with cards can't be deleted. Two names are left
|
|
31
|
+
* unchecked on purpose, as the port says: a card's epic and a cross-board
|
|
32
|
+
* relation's target.
|
|
33
|
+
* - Flags are 0 or 1, times are ISO 8601 text in UTC, JSON stays text.
|
|
34
|
+
*/
|
|
35
|
+
/** Says "this file is Orbit's": 'ORBT' as a big-endian 32-bit integer. */
|
|
36
|
+
export const APPLICATION_ID = 0x4f524254;
|
|
37
|
+
/** The version of the schema below, in every file's `user_version`. */
|
|
38
|
+
export const SCHEMA_VERSION = 1;
|
|
39
|
+
/**
|
|
40
|
+
* The version of the search index's shape (its columns and tokenizer). When
|
|
41
|
+
* it changes, a board's index is rebuilt from the documents it holds, once,
|
|
42
|
+
* the first time the board is opened; never at every start.
|
|
43
|
+
*/
|
|
44
|
+
export const SEARCH_INDEX_VERSION = 1;
|
|
45
|
+
/**
|
|
46
|
+
* The search index's table, apart from the rest so a change of its shape
|
|
47
|
+
* rebuilds it alone (./board.ts). Its columns are the core's document
|
|
48
|
+
* (SearchDocument in src/store/types.ts).
|
|
49
|
+
*/
|
|
50
|
+
export const SEARCH_TABLE = `CREATE VIRTUAL TABLE search USING fts5 (
|
|
51
|
+
title, description, type, details, comments,
|
|
52
|
+
tokenize = "unicode61 remove_diacritics 2 tokenchars '_'"
|
|
53
|
+
);`;
|
|
54
|
+
/** registry.db */
|
|
55
|
+
export const REGISTRY_SCHEMA = `
|
|
56
|
+
-- The boards this Orbit has. A board's records live in its own board.db, in
|
|
57
|
+
-- boards/<folder>/; the folder is named once, by the slug the board was made
|
|
58
|
+
-- with, and stays put when the slug changes. The name, slug and the rest are
|
|
59
|
+
-- copies of the board's own record, kept in step after each write, so the
|
|
60
|
+
-- list of boards is one read.
|
|
61
|
+
CREATE TABLE boards (
|
|
62
|
+
seq INTEGER PRIMARY KEY,
|
|
63
|
+
id TEXT NOT NULL UNIQUE,
|
|
64
|
+
slug TEXT NOT NULL UNIQUE,
|
|
65
|
+
name TEXT NOT NULL,
|
|
66
|
+
folder TEXT NOT NULL UNIQUE,
|
|
67
|
+
repo_url TEXT NOT NULL,
|
|
68
|
+
default_branch TEXT NOT NULL,
|
|
69
|
+
last_active_at TEXT,
|
|
70
|
+
created_at TEXT NOT NULL,
|
|
71
|
+
updated_at TEXT NOT NULL
|
|
72
|
+
);
|
|
73
|
+
CREATE INDEX boards_by_name ON boards (name, seq);
|
|
74
|
+
|
|
75
|
+
-- Small values this Orbit keeps for itself (the computer's default board).
|
|
76
|
+
CREATE TABLE settings (
|
|
77
|
+
key TEXT PRIMARY KEY,
|
|
78
|
+
value TEXT NOT NULL
|
|
79
|
+
);
|
|
80
|
+
`;
|
|
81
|
+
/** board.db */
|
|
82
|
+
export const BOARD_SCHEMA = `
|
|
83
|
+
-- The board's own record: one row.
|
|
84
|
+
CREATE TABLE board (
|
|
85
|
+
id TEXT PRIMARY KEY,
|
|
86
|
+
slug TEXT NOT NULL,
|
|
87
|
+
name TEXT NOT NULL,
|
|
88
|
+
repo_url TEXT NOT NULL,
|
|
89
|
+
default_branch TEXT NOT NULL,
|
|
90
|
+
project_notes TEXT NOT NULL,
|
|
91
|
+
agent_instructions TEXT NOT NULL,
|
|
92
|
+
ai_enabled INTEGER NOT NULL CHECK (ai_enabled IN (0, 1)),
|
|
93
|
+
created_at TEXT NOT NULL,
|
|
94
|
+
updated_at TEXT NOT NULL
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
-- Lanes (the code says states). Names are unique on the board; a role says
|
|
98
|
+
-- what the lane does in the agent flow.
|
|
99
|
+
CREATE TABLE states (
|
|
100
|
+
seq INTEGER PRIMARY KEY,
|
|
101
|
+
id TEXT NOT NULL UNIQUE,
|
|
102
|
+
name TEXT NOT NULL UNIQUE,
|
|
103
|
+
position INTEGER NOT NULL,
|
|
104
|
+
is_default INTEGER NOT NULL CHECK (is_default IN (0, 1)),
|
|
105
|
+
role TEXT CHECK (role IN ('ai_ready', 'in_progress', 'review', 'done')),
|
|
106
|
+
created_at TEXT NOT NULL
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
CREATE TABLE labels (
|
|
110
|
+
seq INTEGER PRIMARY KEY,
|
|
111
|
+
id TEXT NOT NULL UNIQUE,
|
|
112
|
+
name TEXT NOT NULL UNIQUE,
|
|
113
|
+
color TEXT NOT NULL,
|
|
114
|
+
created_at TEXT NOT NULL
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
-- Cards (the code says tickets). Numbers are unique on the board and given
|
|
118
|
+
-- by the adapter, one past the highest, inside the write that makes the card.
|
|
119
|
+
-- A card's epic (parent_ticket_id) is not a foreign key: a sub-card keeps it
|
|
120
|
+
-- when its epic is deleted.
|
|
121
|
+
CREATE TABLE tickets (
|
|
122
|
+
id TEXT PRIMARY KEY,
|
|
123
|
+
number INTEGER NOT NULL UNIQUE CHECK (number > 0),
|
|
124
|
+
title TEXT NOT NULL,
|
|
125
|
+
description TEXT NOT NULL,
|
|
126
|
+
type TEXT NOT NULL CHECK (type IN ('epic', 'feature', 'task', 'bug')),
|
|
127
|
+
parent_ticket_id TEXT,
|
|
128
|
+
ai_plan TEXT NOT NULL,
|
|
129
|
+
plan_artifact_path TEXT NOT NULL,
|
|
130
|
+
implementation_summary TEXT NOT NULL,
|
|
131
|
+
implementation_artifact_path TEXT NOT NULL,
|
|
132
|
+
implementation_updates TEXT NOT NULL,
|
|
133
|
+
nebula_url TEXT NOT NULL,
|
|
134
|
+
state_id TEXT NOT NULL REFERENCES states (id),
|
|
135
|
+
priority INTEGER NOT NULL CHECK (priority BETWEEN 0 AND 4),
|
|
136
|
+
created_by TEXT NOT NULL,
|
|
137
|
+
created_at TEXT NOT NULL,
|
|
138
|
+
updated_at TEXT NOT NULL,
|
|
139
|
+
archived_at TEXT
|
|
140
|
+
);
|
|
141
|
+
CREATE INDEX tickets_by_state ON tickets (state_id);
|
|
142
|
+
CREATE INDEX tickets_by_parent ON tickets (parent_ticket_id);
|
|
143
|
+
CREATE INDEX tickets_by_title ON tickets (lower(title));
|
|
144
|
+
|
|
145
|
+
CREATE TABLE ticket_labels (
|
|
146
|
+
seq INTEGER PRIMARY KEY,
|
|
147
|
+
ticket_id TEXT NOT NULL REFERENCES tickets (id) ON DELETE CASCADE,
|
|
148
|
+
label_id TEXT NOT NULL REFERENCES labels (id) ON DELETE CASCADE,
|
|
149
|
+
UNIQUE (ticket_id, label_id)
|
|
150
|
+
);
|
|
151
|
+
CREATE INDEX ticket_labels_by_label ON ticket_labels (label_id);
|
|
152
|
+
|
|
153
|
+
-- kind is free text: Orbit writes human_comment, agent_note, checkpoint and
|
|
154
|
+
-- completion. omitted_for_ai = 1 hides a comment from agents, search included.
|
|
155
|
+
CREATE TABLE comments (
|
|
156
|
+
seq INTEGER PRIMARY KEY,
|
|
157
|
+
id TEXT NOT NULL UNIQUE,
|
|
158
|
+
ticket_id TEXT NOT NULL REFERENCES tickets (id) ON DELETE CASCADE,
|
|
159
|
+
author TEXT NOT NULL,
|
|
160
|
+
kind TEXT NOT NULL,
|
|
161
|
+
body TEXT NOT NULL,
|
|
162
|
+
omitted_for_ai INTEGER NOT NULL CHECK (omitted_for_ai IN (0, 1)),
|
|
163
|
+
created_at TEXT NOT NULL
|
|
164
|
+
);
|
|
165
|
+
CREATE INDEX comments_by_ticket ON comments (ticket_id, created_at, seq);
|
|
166
|
+
|
|
167
|
+
-- Links between two cards of this board.
|
|
168
|
+
CREATE TABLE relations (
|
|
169
|
+
seq INTEGER PRIMARY KEY,
|
|
170
|
+
id TEXT NOT NULL UNIQUE,
|
|
171
|
+
source_ticket_id TEXT NOT NULL REFERENCES tickets (id) ON DELETE CASCADE,
|
|
172
|
+
target_ticket_id TEXT NOT NULL REFERENCES tickets (id) ON DELETE CASCADE,
|
|
173
|
+
type TEXT NOT NULL,
|
|
174
|
+
created_at TEXT NOT NULL,
|
|
175
|
+
UNIQUE (source_ticket_id, target_ticket_id, type)
|
|
176
|
+
);
|
|
177
|
+
CREATE INDEX relations_by_target ON relations (target_ticket_id);
|
|
178
|
+
|
|
179
|
+
-- Links from a card of this board to a card on another board of the same
|
|
180
|
+
-- Orbit. They live here, on the source's board; the target is named, never
|
|
181
|
+
-- checked, and whether it still blocks is read from it when asked.
|
|
182
|
+
CREATE TABLE cross_board_relations (
|
|
183
|
+
seq INTEGER PRIMARY KEY,
|
|
184
|
+
id TEXT NOT NULL UNIQUE,
|
|
185
|
+
source_ticket_id TEXT NOT NULL REFERENCES tickets (id) ON DELETE CASCADE,
|
|
186
|
+
target_board_id TEXT NOT NULL,
|
|
187
|
+
target_ticket_id TEXT NOT NULL,
|
|
188
|
+
type TEXT NOT NULL CHECK (type IN ('blocked_by', 'relates_to')),
|
|
189
|
+
created_at TEXT NOT NULL,
|
|
190
|
+
UNIQUE (source_ticket_id, target_board_id, target_ticket_id, type)
|
|
191
|
+
);
|
|
192
|
+
CREATE INDEX cross_board_relations_by_target ON cross_board_relations (target_board_id);
|
|
193
|
+
|
|
194
|
+
-- The journal: decisions and lessons, optionally about a card. Struck
|
|
195
|
+
-- entries stay; deleting their card keeps them, unlinked.
|
|
196
|
+
CREATE TABLE board_entries (
|
|
197
|
+
seq INTEGER PRIMARY KEY,
|
|
198
|
+
id TEXT NOT NULL UNIQUE,
|
|
199
|
+
type TEXT NOT NULL CHECK (type IN ('decision', 'lesson')),
|
|
200
|
+
title TEXT NOT NULL,
|
|
201
|
+
body TEXT NOT NULL,
|
|
202
|
+
ticket_id TEXT REFERENCES tickets (id) ON DELETE SET NULL,
|
|
203
|
+
created_by TEXT NOT NULL,
|
|
204
|
+
created_at TEXT NOT NULL,
|
|
205
|
+
updated_at TEXT NOT NULL,
|
|
206
|
+
struck_at TEXT
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
CREATE TABLE review_verdicts (
|
|
210
|
+
seq INTEGER PRIMARY KEY,
|
|
211
|
+
id TEXT NOT NULL UNIQUE,
|
|
212
|
+
ticket_id TEXT NOT NULL REFERENCES tickets (id) ON DELETE CASCADE,
|
|
213
|
+
verdict TEXT NOT NULL CHECK (verdict IN ('PASS', 'BLOCK', 'QUESTION')),
|
|
214
|
+
blocking_findings_json TEXT NOT NULL,
|
|
215
|
+
optional_findings_json TEXT NOT NULL,
|
|
216
|
+
evidence_commands_json TEXT NOT NULL,
|
|
217
|
+
reviewer_profile TEXT NOT NULL,
|
|
218
|
+
reviewer_session_id TEXT NOT NULL,
|
|
219
|
+
reviewed_commit_sha TEXT NOT NULL,
|
|
220
|
+
dispatch_run_id TEXT NOT NULL,
|
|
221
|
+
supersedes_prior_review_id TEXT REFERENCES review_verdicts (id) ON DELETE SET NULL,
|
|
222
|
+
created_by TEXT NOT NULL,
|
|
223
|
+
created_at TEXT NOT NULL
|
|
224
|
+
);
|
|
225
|
+
CREATE INDEX review_verdicts_by_ticket ON review_verdicts (ticket_id, created_at, seq);
|
|
226
|
+
CREATE INDEX review_verdicts_by_supersedes ON review_verdicts (supersedes_prior_review_id);
|
|
227
|
+
|
|
228
|
+
-- Images on cards. The bytes are files beside this database, at
|
|
229
|
+
-- attachments/<stored_path>.
|
|
230
|
+
CREATE TABLE attachments (
|
|
231
|
+
seq INTEGER PRIMARY KEY,
|
|
232
|
+
id TEXT NOT NULL UNIQUE,
|
|
233
|
+
ticket_id TEXT NOT NULL REFERENCES tickets (id) ON DELETE CASCADE,
|
|
234
|
+
original_name TEXT NOT NULL,
|
|
235
|
+
stored_path TEXT NOT NULL,
|
|
236
|
+
mime_type TEXT NOT NULL,
|
|
237
|
+
size_bytes INTEGER NOT NULL,
|
|
238
|
+
sha256 TEXT NOT NULL,
|
|
239
|
+
created_by TEXT NOT NULL,
|
|
240
|
+
created_at TEXT NOT NULL
|
|
241
|
+
);
|
|
242
|
+
CREATE INDEX attachments_by_ticket ON attachments (ticket_id, created_at, seq);
|
|
243
|
+
|
|
244
|
+
-- The board's history, in the order it was appended. seq is AUTOINCREMENT so
|
|
245
|
+
-- it never goes back, even after a board is cleared: a watcher that has seen
|
|
246
|
+
-- event n reads what came after it by seq > n (ARCHITECTURE.md, watch()).
|
|
247
|
+
CREATE TABLE events (
|
|
248
|
+
seq INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
249
|
+
id TEXT NOT NULL UNIQUE,
|
|
250
|
+
ticket_id TEXT REFERENCES tickets (id) ON DELETE SET NULL,
|
|
251
|
+
actor TEXT NOT NULL,
|
|
252
|
+
type TEXT NOT NULL,
|
|
253
|
+
body_json TEXT NOT NULL,
|
|
254
|
+
created_at TEXT NOT NULL
|
|
255
|
+
);
|
|
256
|
+
CREATE INDEX events_by_ticket ON events (ticket_id, created_at, seq);
|
|
257
|
+
CREATE INDEX events_by_time ON events (created_at, seq);
|
|
258
|
+
|
|
259
|
+
-- The search index: one document per card, built by the core (a comment
|
|
260
|
+
-- hidden from agents is never in it). Its rowid is the card's number, which
|
|
261
|
+
-- never changes. Words are runs of letters, digits and _, folded to lower
|
|
262
|
+
-- case without accents.
|
|
263
|
+
${SEARCH_TABLE}
|
|
264
|
+
|
|
265
|
+
-- Deleting a card deletes its document.
|
|
266
|
+
CREATE TRIGGER tickets_drop_document AFTER DELETE ON tickets BEGIN
|
|
267
|
+
DELETE FROM search WHERE rowid = old.number;
|
|
268
|
+
END;
|
|
269
|
+
|
|
270
|
+
-- What this file knows about itself: the search index's version.
|
|
271
|
+
CREATE TABLE meta (
|
|
272
|
+
key TEXT PRIMARY KEY,
|
|
273
|
+
value TEXT NOT NULL
|
|
274
|
+
);
|
|
275
|
+
INSERT INTO meta (key, value) VALUES ('search_index_version', '${String(SEARCH_INDEX_VERSION)}');
|
|
276
|
+
`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SQLite adapter: Orbit's storage port on `node:sqlite`, over a data
|
|
3
|
+
* folder.
|
|
4
|
+
*
|
|
5
|
+
* registry.db the list of boards and the settings
|
|
6
|
+
* boards/<folder>/board.db one board's records
|
|
7
|
+
* boards/<folder>/attachments/... its images (the blob store)
|
|
8
|
+
* boards/<folder>/artifacts/... its markdown
|
|
9
|
+
* backups/ copies (VACUUM INTO), with each board's files linked beside them
|
|
10
|
+
*
|
|
11
|
+
* The schema is ./schema.ts. A folder whose files lack v2's version (Orbit
|
|
12
|
+
* 1.x, or 2.0 before its rebuild) is refused untouched, with
|
|
13
|
+
* `data_needs_migration`. Several stores, in one process or several, can open
|
|
14
|
+
* one folder at once: SQLite's locks keep their writes one at a time, and
|
|
15
|
+
* each hears the others' changes.
|
|
16
|
+
*/
|
|
17
|
+
import type { Backups, BlobStore, OrbitStore } from "../../store/types.ts";
|
|
18
|
+
export interface SqliteStoreOptions {
|
|
19
|
+
/** The data folder. Made when missing. */
|
|
20
|
+
dataDir: string;
|
|
21
|
+
/** How long a write waits for a lock another process holds, in ms, before refusing with `storage_busy`. Default 5000. */
|
|
22
|
+
busyTimeoutMs?: number;
|
|
23
|
+
/** Copies kept per board and for the registry. Default 30. */
|
|
24
|
+
backupRetention?: number;
|
|
25
|
+
/** The clock backups are named by and counted against (once per day, UTC). Records never read it. */
|
|
26
|
+
now?: () => Date;
|
|
27
|
+
}
|
|
28
|
+
/** An OrbitStore over a data folder, with the blob store for the same folder. */
|
|
29
|
+
export interface SqliteStore extends OrbitStore {
|
|
30
|
+
readonly backups: Backups;
|
|
31
|
+
/** The bytes beside each board's database. */
|
|
32
|
+
readonly blobs: BlobStore;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Opens a store over `dataDir`, making the folder and its registry when
|
|
36
|
+
* they're missing. Rejects with `data_needs_migration` for a folder of older
|
|
37
|
+
* data, which it leaves as it was.
|
|
38
|
+
*/
|
|
39
|
+
export declare function openSqliteStore(options: SqliteStoreOptions): Promise<SqliteStore>;
|