@fugood/bricks-project 2.24.0-beta.4 → 2.24.0-beta.40

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 (125) hide show
  1. package/compile/action-name-map.ts +38 -0
  2. package/compile/index.ts +429 -160
  3. package/compile/util.ts +2 -0
  4. package/package.json +7 -3
  5. package/package.json.bak +27 -0
  6. package/skills/bricks-design/LICENSE.txt +180 -0
  7. package/skills/bricks-design/SKILL.md +66 -0
  8. package/skills/bricks-project/SKILL.md +2 -2
  9. package/skills/bricks-project/rules/animation.md +1 -1
  10. package/skills/bricks-project/rules/architecture-patterns.md +7 -0
  11. package/skills/bricks-project/rules/automations.md +74 -28
  12. package/skills/bricks-project/rules/buttress.md +10 -7
  13. package/skills/bricks-project/rules/data-calculation.md +1 -1
  14. package/skills/bricks-project/rules/local-sync.md +2 -2
  15. package/skills/bricks-project/rules/media-flow.md +3 -3
  16. package/skills/bricks-project/rules/remote-data-bank.md +6 -6
  17. package/skills/bricks-project/rules/standby-transition.md +1 -1
  18. package/tools/deploy.ts +66 -12
  19. package/tools/icons/fa6pro-meta.json +3669 -26125
  20. package/tools/mcp-server.ts +11 -878
  21. package/tools/mcp-tools/compile.ts +91 -0
  22. package/tools/mcp-tools/huggingface.ts +762 -0
  23. package/tools/mcp-tools/icons.ts +70 -0
  24. package/tools/mcp-tools/lottie.ts +102 -0
  25. package/tools/mcp-tools/media.ts +110 -0
  26. package/tools/postinstall.ts +137 -40
  27. package/tools/preview-main.mjs +146 -9
  28. package/tools/preview.ts +30 -2
  29. package/tools/pull.ts +37 -19
  30. package/tsconfig.json +16 -0
  31. package/types/animation.ts +4 -0
  32. package/types/automation.ts +4 -1
  33. package/types/brick-base.ts +1 -1
  34. package/types/bricks/Camera.ts +48 -13
  35. package/types/bricks/Chart.ts +10 -4
  36. package/types/bricks/GenerativeMedia.ts +30 -14
  37. package/types/bricks/Icon.ts +9 -5
  38. package/types/bricks/Image.ts +10 -6
  39. package/types/bricks/Items.ts +29 -15
  40. package/types/bricks/Lottie.ts +15 -7
  41. package/types/bricks/Maps.ts +16 -8
  42. package/types/bricks/QrCode.ts +9 -5
  43. package/types/bricks/Rect.ts +45 -6
  44. package/types/bricks/RichText.ts +9 -5
  45. package/types/bricks/Rive.ts +21 -11
  46. package/types/bricks/Slideshow.ts +20 -10
  47. package/types/bricks/Svg.ts +8 -4
  48. package/types/bricks/Text.ts +9 -5
  49. package/types/bricks/TextInput.ts +23 -13
  50. package/types/bricks/Video.ts +11 -7
  51. package/types/bricks/VideoStreaming.ts +8 -4
  52. package/types/bricks/WebRtcStream.ts +7 -3
  53. package/types/bricks/WebView.ts +12 -8
  54. package/types/canvas.ts +4 -2
  55. package/types/common.ts +19 -12
  56. package/types/data-calc-command.ts +2 -0
  57. package/types/data-calc.ts +1 -0
  58. package/types/data.ts +2 -0
  59. package/types/generators/AlarmClock.ts +17 -11
  60. package/types/generators/Assistant.ts +69 -18
  61. package/types/generators/BleCentral.ts +31 -11
  62. package/types/generators/BlePeripheral.ts +11 -7
  63. package/types/generators/CanvasMap.ts +10 -6
  64. package/types/generators/CastlesPay.ts +15 -7
  65. package/types/generators/DataBank.ts +44 -9
  66. package/types/generators/File.ts +109 -30
  67. package/types/generators/GraphQl.ts +12 -6
  68. package/types/generators/Http.ts +33 -10
  69. package/types/generators/HttpServer.ts +23 -15
  70. package/types/generators/Information.ts +9 -5
  71. package/types/generators/Intent.ts +15 -5
  72. package/types/generators/Iterator.ts +15 -11
  73. package/types/generators/Keyboard.ts +27 -13
  74. package/types/generators/LlmAnthropicCompat.ts +33 -11
  75. package/types/generators/LlmAppleBuiltin.ts +25 -10
  76. package/types/generators/LlmGgml.ts +140 -31
  77. package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
  78. package/types/generators/LlmMlx.ts +227 -0
  79. package/types/generators/LlmOnnx.ts +34 -14
  80. package/types/generators/LlmOpenAiCompat.ts +47 -11
  81. package/types/generators/LlmQualcommAiEngine.ts +45 -13
  82. package/types/generators/Mcp.ts +375 -34
  83. package/types/generators/McpServer.ts +58 -19
  84. package/types/generators/MediaFlow.ts +38 -12
  85. package/types/generators/MqttBroker.ts +29 -11
  86. package/types/generators/MqttClient.ts +19 -9
  87. package/types/generators/Question.ts +13 -9
  88. package/types/generators/RealtimeTranscription.ts +108 -19
  89. package/types/generators/RerankerGgml.ts +43 -12
  90. package/types/generators/SerialPort.ts +18 -10
  91. package/types/generators/SoundPlayer.ts +10 -4
  92. package/types/generators/SoundRecorder.ts +24 -9
  93. package/types/generators/SpeechToTextGgml.ts +52 -18
  94. package/types/generators/SpeechToTextOnnx.ts +18 -11
  95. package/types/generators/SpeechToTextPlatform.ts +15 -7
  96. package/types/generators/SqLite.ts +20 -10
  97. package/types/generators/Step.ts +9 -5
  98. package/types/generators/SttAppleBuiltin.ts +22 -9
  99. package/types/generators/Tcp.ts +13 -9
  100. package/types/generators/TcpServer.ts +20 -14
  101. package/types/generators/TextToSpeechAppleBuiltin.ts +21 -8
  102. package/types/generators/TextToSpeechGgml.ts +29 -11
  103. package/types/generators/TextToSpeechOnnx.ts +19 -12
  104. package/types/generators/TextToSpeechOpenAiLike.ts +14 -8
  105. package/types/generators/ThermalPrinter.ts +13 -9
  106. package/types/generators/Tick.ts +11 -7
  107. package/types/generators/Udp.ts +17 -8
  108. package/types/generators/VadGgml.ts +51 -14
  109. package/types/generators/VadOnnx.ts +42 -12
  110. package/types/generators/VadTraditional.ts +28 -13
  111. package/types/generators/VectorStore.ts +33 -12
  112. package/types/generators/Watchdog.ts +19 -10
  113. package/types/generators/WebCrawler.ts +11 -7
  114. package/types/generators/WebRtc.ts +30 -16
  115. package/types/generators/WebSocket.ts +11 -7
  116. package/types/generators/index.ts +2 -0
  117. package/types/subspace.ts +3 -0
  118. package/types/system.ts +1 -1
  119. package/utils/calc.ts +12 -8
  120. package/utils/event-props.ts +833 -1022
  121. package/utils/id.ts +4 -0
  122. package/api/index.ts +0 -1
  123. package/api/instance.ts +0 -213
  124. package/types/generators/TextToSpeechApple.ts +0 -113
  125. package/types/generators/TtsAppleBuiltin.ts +0 -105
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * MCP client connecting to tool servers via Streamable HTTP, SSE, or direct-link to in-app MCP Server generator. Provides tools, resources, and prompts for Assistant
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Connect to MCP server */
15
19
  export type GeneratorMCPActionConnect = Action & {
@@ -189,79 +193,416 @@ Default property:
189
193
  /* On connected */
190
194
  onConnected?: Array<EventAction>
191
195
  /* On connection error */
192
- onConnectionError?: Array<EventAction>
196
+ onConnectionError?: Array<
197
+ EventAction<string & keyof TemplateEventPropsMap['Mcp']['onConnectionError']>
198
+ >
193
199
  /* On disconnected */
194
200
  onDisconnected?: Array<EventAction>
195
201
  /* On list resources */
196
- onListResources?: Array<EventAction>
202
+ onListResources?: Array<
203
+ EventAction<string & keyof TemplateEventPropsMap['Mcp']['onListResources']>
204
+ >
197
205
  /* On list resources error */
198
- onListResourcesError?: Array<EventAction>
206
+ onListResourcesError?: Array<
207
+ EventAction<string & keyof TemplateEventPropsMap['Mcp']['onListResourcesError']>
208
+ >
199
209
  /* On list resource templates */
200
- onListResourceTemplates?: Array<EventAction>
210
+ onListResourceTemplates?: Array<
211
+ EventAction<string & keyof TemplateEventPropsMap['Mcp']['onListResourceTemplates']>
212
+ >
201
213
  /* On list resource templates error */
202
- onListResourceTemplatesError?: Array<EventAction>
214
+ onListResourceTemplatesError?: Array<
215
+ EventAction<string & keyof TemplateEventPropsMap['Mcp']['onListResourceTemplatesError']>
216
+ >
203
217
  /* On read resource */
204
- onReadResource?: Array<EventAction>
218
+ onReadResource?: Array<
219
+ EventAction<string & keyof TemplateEventPropsMap['Mcp']['onReadResource']>
220
+ >
205
221
  /* On read resource error */
206
- onReadResourceError?: Array<EventAction>
222
+ onReadResourceError?: Array<
223
+ EventAction<string & keyof TemplateEventPropsMap['Mcp']['onReadResourceError']>
224
+ >
207
225
  /* On list tools */
208
- onListTools?: Array<EventAction>
226
+ onListTools?: Array<EventAction<string & keyof TemplateEventPropsMap['Mcp']['onListTools']>>
209
227
  /* On list tools error */
210
- onListToolsError?: Array<EventAction>
228
+ onListToolsError?: Array<
229
+ EventAction<string & keyof TemplateEventPropsMap['Mcp']['onListToolsError']>
230
+ >
211
231
  /* On call tool */
212
- onCallTool?: Array<EventAction>
232
+ onCallTool?: Array<EventAction<string & keyof TemplateEventPropsMap['Mcp']['onCallTool']>>
213
233
  /* On call tool error */
214
- onCallToolError?: Array<EventAction>
234
+ onCallToolError?: Array<
235
+ EventAction<string & keyof TemplateEventPropsMap['Mcp']['onCallToolError']>
236
+ >
215
237
  /* On list prompts */
216
- onListPrompts?: Array<EventAction>
238
+ onListPrompts?: Array<EventAction<string & keyof TemplateEventPropsMap['Mcp']['onListPrompts']>>
217
239
  /* On list prompts error */
218
- onListPromptsError?: Array<EventAction>
240
+ onListPromptsError?: Array<
241
+ EventAction<string & keyof TemplateEventPropsMap['Mcp']['onListPromptsError']>
242
+ >
219
243
  /* On get prompt */
220
- onGetPrompt?: Array<EventAction>
244
+ onGetPrompt?: Array<EventAction<string & keyof TemplateEventPropsMap['Mcp']['onGetPrompt']>>
221
245
  /* On get prompt error */
222
- onGetPromptError?: Array<EventAction>
246
+ onGetPromptError?: Array<
247
+ EventAction<string & keyof TemplateEventPropsMap['Mcp']['onGetPromptError']>
248
+ >
223
249
  }
224
250
  outlets?: {
225
251
  /* Connection state */
226
- connectionState?: () => Data
252
+ connectionState?: () => Data<string>
227
253
  /* List resources response */
228
- listResourcesResponse?: () => Data
254
+ listResourcesResponse?: () => Data<{
255
+ id?: string
256
+ response?: {
257
+ resources?: Array<{
258
+ name?: string
259
+ [key: string]: any
260
+ }>
261
+ resourceTemplates?: Array<{
262
+ name?: string
263
+ [key: string]: any
264
+ }>
265
+ contents?: Array<{
266
+ uri?: string
267
+ text?: string
268
+ blob?: string
269
+ mimeType?: string
270
+ [key: string]: any
271
+ }>
272
+ tools?: Array<{
273
+ name?: string
274
+ description?: string
275
+ inputSchema?: { [key: string]: any }
276
+ [key: string]: any
277
+ }>
278
+ content?: Array<{
279
+ type?: string
280
+ text?: string
281
+ [key: string]: any
282
+ }>
283
+ prompts?: Array<{
284
+ name?: string
285
+ [key: string]: any
286
+ }>
287
+ messages?: Array<{
288
+ role?: string
289
+ content?: any
290
+ [key: string]: any
291
+ }>
292
+ [key: string]: any
293
+ }
294
+ [key: string]: any
295
+ }>
229
296
  /* List resources error */
230
- listResourcesError?: () => Data
297
+ listResourcesError?: () => Data<{
298
+ id?: string
299
+ error?: string
300
+ [key: string]: any
301
+ }>
231
302
  /* List resource templates response */
232
- listResourceTemplatesResponse?: () => Data
303
+ listResourceTemplatesResponse?: () => Data<{
304
+ id?: string
305
+ response?: {
306
+ resources?: Array<{
307
+ name?: string
308
+ [key: string]: any
309
+ }>
310
+ resourceTemplates?: Array<{
311
+ name?: string
312
+ [key: string]: any
313
+ }>
314
+ contents?: Array<{
315
+ uri?: string
316
+ text?: string
317
+ blob?: string
318
+ mimeType?: string
319
+ [key: string]: any
320
+ }>
321
+ tools?: Array<{
322
+ name?: string
323
+ description?: string
324
+ inputSchema?: { [key: string]: any }
325
+ [key: string]: any
326
+ }>
327
+ content?: Array<{
328
+ type?: string
329
+ text?: string
330
+ [key: string]: any
331
+ }>
332
+ prompts?: Array<{
333
+ name?: string
334
+ [key: string]: any
335
+ }>
336
+ messages?: Array<{
337
+ role?: string
338
+ content?: any
339
+ [key: string]: any
340
+ }>
341
+ [key: string]: any
342
+ }
343
+ [key: string]: any
344
+ }>
233
345
  /* List resource templates error */
234
- listResourceTemplatesError?: () => Data
346
+ listResourceTemplatesError?: () => Data<{
347
+ id?: string
348
+ error?: string
349
+ [key: string]: any
350
+ }>
235
351
  /* Read resource response */
236
- readResourceResponse?: () => Data
352
+ readResourceResponse?: () => Data<{
353
+ id?: string
354
+ response?: {
355
+ resources?: Array<{
356
+ name?: string
357
+ [key: string]: any
358
+ }>
359
+ resourceTemplates?: Array<{
360
+ name?: string
361
+ [key: string]: any
362
+ }>
363
+ contents?: Array<{
364
+ uri?: string
365
+ text?: string
366
+ blob?: string
367
+ mimeType?: string
368
+ [key: string]: any
369
+ }>
370
+ tools?: Array<{
371
+ name?: string
372
+ description?: string
373
+ inputSchema?: { [key: string]: any }
374
+ [key: string]: any
375
+ }>
376
+ content?: Array<{
377
+ type?: string
378
+ text?: string
379
+ [key: string]: any
380
+ }>
381
+ prompts?: Array<{
382
+ name?: string
383
+ [key: string]: any
384
+ }>
385
+ messages?: Array<{
386
+ role?: string
387
+ content?: any
388
+ [key: string]: any
389
+ }>
390
+ [key: string]: any
391
+ }
392
+ [key: string]: any
393
+ }>
237
394
  /* Read resource error */
238
- readResourceError?: () => Data
395
+ readResourceError?: () => Data<{
396
+ id?: string
397
+ error?: string
398
+ [key: string]: any
399
+ }>
239
400
  /* List tools response */
240
- listToolsResponse?: () => Data
401
+ listToolsResponse?: () => Data<{
402
+ id?: string
403
+ response?: {
404
+ resources?: Array<{
405
+ name?: string
406
+ [key: string]: any
407
+ }>
408
+ resourceTemplates?: Array<{
409
+ name?: string
410
+ [key: string]: any
411
+ }>
412
+ contents?: Array<{
413
+ uri?: string
414
+ text?: string
415
+ blob?: string
416
+ mimeType?: string
417
+ [key: string]: any
418
+ }>
419
+ tools?: Array<{
420
+ name?: string
421
+ description?: string
422
+ inputSchema?: { [key: string]: any }
423
+ [key: string]: any
424
+ }>
425
+ content?: Array<{
426
+ type?: string
427
+ text?: string
428
+ [key: string]: any
429
+ }>
430
+ prompts?: Array<{
431
+ name?: string
432
+ [key: string]: any
433
+ }>
434
+ messages?: Array<{
435
+ role?: string
436
+ content?: any
437
+ [key: string]: any
438
+ }>
439
+ [key: string]: any
440
+ }
441
+ [key: string]: any
442
+ }>
241
443
  /* List tools error */
242
- listToolsError?: () => Data
444
+ listToolsError?: () => Data<{
445
+ id?: string
446
+ error?: string
447
+ [key: string]: any
448
+ }>
243
449
  /* Call tool response */
244
- callToolResponse?: () => Data
450
+ callToolResponse?: () => Data<{
451
+ id?: string
452
+ response?: {
453
+ resources?: Array<{
454
+ name?: string
455
+ [key: string]: any
456
+ }>
457
+ resourceTemplates?: Array<{
458
+ name?: string
459
+ [key: string]: any
460
+ }>
461
+ contents?: Array<{
462
+ uri?: string
463
+ text?: string
464
+ blob?: string
465
+ mimeType?: string
466
+ [key: string]: any
467
+ }>
468
+ tools?: Array<{
469
+ name?: string
470
+ description?: string
471
+ inputSchema?: { [key: string]: any }
472
+ [key: string]: any
473
+ }>
474
+ content?: Array<{
475
+ type?: string
476
+ text?: string
477
+ [key: string]: any
478
+ }>
479
+ prompts?: Array<{
480
+ name?: string
481
+ [key: string]: any
482
+ }>
483
+ messages?: Array<{
484
+ role?: string
485
+ content?: any
486
+ [key: string]: any
487
+ }>
488
+ [key: string]: any
489
+ }
490
+ [key: string]: any
491
+ }>
245
492
  /* Call tool error */
246
- callToolError?: () => Data
493
+ callToolError?: () => Data<{
494
+ id?: string
495
+ error?: string
496
+ [key: string]: any
497
+ }>
247
498
  /* List prompts response */
248
- listPromptsResponse?: () => Data
499
+ listPromptsResponse?: () => Data<{
500
+ id?: string
501
+ response?: {
502
+ resources?: Array<{
503
+ name?: string
504
+ [key: string]: any
505
+ }>
506
+ resourceTemplates?: Array<{
507
+ name?: string
508
+ [key: string]: any
509
+ }>
510
+ contents?: Array<{
511
+ uri?: string
512
+ text?: string
513
+ blob?: string
514
+ mimeType?: string
515
+ [key: string]: any
516
+ }>
517
+ tools?: Array<{
518
+ name?: string
519
+ description?: string
520
+ inputSchema?: { [key: string]: any }
521
+ [key: string]: any
522
+ }>
523
+ content?: Array<{
524
+ type?: string
525
+ text?: string
526
+ [key: string]: any
527
+ }>
528
+ prompts?: Array<{
529
+ name?: string
530
+ [key: string]: any
531
+ }>
532
+ messages?: Array<{
533
+ role?: string
534
+ content?: any
535
+ [key: string]: any
536
+ }>
537
+ [key: string]: any
538
+ }
539
+ [key: string]: any
540
+ }>
249
541
  /* List prompts error */
250
- listPromptsError?: () => Data
542
+ listPromptsError?: () => Data<{
543
+ id?: string
544
+ error?: string
545
+ [key: string]: any
546
+ }>
251
547
  /* Get prompt response */
252
- getPromptResponse?: () => Data
548
+ getPromptResponse?: () => Data<{
549
+ id?: string
550
+ response?: {
551
+ resources?: Array<{
552
+ name?: string
553
+ [key: string]: any
554
+ }>
555
+ resourceTemplates?: Array<{
556
+ name?: string
557
+ [key: string]: any
558
+ }>
559
+ contents?: Array<{
560
+ uri?: string
561
+ text?: string
562
+ blob?: string
563
+ mimeType?: string
564
+ [key: string]: any
565
+ }>
566
+ tools?: Array<{
567
+ name?: string
568
+ description?: string
569
+ inputSchema?: { [key: string]: any }
570
+ [key: string]: any
571
+ }>
572
+ content?: Array<{
573
+ type?: string
574
+ text?: string
575
+ [key: string]: any
576
+ }>
577
+ prompts?: Array<{
578
+ name?: string
579
+ [key: string]: any
580
+ }>
581
+ messages?: Array<{
582
+ role?: string
583
+ content?: any
584
+ [key: string]: any
585
+ }>
586
+ [key: string]: any
587
+ }
588
+ [key: string]: any
589
+ }>
253
590
  /* Request prompt error */
254
- getPromptError?: () => Data
591
+ getPromptError?: () => Data<{
592
+ id?: string
593
+ error?: string
594
+ [key: string]: any
595
+ }>
255
596
  /* Last error */
256
- lastError?: () => Data
597
+ lastError?: () => Data<string>
257
598
  }
258
599
  }
259
600
 
260
- /* Model Context Protocol (MCP) Client, support SSE and Generator MCPServer direct link */
601
+ /* MCP client connecting to tool servers via Streamable HTTP, SSE, or direct-link to in-app MCP Server generator. Provides tools, resources, and prompts for Assistant */
261
602
  export type GeneratorMCP = Generator &
262
603
  GeneratorMCPDef & {
263
604
  templateKey: 'GENERATOR_MCP'
264
- switches: Array<
605
+ switches?: Array<
265
606
  SwitchDef &
266
607
  GeneratorMCPDef & {
267
608
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * MCP server exposing tools, resources (static/detect-data-change/script), and prompts. Supports HTTP listening with Bearer auth or direct-link from in-app MCP client
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Refresh tools and resources, used for case if tools or resources are changed. Note that the current connections will be closed. */
15
19
  export type GeneratorMCPServerActionRefreshResources = Action & {
@@ -47,7 +51,7 @@ Default property:
47
51
  name?: string | DataLink
48
52
  /* Version of the MCP server */
49
53
  version?: string | DataLink
50
- /* Resources
54
+ /* Resources
51
55
  Type:
52
56
  `static`: Return static data
53
57
  `detect-data-change`: Watch data target change to return data,
@@ -93,7 +97,7 @@ Default property:
93
97
  }
94
98
  >
95
99
  | DataLink
96
- /* Tools
100
+ /* Tools
97
101
  Type:
98
102
  `static`: Return static data
99
103
  `detect-data-change`: Watch data target change to return data,
@@ -139,7 +143,7 @@ Default property:
139
143
  }
140
144
  >
141
145
  | DataLink
142
- /* Prompts
146
+ /* Prompts
143
147
  Type:
144
148
  `static`: Return static data
145
149
  `detect-data-change`: Watch data target change to return data,
@@ -190,41 +194,76 @@ Default property:
190
194
  /* Listening of HTTP server */
191
195
  onListening?: Array<EventAction>
192
196
  /* Error of HTTP server */
193
- onError?: Array<EventAction>
197
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['McpServer']['onError']>>
194
198
  /* Client error of HTTP server */
195
- onClientError?: Array<EventAction>
199
+ onClientError?: Array<
200
+ EventAction<string & keyof TemplateEventPropsMap['McpServer']['onClientError']>
201
+ >
196
202
  /* Client close of HTTP server */
197
- onClientClose?: Array<EventAction>
203
+ onClientClose?: Array<
204
+ EventAction<string & keyof TemplateEventPropsMap['McpServer']['onClientClose']>
205
+ >
198
206
  /* On request resource (Request: { name: string, uri: string, params: object }) */
199
- onRequestResource?: Array<EventAction>
207
+ onRequestResource?: Array<
208
+ EventAction<string & keyof TemplateEventPropsMap['McpServer']['onRequestResource']>
209
+ >
200
210
  /* On call tool (Request: { name: string, params: object }) */
201
- onCallTool?: Array<EventAction>
211
+ onCallTool?: Array<EventAction<string & keyof TemplateEventPropsMap['McpServer']['onCallTool']>>
202
212
  /* On get prompt (Request: { name: string, arguments: object }) */
203
- onGetPrompt?: Array<EventAction>
213
+ onGetPrompt?: Array<
214
+ EventAction<string & keyof TemplateEventPropsMap['McpServer']['onGetPrompt']>
215
+ >
204
216
  }
205
217
  outlets?: {
206
218
  /* Whether the HTTP server is listening */
207
- isListening?: () => Data
219
+ isListening?: () => Data<boolean>
208
220
  /* Last error of HTTP server */
209
- lastError?: () => Data
221
+ lastError?: () => Data<string>
210
222
  /* MCP server endpoint URL */
211
- endpoint?: () => Data
223
+ endpoint?: () => Data<string>
212
224
  /* Connected remotes (Session ID) */
213
- connectedRemotes?: () => Data
225
+ connectedRemotes?: () => Data<Array<string>>
214
226
  /* Last resource request ({ name: string, uri: string, params: object }) */
215
- lastResourceRequest?: () => Data
227
+ lastResourceRequest?: () => Data<{
228
+ type?: string
229
+ id?: string
230
+ name?: string
231
+ uri?: string
232
+ params?: { [key: string]: any }
233
+ arguments?: { [key: string]: any }
234
+ timeout?: number
235
+ [key: string]: any
236
+ }>
216
237
  /* Last tool call ({ name: string, params: object }) */
217
- lastToolCall?: () => Data
238
+ lastToolCall?: () => Data<{
239
+ type?: string
240
+ id?: string
241
+ name?: string
242
+ uri?: string
243
+ params?: { [key: string]: any }
244
+ arguments?: { [key: string]: any }
245
+ timeout?: number
246
+ [key: string]: any
247
+ }>
218
248
  /* Last prompt get ({ name: string, arguments: object }) */
219
- lastPromptGet?: () => Data
249
+ lastPromptGet?: () => Data<{
250
+ type?: string
251
+ id?: string
252
+ name?: string
253
+ uri?: string
254
+ params?: { [key: string]: any }
255
+ arguments?: { [key: string]: any }
256
+ timeout?: number
257
+ [key: string]: any
258
+ }>
220
259
  }
221
260
  }
222
261
 
223
- /* Model Context Protocol (MCP) Server (https://docs.anthropic.com/en/docs/agents-and-tools/mcp) */
262
+ /* MCP server exposing tools, resources (static/detect-data-change/script), and prompts. Supports HTTP listening with Bearer auth or direct-link from in-app MCP client */
224
263
  export type GeneratorMCPServer = Generator &
225
264
  GeneratorMCPServerDef & {
226
265
  templateKey: 'GENERATOR_MCP_SERVER'
227
- switches: Array<
266
+ switches?: Array<
228
267
  SwitchDef &
229
268
  GeneratorMCPServerDef & {
230
269
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Fetch box's file list from Media Flow
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Start fetcn Media box file list */
15
19
  export type GeneratorMediaFlowActionFetch = Action & {
@@ -54,7 +58,7 @@ Default property:
54
58
  passcode?: string | DataLink
55
59
  /* Include File Types */
56
60
  includeTypes?: Array<'IMAGE' | 'VIDEO' | 'AUDIO' | 'FILE' | DataLink> | DataLink
57
- /* Determine the cache behavior
61
+ /* Determine the cache behavior
58
62
 
59
63
  cache-first: Cache first if existing, then fetch from network
60
64
  network-and-cache: Fetch from network, then save cache
@@ -87,13 +91,17 @@ Default property:
87
91
  }
88
92
  events?: {
89
93
  /* Event of media box fetch error */
90
- fetchError?: Array<EventAction>
94
+ fetchError?: Array<EventAction<string & keyof TemplateEventPropsMap['MediaFlow']['fetchError']>>
91
95
  /* Event of subscribe box change connected (If set `Subscribe Box Change`) */
92
96
  subscribeBoxConnect?: Array<EventAction>
93
97
  /* Event of subscribe box change error (If set `Subscribe Box Change`) */
94
- subscribeBoxError?: Array<EventAction>
98
+ subscribeBoxError?: Array<
99
+ EventAction<string & keyof TemplateEventPropsMap['MediaFlow']['subscribeBoxError']>
100
+ >
95
101
  /* Event of subscribe box change connection error (If set `Subscribe Box Change`) */
96
- subscribeBoxConnectError?: Array<EventAction>
102
+ subscribeBoxConnectError?: Array<
103
+ EventAction<string & keyof TemplateEventPropsMap['MediaFlow']['subscribeBoxConnectError']>
104
+ >
97
105
  /* Event of file sync completed for used `saveToStorage` */
98
106
  saveStorageCompleted?: Array<EventAction>
99
107
  /* Event when file list size exceed of Load size limit */
@@ -101,17 +109,35 @@ Default property:
101
109
  }
102
110
  outlets?: {
103
111
  /* File sync status */
104
- downloadStatus?: () => Data
112
+ downloadStatus?: () => Data<string>
105
113
  /* File sync progress */
106
- downloadProgress?: () => Data
114
+ downloadProgress?: () => Data<
115
+ Array<{
116
+ key?: string
117
+ progress?: number
118
+ finished?: boolean
119
+ [key: string]: any
120
+ }>
121
+ >
107
122
  /* File sync download errors */
108
- downloadErrors?: () => Data
123
+ downloadErrors?: () => Data<Array<string>>
109
124
  /* Media box info */
110
- box?: () => Data
125
+ box?: () => Data<{ [key: string]: any }>
111
126
  /* Save Media Flow fetch result [ { "url": "https://d1kk0369g9vrck.cloudfront.net/box/5b431e29efd40c01e8b2019c/photo5b431e37efd40c01e8b201d1" "extension": "", // enum("jpg", "png", "mp4") "id": "5b431e37efd40c01e8b201d1", "md5": "6134ab412351651324" // md5 came from media resource api } ] */
112
- result?: () => Data
127
+ result?: () => Data<
128
+ Array<{
129
+ id?: string
130
+ key?: string
131
+ mediaType?: string
132
+ extension?: string
133
+ original?: string
134
+ url?: string
135
+ metadata?: { [key: string]: any }
136
+ [key: string]: any
137
+ }>
138
+ >
113
139
  /* File sync result [ { "url": "/storage/emulated/0/Download/SyncFolder/Asset/1.png", "mediaType": "photo" // enum("photo", "video"), used to distingiush "id": "", } ] */
114
- downloadFileUrls?: () => Data
140
+ downloadFileUrls?: () => Data<Array<string>>
115
141
  }
116
142
  }
117
143
 
@@ -119,7 +145,7 @@ Default property:
119
145
  export type GeneratorMediaFlow = Generator &
120
146
  GeneratorMediaFlowDef & {
121
147
  templateKey: 'GENERATOR_MEDIA_FLOW'
122
- switches: Array<
148
+ switches?: Array<
123
149
  SwitchDef &
124
150
  GeneratorMediaFlowDef & {
125
151
  conds?: Array<{