patchwork-os 0.2.0-beta.10.canary.98 → 0.2.0-beta.11
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 +20 -1
- package/dist/adapters/grok.js +6 -1
- package/dist/adapters/grok.js.map +1 -1
- package/dist/approvalHttp.js +61 -66
- package/dist/approvalHttp.js.map +1 -1
- package/dist/bridge.js +3 -2
- package/dist/bridge.js.map +1 -1
- package/dist/claudeOrchestrator.js +15 -0
- package/dist/claudeOrchestrator.js.map +1 -1
- package/dist/commands/connect.d.ts +47 -0
- package/dist/commands/connect.js +419 -0
- package/dist/commands/connect.js.map +1 -0
- package/dist/commands/patchworkInit.d.ts +7 -0
- package/dist/commands/patchworkInit.js +26 -0
- package/dist/commands/patchworkInit.js.map +1 -1
- package/dist/commands/recipe.d.ts +14 -0
- package/dist/commands/recipe.js +51 -0
- package/dist/commands/recipe.js.map +1 -1
- package/dist/commands/recipeInstall.js +15 -0
- package/dist/commands/recipeInstall.js.map +1 -1
- package/dist/connectors/postgres.d.ts +7 -0
- package/dist/connectors/postgres.js +16 -2
- package/dist/connectors/postgres.js.map +1 -1
- package/dist/connectors/snowflake.js +6 -0
- package/dist/connectors/snowflake.js.map +1 -1
- package/dist/connectors/tokenStorage.d.ts +8 -0
- package/dist/connectors/tokenStorage.js +42 -3
- package/dist/connectors/tokenStorage.js.map +1 -1
- package/dist/drivers/claude/api.js +15 -2
- package/dist/drivers/claude/api.js.map +1 -1
- package/dist/drivers/claude/subprocess.js +1 -29
- package/dist/drivers/claude/subprocess.js.map +1 -1
- package/dist/drivers/gemini/index.js +9 -5
- package/dist/drivers/gemini/index.js.map +1 -1
- package/dist/drivers/openai/index.js +29 -4
- package/dist/drivers/openai/index.js.map +1 -1
- package/dist/drivers/outputCap.d.ts +27 -0
- package/dist/drivers/outputCap.js +50 -0
- package/dist/drivers/outputCap.js.map +1 -0
- package/dist/featureFlags.d.ts +9 -0
- package/dist/featureFlags.js +16 -0
- package/dist/featureFlags.js.map +1 -1
- package/dist/fp/commandDescription.d.ts +6 -0
- package/dist/fp/commandDescription.js +4 -4
- package/dist/fp/commandDescription.js.map +1 -1
- package/dist/fp/policyParser.js +13 -7
- package/dist/fp/policyParser.js.map +1 -1
- package/dist/haltPushDispatch.js +7 -22
- package/dist/haltPushDispatch.js.map +1 -1
- package/dist/index.js +148 -0
- package/dist/index.js.map +1 -1
- package/dist/mcpRoutes.js +1 -1
- package/dist/mcpRoutes.js.map +1 -1
- package/dist/oauth.d.ts +13 -0
- package/dist/oauth.js +34 -1
- package/dist/oauth.js.map +1 -1
- package/dist/recipeOrchestration.js +10 -0
- package/dist/recipeOrchestration.js.map +1 -1
- package/dist/recipeRoutes.d.ts +39 -0
- package/dist/recipeRoutes.js +214 -12
- package/dist/recipeRoutes.js.map +1 -1
- package/dist/recipes/agentExecutor.d.ts +20 -0
- package/dist/recipes/agentExecutor.js +32 -10
- package/dist/recipes/agentExecutor.js.map +1 -1
- package/dist/recipes/chainedRunner.d.ts +41 -2
- package/dist/recipes/chainedRunner.js +134 -6
- package/dist/recipes/chainedRunner.js.map +1 -1
- package/dist/recipes/connectorPreflight.js +30 -0
- package/dist/recipes/connectorPreflight.js.map +1 -1
- package/dist/recipes/haltCategory.d.ts +5 -0
- package/dist/recipes/haltCategory.js +7 -1
- package/dist/recipes/haltCategory.js.map +1 -1
- package/dist/recipes/judgeVerdict.d.ts +10 -0
- package/dist/recipes/judgeVerdict.js +10 -0
- package/dist/recipes/judgeVerdict.js.map +1 -1
- package/dist/recipes/names.d.ts +5 -0
- package/dist/recipes/names.js +10 -5
- package/dist/recipes/names.js.map +1 -1
- package/dist/recipes/parser.js +32 -9
- package/dist/recipes/parser.js.map +1 -1
- package/dist/recipes/pricing/costRouter.d.ts +43 -0
- package/dist/recipes/pricing/costRouter.js +44 -0
- package/dist/recipes/pricing/costRouter.js.map +1 -0
- package/dist/recipes/pricing/priceTable.d.ts +76 -0
- package/dist/recipes/pricing/priceTable.js +144 -0
- package/dist/recipes/pricing/priceTable.js.map +1 -0
- package/dist/recipes/runBudget.d.ts +82 -32
- package/dist/recipes/runBudget.js +182 -49
- package/dist/recipes/runBudget.js.map +1 -1
- package/dist/recipes/schema.d.ts +25 -4
- package/dist/recipes/schemaGenerator.d.ts +9 -0
- package/dist/recipes/schemaGenerator.js +386 -75
- package/dist/recipes/schemaGenerator.js.map +1 -1
- package/dist/recipes/simulation/aggregateRunRisk.d.ts +43 -0
- package/dist/recipes/simulation/aggregateRunRisk.js +117 -0
- package/dist/recipes/simulation/aggregateRunRisk.js.map +1 -0
- package/dist/recipes/simulation/costProjector.d.ts +32 -0
- package/dist/recipes/simulation/costProjector.js +194 -0
- package/dist/recipes/simulation/costProjector.js.map +1 -0
- package/dist/recipes/simulation/sideEffects.d.ts +32 -0
- package/dist/recipes/simulation/sideEffects.js +62 -0
- package/dist/recipes/simulation/sideEffects.js.map +1 -0
- package/dist/recipes/simulation/simulate.d.ts +36 -0
- package/dist/recipes/simulation/simulate.js +264 -0
- package/dist/recipes/simulation/simulate.js.map +1 -0
- package/dist/recipes/simulation/simulateMockedRun.d.ts +52 -0
- package/dist/recipes/simulation/simulateMockedRun.js +72 -0
- package/dist/recipes/simulation/simulateMockedRun.js.map +1 -0
- package/dist/recipes/simulation/synthesizeMockedOutputs.d.ts +31 -0
- package/dist/recipes/simulation/synthesizeMockedOutputs.js +50 -0
- package/dist/recipes/simulation/synthesizeMockedOutputs.js.map +1 -0
- package/dist/recipes/simulation/types.d.ts +198 -0
- package/dist/recipes/simulation/types.js +30 -0
- package/dist/recipes/simulation/types.js.map +1 -0
- package/dist/recipes/stepObservation.d.ts +12 -0
- package/dist/recipes/stepObservation.js +21 -1
- package/dist/recipes/stepObservation.js.map +1 -1
- package/dist/recipes/tools/airtable.d.ts +15 -0
- package/dist/recipes/tools/airtable.js +240 -0
- package/dist/recipes/tools/airtable.js.map +1 -0
- package/dist/recipes/tools/caldiy.d.ts +13 -0
- package/dist/recipes/tools/caldiy.js +214 -0
- package/dist/recipes/tools/caldiy.js.map +1 -0
- package/dist/recipes/tools/circleci.d.ts +10 -0
- package/dist/recipes/tools/circleci.js +204 -0
- package/dist/recipes/tools/circleci.js.map +1 -0
- package/dist/recipes/tools/cloudflare.d.ts +13 -0
- package/dist/recipes/tools/cloudflare.js +211 -0
- package/dist/recipes/tools/cloudflare.js.map +1 -0
- package/dist/recipes/tools/docs.d.ts +18 -0
- package/dist/recipes/tools/docs.js +94 -0
- package/dist/recipes/tools/docs.js.map +1 -0
- package/dist/recipes/tools/elasticsearch.d.ts +11 -0
- package/dist/recipes/tools/elasticsearch.js +156 -0
- package/dist/recipes/tools/elasticsearch.js.map +1 -0
- package/dist/recipes/tools/figma.d.ts +12 -0
- package/dist/recipes/tools/figma.js +194 -0
- package/dist/recipes/tools/figma.js.map +1 -0
- package/dist/recipes/tools/grafana.d.ts +11 -0
- package/dist/recipes/tools/grafana.js +216 -0
- package/dist/recipes/tools/grafana.js.map +1 -0
- package/dist/recipes/tools/http.d.ts +1 -1
- package/dist/recipes/tools/http.js +10 -28
- package/dist/recipes/tools/http.js.map +1 -1
- package/dist/recipes/tools/index.d.ts +26 -0
- package/dist/recipes/tools/index.js +26 -0
- package/dist/recipes/tools/index.js.map +1 -1
- package/dist/recipes/tools/monday.d.ts +22 -0
- package/dist/recipes/tools/monday.js +242 -0
- package/dist/recipes/tools/monday.js.map +1 -0
- package/dist/recipes/tools/obsidian.d.ts +15 -0
- package/dist/recipes/tools/obsidian.js +172 -0
- package/dist/recipes/tools/obsidian.js.map +1 -0
- package/dist/recipes/tools/paystack.d.ts +11 -0
- package/dist/recipes/tools/paystack.js +211 -0
- package/dist/recipes/tools/paystack.js.map +1 -0
- package/dist/recipes/tools/pipedrive.d.ts +16 -0
- package/dist/recipes/tools/pipedrive.js +233 -0
- package/dist/recipes/tools/pipedrive.js.map +1 -0
- package/dist/recipes/tools/postgres.d.ts +15 -0
- package/dist/recipes/tools/postgres.js +185 -0
- package/dist/recipes/tools/postgres.js.map +1 -0
- package/dist/recipes/tools/posthog.d.ts +16 -0
- package/dist/recipes/tools/posthog.js +219 -0
- package/dist/recipes/tools/posthog.js.map +1 -0
- package/dist/recipes/tools/redis.d.ts +9 -0
- package/dist/recipes/tools/redis.js +140 -0
- package/dist/recipes/tools/redis.js.map +1 -0
- package/dist/recipes/tools/resend.d.ts +8 -0
- package/dist/recipes/tools/resend.js +153 -0
- package/dist/recipes/tools/resend.js.map +1 -0
- package/dist/recipes/tools/salesforce.d.ts +16 -0
- package/dist/recipes/tools/salesforce.js +184 -0
- package/dist/recipes/tools/salesforce.js.map +1 -0
- package/dist/recipes/tools/sendgrid.d.ts +9 -0
- package/dist/recipes/tools/sendgrid.js +174 -0
- package/dist/recipes/tools/sendgrid.js.map +1 -0
- package/dist/recipes/tools/shopify.d.ts +16 -0
- package/dist/recipes/tools/shopify.js +265 -0
- package/dist/recipes/tools/shopify.js.map +1 -0
- package/dist/recipes/tools/snowflake.d.ts +16 -0
- package/dist/recipes/tools/snowflake.js +173 -0
- package/dist/recipes/tools/snowflake.js.map +1 -0
- package/dist/recipes/tools/stripe.js +13 -12
- package/dist/recipes/tools/stripe.js.map +1 -1
- package/dist/recipes/tools/supabase.d.ts +9 -0
- package/dist/recipes/tools/supabase.js +132 -0
- package/dist/recipes/tools/supabase.js.map +1 -0
- package/dist/recipes/tools/todoist.d.ts +15 -0
- package/dist/recipes/tools/todoist.js +227 -0
- package/dist/recipes/tools/todoist.js.map +1 -0
- package/dist/recipes/tools/twilio.d.ts +11 -0
- package/dist/recipes/tools/twilio.js +180 -0
- package/dist/recipes/tools/twilio.js.map +1 -0
- package/dist/recipes/tools/vercel.d.ts +9 -0
- package/dist/recipes/tools/vercel.js +145 -0
- package/dist/recipes/tools/vercel.js.map +1 -0
- package/dist/recipes/tools/webflow.d.ts +11 -0
- package/dist/recipes/tools/webflow.js +243 -0
- package/dist/recipes/tools/webflow.js.map +1 -0
- package/dist/recipes/tools/woocommerce.d.ts +18 -0
- package/dist/recipes/tools/woocommerce.js +259 -0
- package/dist/recipes/tools/woocommerce.js.map +1 -0
- package/dist/recipes/tools/wrapConnectorExecute.d.ts +25 -0
- package/dist/recipes/tools/wrapConnectorExecute.js +37 -0
- package/dist/recipes/tools/wrapConnectorExecute.js.map +1 -0
- package/dist/recipes/validation.js +264 -0
- package/dist/recipes/validation.js.map +1 -1
- package/dist/recipes/yamlRunner.d.ts +112 -3
- package/dist/recipes/yamlRunner.js +482 -19
- package/dist/recipes/yamlRunner.js.map +1 -1
- package/dist/runLog.d.ts +46 -0
- package/dist/runLog.js +4 -0
- package/dist/runLog.js.map +1 -1
- package/dist/schemas/recipe.v1.json +217 -11
- package/dist/server.d.ts +3 -0
- package/dist/server.js +4 -0
- package/dist/server.js.map +1 -1
- package/dist/streamableHttp.js +3 -2
- package/dist/streamableHttp.js.map +1 -1
- package/dist/tools/gitWrite.js +5 -1
- package/dist/tools/gitWrite.js.map +1 -1
- package/dist/tools/terminal.js +15 -49
- package/dist/tools/terminal.js.map +1 -1
- package/dist/transport.d.ts +1 -0
- package/dist/transport.js +7 -0
- package/dist/transport.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mcp-stdio-shim.cjs +218 -84
- package/templates/recipes/incident-to-pr.yaml +187 -0
|
@@ -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;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AAU,EAAE;YACV,IAAI,EAAE,aAAa,CAAC,IAAI;SACzB;QACD,QAAQ,EAAE,EAAE;KACb;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;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,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Postgres tools — read-only schema introspection plus an arbitrary-SQL query
|
|
3
|
+
* step.
|
|
4
|
+
*
|
|
5
|
+
* Self-registering tool module for the recipe tool registry. Wraps the Postgres
|
|
6
|
+
* connector's `listTables` / `describeTable` schema reads, the `query` SQL
|
|
7
|
+
* runner, and the `explain` query-plan endpoint.
|
|
8
|
+
*
|
|
9
|
+
* The connector enforces a read-only-statement guard (SELECT / SHOW / EXPLAIN /
|
|
10
|
+
* WITH) at runtime, but `postgres.query` runs ARBITRARY SQL supplied by the
|
|
11
|
+
* recipe author, so it is declared `isWrite: true` so the approval queue gates
|
|
12
|
+
* it appropriately. The schema-introspection reads (`list_tables`,
|
|
13
|
+
* `describe_table`) and `explain` are non-mutating, so they are `isWrite: false`.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Postgres tools — read-only schema introspection plus an arbitrary-SQL query
|
|
3
|
+
* step.
|
|
4
|
+
*
|
|
5
|
+
* Self-registering tool module for the recipe tool registry. Wraps the Postgres
|
|
6
|
+
* connector's `listTables` / `describeTable` schema reads, the `query` SQL
|
|
7
|
+
* runner, and the `explain` query-plan endpoint.
|
|
8
|
+
*
|
|
9
|
+
* The connector enforces a read-only-statement guard (SELECT / SHOW / EXPLAIN /
|
|
10
|
+
* WITH) at runtime, but `postgres.query` runs ARBITRARY SQL supplied by the
|
|
11
|
+
* recipe author, so it is declared `isWrite: true` so the approval queue gates
|
|
12
|
+
* it appropriately. The schema-introspection reads (`list_tables`,
|
|
13
|
+
* `describe_table`) and `explain` are non-mutating, so they are `isWrite: false`.
|
|
14
|
+
*/
|
|
15
|
+
import { CommonSchemas, registerTool } from "../toolRegistry.js";
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// postgres.list_tables
|
|
18
|
+
// ============================================================================
|
|
19
|
+
registerTool({
|
|
20
|
+
id: "postgres.list_tables",
|
|
21
|
+
namespace: "postgres",
|
|
22
|
+
description: "List Postgres tables, optionally restricted to a single schema. Excludes the pg_catalog / information_schema system schemas.",
|
|
23
|
+
paramsSchema: {
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: {
|
|
26
|
+
schema: {
|
|
27
|
+
type: "string",
|
|
28
|
+
description: "Optional schema name to restrict results to",
|
|
29
|
+
},
|
|
30
|
+
into: CommonSchemas.into,
|
|
31
|
+
},
|
|
32
|
+
required: [],
|
|
33
|
+
},
|
|
34
|
+
outputSchema: {
|
|
35
|
+
type: "array",
|
|
36
|
+
items: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
table_schema: { type: "string" },
|
|
40
|
+
table_name: { type: "string" },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
riskDefault: "low",
|
|
45
|
+
isWrite: false,
|
|
46
|
+
isConnector: true,
|
|
47
|
+
execute: async ({ params }) => {
|
|
48
|
+
const { getPostgresConnector } = await import("../../connectors/postgres.js");
|
|
49
|
+
const connector = getPostgresConnector();
|
|
50
|
+
const result = await connector.listTables(typeof params.schema === "string" ? params.schema : undefined);
|
|
51
|
+
return JSON.stringify(result);
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
// ============================================================================
|
|
55
|
+
// postgres.describe_table
|
|
56
|
+
// ============================================================================
|
|
57
|
+
registerTool({
|
|
58
|
+
id: "postgres.describe_table",
|
|
59
|
+
namespace: "postgres",
|
|
60
|
+
description: "Describe the columns of a Postgres table (name, data type, nullability, default). Defaults to the public schema.",
|
|
61
|
+
paramsSchema: {
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
table: {
|
|
65
|
+
type: "string",
|
|
66
|
+
description: "Table name to describe",
|
|
67
|
+
},
|
|
68
|
+
schema: {
|
|
69
|
+
type: "string",
|
|
70
|
+
description: "Schema the table lives in (default public)",
|
|
71
|
+
},
|
|
72
|
+
into: CommonSchemas.into,
|
|
73
|
+
},
|
|
74
|
+
required: ["table"],
|
|
75
|
+
},
|
|
76
|
+
outputSchema: {
|
|
77
|
+
type: "array",
|
|
78
|
+
items: {
|
|
79
|
+
type: "object",
|
|
80
|
+
properties: {
|
|
81
|
+
column_name: { type: "string" },
|
|
82
|
+
data_type: { type: "string" },
|
|
83
|
+
is_nullable: { type: "string" },
|
|
84
|
+
column_default: { type: ["string", "null"] },
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
riskDefault: "low",
|
|
89
|
+
isWrite: false,
|
|
90
|
+
isConnector: true,
|
|
91
|
+
execute: async ({ params }) => {
|
|
92
|
+
const { getPostgresConnector } = await import("../../connectors/postgres.js");
|
|
93
|
+
const connector = getPostgresConnector();
|
|
94
|
+
const result = await connector.describeTable(params.table, typeof params.schema === "string" ? params.schema : undefined);
|
|
95
|
+
return JSON.stringify(result);
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
// ============================================================================
|
|
99
|
+
// postgres.query (write-gated)
|
|
100
|
+
// ============================================================================
|
|
101
|
+
registerTool({
|
|
102
|
+
id: "postgres.query",
|
|
103
|
+
namespace: "postgres",
|
|
104
|
+
description: "Run an ARBITRARY SQL statement against Postgres. The connector enforces a read-only guard (SELECT / SHOW / EXPLAIN / WITH) at runtime, but because the SQL is author-supplied this step is treated as a write and is gated by the approval queue. Supports positional bind parameters and a row-count cap.",
|
|
105
|
+
paramsSchema: {
|
|
106
|
+
type: "object",
|
|
107
|
+
properties: {
|
|
108
|
+
sql: {
|
|
109
|
+
type: "string",
|
|
110
|
+
description: "SQL statement to execute (read-only statements only)",
|
|
111
|
+
},
|
|
112
|
+
params: {
|
|
113
|
+
type: "array",
|
|
114
|
+
description: "Positional bind parameters for the statement ($1, $2, …)",
|
|
115
|
+
items: {},
|
|
116
|
+
},
|
|
117
|
+
rowLimit: {
|
|
118
|
+
type: "number",
|
|
119
|
+
description: "Maximum number of rows to return (default 100, max 10000)",
|
|
120
|
+
default: 100,
|
|
121
|
+
},
|
|
122
|
+
into: CommonSchemas.into,
|
|
123
|
+
},
|
|
124
|
+
required: ["sql"],
|
|
125
|
+
},
|
|
126
|
+
outputSchema: {
|
|
127
|
+
type: "object",
|
|
128
|
+
properties: {
|
|
129
|
+
rows: { type: "array", items: { type: "object" } },
|
|
130
|
+
rowCount: { type: "number" },
|
|
131
|
+
fields: {
|
|
132
|
+
type: "array",
|
|
133
|
+
items: {
|
|
134
|
+
type: "object",
|
|
135
|
+
properties: {
|
|
136
|
+
name: { type: "string" },
|
|
137
|
+
dataTypeID: { type: "number" },
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
truncated: { type: "boolean" },
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
riskDefault: "medium",
|
|
145
|
+
isWrite: true,
|
|
146
|
+
isConnector: true,
|
|
147
|
+
execute: async ({ params }) => {
|
|
148
|
+
const { getPostgresConnector } = await import("../../connectors/postgres.js");
|
|
149
|
+
const connector = getPostgresConnector();
|
|
150
|
+
const result = await connector.query(params.sql, Array.isArray(params.params) ? params.params : undefined, typeof params.rowLimit === "number" ? params.rowLimit : undefined);
|
|
151
|
+
return JSON.stringify(result);
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
// ============================================================================
|
|
155
|
+
// postgres.explain
|
|
156
|
+
// ============================================================================
|
|
157
|
+
registerTool({
|
|
158
|
+
id: "postgres.explain",
|
|
159
|
+
namespace: "postgres",
|
|
160
|
+
description: "Return the JSON query plan for a read-only SQL statement via EXPLAIN (FORMAT JSON). Does not execute the statement's effects.",
|
|
161
|
+
paramsSchema: {
|
|
162
|
+
type: "object",
|
|
163
|
+
properties: {
|
|
164
|
+
sql: {
|
|
165
|
+
type: "string",
|
|
166
|
+
description: "SQL statement to explain (read-only statements only)",
|
|
167
|
+
},
|
|
168
|
+
into: CommonSchemas.into,
|
|
169
|
+
},
|
|
170
|
+
required: ["sql"],
|
|
171
|
+
},
|
|
172
|
+
outputSchema: {
|
|
173
|
+
type: "object",
|
|
174
|
+
},
|
|
175
|
+
riskDefault: "low",
|
|
176
|
+
isWrite: false,
|
|
177
|
+
isConnector: true,
|
|
178
|
+
execute: async ({ params }) => {
|
|
179
|
+
const { getPostgresConnector } = await import("../../connectors/postgres.js");
|
|
180
|
+
const connector = getPostgresConnector();
|
|
181
|
+
const result = await connector.explain(params.sql);
|
|
182
|
+
return JSON.stringify(result);
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
//# sourceMappingURL=postgres.js.map
|
|
@@ -0,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,CAAC,OAAO,CAAC,MAAM,CAAC,GAAa,CAAC,CAAC;QAC7D,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 {};
|