@knocklabs/agent-toolkit 0.1.2 → 0.1.3

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 (83) hide show
  1. package/dist/ai-sdk/index.js +22 -1085
  2. package/dist/ai-sdk/index.js.map +1 -1
  3. package/dist/ai-sdk/tool-converter.js +3 -10
  4. package/dist/ai-sdk/tool-converter.js.map +1 -1
  5. package/dist/chunk-2CNJ4XX6.js +33 -0
  6. package/dist/chunk-2CNJ4XX6.js.map +1 -0
  7. package/dist/chunk-3LZK6RH6.js +29 -0
  8. package/dist/chunk-3LZK6RH6.js.map +1 -0
  9. package/dist/chunk-4VR65G5W.js +66 -0
  10. package/dist/chunk-4VR65G5W.js.map +1 -0
  11. package/dist/chunk-6H3BXH2Y.js +15 -0
  12. package/dist/chunk-6H3BXH2Y.js.map +1 -0
  13. package/dist/chunk-BY4KQPUO.js +39 -0
  14. package/dist/chunk-BY4KQPUO.js.map +1 -0
  15. package/dist/chunk-DSRTYV37.js +39 -0
  16. package/dist/chunk-DSRTYV37.js.map +1 -0
  17. package/dist/chunk-JTYQTWCX.js +75 -0
  18. package/dist/chunk-JTYQTWCX.js.map +1 -0
  19. package/dist/chunk-NZB2TMJW.js +92 -0
  20. package/dist/chunk-NZB2TMJW.js.map +1 -0
  21. package/dist/chunk-O6DWF42E.js +31 -0
  22. package/dist/chunk-O6DWF42E.js.map +1 -0
  23. package/dist/chunk-OD5VHBGN.js +32 -0
  24. package/dist/chunk-OD5VHBGN.js.map +1 -0
  25. package/dist/chunk-PDMA6RIB.js +19 -0
  26. package/dist/chunk-PDMA6RIB.js.map +1 -0
  27. package/dist/chunk-RYMJEH6P.js +140 -0
  28. package/dist/chunk-RYMJEH6P.js.map +1 -0
  29. package/dist/chunk-THLK376Y.js +191 -0
  30. package/dist/chunk-THLK376Y.js.map +1 -0
  31. package/dist/chunk-TLHETJRF.js +75 -0
  32. package/dist/chunk-TLHETJRF.js.map +1 -0
  33. package/dist/chunk-TOBLV65T.js +30 -0
  34. package/dist/chunk-TOBLV65T.js.map +1 -0
  35. package/dist/chunk-VJFA3ZVW.js +210 -0
  36. package/dist/chunk-VJFA3ZVW.js.map +1 -0
  37. package/dist/chunk-WB4XCCUS.js +19 -0
  38. package/dist/chunk-WB4XCCUS.js.map +1 -0
  39. package/dist/chunk-XRQWR3LY.js +184 -0
  40. package/dist/chunk-XRQWR3LY.js.map +1 -0
  41. package/dist/chunk-XUYE3AGB.js +27 -0
  42. package/dist/chunk-XUYE3AGB.js.map +1 -0
  43. package/dist/lib/knock-client.js +3 -24
  44. package/dist/lib/knock-client.js.map +1 -1
  45. package/dist/lib/knock-tool.js +3 -25
  46. package/dist/lib/knock-tool.js.map +1 -1
  47. package/dist/lib/tools/channels.js +5 -49
  48. package/dist/lib/tools/channels.js.map +1 -1
  49. package/dist/lib/tools/commits.js +5 -93
  50. package/dist/lib/tools/commits.js.map +1 -1
  51. package/dist/lib/tools/email-layouts.js +5 -55
  52. package/dist/lib/tools/email-layouts.js.map +1 -1
  53. package/dist/lib/tools/environments.js +5 -47
  54. package/dist/lib/tools/environments.js.map +1 -1
  55. package/dist/lib/tools/index.js +17 -1016
  56. package/dist/lib/tools/index.js.map +1 -1
  57. package/dist/lib/tools/message-types.js +5 -209
  58. package/dist/lib/tools/message-types.js.map +1 -1
  59. package/dist/lib/tools/messages.js +5 -50
  60. package/dist/lib/tools/messages.js.map +1 -1
  61. package/dist/lib/tools/objects.js +5 -158
  62. package/dist/lib/tools/objects.js.map +1 -1
  63. package/dist/lib/tools/partials.js +5 -55
  64. package/dist/lib/tools/partials.js.map +1 -1
  65. package/dist/lib/tools/tenants.js +5 -93
  66. package/dist/lib/tools/tenants.js.map +1 -1
  67. package/dist/lib/tools/users.js +5 -228
  68. package/dist/lib/tools/users.js.map +1 -1
  69. package/dist/lib/tools/workflows.js +5 -202
  70. package/dist/lib/tools/workflows.js.map +1 -1
  71. package/dist/lib/utils.js +18 -1071
  72. package/dist/lib/utils.js.map +1 -1
  73. package/dist/modelcontextprotocol/adapter.js +3 -22
  74. package/dist/modelcontextprotocol/adapter.js.map +1 -1
  75. package/dist/modelcontextprotocol/index.js +17 -976
  76. package/dist/modelcontextprotocol/index.js.map +1 -1
  77. package/dist/modelcontextprotocol/local-server.js +25 -1041
  78. package/dist/modelcontextprotocol/local-server.js.map +1 -1
  79. package/dist/openai/index.js +22 -1089
  80. package/dist/openai/index.js.map +1 -1
  81. package/dist/openai/tool-converter.js +3 -14
  82. package/dist/openai/tool-converter.js.map +1 -1
  83. package/package.json +3 -3
@@ -1,52 +1,8 @@
1
- // src/lib/knock-tool.ts
2
- import { z } from "zod";
3
- var trimLines = (text) => text.split("\n").map((l) => l.trim()).filter(Boolean).join("\n");
4
- var KnockTool = (args) => {
5
- const { execute, ...restOfArgs } = args;
6
- const parameters = restOfArgs.parameters ? restOfArgs.parameters : z.object({});
7
- const schemaEntries = Object.entries(parameters.shape);
8
- const argsStr = schemaEntries.length === 0 ? "Takes no arguments" : schemaEntries.map(([key, value]) => {
9
- return `- ${key}: ${value.description || ""}`;
10
- }).join("\n");
11
- const fullDescription = trimLines(`
12
- Tool name:
13
- ${args.name}
14
- Description:
15
- ${args.description}.
16
- Arguments:
17
- ${argsStr}
18
- `);
19
- return {
20
- ...restOfArgs,
21
- parameters,
22
- fullDescription,
23
- bindExecute: (knockClient, config) => execute(knockClient, config)
24
- };
25
- };
26
-
27
- // src/lib/tools/channels.ts
28
- var listChannels = KnockTool({
29
- method: "list_channels",
30
- name: "List channels",
31
- description: `
32
- Returns a list of all of the channels configured in the account. Each channel returns information about the type of channel it is (email, sms, push, etc), and the provider that's used to power the channel.
33
-
34
- Use this tool when you need to know about the channels configured in the Knock account, like when configuring a workflow.
35
- `,
36
- execute: (knockClient) => async (params) => {
37
- const allChannels = [];
38
- for await (const channel of knockClient.channels.list()) {
39
- allChannels.push(channel);
40
- }
41
- return allChannels;
42
- }
43
- });
44
- var channels = {
45
- listChannels
46
- };
47
- var permissions = {
48
- read: ["listChannels"]
49
- };
1
+ import {
2
+ channels,
3
+ permissions
4
+ } from "../../chunk-2CNJ4XX6.js";
5
+ import "../../chunk-TOBLV65T.js";
50
6
  export {
51
7
  channels,
52
8
  permissions
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/knock-tool.ts","../../../src/lib/tools/channels.ts"],"sourcesContent":["import type { ZodObject } from \"zod\";\nimport { z } from \"zod\";\nimport { Config } from \"../types.js\";\nimport { KnockClient } from \"./knock-client.js\";\n\nexport interface KnockToolDefinition {\n /**\n * The method name of the tool. This is a machine-readable string.\n */\n method: string;\n /**\n * The name of the tool. This can be used to reference the tool in the code.\n * A descriptive LLM-readable string.\n */\n name: string;\n\n /**\n * A descriptive prompt explaining the tool's purpose, including examples where useful.\n */\n description: string;\n\n /**\n * A descriptive prompt explaining the tool's purpose, usage and input parameters.\n * Ths is intended to be used by the underlying LLM.\n */\n fullDescription: string;\n\n /**\n * The Zod schema for the input parameters of the tool\n */\n parameters?: ZodObject<any>;\n /**\n * The actual implementation of the tool.\n */\n execute: (\n knockClient: KnockClient,\n config: Config\n ) => (input: any) => Promise<unknown>;\n}\n\nexport interface KnockTool extends Omit<KnockToolDefinition, \"execute\"> {\n bindExecute: (\n knockClient: KnockClient,\n config: Config\n ) => (input: any) => Promise<unknown>;\n}\n\nconst trimLines = (text: string) =>\n text\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter(Boolean)\n .join(\"\\n\");\n\nexport const KnockTool = (\n args: Omit<KnockToolDefinition, \"fullDescription\">\n): KnockTool => {\n const { execute, ...restOfArgs } = args;\n const parameters = restOfArgs.parameters\n ? restOfArgs.parameters\n : z.object({});\n\n const schemaEntries = Object.entries(parameters.shape);\n\n const argsStr =\n schemaEntries.length === 0\n ? \"Takes no arguments\"\n : schemaEntries\n .map(([key, value]) => {\n return `- ${key}: ${(value as any).description || \"\"}`;\n })\n .join(\"\\n\");\n\n const fullDescription = trimLines(`\n Tool name:\n ${args.name}\n Description:\n ${args.description}.\n Arguments:\n ${argsStr}\n `);\n\n return {\n ...restOfArgs,\n parameters,\n fullDescription,\n bindExecute: (knockClient: KnockClient, config: Config) =>\n execute(knockClient, config),\n };\n};\n","import { KnockTool } from \"../knock-tool.js\";\nimport { Channel } from \"@knocklabs/mgmt/resources/channels.js\";\n\nconst listChannels = KnockTool({\n method: \"list_channels\",\n name: \"List channels\",\n description: `\n Returns a list of all of the channels configured in the account. Each channel returns information about the type of channel it is (email, sms, push, etc), and the provider that's used to power the channel.\n\n Use this tool when you need to know about the channels configured in the Knock account, like when configuring a workflow.\n `,\n execute: (knockClient) => async (params) => {\n const allChannels: Channel[] = [];\n for await (const channel of knockClient.channels.list()) {\n allChannels.push(channel);\n }\n return allChannels;\n },\n});\n\nexport const channels = {\n listChannels,\n};\n\nexport const permissions = {\n read: [\"listChannels\"],\n};\n"],"mappings":";AACA,SAAS,SAAS;AA8ClB,IAAM,YAAY,CAAC,SACjB,KACG,MAAM,IAAI,EACV,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,OAAO,EACd,KAAK,IAAI;AAEP,IAAM,YAAY,CACvB,SACc;AACd,QAAM,EAAE,SAAS,GAAG,WAAW,IAAI;AACnC,QAAM,aAAa,WAAW,aAC1B,WAAW,aACX,EAAE,OAAO,CAAC,CAAC;AAEf,QAAM,gBAAgB,OAAO,QAAQ,WAAW,KAAK;AAErD,QAAM,UACJ,cAAc,WAAW,IACrB,uBACA,cACG,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACrB,WAAO,KAAK,GAAG,KAAM,MAAc,eAAe,EAAE;AAAA,EACtD,CAAC,EACA,KAAK,IAAI;AAElB,QAAM,kBAAkB,UAAU;AAAA;AAAA,IAEhC,KAAK,IAAI;AAAA;AAAA,IAET,KAAK,WAAW;AAAA;AAAA,IAEhB,OAAO;AAAA,GACR;AAED,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,aAAa,CAAC,aAA0B,WACtC,QAAQ,aAAa,MAAM;AAAA,EAC/B;AACF;;;ACtFA,IAAM,eAAe,UAAU;AAAA,EAC7B,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,SAAS,CAAC,gBAAgB,OAAO,WAAW;AAC1C,UAAM,cAAyB,CAAC;AAChC,qBAAiB,WAAW,YAAY,SAAS,KAAK,GAAG;AACvD,kBAAY,KAAK,OAAO;AAAA,IAC1B;AACA,WAAO;AAAA,EACT;AACF,CAAC;AAEM,IAAM,WAAW;AAAA,EACtB;AACF;AAEO,IAAM,cAAc;AAAA,EACzB,MAAM,CAAC,cAAc;AACvB;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,96 +1,8 @@
1
- // src/lib/tools/commits.ts
2
- import { z as z2 } from "zod";
3
-
4
- // src/lib/knock-tool.ts
5
- import { z } from "zod";
6
- var trimLines = (text) => text.split("\n").map((l) => l.trim()).filter(Boolean).join("\n");
7
- var KnockTool = (args) => {
8
- const { execute, ...restOfArgs } = args;
9
- const parameters = restOfArgs.parameters ? restOfArgs.parameters : z.object({});
10
- const schemaEntries = Object.entries(parameters.shape);
11
- const argsStr = schemaEntries.length === 0 ? "Takes no arguments" : schemaEntries.map(([key, value]) => {
12
- return `- ${key}: ${value.description || ""}`;
13
- }).join("\n");
14
- const fullDescription = trimLines(`
15
- Tool name:
16
- ${args.name}
17
- Description:
18
- ${args.description}.
19
- Arguments:
20
- ${argsStr}
21
- `);
22
- return {
23
- ...restOfArgs,
24
- parameters,
25
- fullDescription,
26
- bindExecute: (knockClient, config) => execute(knockClient, config)
27
- };
28
- };
29
-
30
- // src/lib/tools/commits.ts
31
- var listCommits = KnockTool({
32
- method: "list_commits",
33
- name: "List commits",
34
- description: `
35
- Returns all commits available in the environment. Use this tool when you are asked to see what changes are available to be deployed.
36
- `,
37
- parameters: z2.object({
38
- environment: z2.string().describe(
39
- "(string): The environment to list commits for. Defaults to `development`."
40
- ),
41
- promoted: z2.boolean().describe(
42
- "(boolean): Whether to only return promoted commits. Defaults to `false`."
43
- )
44
- }),
45
- execute: (knockClient, config) => async (params) => {
46
- return await knockClient.commits.list({
47
- environment: params.environment ?? config.environment ?? "development",
48
- promoted: params.promoted ?? false
49
- });
50
- }
51
- });
52
- var commitAllChanges = KnockTool({
53
- method: "commit_all_changes",
54
- name: "Commit all changes",
55
- description: `
56
- Commit all pending changes to the current environment. Use this tool when you are asked to save all changes to the current environment. This can only be used in the development environment.
57
- `,
58
- parameters: z2.object({
59
- message: z2.string().describe("(string): The message to include in the commit.")
60
- }),
61
- execute: (knockClient, config) => async (params) => {
62
- return await knockClient.commits.commitAll({
63
- environment: config.environment ?? "development",
64
- commit_message: params.message
65
- });
66
- }
67
- });
68
- var promoteAllCommits = KnockTool({
69
- method: "promote_all_commits",
70
- name: "Promote all commits",
71
- description: `
72
- Promote all commits to the next environment. Use this tool when you are asked to deploy all changes.
73
-
74
- When not specified, the \`toEnvironment\` will default to the environment that comes after the environment specified in the config.
75
- `,
76
- parameters: z2.object({
77
- toEnvironment: z2.string().describe("(string): The environment to promote all commits to.")
78
- }),
79
- execute: (knockClient, config) => async (params) => {
80
- return await knockClient.put("/v1/commits/promote", {
81
- body: { to_environment: params.toEnvironment }
82
- });
83
- }
84
- });
85
- var commits = {
86
- listCommits,
87
- commitAllChanges,
88
- promoteAllCommits
89
- };
90
- var permissions = {
91
- read: ["listCommits"],
92
- manage: ["commitAllChanges", "promoteAllCommits"]
93
- };
1
+ import {
2
+ commits,
3
+ permissions
4
+ } from "../../chunk-TLHETJRF.js";
5
+ import "../../chunk-TOBLV65T.js";
94
6
  export {
95
7
  commits,
96
8
  permissions
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/tools/commits.ts","../../../src/lib/knock-tool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\n\nconst listCommits = KnockTool({\n method: \"list_commits\",\n name: \"List commits\",\n description: `\n Returns all commits available in the environment. Use this tool when you are asked to see what changes are available to be deployed.\n `,\n parameters: z.object({\n environment: z\n .string()\n .describe(\n \"(string): The environment to list commits for. Defaults to `development`.\"\n ),\n promoted: z\n .boolean()\n .describe(\n \"(boolean): Whether to only return promoted commits. Defaults to `false`.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n return await knockClient.commits.list({\n environment: params.environment ?? config.environment ?? \"development\",\n promoted: params.promoted ?? false,\n });\n },\n});\n\nconst commitAllChanges = KnockTool({\n method: \"commit_all_changes\",\n name: \"Commit all changes\",\n description: `\n Commit all pending changes to the current environment. Use this tool when you are asked to save all changes to the current environment. This can only be used in the development environment.\n `,\n parameters: z.object({\n message: z\n .string()\n .describe(\"(string): The message to include in the commit.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n return await knockClient.commits.commitAll({\n environment: config.environment ?? \"development\",\n commit_message: params.message,\n });\n },\n});\n\nconst promoteAllCommits = KnockTool({\n method: \"promote_all_commits\",\n name: \"Promote all commits\",\n description: `\n Promote all commits to the next environment. Use this tool when you are asked to deploy all changes. \n\n When not specified, the \\`toEnvironment\\` will default to the environment that comes after the environment specified in the config.\n `,\n parameters: z.object({\n toEnvironment: z\n .string()\n .describe(\"(string): The environment to promote all commits to.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n return await knockClient.put(\"/v1/commits/promote\", {\n body: { to_environment: params.toEnvironment },\n });\n },\n});\n\nexport const commits = {\n listCommits,\n commitAllChanges,\n promoteAllCommits,\n};\n\nexport const permissions = {\n read: [\"listCommits\"],\n manage: [\"commitAllChanges\", \"promoteAllCommits\"],\n};\n","import type { ZodObject } from \"zod\";\nimport { z } from \"zod\";\nimport { Config } from \"../types.js\";\nimport { KnockClient } from \"./knock-client.js\";\n\nexport interface KnockToolDefinition {\n /**\n * The method name of the tool. This is a machine-readable string.\n */\n method: string;\n /**\n * The name of the tool. This can be used to reference the tool in the code.\n * A descriptive LLM-readable string.\n */\n name: string;\n\n /**\n * A descriptive prompt explaining the tool's purpose, including examples where useful.\n */\n description: string;\n\n /**\n * A descriptive prompt explaining the tool's purpose, usage and input parameters.\n * Ths is intended to be used by the underlying LLM.\n */\n fullDescription: string;\n\n /**\n * The Zod schema for the input parameters of the tool\n */\n parameters?: ZodObject<any>;\n /**\n * The actual implementation of the tool.\n */\n execute: (\n knockClient: KnockClient,\n config: Config\n ) => (input: any) => Promise<unknown>;\n}\n\nexport interface KnockTool extends Omit<KnockToolDefinition, \"execute\"> {\n bindExecute: (\n knockClient: KnockClient,\n config: Config\n ) => (input: any) => Promise<unknown>;\n}\n\nconst trimLines = (text: string) =>\n text\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter(Boolean)\n .join(\"\\n\");\n\nexport const KnockTool = (\n args: Omit<KnockToolDefinition, \"fullDescription\">\n): KnockTool => {\n const { execute, ...restOfArgs } = args;\n const parameters = restOfArgs.parameters\n ? restOfArgs.parameters\n : z.object({});\n\n const schemaEntries = Object.entries(parameters.shape);\n\n const argsStr =\n schemaEntries.length === 0\n ? \"Takes no arguments\"\n : schemaEntries\n .map(([key, value]) => {\n return `- ${key}: ${(value as any).description || \"\"}`;\n })\n .join(\"\\n\");\n\n const fullDescription = trimLines(`\n Tool name:\n ${args.name}\n Description:\n ${args.description}.\n Arguments:\n ${argsStr}\n `);\n\n return {\n ...restOfArgs,\n parameters,\n fullDescription,\n bindExecute: (knockClient: KnockClient, config: Config) =>\n execute(knockClient, config),\n };\n};\n"],"mappings":";AAAA,SAAS,KAAAA,UAAS;;;ACClB,SAAS,SAAS;AA8ClB,IAAM,YAAY,CAAC,SACjB,KACG,MAAM,IAAI,EACV,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,OAAO,EACd,KAAK,IAAI;AAEP,IAAM,YAAY,CACvB,SACc;AACd,QAAM,EAAE,SAAS,GAAG,WAAW,IAAI;AACnC,QAAM,aAAa,WAAW,aAC1B,WAAW,aACX,EAAE,OAAO,CAAC,C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BAAgB,OAAO;AAAA,IACzB,CAAC;AAAA,EACH;AACF,CAAC;AAED,IAAM,oBAAoB,UAAU;AAAA,EAClC,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,YAAYA,GAAE,OAAO;AAAA,IACnB,eAAeA,GACZ,OAAO,EACP,SAAS,sDAAsD;AAAA,EACpE,CAAC;AAAA,EACD,SAAS,CAAC,aAAa,WAAW,OAAO,WAAW;AAClD,WAAO,MAAM,YAAY,IAAI,uBAAuB;AAAA,MAClD,MAAM,EAAE,gBAAgB,OAAO,cAAc;AAAA,IAC/C,CAAC;AAAA,EACH;AACF,CAAC;AAEM,IAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,cAAc;AAAA,EACzB,MAAM,CAAC,aAAa;AAAA,EACpB,QAAQ,CAAC,oBAAoB,mBAAmB;AAClD;","names":["z","z"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,58 +1,8 @@
1
- // src/lib/knock-tool.ts
2
- import { z } from "zod";
3
- var trimLines = (text) => text.split("\n").map((l) => l.trim()).filter(Boolean).join("\n");
4
- var KnockTool = (args) => {
5
- const { execute, ...restOfArgs } = args;
6
- const parameters = restOfArgs.parameters ? restOfArgs.parameters : z.object({});
7
- const schemaEntries = Object.entries(parameters.shape);
8
- const argsStr = schemaEntries.length === 0 ? "Takes no arguments" : schemaEntries.map(([key, value]) => {
9
- return `- ${key}: ${value.description || ""}`;
10
- }).join("\n");
11
- const fullDescription = trimLines(`
12
- Tool name:
13
- ${args.name}
14
- Description:
15
- ${args.description}.
16
- Arguments:
17
- ${argsStr}
18
- `);
19
- return {
20
- ...restOfArgs,
21
- parameters,
22
- fullDescription,
23
- bindExecute: (knockClient, config) => execute(knockClient, config)
24
- };
25
- };
26
-
27
- // src/lib/tools/email-layouts.ts
28
- import { z as z2 } from "zod";
29
- var listEmailLayouts = KnockTool({
30
- method: "list_email_layouts",
31
- name: "List email layouts",
32
- description: `List all email layouts within the environment given. Returns information about the email layout, including the name and the key.
33
-
34
- Use this tool when building a workflow that is building an email notification when you need to know the available email layouts.`,
35
- parameters: z2.object({
36
- environment: z2.string().describe(
37
- "(string): The environment to list email layouts for. Defaults to `development`."
38
- )
39
- }),
40
- execute: (knockClient, config) => async (params) => {
41
- const allEmailLayouts = [];
42
- for await (const emailLayout of knockClient.emailLayouts.list({
43
- environment: params.environment ?? config.environment ?? "development"
44
- })) {
45
- allEmailLayouts.push(emailLayout);
46
- }
47
- return allEmailLayouts;
48
- }
49
- });
50
- var emailLayouts = {
51
- listEmailLayouts
52
- };
53
- var permissions = {
54
- read: ["listEmailLayouts"]
55
- };
1
+ import {
2
+ emailLayouts,
3
+ permissions
4
+ } from "../../chunk-DSRTYV37.js";
5
+ import "../../chunk-TOBLV65T.js";
56
6
  export {
57
7
  emailLayouts,
58
8
  permissions
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/knock-tool.ts","../../../src/lib/tools/email-layouts.ts"],"sourcesContent":["import type { ZodObject } from \"zod\";\nimport { z } from \"zod\";\nimport { Config } from \"../types.js\";\nimport { KnockClient } from \"./knock-client.js\";\n\nexport interface KnockToolDefinition {\n /**\n * The method name of the tool. This is a machine-readable string.\n */\n method: string;\n /**\n * The name of the tool. This can be used to reference the tool in the code.\n * A descriptive LLM-readable string.\n */\n name: string;\n\n /**\n * A descriptive prompt explaining the tool's purpose, including examples where useful.\n */\n description: string;\n\n /**\n * A descriptive prompt explaining the tool's purpose, usage and input parameters.\n * Ths is intended to be used by the underlying LLM.\n */\n fullDescription: string;\n\n /**\n * The Zod schema for the input parameters of the tool\n */\n parameters?: ZodObject<any>;\n /**\n * The actual implementation of the tool.\n */\n execute: (\n knockClient: KnockClient,\n config: Config\n ) => (input: any) => Promise<unknown>;\n}\n\nexport interface KnockTool extends Omit<KnockToolDefinition, \"execute\"> {\n bindExecute: (\n knockClient: KnockClient,\n config: Config\n ) => (input: any) => Promise<unknown>;\n}\n\nconst trimLines = (text: string) =>\n text\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter(Boolean)\n .join(\"\\n\");\n\nexport const KnockTool = (\n args: Omit<KnockToolDefinition, \"fullDescription\">\n): KnockTool => {\n const { execute, ...restOfArgs } = args;\n const parameters = restOfArgs.parameters\n ? restOfArgs.parameters\n : z.object({});\n\n const schemaEntries = Object.entries(parameters.shape);\n\n const argsStr =\n schemaEntries.length === 0\n ? \"Takes no arguments\"\n : schemaEntries\n .map(([key, value]) => {\n return `- ${key}: ${(value as any).description || \"\"}`;\n })\n .join(\"\\n\");\n\n const fullDescription = trimLines(`\n Tool name:\n ${args.name}\n Description:\n ${args.description}.\n Arguments:\n ${argsStr}\n `);\n\n return {\n ...restOfArgs,\n parameters,\n fullDescription,\n bindExecute: (knockClient: KnockClient, config: Config) =>\n execute(knockClient, config),\n };\n};\n","import { EmailLayout } from \"@knocklabs/mgmt/resources/email-layouts.js\";\nimport { KnockTool } from \"../knock-tool.js\";\nimport { z } from \"zod\";\n\nconst listEmailLayouts = KnockTool({\n method: \"list_email_layouts\",\n name: \"List email layouts\",\n description: `List all email layouts within the environment given. Returns information about the email layout, including the name and the key. \n \n Use this tool when building a workflow that is building an email notification when you need to know the available email layouts.`,\n parameters: z.object({\n environment: z\n .string()\n .describe(\n \"(string): The environment to list email layouts for. Defaults to `development`.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const allEmailLayouts: EmailLayout[] = [];\n for await (const emailLayout of knockClient.emailLayouts.list({\n environment: params.environment ?? config.environment ?? \"development\",\n })) {\n allEmailLayouts.push(emailLayout);\n }\n return allEmailLayouts;\n },\n});\n\nexport const emailLayouts = {\n listEmailLayouts,\n};\n\nexport const permissions = {\n read: [\"listEmailLayouts\"],\n};\n"],"mappings":";AACA,SAAS,SAAS;AA8ClB,IAAM,YAAY,CAAC,SACjB,KACG,MAAM,IAAI,EACV,IAAI,CAAC,MAAM,EAAE,KAAK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":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,50 +1,8 @@
1
- // src/lib/knock-tool.ts
2
- import { z } from "zod";
3
- var trimLines = (text) => text.split("\n").map((l) => l.trim()).filter(Boolean).join("\n");
4
- var KnockTool = (args) => {
5
- const { execute, ...restOfArgs } = args;
6
- const parameters = restOfArgs.parameters ? restOfArgs.parameters : z.object({});
7
- const schemaEntries = Object.entries(parameters.shape);
8
- const argsStr = schemaEntries.length === 0 ? "Takes no arguments" : schemaEntries.map(([key, value]) => {
9
- return `- ${key}: ${value.description || ""}`;
10
- }).join("\n");
11
- const fullDescription = trimLines(`
12
- Tool name:
13
- ${args.name}
14
- Description:
15
- ${args.description}.
16
- Arguments:
17
- ${argsStr}
18
- `);
19
- return {
20
- ...restOfArgs,
21
- parameters,
22
- fullDescription,
23
- bindExecute: (knockClient, config) => execute(knockClient, config)
24
- };
25
- };
26
-
27
- // src/lib/tools/environments.ts
28
- var listEnvironments = KnockTool({
29
- method: "list_environments",
30
- name: "List environments",
31
- description: `
32
- Lists all environments available, returning the slug, name, and the order of each environment. Use this tool when you need to see what environments are available to deploy to.
33
- `,
34
- execute: (knockClient) => async (params) => {
35
- const allEnvironments = [];
36
- for await (const environment of knockClient.environments.list()) {
37
- allEnvironments.push(environment);
38
- }
39
- return allEnvironments;
40
- }
41
- });
42
- var environments = {
43
- listEnvironments
44
- };
45
- var permissions = {
46
- read: ["listEnvironments"]
47
- };
1
+ import {
2
+ environments,
3
+ permissions
4
+ } from "../../chunk-O6DWF42E.js";
5
+ import "../../chunk-TOBLV65T.js";
48
6
  export {
49
7
  environments,
50
8
  permissions
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/knock-tool.ts","../../../src/lib/tools/environments.ts"],"sourcesContent":["import type { ZodObject } from \"zod\";\nimport { z } from \"zod\";\nimport { Config } from \"../types.js\";\nimport { KnockClient } from \"./knock-client.js\";\n\nexport interface KnockToolDefinition {\n /**\n * The method name of the tool. This is a machine-readable string.\n */\n method: string;\n /**\n * The name of the tool. This can be used to reference the tool in the code.\n * A descriptive LLM-readable string.\n */\n name: string;\n\n /**\n * A descriptive prompt explaining the tool's purpose, including examples where useful.\n */\n description: string;\n\n /**\n * A descriptive prompt explaining the tool's purpose, usage and input parameters.\n * Ths is intended to be used by the underlying LLM.\n */\n fullDescription: string;\n\n /**\n * The Zod schema for the input parameters of the tool\n */\n parameters?: ZodObject<any>;\n /**\n * The actual implementation of the tool.\n */\n execute: (\n knockClient: KnockClient,\n config: Config\n ) => (input: any) => Promise<unknown>;\n}\n\nexport interface KnockTool extends Omit<KnockToolDefinition, \"execute\"> {\n bindExecute: (\n knockClient: KnockClient,\n config: Config\n ) => (input: any) => Promise<unknown>;\n}\n\nconst trimLines = (text: string) =>\n text\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter(Boolean)\n .join(\"\\n\");\n\nexport const KnockTool = (\n args: Omit<KnockToolDefinition, \"fullDescription\">\n): KnockTool => {\n const { execute, ...restOfArgs } = args;\n const parameters = restOfArgs.parameters\n ? restOfArgs.parameters\n : z.object({});\n\n const schemaEntries = Object.entries(parameters.shape);\n\n const argsStr =\n schemaEntries.length === 0\n ? \"Takes no arguments\"\n : schemaEntries\n .map(([key, value]) => {\n return `- ${key}: ${(value as any).description || \"\"}`;\n })\n .join(\"\\n\");\n\n const fullDescription = trimLines(`\n Tool name:\n ${args.name}\n Description:\n ${args.description}.\n Arguments:\n ${argsStr}\n `);\n\n return {\n ...restOfArgs,\n parameters,\n fullDescription,\n bindExecute: (knockClient: KnockClient, config: Config) =>\n execute(knockClient, config),\n };\n};\n","import { Environment } from \"@knocklabs/mgmt/resources/environments.js\";\nimport { KnockTool } from \"../knock-tool.js\";\n\nconst listEnvironments = KnockTool({\n method: \"list_environments\",\n name: \"List environments\",\n description: `\n Lists all environments available, returning the slug, name, and the order of each environment. Use this tool when you need to see what environments are available to deploy to.\n `,\n execute: (knockClient) => async (params) => {\n const allEnvironments: Environment[] = [];\n for await (const environment of knockClient.environments.list()) {\n allEnvironments.push(environment);\n }\n return allEnvironments;\n },\n});\n\nexport const environments = {\n listEnvironments,\n};\n\nexport const permissions = {\n read: [\"listEnvironments\"],\n};\n"],"mappings":";AACA,SAAS,SAAS;AA8ClB,IAAM,YAAY,CAAC,SACjB,KACG,MAAM,IAAI,EACV,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,OAAO,EACd,KAAK,IAAI;AAEP,IAAM,YAAY,CACvB,SACc;AACd,QAAM,EAAE,SAAS,GAAG,WAAW,IAAI;AACnC,QAAM,aAAa,WAAW,aAC1B,WAAW,aACX,EAAE,OAAO,CAAC,CAAC;AAEf,QAAM,gBAAgB,OAAO,QAAQ,WAAW,KAAK;AAErD,QAAM,UACJ,cAAc,WAAW,IACrB,uBACA,cACG,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACrB,WAAO,KAAK,GAAG,KAAM,MAAc,eAAe,EAAE;AAAA,EACtD,CAAC,EACA,KAAK,IAAI;AAElB,QAAM,kBAAkB,UAAU;AAAA;AAAA,IAEhC,KAAK,IAAI;AAAA;AAAA,IAET,KAAK,WAAW;AAAA;AAAA,IAEhB,OAAO;AAAA,GACR;AAED,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,aAAa,CAAC,aAA0B,WACtC,QAAQ,aAAa,MAAM;AAAA,EAC/B;AACF;;;ACtFA,IAAM,mBAAmB,UAAU;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,aAAa;AAAA;AAAA;AAAA,EAGb,SAAS,CAAC,gBAAgB,OAAO,WAAW;AAC1C,UAAM,kBAAiC,CAAC;AACxC,qBAAiB,eAAe,YAAY,aAAa,KAAK,GAAG;AAC/D,sBAAgB,KAAK,WAAW;AAAA,IAClC;AACA,WAAO;AAAA,EACT;AACF,CAAC;AAEM,IAAM,eAAe;AAAA,EAC1B;AACF;AAEO,IAAM,cAAc;AAAA,EACzB,MAAM,CAAC,kBAAkB;AAC3B;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}