@nimblebrain/synapse 0.17.1 → 0.19.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 (95) hide show
  1. package/README.md +20 -18
  2. package/dist/chunk-54W6IAHM.js +24 -0
  3. package/dist/chunk-54W6IAHM.js.map +1 -0
  4. package/dist/{chunk-UPDBDXQB.js → chunk-DRLVEHCD.js} +6 -13
  5. package/dist/chunk-DRLVEHCD.js.map +1 -0
  6. package/dist/chunk-NP7ROSH2.cjs +33 -0
  7. package/dist/chunk-NP7ROSH2.cjs.map +1 -0
  8. package/dist/{chunk-SRQNQ26I.js → chunk-OYLZ5OCK.js} +4 -4
  9. package/dist/chunk-OYLZ5OCK.js.map +1 -0
  10. package/dist/chunk-P5DBJFSQ.js +8459 -0
  11. package/dist/chunk-P5DBJFSQ.js.map +1 -0
  12. package/dist/chunk-PZ5AY32C.js +9 -0
  13. package/dist/chunk-PZ5AY32C.js.map +1 -0
  14. package/dist/chunk-Q7SFCCGT.cjs +11 -0
  15. package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
  16. package/dist/chunk-QXDCA7QW.cjs +8466 -0
  17. package/dist/chunk-QXDCA7QW.cjs.map +1 -0
  18. package/dist/{chunk-EHLQWCYV.cjs → chunk-RU64F5RS.cjs} +7 -7
  19. package/dist/chunk-RU64F5RS.cjs.map +1 -0
  20. package/dist/{chunk-TXJMGQYF.cjs → chunk-SZWHFTXV.cjs} +5 -13
  21. package/dist/chunk-SZWHFTXV.cjs.map +1 -0
  22. package/dist/codegen/cli.cjs +4 -4
  23. package/dist/codegen/cli.js +4 -4
  24. package/dist/codegen/index.cjs +1 -0
  25. package/dist/codegen/index.d.cts +1 -1
  26. package/dist/codegen/index.d.ts +1 -1
  27. package/dist/codegen/index.js +1 -0
  28. package/dist/connect.iife.global.js +66 -43
  29. package/dist/{detect-Bf8Q_0dK.d.ts → detect-DBwc8a21.d.ts} +2 -2
  30. package/dist/{detect-BHYg26_d.d.cts → detect-DZMJsyvZ.d.cts} +2 -2
  31. package/dist/host/index.cjs +15 -14
  32. package/dist/host/index.d.cts +3 -3
  33. package/dist/host/index.d.ts +3 -3
  34. package/dist/host/index.js +3 -2
  35. package/dist/index.cjs +42 -18
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +40 -13
  38. package/dist/index.d.ts +40 -13
  39. package/dist/index.js +35 -3
  40. package/dist/index.js.map +1 -1
  41. package/dist/react/index.cjs +12 -10
  42. package/dist/react/index.cjs.map +1 -1
  43. package/dist/react/index.d.cts +14 -5
  44. package/dist/react/index.d.ts +14 -5
  45. package/dist/react/index.js +7 -5
  46. package/dist/react/index.js.map +1 -1
  47. package/dist/schema-reader-GM4A4L44.js +4 -0
  48. package/dist/{schema-reader-776246MJ.js.map → schema-reader-GM4A4L44.js.map} +1 -1
  49. package/dist/{schema-reader-B6LTGBMJ.cjs → schema-reader-MWBRQ2TQ.cjs} +3 -2
  50. package/dist/{schema-reader-B6LTGBMJ.cjs.map → schema-reader-MWBRQ2TQ.cjs.map} +1 -1
  51. package/dist/{server-QIYIJHD5.cjs → server-LR6T6C44.cjs} +32 -20
  52. package/dist/server-LR6T6C44.cjs.map +1 -0
  53. package/dist/{server-5N76YCWC.js → server-UHPEE55X.js} +32 -21
  54. package/dist/server-UHPEE55X.js.map +1 -0
  55. package/dist/synapse-runtime.iife.global.js +66 -43
  56. package/dist/synapse-ui.iife.global.js +2 -2
  57. package/dist/{type-generator-UA3L4OIA.cjs → type-generator-YTPFWLVG.cjs} +3 -2
  58. package/dist/{type-generator-UA3L4OIA.cjs.map → type-generator-YTPFWLVG.cjs.map} +1 -1
  59. package/dist/type-generator-ZYSVFK3X.js +4 -0
  60. package/dist/{type-generator-MZ4X4DE5.js.map → type-generator-ZYSVFK3X.js.map} +1 -1
  61. package/dist/{types-uEO4VFJ2.d.ts → types-CG08aO82.d.cts} +14 -83
  62. package/dist/{types-uEO4VFJ2.d.cts → types-CG08aO82.d.ts} +14 -83
  63. package/dist/ui/base.cjs +1 -0
  64. package/dist/ui/base.cjs.map +1 -1
  65. package/dist/ui/base.js +1 -0
  66. package/dist/ui/base.js.map +1 -1
  67. package/dist/ui/index.cjs +314 -87
  68. package/dist/ui/index.cjs.map +1 -1
  69. package/dist/ui/index.d.cts +29 -2
  70. package/dist/ui/index.d.ts +29 -2
  71. package/dist/ui/index.js +315 -89
  72. package/dist/ui/index.js.map +1 -1
  73. package/dist/vite/index.cjs +74 -30
  74. package/dist/vite/index.cjs.map +1 -1
  75. package/dist/vite/index.d.cts +5 -1
  76. package/dist/vite/index.d.ts +5 -1
  77. package/dist/vite/index.js +74 -30
  78. package/dist/vite/index.js.map +1 -1
  79. package/dist/{writer-NDK4U6C5.cjs → writer-HDRCQSX2.cjs} +3 -3
  80. package/dist/{writer-NDK4U6C5.cjs.map → writer-HDRCQSX2.cjs.map} +1 -1
  81. package/dist/{writer-ZNBXYUYC.js → writer-QNDPMEYD.js} +3 -3
  82. package/dist/{writer-ZNBXYUYC.js.map → writer-QNDPMEYD.js.map} +1 -1
  83. package/package.json +8 -5
  84. package/dist/chunk-EHLQWCYV.cjs.map +0 -1
  85. package/dist/chunk-FDMRJZKT.cjs +0 -788
  86. package/dist/chunk-FDMRJZKT.cjs.map +0 -1
  87. package/dist/chunk-SRQNQ26I.js.map +0 -1
  88. package/dist/chunk-TXJMGQYF.cjs.map +0 -1
  89. package/dist/chunk-UPDBDXQB.js.map +0 -1
  90. package/dist/chunk-VYR6V47N.js +0 -781
  91. package/dist/chunk-VYR6V47N.js.map +0 -1
  92. package/dist/schema-reader-776246MJ.js +0 -3
  93. package/dist/server-5N76YCWC.js.map +0 -1
  94. package/dist/server-QIYIJHD5.cjs.map +0 -1
  95. package/dist/type-generator-MZ4X4DE5.js +0 -3
@@ -1,4 +1,4 @@
1
- import { g as FontFaceDescriptor } from './types-uEO4VFJ2.js';
1
+ import { f as FontFaceDescriptor } from './types-CG08aO82.js';
2
2
 
3
3
  /**
4
4
  * Cross-host UI client — types and wire constants.
@@ -174,4 +174,4 @@ declare function adapterForKind(kind: HostKind, win: Window & typeof globalThis,
174
174
  /** Select and construct the host adapter, honoring `options.host` when set. */
175
175
  declare function selectAdapter(win: Window & typeof globalThis, options: ConnectUIOptions): HostAdapter;
176
176
 
177
- export { type ConnectUIOptions as C, type HostCapabilities as H, SYNAPSE_DATA_ELEMENT_ID as S, type HostKind as a, HostUnsupportedError as b, type SynapseUIClient as c, type SynapseUITheme as d, connectUI as e, detectHostKind as f, type HostAdapter as g, adapterForKind as h, selectAdapter as s };
177
+ export { type ConnectUIOptions as C, type HostAdapter as H, type SynapseUITheme as S, type HostCapabilities as a, type HostKind as b, HostUnsupportedError as c, SYNAPSE_DATA_ELEMENT_ID as d, type SynapseUIClient as e, adapterForKind as f, connectUI as g, detectHostKind as h, selectAdapter as s };
@@ -1,4 +1,4 @@
1
- import { g as FontFaceDescriptor } from './types-uEO4VFJ2.cjs';
1
+ import { f as FontFaceDescriptor } from './types-CG08aO82.cjs';
2
2
 
3
3
  /**
4
4
  * Cross-host UI client — types and wire constants.
@@ -174,4 +174,4 @@ declare function adapterForKind(kind: HostKind, win: Window & typeof globalThis,
174
174
  /** Select and construct the host adapter, honoring `options.host` when set. */
175
175
  declare function selectAdapter(win: Window & typeof globalThis, options: ConnectUIOptions): HostAdapter;
176
176
 
177
- export { type ConnectUIOptions as C, type HostCapabilities as H, SYNAPSE_DATA_ELEMENT_ID as S, type HostKind as a, HostUnsupportedError as b, type SynapseUIClient as c, type SynapseUITheme as d, connectUI as e, detectHostKind as f, type HostAdapter as g, adapterForKind as h, selectAdapter as s };
177
+ export { type ConnectUIOptions as C, type HostAdapter as H, type SynapseUITheme as S, type HostCapabilities as a, type HostKind as b, HostUnsupportedError as c, SYNAPSE_DATA_ELEMENT_ID as d, type SynapseUIClient as e, adapterForKind as f, connectUI as g, detectHostKind as h, selectAdapter as s };
@@ -1,57 +1,58 @@
1
1
  'use strict';
2
2
 
3
- var chunkEHLQWCYV_cjs = require('../chunk-EHLQWCYV.cjs');
4
- require('../chunk-TXJMGQYF.cjs');
3
+ var chunkRU64F5RS_cjs = require('../chunk-RU64F5RS.cjs');
4
+ require('../chunk-SZWHFTXV.cjs');
5
+ require('../chunk-Q7SFCCGT.cjs');
5
6
 
6
7
 
7
8
 
8
9
  Object.defineProperty(exports, "HostUnsupportedError", {
9
10
  enumerable: true,
10
- get: function () { return chunkEHLQWCYV_cjs.HostUnsupportedError; }
11
+ get: function () { return chunkRU64F5RS_cjs.HostUnsupportedError; }
11
12
  });
12
13
  Object.defineProperty(exports, "SYNAPSE_DATA_ELEMENT_ID", {
13
14
  enumerable: true,
14
- get: function () { return chunkEHLQWCYV_cjs.SYNAPSE_DATA_ELEMENT_ID; }
15
+ get: function () { return chunkRU64F5RS_cjs.SYNAPSE_DATA_ELEMENT_ID; }
15
16
  });
16
17
  Object.defineProperty(exports, "adapterForKind", {
17
18
  enumerable: true,
18
- get: function () { return chunkEHLQWCYV_cjs.adapterForKind; }
19
+ get: function () { return chunkRU64F5RS_cjs.adapterForKind; }
19
20
  });
20
21
  Object.defineProperty(exports, "applyHostTheme", {
21
22
  enumerable: true,
22
- get: function () { return chunkEHLQWCYV_cjs.applyHostTheme; }
23
+ get: function () { return chunkRU64F5RS_cjs.applyHostTheme; }
23
24
  });
24
25
  Object.defineProperty(exports, "coerceMode", {
25
26
  enumerable: true,
26
- get: function () { return chunkEHLQWCYV_cjs.coerceMode; }
27
+ get: function () { return chunkRU64F5RS_cjs.coerceMode; }
27
28
  });
28
29
  Object.defineProperty(exports, "connectUI", {
29
30
  enumerable: true,
30
- get: function () { return chunkEHLQWCYV_cjs.connectUI; }
31
+ get: function () { return chunkRU64F5RS_cjs.connectUI; }
31
32
  });
32
33
  Object.defineProperty(exports, "createChatGPTAdapter", {
33
34
  enumerable: true,
34
- get: function () { return chunkEHLQWCYV_cjs.createChatGPTAdapter; }
35
+ get: function () { return chunkRU64F5RS_cjs.createChatGPTAdapter; }
35
36
  });
36
37
  Object.defineProperty(exports, "createInlineAdapter", {
37
38
  enumerable: true,
38
- get: function () { return chunkEHLQWCYV_cjs.createInlineAdapter; }
39
+ get: function () { return chunkRU64F5RS_cjs.createInlineAdapter; }
39
40
  });
40
41
  Object.defineProperty(exports, "createMcpAppsAdapter", {
41
42
  enumerable: true,
42
- get: function () { return chunkEHLQWCYV_cjs.createMcpAppsAdapter; }
43
+ get: function () { return chunkRU64F5RS_cjs.createMcpAppsAdapter; }
43
44
  });
44
45
  Object.defineProperty(exports, "detectHostKind", {
45
46
  enumerable: true,
46
- get: function () { return chunkEHLQWCYV_cjs.detectHostKind; }
47
+ get: function () { return chunkRU64F5RS_cjs.detectHostKind; }
47
48
  });
48
49
  Object.defineProperty(exports, "preferredMode", {
49
50
  enumerable: true,
50
- get: function () { return chunkEHLQWCYV_cjs.preferredMode; }
51
+ get: function () { return chunkRU64F5RS_cjs.preferredMode; }
51
52
  });
52
53
  Object.defineProperty(exports, "selectAdapter", {
53
54
  enumerable: true,
54
- get: function () { return chunkEHLQWCYV_cjs.selectAdapter; }
55
+ get: function () { return chunkRU64F5RS_cjs.selectAdapter; }
55
56
  });
56
57
  //# sourceMappingURL=index.cjs.map
57
58
  //# sourceMappingURL=index.cjs.map
@@ -1,6 +1,6 @@
1
- import { C as ConnectUIOptions, g as HostAdapter, d as SynapseUITheme } from '../detect-BHYg26_d.cjs';
2
- export { H as HostCapabilities, a as HostKind, b as HostUnsupportedError, S as SYNAPSE_DATA_ELEMENT_ID, c as SynapseUIClient, h as adapterForKind, e as connectUI, f as detectHostKind, s as selectAdapter } from '../detect-BHYg26_d.cjs';
3
- import '../types-uEO4VFJ2.cjs';
1
+ import { C as ConnectUIOptions, H as HostAdapter, S as SynapseUITheme } from '../detect-DZMJsyvZ.cjs';
2
+ export { a as HostCapabilities, b as HostKind, c as HostUnsupportedError, d as SYNAPSE_DATA_ELEMENT_ID, e as SynapseUIClient, f as adapterForKind, g as connectUI, h as detectHostKind, s as selectAdapter } from '../detect-DZMJsyvZ.cjs';
3
+ import '../types-CG08aO82.cjs';
4
4
  import '@modelcontextprotocol/ext-apps';
5
5
  import '@modelcontextprotocol/sdk/types.js';
6
6
 
@@ -1,6 +1,6 @@
1
- import { C as ConnectUIOptions, g as HostAdapter, d as SynapseUITheme } from '../detect-Bf8Q_0dK.js';
2
- export { H as HostCapabilities, a as HostKind, b as HostUnsupportedError, S as SYNAPSE_DATA_ELEMENT_ID, c as SynapseUIClient, h as adapterForKind, e as connectUI, f as detectHostKind, s as selectAdapter } from '../detect-Bf8Q_0dK.js';
3
- import '../types-uEO4VFJ2.js';
1
+ import { C as ConnectUIOptions, H as HostAdapter, S as SynapseUITheme } from '../detect-DBwc8a21.js';
2
+ export { a as HostCapabilities, b as HostKind, c as HostUnsupportedError, d as SYNAPSE_DATA_ELEMENT_ID, e as SynapseUIClient, f as adapterForKind, g as connectUI, h as detectHostKind, s as selectAdapter } from '../detect-DBwc8a21.js';
3
+ import '../types-CG08aO82.js';
4
4
  import '@modelcontextprotocol/ext-apps';
5
5
  import '@modelcontextprotocol/sdk/types.js';
6
6
 
@@ -1,4 +1,5 @@
1
- export { HostUnsupportedError, SYNAPSE_DATA_ELEMENT_ID, adapterForKind, applyHostTheme, coerceMode, connectUI, createChatGPTAdapter, createInlineAdapter, createMcpAppsAdapter, detectHostKind, preferredMode, selectAdapter } from '../chunk-SRQNQ26I.js';
2
- import '../chunk-UPDBDXQB.js';
1
+ export { HostUnsupportedError, SYNAPSE_DATA_ELEMENT_ID, adapterForKind, applyHostTheme, coerceMode, connectUI, createChatGPTAdapter, createInlineAdapter, createMcpAppsAdapter, detectHostKind, preferredMode, selectAdapter } from '../chunk-OYLZ5OCK.js';
2
+ import '../chunk-DRLVEHCD.js';
3
+ import '../chunk-PZ5AY32C.js';
3
4
  //# sourceMappingURL=index.js.map
4
5
  //# sourceMappingURL=index.js.map
package/dist/index.cjs CHANGED
@@ -1,54 +1,78 @@
1
1
  'use strict';
2
2
 
3
- var chunkEHLQWCYV_cjs = require('./chunk-EHLQWCYV.cjs');
4
- var chunkFDMRJZKT_cjs = require('./chunk-FDMRJZKT.cjs');
5
- var chunkTXJMGQYF_cjs = require('./chunk-TXJMGQYF.cjs');
6
-
3
+ var chunkRU64F5RS_cjs = require('./chunk-RU64F5RS.cjs');
4
+ var chunkQXDCA7QW_cjs = require('./chunk-QXDCA7QW.cjs');
5
+ var chunkSZWHFTXV_cjs = require('./chunk-SZWHFTXV.cjs');
6
+ require('./chunk-NP7ROSH2.cjs');
7
+ require('./chunk-Q7SFCCGT.cjs');
8
+ var extApps = require('@modelcontextprotocol/ext-apps');
7
9
 
10
+ var BASE64_CHUNK = 32768;
11
+ async function downloadFile(app, filename, content, mimeType) {
12
+ const internals = chunkQXDCA7QW_cjs.internalsFor(app);
13
+ if (internals.hostDownloadFileCapability === void 0) {
14
+ throw new Error("downloadFile is not supported in this host");
15
+ }
16
+ const resolvedMime = mimeType || (content instanceof Blob ? content.type : "") || "application/octet-stream";
17
+ const uri = `file:///${filename}`;
18
+ const resource = typeof content === "string" ? { uri, mimeType: resolvedMime, text: content } : { uri, mimeType: resolvedMime, blob: await toBase64(content) };
19
+ const params = {
20
+ contents: [{ type: "resource", resource }]
21
+ };
22
+ return await internals.request(
23
+ extApps.DOWNLOAD_FILE_METHOD,
24
+ params
25
+ );
26
+ }
27
+ async function toBase64(blob) {
28
+ const bytes = new Uint8Array(await blob.arrayBuffer());
29
+ let binary = "";
30
+ for (let i = 0; i < bytes.length; i += BASE64_CHUNK) {
31
+ binary += String.fromCharCode(...bytes.subarray(i, i + BASE64_CHUNK));
32
+ }
33
+ return btoa(binary);
34
+ }
8
35
 
9
36
  Object.defineProperty(exports, "HostUnsupportedError", {
10
37
  enumerable: true,
11
- get: function () { return chunkEHLQWCYV_cjs.HostUnsupportedError; }
38
+ get: function () { return chunkRU64F5RS_cjs.HostUnsupportedError; }
12
39
  });
13
40
  Object.defineProperty(exports, "SYNAPSE_DATA_ELEMENT_ID", {
14
41
  enumerable: true,
15
- get: function () { return chunkEHLQWCYV_cjs.SYNAPSE_DATA_ELEMENT_ID; }
42
+ get: function () { return chunkRU64F5RS_cjs.SYNAPSE_DATA_ELEMENT_ID; }
16
43
  });
17
44
  Object.defineProperty(exports, "connectUI", {
18
45
  enumerable: true,
19
- get: function () { return chunkEHLQWCYV_cjs.connectUI; }
46
+ get: function () { return chunkRU64F5RS_cjs.connectUI; }
20
47
  });
21
48
  Object.defineProperty(exports, "detectHostKind", {
22
49
  enumerable: true,
23
- get: function () { return chunkEHLQWCYV_cjs.detectHostKind; }
50
+ get: function () { return chunkRU64F5RS_cjs.detectHostKind; }
24
51
  });
25
52
  Object.defineProperty(exports, "action", {
26
53
  enumerable: true,
27
- get: function () { return chunkFDMRJZKT_cjs.action; }
54
+ get: function () { return chunkQXDCA7QW_cjs.action; }
28
55
  });
29
56
  Object.defineProperty(exports, "callToolAsTask", {
30
57
  enumerable: true,
31
- get: function () { return chunkFDMRJZKT_cjs.callToolAsTask; }
58
+ get: function () { return chunkQXDCA7QW_cjs.callToolAsTask; }
32
59
  });
33
60
  Object.defineProperty(exports, "connect", {
34
61
  enumerable: true,
35
- get: function () { return chunkFDMRJZKT_cjs.connect; }
36
- });
37
- Object.defineProperty(exports, "downloadFile", {
38
- enumerable: true,
39
- get: function () { return chunkFDMRJZKT_cjs.downloadFile; }
62
+ get: function () { return chunkQXDCA7QW_cjs.connect; }
40
63
  });
41
64
  Object.defineProperty(exports, "pickFile", {
42
65
  enumerable: true,
43
- get: function () { return chunkFDMRJZKT_cjs.pickFile; }
66
+ get: function () { return chunkQXDCA7QW_cjs.pickFile; }
44
67
  });
45
68
  Object.defineProperty(exports, "pickFiles", {
46
69
  enumerable: true,
47
- get: function () { return chunkFDMRJZKT_cjs.pickFiles; }
70
+ get: function () { return chunkQXDCA7QW_cjs.pickFiles; }
48
71
  });
49
72
  Object.defineProperty(exports, "FONT_FACES_CONTEXT_KEY", {
50
73
  enumerable: true,
51
- get: function () { return chunkTXJMGQYF_cjs.FONT_FACES_CONTEXT_KEY; }
74
+ get: function () { return chunkSZWHFTXV_cjs.FONT_FACES_CONTEXT_KEY; }
52
75
  });
76
+ exports.downloadFile = downloadFile;
53
77
  //# sourceMappingURL=index.cjs.map
54
78
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
1
+ {"version":3,"sources":["../src/download-file.ts"],"names":["internalsFor","DOWNLOAD_FILE_METHOD"],"mappings":";;;;;;;;;AAqBA,IAAM,YAAA,GAAe,KAAA;AAqBrB,eAAsB,YAAA,CACpB,GAAA,EACA,QAAA,EACA,OAAA,EACA,QAAA,EACkC;AAClC,EAAA,MAAM,SAAA,GAAYA,+BAAa,GAAG,CAAA;AAClC,EAAA,IAAI,SAAA,CAAU,+BAA+B,MAAA,EAAW;AACtD,IAAA,MAAM,IAAI,MAAM,4CAA4C,CAAA;AAAA,EAC9D;AACA,EAAA,MAAM,eACJ,QAAA,KAAa,OAAA,YAAmB,IAAA,GAAO,OAAA,CAAQ,OAAO,EAAA,CAAA,IAAO,0BAAA;AAC/D,EAAA,MAAM,GAAA,GAAM,WAAW,QAAQ,CAAA,CAAA;AAC/B,EAAA,MAAM,WACJ,OAAO,OAAA,KAAY,WACf,EAAE,GAAA,EAAK,UAAU,YAAA,EAAc,IAAA,EAAM,SAAQ,GAC7C,EAAE,KAAK,QAAA,EAAU,YAAA,EAAc,MAAM,MAAM,QAAA,CAAS,OAAO,CAAA,EAAE;AACnE,EAAA,MAAM,MAAA,GAA6C;AAAA,IACjD,UAAU,CAAC,EAAE,IAAA,EAAM,UAAA,EAAY,UAAU;AAAA,GAC3C;AACA,EAAA,OAAQ,MAAM,SAAA,CAAU,OAAA;AAAA,IACtBC,4BAAA;AAAA,IACA;AAAA,GACF;AACF;AAEA,eAAe,SAAS,IAAA,EAA6B;AACnD,EAAA,MAAM,QAAQ,IAAI,UAAA,CAAW,MAAM,IAAA,CAAK,aAAa,CAAA;AACrD,EAAA,IAAI,MAAA,GAAS,EAAA;AACb,EAAA,KAAA,IAAS,IAAI,CAAA,EAAG,CAAA,GAAI,KAAA,CAAM,MAAA,EAAQ,KAAK,YAAA,EAAc;AACnD,IAAA,MAAA,IAAU,MAAA,CAAO,aAAa,GAAG,KAAA,CAAM,SAAS,CAAA,EAAG,CAAA,GAAI,YAAY,CAAC,CAAA;AAAA,EACtE;AACA,EAAA,OAAO,KAAK,MAAM,CAAA;AACpB","file":"index.cjs","sourcesContent":["/**\n * Hand the user a file to save, over the ext-apps `ui/download-file` request.\n *\n * A function over {@link App} rather than a method on it, like the helpers in\n * `extensions.ts` — but unlike them this is spec surface, so it is not gated on\n * the host identity. Any host that advertises `downloadFile` can answer it.\n *\n * The bytes always travel embedded. The spec also allows a `ResourceLink`, which\n * asks the host to fetch a URI the app names; a host holding the user's session\n * has every reason to refuse that, and the NimbleBrain host does.\n */\nimport {\n DOWNLOAD_FILE_METHOD,\n type McpUiDownloadFileRequest,\n type McpUiDownloadFileResult,\n} from \"@modelcontextprotocol/ext-apps\";\nimport type { EmbeddedResource } from \"@modelcontextprotocol/sdk/types.js\";\nimport { internalsFor } from \"./internals.js\";\nimport type { App } from \"./types.js\";\n\n/** Bytes per `String.fromCharCode` spread — well under any engine's argument limit. */\nconst BASE64_CHUNK = 0x8000;\n\n/**\n * Hand the user a file to save.\n *\n * A string is sent as the resource's `text`; a `Blob` is read and sent as\n * base64 `blob`. Reading a `Blob` is asynchronous, which is why this returns a\n * promise.\n *\n * Precedence for the MIME type: the explicit argument, then the Blob's own\n * type, then `application/octet-stream`. An empty-string argument falls\n * through — a `\"\"` MIME is effectively \"no type\".\n *\n * The filename is the last segment of the resource's `file:///` URI, because an\n * embedded resource has no name field of its own.\n *\n * Resolves with the host's result: `{ isError: true }` when the host declined\n * or the user cancelled. Rejects, without sending, when the host did not\n * advertise the `downloadFile` capability — a host that does not implement the\n * request may never answer it, and a request has no deadline.\n */\nexport async function downloadFile(\n app: App,\n filename: string,\n content: string | Blob,\n mimeType?: string,\n): Promise<McpUiDownloadFileResult> {\n const internals = internalsFor(app);\n if (internals.hostDownloadFileCapability === undefined) {\n throw new Error(\"downloadFile is not supported in this host\");\n }\n const resolvedMime =\n mimeType || (content instanceof Blob ? content.type : \"\") || \"application/octet-stream\";\n const uri = `file:///${filename}`;\n const resource: EmbeddedResource[\"resource\"] =\n typeof content === \"string\"\n ? { uri, mimeType: resolvedMime, text: content }\n : { uri, mimeType: resolvedMime, blob: await toBase64(content) };\n const params: McpUiDownloadFileRequest[\"params\"] = {\n contents: [{ type: \"resource\", resource }],\n };\n return (await internals.request(\n DOWNLOAD_FILE_METHOD,\n params as unknown as Record<string, unknown>,\n )) as McpUiDownloadFileResult;\n}\n\nasync function toBase64(blob: Blob): Promise<string> {\n const bytes = new Uint8Array(await blob.arrayBuffer());\n let binary = \"\";\n for (let i = 0; i < bytes.length; i += BASE64_CHUNK) {\n binary += String.fromCharCode(...bytes.subarray(i, i + BASE64_CHUNK));\n }\n return btoa(binary);\n}\n"]}
package/dist/index.d.cts CHANGED
@@ -1,18 +1,21 @@
1
1
  export { CreateTaskResult, ReadResourceRequest, ReadResourceResult, Task, TaskStatus } from '@modelcontextprotocol/sdk/types.js';
2
- import { C as ConnectOptions, A as App, R as RequestFileOptions, F as FileResult, a as CallToolAsTaskOptions, T as TaskHandle } from './types-uEO4VFJ2.cjs';
3
- export { h as AgentAction, i as AppEventName, B as BuiltinActionType, c as CallToolOptions, D as DataChangedEvent, j as Dimensions, k as FontDisplayValue, g as FontFaceDescriptor, H as HostInfo, K as KeyForwardConfig, M as ModelContext, N as NavigatePayload, l as NotifyPayload, m as TasksCapability, d as Theme, b as ToolCallResult, f as ToolDefinition, e as ToolResultData } from './types-uEO4VFJ2.cjs';
4
- export { C as ConnectUIOptions, H as HostCapabilities, a as HostKind, b as HostUnsupportedError, S as SYNAPSE_DATA_ELEMENT_ID, c as SynapseUIClient, d as SynapseUITheme, e as connectUI, f as detectHostKind } from './detect-BHYg26_d.cjs';
2
+ import { C as ConnectOptions, A as App, R as RequestFileOptions, F as FileResult, a as CallToolAsTaskOptions, T as TaskHandle } from './types-CG08aO82.cjs';
3
+ export { g as AppEventName, D as Dimensions, h as FontDisplayValue, f as FontFaceDescriptor, K as KeyForwardConfig, M as ModelContext, i as TasksCapability, c as Theme, b as ToolCallResult, e as ToolDefinition, d as ToolResultData } from './types-CG08aO82.cjs';
4
+ import { McpUiDownloadFileResult } from '@modelcontextprotocol/ext-apps';
5
5
  export { McpUiHostContext } from '@modelcontextprotocol/ext-apps';
6
+ export { C as ConnectUIOptions, a as HostCapabilities, b as HostKind, c as HostUnsupportedError, d as SYNAPSE_DATA_ELEMENT_ID, e as SynapseUIClient, S as SynapseUITheme, g as connectUI, h as detectHostKind } from './detect-DZMJsyvZ.cjs';
6
7
 
7
8
  /**
8
9
  * Connect to an MCP Apps host.
9
10
  *
10
- * The one entry point: owns the ext-apps handshake, theme injection, content
11
- * parsing, resize management, and event routing, and resolves to a ready
12
- * {@link App}.
11
+ * The one entry point. The protocol underneath is the spec's own client,
12
+ * `@modelcontextprotocol/ext-apps`'s `App`: it owns the transport, the
13
+ * handshake and the wire schemas. What this adds is the framework on top —
14
+ * theme injection, the parsed payloads, multi-subscriber events, resize, and
15
+ * the NimbleBrain extensions — and it resolves to a ready {@link App}.
13
16
  *
14
17
  * The `App` it returns stays deliberately small. NimbleBrain's own extensions
15
- * (`action`, the file picker, `downloadFile`) and the MCP tasks utility are
18
+ * (`action`, the file picker), `downloadFile` and the MCP tasks utility are
16
19
  * composable functions over it — import them from the package root.
17
20
  */
18
21
  declare function connect(options: ConnectOptions): Promise<App>;
@@ -30,21 +33,45 @@ declare function connect(options: ConnectOptions): Promise<App>;
30
33
  declare const FONT_FACES_CONTEXT_KEY = "synapse/fontFaces";
31
34
 
32
35
  /**
33
- * Trigger a host-side action.
36
+ * Hand the user a file to save, over the ext-apps `ui/download-file` request.
37
+ *
38
+ * A function over {@link App} rather than a method on it, like the helpers in
39
+ * `extensions.ts` — but unlike them this is spec surface, so it is not gated on
40
+ * the host identity. Any host that advertises `downloadFile` can answer it.
34
41
  *
35
- * The inverse direction of the `action` event: this sends a command *to* the
36
- * host (navigate, open a panel), where `app.on("action", …)` receives the ones
37
- * a tool emits. No-op off a NimbleBrain host.
42
+ * The bytes always travel embedded. The spec also allows a `ResourceLink`, which
43
+ * asks the host to fetch a URI the app names; a host holding the user's session
44
+ * has every reason to refuse that, and the NimbleBrain host does.
38
45
  */
39
- declare function action(app: App, name: string, params?: Record<string, unknown>): void;
46
+
40
47
  /**
41
48
  * Hand the user a file to save.
42
49
  *
50
+ * A string is sent as the resource's `text`; a `Blob` is read and sent as
51
+ * base64 `blob`. Reading a `Blob` is asynchronous, which is why this returns a
52
+ * promise.
53
+ *
43
54
  * Precedence for the MIME type: the explicit argument, then the Blob's own
44
55
  * type, then `application/octet-stream`. An empty-string argument falls
45
56
  * through — a `""` MIME is effectively "no type".
57
+ *
58
+ * The filename is the last segment of the resource's `file:///` URI, because an
59
+ * embedded resource has no name field of its own.
60
+ *
61
+ * Resolves with the host's result: `{ isError: true }` when the host declined
62
+ * or the user cancelled. Rejects, without sending, when the host did not
63
+ * advertise the `downloadFile` capability — a host that does not implement the
64
+ * request may never answer it, and a request has no deadline.
46
65
  */
47
- declare function downloadFile(app: App, filename: string, content: string | Blob, mimeType?: string): void;
66
+ declare function downloadFile(app: App, filename: string, content: string | Blob, mimeType?: string): Promise<McpUiDownloadFileResult>;
67
+
68
+ /**
69
+ * Trigger a host-side action.
70
+ *
71
+ * Sends a command *to* the host (navigate, open a panel). No-op off a
72
+ * NimbleBrain host.
73
+ */
74
+ declare function action(app: App, name: string, params?: Record<string, unknown>): void;
48
75
  /**
49
76
  * Request one file from the user via the host's native file picker.
50
77
  *
package/dist/index.d.ts CHANGED
@@ -1,18 +1,21 @@
1
1
  export { CreateTaskResult, ReadResourceRequest, ReadResourceResult, Task, TaskStatus } from '@modelcontextprotocol/sdk/types.js';
2
- import { C as ConnectOptions, A as App, R as RequestFileOptions, F as FileResult, a as CallToolAsTaskOptions, T as TaskHandle } from './types-uEO4VFJ2.js';
3
- export { h as AgentAction, i as AppEventName, B as BuiltinActionType, c as CallToolOptions, D as DataChangedEvent, j as Dimensions, k as FontDisplayValue, g as FontFaceDescriptor, H as HostInfo, K as KeyForwardConfig, M as ModelContext, N as NavigatePayload, l as NotifyPayload, m as TasksCapability, d as Theme, b as ToolCallResult, f as ToolDefinition, e as ToolResultData } from './types-uEO4VFJ2.js';
4
- export { C as ConnectUIOptions, H as HostCapabilities, a as HostKind, b as HostUnsupportedError, S as SYNAPSE_DATA_ELEMENT_ID, c as SynapseUIClient, d as SynapseUITheme, e as connectUI, f as detectHostKind } from './detect-Bf8Q_0dK.js';
2
+ import { C as ConnectOptions, A as App, R as RequestFileOptions, F as FileResult, a as CallToolAsTaskOptions, T as TaskHandle } from './types-CG08aO82.js';
3
+ export { g as AppEventName, D as Dimensions, h as FontDisplayValue, f as FontFaceDescriptor, K as KeyForwardConfig, M as ModelContext, i as TasksCapability, c as Theme, b as ToolCallResult, e as ToolDefinition, d as ToolResultData } from './types-CG08aO82.js';
4
+ import { McpUiDownloadFileResult } from '@modelcontextprotocol/ext-apps';
5
5
  export { McpUiHostContext } from '@modelcontextprotocol/ext-apps';
6
+ export { C as ConnectUIOptions, a as HostCapabilities, b as HostKind, c as HostUnsupportedError, d as SYNAPSE_DATA_ELEMENT_ID, e as SynapseUIClient, S as SynapseUITheme, g as connectUI, h as detectHostKind } from './detect-DBwc8a21.js';
6
7
 
7
8
  /**
8
9
  * Connect to an MCP Apps host.
9
10
  *
10
- * The one entry point: owns the ext-apps handshake, theme injection, content
11
- * parsing, resize management, and event routing, and resolves to a ready
12
- * {@link App}.
11
+ * The one entry point. The protocol underneath is the spec's own client,
12
+ * `@modelcontextprotocol/ext-apps`'s `App`: it owns the transport, the
13
+ * handshake and the wire schemas. What this adds is the framework on top —
14
+ * theme injection, the parsed payloads, multi-subscriber events, resize, and
15
+ * the NimbleBrain extensions — and it resolves to a ready {@link App}.
13
16
  *
14
17
  * The `App` it returns stays deliberately small. NimbleBrain's own extensions
15
- * (`action`, the file picker, `downloadFile`) and the MCP tasks utility are
18
+ * (`action`, the file picker), `downloadFile` and the MCP tasks utility are
16
19
  * composable functions over it — import them from the package root.
17
20
  */
18
21
  declare function connect(options: ConnectOptions): Promise<App>;
@@ -30,21 +33,45 @@ declare function connect(options: ConnectOptions): Promise<App>;
30
33
  declare const FONT_FACES_CONTEXT_KEY = "synapse/fontFaces";
31
34
 
32
35
  /**
33
- * Trigger a host-side action.
36
+ * Hand the user a file to save, over the ext-apps `ui/download-file` request.
37
+ *
38
+ * A function over {@link App} rather than a method on it, like the helpers in
39
+ * `extensions.ts` — but unlike them this is spec surface, so it is not gated on
40
+ * the host identity. Any host that advertises `downloadFile` can answer it.
34
41
  *
35
- * The inverse direction of the `action` event: this sends a command *to* the
36
- * host (navigate, open a panel), where `app.on("action", …)` receives the ones
37
- * a tool emits. No-op off a NimbleBrain host.
42
+ * The bytes always travel embedded. The spec also allows a `ResourceLink`, which
43
+ * asks the host to fetch a URI the app names; a host holding the user's session
44
+ * has every reason to refuse that, and the NimbleBrain host does.
38
45
  */
39
- declare function action(app: App, name: string, params?: Record<string, unknown>): void;
46
+
40
47
  /**
41
48
  * Hand the user a file to save.
42
49
  *
50
+ * A string is sent as the resource's `text`; a `Blob` is read and sent as
51
+ * base64 `blob`. Reading a `Blob` is asynchronous, which is why this returns a
52
+ * promise.
53
+ *
43
54
  * Precedence for the MIME type: the explicit argument, then the Blob's own
44
55
  * type, then `application/octet-stream`. An empty-string argument falls
45
56
  * through — a `""` MIME is effectively "no type".
57
+ *
58
+ * The filename is the last segment of the resource's `file:///` URI, because an
59
+ * embedded resource has no name field of its own.
60
+ *
61
+ * Resolves with the host's result: `{ isError: true }` when the host declined
62
+ * or the user cancelled. Rejects, without sending, when the host did not
63
+ * advertise the `downloadFile` capability — a host that does not implement the
64
+ * request may never answer it, and a request has no deadline.
46
65
  */
47
- declare function downloadFile(app: App, filename: string, content: string | Blob, mimeType?: string): void;
66
+ declare function downloadFile(app: App, filename: string, content: string | Blob, mimeType?: string): Promise<McpUiDownloadFileResult>;
67
+
68
+ /**
69
+ * Trigger a host-side action.
70
+ *
71
+ * Sends a command *to* the host (navigate, open a panel). No-op off a
72
+ * NimbleBrain host.
73
+ */
74
+ declare function action(app: App, name: string, params?: Record<string, unknown>): void;
48
75
  /**
49
76
  * Request one file from the user via the host's native file picker.
50
77
  *
package/dist/index.js CHANGED
@@ -1,5 +1,37 @@
1
- export { HostUnsupportedError, SYNAPSE_DATA_ELEMENT_ID, connectUI, detectHostKind } from './chunk-SRQNQ26I.js';
2
- export { action, callToolAsTask, connect, downloadFile, pickFile, pickFiles } from './chunk-VYR6V47N.js';
3
- export { FONT_FACES_CONTEXT_KEY } from './chunk-UPDBDXQB.js';
1
+ export { HostUnsupportedError, SYNAPSE_DATA_ELEMENT_ID, connectUI, detectHostKind } from './chunk-OYLZ5OCK.js';
2
+ import { internalsFor } from './chunk-P5DBJFSQ.js';
3
+ export { action, callToolAsTask, connect, pickFile, pickFiles } from './chunk-P5DBJFSQ.js';
4
+ export { FONT_FACES_CONTEXT_KEY } from './chunk-DRLVEHCD.js';
5
+ import './chunk-54W6IAHM.js';
6
+ import './chunk-PZ5AY32C.js';
7
+ import { DOWNLOAD_FILE_METHOD } from '@modelcontextprotocol/ext-apps';
8
+
9
+ var BASE64_CHUNK = 32768;
10
+ async function downloadFile(app, filename, content, mimeType) {
11
+ const internals = internalsFor(app);
12
+ if (internals.hostDownloadFileCapability === void 0) {
13
+ throw new Error("downloadFile is not supported in this host");
14
+ }
15
+ const resolvedMime = mimeType || (content instanceof Blob ? content.type : "") || "application/octet-stream";
16
+ const uri = `file:///${filename}`;
17
+ const resource = typeof content === "string" ? { uri, mimeType: resolvedMime, text: content } : { uri, mimeType: resolvedMime, blob: await toBase64(content) };
18
+ const params = {
19
+ contents: [{ type: "resource", resource }]
20
+ };
21
+ return await internals.request(
22
+ DOWNLOAD_FILE_METHOD,
23
+ params
24
+ );
25
+ }
26
+ async function toBase64(blob) {
27
+ const bytes = new Uint8Array(await blob.arrayBuffer());
28
+ let binary = "";
29
+ for (let i = 0; i < bytes.length; i += BASE64_CHUNK) {
30
+ binary += String.fromCharCode(...bytes.subarray(i, i + BASE64_CHUNK));
31
+ }
32
+ return btoa(binary);
33
+ }
34
+
35
+ export { downloadFile };
4
36
  //# sourceMappingURL=index.js.map
5
37
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
1
+ {"version":3,"sources":["../src/download-file.ts"],"names":[],"mappings":";;;;;;;;AAqBA,IAAM,YAAA,GAAe,KAAA;AAqBrB,eAAsB,YAAA,CACpB,GAAA,EACA,QAAA,EACA,OAAA,EACA,QAAA,EACkC;AAClC,EAAA,MAAM,SAAA,GAAY,aAAa,GAAG,CAAA;AAClC,EAAA,IAAI,SAAA,CAAU,+BAA+B,MAAA,EAAW;AACtD,IAAA,MAAM,IAAI,MAAM,4CAA4C,CAAA;AAAA,EAC9D;AACA,EAAA,MAAM,eACJ,QAAA,KAAa,OAAA,YAAmB,IAAA,GAAO,OAAA,CAAQ,OAAO,EAAA,CAAA,IAAO,0BAAA;AAC/D,EAAA,MAAM,GAAA,GAAM,WAAW,QAAQ,CAAA,CAAA;AAC/B,EAAA,MAAM,WACJ,OAAO,OAAA,KAAY,WACf,EAAE,GAAA,EAAK,UAAU,YAAA,EAAc,IAAA,EAAM,SAAQ,GAC7C,EAAE,KAAK,QAAA,EAAU,YAAA,EAAc,MAAM,MAAM,QAAA,CAAS,OAAO,CAAA,EAAE;AACnE,EAAA,MAAM,MAAA,GAA6C;AAAA,IACjD,UAAU,CAAC,EAAE,IAAA,EAAM,UAAA,EAAY,UAAU;AAAA,GAC3C;AACA,EAAA,OAAQ,MAAM,SAAA,CAAU,OAAA;AAAA,IACtB,oBAAA;AAAA,IACA;AAAA,GACF;AACF;AAEA,eAAe,SAAS,IAAA,EAA6B;AACnD,EAAA,MAAM,QAAQ,IAAI,UAAA,CAAW,MAAM,IAAA,CAAK,aAAa,CAAA;AACrD,EAAA,IAAI,MAAA,GAAS,EAAA;AACb,EAAA,KAAA,IAAS,IAAI,CAAA,EAAG,CAAA,GAAI,KAAA,CAAM,MAAA,EAAQ,KAAK,YAAA,EAAc;AACnD,IAAA,MAAA,IAAU,MAAA,CAAO,aAAa,GAAG,KAAA,CAAM,SAAS,CAAA,EAAG,CAAA,GAAI,YAAY,CAAC,CAAA;AAAA,EACtE;AACA,EAAA,OAAO,KAAK,MAAM,CAAA;AACpB","file":"index.js","sourcesContent":["/**\n * Hand the user a file to save, over the ext-apps `ui/download-file` request.\n *\n * A function over {@link App} rather than a method on it, like the helpers in\n * `extensions.ts` — but unlike them this is spec surface, so it is not gated on\n * the host identity. Any host that advertises `downloadFile` can answer it.\n *\n * The bytes always travel embedded. The spec also allows a `ResourceLink`, which\n * asks the host to fetch a URI the app names; a host holding the user's session\n * has every reason to refuse that, and the NimbleBrain host does.\n */\nimport {\n DOWNLOAD_FILE_METHOD,\n type McpUiDownloadFileRequest,\n type McpUiDownloadFileResult,\n} from \"@modelcontextprotocol/ext-apps\";\nimport type { EmbeddedResource } from \"@modelcontextprotocol/sdk/types.js\";\nimport { internalsFor } from \"./internals.js\";\nimport type { App } from \"./types.js\";\n\n/** Bytes per `String.fromCharCode` spread — well under any engine's argument limit. */\nconst BASE64_CHUNK = 0x8000;\n\n/**\n * Hand the user a file to save.\n *\n * A string is sent as the resource's `text`; a `Blob` is read and sent as\n * base64 `blob`. Reading a `Blob` is asynchronous, which is why this returns a\n * promise.\n *\n * Precedence for the MIME type: the explicit argument, then the Blob's own\n * type, then `application/octet-stream`. An empty-string argument falls\n * through — a `\"\"` MIME is effectively \"no type\".\n *\n * The filename is the last segment of the resource's `file:///` URI, because an\n * embedded resource has no name field of its own.\n *\n * Resolves with the host's result: `{ isError: true }` when the host declined\n * or the user cancelled. Rejects, without sending, when the host did not\n * advertise the `downloadFile` capability — a host that does not implement the\n * request may never answer it, and a request has no deadline.\n */\nexport async function downloadFile(\n app: App,\n filename: string,\n content: string | Blob,\n mimeType?: string,\n): Promise<McpUiDownloadFileResult> {\n const internals = internalsFor(app);\n if (internals.hostDownloadFileCapability === undefined) {\n throw new Error(\"downloadFile is not supported in this host\");\n }\n const resolvedMime =\n mimeType || (content instanceof Blob ? content.type : \"\") || \"application/octet-stream\";\n const uri = `file:///${filename}`;\n const resource: EmbeddedResource[\"resource\"] =\n typeof content === \"string\"\n ? { uri, mimeType: resolvedMime, text: content }\n : { uri, mimeType: resolvedMime, blob: await toBase64(content) };\n const params: McpUiDownloadFileRequest[\"params\"] = {\n contents: [{ type: \"resource\", resource }],\n };\n return (await internals.request(\n DOWNLOAD_FILE_METHOD,\n params as unknown as Record<string, unknown>,\n )) as McpUiDownloadFileResult;\n}\n\nasync function toBase64(blob: Blob): Promise<string> {\n const bytes = new Uint8Array(await blob.arrayBuffer());\n let binary = \"\";\n for (let i = 0; i < bytes.length; i += BASE64_CHUNK) {\n binary += String.fromCharCode(...bytes.subarray(i, i + BASE64_CHUNK));\n }\n return btoa(binary);\n}\n"]}
@@ -1,7 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkFDMRJZKT_cjs = require('../chunk-FDMRJZKT.cjs');
4
- require('../chunk-TXJMGQYF.cjs');
3
+ var chunkQXDCA7QW_cjs = require('../chunk-QXDCA7QW.cjs');
4
+ require('../chunk-SZWHFTXV.cjs');
5
+ var chunkNP7ROSH2_cjs = require('../chunk-NP7ROSH2.cjs');
6
+ require('../chunk-Q7SFCCGT.cjs');
5
7
  var react = require('react');
6
8
  var jsxRuntime = require('react/jsx-runtime');
7
9
 
@@ -13,7 +15,7 @@ function AppProvider({ children, ...options }) {
13
15
  react.useEffect(() => {
14
16
  if (connectingRef.current) return;
15
17
  connectingRef.current = true;
16
- chunkFDMRJZKT_cjs.connect(options).then(setApp, (err) => {
18
+ chunkQXDCA7QW_cjs.connect(options).then(setApp, (err) => {
17
19
  setError(err instanceof Error ? err : new Error(String(err)));
18
20
  });
19
21
  }, []);
@@ -78,12 +80,12 @@ function useCallTool(toolName) {
78
80
  const [data, setData] = react.useState(null);
79
81
  const callIdRef = react.useRef(0);
80
82
  const call = react.useCallback(
81
- async (args, options) => {
83
+ async (args) => {
82
84
  const id = ++callIdRef.current;
83
85
  setIsPending(true);
84
86
  setError(null);
85
87
  try {
86
- const result = await app.callTool(toolName, args, options);
88
+ const result = await app.callTool(toolName, args);
87
89
  if (id === callIdRef.current) {
88
90
  setData(result.data);
89
91
  setIsPending(false);
@@ -107,7 +109,7 @@ function useDataSync(callback) {
107
109
  const callbackRef = react.useRef(callback);
108
110
  callbackRef.current = callback;
109
111
  react.useEffect(() => {
110
- return app.on("data-changed", (event) => callbackRef.current(event));
112
+ return app.on(chunkNP7ROSH2_cjs.RESOURCE_LIST_CHANGED_METHOD, (params) => callbackRef.current(params ?? {}));
111
113
  }, [app]);
112
114
  }
113
115
  var MODEL_CONTEXT_DEBOUNCE_MS = 250;
@@ -148,7 +150,7 @@ function useSendMessage() {
148
150
  function useAction() {
149
151
  const app = useAppContext();
150
152
  return react.useCallback(
151
- (name, params) => chunkFDMRJZKT_cjs.action(app, name, params),
153
+ (name, params) => chunkQXDCA7QW_cjs.action(app, name, params),
152
154
  [app]
153
155
  );
154
156
  }
@@ -159,7 +161,7 @@ function useFileUpload() {
159
161
  async (options) => {
160
162
  setIsPending(true);
161
163
  try {
162
- return await chunkFDMRJZKT_cjs.pickFile(app, options);
164
+ return await chunkQXDCA7QW_cjs.pickFile(app, options);
163
165
  } finally {
164
166
  setIsPending(false);
165
167
  }
@@ -170,7 +172,7 @@ function useFileUpload() {
170
172
  async (options) => {
171
173
  setIsPending(true);
172
174
  try {
173
- return await chunkFDMRJZKT_cjs.pickFiles(app, options);
175
+ return await chunkQXDCA7QW_cjs.pickFiles(app, options);
174
176
  } finally {
175
177
  setIsPending(false);
176
178
  }
@@ -255,7 +257,7 @@ function useCallToolAsTask(toolName) {
255
257
  refreshFailureCountRef.current = 0;
256
258
  let handle;
257
259
  try {
258
- handle = await chunkFDMRJZKT_cjs.callToolAsTask(app, toolName, args, options);
260
+ handle = await chunkQXDCA7QW_cjs.callToolAsTask(app, toolName, args, options);
259
261
  } catch (err) {
260
262
  if (gen !== genRef.current) throw err;
261
263
  const e = err instanceof Error ? err : new Error(String(err));