@powerhousedao/workflow 6.2.3-dev.32 → 6.2.3-dev.34

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 (66) hide show
  1. package/README.md +17 -13
  2. package/dist/browser/{BlockSelector-BHJQOhie.js → BlockSelector-BQDqIbRZ.js} +4 -2
  3. package/dist/browser/BlockSelector-BQDqIbRZ.js.map +1 -0
  4. package/dist/browser/assets/{entry-DhaRsTID.js → entry-D62sYiFV.js} +2 -2
  5. package/dist/browser/assets/{projection-entry-qrF_MLsE.js → projection-entry-BGcu_9-p.js} +54 -6
  6. package/dist/browser/{connection-form-CaduwBiu.js → connection-form-BCxGD8Zk.js} +20 -21
  7. package/dist/browser/connection-form-BCxGD8Zk.js.map +1 -0
  8. package/dist/browser/{data-tree-8219PVfh.js → data-tree-CZZkfzSH.js} +2 -2
  9. package/dist/browser/{data-tree-8219PVfh.js.map → data-tree-CZZkfzSH.js.map} +1 -1
  10. package/dist/browser/{editor-CFcXlZY2.js → editor-BCH8vdej.js} +3 -3
  11. package/dist/browser/{editor-CFcXlZY2.js.map → editor-BCH8vdej.js.map} +1 -1
  12. package/dist/browser/{editor-C0C1eB0R.js → editor-Bd2Cu8Mx.js} +3 -3
  13. package/dist/browser/{editor-C0C1eB0R.js.map → editor-Bd2Cu8Mx.js.map} +1 -1
  14. package/dist/browser/{editor-BHV1MZS8.js → editor-Bl1Xp7N8.js} +26 -11
  15. package/dist/browser/editor-Bl1Xp7N8.js.map +1 -0
  16. package/dist/browser/editors/connection-editor/module.js +1 -1
  17. package/dist/browser/editors/workflow-editor/module.js +1 -1
  18. package/dist/browser/editors/workflow-studio/module.js +1 -1
  19. package/dist/browser/index.js +3 -2
  20. package/dist/browser/index.js.map +1 -1
  21. package/dist/browser/{trigger-text-BkcklsMX.js → trigger-text-Ld2uv0Cf.js} +4 -4
  22. package/dist/browser/{trigger-text-BkcklsMX.js.map → trigger-text-Ld2uv0Cf.js.map} +1 -1
  23. package/dist/node/{BlockSelector-lOcIiaqt.mjs → BlockSelector-C3XYZfPY.mjs} +4 -2
  24. package/dist/node/BlockSelector-C3XYZfPY.mjs.map +1 -0
  25. package/dist/node/{connection-form-DWt29kft.mjs → connection-form-CjUay_qz.mjs} +20 -21
  26. package/dist/node/connection-form-CjUay_qz.mjs.map +1 -0
  27. package/dist/node/{data-tree-Cdx85Y19.mjs → data-tree-CGfeCLr7.mjs} +2 -2
  28. package/dist/node/{data-tree-Cdx85Y19.mjs.map → data-tree-CGfeCLr7.mjs.map} +1 -1
  29. package/dist/node/{editor-D_t8OtZn.mjs → editor-BXtXOryt.mjs} +3 -3
  30. package/dist/node/{editor-D_t8OtZn.mjs.map → editor-BXtXOryt.mjs.map} +1 -1
  31. package/dist/node/{editor-CR823u-y.mjs → editor-CXGHkwd9.mjs} +3 -3
  32. package/dist/node/{editor-CR823u-y.mjs.map → editor-CXGHkwd9.mjs.map} +1 -1
  33. package/dist/node/{editor-CwX-G2Jv.mjs → editor-D0FCvyPb.mjs} +26 -11
  34. package/dist/node/editor-D0FCvyPb.mjs.map +1 -0
  35. package/dist/node/editors/connection-editor/module.mjs +1 -1
  36. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  37. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  38. package/dist/node/index.mjs +3 -2
  39. package/dist/node/index.mjs.map +1 -1
  40. package/dist/node/pieces/reactor/descriptor.json +1 -1
  41. package/dist/node/pieces/reactor/package.json +1 -1
  42. package/dist/node/{trigger-text-DJIAQBWg.mjs → trigger-text-CMWxL7t_.mjs} +4 -4
  43. package/dist/node/{trigger-text-DJIAQBWg.mjs.map → trigger-text-CMWxL7t_.mjs.map} +1 -1
  44. package/dist/powerhouse.manifest.json +1 -1
  45. package/dist/types/ai/workflow-tools.d.ts.map +1 -1
  46. package/dist/types/editors/shared/editor-chrome.d.ts.map +1 -1
  47. package/dist/types/editors/shared/undo-plan.d.ts +1 -1
  48. package/dist/types/editors/shared/undo-plan.d.ts.map +1 -1
  49. package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
  50. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
  51. package/dist/types/editors/workflow-editor/undo-policy.d.ts +3 -0
  52. package/dist/types/editors/workflow-editor/undo-policy.d.ts.map +1 -0
  53. package/dist/types/editors/workflow-editor/undo-policy.test.d.ts +2 -0
  54. package/dist/types/editors/workflow-editor/undo-policy.test.d.ts.map +1 -0
  55. package/dist/types/scripts/ui-stack.d.ts +62 -1
  56. package/dist/types/scripts/ui-stack.d.ts.map +1 -1
  57. package/dist/types/test/ui/fixtures.d.ts +6 -2
  58. package/dist/types/test/ui/fixtures.d.ts.map +1 -1
  59. package/dist/types/test/ui/global-setup.d.ts.map +1 -1
  60. package/package.json +8 -8
  61. package/dist/browser/BlockSelector-BHJQOhie.js.map +0 -1
  62. package/dist/browser/connection-form-CaduwBiu.js.map +0 -1
  63. package/dist/browser/editor-BHV1MZS8.js.map +0 -1
  64. package/dist/node/BlockSelector-lOcIiaqt.mjs.map +0 -1
  65. package/dist/node/connection-form-DWt29kft.mjs.map +0 -1
  66. package/dist/node/editor-CwX-G2Jv.mjs.map +0 -1
@@ -2,7 +2,7 @@ import { lazy } from "react";
2
2
  //#region editors/connection-editor/module.ts
3
3
  /** Document editor module for the "powerhouse/connection" document type */
4
4
  const ConnectionEditor = {
5
- Component: lazy(() => import("../../editor-D_t8OtZn.mjs")),
5
+ Component: lazy(() => import("../../editor-BXtXOryt.mjs")),
6
6
  documentTypes: ["powerhouse/connection"],
7
7
  config: {
8
8
  id: "connection-editor",
@@ -2,7 +2,7 @@ import { lazy } from "react";
2
2
  //#region editors/workflow-editor/module.ts
3
3
  /** Document editor module for the "powerhouse/workflow" document type */
4
4
  const WorkflowEditor = {
5
- Component: lazy(() => import("../../editor-CwX-G2Jv.mjs")),
5
+ Component: lazy(() => import("../../editor-D0FCvyPb.mjs")),
6
6
  documentTypes: ["powerhouse/workflow"],
7
7
  config: {
8
8
  id: "workflow-editor",
@@ -2,7 +2,7 @@ import { lazy } from "react";
2
2
  //#region editors/workflow-studio/module.ts
3
3
  /** Document editor module for the "powerhouse/document-drive" document type */
4
4
  const WorkflowStudio = {
5
- Component: lazy(() => import("../../editor-CR823u-y.mjs")),
5
+ Component: lazy(() => import("../../editor-CXGHkwd9.mjs")),
6
6
  documentTypes: ["powerhouse/document-drive"],
7
7
  config: {
8
8
  id: "workflow-studio",
@@ -167,7 +167,8 @@ const GRAPH_RULES = [
167
167
  "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.",
168
168
  `The built-in blocks (manual, schedule and webhook triggers, branch and assert) belong to the piece ${CORE_PIECE}.`,
169
169
  "Steps whose piece needs a connection must set connectionId to a powerhouse/connection document id (see getConnections).",
170
- "Only ENABLED workflows get trigger instances and can be fired. PUBLISH_WORKFLOW snapshots the draft and enables it; SET_WORKFLOW_STATUS ENABLED is refused until the workflow has been published once."
170
+ "Runs execute the published snapshot, not the draft. PUBLISH_WORKFLOW only snapshots the draft, so publish again after every edit that should run.",
171
+ "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."
171
172
  ];
172
173
  /** Workflow authoring and run tools, merged into `aiTools` in tools.ts. */
173
174
  const workflowTools = [
@@ -316,7 +317,7 @@ const workflowTools = [
316
317
  },
317
318
  {
318
319
  name: "fireWorkflow",
319
- description: "Fires an ENABLED workflow whose trigger is the core manual trigger and runs it to completion. The payload becomes {{trigger.payload}}. Returns the run id and final status.",
320
+ description: "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.",
320
321
  inputSchema: {
321
322
  workflowId: z.string().describe("Workflow document id."),
322
323
  payload: z.record(z.string(), z.unknown()).optional().describe("Trigger payload object.")
@@ -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 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 { 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(window.ph?.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 {\n CORE_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 \"{{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 \"Only ENABLED workflows get trigger instances and can be fired. PUBLISH_WORKFLOW snapshots the draft and enables it; 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, and whether a connection is needed. 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 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 it 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 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 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/**\n * Stage one of connector discovery: the catalog, optionally narrowed to a\n * case-insensitive substring match on name, display name, or description,\n * capped at {@link MAX_CONNECTORS}. Full auth/action/trigger detail is\n * fetched only 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 const matches = needle\n ? catalog.filter((piece) =>\n [piece.name, piece.displayName, piece.description].some((field) =>\n field.toLowerCase().includes(needle),\n ),\n )\n : [...catalog];\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 =\n typeof window !== \"undefined\" ? window.ph?.reactorClient : undefined;\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 (Activepieces 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 by name or description. 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.\",\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,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;;;AC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C7C;CAOA;CACA,GAAG;AACL;;;;;;;ACjOA,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 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 { 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(window.ph?.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 {\n CORE_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 \"{{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 \"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, and whether a connection is needed. 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 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 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 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/**\n * Stage one of connector discovery: the catalog, optionally narrowed to a\n * case-insensitive substring match on name, display name, or description,\n * capped at {@link MAX_CONNECTORS}. Full auth/action/trigger detail is\n * fetched only 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 const matches = needle\n ? catalog.filter((piece) =>\n [piece.name, piece.displayName, piece.description].some((field) =>\n field.toLowerCase().includes(needle),\n ),\n )\n : [...catalog];\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 =\n typeof window !== \"undefined\" ? window.ph?.reactorClient : undefined;\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 (Activepieces 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 by name or description. 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.\",\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;AACx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AAgB,eAAe;CAkB/B;CACA;EAfA,MAAM;EACN,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;;;;;;;ACjOA,MAAa,iBAAiB,CAACC,YAAcC,QAAU;;;ACCvD,MAAa,UAA0B;CACrC;CACA;CACA;AACF;;;ACNA,MAAa,WAAWC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/piece-reactor",
3
- "version": "6.2.3-dev.32",
3
+ "version": "6.2.3-dev.34",
4
4
  "displayName": "Powerhouse Reactor",
5
5
  "logoUrl": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMTQgMTE0IiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE2MTYxNiIgZD0iTTcxLjI5MTkgMEwyNC4zNDE1IDM4Ljg3NzJDMTcuNDU0OCA0NC41Nzk4IDE2Ljk1MzkgNTQuOTY1OSAyMy4yNiA2MS4zMDQ3TDM5LjUwMjggNzcuNjMxOEM0NC4yNjg0IDgyLjQyMjEgNDUuMjk5NiA4OS43ODM0IDQyLjAzMzUgOTUuNjk4OEwzMS45MjkgMTE0SDE1LjJDNi44MDUyNyAxMTQgMCAxMDcuMTk1IDAgOTguOFYxNS4yQzAgNi44MDUyNyA2LjgwNTI3IDAgMTUuMiAwSDcxLjI5MTlaTTgwLjExMSAwTDcxLjM0MTIgMTUuOTc1OEM2OC4xMDc4IDIxLjg2NiA2OS4xMjU1IDI5LjE4MDQgNzMuODQ0MSAzMy45NjQxTDkxLjA3NTEgNTEuNDMzMUM5Ny4zNjc0IDU3LjgxMjQgOTYuODA0NCA2OC4yMjI3IDg5Ljg2MDcgNzMuODg2MUw0MC42NzgyIDExNEg5OC44QzEwNy4xOTUgMTE0IDExNCAxMDcuMTk1IDExNCA5OC44VjE1LjJDMTE0IDYuODA1MjcgMTA3LjE5NSAwIDk4LjggMEg4MC4xMTFaIi8+PC9zdmc+",
6
6
  "actions": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/piece-reactor",
3
- "version": "6.2.3-dev.32",
3
+ "version": "6.2.3-dev.34",
4
4
  "description": "Read and write Powerhouse documents on the reactor this workflow runs in: create documents, dispatch actions, read state and schemas, and fire on document events.",
5
5
  "type": "module",
6
6
  "main": "index.mjs",
@@ -1,7 +1,7 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-BMI-E3GI.mjs";
2
2
  import { J as SCHEDULE_TRIGGER, Z as WEBHOOK_TRIGGER, q as MANUAL_TRIGGER, ut as parseScheduleConfig } from "./runtime-queries-D5EGaCrH.mjs";
3
3
  import { Rt as blockKey } from "./module-Dhe5E-VA.mjs";
4
- import { At as Tooltip, B as blockMeta, bt as Button, kt as Toggle, wt as IconButton } from "./BlockSelector-lOcIiaqt.mjs";
4
+ import { At as Tooltip, B as blockMeta, bt as Button, kt as Toggle, wt as IconButton } from "./BlockSelector-C3XYZfPY.mjs";
5
5
  import * as React$10 from "react";
6
6
  import { Suspense, lazy, useState } from "react";
7
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -6581,7 +6581,7 @@ function Modal(props) {
6581
6581
  }
6582
6582
  //#endregion
6583
6583
  //#region editors/shared/data-viewer.tsx
6584
- const DataTree = lazy(() => import("./data-tree-Cdx85Y19.mjs"));
6584
+ const DataTree = lazy(() => import("./data-tree-CGfeCLr7.mjs"));
6585
6585
  function stringify(value) {
6586
6586
  try {
6587
6587
  return JSON.stringify(value, null, 2) ?? "";
@@ -6760,6 +6760,6 @@ function describeTrigger(trigger) {
6760
6760
  }
6761
6761
  }
6762
6762
  //#endregion
6763
- export { Modal as a, PublishState as c, VARIABLES_VIEW as d, uniqueStepKey as f, DataViewer as i, StatusToggle as l, describeSchedule as n, DraftBanner as o, describeTrigger as r, PublishButton as s, describeCron as t, usePublish as u };
6763
+ export { Modal as a, PublishState as c, VARIABLES_VIEW as d, hasDraftChanges as f, DataViewer as i, StatusToggle as l, describeSchedule as n, DraftBanner as o, uniqueStepKey as p, describeTrigger as r, PublishButton as s, describeCron as t, usePublish as u };
6764
6764
 
6765
- //# sourceMappingURL=trigger-text-DJIAQBWg.mjs.map
6765
+ //# sourceMappingURL=trigger-text-CMWxL7t_.mjs.map