@tpsdev-ai/flair 0.30.0 → 0.31.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.
Files changed (49) hide show
  1. package/README.md +194 -377
  2. package/dist/cli.js +1355 -281
  3. package/dist/deploy.js +212 -24
  4. package/dist/fabric-upgrade.js +16 -1
  5. package/dist/federation/scheduler.js +500 -0
  6. package/dist/install/clients.js +111 -53
  7. package/dist/lib/mcp-spec.js +128 -0
  8. package/dist/lib/safe-snapshot-extract.js +231 -0
  9. package/dist/lib/scheduler-platform.js +128 -0
  10. package/dist/lib/xml-escape.js +54 -0
  11. package/dist/rem/scheduler.js +35 -87
  12. package/dist/rem/snapshot.js +13 -0
  13. package/dist/replication-convergence.js +505 -0
  14. package/dist/resources/MemoryBootstrap.js +7 -8
  15. package/dist/resources/SemanticSearch.js +17 -45
  16. package/dist/resources/abstention.js +1 -1
  17. package/dist/resources/embeddings-boot.js +10 -12
  18. package/dist/resources/embeddings-provider.js +10 -7
  19. package/dist/resources/health.js +24 -19
  20. package/dist/resources/in-process.js +225 -0
  21. package/dist/resources/mcp-tools.js +23 -17
  22. package/dist/resources/migration-boot.js +80 -10
  23. package/dist/resources/migrations/data-dir.js +205 -0
  24. package/dist/resources/migrations/progress.js +33 -0
  25. package/dist/resources/migrations/runner.js +29 -2
  26. package/dist/resources/migrations/state.js +13 -2
  27. package/dist/resources/models-dir.js +18 -9
  28. package/dist/resources/semantic-retrieval-core.js +5 -4
  29. package/dist/src/lib/scheduler-platform.js +128 -0
  30. package/dist/src/lib/xml-escape.js +54 -0
  31. package/dist/src/rem/scheduler.js +35 -87
  32. package/docs/deploying-on-fabric.md +267 -0
  33. package/docs/deployment.md +5 -0
  34. package/docs/embedding-in-a-harper-app.md +299 -0
  35. package/docs/federation.md +61 -4
  36. package/docs/integrations.md +3 -0
  37. package/docs/mcp-clients.md +16 -7
  38. package/docs/quickstart.md +80 -54
  39. package/docs/releasing.md +72 -38
  40. package/docs/supply-chain-policy.md +36 -0
  41. package/docs/troubleshooting.md +24 -0
  42. package/docs/upgrade.md +98 -3
  43. package/package.json +1 -11
  44. package/templates/bin/flair-federation-sync.sh.tmpl +28 -0
  45. package/templates/launchd/dev.flair.federation.sync.plist.tmpl +47 -0
  46. package/templates/systemd/flair-federation-sync.service.tmpl +21 -0
  47. package/templates/systemd/flair-federation-sync.timer.tmpl +16 -0
  48. package/dist/resources/rerank-provider.js +0 -569
  49. package/docs/rerank-provisioning.md +0 -101
@@ -0,0 +1,28 @@
1
+ #!/bin/sh
2
+ # Flair federation sync driver shim.
3
+ # Deployed by `flair federation sync enable` to {{SHIM_PATH}}.
4
+ # Invoked by launchd (macOS) or systemd (Linux) every {{INTERVAL_SECONDS}}s.
5
+ #
6
+ # One-shot by design: every run is a fresh, fully bounded process. See
7
+ # src/federation/scheduler.ts for why this is a periodic one-shot rather than
8
+ # a supervised long-lived watcher.
9
+ #
10
+ # The admin password is NEVER written into the scheduler unit. The unit
11
+ # carries FLAIR_ADMIN_PASS_FILE — a PATH — and the CLI reads the file itself
12
+ # through readAdminPassFileSecure(), which refuses anything not owner-only.
13
+ # Passing the path (not the value) also keeps it out of `ps`.
14
+ #
15
+ # Logs land in {{HOME}}/.flair/logs/federation-sync.{stdout,stderr}.log.
16
+ set -e
17
+
18
+ if [ -n "${FLAIR_TARGET:-}" ]; then
19
+ set -- --target "${FLAIR_TARGET}"
20
+ else
21
+ set --
22
+ fi
23
+
24
+ if [ -n "${FLAIR_ADMIN_PASS_FILE:-}" ] && [ -f "${FLAIR_ADMIN_PASS_FILE}" ]; then
25
+ set -- "$@" --admin-pass-file "${FLAIR_ADMIN_PASS_FILE}"
26
+ fi
27
+
28
+ exec "{{FLAIR_BIN}}" federation sync "$@"
@@ -0,0 +1,47 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
3
+ "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
4
+ <plist version="1.0">
5
+ <dict>
6
+ <key>Label</key>
7
+ <string>dev.flair.federation.sync</string>
8
+
9
+ <key>ProgramArguments</key>
10
+ <array>
11
+ <string>{{SHIM_PATH}}</string>
12
+ </array>
13
+
14
+ <!-- Periodic one-shot. NOT KeepAlive: the sync carries no state between
15
+ runs, and KeepAlive restarts a process that exits while doing nothing
16
+ for one that hangs. See src/federation/scheduler.ts. -->
17
+ <key>StartInterval</key>
18
+ <integer>{{INTERVAL_SECONDS}}</integer>
19
+
20
+ <!-- Sync once as soon as the job is loaded, so `enable` visibly works
21
+ instead of leaving the operator waiting out a whole interval. -->
22
+ <key>RunAtLoad</key>
23
+ <true/>
24
+
25
+ <key>StandardOutPath</key>
26
+ <string>{{HOME}}/.flair/logs/federation-sync.stdout.log</string>
27
+
28
+ <key>StandardErrorPath</key>
29
+ <string>{{HOME}}/.flair/logs/federation-sync.stderr.log</string>
30
+
31
+ <key>WorkingDirectory</key>
32
+ <string>{{HOME}}</string>
33
+
34
+ <key>EnvironmentVariables</key>
35
+ <dict>
36
+ <key>HOME</key>
37
+ <string>{{HOME}}</string>
38
+ <key>PATH</key>
39
+ <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
40
+ <!-- A PATH to the password file, never the password. -->
41
+ <key>FLAIR_ADMIN_PASS_FILE</key>
42
+ <string>{{ADMIN_PASS_FILE}}</string>
43
+ <key>FLAIR_TARGET</key>
44
+ <string>{{FLAIR_TARGET}}</string>
45
+ </dict>
46
+ </dict>
47
+ </plist>
@@ -0,0 +1,21 @@
1
+ [Unit]
2
+ Description=Flair federation sync (one-shot, driven by flair-federation-sync.timer)
3
+ After=network-online.target
4
+
5
+ [Service]
6
+ # Type=oneshot, not a Restart=always long-lived watcher: the sync carries no
7
+ # state between runs, and every network call inside it is bounded by its own
8
+ # timeout, so a run always terminates and the timer always gets to fire the
9
+ # next one. See src/federation/scheduler.ts.
10
+ Type=oneshot
11
+ ExecStart={{SHIM_PATH}}
12
+ # A PATH to the password file, never the password.
13
+ Environment=FLAIR_ADMIN_PASS_FILE={{ADMIN_PASS_FILE}}
14
+ Environment=FLAIR_TARGET={{FLAIR_TARGET}}
15
+ StandardOutput=append:{{HOME}}/.flair/logs/federation-sync.stdout.log
16
+ StandardError=append:{{HOME}}/.flair/logs/federation-sync.stderr.log
17
+
18
+ # No [Install] section: this unit is started by flair-federation-sync.timer,
19
+ # which is what `flair federation sync enable` enables. A WantedBy here would
20
+ # only invite someone to enable the service directly and get exactly one sync
21
+ # per boot.
@@ -0,0 +1,16 @@
1
+ [Unit]
2
+ Description=Flair federation sync timer (every {{INTERVAL_SECONDS}}s)
3
+
4
+ [Timer]
5
+ # Sync shortly after the timer starts (enable, and every boot thereafter), so
6
+ # `enable` visibly works instead of leaving the operator waiting out a whole
7
+ # interval. The launchd side gets this from RunAtLoad.
8
+ OnActiveSec=10s
9
+ # Then repeat, measured from the END of the previous run — a slow sync delays
10
+ # the next one rather than overlapping with it.
11
+ OnUnitActiveSec={{INTERVAL_SECONDS}}s
12
+ AccuracySec=30s
13
+ Unit=flair-federation-sync.service
14
+
15
+ [Install]
16
+ WantedBy=timers.target