@nimblebrain/synapse 0.7.0 → 0.9.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.
@@ -185,12 +185,23 @@ interface ToolCallResult<T = unknown> {
185
185
  [key: string]: unknown;
186
186
  };
187
187
  }
188
- /** Result from a file picker request */
188
+ /**
189
+ * Result from a file picker request. Returned after the host has
190
+ * persisted the picked file to its workspace store; the bytes never
191
+ * cross the iframe boundary.
192
+ *
193
+ * Tools that need the bytes look the file up by `id` (e.g. by passing
194
+ * it to a tool that calls the host's file APIs server-side). Bytes
195
+ * inline in tool-call arguments was the prior shape and capped uploads
196
+ * at the JSON body limit; this `id`-shaped result removes that ceiling.
197
+ */
189
198
  interface FileResult {
199
+ /** Workspace file ID (`fl_` + 24 hex). Stable identifier for this
200
+ * file in the originating workspace. */
201
+ id: string;
190
202
  filename: string;
191
203
  mimeType: string;
192
204
  size: number;
193
- base64Data: string;
194
205
  }
195
206
  /** Options for requesting a file from the user */
196
207
  interface RequestFileOptions {
@@ -185,12 +185,23 @@ interface ToolCallResult<T = unknown> {
185
185
  [key: string]: unknown;
186
186
  };
187
187
  }
188
- /** Result from a file picker request */
188
+ /**
189
+ * Result from a file picker request. Returned after the host has
190
+ * persisted the picked file to its workspace store; the bytes never
191
+ * cross the iframe boundary.
192
+ *
193
+ * Tools that need the bytes look the file up by `id` (e.g. by passing
194
+ * it to a tool that calls the host's file APIs server-side). Bytes
195
+ * inline in tool-call arguments was the prior shape and capped uploads
196
+ * at the JSON body limit; this `id`-shaped result removes that ceiling.
197
+ */
189
198
  interface FileResult {
199
+ /** Workspace file ID (`fl_` + 24 hex). Stable identifier for this
200
+ * file in the originating workspace. */
201
+ id: string;
190
202
  filename: string;
191
203
  mimeType: string;
192
204
  size: number;
193
- base64Data: string;
194
205
  }
195
206
  /** Options for requesting a file from the user */
196
207
  interface RequestFileOptions {
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ // src/ui/fonts.ts
4
+ var FONTSHARE_HREF = "https://api.fontshare.com/v2/css?f[]=satoshi@400,500,700&f[]=erode@400,500&display=swap";
5
+ var LINK_ID = "nb-synapse-fonts";
6
+ function injectFonts() {
7
+ if (typeof document === "undefined") return;
8
+ if (document.getElementById(LINK_ID)) return;
9
+ const link = document.createElement("link");
10
+ link.id = LINK_ID;
11
+ link.rel = "stylesheet";
12
+ link.href = FONTSHARE_HREF;
13
+ document.head.appendChild(link);
14
+ }
15
+ injectFonts();
16
+
17
+ exports.injectFonts = injectFonts;
18
+ //# sourceMappingURL=fonts.cjs.map
19
+ //# sourceMappingURL=fonts.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ui/fonts.ts"],"names":[],"mappings":";;;AAuBA,IAAM,cAAA,GACJ,yFAAA;AACF,IAAM,OAAA,GAAU,kBAAA;AAOT,SAAS,WAAA,GAAoB;AAClC,EAAA,IAAI,OAAO,aAAa,WAAA,EAAa;AACrC,EAAA,IAAI,QAAA,CAAS,cAAA,CAAe,OAAO,CAAA,EAAG;AACtC,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,aAAA,CAAc,MAAM,CAAA;AAC1C,EAAA,IAAA,CAAK,EAAA,GAAK,OAAA;AACV,EAAA,IAAA,CAAK,GAAA,GAAM,YAAA;AACX,EAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AACZ,EAAA,QAAA,CAAS,IAAA,CAAK,YAAY,IAAI,CAAA;AAChC;AAEA,WAAA,EAAY","file":"fonts.cjs","sourcesContent":["/**\n * Loads the NimbleBrain brand fonts into the current document. Import for the\n * side effect:\n *\n * ```ts\n * import \"@nimblebrain/synapse/ui/fonts\";\n * ```\n *\n * The token contract names these fonts (`--font-sans: Satoshi`,\n * `--nb-font-heading: Erode`), but a font *name* only renders if the font\n * *files* are loaded in the iframe document — each app iframe is its own\n * document and does not inherit the host's `@font-face`s. This module injects\n * the Fontshare stylesheet so the named fonts resolve instead of silently\n * falling back.\n *\n * JetBrains Mono (`--font-mono`) is not injected here — apps that render code\n * should add `@fontsource-variable/jetbrains-mono` to their own bundle.\n *\n * CSP note: the host iframe must allow `https://api.fontshare.com` in its\n * `style-src`/`font-src` for this to take effect. If blocked, fonts fall back\n * to the neutral system stack in the token contract.\n */\n\nconst FONTSHARE_HREF =\n \"https://api.fontshare.com/v2/css?f[]=satoshi@400,500,700&f[]=erode@400,500&display=swap\";\nconst LINK_ID = \"nb-synapse-fonts\";\n\n/**\n * Inject the Fontshare brand-font stylesheet once. Idempotent and SSR-safe\n * (no-ops when `document` is unavailable). Called automatically on import;\n * exported for explicit invocation.\n */\nexport function injectFonts(): void {\n if (typeof document === \"undefined\") return;\n if (document.getElementById(LINK_ID)) return;\n const link = document.createElement(\"link\");\n link.id = LINK_ID;\n link.rel = \"stylesheet\";\n link.href = FONTSHARE_HREF;\n document.head.appendChild(link);\n}\n\ninjectFonts();\n"]}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Loads the NimbleBrain brand fonts into the current document. Import for the
3
+ * side effect:
4
+ *
5
+ * ```ts
6
+ * import "@nimblebrain/synapse/ui/fonts";
7
+ * ```
8
+ *
9
+ * The token contract names these fonts (`--font-sans: Satoshi`,
10
+ * `--nb-font-heading: Erode`), but a font *name* only renders if the font
11
+ * *files* are loaded in the iframe document — each app iframe is its own
12
+ * document and does not inherit the host's `@font-face`s. This module injects
13
+ * the Fontshare stylesheet so the named fonts resolve instead of silently
14
+ * falling back.
15
+ *
16
+ * JetBrains Mono (`--font-mono`) is not injected here — apps that render code
17
+ * should add `@fontsource-variable/jetbrains-mono` to their own bundle.
18
+ *
19
+ * CSP note: the host iframe must allow `https://api.fontshare.com` in its
20
+ * `style-src`/`font-src` for this to take effect. If blocked, fonts fall back
21
+ * to the neutral system stack in the token contract.
22
+ */
23
+ /**
24
+ * Inject the Fontshare brand-font stylesheet once. Idempotent and SSR-safe
25
+ * (no-ops when `document` is unavailable). Called automatically on import;
26
+ * exported for explicit invocation.
27
+ */
28
+ declare function injectFonts(): void;
29
+
30
+ export { injectFonts };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Loads the NimbleBrain brand fonts into the current document. Import for the
3
+ * side effect:
4
+ *
5
+ * ```ts
6
+ * import "@nimblebrain/synapse/ui/fonts";
7
+ * ```
8
+ *
9
+ * The token contract names these fonts (`--font-sans: Satoshi`,
10
+ * `--nb-font-heading: Erode`), but a font *name* only renders if the font
11
+ * *files* are loaded in the iframe document — each app iframe is its own
12
+ * document and does not inherit the host's `@font-face`s. This module injects
13
+ * the Fontshare stylesheet so the named fonts resolve instead of silently
14
+ * falling back.
15
+ *
16
+ * JetBrains Mono (`--font-mono`) is not injected here — apps that render code
17
+ * should add `@fontsource-variable/jetbrains-mono` to their own bundle.
18
+ *
19
+ * CSP note: the host iframe must allow `https://api.fontshare.com` in its
20
+ * `style-src`/`font-src` for this to take effect. If blocked, fonts fall back
21
+ * to the neutral system stack in the token contract.
22
+ */
23
+ /**
24
+ * Inject the Fontshare brand-font stylesheet once. Idempotent and SSR-safe
25
+ * (no-ops when `document` is unavailable). Called automatically on import;
26
+ * exported for explicit invocation.
27
+ */
28
+ declare function injectFonts(): void;
29
+
30
+ export { injectFonts };
@@ -0,0 +1,17 @@
1
+ // src/ui/fonts.ts
2
+ var FONTSHARE_HREF = "https://api.fontshare.com/v2/css?f[]=satoshi@400,500,700&f[]=erode@400,500&display=swap";
3
+ var LINK_ID = "nb-synapse-fonts";
4
+ function injectFonts() {
5
+ if (typeof document === "undefined") return;
6
+ if (document.getElementById(LINK_ID)) return;
7
+ const link = document.createElement("link");
8
+ link.id = LINK_ID;
9
+ link.rel = "stylesheet";
10
+ link.href = FONTSHARE_HREF;
11
+ document.head.appendChild(link);
12
+ }
13
+ injectFonts();
14
+
15
+ export { injectFonts };
16
+ //# sourceMappingURL=fonts.js.map
17
+ //# sourceMappingURL=fonts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ui/fonts.ts"],"names":[],"mappings":";AAuBA,IAAM,cAAA,GACJ,yFAAA;AACF,IAAM,OAAA,GAAU,kBAAA;AAOT,SAAS,WAAA,GAAoB;AAClC,EAAA,IAAI,OAAO,aAAa,WAAA,EAAa;AACrC,EAAA,IAAI,QAAA,CAAS,cAAA,CAAe,OAAO,CAAA,EAAG;AACtC,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,aAAA,CAAc,MAAM,CAAA;AAC1C,EAAA,IAAA,CAAK,EAAA,GAAK,OAAA;AACV,EAAA,IAAA,CAAK,GAAA,GAAM,YAAA;AACX,EAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AACZ,EAAA,QAAA,CAAS,IAAA,CAAK,YAAY,IAAI,CAAA;AAChC;AAEA,WAAA,EAAY","file":"fonts.js","sourcesContent":["/**\n * Loads the NimbleBrain brand fonts into the current document. Import for the\n * side effect:\n *\n * ```ts\n * import \"@nimblebrain/synapse/ui/fonts\";\n * ```\n *\n * The token contract names these fonts (`--font-sans: Satoshi`,\n * `--nb-font-heading: Erode`), but a font *name* only renders if the font\n * *files* are loaded in the iframe document — each app iframe is its own\n * document and does not inherit the host's `@font-face`s. This module injects\n * the Fontshare stylesheet so the named fonts resolve instead of silently\n * falling back.\n *\n * JetBrains Mono (`--font-mono`) is not injected here — apps that render code\n * should add `@fontsource-variable/jetbrains-mono` to their own bundle.\n *\n * CSP note: the host iframe must allow `https://api.fontshare.com` in its\n * `style-src`/`font-src` for this to take effect. If blocked, fonts fall back\n * to the neutral system stack in the token contract.\n */\n\nconst FONTSHARE_HREF =\n \"https://api.fontshare.com/v2/css?f[]=satoshi@400,500,700&f[]=erode@400,500&display=swap\";\nconst LINK_ID = \"nb-synapse-fonts\";\n\n/**\n * Inject the Fontshare brand-font stylesheet once. Idempotent and SSR-safe\n * (no-ops when `document` is unavailable). Called automatically on import;\n * exported for explicit invocation.\n */\nexport function injectFonts(): void {\n if (typeof document === \"undefined\") return;\n if (document.getElementById(LINK_ID)) return;\n const link = document.createElement(\"link\");\n link.id = LINK_ID;\n link.rel = \"stylesheet\";\n link.href = FONTSHARE_HREF;\n document.head.appendChild(link);\n}\n\ninjectFonts();\n"]}