@fugood/bricks-ctor 2.25.0-beta.8 → 2.25.0-beta.81

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 (137) hide show
  1. package/package.json +4 -24
  2. package/tools/__tests__/legacy-forwarder.test.js +91 -0
  3. package/tools/_forward.ts +26 -0
  4. package/tools/deploy.ts +3 -164
  5. package/tools/mcp-server.ts +3 -27
  6. package/tools/postinstall.ts +3 -234
  7. package/tools/pull.ts +3 -121
  8. package/tools/push-config.ts +4 -0
  9. package/tools/simulator.ts +4 -0
  10. package/compile/__tests__/index.test.js +0 -115
  11. package/compile/action-name-map.ts +0 -1015
  12. package/compile/index.ts +0 -1458
  13. package/compile/util.ts +0 -358
  14. package/index.ts +0 -6
  15. package/skills/bricks-ctor/SKILL.md +0 -32
  16. package/skills/bricks-ctor/rules/animation.md +0 -160
  17. package/skills/bricks-ctor/rules/architecture-patterns.md +0 -69
  18. package/skills/bricks-ctor/rules/automations.md +0 -221
  19. package/skills/bricks-ctor/rules/buttress.md +0 -156
  20. package/skills/bricks-ctor/rules/data-calculation.md +0 -209
  21. package/skills/bricks-ctor/rules/local-sync.md +0 -129
  22. package/skills/bricks-ctor/rules/media-flow.md +0 -158
  23. package/skills/bricks-ctor/rules/remote-data-bank.md +0 -196
  24. package/skills/bricks-ctor/rules/standby-transition.md +0 -124
  25. package/skills/bricks-design/LICENSE.txt +0 -180
  26. package/skills/bricks-design/SKILL.md +0 -66
  27. package/skills/rive-marketplace/SKILL.md +0 -99
  28. package/tools/_git-author.ts +0 -29
  29. package/tools/_shell.ts +0 -173
  30. package/tools/icons/.gitattributes +0 -1
  31. package/tools/icons/fa6pro-glyphmap.json +0 -4686
  32. package/tools/icons/fa6pro-meta.json +0 -1
  33. package/tools/mcp-tools/compile.ts +0 -92
  34. package/tools/mcp-tools/huggingface.ts +0 -762
  35. package/tools/mcp-tools/icons.ts +0 -81
  36. package/tools/mcp-tools/lottie.ts +0 -102
  37. package/tools/mcp-tools/media.ts +0 -110
  38. package/tools/preview-main.mjs +0 -306
  39. package/tools/preview.ts +0 -150
  40. package/types/animation.ts +0 -111
  41. package/types/automation.ts +0 -235
  42. package/types/brick-base.ts +0 -80
  43. package/types/bricks/Camera.ts +0 -246
  44. package/types/bricks/Chart.ts +0 -372
  45. package/types/bricks/GenerativeMedia.ts +0 -290
  46. package/types/bricks/Icon.ts +0 -98
  47. package/types/bricks/Image.ts +0 -126
  48. package/types/bricks/Items.ts +0 -476
  49. package/types/bricks/Lottie.ts +0 -168
  50. package/types/bricks/Maps.ts +0 -262
  51. package/types/bricks/QrCode.ts +0 -117
  52. package/types/bricks/Rect.ts +0 -150
  53. package/types/bricks/RichText.ts +0 -128
  54. package/types/bricks/Rive.ts +0 -220
  55. package/types/bricks/Sketch.ts +0 -254
  56. package/types/bricks/Slideshow.ts +0 -201
  57. package/types/bricks/Svg.ts +0 -99
  58. package/types/bricks/Text.ts +0 -148
  59. package/types/bricks/TextInput.ts +0 -242
  60. package/types/bricks/Video.ts +0 -175
  61. package/types/bricks/VideoStreaming.ts +0 -112
  62. package/types/bricks/WebRtcStream.ts +0 -65
  63. package/types/bricks/WebView.ts +0 -168
  64. package/types/bricks/index.ts +0 -22
  65. package/types/canvas.ts +0 -82
  66. package/types/common.ts +0 -144
  67. package/types/data-calc-command.ts +0 -7005
  68. package/types/data-calc-script.ts +0 -21
  69. package/types/data-calc.ts +0 -11
  70. package/types/data.ts +0 -95
  71. package/types/generators/AlarmClock.ts +0 -110
  72. package/types/generators/Assistant.ts +0 -621
  73. package/types/generators/BleCentral.ts +0 -247
  74. package/types/generators/BlePeripheral.ts +0 -208
  75. package/types/generators/CanvasMap.ts +0 -74
  76. package/types/generators/CastlesPay.ts +0 -87
  77. package/types/generators/DataBank.ts +0 -160
  78. package/types/generators/File.ts +0 -432
  79. package/types/generators/GraphQl.ts +0 -132
  80. package/types/generators/Http.ts +0 -222
  81. package/types/generators/HttpServer.ts +0 -176
  82. package/types/generators/Information.ts +0 -103
  83. package/types/generators/Intent.ts +0 -168
  84. package/types/generators/Iterator.ts +0 -108
  85. package/types/generators/Keyboard.ts +0 -105
  86. package/types/generators/LlmAnthropicCompat.ts +0 -212
  87. package/types/generators/LlmAppleBuiltin.ts +0 -159
  88. package/types/generators/LlmGgml.ts +0 -861
  89. package/types/generators/LlmMediaTekNeuroPilot.ts +0 -235
  90. package/types/generators/LlmMlx.ts +0 -227
  91. package/types/generators/LlmOnnx.ts +0 -213
  92. package/types/generators/LlmOpenAiCompat.ts +0 -312
  93. package/types/generators/LlmQualcommAiEngine.ts +0 -247
  94. package/types/generators/Mcp.ts +0 -637
  95. package/types/generators/McpServer.ts +0 -289
  96. package/types/generators/MediaFlow.ts +0 -170
  97. package/types/generators/MqttBroker.ts +0 -141
  98. package/types/generators/MqttClient.ts +0 -141
  99. package/types/generators/Question.ts +0 -408
  100. package/types/generators/RealtimeTranscription.ts +0 -287
  101. package/types/generators/RerankerGgml.ts +0 -191
  102. package/types/generators/SerialPort.ts +0 -151
  103. package/types/generators/SoundPlayer.ts +0 -94
  104. package/types/generators/SoundRecorder.ts +0 -130
  105. package/types/generators/SpeechToTextGgml.ts +0 -419
  106. package/types/generators/SpeechToTextOnnx.ts +0 -236
  107. package/types/generators/SpeechToTextPlatform.ts +0 -85
  108. package/types/generators/SqLite.ts +0 -159
  109. package/types/generators/Step.ts +0 -107
  110. package/types/generators/SttAppleBuiltin.ts +0 -130
  111. package/types/generators/Tcp.ts +0 -126
  112. package/types/generators/TcpServer.ts +0 -147
  113. package/types/generators/TextToSpeechAppleBuiltin.ts +0 -127
  114. package/types/generators/TextToSpeechGgml.ts +0 -221
  115. package/types/generators/TextToSpeechOnnx.ts +0 -178
  116. package/types/generators/TextToSpeechOpenAiLike.ts +0 -121
  117. package/types/generators/ThermalPrinter.ts +0 -191
  118. package/types/generators/Tick.ts +0 -83
  119. package/types/generators/Udp.ts +0 -120
  120. package/types/generators/VadGgml.ts +0 -250
  121. package/types/generators/VadOnnx.ts +0 -231
  122. package/types/generators/VadTraditional.ts +0 -138
  123. package/types/generators/VectorStore.ts +0 -257
  124. package/types/generators/Watchdog.ts +0 -107
  125. package/types/generators/WebCrawler.ts +0 -103
  126. package/types/generators/WebRtc.ts +0 -181
  127. package/types/generators/WebSocket.ts +0 -148
  128. package/types/generators/index.ts +0 -57
  129. package/types/index.ts +0 -13
  130. package/types/subspace.ts +0 -60
  131. package/types/switch.ts +0 -51
  132. package/types/system.ts +0 -707
  133. package/utils/__tests__/id.test.js +0 -58
  134. package/utils/calc.ts +0 -126
  135. package/utils/data.ts +0 -497
  136. package/utils/event-props.ts +0 -886
  137. package/utils/id.ts +0 -80
@@ -1,168 +0,0 @@
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
- }
@@ -1,108 +0,0 @@
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
- }
@@ -1,105 +0,0 @@
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
- }
@@ -1,212 +0,0 @@
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
- }