brane 0.1.1 → 0.3.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/AGENTS.md +367 -0
- package/CHANGELOG.md +66 -0
- package/CONTRIBUTING.md +101 -0
- package/DESIGN.md +405 -0
- package/Dockerfile +61 -0
- package/LICENSE +656 -17
- package/README.md +174 -2
- package/SECURITY.md +213 -0
- package/dist/absorb/brane-id.js +11 -0
- package/dist/absorb/chatgpt.js +161 -0
- package/dist/absorb/claude-code.js +504 -0
- package/dist/absorb/index.js +543 -0
- package/dist/absorb/organelle.js +345 -0
- package/dist/absorb/run.js +520 -0
- package/dist/absorb/sources.js +168 -0
- package/dist/absorb/types.js +3 -0
- package/dist/agent-env.js +45 -0
- package/dist/agents.js +1168 -0
- package/dist/claude-live-session.js +124 -0
- package/dist/cli.js +50 -0
- package/dist/codex-tool-log.js +144 -0
- package/dist/commands/absorb.js +291 -0
- package/dist/commands/attach.js +31 -0
- package/dist/commands/certify.js +62 -0
- package/dist/commands/config.js +133 -0
- package/dist/commands/cost.js +126 -0
- package/dist/commands/daemon.js +350 -0
- package/dist/commands/doctor.js +262 -0
- package/dist/commands/fold.js +95 -0
- package/dist/commands/list.js +89 -0
- package/dist/commands/mcp.js +84 -0
- package/dist/commands/meld.js +360 -0
- package/dist/commands/memory.js +215 -0
- package/dist/commands/revive.js +74 -0
- package/dist/commands/run.js +85 -0
- package/dist/commands/spawn.js +1101 -0
- package/dist/commands/token.js +154 -0
- package/dist/copilot-tool-log.js +145 -0
- package/dist/cost/pricing.js +116 -0
- package/dist/cost/reprice.js +136 -0
- package/dist/crush-tool-log.js +293 -0
- package/dist/daemon/agent-scope.js +116 -0
- package/dist/daemon/awaiting.js +54 -0
- package/dist/daemon/cert-manager.js +349 -0
- package/dist/daemon/client.js +262 -0
- package/dist/daemon/gated-routes.js +112 -0
- package/dist/daemon/keep-awake.js +103 -0
- package/dist/daemon/local-socket.js +145 -0
- package/dist/daemon/presence-gate.js +206 -0
- package/dist/daemon/server.js +6353 -0
- package/dist/daemon/signal-source.js +35 -0
- package/dist/daemon/tailscale-rebind.js +58 -0
- package/dist/daemon/token-ring.js +263 -0
- package/dist/daemon/token-routes.js +190 -0
- package/dist/db/events.js +152 -0
- package/dist/db/mentions.js +179 -0
- package/dist/db/schema.js +643 -0
- package/dist/db/tokens.js +624 -0
- package/dist/db/tool-uses.js +647 -0
- package/dist/diagram/index.js +85 -0
- package/dist/diagram/label.js +455 -0
- package/dist/diagram/layout.js +476 -0
- package/dist/diagram/links.js +50 -0
- package/dist/diagram/metrics.js +152 -0
- package/dist/diagram/parse.js +487 -0
- package/dist/diagram/svg.js +389 -0
- package/dist/diagram/types.js +9 -0
- package/dist/export.js +629 -0
- package/dist/files/archive-types.js +2 -0
- package/dist/files/archive.js +182 -0
- package/dist/files/browse.js +327 -0
- package/dist/files/bytes.js +162 -0
- package/dist/files/codecs.js +33 -0
- package/dist/files/find.js +212 -0
- package/dist/files/tar.js +223 -0
- package/dist/files/zip.js +209 -0
- package/dist/folds.js +72 -0
- package/dist/grammars/ebnf.js +92 -0
- package/dist/highlight.js +250 -0
- package/dist/ids.js +24 -0
- package/dist/markdown-diagnostics.js +233 -0
- package/dist/math.js +168 -0
- package/dist/mcp/server.js +886 -0
- package/dist/memory/embedder.js +145 -0
- package/dist/memory/embedding-worker.js +71 -0
- package/dist/memory/embeddings.js +91 -0
- package/dist/memory/index.js +232 -0
- package/dist/memory/storage.js +587 -0
- package/dist/memory/wiki.js +688 -0
- package/dist/memory/wordpiece.js +247 -0
- package/dist/mentions-scan.js +40 -0
- package/dist/presence.js +259 -0
- package/dist/session-affinity.js +185 -0
- package/dist/shared/api-request.js +124 -0
- package/dist/shared/app-origin.js +26 -0
- package/dist/shared/block-glyphs.js +114 -0
- package/dist/shared/diagram-css.js +17 -0
- package/dist/shared/export-selection.js +101 -0
- package/dist/shared/find-in-text.js +110 -0
- package/dist/shared/glow-hues.js +225 -0
- package/dist/shared/hex-dump.js +62 -0
- package/dist/shared/hex-pages.js +52 -0
- package/dist/shared/hit-drum.js +79 -0
- package/dist/shared/known-nids.js +58 -0
- package/dist/shared/list-scroll-keys.js +56 -0
- package/dist/shared/markdown-lists.js +72 -0
- package/dist/shared/markdown-math.js +485 -0
- package/dist/shared/markdown-mentions.js +79 -0
- package/dist/shared/markdown-nids.js +41 -0
- package/dist/shared/markdown-protocols.js +53 -0
- package/dist/shared/markdown-refs.js +123 -0
- package/dist/shared/membrane-invasion.js +342 -0
- package/dist/shared/membrane-motion.js +83 -0
- package/dist/shared/membrane-palette.js +253 -0
- package/dist/shared/membrane-terrain.js +212 -0
- package/dist/shared/message-selection.js +123 -0
- package/dist/shared/mo-glyph.js +57 -0
- package/dist/shared/narrative-format.js +237 -0
- package/dist/shared/narrative-menu.js +84 -0
- package/dist/shared/narrative-sort.js +47 -0
- package/dist/shared/narrative-status.js +52 -0
- package/dist/shared/no-pan.js +85 -0
- package/dist/shared/pane-layout.js +50 -0
- package/dist/shared/payload-inline.js +83 -0
- package/dist/shared/speaker-color.js +61 -0
- package/dist/shared/token-rotation.js +14 -0
- package/dist/shared/view-url.js +216 -0
- package/dist/shared/wiki-links.js +70 -0
- package/dist/shared/wiki-window.js +4 -0
- package/dist/tailscale.js +55 -0
- package/dist/test/absorb-claude.test.js +892 -0
- package/dist/test/agent-scope.test.js +193 -0
- package/dist/test/agents.test.js +55 -0
- package/dist/test/api-request.test.js +122 -0
- package/dist/test/app-host-literal.test.js +53 -0
- package/dist/test/awaiting-glow.test.js +54 -0
- package/dist/test/awaiting.test.js +122 -0
- package/dist/test/bind-token.test.js +88 -0
- package/dist/test/block-glyphs.test.js +68 -0
- package/dist/test/cert-manager.test.js +262 -0
- package/dist/test/claude-live-session.test.js +110 -0
- package/dist/test/codex-tool-log.test.js +568 -0
- package/dist/test/config.test.js +71 -0
- package/dist/test/copilot-tool-log.test.js +93 -0
- package/dist/test/cors-preflight.test.js +56 -0
- package/dist/test/cost-linger.test.js +31 -0
- package/dist/test/cost-pricing.test.js +72 -0
- package/dist/test/cost-reprice.test.js +139 -0
- package/dist/test/cost-sessions.test.js +301 -0
- package/dist/test/crush-tool-log.test.js +289 -0
- package/dist/test/daemon-client.test.js +109 -0
- package/dist/test/daemon-socket.test.js +293 -0
- package/dist/test/diagram-arrows.test.js +205 -0
- package/dist/test/diagram-export.test.js +210 -0
- package/dist/test/diagram-labels.test.js +313 -0
- package/dist/test/diagram-parse.test.js +191 -0
- package/dist/test/diagram-render.test.js +175 -0
- package/dist/test/diagram-review.test.js +288 -0
- package/dist/test/diagram-self-loop-labels.test.js +303 -0
- package/dist/test/embedder.test.js +84 -0
- package/dist/test/events.test.js +123 -0
- package/dist/test/export-selection.test.js +102 -0
- package/dist/test/export.test.js +505 -0
- package/dist/test/files-browse.test.js +393 -0
- package/dist/test/files-find.test.js +272 -0
- package/dist/test/find-in-text.test.js +86 -0
- package/dist/test/first-paint-viewport.test.js +59 -0
- package/dist/test/fixtures/embedding-golden.js +23 -0
- package/dist/test/fixtures/wordpiece-golden.js +167 -0
- package/dist/test/glow-hues.test.js +202 -0
- package/dist/test/harness-cost.test.js +423 -0
- package/dist/test/helpers.js +21 -0
- package/dist/test/hex-pages.test.js +68 -0
- package/dist/test/highlight.test.js +69 -0
- package/dist/test/hit-drum.test.js +71 -0
- package/dist/test/hook-config.test.js +299 -0
- package/dist/test/json-gzip.test.js +70 -0
- package/dist/test/key-routing.test.js +58 -0
- package/dist/test/known-nids.test.js +106 -0
- package/dist/test/link-preview.test.js +67 -0
- package/dist/test/list-scroll-keys.test.js +66 -0
- package/dist/test/listen-own-words.test.js +147 -0
- package/dist/test/listen-timeout.test.js +33 -0
- package/dist/test/markdown-diagnostics.test.js +121 -0
- package/dist/test/markdown-lists.test.js +182 -0
- package/dist/test/markdown-math.test.js +256 -0
- package/dist/test/markdown-nids.test.js +146 -0
- package/dist/test/markdown-protocols.test.js +139 -0
- package/dist/test/mcp-bridge-cancel.test.js +98 -0
- package/dist/test/mcp-bridge-reconnect.test.js +121 -0
- package/dist/test/mcp-narrative.test.js +193 -0
- package/dist/test/mcp.test.js +548 -0
- package/dist/test/meld.test.js +143 -0
- package/dist/test/membrane-invasion.test.js +482 -0
- package/dist/test/membrane-motion.test.js +101 -0
- package/dist/test/membrane-palette.test.js +166 -0
- package/dist/test/membrane-terrain.test.js +170 -0
- package/dist/test/memory-log.test.js +202 -0
- package/dist/test/mentions-e2e.test.js +261 -0
- package/dist/test/mentions-ledger.test.js +265 -0
- package/dist/test/mentions-listen.test.js +265 -0
- package/dist/test/mentions.test.js +238 -0
- package/dist/test/message-selection.test.js +114 -0
- package/dist/test/mo-glyph.test.js +22 -0
- package/dist/test/model-resolution.test.js +166 -0
- package/dist/test/narrate-validate.test.js +77 -0
- package/dist/test/narrate-wait.test.js +160 -0
- package/dist/test/narrative-format.test.js +219 -0
- package/dist/test/narrative-menu.test.js +150 -0
- package/dist/test/narrative-sort.test.js +75 -0
- package/dist/test/no-pan.test.js +60 -0
- package/dist/test/pane-layout.test.js +153 -0
- package/dist/test/paths.test.js +37 -0
- package/dist/test/payload-inline.test.js +91 -0
- package/dist/test/precache-fonts.test.js +72 -0
- package/dist/test/presence-gate.test.js +440 -0
- package/dist/test/presence.test.js +160 -0
- package/dist/test/read-events.test.js +220 -0
- package/dist/test/remote-meld.test.js +128 -0
- package/dist/test/revive-cli.test.js +93 -0
- package/dist/test/search-floor.test.js +206 -0
- package/dist/test/search-fusion.test.js +168 -0
- package/dist/test/search.test.js +205 -0
- package/dist/test/security.test.js +48 -0
- package/dist/test/selection-wiring.test.js +61 -0
- package/dist/test/session-affinity.test.js +295 -0
- package/dist/test/signal-source.test.js +32 -0
- package/dist/test/socket-account.test.js +268 -0
- package/dist/test/spawn-toml.test.js +72 -0
- package/dist/test/speaker-color.test.js +90 -0
- package/dist/test/tailscale-rebind.test.js +79 -0
- package/dist/test/terminal-cursor.test.js +61 -0
- package/dist/test/terminal-resync.test.js +23 -0
- package/dist/test/terminal-size.test.js +36 -0
- package/dist/test/thin-cli.test.js +382 -0
- package/dist/test/token-bootstrap.test.js +272 -0
- package/dist/test/token-devices.test.js +646 -0
- package/dist/test/token-lapse.test.js +94 -0
- package/dist/test/token-ring.test.js +188 -0
- package/dist/test/token-rotate-cli.test.js +58 -0
- package/dist/test/token-routes.test.js +95 -0
- package/dist/test/tool-uses.test.js +1006 -0
- package/dist/test/usage-ledger.test.js +126 -0
- package/dist/test/view-url.test.js +627 -0
- package/dist/test/wiki-links.test.js +57 -0
- package/dist/test/wiki-sources.test.js +85 -0
- package/dist/test/wiki-window.test.js +31 -0
- package/dist/test/wiki.test.js +399 -0
- package/dist/test/wordpiece.test.js +68 -0
- package/dist/test/wrangler-route.test.js +27 -0
- package/dist/tls.js +148 -0
- package/dist/tmux.js +213 -0
- package/dist/user-agent.js +46 -0
- package/docker-entrypoint.sh +154 -0
- package/docs/README.md +3 -0
- package/docs/absorb.md +231 -0
- package/docs/cost-ledger.md +125 -0
- package/docs/daemon-api.md +189 -0
- package/docs/diagrams.md +163 -0
- package/docs/doctor.md +36 -0
- package/docs/export-scope.md +69 -0
- package/docs/files-view.md +133 -0
- package/docs/link-previews.md +38 -0
- package/docs/math.md +32 -0
- package/docs/mcp.md +69 -0
- package/docs/memory-search.md +75 -0
- package/docs/mentions.md +101 -0
- package/docs/multi-brane.md +14 -0
- package/docs/passkeys.md +165 -0
- package/docs/presence.md +202 -0
- package/docs/releasing.md +104 -0
- package/docs/rendering-warnings.md +22 -0
- package/docs/request-layer.md +72 -0
- package/docs/selection-store.md +50 -0
- package/docs/session-affinity.md +61 -0
- package/docs/terminal-mirroring.md +243 -0
- package/docs/token-rotation.md +431 -0
- package/docs/view-urls.md +134 -0
- package/docs/web-app.md +23 -0
- package/docs/wiki.md +43 -0
- package/expo/dist/_expo/static/js/web/entry-e94247f119fdcd3b424a1764233a41d2.js +1099 -0
- package/expo/dist/apple-touch-icon.png +0 -0
- package/expo/dist/favicon.svg +3 -0
- package/expo/dist/index.html +177 -0
- package/expo/dist/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/expo/dist/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/expo/dist/katex/katex.min.css +1 -0
- package/expo/dist/manifest.json +16 -0
- package/expo/dist/metadata.json +1 -0
- package/expo/dist/og/membrane.v1.png +0 -0
- package/expo/dist/pdf.min.mjs +28 -0
- package/expo/dist/pdf.worker.min.mjs +28 -0
- package/expo/dist/sw.js +154 -0
- package/package.json +79 -27
- package/protocols/LIVE_loop.md +407 -0
- package/protocols/bebrief.md +41 -0
- package/protocols/digest.md +231 -0
- package/protocols/fly.md +266 -0
- package/protocols/idle.md +81 -0
- package/protocols/keeper.md +829 -0
- package/protocols/markdown.md +80 -0
- package/protocols/memory.md +419 -0
- package/protocols/mentions.md +93 -0
- package/protocols/payloads.md +53 -0
- package/protocols/prelude.md +91 -0
- package/protocols/ramify.md +105 -0
- package/protocols/review.md +356 -0
- package/protocols/rrr.md +232 -0
- package/protocols/scribe.md +429 -0
- package/protocols/summarize.md +203 -0
- package/protocols/twin.md +174 -0
- package/protocols/wiki.md +438 -0
- package/protocols/worker.md +38 -0
- package/wiki/shared/append-only-event-log.md +148 -0
- package/wiki/shared/index.md +53 -0
- package/wiki/shared/owning-your-narratives.md +161 -0
- package/wiki/shared/premature-ontologies.md +435 -0
- package/wiki/shared/sedimentary-superintelligence.md +128 -0
- package/wiki/shared/sequestering-the-narrative.md +143 -0
- package/wiki/shared/why-wikis-work.md +216 -0
- package/.travis.yml +0 -7
- package/lib/brane.cjs.js +0 -12
- package/lib/brane.cjs.js.map +0 -1
- package/lib/brane.d.ts +0 -11
- package/lib/brane.js +0 -6
- package/lib/brane.js.map +0 -1
- package/lib/tests.d.ts +0 -1
- package/lib/tests.js +0 -8
- package/lib/tests.js.map +0 -1
- package/rollup.config.js +0 -21
- package/scripts/test.sh +0 -8
- package/src/brane.ts +0 -21
- package/src/tests.ts +0 -8
- package/tsconfig.json +0 -16
package/expo/dist/sw.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// Brane service worker — cache-first for static assets, network-first for API/WS.
|
|
2
|
+
//
|
|
3
|
+
// The two constants below are placeholders in this source file and are rewritten
|
|
4
|
+
// in `dist/sw.js` by scripts/gen-precache.mjs, which reads the export that was
|
|
5
|
+
// actually produced. Editing them here has no effect on a build; see that script
|
|
6
|
+
// for why the list is generated rather than maintained by hand.
|
|
7
|
+
const CACHE_NAME = "brane-6ce22c4f8738";
|
|
8
|
+
const PRECACHE = [
|
|
9
|
+
"/",
|
|
10
|
+
"/_expo/static/js/web/entry-e94247f119fdcd3b424a1764233a41d2.js",
|
|
11
|
+
"/assets/node_modules/@react-navigation/elements/lib/module/assets/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png",
|
|
12
|
+
"/assets/node_modules/@react-navigation/elements/lib/module/assets/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png",
|
|
13
|
+
"/assets/node_modules/@react-navigation/elements/lib/module/assets/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png",
|
|
14
|
+
"/assets/node_modules/@react-navigation/elements/lib/module/assets/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png",
|
|
15
|
+
"/assets/node_modules/@react-navigation/elements/lib/module/assets/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png",
|
|
16
|
+
"/assets/node_modules/@react-navigation/elements/lib/module/assets/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png",
|
|
17
|
+
"/assets/node_modules/@react-navigation/elements/lib/module/assets/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png",
|
|
18
|
+
"/assets/node_modules/@react-navigation/elements/lib/module/assets/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png",
|
|
19
|
+
"/assets/node_modules/@react-navigation/elements/lib/module/assets/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png",
|
|
20
|
+
"/assets/node_modules/@react-navigation/elements/lib/module/assets/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png",
|
|
21
|
+
"/assets/node_modules/@react-navigation/elements/lib/module/assets/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png",
|
|
22
|
+
"/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png",
|
|
23
|
+
"/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png",
|
|
24
|
+
"/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png",
|
|
25
|
+
"/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png",
|
|
26
|
+
"/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png",
|
|
27
|
+
"/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png",
|
|
28
|
+
"/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png",
|
|
29
|
+
"/favicon.svg",
|
|
30
|
+
"/katex/fonts/KaTeX_Main-Bold.woff2",
|
|
31
|
+
"/katex/fonts/KaTeX_Main-BoldItalic.woff2",
|
|
32
|
+
"/katex/fonts/KaTeX_Main-Italic.woff2",
|
|
33
|
+
"/katex/fonts/KaTeX_Main-Regular.woff2",
|
|
34
|
+
"/katex/fonts/KaTeX_Math-BoldItalic.woff2",
|
|
35
|
+
"/katex/fonts/KaTeX_Math-Italic.woff2",
|
|
36
|
+
"/katex/katex.min.css",
|
|
37
|
+
"/manifest.json"
|
|
38
|
+
];
|
|
39
|
+
const VENDOR_CACHE = "brane-vendor-d57f3df64e26";
|
|
40
|
+
|
|
41
|
+
// Vendored files fetched on demand rather than precached: KaTeX's font tail and
|
|
42
|
+
// pdf.js. They go in a cache of their own, named for a hash of the vendored
|
|
43
|
+
// files alone, because CACHE_NAME changes on essentially every build — and
|
|
44
|
+
// `activate` drops every cache but the current ones. Kept in CACHE_NAME, a face
|
|
45
|
+
// fetched last week was gone after the next deploy, so "updated while online,
|
|
46
|
+
// then went offline" rendered math in fallback glyphs. Here they survive every
|
|
47
|
+
// build that doesn't change the vendored files themselves, and a KaTeX or
|
|
48
|
+
// pdf.js upgrade retires them together.
|
|
49
|
+
function isVendor(pathname) {
|
|
50
|
+
return (
|
|
51
|
+
pathname.startsWith("/katex/") ||
|
|
52
|
+
pathname === "/pdf.min.mjs" ||
|
|
53
|
+
pathname === "/pdf.worker.min.mjs"
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Assets safe to serve from cache without revalidating. `_expo/static` is
|
|
58
|
+
// content-hashed; the rest are vendored files that only change with a build,
|
|
59
|
+
// which is also when CACHE_NAME changes and the old cache is dropped.
|
|
60
|
+
function isStatic(pathname) {
|
|
61
|
+
return (
|
|
62
|
+
pathname.startsWith("/_expo/static/") ||
|
|
63
|
+
pathname.startsWith("/assets/") ||
|
|
64
|
+
pathname.startsWith("/katex/") ||
|
|
65
|
+
pathname === "/favicon.svg" ||
|
|
66
|
+
pathname === "/manifest.json" ||
|
|
67
|
+
// pdf.js is deliberately left out of PRECACHE (1.7 MB); this is what makes
|
|
68
|
+
// it stick after the first PDF you open.
|
|
69
|
+
pathname === "/pdf.min.mjs" ||
|
|
70
|
+
pathname === "/pdf.worker.min.mjs"
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Precache the shell on install. `addAll` is atomic on purpose: a partial
|
|
75
|
+
// precache is the silent half-offline state this worker exists to eliminate, so
|
|
76
|
+
// a failed install leaves the previous worker serving and retries on next load.
|
|
77
|
+
self.addEventListener("install", (event) => {
|
|
78
|
+
event.waitUntil(
|
|
79
|
+
caches
|
|
80
|
+
.open(CACHE_NAME)
|
|
81
|
+
.then((cache) => cache.addAll(PRECACHE))
|
|
82
|
+
.then(() => self.skipWaiting()),
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
self.addEventListener("activate", (event) => {
|
|
87
|
+
// Clean old caches — every one but this build's shell and the vendored files
|
|
88
|
+
// it ships, which may well be the same files an older build fetched.
|
|
89
|
+
event.waitUntil(
|
|
90
|
+
caches.keys().then((keys) =>
|
|
91
|
+
Promise.all(
|
|
92
|
+
keys.filter((k) => k !== CACHE_NAME && k !== VENDOR_CACHE).map((k) => caches.delete(k)),
|
|
93
|
+
)
|
|
94
|
+
).then(() => self.clients.claim())
|
|
95
|
+
);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
function cacheFirst(request, cacheName) {
|
|
99
|
+
return caches.match(request).then((cached) => {
|
|
100
|
+
if (cached) return cached;
|
|
101
|
+
return fetch(request).then((response) => {
|
|
102
|
+
if (response.ok && !isShellFallback(response)) {
|
|
103
|
+
const clone = response.clone();
|
|
104
|
+
caches.open(cacheName).then((cache) => cache.put(request, clone));
|
|
105
|
+
}
|
|
106
|
+
return response;
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// None of the static paths is HTML, but the servers answer a path they don't
|
|
112
|
+
// have with the SPA shell and a 200 — the daemon's static handler and the
|
|
113
|
+
// Cloudflare worker's single-page fallback both do. A font or script URL
|
|
114
|
+
// requested mid-deploy (an `expo export` clears its output first) would cache
|
|
115
|
+
// that page under its own name, cache-first, never revalidated. In
|
|
116
|
+
// VENDOR_CACHE it would then outlive every build until KaTeX or pdf.js
|
|
117
|
+
// changed. So an HTML answer to a static request is served, never kept.
|
|
118
|
+
function isShellFallback(response) {
|
|
119
|
+
return (response.headers.get("content-type") || "").toLowerCase().startsWith("text/html");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
self.addEventListener("fetch", (event) => {
|
|
123
|
+
const url = new URL(event.request.url);
|
|
124
|
+
|
|
125
|
+
// Skip non-GET, API calls, and WebSocket upgrades
|
|
126
|
+
if (
|
|
127
|
+
event.request.method !== "GET" ||
|
|
128
|
+
url.pathname.startsWith("/api/") ||
|
|
129
|
+
url.pathname.startsWith("/ws/")
|
|
130
|
+
) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (isStatic(url.pathname)) {
|
|
135
|
+
event.respondWith(cacheFirst(event.request, isVendor(url.pathname) ? VENDOR_CACHE : CACHE_NAME));
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// HTML pages (/, /[nid], etc.) — network-first with cache fallback
|
|
140
|
+
// This ensures updates propagate but offline still works. The final fallback
|
|
141
|
+
// is the precached "/", which is the whole point of precaching it: a cold
|
|
142
|
+
// offline load of a deep route still gets the SPA shell.
|
|
143
|
+
event.respondWith(
|
|
144
|
+
fetch(event.request)
|
|
145
|
+
.then((response) => {
|
|
146
|
+
if (response.ok) {
|
|
147
|
+
const clone = response.clone();
|
|
148
|
+
caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
|
|
149
|
+
}
|
|
150
|
+
return response;
|
|
151
|
+
})
|
|
152
|
+
.catch(() => caches.match(event.request).then((cached) => cached || caches.match("/")))
|
|
153
|
+
);
|
|
154
|
+
});
|
package/package.json
CHANGED
|
@@ -1,41 +1,93 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brane",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Userspace daemon and CLI for narrative agent sessions",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agents",
|
|
7
|
+
"claude",
|
|
8
|
+
"mcp",
|
|
9
|
+
"tmux",
|
|
10
|
+
"daemon",
|
|
11
|
+
"cli",
|
|
12
|
+
"llm"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/benjamn/brane#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/benjamn/brane/issues"
|
|
17
|
+
},
|
|
18
|
+
"funding": {
|
|
19
|
+
"type": "github",
|
|
20
|
+
"url": "https://github.com/sponsors/benjamn"
|
|
21
|
+
},
|
|
12
22
|
"repository": {
|
|
13
23
|
"type": "git",
|
|
14
24
|
"url": "git+https://github.com/benjamn/brane.git"
|
|
15
25
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
26
|
+
"type": "module",
|
|
27
|
+
"bin": {
|
|
28
|
+
"brane": "./dist/cli.js"
|
|
18
29
|
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"!dist/**/*.d.ts",
|
|
33
|
+
"!dist/**/*.map",
|
|
34
|
+
"expo/dist",
|
|
35
|
+
"protocols",
|
|
36
|
+
"wiki/shared",
|
|
37
|
+
"AGENTS.md",
|
|
38
|
+
"docs",
|
|
39
|
+
"CONTRIBUTING.md",
|
|
40
|
+
"CHANGELOG.md",
|
|
41
|
+
"DESIGN.md",
|
|
42
|
+
"SECURITY.md",
|
|
43
|
+
"Dockerfile",
|
|
44
|
+
"docker-entrypoint.sh"
|
|
45
|
+
],
|
|
19
46
|
"scripts": {
|
|
20
|
-
"clean": "
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
47
|
+
"clean": "node scripts/clean-dist.mjs",
|
|
48
|
+
"prebuild": "npm run clean",
|
|
49
|
+
"build": "tsc && npm run build:web --prefix expo",
|
|
50
|
+
"postbuild": "node scripts/chmod-bin.mjs",
|
|
51
|
+
"prebuild:server": "npm run clean",
|
|
52
|
+
"build:server": "tsc",
|
|
53
|
+
"postbuild:server": "node scripts/chmod-bin.mjs",
|
|
54
|
+
"start": "node dist/cli.js",
|
|
55
|
+
"test": "tsc && node --test dist/test/*.test.js"
|
|
27
56
|
},
|
|
28
57
|
"dependencies": {
|
|
29
|
-
"
|
|
58
|
+
"@dagrejs/dagre": "^3.1.1",
|
|
59
|
+
"better-sqlite3": "^13.0.3",
|
|
60
|
+
"citty": "^0.1.6",
|
|
61
|
+
"katex": "^0.18.4",
|
|
62
|
+
"mdast-util-from-markdown": "^2.0.3",
|
|
63
|
+
"mdast-util-gfm-autolink-literal": "^2.0.1",
|
|
64
|
+
"mdast-util-gfm-table": "^2.0.0",
|
|
65
|
+
"mdast-util-gfm-task-list-item": "^2.0.0",
|
|
66
|
+
"micromark": "^4.0.2",
|
|
67
|
+
"micromark-extension-gfm-autolink-literal": "^2.1.0",
|
|
68
|
+
"micromark-extension-gfm-table": "^2.1.1",
|
|
69
|
+
"micromark-extension-gfm-task-list-item": "^2.1.0",
|
|
70
|
+
"micromark-extension-math": "^3.1.0",
|
|
71
|
+
"onnxruntime-node": "^1.21.0",
|
|
72
|
+
"qrcode-terminal": "^0.12.0",
|
|
73
|
+
"shiki": "^4.0.2",
|
|
74
|
+
"sqlite-vec": "^0.1.9",
|
|
75
|
+
"stream-json": "^3.7.0",
|
|
76
|
+
"ws": "^8.19.0"
|
|
30
77
|
},
|
|
31
78
|
"devDependencies": {
|
|
32
|
-
"@types/
|
|
33
|
-
"@types/node": "^
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
79
|
+
"@types/better-sqlite3": "^7.6.12",
|
|
80
|
+
"@types/node": "^22.0.0",
|
|
81
|
+
"@types/qrcode-terminal": "^0.12.2",
|
|
82
|
+
"@types/ws": "^8.18.1",
|
|
83
|
+
"typescript": "^5.7.0",
|
|
84
|
+
"wrangler": "^4.70.0"
|
|
85
|
+
},
|
|
86
|
+
"engines": {
|
|
87
|
+
"node": ">=20"
|
|
88
|
+
},
|
|
89
|
+
"license": "AGPL-3.0-or-later",
|
|
90
|
+
"overrides": {
|
|
91
|
+
"katex": "$katex"
|
|
40
92
|
}
|
|
41
93
|
}
|