@openparachute/vault 0.6.0-rc.1 → 0.6.1
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 +14 -3
- package/README.md +32 -7
- package/core/src/content-range.test.ts +374 -0
- package/core/src/content-range.ts +185 -0
- package/core/src/core.test.ts +279 -26
- package/core/src/expand-visibility.test.ts +102 -0
- package/core/src/expand.ts +31 -3
- package/core/src/indexed-fields.ts +1 -1
- package/core/src/link-count.test.ts +301 -0
- package/core/src/links.ts +172 -22
- package/core/src/mcp.ts +254 -34
- package/core/src/notes.ts +172 -48
- package/core/src/obsidian-alignment.test.ts +375 -0
- package/core/src/obsidian.ts +234 -14
- package/core/src/portable-md.test.ts +40 -0
- package/core/src/portable-md.ts +142 -16
- package/core/src/query-perf-routing.test.ts +208 -0
- package/core/src/schema.ts +87 -11
- package/core/src/store.ts +69 -22
- package/core/src/tag-expand-axis.test.ts +301 -0
- package/core/src/tag-hierarchy.ts +80 -0
- package/core/src/tag-schemas.ts +61 -46
- package/core/src/triggers-store.test.ts +100 -0
- package/core/src/triggers-store.ts +165 -0
- package/core/src/types.ts +68 -4
- package/core/src/vault-projection.ts +20 -0
- package/core/src/wikilinks.ts +2 -2
- package/package.json +2 -3
- package/src/admin-spa.test.ts +100 -10
- package/src/admin-spa.ts +48 -3
- package/src/auth-hub-jwt.test.ts +8 -1
- package/src/auth-status.ts +2 -2
- package/src/auth.test.ts +39 -3
- package/src/auth.ts +31 -2
- package/src/auto-transcribe.test.ts +51 -0
- package/src/auto-transcribe.ts +24 -6
- package/src/autostart.test.ts +75 -0
- package/src/autostart.ts +84 -0
- package/src/cli.ts +434 -140
- package/src/config.test.ts +109 -0
- package/src/config.ts +157 -10
- package/src/content-range-routes.test.ts +178 -0
- package/src/export-watch.test.ts +23 -0
- package/src/export-watch.ts +14 -0
- package/src/git-preflight.test.ts +70 -0
- package/src/git-preflight.ts +68 -0
- package/src/github-device-flow.test.ts +265 -6
- package/src/github-device-flow.ts +297 -45
- package/src/hub-jwt.test.ts +75 -2
- package/src/hub-jwt.ts +43 -6
- package/src/init-summary.test.ts +120 -5
- package/src/init-summary.ts +67 -25
- package/src/live-match.test.ts +198 -0
- package/src/live-match.ts +310 -0
- package/src/mcp-install.test.ts +93 -0
- package/src/mcp-install.ts +106 -0
- package/src/mcp-tools.ts +80 -7
- package/src/mirror-config.test.ts +14 -0
- package/src/mirror-config.ts +11 -0
- package/src/mirror-credentials.test.ts +20 -0
- package/src/mirror-credentials.ts +6 -2
- package/src/mirror-import.test.ts +110 -0
- package/src/mirror-import.ts +71 -13
- package/src/mirror-manager.test.ts +51 -0
- package/src/mirror-manager.ts +73 -11
- package/src/mirror-routes.test.ts +1331 -110
- package/src/mirror-routes.ts +787 -30
- package/src/oauth-discovery.test.ts +55 -0
- package/src/oauth-discovery.ts +24 -5
- package/src/routes.ts +763 -122
- package/src/routing.test.ts +451 -5
- package/src/routing.ts +121 -5
- package/src/scopes.ts +1 -1
- package/src/server.ts +66 -4
- package/src/storage.test.ts +162 -0
- package/src/subscribe.test.ts +588 -0
- package/src/subscribe.ts +248 -0
- package/src/subscriptions.ts +295 -0
- package/src/tag-expand-routes.test.ts +45 -0
- package/src/tag-scope.ts +68 -1
- package/src/token-store.ts +7 -7
- package/src/transcription-worker.test.ts +471 -5
- package/src/transcription-worker.ts +212 -44
- package/src/triggers-api.test.ts +533 -0
- package/src/triggers-api.ts +295 -0
- package/src/triggers.ts +93 -7
- package/src/usage.test.ts +362 -0
- package/src/usage.ts +318 -0
- package/src/vault-create.test.ts +340 -12
- package/src/vault-name.test.ts +61 -3
- package/src/vault-name.ts +62 -14
- package/src/vault-remove.test.ts +187 -0
- package/src/vault-store.ts +10 -3
- package/src/vault.test.ts +1353 -62
- package/web/ui/dist/assets/index-BPgyIjR7.js +61 -0
- package/web/ui/dist/assets/index-J0pVP7I-.css +1 -0
- package/web/ui/dist/index.html +2 -2
- package/web/ui/dist/assets/index-DBe8Xiah.css +0 -1
- package/web/ui/dist/assets/index-DDRo6F4u.js +0 -60
package/src/autostart.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decide whether `parachute-vault init` should register a boot/restart daemon
|
|
3
|
+
* (launchd on macOS, systemd on Linux).
|
|
4
|
+
*
|
|
5
|
+
* Pure: extracted so the flag × persisted-config × hub-presence matrix can be
|
|
6
|
+
* unit-tested without spawning the CLI or touching launchd/systemd. The caller
|
|
7
|
+
* passes in the resolved `hubPresent` signal (from `detectHubPresence`) so this
|
|
8
|
+
* function stays side-effect-free.
|
|
9
|
+
*
|
|
10
|
+
* Why hub-presence flips the default (ParachuteComputer/parachute-hub#580):
|
|
11
|
+
* under hub-as-supervisor the hub owns the vault lifecycle — it spawns vault as
|
|
12
|
+
* a supervised child. If init *also* registers a launchd/systemd unit with
|
|
13
|
+
* `KeepAlive`/`RunAtLoad`, two lifecycles race for :1940: the supervisor's
|
|
14
|
+
* child and the platform manager's respawn. `parachute stop` kills the
|
|
15
|
+
* supervised one, launchd resurrects the other (EADDRINUSE crash-loop, pidfile
|
|
16
|
+
* records the loser, the rogue holds the port with no injected
|
|
17
|
+
* PARACHUTE_HUB_ORIGIN → iss mismatch). Defaulting autostart OFF when a hub is
|
|
18
|
+
* present makes the standalone daemon an explicit opt-in.
|
|
19
|
+
*
|
|
20
|
+
* Precedence (first match wins):
|
|
21
|
+
* 1. `--no-autostart` on this run → off (persisted; safer-default
|
|
22
|
+
* precedence beats --autostart)
|
|
23
|
+
* 2. `--autostart` on this run → on (persisted; operator
|
|
24
|
+
* override — caller warns if a
|
|
25
|
+
* supervised hub was detected)
|
|
26
|
+
* 3. Existing `config.autostart` (boolean) → that value (honor prior choice)
|
|
27
|
+
* 4. Hub present, no flag, no persisted value → off (the hub supervisor owns
|
|
28
|
+
* the lifecycle — #580)
|
|
29
|
+
* 5. Default → on (standalone deploys
|
|
30
|
+
* genuinely need a daemon)
|
|
31
|
+
*
|
|
32
|
+
* `persist` is true only when the choice came from an explicit flag (cases 1+2)
|
|
33
|
+
* — matching the prior behavior where a flagless re-run never rewrote the
|
|
34
|
+
* persisted value. The hub-present default (case 4) is intentionally NOT
|
|
35
|
+
* persisted: it's a per-run inference, so a later standalone re-run (no hub)
|
|
36
|
+
* falls back to the register default rather than being stuck off.
|
|
37
|
+
*
|
|
38
|
+
* `overrodeHub` is true only for case 2 when a hub was detected — the signal the
|
|
39
|
+
* caller uses to log the "supervised hub detected, registering anyway" warning.
|
|
40
|
+
*/
|
|
41
|
+
export interface AutostartDecisionInput {
|
|
42
|
+
/** `--autostart` present on this invocation. */
|
|
43
|
+
flagOn: boolean;
|
|
44
|
+
/** `--no-autostart` present on this invocation. */
|
|
45
|
+
flagOff: boolean;
|
|
46
|
+
/** Persisted `config.autostart` from a prior run, if a boolean. */
|
|
47
|
+
persisted?: boolean | undefined;
|
|
48
|
+
/** Whether a hub supervisor was detected (from `detectHubPresence`). */
|
|
49
|
+
hubPresent: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface AutostartDecision {
|
|
53
|
+
/** Final resolved value. */
|
|
54
|
+
enabled: boolean;
|
|
55
|
+
/** Whether the caller should write `config.autostart` to disk. */
|
|
56
|
+
persist: boolean;
|
|
57
|
+
/** True when `--autostart` forced registration despite a detected hub. */
|
|
58
|
+
overrodeHub: boolean;
|
|
59
|
+
/** Which precedence rule decided the outcome (for testing + copy). */
|
|
60
|
+
reason: "flag-off" | "flag-on" | "persisted" | "hub-default-off" | "default-on";
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function decideAutostart(input: AutostartDecisionInput): AutostartDecision {
|
|
64
|
+
const { flagOn, flagOff, persisted, hubPresent } = input;
|
|
65
|
+
|
|
66
|
+
if (flagOff) {
|
|
67
|
+
return { enabled: false, persist: true, overrodeHub: false, reason: "flag-off" };
|
|
68
|
+
}
|
|
69
|
+
if (flagOn) {
|
|
70
|
+
return {
|
|
71
|
+
enabled: true,
|
|
72
|
+
persist: true,
|
|
73
|
+
overrodeHub: hubPresent,
|
|
74
|
+
reason: "flag-on",
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (typeof persisted === "boolean") {
|
|
78
|
+
return { enabled: persisted, persist: false, overrodeHub: false, reason: "persisted" };
|
|
79
|
+
}
|
|
80
|
+
if (hubPresent) {
|
|
81
|
+
return { enabled: false, persist: false, overrodeHub: false, reason: "hub-default-off" };
|
|
82
|
+
}
|
|
83
|
+
return { enabled: true, persist: false, overrodeHub: false, reason: "default-on" };
|
|
84
|
+
}
|