@fugood/bricks-ctor 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 (129) hide show
  1. package/compile/action-name-map.ts +988 -0
  2. package/compile/index.ts +1245 -0
  3. package/compile/util.ts +358 -0
  4. package/index.ts +6 -0
  5. package/package.json +28 -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 +32 -0
  9. package/skills/bricks-project/rules/animation.md +159 -0
  10. package/skills/bricks-project/rules/architecture-patterns.md +69 -0
  11. package/skills/bricks-project/rules/automations.md +221 -0
  12. package/skills/bricks-project/rules/buttress.md +156 -0
  13. package/skills/bricks-project/rules/data-calculation.md +208 -0
  14. package/skills/bricks-project/rules/local-sync.md +129 -0
  15. package/skills/bricks-project/rules/media-flow.md +158 -0
  16. package/skills/bricks-project/rules/remote-data-bank.md +196 -0
  17. package/skills/bricks-project/rules/standby-transition.md +124 -0
  18. package/skills/rive-marketplace/SKILL.md +99 -0
  19. package/tools/deploy.ts +151 -0
  20. package/tools/icons/.gitattributes +1 -0
  21. package/tools/icons/fa6pro-glyphmap.json +4686 -0
  22. package/tools/icons/fa6pro-meta.json +3671 -0
  23. package/tools/mcp-server.ts +28 -0
  24. package/tools/mcp-tools/compile.ts +91 -0
  25. package/tools/mcp-tools/huggingface.ts +762 -0
  26. package/tools/mcp-tools/icons.ts +70 -0
  27. package/tools/mcp-tools/lottie.ts +102 -0
  28. package/tools/mcp-tools/media.ts +110 -0
  29. package/tools/postinstall.ts +229 -0
  30. package/tools/preview-main.mjs +293 -0
  31. package/tools/preview.ts +143 -0
  32. package/tools/pull.ts +116 -0
  33. package/tsconfig.json +16 -0
  34. package/types/animation.ts +100 -0
  35. package/types/automation.ts +235 -0
  36. package/types/brick-base.ts +80 -0
  37. package/types/bricks/Camera.ts +246 -0
  38. package/types/bricks/Chart.ts +372 -0
  39. package/types/bricks/GenerativeMedia.ts +276 -0
  40. package/types/bricks/Icon.ts +98 -0
  41. package/types/bricks/Image.ts +114 -0
  42. package/types/bricks/Items.ts +476 -0
  43. package/types/bricks/Lottie.ts +168 -0
  44. package/types/bricks/Maps.ts +262 -0
  45. package/types/bricks/QrCode.ts +117 -0
  46. package/types/bricks/Rect.ts +150 -0
  47. package/types/bricks/RichText.ts +128 -0
  48. package/types/bricks/Rive.ts +220 -0
  49. package/types/bricks/Slideshow.ts +201 -0
  50. package/types/bricks/Svg.ts +99 -0
  51. package/types/bricks/Text.ts +148 -0
  52. package/types/bricks/TextInput.ts +242 -0
  53. package/types/bricks/Video.ts +175 -0
  54. package/types/bricks/VideoStreaming.ts +112 -0
  55. package/types/bricks/WebRtcStream.ts +65 -0
  56. package/types/bricks/WebView.ts +168 -0
  57. package/types/bricks/index.ts +21 -0
  58. package/types/canvas.ts +82 -0
  59. package/types/common.ts +144 -0
  60. package/types/data-calc-command.ts +7005 -0
  61. package/types/data-calc-script.ts +21 -0
  62. package/types/data-calc.ts +11 -0
  63. package/types/data.ts +95 -0
  64. package/types/generators/AlarmClock.ts +110 -0
  65. package/types/generators/Assistant.ts +621 -0
  66. package/types/generators/BleCentral.ts +247 -0
  67. package/types/generators/BlePeripheral.ts +208 -0
  68. package/types/generators/CanvasMap.ts +74 -0
  69. package/types/generators/CastlesPay.ts +87 -0
  70. package/types/generators/DataBank.ts +160 -0
  71. package/types/generators/File.ts +432 -0
  72. package/types/generators/GraphQl.ts +132 -0
  73. package/types/generators/Http.ts +222 -0
  74. package/types/generators/HttpServer.ts +176 -0
  75. package/types/generators/Information.ts +103 -0
  76. package/types/generators/Intent.ts +168 -0
  77. package/types/generators/Iterator.ts +108 -0
  78. package/types/generators/Keyboard.ts +105 -0
  79. package/types/generators/LlmAnthropicCompat.ts +212 -0
  80. package/types/generators/LlmAppleBuiltin.ts +159 -0
  81. package/types/generators/LlmGgml.ts +861 -0
  82. package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
  83. package/types/generators/LlmMlx.ts +227 -0
  84. package/types/generators/LlmOnnx.ts +213 -0
  85. package/types/generators/LlmOpenAiCompat.ts +244 -0
  86. package/types/generators/LlmQualcommAiEngine.ts +247 -0
  87. package/types/generators/Mcp.ts +637 -0
  88. package/types/generators/McpServer.ts +289 -0
  89. package/types/generators/MediaFlow.ts +170 -0
  90. package/types/generators/MqttBroker.ts +141 -0
  91. package/types/generators/MqttClient.ts +141 -0
  92. package/types/generators/Question.ts +408 -0
  93. package/types/generators/RealtimeTranscription.ts +279 -0
  94. package/types/generators/RerankerGgml.ts +191 -0
  95. package/types/generators/SerialPort.ts +151 -0
  96. package/types/generators/SoundPlayer.ts +94 -0
  97. package/types/generators/SoundRecorder.ts +130 -0
  98. package/types/generators/SpeechToTextGgml.ts +415 -0
  99. package/types/generators/SpeechToTextOnnx.ts +236 -0
  100. package/types/generators/SpeechToTextPlatform.ts +85 -0
  101. package/types/generators/SqLite.ts +159 -0
  102. package/types/generators/Step.ts +107 -0
  103. package/types/generators/SttAppleBuiltin.ts +130 -0
  104. package/types/generators/Tcp.ts +126 -0
  105. package/types/generators/TcpServer.ts +147 -0
  106. package/types/generators/TextToSpeechAppleBuiltin.ts +127 -0
  107. package/types/generators/TextToSpeechGgml.ts +221 -0
  108. package/types/generators/TextToSpeechOnnx.ts +178 -0
  109. package/types/generators/TextToSpeechOpenAiLike.ts +121 -0
  110. package/types/generators/ThermalPrinter.ts +191 -0
  111. package/types/generators/Tick.ts +83 -0
  112. package/types/generators/Udp.ts +120 -0
  113. package/types/generators/VadGgml.ts +250 -0
  114. package/types/generators/VadOnnx.ts +231 -0
  115. package/types/generators/VadTraditional.ts +138 -0
  116. package/types/generators/VectorStore.ts +257 -0
  117. package/types/generators/Watchdog.ts +107 -0
  118. package/types/generators/WebCrawler.ts +103 -0
  119. package/types/generators/WebRtc.ts +181 -0
  120. package/types/generators/WebSocket.ts +148 -0
  121. package/types/generators/index.ts +57 -0
  122. package/types/index.ts +13 -0
  123. package/types/subspace.ts +59 -0
  124. package/types/switch.ts +51 -0
  125. package/types/system.ts +707 -0
  126. package/utils/calc.ts +126 -0
  127. package/utils/data.ts +497 -0
  128. package/utils/event-props.ts +836 -0
  129. package/utils/id.ts +80 -0
@@ -0,0 +1,168 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Send intent to app and get result (Android only)
4
+ */
5
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
+ import type { Data, DataLink } from '../data'
7
+ import type {
8
+ Brick,
9
+ Generator,
10
+ EventAction,
11
+ ActionWithDataParams,
12
+ ActionWithParams,
13
+ Action,
14
+ EventProperty,
15
+ } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
17
+
18
+ /* Read stats */
19
+ export type GeneratorIntentActionSendIntent = ActionWithParams & {
20
+ __actionName: 'GENERATOR_INTENT_SEND_INTENT'
21
+ params?: Array<
22
+ | {
23
+ input: 'action'
24
+ value?: string | DataLink | EventProperty
25
+ mapping?: string
26
+ }
27
+ | {
28
+ input: 'data'
29
+ value?: string | DataLink | EventProperty
30
+ mapping?: string
31
+ }
32
+ | {
33
+ input: 'type'
34
+ value?: string | DataLink | EventProperty
35
+ mapping?: string
36
+ }
37
+ | {
38
+ input: 'extra'
39
+ value?: {} | DataLink | EventProperty
40
+ mapping?: string
41
+ }
42
+ | {
43
+ input: 'className'
44
+ value?: string | DataLink | EventProperty
45
+ mapping?: string
46
+ }
47
+ | {
48
+ input: 'packageName'
49
+ value?: string | DataLink | EventProperty
50
+ mapping?: string
51
+ }
52
+ | {
53
+ input: 'category'
54
+ value?: string | DataLink | EventProperty
55
+ mapping?: string
56
+ }
57
+ >
58
+ }
59
+
60
+ /* Start intent service */
61
+ export type GeneratorIntentActionStartService = ActionWithParams & {
62
+ __actionName: 'GENERATOR_INTENT_START_SERVICE'
63
+ params?: Array<
64
+ | {
65
+ input: 'action'
66
+ value?: string | DataLink | EventProperty
67
+ mapping?: string
68
+ }
69
+ | {
70
+ input: 'data'
71
+ value?: string | DataLink | EventProperty
72
+ mapping?: string
73
+ }
74
+ | {
75
+ input: 'type'
76
+ value?: string | DataLink | EventProperty
77
+ mapping?: string
78
+ }
79
+ | {
80
+ input: 'extra'
81
+ value?: {} | DataLink | EventProperty
82
+ mapping?: string
83
+ }
84
+ | {
85
+ input: 'className'
86
+ value?: string | DataLink | EventProperty
87
+ mapping?: string
88
+ }
89
+ | {
90
+ input: 'packageName'
91
+ value?: string | DataLink | EventProperty
92
+ mapping?: string
93
+ }
94
+ | {
95
+ input: 'category'
96
+ value?: string | DataLink | EventProperty
97
+ mapping?: string
98
+ }
99
+ | {
100
+ input: 'foreground'
101
+ value?: boolean | DataLink | EventProperty
102
+ mapping?: string
103
+ }
104
+ >
105
+ }
106
+
107
+ interface GeneratorIntentDef {
108
+ /*
109
+ Default property:
110
+ {}
111
+ */
112
+ property?: {
113
+ /* Intent action */
114
+ action?: string | DataLink
115
+ /* Intent data */
116
+ data?: string | DataLink
117
+ /* Intent type */
118
+ type?: string | DataLink
119
+ /* Extra data */
120
+ extra?: {} | DataLink
121
+ /* Intent target class name in package */
122
+ className?: string | DataLink
123
+ /* Intent target package name */
124
+ packageName?: string | DataLink
125
+ /* Intent category */
126
+ category?: string | DataLink
127
+ /* Intent start foreground service */
128
+ foregroundService?: boolean | DataLink
129
+ }
130
+ events?: {
131
+ /* On intent return a result trigger */
132
+ onResult?: Array<EventAction<string & keyof TemplateEventPropsMap['Intent']['onResult']>>
133
+ /* On intent error trigger */
134
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Intent']['onError']>>
135
+ }
136
+ outlets?: {
137
+ /* Last intent result */
138
+ result?: () => Data<{
139
+ action?: string
140
+ data?: string
141
+ type?: string
142
+ extras?: { [key: string]: any }
143
+ [key: string]: any
144
+ }>
145
+ }
146
+ }
147
+
148
+ /* Send intent to app and get result (Android only) */
149
+ export type GeneratorIntent = Generator &
150
+ GeneratorIntentDef & {
151
+ templateKey: 'GENERATOR_INTENT'
152
+ switches?: Array<
153
+ SwitchDef &
154
+ GeneratorIntentDef & {
155
+ conds?: Array<{
156
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
157
+ cond:
158
+ | SwitchCondInnerStateCurrentCanvas
159
+ | SwitchCondData
160
+ | {
161
+ __typename: 'SwitchCondInnerStateOutlet'
162
+ outlet: 'result'
163
+ value: any
164
+ }
165
+ }>
166
+ }
167
+ >
168
+ }
@@ -0,0 +1,108 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Iterate through values (Array, Object, Number, String)
4
+ */
5
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
+ import type { Data, DataLink } from '../data'
7
+ import type {
8
+ Brick,
9
+ Generator,
10
+ EventAction,
11
+ ActionWithDataParams,
12
+ ActionWithParams,
13
+ Action,
14
+ EventProperty,
15
+ } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
17
+
18
+ /* Proceed to next iteration */
19
+ export type GeneratorIteratorActionNext = Action & {
20
+ __actionName: 'GENERATOR_ITERATOR_NEXT'
21
+ }
22
+
23
+ /* Go back to previous iteration */
24
+ export type GeneratorIteratorActionPrevious = Action & {
25
+ __actionName: 'GENERATOR_ITERATOR_PREVIOUS'
26
+ }
27
+
28
+ /* Jump to the first iteration element */
29
+ export type GeneratorIteratorActionFirst = Action & {
30
+ __actionName: 'GENERATOR_ITERATOR_FIRST'
31
+ }
32
+
33
+ /* Jump to the last iteration element (ignoring the loop setting) */
34
+ export type GeneratorIteratorActionLast = Action & {
35
+ __actionName: 'GENERATOR_ITERATOR_LAST'
36
+ }
37
+
38
+ /* Reset iteration state */
39
+ export type GeneratorIteratorActionReset = Action & {
40
+ __actionName: 'GENERATOR_ITERATOR_RESET'
41
+ }
42
+
43
+ interface GeneratorIteratorDef {
44
+ /*
45
+ Default property:
46
+ {
47
+ "data": [],
48
+ "start": 0,
49
+ "step": 1
50
+ }
51
+ */
52
+ property?: {
53
+ /* 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. */
54
+ data?: any
55
+ /* Starting element position */
56
+ start?: number | DataLink
57
+ /* Step size for each iteration */
58
+ step?: number | DataLink
59
+ /* Maximum number of iterations (can be set to -1 for unlimited). When reached, further iteration actions will be silently ignored. */
60
+ maxQuantity?: number | DataLink
61
+ /* Whether to loop the iteration */
62
+ loop?: boolean | DataLink
63
+ }
64
+ events?: {
65
+ /* Event triggered on each iteration */
66
+ iterate?: Array<EventAction<string & keyof TemplateEventPropsMap['Iterator']['iterate']>>
67
+ /* Event triggered on the first iteration of a round */
68
+ first?: Array<EventAction<string & keyof TemplateEventPropsMap['Iterator']['first']>>
69
+ /* Event triggered on the last iteration of a round */
70
+ end?: Array<EventAction<string & keyof TemplateEventPropsMap['Iterator']['end']>>
71
+ /* Event triggered when data type is invalid or unexpected */
72
+ error?: Array<EventAction<string & keyof TemplateEventPropsMap['Iterator']['error']>>
73
+ }
74
+ outlets?: {
75
+ /* Elements that have been iterated (including current one) */
76
+ iteratedArray?: () => Data<Array<any>>
77
+ /* Elements that will be iterated but have not been iterated yet */
78
+ upcomingArray?: () => Data<Array<any>>
79
+ /* Current iteration element */
80
+ value?: () => Data<any>
81
+ /* Key of the current iteration element (for number: same as value, for array/string: index, for object: string key) */
82
+ key?: () => Data<any>
83
+ /* Current iteration count (if data is 6 and step is 2, this will return: 1,2,3 in sequence) */
84
+ index?: () => Data<number>
85
+ }
86
+ }
87
+
88
+ /* Iterate through values (Array, Object, Number, String) */
89
+ export type GeneratorIterator = Generator &
90
+ GeneratorIteratorDef & {
91
+ templateKey: 'GENERATOR_ITERATOR'
92
+ switches?: Array<
93
+ SwitchDef &
94
+ GeneratorIteratorDef & {
95
+ conds?: Array<{
96
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
97
+ cond:
98
+ | SwitchCondInnerStateCurrentCanvas
99
+ | SwitchCondData
100
+ | {
101
+ __typename: 'SwitchCondInnerStateOutlet'
102
+ outlet: 'iteratedArray' | 'upcomingArray' | 'value' | 'key' | 'index'
103
+ value: any
104
+ }
105
+ }>
106
+ }
107
+ >
108
+ }
@@ -0,0 +1,105 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Listen to keyboard and remote control key events (keyDown, keyUp)
4
+ */
5
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
+ import type { Data, DataLink } from '../data'
7
+ import type {
8
+ Brick,
9
+ Generator,
10
+ EventAction,
11
+ ActionWithDataParams,
12
+ ActionWithParams,
13
+ Action,
14
+ EventProperty,
15
+ } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
17
+
18
+ interface GeneratorKeyboardDef {
19
+ /*
20
+ Default property:
21
+ {
22
+ "enabled": true,
23
+ "keyMap": {},
24
+ "keyOutletPrefer": "auto",
25
+ "batchStopKeys": [
26
+ 13
27
+ ],
28
+ "batchDebounce": 500
29
+ }
30
+ */
31
+ property?: {
32
+ /* Enable listening for input */
33
+ enabled?: boolean | DataLink
34
+ /* Key map to transform key or key code to the designated content
35
+ Example: { 37: 'left', 38: 'up', 39: 'right', 40: 'down', 'Enter': 'confirm' }
36
+ Supports both key codes (numbers) and key names (strings) as keys */
37
+ keyMap?: {} | DataLink
38
+ /* Key outlet preference use key code or key. */
39
+ keyOutletPrefer?: 'auto' | 'key-code' | 'key' | DataLink
40
+ /* Key or code to finish batch input
41
+ Common values: 13 (Enter), 27 (Escape), 'Enter', 'Escape' */
42
+ batchStopKeys?: Array<string | DataLink | number | DataLink | DataLink> | DataLink
43
+ /* Debounce time (ms) to finish batch input */
44
+ batchDebounce?: number | DataLink
45
+ /* Maximum wait time (ms) to finish batch input (default: unlimited) */
46
+ batchDebounceMaxWait?: number | DataLink
47
+ }
48
+ events?: {
49
+ /* Event on key press */
50
+ onDown?: Array<EventAction<string & keyof TemplateEventPropsMap['Keyboard']['onDown']>>
51
+ /* Event on key up */
52
+ onUp?: Array<EventAction<string & keyof TemplateEventPropsMap['Keyboard']['onUp']>>
53
+ /* Event on batch input complete */
54
+ onBatch?: Array<EventAction<string & keyof TemplateEventPropsMap['Keyboard']['onBatch']>>
55
+ }
56
+ outlets?: {
57
+ /* Last key code pressed */
58
+ lastKeyDown?: () => Data<string | number>
59
+ /* Modifier key information on last key press */
60
+ lastKeyDownFlags?: () => Data<{ [key: string]: any }>
61
+ /* Last key code released */
62
+ lastKeyUp?: () => Data<string | number>
63
+ /* Modifier key information on last key release */
64
+ lastKeyUpFlags?: () => Data<{ [key: string]: any }>
65
+ /* Last batch event */
66
+ lastBatchEvents?: () => Data<
67
+ Array<{
68
+ event?: string
69
+ key?: any
70
+ keyNoMapping?: any
71
+ keyCode?: any
72
+ keyCodeNoMapping?: any
73
+ flags?: { [key: string]: any }
74
+ [key: string]: any
75
+ }>
76
+ >
77
+ }
78
+ }
79
+
80
+ /* Listen to keyboard and remote control key events (keyDown, keyUp) */
81
+ export type GeneratorKeyboard = Generator &
82
+ GeneratorKeyboardDef & {
83
+ templateKey: 'GENERATOR_KEYBOARD'
84
+ switches?: Array<
85
+ SwitchDef &
86
+ GeneratorKeyboardDef & {
87
+ conds?: Array<{
88
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
89
+ cond:
90
+ | SwitchCondInnerStateCurrentCanvas
91
+ | SwitchCondData
92
+ | {
93
+ __typename: 'SwitchCondInnerStateOutlet'
94
+ outlet:
95
+ | 'lastKeyDown'
96
+ | 'lastKeyDownFlags'
97
+ | 'lastKeyUp'
98
+ | 'lastKeyUpFlags'
99
+ | 'lastBatchEvents'
100
+ value: any
101
+ }
102
+ }>
103
+ }
104
+ >
105
+ }
@@ -0,0 +1,212 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * LLM inference using Anthropic-compatible API endpoints
4
+ *
5
+ * ## Features
6
+ * - Compatible with Anthropic API format
7
+ * - Supports function calling (tools)
8
+ * - Streaming responses
9
+ * - Custom API endpoints (Default to https://api.anthropic.com/v1/messages)
10
+ */
11
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
12
+ import type { Data, DataLink } from '../data'
13
+ import type {
14
+ Brick,
15
+ Generator,
16
+ EventAction,
17
+ ActionWithDataParams,
18
+ ActionWithParams,
19
+ Action,
20
+ EventProperty,
21
+ } from '../common'
22
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
23
+
24
+ /* Run text completion */
25
+ export type GeneratorAnthropicLLMActionCompletion = ActionWithParams & {
26
+ __actionName: 'GENERATOR_ANTHROPIC_LLM_COMPLETION'
27
+ params?: Array<
28
+ | {
29
+ input: 'systemMessage'
30
+ value?: string | DataLink | EventProperty
31
+ mapping?: string
32
+ }
33
+ | {
34
+ input: 'messages'
35
+ value?: Array<any> | DataLink | EventProperty
36
+ mapping?: string
37
+ }
38
+ | {
39
+ input: 'maxTokens'
40
+ value?: number | DataLink | EventProperty
41
+ mapping?: string
42
+ }
43
+ | {
44
+ input: 'temperature'
45
+ value?: number | DataLink | EventProperty
46
+ mapping?: string
47
+ }
48
+ | {
49
+ input: 'topP'
50
+ value?: number | DataLink | EventProperty
51
+ mapping?: string
52
+ }
53
+ | {
54
+ input: 'topK'
55
+ value?: number | DataLink | EventProperty
56
+ mapping?: string
57
+ }
58
+ | {
59
+ input: 'stopSequences'
60
+ value?: Array<any> | DataLink | EventProperty
61
+ mapping?: string
62
+ }
63
+ | {
64
+ input: 'tools'
65
+ value?: Array<any> | DataLink | EventProperty
66
+ mapping?: string
67
+ }
68
+ | {
69
+ input: 'toolChoice'
70
+ value?: {} | DataLink | EventProperty
71
+ mapping?: string
72
+ }
73
+ >
74
+ }
75
+
76
+ /* Stop text completion */
77
+ export type GeneratorAnthropicLLMActionStopCompletion = Action & {
78
+ __actionName: 'GENERATOR_ANTHROPIC_LLM_STOP_COMPLETION'
79
+ }
80
+
81
+ interface GeneratorAnthropicLLMDef {
82
+ /*
83
+ Default property:
84
+ {
85
+ "apiEndpoint": "https://api.anthropic.com/v1/messages",
86
+ "model": "claude-3-5-sonnet-20241022",
87
+ "systemMessage": "You are a helpful assistant.",
88
+ "completionMessages": [],
89
+ "completionMaxTokens": 1024,
90
+ "completionTemperature": 1,
91
+ "completionTopP": 1,
92
+ "completionStopSequences": []
93
+ }
94
+ */
95
+ property?: {
96
+ /* API endpoint URL */
97
+ apiEndpoint?: string | DataLink
98
+ /* API key */
99
+ apiKey?: string | DataLink
100
+ /* Model name (Default: claude-3-5-sonnet-20241022) */
101
+ model?: string | DataLink
102
+ /* System message content */
103
+ systemMessage?: string | DataLink
104
+ /* Chat messages (user/assistant only) */
105
+ completionMessages?:
106
+ | Array<
107
+ | DataLink
108
+ | {
109
+ role?: 'user' | 'assistant' | DataLink
110
+ content?:
111
+ | string
112
+ | DataLink
113
+ | Array<
114
+ | DataLink
115
+ | {
116
+ type?: 'text' | 'image' | DataLink
117
+ text?: string | DataLink
118
+ source?:
119
+ | DataLink
120
+ | {
121
+ type?: string | DataLink
122
+ media_type?: string | DataLink
123
+ data?: string | DataLink
124
+ }
125
+ }
126
+ >
127
+ | DataLink
128
+ | DataLink
129
+ }
130
+ >
131
+ | DataLink
132
+ /* Tools for function calling following Anthropic format
133
+ Format: Array of objects with {name, description, input_schema} structure
134
+ See: https://docs.anthropic.com/en/docs/tool-use */
135
+ completionTools?: Array<{} | DataLink> | DataLink
136
+ /* Tool choice for function calling */
137
+ completionToolChoice?:
138
+ | DataLink
139
+ | {
140
+ type?: 'auto' | 'any' | 'tool' | DataLink
141
+ name?: string | DataLink
142
+ }
143
+ /* Maximum tokens to generate */
144
+ completionMaxTokens?: number | DataLink
145
+ /* Temperature */
146
+ completionTemperature?: number | DataLink
147
+ /* Top P sampling */
148
+ completionTopP?: number | DataLink
149
+ /* Top K sampling */
150
+ completionTopK?: number | DataLink
151
+ /* Stop sequences */
152
+ completionStopSequences?: Array<string | DataLink> | DataLink
153
+ }
154
+ events?: {
155
+ /* Error event */
156
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['AnthropicLlm']['onError']>>
157
+ /* Completion event */
158
+ onCompletion?: Array<
159
+ EventAction<string & keyof TemplateEventPropsMap['AnthropicLlm']['onCompletion']>
160
+ >
161
+ /* Completion finished event */
162
+ onCompletionFinished?: Array<
163
+ EventAction<string & keyof TemplateEventPropsMap['AnthropicLlm']['onCompletionFinished']>
164
+ >
165
+ /* Tool use event */
166
+ onToolUse?: Array<
167
+ EventAction<string & keyof TemplateEventPropsMap['AnthropicLlm']['onToolUse']>
168
+ >
169
+ }
170
+ outlets?: {
171
+ /* Evaluating outlet */
172
+ isEvaluating?: () => Data<boolean>
173
+ /* Completion result outlet */
174
+ completionResult?: () => Data<string>
175
+ /* Completion details outlet */
176
+ completionDetails?: () => Data<{
177
+ model?: string
178
+ stop_reason?: string
179
+ usage?: { [key: string]: any }
180
+ content?: Array<any>
181
+ [key: string]: any
182
+ }>
183
+ }
184
+ }
185
+
186
+ /* LLM inference using Anthropic-compatible API endpoints
187
+
188
+ ## Features
189
+ - Compatible with Anthropic API format
190
+ - Supports function calling (tools)
191
+ - Streaming responses
192
+ - Custom API endpoints (Default to https://api.anthropic.com/v1/messages) */
193
+ export type GeneratorAnthropicLLM = Generator &
194
+ GeneratorAnthropicLLMDef & {
195
+ templateKey: 'GENERATOR_ANTHROPIC_LLM'
196
+ switches?: Array<
197
+ SwitchDef &
198
+ GeneratorAnthropicLLMDef & {
199
+ conds?: Array<{
200
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
201
+ cond:
202
+ | SwitchCondInnerStateCurrentCanvas
203
+ | SwitchCondData
204
+ | {
205
+ __typename: 'SwitchCondInnerStateOutlet'
206
+ outlet: 'isEvaluating' | 'completionResult' | 'completionDetails'
207
+ value: any
208
+ }
209
+ }>
210
+ }
211
+ >
212
+ }