patchwork-os 0.2.0-beta.10 → 0.2.0-beta.10.canary.101

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 (151) hide show
  1. package/dist/bridge.js +17 -10
  2. package/dist/bridge.js.map +1 -1
  3. package/dist/commands/connect.d.ts +47 -0
  4. package/dist/commands/connect.js +419 -0
  5. package/dist/commands/connect.js.map +1 -0
  6. package/dist/commands/recipe.d.ts +45 -4
  7. package/dist/commands/recipe.js +141 -4
  8. package/dist/commands/recipe.js.map +1 -1
  9. package/dist/commands/task.d.ts +25 -0
  10. package/dist/commands/task.js +61 -41
  11. package/dist/commands/task.js.map +1 -1
  12. package/dist/commands/tracesExport.d.ts +15 -1
  13. package/dist/commands/tracesExport.js +39 -5
  14. package/dist/commands/tracesExport.js.map +1 -1
  15. package/dist/connectorRoutes.js +556 -0
  16. package/dist/connectorRoutes.js.map +1 -1
  17. package/dist/connectors/connectorRegistry.d.ts +0 -3
  18. package/dist/connectors/connectorRegistry.js +8 -8
  19. package/dist/connectors/connectorRegistry.js.map +1 -1
  20. package/dist/connectors/datadog.js +8 -1
  21. package/dist/connectors/datadog.js.map +1 -1
  22. package/dist/connectors/jira.js +7 -2
  23. package/dist/connectors/jira.js.map +1 -1
  24. package/dist/connectors/mcpClient.js +37 -23
  25. package/dist/connectors/mcpClient.js.map +1 -1
  26. package/dist/connectors/notion.d.ts +1 -1
  27. package/dist/connectors/notion.js +13 -4
  28. package/dist/connectors/notion.js.map +1 -1
  29. package/dist/connectors/redis.js +10 -2
  30. package/dist/connectors/redis.js.map +1 -1
  31. package/dist/connectors/snowflake.js +18 -0
  32. package/dist/connectors/snowflake.js.map +1 -1
  33. package/dist/decisionReplay.d.ts +8 -6
  34. package/dist/decisionReplay.js +35 -11
  35. package/dist/decisionReplay.js.map +1 -1
  36. package/dist/drivers/claude/api.js +28 -5
  37. package/dist/drivers/claude/api.js.map +1 -1
  38. package/dist/drivers/claude/subprocess.js +47 -13
  39. package/dist/drivers/claude/subprocess.js.map +1 -1
  40. package/dist/drivers/local/index.d.ts +2 -17
  41. package/dist/drivers/local/index.js +5 -92
  42. package/dist/drivers/local/index.js.map +1 -1
  43. package/dist/fp/automationInterpreter.js +57 -12
  44. package/dist/fp/automationInterpreter.js.map +1 -1
  45. package/dist/fp/policyParser.js +5 -1
  46. package/dist/fp/policyParser.js.map +1 -1
  47. package/dist/index.js +154 -83
  48. package/dist/index.js.map +1 -1
  49. package/dist/localEndpointGuard.d.ts +25 -0
  50. package/dist/localEndpointGuard.js +101 -0
  51. package/dist/localEndpointGuard.js.map +1 -0
  52. package/dist/orchestrator/childBridgeClient.d.ts +5 -0
  53. package/dist/orchestrator/childBridgeClient.js +28 -1
  54. package/dist/orchestrator/childBridgeClient.js.map +1 -1
  55. package/dist/orchestrator/orchestratorBridge.d.ts +33 -0
  56. package/dist/orchestrator/orchestratorBridge.js +70 -9
  57. package/dist/orchestrator/orchestratorBridge.js.map +1 -1
  58. package/dist/recipes/chainedRunner.js +14 -4
  59. package/dist/recipes/chainedRunner.js.map +1 -1
  60. package/dist/recipes/compiler.js +9 -5
  61. package/dist/recipes/compiler.js.map +1 -1
  62. package/dist/recipes/dependencyGraph.d.ts +9 -0
  63. package/dist/recipes/dependencyGraph.js +19 -2
  64. package/dist/recipes/dependencyGraph.js.map +1 -1
  65. package/dist/recipes/githubInstallSource.d.ts +9 -2
  66. package/dist/recipes/githubInstallSource.js +36 -6
  67. package/dist/recipes/githubInstallSource.js.map +1 -1
  68. package/dist/recipes/idempotencyKey.d.ts +23 -3
  69. package/dist/recipes/idempotencyKey.js +57 -4
  70. package/dist/recipes/idempotencyKey.js.map +1 -1
  71. package/dist/recipes/installer.js +10 -1
  72. package/dist/recipes/installer.js.map +1 -1
  73. package/dist/recipes/parser.js +28 -1
  74. package/dist/recipes/parser.js.map +1 -1
  75. package/dist/recipes/schema.d.ts +29 -2
  76. package/dist/recipes/schemaGenerator.js +16 -2
  77. package/dist/recipes/schemaGenerator.js.map +1 -1
  78. package/dist/recipes/toolRegistry.js +13 -4
  79. package/dist/recipes/toolRegistry.js.map +1 -1
  80. package/dist/recipes/tools/airtable.d.ts +15 -0
  81. package/dist/recipes/tools/airtable.js +239 -0
  82. package/dist/recipes/tools/airtable.js.map +1 -0
  83. package/dist/recipes/tools/circleci.d.ts +10 -0
  84. package/dist/recipes/tools/circleci.js +203 -0
  85. package/dist/recipes/tools/circleci.js.map +1 -0
  86. package/dist/recipes/tools/grafana.d.ts +11 -0
  87. package/dist/recipes/tools/grafana.js +215 -0
  88. package/dist/recipes/tools/grafana.js.map +1 -0
  89. package/dist/recipes/tools/index.d.ts +11 -0
  90. package/dist/recipes/tools/index.js +11 -0
  91. package/dist/recipes/tools/index.js.map +1 -1
  92. package/dist/recipes/tools/pipedrive.d.ts +16 -0
  93. package/dist/recipes/tools/pipedrive.js +233 -0
  94. package/dist/recipes/tools/pipedrive.js.map +1 -0
  95. package/dist/recipes/tools/posthog.d.ts +16 -0
  96. package/dist/recipes/tools/posthog.js +218 -0
  97. package/dist/recipes/tools/posthog.js.map +1 -0
  98. package/dist/recipes/tools/resend.d.ts +8 -0
  99. package/dist/recipes/tools/resend.js +152 -0
  100. package/dist/recipes/tools/resend.js.map +1 -0
  101. package/dist/recipes/tools/sendgrid.d.ts +9 -0
  102. package/dist/recipes/tools/sendgrid.js +174 -0
  103. package/dist/recipes/tools/sendgrid.js.map +1 -0
  104. package/dist/recipes/tools/shopify.d.ts +16 -0
  105. package/dist/recipes/tools/shopify.js +265 -0
  106. package/dist/recipes/tools/shopify.js.map +1 -0
  107. package/dist/recipes/tools/todoist.d.ts +15 -0
  108. package/dist/recipes/tools/todoist.js +227 -0
  109. package/dist/recipes/tools/todoist.js.map +1 -0
  110. package/dist/recipes/tools/twilio.d.ts +11 -0
  111. package/dist/recipes/tools/twilio.js +179 -0
  112. package/dist/recipes/tools/twilio.js.map +1 -0
  113. package/dist/recipes/tools/vercel.d.ts +9 -0
  114. package/dist/recipes/tools/vercel.js +145 -0
  115. package/dist/recipes/tools/vercel.js.map +1 -0
  116. package/dist/recipes/validation.js +112 -0
  117. package/dist/recipes/validation.js.map +1 -1
  118. package/dist/recipes/yamlRunner.d.ts +3 -0
  119. package/dist/recipes/yamlRunner.js +112 -29
  120. package/dist/recipes/yamlRunner.js.map +1 -1
  121. package/dist/schemas/recipe.v1.json +2 -2
  122. package/dist/telemetry.js +20 -9
  123. package/dist/telemetry.js.map +1 -1
  124. package/dist/tools/getGitStatus.js +6 -1
  125. package/dist/tools/getGitStatus.js.map +1 -1
  126. package/dist/tools/getToolCapabilities.js +39 -4
  127. package/dist/tools/getToolCapabilities.js.map +1 -1
  128. package/dist/tools/github/composite.d.ts +1 -1
  129. package/dist/tools/github/composite.js +7 -7
  130. package/dist/tools/github/composite.js.map +1 -1
  131. package/dist/tools/github/pr.d.ts +6 -6
  132. package/dist/tools/github/pr.js +18 -11
  133. package/dist/tools/github/pr.js.map +1 -1
  134. package/dist/tools/index.js +14 -10
  135. package/dist/tools/index.js.map +1 -1
  136. package/dist/tools/previewEdit.js +16 -1
  137. package/dist/tools/previewEdit.js.map +1 -1
  138. package/dist/tools/searchAndReplace.js +4 -5
  139. package/dist/tools/searchAndReplace.js.map +1 -1
  140. package/dist/tools/searchTools.d.ts +26 -0
  141. package/dist/tools/searchTools.js +42 -2
  142. package/dist/tools/searchTools.js.map +1 -1
  143. package/dist/tools/transaction.d.ts +9 -1
  144. package/dist/tools/transaction.js +59 -4
  145. package/dist/tools/transaction.js.map +1 -1
  146. package/dist/tools/utils.d.ts +15 -0
  147. package/dist/tools/utils.js +19 -0
  148. package/dist/tools/utils.js.map +1 -1
  149. package/dist/transport.js +23 -0
  150. package/dist/transport.js.map +1 -1
  151. package/package.json +1 -1
@@ -0,0 +1,233 @@
1
+ /**
2
+ * Pipedrive tools — read wrappers (deals, persons, pipelines) plus a write
3
+ * (create_deal) over the Pipedrive CRM REST API v1.
4
+ *
5
+ * Self-registering tool module for the recipe tool registry. Mirrors the
6
+ * connector method signatures faithfully (see src/connectors/pipedrive.ts):
7
+ * - getDeals({ status?, start?, limit? }) → PipedriveDeal[]
8
+ * - createDeal({ title, value?, currency?, stageId?, personId?, orgId?,
9
+ * status?, expectedCloseDate? }) → PipedriveDeal
10
+ * - getPersons({ start?, limit? }) → PipedrivePerson[]
11
+ * - getPipelines() → PipedrivePipeline[]
12
+ *
13
+ * Read tools declare `isWrite: false`; the write tool declares `isWrite: true`
14
+ * so the approval queue gates it appropriately.
15
+ */
16
+ import { CommonSchemas, registerTool } from "../toolRegistry.js";
17
+ // ============================================================================
18
+ // pipedrive.list_deals
19
+ // ============================================================================
20
+ registerTool({
21
+ id: "pipedrive.list_deals",
22
+ namespace: "pipedrive",
23
+ description: "List Pipedrive deals, optionally filtered by status with pagination.",
24
+ paramsSchema: {
25
+ type: "object",
26
+ properties: {
27
+ status: {
28
+ type: "string",
29
+ enum: ["open", "won", "lost", "deleted", "all_not_deleted"],
30
+ description: "Filter by deal status",
31
+ },
32
+ start: {
33
+ type: "number",
34
+ description: "Pagination offset (0-based index of first item)",
35
+ },
36
+ limit: {
37
+ type: "number",
38
+ description: "Max number of deals to return",
39
+ },
40
+ into: CommonSchemas.into,
41
+ },
42
+ required: [],
43
+ },
44
+ outputSchema: {
45
+ type: "array",
46
+ items: {
47
+ type: "object",
48
+ properties: {
49
+ id: { type: "number" },
50
+ title: { type: "string" },
51
+ value: { type: ["number", "null"] },
52
+ currency: { type: "string" },
53
+ status: { type: "string" },
54
+ stage_id: { type: ["number", "null"] },
55
+ expected_close_date: { type: ["string", "null"] },
56
+ add_time: { type: "string" },
57
+ update_time: { type: "string" },
58
+ },
59
+ },
60
+ },
61
+ riskDefault: "low",
62
+ isWrite: false,
63
+ isConnector: true,
64
+ execute: async ({ params }) => {
65
+ const { getPipedriveConnector } = await import("../../connectors/pipedrive.js");
66
+ const connector = getPipedriveConnector();
67
+ const result = await connector.getDeals({
68
+ status: typeof params.status === "string"
69
+ ? params.status
70
+ : undefined,
71
+ start: typeof params.start === "number" ? params.start : undefined,
72
+ limit: typeof params.limit === "number" ? params.limit : undefined,
73
+ });
74
+ return JSON.stringify(result);
75
+ },
76
+ });
77
+ // ============================================================================
78
+ // pipedrive.create_deal (write-gated)
79
+ // ============================================================================
80
+ registerTool({
81
+ id: "pipedrive.create_deal",
82
+ namespace: "pipedrive",
83
+ description: "Create a new Pipedrive deal. Requires a title; all other fields optional.",
84
+ paramsSchema: {
85
+ type: "object",
86
+ properties: {
87
+ title: { type: "string", description: "Deal title (required)" },
88
+ value: { type: "number", description: "Deal monetary value" },
89
+ currency: {
90
+ type: "string",
91
+ description: "Currency code (e.g. USD, EUR)",
92
+ },
93
+ stageId: { type: "number", description: "Pipeline stage id" },
94
+ personId: { type: "number", description: "Linked person id" },
95
+ orgId: { type: "number", description: "Linked organization id" },
96
+ status: {
97
+ type: "string",
98
+ enum: ["open", "won", "lost"],
99
+ description: "Initial deal status",
100
+ },
101
+ expectedCloseDate: {
102
+ type: "string",
103
+ description: "Expected close date (ISO YYYY-MM-DD)",
104
+ },
105
+ into: CommonSchemas.into,
106
+ },
107
+ required: ["title"],
108
+ },
109
+ outputSchema: {
110
+ type: "object",
111
+ properties: {
112
+ id: { type: "number" },
113
+ title: { type: "string" },
114
+ value: { type: ["number", "null"] },
115
+ currency: { type: "string" },
116
+ status: { type: "string" },
117
+ stage_id: { type: ["number", "null"] },
118
+ expected_close_date: { type: ["string", "null"] },
119
+ add_time: { type: "string" },
120
+ update_time: { type: "string" },
121
+ },
122
+ },
123
+ riskDefault: "medium",
124
+ isWrite: true,
125
+ isConnector: true,
126
+ execute: async ({ params }) => {
127
+ const { getPipedriveConnector } = await import("../../connectors/pipedrive.js");
128
+ const connector = getPipedriveConnector();
129
+ const result = await connector.createDeal({
130
+ title: params.title,
131
+ value: typeof params.value === "number" ? params.value : undefined,
132
+ currency: typeof params.currency === "string" ? params.currency : undefined,
133
+ stageId: typeof params.stageId === "number" ? params.stageId : undefined,
134
+ personId: typeof params.personId === "number" ? params.personId : undefined,
135
+ orgId: typeof params.orgId === "number" ? params.orgId : undefined,
136
+ status: typeof params.status === "string"
137
+ ? params.status
138
+ : undefined,
139
+ expectedCloseDate: typeof params.expectedCloseDate === "string"
140
+ ? params.expectedCloseDate
141
+ : undefined,
142
+ });
143
+ return JSON.stringify(result);
144
+ },
145
+ });
146
+ // ============================================================================
147
+ // pipedrive.list_persons
148
+ // ============================================================================
149
+ registerTool({
150
+ id: "pipedrive.list_persons",
151
+ namespace: "pipedrive",
152
+ description: "List Pipedrive persons (contacts) with pagination.",
153
+ paramsSchema: {
154
+ type: "object",
155
+ properties: {
156
+ start: {
157
+ type: "number",
158
+ description: "Pagination offset (0-based index of first item)",
159
+ },
160
+ limit: {
161
+ type: "number",
162
+ description: "Max number of persons to return",
163
+ },
164
+ into: CommonSchemas.into,
165
+ },
166
+ required: [],
167
+ },
168
+ outputSchema: {
169
+ type: "array",
170
+ items: {
171
+ type: "object",
172
+ properties: {
173
+ id: { type: "number" },
174
+ name: { type: "string" },
175
+ email: { type: "array", items: { type: "object" } },
176
+ phone: { type: "array", items: { type: "object" } },
177
+ org_id: { type: ["object", "null"] },
178
+ add_time: { type: "string" },
179
+ },
180
+ },
181
+ },
182
+ riskDefault: "low",
183
+ isWrite: false,
184
+ isConnector: true,
185
+ execute: async ({ params }) => {
186
+ const { getPipedriveConnector } = await import("../../connectors/pipedrive.js");
187
+ const connector = getPipedriveConnector();
188
+ const result = await connector.getPersons({
189
+ start: typeof params.start === "number" ? params.start : undefined,
190
+ limit: typeof params.limit === "number" ? params.limit : undefined,
191
+ });
192
+ return JSON.stringify(result);
193
+ },
194
+ });
195
+ // ============================================================================
196
+ // pipedrive.list_pipelines
197
+ // ============================================================================
198
+ registerTool({
199
+ id: "pipedrive.list_pipelines",
200
+ namespace: "pipedrive",
201
+ description: "List all Pipedrive pipelines.",
202
+ paramsSchema: {
203
+ type: "object",
204
+ properties: {
205
+ into: CommonSchemas.into,
206
+ },
207
+ required: [],
208
+ },
209
+ outputSchema: {
210
+ type: "array",
211
+ items: {
212
+ type: "object",
213
+ properties: {
214
+ id: { type: "number" },
215
+ name: { type: "string" },
216
+ order_nr: { type: "number" },
217
+ active: { type: "boolean" },
218
+ add_time: { type: "string" },
219
+ update_time: { type: "string" },
220
+ },
221
+ },
222
+ },
223
+ riskDefault: "low",
224
+ isWrite: false,
225
+ isConnector: true,
226
+ execute: async () => {
227
+ const { getPipedriveConnector } = await import("../../connectors/pipedrive.js");
228
+ const connector = getPipedriveConnector();
229
+ const result = await connector.getPipelines();
230
+ return JSON.stringify(result);
231
+ },
232
+ });
233
+ //# sourceMappingURL=pipedrive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipedrive.js","sourceRoot":"","sources":["../../../src/recipes/tools/pipedrive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E,YAAY,CAAC;IACX,EAAE,EAAE,sBAAsB;IAC1B,SAAS,EAAE,WAAW;IACtB,WAAW,EACT,sEAAsE;IACxE,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,CAAC;gBAC3D,WAAW,EAAE,uBAAuB;aACrC;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iDAAiD;aAC/D;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+BAA+B;aAC7C;YACD,IAAI,EAAE,aAAa,CAAC,IAAI;SACzB;QACD,QAAQ,EAAE,EAAE;KACb;IACD,YAAY,EAAE;QACZ,IAAI,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AQ;YACd,UAAU,EAAE;gBACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACtB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACxB,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC5B,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC5B,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aAChC;SACF;KACF;IACD,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,MAAM,CAC5C,+BAA+B,CAChC,CAAC;QACF,MAAM,SAAS,GAAG,qBAAqB,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,YAAY,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * PostHog tools — capture product-analytics events (write) plus read wrappers
3
+ * for insights, HogQL queries, and raw events.
4
+ *
5
+ * Self-registering tool module for the recipe tool registry. Mirrors the
6
+ * connector method signatures in src/connectors/posthog.ts:
7
+ * - captureEvent(distinctId, event, properties?, timestamp?)
8
+ * - getInsights(projectId, limit?)
9
+ * - queryInsight(projectId, query)
10
+ * - getEvents(projectId, params)
11
+ *
12
+ * `capture_event` is the only mutating tool — it POSTs to /capture/ and so
13
+ * declares isWrite: true so the approval queue / kill-switch gate it. The
14
+ * remaining tools are read-only.
15
+ */
16
+ export {};
@@ -0,0 +1,218 @@
1
+ /**
2
+ * PostHog tools — capture product-analytics events (write) plus read wrappers
3
+ * for insights, HogQL queries, and raw events.
4
+ *
5
+ * Self-registering tool module for the recipe tool registry. Mirrors the
6
+ * connector method signatures in src/connectors/posthog.ts:
7
+ * - captureEvent(distinctId, event, properties?, timestamp?)
8
+ * - getInsights(projectId, limit?)
9
+ * - queryInsight(projectId, query)
10
+ * - getEvents(projectId, params)
11
+ *
12
+ * `capture_event` is the only mutating tool — it POSTs to /capture/ and so
13
+ * declares isWrite: true so the approval queue / kill-switch gate it. The
14
+ * remaining tools are read-only.
15
+ */
16
+ import { CommonSchemas, registerTool } from "../toolRegistry.js";
17
+ // ============================================================================
18
+ // posthog.capture_event (write-gated)
19
+ // ============================================================================
20
+ registerTool({
21
+ id: "posthog.capture_event",
22
+ namespace: "posthog",
23
+ description: "Capture a PostHog product-analytics event for a distinct id. Requires a project API key on the connection.",
24
+ paramsSchema: {
25
+ type: "object",
26
+ properties: {
27
+ distinctId: {
28
+ type: "string",
29
+ description: "Distinct id of the person the event is attributed to",
30
+ },
31
+ event: {
32
+ type: "string",
33
+ description: "Event name (e.g. 'signed_up', '$pageview')",
34
+ },
35
+ properties: {
36
+ type: "object",
37
+ description: "Optional event property bag",
38
+ additionalProperties: true,
39
+ },
40
+ timestamp: {
41
+ type: "string",
42
+ description: "Optional ISO 8601 timestamp for the event",
43
+ },
44
+ into: CommonSchemas.into,
45
+ },
46
+ required: ["distinctId", "event"],
47
+ },
48
+ outputSchema: {
49
+ type: "object",
50
+ properties: {
51
+ status: { type: "string" },
52
+ },
53
+ },
54
+ riskDefault: "medium",
55
+ isWrite: true,
56
+ isConnector: true,
57
+ execute: async ({ params }) => {
58
+ const { getPostHogConnector } = await import("../../connectors/posthog.js");
59
+ const connector = getPostHogConnector();
60
+ const result = await connector.captureEvent(params.distinctId, params.event, typeof params.properties === "object" && params.properties !== null
61
+ ? params.properties
62
+ : undefined, typeof params.timestamp === "string" ? params.timestamp : undefined);
63
+ return JSON.stringify(result);
64
+ },
65
+ });
66
+ // ============================================================================
67
+ // posthog.list_insights
68
+ // ============================================================================
69
+ registerTool({
70
+ id: "posthog.list_insights",
71
+ namespace: "posthog",
72
+ description: "List PostHog insights for a project, optionally limited.",
73
+ paramsSchema: {
74
+ type: "object",
75
+ properties: {
76
+ projectId: {
77
+ type: ["string", "number"],
78
+ description: "PostHog project id",
79
+ },
80
+ limit: {
81
+ type: "number",
82
+ description: "Max number of insights to return",
83
+ },
84
+ into: CommonSchemas.into,
85
+ },
86
+ required: ["projectId"],
87
+ },
88
+ outputSchema: {
89
+ type: "array",
90
+ items: {
91
+ type: "object",
92
+ properties: {
93
+ id: { type: ["string", "number"] },
94
+ name: { type: "string" },
95
+ description: { type: "string" },
96
+ filters: { type: "object" },
97
+ result: {},
98
+ last_modified_at: { type: "string" },
99
+ },
100
+ },
101
+ },
102
+ riskDefault: "low",
103
+ isWrite: false,
104
+ isConnector: true,
105
+ execute: async ({ params }) => {
106
+ const { getPostHogConnector } = await import("../../connectors/posthog.js");
107
+ const connector = getPostHogConnector();
108
+ const result = await connector.getInsights(params.projectId, typeof params.limit === "number" ? params.limit : undefined);
109
+ return JSON.stringify(result);
110
+ },
111
+ });
112
+ // ============================================================================
113
+ // posthog.query_insight
114
+ // ============================================================================
115
+ registerTool({
116
+ id: "posthog.query_insight",
117
+ namespace: "posthog",
118
+ description: "Run a HogQL / structured query against a PostHog project and return the raw query result.",
119
+ paramsSchema: {
120
+ type: "object",
121
+ properties: {
122
+ projectId: {
123
+ type: ["string", "number"],
124
+ description: "PostHog project id",
125
+ },
126
+ query: {
127
+ type: "object",
128
+ description: "PostHog query object (e.g. { kind: 'HogQLQuery', query: 'SELECT ...' })",
129
+ additionalProperties: true,
130
+ },
131
+ into: CommonSchemas.into,
132
+ },
133
+ required: ["projectId", "query"],
134
+ },
135
+ outputSchema: {
136
+ type: "object",
137
+ description: "Raw PostHog query response (shape varies by query kind)",
138
+ additionalProperties: true,
139
+ },
140
+ riskDefault: "low",
141
+ isWrite: false,
142
+ isConnector: true,
143
+ execute: async ({ params }) => {
144
+ const { getPostHogConnector } = await import("../../connectors/posthog.js");
145
+ const connector = getPostHogConnector();
146
+ const result = await connector.queryInsight(params.projectId, params.query);
147
+ return JSON.stringify(result);
148
+ },
149
+ });
150
+ // ============================================================================
151
+ // posthog.list_events
152
+ // ============================================================================
153
+ registerTool({
154
+ id: "posthog.list_events",
155
+ namespace: "posthog",
156
+ description: "List raw PostHog events for a project, optionally filtered by event name, person, and time window.",
157
+ paramsSchema: {
158
+ type: "object",
159
+ properties: {
160
+ projectId: {
161
+ type: ["string", "number"],
162
+ description: "PostHog project id",
163
+ },
164
+ event: {
165
+ type: "string",
166
+ description: "Filter by event name",
167
+ },
168
+ personId: {
169
+ type: "string",
170
+ description: "Filter by person id",
171
+ },
172
+ after: {
173
+ type: "string",
174
+ description: "ISO 8601 timestamp — only events after this time",
175
+ },
176
+ before: {
177
+ type: "string",
178
+ description: "ISO 8601 timestamp — only events before this time",
179
+ },
180
+ limit: {
181
+ type: "number",
182
+ description: "Max number of events to return",
183
+ },
184
+ into: CommonSchemas.into,
185
+ },
186
+ required: ["projectId"],
187
+ },
188
+ outputSchema: {
189
+ type: "array",
190
+ items: {
191
+ type: "object",
192
+ properties: {
193
+ id: { type: "string" },
194
+ distinct_id: { type: "string" },
195
+ event: { type: "string" },
196
+ properties: { type: "object" },
197
+ timestamp: { type: "string" },
198
+ person: { type: "object" },
199
+ },
200
+ },
201
+ },
202
+ riskDefault: "low",
203
+ isWrite: false,
204
+ isConnector: true,
205
+ execute: async ({ params }) => {
206
+ const { getPostHogConnector } = await import("../../connectors/posthog.js");
207
+ const connector = getPostHogConnector();
208
+ const result = await connector.getEvents(params.projectId, {
209
+ event: typeof params.event === "string" ? params.event : undefined,
210
+ personId: typeof params.personId === "string" ? params.personId : undefined,
211
+ after: typeof params.after === "string" ? params.after : undefined,
212
+ before: typeof params.before === "string" ? params.before : undefined,
213
+ limit: typeof params.limit === "number" ? params.limit : undefined,
214
+ });
215
+ return JSON.stringify(result);
216
+ },
217
+ });
218
+ //# sourceMappingURL=posthog.js.map
@@ -0,0 +1 @@
1
+ {"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;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Resend tools — transactional email send + read access to sent emails.
3
+ *
4
+ * Self-registering tool module for the recipe tool registry. Wraps the Resend
5
+ * connector (src/connectors/resend.ts). `send_email` is write-gated; the two
6
+ * read tools surface a single email / a list of emails.
7
+ */
8
+ export {};
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Resend tools — transactional email send + read access to sent emails.
3
+ *
4
+ * Self-registering tool module for the recipe tool registry. Wraps the Resend
5
+ * connector (src/connectors/resend.ts). `send_email` is write-gated; the two
6
+ * read tools surface a single email / a list of emails.
7
+ */
8
+ import { CommonSchemas, registerTool } from "../toolRegistry.js";
9
+ // ============================================================================
10
+ // resend.send_email (write-gated)
11
+ // ============================================================================
12
+ registerTool({
13
+ id: "resend.send_email",
14
+ namespace: "resend",
15
+ description: "Send a transactional email via Resend. Requires from, to, subject, and one of html/text.",
16
+ paramsSchema: {
17
+ type: "object",
18
+ properties: {
19
+ from: {
20
+ type: "string",
21
+ description: "Sender address (must be a verified Resend domain)",
22
+ },
23
+ to: {
24
+ type: ["string", "array"],
25
+ items: { type: "string" },
26
+ description: "Recipient address or array of addresses",
27
+ },
28
+ subject: { type: "string", description: "Email subject line" },
29
+ html: {
30
+ type: "string",
31
+ description: "HTML body (either html or text is required)",
32
+ },
33
+ text: {
34
+ type: "string",
35
+ description: "Plain-text body (either html or text is required)",
36
+ },
37
+ reply_to: {
38
+ type: ["string", "array"],
39
+ items: { type: "string" },
40
+ description: "Optional reply-to address or array of addresses",
41
+ },
42
+ into: CommonSchemas.into,
43
+ },
44
+ required: ["from", "to", "subject"],
45
+ },
46
+ outputSchema: {
47
+ type: "object",
48
+ properties: {
49
+ id: { type: "string" },
50
+ },
51
+ },
52
+ riskDefault: "medium",
53
+ isWrite: true,
54
+ isConnector: true,
55
+ execute: async ({ params }) => {
56
+ const { getResendConnector } = await import("../../connectors/resend.js");
57
+ const connector = getResendConnector();
58
+ const result = await connector.sendEmail({
59
+ from: params.from,
60
+ to: params.to,
61
+ subject: params.subject,
62
+ html: typeof params.html === "string" ? params.html : undefined,
63
+ text: typeof params.text === "string" ? params.text : undefined,
64
+ replyTo: typeof params.reply_to === "string" || Array.isArray(params.reply_to)
65
+ ? params.reply_to
66
+ : undefined,
67
+ });
68
+ return JSON.stringify(result);
69
+ },
70
+ });
71
+ // ============================================================================
72
+ // resend.list_emails
73
+ // ============================================================================
74
+ registerTool({
75
+ id: "resend.list_emails",
76
+ namespace: "resend",
77
+ description: "List emails sent via Resend, with optional limit/page paging.",
78
+ paramsSchema: {
79
+ type: "object",
80
+ properties: {
81
+ limit: {
82
+ type: "number",
83
+ description: "Max number of emails to return",
84
+ },
85
+ page: {
86
+ type: "number",
87
+ description: "Page number for pagination",
88
+ },
89
+ into: CommonSchemas.into,
90
+ },
91
+ required: [],
92
+ },
93
+ outputSchema: {
94
+ type: "object",
95
+ properties: {
96
+ object: { type: "string" },
97
+ data: { type: "array", items: { type: "object" } },
98
+ },
99
+ },
100
+ riskDefault: "low",
101
+ isWrite: false,
102
+ isConnector: true,
103
+ execute: async ({ params }) => {
104
+ const { getResendConnector } = await import("../../connectors/resend.js");
105
+ const connector = getResendConnector();
106
+ const result = await connector.listEmails({
107
+ limit: typeof params.limit === "number" ? params.limit : undefined,
108
+ page: typeof params.page === "number" ? params.page : undefined,
109
+ });
110
+ return JSON.stringify(result);
111
+ },
112
+ });
113
+ // ============================================================================
114
+ // resend.get_email
115
+ // ============================================================================
116
+ registerTool({
117
+ id: "resend.get_email",
118
+ namespace: "resend",
119
+ description: "Fetch a single email sent via Resend by its ID.",
120
+ paramsSchema: {
121
+ type: "object",
122
+ properties: {
123
+ id: { type: "string", description: "Resend email ID" },
124
+ into: CommonSchemas.into,
125
+ },
126
+ required: ["id"],
127
+ },
128
+ outputSchema: {
129
+ type: "object",
130
+ properties: {
131
+ object: { type: "string" },
132
+ id: { type: "string" },
133
+ to: { type: ["string", "array"], items: { type: "string" } },
134
+ from: { type: "string" },
135
+ subject: { type: "string" },
136
+ html: { type: ["string", "null"] },
137
+ text: { type: ["string", "null"] },
138
+ created_at: { type: "string" },
139
+ last_event: { type: "string" },
140
+ },
141
+ },
142
+ riskDefault: "low",
143
+ isWrite: false,
144
+ isConnector: true,
145
+ execute: async ({ params }) => {
146
+ const { getResendConnector } = await import("../../connectors/resend.js");
147
+ const connector = getResendConnector();
148
+ const result = await connector.getEmail(params.id);
149
+ return JSON.stringify(result);
150
+ },
151
+ });
152
+ //# sourceMappingURL=resend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resend.js","sourceRoot":"","sources":["../../../src/recipes/tools/resend.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE,+EAA+E;AAC/E,mCAAmC;AACnC,+EAA+E;AAE/E,YAAY,CAAC;IACX,EAAE,EAAE,mBAAmB;IACvB,SAAS,EAAE,QAAQ;IACnB,WAAW,EACT,0FAA0F;IAC5F,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;aACjE;YACD,EAAE,EAAE;gBACF,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;gBACzB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,WAAW,EAAE,yCAAyC;aACvD;YACD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;YAC9D,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,6CAA6C;aAC3D;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;aACjE;YACD,QAAQ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