patchwork-os 0.2.0-alpha.3 → 0.2.0-alpha.31
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.bridge.md +6 -0
- package/README.md +40 -15
- package/deploy/bootstrap-vps.sh +184 -0
- package/deploy/deploy-dashboard.sh +174 -0
- package/deploy/deploy-landing.sh +79 -0
- package/dist/activationMetrics.d.ts +67 -0
- package/dist/activationMetrics.js +255 -0
- package/dist/activationMetrics.js.map +1 -0
- package/dist/approvalHttp.d.ts +24 -2
- package/dist/approvalHttp.js +150 -10
- package/dist/approvalHttp.js.map +1 -1
- package/dist/approvalQueue.d.ts +16 -1
- package/dist/approvalQueue.js +44 -3
- package/dist/approvalQueue.js.map +1 -1
- package/dist/automation.d.ts +20 -0
- package/dist/automation.js +54 -1
- package/dist/automation.js.map +1 -1
- package/dist/bridge.d.ts +2 -0
- package/dist/bridge.js +55 -130
- package/dist/bridge.js.map +1 -1
- package/dist/bridgeToken.js +57 -19
- package/dist/bridgeToken.js.map +1 -1
- package/dist/ccPermissions.js +6 -4
- package/dist/ccPermissions.js.map +1 -1
- package/dist/claudeOrchestrator.d.ts +1 -1
- package/dist/claudeOrchestrator.js +14 -8
- package/dist/claudeOrchestrator.js.map +1 -1
- package/dist/commands/launchd.d.ts +2 -0
- package/dist/commands/launchd.js +94 -0
- package/dist/commands/launchd.js.map +1 -0
- package/dist/commands/recipe.d.ts +258 -0
- package/dist/commands/recipe.js +1130 -0
- package/dist/commands/recipe.js.map +1 -0
- package/dist/commands/recipeInstall.d.ts +72 -0
- package/dist/commands/recipeInstall.js +339 -0
- package/dist/commands/recipeInstall.js.map +1 -0
- package/dist/config.d.ts +14 -1
- package/dist/config.js +99 -8
- package/dist/config.js.map +1 -1
- package/dist/connectors/baseConnector.d.ts +117 -0
- package/dist/connectors/baseConnector.js +213 -0
- package/dist/connectors/baseConnector.js.map +1 -0
- package/dist/connectors/confluence.d.ts +111 -0
- package/dist/connectors/confluence.js +406 -0
- package/dist/connectors/confluence.js.map +1 -0
- package/dist/connectors/datadog.d.ts +116 -0
- package/dist/connectors/datadog.js +385 -0
- package/dist/connectors/datadog.js.map +1 -0
- package/dist/connectors/fixtureLibrary.d.ts +21 -0
- package/dist/connectors/fixtureLibrary.js +70 -0
- package/dist/connectors/fixtureLibrary.js.map +1 -0
- package/dist/connectors/fixtureRecorder.d.ts +1 -0
- package/dist/connectors/fixtureRecorder.js +35 -0
- package/dist/connectors/fixtureRecorder.js.map +1 -0
- package/dist/connectors/github.d.ts +58 -8
- package/dist/connectors/github.js +312 -84
- package/dist/connectors/github.js.map +1 -1
- package/dist/connectors/gmail.d.ts +4 -1
- package/dist/connectors/gmail.js +79 -16
- package/dist/connectors/gmail.js.map +1 -1
- package/dist/connectors/googleCalendar.d.ts +60 -0
- package/dist/connectors/googleCalendar.js +345 -0
- package/dist/connectors/googleCalendar.js.map +1 -0
- package/dist/connectors/hubspot.d.ts +112 -0
- package/dist/connectors/hubspot.js +408 -0
- package/dist/connectors/hubspot.js.map +1 -0
- package/dist/connectors/intercom.d.ts +102 -0
- package/dist/connectors/intercom.js +402 -0
- package/dist/connectors/intercom.js.map +1 -0
- package/dist/connectors/jira.d.ts +98 -0
- package/dist/connectors/jira.js +379 -0
- package/dist/connectors/jira.js.map +1 -0
- package/dist/connectors/linear.d.ts +69 -19
- package/dist/connectors/linear.js +170 -129
- package/dist/connectors/linear.js.map +1 -1
- package/dist/connectors/mcpClient.d.ts +56 -0
- package/dist/connectors/mcpClient.js +189 -0
- package/dist/connectors/mcpClient.js.map +1 -0
- package/dist/connectors/mcpOAuth.d.ts +84 -0
- package/dist/connectors/mcpOAuth.js +389 -0
- package/dist/connectors/mcpOAuth.js.map +1 -0
- package/dist/connectors/mockConnector.d.ts +28 -0
- package/dist/connectors/mockConnector.js +81 -0
- package/dist/connectors/mockConnector.js.map +1 -0
- package/dist/connectors/notion.d.ts +143 -0
- package/dist/connectors/notion.js +424 -0
- package/dist/connectors/notion.js.map +1 -0
- package/dist/connectors/sentry.d.ts +17 -21
- package/dist/connectors/sentry.js +115 -131
- package/dist/connectors/sentry.js.map +1 -1
- package/dist/connectors/slack.d.ts +50 -0
- package/dist/connectors/slack.js +324 -0
- package/dist/connectors/slack.js.map +1 -0
- package/dist/connectors/stripe.d.ts +116 -0
- package/dist/connectors/stripe.js +379 -0
- package/dist/connectors/stripe.js.map +1 -0
- package/dist/connectors/tokenStorage.d.ts +35 -0
- package/dist/connectors/tokenStorage.js +459 -0
- package/dist/connectors/tokenStorage.js.map +1 -0
- package/dist/connectors/zendesk.d.ts +104 -0
- package/dist/connectors/zendesk.js +424 -0
- package/dist/connectors/zendesk.js.map +1 -0
- package/dist/drivers/gemini/index.d.ts +5 -1
- package/dist/drivers/gemini/index.js +39 -5
- package/dist/drivers/gemini/index.js.map +1 -1
- package/dist/drivers/index.d.ts +5 -0
- package/dist/drivers/index.js +1 -1
- package/dist/drivers/index.js.map +1 -1
- package/dist/featureFlags.d.ts +73 -0
- package/dist/featureFlags.js +203 -0
- package/dist/featureFlags.js.map +1 -0
- package/dist/fp/automationInterpreter.js +1 -0
- package/dist/fp/automationInterpreter.js.map +1 -1
- package/dist/fp/automationProgram.d.ts +1 -1
- package/dist/fp/automationProgram.js.map +1 -1
- package/dist/fp/policyParser.js +17 -0
- package/dist/fp/policyParser.js.map +1 -1
- package/dist/index.js +621 -61
- package/dist/index.js.map +1 -1
- package/dist/installGuard.d.ts +25 -0
- package/dist/installGuard.js +48 -0
- package/dist/installGuard.js.map +1 -0
- package/dist/oauth.d.ts +4 -1
- package/dist/oauth.js +50 -14
- package/dist/oauth.js.map +1 -1
- package/dist/patchworkConfig.d.ts +9 -0
- package/dist/patchworkConfig.js.map +1 -1
- package/dist/recipeOrchestration.d.ts +53 -0
- package/dist/recipeOrchestration.js +272 -0
- package/dist/recipeOrchestration.js.map +1 -0
- package/dist/recipes/RecipeOrchestrator.d.ts +40 -0
- package/dist/recipes/RecipeOrchestrator.js +51 -0
- package/dist/recipes/RecipeOrchestrator.js.map +1 -0
- package/dist/recipes/agentExecutor.d.ts +28 -0
- package/dist/recipes/agentExecutor.js +42 -0
- package/dist/recipes/agentExecutor.js.map +1 -0
- package/dist/recipes/chainedRunner.d.ts +140 -0
- package/dist/recipes/chainedRunner.js +539 -0
- package/dist/recipes/chainedRunner.js.map +1 -0
- package/dist/recipes/dependencyGraph.d.ts +39 -0
- package/dist/recipes/dependencyGraph.js +199 -0
- package/dist/recipes/dependencyGraph.js.map +1 -0
- package/dist/recipes/legacyRecipeCompat.d.ts +2 -0
- package/dist/recipes/legacyRecipeCompat.js +112 -0
- package/dist/recipes/legacyRecipeCompat.js.map +1 -0
- package/dist/recipes/manifest.d.ts +47 -0
- package/dist/recipes/manifest.js +141 -0
- package/dist/recipes/manifest.js.map +1 -0
- package/dist/recipes/nestedRecipeStep.d.ts +58 -0
- package/dist/recipes/nestedRecipeStep.js +95 -0
- package/dist/recipes/nestedRecipeStep.js.map +1 -0
- package/dist/recipes/outputRegistry.d.ts +28 -0
- package/dist/recipes/outputRegistry.js +52 -0
- package/dist/recipes/outputRegistry.js.map +1 -0
- package/dist/recipes/scheduler.d.ts +23 -7
- package/dist/recipes/scheduler.js +131 -41
- package/dist/recipes/scheduler.js.map +1 -1
- package/dist/recipes/schema.d.ts +17 -2
- package/dist/recipes/schemaGenerator.d.ts +28 -0
- package/dist/recipes/schemaGenerator.js +565 -0
- package/dist/recipes/schemaGenerator.js.map +1 -0
- package/dist/recipes/templateEngine.d.ts +62 -0
- package/dist/recipes/templateEngine.js +182 -0
- package/dist/recipes/templateEngine.js.map +1 -0
- package/dist/recipes/toolRegistry.d.ts +181 -0
- package/dist/recipes/toolRegistry.js +300 -0
- package/dist/recipes/toolRegistry.js.map +1 -0
- package/dist/recipes/tools/calendar.d.ts +6 -0
- package/dist/recipes/tools/calendar.js +61 -0
- package/dist/recipes/tools/calendar.js.map +1 -0
- package/dist/recipes/tools/confluence.d.ts +6 -0
- package/dist/recipes/tools/confluence.js +254 -0
- package/dist/recipes/tools/confluence.js.map +1 -0
- package/dist/recipes/tools/datadog.d.ts +6 -0
- package/dist/recipes/tools/datadog.js +239 -0
- package/dist/recipes/tools/datadog.js.map +1 -0
- package/dist/recipes/tools/diagnostics.d.ts +6 -0
- package/dist/recipes/tools/diagnostics.js +36 -0
- package/dist/recipes/tools/diagnostics.js.map +1 -0
- package/dist/recipes/tools/file.d.ts +6 -0
- package/dist/recipes/tools/file.js +170 -0
- package/dist/recipes/tools/file.js.map +1 -0
- package/dist/recipes/tools/git.d.ts +6 -0
- package/dist/recipes/tools/git.js +63 -0
- package/dist/recipes/tools/git.js.map +1 -0
- package/dist/recipes/tools/github.d.ts +6 -0
- package/dist/recipes/tools/github.js +91 -0
- package/dist/recipes/tools/github.js.map +1 -0
- package/dist/recipes/tools/gmail.d.ts +6 -0
- package/dist/recipes/tools/gmail.js +210 -0
- package/dist/recipes/tools/gmail.js.map +1 -0
- package/dist/recipes/tools/hubspot.d.ts +6 -0
- package/dist/recipes/tools/hubspot.js +232 -0
- package/dist/recipes/tools/hubspot.js.map +1 -0
- package/dist/recipes/tools/index.d.ts +22 -0
- package/dist/recipes/tools/index.js +25 -0
- package/dist/recipes/tools/index.js.map +1 -0
- package/dist/recipes/tools/intercom.d.ts +6 -0
- package/dist/recipes/tools/intercom.js +226 -0
- package/dist/recipes/tools/intercom.js.map +1 -0
- package/dist/recipes/tools/linear.d.ts +6 -0
- package/dist/recipes/tools/linear.js +83 -0
- package/dist/recipes/tools/linear.js.map +1 -0
- package/dist/recipes/tools/notion.d.ts +6 -0
- package/dist/recipes/tools/notion.js +278 -0
- package/dist/recipes/tools/notion.js.map +1 -0
- package/dist/recipes/tools/slack.d.ts +6 -0
- package/dist/recipes/tools/slack.js +72 -0
- package/dist/recipes/tools/slack.js.map +1 -0
- package/dist/recipes/tools/stripe.d.ts +6 -0
- package/dist/recipes/tools/stripe.js +265 -0
- package/dist/recipes/tools/stripe.js.map +1 -0
- package/dist/recipes/tools/zendesk.d.ts +6 -0
- package/dist/recipes/tools/zendesk.js +245 -0
- package/dist/recipes/tools/zendesk.js.map +1 -0
- package/dist/recipes/validation.d.ts +13 -0
- package/dist/recipes/validation.js +433 -0
- package/dist/recipes/validation.js.map +1 -0
- package/dist/recipes/yamlRunner.d.ts +87 -0
- package/dist/recipes/yamlRunner.js +693 -409
- package/dist/recipes/yamlRunner.js.map +1 -1
- package/dist/recipesHttp.d.ts +34 -6
- package/dist/recipesHttp.js +285 -15
- package/dist/recipesHttp.js.map +1 -1
- package/dist/riskTier.js +1 -0
- package/dist/riskTier.js.map +1 -1
- package/dist/runLog.d.ts +23 -0
- package/dist/runLog.js +56 -1
- package/dist/runLog.js.map +1 -1
- package/dist/schemas/dry-run-plan.v1.json +139 -0
- package/dist/schemas/recipe.v1.json +684 -0
- package/dist/server.d.ts +32 -1
- package/dist/server.js +980 -97
- package/dist/server.js.map +1 -1
- package/dist/streamableHttp.js +2 -0
- package/dist/streamableHttp.js.map +1 -1
- package/dist/tools/addLinearComment.d.ts +55 -0
- package/dist/tools/addLinearComment.js +72 -0
- package/dist/tools/addLinearComment.js.map +1 -0
- package/dist/tools/bridgeDoctor.js +2 -2
- package/dist/tools/bridgeDoctor.js.map +1 -1
- package/dist/tools/createLinearIssue.d.ts +84 -0
- package/dist/tools/createLinearIssue.js +146 -0
- package/dist/tools/createLinearIssue.js.map +1 -0
- package/dist/tools/fetchCalendarEvents.d.ts +94 -0
- package/dist/tools/fetchCalendarEvents.js +97 -0
- package/dist/tools/fetchCalendarEvents.js.map +1 -0
- package/dist/tools/fetchGithubIssue.d.ts +80 -0
- package/dist/tools/fetchGithubIssue.js +84 -0
- package/dist/tools/fetchGithubIssue.js.map +1 -0
- package/dist/tools/fetchGithubPR.d.ts +89 -0
- package/dist/tools/fetchGithubPR.js +96 -0
- package/dist/tools/fetchGithubPR.js.map +1 -0
- package/dist/tools/fetchSlackProfile.d.ts +43 -0
- package/dist/tools/fetchSlackProfile.js +46 -0
- package/dist/tools/fetchSlackProfile.js.map +1 -0
- package/dist/tools/getConnectorStatus.d.ts +58 -0
- package/dist/tools/getConnectorStatus.js +56 -0
- package/dist/tools/getConnectorStatus.js.map +1 -0
- package/dist/tools/github/actions.js +4 -2
- package/dist/tools/github/actions.js.map +1 -1
- package/dist/tools/github/composite.d.ts +339 -0
- package/dist/tools/github/composite.js +343 -0
- package/dist/tools/github/composite.js.map +1 -0
- package/dist/tools/github/index.d.ts +2 -1
- package/dist/tools/github/index.js +2 -1
- package/dist/tools/github/index.js.map +1 -1
- package/dist/tools/github/issues.js +8 -4
- package/dist/tools/github/issues.js.map +1 -1
- package/dist/tools/github/pr.d.ts +122 -0
- package/dist/tools/github/pr.js +195 -5
- package/dist/tools/github/pr.js.map +1 -1
- package/dist/tools/index.js +32 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/searchTools.js +1 -1
- package/dist/tools/searchTools.js.map +1 -1
- package/dist/tools/slackListChannels.d.ts +65 -0
- package/dist/tools/slackListChannels.js +70 -0
- package/dist/tools/slackListChannels.js.map +1 -0
- package/dist/tools/slackPostMessage.d.ts +57 -0
- package/dist/tools/slackPostMessage.js +77 -0
- package/dist/tools/slackPostMessage.js.map +1 -0
- package/dist/tools/testTraceToSource.js +2 -2
- package/dist/tools/testTraceToSource.js.map +1 -1
- package/dist/tools/updateLinearIssue.d.ts +89 -0
- package/dist/tools/updateLinearIssue.js +117 -0
- package/dist/tools/updateLinearIssue.js.map +1 -0
- package/dist/transport.d.ts +7 -1
- package/dist/transport.js +85 -11
- package/dist/transport.js.map +1 -1
- package/package.json +5 -2
- package/scripts/start-all.sh +56 -19
- package/templates/automation-policies/recipe-authoring.json +25 -0
- package/templates/automation-policy.example.json +6 -0
- package/templates/co.patchwork-os.bridge.plist +34 -0
- package/templates/recipes/ctx-loop-test.yaml +75 -0
- package/templates/recipes/lint-on-save.yaml +1 -2
- package/templates/recipes/morning-brief-slack.yaml +57 -0
- package/templates/recipes/morning-brief.yaml +14 -6
- package/templates/recipes/project-health-check.yaml +50 -0
- package/templates/recipes/sentry-to-linear.yaml +77 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File tools — file.read, file.write, file.append
|
|
3
|
+
*
|
|
4
|
+
* Self-registering tool module for the recipe tool registry.
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
7
|
+
import { dirname } from "node:path";
|
|
8
|
+
import { assertWriteAllowed } from "../../featureFlags.js";
|
|
9
|
+
import { CommonSchemas, registerTool } from "../toolRegistry.js";
|
|
10
|
+
function expandHome(p) {
|
|
11
|
+
if (p.startsWith("~/")) {
|
|
12
|
+
return `${process.env.HOME ?? process.env.USERPROFILE}${p.slice(1)}`;
|
|
13
|
+
}
|
|
14
|
+
return p;
|
|
15
|
+
}
|
|
16
|
+
function ensureDir(p) {
|
|
17
|
+
const dir = dirname(p);
|
|
18
|
+
if (dir && dir !== "." && !existsSync(dir)) {
|
|
19
|
+
mkdirSync(dir, { recursive: true });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// file.read
|
|
24
|
+
// ============================================================================
|
|
25
|
+
registerTool({
|
|
26
|
+
id: "file.read",
|
|
27
|
+
namespace: "file",
|
|
28
|
+
description: "Read file content into context. Supports optional flag to allow missing files.",
|
|
29
|
+
paramsSchema: {
|
|
30
|
+
type: "object",
|
|
31
|
+
properties: {
|
|
32
|
+
path: CommonSchemas.filePath,
|
|
33
|
+
optional: CommonSchemas.optional,
|
|
34
|
+
into: CommonSchemas.into,
|
|
35
|
+
},
|
|
36
|
+
required: ["path"],
|
|
37
|
+
},
|
|
38
|
+
outputSchema: {
|
|
39
|
+
type: "string",
|
|
40
|
+
description: "File content as string (or empty if optional and missing)",
|
|
41
|
+
},
|
|
42
|
+
riskDefault: "low",
|
|
43
|
+
isWrite: false,
|
|
44
|
+
execute: async ({ params, step, deps }) => {
|
|
45
|
+
const p = expandHome(params.path);
|
|
46
|
+
const optional = step.optional ?? false;
|
|
47
|
+
try {
|
|
48
|
+
return deps.readFile(p);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
if (optional)
|
|
52
|
+
return "";
|
|
53
|
+
throw new Error(`file.read: could not read ${p}`);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
// ============================================================================
|
|
58
|
+
// file.write
|
|
59
|
+
// ============================================================================
|
|
60
|
+
registerTool({
|
|
61
|
+
id: "file.write",
|
|
62
|
+
namespace: "file",
|
|
63
|
+
description: "Write content to a file path (creates directories as needed).",
|
|
64
|
+
paramsSchema: {
|
|
65
|
+
type: "object",
|
|
66
|
+
properties: {
|
|
67
|
+
path: CommonSchemas.filePath,
|
|
68
|
+
content: {
|
|
69
|
+
type: "string",
|
|
70
|
+
description: "Content to write (supports {{template}} substitution)",
|
|
71
|
+
},
|
|
72
|
+
into: CommonSchemas.into,
|
|
73
|
+
},
|
|
74
|
+
required: ["path", "content"],
|
|
75
|
+
},
|
|
76
|
+
outputSchema: {
|
|
77
|
+
type: "object",
|
|
78
|
+
properties: {
|
|
79
|
+
path: { type: "string" },
|
|
80
|
+
bytesWritten: { type: "number" },
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
riskDefault: "medium",
|
|
84
|
+
isWrite: true,
|
|
85
|
+
execute: async ({ params, deps }) => {
|
|
86
|
+
assertWriteAllowed("file.write");
|
|
87
|
+
const p = expandHome(params.path);
|
|
88
|
+
const content = params.content;
|
|
89
|
+
ensureDir(p);
|
|
90
|
+
deps.writeFile(p, content);
|
|
91
|
+
return JSON.stringify({ path: p, bytesWritten: content.length });
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
// ============================================================================
|
|
95
|
+
// file.append
|
|
96
|
+
// ============================================================================
|
|
97
|
+
registerTool({
|
|
98
|
+
id: "file.append",
|
|
99
|
+
namespace: "file",
|
|
100
|
+
description: "Append content to a file (creates if missing). Supports conditional 'when' clause.",
|
|
101
|
+
paramsSchema: {
|
|
102
|
+
type: "object",
|
|
103
|
+
properties: {
|
|
104
|
+
path: CommonSchemas.filePath,
|
|
105
|
+
content: {
|
|
106
|
+
type: "string",
|
|
107
|
+
description: "Content to append (supports {{template}} substitution)",
|
|
108
|
+
},
|
|
109
|
+
when: CommonSchemas.when,
|
|
110
|
+
into: CommonSchemas.into,
|
|
111
|
+
},
|
|
112
|
+
required: ["path", "content"],
|
|
113
|
+
},
|
|
114
|
+
outputSchema: {
|
|
115
|
+
type: "object",
|
|
116
|
+
properties: {
|
|
117
|
+
path: { type: "string" },
|
|
118
|
+
bytesAppended: { type: "number" },
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
riskDefault: "medium",
|
|
122
|
+
isWrite: true,
|
|
123
|
+
execute: async ({ params, step, deps }) => {
|
|
124
|
+
assertWriteAllowed("file.append");
|
|
125
|
+
const p = expandHome(params.path);
|
|
126
|
+
const content = params.content;
|
|
127
|
+
// 'when' condition is evaluated before executeStep is called in yamlRunner
|
|
128
|
+
// but we check here too for direct registry usage
|
|
129
|
+
const when = step.when;
|
|
130
|
+
if (when && !evalCondition(when, {})) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
ensureDir(p);
|
|
134
|
+
deps.appendFile(p, content);
|
|
135
|
+
return JSON.stringify({ path: p, bytesAppended: content.length });
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* Minimal condition evaluator for 'when' clauses.
|
|
140
|
+
* Note: yamlRunner.ts has a more complete evalWhen that runs before executeStep.
|
|
141
|
+
* This is a fallback for direct registry usage.
|
|
142
|
+
*/
|
|
143
|
+
function evalCondition(expr, _ctx) {
|
|
144
|
+
// Simple numeric comparisons: "N > 0"
|
|
145
|
+
const match = expr.match(/^\s*(\w+)\s*([><=!]+)\s*(\d+)\s*$/);
|
|
146
|
+
if (match) {
|
|
147
|
+
const [, _var, op, val] = match;
|
|
148
|
+
if (!op || !val)
|
|
149
|
+
return false;
|
|
150
|
+
const num = 0; // Would resolve from ctx in full implementation
|
|
151
|
+
const cmp = parseInt(val, 10);
|
|
152
|
+
switch (op) {
|
|
153
|
+
case ">":
|
|
154
|
+
return num > cmp;
|
|
155
|
+
case ">=":
|
|
156
|
+
return num >= cmp;
|
|
157
|
+
case "<":
|
|
158
|
+
return num < cmp;
|
|
159
|
+
case "<=":
|
|
160
|
+
return num <= cmp;
|
|
161
|
+
case "==":
|
|
162
|
+
return num === cmp;
|
|
163
|
+
case "!=":
|
|
164
|
+
return num !== cmp;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Default: evaluate truthy
|
|
168
|
+
return expr.length > 0;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/recipes/tools/file.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE,SAAS,UAAU,CAAC,CAAS;IAC3B,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAA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EAAE,GAAG,CAAC,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG;YAAE,OAAO,KAAK,CAAC;QAC9B,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,gDAAgD;QAC/D,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC9B,QAAQ,EAAE,EAAE,CAAC;YACX,KAAK,GAAG;gBACN,OAAO,GAAG,GAAG,GAAG,CAAC;YACnB,KAAK,IAAI;gBACP,OAAO,GAAG,IAAI,GAAG,CAAC;YACpB,KAAK,GAAG;gBACN,OAAO,GAAG,GAAG,GAAG,CAAC;YACnB,KAAK,IAAI;gBACP,OAAO,GAAG,IAAI,GAAG,CAAC;YACpB,KAAK,IAAI;gBACP,OAAO,GAAG,KAAK,GAAG,CAAC;YACrB,KAAK,IAAI;gBACP,OAAO,GAAG,KAAK,GAAG,CAAC;QACvB,CAAC;IACH,CAAC;IACD,2BAA2B;IAC3B,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git tools — git.log_since, git.stale_branches
|
|
3
|
+
*
|
|
4
|
+
* Self-registering tool module for the recipe tool registry.
|
|
5
|
+
*/
|
|
6
|
+
import { CommonSchemas, registerTool } from "../toolRegistry.js";
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// git.log_since
|
|
9
|
+
// ============================================================================
|
|
10
|
+
registerTool({
|
|
11
|
+
id: "git.log_since",
|
|
12
|
+
namespace: "git",
|
|
13
|
+
description: "Get git log since a time expression (e.g., '24h', '7d', '2026-01-01').",
|
|
14
|
+
paramsSchema: {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: {
|
|
17
|
+
since: CommonSchemas.since,
|
|
18
|
+
into: CommonSchemas.into,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
outputSchema: {
|
|
22
|
+
type: "string",
|
|
23
|
+
description: "Git log output as newline-separated commits",
|
|
24
|
+
},
|
|
25
|
+
riskDefault: "low",
|
|
26
|
+
isWrite: false,
|
|
27
|
+
execute: async ({ params, deps }) => {
|
|
28
|
+
const since = params.since ?? "24h";
|
|
29
|
+
// Use injected gitLogSince for testability
|
|
30
|
+
return deps.gitLogSince(since, deps.workdir);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// git.stale_branches
|
|
35
|
+
// ============================================================================
|
|
36
|
+
registerTool({
|
|
37
|
+
id: "git.stale_branches",
|
|
38
|
+
namespace: "git",
|
|
39
|
+
description: "List branches with no activity in N days.",
|
|
40
|
+
paramsSchema: {
|
|
41
|
+
type: "object",
|
|
42
|
+
properties: {
|
|
43
|
+
days: {
|
|
44
|
+
type: "number",
|
|
45
|
+
description: "Number of days of inactivity to consider stale",
|
|
46
|
+
default: 30,
|
|
47
|
+
},
|
|
48
|
+
into: CommonSchemas.into,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
outputSchema: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "List of stale branches with last commit dates",
|
|
54
|
+
},
|
|
55
|
+
riskDefault: "low",
|
|
56
|
+
isWrite: false,
|
|
57
|
+
execute: async ({ params, deps }) => {
|
|
58
|
+
const days = typeof params.days === "number" ? params.days : 30;
|
|
59
|
+
// Use injected gitStaleBranches for testability
|
|
60
|
+
return deps.gitStaleBranches(days, deps.workdir);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../../src/recipes/tools/git.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,YAAY,CAAC;IACX,EA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AAC,CAAC,EAAE,CAAC;QAChE,gDAAgD;QAChD,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub tools — github.list_issues, github.list_prs
|
|
3
|
+
*
|
|
4
|
+
* Self-registering tool module for the recipe tool registry.
|
|
5
|
+
*/
|
|
6
|
+
import { CommonSchemas, registerTool } from "../toolRegistry.js";
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// github.list_issues
|
|
9
|
+
// ============================================================================
|
|
10
|
+
registerTool({
|
|
11
|
+
id: "github.list_issues",
|
|
12
|
+
namespace: "github",
|
|
13
|
+
description: "List GitHub issues assigned to a user or matching filters.",
|
|
14
|
+
paramsSchema: {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: {
|
|
17
|
+
repo: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "Repository in 'owner/repo' format (omit for all accessible repos)",
|
|
20
|
+
},
|
|
21
|
+
assignee: {
|
|
22
|
+
type: "string",
|
|
23
|
+
description: "User to filter by (use '@me' for current user)",
|
|
24
|
+
default: "@me",
|
|
25
|
+
},
|
|
26
|
+
max: CommonSchemas.max,
|
|
27
|
+
into: CommonSchemas.into,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
outputSchema: {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: {
|
|
33
|
+
count: { type: "number" },
|
|
34
|
+
issues: { type: "array" },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
riskDefault: "low",
|
|
38
|
+
isWrite: false,
|
|
39
|
+
isConnector: true,
|
|
40
|
+
execute: async ({ params }) => {
|
|
41
|
+
const { listIssues } = await import("../../connectors/github.js");
|
|
42
|
+
const repo = params.repo ? String(params.repo) : undefined;
|
|
43
|
+
const assignee = params.assignee ? String(params.assignee) : "@me";
|
|
44
|
+
const limit = typeof params.max === "number" ? params.max : 20;
|
|
45
|
+
const issues = await listIssues({ repo, assignee, limit });
|
|
46
|
+
return JSON.stringify({ count: issues.length, issues });
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
// ============================================================================
|
|
50
|
+
// github.list_prs
|
|
51
|
+
// ============================================================================
|
|
52
|
+
registerTool({
|
|
53
|
+
id: "github.list_prs",
|
|
54
|
+
namespace: "github",
|
|
55
|
+
description: "List GitHub pull requests authored by or involving a user.",
|
|
56
|
+
paramsSchema: {
|
|
57
|
+
type: "object",
|
|
58
|
+
properties: {
|
|
59
|
+
repo: {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "Repository in 'owner/repo' format (omit for all accessible repos)",
|
|
62
|
+
},
|
|
63
|
+
author: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Author to filter by (use '@me' for current user)",
|
|
66
|
+
default: "@me",
|
|
67
|
+
},
|
|
68
|
+
max: CommonSchemas.max,
|
|
69
|
+
into: CommonSchemas.into,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
outputSchema: {
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: {
|
|
75
|
+
count: { type: "number" },
|
|
76
|
+
prs: { type: "array" },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
riskDefault: "low",
|
|
80
|
+
isWrite: false,
|
|
81
|
+
isConnector: true,
|
|
82
|
+
execute: async ({ params }) => {
|
|
83
|
+
const { listPRs } = await import("../../connectors/github.js");
|
|
84
|
+
const repo = params.repo ? String(params.repo) : undefined;
|
|
85
|
+
const author = params.author ? String(params.author) : "@me";
|
|
86
|
+
const limit = typeof params.max === "number" ? params.max : 20;
|
|
87
|
+
const prs = await listPRs({ repo, author, limit });
|
|
88
|
+
return JSON.stringify({ count: prs.length, prs });
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=github.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.js","s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AC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3D,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7D,MAAM,KAAK,GAAG,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gmail tools — gmail.fetch_unread, gmail.search, gmail.fetch_thread
|
|
3
|
+
*
|
|
4
|
+
* Self-registering tool module for the recipe tool registry.
|
|
5
|
+
*/
|
|
6
|
+
import { CommonSchemas, registerTool } from "../toolRegistry.js";
|
|
7
|
+
async function gmailSearch(query, max, deps) {
|
|
8
|
+
const errorResult = (msg) => JSON.stringify({ count: 0, messages: [], error: msg });
|
|
9
|
+
let token;
|
|
10
|
+
try {
|
|
11
|
+
if (!deps.getGmailToken) {
|
|
12
|
+
return errorResult("Gmail not connected");
|
|
13
|
+
}
|
|
14
|
+
token = await deps.getGmailToken();
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
return errorResult(err instanceof Error ? err.message : "Gmail not connected");
|
|
18
|
+
}
|
|
19
|
+
const fetch = deps.fetchFn || globalThis.fetch;
|
|
20
|
+
try {
|
|
21
|
+
// 1. List messages
|
|
22
|
+
const listUrl = `https://www.googleapis.com/gmail/v1/users/me/messages?q=${encodeURIComponent(query)}&maxResults=${max}`;
|
|
23
|
+
const listRes = await fetch(listUrl, {
|
|
24
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
25
|
+
});
|
|
26
|
+
if (!listRes.ok) {
|
|
27
|
+
return errorResult("Gmail API error");
|
|
28
|
+
}
|
|
29
|
+
const listJson = (await listRes.json());
|
|
30
|
+
const ids = listJson.messages ?? [];
|
|
31
|
+
// 2. Fetch details for each message
|
|
32
|
+
const messages = await Promise.all(ids.slice(0, max).map(async (m) => {
|
|
33
|
+
const detailUrl = `https://www.googleapis.com/gmail/v1/users/me/messages/${m.id}?format=metadata&metadataHeaders=Subject,From,Date`;
|
|
34
|
+
const detailRes = await fetch(detailUrl, {
|
|
35
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
36
|
+
});
|
|
37
|
+
if (!detailRes.ok) {
|
|
38
|
+
return { id: m.id, subject: "", from: "", date: "", snippet: "" };
|
|
39
|
+
}
|
|
40
|
+
const detail = (await detailRes.json());
|
|
41
|
+
const hdrs = detail.payload?.headers ?? [];
|
|
42
|
+
return {
|
|
43
|
+
id: detail.id,
|
|
44
|
+
subject: getHeader(hdrs, "Subject"),
|
|
45
|
+
from: getHeader(hdrs, "From"),
|
|
46
|
+
date: getHeader(hdrs, "Date"),
|
|
47
|
+
snippet: cleanSnippet(detail.snippet ?? ""),
|
|
48
|
+
};
|
|
49
|
+
}));
|
|
50
|
+
return JSON.stringify({ count: messages.length, messages });
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return errorResult("Gmail fetch failed");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function getHeader(headers, name) {
|
|
57
|
+
return (headers.find((h) => h.name.toLowerCase() === name.toLowerCase())?.value ??
|
|
58
|
+
"");
|
|
59
|
+
}
|
|
60
|
+
function cleanSnippet(raw) {
|
|
61
|
+
return raw
|
|
62
|
+
.replace(/[\u00AD\u200B-\u200F\u2060\uFEFF]/g, "")
|
|
63
|
+
.replace(/(\s)\s+/g, "$1")
|
|
64
|
+
.trim()
|
|
65
|
+
.slice(0, 200);
|
|
66
|
+
}
|
|
67
|
+
async function gmailFetchThread(id, deps) {
|
|
68
|
+
const errorResult = (msg) => JSON.stringify({ subject: "", messages: [], error: msg });
|
|
69
|
+
let token;
|
|
70
|
+
try {
|
|
71
|
+
if (!deps.getGmailToken) {
|
|
72
|
+
return errorResult("Gmail not connected");
|
|
73
|
+
}
|
|
74
|
+
token = await deps.getGmailToken();
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
return errorResult(err instanceof Error ? err.message : "Gmail not connected");
|
|
78
|
+
}
|
|
79
|
+
const fetch = deps.fetchFn || globalThis.fetch;
|
|
80
|
+
const res = await fetch(`https://www.googleapis.com/gmail/v1/users/me/threads/${id}?format=metadata`, { headers: { Authorization: `Bearer ${token}` } });
|
|
81
|
+
if (!res.ok) {
|
|
82
|
+
return errorResult(`Gmail API error`);
|
|
83
|
+
}
|
|
84
|
+
const data = await res.json();
|
|
85
|
+
const headers = data.messages?.[0]?.payload?.headers ?? [];
|
|
86
|
+
const subject = headers.find((h) => h.name === "Subject")?.value ?? "";
|
|
87
|
+
return JSON.stringify({
|
|
88
|
+
subject,
|
|
89
|
+
messages: data.messages ?? [],
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function sinceToGmailQuery(since) {
|
|
93
|
+
if (since.includes("d")) {
|
|
94
|
+
return `${since.replace("d", "")}d`;
|
|
95
|
+
}
|
|
96
|
+
if (since.includes("h")) {
|
|
97
|
+
return `${since.replace("h", "")}h`;
|
|
98
|
+
}
|
|
99
|
+
return "1d";
|
|
100
|
+
}
|
|
101
|
+
// ============================================================================
|
|
102
|
+
// gmail.fetch_unread
|
|
103
|
+
// ============================================================================
|
|
104
|
+
registerTool({
|
|
105
|
+
id: "gmail.fetch_unread",
|
|
106
|
+
namespace: "gmail",
|
|
107
|
+
description: "Fetch unread Gmail messages since a time expression.",
|
|
108
|
+
paramsSchema: {
|
|
109
|
+
type: "object",
|
|
110
|
+
properties: {
|
|
111
|
+
since: CommonSchemas.since,
|
|
112
|
+
max: {
|
|
113
|
+
...CommonSchemas.max,
|
|
114
|
+
maximum: 50,
|
|
115
|
+
},
|
|
116
|
+
into: CommonSchemas.into,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
outputSchema: {
|
|
120
|
+
type: "object",
|
|
121
|
+
properties: {
|
|
122
|
+
count: { type: "number" },
|
|
123
|
+
messages: { type: "array" },
|
|
124
|
+
error: { type: "string" },
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
riskDefault: "low",
|
|
128
|
+
isWrite: false,
|
|
129
|
+
isConnector: true,
|
|
130
|
+
execute: async ({ params, deps }) => {
|
|
131
|
+
const since = String(params.since ?? "24h");
|
|
132
|
+
const max = Math.min(typeof params.max === "number" ? params.max : 20, 50);
|
|
133
|
+
const query = `is:unread newer_than:${sinceToGmailQuery(since)}`;
|
|
134
|
+
return gmailSearch(query, max, deps);
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
// ============================================================================
|
|
138
|
+
// gmail.search
|
|
139
|
+
// ============================================================================
|
|
140
|
+
registerTool({
|
|
141
|
+
id: "gmail.search",
|
|
142
|
+
namespace: "gmail",
|
|
143
|
+
description: "Search Gmail with a custom query string.",
|
|
144
|
+
paramsSchema: {
|
|
145
|
+
type: "object",
|
|
146
|
+
properties: {
|
|
147
|
+
query: {
|
|
148
|
+
type: "string",
|
|
149
|
+
description: "Gmail search query (same syntax as Gmail search bar)",
|
|
150
|
+
},
|
|
151
|
+
max: {
|
|
152
|
+
...CommonSchemas.max,
|
|
153
|
+
maximum: 50,
|
|
154
|
+
},
|
|
155
|
+
into: CommonSchemas.into,
|
|
156
|
+
},
|
|
157
|
+
required: ["query"],
|
|
158
|
+
},
|
|
159
|
+
outputSchema: {
|
|
160
|
+
type: "object",
|
|
161
|
+
properties: {
|
|
162
|
+
count: { type: "number" },
|
|
163
|
+
messages: { type: "array" },
|
|
164
|
+
error: { type: "string" },
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
riskDefault: "low",
|
|
168
|
+
isWrite: false,
|
|
169
|
+
isConnector: true,
|
|
170
|
+
execute: async ({ params, deps }) => {
|
|
171
|
+
const query = String(params.query ?? "");
|
|
172
|
+
const max = Math.min(typeof params.max === "number" ? params.max : 10, 50);
|
|
173
|
+
return gmailSearch(query, max, deps);
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
// ============================================================================
|
|
177
|
+
// gmail.fetch_thread
|
|
178
|
+
// ============================================================================
|
|
179
|
+
registerTool({
|
|
180
|
+
id: "gmail.fetch_thread",
|
|
181
|
+
namespace: "gmail",
|
|
182
|
+
description: "Fetch a specific Gmail thread by ID.",
|
|
183
|
+
paramsSchema: {
|
|
184
|
+
type: "object",
|
|
185
|
+
properties: {
|
|
186
|
+
id: {
|
|
187
|
+
type: "string",
|
|
188
|
+
description: "Gmail thread ID",
|
|
189
|
+
},
|
|
190
|
+
into: CommonSchemas.into,
|
|
191
|
+
},
|
|
192
|
+
required: ["id"],
|
|
193
|
+
},
|
|
194
|
+
outputSchema: {
|
|
195
|
+
type: "object",
|
|
196
|
+
properties: {
|
|
197
|
+
subject: { type: "string" },
|
|
198
|
+
messages: { type: "array" },
|
|
199
|
+
error: { type: "string" },
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
riskDefault: "low",
|
|
203
|
+
isWrite: false,
|
|
204
|
+
isConnector: true,
|
|
205
|
+
execute: async ({ params, deps }) => {
|
|
206
|
+
const id = String(params.id ?? "");
|
|
207
|
+
return gmailFetchThread(id, deps);
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
//# sourceMappingURL=gmail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmail.js","sourceRoot":"","sources":["../../../src/recipes/tools/gmail.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBA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