@openparachute/vault 0.6.5-rc.2 → 0.6.5
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/.parachute/module.json +1 -0
- package/core/src/core.test.ts +7 -7
- package/core/src/do-param-cap.test.ts +161 -0
- package/core/src/links.ts +8 -13
- package/core/src/mcp.ts +1 -1
- package/core/src/notes.ts +33 -15
- package/core/src/onboarding.ts +14 -296
- package/core/src/schema.ts +5 -5
- package/core/src/seed-packs.test.ts +357 -0
- package/core/src/seed-packs.ts +823 -0
- package/core/src/sql-in.test.ts +58 -0
- package/core/src/sql-in.ts +76 -0
- package/core/src/tag-hierarchy.ts +1 -1
- package/core/src/tag-schemas.ts +2 -2
- package/core/src/transcription/provider.ts +141 -0
- package/core/src/types.ts +1 -1
- package/core/src/vault-projection.ts +1 -1
- package/core/src/wikilinks.ts +10 -4
- package/package.json +1 -1
- package/src/add-pack.test.ts +142 -0
- package/src/admin-spa.ts +2 -1
- package/src/auth.ts +1 -1
- package/src/cli.ts +806 -7
- package/src/export-watch.ts +1 -1
- package/src/live-frame-parity.test.ts +201 -0
- package/src/module-manifest.ts +8 -0
- package/src/onboarding-seed.test.ts +188 -40
- package/src/onboarding-seed.ts +41 -46
- package/src/routes.ts +20 -3
- package/src/routing.test.ts +2 -2
- package/src/routing.ts +18 -6
- package/src/self-register.test.ts +19 -0
- package/src/self-register.ts +6 -1
- package/src/server.ts +133 -31
- package/src/services-manifest.ts +8 -0
- package/src/subscriptions.ts +100 -42
- package/src/tag-scope.ts +3 -3
- package/src/test-support/live-frame-corpus.ts +72 -0
- package/src/token-store.ts +2 -2
- package/src/transcription/build.test.ts +305 -0
- package/src/transcription/build.ts +332 -0
- package/src/transcription/capability.test.ts +118 -0
- package/src/transcription/capability.ts +96 -0
- package/src/transcription/download.test.ts +101 -0
- package/src/transcription/download.ts +71 -0
- package/src/transcription/install-python.test.ts +366 -0
- package/src/transcription/install-python.ts +471 -0
- package/src/transcription/install.test.ts +167 -0
- package/src/transcription/install.ts +296 -0
- package/src/transcription/providers/onnx-asr.test.ts +229 -0
- package/src/transcription/providers/onnx-asr.ts +239 -0
- package/src/transcription/providers/parakeet-mlx.test.ts +290 -0
- package/src/transcription/providers/parakeet-mlx.ts +242 -0
- package/src/transcription/providers/scribe-http.test.ts +195 -0
- package/src/transcription/providers/scribe-http.ts +144 -0
- package/src/transcription/providers/transcribe-cpp.test.ts +314 -0
- package/src/transcription/providers/transcribe-cpp.ts +293 -0
- package/src/transcription/select.test.ts +299 -0
- package/src/transcription/select.ts +397 -0
- package/src/transcription/tiers.test.ts +197 -0
- package/src/transcription/tiers.ts +184 -0
- package/src/transcription-worker.test.ts +44 -0
- package/src/transcription-worker.ts +57 -122
- package/src/vault-create.test.ts +43 -10
- package/src/vault.test.ts +49 -1
- package/src/ws-server.ts +408 -0
- package/src/ws-subscribe.test.ts +474 -0
- package/src/ws-subscribe.ts +242 -0
- package/src/subscribe.test.ts +0 -609
- package/src/subscribe.ts +0 -248
package/core/src/onboarding.ts
CHANGED
|
@@ -1,300 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* DEPRECATED back-compat shim — the onboarding content moved to
|
|
3
|
+
* `seed-packs.ts` (named seed packs: `welcome` / `getting-started` /
|
|
4
|
+
* `surface-starter`, one canonical content module for both the bun and cloud
|
|
5
|
+
* runtimes).
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* can share the canonical note paths without a cross-layer import.
|
|
10
|
-
*
|
|
11
|
-
* The notes are AI-legible, practical (SKILL.md-style) guides addressed to the
|
|
12
|
-
* assistant that connects to the vault. They are a starting point, not gospel —
|
|
13
|
-
* Getting Started tells the AI it can adapt them as the vault matures. Seeding is
|
|
14
|
-
* create-time only and idempotent (never clobbers a note the operator/AI has
|
|
15
|
-
* since edited).
|
|
16
|
-
*
|
|
17
|
-
* See the demo-prep Workstream A (A1/A2/A3).
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/** Canonical path of the seeded onboarding guide. Top-level, title-cased so it
|
|
21
|
-
* reads as a doc and sorts to the top of a casual file listing. */
|
|
22
|
-
export const GETTING_STARTED_PATH = "Getting Started";
|
|
23
|
-
|
|
24
|
-
/** Canonical path of the seeded surface-build starter, linked from Getting
|
|
25
|
-
* Started. */
|
|
26
|
-
export const SURFACE_STARTER_PATH = "Surface Starter";
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Body of the seeded `Getting Started` note.
|
|
30
|
-
*
|
|
31
|
-
* Voice: addressed to the connected AI ("you"), practical, SKILL.md-style.
|
|
32
|
-
* Covers (a) what a Parachute vault is, (b) tags-vs-paths-vs-schemas design,
|
|
33
|
-
* (c) importing existing notes, (d) that it's an adaptable starting point.
|
|
34
|
-
*/
|
|
35
|
-
export const GETTING_STARTED_CONTENT = `# Getting Started
|
|
36
|
-
|
|
37
|
-
This is the **start-here guide** for this Parachute vault — think of it like a
|
|
38
|
-
\`SKILL.md\`: practical instructions for setting up and growing the vault. Read it
|
|
39
|
-
when you're **getting the vault started** or orienting yourself to it — you don't
|
|
40
|
-
need to re-read it every session. It's a **starting point, not a script**, and
|
|
41
|
-
it's adaptable: edit it (see "Adapt this note") as the vault takes shape.
|
|
42
|
-
|
|
43
|
-
When the operator says something like *"help me set up my parachute,"* this is
|
|
44
|
-
your brief: design their structure with them, import what they already have, and
|
|
45
|
-
shape the vault around how they actually think and work.
|
|
46
|
-
|
|
47
|
-
## What a Parachute vault is
|
|
48
|
-
|
|
49
|
-
A vault is **notes + tags + links** in one graph, reachable over MCP (you, now),
|
|
50
|
-
a REST API (scripts), and any surface (a UI). It ships *blank* — no predefined
|
|
51
|
-
tags or schema. You and the operator design the structure that fits *their*
|
|
52
|
-
life and work. The vault is the engine; the meaning is yours to bring.
|
|
53
|
-
|
|
54
|
-
Core moves you already have as MCP tools:
|
|
55
|
-
- \`create-note\` / \`update-note\` / \`delete-note\` — write notes (single or batch).
|
|
56
|
-
- \`query-notes\` — by id/path, by tag, full-text \`search\`, or graph \`near\` a note.
|
|
57
|
-
- \`list-tags\` / \`update-tag\` / \`delete-tag\` — manage the tag vocabulary + schemas.
|
|
58
|
-
- \`find-path\` — shortest link path between two notes.
|
|
59
|
-
- \`vault-info\` — refresh the live schema/stats projection any time.
|
|
60
|
-
|
|
61
|
-
\`[[wikilinks]]\` in note content auto-link to the note at that path — use them
|
|
62
|
-
freely; they resolve even if the target is created later.
|
|
63
|
-
|
|
64
|
-
## Tags vs paths vs schemas — the design vocabulary
|
|
65
|
-
|
|
66
|
-
These three axes are the heart of vault design. Use the right one for the job:
|
|
67
|
-
|
|
68
|
-
- **Tags = types / membership.** A tag answers *"what kind of thing is this?"*
|
|
69
|
-
(\`#person\`, \`#meeting\`, \`#project\`). Queries **expand over tags**: a tag can
|
|
70
|
-
declare \`parent_names\` so \`tag:X\` also returns its subtypes (e.g. tagging a
|
|
71
|
-
note \`#meeting/standup\` with \`parent_names: [meeting]\` means \`query-notes
|
|
72
|
-
{ tag: "meeting" }\` finds it). Tags are how you ask *"show me all my people."*
|
|
73
|
-
This is the primary structure — reach for a tag first.
|
|
74
|
-
|
|
75
|
-
- **Paths = organization / filing.** A path (\`Projects/Acme/Kickoff\`) is *where*
|
|
76
|
-
a note lives — a human-browsable address, unique per note. Paths are for
|
|
77
|
-
folders and named docs (like this one). They do **not** drive type queries;
|
|
78
|
-
don't encode meaning in a path that a tag should carry. A note can have a
|
|
79
|
-
path, tags, or both.
|
|
80
|
-
|
|
81
|
-
- **Schemas = typed metadata fields.** Attach a schema to a tag (via
|
|
82
|
-
\`update-tag\`) to declare typed metadata fields — e.g. \`#meeting\` with a
|
|
83
|
-
\`held_on\` date, \`#person\` with an \`email\`. Each field can **optionally** be
|
|
84
|
-
marked \`indexed: true\` to make it **queryable with operators** (\`query-notes
|
|
85
|
-
{ tag: "meeting", metadata: { held_on: { gte: "2026-01-01" } } }\`); indexing
|
|
86
|
-
is opt-in per field, not automatic. Add a schema (and index a field) when you
|
|
87
|
-
find yourself wanting to filter or sort on a value, not before.
|
|
88
|
-
|
|
89
|
-
Rule of thumb: **type with tags, file with paths, make-it-queryable with
|
|
90
|
-
schemas.** Start minimal — invent tags as real notes need them, declare a
|
|
91
|
-
schema only when a query demands it. Over-designing an empty vault is the
|
|
92
|
-
common mistake.
|
|
93
|
-
|
|
94
|
-
Declaring a schema is one \`update-tag\` call — the \`fields\` object maps each
|
|
95
|
-
field name to \`{ type, enum?, indexed? }\` (\`type\` is \`"string"\`, \`"boolean"\`,
|
|
96
|
-
or \`"integer"\`):
|
|
97
|
-
|
|
98
|
-
\`\`\`
|
|
99
|
-
update-tag {
|
|
100
|
-
tag: "meeting",
|
|
101
|
-
description: "A meeting with notes",
|
|
102
|
-
fields: {
|
|
103
|
-
held_on: { type: "string", indexed: true }, // queryable with operators
|
|
104
|
-
status: { type: "string", enum: ["scheduled", "done"] }, // first enum value is the default
|
|
105
|
-
rating: { type: "integer" }
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
\`\`\`
|
|
109
|
-
|
|
110
|
-
\`fields\` is **merged** (new keys added, existing replaced); \`parent_names\` and
|
|
111
|
-
\`relationships\` are replaced wholesale when passed. Only \`indexed: true\` fields
|
|
112
|
-
support operator queries (\`metadata: { held_on: { gte: "..." } }\`) and
|
|
113
|
-
\`order_by\`; all tags declaring the same field must agree on its \`type\` and
|
|
114
|
-
\`indexed\` flag.
|
|
115
|
-
|
|
116
|
-
## Write gotchas
|
|
117
|
-
|
|
118
|
-
A few behaviors worth knowing before you write at scale:
|
|
119
|
-
|
|
120
|
-
- **\`update-note\` requires optimistic concurrency by default.** Pass
|
|
121
|
-
\`if_updated_at\` with the \`updated_at\` you last read; a mismatch returns a
|
|
122
|
-
conflict error (re-read, reconcile, retry). For bulk/scripted writes where
|
|
123
|
-
concurrency is known-safe, pass \`force: true\` to waive the *requirement to
|
|
124
|
-
supply* it. \`append\`/\`prepend\`-only updates are exempt (no-conflict-by-design).
|
|
125
|
-
- **A schema field's default is filled in on write, so it shows up even when you
|
|
126
|
-
didn't set it.** When a note gets a tag whose schema declares a field, the
|
|
127
|
-
missing field is back-filled: an \`enum\` field → its **first listed value**, an
|
|
128
|
-
\`integer\` → \`0\`, a \`boolean\` → \`false\`, a plain string → \`""\`. So a
|
|
129
|
-
\`rating: { type: "integer" }\` reads as \`0\` on notes nobody rated — that \`0\`
|
|
130
|
-
is "unset," not "rated zero." Order an \`enum\`'s values so the first is a sane
|
|
131
|
-
default, and don't read a back-filled \`0\`/\`""\`/\`false\` as a real value.
|
|
132
|
-
- **Validation is advisory, never blocking.** A type/enum mismatch comes back as
|
|
133
|
-
a \`validation_status\` warning on the write response — the write still lands.
|
|
134
|
-
Read those warnings and self-correct on the next turn.
|
|
135
|
-
|
|
136
|
-
(Full design guide, with copy-paste examples: https://parachute.computer/scripting/)
|
|
137
|
-
|
|
138
|
-
## Importing existing notes
|
|
139
|
-
|
|
140
|
-
If the operator already keeps notes (Obsidian, Markdown, etc.), bring them in
|
|
141
|
-
rather than starting cold:
|
|
142
|
-
|
|
143
|
-
- **Obsidian / a Markdown folder:** \`parachute-vault import <path>\` — preserves
|
|
144
|
-
frontmatter, tags, \`[[wikilinks]]\`, and file paths.
|
|
145
|
-
- **A portable Parachute export** (a dir with \`.parachute/vault.yaml\`): the same
|
|
146
|
-
\`import\` command auto-detects it and does a lossless round-trip (ids, typed
|
|
147
|
-
links, tag schemas, attachments).
|
|
148
|
-
- **Ad hoc / pasted content:** just \`create-note\` it. Then help the operator tag
|
|
149
|
-
and schematize: read a sample of imported notes, propose a small tag
|
|
150
|
-
vocabulary, and apply it.
|
|
151
|
-
|
|
152
|
-
After an import, orient yourself: \`vault-info\` for the new schema picture,
|
|
153
|
-
\`list-tags\` to see what vocabulary arrived, \`query-notes { search: "..." }\` to
|
|
154
|
-
spot-check. Then propose structure — don't impose it silently.
|
|
155
|
-
|
|
156
|
-
## Later: a custom surface
|
|
157
|
-
|
|
158
|
-
Building a custom UI over the vault (a dashboard, a notes app) is usually **not**
|
|
159
|
-
the starting point — get the notes and structure right first. If and when the
|
|
160
|
-
operator wants one, see **[[Surface Starter]]** (built with
|
|
161
|
-
\`@openparachute/surface-client\` + \`@openparachute/surface-render\`).
|
|
162
|
-
|
|
163
|
-
## Adapt this note
|
|
164
|
-
|
|
165
|
-
This guide is a **default starting point, not gospel** — edit it to fit this
|
|
166
|
-
vault. As you and the operator settle on a tag vocabulary, conventions, or a
|
|
167
|
-
surface, you can record that here so a future session inherits the current shape
|
|
168
|
-
of the vault instead of this blank-slate default. Useful things to capture:
|
|
169
|
-
- the tag vocabulary you've settled on and what each tag means;
|
|
170
|
-
- naming/path conventions for this vault;
|
|
171
|
-
- which schemas exist and why;
|
|
172
|
-
- anything a fresh AI would need to be immediately useful.
|
|
173
|
-
|
|
174
|
-
Treat setup as a relationship, not a one-time install.
|
|
175
|
-
`;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Body of the seeded `Surface Starter` note. Linked from Getting Started.
|
|
179
|
-
*
|
|
180
|
-
* A concise, *living* starter prompt for building a custom surface (UI) over
|
|
181
|
-
* the vault using the published surface packages. Tells the AI to import the
|
|
182
|
-
* packages rather than hand-roll OAuth/API/rendering.
|
|
7
|
+
* Kept so existing importers (including out-of-repo consumers of core, e.g.
|
|
8
|
+
* parachute-cloud's `file:` dep) keep resolving. New code imports from
|
|
9
|
+
* `seed-packs.ts` directly — prefer the `SeedPack` objects + `applySeedPack`
|
|
10
|
+
* over these raw constants.
|
|
183
11
|
*/
|
|
184
|
-
export const SURFACE_STARTER_CONTENT = `# Surface Starter
|
|
185
|
-
|
|
186
|
-
A **surface** is a custom UI over this vault — a dashboard, a notes app, a
|
|
187
|
-
single-purpose tool. This note is a living starter for building one *with the
|
|
188
|
-
operator*. Update it as you settle on a stack, conventions, or a deployed
|
|
189
|
-
surface for this vault.
|
|
190
|
-
|
|
191
|
-
## ⚠️ Build a surface in your editor, not from this session
|
|
192
|
-
|
|
193
|
-
A surface runs **in a browser**: it needs a real OAuth round-trip (a redirect to
|
|
194
|
-
the hub's consent screen and back), a dev server to serve the app, and a CORS
|
|
195
|
-
origin the hub trusts. **None of that exists in this MCP/chat session** — there's
|
|
196
|
-
no browser, no redirect, no dev server. So **don't try to "run" a surface from
|
|
197
|
-
the vault session.** Build it in **Claude Code (or your editor)** against a local
|
|
198
|
-
dev server (\`vite\`/\`bun dev\`), sign in through the browser there, and iterate.
|
|
199
|
-
From *this* session you design the vault structure the surface will consume and
|
|
200
|
-
write the code — you can't exercise the OAuth/render loop here.
|
|
201
|
-
|
|
202
|
-
## Don't hand-roll the plumbing
|
|
203
|
-
|
|
204
|
-
Two published packages do the heavy lifting — import them instead of writing
|
|
205
|
-
OAuth, the vault API client, or note rendering by hand:
|
|
206
|
-
|
|
207
|
-
- **\`@openparachute/surface-client\`** — \`createVaultSurface(...)\` wires up
|
|
208
|
-
Parachute OAuth (sign-in on first connect) and a typed vault API client
|
|
209
|
-
(query/create/update notes, tags, links) so your app code just calls methods.
|
|
210
|
-
- **\`@openparachute/surface-render\`** — \`<NoteRenderer>\` and friends render note
|
|
211
|
-
content (Markdown, wikilinks, embeds) the way the rest of the ecosystem does,
|
|
212
|
-
so your surface looks native without re-implementing the renderer.
|
|
213
|
-
|
|
214
|
-
## Minimal end-to-end (config → sign-in → query → render)
|
|
215
|
-
|
|
216
|
-
A React sketch wiring all four steps. \`createVaultSurface\` is the only required
|
|
217
|
-
config (its \`clientName\` is the sole required option; \`hubUrl\` defaults to the
|
|
218
|
-
page origin, \`vaultName\` to \`"default"\`, \`scope\` to \`"vault:read vault:write"\`).
|
|
219
|
-
\`getClient()\` returns a \`VaultClient\` (or \`null\` until signed in) whose
|
|
220
|
-
\`queryNotes()\` takes the same query grammar you use over MCP. See
|
|
221
|
-
[[Getting Started]] / \`vault-info\` for this vault's NAME and hub origin.
|
|
222
|
-
|
|
223
|
-
\`\`\`tsx
|
|
224
|
-
import { useEffect, useState } from "react";
|
|
225
|
-
import { createVaultSurface, type Note } from "@openparachute/surface-client";
|
|
226
|
-
import { NoteRenderer } from "@openparachute/surface-render";
|
|
227
|
-
|
|
228
|
-
// One surface per (hub, vault) config. clientName shows on the consent screen.
|
|
229
|
-
const surface = createVaultSurface({
|
|
230
|
-
clientName: "My Vault Surface",
|
|
231
|
-
hubUrl: "https://your-hub.example", // omit to default to window.location.origin
|
|
232
|
-
vaultName: "default", // this vault's name (see vault-info)
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
export function App() {
|
|
236
|
-
const [notes, setNotes] = useState<Note[] | null>(null);
|
|
237
|
-
|
|
238
|
-
useEffect(() => {
|
|
239
|
-
(async () => {
|
|
240
|
-
// OAuth: finish a redirect callback if we're on it, else send the browser
|
|
241
|
-
// off to sign in. handleCallback() needs BOTH code + state, so guard on
|
|
242
|
-
// both. (Real apps route /oauth/callback to its own component.)
|
|
243
|
-
const q = new URLSearchParams(location.search);
|
|
244
|
-
if (q.get("code") && q.get("state")) await surface.handleCallback();
|
|
245
|
-
// getClient() builds a FRESH VaultClient on each call — fine here (one-shot
|
|
246
|
-
// effect); in a real component keep it in state/ref, don't call it per render.
|
|
247
|
-
const client = surface.getClient(); // VaultClient | null (null = not signed in)
|
|
248
|
-
if (!client) return void surface.login();
|
|
249
|
-
setNotes(await client.queryNotes({ tag: "note", limit: 20 }));
|
|
250
|
-
})();
|
|
251
|
-
}, []);
|
|
252
|
-
|
|
253
|
-
if (!notes) return <p>Connecting…</p>;
|
|
254
|
-
return (
|
|
255
|
-
<>
|
|
256
|
-
{notes.map((n) => (
|
|
257
|
-
// resolve maps a [[wikilink]] target → { href, exists } (or null = inert).
|
|
258
|
-
// You own this href's trust boundary — keep it a fragment (or validate the
|
|
259
|
-
// target). Don't build a raw passthrough href: a vault note could carry a
|
|
260
|
-
// javascript: target.
|
|
261
|
-
<NoteRenderer
|
|
262
|
-
key={n.id}
|
|
263
|
-
note={n}
|
|
264
|
-
resolve={(target) => ({ href: \`#/n/\${encodeURIComponent(target)}\`, exists: true })}
|
|
265
|
-
/>
|
|
266
|
-
))}
|
|
267
|
-
</>
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
\`\`\`
|
|
271
|
-
|
|
272
|
-
That's the whole spine. \`<NoteRenderer>\` also takes \`linkComponent\` (your
|
|
273
|
-
router's \`<Link>\`) and \`fetchBlob\` (\`(url) => Promise<Blob>\`, for auth'd
|
|
274
|
-
image/audio embeds) when you need them — both optional.
|
|
275
|
-
|
|
276
|
-
## Build order
|
|
277
|
-
|
|
278
|
-
1. **Auth + data first.** Stand up \`createVaultSurface\` pointed at this vault;
|
|
279
|
-
confirm you can sign in and \`queryNotes\` round-trips before any UI polish.
|
|
280
|
-
2. **Render next.** Drop in \`<NoteRenderer>\` to display note content; wire
|
|
281
|
-
wikilink/embed resolution through the package, not by hand.
|
|
282
|
-
3. **UX last.** Layout, navigation, and the surface's actual purpose — now that
|
|
283
|
-
auth, data, and rendering are solid.
|
|
284
|
-
|
|
285
|
-
## Design it around this vault's structure
|
|
286
|
-
|
|
287
|
-
A good surface is shaped by the vault's tags + schemas (see [[Getting Started]]
|
|
288
|
-
for the tags-vs-paths-vs-schemas design vocabulary). Query by the tags that
|
|
289
|
-
matter to the operator; surface the indexed fields they filter on. If the vault
|
|
290
|
-
doesn't yet have the structure a surface wants, that's a signal to design tags +
|
|
291
|
-
schemas first.
|
|
292
|
-
|
|
293
|
-
## Adapt this note
|
|
294
|
-
|
|
295
|
-
When you build a surface for this vault, record it here: what it's for, the
|
|
296
|
-
stack, how to run it, the queries it depends on. The next session should be able
|
|
297
|
-
to pick it up from this note.
|
|
298
12
|
|
|
299
|
-
|
|
300
|
-
|
|
13
|
+
export {
|
|
14
|
+
GETTING_STARTED_PATH,
|
|
15
|
+
GETTING_STARTED_CONTENT,
|
|
16
|
+
SURFACE_STARTER_PATH,
|
|
17
|
+
SURFACE_STARTER_CONTENT,
|
|
18
|
+
} from "./seed-packs.ts";
|
package/core/src/schema.ts
CHANGED
|
@@ -41,7 +41,7 @@ CREATE TABLE IF NOT EXISTS notes (
|
|
|
41
41
|
|
|
42
42
|
-- Tags: first-class identity carrying schema, hierarchy, and typed-link
|
|
43
43
|
-- declarations. One row per tag; no notes-as-config sidecars for these
|
|
44
|
-
-- concerns. See
|
|
44
|
+
-- concerns. See docs/contracts/tag-data-model.md.
|
|
45
45
|
--
|
|
46
46
|
-- description — human-readable blurb (markdown).
|
|
47
47
|
-- fields — JSON: indexed metadata field declarations per
|
|
@@ -136,7 +136,7 @@ CREATE TABLE IF NOT EXISTS indexed_fields (
|
|
|
136
136
|
-- scoped_tags is a JSON-encoded array of root tag names that constrain the
|
|
137
137
|
-- token's effective access (intersection with the scopes column). NULL
|
|
138
138
|
-- means unscoped — full vault access per scopes. Introduced in v13 per
|
|
139
|
-
--
|
|
139
|
+
-- docs/contracts/tag-scoped-tokens.md. Hierarchy expansion is applied at auth
|
|
140
140
|
-- time via getTagDescendants; the column stores root names only.
|
|
141
141
|
--
|
|
142
142
|
-- vault_name (v16) binds the token to a single vault. NULL means the
|
|
@@ -443,7 +443,7 @@ export function initSchema(db: Database): void {
|
|
|
443
443
|
// Migrate v13 → v14: tag-data-model reshape. Augment `tags` row with
|
|
444
444
|
// description/fields/relationships/parent_names/timestamps; copy data
|
|
445
445
|
// from the v6-era tag_schemas sidecar and from `_tags/<name>` config
|
|
446
|
-
// notes; drop tag_schemas after copy. See
|
|
446
|
+
// notes; drop tag_schemas after copy. See docs/contracts/tag-data-model.md.
|
|
447
447
|
migrateToV14(db);
|
|
448
448
|
|
|
449
449
|
// Migrate v14 → v15: retire the `_schemas/<name>` and `_schema_defaults`
|
|
@@ -650,7 +650,7 @@ function migrateToV12(db: Database): void {
|
|
|
650
650
|
* (current full-vault behavior); a JSON array of root tag names narrows the
|
|
651
651
|
* token's access to notes carrying one of those tags or a sub-tag thereof
|
|
652
652
|
* (hierarchy expansion via getTagDescendants at auth time). See
|
|
653
|
-
*
|
|
653
|
+
* docs/contracts/tag-scoped-tokens.md.
|
|
654
654
|
*/
|
|
655
655
|
function migrateToV13(db: Database): void {
|
|
656
656
|
if (hasTable(db, "tokens") && !hasColumn(db, "tokens", "scoped_tags")) {
|
|
@@ -659,7 +659,7 @@ function migrateToV13(db: Database): void {
|
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
/**
|
|
662
|
-
* Migrate v13 → v14: tag-data-model reshape (
|
|
662
|
+
* Migrate v13 → v14: tag-data-model reshape (docs/contracts/tag-data-model.md).
|
|
663
663
|
*
|
|
664
664
|
* Augments the `tags` table with five new columns and one timestamp pair,
|
|
665
665
|
* then copies pre-existing data from two notes-as-config sidecars:
|