@fugood/bricks-project 2.23.0-beta.4 → 2.23.0-beta.41
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.
- package/compile/action-name-map.ts +60 -0
- package/compile/index.ts +52 -60
- package/package.json +4 -4
- package/tools/mcp-server.ts +3 -3
- package/tools/postinstall.ts +2 -5
- package/tools/preview.ts +1 -1
- package/tools/pull.ts +1 -1
- package/types/brick-base.ts +1 -0
- package/types/bricks/Camera.ts +1 -0
- package/types/bricks/Chart.ts +1 -0
- package/types/bricks/GenerativeMedia.ts +21 -3
- package/types/bricks/Icon.ts +1 -0
- package/types/bricks/Image.ts +1 -0
- package/types/bricks/Items.ts +1 -0
- package/types/bricks/Lottie.ts +1 -0
- package/types/bricks/QrCode.ts +1 -0
- package/types/bricks/Rect.ts +1 -0
- package/types/bricks/RichText.ts +1 -0
- package/types/bricks/Rive.ts +1 -0
- package/types/bricks/Slideshow.ts +38 -2
- package/types/bricks/Svg.ts +1 -0
- package/types/bricks/Text.ts +1 -0
- package/types/bricks/TextInput.ts +1 -0
- package/types/bricks/Video.ts +1 -0
- package/types/bricks/VideoStreaming.ts +1 -0
- package/types/bricks/WebRtcStream.ts +1 -0
- package/types/bricks/WebView.ts +1 -0
- package/types/bricks/index.ts +1 -0
- package/types/canvas.ts +1 -0
- package/types/data-calc.ts +44 -0
- package/types/data.ts +1 -0
- package/types/generators/AlarmClock.ts +1 -0
- package/types/generators/Assistant.ts +24 -1
- package/types/generators/BleCentral.ts +1 -0
- package/types/generators/BlePeripheral.ts +1 -0
- package/types/generators/CanvasMap.ts +15 -3
- package/types/generators/CastlesPay.ts +1 -0
- package/types/generators/DataBank.ts +1 -0
- package/types/generators/File.ts +1 -0
- package/types/generators/GraphQl.ts +1 -0
- package/types/generators/Http.ts +83 -2
- package/types/generators/HttpServer.ts +4 -1
- package/types/generators/Information.ts +1 -0
- package/types/generators/Intent.ts +50 -0
- package/types/generators/Iterator.ts +10 -2
- package/types/generators/Keyboard.ts +1 -0
- package/types/generators/LlmAnthropicCompat.ts +1 -0
- package/types/generators/LlmAppleBuiltin.ts +143 -0
- package/types/generators/LlmGgml.ts +22 -5
- package/types/generators/LlmOnnx.ts +8 -0
- package/types/generators/LlmOpenAiCompat.ts +1 -0
- package/types/generators/LlmQualcommAiEngine.ts +1 -0
- package/types/generators/Mcp.ts +1 -0
- package/types/generators/McpServer.ts +1 -0
- package/types/generators/MediaFlow.ts +1 -0
- package/types/generators/MqttBroker.ts +1 -0
- package/types/generators/MqttClient.ts +1 -0
- package/types/generators/Question.ts +8 -0
- package/types/generators/RealtimeTranscription.ts +1 -0
- package/types/generators/RerankerGgml.ts +22 -16
- package/types/generators/SerialPort.ts +1 -0
- package/types/generators/SoundPlayer.ts +1 -0
- package/types/generators/SoundRecorder.ts +1 -0
- package/types/generators/SpeechToTextGgml.ts +13 -4
- package/types/generators/SpeechToTextOnnx.ts +1 -0
- package/types/generators/SpeechToTextPlatform.ts +1 -0
- package/types/generators/SqLite.ts +31 -1
- package/types/generators/Step.ts +1 -0
- package/types/generators/SttAppleBuiltin.ts +116 -0
- package/types/generators/Tcp.ts +1 -0
- package/types/generators/TcpServer.ts +4 -1
- package/types/generators/TextToSpeechApple.ts +113 -0
- package/types/generators/TextToSpeechAppleBuiltin.ts +113 -0
- package/types/generators/TextToSpeechGgml.ts +23 -3
- package/types/generators/TextToSpeechOnnx.ts +1 -0
- package/types/generators/TextToSpeechOpenAiLike.ts +1 -0
- package/types/generators/ThermalPrinter.ts +1 -0
- package/types/generators/Tick.ts +4 -1
- package/types/generators/TtsAppleBuiltin.ts +105 -0
- package/types/generators/Udp.ts +1 -0
- package/types/generators/VadGgml.ts +3 -2
- package/types/generators/VectorStore.ts +14 -2
- package/types/generators/Watchdog.ts +1 -0
- package/types/generators/WebCrawler.ts +1 -0
- package/types/generators/WebRtc.ts +1 -0
- package/types/generators/WebSocket.ts +1 -0
- package/types/generators/index.ts +3 -0
- package/types/system.ts +1 -0
- package/utils/data.ts +1 -0
- package/utils/event-props.ts +79 -3
- package/utils/id.ts +3 -1
package/types/bricks/WebView.ts
CHANGED
package/types/bricks/index.ts
CHANGED
package/types/canvas.ts
CHANGED
package/types/data-calc.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* Auto generated by build script */
|
|
1
2
|
import type { Data } from './data'
|
|
2
3
|
|
|
3
4
|
/* DataCalculation has two types: DataCalculationScript and DataCalculationMap */
|
|
@@ -3849,6 +3850,48 @@ export type DataCommandStringTitleCase = DataCommand & {
|
|
|
3849
3850
|
}>
|
|
3850
3851
|
}
|
|
3851
3852
|
|
|
3853
|
+
/*
|
|
3854
|
+
TOON Decode
|
|
3855
|
+
Decode TOON string. Return undefined if decode failed.
|
|
3856
|
+
*/
|
|
3857
|
+
export type DataCommandStringToolDecode = DataCommand & {
|
|
3858
|
+
__commandName: 'STRING_TOOL_DECODE'
|
|
3859
|
+
inputs?: Array<{
|
|
3860
|
+
// Default value: "{}"
|
|
3861
|
+
key: 'subject'
|
|
3862
|
+
source: (() => DataCalculationData | DataCommand) | string
|
|
3863
|
+
sourceKey: string
|
|
3864
|
+
trigger?: boolean
|
|
3865
|
+
}>
|
|
3866
|
+
outputs?: Array<{
|
|
3867
|
+
key: 'result'
|
|
3868
|
+
// target type: any
|
|
3869
|
+
target: () => DataCalculationData | DataCommand
|
|
3870
|
+
targetKey: string
|
|
3871
|
+
}>
|
|
3872
|
+
}
|
|
3873
|
+
|
|
3874
|
+
/*
|
|
3875
|
+
TOON Encode
|
|
3876
|
+
Encode TOON string. Return undefined if encode failed.
|
|
3877
|
+
*/
|
|
3878
|
+
export type DataCommandStringToolEncode = DataCommand & {
|
|
3879
|
+
__commandName: 'STRING_TOOL_ENCODE'
|
|
3880
|
+
inputs?: Array<{
|
|
3881
|
+
// Default value: {}
|
|
3882
|
+
key: 'subject'
|
|
3883
|
+
source: (() => DataCalculationData | DataCommand) | any
|
|
3884
|
+
sourceKey: string
|
|
3885
|
+
trigger?: boolean
|
|
3886
|
+
}>
|
|
3887
|
+
outputs?: Array<{
|
|
3888
|
+
key: 'result'
|
|
3889
|
+
// target type: string
|
|
3890
|
+
target: () => DataCalculationData | DataCommand
|
|
3891
|
+
targetKey: string
|
|
3892
|
+
}>
|
|
3893
|
+
}
|
|
3894
|
+
|
|
3852
3895
|
/*
|
|
3853
3896
|
Trim
|
|
3854
3897
|
Removes whitespaces from left and right sides of the subject.
|
|
@@ -5058,6 +5101,7 @@ export type DataCommandSandboxGetReturnValue = DataCommand & {
|
|
|
5058
5101
|
- coseVerify (cose.sign.verifySync from https://github.com/erdtman/COSE-JS)
|
|
5059
5102
|
- fflate (Not support async, callback and stream)
|
|
5060
5103
|
- iconv (Use iconv-lite)
|
|
5104
|
+
- OpenCC (Use opencc-js)
|
|
5061
5105
|
|
|
5062
5106
|
Android: Running on the sandbox of Hermes engine
|
|
5063
5107
|
|
package/types/data.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
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 {
|
|
@@ -411,7 +412,10 @@ Default property:
|
|
|
411
412
|
"sttEnabled": true,
|
|
412
413
|
"sttLivePolicy": "only-in-use",
|
|
413
414
|
"ttsEnabled": false,
|
|
414
|
-
"ttsLivePolicy": "only-in-use"
|
|
415
|
+
"ttsLivePolicy": "only-in-use",
|
|
416
|
+
"mcpResourceAnnotationEnabled": false,
|
|
417
|
+
"mcpResourceAnnotationKeyword": "@resource:",
|
|
418
|
+
"mcpResourceAnnotationFallback": ""
|
|
415
419
|
}
|
|
416
420
|
*/
|
|
417
421
|
property?: {
|
|
@@ -453,6 +457,9 @@ Default property:
|
|
|
453
457
|
| DataLink
|
|
454
458
|
/* Summary Session Key (Custom session key for summarization) */
|
|
455
459
|
llmSummarySessionKey?: string | DataLink
|
|
460
|
+
/* Generate fallback content for tool calls when LLM returns tool calls without text content. When enabled, creates a message like "Call:
|
|
461
|
+
functionName(args)" to keep the conversation readable. */
|
|
462
|
+
llmToolCallFallbackContent?: boolean | DataLink
|
|
456
463
|
/* File Search (Vector Store) Enabled */
|
|
457
464
|
fileSearchEnabled?: boolean | DataLink
|
|
458
465
|
/* File Search (Vector Store) Generator */
|
|
@@ -486,9 +493,19 @@ Default property:
|
|
|
486
493
|
generatorKey?: string | DataLink
|
|
487
494
|
name?: string | DataLink
|
|
488
495
|
enabled?: boolean | DataLink
|
|
496
|
+
includeTools?: Array<string | DataLink> | DataLink
|
|
497
|
+
excludeTools?: Array<string | DataLink> | DataLink
|
|
498
|
+
blockTools?: Array<string | DataLink> | DataLink
|
|
499
|
+
blockToolMessage?: string | DataLink
|
|
489
500
|
}
|
|
490
501
|
>
|
|
491
502
|
| DataLink
|
|
503
|
+
/* 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> */
|
|
504
|
+
mcpResourceAnnotationEnabled?: boolean | DataLink
|
|
505
|
+
/* MCP resource annotation keyword (Default: @resource:) */
|
|
506
|
+
mcpResourceAnnotationKeyword?: string | DataLink
|
|
507
|
+
/* Fallback text when MCP server or resource is not found. If empty, an error will be thrown. */
|
|
508
|
+
mcpResourceAnnotationFallback?: string | DataLink
|
|
492
509
|
}
|
|
493
510
|
events?: {
|
|
494
511
|
/* Error event */
|
|
@@ -497,6 +514,12 @@ Default property:
|
|
|
497
514
|
onLogs?: Array<EventAction>
|
|
498
515
|
/* Messages update event */
|
|
499
516
|
onMessagesUpdate?: Array<EventAction>
|
|
517
|
+
/* Heatup finished event */
|
|
518
|
+
onHeatupFinished?: Array<EventAction>
|
|
519
|
+
/* Generating event (triggered when assistant starts generating response) */
|
|
520
|
+
onGenerating?: Array<EventAction>
|
|
521
|
+
/* Finished event (triggered when assistant finishes generating response) */
|
|
522
|
+
onFinished?: Array<EventAction>
|
|
500
523
|
}
|
|
501
524
|
outlets?: {
|
|
502
525
|
/* Whether the assistant is heating up */
|
|
@@ -1,3 +1,4 @@
|
|
|
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 {
|
|
@@ -31,10 +32,21 @@ Default property:
|
|
|
31
32
|
>
|
|
32
33
|
| DataLink
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
events?: {
|
|
36
|
+
/* Event triggered when a rule matches and canvas navigation occurs */
|
|
37
|
+
onNavigate?: Array<EventAction>
|
|
38
|
+
}
|
|
39
|
+
outlets?: {
|
|
40
|
+
/* Last matched trigger rule that caused canvas navigation */
|
|
41
|
+
lastMatchedRule?: () => Data
|
|
42
|
+
/* Index of the last matched rule in triggerList */
|
|
43
|
+
lastMatchedIndex?: () => Data
|
|
44
|
+
/* Total count of canvas navigations triggered by this generator */
|
|
45
|
+
navigationCount?: () => Data
|
|
46
|
+
}
|
|
35
47
|
}
|
|
36
48
|
|
|
37
|
-
/* Trigger
|
|
49
|
+
/* Trigger canvas navigation by setup rules */
|
|
38
50
|
export type GeneratorCanvasMap = Generator &
|
|
39
51
|
GeneratorCanvasMapDef & {
|
|
40
52
|
templateKey: 'GENERATOR_CANVAS_MAP'
|
|
@@ -48,7 +60,7 @@ export type GeneratorCanvasMap = Generator &
|
|
|
48
60
|
| SwitchCondData
|
|
49
61
|
| {
|
|
50
62
|
__typename: 'SwitchCondInnerStateOutlet'
|
|
51
|
-
outlet: ''
|
|
63
|
+
outlet: 'lastMatchedRule' | 'lastMatchedIndex' | 'navigationCount'
|
|
52
64
|
value: any
|
|
53
65
|
}
|
|
54
66
|
}>
|
package/types/generators/File.ts
CHANGED
package/types/generators/Http.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
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 {
|
|
@@ -10,8 +11,86 @@ import type {
|
|
|
10
11
|
} from '../common'
|
|
11
12
|
|
|
12
13
|
/* Run HTTP request with defined properties */
|
|
13
|
-
export type GeneratorHTTPActionRunRequest =
|
|
14
|
+
export type GeneratorHTTPActionRunRequest = ActionWithParams & {
|
|
14
15
|
__actionName: 'GENERATOR_HTTP_RUN_REQUEST'
|
|
16
|
+
params?: Array<
|
|
17
|
+
| {
|
|
18
|
+
input: 'url'
|
|
19
|
+
value?: string | DataLink | EventProperty
|
|
20
|
+
mapping?: string
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
input: 'method'
|
|
24
|
+
value?:
|
|
25
|
+
| 'GET'
|
|
26
|
+
| 'POST'
|
|
27
|
+
| 'PUT'
|
|
28
|
+
| 'DELETE'
|
|
29
|
+
| 'HEAD'
|
|
30
|
+
| 'PATCH'
|
|
31
|
+
| 'OPTIONS'
|
|
32
|
+
| 'CONNECT'
|
|
33
|
+
| 'TRACE'
|
|
34
|
+
| DataLink
|
|
35
|
+
| EventProperty
|
|
36
|
+
mapping?: string
|
|
37
|
+
}
|
|
38
|
+
| {
|
|
39
|
+
input: 'headers'
|
|
40
|
+
value?: {} | DataLink | EventProperty
|
|
41
|
+
mapping?: string
|
|
42
|
+
}
|
|
43
|
+
| {
|
|
44
|
+
input: 'body'
|
|
45
|
+
value?: {} | DataLink | EventProperty
|
|
46
|
+
mapping?: string
|
|
47
|
+
}
|
|
48
|
+
| {
|
|
49
|
+
input: 'timeout'
|
|
50
|
+
value?: number | DataLink | EventProperty
|
|
51
|
+
mapping?: string
|
|
52
|
+
}
|
|
53
|
+
| {
|
|
54
|
+
input: 'mode'
|
|
55
|
+
value?: 'same-origin' | 'no-cors' | 'cors' | DataLink | EventProperty
|
|
56
|
+
mapping?: string
|
|
57
|
+
}
|
|
58
|
+
| {
|
|
59
|
+
input: 'credentials'
|
|
60
|
+
value?: 'include' | 'same-origin' | 'omit' | DataLink | EventProperty
|
|
61
|
+
mapping?: string
|
|
62
|
+
}
|
|
63
|
+
| {
|
|
64
|
+
input: 'redirect'
|
|
65
|
+
value?: 'manual' | 'follow' | 'error' | DataLink | EventProperty
|
|
66
|
+
mapping?: string
|
|
67
|
+
}
|
|
68
|
+
| {
|
|
69
|
+
input: 'referrer'
|
|
70
|
+
value?: 'no-referrer' | 'client' | DataLink | EventProperty
|
|
71
|
+
mapping?: string
|
|
72
|
+
}
|
|
73
|
+
| {
|
|
74
|
+
input: 'resType'
|
|
75
|
+
value?: 'json' | 'text' | 'xml' | 'csv' | DataLink | EventProperty
|
|
76
|
+
mapping?: string
|
|
77
|
+
}
|
|
78
|
+
| {
|
|
79
|
+
input: 'resSelector'
|
|
80
|
+
value?: string | DataLink | EventProperty
|
|
81
|
+
mapping?: string
|
|
82
|
+
}
|
|
83
|
+
| {
|
|
84
|
+
input: 'eventStream'
|
|
85
|
+
value?: boolean | DataLink | EventProperty
|
|
86
|
+
mapping?: string
|
|
87
|
+
}
|
|
88
|
+
| {
|
|
89
|
+
input: 'eventName'
|
|
90
|
+
value?: string | DataLink | EventProperty
|
|
91
|
+
mapping?: string
|
|
92
|
+
}
|
|
93
|
+
>
|
|
15
94
|
}
|
|
16
95
|
|
|
17
96
|
/* Abort HTTP request or SSE */
|
|
@@ -63,9 +142,11 @@ Default property:
|
|
|
63
142
|
referrer?: 'no-referrer' | 'client' | DataLink
|
|
64
143
|
/* HTTP request body, it will transform depends on `headers.Content-Type` (`application/json`, `application/x-www-form-urlencoded` or `multipart/form-data`)
|
|
65
144
|
The multipart schema like `{ file: { uri: File, type: File MIME, name: File Name }, field: "value" }` */
|
|
66
|
-
body?:
|
|
145
|
+
body?: {} | DataLink
|
|
67
146
|
/* HTTP response type */
|
|
68
147
|
resType?: 'json' | 'text' | 'xml' | 'csv' | DataLink
|
|
148
|
+
/* Response selector path to extract specific data from parsed response (e.g., "data.items" for JSON, "root.element" for XML) */
|
|
149
|
+
resSelector?: string | DataLink
|
|
69
150
|
/* Receive event stream (SSE) */
|
|
70
151
|
eventStream?: boolean | DataLink
|
|
71
152
|
/* Event name to listen on SSE */
|
|
@@ -1,3 +1,4 @@
|
|
|
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 {
|
|
@@ -132,6 +133,8 @@ Default property:
|
|
|
132
133
|
onError?: Array<EventAction>
|
|
133
134
|
}
|
|
134
135
|
outlets?: {
|
|
136
|
+
/* Server is listening */
|
|
137
|
+
isListening?: () => Data
|
|
135
138
|
/* Query of request */
|
|
136
139
|
requestQuery?: () => Data
|
|
137
140
|
/* Body of request */
|
|
@@ -155,7 +158,7 @@ export type GeneratorHTTPServer = Generator &
|
|
|
155
158
|
| SwitchCondData
|
|
156
159
|
| {
|
|
157
160
|
__typename: 'SwitchCondInnerStateOutlet'
|
|
158
|
-
outlet: 'requestQuery' | 'requestBody' | 'clientAddress'
|
|
161
|
+
outlet: 'isListening' | 'requestQuery' | 'requestBody' | 'clientAddress'
|
|
159
162
|
value: any
|
|
160
163
|
}
|
|
161
164
|
}>
|
|
@@ -1,3 +1,4 @@
|
|
|
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 {
|
|
@@ -51,6 +52,53 @@ export type GeneratorIntentActionSendIntent = ActionWithParams & {
|
|
|
51
52
|
>
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
/* Start intent service */
|
|
56
|
+
export type GeneratorIntentActionStartService = ActionWithParams & {
|
|
57
|
+
__actionName: 'GENERATOR_INTENT_START_SERVICE'
|
|
58
|
+
params?: Array<
|
|
59
|
+
| {
|
|
60
|
+
input: 'action'
|
|
61
|
+
value?: string | DataLink | EventProperty
|
|
62
|
+
mapping?: string
|
|
63
|
+
}
|
|
64
|
+
| {
|
|
65
|
+
input: 'data'
|
|
66
|
+
value?: string | DataLink | EventProperty
|
|
67
|
+
mapping?: string
|
|
68
|
+
}
|
|
69
|
+
| {
|
|
70
|
+
input: 'type'
|
|
71
|
+
value?: string | DataLink | EventProperty
|
|
72
|
+
mapping?: string
|
|
73
|
+
}
|
|
74
|
+
| {
|
|
75
|
+
input: 'extra'
|
|
76
|
+
value?: {} | DataLink | EventProperty
|
|
77
|
+
mapping?: string
|
|
78
|
+
}
|
|
79
|
+
| {
|
|
80
|
+
input: 'className'
|
|
81
|
+
value?: string | DataLink | EventProperty
|
|
82
|
+
mapping?: string
|
|
83
|
+
}
|
|
84
|
+
| {
|
|
85
|
+
input: 'packageName'
|
|
86
|
+
value?: string | DataLink | EventProperty
|
|
87
|
+
mapping?: string
|
|
88
|
+
}
|
|
89
|
+
| {
|
|
90
|
+
input: 'category'
|
|
91
|
+
value?: string | DataLink | EventProperty
|
|
92
|
+
mapping?: string
|
|
93
|
+
}
|
|
94
|
+
| {
|
|
95
|
+
input: 'foreground'
|
|
96
|
+
value?: boolean | DataLink | EventProperty
|
|
97
|
+
mapping?: string
|
|
98
|
+
}
|
|
99
|
+
>
|
|
100
|
+
}
|
|
101
|
+
|
|
54
102
|
interface GeneratorIntentDef {
|
|
55
103
|
/*
|
|
56
104
|
Default property:
|
|
@@ -71,6 +119,8 @@ Default property:
|
|
|
71
119
|
packageName?: string | DataLink
|
|
72
120
|
/* Intent category */
|
|
73
121
|
category?: string | DataLink
|
|
122
|
+
/* Intent start foreground service */
|
|
123
|
+
foregroundService?: boolean | DataLink
|
|
74
124
|
}
|
|
75
125
|
events?: {
|
|
76
126
|
/* On intent return a result trigger */
|
|
@@ -1,3 +1,4 @@
|
|
|
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 {
|
|
@@ -19,6 +20,11 @@ export type GeneratorIteratorActionPrevious = Action & {
|
|
|
19
20
|
__actionName: 'GENERATOR_ITERATOR_PREVIOUS'
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
/* Jump to the first iteration element */
|
|
24
|
+
export type GeneratorIteratorActionFirst = Action & {
|
|
25
|
+
__actionName: 'GENERATOR_ITERATOR_FIRST'
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
/* Jump to the last iteration element (ignoring the loop setting) */
|
|
23
29
|
export type GeneratorIteratorActionLast = Action & {
|
|
24
30
|
__actionName: 'GENERATOR_ITERATOR_LAST'
|
|
@@ -39,13 +45,13 @@ Default property:
|
|
|
39
45
|
}
|
|
40
46
|
*/
|
|
41
47
|
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.
|
|
48
|
+
/* 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
49
|
data?: any
|
|
44
50
|
/* Starting element position */
|
|
45
51
|
start?: number | DataLink
|
|
46
52
|
/* Step size for each iteration */
|
|
47
53
|
step?: number | DataLink
|
|
48
|
-
/* Maximum number of iterations (can be set to -1 for unlimited) */
|
|
54
|
+
/* Maximum number of iterations (can be set to -1 for unlimited). When reached, further iteration actions will be silently ignored. */
|
|
49
55
|
maxQuantity?: number | DataLink
|
|
50
56
|
/* Whether to loop the iteration */
|
|
51
57
|
loop?: boolean | DataLink
|
|
@@ -57,6 +63,8 @@ Default property:
|
|
|
57
63
|
first?: Array<EventAction>
|
|
58
64
|
/* Event triggered on the last iteration of a round */
|
|
59
65
|
end?: Array<EventAction>
|
|
66
|
+
/* Event triggered when data type is invalid or unexpected */
|
|
67
|
+
error?: Array<EventAction>
|
|
60
68
|
}
|
|
61
69
|
outlets?: {
|
|
62
70
|
/* Elements that have been iterated (including current one) */
|
|
@@ -0,0 +1,143 @@
|
|
|
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
|
+
Generator,
|
|
6
|
+
EventAction,
|
|
7
|
+
ActionWithDataParams,
|
|
8
|
+
ActionWithParams,
|
|
9
|
+
Action,
|
|
10
|
+
EventProperty,
|
|
11
|
+
} from '../common'
|
|
12
|
+
|
|
13
|
+
/* Load model */
|
|
14
|
+
export type GeneratorAppleLLMActionLoadModel = Action & {
|
|
15
|
+
__actionName: 'GENERATOR_APPLE_LLM_LOAD_MODEL'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Run text completion */
|
|
19
|
+
export type GeneratorAppleLLMActionCompletion = ActionWithParams & {
|
|
20
|
+
__actionName: 'GENERATOR_APPLE_LLM_COMPLETION'
|
|
21
|
+
params?: Array<
|
|
22
|
+
| {
|
|
23
|
+
input: 'messages'
|
|
24
|
+
value?: Array<any> | DataLink | EventProperty
|
|
25
|
+
mapping?: string
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
input: 'maxTokens'
|
|
29
|
+
value?: number | DataLink | EventProperty
|
|
30
|
+
mapping?: string
|
|
31
|
+
}
|
|
32
|
+
| {
|
|
33
|
+
input: 'temperature'
|
|
34
|
+
value?: number | DataLink | EventProperty
|
|
35
|
+
mapping?: string
|
|
36
|
+
}
|
|
37
|
+
| {
|
|
38
|
+
input: 'topP'
|
|
39
|
+
value?: number | DataLink | EventProperty
|
|
40
|
+
mapping?: string
|
|
41
|
+
}
|
|
42
|
+
>
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Stop text completion */
|
|
46
|
+
export type GeneratorAppleLLMActionStopCompletion = Action & {
|
|
47
|
+
__actionName: 'GENERATOR_APPLE_LLM_STOP_COMPLETION'
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface GeneratorAppleLLMDef {
|
|
51
|
+
/*
|
|
52
|
+
Default property:
|
|
53
|
+
{
|
|
54
|
+
"init": false,
|
|
55
|
+
"completionMessages": [
|
|
56
|
+
{
|
|
57
|
+
"role": "system",
|
|
58
|
+
"content": "You are a helpful assistant."
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"role": "user",
|
|
62
|
+
"content": "Hello"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"completionMaxTokens": 1024,
|
|
66
|
+
"completionTemperature": 0.7,
|
|
67
|
+
"completionTopP": 0.9
|
|
68
|
+
}
|
|
69
|
+
*/
|
|
70
|
+
property?: {
|
|
71
|
+
/* Initialize model on generator init */
|
|
72
|
+
init?: boolean | DataLink
|
|
73
|
+
/* Chat messages (if first message has role 'system', it will be used as system prompt) */
|
|
74
|
+
completionMessages?:
|
|
75
|
+
| Array<
|
|
76
|
+
| DataLink
|
|
77
|
+
| {
|
|
78
|
+
role?: string | DataLink
|
|
79
|
+
content?: string | DataLink
|
|
80
|
+
}
|
|
81
|
+
>
|
|
82
|
+
| DataLink
|
|
83
|
+
/* Maximum tokens to generate */
|
|
84
|
+
completionMaxTokens?: number | DataLink
|
|
85
|
+
/* Temperature (0.0 to 1.0) */
|
|
86
|
+
completionTemperature?: number | DataLink
|
|
87
|
+
/* Top P sampling */
|
|
88
|
+
completionTopP?: number | DataLink
|
|
89
|
+
}
|
|
90
|
+
events?: {
|
|
91
|
+
/* Error event */
|
|
92
|
+
onError?: Array<EventAction>
|
|
93
|
+
/* Model loaded event */
|
|
94
|
+
onModelLoaded?: Array<EventAction>
|
|
95
|
+
/* Completion event */
|
|
96
|
+
onCompletion?: Array<EventAction>
|
|
97
|
+
/* Completion finished event */
|
|
98
|
+
onCompletionFinished?: Array<EventAction>
|
|
99
|
+
}
|
|
100
|
+
outlets?: {
|
|
101
|
+
/* Context state outlet */
|
|
102
|
+
contextState?: () => Data
|
|
103
|
+
/* Evaluating outlet */
|
|
104
|
+
isEvaluating?: () => Data
|
|
105
|
+
/* Completion result outlet */
|
|
106
|
+
completionResult?: () => Data
|
|
107
|
+
/* Last token outlet */
|
|
108
|
+
completionLastToken?: () => Data
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* LLM inference using Apple Intelligence on iOS/tvOS 26+
|
|
113
|
+
|
|
114
|
+
## Features
|
|
115
|
+
- Native Apple Intelligence integration
|
|
116
|
+
- No model download required
|
|
117
|
+
- Privacy-focused on-device processing
|
|
118
|
+
- Optimized for Apple Silicon
|
|
119
|
+
- Requires iOS 26+ or tvOS 26+ */
|
|
120
|
+
export type GeneratorAppleLLM = Generator &
|
|
121
|
+
GeneratorAppleLLMDef & {
|
|
122
|
+
templateKey: 'GENERATOR_APPLE_LLM'
|
|
123
|
+
switches: Array<
|
|
124
|
+
SwitchDef &
|
|
125
|
+
GeneratorAppleLLMDef & {
|
|
126
|
+
conds?: Array<{
|
|
127
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
128
|
+
cond:
|
|
129
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
130
|
+
| SwitchCondData
|
|
131
|
+
| {
|
|
132
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
133
|
+
outlet:
|
|
134
|
+
| 'contextState'
|
|
135
|
+
| 'isEvaluating'
|
|
136
|
+
| 'completionResult'
|
|
137
|
+
| 'completionLastToken'
|
|
138
|
+
value: any
|
|
139
|
+
}
|
|
140
|
+
}>
|
|
141
|
+
}
|
|
142
|
+
>
|
|
143
|
+
}
|