@q1k-oss/btree-workflows 0.0.1
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/.claude/settings.local.json +31 -0
- package/CLAUDE.md +181 -0
- package/LICENSE +21 -0
- package/README.md +920 -0
- package/behaviour-tree-workflows-landing/index.html +16 -0
- package/behaviour-tree-workflows-landing/package-lock.json +2074 -0
- package/behaviour-tree-workflows-landing/package.json +31 -0
- package/behaviour-tree-workflows-landing/public/favicon.svg +17 -0
- package/behaviour-tree-workflows-landing/src/App.css +103 -0
- package/behaviour-tree-workflows-landing/src/App.tsx +176 -0
- package/behaviour-tree-workflows-landing/src/components/BlackboardInspector.css +89 -0
- package/behaviour-tree-workflows-landing/src/components/BlackboardInspector.tsx +64 -0
- package/behaviour-tree-workflows-landing/src/components/ExampleSelector.css +64 -0
- package/behaviour-tree-workflows-landing/src/components/ExampleSelector.tsx +34 -0
- package/behaviour-tree-workflows-landing/src/components/ExecutionLog.css +107 -0
- package/behaviour-tree-workflows-landing/src/components/ExecutionLog.tsx +85 -0
- package/behaviour-tree-workflows-landing/src/components/Header.css +50 -0
- package/behaviour-tree-workflows-landing/src/components/Header.tsx +26 -0
- package/behaviour-tree-workflows-landing/src/components/StatusBadge.css +45 -0
- package/behaviour-tree-workflows-landing/src/components/StatusBadge.tsx +15 -0
- package/behaviour-tree-workflows-landing/src/components/Toolbar.css +74 -0
- package/behaviour-tree-workflows-landing/src/components/Toolbar.tsx +53 -0
- package/behaviour-tree-workflows-landing/src/components/TreeVisualizer.css +67 -0
- package/behaviour-tree-workflows-landing/src/components/TreeVisualizer.tsx +192 -0
- package/behaviour-tree-workflows-landing/src/components/YamlEditor.css +18 -0
- package/behaviour-tree-workflows-landing/src/components/YamlEditor.tsx +96 -0
- package/behaviour-tree-workflows-landing/src/lib/count-nodes.ts +11 -0
- package/behaviour-tree-workflows-landing/src/lib/execution-engine.ts +96 -0
- package/behaviour-tree-workflows-landing/src/lib/tree-layout.ts +136 -0
- package/behaviour-tree-workflows-landing/src/lib/yaml-examples.ts +549 -0
- package/behaviour-tree-workflows-landing/src/main.tsx +9 -0
- package/behaviour-tree-workflows-landing/src/stubs/activepieces.ts +18 -0
- package/behaviour-tree-workflows-landing/src/stubs/fs.ts +24 -0
- package/behaviour-tree-workflows-landing/src/stubs/path.ts +16 -0
- package/behaviour-tree-workflows-landing/src/stubs/temporal-activity.ts +6 -0
- package/behaviour-tree-workflows-landing/src/stubs/temporal-workflow.ts +22 -0
- package/behaviour-tree-workflows-landing/tsconfig.json +25 -0
- package/behaviour-tree-workflows-landing/vite.config.ts +40 -0
- package/demo-google-sheets.ts +181 -0
- package/demo-runtime-variables.ts +174 -0
- package/demo-template.ts +208 -0
- package/docs/ARCHITECTURE_SUMMARY.md +613 -0
- package/docs/NODE_REFERENCE.md +504 -0
- package/docs/README.md +53 -0
- package/docs/custom-nodes-architecture.md +826 -0
- package/docs/observability.md +175 -0
- package/docs/yaml-specification.md +990 -0
- package/examples/temporal/README.md +117 -0
- package/examples/temporal/activities.ts +373 -0
- package/examples/temporal/client.ts +115 -0
- package/examples/temporal/python-worker/activities.py +339 -0
- package/examples/temporal/python-worker/requirements.txt +12 -0
- package/examples/temporal/python-worker/worker.py +106 -0
- package/examples/temporal/worker.ts +66 -0
- package/examples/temporal/workflows.ts +6 -0
- package/examples/temporal/yaml-workflow-loader.ts +105 -0
- package/examples/yaml-test.ts +97 -0
- package/examples/yaml-workflows/01-simple-sequence.yaml +25 -0
- package/examples/yaml-workflows/02-parallel-timeout.yaml +45 -0
- package/examples/yaml-workflows/03-ecommerce-checkout.yaml +94 -0
- package/examples/yaml-workflows/04-ai-agent-workflow.yaml +346 -0
- package/examples/yaml-workflows/05-order-processing.yaml +146 -0
- package/examples/yaml-workflows/06-activity-test.yaml +71 -0
- package/examples/yaml-workflows/07-activity-simple-test.yaml +43 -0
- package/examples/yaml-workflows/08-file-processing.yaml +141 -0
- package/examples/yaml-workflows/09-http-request.yaml +137 -0
- package/examples/yaml-workflows/README.md +211 -0
- package/package.json +38 -0
- package/src/actions/code-execution.schema.ts +27 -0
- package/src/actions/code-execution.ts +218 -0
- package/src/actions/generate-file.test.ts +516 -0
- package/src/actions/generate-file.ts +166 -0
- package/src/actions/http-request.test.ts +784 -0
- package/src/actions/http-request.ts +228 -0
- package/src/actions/index.ts +20 -0
- package/src/actions/parse-file.test.ts +448 -0
- package/src/actions/parse-file.ts +139 -0
- package/src/actions/python-script.test.ts +439 -0
- package/src/actions/python-script.ts +154 -0
- package/src/base-node.test.ts +511 -0
- package/src/base-node.ts +605 -0
- package/src/behavior-tree.test.ts +431 -0
- package/src/behavior-tree.ts +283 -0
- package/src/blackboard.test.ts +222 -0
- package/src/blackboard.ts +192 -0
- package/src/composites/conditional.schema.ts +19 -0
- package/src/composites/conditional.test.ts +309 -0
- package/src/composites/conditional.ts +129 -0
- package/src/composites/for-each.schema.ts +23 -0
- package/src/composites/for-each.test.ts +254 -0
- package/src/composites/for-each.ts +132 -0
- package/src/composites/index.ts +15 -0
- package/src/composites/memory-sequence.schema.ts +19 -0
- package/src/composites/memory-sequence.test.ts +223 -0
- package/src/composites/memory-sequence.ts +98 -0
- package/src/composites/parallel.schema.ts +28 -0
- package/src/composites/parallel.test.ts +502 -0
- package/src/composites/parallel.ts +157 -0
- package/src/composites/reactive-sequence.schema.ts +19 -0
- package/src/composites/reactive-sequence.test.ts +170 -0
- package/src/composites/reactive-sequence.ts +85 -0
- package/src/composites/recovery.schema.ts +19 -0
- package/src/composites/recovery.test.ts +366 -0
- package/src/composites/recovery.ts +90 -0
- package/src/composites/selector.schema.ts +19 -0
- package/src/composites/selector.test.ts +387 -0
- package/src/composites/selector.ts +85 -0
- package/src/composites/sequence.schema.ts +19 -0
- package/src/composites/sequence.test.ts +337 -0
- package/src/composites/sequence.ts +72 -0
- package/src/composites/sub-tree.schema.ts +21 -0
- package/src/composites/sub-tree.test.ts +893 -0
- package/src/composites/sub-tree.ts +177 -0
- package/src/composites/while.schema.ts +24 -0
- package/src/composites/while.test.ts +381 -0
- package/src/composites/while.ts +149 -0
- package/src/data-store/index.ts +10 -0
- package/src/data-store/memory-store.ts +161 -0
- package/src/data-store/types.ts +94 -0
- package/src/debug/breakpoint.test.ts +47 -0
- package/src/debug/breakpoint.ts +30 -0
- package/src/debug/index.ts +17 -0
- package/src/debug/resume-point.test.ts +49 -0
- package/src/debug/resume-point.ts +29 -0
- package/src/decorators/delay.schema.ts +21 -0
- package/src/decorators/delay.test.ts +261 -0
- package/src/decorators/delay.ts +140 -0
- package/src/decorators/force-result.schema.ts +32 -0
- package/src/decorators/force-result.test.ts +133 -0
- package/src/decorators/force-result.ts +63 -0
- package/src/decorators/index.ts +13 -0
- package/src/decorators/invert.schema.ts +19 -0
- package/src/decorators/invert.test.ts +135 -0
- package/src/decorators/invert.ts +42 -0
- package/src/decorators/keep-running.schema.ts +20 -0
- package/src/decorators/keep-running.test.ts +105 -0
- package/src/decorators/keep-running.ts +49 -0
- package/src/decorators/precondition.schema.ts +19 -0
- package/src/decorators/precondition.test.ts +351 -0
- package/src/decorators/precondition.ts +139 -0
- package/src/decorators/repeat.schema.ts +21 -0
- package/src/decorators/repeat.test.ts +187 -0
- package/src/decorators/repeat.ts +94 -0
- package/src/decorators/run-once.schema.ts +19 -0
- package/src/decorators/run-once.test.ts +140 -0
- package/src/decorators/run-once.ts +61 -0
- package/src/decorators/soft-assert.schema.ts +19 -0
- package/src/decorators/soft-assert.test.ts +107 -0
- package/src/decorators/soft-assert.ts +68 -0
- package/src/decorators/timeout.schema.ts +21 -0
- package/src/decorators/timeout.test.ts +274 -0
- package/src/decorators/timeout.ts +159 -0
- package/src/errors.test.ts +63 -0
- package/src/errors.ts +34 -0
- package/src/events.test.ts +347 -0
- package/src/events.ts +183 -0
- package/src/index.ts +80 -0
- package/src/integrations/index.ts +30 -0
- package/src/integrations/integration-action.test.ts +571 -0
- package/src/integrations/integration-action.ts +233 -0
- package/src/integrations/piece-executor.ts +320 -0
- package/src/observability/execution-tracker.ts +320 -0
- package/src/observability/index.ts +23 -0
- package/src/observability/sinks.ts +138 -0
- package/src/observability/types.ts +130 -0
- package/src/registry-utils.ts +147 -0
- package/src/registry.test.ts +466 -0
- package/src/registry.ts +334 -0
- package/src/schemas/base.schema.ts +104 -0
- package/src/schemas/index.ts +223 -0
- package/src/schemas/integration.test.ts +238 -0
- package/src/schemas/tree-definition.schema.ts +170 -0
- package/src/schemas/validation.test.ts +146 -0
- package/src/schemas/validation.ts +122 -0
- package/src/scripting/index.ts +22 -0
- package/src/templates/template-loader.test.ts +281 -0
- package/src/templates/template-loader.ts +152 -0
- package/src/temporal-integration.test.ts +213 -0
- package/src/test-nodes.ts +259 -0
- package/src/types.ts +503 -0
- package/src/utilities/index.ts +17 -0
- package/src/utilities/log-message.test.ts +275 -0
- package/src/utilities/log-message.ts +134 -0
- package/src/utilities/regex-extract.test.ts +138 -0
- package/src/utilities/regex-extract.ts +108 -0
- package/src/utilities/variable-resolver.test.ts +416 -0
- package/src/utilities/variable-resolver.ts +318 -0
- package/src/utils/error-handler.test.ts +117 -0
- package/src/utils/error-handler.ts +48 -0
- package/src/utils/signal-check.test.ts +234 -0
- package/src/utils/signal-check.ts +140 -0
- package/src/yaml/errors.ts +143 -0
- package/src/yaml/index.ts +30 -0
- package/src/yaml/loader.ts +39 -0
- package/src/yaml/parser.ts +286 -0
- package/src/yaml/validation/semantic-validator.ts +196 -0
- package/templates/google-sheets/insert-row.yaml +76 -0
- package/templates/notification-sender.yaml +33 -0
- package/templates/order-validation.yaml +44 -0
- package/tsconfig.json +24 -0
- package/vitest.config.ts +25 -0
- package/workflows/order-processor.yaml +59 -0
- package/workflows/process-order-workflow.yaml +142 -0
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
export interface YamlExample {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
yaml: string;
|
|
6
|
+
executable: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const examples: YamlExample[] = [
|
|
10
|
+
{
|
|
11
|
+
id: 'simple-sequence',
|
|
12
|
+
name: 'Simple Sequence',
|
|
13
|
+
description: 'Basic sequential PrintActions',
|
|
14
|
+
executable: true,
|
|
15
|
+
yaml: `# Simple Sequence Workflow
|
|
16
|
+
type: Sequence
|
|
17
|
+
id: simple-sequence
|
|
18
|
+
name: Simple Sequence Workflow
|
|
19
|
+
children:
|
|
20
|
+
- type: PrintAction
|
|
21
|
+
id: step1
|
|
22
|
+
name: Start Step
|
|
23
|
+
props:
|
|
24
|
+
message: "Starting workflow..."
|
|
25
|
+
- type: PrintAction
|
|
26
|
+
id: step2
|
|
27
|
+
name: Process Step
|
|
28
|
+
props:
|
|
29
|
+
message: "Processing data..."
|
|
30
|
+
- type: PrintAction
|
|
31
|
+
id: step3
|
|
32
|
+
name: Complete Step
|
|
33
|
+
props:
|
|
34
|
+
message: "Workflow complete!"`,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'parallel-timeout',
|
|
38
|
+
name: 'Parallel + Timeout',
|
|
39
|
+
description: 'Concurrent tasks with timeout protection',
|
|
40
|
+
executable: true,
|
|
41
|
+
yaml: `# Parallel Execution with Timeout
|
|
42
|
+
type: Sequence
|
|
43
|
+
id: parallel-timeout-root
|
|
44
|
+
name: Parallel with Timeout Workflow
|
|
45
|
+
children:
|
|
46
|
+
- type: Timeout
|
|
47
|
+
id: timeout
|
|
48
|
+
name: 5 Second Timeout
|
|
49
|
+
props:
|
|
50
|
+
timeoutMs: 5000
|
|
51
|
+
children:
|
|
52
|
+
- type: Parallel
|
|
53
|
+
id: parallelTasks
|
|
54
|
+
name: Parallel Tasks
|
|
55
|
+
props:
|
|
56
|
+
strategy: "strict"
|
|
57
|
+
children:
|
|
58
|
+
- type: PrintAction
|
|
59
|
+
id: task1
|
|
60
|
+
name: Task 1
|
|
61
|
+
props:
|
|
62
|
+
message: "Task 1: Fetching data..."
|
|
63
|
+
- type: PrintAction
|
|
64
|
+
id: task2
|
|
65
|
+
name: Task 2
|
|
66
|
+
props:
|
|
67
|
+
message: "Task 2: Processing..."
|
|
68
|
+
- type: PrintAction
|
|
69
|
+
id: task3
|
|
70
|
+
name: Task 3
|
|
71
|
+
props:
|
|
72
|
+
message: "Task 3: Validating..."
|
|
73
|
+
- type: PrintAction
|
|
74
|
+
id: complete
|
|
75
|
+
name: Completion Message
|
|
76
|
+
props:
|
|
77
|
+
message: "All tasks completed successfully!"`,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'ecommerce-checkout',
|
|
81
|
+
name: 'Checkout Flow',
|
|
82
|
+
description: 'Multi-phase checkout with validation & parallel post-processing',
|
|
83
|
+
executable: true,
|
|
84
|
+
yaml: `# E-commerce Checkout Workflow
|
|
85
|
+
type: Sequence
|
|
86
|
+
id: checkout-workflow
|
|
87
|
+
name: E-commerce Checkout
|
|
88
|
+
children:
|
|
89
|
+
- type: Sequence
|
|
90
|
+
id: validation-phase
|
|
91
|
+
name: Validation Phase
|
|
92
|
+
children:
|
|
93
|
+
- type: PrintAction
|
|
94
|
+
id: validate-cart
|
|
95
|
+
props:
|
|
96
|
+
message: "Validating shopping cart..."
|
|
97
|
+
- type: PrintAction
|
|
98
|
+
id: check-inventory
|
|
99
|
+
props:
|
|
100
|
+
message: "Checking inventory availability..."
|
|
101
|
+
- type: Timeout
|
|
102
|
+
id: payment-timeout
|
|
103
|
+
props:
|
|
104
|
+
timeoutMs: 30000
|
|
105
|
+
children:
|
|
106
|
+
- type: Sequence
|
|
107
|
+
id: payment-sequence
|
|
108
|
+
children:
|
|
109
|
+
- type: PrintAction
|
|
110
|
+
id: init-payment
|
|
111
|
+
props:
|
|
112
|
+
message: "Initializing payment gateway..."
|
|
113
|
+
- type: PrintAction
|
|
114
|
+
id: charge-card
|
|
115
|
+
props:
|
|
116
|
+
message: "Charging credit card..."
|
|
117
|
+
- type: Parallel
|
|
118
|
+
id: post-checkout-tasks
|
|
119
|
+
name: Post-Checkout Tasks
|
|
120
|
+
props:
|
|
121
|
+
strategy: strict
|
|
122
|
+
children:
|
|
123
|
+
- type: Sequence
|
|
124
|
+
id: order-confirmation
|
|
125
|
+
children:
|
|
126
|
+
- type: PrintAction
|
|
127
|
+
id: send-confirmation-email
|
|
128
|
+
props:
|
|
129
|
+
message: "Sending order confirmation email..."
|
|
130
|
+
- type: PrintAction
|
|
131
|
+
id: send-sms
|
|
132
|
+
props:
|
|
133
|
+
message: "Sending SMS notification..."
|
|
134
|
+
- type: PrintAction
|
|
135
|
+
id: update-inventory
|
|
136
|
+
props:
|
|
137
|
+
message: "Updating inventory levels..."
|
|
138
|
+
- type: PrintAction
|
|
139
|
+
id: create-shipment
|
|
140
|
+
props:
|
|
141
|
+
message: "Creating shipment record..."
|
|
142
|
+
- type: PrintAction
|
|
143
|
+
id: checkout-complete
|
|
144
|
+
props:
|
|
145
|
+
message: "Checkout completed successfully!"`,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: 'ai-agent',
|
|
149
|
+
name: 'AI Agent',
|
|
150
|
+
description: 'Complex: Selector, While, Recovery, Conditional',
|
|
151
|
+
executable: true,
|
|
152
|
+
yaml: `# AI Agent Decision Workflow
|
|
153
|
+
type: Sequence
|
|
154
|
+
id: ai-agent-workflow
|
|
155
|
+
name: AI Agent Task Execution
|
|
156
|
+
children:
|
|
157
|
+
- type: Sequence
|
|
158
|
+
id: agent-initialization
|
|
159
|
+
name: Agent Initialization
|
|
160
|
+
children:
|
|
161
|
+
- type: PrintAction
|
|
162
|
+
id: load-agent
|
|
163
|
+
props:
|
|
164
|
+
message: "Initializing AI agent..."
|
|
165
|
+
- type: PrintAction
|
|
166
|
+
id: load-context
|
|
167
|
+
props:
|
|
168
|
+
message: "Loading conversation context..."
|
|
169
|
+
- type: Selector
|
|
170
|
+
id: task-router
|
|
171
|
+
name: Task Type Router
|
|
172
|
+
children:
|
|
173
|
+
- type: Sequence
|
|
174
|
+
id: research-path
|
|
175
|
+
name: Research & Information Gathering
|
|
176
|
+
children:
|
|
177
|
+
- type: PrintAction
|
|
178
|
+
id: default-route
|
|
179
|
+
props:
|
|
180
|
+
message: "Executing research task..."
|
|
181
|
+
- type: Sequence
|
|
182
|
+
id: research-step
|
|
183
|
+
children:
|
|
184
|
+
- type: Selector
|
|
185
|
+
id: information-gathering
|
|
186
|
+
name: Multi-Source Info Gathering
|
|
187
|
+
children:
|
|
188
|
+
- type: Sequence
|
|
189
|
+
id: web-search
|
|
190
|
+
children:
|
|
191
|
+
- type: Timeout
|
|
192
|
+
id: search-timeout
|
|
193
|
+
props:
|
|
194
|
+
timeoutMs: 10000
|
|
195
|
+
children:
|
|
196
|
+
- type: PrintAction
|
|
197
|
+
id: execute-search
|
|
198
|
+
props:
|
|
199
|
+
message: "Searching web for information..."
|
|
200
|
+
- type: Sequence
|
|
201
|
+
id: knowledge-base-lookup
|
|
202
|
+
children:
|
|
203
|
+
- type: PrintAction
|
|
204
|
+
id: query-kb
|
|
205
|
+
props:
|
|
206
|
+
message: "Querying internal knowledge base..."
|
|
207
|
+
- type: ForceSuccess
|
|
208
|
+
id: ensure-progress
|
|
209
|
+
children:
|
|
210
|
+
- type: PrintAction
|
|
211
|
+
id: use-cached
|
|
212
|
+
props:
|
|
213
|
+
message: "Using cached knowledge..."
|
|
214
|
+
- type: PrintAction
|
|
215
|
+
id: synthesize-info
|
|
216
|
+
props:
|
|
217
|
+
message: "Synthesizing information..."
|
|
218
|
+
- type: Recovery
|
|
219
|
+
id: quality-with-recovery
|
|
220
|
+
children:
|
|
221
|
+
- type: Parallel
|
|
222
|
+
id: quality-checks
|
|
223
|
+
name: Quality Assurance
|
|
224
|
+
props:
|
|
225
|
+
strategy: strict
|
|
226
|
+
children:
|
|
227
|
+
- type: PrintAction
|
|
228
|
+
id: verify-accuracy
|
|
229
|
+
props:
|
|
230
|
+
message: "Verifying accuracy of results..."
|
|
231
|
+
- type: PrintAction
|
|
232
|
+
id: verify-completeness
|
|
233
|
+
props:
|
|
234
|
+
message: "Checking completeness of response..."
|
|
235
|
+
- type: PrintAction
|
|
236
|
+
id: run-safety-filters
|
|
237
|
+
props:
|
|
238
|
+
message: "Running safety and content filters..."
|
|
239
|
+
- type: PrintAction
|
|
240
|
+
id: fallback-quality
|
|
241
|
+
props:
|
|
242
|
+
message: "Running simplified quality check..."
|
|
243
|
+
- type: PrintAction
|
|
244
|
+
id: save-results
|
|
245
|
+
props:
|
|
246
|
+
message: "Saving quality results..."
|
|
247
|
+
- type: Conditional
|
|
248
|
+
id: check-format-preference
|
|
249
|
+
props:
|
|
250
|
+
condition:
|
|
251
|
+
key: user.preferMarkdown
|
|
252
|
+
operator: "=="
|
|
253
|
+
value: true
|
|
254
|
+
children:
|
|
255
|
+
- type: PrintAction
|
|
256
|
+
id: format-markdown
|
|
257
|
+
props:
|
|
258
|
+
message: "Formatting as markdown..."
|
|
259
|
+
- type: PrintAction
|
|
260
|
+
id: format-plaintext
|
|
261
|
+
props:
|
|
262
|
+
message: "Formatting as plain text..."
|
|
263
|
+
- type: Sequence
|
|
264
|
+
id: delivery
|
|
265
|
+
name: Response Delivery
|
|
266
|
+
children:
|
|
267
|
+
- type: PrintAction
|
|
268
|
+
id: send-response
|
|
269
|
+
props:
|
|
270
|
+
message: "Sending response to user..."
|
|
271
|
+
- type: Parallel
|
|
272
|
+
id: post-delivery
|
|
273
|
+
props:
|
|
274
|
+
strategy: any
|
|
275
|
+
children:
|
|
276
|
+
- type: PrintAction
|
|
277
|
+
id: log-interaction
|
|
278
|
+
props:
|
|
279
|
+
message: "Logging interaction for analytics..."
|
|
280
|
+
- type: PrintAction
|
|
281
|
+
id: update-context
|
|
282
|
+
props:
|
|
283
|
+
message: "Updating conversation context..."
|
|
284
|
+
- type: PrintAction
|
|
285
|
+
id: agent-complete
|
|
286
|
+
props:
|
|
287
|
+
message: "AI agent workflow completed!"`,
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
id: 'order-processing',
|
|
291
|
+
name: 'Order Pipeline',
|
|
292
|
+
description: 'Order pipeline with Timeout, Parallel, Delay',
|
|
293
|
+
executable: true,
|
|
294
|
+
yaml: `# Order Processing Workflow
|
|
295
|
+
type: Sequence
|
|
296
|
+
id: order-processing
|
|
297
|
+
name: Order Processing Workflow
|
|
298
|
+
children:
|
|
299
|
+
- type: PrintAction
|
|
300
|
+
id: start
|
|
301
|
+
name: Start Order Processing
|
|
302
|
+
props:
|
|
303
|
+
message: "Starting Order Processing"
|
|
304
|
+
- type: Timeout
|
|
305
|
+
id: validation-timeout
|
|
306
|
+
name: Validation Timeout (5s)
|
|
307
|
+
props:
|
|
308
|
+
timeoutMs: 5000
|
|
309
|
+
children:
|
|
310
|
+
- type: Parallel
|
|
311
|
+
id: validation-checks
|
|
312
|
+
name: Run Validation Checks
|
|
313
|
+
props:
|
|
314
|
+
strategy: "strict"
|
|
315
|
+
children:
|
|
316
|
+
- type: PrintAction
|
|
317
|
+
id: validate-inventory
|
|
318
|
+
props:
|
|
319
|
+
message: "Validating inventory availability..."
|
|
320
|
+
- type: PrintAction
|
|
321
|
+
id: validate-payment
|
|
322
|
+
props:
|
|
323
|
+
message: "Validating payment method..."
|
|
324
|
+
- type: PrintAction
|
|
325
|
+
id: validate-shipping
|
|
326
|
+
props:
|
|
327
|
+
message: "Validating shipping address..."
|
|
328
|
+
- type: Timeout
|
|
329
|
+
id: payment-timeout
|
|
330
|
+
name: Payment Timeout (10s)
|
|
331
|
+
props:
|
|
332
|
+
timeoutMs: 10000
|
|
333
|
+
children:
|
|
334
|
+
- type: Sequence
|
|
335
|
+
id: payment-sequence
|
|
336
|
+
children:
|
|
337
|
+
- type: PrintAction
|
|
338
|
+
id: charge-card
|
|
339
|
+
props:
|
|
340
|
+
message: "Processing payment..."
|
|
341
|
+
- type: Delay
|
|
342
|
+
id: payment-delay
|
|
343
|
+
name: Simulate Payment Processing
|
|
344
|
+
props:
|
|
345
|
+
delayMs: 1000
|
|
346
|
+
children:
|
|
347
|
+
- type: PrintAction
|
|
348
|
+
id: payment-success
|
|
349
|
+
props:
|
|
350
|
+
message: "Payment processed successfully!"
|
|
351
|
+
- type: Parallel
|
|
352
|
+
id: fulfillment-tasks
|
|
353
|
+
name: Parallel Fulfillment
|
|
354
|
+
props:
|
|
355
|
+
strategy: "strict"
|
|
356
|
+
children:
|
|
357
|
+
- type: Sequence
|
|
358
|
+
id: inventory-update
|
|
359
|
+
name: Update Inventory
|
|
360
|
+
children:
|
|
361
|
+
- type: PrintAction
|
|
362
|
+
id: reserve-items
|
|
363
|
+
props:
|
|
364
|
+
message: "Reserving items from inventory..."
|
|
365
|
+
- type: Delay
|
|
366
|
+
id: inventory-delay
|
|
367
|
+
props:
|
|
368
|
+
delayMs: 500
|
|
369
|
+
children:
|
|
370
|
+
- type: PrintAction
|
|
371
|
+
id: inventory-complete
|
|
372
|
+
props:
|
|
373
|
+
message: "Inventory updated"
|
|
374
|
+
- type: Sequence
|
|
375
|
+
id: shipping-label
|
|
376
|
+
name: Generate Shipping Label
|
|
377
|
+
children:
|
|
378
|
+
- type: PrintAction
|
|
379
|
+
id: create-label
|
|
380
|
+
props:
|
|
381
|
+
message: "Generating shipping label..."
|
|
382
|
+
- type: Delay
|
|
383
|
+
id: shipping-delay
|
|
384
|
+
props:
|
|
385
|
+
delayMs: 500
|
|
386
|
+
children:
|
|
387
|
+
- type: PrintAction
|
|
388
|
+
id: label-complete
|
|
389
|
+
props:
|
|
390
|
+
message: "Shipping label created"
|
|
391
|
+
- type: PrintAction
|
|
392
|
+
id: send-confirmation
|
|
393
|
+
name: Send Confirmation Email
|
|
394
|
+
props:
|
|
395
|
+
message: "Sending order confirmation email..."
|
|
396
|
+
- type: PrintAction
|
|
397
|
+
id: success
|
|
398
|
+
name: Success Message
|
|
399
|
+
props:
|
|
400
|
+
message: "Order processed successfully!"`,
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
id: 'activity-test',
|
|
404
|
+
name: 'Activity Test',
|
|
405
|
+
description: 'CodeExecution + IntegrationAction (view-only)',
|
|
406
|
+
executable: false,
|
|
407
|
+
yaml: `# Activity Test Workflow (requires Temporal activities)
|
|
408
|
+
type: Sequence
|
|
409
|
+
id: activity-test-workflow
|
|
410
|
+
children:
|
|
411
|
+
- type: LogMessage
|
|
412
|
+
id: log-start
|
|
413
|
+
props:
|
|
414
|
+
message: "Starting activity test workflow"
|
|
415
|
+
level: info
|
|
416
|
+
- type: CodeExecution
|
|
417
|
+
id: prepare-row
|
|
418
|
+
props:
|
|
419
|
+
language: javascript
|
|
420
|
+
code: |
|
|
421
|
+
const timestamp = new Date().toISOString();
|
|
422
|
+
setBB('rowData', ['ORD-001', 'Alice', 99.99, timestamp]);
|
|
423
|
+
- type: IntegrationAction
|
|
424
|
+
id: append-to-sheet
|
|
425
|
+
props:
|
|
426
|
+
provider: google-sheets
|
|
427
|
+
action: append_row
|
|
428
|
+
inputs:
|
|
429
|
+
spreadsheetId: "example-spreadsheet-id"
|
|
430
|
+
sheetName: "Orders"
|
|
431
|
+
values: "\${bb.rowData}"
|
|
432
|
+
resultKey: "sheetResult"
|
|
433
|
+
- type: LogMessage
|
|
434
|
+
id: log-result
|
|
435
|
+
props:
|
|
436
|
+
message: "Appended row to sheet"
|
|
437
|
+
level: info`,
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
id: 'file-processing',
|
|
441
|
+
name: 'File Processing',
|
|
442
|
+
description: 'ParseFile + GenerateFile pipeline (view-only)',
|
|
443
|
+
executable: false,
|
|
444
|
+
yaml: `# File Processing Workflow (requires Temporal activities)
|
|
445
|
+
type: Sequence
|
|
446
|
+
id: file-processing-workflow
|
|
447
|
+
children:
|
|
448
|
+
- type: LogMessage
|
|
449
|
+
id: log-start
|
|
450
|
+
props:
|
|
451
|
+
message: "Starting file processing"
|
|
452
|
+
level: info
|
|
453
|
+
- type: ParseFile
|
|
454
|
+
id: parse-input
|
|
455
|
+
props:
|
|
456
|
+
file: "input.csv"
|
|
457
|
+
format: csv
|
|
458
|
+
outputKey: "rawData"
|
|
459
|
+
options:
|
|
460
|
+
trim: true
|
|
461
|
+
- type: CodeExecution
|
|
462
|
+
id: transform-data
|
|
463
|
+
props:
|
|
464
|
+
language: javascript
|
|
465
|
+
code: |
|
|
466
|
+
const data = getBB('rawData') || [];
|
|
467
|
+
const processed = data.map(row => ({
|
|
468
|
+
...row,
|
|
469
|
+
lineTotal: row.quantity * row.price
|
|
470
|
+
}));
|
|
471
|
+
setBB('processedData', processed);
|
|
472
|
+
- type: GenerateFile
|
|
473
|
+
id: export-csv
|
|
474
|
+
props:
|
|
475
|
+
format: csv
|
|
476
|
+
dataKey: "processedData"
|
|
477
|
+
columns:
|
|
478
|
+
- header: "Order ID"
|
|
479
|
+
key: "orderId"
|
|
480
|
+
- header: "Product"
|
|
481
|
+
key: "product"
|
|
482
|
+
- header: "Total"
|
|
483
|
+
key: "lineTotal"
|
|
484
|
+
filename: "output.csv"
|
|
485
|
+
storage: temp
|
|
486
|
+
outputKey: "outputFile"
|
|
487
|
+
- type: LogMessage
|
|
488
|
+
id: log-complete
|
|
489
|
+
props:
|
|
490
|
+
message: "File processing complete"
|
|
491
|
+
level: info`,
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
id: 'http-request',
|
|
495
|
+
name: 'HTTP Request',
|
|
496
|
+
description: 'HttpRequest + CodeExecution pipeline (view-only)',
|
|
497
|
+
executable: false,
|
|
498
|
+
yaml: `# HTTP Request Workflow (requires Temporal activities)
|
|
499
|
+
type: Sequence
|
|
500
|
+
id: http-request-workflow
|
|
501
|
+
children:
|
|
502
|
+
- type: LogMessage
|
|
503
|
+
id: log-start
|
|
504
|
+
props:
|
|
505
|
+
message: "Starting HTTP request workflow"
|
|
506
|
+
level: info
|
|
507
|
+
- type: CodeExecution
|
|
508
|
+
id: setup-config
|
|
509
|
+
props:
|
|
510
|
+
language: javascript
|
|
511
|
+
code: |
|
|
512
|
+
setBB('apiBaseUrl', 'https://api.example.com');
|
|
513
|
+
setBB('authToken', 'mock-auth-token-123');
|
|
514
|
+
- type: HttpRequest
|
|
515
|
+
id: fetch-user
|
|
516
|
+
props:
|
|
517
|
+
url: "\${bb.apiBaseUrl}/users/123"
|
|
518
|
+
method: GET
|
|
519
|
+
headers:
|
|
520
|
+
Authorization: "Bearer \${bb.authToken}"
|
|
521
|
+
timeout: 5000
|
|
522
|
+
responseType: json
|
|
523
|
+
outputKey: "userResponse"
|
|
524
|
+
- type: CodeExecution
|
|
525
|
+
id: process-user-data
|
|
526
|
+
props:
|
|
527
|
+
language: javascript
|
|
528
|
+
code: |
|
|
529
|
+
const response = getBB('userResponse') || {};
|
|
530
|
+
setBB('user', { id: '123', name: response.data?.name || 'User' });
|
|
531
|
+
- type: HttpRequest
|
|
532
|
+
id: create-order
|
|
533
|
+
props:
|
|
534
|
+
url: "\${bb.apiBaseUrl}/orders"
|
|
535
|
+
method: POST
|
|
536
|
+
headers:
|
|
537
|
+
Authorization: "Bearer \${bb.authToken}"
|
|
538
|
+
Content-Type: "application/json"
|
|
539
|
+
body: "\${bb.newOrder}"
|
|
540
|
+
timeout: 10000
|
|
541
|
+
responseType: json
|
|
542
|
+
outputKey: "orderResponse"
|
|
543
|
+
- type: LogMessage
|
|
544
|
+
id: log-complete
|
|
545
|
+
props:
|
|
546
|
+
message: "HTTP workflow complete"
|
|
547
|
+
level: info`,
|
|
548
|
+
},
|
|
549
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Stub for @activepieces/* packages -- not available in the browser
|
|
2
|
+
export const googleSheets = { _actions: {} };
|
|
3
|
+
export const createPiece = () => ({});
|
|
4
|
+
export const Property = {
|
|
5
|
+
ShortText: () => ({}),
|
|
6
|
+
LongText: () => ({}),
|
|
7
|
+
Number: () => ({}),
|
|
8
|
+
Checkbox: () => ({}),
|
|
9
|
+
Dropdown: () => ({}),
|
|
10
|
+
Array: () => ({}),
|
|
11
|
+
Object: () => ({}),
|
|
12
|
+
Json: () => ({}),
|
|
13
|
+
DateTime: () => ({}),
|
|
14
|
+
File: () => ({}),
|
|
15
|
+
OAuth2: () => ({}),
|
|
16
|
+
};
|
|
17
|
+
export const PieceAuth = { OAuth2: () => ({}) };
|
|
18
|
+
export default { googleSheets, createPiece, Property, PieceAuth };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Stub for fs and fs/promises -- not available in the browser
|
|
2
|
+
export function readFileSync(): string { return ''; }
|
|
3
|
+
export function writeFileSync(): void {}
|
|
4
|
+
export function existsSync(): boolean { return false; }
|
|
5
|
+
export function readdirSync(): string[] { return []; }
|
|
6
|
+
export function mkdirSync(): void {}
|
|
7
|
+
export async function readFile(): Promise<string> { return ''; }
|
|
8
|
+
export async function writeFile(): Promise<void> {}
|
|
9
|
+
export async function readdir(): Promise<string[]> { return []; }
|
|
10
|
+
export async function mkdir(): Promise<undefined> { return undefined; }
|
|
11
|
+
export async function stat(): Promise<{ isFile: () => boolean; isDirectory: () => boolean }> {
|
|
12
|
+
return { isFile: () => false, isDirectory: () => false };
|
|
13
|
+
}
|
|
14
|
+
export async function access(): Promise<void> {}
|
|
15
|
+
|
|
16
|
+
export const promises = {
|
|
17
|
+
readFile,
|
|
18
|
+
writeFile,
|
|
19
|
+
readdir,
|
|
20
|
+
mkdir,
|
|
21
|
+
stat,
|
|
22
|
+
access,
|
|
23
|
+
};
|
|
24
|
+
export default { readFileSync, writeFileSync, existsSync, readdirSync, mkdirSync, promises };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Stub for path -- not available in the browser
|
|
2
|
+
export function join(...parts: string[]): string { return parts.join('/'); }
|
|
3
|
+
export function resolve(...parts: string[]): string { return parts.join('/'); }
|
|
4
|
+
export function basename(p: string, ext?: string): string {
|
|
5
|
+
const base = p.split('/').pop() || p;
|
|
6
|
+
return ext && base.endsWith(ext) ? base.slice(0, -ext.length) : base;
|
|
7
|
+
}
|
|
8
|
+
export function extname(p: string): string {
|
|
9
|
+
const dot = p.lastIndexOf('.');
|
|
10
|
+
return dot >= 0 ? p.slice(dot) : '';
|
|
11
|
+
}
|
|
12
|
+
export function dirname(p: string): string {
|
|
13
|
+
return p.split('/').slice(0, -1).join('/') || '.';
|
|
14
|
+
}
|
|
15
|
+
export const sep = '/';
|
|
16
|
+
export default { join, resolve, basename, extname, dirname, sep };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Stub for @temporalio/workflow -- not available in the browser
|
|
2
|
+
export function proxyActivities<T>(): T {
|
|
3
|
+
return {} as T;
|
|
4
|
+
}
|
|
5
|
+
export function sleep(_ms: number): Promise<void> {
|
|
6
|
+
return new Promise((r) => setTimeout(r, _ms));
|
|
7
|
+
}
|
|
8
|
+
export function setHandler() {}
|
|
9
|
+
export function defineQuery() { return () => {}; }
|
|
10
|
+
export function defineSignal() { return () => {}; }
|
|
11
|
+
export function defineUpdate() { return () => {}; }
|
|
12
|
+
export function isCancellation(_err: unknown): boolean { return false; }
|
|
13
|
+
export function proxySinks<T>(): T { return {} as T; }
|
|
14
|
+
export const condition = () => Promise.resolve(true);
|
|
15
|
+
export const workflowInfo = () => ({ workflowId: 'playground', runId: 'local', namespace: 'default' });
|
|
16
|
+
export class CancellationScope {
|
|
17
|
+
static cancellable<T>(fn: () => Promise<T>): Promise<T> { return fn(); }
|
|
18
|
+
static nonCancellable<T>(fn: () => Promise<T>): Promise<T> { return fn(); }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Type stubs
|
|
22
|
+
export interface Sinks { [name: string]: Record<string, (...args: unknown[]) => void>; }
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"moduleDetection": "force",
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"jsx": "react-jsx",
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noUnusedLocals": false,
|
|
16
|
+
"noUnusedParameters": false,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
"forceConsistentCasingInFileNames": true,
|
|
19
|
+
"baseUrl": ".",
|
|
20
|
+
"paths": {
|
|
21
|
+
"@btree/*": ["../src/*"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"include": ["src", "../src"]
|
|
25
|
+
}
|