@addai/flows-mcp 0.2.0 → 0.3.0

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 (74) hide show
  1. package/README.md +13 -0
  2. package/dist/bin/install.js +53 -0
  3. package/dist/bin/install.js.map +1 -1
  4. package/dist/client.d.ts +2 -0
  5. package/dist/client.js +20 -2
  6. package/dist/client.js.map +1 -1
  7. package/dist/healing.d.ts +9 -0
  8. package/dist/healing.js +104 -0
  9. package/dist/healing.js.map +1 -0
  10. package/dist/index.js +6 -4
  11. package/dist/index.js.map +1 -1
  12. package/dist/instructions.d.ts +6 -0
  13. package/dist/instructions.js +149 -0
  14. package/dist/instructions.js.map +1 -0
  15. package/dist/node-defaults.js +395 -46
  16. package/dist/node-defaults.js.map +1 -1
  17. package/dist/prompts.d.ts +2 -0
  18. package/dist/prompts.js +741 -0
  19. package/dist/prompts.js.map +1 -0
  20. package/dist/tools/custom-nodes.js +14 -9
  21. package/dist/tools/custom-nodes.js.map +1 -1
  22. package/dist/tools/flows.js +36 -35
  23. package/dist/tools/flows.js.map +1 -1
  24. package/dist/tools/nodes.js +17 -7
  25. package/dist/tools/nodes.js.map +1 -1
  26. package/dist/tools/preview.d.ts +3 -0
  27. package/dist/tools/preview.js +85 -0
  28. package/dist/tools/preview.js.map +1 -0
  29. package/dist/tools/reference.js +8 -5
  30. package/dist/tools/reference.js.map +1 -1
  31. package/dist/tools/runs.js +112 -1
  32. package/dist/tools/runs.js.map +1 -1
  33. package/dist/tools/variables.js +1 -1
  34. package/dist/tools/variables.js.map +1 -1
  35. package/dist/types.d.ts +13 -0
  36. package/dist/validation/enums.d.ts +20 -0
  37. package/dist/validation/enums.js +36 -0
  38. package/dist/validation/enums.js.map +1 -0
  39. package/dist/validation/handles.d.ts +2 -0
  40. package/dist/validation/handles.js +88 -0
  41. package/dist/validation/handles.js.map +1 -0
  42. package/dist/validation/index.d.ts +3 -0
  43. package/dist/validation/index.js +47 -0
  44. package/dist/validation/index.js.map +1 -0
  45. package/dist/validation/nested-ids.d.ts +2 -0
  46. package/dist/validation/nested-ids.js +55 -0
  47. package/dist/validation/nested-ids.js.map +1 -0
  48. package/dist/validation/reachability.d.ts +2 -0
  49. package/dist/validation/reachability.js +62 -0
  50. package/dist/validation/reachability.js.map +1 -0
  51. package/dist/validation/references.d.ts +2 -0
  52. package/dist/validation/references.js +107 -0
  53. package/dist/validation/references.js.map +1 -0
  54. package/dist/validation/shape-rules.d.ts +7 -0
  55. package/dist/validation/shape-rules.js +284 -0
  56. package/dist/validation/shape-rules.js.map +1 -0
  57. package/dist/validation/shape.d.ts +2 -0
  58. package/dist/validation/shape.js +47 -0
  59. package/dist/validation/shape.js.map +1 -0
  60. package/dist/validation/structure.d.ts +2 -0
  61. package/dist/validation/structure.js +137 -0
  62. package/dist/validation/structure.js.map +1 -0
  63. package/dist/validation/syntax.d.ts +2 -0
  64. package/dist/validation/syntax.js +69 -0
  65. package/dist/validation/syntax.js.map +1 -0
  66. package/dist/validation/types.d.ts +49 -0
  67. package/dist/validation/types.js +2 -0
  68. package/dist/validation/types.js.map +1 -0
  69. package/package.json +15 -4
  70. package/skill/SKILL.md +116 -0
  71. package/skill/anti-patterns.md +207 -0
  72. package/skill/node-cheatsheet.md +37 -0
  73. package/skill/recipes.md +308 -0
  74. package/skill/version.txt +1 -0
@@ -215,6 +215,22 @@ export const ELEMENT_TYPES = {
215
215
  settings: {}
216
216
  }
217
217
  },
218
+ button: {
219
+ type: 'button',
220
+ label: 'Button',
221
+ description: 'Submit / action button',
222
+ category: 'inputs',
223
+ defaultConfig: {
224
+ buttonText: 'Continue',
225
+ buttonColor: '#3b82f6',
226
+ buttonAlign: 'left',
227
+ buttonAction: 'submit',
228
+ buttonLink: '',
229
+ buttonLinkNewTab: true,
230
+ width: 'full',
231
+ settings: {}
232
+ }
233
+ },
218
234
  // ── DISPLAY ELEMENTS (show content) ───────────────────────────────────────
219
235
  textBlock: {
220
236
  type: 'textBlock',
@@ -313,6 +329,7 @@ export const LOADING_CONFIG_DEFAULTS = {
313
329
  // NODE TYPES
314
330
  // ============================================================================
315
331
  export const NODE_TYPES = {
332
+ // ── TRIGGERS ──────────────────────────────────────────────────────────────
316
333
  trigger: {
317
334
  type: 'trigger',
318
335
  label: 'Webhook Trigger',
@@ -323,7 +340,19 @@ export const NODE_TYPES = {
323
340
  webhookPath: '',
324
341
  method: 'POST',
325
342
  description: 'Receives incoming HTTP requests'
326
- }
343
+ },
344
+ guide: 'Starts the flow when an HTTP request is received at the webhook URL. The request body/query/headers are available as the trigger output. Downstream nodes access trigger data via {{triggerId.body.field}}, {{triggerId.headers.field}}, {{triggerId.query.field}}.',
345
+ outputShape: {
346
+ body: 'Request body (parsed JSON or string)',
347
+ headers: 'Request headers object',
348
+ query: 'URL query parameters object',
349
+ method: 'HTTP method (GET, POST, etc.)',
350
+ url: 'Full request URL'
351
+ },
352
+ tips: [
353
+ 'The webhook URL is auto-generated after the flow is published',
354
+ 'Use respondToWebhook node downstream to send a custom response'
355
+ ]
327
356
  },
328
357
  scheduleTrigger: {
329
358
  type: 'scheduleTrigger',
@@ -338,7 +367,16 @@ export const NODE_TYPES = {
338
367
  cronExpression: '0 * * * *',
339
368
  timezone: 'UTC',
340
369
  enabled: true
341
- }
370
+ },
371
+ guide: 'Triggers the flow on a recurring schedule. Use scheduleType "interval" for simple intervals or "cron" for cron expressions. Output contains the scheduled time.',
372
+ outputShape: {
373
+ scheduledTime: 'ISO timestamp of when the trigger fired',
374
+ scheduleType: 'interval or cron'
375
+ },
376
+ tips: [
377
+ 'intervalUnit options: seconds, minutes, hours, days',
378
+ 'Set enabled: false to pause the schedule without removing it'
379
+ ]
342
380
  },
343
381
  tablesSchedule: {
344
382
  type: 'tablesSchedule',
@@ -368,6 +406,12 @@ export const NODE_TYPES = {
368
406
  syncDirection: 'full',
369
407
  syncScope: 'all',
370
408
  undeletable: true
409
+ },
410
+ guide: 'Runs on a cron schedule and provides context for +Ai Tables operations. Typically created automatically by the Tables product. The schedule object uses cron-style fields.',
411
+ outputShape: {
412
+ scheduledTime: 'ISO timestamp',
413
+ databaseId: 'Target database ID',
414
+ tableId: 'Target table ID'
371
415
  }
372
416
  },
373
417
  tableButton: {
@@ -385,6 +429,13 @@ export const NODE_TYPES = {
385
429
  tableUrl: '',
386
430
  undeletable: true,
387
431
  description: 'Triggers when this button is clicked in the table'
432
+ },
433
+ guide: 'Fires when a user clicks a button column in an +Ai Table. The row data is passed as the trigger output.',
434
+ outputShape: {
435
+ row: 'The full row data object from the table',
436
+ rowId: 'Row ID that was clicked',
437
+ tableId: 'Table ID',
438
+ columnId: 'Button column ID'
388
439
  }
389
440
  },
390
441
  tableActionTrigger: {
@@ -403,6 +454,14 @@ export const NODE_TYPES = {
403
454
  enabledButtons: [],
404
455
  undeletable: true,
405
456
  description: 'Triggers when a table button is clicked'
457
+ },
458
+ guide: 'Alternative table button trigger with database context. Fires for specific enabled buttons within a column.',
459
+ outputShape: {
460
+ row: 'Full row data object',
461
+ rowId: 'Row ID',
462
+ buttonId: 'Clicked button ID',
463
+ databaseId: 'Database ID',
464
+ tableId: 'Table ID'
406
465
  }
407
466
  },
408
467
  batchActionTrigger: {
@@ -423,6 +482,14 @@ export const NODE_TYPES = {
423
482
  actionLabel: '',
424
483
  undeletable: true,
425
484
  description: ''
485
+ },
486
+ guide: 'Fires when a batch or autopilot action runs on table rows. Receives the row data for processing.',
487
+ outputShape: {
488
+ row: 'Current row data object',
489
+ rowId: 'Row ID being processed',
490
+ actionId: 'Batch action ID',
491
+ databaseId: 'Database ID',
492
+ tableId: 'Table ID'
426
493
  }
427
494
  },
428
495
  tableTrigger: {
@@ -440,6 +507,15 @@ export const NODE_TYPES = {
440
507
  enabledTriggerIds: [],
441
508
  undeletable: true,
442
509
  description: 'Responds to table row events'
510
+ },
511
+ guide: 'Fires on row INSERT, UPDATE, or DELETE events in an +Ai Table. Configure enabledEvents to filter which events trigger the flow.',
512
+ outputShape: {
513
+ event: 'Event type: INSERT, UPDATE, or DELETE',
514
+ row: 'Current row data (after change for INSERT/UPDATE)',
515
+ oldRow: 'Previous row data (for UPDATE/DELETE)',
516
+ rowId: 'Row ID',
517
+ databaseId: 'Database ID',
518
+ tableId: 'Table ID'
443
519
  }
444
520
  },
445
521
  emailTrigger: {
@@ -450,28 +526,21 @@ export const NODE_TYPES = {
450
526
  defaultData: {
451
527
  label: 'Email Trigger',
452
528
  description: 'Triggers when an email is sent to this flow'
529
+ },
530
+ guide: 'Starts the flow when an email is received at the flow\'s email address. The email content, sender, subject, and attachments are available as output.',
531
+ outputShape: {
532
+ from: 'Sender email address',
533
+ to: 'Recipient email address',
534
+ subject: 'Email subject line',
535
+ text: 'Plain text body',
536
+ html: 'HTML body',
537
+ attachments: 'Array of attachment objects'
453
538
  }
454
539
  },
455
- startForm: {
456
- type: 'startForm',
457
- label: 'Start Form',
458
- category: 'triggers',
459
- description: 'Start flow from a public form',
460
- defaultData: {
461
- label: 'Start Form',
462
- elements: [],
463
- pageStyle: {
464
- backgroundColor: '#ffffff',
465
- backgroundImage: '',
466
- maxWidth: '640px',
467
- padding: '2rem',
468
- showProgressBar: false,
469
- submitButtonText: 'Submit',
470
- submitButtonColor: '#3b82f6'
471
- },
472
- formSlug: ''
473
- }
474
- },
540
+ // (The standalone 'startForm' node type was removed in the start-form
541
+ // refactor — start forms are now page nodes with data.isStartForm===true.
542
+ // See the 'page' entry below for documentation.)
543
+ // ── PROCESSING ────────────────────────────────────────────────────────────
475
544
  httpRequest: {
476
545
  type: 'httpRequest',
477
546
  label: 'HTTP Request',
@@ -489,7 +558,24 @@ export const NODE_TYPES = {
489
558
  timeout: 30000,
490
559
  retries: 0,
491
560
  onError: 'stop'
492
- }
561
+ },
562
+ guide: 'Makes HTTP requests to external APIs. URL, headers values, query param values, and body all support {{nodeId.field}} template syntax.\n\nHeaders: [{key: "Authorization", value: "Bearer {{Variables.apiKey}}", enabled: true}].\nQuery params: [{key: "id", value: "{{triggerId.body.userId}}", enabled: true}].\n\nbodyType options: "none", "json", "text", "xml", "form", "file".\n- json/text/xml: set body as a string\n- form: set formFields as [{key, value, type: "text"|"file", enabled: true}]\n- file: set fileBody (variable reference) + fileContentType (MIME type or "auto-detect")\n\nauthentication: {type: "none"|"bearer"|"basic"|"apikey", token?, username?, password?, apiKeyHeader?, apiKeyValue?}.\n\nonError: "stop" (halt flow) or "continue" (proceed with error in output). Set storeHeaders: true to capture response headers.',
563
+ outputShape: {
564
+ status: 'HTTP status code (number, e.g. 200)',
565
+ body: 'Response body (parsed JSON if Content-Type is application/json, otherwise string). For simple JSON, response fields are also spread at root level.',
566
+ headers: 'Response headers object (only if storeHeaders is true)',
567
+ success: 'boolean — true if status 2xx',
568
+ error: 'Error message string (only on failure when onError is "continue")'
569
+ },
570
+ tips: [
571
+ 'URL supports {{nodeId.field}} templates, e.g. "https://api.example.com/users/{{triggerId.body.userId}}"',
572
+ 'For JSON body, set bodyType to "json" and body to a JSON string with {{}} templates inside',
573
+ 'For form data, set bodyType to "form" and formFields as [{key, value, type: "text", enabled: true}]',
574
+ 'Set authentication.type to "bearer" with authentication.token for bearer auth',
575
+ 'Set retries > 0 for automatic retry on failure (max 10)',
576
+ 'Set onError to "continue" if you want to handle errors in downstream nodes instead of stopping the flow',
577
+ 'Set storeHeaders: true to include response headers in output'
578
+ ]
493
579
  },
494
580
  respondToWebhook: {
495
581
  type: 'respondToWebhook',
@@ -503,7 +589,19 @@ export const NODE_TYPES = {
503
589
  bodyType: 'json',
504
590
  headers: [],
505
591
  description: 'Sends a custom response to the webhook caller'
506
- }
592
+ },
593
+ guide: 'Sends a custom HTTP response back to the webhook caller. Only works in flows triggered by a Webhook Trigger. responseBody and headers support {{nodeId.field}} templates. bodyType: "json", "text", "html". Headers format: [{key: "Content-Type", value: "application/json"}].',
594
+ outputShape: {
595
+ success: 'boolean — true if response was sent',
596
+ statusCode: 'The status code that was sent',
597
+ responseBody: 'The response body that was sent',
598
+ skipped: 'true if no webhook connection was available'
599
+ },
600
+ tips: [
601
+ 'Must be used in a flow that starts with a Webhook Trigger',
602
+ 'Can only send one response per webhook request — use the first one in the flow path',
603
+ 'responseBody supports {{}} templates for dynamic responses'
604
+ ]
507
605
  },
508
606
  code: {
509
607
  type: 'code',
@@ -514,10 +612,25 @@ export const NODE_TYPES = {
514
612
  label: 'Code',
515
613
  isAction: true,
516
614
  mode: 'runOnce',
517
- code: '// All upstream data is available via $input\nconst data = $input;\n\nreturn {\n result: data\n};',
615
+ code: '// Access upstream node outputs via $("nodeId")\n// const data = $("previous-node-id");\n\nreturn {\n result: "hello"\n};',
518
616
  itemsPath: '',
519
617
  onError: 'stop'
520
- }
618
+ },
619
+ guide: 'Executes inline JavaScript in a sandbox. TWO MODES:\n\n**runOnce mode:** Code runs once. Available globals:\n- `$("nodeId")` — lookup any upstream node\'s output by its node ID. This is the primary way to access data.\n- `console.log()` — logging\n- `fetch(url, options)` — HTTP requests (localhost/private IPs blocked)\n- Code must `return { key: value }` — returned keys become the node\'s output fields\n\n**runForEachItem mode:** Iterates over an array. Set `itemsPath` to the path within the parent output to the array (e.g. "data.items"). Available globals:\n- `item` — current array element\n- `index` — current array index\n- `$("nodeId")`, `console`, `fetch` — same as runOnce\n- Returns array of results\n\nIMPORTANT: Do NOT use {{}} template syntax in code — that is for config fields only. Use $("nodeId") instead.',
620
+ outputShape: {
621
+ '<user-defined>': 'Whatever keys the code returns are spread into the output. E.g. return {name: "John", age: 30} makes {{codeNodeId.name}} and {{codeNodeId.age}} available downstream.'
622
+ },
623
+ handles: {
624
+ source: [{ id: 'right', description: 'Default output (code result)' }]
625
+ },
626
+ tips: [
627
+ 'Always return an object: return { result: data }',
628
+ 'Use $("nodeId") to access any upstream node\'s output by ID — this is the correct way to get data',
629
+ 'Do NOT use {{}} syntax in code — that is for config fields only',
630
+ 'In runForEachItem mode, item and index are available for the current iteration',
631
+ 'fetch() is available but blocks localhost and private IP ranges',
632
+ 'Example: const userData = $("abc-123-node-id"); return { name: userData.body.name };'
633
+ ]
521
634
  },
522
635
  map: {
523
636
  type: 'map',
@@ -528,8 +641,22 @@ export const NODE_TYPES = {
528
641
  label: 'Map Data',
529
642
  mappings: [],
530
643
  outputFormat: 'object'
531
- }
644
+ },
645
+ guide: 'Transforms data by mapping input expressions to output keys. Each mapping: {id: "<uuid>", inputExpression: "{{nodeId.field}}", outputName: "myKey", transformType: "direct", enabled: true, description: ""}.\n\nTransform types (17): direct, toString, toNumber, toBoolean, toJson, stringify, lowercase, uppercase, trim, length, split, join, extract, replace, template, calculate, custom.\n\nTransform-specific fields:\n- split: set delimiter (e.g. ",")\n- join: set separator (e.g. ", ")\n- extract: set pattern (regex string)\n- replace: set find + replaceWith\n- template: set template (string with {field} placeholders)\n- calculate: set expression (math expression)\n- custom: set customCode (JavaScript code)',
646
+ outputShape: {
647
+ '<outputName>': 'Each mapping produces an output key with the transformed value. E.g. mapping with outputName "email" makes {{mapNodeId.email}} available downstream.',
648
+ '_metadata': '{successfulMappings: string[], failedMappings: array, totalMappings: number}',
649
+ 'transformMode': '"standard", "batch", "merge", or "restructure"'
650
+ },
651
+ tips: [
652
+ 'inputExpression supports {{nodeId.field}} template syntax',
653
+ 'Each mapping needs a unique id (crypto.randomUUID())',
654
+ 'Use "custom" transformType for complex logic — provide JavaScript in customCode',
655
+ 'Set enabled: false to temporarily disable a mapping',
656
+ 'Failed mappings don\'t stop execution — check _metadata.failedMappings'
657
+ ]
532
658
  },
659
+ // ── LOGIC ─────────────────────────────────────────────────────────────────
533
660
  if: {
534
661
  type: 'if',
535
662
  label: 'If Condition',
@@ -539,7 +666,27 @@ export const NODE_TYPES = {
539
666
  label: 'If Condition',
540
667
  conditions: [],
541
668
  conditionLogic: 'and'
542
- }
669
+ },
670
+ guide: 'Branches the flow based on conditions. Each condition: {id: "<uuid>", leftValue: "{{nodeId.field}}", operator: "equals", rightValue: "expected", dataType: "string"}. conditionLogic: "and" (all must match) or "or" (any matches). Connect the "true" handle to the success path and "false" to the fallback path.\n\nOperators (23): equals, not_equals, greater_than, greater_than_or_equal, less_than, less_than_or_equal, contains, not_contains, starts_with, ends_with, matches_regex, is_empty, is_not_empty, is_null, is_not_null, is_true, is_false, in_array, not_in_array, array_contains, array_length, between, custom_expression.\n\ndataType options: auto, string, number, boolean, array, object, date.\n\nFor "between" operator, add range: {min, max}. For "custom_expression" operator, add expression: "JavaScript expression".',
671
+ outputShape: {
672
+ conditionMet: 'boolean — true if conditions passed',
673
+ evaluatedConditions: 'Array of condition results with leftResolved and rightResolved values',
674
+ logicOperator: '"AND" or "OR"'
675
+ },
676
+ handles: {
677
+ source: [
678
+ { id: 'true', description: 'Condition met — all/any conditions passed' },
679
+ { id: 'false', description: 'Condition not met — conditions failed' }
680
+ ]
681
+ },
682
+ tips: [
683
+ 'leftValue and rightValue support {{nodeId.field}} templates',
684
+ 'Use source_handle "true" or "false" when connecting edges from this node',
685
+ 'Use dataType to ensure proper comparison (e.g. "number" for numeric comparisons)',
686
+ 'Unary operators (is_empty, is_not_empty, is_null, is_not_null, is_true, is_false) ignore rightValue',
687
+ 'Use "between" operator with range: {min: "0", max: "100"} for range checks',
688
+ 'Each condition needs a unique id (crypto.randomUUID())'
689
+ ]
543
690
  },
544
691
  switch: {
545
692
  type: 'switch',
@@ -551,7 +698,27 @@ export const NODE_TYPES = {
551
698
  cases: [],
552
699
  mode: 'first',
553
700
  hasDefault: true
554
- }
701
+ },
702
+ guide: 'Multi-path branching. Each case: {id: "case_<timestamp>", label: "Case Name", outputLabel: "case-0", conditions: [{id, leftValue, operator, rightValue, dataType}], logicOperator: "AND", enabled: true}. The outputLabel is used as the source_handle for edges. Mode "first" stops at the first matching case; "all" executes all matching paths. If hasDefault is true, include a "default" handle for when no cases match.\n\nCondition format is identical to the If node (same 23 operators, same dataType options).',
703
+ outputShape: {
704
+ matchedHandles: 'Array of matched case handle IDs (outputLabel values)',
705
+ matchedCaseLabels: 'Array of matched case label strings',
706
+ hasDefault: 'boolean',
707
+ mode: '"first" or "all"'
708
+ },
709
+ handles: {
710
+ source: [
711
+ { id: '<case.outputLabel>', description: 'Each case uses its outputLabel as the handle ID (e.g. "case-0", "case-1")' },
712
+ { id: 'default', description: 'Fallback when no cases match (only if hasDefault is true)' }
713
+ ]
714
+ },
715
+ tips: [
716
+ 'source_handle must match the case\'s outputLabel value (e.g. "case-0")',
717
+ 'Always include a "default" handle path unless you\'re certain all cases are covered',
718
+ 'Cases use the same condition format as If nodes (same 23 operators)',
719
+ 'Set enabled: false on a case to temporarily disable it without removing',
720
+ 'Each case needs a unique id (e.g. "case_" + Date.now()) and outputLabel (e.g. "case-0")'
721
+ ]
555
722
  },
556
723
  wait: {
557
724
  type: 'wait',
@@ -563,7 +730,20 @@ export const NODE_TYPES = {
563
730
  waitType: 'duration',
564
731
  duration: 5,
565
732
  durationUnit: 'seconds'
566
- }
733
+ },
734
+ guide: 'Pauses flow execution. waitType "duration" pauses for a set time (duration + durationUnit). waitType "until" waits until a specific datetime. Waits longer than ~30 seconds persist to database (sets pauseInDatabase: true) and resume automatically later.',
735
+ outputShape: {
736
+ type: '"delay" for duration waits, "until" for datetime waits',
737
+ duration: 'Wait time in milliseconds (for duration type)',
738
+ completedAt: 'ISO timestamp when wait completed (short waits)',
739
+ pauseInDatabase: 'true for long waits (>30s) — flow persisted and resumed later',
740
+ resumeAt: 'ISO timestamp to resume at (long waits)'
741
+ },
742
+ tips: [
743
+ 'durationUnit options: seconds, minutes, hours, days',
744
+ 'Long waits (>30s) are persisted to database — the flow resumes even after server restarts',
745
+ 'In test mode, waits are skipped (output includes skippedWait: true)'
746
+ ]
567
747
  },
568
748
  flow: {
569
749
  type: 'flow',
@@ -576,33 +756,72 @@ export const NODE_TYPES = {
576
756
  flowName: null,
577
757
  waitForCompletion: true,
578
758
  body: '{}'
579
- }
759
+ },
760
+ guide: 'Executes another flow as a sub-flow. Set flowId to the target flow\'s ID. body accepts a JSON string with input data for the child flow (supports {{nodeId.field}} templates). If waitForCompletion is true, this node waits for the child flow to finish and returns its output; if false, it fires and forgets.',
761
+ outputShape: {
762
+ flowId: 'The executed flow\'s ID',
763
+ flowName: 'The executed flow\'s name',
764
+ runId: 'The child flow run ID',
765
+ waitedForCompletion: 'boolean',
766
+ status: '"completed", "triggered", "failed", or "timeout"',
767
+ success: 'boolean',
768
+ outputs: 'Child flow outputs (only when waitedForCompletion is true and status is "completed")'
769
+ },
770
+ tips: [
771
+ 'body supports {{}} templates for passing dynamic data to the child flow',
772
+ 'Set waitForCompletion to false for fire-and-forget execution',
773
+ 'The child flow must have a trigger node to receive the input data'
774
+ ]
580
775
  },
581
776
  goal: {
582
777
  type: 'goal',
583
778
  label: 'Goal',
584
779
  category: 'logic',
585
- description: 'Goal endpoint for subflow or flow',
780
+ description: 'Goal endpoint — marks a successful flow outcome',
586
781
  defaultData: {
587
782
  label: 'Goal',
588
783
  goalName: ''
589
- }
784
+ },
785
+ guide: 'Terminal node that marks a successful flow outcome. Used for analytics tracking and end conditions. Set goalName to identify this goal in stats. When reached, the flow run status is set to "goal" with the goal name recorded.',
786
+ outputShape: {
787
+ goalName: 'The configured goal name',
788
+ isEndNode: 'true',
789
+ endType: '"goal"',
790
+ success: 'true'
791
+ },
792
+ tips: [
793
+ 'Goal nodes have no output handles — they terminate the flow path',
794
+ 'goalName appears in flow stats and outcome breakdowns',
795
+ 'Multiple goal nodes can exist in a flow for different success paths'
796
+ ]
590
797
  },
591
798
  exit: {
592
799
  type: 'exit',
593
800
  label: 'Exit',
594
801
  category: 'logic',
595
- description: 'Exit endpoint for subflow or flow',
802
+ description: 'Exit endpoint — marks an alternative flow outcome',
596
803
  defaultData: {
597
804
  label: 'Exit',
598
805
  exitName: ''
599
- }
806
+ },
807
+ guide: 'Terminal node that marks an alternative (non-success) flow outcome. Used for analytics tracking. Set exitName to identify this exit in stats. Similar to Goal but semantically represents an exit/fallback path.',
808
+ outputShape: {
809
+ exitName: 'The configured exit name',
810
+ isEndNode: 'true',
811
+ endType: '"exit"',
812
+ success: 'false'
813
+ },
814
+ tips: [
815
+ 'Exit nodes have no output handles — they terminate the flow path',
816
+ 'exitName appears in flow stats and outcome breakdowns',
817
+ 'Use Exit for fallback/rejection paths, Goal for success paths'
818
+ ]
600
819
  },
601
820
  review: {
602
821
  type: 'review',
603
822
  label: 'Review',
604
823
  category: 'logic',
605
- description: 'Wait for approval before continuing',
824
+ description: 'Wait for human approval before continuing',
606
825
  defaultData: {
607
826
  label: 'Review',
608
827
  title: 'Review Required',
@@ -612,17 +831,39 @@ export const NODE_TYPES = {
612
831
  { id: 'option_0', label: 'Approve', color: 'green' },
613
832
  { id: 'option_1', label: 'Reject', color: 'red' }
614
833
  ]
615
- }
834
+ },
835
+ guide: 'Pauses the flow and creates a human review task. The flow resumes when a reviewer selects an option.\n\nfields: [{id: "field_<timestamp>", label: "Field Name", value: "{{nodeId.field}}"}] — value supports {{nodeId.field}} templates, resolved before the review task is created. These show contextual data to the reviewer.\n\noptions: [{id: "option_0", label: "Approve", color: "green"}] — each option becomes a source handle. Colors: "green", "red", "blue", "yellow", "orange", "purple", "gray".\n\nConnect edges from each option\'s handle to the appropriate downstream path.',
836
+ outputShape: {
837
+ selectedOption: 'ID of the chosen option (e.g. "option_0")',
838
+ selectedOptionLabel: 'Label of the chosen option (e.g. "Approve")',
839
+ reviewData: 'Object of resolved field values: {fieldLabel: resolvedValue}',
840
+ respondedBy: 'User ID of the reviewer',
841
+ respondedDate: 'ISO timestamp of the response'
842
+ },
843
+ handles: {
844
+ source: [
845
+ { id: 'option_0', description: 'First option (default: Approve)' },
846
+ { id: 'option_1', description: 'Second option (default: Reject)' },
847
+ { id: 'option_N', description: 'Additional options use sequential IDs: option_2, option_3, etc.' }
848
+ ]
849
+ },
850
+ tips: [
851
+ 'source_handle must match the option\'s id (e.g. "option_0" for Approve)',
852
+ 'Field values support {{nodeId.field}} templates for showing dynamic context',
853
+ 'Add more options by extending the options array with sequential IDs',
854
+ 'Review tasks appear in the /reviews page for workspace members'
855
+ ]
616
856
  },
617
857
  page: {
618
858
  type: 'page',
619
859
  label: 'Page',
620
860
  category: 'logic',
621
- description: 'Show a form page and wait for submission',
861
+ description: 'Show a form page (mid-flow) or act as a public form trigger (data.isStartForm)',
622
862
  defaultData: {
623
863
  label: 'Page',
624
864
  elements: [],
625
865
  abandonments: [],
866
+ isStartForm: false,
626
867
  pageStyle: {
627
868
  backgroundColor: '#ffffff',
628
869
  backgroundImage: '',
@@ -639,7 +880,33 @@ export const NODE_TYPES = {
639
880
  animation: 'spinner',
640
881
  backgroundColor: '#ffffff'
641
882
  }
642
- }
883
+ },
884
+ guide: 'A page node renders a form. By default it pauses the flow mid-execution and resumes when the user submits.\n\nelements: array of form elements (use list_page_elements for available types). Each element needs {id: "<uuid>", type: "shortText", label: "Field Name", ...config}.\n\nabandonments: [{id, name, delay, delayUnit}] — optional paths that trigger if the user doesn\'t submit within the delay.\n\nSubmission data is keyed by element LABEL (not ID). Downstream nodes reference via {{pageNodeId.submissionData.Element Label}}.\n\npageStyle: controls form appearance. loadingConfig: loading screen shown while the next step processes.\n\nStart-form mode: set data.isStartForm: true to make the page a public form TRIGGER (replaces the legacy startForm node type). When enabled:\n - The page has no input handle and starts the flow when its public URL receives a submission.\n - data.formSlug (defaulting to the node id) controls the public URL: /form/<flowId>/<slugOrNodeId>. Slug must be unique within the flow.\n - isStartForm is mutually exclusive with isGoal and isExit.\n - The output gains formData (id-keyed raw), urlParams (querystring at landing), and fingerprint (browser+server) on top of the regular page output.',
885
+ outputShape: {
886
+ submissionData: 'Object keyed by element label -> submitted value. E.g. {"Email": "user@example.com", "Full Name": "John Doe"}',
887
+ submittedDate: 'ISO timestamp of form submission',
888
+ status: '"completed" for submission, "abandoned" for abandonment timeout',
889
+ activeHandle: '"right" for submission, or abandonment handle ID',
890
+ formData: '(start-form pages only) Object keyed by element ID -> raw submitted value',
891
+ urlParams: '(start-form pages only) Object of URL query params at landing',
892
+ fingerprint: '(start-form pages only) Browser + server fingerprint object'
893
+ },
894
+ handles: {
895
+ source: [
896
+ { id: 'right', description: 'Form submitted successfully' },
897
+ { id: '<abandonment.id>', description: 'Abandonment timeout path (one per abandonment rule)' }
898
+ ]
899
+ },
900
+ tips: [
901
+ 'Use source_handle "right" for the submission path',
902
+ 'Elements need a unique id (crypto.randomUUID()), type, and label at minimum',
903
+ 'Submission data is keyed by LABEL not ID — {{pageNodeId.submissionData.Email}}',
904
+ 'Display elements (textBlock, image, video) show content but produce no submission data',
905
+ 'Default values in elements support {{nodeId.field}} templates for pre-filling from upstream data',
906
+ 'Use list_page_elements to see all available element types and their configurations',
907
+ 'For a public form trigger, set data.isStartForm: true (mutually exclusive with isGoal/isExit)',
908
+ 'Start-form pages use data.formSlug for the public URL slug (defaults to the node id)'
909
+ ]
643
910
  },
644
911
  loop: {
645
912
  type: 'loop',
@@ -651,7 +918,31 @@ export const NODE_TYPES = {
651
918
  arraySources: [''],
652
919
  enableFailRoute: false,
653
920
  description: 'Loop over each item in an array'
654
- }
921
+ },
922
+ guide: 'Iterates over an array. arraySources accepts {{nodeId.fieldName}} references pointing to arrays. The "loop" handle path executes once per item (the current item is available as the loop node\'s output). After all iterations complete, the "done" handle fires. If enableFailRoute is true, failed iterations route to "fail".\n\nDuring each iteration, downstream nodes access:\n- {{loopNodeId.currentItem}} — the current array element\n- {{loopNodeId.currentIndex}} — 0-based iteration index\n- {{loopNodeId.totalItems}} — total count',
923
+ outputShape: {
924
+ items: 'The full resolved array',
925
+ totalItems: 'Total number of items',
926
+ currentItem: 'Current array element (available during each "loop" iteration)',
927
+ currentIndex: 'Current 0-based index (available during each "loop" iteration)',
928
+ loopHandle: '"loop" — the handle ID for per-item execution',
929
+ doneHandle: '"done" — the handle ID for post-completion',
930
+ enableFailRoute: 'boolean'
931
+ },
932
+ handles: {
933
+ source: [
934
+ { id: 'loop', description: 'Executes once per item — currentItem and currentIndex available' },
935
+ { id: 'done', description: 'Fires after all iterations complete' },
936
+ { id: 'fail', description: 'Failed iterations route here (only when enableFailRoute is true)' }
937
+ ]
938
+ },
939
+ tips: [
940
+ 'arraySources uses {{nodeId.field}} syntax, e.g. ["{{httpRequestId.body.data}}"]',
941
+ 'Nodes in the loop body access {{loopNodeId.currentItem}} and {{loopNodeId.currentIndex}}',
942
+ 'After all iterations, "done" handle fires — use this for post-processing',
943
+ 'Enable enableFailRoute to handle iteration errors separately',
944
+ 'Multiple arraySources are supported — they are concatenated into a single array'
945
+ ]
655
946
  },
656
947
  subflow: {
657
948
  type: 'subflow',
@@ -661,7 +952,13 @@ export const NODE_TYPES = {
661
952
  defaultData: {
662
953
  label: 'Subflow',
663
954
  description: 'Group of nodes'
664
- }
955
+ },
956
+ guide: 'Visual grouping node that collapses a set of nodes into a single block on the canvas. Does not affect execution logic — nodes inside execute normally. Used for organization and readability.',
957
+ outputShape: {},
958
+ tips: [
959
+ 'Subflows are purely visual — they don\'t change execution behavior',
960
+ 'Drag nodes into the subflow group on the canvas to add them'
961
+ ]
665
962
  },
666
963
  variable: {
667
964
  type: 'variable',
@@ -677,7 +974,23 @@ export const NODE_TYPES = {
677
974
  value: '',
678
975
  defaultValue: '',
679
976
  variables: []
680
- }
977
+ },
978
+ guide: 'Manages flow-level variables that persist across the flow run.\n\naction "create": Creates multiple variables at once using the "variables" array: [{name: "myVar", type: "string", defaultValue: "", isList: false, deduplicate: false}].\naction "update": Modifies a single variable. Set variableName, operator, and value. value supports {{nodeId.field}} templates.\naction "delete": Removes a variable by variableName.\n\nVariable types: string, number, boolean, object.\nString operators: set, concat, append.\nNumber operators: set, add, subtract, multiply, divide.\nList operators (when isList is true): set, push, pop, shift, unshift, concat, unique, reverse, sort.\n\nVariables are referenced in other nodes as {{Variables.varName}}. The create action also accepts defaultValue with {{}} templates.',
979
+ outputShape: {
980
+ action: '"create", "update", or "delete"',
981
+ variableName: 'Name of the variable (update/delete only)',
982
+ previousValue: 'Value before the change',
983
+ newValue: 'Value after the change',
984
+ createdVariables: 'Array of created variable names (create action only)',
985
+ __updatedVariables: 'Internal: full variables state after change (system use)',
986
+ __updatedVariablesMeta: 'Internal: variable metadata after change (system use)'
987
+ },
988
+ tips: [
989
+ 'Reference variables in other node config fields as {{Variables.varName}}',
990
+ 'value supports {{nodeId.field}} templates for dynamic updates',
991
+ 'Use isList: true for array variables with list-specific operators (push, pop, etc.)',
992
+ 'Create variables first using the set_variable tool or a Variable node with action "create"'
993
+ ]
681
994
  },
682
995
  splitTest: {
683
996
  type: 'splitTest',
@@ -690,8 +1003,27 @@ export const NODE_TYPES = {
690
1003
  { id: 'v_0', label: 'Variant A', percentage: 50 },
691
1004
  { id: 'v_1', label: 'Variant B', percentage: 50 }
692
1005
  ]
693
- }
1006
+ },
1007
+ guide: 'Routes traffic randomly based on percentage weights for A/B testing. Each variant has {id, label, percentage}. Percentages must sum to 100. The variant label is used as the source_handle for edges.',
1008
+ outputShape: {
1009
+ selectedHandle: 'The selected variant\'s label (used as handle ID)',
1010
+ selectedLabel: 'The selected variant\'s label',
1011
+ selectedVariantId: 'The selected variant\'s id'
1012
+ },
1013
+ handles: {
1014
+ source: [
1015
+ { id: 'Variant A', description: 'First variant path (50% by default)' },
1016
+ { id: 'Variant B', description: 'Second variant path (50% by default)' }
1017
+ ]
1018
+ },
1019
+ tips: [
1020
+ 'source_handle must match the variant\'s label string (e.g. "Variant A")',
1021
+ 'Percentages must sum to 100',
1022
+ 'Add more variants by extending the variants array',
1023
+ 'Use the split test management tools (create_split_test, etc.) for production A/B testing with version routing'
1024
+ ]
694
1025
  },
1026
+ // ── CUSTOM ────────────────────────────────────────────────────────────────
695
1027
  customNode: {
696
1028
  type: 'customNode',
697
1029
  label: 'Custom Node',
@@ -707,17 +1039,34 @@ export const NODE_TYPES = {
707
1039
  customNodeIcon: null,
708
1040
  customNodeVersion: null,
709
1041
  onError: 'stop'
710
- }
1042
+ },
1043
+ guide: 'Uses a published custom node definition. Set customNodeId to the custom node\'s ID and optionally customVersionId for a specific version.\n\nInput values are configured as additional data properties (matching the custom node\'s input_schema keys). These values support {{nodeId.field}} template syntax and are resolved BEFORE the custom node code runs.\n\nIMPORTANT: Custom node code receives inputs as `inputs.keyName` — NOT $("nodeId"). The $() function is only available in inline Code nodes.\n\nCustom node code also has access to `secrets.keyName` for configured secrets and `fetch()` for HTTP calls.',
1044
+ outputShape: {
1045
+ '<defined by output_schema>': 'Output keys match the custom node\'s output_schema. Each key from the schema is available as {{customNodeId.key}} downstream.'
1046
+ },
1047
+ tips: [
1048
+ 'Custom node code uses inputs.keyName, NOT $("nodeId") — $() is only for inline Code nodes',
1049
+ 'Input values in the flow editor support {{nodeId.field}} templates — they\'re resolved before code runs',
1050
+ 'Set onError to "stop" (halt flow) or "continue" (proceed with error in output)',
1051
+ 'Use list_custom_nodes to see available custom nodes and their input/output schemas'
1052
+ ]
711
1053
  },
1054
+ // ── UTILITY ───────────────────────────────────────────────────────────────
712
1055
  note: {
713
1056
  type: 'note',
714
1057
  label: 'Note',
715
1058
  category: 'utility',
716
- description: 'Add notes to your flow',
1059
+ description: 'Add notes to your flow canvas',
717
1060
  defaultData: {
718
1061
  label: 'Note',
719
1062
  content: ''
720
- }
1063
+ },
1064
+ guide: 'A visual annotation on the canvas. Does not affect execution. Use for documentation, TODOs, or explaining complex flow logic to team members.',
1065
+ outputShape: {},
1066
+ tips: [
1067
+ 'Notes are not connected to the flow — they are visual only',
1068
+ 'Use markdown in the content field for formatting'
1069
+ ]
721
1070
  }
722
1071
  };
723
1072
  //# sourceMappingURL=node-defaults.js.map