@fugood/bricks-project 2.23.0-beta.9 → 2.23.2

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 (118) hide show
  1. package/api/instance.ts +37 -5
  2. package/compile/action-name-map.ts +107 -0
  3. package/compile/index.ts +172 -66
  4. package/compile/util.ts +13 -4
  5. package/package.json +9 -5
  6. package/skills/bricks-project/SKILL.md +32 -0
  7. package/skills/bricks-project/rules/animation.md +159 -0
  8. package/skills/bricks-project/rules/architecture-patterns.md +62 -0
  9. package/skills/bricks-project/rules/automations.md +221 -0
  10. package/skills/bricks-project/rules/buttress.md +153 -0
  11. package/skills/bricks-project/rules/data-calculation.md +208 -0
  12. package/skills/bricks-project/rules/local-sync.md +129 -0
  13. package/skills/bricks-project/rules/media-flow.md +158 -0
  14. package/skills/bricks-project/rules/remote-data-bank.md +196 -0
  15. package/skills/bricks-project/rules/standby-transition.md +124 -0
  16. package/skills/rive-marketplace/SKILL.md +99 -0
  17. package/tools/deploy.ts +74 -12
  18. package/tools/icons/.gitattributes +1 -0
  19. package/tools/icons/fa6pro-glyphmap.json +4686 -0
  20. package/tools/icons/fa6pro-meta.json +26127 -0
  21. package/tools/mcp-server.ts +818 -9
  22. package/tools/postinstall.ts +75 -13
  23. package/tools/preview-main.mjs +54 -4
  24. package/tools/preview.ts +54 -7
  25. package/tools/pull.ts +37 -16
  26. package/types/automation.ts +232 -0
  27. package/types/brick-base.ts +1 -0
  28. package/types/bricks/Camera.ts +26 -10
  29. package/types/bricks/Chart.ts +1 -0
  30. package/types/bricks/GenerativeMedia.ts +21 -3
  31. package/types/bricks/Icon.ts +1 -0
  32. package/types/bricks/Image.ts +6 -0
  33. package/types/bricks/Items.ts +1 -0
  34. package/types/bricks/Lottie.ts +1 -0
  35. package/types/bricks/Maps.ts +254 -0
  36. package/types/bricks/QrCode.ts +1 -0
  37. package/types/bricks/Rect.ts +1 -0
  38. package/types/bricks/RichText.ts +1 -0
  39. package/types/bricks/Rive.ts +1 -0
  40. package/types/bricks/Slideshow.ts +1 -0
  41. package/types/bricks/Svg.ts +1 -0
  42. package/types/bricks/Text.ts +1 -0
  43. package/types/bricks/TextInput.ts +1 -0
  44. package/types/bricks/Video.ts +1 -0
  45. package/types/bricks/VideoStreaming.ts +1 -0
  46. package/types/bricks/WebRtcStream.ts +1 -0
  47. package/types/bricks/WebView.ts +8 -1
  48. package/types/bricks/index.ts +2 -0
  49. package/types/canvas.ts +1 -0
  50. package/types/common.ts +2 -0
  51. package/types/data-calc-command.ts +7003 -0
  52. package/types/data-calc-script.ts +21 -0
  53. package/types/data-calc.ts +3 -6977
  54. package/types/data.ts +3 -0
  55. package/types/generators/AlarmClock.ts +2 -0
  56. package/types/generators/Assistant.ts +30 -6
  57. package/types/generators/BleCentral.ts +2 -0
  58. package/types/generators/BlePeripheral.ts +2 -0
  59. package/types/generators/CanvasMap.ts +2 -0
  60. package/types/generators/CastlesPay.ts +2 -0
  61. package/types/generators/DataBank.ts +2 -0
  62. package/types/generators/File.ts +2 -0
  63. package/types/generators/GraphQl.ts +2 -0
  64. package/types/generators/Http.ts +84 -2
  65. package/types/generators/HttpServer.ts +5 -1
  66. package/types/generators/Information.ts +2 -0
  67. package/types/generators/Intent.ts +51 -0
  68. package/types/generators/Iterator.ts +11 -2
  69. package/types/generators/Keyboard.ts +2 -0
  70. package/types/generators/LlmAnthropicCompat.ts +2 -0
  71. package/types/generators/LlmAppleBuiltin.ts +144 -0
  72. package/types/generators/LlmGgml.ts +28 -4
  73. package/types/generators/LlmOnnx.ts +2 -0
  74. package/types/generators/LlmOpenAiCompat.ts +2 -0
  75. package/types/generators/LlmQualcommAiEngine.ts +2 -0
  76. package/types/generators/Mcp.ts +6 -4
  77. package/types/generators/McpServer.ts +8 -6
  78. package/types/generators/MediaFlow.ts +2 -0
  79. package/types/generators/MqttBroker.ts +2 -0
  80. package/types/generators/MqttClient.ts +2 -0
  81. package/types/generators/Question.ts +9 -0
  82. package/types/generators/RealtimeTranscription.ts +18 -8
  83. package/types/generators/RerankerGgml.ts +23 -16
  84. package/types/generators/SerialPort.ts +2 -0
  85. package/types/generators/SoundPlayer.ts +2 -0
  86. package/types/generators/SoundRecorder.ts +2 -0
  87. package/types/generators/SpeechToTextGgml.ts +19 -4
  88. package/types/generators/SpeechToTextOnnx.ts +2 -0
  89. package/types/generators/SpeechToTextPlatform.ts +2 -0
  90. package/types/generators/SqLite.ts +32 -1
  91. package/types/generators/Step.ts +2 -0
  92. package/types/generators/SttAppleBuiltin.ts +117 -0
  93. package/types/generators/Tcp.ts +2 -0
  94. package/types/generators/TcpServer.ts +5 -1
  95. package/types/generators/TextToSpeechApple.ts +113 -0
  96. package/types/generators/TextToSpeechAppleBuiltin.ts +114 -0
  97. package/types/generators/TextToSpeechGgml.ts +24 -3
  98. package/types/generators/TextToSpeechOnnx.ts +2 -0
  99. package/types/generators/TextToSpeechOpenAiLike.ts +2 -0
  100. package/types/generators/ThermalPrinter.ts +2 -0
  101. package/types/generators/Tick.ts +5 -1
  102. package/types/generators/TtsAppleBuiltin.ts +105 -0
  103. package/types/generators/Udp.ts +2 -0
  104. package/types/generators/VadGgml.ts +4 -2
  105. package/types/generators/VadOnnx.ts +201 -0
  106. package/types/generators/VadTraditional.ts +123 -0
  107. package/types/generators/VectorStore.ts +15 -2
  108. package/types/generators/Watchdog.ts +2 -0
  109. package/types/generators/WebCrawler.ts +2 -0
  110. package/types/generators/WebRtc.ts +4 -2
  111. package/types/generators/WebSocket.ts +2 -0
  112. package/types/generators/index.ts +5 -0
  113. package/types/index.ts +3 -0
  114. package/types/system.ts +48 -6
  115. package/utils/calc.ts +15 -9
  116. package/utils/data.ts +1 -0
  117. package/utils/event-props.ts +112 -2
  118. package/utils/id.ts +3 -1
package/types/data.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /* Auto generated by build script */
1
2
  import type { SubspaceID, EventAction, LocalSyncStrategy } from './common'
2
3
 
3
4
  interface DataDef {
@@ -31,6 +32,8 @@ export type Data<T = any> = DataDef & {
31
32
  localSyncUpdateMode?: LocalSyncStrategy
32
33
  type: 'string' | 'number' | 'bool' | 'array' | 'object' | 'any'
33
34
  schema?: object
35
+ hit_equal?: any
36
+ hit_regex?: string
34
37
  kind?:
35
38
  | {
36
39
  type: 'id'
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -411,7 +413,10 @@ Default property:
411
413
  "sttEnabled": true,
412
414
  "sttLivePolicy": "only-in-use",
413
415
  "ttsEnabled": false,
414
- "ttsLivePolicy": "only-in-use"
416
+ "ttsLivePolicy": "only-in-use",
417
+ "mcpResourceAnnotationEnabled": false,
418
+ "mcpResourceAnnotationKeyword": "@resource:",
419
+ "mcpResourceAnnotationFallback": ""
415
420
  }
416
421
  */
417
422
  property?: {
@@ -430,7 +435,7 @@ Default property:
430
435
  /* Whether to cache messages */
431
436
  cacheMessages?: boolean | DataLink
432
437
  /* LLM Generator (Supports `LLM (GGML)` and `OpenAI LLM` generators) */
433
- llmGeneratorId?: string | DataLink
438
+ llmGeneratorId?: string | DataLink | (() => Generator)
434
439
  /* LLM Live Policy. If the policy is `only-in-use`, the LLM context will be released when the assistant is not in use.
435
440
 
436
441
  Note: LLM (Qualcomm AI Engine) recommend use `manual` and loaded constantly. */
@@ -453,10 +458,13 @@ Default property:
453
458
  | DataLink
454
459
  /* Summary Session Key (Custom session key for summarization) */
455
460
  llmSummarySessionKey?: string | DataLink
461
+ /* Generate fallback content for tool calls when LLM returns tool calls without text content. When enabled, creates a message like "Call:
462
+ functionName(args)" to keep the conversation readable. */
463
+ llmToolCallFallbackContent?: boolean | DataLink
456
464
  /* File Search (Vector Store) Enabled */
457
465
  fileSearchEnabled?: boolean | DataLink
458
466
  /* File Search (Vector Store) Generator */
459
- fileSearchGeneratorId?: string | DataLink
467
+ fileSearchGeneratorId?: string | DataLink | (() => Generator)
460
468
  /* File Search (Vector Store) Live Policy. If the policy is `only-in-use`, the File Search (Vector Store) context will be released when the assistant is not in use. */
461
469
  fileSearchLivePolicy?: 'only-in-use' | 'manual' | DataLink
462
470
  /* File Search Citation Count. (Default: 3) */
@@ -466,13 +474,13 @@ Default property:
466
474
  /* File Search Ignore Threshold. (Default: false) */
467
475
  fileSearchIgnoreThreshold?: boolean | DataLink
468
476
  /* STT Generator use for transcribing audio message (Supports `STT (GGML)` generators) */
469
- sttGeneratorId?: string | DataLink
477
+ sttGeneratorId?: string | DataLink | (() => Generator)
470
478
  /* STT Enabled */
471
479
  sttEnabled?: boolean | DataLink
472
480
  /* STT Live Policy. If the policy is `only-in-use`, the STT context will be released when the assistant is not in use. */
473
481
  sttLivePolicy?: 'only-in-use' | 'manual' | DataLink
474
482
  /* TTS Generator use for generating LLM response audio message (Supports `TTS (ONNX)` and `OpenAI TTS` generators) */
475
- ttsGeneratorId?: string | DataLink
483
+ ttsGeneratorId?: string | DataLink | (() => Generator)
476
484
  /* TTS Enabled */
477
485
  ttsEnabled?: boolean | DataLink
478
486
  /* TTS Live Policy. If the policy is `only-in-use`, the TTS context will be released when the assistant is not in use. */
@@ -482,13 +490,23 @@ Default property:
482
490
  | Array<
483
491
  | DataLink
484
492
  | {
485
- generatorId?: string | DataLink
493
+ generatorId?: string | DataLink | (() => Generator)
486
494
  generatorKey?: string | DataLink
487
495
  name?: string | DataLink
488
496
  enabled?: boolean | DataLink
497
+ includeTools?: Array<string | DataLink> | DataLink
498
+ excludeTools?: Array<string | DataLink> | DataLink
499
+ blockTools?: Array<string | DataLink> | DataLink
500
+ blockToolMessage?: string | DataLink
489
501
  }
490
502
  >
491
503
  | DataLink
504
+ /* Enable MCP resource annotation in messages. When enabled, users can use keyboard shortcuts to include MCP resources using the format: @resource:<server-name>:<resource-uri> */
505
+ mcpResourceAnnotationEnabled?: boolean | DataLink
506
+ /* MCP resource annotation keyword (Default: @resource:) */
507
+ mcpResourceAnnotationKeyword?: string | DataLink
508
+ /* Fallback text when MCP server or resource is not found. If empty, an error will be thrown. */
509
+ mcpResourceAnnotationFallback?: string | DataLink
492
510
  }
493
511
  events?: {
494
512
  /* Error event */
@@ -497,6 +515,12 @@ Default property:
497
515
  onLogs?: Array<EventAction>
498
516
  /* Messages update event */
499
517
  onMessagesUpdate?: Array<EventAction>
518
+ /* Heatup finished event */
519
+ onHeatupFinished?: Array<EventAction>
520
+ /* Generating event (triggered when assistant starts generating response) */
521
+ onGenerating?: Array<EventAction>
522
+ /* Finished event (triggered when assistant finishes generating response) */
523
+ onFinished?: Array<EventAction>
500
524
  }
501
525
  outlets?: {
502
526
  /* Whether the assistant is heating up */
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -10,8 +12,86 @@ import type {
10
12
  } from '../common'
11
13
 
12
14
  /* Run HTTP request with defined properties */
13
- export type GeneratorHTTPActionRunRequest = Action & {
15
+ export type GeneratorHTTPActionRunRequest = ActionWithParams & {
14
16
  __actionName: 'GENERATOR_HTTP_RUN_REQUEST'
17
+ params?: Array<
18
+ | {
19
+ input: 'url'
20
+ value?: string | DataLink | EventProperty
21
+ mapping?: string
22
+ }
23
+ | {
24
+ input: 'method'
25
+ value?:
26
+ | 'GET'
27
+ | 'POST'
28
+ | 'PUT'
29
+ | 'DELETE'
30
+ | 'HEAD'
31
+ | 'PATCH'
32
+ | 'OPTIONS'
33
+ | 'CONNECT'
34
+ | 'TRACE'
35
+ | DataLink
36
+ | EventProperty
37
+ mapping?: string
38
+ }
39
+ | {
40
+ input: 'headers'
41
+ value?: {} | DataLink | EventProperty
42
+ mapping?: string
43
+ }
44
+ | {
45
+ input: 'body'
46
+ value?: {} | DataLink | EventProperty
47
+ mapping?: string
48
+ }
49
+ | {
50
+ input: 'timeout'
51
+ value?: number | DataLink | EventProperty
52
+ mapping?: string
53
+ }
54
+ | {
55
+ input: 'mode'
56
+ value?: 'same-origin' | 'no-cors' | 'cors' | DataLink | EventProperty
57
+ mapping?: string
58
+ }
59
+ | {
60
+ input: 'credentials'
61
+ value?: 'include' | 'same-origin' | 'omit' | DataLink | EventProperty
62
+ mapping?: string
63
+ }
64
+ | {
65
+ input: 'redirect'
66
+ value?: 'manual' | 'follow' | 'error' | DataLink | EventProperty
67
+ mapping?: string
68
+ }
69
+ | {
70
+ input: 'referrer'
71
+ value?: 'no-referrer' | 'client' | DataLink | EventProperty
72
+ mapping?: string
73
+ }
74
+ | {
75
+ input: 'resType'
76
+ value?: 'json' | 'text' | 'xml' | 'csv' | DataLink | EventProperty
77
+ mapping?: string
78
+ }
79
+ | {
80
+ input: 'resSelector'
81
+ value?: string | DataLink | EventProperty
82
+ mapping?: string
83
+ }
84
+ | {
85
+ input: 'eventStream'
86
+ value?: boolean | DataLink | EventProperty
87
+ mapping?: string
88
+ }
89
+ | {
90
+ input: 'eventName'
91
+ value?: string | DataLink | EventProperty
92
+ mapping?: string
93
+ }
94
+ >
15
95
  }
16
96
 
17
97
  /* Abort HTTP request or SSE */
@@ -63,9 +143,11 @@ Default property:
63
143
  referrer?: 'no-referrer' | 'client' | DataLink
64
144
  /* HTTP request body, it will transform depends on `headers.Content-Type` (`application/json`, `application/x-www-form-urlencoded` or `multipart/form-data`)
65
145
  The multipart schema like `{ file: { uri: File, type: File MIME, name: File Name }, field: "value" }` */
66
- body?: any
146
+ body?: {} | DataLink
67
147
  /* HTTP response type */
68
148
  resType?: 'json' | 'text' | 'xml' | 'csv' | DataLink
149
+ /* Response selector path to extract specific data from parsed response (e.g., "data.items" for JSON, "root.element" for XML) */
150
+ resSelector?: string | DataLink
69
151
  /* Receive event stream (SSE) */
70
152
  eventStream?: boolean | DataLink
71
153
  /* Event name to listen on SSE */
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -132,6 +134,8 @@ Default property:
132
134
  onError?: Array<EventAction>
133
135
  }
134
136
  outlets?: {
137
+ /* Server is listening */
138
+ isListening?: () => Data
135
139
  /* Query of request */
136
140
  requestQuery?: () => Data
137
141
  /* Body of request */
@@ -155,7 +159,7 @@ export type GeneratorHTTPServer = Generator &
155
159
  | SwitchCondData
156
160
  | {
157
161
  __typename: 'SwitchCondInnerStateOutlet'
158
- outlet: 'requestQuery' | 'requestBody' | 'clientAddress'
162
+ outlet: 'isListening' | 'requestQuery' | 'requestBody' | 'clientAddress'
159
163
  value: any
160
164
  }
161
165
  }>
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -51,6 +53,53 @@ export type GeneratorIntentActionSendIntent = ActionWithParams & {
51
53
  >
52
54
  }
53
55
 
56
+ /* Start intent service */
57
+ export type GeneratorIntentActionStartService = ActionWithParams & {
58
+ __actionName: 'GENERATOR_INTENT_START_SERVICE'
59
+ params?: Array<
60
+ | {
61
+ input: 'action'
62
+ value?: string | DataLink | EventProperty
63
+ mapping?: string
64
+ }
65
+ | {
66
+ input: 'data'
67
+ value?: string | DataLink | EventProperty
68
+ mapping?: string
69
+ }
70
+ | {
71
+ input: 'type'
72
+ value?: string | DataLink | EventProperty
73
+ mapping?: string
74
+ }
75
+ | {
76
+ input: 'extra'
77
+ value?: {} | DataLink | EventProperty
78
+ mapping?: string
79
+ }
80
+ | {
81
+ input: 'className'
82
+ value?: string | DataLink | EventProperty
83
+ mapping?: string
84
+ }
85
+ | {
86
+ input: 'packageName'
87
+ value?: string | DataLink | EventProperty
88
+ mapping?: string
89
+ }
90
+ | {
91
+ input: 'category'
92
+ value?: string | DataLink | EventProperty
93
+ mapping?: string
94
+ }
95
+ | {
96
+ input: 'foreground'
97
+ value?: boolean | DataLink | EventProperty
98
+ mapping?: string
99
+ }
100
+ >
101
+ }
102
+
54
103
  interface GeneratorIntentDef {
55
104
  /*
56
105
  Default property:
@@ -71,6 +120,8 @@ Default property:
71
120
  packageName?: string | DataLink
72
121
  /* Intent category */
73
122
  category?: string | DataLink
123
+ /* Intent start foreground service */
124
+ foregroundService?: boolean | DataLink
74
125
  }
75
126
  events?: {
76
127
  /* On intent return a result trigger */
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -19,6 +21,11 @@ export type GeneratorIteratorActionPrevious = Action & {
19
21
  __actionName: 'GENERATOR_ITERATOR_PREVIOUS'
20
22
  }
21
23
 
24
+ /* Jump to the first iteration element */
25
+ export type GeneratorIteratorActionFirst = Action & {
26
+ __actionName: 'GENERATOR_ITERATOR_FIRST'
27
+ }
28
+
22
29
  /* Jump to the last iteration element (ignoring the loop setting) */
23
30
  export type GeneratorIteratorActionLast = Action & {
24
31
  __actionName: 'GENERATOR_ITERATOR_LAST'
@@ -39,13 +46,13 @@ Default property:
39
46
  }
40
47
  */
41
48
  property?: {
42
- /* Data source for iteration. If it's an Array, it will iterate through elements. If it's an Object, it will use Object.values() as data source. If it's a String, it will iterate through characters. If it's a Number, it represents count from 1 to N. */
49
+ /* Data source for iteration. If it's an Array, it will iterate through elements. If it's an Object, it will use Object.entries() to get key-value pairs. If it's a String, it will iterate through characters. If it's a Number, it represents count from 1 to N. */
43
50
  data?: any
44
51
  /* Starting element position */
45
52
  start?: number | DataLink
46
53
  /* Step size for each iteration */
47
54
  step?: number | DataLink
48
- /* Maximum number of iterations (can be set to -1 for unlimited) */
55
+ /* Maximum number of iterations (can be set to -1 for unlimited). When reached, further iteration actions will be silently ignored. */
49
56
  maxQuantity?: number | DataLink
50
57
  /* Whether to loop the iteration */
51
58
  loop?: boolean | DataLink
@@ -57,6 +64,8 @@ Default property:
57
64
  first?: Array<EventAction>
58
65
  /* Event triggered on the last iteration of a round */
59
66
  end?: Array<EventAction>
67
+ /* Event triggered when data type is invalid or unexpected */
68
+ error?: Array<EventAction>
60
69
  }
61
70
  outlets?: {
62
71
  /* Elements that have been iterated (including current one) */
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -0,0 +1,144 @@
1
+ /* Auto generated by build script */
2
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
+ import type { Data, DataLink } from '../data'
4
+ import type {
5
+ Brick,
6
+ Generator,
7
+ EventAction,
8
+ ActionWithDataParams,
9
+ ActionWithParams,
10
+ Action,
11
+ EventProperty,
12
+ } from '../common'
13
+
14
+ /* Load model */
15
+ export type GeneratorAppleLLMActionLoadModel = Action & {
16
+ __actionName: 'GENERATOR_APPLE_LLM_LOAD_MODEL'
17
+ }
18
+
19
+ /* Run text completion */
20
+ export type GeneratorAppleLLMActionCompletion = ActionWithParams & {
21
+ __actionName: 'GENERATOR_APPLE_LLM_COMPLETION'
22
+ params?: Array<
23
+ | {
24
+ input: 'messages'
25
+ value?: Array<any> | DataLink | EventProperty
26
+ mapping?: string
27
+ }
28
+ | {
29
+ input: 'maxTokens'
30
+ value?: number | DataLink | EventProperty
31
+ mapping?: string
32
+ }
33
+ | {
34
+ input: 'temperature'
35
+ value?: number | DataLink | EventProperty
36
+ mapping?: string
37
+ }
38
+ | {
39
+ input: 'topP'
40
+ value?: number | DataLink | EventProperty
41
+ mapping?: string
42
+ }
43
+ >
44
+ }
45
+
46
+ /* Stop text completion */
47
+ export type GeneratorAppleLLMActionStopCompletion = Action & {
48
+ __actionName: 'GENERATOR_APPLE_LLM_STOP_COMPLETION'
49
+ }
50
+
51
+ interface GeneratorAppleLLMDef {
52
+ /*
53
+ Default property:
54
+ {
55
+ "init": false,
56
+ "completionMessages": [
57
+ {
58
+ "role": "system",
59
+ "content": "You are a helpful assistant."
60
+ },
61
+ {
62
+ "role": "user",
63
+ "content": "Hello"
64
+ }
65
+ ],
66
+ "completionMaxTokens": 1024,
67
+ "completionTemperature": 0.7,
68
+ "completionTopP": 0.9
69
+ }
70
+ */
71
+ property?: {
72
+ /* Initialize model on generator init */
73
+ init?: boolean | DataLink
74
+ /* Chat messages (if first message has role 'system', it will be used as system prompt) */
75
+ completionMessages?:
76
+ | Array<
77
+ | DataLink
78
+ | {
79
+ role?: string | DataLink
80
+ content?: string | DataLink
81
+ }
82
+ >
83
+ | DataLink
84
+ /* Maximum tokens to generate */
85
+ completionMaxTokens?: number | DataLink
86
+ /* Temperature (0.0 to 1.0) */
87
+ completionTemperature?: number | DataLink
88
+ /* Top P sampling */
89
+ completionTopP?: number | DataLink
90
+ }
91
+ events?: {
92
+ /* Error event */
93
+ onError?: Array<EventAction>
94
+ /* Model loaded event */
95
+ onModelLoaded?: Array<EventAction>
96
+ /* Completion event */
97
+ onCompletion?: Array<EventAction>
98
+ /* Completion finished event */
99
+ onCompletionFinished?: Array<EventAction>
100
+ }
101
+ outlets?: {
102
+ /* Context state outlet */
103
+ contextState?: () => Data
104
+ /* Evaluating outlet */
105
+ isEvaluating?: () => Data
106
+ /* Completion result outlet */
107
+ completionResult?: () => Data
108
+ /* Last token outlet */
109
+ completionLastToken?: () => Data
110
+ }
111
+ }
112
+
113
+ /* LLM inference using Apple Intelligence on iOS/tvOS 26+
114
+
115
+ ## Features
116
+ - Native Apple Intelligence integration
117
+ - No model download required
118
+ - Privacy-focused on-device processing
119
+ - Optimized for Apple Silicon
120
+ - Requires iOS 26+ or tvOS 26+ */
121
+ export type GeneratorAppleLLM = Generator &
122
+ GeneratorAppleLLMDef & {
123
+ templateKey: 'GENERATOR_APPLE_LLM'
124
+ switches: Array<
125
+ SwitchDef &
126
+ GeneratorAppleLLMDef & {
127
+ conds?: Array<{
128
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
129
+ cond:
130
+ | SwitchCondInnerStateCurrentCanvas
131
+ | SwitchCondData
132
+ | {
133
+ __typename: 'SwitchCondInnerStateOutlet'
134
+ outlet:
135
+ | 'contextState'
136
+ | 'isEvaluating'
137
+ | 'completionResult'
138
+ | 'completionLastToken'
139
+ value: any
140
+ }
141
+ }>
142
+ }
143
+ >
144
+ }