@powerhousedao/workflow 6.2.3-dev.69 → 6.2.3-dev.71

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 (126) hide show
  1. package/dist/browser/BlockSelector-DFX-DZHl.js +3243 -0
  2. package/dist/browser/BlockSelector-DFX-DZHl.js.map +1 -0
  3. package/dist/browser/PieceMarkdown-U6OUTwRi.js +66 -0
  4. package/dist/browser/PieceMarkdown-U6OUTwRi.js.map +1 -0
  5. package/dist/browser/{connection-5ri_Ex8F.js → connection-Ci_pI3kD.js} +2 -2
  6. package/dist/browser/{connection-5ri_Ex8F.js.map → connection-Ci_pI3kD.js.map} +1 -1
  7. package/dist/browser/{connection-form-FoGRZSTT.js → connection-form-BuW6qOAF.js} +6 -5
  8. package/dist/browser/{connection-form-FoGRZSTT.js.map → connection-form-BuW6qOAF.js.map} +1 -1
  9. package/dist/browser/data-tree-BLn565V5.js +63 -0
  10. package/dist/browser/data-tree-BLn565V5.js.map +1 -0
  11. package/dist/browser/document-models/connection/index.js +2 -2
  12. package/dist/browser/document-models/index.js +3 -3
  13. package/dist/browser/document-models/workflow/index.js +2 -2
  14. package/dist/browser/{document-models-DAAo3Bln.js → document-models-B2IDRvBZ.js} +3 -3
  15. package/dist/browser/{document-models-DAAo3Bln.js.map → document-models-B2IDRvBZ.js.map} +1 -1
  16. package/dist/browser/{editor-ioEkaHLb.js → editor-B1-_KRbr.js} +10 -11
  17. package/dist/browser/{editor-ioEkaHLb.js.map → editor-B1-_KRbr.js.map} +1 -1
  18. package/dist/browser/editor-DBcq58Fr.js +6847 -0
  19. package/dist/browser/editor-DBcq58Fr.js.map +1 -0
  20. package/dist/browser/{editor-CX_SY6s_.js → editor-DPGuck1V.js} +8 -8
  21. package/dist/browser/editor-DPGuck1V.js.map +1 -0
  22. package/dist/browser/editors/connection-editor/module.js +1 -1
  23. package/dist/browser/editors/connection-editor/module.js.map +1 -1
  24. package/dist/browser/editors/runtime/index.js +1 -1
  25. package/dist/browser/editors/workflow-editor/module.js +1 -1
  26. package/dist/browser/editors/workflow-editor/module.js.map +1 -1
  27. package/dist/browser/editors/workflow-studio/module.js +1 -1
  28. package/dist/browser/index.js +12 -5
  29. package/dist/browser/index.js.map +1 -1
  30. package/dist/browser/{module-DxQBeqBh.js → module-DFCANOuI.js} +3 -3
  31. package/dist/browser/{module-DxQBeqBh.js.map → module-DFCANOuI.js.map} +1 -1
  32. package/dist/browser/{module-DIQ3tQ2M.js → module-FuSfFXPT.js} +2 -2
  33. package/dist/browser/{module-DIQ3tQ2M.js.map → module-FuSfFXPT.js.map} +1 -1
  34. package/dist/browser/reactor/index.js +2 -2
  35. package/dist/browser/rolldown-runtime-D7D4PA-g.js +13 -0
  36. package/dist/browser/runtime-queries-C9SoXGm2.js +791 -0
  37. package/dist/browser/runtime-queries-C9SoXGm2.js.map +1 -0
  38. package/dist/browser/trigger-text-B2mo1fiB.js +493 -0
  39. package/dist/browser/trigger-text-B2mo1fiB.js.map +1 -0
  40. package/dist/browser/upgrade-manifests-B62uqKVp.js +8 -0
  41. package/dist/browser/{upgrade-manifests-CAE3ivDp.js.map → upgrade-manifests-B62uqKVp.js.map} +1 -1
  42. package/dist/browser/{workflow-CP_X_Njm.js → workflow-DjTleFFO.js} +2 -2
  43. package/dist/browser/{workflow-CP_X_Njm.js.map → workflow-DjTleFFO.js.map} +1 -1
  44. package/dist/node/{BlockSelector-DfCL1GAk.mjs → BlockSelector-CF4xOFNG.mjs} +2 -2
  45. package/dist/node/{BlockSelector-DfCL1GAk.mjs.map → BlockSelector-CF4xOFNG.mjs.map} +1 -1
  46. package/dist/node/{PieceMarkdown-BMhBGa4t.mjs → PieceMarkdown-DwpCBISY.mjs} +2 -2
  47. package/dist/node/{PieceMarkdown-BMhBGa4t.mjs.map → PieceMarkdown-DwpCBISY.mjs.map} +1 -1
  48. package/dist/node/{connection-form-BbWKMBHt.mjs → connection-form-CYlSCGTK.mjs} +3 -3
  49. package/dist/node/{connection-form-BbWKMBHt.mjs.map → connection-form-CYlSCGTK.mjs.map} +1 -1
  50. package/dist/node/{connection-DJFsS9rQ.mjs → connection-i6ISRY0F.mjs} +2 -2
  51. package/dist/node/{connection-DJFsS9rQ.mjs.map → connection-i6ISRY0F.mjs.map} +1 -1
  52. package/dist/node/{data-tree-DAlZbha-.mjs → data-tree-DmhiI_Jk.mjs} +3 -3
  53. package/dist/node/{data-tree-DAlZbha-.mjs.map → data-tree-DmhiI_Jk.mjs.map} +1 -1
  54. package/dist/node/document-models/connection/index.mjs +2 -2
  55. package/dist/node/document-models/index.mjs +3 -3
  56. package/dist/node/document-models/workflow/index.mjs +2 -2
  57. package/dist/node/{editor-tHhPmmR_.mjs → editor-B653s9Xv.mjs} +15 -15
  58. package/dist/node/editor-B653s9Xv.mjs.map +1 -0
  59. package/dist/node/{editor-CAfTlm6l.mjs → editor-C6B1IKNB.mjs} +9 -10
  60. package/dist/node/{editor-CAfTlm6l.mjs.map → editor-C6B1IKNB.mjs.map} +1 -1
  61. package/dist/node/{editor-mRrsuvh4.mjs → editor-k8zOuO2n.mjs} +6 -6
  62. package/dist/node/editor-k8zOuO2n.mjs.map +1 -0
  63. package/dist/node/editors/connection-editor/module.mjs +1 -1
  64. package/dist/node/editors/connection-editor/module.mjs.map +1 -1
  65. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  66. package/dist/node/editors/workflow-editor/module.mjs.map +1 -1
  67. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  68. package/dist/node/{graphql-BGVLRhC1.mjs → graphql-D76E1YiQ.mjs} +2 -2
  69. package/dist/node/{graphql-BGVLRhC1.mjs.map → graphql-D76E1YiQ.mjs.map} +1 -1
  70. package/dist/node/index.mjs +10 -4
  71. package/dist/node/index.mjs.map +1 -1
  72. package/dist/node/{module-DPg8IYIn.mjs → module-DV3LLvxo.mjs} +2 -2
  73. package/dist/node/{module-DPg8IYIn.mjs.map → module-DV3LLvxo.mjs.map} +1 -1
  74. package/dist/node/{module-Bl_4mnxR.mjs → module-weVJEMpP.mjs} +2 -2
  75. package/dist/node/{module-Bl_4mnxR.mjs.map → module-weVJEMpP.mjs.map} +1 -1
  76. package/dist/node/pieces/reactor/descriptor.json +1 -1
  77. package/dist/node/pieces/reactor/package.json +1 -1
  78. package/dist/{browser/rolldown-runtime-DC62tzP2.js → node/rolldown-runtime-B4iAMlE-.mjs} +3 -1
  79. package/dist/node/trigger-text-D98Ip9qF.mjs +492 -0
  80. package/dist/node/trigger-text-D98Ip9qF.mjs.map +1 -0
  81. package/dist/node/upgrade-manifests-CO9zzPnE.mjs +8 -0
  82. package/dist/node/{upgrade-manifests-7SFwDrhd.mjs.map → upgrade-manifests-CO9zzPnE.mjs.map} +1 -1
  83. package/dist/node/{workflow-CPlqsc5D.mjs → workflow-BS5m4jtr.mjs} +2 -2
  84. package/dist/node/{workflow-CPlqsc5D.mjs.map → workflow-BS5m4jtr.mjs.map} +1 -1
  85. package/dist/powerhouse.manifest.json +1 -1
  86. package/dist/style.css +3 -2903
  87. package/dist/types/ai/runtime-url.d.ts.map +1 -1
  88. package/dist/types/editors/connection-editor/editor.d.ts +3 -1
  89. package/dist/types/editors/connection-editor/editor.d.ts.map +1 -1
  90. package/dist/types/editors/connection-editor/module.d.ts +2 -1
  91. package/dist/types/editors/connection-editor/module.d.ts.map +1 -1
  92. package/dist/types/editors/workflow-editor/editor.d.ts +3 -1
  93. package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
  94. package/dist/types/editors/workflow-editor/module.d.ts +2 -1
  95. package/dist/types/editors/workflow-editor/module.d.ts.map +1 -1
  96. package/package.json +8 -8
  97. package/dist/browser/BlockSelector-BMI6RtS_.js +0 -8596
  98. package/dist/browser/BlockSelector-BMI6RtS_.js.map +0 -1
  99. package/dist/browser/PieceMarkdown-B8EEaQgT.js +0 -21435
  100. package/dist/browser/PieceMarkdown-B8EEaQgT.js.map +0 -1
  101. package/dist/browser/assets/entry-oIniX8Dq.js +0 -418
  102. package/dist/browser/assets/projection-entry-CdlLTrjU.js +0 -482
  103. package/dist/browser/block-type-kX-27vVt.js +0 -44
  104. package/dist/browser/block-type-kX-27vVt.js.map +0 -1
  105. package/dist/browser/data-tree-Bae8a2NP.js +0 -1896
  106. package/dist/browser/data-tree-Bae8a2NP.js.map +0 -1
  107. package/dist/browser/editor-CX_SY6s_.js.map +0 -1
  108. package/dist/browser/editor-DUtYefNU.js +0 -17626
  109. package/dist/browser/editor-DUtYefNU.js.map +0 -1
  110. package/dist/browser/graphql-Cr1ia6fo.js +0 -2474
  111. package/dist/browser/graphql-Cr1ia6fo.js.map +0 -1
  112. package/dist/browser/icon-components-CJ4I3Y6Y-DQj9fo1T.js +0 -3188
  113. package/dist/browser/icon-components-CJ4I3Y6Y-DQj9fo1T.js.map +0 -1
  114. package/dist/browser/runtime-queries-DehIdatq.js +0 -2615
  115. package/dist/browser/runtime-queries-DehIdatq.js.map +0 -1
  116. package/dist/browser/trigger-text-Cepiqt6x.js +0 -6131
  117. package/dist/browser/trigger-text-Cepiqt6x.js.map +0 -1
  118. package/dist/browser/upgrade-manifests-CAE3ivDp.js +0 -8
  119. package/dist/node/editor-mRrsuvh4.mjs.map +0 -1
  120. package/dist/node/editor-tHhPmmR_.mjs.map +0 -1
  121. package/dist/node/icon-components-CJ4I3Y6Y-DyXkyBjD.mjs +0 -3188
  122. package/dist/node/icon-components-CJ4I3Y6Y-DyXkyBjD.mjs.map +0 -1
  123. package/dist/node/rolldown-runtime-BMI-E3GI.mjs +0 -44
  124. package/dist/node/trigger-text-nrUcI93G.mjs +0 -7327
  125. package/dist/node/trigger-text-nrUcI93G.mjs.map +0 -1
  126. package/dist/node/upgrade-manifests-7SFwDrhd.mjs +0 -8
@@ -1,8 +1,8 @@
1
1
  import { a as isConfigValueMissing, c as planFromAuth, o as packageFromConnectorId, r as connectorIdForPiece } from "./piece-auth-BS5CtQOG.mjs";
2
2
  import { Q as REACTOR_PIECE, U as createRuntimeClient, V as DEFAULT_RUNTIME_URL, X as CORE_PIECE, gt as flowPorts, n as catalogQuery, r as createRuntimeQueryClient, t as blockFormQuery } from "./runtime-queries-CJSpbsBq.mjs";
3
- import { M as REACTOR_CONNECTOR_ID, t as Connection } from "./module-Bl_4mnxR.mjs";
4
- import { t as Workflow } from "./module-DPg8IYIn.mjs";
5
- import { t as upgradeManifests } from "./upgrade-manifests-7SFwDrhd.mjs";
3
+ import { M as REACTOR_CONNECTOR_ID, t as Connection } from "./module-weVJEMpP.mjs";
4
+ import { t as Workflow } from "./module-DV3LLvxo.mjs";
5
+ import { t as upgradeManifests } from "./upgrade-manifests-CO9zzPnE.mjs";
6
6
  import { ConnectionEditor } from "./editors/connection-editor/module.mjs";
7
7
  import { WorkflowEditor } from "./editors/workflow-editor/module.mjs";
8
8
  import { WorkflowStudio } from "./editors/workflow-studio/module.mjs";
@@ -175,9 +175,15 @@ const fetchRuns = (scope) => ambient.fetchRuns(scope);
175
175
  const fireWorkflow = (workflowId, payload) => ambient.fireWorkflow(workflowId, payload);
176
176
  //#endregion
177
177
  //#region ai/runtime-url.ts
178
+ const warnedDrives = /* @__PURE__ */ new Set();
178
179
  function syncRuntimeUrl() {
179
180
  if (typeof window === "undefined") return;
180
- const switchboard = resolveDriveSwitchboard(getPHStore()?.selectedDriveId);
181
+ const driveId = getPHStore()?.selectedDriveId;
182
+ const switchboard = resolveDriveSwitchboard(driveId);
183
+ if (!switchboard && driveId && !warnedDrives.has(driveId)) {
184
+ warnedDrives.add(driveId);
185
+ console.warn(`[workflow] Drive "${driveId}" is not synced from a switchboard, so Workflow Studio falls back to ${DEFAULT_RUNTIME_URL}. Attach the switchboard's Workflows drive (its /d/<slug> URL) instead of a local drive.`);
186
+ }
181
187
  setRuntimeUrl(switchboard ? `${switchboard.graphqlUrl}/workflow-runtime` : DEFAULT_RUNTIME_URL);
182
188
  }
183
189
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["READ_ONLY","runConnectionCheck","ConnectionV1","WorkflowV1","manifestJson"],"sources":["../../powerhouse.manifest.json","../../editors/workflow-editor/runtime-api.ts","../../ai/runtime-url.ts","../../ai/workflow-tools.ts","../../ai/tools.ts","../../document-models/document-models.ts","../../editors/editors.ts","../../index.ts"],"sourcesContent":["","// Ambient runtime client for the AI tools, which run outside any editor.\n// Editors never import this: each one gets its own client from RuntimeProvider.\nimport type { BlockRef } from \"@powerhousedao/pieces-framework/block-type\";\nimport {\n createRuntimeClient,\n DEFAULT_RUNTIME_URL,\n type RunsScope,\n type RuntimeClient,\n} from \"./runtime-client.js\";\nimport {\n blockFormQuery,\n catalogQuery,\n createRuntimeQueryClient,\n} from \"./runtime-queries.js\";\n\nexport type * from \"./runtime-client.js\";\nexport { DEFAULT_RUNTIME_URL };\n\nlet ambient: RuntimeClient = createRuntimeClient(DEFAULT_RUNTIME_URL);\n// Keys start with the URL, so switching runtimes needs no cache reset.\nconst ambientQueries = createRuntimeQueryClient();\n\nexport function setRuntimeUrl(url: string): void {\n if (url !== ambient.url) ambient = createRuntimeClient(url);\n}\n\nexport const getBlockForm = (block: BlockRef) =>\n ambientQueries.fetchQuery(blockFormQuery(ambient, block));\nexport const fetchPieceCatalog = () =>\n ambientQueries.fetchQuery(catalogQuery(ambient));\nexport const fetchPieceActions = (packageName: string) =>\n ambient.fetchPieceActions(packageName);\nexport const fetchPieceTriggers = (packageName: string) =>\n ambient.fetchPieceTriggers(packageName);\nexport const searchPieces = (\n query: string,\n filter: Parameters<RuntimeClient[\"searchPieces\"]>[1],\n) => ambient.searchPieces(query, filter);\nexport const fetchConnections = () => ambient.fetchConnections();\nexport const checkConnection = (connectionId: string) =>\n ambient.checkConnection(connectionId);\nexport const fetchRuns = (scope?: RunsScope) => ambient.fetchRuns(scope);\nexport const fireWorkflow = (workflowId: string, payload?: unknown) =>\n ambient.fireWorkflow(workflowId, payload);\n","// Points the module-level runtime client at the selected drive's\n// workflow-runtime subgraph before an AI tool talks to it.\nimport { getPHStore } from \"@powerhousedao/reactor-browser\";\nimport { resolveDriveSwitchboard } from \"@powerhousedao/reactor-browser/ai\";\nimport {\n DEFAULT_RUNTIME_URL,\n setRuntimeUrl,\n} from \"../editors/workflow-editor/runtime-api.js\";\n\nexport function syncRuntimeUrl(): void {\n if (typeof window === \"undefined\") return;\n const switchboard = resolveDriveSwitchboard(getPHStore()?.selectedDriveId);\n // No resolvable switchboard (no selection, or a local/unsynced drive):\n // reset to the default rather than leaving a prior drive's URL attached.\n setRuntimeUrl(\n switchboard\n ? `${switchboard.graphqlUrl}/workflow-runtime`\n : DEFAULT_RUNTIME_URL,\n );\n}\n","// AI tool descriptors for authoring and running workflows: the pinned blocks\n// a piece offers, a block's config props, the built-in core blocks with\n// the expression syntax, run history and manual firing. Complements the\n// connector/connection tools in tools.ts, which cover the catalog and auth.\nimport type { PhAiToolDescriptor } from \"@powerhousedao/shared/document-model\";\nimport { z } from \"zod\";\nimport {\n fetchPieceActions,\n fetchPieceTriggers,\n fetchRuns,\n fireWorkflow,\n getBlockForm,\n} from \"../editors/workflow-editor/runtime-api.js\";\nimport type { BlockFormProp } from \"../editors/workflow-editor/ui/forms.js\";\nimport { REACTOR_CONNECTOR_ID } from \"../document-models/connection/v1/src/reactor-connection.js\";\nimport {\n CORE_PIECE,\n REACTOR_PIECE,\n type BlockRef,\n} from \"../editors/workflow-editor/ui/blocks.js\";\nimport { syncRuntimeUrl } from \"./runtime-url.js\";\nimport { flowPorts } from \"@powerhousedao/pieces-framework/workflow\";\n\nconst READ_ONLY = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n} as const;\n\nfunction kindOf(block: BlockRef): \"trigger\" | \"step\" {\n return block.kind === \"trigger\" ? \"trigger\" : \"step\";\n}\n\n// The fields ADD_STEP or SET_TRIGGER takes for the block.\nfunction blockFields(block: BlockRef) {\n return {\n pieceName: block.pieceName,\n pieceVersion: block.pieceVersion,\n ...(block.kind === \"trigger\"\n ? { triggerName: block.name }\n : { actionName: block.name }),\n };\n}\n\n// The onward ports the block's descriptor declares; \"error\" is a failure route.\nfunction portsFor(form: { ports?: readonly string[] }): string[] {\n return flowPorts(form.ports ?? []);\n}\n\nfunction describeProp(prop: BlockFormProp) {\n return {\n name: prop.name,\n label: prop.displayName,\n type: prop.type,\n required: prop.required,\n ...(prop.description ? { description: prop.description } : {}),\n ...(prop.defaultValue !== undefined ? { default: prop.defaultValue } : {}),\n ...(prop.staticOptions\n ? { options: prop.staticOptions.map((option) => option.value) }\n : {}),\n ...(prop.hasDynamicResolver ? { dynamicOptions: true } : {}),\n };\n}\n\nconst EXPRESSIONS = [\n \"Step configs and edge conditions may contain expressions in double braces.\",\n \"{{trigger.payload.<field>}} reads the trigger payload: for the core manual trigger the payload passed to fireWorkflow; for the reactor piece's document triggers it carries documentId, documentType, driveId and name.\",\n \"{{steps.<key>.output.<path>}} reads an upstream step's output by that step's key, e.g. {{steps.fetch.output.body.title}}.\",\n \"The reactor piece's document-create and document-dispatch output a reference { documentId, documentType, branch, revision }, e.g. {{steps.create.output.documentId}}; read the document with document-get to use its state. document-get outputs the document as { header, state }, e.g. {{steps.get.output.state.global.name}} or {{steps.get.output.header.id}}. document-find outputs { results, nextCursor }: each result has a header (and state with includeState), and nextCursor, present while more match, goes in a later find's cursor.\",\n \"{{variables.<key>}} reads a workflow variable.\",\n \"'a' || 'b' picks the first non-empty value, e.g. {{trigger.payload.url || 'https://example.com'}}.\",\n \"A whole-string expression yields the raw value; text around expressions is interpolated.\",\n];\n\nconst GRAPH_RULES = [\n \"A workflow is a powerhouse/workflow document. Build it with SET_TRIGGER once, ADD_STEP per step (each with a unique id and key), and ADD_EDGE from the trigger id to the first step and between steps.\",\n \"An edge must leave on a port its source declares (getWorkflowBlockConfig lists them): 'next' for the trigger and ordinary steps, 'true' and 'false' for the core branch action, 'error' to route a failure. An edge on any other port is never taken, and the run is flagged with a warning.\",\n \"A step names its block with pieceName, pieceVersion and actionName; the trigger with pieceName, pieceVersion and triggerName. pieceVersion is an exact semver: copy the fields getWorkflowPieceBlocks or listWorkflowCoreBlocks return.\",\n `The built-in blocks (manual, schedule and webhook triggers, branch and assert) belong to the piece ${CORE_PIECE}.`,\n \"Steps whose piece needs a connection must set connectionId to a powerhouse/connection document id (see getConnections).\",\n `Every step and trigger whose block reports requireReactor (getWorkflowBlockConfig) must set reactorConnectionId to a powerhouse/connection document with authType REACTOR and connectorId ${REACTOR_CONNECTOR_ID} (see getConnections); the ${REACTOR_PIECE} blocks all do. Without one the block gets no reactor access and fails. The connection's config { endpoint: \"local\", access?: \"read\", filter?: { documentType?, documentId?, driveId?, actionType? } } limits which documents it reads and writes. connectionId stays for credentials; a document block normally needs none.`,\n \"Runs execute the published snapshot, not the draft. PUBLISH_WORKFLOW only snapshots the draft, so publish again after every edit that should run.\",\n \"Only ENABLED workflows get trigger instances and can be fired. PUBLISH_WORKFLOW does not enable: to turn a workflow on, dispatch SET_WORKFLOW_STATUS ENABLED after PUBLISH_WORKFLOW (the same batch works). SET_WORKFLOW_STATUS ENABLED is refused until the workflow has been published once.\",\n];\n\nexport const getWorkflowPieceBlocksTool: PhAiToolDescriptor = {\n name: \"getWorkflowPieceBlocks\",\n description:\n \"Lists the actions and triggers of one piece, each with the pieceName, pieceVersion and actionName or triggerName to use in ADD_STEP or SET_TRIGGER. Takes the piece package name from getConnectors. Call getWorkflowBlockConfig next for a block's config props.\",\n inputSchema: {\n packageName: z\n .string()\n .describe(\"Piece package name, e.g. @activepieces/piece-http.\"),\n },\n annotations: { title: \"Get Workflow Piece Blocks\", ...READ_ONLY },\n callback: async (args: { packageName: string }) => {\n syncRuntimeUrl();\n const [actions, triggers] = await Promise.all([\n fetchPieceActions(args.packageName),\n fetchPieceTriggers(args.packageName),\n ]);\n return {\n packageName: args.packageName,\n actions: actions.map((action) => ({\n pieceName: action.pieceName,\n pieceVersion: action.pieceVersion,\n actionName: action.name,\n displayName: action.displayName,\n description: action.description,\n })),\n triggers: triggers.map((trigger) => ({\n pieceName: trigger.pieceName,\n pieceVersion: trigger.pieceVersion,\n triggerName: trigger.name,\n displayName: trigger.displayName,\n description: trigger.description,\n strategy: trigger.strategy,\n })),\n };\n },\n};\n\nexport const getWorkflowBlockConfigTool: PhAiToolDescriptor = {\n name: \"getWorkflowBlockConfig\",\n description:\n \"Describes the config of one block (a core block or a piece's action or trigger): prop names, types, whether required, allowed options, the output ports, whether a connection is needed, and requireReactor (read | write) when it needs a reactor connection. Use it before writing a step or trigger config.\",\n inputSchema: {\n pieceName: z\n .string()\n .describe(\n `Piece package name, e.g. ${CORE_PIECE} or @activepieces/piece-http.`,\n ),\n pieceVersion: z.string().describe(\"Exact semver of the piece.\"),\n name: z\n .string()\n .describe(\"Action or trigger name, e.g. branch or send_request.\"),\n kind: z.enum([\"action\", \"trigger\"]).describe(\"action or trigger.\"),\n },\n annotations: { title: \"Get Workflow Block Config\", ...READ_ONLY },\n callback: async (args: BlockRef) => {\n const block: BlockRef = {\n pieceName: args.pieceName,\n pieceVersion: args.pieceVersion,\n name: args.name,\n kind: args.kind,\n };\n syncRuntimeUrl();\n const form = await getBlockForm(block);\n if (!form) {\n return {\n ...blockFields(block),\n error:\n \"Unknown block. Use getConnectors and getWorkflowPieceBlocks to find valid blocks (documents live in @powerhousedao/piece-reactor), or listWorkflowCoreBlocks for built-ins.\",\n };\n }\n return {\n ...blockFields(block),\n title: form.title,\n kind: kindOf(block),\n requiresConnection: form.auth === \"required\",\n // read | write: the block needs a reactorConnectionId granting this.\n requireReactor: form.requireReactor ?? null,\n props: form.props.map(describeProp),\n ports: portsFor(form),\n };\n },\n};\n\nexport const listWorkflowCoreBlocksTool: PhAiToolDescriptor = {\n name: \"listWorkflowCoreBlocks\",\n description: `Lists the built-in blocks of the ${CORE_PIECE} piece (manual, schedule and webhook triggers, branch and assert) with their pinned fields and config props, plus the expression syntax and the rules for building a powerhouse/workflow document. Documents are read and written by the @powerhousedao/piece-reactor blocks; list those with getWorkflowPieceBlocks.`,\n inputSchema: {},\n annotations: { title: \"List Workflow Core Blocks\", ...READ_ONLY },\n callback: async () => {\n syncRuntimeUrl();\n // The reactor serves the core piece's descriptors, as it does any piece's.\n const [actions, triggers] = await Promise.all([\n fetchPieceActions(CORE_PIECE),\n fetchPieceTriggers(CORE_PIECE),\n ]);\n const blocks: BlockRef[] = [\n ...triggers.map((entry) => ({ ...entry, kind: \"trigger\" as const })),\n ...actions.map((entry) => ({ ...entry, kind: \"action\" as const })),\n ].map((entry) => ({\n pieceName: entry.pieceName,\n pieceVersion: entry.pieceVersion,\n name: entry.name,\n kind: entry.kind,\n }));\n const forms = await Promise.all(blocks.map(getBlockForm));\n return {\n blocks: blocks.flatMap((block, index) => {\n const form = forms[index];\n if (!form) return [];\n return [\n {\n ...blockFields(block),\n title: form.title,\n kind: kindOf(block),\n props: form.props.map(describeProp),\n ports: portsFor(form),\n },\n ];\n }),\n expressions: EXPRESSIONS,\n rules: GRAPH_RULES,\n };\n },\n};\n\nexport const listWorkflowRunsTool: PhAiToolDescriptor = {\n name: \"listWorkflowRuns\",\n description:\n \"Lists recent workflow runs, newest first, with status, error and each step's outcome. Filter by workflowId to inspect one workflow, or by driveId for every workflow in a drive.\",\n inputSchema: {\n workflowId: z\n .string()\n .optional()\n .describe(\"Workflow document id to filter by.\"),\n driveId: z\n .string()\n .optional()\n .describe(\"Drive id to filter by (all workflows in that drive).\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe(\"Maximum runs to return (default 10).\"),\n },\n annotations: { title: \"List Workflow Runs\", ...READ_ONLY },\n callback: async (args: {\n workflowId?: string;\n driveId?: string;\n limit?: number;\n }) => {\n syncRuntimeUrl();\n const runs = await fetchRuns({\n workflowId: args.workflowId,\n driveId: args.driveId,\n limit: args.limit ?? 10,\n });\n return {\n runs: runs.map((run) => ({\n id: run.id,\n workflowId: run.workflowId,\n workflowName: run.workflowName,\n status: run.status,\n error: run.error,\n triggerKind: run.triggerKind,\n startedAt: run.startedAt,\n endedAt: run.endedAt,\n steps: run.steps.map((step) => ({\n key: step.stepKey,\n status: step.status,\n error: step.error,\n })),\n })),\n };\n },\n};\n\nexport const fireWorkflowTool: PhAiToolDescriptor = {\n name: \"fireWorkflow\",\n description:\n \"Fires an ENABLED workflow whose trigger is the core manual trigger and runs its published snapshot to completion. The payload becomes {{trigger.payload}}. Returns the run id and final status.\",\n inputSchema: {\n workflowId: z.string().describe(\"Workflow document id.\"),\n payload: z\n .record(z.string(), z.unknown())\n .optional()\n .describe(\"Trigger payload object.\"),\n },\n annotations: {\n title: \"Fire Workflow\",\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: false,\n },\n callback: (args: {\n workflowId: string;\n payload?: Record<string, unknown>;\n }) => {\n syncRuntimeUrl();\n return fireWorkflow(args.workflowId, args.payload ?? {});\n },\n};\n\n/** Workflow authoring and run tools, merged into `aiTools` in tools.ts. */\nexport const workflowTools: PhAiToolDescriptor[] = [\n getWorkflowPieceBlocksTool,\n getWorkflowBlockConfigTool,\n listWorkflowCoreBlocksTool,\n listWorkflowRunsTool,\n fireWorkflowTool,\n];\n","// Read-only AI tool descriptors for the Connect assistant: the project's\n// piece catalog, connection documents, and connection health. The `aiTools`\n// export is how the host app discovers this package's tools (the line in the\n// project index is synced by `ph generate`).\nimport { getPHStore } from \"@powerhousedao/reactor-browser\";\nimport type { PhAiToolDescriptor } from \"@powerhousedao/shared/document-model\";\nimport { z } from \"zod\";\nimport {\n connectorIdForPiece,\n isConfigValueMissing,\n packageFromConnectorId,\n planFromAuth,\n type AuthField,\n} from \"../editors/connection-editor/piece-auth.js\";\nimport {\n checkConnection as runConnectionCheck,\n fetchConnections,\n fetchPieceActions,\n fetchPieceCatalog,\n fetchPieceTriggers,\n searchPieces,\n type PieceSummary,\n} from \"../editors/workflow-editor/runtime-api.js\";\nimport { syncRuntimeUrl } from \"./runtime-url.js\";\nimport { workflowTools } from \"./workflow-tools.js\";\n\nconst MAX_CONNECTORS = 20;\n\nexport interface ConnectorField {\n name: string;\n label: string;\n required: boolean;\n description?: string;\n secret: boolean;\n}\n\nexport interface ConnectorDetail {\n connectorId: string;\n pieceName: string;\n displayName: string;\n description: string;\n version: string;\n authType: string;\n /** False for auth kinds the runtime cannot execute yet (OIDC). */\n supported: boolean;\n /** OAUTH2: a person finishes it by signing in from the connection editor. */\n signIn?: \"oauth2\";\n fields: ConnectorField[];\n actions: string[];\n triggers: string[];\n}\n\nfunction toField(field: AuthField, secret: boolean): ConnectorField {\n return {\n name: field.name,\n label: field.displayName,\n required: field.required,\n description: field.description,\n secret,\n };\n}\n\nasync function connectorDetail(piece: PieceSummary): Promise<ConnectorDetail> {\n const plan = planFromAuth(piece.auth);\n const [actions, triggers] = await Promise.all([\n fetchPieceActions(piece.name),\n fetchPieceTriggers(piece.name),\n ]);\n return {\n connectorId: connectorIdForPiece(piece.name),\n pieceName: piece.name,\n displayName: piece.displayName,\n description: piece.description,\n version: piece.version,\n authType: plan.authType,\n supported: plan.supported,\n ...(plan.oauth2 ? { signIn: \"oauth2\" as const } : {}),\n fields: [\n ...plan.configFields.map((field) => toField(field, false)),\n ...plan.secretFields.map((field) => toField(field, true)),\n ],\n actions: actions.map((action) => action.name),\n triggers: triggers.map((trigger) => trigger.name),\n };\n}\n\n// Pieces the runtime's search ranks for the query, actions' and triggers'\n// rankings interleaved; null while its index builds, where it has none, or\n// when it ranks nothing (a package name, say).\nasync function rankedPieces(\n catalog: PieceSummary[],\n query: string,\n): Promise<PieceSummary[] | null> {\n let results;\n try {\n results = await Promise.all(\n ([\"action\", \"trigger\"] as const).map((kind) =>\n searchPieces(query, { kind, limit: 50 }),\n ),\n );\n } catch {\n return null;\n }\n if (results.some((result) => result.status !== \"ready\")) return null;\n const byName = new Map(catalog.map((piece) => [piece.name, piece]));\n const ranked = new Map<string, PieceSummary>();\n const longest = Math.max(...results.map((result) => result.pieces.length));\n for (let rank = 0; rank < longest; rank++) {\n for (const result of results) {\n const name = result.pieces.at(rank)?.pieceName;\n const piece = name === undefined ? undefined : byName.get(name);\n if (piece && !ranked.has(piece.name)) ranked.set(piece.name, piece);\n }\n }\n return ranked.size > 0 ? [...ranked.values()] : null;\n}\n\n/**\n * Stage one of connector discovery: the catalog, optionally narrowed by the\n * runtime's piece search (a substring match while its index builds), capped\n * at {@link MAX_CONNECTORS}. Full auth/action/trigger detail is fetched only\n * for the surviving entries (stage two).\n */\nexport async function getConnectors(query?: string): Promise<{\n total: number;\n matches: number;\n truncated: boolean;\n connectors: ConnectorDetail[];\n}> {\n syncRuntimeUrl();\n const catalog = await fetchPieceCatalog();\n const needle = query?.trim().toLowerCase();\n // A package name is an answer, not a search.\n const exact = catalog.filter((piece) => piece.name.toLowerCase() === needle);\n const matches = !needle\n ? [...catalog]\n : exact.length > 0\n ? exact\n : ((await rankedPieces(catalog, needle)) ??\n catalog.filter((piece) =>\n [piece.name, piece.displayName, piece.description].some((field) =>\n field.toLowerCase().includes(needle),\n ),\n ));\n const page = matches.slice(0, MAX_CONNECTORS);\n const connectors = await Promise.all(page.map(connectorDetail));\n return {\n total: catalog.length,\n matches: matches.length,\n truncated: matches.length > page.length,\n connectors,\n };\n}\n\ninterface ConnectionState {\n config?: unknown;\n secretRefs?: { name: string }[];\n}\n\nexport interface ConnectionDetail {\n id: string;\n name: string;\n connectorId: string;\n authType: string;\n status: string;\n accountLabel: string | null;\n /** Required secret fields with no stored ref, by auth property name. */\n missingSecrets: string[];\n /** Required config fields with no value, by auth property name. */\n missingConfig: string[];\n}\n\n/**\n * Every connection document with its credential state compared against the\n * piece's auth plan. Only field names and opaque refs are surfaced; secret\n * values never do.\n */\nexport async function getConnections(): Promise<{\n connections: ConnectionDetail[];\n}> {\n syncRuntimeUrl();\n const [catalog, summaries] = await Promise.all([\n fetchPieceCatalog(),\n fetchConnections(),\n ]);\n const client = getPHStore()?.reactorClient;\n const connections = await Promise.all(\n summaries.map(async (summary) => {\n const piece = catalog.find(\n (entry) => entry.name === packageFromConnectorId(summary.connectorId),\n );\n const plan = planFromAuth(piece?.auth ?? null);\n let state: ConnectionState | undefined;\n if (client) {\n try {\n const document = await client.get(summary.id);\n state = (document.state as { global?: ConnectionState }).global;\n } catch {\n state = undefined;\n }\n }\n const refNames = new Set(\n (state?.secretRefs ?? []).map((ref) => ref.name),\n );\n const config = (state?.config ?? {}) as Record<string, unknown>;\n return {\n id: summary.id,\n name: summary.name,\n connectorId: summary.connectorId,\n authType: summary.authType,\n status: summary.status,\n accountLabel: summary.accountLabel,\n missingSecrets: plan.secretFields\n .filter((field) => field.required && !refNames.has(field.name))\n .map((field) => field.name),\n missingConfig: plan.configFields\n .filter(\n (field) =>\n field.required && isConfigValueMissing(config[field.name]),\n )\n .map((field) => field.name),\n };\n }),\n );\n return { connections };\n}\n\nconst READ_ONLY = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n} as const;\n\nexport const getConnectorsTool: PhAiToolDescriptor = {\n name: \"getConnectors\",\n description:\n 'Lists the connectors (pieces) available to the workflow runtime with their auth fields, actions, and triggers. Without a query it returns up to 20 connectors; pass `query` to search, best match first: words can name the piece or what it does (e.g. \"slack send message\"), in any order, and small typos are tolerated. Secret fields are listed by name only, never by value.',\n inputSchema: { query: z.string().optional() },\n annotations: { title: \"Get Connectors\", ...READ_ONLY },\n callback: (args: { query?: string }) => getConnectors(args.query),\n};\n\nexport const getConnectionsTool: PhAiToolDescriptor = {\n name: \"getConnections\",\n description:\n \"Lists the project's connection documents with their credential status: which required secrets and config values are still missing, and the last account label. Secret values are never included. A connection with authType REACTOR is bound through a step's or trigger's reactorConnectionId, never connectionId.\",\n inputSchema: {},\n annotations: { title: \"Get Connections\", ...READ_ONLY },\n callback: () => getConnections(),\n};\n\nexport const checkConnectionTool: PhAiToolDescriptor = {\n name: \"checkConnection\",\n description:\n \"Runs a connection's own check against its stored credentials to verify they work. Takes a connection id (from getConnections) and reports success, the failure detail, and the account label when the provider returns one.\",\n inputSchema: { connectionId: z.string() },\n annotations: { title: \"Check Connection\", ...READ_ONLY },\n callback: (args: { connectionId: string }) => {\n syncRuntimeUrl();\n return runConnectionCheck(args.connectionId);\n },\n};\n\n/** Tool descriptors the host app offers the AI assistant. */\nexport const aiTools: PhAiToolDescriptor[] = [\n getConnectorsTool,\n getConnectionsTool,\n checkConnectionTool,\n ...workflowTools,\n];\n","import { Connection as ConnectionV1 } from \"document-models/connection/v1\";\nimport { Workflow as WorkflowV1 } from \"document-models/workflow/v1\";\n\n/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\n\nexport const documentModels = [ConnectionV1, WorkflowV1] as const;\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { EditorModule } from \"document-model\";\nimport { ConnectionEditor } from \"./connection-editor/module.js\";\nimport { WorkflowEditor } from \"./workflow-editor/module.js\";\nimport { WorkflowStudio } from \"./workflow-studio/module.js\";\n\nexport const editors: EditorModule[] = [\n ConnectionEditor,\n WorkflowEditor,\n WorkflowStudio,\n];\n","import type { Manifest } from \"document-model\";\nimport manifestJson from \"./powerhouse.manifest.json\" with { type: \"json\" };\n\nexport { aiTools } from \"./ai/tools.js\";\nexport { documentModels } from \"./document-models/document-models.js\";\nexport { upgradeManifests } from \"./document-models/upgrade-manifests.js\";\nexport { editors } from \"./editors/editors.js\";\nexport const manifest = manifestJson as Manifest;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACkBA,IAAI,UAAyB,oBAAoB,mBAAmB;AAEpE,MAAM,iBAAiB,yBAAyB;AAEhD,SAAgB,cAAc,KAAmB;CAC/C,IAAI,QAAQ,QAAQ,KAAK,UAAU,oBAAoB,GAAG;AAC5D;AAEA,MAAa,gBAAgB,UAC3B,eAAe,WAAW,eAAe,SAAS,KAAK,CAAC;AAC1D,MAAa,0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aACE;EACF,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE;EACxC,aAAa;GAAE,OAAO;GAAoB,GAAG;EAAU;EACvD,WAAW,SAAmC;GAC5C,eAAe;GACf,OAAOC,gBAAmB,KAAK,YAAY;EAC7C;CAOA;CACA,GAAG;AACL;;;;;;;ACtQA,MAAa,iBAAiB,CAACC,YAAcC,QAAU;;;ACCvD,MAAa,UAA0B;CACrC;CACA;CACA;AACF;;;ACNA,MAAa,WAAWC"}
1
+ {"version":3,"file":"index.mjs","names":["READ_ONLY","runConnectionCheck","ConnectionV1","WorkflowV1","manifestJson"],"sources":["../../powerhouse.manifest.json","../../editors/workflow-editor/runtime-api.ts","../../ai/runtime-url.ts","../../ai/workflow-tools.ts","../../ai/tools.ts","../../document-models/document-models.ts","../../editors/editors.ts","../../index.ts"],"sourcesContent":["","// Ambient runtime client for the AI tools, which run outside any editor.\n// Editors never import this: each one gets its own client from RuntimeProvider.\nimport type { BlockRef } from \"@powerhousedao/pieces-framework/block-type\";\nimport {\n createRuntimeClient,\n DEFAULT_RUNTIME_URL,\n type RunsScope,\n type RuntimeClient,\n} from \"./runtime-client.js\";\nimport {\n blockFormQuery,\n catalogQuery,\n createRuntimeQueryClient,\n} from \"./runtime-queries.js\";\n\nexport type * from \"./runtime-client.js\";\nexport { DEFAULT_RUNTIME_URL };\n\nlet ambient: RuntimeClient = createRuntimeClient(DEFAULT_RUNTIME_URL);\n// Keys start with the URL, so switching runtimes needs no cache reset.\nconst ambientQueries = createRuntimeQueryClient();\n\nexport function setRuntimeUrl(url: string): void {\n if (url !== ambient.url) ambient = createRuntimeClient(url);\n}\n\nexport const getBlockForm = (block: BlockRef) =>\n ambientQueries.fetchQuery(blockFormQuery(ambient, block));\nexport const fetchPieceCatalog = () =>\n ambientQueries.fetchQuery(catalogQuery(ambient));\nexport const fetchPieceActions = (packageName: string) =>\n ambient.fetchPieceActions(packageName);\nexport const fetchPieceTriggers = (packageName: string) =>\n ambient.fetchPieceTriggers(packageName);\nexport const searchPieces = (\n query: string,\n filter: Parameters<RuntimeClient[\"searchPieces\"]>[1],\n) => ambient.searchPieces(query, filter);\nexport const fetchConnections = () => ambient.fetchConnections();\nexport const checkConnection = (connectionId: string) =>\n ambient.checkConnection(connectionId);\nexport const fetchRuns = (scope?: RunsScope) => ambient.fetchRuns(scope);\nexport const fireWorkflow = (workflowId: string, payload?: unknown) =>\n ambient.fireWorkflow(workflowId, payload);\n","// Points the module-level runtime client at the selected drive's\n// workflow-runtime subgraph before an AI tool talks to it.\nimport { getPHStore } from \"@powerhousedao/reactor-browser\";\nimport { resolveDriveSwitchboard } from \"@powerhousedao/reactor-browser/ai\";\nimport {\n DEFAULT_RUNTIME_URL,\n setRuntimeUrl,\n} from \"../editors/workflow-editor/runtime-api.js\";\n\nconst warnedDrives = new Set<string>();\n\nexport function syncRuntimeUrl(): void {\n if (typeof window === \"undefined\") return;\n const driveId = getPHStore()?.selectedDriveId;\n const switchboard = resolveDriveSwitchboard(driveId);\n // No resolvable switchboard (no selection, or a local/unsynced drive):\n // reset to the default rather than leaving a prior drive's URL attached.\n if (!switchboard && driveId && !warnedDrives.has(driveId)) {\n // A Workflows drive has to be attached as a REMOTE of the switchboard\n // that runs the workflow runtime; a local copy renders the studio against\n // whatever answers at the default URL.\n warnedDrives.add(driveId);\n console.warn(\n `[workflow] Drive \"${driveId}\" is not synced from a switchboard, so Workflow Studio falls back to ${DEFAULT_RUNTIME_URL}. ` +\n \"Attach the switchboard's Workflows drive (its /d/<slug> URL) instead of a local drive.\",\n );\n }\n setRuntimeUrl(\n switchboard\n ? `${switchboard.graphqlUrl}/workflow-runtime`\n : DEFAULT_RUNTIME_URL,\n );\n}\n","// AI tool descriptors for authoring and running workflows: the pinned blocks\n// a piece offers, a block's config props, the built-in core blocks with\n// the expression syntax, run history and manual firing. Complements the\n// connector/connection tools in tools.ts, which cover the catalog and auth.\nimport type { PhAiToolDescriptor } from \"@powerhousedao/shared/document-model\";\nimport { z } from \"zod\";\nimport {\n fetchPieceActions,\n fetchPieceTriggers,\n fetchRuns,\n fireWorkflow,\n getBlockForm,\n} from \"../editors/workflow-editor/runtime-api.js\";\nimport type { BlockFormProp } from \"../editors/workflow-editor/ui/forms.js\";\nimport { REACTOR_CONNECTOR_ID } from \"../document-models/connection/v1/src/reactor-connection.js\";\nimport {\n CORE_PIECE,\n REACTOR_PIECE,\n type BlockRef,\n} from \"../editors/workflow-editor/ui/blocks.js\";\nimport { syncRuntimeUrl } from \"./runtime-url.js\";\nimport { flowPorts } from \"@powerhousedao/pieces-framework/workflow\";\n\nconst READ_ONLY = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n} as const;\n\nfunction kindOf(block: BlockRef): \"trigger\" | \"step\" {\n return block.kind === \"trigger\" ? \"trigger\" : \"step\";\n}\n\n// The fields ADD_STEP or SET_TRIGGER takes for the block.\nfunction blockFields(block: BlockRef) {\n return {\n pieceName: block.pieceName,\n pieceVersion: block.pieceVersion,\n ...(block.kind === \"trigger\"\n ? { triggerName: block.name }\n : { actionName: block.name }),\n };\n}\n\n// The onward ports the block's descriptor declares; \"error\" is a failure route.\nfunction portsFor(form: { ports?: readonly string[] }): string[] {\n return flowPorts(form.ports ?? []);\n}\n\nfunction describeProp(prop: BlockFormProp) {\n return {\n name: prop.name,\n label: prop.displayName,\n type: prop.type,\n required: prop.required,\n ...(prop.description ? { description: prop.description } : {}),\n ...(prop.defaultValue !== undefined ? { default: prop.defaultValue } : {}),\n ...(prop.staticOptions\n ? { options: prop.staticOptions.map((option) => option.value) }\n : {}),\n ...(prop.hasDynamicResolver ? { dynamicOptions: true } : {}),\n };\n}\n\nconst EXPRESSIONS = [\n \"Step configs and edge conditions may contain expressions in double braces.\",\n \"{{trigger.payload.<field>}} reads the trigger payload: for the core manual trigger the payload passed to fireWorkflow; for the reactor piece's document triggers it carries documentId, documentType, driveId and name.\",\n \"{{steps.<key>.output.<path>}} reads an upstream step's output by that step's key, e.g. {{steps.fetch.output.body.title}}.\",\n \"The reactor piece's document-create and document-dispatch output a reference { documentId, documentType, branch, revision }, e.g. {{steps.create.output.documentId}}; read the document with document-get to use its state. document-get outputs the document as { header, state }, e.g. {{steps.get.output.state.global.name}} or {{steps.get.output.header.id}}. document-find outputs { results, nextCursor }: each result has a header (and state with includeState), and nextCursor, present while more match, goes in a later find's cursor.\",\n \"{{variables.<key>}} reads a workflow variable.\",\n \"'a' || 'b' picks the first non-empty value, e.g. {{trigger.payload.url || 'https://example.com'}}.\",\n \"A whole-string expression yields the raw value; text around expressions is interpolated.\",\n];\n\nconst GRAPH_RULES = [\n \"A workflow is a powerhouse/workflow document. Build it with SET_TRIGGER once, ADD_STEP per step (each with a unique id and key), and ADD_EDGE from the trigger id to the first step and between steps.\",\n \"An edge must leave on a port its source declares (getWorkflowBlockConfig lists them): 'next' for the trigger and ordinary steps, 'true' and 'false' for the core branch action, 'error' to route a failure. An edge on any other port is never taken, and the run is flagged with a warning.\",\n \"A step names its block with pieceName, pieceVersion and actionName; the trigger with pieceName, pieceVersion and triggerName. pieceVersion is an exact semver: copy the fields getWorkflowPieceBlocks or listWorkflowCoreBlocks return.\",\n `The built-in blocks (manual, schedule and webhook triggers, branch and assert) belong to the piece ${CORE_PIECE}.`,\n \"Steps whose piece needs a connection must set connectionId to a powerhouse/connection document id (see getConnections).\",\n `Every step and trigger whose block reports requireReactor (getWorkflowBlockConfig) must set reactorConnectionId to a powerhouse/connection document with authType REACTOR and connectorId ${REACTOR_CONNECTOR_ID} (see getConnections); the ${REACTOR_PIECE} blocks all do. Without one the block gets no reactor access and fails. The connection's config { endpoint: \"local\", access?: \"read\", filter?: { documentType?, documentId?, driveId?, actionType? } } limits which documents it reads and writes. connectionId stays for credentials; a document block normally needs none.`,\n \"Runs execute the published snapshot, not the draft. PUBLISH_WORKFLOW only snapshots the draft, so publish again after every edit that should run.\",\n \"Only ENABLED workflows get trigger instances and can be fired. PUBLISH_WORKFLOW does not enable: to turn a workflow on, dispatch SET_WORKFLOW_STATUS ENABLED after PUBLISH_WORKFLOW (the same batch works). SET_WORKFLOW_STATUS ENABLED is refused until the workflow has been published once.\",\n];\n\nexport const getWorkflowPieceBlocksTool: PhAiToolDescriptor = {\n name: \"getWorkflowPieceBlocks\",\n description:\n \"Lists the actions and triggers of one piece, each with the pieceName, pieceVersion and actionName or triggerName to use in ADD_STEP or SET_TRIGGER. Takes the piece package name from getConnectors. Call getWorkflowBlockConfig next for a block's config props.\",\n inputSchema: {\n packageName: z\n .string()\n .describe(\"Piece package name, e.g. @activepieces/piece-http.\"),\n },\n annotations: { title: \"Get Workflow Piece Blocks\", ...READ_ONLY },\n callback: async (args: { packageName: string }) => {\n syncRuntimeUrl();\n const [actions, triggers] = await Promise.all([\n fetchPieceActions(args.packageName),\n fetchPieceTriggers(args.packageName),\n ]);\n return {\n packageName: args.packageName,\n actions: actions.map((action) => ({\n pieceName: action.pieceName,\n pieceVersion: action.pieceVersion,\n actionName: action.name,\n displayName: action.displayName,\n description: action.description,\n })),\n triggers: triggers.map((trigger) => ({\n pieceName: trigger.pieceName,\n pieceVersion: trigger.pieceVersion,\n triggerName: trigger.name,\n displayName: trigger.displayName,\n description: trigger.description,\n strategy: trigger.strategy,\n })),\n };\n },\n};\n\nexport const getWorkflowBlockConfigTool: PhAiToolDescriptor = {\n name: \"getWorkflowBlockConfig\",\n description:\n \"Describes the config of one block (a core block or a piece's action or trigger): prop names, types, whether required, allowed options, the output ports, whether a connection is needed, and requireReactor (read | write) when it needs a reactor connection. Use it before writing a step or trigger config.\",\n inputSchema: {\n pieceName: z\n .string()\n .describe(\n `Piece package name, e.g. ${CORE_PIECE} or @activepieces/piece-http.`,\n ),\n pieceVersion: z.string().describe(\"Exact semver of the piece.\"),\n name: z\n .string()\n .describe(\"Action or trigger name, e.g. branch or send_request.\"),\n kind: z.enum([\"action\", \"trigger\"]).describe(\"action or trigger.\"),\n },\n annotations: { title: \"Get Workflow Block Config\", ...READ_ONLY },\n callback: async (args: BlockRef) => {\n const block: BlockRef = {\n pieceName: args.pieceName,\n pieceVersion: args.pieceVersion,\n name: args.name,\n kind: args.kind,\n };\n syncRuntimeUrl();\n const form = await getBlockForm(block);\n if (!form) {\n return {\n ...blockFields(block),\n error:\n \"Unknown block. Use getConnectors and getWorkflowPieceBlocks to find valid blocks (documents live in @powerhousedao/piece-reactor), or listWorkflowCoreBlocks for built-ins.\",\n };\n }\n return {\n ...blockFields(block),\n title: form.title,\n kind: kindOf(block),\n requiresConnection: form.auth === \"required\",\n // read | write: the block needs a reactorConnectionId granting this.\n requireReactor: form.requireReactor ?? null,\n props: form.props.map(describeProp),\n ports: portsFor(form),\n };\n },\n};\n\nexport const listWorkflowCoreBlocksTool: PhAiToolDescriptor = {\n name: \"listWorkflowCoreBlocks\",\n description: `Lists the built-in blocks of the ${CORE_PIECE} piece (manual, schedule and webhook triggers, branch and assert) with their pinned fields and config props, plus the expression syntax and the rules for building a powerhouse/workflow document. Documents are read and written by the @powerhousedao/piece-reactor blocks; list those with getWorkflowPieceBlocks.`,\n inputSchema: {},\n annotations: { title: \"List Workflow Core Blocks\", ...READ_ONLY },\n callback: async () => {\n syncRuntimeUrl();\n // The reactor serves the core piece's descriptors, as it does any piece's.\n const [actions, triggers] = await Promise.all([\n fetchPieceActions(CORE_PIECE),\n fetchPieceTriggers(CORE_PIECE),\n ]);\n const blocks: BlockRef[] = [\n ...triggers.map((entry) => ({ ...entry, kind: \"trigger\" as const })),\n ...actions.map((entry) => ({ ...entry, kind: \"action\" as const })),\n ].map((entry) => ({\n pieceName: entry.pieceName,\n pieceVersion: entry.pieceVersion,\n name: entry.name,\n kind: entry.kind,\n }));\n const forms = await Promise.all(blocks.map(getBlockForm));\n return {\n blocks: blocks.flatMap((block, index) => {\n const form = forms[index];\n if (!form) return [];\n return [\n {\n ...blockFields(block),\n title: form.title,\n kind: kindOf(block),\n props: form.props.map(describeProp),\n ports: portsFor(form),\n },\n ];\n }),\n expressions: EXPRESSIONS,\n rules: GRAPH_RULES,\n };\n },\n};\n\nexport const listWorkflowRunsTool: PhAiToolDescriptor = {\n name: \"listWorkflowRuns\",\n description:\n \"Lists recent workflow runs, newest first, with status, error and each step's outcome. Filter by workflowId to inspect one workflow, or by driveId for every workflow in a drive.\",\n inputSchema: {\n workflowId: z\n .string()\n .optional()\n .describe(\"Workflow document id to filter by.\"),\n driveId: z\n .string()\n .optional()\n .describe(\"Drive id to filter by (all workflows in that drive).\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe(\"Maximum runs to return (default 10).\"),\n },\n annotations: { title: \"List Workflow Runs\", ...READ_ONLY },\n callback: async (args: {\n workflowId?: string;\n driveId?: string;\n limit?: number;\n }) => {\n syncRuntimeUrl();\n const runs = await fetchRuns({\n workflowId: args.workflowId,\n driveId: args.driveId,\n limit: args.limit ?? 10,\n });\n return {\n runs: runs.map((run) => ({\n id: run.id,\n workflowId: run.workflowId,\n workflowName: run.workflowName,\n status: run.status,\n error: run.error,\n triggerKind: run.triggerKind,\n startedAt: run.startedAt,\n endedAt: run.endedAt,\n steps: run.steps.map((step) => ({\n key: step.stepKey,\n status: step.status,\n error: step.error,\n })),\n })),\n };\n },\n};\n\nexport const fireWorkflowTool: PhAiToolDescriptor = {\n name: \"fireWorkflow\",\n description:\n \"Fires an ENABLED workflow whose trigger is the core manual trigger and runs its published snapshot to completion. The payload becomes {{trigger.payload}}. Returns the run id and final status.\",\n inputSchema: {\n workflowId: z.string().describe(\"Workflow document id.\"),\n payload: z\n .record(z.string(), z.unknown())\n .optional()\n .describe(\"Trigger payload object.\"),\n },\n annotations: {\n title: \"Fire Workflow\",\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: false,\n },\n callback: (args: {\n workflowId: string;\n payload?: Record<string, unknown>;\n }) => {\n syncRuntimeUrl();\n return fireWorkflow(args.workflowId, args.payload ?? {});\n },\n};\n\n/** Workflow authoring and run tools, merged into `aiTools` in tools.ts. */\nexport const workflowTools: PhAiToolDescriptor[] = [\n getWorkflowPieceBlocksTool,\n getWorkflowBlockConfigTool,\n listWorkflowCoreBlocksTool,\n listWorkflowRunsTool,\n fireWorkflowTool,\n];\n","// Read-only AI tool descriptors for the Connect assistant: the project's\n// piece catalog, connection documents, and connection health. The `aiTools`\n// export is how the host app discovers this package's tools (the line in the\n// project index is synced by `ph generate`).\nimport { getPHStore } from \"@powerhousedao/reactor-browser\";\nimport type { PhAiToolDescriptor } from \"@powerhousedao/shared/document-model\";\nimport { z } from \"zod\";\nimport {\n connectorIdForPiece,\n isConfigValueMissing,\n packageFromConnectorId,\n planFromAuth,\n type AuthField,\n} from \"../editors/connection-editor/piece-auth.js\";\nimport {\n checkConnection as runConnectionCheck,\n fetchConnections,\n fetchPieceActions,\n fetchPieceCatalog,\n fetchPieceTriggers,\n searchPieces,\n type PieceSummary,\n} from \"../editors/workflow-editor/runtime-api.js\";\nimport { syncRuntimeUrl } from \"./runtime-url.js\";\nimport { workflowTools } from \"./workflow-tools.js\";\n\nconst MAX_CONNECTORS = 20;\n\nexport interface ConnectorField {\n name: string;\n label: string;\n required: boolean;\n description?: string;\n secret: boolean;\n}\n\nexport interface ConnectorDetail {\n connectorId: string;\n pieceName: string;\n displayName: string;\n description: string;\n version: string;\n authType: string;\n /** False for auth kinds the runtime cannot execute yet (OIDC). */\n supported: boolean;\n /** OAUTH2: a person finishes it by signing in from the connection editor. */\n signIn?: \"oauth2\";\n fields: ConnectorField[];\n actions: string[];\n triggers: string[];\n}\n\nfunction toField(field: AuthField, secret: boolean): ConnectorField {\n return {\n name: field.name,\n label: field.displayName,\n required: field.required,\n description: field.description,\n secret,\n };\n}\n\nasync function connectorDetail(piece: PieceSummary): Promise<ConnectorDetail> {\n const plan = planFromAuth(piece.auth);\n const [actions, triggers] = await Promise.all([\n fetchPieceActions(piece.name),\n fetchPieceTriggers(piece.name),\n ]);\n return {\n connectorId: connectorIdForPiece(piece.name),\n pieceName: piece.name,\n displayName: piece.displayName,\n description: piece.description,\n version: piece.version,\n authType: plan.authType,\n supported: plan.supported,\n ...(plan.oauth2 ? { signIn: \"oauth2\" as const } : {}),\n fields: [\n ...plan.configFields.map((field) => toField(field, false)),\n ...plan.secretFields.map((field) => toField(field, true)),\n ],\n actions: actions.map((action) => action.name),\n triggers: triggers.map((trigger) => trigger.name),\n };\n}\n\n// Pieces the runtime's search ranks for the query, actions' and triggers'\n// rankings interleaved; null while its index builds, where it has none, or\n// when it ranks nothing (a package name, say).\nasync function rankedPieces(\n catalog: PieceSummary[],\n query: string,\n): Promise<PieceSummary[] | null> {\n let results;\n try {\n results = await Promise.all(\n ([\"action\", \"trigger\"] as const).map((kind) =>\n searchPieces(query, { kind, limit: 50 }),\n ),\n );\n } catch {\n return null;\n }\n if (results.some((result) => result.status !== \"ready\")) return null;\n const byName = new Map(catalog.map((piece) => [piece.name, piece]));\n const ranked = new Map<string, PieceSummary>();\n const longest = Math.max(...results.map((result) => result.pieces.length));\n for (let rank = 0; rank < longest; rank++) {\n for (const result of results) {\n const name = result.pieces.at(rank)?.pieceName;\n const piece = name === undefined ? undefined : byName.get(name);\n if (piece && !ranked.has(piece.name)) ranked.set(piece.name, piece);\n }\n }\n return ranked.size > 0 ? [...ranked.values()] : null;\n}\n\n/**\n * Stage one of connector discovery: the catalog, optionally narrowed by the\n * runtime's piece search (a substring match while its index builds), capped\n * at {@link MAX_CONNECTORS}. Full auth/action/trigger detail is fetched only\n * for the surviving entries (stage two).\n */\nexport async function getConnectors(query?: string): Promise<{\n total: number;\n matches: number;\n truncated: boolean;\n connectors: ConnectorDetail[];\n}> {\n syncRuntimeUrl();\n const catalog = await fetchPieceCatalog();\n const needle = query?.trim().toLowerCase();\n // A package name is an answer, not a search.\n const exact = catalog.filter((piece) => piece.name.toLowerCase() === needle);\n const matches = !needle\n ? [...catalog]\n : exact.length > 0\n ? exact\n : ((await rankedPieces(catalog, needle)) ??\n catalog.filter((piece) =>\n [piece.name, piece.displayName, piece.description].some((field) =>\n field.toLowerCase().includes(needle),\n ),\n ));\n const page = matches.slice(0, MAX_CONNECTORS);\n const connectors = await Promise.all(page.map(connectorDetail));\n return {\n total: catalog.length,\n matches: matches.length,\n truncated: matches.length > page.length,\n connectors,\n };\n}\n\ninterface ConnectionState {\n config?: unknown;\n secretRefs?: { name: string }[];\n}\n\nexport interface ConnectionDetail {\n id: string;\n name: string;\n connectorId: string;\n authType: string;\n status: string;\n accountLabel: string | null;\n /** Required secret fields with no stored ref, by auth property name. */\n missingSecrets: string[];\n /** Required config fields with no value, by auth property name. */\n missingConfig: string[];\n}\n\n/**\n * Every connection document with its credential state compared against the\n * piece's auth plan. Only field names and opaque refs are surfaced; secret\n * values never do.\n */\nexport async function getConnections(): Promise<{\n connections: ConnectionDetail[];\n}> {\n syncRuntimeUrl();\n const [catalog, summaries] = await Promise.all([\n fetchPieceCatalog(),\n fetchConnections(),\n ]);\n const client = getPHStore()?.reactorClient;\n const connections = await Promise.all(\n summaries.map(async (summary) => {\n const piece = catalog.find(\n (entry) => entry.name === packageFromConnectorId(summary.connectorId),\n );\n const plan = planFromAuth(piece?.auth ?? null);\n let state: ConnectionState | undefined;\n if (client) {\n try {\n const document = await client.get(summary.id);\n state = (document.state as { global?: ConnectionState }).global;\n } catch {\n state = undefined;\n }\n }\n const refNames = new Set(\n (state?.secretRefs ?? []).map((ref) => ref.name),\n );\n const config = (state?.config ?? {}) as Record<string, unknown>;\n return {\n id: summary.id,\n name: summary.name,\n connectorId: summary.connectorId,\n authType: summary.authType,\n status: summary.status,\n accountLabel: summary.accountLabel,\n missingSecrets: plan.secretFields\n .filter((field) => field.required && !refNames.has(field.name))\n .map((field) => field.name),\n missingConfig: plan.configFields\n .filter(\n (field) =>\n field.required && isConfigValueMissing(config[field.name]),\n )\n .map((field) => field.name),\n };\n }),\n );\n return { connections };\n}\n\nconst READ_ONLY = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n} as const;\n\nexport const getConnectorsTool: PhAiToolDescriptor = {\n name: \"getConnectors\",\n description:\n 'Lists the connectors (pieces) available to the workflow runtime with their auth fields, actions, and triggers. Without a query it returns up to 20 connectors; pass `query` to search, best match first: words can name the piece or what it does (e.g. \"slack send message\"), in any order, and small typos are tolerated. Secret fields are listed by name only, never by value.',\n inputSchema: { query: z.string().optional() },\n annotations: { title: \"Get Connectors\", ...READ_ONLY },\n callback: (args: { query?: string }) => getConnectors(args.query),\n};\n\nexport const getConnectionsTool: PhAiToolDescriptor = {\n name: \"getConnections\",\n description:\n \"Lists the project's connection documents with their credential status: which required secrets and config values are still missing, and the last account label. Secret values are never included. A connection with authType REACTOR is bound through a step's or trigger's reactorConnectionId, never connectionId.\",\n inputSchema: {},\n annotations: { title: \"Get Connections\", ...READ_ONLY },\n callback: () => getConnections(),\n};\n\nexport const checkConnectionTool: PhAiToolDescriptor = {\n name: \"checkConnection\",\n description:\n \"Runs a connection's own check against its stored credentials to verify they work. Takes a connection id (from getConnections) and reports success, the failure detail, and the account label when the provider returns one.\",\n inputSchema: { connectionId: z.string() },\n annotations: { title: \"Check Connection\", ...READ_ONLY },\n callback: (args: { connectionId: string }) => {\n syncRuntimeUrl();\n return runConnectionCheck(args.connectionId);\n },\n};\n\n/** Tool descriptors the host app offers the AI assistant. */\nexport const aiTools: PhAiToolDescriptor[] = [\n getConnectorsTool,\n getConnectionsTool,\n checkConnectionTool,\n ...workflowTools,\n];\n","import { Connection as ConnectionV1 } from \"document-models/connection/v1\";\nimport { Workflow as WorkflowV1 } from \"document-models/workflow/v1\";\n\n/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\n\nexport const documentModels = [ConnectionV1, WorkflowV1] as const;\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { EditorModule } from \"document-model\";\nimport { ConnectionEditor } from \"./connection-editor/module.js\";\nimport { WorkflowEditor } from \"./workflow-editor/module.js\";\nimport { WorkflowStudio } from \"./workflow-studio/module.js\";\n\nexport const editors: EditorModule[] = [\n ConnectionEditor,\n WorkflowEditor,\n WorkflowStudio,\n];\n","import type { Manifest } from \"document-model\";\nimport manifestJson from \"./powerhouse.manifest.json\" with { type: \"json\" };\n\nexport { aiTools } from \"./ai/tools.js\";\nexport { documentModels } from \"./document-models/document-models.js\";\nexport { upgradeManifests } from \"./document-models/upgrade-manifests.js\";\nexport { editors } from \"./editors/editors.js\";\nexport const manifest = manifestJson as Manifest;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACkBA,IAAI,UAAyB,oBAAoB,mBAAmB;AAEpE,MAAM,iBAAiB,yBAAyB;AAEhD,SAAgB,cAAc,KAAmB;CAC/C,IAAI,QAAQ,QAAQ,KAAK,UAAU,oBAAoB,GAAG;AAC5D;AAEA,MAAa,gBAAgB,UAC3B,eAAe,WAAW,eAAe,SAAS,KAAK,CAAC;AAC1D,MAAa,0BACX,eAAe,WAAW,aAAa,OAAO,CAAC;AACjD,MAAa,qBAAqB,gBAChC,QAAQ,kBAAkB,WAAW;AACvC,MAAa,sBAAsB,gBACjC,QAAQ,mBAAmB,WAAW;AACxC,MAAa,gBACX,OACA,WACG,QAAQ,aAAa,OAAO,MAAM;AACvC,MAAa,yBAAyB,QAAQ,iBAAiB;AAC/D,MAAa,mBAAmB,iBAC9B,QAAQ,gBAAgB,YAAY;AACtC,MAAa,aAAa,UAAsB,QAAQ,UAAU,KAAK;AACvE,MAAa,gBAAgB,YAAoB,YAC/C,QAAQ,aAAa,YAAY,OAAO;;;AClC1C,MAAM,+BAAe,IAAI,IAAY;AAErC,SAAgB,iBAAuB;CACrC,IAAI,OAAO,WAAW,aAAa;CACnC,MAAM,UAAU,WAAW,CAAC,EAAE;CAC9B,MAAM,cAAc,wBAAwB,OAAO;CAGnD,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time-BMI-E3GI.mjs";
1
+ import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.mjs";
2
2
  import { r as isExactVersion } from "./block-type-kX-27vVt.mjs";
3
3
  import * as z$1 from "zod";
4
4
  import { z } from "zod";
@@ -1754,4 +1754,4 @@ const Workflow = {
1754
1754
  //#endregion
1755
1755
  export { AddStepRetryPolicyInputSchema as $, setTriggerConfig as A, SetWorkflowStatusInputSchema as At, setLastTest as B, WorkflowStatusSchema as Bt, setWorkflowStatus as C, SetTriggerConnectionInputSchema as Ct, clearTrigger as D, SetVariableInputSchema as Dt, setVariable as E, SetTriggerPropertySettingInputSchema as Et, removeStep as F, UpdateStepRetryPolicyInputSchema as Ft, setPolicy as G, publishWorkflow as H, WorkflowVariableSchema as Ht, setStepConfig as I, VariableTypeSchema as It, removeEdge as J, addEdge as K, updateStep as L, WorkflowEdgeSchema as Lt, setTriggerPieceVersion as M, TriggerBindingSchema as Mt, addStep as N, UpdateStepInputSchema as Nt, creators_exports$2 as O, SetWorkflowDescriptionInputSchema as Ot, creators_exports$3 as P, UpdateStepPositionInputSchema as Pt, AddStepPropertySettingInputSchema as Q, creators_exports$4 as R, WorkflowPolicySchema as Rt, setWorkflowName as S, SetTriggerConfigPropertySettingInputSchema as St, removeVariable as T, SetTriggerPieceVersionInputSchema as Tt, revertToPublished as U, definedNonNullAnySchema as Ut, creators_exports$5 as V, WorkflowStepSchema as Vt, creators_exports$6 as W, isDefinedNonNullAny as Wt, AddStepInputSchema as X, AddEdgeInputSchema as Y, AddStepPositionInputSchema as Z, reducer as _, SetPolicyInputSchema as _t, utils$1 as a, PropertyModeSchema as at, creators_exports as b, SetStepConfigPropertySettingInputSchema as bt, WorkflowPHStateSchema as c, PublishedWorkflowSchema as ct, isWorkflowDocument as d, RemoveVariableInputSchema as dt, BackoffKindSchema as et, isWorkflowState as f, RetryPolicySchema as ft, supportedVersions as g, SetLastTestInputSchema as gt, latestVersion as h, SetLastRunInputSchema as ht, initialLocalState as i, PointSchema as it, setTriggerConnection as j, StepTestRecordSchema as jt, setTrigger as k, SetWorkflowNameInputSchema as kt, assertIsWorkflowDocument as l, RemoveEdgeInputSchema as lt, workflowUpgradeManifest as m, RunStatusSchema as mt, utils as n, ConcurrencyModeSchema as nt, WorkflowDocumentHeaderSchema as o, PropertySettingSchema as ot, workflowDocumentType as p, RevertToPublishedInputSchema as pt, creators_exports$7 as q, initialGlobalState as r, FailureModeSchema as rt, WorkflowDocumentSchema as s, PublishWorkflowInputSchema as st, Workflow as t, ClearTriggerInputSchema as tt, assertIsWorkflowState as u, RemoveStepInputSchema as ut, documentModel as v, SetPolicyRetryPolicyInputSchema as vt, creators_exports$1 as w, SetTriggerInputSchema as wt, setWorkflowDescription as x, SetTriggerConfigInputSchema as xt, actions as y, SetStepConfigInputSchema as yt, setLastRun as z, WorkflowStateSchema as zt };
1756
1756
 
1757
- //# sourceMappingURL=module-DPg8IYIn.mjs.map
1757
+ //# sourceMappingURL=module-DV3LLvxo.mjs.map