@portel/photon 1.18.0 → 1.20.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 (238) hide show
  1. package/dist/auto-ui/beam/routes/api-browse.d.ts.map +1 -1
  2. package/dist/auto-ui/beam/routes/api-browse.js +16 -4
  3. package/dist/auto-ui/beam/routes/api-browse.js.map +1 -1
  4. package/dist/auto-ui/beam/routes/api-config.js +4 -4
  5. package/dist/auto-ui/beam/routes/api-config.js.map +1 -1
  6. package/dist/auto-ui/beam/routes/api-marketplace.d.ts.map +1 -1
  7. package/dist/auto-ui/beam/routes/api-marketplace.js +14 -1
  8. package/dist/auto-ui/beam/routes/api-marketplace.js.map +1 -1
  9. package/dist/auto-ui/beam.d.ts.map +1 -1
  10. package/dist/auto-ui/beam.js +196 -77
  11. package/dist/auto-ui/beam.js.map +1 -1
  12. package/dist/auto-ui/bridge/index.d.ts.map +1 -1
  13. package/dist/auto-ui/bridge/index.js +17 -0
  14. package/dist/auto-ui/bridge/index.js.map +1 -1
  15. package/dist/auto-ui/streamable-http-transport.d.ts +1 -0
  16. package/dist/auto-ui/streamable-http-transport.d.ts.map +1 -1
  17. package/dist/auto-ui/streamable-http-transport.js +64 -16
  18. package/dist/auto-ui/streamable-http-transport.js.map +1 -1
  19. package/dist/auto-ui/types.d.ts +12 -0
  20. package/dist/auto-ui/types.d.ts.map +1 -1
  21. package/dist/auto-ui/types.js.map +1 -1
  22. package/dist/beam-form.bundle.js +49 -6
  23. package/dist/beam-form.bundle.js.map +2 -2
  24. package/dist/beam.bundle.js +2090 -512
  25. package/dist/beam.bundle.js.map +4 -4
  26. package/dist/capability-negotiator.d.ts +67 -0
  27. package/dist/capability-negotiator.d.ts.map +1 -0
  28. package/dist/capability-negotiator.js +104 -0
  29. package/dist/capability-negotiator.js.map +1 -0
  30. package/dist/channel-manager.d.ts +122 -0
  31. package/dist/channel-manager.d.ts.map +1 -0
  32. package/dist/channel-manager.js +266 -0
  33. package/dist/channel-manager.js.map +1 -0
  34. package/dist/claude-code-plugin.js +1 -1
  35. package/dist/cli/commands/beam.d.ts.map +1 -1
  36. package/dist/cli/commands/beam.js +8 -2
  37. package/dist/cli/commands/beam.js.map +1 -1
  38. package/dist/cli/commands/changelog.d.ts +9 -0
  39. package/dist/cli/commands/changelog.d.ts.map +1 -0
  40. package/dist/cli/commands/changelog.js +133 -0
  41. package/dist/cli/commands/changelog.js.map +1 -0
  42. package/dist/cli/commands/maker.d.ts.map +1 -1
  43. package/dist/cli/commands/maker.js +23 -2
  44. package/dist/cli/commands/maker.js.map +1 -1
  45. package/dist/cli/commands/mcp.d.ts.map +1 -1
  46. package/dist/cli/commands/mcp.js +53 -0
  47. package/dist/cli/commands/mcp.js.map +1 -1
  48. package/dist/cli/commands/package.d.ts.map +1 -1
  49. package/dist/cli/commands/package.js +43 -9
  50. package/dist/cli/commands/package.js.map +1 -1
  51. package/dist/cli/commands/run.d.ts.map +1 -1
  52. package/dist/cli/commands/run.js +1 -0
  53. package/dist/cli/commands/run.js.map +1 -1
  54. package/dist/cli/commands/update.d.ts +3 -2
  55. package/dist/cli/commands/update.d.ts.map +1 -1
  56. package/dist/cli/commands/update.js +50 -43
  57. package/dist/cli/commands/update.js.map +1 -1
  58. package/dist/cli/index.d.ts.map +1 -1
  59. package/dist/cli/index.js +16 -2
  60. package/dist/cli/index.js.map +1 -1
  61. package/dist/cli-alias.js +1 -1
  62. package/dist/cli-alias.js.map +1 -1
  63. package/dist/context-store.d.ts +23 -33
  64. package/dist/context-store.d.ts.map +1 -1
  65. package/dist/context-store.js +147 -97
  66. package/dist/context-store.js.map +1 -1
  67. package/dist/context.d.ts +15 -10
  68. package/dist/context.d.ts.map +1 -1
  69. package/dist/context.js +37 -13
  70. package/dist/context.js.map +1 -1
  71. package/dist/daemon/client.d.ts.map +1 -1
  72. package/dist/daemon/client.js +12 -0
  73. package/dist/daemon/client.js.map +1 -1
  74. package/dist/daemon/server.js +34 -51
  75. package/dist/daemon/server.js.map +1 -1
  76. package/dist/daemon/worker-manager.d.ts.map +1 -1
  77. package/dist/daemon/worker-manager.js +21 -7
  78. package/dist/daemon/worker-manager.js.map +1 -1
  79. package/dist/data-migration.d.ts +27 -0
  80. package/dist/data-migration.d.ts.map +1 -0
  81. package/dist/data-migration.js +307 -0
  82. package/dist/data-migration.js.map +1 -0
  83. package/dist/editor-support/docblock-tag-catalog.d.ts.map +1 -1
  84. package/dist/editor-support/docblock-tag-catalog.js +6 -0
  85. package/dist/editor-support/docblock-tag-catalog.js.map +1 -1
  86. package/dist/loader.d.ts +13 -0
  87. package/dist/loader.d.ts.map +1 -1
  88. package/dist/loader.js +169 -22
  89. package/dist/loader.js.map +1 -1
  90. package/dist/marketplace-manager.d.ts +6 -0
  91. package/dist/marketplace-manager.d.ts.map +1 -1
  92. package/dist/marketplace-manager.js +185 -62
  93. package/dist/marketplace-manager.js.map +1 -1
  94. package/dist/namespace-migration.d.ts +1 -0
  95. package/dist/namespace-migration.d.ts.map +1 -1
  96. package/dist/namespace-migration.js +86 -0
  97. package/dist/namespace-migration.js.map +1 -1
  98. package/dist/photon-cli-runner.d.ts.map +1 -1
  99. package/dist/photon-cli-runner.js +47 -21
  100. package/dist/photon-cli-runner.js.map +1 -1
  101. package/dist/photon-doc-extractor.d.ts +1 -0
  102. package/dist/photon-doc-extractor.d.ts.map +1 -1
  103. package/dist/photon-doc-extractor.js +6 -0
  104. package/dist/photon-doc-extractor.js.map +1 -1
  105. package/dist/readme-syncer.d.ts.map +1 -1
  106. package/dist/readme-syncer.js +6 -1
  107. package/dist/readme-syncer.js.map +1 -1
  108. package/dist/resource-server.d.ts +105 -0
  109. package/dist/resource-server.d.ts.map +1 -0
  110. package/dist/resource-server.js +723 -0
  111. package/dist/resource-server.js.map +1 -0
  112. package/dist/serv/auth/jwt.d.ts +2 -0
  113. package/dist/serv/auth/jwt.d.ts.map +1 -1
  114. package/dist/serv/auth/jwt.js +11 -5
  115. package/dist/serv/auth/jwt.js.map +1 -1
  116. package/dist/serv/vault/token-vault.d.ts +2 -0
  117. package/dist/serv/vault/token-vault.d.ts.map +1 -1
  118. package/dist/serv/vault/token-vault.js +6 -0
  119. package/dist/serv/vault/token-vault.js.map +1 -1
  120. package/dist/server.d.ts +30 -119
  121. package/dist/server.d.ts.map +1 -1
  122. package/dist/server.js +252 -1122
  123. package/dist/server.js.map +1 -1
  124. package/dist/shared/audit.d.ts.map +1 -1
  125. package/dist/shared/audit.js +11 -4
  126. package/dist/shared/audit.js.map +1 -1
  127. package/dist/shared/security.d.ts +10 -0
  128. package/dist/shared/security.d.ts.map +1 -1
  129. package/dist/shared/security.js +27 -0
  130. package/dist/shared/security.js.map +1 -1
  131. package/dist/task-executor.d.ts +69 -0
  132. package/dist/task-executor.d.ts.map +1 -0
  133. package/dist/task-executor.js +182 -0
  134. package/dist/task-executor.js.map +1 -0
  135. package/dist/tasks/store.d.ts.map +1 -1
  136. package/dist/tasks/store.js +6 -2
  137. package/dist/tasks/store.js.map +1 -1
  138. package/dist/types/photon-instance.d.ts +50 -0
  139. package/dist/types/photon-instance.d.ts.map +1 -0
  140. package/dist/types/photon-instance.js +9 -0
  141. package/dist/types/photon-instance.js.map +1 -0
  142. package/dist/types/server-types.d.ts +61 -0
  143. package/dist/types/server-types.d.ts.map +1 -0
  144. package/dist/types/server-types.js +8 -0
  145. package/dist/types/server-types.js.map +1 -0
  146. package/dist/version-notify.d.ts +27 -0
  147. package/dist/version-notify.d.ts.map +1 -0
  148. package/dist/version-notify.js +142 -0
  149. package/dist/version-notify.js.map +1 -0
  150. package/package.json +3 -3
  151. package/dist/auto-ui/bridge/openai-shim.d.ts +0 -20
  152. package/dist/auto-ui/bridge/openai-shim.d.ts.map +0 -1
  153. package/dist/auto-ui/bridge/openai-shim.js +0 -231
  154. package/dist/auto-ui/bridge/openai-shim.js.map +0 -1
  155. package/dist/auto-ui/bridge/photon-app.d.ts +0 -162
  156. package/dist/auto-ui/bridge/photon-app.d.ts.map +0 -1
  157. package/dist/auto-ui/bridge/photon-app.js +0 -460
  158. package/dist/auto-ui/bridge/photon-app.js.map +0 -1
  159. package/dist/auto-ui/daemon-tools.d.ts +0 -45
  160. package/dist/auto-ui/daemon-tools.d.ts.map +0 -1
  161. package/dist/auto-ui/daemon-tools.js +0 -581
  162. package/dist/auto-ui/daemon-tools.js.map +0 -1
  163. package/dist/auto-ui/design-system/index.d.ts +0 -21
  164. package/dist/auto-ui/design-system/index.d.ts.map +0 -1
  165. package/dist/auto-ui/design-system/index.js +0 -27
  166. package/dist/auto-ui/design-system/index.js.map +0 -1
  167. package/dist/auto-ui/design-system/transaction-ui.d.ts +0 -70
  168. package/dist/auto-ui/design-system/transaction-ui.d.ts.map +0 -1
  169. package/dist/auto-ui/design-system/transaction-ui.js +0 -982
  170. package/dist/auto-ui/design-system/transaction-ui.js.map +0 -1
  171. package/dist/auto-ui/playground-server.d.ts +0 -7
  172. package/dist/auto-ui/playground-server.d.ts.map +0 -1
  173. package/dist/auto-ui/playground-server.js +0 -840
  174. package/dist/auto-ui/playground-server.js.map +0 -1
  175. package/dist/auto-ui/rendering/components.d.ts +0 -29
  176. package/dist/auto-ui/rendering/components.d.ts.map +0 -1
  177. package/dist/auto-ui/rendering/components.js +0 -1341
  178. package/dist/auto-ui/rendering/components.js.map +0 -1
  179. package/dist/auto-ui/rendering/field-analyzer.d.ts +0 -104
  180. package/dist/auto-ui/rendering/field-analyzer.d.ts.map +0 -1
  181. package/dist/auto-ui/rendering/field-analyzer.js +0 -447
  182. package/dist/auto-ui/rendering/field-analyzer.js.map +0 -1
  183. package/dist/auto-ui/rendering/field-renderers.d.ts +0 -64
  184. package/dist/auto-ui/rendering/field-renderers.d.ts.map +0 -1
  185. package/dist/auto-ui/rendering/field-renderers.js +0 -317
  186. package/dist/auto-ui/rendering/field-renderers.js.map +0 -1
  187. package/dist/auto-ui/rendering/index.d.ts +0 -28
  188. package/dist/auto-ui/rendering/index.d.ts.map +0 -1
  189. package/dist/auto-ui/rendering/index.js +0 -60
  190. package/dist/auto-ui/rendering/index.js.map +0 -1
  191. package/dist/auto-ui/rendering/layout-selector.d.ts +0 -60
  192. package/dist/auto-ui/rendering/layout-selector.d.ts.map +0 -1
  193. package/dist/auto-ui/rendering/layout-selector.js +0 -476
  194. package/dist/auto-ui/rendering/layout-selector.js.map +0 -1
  195. package/dist/markdown-utils.d.ts +0 -8
  196. package/dist/markdown-utils.d.ts.map +0 -1
  197. package/dist/markdown-utils.js +0 -64
  198. package/dist/markdown-utils.js.map +0 -1
  199. package/dist/mcp-client.d.ts +0 -9
  200. package/dist/mcp-client.d.ts.map +0 -1
  201. package/dist/mcp-client.js +0 -11
  202. package/dist/mcp-client.js.map +0 -1
  203. package/dist/mcp-elicitation.d.ts +0 -32
  204. package/dist/mcp-elicitation.d.ts.map +0 -1
  205. package/dist/mcp-elicitation.js +0 -26
  206. package/dist/mcp-elicitation.js.map +0 -1
  207. package/dist/photons/builder-compass.photon.d.ts +0 -167
  208. package/dist/photons/builder-compass.photon.d.ts.map +0 -1
  209. package/dist/photons/builder-compass.photon.js +0 -816
  210. package/dist/photons/builder-compass.photon.js.map +0 -1
  211. package/dist/photons/builder-compass.photon.ts +0 -1129
  212. package/dist/photons/docs/ui/docs.html +0 -441
  213. package/dist/photons/docs.photon.d.ts +0 -237
  214. package/dist/photons/docs.photon.d.ts.map +0 -1
  215. package/dist/photons/docs.photon.js +0 -483
  216. package/dist/photons/docs.photon.js.map +0 -1
  217. package/dist/photons/docs.photon.ts +0 -536
  218. package/dist/photons/slides.photon.d.ts +0 -212
  219. package/dist/photons/slides.photon.d.ts.map +0 -1
  220. package/dist/photons/slides.photon.js +0 -355
  221. package/dist/photons/slides.photon.js.map +0 -1
  222. package/dist/photons/slides.photon.ts +0 -370
  223. package/dist/photons/spreadsheet/ui/spreadsheet.html +0 -779
  224. package/dist/photons/spreadsheet.photon.d.ts +0 -554
  225. package/dist/photons/spreadsheet.photon.d.ts.map +0 -1
  226. package/dist/photons/spreadsheet.photon.js +0 -1050
  227. package/dist/photons/spreadsheet.photon.js.map +0 -1
  228. package/dist/photons/spreadsheet.photon.ts +0 -1239
  229. package/dist/photons/ui/builder-compass.html +0 -1199
  230. package/dist/photons/ui/builder-compass.photon.html +0 -380
  231. package/dist/security-scanner.d.ts +0 -52
  232. package/dist/security-scanner.d.ts.map +0 -1
  233. package/dist/security-scanner.js +0 -181
  234. package/dist/security-scanner.js.map +0 -1
  235. package/dist/shared/performance.d.ts +0 -65
  236. package/dist/shared/performance.d.ts.map +0 -1
  237. package/dist/shared/performance.js +0 -136
  238. package/dist/shared/performance.js.map +0 -1
@@ -1,460 +0,0 @@
1
- /**
2
- * PhotonApp class for UI templates
3
- *
4
- * This runs in the browser iframe and communicates with the host
5
- * using the MCP Apps Extension protocol.
6
- */
7
- export class PhotonApp {
8
- _name;
9
- _toolOutput = null;
10
- _toolInput = {};
11
- _widgetState = {};
12
- _theme = 'dark';
13
- _locale = 'en-US';
14
- _hostContext = null;
15
- _pendingCalls = new Map();
16
- _callIdCounter = 0;
17
- // Event listeners
18
- _resultListeners = [];
19
- _themeListeners = [];
20
- _progressListeners = [];
21
- _statusListeners = [];
22
- _streamListeners = [];
23
- _emitListeners = [];
24
- constructor(name) {
25
- this._name = name;
26
- this._setupMessageHandler();
27
- }
28
- /**
29
- * Set up message handler for communication with host
30
- */
31
- _setupMessageHandler() {
32
- window.addEventListener('message', (event) => {
33
- const msg = event.data;
34
- if (!msg || typeof msg !== 'object')
35
- return;
36
- // Handle JSON-RPC 2.0 messages
37
- if (msg.jsonrpc === '2.0') {
38
- this._handleJsonRpcMessage(msg);
39
- return;
40
- }
41
- // Handle legacy photon: messages for backward compatibility
42
- if (typeof msg.type === 'string' && msg.type.startsWith('photon:')) {
43
- this._handleLegacyMessage(msg);
44
- return;
45
- }
46
- });
47
- }
48
- /**
49
- * Handle JSON-RPC 2.0 messages (MCP Apps protocol)
50
- */
51
- _handleJsonRpcMessage(msg) {
52
- // Response to our call (has id, no method)
53
- if (msg.id && !msg.method) {
54
- const pending = this._pendingCalls.get(msg.id);
55
- if (pending) {
56
- this._pendingCalls.delete(msg.id);
57
- if (msg.error) {
58
- pending.reject(new Error(msg.error.message || 'Call failed'));
59
- }
60
- else if (msg.result?.isError) {
61
- const errorData = this._extractData(msg.result);
62
- pending.reject(new Error(typeof errorData === 'string' ? errorData : JSON.stringify(errorData)));
63
- }
64
- else {
65
- pending.resolve(this._extractData(msg.result));
66
- }
67
- }
68
- return;
69
- }
70
- // Notifications and requests from host
71
- switch (msg.method) {
72
- case 'ui/initialize':
73
- this._handleInitialize(msg);
74
- break;
75
- case 'ui/notifications/tool-result':
76
- this._toolOutput = msg.params?.result;
77
- this._resultListeners.forEach((cb) => cb(this._extractData(msg.params?.result)));
78
- break;
79
- case 'ui/notifications/tool-input':
80
- this._toolInput = msg.params?.input || {};
81
- break;
82
- case 'ui/notifications/host-context-changed':
83
- case 'ui/notifications/context':
84
- this._handleHostContextChanged(msg.params);
85
- break;
86
- case 'ui/resource-teardown':
87
- // Respond to teardown request
88
- if (msg.id != null) {
89
- this._postToHost({ jsonrpc: '2.0', id: msg.id, result: {} });
90
- }
91
- break;
92
- // Custom Photon notifications
93
- case 'photon/notifications/progress':
94
- this._progressListeners.forEach((cb) => cb(msg.params));
95
- break;
96
- case 'photon/notifications/status':
97
- this._statusListeners.forEach((cb) => cb(msg.params));
98
- break;
99
- case 'photon/notifications/stream':
100
- this._streamListeners.forEach((cb) => cb(msg.params));
101
- break;
102
- case 'photon/notifications/emit':
103
- this._emitListeners.forEach((cb) => cb(msg.params));
104
- break;
105
- }
106
- }
107
- /**
108
- * Handle legacy photon: messages for backward compatibility
109
- */
110
- _handleLegacyMessage(msg) {
111
- switch (msg.type) {
112
- case 'photon:result':
113
- this._toolOutput = msg.data;
114
- this._resultListeners.forEach((cb) => cb(msg.data));
115
- break;
116
- case 'photon:theme-change':
117
- this._theme = msg.theme || 'dark';
118
- this._applyTheme();
119
- this._themeListeners.forEach((cb) => cb(this._theme));
120
- break;
121
- case 'photon:context':
122
- if (msg.context?.theme) {
123
- this._theme = msg.context.theme;
124
- this._applyTheme();
125
- this._themeListeners.forEach((cb) => cb(this._theme));
126
- }
127
- break;
128
- }
129
- }
130
- /**
131
- * Handle ui/initialize message
132
- */
133
- _handleInitialize(msg) {
134
- const params = msg.params || {};
135
- this._hostContext = params.hostContext;
136
- if (params.hostContext?.theme) {
137
- this._theme = params.hostContext.theme;
138
- }
139
- if (params.hostContext?.styles?.variables) {
140
- this._applyThemeTokens(params.hostContext.styles.variables);
141
- }
142
- this._applyTheme();
143
- // Send initialized notification
144
- this._postToHost({
145
- jsonrpc: '2.0',
146
- method: 'ui/notifications/initialized',
147
- params: {},
148
- });
149
- }
150
- /**
151
- * Handle host context changes (theme, etc.)
152
- */
153
- _handleHostContextChanged(params) {
154
- if (!params)
155
- return;
156
- if (params.theme) {
157
- this._theme = params.theme;
158
- this._applyTheme();
159
- this._themeListeners.forEach((cb) => cb(this._theme));
160
- }
161
- if (params.styles?.variables) {
162
- this._applyThemeTokens(params.styles.variables);
163
- }
164
- }
165
- /**
166
- * Apply theme class to document
167
- */
168
- _applyTheme() {
169
- document.documentElement.classList.remove('light', 'dark');
170
- document.documentElement.classList.add(this._theme);
171
- document.documentElement.setAttribute('data-theme', this._theme);
172
- document.documentElement.style.colorScheme = this._theme;
173
- }
174
- /**
175
- * Apply theme CSS variables
176
- */
177
- _applyThemeTokens(tokens) {
178
- const root = document.documentElement;
179
- for (const [key, value] of Object.entries(tokens)) {
180
- root.style.setProperty(key, value);
181
- }
182
- }
183
- /**
184
- * Post message to host
185
- */
186
- _postToHost(msg) {
187
- window.parent.postMessage(msg, '*');
188
- }
189
- /**
190
- * Generate unique call ID
191
- */
192
- _generateCallId() {
193
- return `call_${++this._callIdCounter}_${Math.random().toString(36).slice(2)}`;
194
- }
195
- /**
196
- * Extract data from MCP result format
197
- */
198
- _extractData(result) {
199
- if (!result)
200
- return result;
201
- // Prefer structuredContent
202
- if (result.structuredContent) {
203
- return result.structuredContent;
204
- }
205
- // Extract from content array
206
- if (Array.isArray(result.content)) {
207
- const textItem = result.content.find((item) => item.type === 'text');
208
- if (textItem?.text) {
209
- try {
210
- return JSON.parse(textItem.text);
211
- }
212
- catch {
213
- return textItem.text;
214
- }
215
- }
216
- }
217
- return result;
218
- }
219
- // ═══════════════════════════════════════════════════════════════════════════
220
- // PUBLIC API (window.photon interface)
221
- // ═══════════════════════════════════════════════════════════════════════════
222
- /**
223
- * Connect to host and perform MCP Apps handshake
224
- */
225
- async connect() {
226
- const callId = this._generateCallId();
227
- return new Promise((resolve, reject) => {
228
- this._pendingCalls.set(callId, {
229
- resolve: () => resolve(),
230
- reject,
231
- });
232
- this._postToHost({
233
- jsonrpc: '2.0',
234
- id: callId,
235
- method: 'ui/initialize',
236
- params: {
237
- appInfo: { name: this._name, version: '1.0.0' },
238
- appCapabilities: {},
239
- protocolVersion: '2026-01-26',
240
- },
241
- });
242
- // Timeout after 5 seconds
243
- setTimeout(() => {
244
- if (this._pendingCalls.has(callId)) {
245
- this._pendingCalls.delete(callId);
246
- // Don't reject - some hosts don't respond to initialize
247
- resolve();
248
- }
249
- }, 5000);
250
- });
251
- }
252
- /**
253
- * Current tool output data
254
- */
255
- get toolOutput() {
256
- return this._toolOutput;
257
- }
258
- /**
259
- * Current tool input
260
- */
261
- get toolInput() {
262
- return this._toolInput;
263
- }
264
- /**
265
- * Widget state
266
- */
267
- get widgetState() {
268
- return this._widgetState;
269
- }
270
- /**
271
- * Set widget state
272
- */
273
- setWidgetState(state) {
274
- this._widgetState = state;
275
- this._postToHost({ type: 'photon:set-state', state });
276
- }
277
- /**
278
- * Current theme
279
- */
280
- get theme() {
281
- return this._theme;
282
- }
283
- /**
284
- * Current locale
285
- */
286
- get locale() {
287
- return this._locale;
288
- }
289
- /**
290
- * Host context from initialization
291
- */
292
- get hostContext() {
293
- return this._hostContext;
294
- }
295
- /**
296
- * Register result handler
297
- */
298
- onResult(cb) {
299
- this._resultListeners.push(cb);
300
- return () => {
301
- const idx = this._resultListeners.indexOf(cb);
302
- if (idx >= 0)
303
- this._resultListeners.splice(idx, 1);
304
- };
305
- }
306
- /**
307
- * Register theme change handler
308
- */
309
- onThemeChange(cb) {
310
- this._themeListeners.push(cb);
311
- return () => {
312
- const idx = this._themeListeners.indexOf(cb);
313
- if (idx >= 0)
314
- this._themeListeners.splice(idx, 1);
315
- };
316
- }
317
- /**
318
- * Register progress notification handler
319
- */
320
- onProgress(cb) {
321
- this._progressListeners.push(cb);
322
- return () => {
323
- const idx = this._progressListeners.indexOf(cb);
324
- if (idx >= 0)
325
- this._progressListeners.splice(idx, 1);
326
- };
327
- }
328
- /**
329
- * Register status notification handler
330
- */
331
- onStatus(cb) {
332
- this._statusListeners.push(cb);
333
- return () => {
334
- const idx = this._statusListeners.indexOf(cb);
335
- if (idx >= 0)
336
- this._statusListeners.splice(idx, 1);
337
- };
338
- }
339
- /**
340
- * Register stream notification handler
341
- */
342
- onStream(cb) {
343
- this._streamListeners.push(cb);
344
- return () => {
345
- const idx = this._streamListeners.indexOf(cb);
346
- if (idx >= 0)
347
- this._streamListeners.splice(idx, 1);
348
- };
349
- }
350
- /**
351
- * Register emit notification handler
352
- */
353
- onEmit(cb) {
354
- this._emitListeners.push(cb);
355
- return () => {
356
- const idx = this._emitListeners.indexOf(cb);
357
- if (idx >= 0)
358
- this._emitListeners.splice(idx, 1);
359
- };
360
- }
361
- /**
362
- * Call a tool on the server
363
- */
364
- async invoke(name, args) {
365
- const callId = this._generateCallId();
366
- return new Promise((resolve, reject) => {
367
- this._pendingCalls.set(callId, { resolve, reject });
368
- this._postToHost({
369
- jsonrpc: '2.0',
370
- id: callId,
371
- method: 'tools/call',
372
- params: { name, arguments: args || {} },
373
- });
374
- // Timeout after 30 seconds
375
- setTimeout(() => {
376
- if (this._pendingCalls.has(callId)) {
377
- this._pendingCalls.delete(callId);
378
- reject(new Error('Tool call timeout'));
379
- }
380
- }, 30000);
381
- });
382
- }
383
- /**
384
- * Alias for invoke (compatibility)
385
- */
386
- callTool(name, args) {
387
- return this.invoke(name, args);
388
- }
389
- /**
390
- * Send size change notification to host
391
- */
392
- sendSizeChanged(size) {
393
- this._postToHost({
394
- jsonrpc: '2.0',
395
- method: 'ui/notifications/size-changed',
396
- params: size,
397
- });
398
- }
399
- /**
400
- * Parse size constraints from meta tag
401
- */
402
- static parseSizeMeta() {
403
- const meta = document.querySelector('meta[name="mcp:ui-size"]');
404
- if (!meta)
405
- return {};
406
- const content = meta.getAttribute('content') || '';
407
- const constraints = {};
408
- const pairs = content.split(';');
409
- for (const pair of pairs) {
410
- const [key, value] = pair.split('=');
411
- if (key && value) {
412
- const numValue = parseInt(value, 10);
413
- if (!isNaN(numValue)) {
414
- if (key === 'minWidth')
415
- constraints.minWidth = numValue;
416
- if (key === 'minHeight')
417
- constraints.minHeight = numValue;
418
- if (key === 'maxWidth')
419
- constraints.maxWidth = numValue;
420
- if (key === 'maxHeight')
421
- constraints.maxHeight = numValue;
422
- }
423
- }
424
- }
425
- return constraints;
426
- }
427
- /**
428
- * Set up automatic size reporting with ResizeObserver
429
- */
430
- setupAutoResize(target) {
431
- const element = target || document.body;
432
- const constraints = PhotonApp.parseSizeMeta();
433
- // Get host constraints if available
434
- const hostMaxWidth = this._hostContext?.containerDimensions?.maxWidth;
435
- const hostMaxHeight = this._hostContext?.containerDimensions?.maxHeight;
436
- const observer = new ResizeObserver(() => {
437
- let width = element.scrollWidth;
438
- let height = element.scrollHeight;
439
- // Apply declared minimums
440
- if (constraints.minWidth)
441
- width = Math.max(width, constraints.minWidth);
442
- if (constraints.minHeight)
443
- height = Math.max(height, constraints.minHeight);
444
- // Apply host maximums
445
- if (hostMaxWidth)
446
- width = Math.min(width, hostMaxWidth);
447
- if (hostMaxHeight)
448
- height = Math.min(height, hostMaxHeight);
449
- // Apply declared maximums
450
- if (constraints.maxWidth)
451
- width = Math.min(width, constraints.maxWidth);
452
- if (constraints.maxHeight)
453
- height = Math.min(height, constraints.maxHeight);
454
- this.sendSizeChanged({ width, height });
455
- });
456
- observer.observe(element);
457
- return () => observer.disconnect();
458
- }
459
- }
460
- //# sourceMappingURL=photon-app.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"photon-app.js","sourceRoot":"","sources":["../../../src/auto-ui/bridge/photon-app.ts"],"names":[],"mappings":"AA2BA;;;;;GAKG;AACH,MAAM,OAAO,SAAS;IACZ,KAAK,CAAS;IACd,WAAW,GAAQ,IAAI,CAAC;IACxB,UAAU,GAA4B,EAAE,CAAC;IACzC,YAAY,GAAY,EAAE,CAAC;IAC3B,MAAM,GAAqB,MAAM,CAAC;IAClC,OAAO,GAAW,OAAO,CAAC;IAC1B,YAAY,GAAQ,IAAI,CAAC;IACzB,aAAa,GAAG,IAAI,GAAG,EAAqE,CAAC;IAC7F,cAAc,GAAG,CAAC,CAAC;IAE3B,kBAAkB;IACV,gBAAgB,GAAoB,EAAE,CAAC;IACvC,eAAe,GAAiC,EAAE,CAAC;IACnD,kBAAkB,GAAqC,EAAE,CAAC;IAC1D,gBAAgB,GAAmC,EAAE,CAAC;IACtD,gBAAgB,GAAmC,EAAE,CAAC;IACtD,cAAc,GAAiC,EAAE,CAAC;IAE1D,YAAY,IAAY;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACK,oBAAoB;QAC1B,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YAC3C,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC;YACvB,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;gBAAE,OAAO;YAE5C,+BAA+B;YAC/B,IAAI,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;gBAC1B,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;gBAChC,OAAO;YACT,CAAC;YAED,4DAA4D;YAC5D,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MCP
3
- *
4
- * Exposes Photon daemon features (pub/sub, locks, scheduled jobs) as MCP tools.
5
- * Beam acts as a bridge between MCP clients and the daemon IPC protocol.
6
- *
7
- * Architecture:
8
- * MCP Client (Claude) ←→ Beam (MCP Server) ←→ Daemon (IPC)
9
- */
10
- /**
11
- * Tool definitions for MCP tools/list
12
- */
13
- export interface DaemonToolDefinition {
14
- name: string;
15
- description: string;
16
- inputSchema: {
17
- type: 'object';
18
- properties: Record<string, unknown>;
19
- required?: string[];
20
- };
21
- }
22
- export declare const DAEMON_TOOLS: DaemonToolDefinition[];
23
- /**
24
- * Handle daemon tool calls
25
- */
26
- export declare function handleDaemonTool(toolName: string, args: Record<string, unknown>, sessionId: string, sendNotification: (method: string, params: unknown) => void, workingDir?: string): Promise<{
27
- content: Array<{
28
- type: string;
29
- text: string;
30
- }>;
31
- isError?: boolean;
32
- }>;
33
- /**
34
- * Check if a tool name is a daemon tool
35
- */
36
- export declare function isDaemonTool(toolName: string): boolean;
37
- /**
38
- * Clean up subscriptions when MCP session ends
39
- */
40
- export declare function cleanupDaemonSession(sessionId: string): void;
41
- /**
42
- * Get all daemon tool definitions
43
- */
44
- export declare function getDaemonTools(): DaemonToolDefinition[];
45
- //# sourceMappingURL=daemon-tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"daemon-tools.d.ts","sourceRoot":"","sources":["../../src/auto-ui/daemon-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsBH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH;AAcD,eAAO,MAAM,YAAY,EAAE,oBAAoB,EAwM9C,CAAC;AAwJF;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,EAC3D,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA+ShF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAG5D;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,oBAAoB,EAAE,CAEvD"}