@oomol-lab/open-flow 0.1.0-beta.72 → 0.1.0-beta.74
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/LICENSE +36 -0
- package/NOTICE +7 -0
- package/README.md +40 -0
- package/dist/browser/{createResourceDialog-BWJkjiOO.js → createResourceDialog-DI9pL-Yr.js} +2 -2
- package/dist/browser/{dialog-CUy_fwx9.js → dialog-BYJGvItc.js} +54 -19
- package/dist/browser/{flowChanges-CgSnSqqP.js → flowChanges-RL-H4CjD.js} +306 -48
- package/dist/browser/{flowWorkspace-Bf7H-r0t.js → flowWorkspace-BkDsETj0.js} +20745 -20186
- package/dist/browser/preview.css +73 -3
- package/dist/browser/preview.js +21410 -20607
- package/dist/browser/{typeScriptSession-B0hC-C8y.js → typeScriptSession-CSRwWmZm.js} +1 -1
- package/dist/browser/ui.css +72 -2
- package/dist/browser/workbench.css +73 -3
- package/dist/browser/workbench.js +14 -76
- package/dist/browser/{workbenchSelect-C3e4J93X.js → workbenchSelect-BcWPWGzw.js} +1 -1
- package/dist/command/index.js +34 -34
- package/dist/common/authoring.d.ts +1 -1
- package/dist/common/authoringFields.d.ts +1 -1
- package/dist/common/authoringSchema.d.ts +28 -4
- package/dist/common/connector-proxy.d.ts +1 -1
- package/dist/common/control-api-conformance.d.ts +1 -1
- package/dist/common/control-api-conformance.js +61 -24
- package/dist/common/control-api.d.ts +4 -3
- package/dist/common/control-api.js +90 -42
- package/dist/common/control-requests.d.ts +2 -1
- package/dist/common/control-requests.js +204 -42
- package/dist/common/cron-trigger.d.ts +1 -1
- package/dist/common/decision.d.ts +1 -1
- package/dist/common/draftOperations.d.ts +1 -1
- package/dist/common/engine-contract.d.ts +3 -2
- package/dist/common/event-source-definition.d.ts +1 -1
- package/dist/common/flow-agent.d.ts +1 -1
- package/dist/{browser → common}/flow-authoring-node.d.ts +3 -3
- package/dist/{browser → common}/flow-authoring.js +75 -23
- package/dist/{browser → common}/flow-change-schema.d.ts +177 -6
- package/dist/{browser → common}/flow-change.d.ts +35 -15
- package/dist/{browser → common}/flow-change.js +77 -25
- package/dist/common/flow-connectionUsage.d.ts +1 -1
- package/dist/common/flow-encoding.d.ts +1 -1
- package/dist/common/flow-encoding.js +34 -16
- package/dist/common/flow-errorHandling.d.ts +1 -1
- package/dist/common/flow-graph.d.ts +1 -1
- package/dist/common/flow-modules.d.ts +1 -1
- package/dist/common/flow-promptTemplate.d.ts +1 -1
- package/dist/common/flow-retry.d.ts +1 -1
- package/dist/common/flow-semantics.d.ts +1 -1
- package/dist/common/flow-semantics.js +151 -32
- package/dist/common/flow-workflowFile.d.ts +1 -1
- package/dist/common/flowInspection.d.ts +3 -3
- package/dist/common/integration-trigger.d.ts +1 -1
- package/dist/common/licenses.md +118 -1
- package/dist/common/liveDetails.d.ts +1 -1
- package/dist/common/mcp.d.ts +2 -1
- package/dist/common/mcp.js +59 -22
- package/dist/common/openapi.d.ts +1 -1
- package/dist/common/poll-trigger.d.ts +1 -1
- package/dist/common/run-results.d.ts +8 -1
- package/dist/common/runtime-contract.d.ts +8 -2
- package/dist/common/runtime-contract.js +22 -5
- package/dist/common/scheduler-checkpoint.d.ts +1 -1
- package/dist/common/scheduler-dependencies.d.ts +1 -1
- package/dist/common/scheduler-node-execution.d.ts +1 -1
- package/dist/common/scheduler.d.ts +2 -2
- package/dist/common/scheduler.js +31 -12
- package/dist/common/trigger-catalog.d.ts +1 -1
- package/dist/common/trigger-config-options.d.ts +1 -1
- package/dist/common/trigger-config.d.ts +1 -1
- package/dist/common/trigger-contract.d.ts +2 -2
- package/dist/common/trigger-localization.d.ts +1 -1
- package/dist/common/webhook-response.d.ts +1 -1
- package/dist/common/webhook-trigger.d.ts +1 -1
- package/dist/common/workflow.d.ts +17 -1
- package/dist/common/workflow.js +68 -22
- package/dist/index.d.ts +6 -3
- package/package.json +7 -6
- package/src/base/common/json.ts +90 -0
- package/src/canvas/common/commands.ts +15 -0
- package/src/connector/common/actionSchema.ts +168 -0
- package/src/connector/common/proxy.ts +44 -0
- package/src/control/common/api.ts +1505 -0
- package/src/control/common/authoring.ts +912 -0
- package/src/control/common/authoringCondition.ts +110 -0
- package/src/control/common/authoringDiagnosticFields.ts +136 -0
- package/src/control/common/authoringExamples.ts +192 -0
- package/src/control/common/authoringFields.ts +53 -0
- package/src/control/common/authoringLlm.ts +70 -0
- package/src/control/common/authoringOpenApi.ts +129 -0
- package/src/control/common/authoringSchema.ts +404 -0
- package/src/control/common/authoringTools.ts +123 -0
- package/src/control/common/authoringTriggers.ts +26 -0
- package/src/control/common/checkDecoders.ts +65 -0
- package/src/control/common/conformance.ts +1989 -0
- package/src/control/common/connectorDecoders.ts +370 -0
- package/src/control/common/connectorQueries.ts +61 -0
- package/src/control/common/decoding.ts +60 -0
- package/src/control/common/draftOperations.ts +61 -0
- package/src/control/common/errors.ts +114 -0
- package/src/control/common/eventSourceSchemas.ts +13 -0
- package/src/control/common/eventSources.ts +186 -0
- package/src/control/common/flowDecoders.ts +153 -0
- package/src/control/common/flowInspection.ts +181 -0
- package/src/control/common/flowNotifications.ts +37 -0
- package/src/control/common/liveDetails.ts +124 -0
- package/src/control/common/mcp.ts +241 -0
- package/src/control/common/mcpConformance.ts +142 -0
- package/src/control/common/providerAccess.ts +28 -0
- package/src/control/common/providerIconSprite.ts +42 -0
- package/src/control/common/publicationDecoders.ts +98 -0
- package/src/control/common/random.ts +16 -0
- package/src/control/common/requests.ts +112 -0
- package/src/control/common/resultQuery.ts +8 -0
- package/src/control/common/results.ts +176 -0
- package/src/control/common/revisionDecoders.ts +52 -0
- package/src/control/common/runDecoders.ts +240 -0
- package/src/control/common/triggerCatalog.ts +89 -0
- package/src/control/common/triggerDecoders.ts +175 -0
- package/src/decision/common/decision.ts +168 -0
- package/src/event-source/common/catalog.generated.json +65 -0
- package/src/event-source/common/definition.ts +66 -0
- package/src/event-source/common/index.ts +99 -0
- package/src/execution/common/checkpoint.ts +311 -0
- package/src/execution/common/dependencies.ts +440 -0
- package/src/execution/common/engineContract.ts +80 -0
- package/src/execution/common/events.ts +328 -0
- package/src/execution/common/node-execution.ts +467 -0
- package/src/execution/common/runLifecycle.ts +250 -0
- package/src/execution/common/runtime.ts +563 -0
- package/src/execution/common/scheduler.ts +696 -0
- package/src/execution/common/wait.ts +36 -0
- package/src/flow/common/agent.ts +305 -0
- package/src/flow/common/authoring.ts +30 -0
- package/src/flow/common/change.ts +1036 -0
- package/src/flow/common/changeSchema.ts +783 -0
- package/src/flow/common/codePermissions.ts +2 -0
- package/src/flow/common/condition.ts +265 -0
- package/src/flow/common/connectionUsage.ts +131 -0
- package/src/flow/common/edgeChanges.ts +35 -0
- package/src/flow/common/encoding.ts +437 -0
- package/src/flow/common/errorHandling.ts +34 -0
- package/src/flow/common/graph.ts +892 -0
- package/src/flow/common/inputValue.ts +16 -0
- package/src/flow/common/json.ts +8 -0
- package/src/flow/common/moduleChanges.ts +31 -0
- package/src/flow/common/modules.ts +292 -0
- package/src/flow/common/nodeChanges.ts +762 -0
- package/src/flow/common/portChanges.ts +36 -0
- package/src/flow/common/promptTemplate.ts +15 -0
- package/src/flow/common/retry.ts +20 -0
- package/src/flow/common/schema.ts +162 -0
- package/src/flow/common/schemaCompare.ts +176 -0
- package/src/flow/common/schemaComparer.ts +178 -0
- package/src/flow/common/schemaKeywords.ts +53 -0
- package/src/flow/common/semantics.ts +474 -0
- package/src/flow/common/sourceField.ts +35 -0
- package/src/flow/common/triggerScheduleSchema.ts +8 -0
- package/src/flow/common/wait.ts +30 -0
- package/src/flow/common/webhookMethod.ts +7 -0
- package/src/flow/common/webhookResponse.ts +75 -0
- package/src/flow/common/workflowFile.ts +97 -0
- package/src/json-schema-subset/checker/array.ts +142 -0
- package/src/json-schema-subset/checker/cache.ts +57 -0
- package/src/json-schema-subset/checker/checker.ts +230 -0
- package/src/json-schema-subset/checker/enumAndConst.ts +113 -0
- package/src/json-schema-subset/checker/equals.ts +93 -0
- package/src/json-schema-subset/checker/numeric/checker.ts +50 -0
- package/src/json-schema-subset/checker/numeric/float.ts +121 -0
- package/src/json-schema-subset/checker/numeric/index.ts +1 -0
- package/src/json-schema-subset/checker/numeric/integer.ts +119 -0
- package/src/json-schema-subset/checker/numeric/integerNormalizer.ts +72 -0
- package/src/json-schema-subset/checker/object.ts +354 -0
- package/src/json-schema-subset/checker/range.ts +91 -0
- package/src/json-schema-subset/checker/string.ts +60 -0
- package/src/json-schema-subset/checker/tools/index.ts +3 -0
- package/src/json-schema-subset/checker/tools/mark.ts +82 -0
- package/src/json-schema-subset/checker/tools/quantum.ts +106 -0
- package/src/json-schema-subset/checker/tools/range.ts +210 -0
- package/src/json-schema-subset/checker/validator.ts +23 -0
- package/src/json-schema-subset/compiler/array.ts +163 -0
- package/src/json-schema-subset/compiler/combination.ts +109 -0
- package/src/json-schema-subset/compiler/common.ts +99 -0
- package/src/json-schema-subset/compiler/compiler.ts +188 -0
- package/src/json-schema-subset/compiler/enumAndConst.ts +75 -0
- package/src/json-schema-subset/compiler/index.ts +11 -0
- package/src/json-schema-subset/compiler/object.ts +411 -0
- package/src/json-schema-subset/compiler/primitive.ts +144 -0
- package/src/json-schema-subset/compiler/utils.ts +24 -0
- package/src/json-schema-subset/compiler/wrapper.ts +192 -0
- package/src/json-schema-subset/error.ts +55 -0
- package/src/json-schema-subset/expression/calculator.ts +442 -0
- package/src/json-schema-subset/expression/combination.ts +49 -0
- package/src/json-schema-subset/expression/expression.ts +191 -0
- package/src/json-schema-subset/expression/index.ts +25 -0
- package/src/json-schema-subset/expression/result.ts +88 -0
- package/src/json-schema-subset/expression/types.ts +36 -0
- package/src/json-schema-subset/extends/extendsContext.ts +89 -0
- package/src/json-schema-subset/extends/index.ts +2 -0
- package/src/json-schema-subset/extends/types.ts +12 -0
- package/src/json-schema-subset/global.ts +60 -0
- package/src/json-schema-subset/index.ts +8 -0
- package/src/json-schema-subset/preprocessing.ts +74 -0
- package/src/json-schema-subset/types.ts +8 -0
- package/src/json-schema-subset/utils.ts +95 -0
- package/src/localization/common/languages.ts +118 -0
- package/src/localization/common/timeZone.ts +25 -0
- package/src/openapi/common/authBindings.ts +12 -0
- package/src/openapi/common/openapi.ts +459 -0
- package/src/trigger/common/config.ts +56 -0
- package/src/trigger/common/configOptions.ts +15 -0
- package/src/trigger/common/configSchema.ts +8 -0
- package/src/trigger/common/contract.ts +132 -0
- package/src/trigger/common/cron.ts +151 -0
- package/src/trigger/common/integration.ts +498 -0
- package/src/trigger/common/poll.ts +187 -0
- package/src/trigger/common/webhook.ts +412 -0
- package/src/trigger/providers/airtable/locales/fr.json +18 -0
- package/src/trigger/providers/airtable/locales/ja.json +18 -0
- package/src/trigger/providers/airtable/locales/ko.json +18 -0
- package/src/trigger/providers/airtable/locales/ru.json +18 -0
- package/src/trigger/providers/airtable/locales/zh-CN.json +18 -0
- package/src/trigger/providers/airtable/locales/zh-TW.json +18 -0
- package/src/trigger/providers/asana/locales/fr.json +15 -0
- package/src/trigger/providers/asana/locales/ja.json +15 -0
- package/src/trigger/providers/asana/locales/ko.json +15 -0
- package/src/trigger/providers/asana/locales/ru.json +15 -0
- package/src/trigger/providers/asana/locales/zh-CN.json +15 -0
- package/src/trigger/providers/asana/locales/zh-TW.json +15 -0
- package/src/trigger/providers/calendly/locales/fr.json +16 -0
- package/src/trigger/providers/calendly/locales/ja.json +16 -0
- package/src/trigger/providers/calendly/locales/ko.json +16 -0
- package/src/trigger/providers/calendly/locales/ru.json +16 -0
- package/src/trigger/providers/calendly/locales/zh-CN.json +16 -0
- package/src/trigger/providers/calendly/locales/zh-TW.json +16 -0
- package/src/trigger/providers/catalog.generated.json +4996 -0
- package/src/trigger/providers/clickup/locales/fr.json +16 -0
- package/src/trigger/providers/clickup/locales/ja.json +16 -0
- package/src/trigger/providers/clickup/locales/ko.json +16 -0
- package/src/trigger/providers/clickup/locales/ru.json +16 -0
- package/src/trigger/providers/clickup/locales/zh-CN.json +16 -0
- package/src/trigger/providers/clickup/locales/zh-TW.json +16 -0
- package/src/trigger/providers/definitions.ts +19 -0
- package/src/trigger/providers/feishu/locales/fr.json +20 -0
- package/src/trigger/providers/feishu/locales/ja.json +20 -0
- package/src/trigger/providers/feishu/locales/ko.json +20 -0
- package/src/trigger/providers/feishu/locales/ru.json +20 -0
- package/src/trigger/providers/feishu/locales/zh-CN.json +20 -0
- package/src/trigger/providers/feishu/locales/zh-TW.json +20 -0
- package/src/trigger/providers/fieldDescriptions.ts +392 -0
- package/src/trigger/providers/fieldLabels.ts +256 -0
- package/src/trigger/providers/fireflies/locales/fr.json +17 -0
- package/src/trigger/providers/fireflies/locales/ja.json +17 -0
- package/src/trigger/providers/fireflies/locales/ko.json +17 -0
- package/src/trigger/providers/fireflies/locales/ru.json +17 -0
- package/src/trigger/providers/fireflies/locales/zh-CN.json +17 -0
- package/src/trigger/providers/fireflies/locales/zh-TW.json +17 -0
- package/src/trigger/providers/github/locales/fr.json +30 -0
- package/src/trigger/providers/github/locales/ja.json +30 -0
- package/src/trigger/providers/github/locales/ko.json +30 -0
- package/src/trigger/providers/github/locales/ru.json +30 -0
- package/src/trigger/providers/github/locales/zh-CN.json +30 -0
- package/src/trigger/providers/github/locales/zh-TW.json +30 -0
- package/src/trigger/providers/gitlab/locales/fr.json +18 -0
- package/src/trigger/providers/gitlab/locales/ja.json +18 -0
- package/src/trigger/providers/gitlab/locales/ko.json +18 -0
- package/src/trigger/providers/gitlab/locales/ru.json +18 -0
- package/src/trigger/providers/gitlab/locales/zh-CN.json +18 -0
- package/src/trigger/providers/gitlab/locales/zh-TW.json +18 -0
- package/src/trigger/providers/gmail/locales/fr.json +18 -0
- package/src/trigger/providers/gmail/locales/ja.json +18 -0
- package/src/trigger/providers/gmail/locales/ko.json +18 -0
- package/src/trigger/providers/gmail/locales/ru.json +18 -0
- package/src/trigger/providers/gmail/locales/zh-CN.json +18 -0
- package/src/trigger/providers/gmail/locales/zh-TW.json +18 -0
- package/src/trigger/providers/google-calendar/locales/fr.json +15 -0
- package/src/trigger/providers/google-calendar/locales/ja.json +15 -0
- package/src/trigger/providers/google-calendar/locales/ko.json +15 -0
- package/src/trigger/providers/google-calendar/locales/ru.json +15 -0
- package/src/trigger/providers/google-calendar/locales/zh-CN.json +15 -0
- package/src/trigger/providers/google-calendar/locales/zh-TW.json +15 -0
- package/src/trigger/providers/google-drive/locales/fr.json +48 -0
- package/src/trigger/providers/google-drive/locales/ja.json +48 -0
- package/src/trigger/providers/google-drive/locales/ko.json +48 -0
- package/src/trigger/providers/google-drive/locales/ru.json +48 -0
- package/src/trigger/providers/google-drive/locales/zh-CN.json +48 -0
- package/src/trigger/providers/google-drive/locales/zh-TW.json +48 -0
- package/src/trigger/providers/google-sheets/locales/fr.json +19 -0
- package/src/trigger/providers/google-sheets/locales/ja.json +19 -0
- package/src/trigger/providers/google-sheets/locales/ko.json +19 -0
- package/src/trigger/providers/google-sheets/locales/ru.json +19 -0
- package/src/trigger/providers/google-sheets/locales/zh-CN.json +19 -0
- package/src/trigger/providers/google-sheets/locales/zh-TW.json +19 -0
- package/src/trigger/providers/intercom/locales/fr.json +17 -0
- package/src/trigger/providers/intercom/locales/ja.json +17 -0
- package/src/trigger/providers/intercom/locales/ko.json +17 -0
- package/src/trigger/providers/intercom/locales/ru.json +17 -0
- package/src/trigger/providers/intercom/locales/zh-CN.json +17 -0
- package/src/trigger/providers/intercom/locales/zh-TW.json +17 -0
- package/src/trigger/providers/jira/locales/fr.json +17 -0
- package/src/trigger/providers/jira/locales/ja.json +17 -0
- package/src/trigger/providers/jira/locales/ko.json +17 -0
- package/src/trigger/providers/jira/locales/ru.json +17 -0
- package/src/trigger/providers/jira/locales/zh-CN.json +17 -0
- package/src/trigger/providers/jira/locales/zh-TW.json +17 -0
- package/src/trigger/providers/linear/locales/fr.json +13 -0
- package/src/trigger/providers/linear/locales/ja.json +13 -0
- package/src/trigger/providers/linear/locales/ko.json +13 -0
- package/src/trigger/providers/linear/locales/ru.json +13 -0
- package/src/trigger/providers/linear/locales/zh-CN.json +13 -0
- package/src/trigger/providers/linear/locales/zh-TW.json +13 -0
- package/src/trigger/providers/locales/fr.ts +71 -0
- package/src/trigger/providers/locales/ja.ts +71 -0
- package/src/trigger/providers/locales/ko.ts +71 -0
- package/src/trigger/providers/locales/ru.ts +71 -0
- package/src/trigger/providers/locales/zh-CN.ts +71 -0
- package/src/trigger/providers/locales/zh-TW.ts +71 -0
- package/src/trigger/providers/localization.ts +59 -0
- package/src/trigger/providers/notion/locales/fr.json +16 -0
- package/src/trigger/providers/notion/locales/ja.json +16 -0
- package/src/trigger/providers/notion/locales/ko.json +16 -0
- package/src/trigger/providers/notion/locales/ru.json +16 -0
- package/src/trigger/providers/notion/locales/zh-CN.json +16 -0
- package/src/trigger/providers/notion/locales/zh-TW.json +16 -0
- package/src/trigger/providers/one-drive/locales/fr.json +16 -0
- package/src/trigger/providers/one-drive/locales/ja.json +16 -0
- package/src/trigger/providers/one-drive/locales/ko.json +16 -0
- package/src/trigger/providers/one-drive/locales/ru.json +16 -0
- package/src/trigger/providers/one-drive/locales/zh-CN.json +16 -0
- package/src/trigger/providers/one-drive/locales/zh-TW.json +16 -0
- package/src/trigger/providers/outlook/locales/fr.json +18 -0
- package/src/trigger/providers/outlook/locales/ja.json +18 -0
- package/src/trigger/providers/outlook/locales/ko.json +18 -0
- package/src/trigger/providers/outlook/locales/ru.json +18 -0
- package/src/trigger/providers/outlook/locales/zh-CN.json +18 -0
- package/src/trigger/providers/outlook/locales/zh-TW.json +18 -0
- package/src/trigger/providers/pandadoc/locales/fr.json +12 -0
- package/src/trigger/providers/pandadoc/locales/ja.json +12 -0
- package/src/trigger/providers/pandadoc/locales/ko.json +12 -0
- package/src/trigger/providers/pandadoc/locales/ru.json +12 -0
- package/src/trigger/providers/pandadoc/locales/zh-CN.json +12 -0
- package/src/trigger/providers/pandadoc/locales/zh-TW.json +12 -0
- package/src/trigger/providers/pipedrive/locales/fr.json +15 -0
- package/src/trigger/providers/pipedrive/locales/ja.json +15 -0
- package/src/trigger/providers/pipedrive/locales/ko.json +15 -0
- package/src/trigger/providers/pipedrive/locales/ru.json +15 -0
- package/src/trigger/providers/pipedrive/locales/zh-CN.json +15 -0
- package/src/trigger/providers/pipedrive/locales/zh-TW.json +15 -0
- package/src/trigger/providers/remote.ts +163 -0
- package/src/trigger/providers/resend/locales/fr.json +16 -0
- package/src/trigger/providers/resend/locales/ja.json +16 -0
- package/src/trigger/providers/resend/locales/ko.json +16 -0
- package/src/trigger/providers/resend/locales/ru.json +16 -0
- package/src/trigger/providers/resend/locales/zh-CN.json +16 -0
- package/src/trigger/providers/resend/locales/zh-TW.json +16 -0
- package/src/trigger/providers/sentry/locales/fr.json +19 -0
- package/src/trigger/providers/sentry/locales/ja.json +19 -0
- package/src/trigger/providers/sentry/locales/ko.json +19 -0
- package/src/trigger/providers/sentry/locales/ru.json +19 -0
- package/src/trigger/providers/sentry/locales/zh-CN.json +19 -0
- package/src/trigger/providers/sentry/locales/zh-TW.json +19 -0
- package/src/trigger/providers/shopify/locales/fr.json +18 -0
- package/src/trigger/providers/shopify/locales/ja.json +18 -0
- package/src/trigger/providers/shopify/locales/ko.json +18 -0
- package/src/trigger/providers/shopify/locales/ru.json +18 -0
- package/src/trigger/providers/shopify/locales/zh-CN.json +18 -0
- package/src/trigger/providers/shopify/locales/zh-TW.json +18 -0
- package/src/trigger/providers/slack/locales/fr.json +18 -0
- package/src/trigger/providers/slack/locales/ja.json +18 -0
- package/src/trigger/providers/slack/locales/ko.json +18 -0
- package/src/trigger/providers/slack/locales/ru.json +18 -0
- package/src/trigger/providers/slack/locales/zh-CN.json +18 -0
- package/src/trigger/providers/slack/locales/zh-TW.json +18 -0
- package/src/trigger/providers/slackbot/locales/fr.json +23 -0
- package/src/trigger/providers/slackbot/locales/ja.json +23 -0
- package/src/trigger/providers/slackbot/locales/ko.json +23 -0
- package/src/trigger/providers/slackbot/locales/ru.json +23 -0
- package/src/trigger/providers/slackbot/locales/zh-CN.json +23 -0
- package/src/trigger/providers/slackbot/locales/zh-TW.json +23 -0
- package/src/trigger/providers/source-events.ts +25 -0
- package/src/trigger/providers/stripe/locales/fr.json +17 -0
- package/src/trigger/providers/stripe/locales/ja.json +17 -0
- package/src/trigger/providers/stripe/locales/ko.json +17 -0
- package/src/trigger/providers/stripe/locales/ru.json +17 -0
- package/src/trigger/providers/stripe/locales/zh-CN.json +17 -0
- package/src/trigger/providers/stripe/locales/zh-TW.json +17 -0
- package/src/trigger/providers/tally/locales/fr.json +12 -0
- package/src/trigger/providers/tally/locales/ja.json +12 -0
- package/src/trigger/providers/tally/locales/ko.json +12 -0
- package/src/trigger/providers/tally/locales/ru.json +12 -0
- package/src/trigger/providers/tally/locales/zh-CN.json +12 -0
- package/src/trigger/providers/tally/locales/zh-TW.json +12 -0
- package/src/trigger/providers/telegram/locales/fr.json +17 -0
- package/src/trigger/providers/telegram/locales/ja.json +17 -0
- package/src/trigger/providers/telegram/locales/ko.json +17 -0
- package/src/trigger/providers/telegram/locales/ru.json +17 -0
- package/src/trigger/providers/telegram/locales/zh-CN.json +17 -0
- package/src/trigger/providers/telegram/locales/zh-TW.json +17 -0
- package/src/trigger/providers/typeform/locales/fr.json +12 -0
- package/src/trigger/providers/typeform/locales/ja.json +12 -0
- package/src/trigger/providers/typeform/locales/ko.json +12 -0
- package/src/trigger/providers/typeform/locales/ru.json +12 -0
- package/src/trigger/providers/typeform/locales/zh-CN.json +12 -0
- package/src/trigger/providers/typeform/locales/zh-TW.json +12 -0
- package/src/trigger/providers/vercel/locales/fr.json +18 -0
- package/src/trigger/providers/vercel/locales/ja.json +18 -0
- package/src/trigger/providers/vercel/locales/ko.json +18 -0
- package/src/trigger/providers/vercel/locales/ru.json +18 -0
- package/src/trigger/providers/vercel/locales/zh-CN.json +18 -0
- package/src/trigger/providers/vercel/locales/zh-TW.json +18 -0
- package/src/trigger/providers/woocommerce/locales/fr.json +19 -0
- package/src/trigger/providers/woocommerce/locales/ja.json +19 -0
- package/src/trigger/providers/woocommerce/locales/ko.json +19 -0
- package/src/trigger/providers/woocommerce/locales/ru.json +19 -0
- package/src/trigger/providers/woocommerce/locales/zh-CN.json +19 -0
- package/src/trigger/providers/woocommerce/locales/zh-TW.json +19 -0
- package/src/trigger/providers/zendesk/locales/fr.json +15 -0
- package/src/trigger/providers/zendesk/locales/ja.json +15 -0
- package/src/trigger/providers/zendesk/locales/ko.json +15 -0
- package/src/trigger/providers/zendesk/locales/ru.json +15 -0
- package/src/trigger/providers/zendesk/locales/zh-CN.json +15 -0
- package/src/trigger/providers/zendesk/locales/zh-TW.json +15 -0
- package/src/trigger/providers/zoom/locales/fr.json +17 -0
- package/src/trigger/providers/zoom/locales/ja.json +17 -0
- package/src/trigger/providers/zoom/locales/ko.json +17 -0
- package/src/trigger/providers/zoom/locales/ru.json +17 -0
- package/src/trigger/providers/zoom/locales/zh-CN.json +17 -0
- package/src/trigger/providers/zoom/locales/zh-TW.json +17 -0
- package/src/types/index.ts +112 -0
- package/src/workflow/common/workflow.ts +273 -0
- package/dist/browser/lib-DrKav3HG.js +0 -11403
- /package/dist/{browser → common}/flow-authoring-edge.d.ts +0 -0
- /package/dist/{browser → common}/flow-authoring-module.d.ts +0 -0
- /package/dist/{browser → common}/flow-authoring.d.ts +0 -0
- /package/dist/{browser → common}/flow-input-value.d.ts +0 -0
- /package/dist/{browser → common}/webhook-method.d.ts +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { ConditionExpression, ConditionNode, ConditionOperand, ConditionOperator, JsonValue, Source } from '../../flow/common/change.ts'
|
|
2
|
+
|
|
3
|
+
export type AuthoringConditionSource =
|
|
4
|
+
| { readonly kind: 'output'; readonly node: string; readonly port?: string; readonly field?: string }
|
|
5
|
+
| { readonly kind: 'variable'; readonly name: string }
|
|
6
|
+
export type AuthoringConditionOperand = AuthoringConditionSource | { readonly kind: 'value'; readonly value?: JsonValue; readonly schema?: JsonValue }
|
|
7
|
+
export interface AuthoringConditionExpression {
|
|
8
|
+
readonly left: AuthoringConditionOperand
|
|
9
|
+
readonly operator: ConditionOperator
|
|
10
|
+
readonly right?: AuthoringConditionOperand
|
|
11
|
+
}
|
|
12
|
+
type All = { readonly all: readonly AuthoringConditionExpression[] }
|
|
13
|
+
export type AuthoringConditionWhen = AuthoringConditionExpression | All | { readonly any: readonly (AuthoringConditionExpression | All)[] }
|
|
14
|
+
export interface AuthoringConditionConfiguration {
|
|
15
|
+
readonly match: ConditionNode['matchMode']
|
|
16
|
+
readonly branches: readonly { readonly name: string; readonly description?: string; readonly when: AuthoringConditionWhen }[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Preserve empty groups in invalid drafts; do not turn them into unconditional branches. */
|
|
20
|
+
export function conditionConfigurationView(
|
|
21
|
+
node: Pick<ConditionNode, 'cases' | 'matchMode'>,
|
|
22
|
+
source: (value: Source) => AuthoringConditionSource,
|
|
23
|
+
): AuthoringConditionConfiguration {
|
|
24
|
+
const operand = (value: ConditionOperand): AuthoringConditionOperand =>
|
|
25
|
+
value.kind == 'source'
|
|
26
|
+
? source(value.source)
|
|
27
|
+
: { kind: 'value', ...(value.value === undefined ? {} : { value: value.value }), ...(value.jsonSchema === undefined ? {} : { schema: value.jsonSchema }) }
|
|
28
|
+
const expression = (value: ConditionExpression): AuthoringConditionExpression => ({
|
|
29
|
+
left: operand(value.left),
|
|
30
|
+
operator: value.operator,
|
|
31
|
+
...(value.right === undefined ? {} : { right: operand(value.right) }),
|
|
32
|
+
})
|
|
33
|
+
return {
|
|
34
|
+
match: node.matchMode,
|
|
35
|
+
branches: node.cases.map((branch) => {
|
|
36
|
+
const groups = branch.groups.map((group) =>
|
|
37
|
+
group.expressions.length == 1 ? expression(group.expressions[0]!) : { all: group.expressions.map(expression) },
|
|
38
|
+
)
|
|
39
|
+
return {
|
|
40
|
+
name: branch.output,
|
|
41
|
+
...(branch.description === undefined ? {} : { description: branch.description }),
|
|
42
|
+
when: groups.length == 1 ? groups[0]! : { any: groups },
|
|
43
|
+
}
|
|
44
|
+
}),
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function prepareConditionConfiguration(
|
|
49
|
+
config: AuthoringConditionConfiguration,
|
|
50
|
+
source: (value: AuthoringConditionSource) => Source,
|
|
51
|
+
): Pick<ConditionNode, 'cases' | 'matchMode'> {
|
|
52
|
+
const operand = (value: AuthoringConditionOperand): ConditionOperand =>
|
|
53
|
+
value.kind == 'value'
|
|
54
|
+
? { kind: 'value', ...(value.value === undefined ? {} : { value: value.value }), ...(value.schema === undefined ? {} : { jsonSchema: value.schema }) }
|
|
55
|
+
: { kind: 'source', source: source(value) }
|
|
56
|
+
const expression = (value: AuthoringConditionExpression): ConditionExpression => ({
|
|
57
|
+
left: operand(value.left),
|
|
58
|
+
operator: value.operator,
|
|
59
|
+
...(value.right === undefined ? {} : { right: operand(value.right) }),
|
|
60
|
+
})
|
|
61
|
+
return {
|
|
62
|
+
matchMode: config.match,
|
|
63
|
+
cases: config.branches.map((branch) => {
|
|
64
|
+
const groups = 'any' in branch.when ? branch.when.any : [branch.when]
|
|
65
|
+
return {
|
|
66
|
+
output: branch.name,
|
|
67
|
+
...(branch.description === undefined ? {} : { description: branch.description }),
|
|
68
|
+
groups: groups.map((group) => ({ expressions: ('all' in group ? group.all : [group]).map(expression) })),
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Map a path relative to a persisted Condition configuration into its normalized public config. */
|
|
75
|
+
export function conditionConfigurationFieldPath(node: Pick<ConditionNode, 'cases'>, path: readonly (string | number)[]): readonly (string | number)[] {
|
|
76
|
+
if (path[0] == 'matchMode') return ['match', ...path.slice(1)]
|
|
77
|
+
if (path[0] != 'cases') return path
|
|
78
|
+
if (path.length == 1) return ['branches']
|
|
79
|
+
const branchIndex = Number(path[1]),
|
|
80
|
+
branch = node.cases[branchIndex],
|
|
81
|
+
base: (string | number)[] = ['branches', path[1]!]
|
|
82
|
+
if (path[2] == 'output') return [...base, 'name', ...path.slice(3)]
|
|
83
|
+
if (path[2] != 'groups') return [...base, ...path.slice(2)]
|
|
84
|
+
base.push('when')
|
|
85
|
+
if (branch == null || path.length == 3) return base
|
|
86
|
+
const groupIndex = Number(path[3]),
|
|
87
|
+
group = branch.groups[groupIndex]
|
|
88
|
+
if (branch.groups.length != 1) base.push('any', path[3]!)
|
|
89
|
+
if (path[4] != 'expressions') return [...base, ...path.slice(4)]
|
|
90
|
+
if (group == null || path.length == 5) return group?.expressions.length == 1 ? base : [...base, 'all']
|
|
91
|
+
if (group.expressions.length != 1) base.push('all', path[5]!)
|
|
92
|
+
const remaining = path.slice(6).filter((part, index) => !(index == 1 && part == 'source'))
|
|
93
|
+
if (remaining[0] == 'left' || remaining[0] == 'right') {
|
|
94
|
+
switch (remaining[1]) {
|
|
95
|
+
case 'jsonSchema':
|
|
96
|
+
remaining[1] = 'schema'
|
|
97
|
+
break
|
|
98
|
+
case 'nodeId':
|
|
99
|
+
remaining[1] = 'node'
|
|
100
|
+
break
|
|
101
|
+
case 'output':
|
|
102
|
+
remaining[1] = 'port'
|
|
103
|
+
break
|
|
104
|
+
case 'bindingId':
|
|
105
|
+
remaining[1] = 'name'
|
|
106
|
+
break
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return [...base, ...remaining]
|
|
110
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { GraphNode, Group, InputPort } from '../../flow/common/change.ts'
|
|
2
|
+
|
|
3
|
+
import { conditionConfigurationFieldPath } from './authoringCondition.ts'
|
|
4
|
+
|
|
5
|
+
type Ports = readonly (InputPort | Group)[]
|
|
6
|
+
const metadata = new Set(['name', 'description', 'icon', 'timeoutMs', 'maxExecutions', 'retry', 'onError'])
|
|
7
|
+
|
|
8
|
+
function portField(ports: Ports, path: readonly string[], parent: string): string {
|
|
9
|
+
const port = ports[Number(path[0])]
|
|
10
|
+
if (port == null || !('handle' in port)) return parent
|
|
11
|
+
const field = `${parent}.${port.handle}`
|
|
12
|
+
switch (path[1]) {
|
|
13
|
+
case 'jsonSchema':
|
|
14
|
+
return [field, 'schema', ...path.slice(2)].join('.')
|
|
15
|
+
case 'value':
|
|
16
|
+
return [field, 'default', ...path.slice(2)].join('.')
|
|
17
|
+
case 'nullable':
|
|
18
|
+
case 'description':
|
|
19
|
+
return [field, ...path.slice(1)].join('.')
|
|
20
|
+
default:
|
|
21
|
+
return field
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Accept a decoded JSON Pointer, including or omitting its initial empty component. */
|
|
26
|
+
export function authoringDiagnosticField(node: GraphNode | undefined, parts: readonly string[]): string {
|
|
27
|
+
const path = parts[0] == '' ? parts.slice(1) : parts
|
|
28
|
+
if (node == null) return 'config'
|
|
29
|
+
if (path[0] == 'modules') return 'code'
|
|
30
|
+
let location = path[0] == 'document' && path[1] == 'graph' && path[2] == 'nodes' ? path.slice(4) : path
|
|
31
|
+
const inlineDefinition = node.kind == 'task' && location[0] == 'task'
|
|
32
|
+
if (inlineDefinition) location = location.slice(1)
|
|
33
|
+
if (location.length == 0) return 'config'
|
|
34
|
+
const head = location[0]!
|
|
35
|
+
if (!inlineDefinition && metadata.has(head)) return location.join('.')
|
|
36
|
+
if (node.kind == 'start' && head == 'inputDefs') return portField(node.inputDefs, location.slice(1), 'config.inputDefs')
|
|
37
|
+
if (node.kind == 'outputs' && head == 'outputDefs') return portField(node.outputDefs, location.slice(1), 'config.outputDefs')
|
|
38
|
+
if (node.kind == 'outputs' && head == 'outputMappings') return ['inputs', ...location.slice(1)].join('.')
|
|
39
|
+
if (head == 'prompt') return 'prompt'
|
|
40
|
+
if (head == 'inputs' && !inlineDefinition) {
|
|
41
|
+
if (node.kind == 'condition' && location[1] != null) {
|
|
42
|
+
const [branch, group, expression, side] = location[1].split('/')
|
|
43
|
+
if (branch != null && group != null && expression != null && (side == 'left' || side == 'right'))
|
|
44
|
+
return ['config', ...conditionConfigurationFieldPath(node, ['cases', branch, 'groups', group, 'expressions', expression, side])].join('.')
|
|
45
|
+
return 'config.branches'
|
|
46
|
+
}
|
|
47
|
+
return location[1] == null ? 'inputs' : `inputs.${location[1]}`
|
|
48
|
+
}
|
|
49
|
+
if (node.kind == 'task') {
|
|
50
|
+
const task = node.task
|
|
51
|
+
if (task == null) return 'config'
|
|
52
|
+
const executor = 'executor' in task ? task.executor : undefined
|
|
53
|
+
if (head == 'additionalInputs') return portField(node.additionalInputs ?? [], location.slice(1), 'config.inputs')
|
|
54
|
+
if (head == 'inputs' || head == 'outputs') {
|
|
55
|
+
const ports = task[head]
|
|
56
|
+
const port = ports[Number(location[1])]
|
|
57
|
+
if (head == 'outputs' && (executor?.kind == 'agent' || executor?.kind == 'llm'))
|
|
58
|
+
return location[2] == 'jsonSchema' ? ['config', 'resultSchema', ...location.slice(3)].join('.') : 'config.resultSchema'
|
|
59
|
+
if (head == 'inputs' && executor?.kind == 'llm' && port != null && 'handle' in port && ['model', 'template', 'messages'].includes(port.handle))
|
|
60
|
+
return ['config', port.handle, ...(location[2] == 'value' ? location.slice(3) : [])].join('.')
|
|
61
|
+
const custom = executor == null || executor.kind == 'agent' || executor.kind == 'llm'
|
|
62
|
+
return portField(ports, location.slice(1), custom ? `config.${head}` : head == 'inputs' ? 'inputPorts' : 'outputPorts')
|
|
63
|
+
}
|
|
64
|
+
if (head == 'executor') {
|
|
65
|
+
const field = location[1]
|
|
66
|
+
if (field == null || field == 'kind') return 'config'
|
|
67
|
+
if (field == 'prompt') return 'prompt'
|
|
68
|
+
if (executor?.kind == 'workflow' && field == 'revisionId') return 'config.flowId'
|
|
69
|
+
if (executor?.kind == 'openapi') {
|
|
70
|
+
if (field == 'document') return 'config'
|
|
71
|
+
if (field == 'auth') return 'config.authentication'
|
|
72
|
+
}
|
|
73
|
+
if (executor?.kind == 'agent') {
|
|
74
|
+
if (field == 'tools') {
|
|
75
|
+
const tool = executor.tools[Number(location[2])]
|
|
76
|
+
if (tool == null) return 'config.tools'
|
|
77
|
+
const base = `config.tools.${location[2]}`
|
|
78
|
+
if (location[3] == 'id') return base
|
|
79
|
+
if (tool.kind == 'workflow' && (location[3] == 'revisionId' || location[3] == 'outputs')) return `${base}.flowId`
|
|
80
|
+
if (location[3] == 'inputs') {
|
|
81
|
+
const input = tool.inputs[Number(location[4])]
|
|
82
|
+
if (input == null) return `${base}.inputs`
|
|
83
|
+
return location[5] == 'source' ? [base, 'inputs', input.handle, ...location.slice(6)].join('.') : `${base}.inputs.${input.handle}`
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (field == 'notification' && location[2] == 'inputDefinitions') return 'config.notification.inputs'
|
|
87
|
+
}
|
|
88
|
+
return ['config', ...location.slice(1)].join('.')
|
|
89
|
+
}
|
|
90
|
+
if (
|
|
91
|
+
head == 'capabilities' &&
|
|
92
|
+
'moduleId' in task &&
|
|
93
|
+
task.capabilities?.[Number(location[1])]?.kind == 'workflow' &&
|
|
94
|
+
['revisionId', 'inputs', 'outputs'].includes(location[2] ?? '')
|
|
95
|
+
)
|
|
96
|
+
return `config.capabilities.${location[1]}.flowId`
|
|
97
|
+
if (head == 'capabilities') return ['config', ...location].join('.')
|
|
98
|
+
if (head == 'name') return 'name'
|
|
99
|
+
return 'config'
|
|
100
|
+
}
|
|
101
|
+
switch (node.kind) {
|
|
102
|
+
case 'condition':
|
|
103
|
+
return head == 'cases' || head == 'matchMode' ? ['config', ...conditionConfigurationFieldPath(node, location)].join('.') : 'config'
|
|
104
|
+
case 'wait':
|
|
105
|
+
case 'approval':
|
|
106
|
+
return head == 'inputDefinitions'
|
|
107
|
+
? portField(node.inputDefinitions, location.slice(1), 'config.inputs')
|
|
108
|
+
: head == 'autoContinue'
|
|
109
|
+
? ['config', ...location].join('.')
|
|
110
|
+
: 'config'
|
|
111
|
+
case 'start':
|
|
112
|
+
return 'config'
|
|
113
|
+
case 'webhook':
|
|
114
|
+
if (head == 'bodyFields') return portField(node.bodyFields, location.slice(1), 'config.body')
|
|
115
|
+
return head == 'method' || head == 'options' ? ['config', ...location].join('.') : 'config'
|
|
116
|
+
case 'value': {
|
|
117
|
+
if (head != 'values') return 'config'
|
|
118
|
+
const port = node.values[Number(location[1])]
|
|
119
|
+
if (port == null) return 'config.values'
|
|
120
|
+
if (location[2] == 'value') return ['config', 'values', port.handle, ...location.slice(3)].join('.')
|
|
121
|
+
return portField(node.values, location.slice(1), 'config.outputs')
|
|
122
|
+
}
|
|
123
|
+
case 'cron':
|
|
124
|
+
return head == 'cronTimes' ? ['config', 'schedule', ...location.slice(1)].join('.') : 'config'
|
|
125
|
+
case 'poll':
|
|
126
|
+
case 'integration':
|
|
127
|
+
if (head == 'config') return location[1] == null ? 'inputs' : `inputs.${location[1]}`
|
|
128
|
+
if (head == 'definition') return location[1] == 'configInputs' ? portField(node.definition.configInputs, location.slice(2), 'inputPorts') : 'config.key'
|
|
129
|
+
if (head == 'pollTimes') return ['config', 'schedule', ...location.slice(1)].join('.')
|
|
130
|
+
return head == 'connectionId' ? 'config.connectionId' : 'config'
|
|
131
|
+
case 'error':
|
|
132
|
+
return head == 'sourceFlowIds' ? ['config', ...location].join('.') : 'config'
|
|
133
|
+
default:
|
|
134
|
+
return 'config'
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import type { DraftOperation } from './draftOperations.ts'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createApproval,
|
|
5
|
+
createBuiltinTrigger,
|
|
6
|
+
createCodeTask,
|
|
7
|
+
createCondition,
|
|
8
|
+
createDecisionTask,
|
|
9
|
+
createLlmTask,
|
|
10
|
+
createManagedTask,
|
|
11
|
+
createValue,
|
|
12
|
+
createWait,
|
|
13
|
+
} from '../../flow/common/nodeChanges.ts'
|
|
14
|
+
import { openApiTask, selectOperation } from '../../openapi/common/openapi.ts'
|
|
15
|
+
|
|
16
|
+
const descriptions = {
|
|
17
|
+
'start': 'A Start node with a required message parameter. Supply it through trigger.outputs.',
|
|
18
|
+
'error': 'A Flow Error node. Select upstream Flows, then publish and enable this Flow to listen for failures in their automatic runs.',
|
|
19
|
+
'webhook': 'A Webhook start node.',
|
|
20
|
+
'webhook-response': 'An HTTP response node with body, statusCode and headers inputs. Select it from a reachable Webhook.',
|
|
21
|
+
'cron': 'An hourly scheduled start node.',
|
|
22
|
+
'poll': 'Gmail polling by key; replace CONNECTION_ID with an active Gmail connection.',
|
|
23
|
+
'integration': 'Telegram webhook integration by key; replace CONNECTION_ID with an active Telegram connection.',
|
|
24
|
+
'decision': 'AI Decision evaluates named questions against target and returns a complete answer object per output. Configure target before running.',
|
|
25
|
+
'openapi': 'A fixed JSON API operation. Replace the example document and URL before running.',
|
|
26
|
+
'connector':
|
|
27
|
+
'A Connector Task and its node. Replace ACTION_ID, CONNECTION_ID and port definitions using connector_get / connector show. Set connectionId to an empty string to defer account configuration; execution will require an account.',
|
|
28
|
+
'code': 'A JavaScript module and its node. Use Code for custom computation; use Connector Tasks for existing actions.',
|
|
29
|
+
'condition': 'A condition with true and false execution branches.',
|
|
30
|
+
'value': 'A fixed value node.',
|
|
31
|
+
'approval': 'An Approval with approve and reject decision branches and a built-in notification output.',
|
|
32
|
+
'wait': 'A Wait with a continue action and a built-in notification output.',
|
|
33
|
+
'agent': 'An Agent with code computation enabled. Configure a model available in the deployment.',
|
|
34
|
+
'llm-chat': 'An LLM chat Task and its node; configure a model available in the deployment.',
|
|
35
|
+
'llm-json': 'An LLM JSON Task and its node; configure a model available in the deployment.',
|
|
36
|
+
'poll-notification':
|
|
37
|
+
'Gmail events → JavaScript text formatting → Connector notification. Replace connection/action IDs and match the notification input ports.',
|
|
38
|
+
} as const
|
|
39
|
+
|
|
40
|
+
export const authoringExampleNames = Object.keys(descriptions) as (keyof typeof descriptions)[]
|
|
41
|
+
|
|
42
|
+
export const authoringExamples = authoringExampleNames.map((name) => ({ name, description: descriptions[name] }))
|
|
43
|
+
|
|
44
|
+
export function authoringExample(name: string): { version: 1; operations: readonly DraftOperation[] } {
|
|
45
|
+
let operations: readonly DraftOperation[]
|
|
46
|
+
switch (name) {
|
|
47
|
+
case 'webhook-response':
|
|
48
|
+
operations = [{ kind: 'graph.node.create', nodeId: 'reply', node: { kind: 'webhook-response', name: 'Webhook Response', inputs: {} } }]
|
|
49
|
+
break
|
|
50
|
+
case 'error':
|
|
51
|
+
operations = createBuiltinTrigger('error', { kind: 'error', name: 'Flow Error' })
|
|
52
|
+
break
|
|
53
|
+
case 'decision':
|
|
54
|
+
operations = createDecisionTask({ nodeId: 'decision' }, 'AI Decision', [
|
|
55
|
+
{ name: 'needs_support', type: 'noul', instructions: 'Does the customer need support?' },
|
|
56
|
+
])
|
|
57
|
+
break
|
|
58
|
+
case 'openapi': {
|
|
59
|
+
const document = {
|
|
60
|
+
openapi: '3.1.0',
|
|
61
|
+
paths: { '/items': { get: { responses: { '200': { content: { 'application/json': { schema: { type: 'array', items: { type: 'string' } } } } } } } } },
|
|
62
|
+
}
|
|
63
|
+
operations = createManagedTask({ nodeId: 'api' }, openApiTask(selectOperation(document, 'https://api.example.com/openapi.json', '/items', 'get')))
|
|
64
|
+
break
|
|
65
|
+
}
|
|
66
|
+
case 'start':
|
|
67
|
+
operations = [
|
|
68
|
+
...createBuiltinTrigger('start', { inputDefs: [{ handle: 'message', jsonSchema: { type: 'string' }, nullable: false }], kind: 'start', name: 'Start' }),
|
|
69
|
+
]
|
|
70
|
+
break
|
|
71
|
+
case 'webhook':
|
|
72
|
+
operations = createBuiltinTrigger('start', { kind: 'webhook', method: 'POST', name: 'Webhook', bodyFields: [] })
|
|
73
|
+
break
|
|
74
|
+
case 'cron':
|
|
75
|
+
operations = createBuiltinTrigger('start', { kind: 'cron', name: 'Schedule', cronTimes: [{ type: 'every', unit: 'hour', value: 1 }] })
|
|
76
|
+
break
|
|
77
|
+
case 'poll':
|
|
78
|
+
operations = [
|
|
79
|
+
{
|
|
80
|
+
kind: 'graph.trigger.create',
|
|
81
|
+
nodeId: 'mail',
|
|
82
|
+
|
|
83
|
+
key: 'gmail.on_message_received',
|
|
84
|
+
connectionId: 'CONNECTION_ID',
|
|
85
|
+
config: {},
|
|
86
|
+
schedule: [{ type: 'every', unit: 'minute', value: 5 }],
|
|
87
|
+
},
|
|
88
|
+
]
|
|
89
|
+
break
|
|
90
|
+
case 'integration':
|
|
91
|
+
operations = [
|
|
92
|
+
{
|
|
93
|
+
kind: 'graph.trigger.create',
|
|
94
|
+
nodeId: 'telegram',
|
|
95
|
+
|
|
96
|
+
key: 'telegram.on_update',
|
|
97
|
+
connectionId: 'CONNECTION_ID',
|
|
98
|
+
config: { updates: ['message'] },
|
|
99
|
+
},
|
|
100
|
+
]
|
|
101
|
+
break
|
|
102
|
+
case 'agent':
|
|
103
|
+
operations = createManagedTask(
|
|
104
|
+
{ nodeId: 'agent' },
|
|
105
|
+
{
|
|
106
|
+
name: 'Agent',
|
|
107
|
+
inputs: [{ handle: 'input', jsonSchema: { type: 'string' }, nullable: false, value: 'Summarize the current input.' }],
|
|
108
|
+
outputs: [{ handle: 'output', jsonSchema: { type: 'string' }, nullable: false }],
|
|
109
|
+
executor: { kind: 'agent', code: true, model: 'deepseek-v4-flash', prompt: '{{input}}', maxRounds: 10, tools: [] },
|
|
110
|
+
},
|
|
111
|
+
)
|
|
112
|
+
break
|
|
113
|
+
case 'connector':
|
|
114
|
+
operations = createManagedTask(
|
|
115
|
+
{ nodeId: 'notify' },
|
|
116
|
+
{
|
|
117
|
+
name: 'Notify',
|
|
118
|
+
executor: { kind: 'connector', action: 'ACTION_ID', connectionId: 'CONNECTION_ID' },
|
|
119
|
+
inputs: [{ handle: 'text', jsonSchema: { type: 'string' }, nullable: false, value: 'Hello' }],
|
|
120
|
+
outputs: [],
|
|
121
|
+
},
|
|
122
|
+
)
|
|
123
|
+
break
|
|
124
|
+
case 'code':
|
|
125
|
+
operations = createCodeTask(
|
|
126
|
+
{ nodeId: 'format', moduleId: 'format-module' },
|
|
127
|
+
'Format',
|
|
128
|
+
{
|
|
129
|
+
imports: [],
|
|
130
|
+
source: 'export default async function (inputs) { return { text: inputs.events.map(event => `${event.sender}: ${event.subject}`).join("\\n") } }',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
inputs: [
|
|
134
|
+
{
|
|
135
|
+
handle: 'events',
|
|
136
|
+
jsonSchema: { type: 'array', items: { type: 'object' } },
|
|
137
|
+
nullable: false,
|
|
138
|
+
value: [],
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
outputs: [{ handle: 'text', jsonSchema: { type: 'string' }, nullable: false }],
|
|
142
|
+
},
|
|
143
|
+
)
|
|
144
|
+
break
|
|
145
|
+
case 'condition':
|
|
146
|
+
operations = [
|
|
147
|
+
...createCondition('condition', 'Condition'),
|
|
148
|
+
{ kind: 'graph.node.input.set', nodeId: 'condition', handle: '0/0/0/left', value: { kind: 'value', value: 100 } },
|
|
149
|
+
{ kind: 'graph.node.input.set', nodeId: 'condition', handle: '0/0/0/right', value: { kind: 'value', value: 100 } },
|
|
150
|
+
]
|
|
151
|
+
break
|
|
152
|
+
case 'value':
|
|
153
|
+
operations = createValue('value', 'Value')
|
|
154
|
+
break
|
|
155
|
+
case 'approval':
|
|
156
|
+
operations = createApproval('approval', 'Approve?')
|
|
157
|
+
break
|
|
158
|
+
case 'wait':
|
|
159
|
+
operations = createWait('wait', 'Continue?')
|
|
160
|
+
break
|
|
161
|
+
case 'llm-chat':
|
|
162
|
+
case 'llm-json':
|
|
163
|
+
operations = createLlmTask({ nodeId: 'llm' }, 'LLM', name == 'llm-chat' ? 'chat' : 'json', 'Generated response.')
|
|
164
|
+
break
|
|
165
|
+
case 'poll-notification':
|
|
166
|
+
operations = [
|
|
167
|
+
...authoringExample('poll').operations,
|
|
168
|
+
...authoringExample('code').operations,
|
|
169
|
+
...authoringExample('connector').operations,
|
|
170
|
+
{ kind: 'graph.edge.connect', edge: { source: 'mail', target: 'format' } },
|
|
171
|
+
{ kind: 'graph.edge.connect', edge: { source: 'format', target: 'notify' } },
|
|
172
|
+
{
|
|
173
|
+
kind: 'graph.node.input.set',
|
|
174
|
+
nodeId: 'format',
|
|
175
|
+
handle: 'events',
|
|
176
|
+
before: { kind: 'value', value: [] },
|
|
177
|
+
value: { kind: 'sources', sources: [{ kind: 'node', nodeId: 'mail', output: 'events' }] },
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
kind: 'graph.node.input.set',
|
|
181
|
+
nodeId: 'notify',
|
|
182
|
+
handle: 'text',
|
|
183
|
+
before: { kind: 'value', value: 'Hello' },
|
|
184
|
+
value: { kind: 'sources', sources: [{ kind: 'node', nodeId: 'format', output: 'text' }] },
|
|
185
|
+
},
|
|
186
|
+
]
|
|
187
|
+
break
|
|
188
|
+
default:
|
|
189
|
+
throw new TypeError(`Unknown authoring example ${JSON.stringify(name)}.`)
|
|
190
|
+
}
|
|
191
|
+
return { version: 1 as const, operations }
|
|
192
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { InputPort, Group, JsonValue, RevisionContent } from '../../flow/common/change.ts'
|
|
2
|
+
|
|
3
|
+
import { dequal } from 'dequal/lite'
|
|
4
|
+
const record = (value: unknown): Record<string, unknown> =>
|
|
5
|
+
value != null && typeof value == 'object' && !Array.isArray(value) ? (value as Record<string, unknown>) : {}
|
|
6
|
+
/** Business field contracts, independent of storage handles and presentation groups. */
|
|
7
|
+
export function fieldsView(ports: readonly (InputPort | Group)[]) {
|
|
8
|
+
return Object.fromEntries(
|
|
9
|
+
ports.flatMap((port) =>
|
|
10
|
+
'handle' in port
|
|
11
|
+
? [
|
|
12
|
+
[
|
|
13
|
+
port.handle,
|
|
14
|
+
{
|
|
15
|
+
schema: port.jsonSchema,
|
|
16
|
+
nullable: port.nullable,
|
|
17
|
+
...(port.description == null ? {} : { description: port.description }),
|
|
18
|
+
...(Object.hasOwn(port, 'value') ? { default: port.value } : {}),
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
]
|
|
22
|
+
: [],
|
|
23
|
+
),
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
export function fieldsToPorts(fields: unknown, previous: readonly (InputPort | Group)[]): readonly (InputPort | Group)[] {
|
|
27
|
+
const remaining = new Map(Object.entries(record(fields)))
|
|
28
|
+
function port(handle: string, value: unknown): InputPort {
|
|
29
|
+
const field = record(value)
|
|
30
|
+
return {
|
|
31
|
+
handle,
|
|
32
|
+
jsonSchema: (Object.hasOwn(field, 'schema') ? field.schema : {}) as JsonValue,
|
|
33
|
+
nullable: (field.nullable ?? true) as boolean,
|
|
34
|
+
...(field.description == null ? {} : { description: String(field.description) }),
|
|
35
|
+
...(Object.hasOwn(field, 'default') ? { value: field.default as JsonValue } : {}),
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return [
|
|
39
|
+
...previous.flatMap<InputPort | Group>((old) => {
|
|
40
|
+
if (!('handle' in old)) return [old]
|
|
41
|
+
if (!remaining.has(old.handle)) return []
|
|
42
|
+
const value = remaining.get(old.handle)
|
|
43
|
+
remaining.delete(old.handle)
|
|
44
|
+
return [dequal(fieldsView([old])[old.handle], value) ? old : port(old.handle, value)]
|
|
45
|
+
}),
|
|
46
|
+
...Array.from(remaining, ([handle, value]) => port(handle, value)),
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The workflow input contract shared by draft authoring and published views. */
|
|
51
|
+
export function flowInputDefinitions(content: RevisionContent) {
|
|
52
|
+
return fieldsView(Object.values(content.document.graph.nodes).find((node) => node.kind == 'start')?.inputDefs ?? [])
|
|
53
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Group, InputPort, JsonValue, ManagedTaskDefinition } from '../../flow/common/change.ts'
|
|
2
|
+
|
|
3
|
+
import { dequal } from 'dequal/lite'
|
|
4
|
+
import { z } from 'zod'
|
|
5
|
+
|
|
6
|
+
// Values remain JSON so an existing draft with invalid runtime values can still
|
|
7
|
+
// be inspected and repaired without rewriting unrelated configuration.
|
|
8
|
+
export const authoringLlmConfiguration = z.strictObject({
|
|
9
|
+
mode: z.enum(['chat', 'json']),
|
|
10
|
+
resultSchema: z.json(),
|
|
11
|
+
model: z.json().optional().describe('Default model settings: {model, temperature?, top_p?, max_tokens?}. A bound model input takes precedence.'),
|
|
12
|
+
template: z.json().optional().describe('Default message templates: [{role: "system" | "user" | "assistant", content: "Text with {{namedInput}}"}].'),
|
|
13
|
+
messages: z.json().optional().describe('Default conversation history, prepended without template interpolation; an array of {role, content} or null.'),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const defaults = { model: 'model', template: 'template', messages: 'messages' } as const
|
|
17
|
+
type DefaultName = keyof typeof defaults
|
|
18
|
+
|
|
19
|
+
/** Read defaults only. Node bindings remain independently visible and editable. */
|
|
20
|
+
export function llmConfigurationView(task: ManagedTaskDefinition): Record<string, JsonValue> {
|
|
21
|
+
if (task.executor.kind != 'llm') throw new TypeError('Expected an LLM task.')
|
|
22
|
+
const config: Record<string, JsonValue> = {
|
|
23
|
+
mode: task.executor.mode,
|
|
24
|
+
resultSchema: task.outputs.find((port) => 'handle' in port)?.jsonSchema ?? {},
|
|
25
|
+
}
|
|
26
|
+
for (const [name, handle] of Object.entries(defaults)) {
|
|
27
|
+
const port = task.inputs.find((candidate): candidate is InputPort => 'handle' in candidate && candidate.handle == handle)
|
|
28
|
+
if (port != null && Object.hasOwn(port, 'value')) config[name] = port.value!
|
|
29
|
+
}
|
|
30
|
+
return config
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Update default values without altering port contracts, groups, or node bindings. */
|
|
34
|
+
export function prepareLlmConfiguration(config: Record<string, unknown>, previous: ManagedTaskDefinition, name: string): ManagedTaskDefinition {
|
|
35
|
+
if (previous.executor.kind != 'llm') throw new TypeError('Expected an LLM task.')
|
|
36
|
+
const old = llmConfigurationView(previous)
|
|
37
|
+
const changed = (Object.keys(defaults) as DefaultName[]).filter(
|
|
38
|
+
(key) => Object.hasOwn(old, key) != Object.hasOwn(config, key) || !dequal(old[key], config[key]),
|
|
39
|
+
)
|
|
40
|
+
const inputs = previous.inputs.map((port): InputPort | Group => {
|
|
41
|
+
if (!('handle' in port)) return port
|
|
42
|
+
const key = changed.find((candidate) => defaults[candidate] == port.handle)
|
|
43
|
+
if (key == null) return port
|
|
44
|
+
const { value: _value, ...withoutDefault } = port
|
|
45
|
+
return Object.hasOwn(config, key) ? { ...withoutDefault, value: config[key] as JsonValue } : withoutDefault
|
|
46
|
+
})
|
|
47
|
+
return {
|
|
48
|
+
...previous,
|
|
49
|
+
name,
|
|
50
|
+
executor: { ...previous.executor, mode: config.mode as 'chat' | 'json' },
|
|
51
|
+
inputs,
|
|
52
|
+
outputs: dequal(old.resultSchema, config.resultSchema)
|
|
53
|
+
? previous.outputs
|
|
54
|
+
: previous.outputs.map((port) => ('handle' in port ? { ...port, jsonSchema: config.resultSchema as JsonValue } : port)),
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Keep the production LLM factory's contracts while removing sample business data. */
|
|
59
|
+
export function initialAuthoringLlmTask(task: ManagedTaskDefinition): ManagedTaskDefinition {
|
|
60
|
+
if (task.executor.kind != 'llm') throw new TypeError('Expected an LLM task.')
|
|
61
|
+
return {
|
|
62
|
+
...task,
|
|
63
|
+
inputs: task.inputs.flatMap<InputPort | Group>((port) => {
|
|
64
|
+
if (!('handle' in port)) return [port]
|
|
65
|
+
if (port.handle == 'input') return []
|
|
66
|
+
if (port.handle == 'template') return [{ ...port, value: [{ role: 'user', content: '' }] }]
|
|
67
|
+
return [port]
|
|
68
|
+
}),
|
|
69
|
+
}
|
|
70
|
+
}
|