@powerhousedao/workflow 6.2.3-dev.20 → 6.2.3-dev.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,11 +22,11 @@ reactor piece that lets a workflow read and write documents.
22
22
 
23
23
  ## The three packages
24
24
 
25
- | Package | What it is |
26
- | --- | --- |
27
- | [`@powerhousedao/pieces-framework`](../pieces-framework) | The piece authoring API (Activepieces', vendored) plus `ctx.reactor`. |
28
- | `@powerhousedao/workflow` (this one) | Models, editors, assistant tools and the reactor piece. Loaded by Connect; its models are loaded by a reactor. |
29
- | `@powerhousedao/reactor-workflow` | The engine that runs a workflow: scheduler, executor, piece host, and the GraphQL surface. Arrives next. |
25
+ | Package | What it is |
26
+ | -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
27
+ | [`@powerhousedao/pieces-framework`](../pieces-framework) | The piece authoring API (Activepieces', vendored) plus `ctx.reactor`. |
28
+ | `@powerhousedao/workflow` (this one) | Models, editors, assistant tools and the reactor piece. Loaded by Connect; its models are loaded by a reactor. |
29
+ | `@powerhousedao/reactor-workflow` | The engine that runs a workflow: scheduler, executor, piece host, and the GraphQL surface. Arrives next. |
30
30
 
31
31
  This package deliberately depends on neither the engine nor
32
32
  `@powerhousedao/reactor-api`, so Connect can load it without pulling a server
@@ -45,6 +45,12 @@ flag on, the reactor registers this package's two document models, so
45
45
  workflows and connections can be created and synced. Running them is the
46
46
  engine's job and follows in `@powerhousedao/reactor-workflow`.
47
47
 
48
+ What that engine reads from the environment is declared under `config` in
49
+ [`powerhouse.manifest.json`](./powerhouse.manifest.json) — every entry prefixed
50
+ `PH_WORKFLOWS_`, each with its type, default and what it sets. The table in
51
+ [`@powerhousedao/reactor-workflow`'s README](../reactor-workflow/README.md#configuration)
52
+ explains them, including which ones a deployment should not leave unset.
53
+
48
54
  ## Developing
49
55
 
50
56
  ```sh
@@ -0,0 +1,98 @@
1
+ import { t as Connection } from "./module-12vI18HY.js";
2
+ import { t as Workflow } from "./module-CYQnNZWl.js";
3
+ //#region powerhouse.manifest.json
4
+ var powerhouse_manifest_default = {
5
+ name: "@powerhousedao/workflow",
6
+ description: "Workflows in Connect: the workflow and connection document models, their editors and Workflow Studio, and the reactor piece.",
7
+ category: "",
8
+ publisher: {
9
+ "name": "@powerhousedao",
10
+ "url": "https://github.com/powerhouse-inc/powerhouse/tree/main/packages/workflow"
11
+ },
12
+ documentModels: [{
13
+ "id": "powerhouse/workflow",
14
+ "name": "Workflow"
15
+ }, {
16
+ "id": "powerhouse/connection",
17
+ "name": "Connection"
18
+ }],
19
+ apps: [{
20
+ "id": "workflow-studio",
21
+ "name": "Workflow Studio",
22
+ "documentTypes": ["powerhouse/document-drive"]
23
+ }],
24
+ editors: [{
25
+ "id": "workflow-editor",
26
+ "name": "Workflow Editor",
27
+ "documentTypes": ["powerhouse/workflow"]
28
+ }, {
29
+ "id": "connection-editor",
30
+ "name": "Connection Editor",
31
+ "documentTypes": ["powerhouse/connection"]
32
+ }],
33
+ pieces: [{
34
+ "id": "@powerhousedao/piece-reactor",
35
+ "name": "Powerhouse Reactor"
36
+ }],
37
+ processors: [],
38
+ subgraphs: [],
39
+ config: [
40
+ {
41
+ "name": "PH_WORKFLOWS_SECRETS_MASTER_KEY",
42
+ "type": "secret",
43
+ "description": "64 hex chars (32 bytes) encrypting connection secrets at rest. Unset, a key is generated at ./.ph/secrets.key and reused; a host whose working directory does not survive a restart must set this or every stored secret becomes undecryptable."
44
+ },
45
+ {
46
+ "name": "PH_WORKFLOWS_EGRESS_ALLOW_ADDRESSES",
47
+ "type": "var",
48
+ "description": "Comma-separated addresses or CIDRs a piece may reach, widening the default policy that refuses private and loopback space. A bare address is taken as one host. Applies to steps and to design-time piece code alike."
49
+ },
50
+ {
51
+ "name": "PH_WORKFLOWS_RUN_CONCURRENCY",
52
+ "type": "var",
53
+ "description": "How many runs execute at once. Each slot is a forked node process, so this is the reactor's real connector concurrency.",
54
+ "default": "4"
55
+ },
56
+ {
57
+ "name": "PH_WORKFLOWS_RUN_QUEUE_DEPTH",
58
+ "type": "var",
59
+ "description": "How many runs may wait for a slot before new ones are refused. 0 waits without limit, turning saturation into latency rather than failures.",
60
+ "default": "0"
61
+ },
62
+ {
63
+ "name": "PH_WORKFLOWS_POLL_INTERVAL_MS",
64
+ "type": "var",
65
+ "description": "Cadence for a polling trigger that names none of its own. An author's override and a piece's requested schedule both win over it; a 1000ms floor applies to all three.",
66
+ "default": "60000"
67
+ },
68
+ {
69
+ "name": "PH_WORKFLOWS_WEBHOOK_RECONCILE_MS",
70
+ "type": "var",
71
+ "description": "How often a webhook trigger re-registers with its provider, so a registration the provider dropped comes back.",
72
+ "default": "900000"
73
+ },
74
+ {
75
+ "name": "PH_WORKFLOWS_WEBHOOK_TIMEOUT_MS",
76
+ "type": "var",
77
+ "description": "How long a sync-mode delivery holds the provider's socket. Past it the run continues and the provider is told so, lest a wedged step tie up connections.",
78
+ "default": "30000"
79
+ },
80
+ {
81
+ "name": "PH_WORKFLOWS_PIECE_MAX_FILE_BYTES",
82
+ "type": "var",
83
+ "description": "File-size ceiling for both directions: a FILE property hydrated from a URL, data URI or attachment ref, and ctx.files.write.",
84
+ "default": "8388608"
85
+ }
86
+ ]
87
+ };
88
+ //#endregion
89
+ //#region document-models/document-models.ts
90
+ /**
91
+ * WARNING: DO NOT EDIT
92
+ * This file is auto-generated and updated by codegen
93
+ */
94
+ const documentModels = [Connection, Workflow];
95
+ //#endregion
96
+ export { powerhouse_manifest_default as n, documentModels as t };
97
+
98
+ //# sourceMappingURL=document-models-BYheX-te.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"document-models-vmNTCrKx.js","names":["ConnectionV1","WorkflowV1"],"sources":["../../powerhouse.manifest.json","../../document-models/document-models.ts"],"sourcesContent":["","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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACQA,MAAa,iBAAiB,CAACA,YAAcC,SAAW"}
1
+ {"version":3,"file":"document-models-BYheX-te.js","names":["ConnectionV1","WorkflowV1"],"sources":["../../powerhouse.manifest.json","../../document-models/document-models.ts"],"sourcesContent":["","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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACQA,MAAa,iBAAiB,CAACA,YAAcC,SAAW"}
@@ -1,4 +1,4 @@
1
- import { n as powerhouse_manifest_default, t as documentModels } from "./document-models-vmNTCrKx.js";
1
+ import { n as powerhouse_manifest_default, t as documentModels } from "./document-models-BYheX-te.js";
2
2
  import { C as connectorIdForPiece, D as planFromAuth, E as packageFromConnectorId, T as isConfigValueMissing, a as fetchConnections, c as fetchPieceTriggers, f as fireWorkflow, l as fetchRuns, n as checkConnection, o as fetchPieceActions, p as getBlockForm, s as fetchPieceCatalog, t as DEFAULT_RUNTIME_URL, x as CORE_FORMS, y as setRuntimeUrl } from "./runtime-api-DQa04P3e.js";
3
3
  import { t as upgradeManifests } from "./upgrade-manifests-Cnpfo6kC.js";
4
4
  import { ConnectionEditor } from "./editors/connection-editor/module.js";
@@ -1,4 +1,4 @@
1
- import { n as powerhouse_manifest_default, t as documentModels } from "../document-models-vmNTCrKx.js";
1
+ import { n as powerhouse_manifest_default, t as documentModels } from "../document-models-BYheX-te.js";
2
2
  import { t as upgradeManifests } from "../upgrade-manifests-Cnpfo6kC.js";
3
3
  //#region reactor/index.ts
4
4
  const manifest = powerhouse_manifest_default;
@@ -43,7 +43,54 @@ var powerhouse_manifest_default = {
43
43
  }],
44
44
  processors: [],
45
45
  subgraphs: [],
46
- config: []
46
+ config: [
47
+ {
48
+ "name": "PH_WORKFLOWS_SECRETS_MASTER_KEY",
49
+ "type": "secret",
50
+ "description": "64 hex chars (32 bytes) encrypting connection secrets at rest. Unset, a key is generated at ./.ph/secrets.key and reused; a host whose working directory does not survive a restart must set this or every stored secret becomes undecryptable."
51
+ },
52
+ {
53
+ "name": "PH_WORKFLOWS_EGRESS_ALLOW_ADDRESSES",
54
+ "type": "var",
55
+ "description": "Comma-separated addresses or CIDRs a piece may reach, widening the default policy that refuses private and loopback space. A bare address is taken as one host. Applies to steps and to design-time piece code alike."
56
+ },
57
+ {
58
+ "name": "PH_WORKFLOWS_RUN_CONCURRENCY",
59
+ "type": "var",
60
+ "description": "How many runs execute at once. Each slot is a forked node process, so this is the reactor's real connector concurrency.",
61
+ "default": "4"
62
+ },
63
+ {
64
+ "name": "PH_WORKFLOWS_RUN_QUEUE_DEPTH",
65
+ "type": "var",
66
+ "description": "How many runs may wait for a slot before new ones are refused. 0 waits without limit, turning saturation into latency rather than failures.",
67
+ "default": "0"
68
+ },
69
+ {
70
+ "name": "PH_WORKFLOWS_POLL_INTERVAL_MS",
71
+ "type": "var",
72
+ "description": "Cadence for a polling trigger that names none of its own. An author's override and a piece's requested schedule both win over it; a 1000ms floor applies to all three.",
73
+ "default": "60000"
74
+ },
75
+ {
76
+ "name": "PH_WORKFLOWS_WEBHOOK_RECONCILE_MS",
77
+ "type": "var",
78
+ "description": "How often a webhook trigger re-registers with its provider, so a registration the provider dropped comes back.",
79
+ "default": "900000"
80
+ },
81
+ {
82
+ "name": "PH_WORKFLOWS_WEBHOOK_TIMEOUT_MS",
83
+ "type": "var",
84
+ "description": "How long a sync-mode delivery holds the provider's socket. Past it the run continues and the provider is told so, lest a wedged step tie up connections.",
85
+ "default": "30000"
86
+ },
87
+ {
88
+ "name": "PH_WORKFLOWS_PIECE_MAX_FILE_BYTES",
89
+ "type": "var",
90
+ "description": "File-size ceiling for both directions: a FILE property hydrated from a URL, data URI or attachment ref, and ctx.files.write.",
91
+ "default": "8388608"
92
+ }
93
+ ]
47
94
  };
48
95
  //#endregion
49
96
  //#region ai/runtime-url.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["READ_ONLY","runConnectionCheck","ConnectionV1","WorkflowV1","manifestJson"],"sources":["../../powerhouse.manifest.json","../../ai/runtime-url.ts","../../ai/workflow-tools.ts","../../ai/tools.ts","../../document-models/document-models.ts","../../editors/editors.ts","../../index.ts"],"sourcesContent":["","// 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 exact block\n// types 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 {\n CORE_FORMS,\n type BlockFormProp,\n} from \"../editors/workflow-editor/ui/forms.js\";\nimport { syncRuntimeUrl } from \"./runtime-url.js\";\n\nconst READ_ONLY = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n} as const;\n\n// Core blocks that are triggers. A piece's trigger says so in its own block\n// type, which is how every document trigger is classified now.\nconst CORE_TRIGGERS = new Set([\"core#manual\", \"core#schedule\", \"core#webhook\"]);\n\nfunction kindOf(blockType: string): \"trigger\" | \"step\" {\n return CORE_TRIGGERS.has(blockType) || blockType.includes(\"#trigger:\")\n ? \"trigger\"\n : \"step\";\n}\n\nfunction portsFor(blockType: string): string[] {\n return blockType === \"core#branch\" ? [\"true\", \"false\"] : [\"next\"];\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 core#manual 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 \"Edges use port 'next' for the trigger and ordinary steps; core#branch emits 'true' and 'false'.\",\n \"Piece block types are '<package>@<version>#<action>' for actions and '<package>@<version>#trigger:<trigger>' for triggers. Always use the pinned strings returned by getWorkflowPieceBlocks.\",\n \"Steps whose piece needs a connection must set connectionId to a powerhouse/connection document id (see getConnections).\",\n \"Only workflows with status ENABLED get trigger instances and can be fired; set it with SET_WORKFLOW_STATUS.\",\n];\n\nexport const getWorkflowPieceBlocksTool: PhAiToolDescriptor = {\n name: \"getWorkflowPieceBlocks\",\n description:\n \"Lists the actions and triggers of one Activepieces piece with the exact, version-pinned blockType 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 blockType: action.blockType,\n displayName: action.displayName,\n description: action.description,\n })),\n triggers: triggers.map((trigger) => ({\n blockType: trigger.blockType,\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 a block type (core#… or a piece blockType): 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 blockType: z\n .string()\n .describe(\n \"Block type, e.g. core#branch or @activepieces/piece-http@0.11.19#send_request.\",\n ),\n },\n annotations: { title: \"Get Workflow Block Config\", ...READ_ONLY },\n callback: async (args: { blockType: string }) => {\n const { blockType } = args;\n if (!Object.hasOwn(CORE_FORMS, blockType)) syncRuntimeUrl();\n const form = await getBlockForm(blockType);\n if (!form) {\n return {\n blockType,\n error:\n \"Unknown block type. Use getConnectors and getWorkflowPieceBlocks to find valid block types (documents live in @powerhousedao/piece-reactor), or listWorkflowCoreBlocks for built-ins.\",\n };\n }\n return {\n blockType,\n title: form.title,\n kind: kindOf(blockType),\n requiresConnection: form.auth === \"required\",\n props: form.props.map(describeProp),\n ports: portsFor(blockType),\n };\n },\n};\n\nexport const listWorkflowCoreBlocksTool: PhAiToolDescriptor = {\n name: \"listWorkflowCoreBlocks\",\n description:\n \"Lists the built-in core#… blocks (manual, schedule and webhook triggers, branch and assert) with their 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: () =>\n Promise.resolve({\n blocks: Object.entries(CORE_FORMS).map(([blockType, form]) => ({\n blockType,\n title: form.title,\n kind: kindOf(blockType),\n props: form.props.map(describeProp),\n ports: portsFor(blockType),\n })),\n expressions: EXPRESSIONS,\n rules: GRAPH_RULES,\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 that has a 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 (OAUTH2, OIDC). */\n supported: boolean;\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 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC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WAAW,SAAmC;AAC5C,mBAAgB;AAChB,UAAOC,gBAAmB,KAAK,aAAa;;EAE/C;CAOC,GAAG;CACJ;;;;;;;AC9ND,MAAa,iBAAiB,CAACC,YAAcC,SAAW;;;ACCxD,MAAa,UAA0B;CACrC;CACA;CACA;CACD;;;ACND,MAAa,WAAWC"}
1
+ {"version":3,"file":"index.mjs","names":["READ_ONLY","runConnectionCheck","ConnectionV1","WorkflowV1","manifestJson"],"sources":["../../powerhouse.manifest.json","../../ai/runtime-url.ts","../../ai/workflow-tools.ts","../../ai/tools.ts","../../document-models/document-models.ts","../../editors/editors.ts","../../index.ts"],"sourcesContent":["","// 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 exact block\n// types 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 {\n CORE_FORMS,\n type BlockFormProp,\n} from \"../editors/workflow-editor/ui/forms.js\";\nimport { syncRuntimeUrl } from \"./runtime-url.js\";\n\nconst READ_ONLY = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n} as const;\n\n// Core blocks that are triggers. A piece's trigger says so in its own block\n// type, which is how every document trigger is classified now.\nconst CORE_TRIGGERS = new Set([\"core#manual\", \"core#schedule\", \"core#webhook\"]);\n\nfunction kindOf(blockType: string): \"trigger\" | \"step\" {\n return CORE_TRIGGERS.has(blockType) || blockType.includes(\"#trigger:\")\n ? \"trigger\"\n : \"step\";\n}\n\nfunction portsFor(blockType: string): string[] {\n return blockType === \"core#branch\" ? [\"true\", \"false\"] : [\"next\"];\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 core#manual 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 \"Edges use port 'next' for the trigger and ordinary steps; core#branch emits 'true' and 'false'.\",\n \"Piece block types are '<package>@<version>#<action>' for actions and '<package>@<version>#trigger:<trigger>' for triggers. Always use the pinned strings returned by getWorkflowPieceBlocks.\",\n \"Steps whose piece needs a connection must set connectionId to a powerhouse/connection document id (see getConnections).\",\n \"Only workflows with status ENABLED get trigger instances and can be fired; set it with SET_WORKFLOW_STATUS.\",\n];\n\nexport const getWorkflowPieceBlocksTool: PhAiToolDescriptor = {\n name: \"getWorkflowPieceBlocks\",\n description:\n \"Lists the actions and triggers of one Activepieces piece with the exact, version-pinned blockType 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 blockType: action.blockType,\n displayName: action.displayName,\n description: action.description,\n })),\n triggers: triggers.map((trigger) => ({\n blockType: trigger.blockType,\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 a block type (core#… or a piece blockType): 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 blockType: z\n .string()\n .describe(\n \"Block type, e.g. core#branch or @activepieces/piece-http@0.11.19#send_request.\",\n ),\n },\n annotations: { title: \"Get Workflow Block Config\", ...READ_ONLY },\n callback: async (args: { blockType: string }) => {\n const { blockType } = args;\n if (!Object.hasOwn(CORE_FORMS, blockType)) syncRuntimeUrl();\n const form = await getBlockForm(blockType);\n if (!form) {\n return {\n blockType,\n error:\n \"Unknown block type. Use getConnectors and getWorkflowPieceBlocks to find valid block types (documents live in @powerhousedao/piece-reactor), or listWorkflowCoreBlocks for built-ins.\",\n };\n }\n return {\n blockType,\n title: form.title,\n kind: kindOf(blockType),\n requiresConnection: form.auth === \"required\",\n props: form.props.map(describeProp),\n ports: portsFor(blockType),\n };\n },\n};\n\nexport const listWorkflowCoreBlocksTool: PhAiToolDescriptor = {\n name: \"listWorkflowCoreBlocks\",\n description:\n \"Lists the built-in core#… blocks (manual, schedule and webhook triggers, branch and assert) with their 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: () =>\n Promise.resolve({\n blocks: Object.entries(CORE_FORMS).map(([blockType, form]) => ({\n blockType,\n title: form.title,\n kind: kindOf(blockType),\n props: form.props.map(describeProp),\n ports: portsFor(blockType),\n })),\n expressions: EXPRESSIONS,\n rules: GRAPH_RULES,\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 that has a 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 (OAUTH2, OIDC). */\n supported: boolean;\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 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;GAAoB,GAAG;GAAW;EACxD,WAAW,SAAmC;AAC5C,mBAAgB;AAChB,UAAOC,gBAAmB,KAAK,aAAa;;EAE/C;CAOC,GAAG;CACJ;;;;;;;AC9ND,MAAa,iBAAiB,CAACC,YAAcC,SAAW;;;ACCxD,MAAa,UAA0B;CACrC;CACA;CACA;CACD;;;ACND,MAAa,WAAWC"}
@@ -53,5 +53,52 @@
53
53
  ],
54
54
  "processors": [],
55
55
  "subgraphs": [],
56
- "config": []
56
+ "config": [
57
+ {
58
+ "name": "PH_WORKFLOWS_SECRETS_MASTER_KEY",
59
+ "type": "secret",
60
+ "description": "64 hex chars (32 bytes) encrypting connection secrets at rest. Unset, a key is generated at ./.ph/secrets.key and reused; a host whose working directory does not survive a restart must set this or every stored secret becomes undecryptable."
61
+ },
62
+ {
63
+ "name": "PH_WORKFLOWS_EGRESS_ALLOW_ADDRESSES",
64
+ "type": "var",
65
+ "description": "Comma-separated addresses or CIDRs a piece may reach, widening the default policy that refuses private and loopback space. A bare address is taken as one host. Applies to steps and to design-time piece code alike."
66
+ },
67
+ {
68
+ "name": "PH_WORKFLOWS_RUN_CONCURRENCY",
69
+ "type": "var",
70
+ "description": "How many runs execute at once. Each slot is a forked node process, so this is the reactor's real connector concurrency.",
71
+ "default": "4"
72
+ },
73
+ {
74
+ "name": "PH_WORKFLOWS_RUN_QUEUE_DEPTH",
75
+ "type": "var",
76
+ "description": "How many runs may wait for a slot before new ones are refused. 0 waits without limit, turning saturation into latency rather than failures.",
77
+ "default": "0"
78
+ },
79
+ {
80
+ "name": "PH_WORKFLOWS_POLL_INTERVAL_MS",
81
+ "type": "var",
82
+ "description": "Cadence for a polling trigger that names none of its own. An author's override and a piece's requested schedule both win over it; a 1000ms floor applies to all three.",
83
+ "default": "60000"
84
+ },
85
+ {
86
+ "name": "PH_WORKFLOWS_WEBHOOK_RECONCILE_MS",
87
+ "type": "var",
88
+ "description": "How often a webhook trigger re-registers with its provider, so a registration the provider dropped comes back.",
89
+ "default": "900000"
90
+ },
91
+ {
92
+ "name": "PH_WORKFLOWS_WEBHOOK_TIMEOUT_MS",
93
+ "type": "var",
94
+ "description": "How long a sync-mode delivery holds the provider's socket. Past it the run continues and the provider is told so, lest a wedged step tie up connections.",
95
+ "default": "30000"
96
+ },
97
+ {
98
+ "name": "PH_WORKFLOWS_PIECE_MAX_FILE_BYTES",
99
+ "type": "var",
100
+ "description": "File-size ceiling for both directions: a FILE property hydrated from a URL, data URI or attachment ref, and ctx.files.write.",
101
+ "default": "8388608"
102
+ }
103
+ ]
57
104
  }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dispatch-outcome.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch-outcome.test.d.ts","sourceRoot":"","sources":["../../../../../../pieces/reactor/lib/actions/dispatch-outcome.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/workflow",
3
- "version": "6.2.3-dev.20",
3
+ "version": "6.2.3-dev.21",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -63,13 +63,13 @@
63
63
  "./package.json": "./package.json"
64
64
  },
65
65
  "dependencies": {
66
- "@powerhousedao/design-system": "6.2.3-dev.20",
67
- "@powerhousedao/pieces-framework": "6.2.3-dev.20",
68
- "@powerhousedao/reactor": "6.2.3-dev.20",
69
- "@powerhousedao/reactor-browser": "6.2.3-dev.20",
70
- "@powerhousedao/shared": "6.2.3-dev.20",
66
+ "@powerhousedao/design-system": "6.2.3-dev.21",
67
+ "@powerhousedao/pieces-framework": "6.2.3-dev.21",
68
+ "@powerhousedao/reactor": "6.2.3-dev.21",
69
+ "@powerhousedao/reactor-browser": "6.2.3-dev.21",
70
+ "@powerhousedao/shared": "6.2.3-dev.21",
71
71
  "@xyflow/react": "12.11.6",
72
- "document-model": "6.2.3-dev.20",
72
+ "document-model": "6.2.3-dev.21",
73
73
  "react": "19.2.6",
74
74
  "react-dom": "19.2.6",
75
75
  "react-markdown": "10.1.0",
@@ -1,51 +0,0 @@
1
- import { t as Connection } from "./module-12vI18HY.js";
2
- import { t as Workflow } from "./module-CYQnNZWl.js";
3
- //#region powerhouse.manifest.json
4
- var powerhouse_manifest_default = {
5
- name: "@powerhousedao/workflow",
6
- description: "Workflows in Connect: the workflow and connection document models, their editors and Workflow Studio, and the reactor piece.",
7
- category: "",
8
- publisher: {
9
- "name": "@powerhousedao",
10
- "url": "https://github.com/powerhouse-inc/powerhouse/tree/main/packages/workflow"
11
- },
12
- documentModels: [{
13
- "id": "powerhouse/workflow",
14
- "name": "Workflow"
15
- }, {
16
- "id": "powerhouse/connection",
17
- "name": "Connection"
18
- }],
19
- apps: [{
20
- "id": "workflow-studio",
21
- "name": "Workflow Studio",
22
- "documentTypes": ["powerhouse/document-drive"]
23
- }],
24
- editors: [{
25
- "id": "workflow-editor",
26
- "name": "Workflow Editor",
27
- "documentTypes": ["powerhouse/workflow"]
28
- }, {
29
- "id": "connection-editor",
30
- "name": "Connection Editor",
31
- "documentTypes": ["powerhouse/connection"]
32
- }],
33
- pieces: [{
34
- "id": "@powerhousedao/piece-reactor",
35
- "name": "Powerhouse Reactor"
36
- }],
37
- processors: [],
38
- subgraphs: [],
39
- config: []
40
- };
41
- //#endregion
42
- //#region document-models/document-models.ts
43
- /**
44
- * WARNING: DO NOT EDIT
45
- * This file is auto-generated and updated by codegen
46
- */
47
- const documentModels = [Connection, Workflow];
48
- //#endregion
49
- export { powerhouse_manifest_default as n, documentModels as t };
50
-
51
- //# sourceMappingURL=document-models-vmNTCrKx.js.map