@knocklabs/agent-toolkit 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -95,7 +95,7 @@ export async function POST(req: Request) {
95
95
  const toolkit = await createKnockToolkit({
96
96
  serviceToken: "kst_12345",
97
97
  permissions: {
98
- workflows: { read: true, trigger: true, manage: true },
98
+ workflows: { read: true, run: true, manage: true },
99
99
  },
100
100
  });
101
101
 
@@ -136,7 +136,7 @@ const toolkit = await createKnockToolkit({
136
136
  serviceToken: "kst_12345",
137
137
  permissions: {
138
138
  // Set the permissions of the tools to expose
139
- workflows: { read: true, trigger: true, manage: true },
139
+ workflows: { read: true, run: true, manage: true },
140
140
  },
141
141
  });
142
142
 
@@ -1,18 +1,18 @@
1
- import { T as ToolkitConfig, t as toolPermissions } from '../types-DyB12-Gk.js';
2
- import { Tool } from 'ai';
1
+ import { T as ToolkitConfig, a as ToolCategory } from '../types-BePFw9M2.js';
2
+ import { ToolSet } from 'ai';
3
3
 
4
4
  declare const createKnockToolkit: (config: ToolkitConfig) => {
5
5
  /**
6
6
  * Get all tools for all categories
7
7
  * @returns An array of all tools
8
8
  */
9
- getAllTools: () => Tool[];
9
+ getAllTools: () => ToolSet;
10
10
  /**
11
11
  * Get all tools for a specific category
12
12
  * @param category - The category of tools to get
13
13
  * @returns An array of tools for the given category
14
14
  */
15
- getTools: (category: keyof typeof toolPermissions) => Tool[];
15
+ getTools: (category: ToolCategory) => ToolSet;
16
16
  };
17
17
 
18
18
  export { createKnockToolkit };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createKnockClient,
3
3
  getToolsByPermissionsInCategories
4
- } from "../chunk-ZV2SOIO7.js";
5
- import "../chunk-RPKDXX4O.js";
4
+ } from "../chunk-NOMOK3LZ.js";
5
+ import "../chunk-3NU2K26A.js";
6
6
 
7
7
  // src/ai-sdk/tool-converter.ts
8
8
  import { tool } from "ai";
@@ -24,15 +24,29 @@ var createKnockToolkit = (config) => {
24
24
  * Get all tools for all categories
25
25
  * @returns An array of all tools
26
26
  */
27
- getAllTools: () => Object.values(allowedToolsByCategory).flat().map((t) => knockToolToAiTool(knockClient, config, t)),
27
+ getAllTools: () => {
28
+ return Object.values(allowedToolsByCategory).flat().reduce(
29
+ (acc, tool2) => ({
30
+ ...acc,
31
+ [tool2.method]: knockToolToAiTool(knockClient, config, tool2)
32
+ }),
33
+ {}
34
+ );
35
+ },
28
36
  /**
29
37
  * Get all tools for a specific category
30
38
  * @param category - The category of tools to get
31
39
  * @returns An array of tools for the given category
32
40
  */
33
- getTools: (category) => allowedToolsByCategory[category].map(
34
- (t) => knockToolToAiTool(knockClient, config, t)
35
- )
41
+ getTools: (category) => {
42
+ return allowedToolsByCategory[category].reduce(
43
+ (acc, tool2) => ({
44
+ ...acc,
45
+ [tool2.method]: knockToolToAiTool(knockClient, config, tool2)
46
+ }),
47
+ {}
48
+ );
49
+ }
36
50
  };
37
51
  };
38
52
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ai-sdk/tool-converter.ts","../../src/ai-sdk/index.ts"],"sourcesContent":["import type { Tool } from \"ai\";\nimport { tool } from \"ai\";\nimport { KnockClient } from \"../lib/knock-client.js\";\nimport { KnockTool } from \"../lib/knock-tool.js\";\nimport { Config } from \"../types.js\";\nimport { z } from \"zod\";\n\n/**\n * Convert a KnockTool to an AI Tool, ready to pass to the AI SDK.\n */\nconst knockToolToAiTool = (\n knockClient: KnockClient,\n config: Config,\n knockTool: KnockTool\n): Tool => {\n return tool({\n description: knockTool.description,\n parameters: knockTool.parameters ?? z.object({}),\n execute: knockTool.bindExecute(knockClient, config),\n });\n};\n\nexport { knockToolToAiTool };\n","import { ToolkitConfig } from \"../types.js\";\nimport { toolPermissions } from \"../lib/tools/index.js\";\nimport { getToolsByPermissionsInCategories } from \"../lib/utils.js\";\nimport { createKnockClient } from \"../lib/knock-client.js\";\nimport { Tool } from \"ai\";\nimport { knockToolToAiTool } from \"./tool-converter.js\";\n\nconst createKnockToolkit = (config: ToolkitConfig) => {\n const knockClient = createKnockClient(config);\n const allowedToolsByCategory = getToolsByPermissionsInCategories(config);\n\n return {\n /**\n * Get all tools for all categories\n * @returns An array of all tools\n */\n getAllTools: (): Tool[] =>\n Object.values(allowedToolsByCategory)\n .flat()\n .map((t) => knockToolToAiTool(knockClient, config, t)),\n\n /**\n * Get all tools for a specific category\n * @param category - The category of tools to get\n * @returns An array of tools for the given category\n */\n getTools: (category: keyof typeof toolPermissions): Tool[] =>\n allowedToolsByCategory[category].map((t) =>\n knockToolToAiTool(knockClient, config, t)\n ),\n };\n};\n\nexport { createKnockToolkit };\n"],"mappings":";;;;;;;AACA,SAAS,YAAY;AAIrB,SAAS,SAAS;AAKlB,IAAM,oBAAoB,CACxB,aACA,QACA,cACS;AACT,SAAO,KAAK;AAAA,IACV,aAAa,UAAU;AAAA,IACvB,YAAY,UAAU,cAAc,EAAE,OAAO,CAAC,CAAC;AAAA,IAC/C,SAAS,UAAU,YAAY,aAAa,MAAM;AAAA,EACpD,CAAC;AACH;;;ACbA,IAAM,qBAAqB,CAAC,WAA0B;AACpD,QAAM,cAAc,kBAAkB,MAAM;AAC5C,QAAM,yBAAyB,kCAAkC,MAAM;AAEvE,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,aAAa,MACX,OAAO,OAAO,sBAAsB,EACjC,KAAK,EACL,IAAI,CAAC,MAAM,kBAAkB,aAAa,QAAQ,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOzD,UAAU,CAAC,aACT,uBAAuB,QAAQ,EAAE;AAAA,MAAI,CAAC,MACpC,kBAAkB,aAAa,QAAQ,CAAC;AAAA,IAC1C;AAAA,EACJ;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/ai-sdk/tool-converter.ts","../../src/ai-sdk/index.ts"],"sourcesContent":["import type { Tool } from \"ai\";\nimport { tool } from \"ai\";\nimport { KnockClient } from \"../lib/knock-client.js\";\nimport { KnockTool } from \"../lib/knock-tool.js\";\nimport { Config } from \"../types.js\";\nimport { z } from \"zod\";\n\n/**\n * Convert a KnockTool to an AI Tool, ready to pass to the AI SDK.\n */\nconst knockToolToAiTool = (\n knockClient: KnockClient,\n config: Config,\n knockTool: KnockTool\n): Tool => {\n return tool({\n description: knockTool.description,\n parameters: knockTool.parameters ?? z.object({}),\n execute: knockTool.bindExecute(knockClient, config),\n });\n};\n\nexport { knockToolToAiTool };\n","import { ToolCategory, ToolkitConfig } from \"../types.js\";\nimport { getToolsByPermissionsInCategories } from \"../lib/utils.js\";\nimport { createKnockClient } from \"../lib/knock-client.js\";\nimport { ToolSet } from \"ai\";\nimport { knockToolToAiTool } from \"./tool-converter.js\";\n\nconst createKnockToolkit = (config: ToolkitConfig) => {\n const knockClient = createKnockClient(config);\n const allowedToolsByCategory = getToolsByPermissionsInCategories(config);\n\n return {\n /**\n * Get all tools for all categories\n * @returns An array of all tools\n */\n getAllTools: (): ToolSet => {\n return Object.values(allowedToolsByCategory)\n .flat()\n .reduce(\n (acc, tool) => ({\n ...acc,\n [tool.method]: knockToolToAiTool(knockClient, config, tool),\n }),\n {} as ToolSet\n );\n },\n\n /**\n * Get all tools for a specific category\n * @param category - The category of tools to get\n * @returns An array of tools for the given category\n */\n getTools: (category: ToolCategory): ToolSet => {\n return allowedToolsByCategory[category].reduce(\n (acc, tool) => ({\n ...acc,\n [tool.method]: knockToolToAiTool(knockClient, config, tool),\n }),\n {} as ToolSet\n );\n },\n };\n};\n\nexport { createKnockToolkit };\n"],"mappings":";;;;;;;AACA,SAAS,YAAY;AAIrB,SAAS,SAAS;AAKlB,IAAM,oBAAoB,CACxB,aACA,QACA,cACS;AACT,SAAO,KAAK;AAAA,IACV,aAAa,UAAU;AAAA,IACvB,YAAY,UAAU,cAAc,EAAE,OAAO,CAAC,CAAC;AAAA,IAC/C,SAAS,UAAU,YAAY,aAAa,MAAM;AAAA,EACpD,CAAC;AACH;;;ACdA,IAAM,qBAAqB,CAAC,WAA0B;AACpD,QAAM,cAAc,kBAAkB,MAAM;AAC5C,QAAM,yBAAyB,kCAAkC,MAAM;AAEvE,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,aAAa,MAAe;AAC1B,aAAO,OAAO,OAAO,sBAAsB,EACxC,KAAK,EACL;AAAA,QACC,CAAC,KAAKA,WAAU;AAAA,UACd,GAAG;AAAA,UACH,CAACA,MAAK,MAAM,GAAG,kBAAkB,aAAa,QAAQA,KAAI;AAAA,QAC5D;AAAA,QACA,CAAC;AAAA,MACH;AAAA,IACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,UAAU,CAAC,aAAoC;AAC7C,aAAO,uBAAuB,QAAQ,EAAE;AAAA,QACtC,CAAC,KAAKA,WAAU;AAAA,UACd,GAAG;AAAA,UACH,CAACA,MAAK,MAAM,GAAG,kBAAkB,aAAa,QAAQA,KAAI;AAAA,QAC5D;AAAA,QACA,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["tool"]}
@@ -29,7 +29,7 @@ var listChannels = KnockTool({
29
29
  method: "list_channels",
30
30
  name: "List channels",
31
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.
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. Channels can be used across all environments.
33
33
 
34
34
  Use this tool when you need to know about the channels configured in the Knock account, like when configuring a workflow.
35
35
  `,
@@ -57,7 +57,7 @@ var listCommits = KnockTool({
57
57
  Returns all commits available in the environment. Use this tool when you are asked to see what changes are available to be deployed.
58
58
  `,
59
59
  parameters: z2.object({
60
- environment: z2.string().describe(
60
+ environment: z2.string().optional().describe(
61
61
  "(string): The environment to list commits for. Defaults to `development`."
62
62
  ),
63
63
  promoted: z2.boolean().describe(
@@ -75,14 +75,17 @@ var commitAllChanges = KnockTool({
75
75
  method: "commit_all_changes",
76
76
  name: "Commit all changes",
77
77
  description: `
78
- 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.
78
+ Commit all pending changes. This can only be used in the development environment.
79
79
  `,
80
80
  parameters: z2.object({
81
- message: z2.string().describe("(string): The message to include in the commit.")
81
+ environment: z2.string().optional().describe(
82
+ "(string): The environment to commit all changes to. Defaults to `development`."
83
+ ),
84
+ message: z2.string().optional().describe("(string): The message to include in the commit.")
82
85
  }),
83
86
  execute: (knockClient, config) => async (params) => {
84
87
  return await knockClient.commits.commitAll({
85
- environment: config.environment ?? "development",
88
+ environment: params.environment ?? config.environment ?? "development",
86
89
  commit_message: params.message
87
90
  });
88
91
  }
@@ -91,9 +94,7 @@ var promoteAllCommits = KnockTool({
91
94
  method: "promote_all_commits",
92
95
  name: "Promote all commits",
93
96
  description: `
94
- Promote all commits to the next environment. Use this tool when you are asked to deploy all changes.
95
-
96
- When not specified, the \`toEnvironment\` will default to the environment that comes after the environment specified in the config.
97
+ Promote all commits to the next environment. Use this tool when you are asked to deploy all changes.
97
98
  `,
98
99
  parameters: z2.object({
99
100
  toEnvironment: z2.string().describe("(string): The environment to promote all commits to.")
@@ -123,7 +124,7 @@ var listEmailLayouts = KnockTool({
123
124
 
124
125
  Use this tool when building a workflow that is building an email notification when you need to know the available email layouts.`,
125
126
  parameters: z3.object({
126
- environment: z3.string().describe(
127
+ environment: z3.string().optional().describe(
127
128
  "(string): The environment to list email layouts for. Defaults to `development`."
128
129
  )
129
130
  }),
@@ -175,10 +176,13 @@ var getMessageContent = KnockTool({
175
176
  Retrieves the complete contents of a single message, specified by the messageId. The message contents includes the rendered template that was sent to the recipient. Use this tool when you want to surface information about the emails, SMS, and push notifications that were sent to a user.
176
177
  `,
177
178
  parameters: z4.object({
179
+ environment: z4.string().optional().describe(
180
+ "(string): The environment to retrieve the message from. Defaults to `development`."
181
+ ),
178
182
  messageId: z4.string().describe("(string): The messageId of the message to retrieve.")
179
183
  }),
180
184
  execute: (knockClient) => async (params) => {
181
- const publicClient = await knockClient.publicApi();
185
+ const publicClient = await knockClient.publicApi(params.environment);
182
186
  return await publicClient.messages.getContent(params.messageId);
183
187
  }
184
188
  });
@@ -196,7 +200,7 @@ var listMessageTypes = KnockTool({
196
200
  name: "List message types",
197
201
  description: "List all message types available for the environment. Each message type returns the schema, which includes information about the variants and the fields available per-variant. Use this tool when you need to understand the different message types that are available for the environment for use in Guides.",
198
202
  parameters: z5.object({
199
- environment: z5.string().describe(
203
+ environment: z5.string().optional().describe(
200
204
  "(string): The environment to list message types for. Defaults to `development`."
201
205
  )
202
206
  }),
@@ -288,26 +292,9 @@ var createOrUpdateMessageType = KnockTool({
288
292
  "value": "warning",
289
293
  "label": "Warning",
290
294
  },
291
- {
292
- "value": "success",
293
- "label": "Success",
294
- },
295
- {
296
- "value": "info",
297
- "label": "Info",
298
- },
299
- {
300
- "value": "error",
301
- "label": "Error",
302
- },
303
295
  ]
304
296
  },
305
297
  },
306
- {
307
- "key": "title",
308
- "type": "text",
309
- "label": "Title",
310
- },
311
298
  {
312
299
  "key": "description",
313
300
  "type": "markdown",
@@ -326,6 +313,9 @@ var createOrUpdateMessageType = KnockTool({
326
313
  </example>
327
314
  `,
328
315
  parameters: z5.object({
316
+ environment: z5.string().optional().describe(
317
+ "(string): The environment to create or update the message type in. Defaults to `development`."
318
+ ),
329
319
  messageTypeKey: z5.string().describe("(string): The key of the message type to create or update."),
330
320
  name: z5.string().describe("(string): The name of the message type."),
331
321
  description: z5.string().optional().describe("(string): The description of the message type."),
@@ -341,10 +331,10 @@ var createOrUpdateMessageType = KnockTool({
341
331
  z5.object({
342
332
  key: z5.string().describe("(string): The key of the field."),
343
333
  type: z5.string().describe(
344
- "(string): The type of the field. One of `text`, `textarea`, `button`, `markdown`, `select`, `multi_select`."
334
+ "(string): The type of the field. One of `text`, `textarea`, `button`, `markdown`, `select`, `multi_select`, `image`."
345
335
  ),
346
336
  label: z5.string().describe("(string): The label of the field."),
347
- settings: z5.object({}).describe("(object): The settings of the field.")
337
+ settings: z5.object({}).optional().describe("(object): The settings of the field.")
348
338
  })
349
339
  ).describe("(array): The fields of the variant.")
350
340
  })
@@ -378,10 +368,13 @@ var listObjects = KnockTool({
378
368
  name: "List objects",
379
369
  description: "List all objects in a single collection. Objects are used to model custom collections in Knock that are NOT users or tenants. Use this tool when you need to return a paginated list of objects in a single collection.",
380
370
  parameters: z6.object({
371
+ environment: z6.string().optional().describe(
372
+ "(string): The environment to list objects from. Defaults to `development`."
373
+ ),
381
374
  collection: z6.string().describe("(string): The collection to list objects from.")
382
375
  }),
383
376
  execute: (knockClient, config) => async (params) => {
384
- const publicClient = await knockClient.publicApi();
377
+ const publicClient = await knockClient.publicApi(params.environment);
385
378
  return await publicClient.objects.list(params.collection);
386
379
  }
387
380
  });
@@ -390,11 +383,14 @@ var getObject = KnockTool({
390
383
  name: "Get object",
391
384
  description: "Get an object wihin a collection. Returns information about the object including any custom properties. Use this tool when you need to retrieve an object to understand it's properties.",
392
385
  parameters: z6.object({
386
+ environment: z6.string().optional().describe(
387
+ "(string): The environment to get the object from. Defaults to `development`."
388
+ ),
393
389
  collection: z6.string().describe("(string): The collection to get the object from."),
394
390
  objectId: z6.string().describe("(string): The ID of the object to get.")
395
391
  }),
396
392
  execute: (knockClient, config) => async (params) => {
397
- const publicClient = await knockClient.publicApi();
393
+ const publicClient = await knockClient.publicApi(params.environment);
398
394
  return await publicClient.objects.get(params.collection, params.objectId);
399
395
  }
400
396
  });
@@ -405,12 +401,15 @@ var createOrUpdateObject = KnockTool({
405
401
 
406
402
  Use this tool when you need to create a new object, or update an existing custom-object. Custom objects can be used to subscribe users' to as lists, and also send non-user facing notifications to.`,
407
403
  parameters: z6.object({
404
+ environment: z6.string().optional().describe(
405
+ "(string): The environment to create or update the object in. Defaults to `development`."
406
+ ),
408
407
  collection: z6.string().describe("(string): The collection to create or update the object in."),
409
408
  objectId: z6.string().describe("(string): The ID of the object to create or update."),
410
- properties: z6.record(z6.string(), z6.any()).describe("(object): The properties to set on the object.")
409
+ properties: z6.record(z6.string(), z6.any()).optional().describe("(object): The properties to set on the object.")
411
410
  }),
412
411
  execute: (knockClient, config) => async (params) => {
413
- const publicClient = await knockClient.publicApi();
412
+ const publicClient = await knockClient.publicApi(params.environment);
414
413
  return await publicClient.objects.set(
415
414
  params.collection,
416
415
  params.objectId,
@@ -418,20 +417,6 @@ var createOrUpdateObject = KnockTool({
418
417
  );
419
418
  }
420
419
  });
421
- var deleteObject = KnockTool({
422
- method: "delete_object",
423
- name: "Delete object",
424
- description: `Delete an object from a specific collection. Use this tool when you need to remove an object from the system.`,
425
- parameters: z6.object({
426
- collection: z6.string().describe("(string): The collection to delete the object from."),
427
- objectId: z6.string().describe("(string): The ID of the object to delete.")
428
- }),
429
- execute: (knockClient, config) => async (params) => {
430
- const publicClient = await knockClient.publicApi();
431
- await publicClient.objects.delete(params.collection, params.objectId);
432
- return { success: true };
433
- }
434
- });
435
420
  var subscribeUsersToObject = KnockTool({
436
421
  method: "subscribe_users_to_object",
437
422
  name: "Subscribe users to object",
@@ -443,6 +428,9 @@ var subscribeUsersToObject = KnockTool({
443
428
  Before using this tool, you should create the object in the collection using the createOrUpdateObject tool.
444
429
  `,
445
430
  parameters: z6.object({
431
+ environment: z6.string().optional().describe(
432
+ "(string): The environment to subscribe the user to. Defaults to `development`."
433
+ ),
446
434
  collection: z6.string().describe("(string): The collection to subscribe the user to."),
447
435
  objectId: z6.string().describe("(string): The ID of the object to subscribe the user to."),
448
436
  userIds: z6.array(z6.string()).describe(
@@ -450,7 +438,7 @@ var subscribeUsersToObject = KnockTool({
450
438
  )
451
439
  }),
452
440
  execute: (knockClient, config) => async (params) => {
453
- const publicClient = await knockClient.publicApi();
441
+ const publicClient = await knockClient.publicApi(params.environment);
454
442
  return await publicClient.objects.addSubscriptions(
455
443
  params.collection,
456
444
  params.objectId,
@@ -467,6 +455,9 @@ var unsubscribeUsersFromObject = KnockTool({
467
455
 
468
456
  Use this tool when you need to unsubscribe one or more users from an object where you will then trigger workflows for those lists of users to send notifications to.`,
469
457
  parameters: z6.object({
458
+ environment: z6.string().optional().describe(
459
+ "(string): The environment to unsubscribe the user from. Defaults to `development`."
460
+ ),
470
461
  collection: z6.string().describe("(string): The collection to unsubscribe the user from."),
471
462
  objectId: z6.string().describe("(string): The ID of the object to unsubscribe the user from."),
472
463
  userIds: z6.array(z6.string()).describe(
@@ -474,7 +465,7 @@ var unsubscribeUsersFromObject = KnockTool({
474
465
  )
475
466
  }),
476
467
  execute: (knockClient, config) => async (params) => {
477
- const publicClient = await knockClient.publicApi();
468
+ const publicClient = await knockClient.publicApi(params.environment);
478
469
  return await publicClient.objects.deleteSubscriptions(
479
470
  params.collection,
480
471
  params.objectId,
@@ -488,7 +479,6 @@ var objects = {
488
479
  listObjects,
489
480
  getObject,
490
481
  createOrUpdateObject,
491
- deleteObject,
492
482
  subscribeUsersToObject,
493
483
  unsubscribeUsersFromObject
494
484
  };
@@ -496,7 +486,6 @@ var permissions7 = {
496
486
  read: ["listObjects", "getObject"],
497
487
  manage: [
498
488
  "createOrUpdateObject",
499
- "deleteObject",
500
489
  "subscribeUsersToObject",
501
490
  "unsubscribeUsersFromObject"
502
491
  ]
@@ -507,11 +496,11 @@ import { z as z7 } from "zod";
507
496
  var listPartials = KnockTool({
508
497
  method: "list_partials",
509
498
  name: "List partials",
510
- description: `List all partials within the environment given. Partials provide common building blocks for notification templates. Returns information about the partial, including the name and the key.
511
-
512
- Use this tool when you need to know the available partials for the environment, like when building a notification template and wanting to use a partial to build the template.`,
499
+ description: `
500
+ List all partials within the environment given. Partials provide common building blocks for notification templates. Returns information about the partial, including the name and the key.
501
+ Use this tool when you need to know the available partials for the environment, like when building a notification template and wanting to use a partial to build the template.`,
513
502
  parameters: z7.object({
514
- environment: z7.string().describe(
503
+ environment: z7.string().optional().describe(
515
504
  "(string): The environment to list partials for. Defaults to `development`."
516
505
  )
517
506
  }),
@@ -543,13 +532,34 @@ var getTenant = KnockTool({
543
532
  Use this tool when you need to lookup the information about a tenant, including name, and if there are any custom properties set.
544
533
  `,
545
534
  parameters: z8.object({
535
+ environment: z8.string().optional().describe(
536
+ "(string): The environment to retrieve the tenant from. Defaults to `development`."
537
+ ),
546
538
  tenantId: z8.string().describe("(string): The ID of the tenant to retrieve.")
547
539
  }),
548
540
  execute: (knockClient) => async (params) => {
549
- const publicClient = await knockClient.publicApi();
541
+ const publicClient = await knockClient.publicApi(params.environment);
550
542
  return await publicClient.tenants.get(params.tenantId);
551
543
  }
552
544
  });
545
+ var listTenants = KnockTool({
546
+ method: "list_tenants",
547
+ name: "List tenants",
548
+ description: `
549
+ Retrieves a list of tenants. Tenants in Knock are used to model organizations, teams, and other groups of users. They are a special type of object.
550
+
551
+ Use this tool when you need to list all tenants in an environment.
552
+ `,
553
+ parameters: z8.object({
554
+ environment: z8.string().optional().describe(
555
+ "(string): The environment to retrieve the tenants from. Defaults to `development`."
556
+ )
557
+ }),
558
+ execute: (knockClient) => async (params) => {
559
+ const publicClient = await knockClient.publicApi(params.environment);
560
+ return await publicClient.tenants.list();
561
+ }
562
+ });
553
563
  var setTenant = KnockTool({
554
564
  method: "set_tenant",
555
565
  name: "Set tenant",
@@ -559,43 +569,29 @@ var setTenant = KnockTool({
559
569
  Use this tool when you need to create a new tenant, or update an existing tenant's properties.
560
570
  `,
561
571
  parameters: z8.object({
572
+ environment: z8.string().optional().describe(
573
+ "(string): The environment to set the tenant in. Defaults to `development`."
574
+ ),
562
575
  tenantId: z8.string().describe("(string): The ID of the tenant to update."),
563
- name: z8.string().describe("(string): The name of the tenant."),
564
- properties: z8.record(z8.string(), z8.any()).describe("(object): The properties to set on the tenant.")
576
+ name: z8.string().optional().describe("(string): The name of the tenant."),
577
+ properties: z8.record(z8.string(), z8.any()).optional().describe("(object): The properties to set on the tenant.")
565
578
  }),
566
579
  execute: (knockClient) => async (params) => {
567
- const publicClient = await knockClient.publicApi();
580
+ const publicClient = await knockClient.publicApi(params.environment);
568
581
  return await publicClient.tenants.set(params.tenantId, {
569
582
  name: params.name,
570
583
  ...params.properties
571
584
  });
572
585
  }
573
586
  });
574
- var deleteTenant = KnockTool({
575
- method: "delete_tenant",
576
- name: "Delete tenant",
577
- description: `
578
- Deletes a tenant. Tenants in Knock are used to model organizations, teams, and other groups of users. They are a special type of object.
579
-
580
- Use this tool when you've been asked to remove a tenant from the system.
581
- `,
582
- parameters: z8.object({
583
- tenantId: z8.string().describe("(string): The ID of the tenant to delete.")
584
- }),
585
- execute: (knockClient) => async (params) => {
586
- const publicClient = await knockClient.publicApi();
587
- await publicClient.tenants.delete(params.tenantId);
588
- return { success: true };
589
- }
590
- });
591
587
  var tenants = {
592
588
  getTenant,
593
- setTenant,
594
- deleteTenant
589
+ listTenants,
590
+ setTenant
595
591
  };
596
592
  var permissions9 = {
597
- read: ["getTenant"],
598
- manage: ["setTenant", "deleteTenant"]
593
+ read: ["getTenant", "listTenants"],
594
+ manage: ["setTenant"]
599
595
  };
600
596
 
601
597
  // src/lib/tools/users.ts
@@ -609,10 +605,13 @@ var getUser = KnockTool({
609
605
  If the userId is not provided, it will use the userId from the config.
610
606
  `,
611
607
  parameters: z9.object({
612
- userId: z9.string().describe("(string): The userId of the User to retrieve.")
608
+ environment: z9.string().optional().describe(
609
+ "(string): The environment to retrieve the user from. Defaults to `development`."
610
+ ),
611
+ userId: z9.string().optional().describe("(string): The userId of the User to retrieve.")
613
612
  }),
614
613
  execute: (knockClient, config) => async (params) => {
615
- const publicClient = await knockClient.publicApi();
614
+ const publicClient = await knockClient.publicApi(params.environment);
616
615
  return await publicClient.users.get(params.userId ?? config.userId);
617
616
  }
618
617
  });
@@ -627,17 +626,20 @@ var createOrUpdateUser = KnockTool({
627
626
  If the userId is not provided, it will use the userId from the config.
628
627
  `,
629
628
  parameters: z9.object({
630
- userId: z9.string().describe("(string): The userId of the User to update."),
631
- email: z9.string().describe("(string): The email of the User to update."),
632
- name: z9.string().describe("(string): The name of the User to update."),
633
- phoneNumber: z9.string().describe("(string): The phone number of the User to update."),
634
- customProperties: z9.record(z9.string(), z9.any()).describe(
629
+ environment: z9.string().optional().describe(
630
+ "(string): The environment to create or update the user in. Defaults to `development`."
631
+ ),
632
+ userId: z9.string().optional().describe("(string): The userId of the User to update."),
633
+ email: z9.string().optional().describe("(string): The email of the User to update."),
634
+ name: z9.string().optional().describe("(string): The name of the User to update."),
635
+ phoneNumber: z9.string().optional().describe("(string): The phone number of the User to update."),
636
+ customProperties: z9.record(z9.string(), z9.any()).optional().describe(
635
637
  "(object): A dictionary of custom properties to update for the User."
636
638
  )
637
639
  }),
638
640
  execute: (knockClient, config) => async (params) => {
639
- const publicClient = await knockClient.publicApi();
640
- return await publicClient.users.identify(params.userId, {
641
+ const publicClient = await knockClient.publicApi(params.environment);
642
+ return await publicClient.users.identify(params.userId ?? config.userId, {
641
643
  email: params.email,
642
644
  name: params.name,
643
645
  phone_number: params.phoneNumber,
@@ -645,21 +647,6 @@ var createOrUpdateUser = KnockTool({
645
647
  });
646
648
  }
647
649
  });
648
- var deleteUser = KnockTool({
649
- method: "delete_user",
650
- name: "Delete user",
651
- description: `
652
- Deletes a user. Use this tool when you've been asked to remove a user from the system.
653
- `,
654
- parameters: z9.object({
655
- userId: z9.string().describe("(string): The userId of the User to delete.")
656
- }),
657
- execute: (knockClient, config) => async (params) => {
658
- const publicClient = await knockClient.publicApi();
659
- await publicClient.users.delete(params.userId);
660
- return { success: true };
661
- }
662
- });
663
650
  var getUserPreferences = KnockTool({
664
651
  method: "get_user_preferences",
665
652
  name: "Get user preferences",
@@ -669,15 +656,18 @@ var getUserPreferences = KnockTool({
669
656
  If the userId is not provided, it will use the userId from the config.
670
657
  `,
671
658
  parameters: z9.object({
672
- userId: z9.string().describe(
659
+ environment: z9.string().optional().describe(
660
+ "(string): The environment to retrieve the user preferences from. Defaults to `development`."
661
+ ),
662
+ userId: z9.string().optional().describe(
673
663
  "(string): The userId of the User to retrieve Preferences for."
674
664
  ),
675
- preferenceSetId: z9.string().describe(
665
+ preferenceSetId: z9.string().optional().describe(
676
666
  "(string): The preferenceSetId of the User to retrieve preferences for. Defaults to `default`."
677
667
  )
678
668
  }),
679
669
  execute: (knockClient, config) => async (params) => {
680
- const publicClient = await knockClient.publicApi();
670
+ const publicClient = await knockClient.publicApi(params.environment);
681
671
  return await publicClient.users.getPreferences(
682
672
  params.userId ?? config.userId,
683
673
  {
@@ -722,19 +712,22 @@ var setUserPreferences = KnockTool({
722
712
  </examples>
723
713
  `,
724
714
  parameters: z9.object({
725
- userId: z9.string().describe("(string): The userId of the User to update preferences for."),
726
- workflows: z9.record(z9.string(), z9.any()).describe(
715
+ environment: z9.string().optional().describe(
716
+ "(string): The environment to set the user preferences in. Defaults to `development`."
717
+ ),
718
+ userId: z9.string().optional().describe("(string): The userId of the User to update preferences for."),
719
+ workflows: z9.record(z9.string(), z9.any()).optional().describe(
727
720
  "(object): The workflows to update where the key is the workflow key, and the value of the object is an object that contains a `channel_types` key with a boolean value for each channel type."
728
721
  ),
729
- categories: z9.record(z9.string(), z9.any()).describe(
722
+ categories: z9.record(z9.string(), z9.any()).optional().describe(
730
723
  "(object): The categories to update where the key is the category key, and the value of the object is an object that contains a `channel_types` key with a boolean value for each channel type."
731
724
  ),
732
- channel_types: z9.record(z9.string(), z9.boolean()).describe(
725
+ channel_types: z9.record(z9.string(), z9.boolean()).optional().describe(
733
726
  "(object): The channel types to update where the key is the channel type, and the value of the object is a boolean value."
734
727
  )
735
728
  }),
736
729
  execute: (knockClient, config) => async (params) => {
737
- const publicClient = await knockClient.publicApi();
730
+ const publicClient = await knockClient.publicApi(params.environment);
738
731
  const existingPreferences = await publicClient.users.getPreferences(
739
732
  params.userId ?? config.userId,
740
733
  {
@@ -771,13 +764,16 @@ var getUserMessages = KnockTool({
771
764
  If the userId is not provided, it will use the userId from the config.
772
765
  `,
773
766
  parameters: z9.object({
774
- userId: z9.string().describe("(string): The userId of the User to retrieve messages for."),
775
- workflowRunId: z9.string().describe(
767
+ environment: z9.string().optional().describe(
768
+ "(string): The environment to retrieve the user messages from. Defaults to `development`."
769
+ ),
770
+ userId: z9.string().optional().describe("(string): The userId of the User to retrieve messages for."),
771
+ workflowRunId: z9.string().optional().describe(
776
772
  "(string): The workflowRunId of the User to retrieve. Use this when you want to retrieve messages sent from a workflow trigger."
777
773
  )
778
774
  }),
779
775
  execute: (knockClient, config) => async (params) => {
780
- const publicClient = await knockClient.publicApi();
776
+ const publicClient = await knockClient.publicApi(params.environment);
781
777
  return await publicClient.users.getMessages(
782
778
  params.userId ?? config.userId,
783
779
  {
@@ -788,15 +784,14 @@ var getUserMessages = KnockTool({
788
784
  });
789
785
  var users = {
790
786
  getUser,
791
- deleteUser,
792
787
  createOrUpdateUser,
793
788
  getUserPreferences,
794
789
  setUserPreferences,
795
790
  getUserMessages
796
791
  };
797
792
  var permissions10 = {
798
- read: ["getUser", "getUserPreferences", "getUserMessages"],
799
- manage: ["createOrUpdateUser", "deleteUser", "setUserPreferences"]
793
+ read: ["getUser", "getUserMessages", "getUserPreferences"],
794
+ manage: ["createOrUpdateUser", "setUserPreferences"]
800
795
  };
801
796
 
802
797
  // src/lib/tools/workflows.ts
@@ -810,7 +805,7 @@ var listWorkflows = KnockTool({
810
805
  Use this tool when you need to understand which workflows are available to be called.
811
806
  `,
812
807
  parameters: z10.object({
813
- environment: z10.string().describe(
808
+ environment: z10.string().optional().describe(
814
809
  "(string): The environment to list workflows for. Defaults to `development`."
815
810
  )
816
811
  }),
@@ -829,26 +824,31 @@ var triggerWorkflow = KnockTool({
829
824
  method: "trigger_workflow",
830
825
  name: "Trigger workflow",
831
826
  description: `
832
- Trigger a workflow for one or more recipients.
827
+ Trigger a workflow for one or more recipients, which may produce one or more messages for each recipient depending on the workflow's steps.
833
828
 
834
829
  Use this tool when you need to trigger a workflow to send a notification across the channels configured for the workflow. The workflow must be committed in the environment for you to trigger it.
835
830
 
836
831
  When recipients aren't provided, the workflow will be triggered for the current user specified in the config.
837
832
  `,
838
833
  parameters: z10.object({
834
+ environment: z10.string().optional().describe(
835
+ "(string): The environment to trigger the workflow in. Defaults to `development`."
836
+ ),
839
837
  workflowKey: z10.string().describe("(string): The key of the workflow to trigger."),
840
- recipients: z10.array(z10.string()).describe("(array): The recipients to trigger the workflow for."),
841
- data: z10.record(z10.string(), z10.any()).describe("(object): Data to pass to the workflow."),
842
- tenant: z10.record(z10.string(), z10.any()).describe(
838
+ recipients: z10.array(z10.string()).optional().describe(
839
+ "(array): The recipients to trigger the workflow for. This is an array of user IDs."
840
+ ),
841
+ data: z10.record(z10.string(), z10.any()).optional().describe("(object): Data to pass to the workflow."),
842
+ tenant: z10.record(z10.string(), z10.any()).optional().describe(
843
843
  "(object): The tenant to trigger the workflow for. Must contain an id if being sent."
844
844
  )
845
845
  }),
846
846
  execute: (knockClient, config) => async (params) => {
847
- const publicClient = await knockClient.publicApi();
847
+ const publicClient = await knockClient.publicApi(params.environment);
848
848
  const result = await publicClient.workflows.trigger(params.workflowKey, {
849
- recipients: params.recipients,
849
+ recipients: params.recipients ?? [config.userId] ?? [],
850
850
  data: params.data,
851
- tenant: params.tenant
851
+ tenant: params.tenant ?? config.tenantId
852
852
  });
853
853
  return result.workflow_run_id;
854
854
  }
@@ -878,12 +878,12 @@ var createEmailWorkflow = KnockTool({
878
878
  Once you've created the workflow, you should ask if you should commit the changes to the environment.
879
879
  `,
880
880
  parameters: z10.object({
881
- environment: z10.string().describe(
881
+ environment: z10.string().optional().describe(
882
882
  "(string): The environment to create the workflow in. Defaults to `development`."
883
883
  ),
884
884
  workflowKey: z10.string().describe("(string): The key of the workflow."),
885
885
  name: z10.string().describe("(string): The name of the workflow."),
886
- categories: z10.array(z10.string()).describe("(array): The categories to add to the workflow."),
886
+ categories: z10.array(z10.string()).optional().describe("(array): The categories to add to the workflow."),
887
887
  subject: z10.string().describe("(string): The subject of the email."),
888
888
  body: z10.string().describe("(string): The body of the email.")
889
889
  }),
@@ -944,6 +944,9 @@ var createOneOffWorkflowSchedule = KnockTool({
944
944
  - In two weeks, send a survey to a user
945
945
  `,
946
946
  parameters: z10.object({
947
+ environment: z10.string().optional().describe(
948
+ "(string): The environment to create the workflow in. Defaults to `development`."
949
+ ),
947
950
  workflowKey: z10.string().describe("(string): The key of the workflow to schedule."),
948
951
  userId: z10.string().describe(
949
952
  "(string): The userId of the user to schedule the workflow for."
@@ -951,10 +954,10 @@ var createOneOffWorkflowSchedule = KnockTool({
951
954
  scheduledAt: z10.string().describe(
952
955
  "(string): The date and time to schedule the workflow for. Must be in ISO 8601 format."
953
956
  ),
954
- data: z10.record(z10.string(), z10.any()).describe("(object): Data to pass to the workflow.")
957
+ data: z10.record(z10.string(), z10.any()).optional().describe("(object): Data to pass to the workflow.")
955
958
  }),
956
959
  execute: (knockClient, config) => async (params) => {
957
- const publicClient = await knockClient.publicApi();
960
+ const publicClient = await knockClient.publicApi(params.environment);
958
961
  return await publicClient.workflows.createSchedules(params.workflowKey, {
959
962
  recipients: [params.userId ?? config.userId],
960
963
  scheduled_at: params.scheduledAt,
@@ -971,7 +974,7 @@ var workflows = {
971
974
  var permissions11 = {
972
975
  read: ["listWorkflows"],
973
976
  manage: ["createEmailWorkflow", "createOneOffWorkflowSchedule"],
974
- trigger: ["triggerWorkflow"]
977
+ run: ["triggerWorkflow"]
975
978
  };
976
979
 
977
980
  // src/lib/tools/index.ts
@@ -1020,4 +1023,4 @@ export {
1020
1023
  allTools,
1021
1024
  toolPermissions
1022
1025
  };
1023
- //# sourceMappingURL=chunk-RPKDXX4O.js.map
1026
+ //# sourceMappingURL=chunk-3NU2K26A.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/knock-tool.ts","../src/lib/tools/channels.ts","../src/lib/tools/commits.ts","../src/lib/tools/email-layouts.ts","../src/lib/tools/environments.ts","../src/lib/tools/messages.ts","../src/lib/tools/message-types.ts","../src/lib/tools/objects.ts","../src/lib/tools/partials.ts","../src/lib/tools/tenants.ts","../src/lib/tools/users.ts","../src/lib/tools/workflows.ts","../src/lib/tools/index.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. Channels can be used across all environments.\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","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 .optional()\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. This can only be used in the development environment.\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to commit all changes to. Defaults to `development`.\"\n ),\n message: z\n .string()\n .optional()\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: params.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 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 { 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 .optional()\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","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","import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\n\nconst getMessageContent = KnockTool({\n method: \"get_message_content\",\n name: \"Get message content\",\n description: `\n Retrieves the complete contents of a single message, specified by the messageId. The message contents includes the rendered template that was sent to the recipient. Use this tool when you want to surface information about the emails, SMS, and push notifications that were sent to a user.\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to retrieve the message from. Defaults to `development`.\"\n ),\n messageId: z\n .string()\n .describe(\"(string): The messageId of the message to retrieve.\"),\n }),\n execute: (knockClient) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n return await publicClient.messages.getContent(params.messageId);\n },\n});\n\nexport const messages = {\n getMessageContent,\n};\n\nexport const permissions = {\n read: [\"getMessageContent\"],\n};\n","import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\nimport { MessageType } from \"@knocklabs/mgmt/resources/message-types.js\";\n\nconst listMessageTypes = KnockTool({\n method: \"list_message_types\",\n name: \"List message types\",\n description:\n \"List all message types available for the environment. Each message type returns the schema, which includes information about the variants and the fields available per-variant. Use this tool when you need to understand the different message types that are available for the environment for use in Guides.\",\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to list message types for. Defaults to `development`.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const allMessageTypes: MessageType[] = [];\n for await (const messageType of knockClient.messageTypes.list({\n environment: params.environment ?? config.environment ?? \"development\",\n })) {\n allMessageTypes.push(messageType);\n }\n return allMessageTypes;\n },\n});\n\nconst createOrUpdateMessageType = KnockTool({\n method: \"create_or_update_message_type\",\n name: \"Create or update message type\",\n description: `\n Create or update a message type. A message type is a schema that defines fields available to an editor within Knock. Message types always have at least one variant, that MUST be named \"default\".\n \n Use this tool when you need to create a new message type, or update an existing message type. You must pass the FULL message type to this tool if you're going to update an existing message type.\n\n The preview is a string of HTML that will be rendered in the Knock UI as a representation of the message type. It is shared across all variants. It supports liquid, where the field name is available as a variable, so a field named \"text\" will be rendered as {{ text }}.\n\n <example>\n <description>\n Create a new message type for a banner component that has a text and an action URL.\n </description>\n <input>\n {\n \"messageTypeKey\": \"banner\",\n \"name\": \"Banner\",\n \"description\": \"A banner component that has a text and an action URL.\",\n \"preview\": \"<div>{{ text }}</div>\",\n \"variants\": [\n {\n \"key\": \"default\",\n \"name\": \"Default\",\n \"fields\": [\n {\n \"key\": \"text\",\n \"type\": \"text\",\n \"label\": \"Text\",\n \"settings\": {\n \"max_length\": 100,\n },\n },\n {\n \"key\": \"action_url\",\n \"type\": \"text\",\n \"label\": \"Action URL\",\n \"settings\": {\n \"placeholder\": \"https://example.com\",\n },\n }\n ]\n }\n ]\n }\n </input>\n </example>\n <example>\n <description>\n Create a message type for a card component that has an icon type, title, body, and a single action button.\n </description>\n <input>\n {\n \"messageTypeKey\": \"card\",\n \"name\": \"Card\",\n \"description\": \"A single-action card component.\",\n \"preview\": \"\n <div>\n <h2>{{ title }}</h2>\n <p>{{ body }}</p>\n <button>Action</button>\n </div>\n \",\n \"variants\": [\n {\n \"key\": \"default\",\n \"name\": \"Default\",\n \"fields\": [\n {\n \"key\": \"icon_type\",\n \"type\": \"select\",\n \"label\": \"Icon type\",\n \"settings\": {\n \"options\": [\n {\n \"value\": \"warning\",\n \"label\": \"Warning\",\n },\n ]\n },\n },\n {\n \"key\": \"description\",\n \"type\": \"markdown\",\n \"label\": \"Description\",\n },\n {\n \"key\": \"action_button\",\n \"type\": \"button\",\n \"label\": \"Action button\",\n },\n ]\n }\n ]\n }\n </input>\n </example>\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to create or update the message type in. Defaults to `development`.\"\n ),\n messageTypeKey: z\n .string()\n .describe(\"(string): The key of the message type to create or update.\"),\n name: z.string().describe(\"(string): The name of the message type.\"),\n description: z\n .string()\n .optional()\n .describe(\"(string): The description of the message type.\"),\n preview: z\n .string()\n .optional()\n .describe(\n \"(string): The preview of the variant. This is a string of HTML that will be rendered in the preview of the message type. There is a single preview shared by all variants.\"\n ),\n variants: z\n .array(\n z.object({\n key: z.string().describe(\"(string): The key of the variant.\"),\n name: z.string().describe(\"(string): The name of the variant.\"),\n description: z\n .string()\n .optional()\n .describe(\"(string): The description of the variant.\"),\n fields: z\n .array(\n z.object({\n key: z.string().describe(\"(string): The key of the field.\"),\n type: z\n .string()\n .describe(\n \"(string): The type of the field. One of `text`, `textarea`, `button`, `markdown`, `select`, `multi_select`, `image`.\"\n ),\n label: z.string().describe(\"(string): The label of the field.\"),\n settings: z\n .object({})\n .optional()\n .describe(\"(object): The settings of the field.\"),\n })\n )\n .describe(\"(array): The fields of the variant.\"),\n })\n )\n .describe(\"(array): The variants of the message type.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n return await knockClient.messageTypes.upsert(params.messageTypeKey, {\n message_type: {\n name: params.name,\n variants: params.variants,\n description: params.description ?? \"\",\n preview: params.preview ?? \"<div></div>\",\n },\n environment: params.environment ?? config.environment ?? \"development\",\n });\n },\n});\n\nexport const messageTypes = {\n listMessageTypes,\n createOrUpdateMessageType,\n};\n\nexport const permissions = {\n read: [\"listMessageTypes\"],\n manage: [\"createOrUpdateMessageType\"],\n};\n","import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\n\nconst listObjects = KnockTool({\n method: \"list_objects\",\n name: \"List objects\",\n description:\n \"List all objects in a single collection. Objects are used to model custom collections in Knock that are NOT users or tenants. Use this tool when you need to return a paginated list of objects in a single collection.\",\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to list objects from. Defaults to `development`.\"\n ),\n collection: z\n .string()\n .describe(\"(string): The collection to list objects from.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n return await publicClient.objects.list(params.collection);\n },\n});\n\nconst getObject = KnockTool({\n method: \"get_object\",\n name: \"Get object\",\n description:\n \"Get an object wihin a collection. Returns information about the object including any custom properties. Use this tool when you need to retrieve an object to understand it's properties.\",\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to get the object from. Defaults to `development`.\"\n ),\n collection: z\n .string()\n .describe(\"(string): The collection to get the object from.\"),\n objectId: z.string().describe(\"(string): The ID of the object to get.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n return await publicClient.objects.get(params.collection, params.objectId);\n },\n});\n\nconst createOrUpdateObject = KnockTool({\n method: \"create_or_update_object\",\n name: \"Create or update object\",\n description: `Create or update an object in a specific collection. Objects are used to model custom collections in Knock that are NOT users or tenants. If the object does not exist, it will be created. If the object exists, it will be updated with the provided properties. The update will always perform an upsert operation, so you do not need to provide the full properties each time.\n \n Use this tool when you need to create a new object, or update an existing custom-object. Custom objects can be used to subscribe users' to as lists, and also send non-user facing notifications to.`,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to create or update the object in. Defaults to `development`.\"\n ),\n collection: z\n .string()\n .describe(\"(string): The collection to create or update the object in.\"),\n objectId: z\n .string()\n .describe(\"(string): The ID of the object to create or update.\"),\n properties: z\n .record(z.string(), z.any())\n .optional()\n .describe(\"(object): The properties to set on the object.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n return await publicClient.objects.set(\n params.collection,\n params.objectId,\n params.properties\n );\n },\n});\n\nconst subscribeUsersToObject = KnockTool({\n method: \"subscribe_users_to_object\",\n name: \"Subscribe users to object\",\n description: `\n Subscribe a list of users to an object in a specific collection. We use this to model lists of users, for pub-sub use cases.\n \n Use this tool when you need to subscribe one or more users to an object where you will then trigger workflows for those lists of users to send notifications to.\n\n Before using this tool, you should create the object in the collection using the createOrUpdateObject tool.\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to subscribe the user to. Defaults to `development`.\"\n ),\n collection: z\n .string()\n .describe(\"(string): The collection to subscribe the user to.\"),\n objectId: z\n .string()\n .describe(\"(string): The ID of the object to subscribe the user to.\"),\n userIds: z\n .array(z.string())\n .describe(\n \"(array): The IDs of the users to subscribe to the object. If not provided, the current user will be subscribed.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n return await publicClient.objects.addSubscriptions(\n params.collection,\n params.objectId,\n {\n recipients: params.userIds ?? [config.userId],\n }\n );\n },\n});\n\nconst unsubscribeUsersFromObject = KnockTool({\n method: \"unsubscribe_users_from_object\",\n name: \"Unsubscribe users from object\",\n description: `Unsubscribe a list of users from an object in a specific collection. We use this to model lists of users, for pub-sub use cases.\n \n Use this tool when you need to unsubscribe one or more users from an object where you will then trigger workflows for those lists of users to send notifications to.`,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to unsubscribe the user from. Defaults to `development`.\"\n ),\n collection: z\n .string()\n .describe(\"(string): The collection to unsubscribe the user from.\"),\n objectId: z\n .string()\n .describe(\"(string): The ID of the object to unsubscribe the user from.\"),\n userIds: z\n .array(z.string())\n .describe(\n \"(array): The IDs of the users to unsubscribe from the object.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n return await publicClient.objects.deleteSubscriptions(\n params.collection,\n params.objectId,\n {\n recipients: params.userIds ?? [config.userId],\n }\n );\n },\n});\n\nexport const objects = {\n listObjects,\n getObject,\n createOrUpdateObject,\n subscribeUsersToObject,\n unsubscribeUsersFromObject,\n};\n\nexport const permissions = {\n read: [\"listObjects\", \"getObject\"],\n manage: [\n \"createOrUpdateObject\",\n \"subscribeUsersToObject\",\n \"unsubscribeUsersFromObject\",\n ],\n};\n","import { KnockTool } from \"../knock-tool.js\";\nimport { z } from \"zod\";\nimport { Partial } from \"@knocklabs/mgmt/resources/partials.js\";\n\nconst listPartials = KnockTool({\n method: \"list_partials\",\n name: \"List partials\",\n description: `\n List all partials within the environment given. Partials provide common building blocks for notification templates. Returns information about the partial, including the name and the key. \n Use this tool when you need to know the available partials for the environment, like when building a notification template and wanting to use a partial to build the template.`,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to list partials for. Defaults to `development`.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const allPartials: Partial[] = [];\n for await (const partial of knockClient.partials.list({\n environment: params.environment ?? config.environment ?? \"development\",\n })) {\n allPartials.push(partial);\n }\n return allPartials;\n },\n});\n\nexport const partials = {\n listPartials,\n};\n\nexport const permissions = {\n read: [\"listPartials\"],\n};\n","import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\n\nconst getTenant = KnockTool({\n method: \"get_tenant\",\n name: \"Get tenant\",\n description: `\n Retrieves a tenant by their ID. Tenants in Knock are used to model organizations, teams, and other groups of users. They are a special type of object.\n \n Use this tool when you need to lookup the information about a tenant, including name, and if there are any custom properties set.\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to retrieve the tenant from. Defaults to `development`.\"\n ),\n tenantId: z\n .string()\n .describe(\"(string): The ID of the tenant to retrieve.\"),\n }),\n execute: (knockClient) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n return await publicClient.tenants.get(params.tenantId);\n },\n});\n\nconst listTenants = KnockTool({\n method: \"list_tenants\",\n name: \"List tenants\",\n description: `\n Retrieves a list of tenants. Tenants in Knock are used to model organizations, teams, and other groups of users. They are a special type of object. \n \n Use this tool when you need to list all tenants in an environment.\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to retrieve the tenants from. Defaults to `development`.\"\n ),\n }),\n execute: (knockClient) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n return await publicClient.tenants.list();\n },\n});\n\nconst setTenant = KnockTool({\n method: \"set_tenant\",\n name: \"Set tenant\",\n description: `\n Creates or updates a tenant using the properties provided. Tenants in Knock are used to model organizations, teams, and other groups of users. They are a special type of object.\n \n Use this tool when you need to create a new tenant, or update an existing tenant's properties.\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to set the tenant in. Defaults to `development`.\"\n ),\n tenantId: z.string().describe(\"(string): The ID of the tenant to update.\"),\n name: z.string().optional().describe(\"(string): The name of the tenant.\"),\n properties: z\n .record(z.string(), z.any())\n .optional()\n .describe(\"(object): The properties to set on the tenant.\"),\n }),\n execute: (knockClient) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n return await publicClient.tenants.set(params.tenantId, {\n name: params.name,\n ...params.properties,\n });\n },\n});\n\nexport const tenants = {\n getTenant,\n listTenants,\n setTenant,\n};\n\nexport const permissions = {\n read: [\"getTenant\", \"listTenants\"],\n manage: [\"setTenant\"],\n};\n","import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\n\nconst getUser = KnockTool({\n method: \"get_user\",\n name: \"Get user\",\n description: `\n Retrieves the complete user object for the given userId, including email, name, phone number, and any custom properties. Use this tool when you need to retrieve a user's complete profile.\n\n If the userId is not provided, it will use the userId from the config.\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to retrieve the user from. Defaults to `development`.\"\n ),\n userId: z\n .string()\n .optional()\n .describe(\"(string): The userId of the User to retrieve.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n\n return await publicClient.users.get(params.userId ?? config.userId);\n },\n});\n\nconst createOrUpdateUser = KnockTool({\n method: \"create_or_update_user\",\n name: \"Create or update user\",\n description: `\n Creates a new user if they don't exist, or updates the user object for the given userId, including email, name, phone number, and any custom properties.\n \n Use this tool when you need to update a user's profile.\n\n If the userId is not provided, it will use the userId from the config.\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to create or update the user in. Defaults to `development`.\"\n ),\n userId: z\n .string()\n .optional()\n .describe(\"(string): The userId of the User to update.\"),\n email: z\n .string()\n .optional()\n .describe(\"(string): The email of the User to update.\"),\n name: z\n .string()\n .optional()\n .describe(\"(string): The name of the User to update.\"),\n phoneNumber: z\n .string()\n .optional()\n .describe(\"(string): The phone number of the User to update.\"),\n customProperties: z\n .record(z.string(), z.any())\n .optional()\n .describe(\n \"(object): A dictionary of custom properties to update for the User.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n\n return await publicClient.users.identify(params.userId ?? config.userId, {\n email: params.email,\n name: params.name,\n phone_number: params.phoneNumber,\n ...(params.customProperties ?? {}),\n });\n },\n});\n\nconst getUserPreferences = KnockTool({\n method: \"get_user_preferences\",\n name: \"Get user preferences\",\n description: `\n Retrieves the user's notification preferences for the given userId.\n\n If the userId is not provided, it will use the userId from the config. \n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to retrieve the user preferences from. Defaults to `development`.\"\n ),\n userId: z\n .string()\n .optional()\n .describe(\n \"(string): The userId of the User to retrieve Preferences for.\"\n ),\n preferenceSetId: z\n .string()\n .optional()\n .describe(\n \"(string): The preferenceSetId of the User to retrieve preferences for. Defaults to `default`.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n\n return await publicClient.users.getPreferences(\n params.userId ?? config.userId,\n {\n preferenceSet: params.preferenceSetId ?? \"default\",\n }\n );\n },\n});\n\nconst setUserPreferences = KnockTool({\n method: \"set_user_preferences\",\n name: \"Set user preferences\",\n description: `\n Overwrites the user's notification preferences for the given userId. Allows setting per-workflow, per-category, or per-channel notification preferences. Use this tool when you are asked to update a user's notification preferences.\n\n If the userId is not provided, it will use the userId from the config.\n\n Instructions:\n\n - You must ALWAYS provide a full preference set to this tool.\n - When setting per-workflow preferences, the key in the object should be the workflow key.\n - Workflow and category preferences should always have channel types underneath.\n - The channel types available to you are: email, sms, push, chat, and in_app_feed.\n - To turn OFF a preference, you must set it to false.\n - To turn ON a preference, you must set it to true.\n\n <examples>\n <example>\n <description>\n Update the user's preferences to turn off email notifications for the \"welcome\" workflow.\n </description>\n <input>\n {\n \"workflows\": {\n \"welcome\": {\n \"channel_types\": {\n \"email\": false\n }\n }\n }\n }\n </example>\n </examples>\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to set the user preferences in. Defaults to `development`.\"\n ),\n userId: z\n .string()\n .optional()\n .describe(\"(string): The userId of the User to update preferences for.\"),\n workflows: z\n .record(z.string(), z.any())\n .optional()\n .describe(\n \"(object): The workflows to update where the key is the workflow key, and the value of the object is an object that contains a `channel_types` key with a boolean value for each channel type.\"\n ),\n categories: z\n .record(z.string(), z.any())\n .optional()\n .describe(\n \"(object): The categories to update where the key is the category key, and the value of the object is an object that contains a `channel_types` key with a boolean value for each channel type.\"\n ),\n channel_types: z\n .record(z.string(), z.boolean())\n .optional()\n .describe(\n \"(object): The channel types to update where the key is the channel type, and the value of the object is a boolean value.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n\n const existingPreferences = await publicClient.users.getPreferences(\n params.userId ?? config.userId,\n {\n preferenceSet: \"default\",\n }\n );\n\n const updatedPreferences = {\n ...existingPreferences,\n workflows: {\n ...existingPreferences.workflows,\n ...params.workflows,\n },\n categories: {\n ...existingPreferences.categories,\n ...params.categories,\n },\n channel_types: {\n ...existingPreferences.channel_types,\n ...params.channel_types,\n },\n };\n\n return await publicClient.users.setPreferences(\n params.userId ?? config.userId,\n updatedPreferences\n );\n },\n});\n\nconst getUserMessages = KnockTool({\n method: \"get_user_messages\",\n name: \"Get user messages\",\n description: `\n Retrieves the messages that this user has received from the service. Use this tool when you need information about the notifications that the user has received, including if the message has been read, seen, or interacted with. This will return a list of messages across all of the channels.\n\n If the userId is not provided, it will use the userId from the config.\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to retrieve the user messages from. Defaults to `development`.\"\n ),\n userId: z\n .string()\n .optional()\n .describe(\"(string): The userId of the User to retrieve messages for.\"),\n workflowRunId: z\n .string()\n .optional()\n .describe(\n \"(string): The workflowRunId of the User to retrieve. Use this when you want to retrieve messages sent from a workflow trigger.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n\n return await publicClient.users.getMessages(\n params.userId ?? config.userId,\n {\n workflow_run_id: params.workflowRunId,\n }\n );\n },\n});\n\nexport const users = {\n getUser,\n createOrUpdateUser,\n getUserPreferences,\n setUserPreferences,\n getUserMessages,\n};\n\nexport const permissions = {\n read: [\"getUser\", \"getUserMessages\", \"getUserPreferences\"],\n manage: [\"createOrUpdateUser\", \"setUserPreferences\"],\n};\n","import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\nimport {\n Workflow,\n WorkflowUpsertParams,\n} from \"@knocklabs/mgmt/resources/index.js\";\n\nconst listWorkflows = KnockTool({\n method: \"list_workflows\",\n name: \"List workflows\",\n description: `\n List all workflows available for the given environment. Returns structural information about the workflows, including the key, name, description, and categories. Will also return the steps that make up the workflow. \n\n Use this tool when you need to understand which workflows are available to be called. \n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to list workflows for. Defaults to `development`.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const allWorkflows: Workflow[] = [];\n const listParams = {\n environment: params.environment ?? config.environment ?? \"development\",\n };\n\n for await (const workflow of knockClient.workflows.list(listParams)) {\n allWorkflows.push(workflow);\n }\n return allWorkflows;\n },\n});\n\nconst triggerWorkflow = KnockTool({\n method: \"trigger_workflow\",\n name: \"Trigger workflow\",\n description: `\n Trigger a workflow for one or more recipients, which may produce one or more messages for each recipient depending on the workflow's steps.\n\n Use this tool when you need to trigger a workflow to send a notification across the channels configured for the workflow. The workflow must be committed in the environment for you to trigger it.\n\n When recipients aren't provided, the workflow will be triggered for the current user specified in the config.\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to trigger the workflow in. Defaults to `development`.\"\n ),\n workflowKey: z\n .string()\n .describe(\"(string): The key of the workflow to trigger.\"),\n recipients: z\n .array(z.string())\n .optional()\n .describe(\n \"(array): The recipients to trigger the workflow for. This is an array of user IDs.\"\n ),\n data: z\n .record(z.string(), z.any())\n .optional()\n .describe(\"(object): Data to pass to the workflow.\"),\n tenant: z\n .record(z.string(), z.any())\n .optional()\n .describe(\n \"(object): The tenant to trigger the workflow for. Must contain an id if being sent.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n\n const result = await publicClient.workflows.trigger(params.workflowKey, {\n recipients: params.recipients ?? [config.userId] ?? [],\n data: params.data,\n tenant: params.tenant ?? config.tenantId,\n });\n\n return result.workflow_run_id;\n },\n});\n\nconst createEmailWorkflow = KnockTool({\n method: \"create_email_workflow\",\n name: \"Create email workflow\",\n description: `\n Creates a simple email workflow with a single step that sends an email to the recipient. Use this tool when you need to need to create an email notification, and you don't need to specify any additional steps. You can only create workflows in the development environment.\n\n The content of the email you supply should ONLY ever be in markdown format for simplicity. You can supply dynamic variables to the subject and body of the email using the liquid template language.\n\n When writing markdown, be sure to use headings (##) to separate sections of the email. Use an informal writing style, and avoid using complex language.\n\n The following variables are available to use in the email subject and body:\n\n - \\`recipient.name\\`: The name of the recipient.\n - \\`recipient.email\\`: The email of the recipient.\n - \\`recipient.phone_number\\`: The phone number of the recipient.\n - \\`tenant.id\\`: The id of the tenant.\n - \\`tenant.name\\`: The name of the tenant.\n\n You can supply any other dynamic variables by referencing them under the \\`data\\` key in the \\`data\\` parameter when triggering the workflow. You add those like \\`{{ data.variable_name }}\\`.\n\n You can also supply a list of categories to the workflow. These are used to categorize workflows for notification preferences. Categories should be supplied as lowercase strings in kebab case.\n\n Once you've created the workflow, you should ask if you should commit the changes to the environment.\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to create the workflow in. Defaults to `development`.\"\n ),\n workflowKey: z.string().describe(\"(string): The key of the workflow.\"),\n name: z.string().describe(\"(string): The name of the workflow.\"),\n categories: z\n .array(z.string())\n .optional()\n .describe(\"(array): The categories to add to the workflow.\"),\n subject: z.string().describe(\"(string): The subject of the email.\"),\n body: z.string().describe(\"(string): The body of the email.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const emailChannelsPage = await knockClient.channels.list();\n const emailChannels = emailChannelsPage.entries.filter(\n (channel) => channel.type === \"email\"\n );\n\n if (emailChannels.length === 0) {\n throw new Error(\"No email channels found\");\n }\n\n const workflowParams: WorkflowUpsertParams = {\n environment: params.environment ?? config.environment ?? \"development\",\n workflow: {\n name: params.name,\n categories: params.categories ?? [],\n steps: [\n {\n type: \"channel\",\n channel_key: emailChannels[0].key,\n template: {\n settings: {\n layout_key: \"default\",\n },\n subject: params.subject,\n visual_blocks: [\n // @ts-ignore\n {\n type: \"markdown\",\n content: params.body,\n },\n ],\n },\n name: \"Email\",\n ref: \"email_1\",\n },\n ],\n },\n };\n\n return await knockClient.workflows.upsert(\n params.workflowKey,\n workflowParams\n );\n },\n});\n\nconst createOneOffWorkflowSchedule = KnockTool({\n method: \"create_one_off_workflow_schedule\",\n name: \"Create one-off workflow schedule\",\n description: `\n Create a one-off workflow schedule for a user. Use this tool when you need to schedule the execution of a workflow for a specific user in the future, like to power a delayed notification.\n \n Schedules can accept a set of data that will be passed to the workflow trigger when it is executed. When the userId is not provided, the schedule will be created for the current user specified in the config.\n\n Examples:\n \n - In three days, send a welcome email to a user\n - In one hour, send a password reset email to a user\n - In two weeks, send a survey to a user\n `,\n parameters: z.object({\n environment: z\n .string()\n .optional()\n .describe(\n \"(string): The environment to create the workflow in. Defaults to `development`.\"\n ),\n workflowKey: z\n .string()\n .describe(\"(string): The key of the workflow to schedule.\"),\n userId: z\n .string()\n .describe(\n \"(string): The userId of the user to schedule the workflow for.\"\n ),\n scheduledAt: z\n .string()\n .describe(\n \"(string): The date and time to schedule the workflow for. Must be in ISO 8601 format.\"\n ),\n data: z\n .record(z.string(), z.any())\n .optional()\n .describe(\"(object): Data to pass to the workflow.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi(params.environment);\n\n return await publicClient.workflows.createSchedules(params.workflowKey, {\n recipients: [params.userId ?? config.userId],\n scheduled_at: params.scheduledAt,\n data: params.data,\n });\n },\n});\n\nexport const workflows = {\n listWorkflows,\n triggerWorkflow,\n createEmailWorkflow,\n createOneOffWorkflowSchedule,\n};\n\nexport const permissions = {\n read: [\"listWorkflows\"],\n manage: [\"createEmailWorkflow\", \"createOneOffWorkflowSchedule\"],\n run: [\"triggerWorkflow\"],\n};\n","import { channels, permissions as channelsPermissions } from \"./channels.js\";\nimport { commits, permissions as commitsPermissions } from \"./commits.js\";\nimport {\n emailLayouts,\n permissions as emailLayoutsPermissions,\n} from \"./email-layouts.js\";\nimport {\n environments,\n permissions as environmentsPermissions,\n} from \"./environments.js\";\nimport { messages, permissions as messagesPermissions } from \"./messages.js\";\nimport {\n messageTypes,\n permissions as messageTypesPermissions,\n} from \"./message-types.js\";\nimport { objects, permissions as objectsPermissions } from \"./objects.js\";\nimport { partials, permissions as partialsPermissions } from \"./partials.js\";\nimport { tenants, permissions as tenantsPermissions } from \"./tenants.js\";\nimport { users, permissions as usersPermissions } from \"./users.js\";\nimport { workflows, permissions as workflowsPermissions } from \"./workflows.js\";\n\nexport const tools = {\n channels,\n commits,\n emailLayouts,\n environments,\n messages,\n messageTypes,\n objects,\n partials,\n tenants,\n users,\n workflows,\n};\n\nexport const allTools = {\n ...channels,\n ...commits,\n ...emailLayouts,\n ...environments,\n ...messageTypes,\n ...messages,\n ...objects,\n ...partials,\n ...tenants,\n ...users,\n ...workflows,\n};\n\nexport const toolPermissions = {\n channels: channelsPermissions,\n commits: commitsPermissions,\n emailLayouts: emailLayoutsPermissions,\n environments: environmentsPermissions,\n messages: messagesPermissions,\n messageTypes: messageTypesPermissions,\n objects: objectsPermissions,\n partials: partialsPermissions,\n tenants: tenantsPermissions,\n users: usersPermissions,\n workflows: workflowsPermissions,\n};\n"],"mappings":";AACA,SAAS,SAAS;AA8ClB,IAAM,YAAY,CAAC,SACjB,KACG,MAAM,IAAI,EACV,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB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AuB,8BAA8B;AAAA,EAC9D,KAAK,CAAC,iBAAiB;AACzB;;;ACpNO,IAAM,QAAQ;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,WAAW;AAAA,EACtB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,IAAM,kBAAkB;AAAA,EAC7B,UAAU;AAAA,EACV,SAASC;AAAA,EACT,cAAcA;AAAA,EACd,cAAcA;AAAA,EACd,UAAUA;AAAA,EACV,cAAcA;AAAA,EACd,SAASA;AAAA,EACT,UAAUA;AAAA,EACV,SAASA;AAAA,EACT,OAAOA;AAAA,EACP,WAAWA;AACb;","names":["z","z","permissions","z","permissions","permissions","z","z","permissions","z","z","permissions","z","z","permissions","z","permissions","z","z","permissions","z","z","permissions","z","z","permissions","permissions"]}
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  allTools
3
- } from "./chunk-RPKDXX4O.js";
3
+ } from "./chunk-3NU2K26A.js";
4
4
 
5
5
  // src/modelcontextprotocol/adapter.ts
6
6
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
7
7
  import { z } from "zod";
8
8
  var KnockMcpServer = class extends McpServer {
9
9
  constructor(knockClient, config, tools) {
10
- super({ name: "Knock", version: "0.1.0" });
10
+ super({ name: "Knock", version: "0.1.6" });
11
11
  tools.forEach((tool) => {
12
12
  const toolParams = tool.parameters ?? z.object({});
13
13
  this.tool(
14
- tool.name,
14
+ tool.method,
15
15
  tool.description,
16
16
  toolParams.shape,
17
17
  async (arg) => {
@@ -36,4 +36,4 @@ var createKnockMcpServer = async (params) => {
36
36
  export {
37
37
  createKnockMcpServer
38
38
  };
39
- //# sourceMappingURL=chunk-B6DIDKFY.js.map
39
+ //# sourceMappingURL=chunk-GGZXDBNR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/modelcontextprotocol/adapter.ts","../src/modelcontextprotocol/index.ts"],"sourcesContent":["import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport type { KnockTool } from \"../lib/knock-tool.js\";\nimport { Config } from \"../types.js\";\nimport { KnockClient } from \"../lib/knock-client.js\";\n\nexport class KnockMcpServer extends McpServer {\n constructor(knockClient: KnockClient, config: Config, tools: KnockTool[]) {\n super({ name: \"Knock\", version: PACKAGE_VERSION });\n\n tools.forEach((tool) => {\n const toolParams = tool.parameters ?? z.object({});\n\n this.tool(\n tool.method,\n tool.description,\n toolParams.shape,\n async (arg: unknown) => {\n const res = await tool.bindExecute(knockClient, config)(arg);\n\n return {\n content: [{ type: \"text\" as const, text: JSON.stringify(res) }],\n };\n }\n );\n });\n }\n}\n","import type { KnockTool } from \"../lib/knock-tool.js\";\nimport { allTools } from \"../lib/tools/index.js\";\nimport { KnockMcpServer } from \"./adapter.js\";\nimport { Config } from \"../types.js\";\nimport { KnockClient } from \"../lib/knock-client.js\";\n\ntype CreateKnockMcpServerParams = {\n /**\n * Array of Knock tools to enable in the server.\n */\n tools?: KnockTool[];\n\n /**\n * A Knock client to use for the server.\n */\n knockClient: KnockClient;\n\n /**\n * The config to use for the server.\n */\n config: Config;\n};\n\n/**\n * Creates a Knock MCP Server with the given parameters.\n */\nexport const createKnockMcpServer = async (\n params: CreateKnockMcpServerParams\n): Promise<KnockMcpServer> => {\n const { tools, knockClient, config } = params;\n\n return Promise.resolve(\n new KnockMcpServer(knockClient, config, tools || Object.values(allTools))\n );\n};\n"],"mappings":";;;;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,SAAS;AAKX,IAAM,iBAAN,cAA6B,UAAU;AAAA,EAC5C,YAAY,aAA0B,QAAgB,OAAoB;AACxE,UAAM,EAAE,MAAM,SAAS,SAAS,QAAgB,CAAC;AAEjD,UAAM,QAAQ,CAAC,SAAS;AACtB,YAAM,aAAa,KAAK,cAAc,EAAE,OAAO,CAAC,CAAC;AAEjD,WAAK;AAAA,QACH,KAAK;AAAA,QACL,KAAK;AAAA,QACL,WAAW;AAAA,QACX,OAAO,QAAiB;AACtB,gBAAM,MAAM,MAAM,KAAK,YAAY,aAAa,MAAM,EAAE,GAAG;AAE3D,iBAAO;AAAA,YACL,SAAS,CAAC,EAAE,MAAM,QAAiB,MAAM,KAAK,UAAU,GAAG,EAAE,CAAC;AAAA,UAChE;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;;;ACDO,IAAM,uBAAuB,OAClC,WAC4B;AAC5B,QAAM,EAAE,OAAO,aAAa,OAAO,IAAI;AAEvC,SAAO,QAAQ;AAAA,IACb,IAAI,eAAe,aAAa,QAAQ,SAAS,OAAO,OAAO,QAAQ,CAAC;AAAA,EAC1E;AACF;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  toolPermissions,
3
3
  tools
4
- } from "./chunk-RPKDXX4O.js";
4
+ } from "./chunk-3NU2K26A.js";
5
5
 
6
6
  // src/lib/utils.ts
7
7
  function filterTools(tools2, pattern) {
@@ -67,8 +67,8 @@ var createKnockClient = (config) => {
67
67
  serviceToken: config.serviceToken
68
68
  });
69
69
  return Object.assign(client, {
70
- publicApi: async (_environment) => {
71
- const environment = _environment ?? config.environment ?? "development";
70
+ publicApi: async (environmentSlug) => {
71
+ const environment = environmentSlug ?? config.environment ?? "development";
72
72
  if (serviceTokensToApiClients?.[config.serviceToken]?.[environment]) {
73
73
  return serviceTokensToApiClients[config.serviceToken][environment];
74
74
  }
@@ -88,4 +88,4 @@ export {
88
88
  getToolsByPermissionsInCategories,
89
89
  createKnockClient
90
90
  };
91
- //# sourceMappingURL=chunk-ZV2SOIO7.js.map
91
+ //# sourceMappingURL=chunk-NOMOK3LZ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/utils.ts","../src/lib/knock-client.ts"],"sourcesContent":["import { KnockTool } from \"./knock-tool.js\";\nimport { toolPermissions, tools } from \"../lib/tools/index.js\";\nimport { ToolkitConfig } from \"../types.js\";\nimport { ToolCategory } from \"../types.js\";\n\n/**\n * Given a list of tools, and some config may describe the tools that should be provided to the LLM,\n * returns a filtered list of tools that match the config.\n *\n * Options:\n * `*` - All tools\n * `users.*` - All tools that start with `users.`\n * `users.getUser` - A specific tool\n *\n */\nexport function filterTools(\n tools: Record<string, Record<string, KnockTool>>,\n pattern: string | undefined\n): KnockTool[] {\n if (!pattern) {\n throw new Error(\"No pattern provided\");\n }\n\n // If the pattern is `*`, return all tools\n if (pattern === \"*\") {\n return Object.values(tools).flatMap((category) => Object.values(category));\n }\n\n const [category, tool] = pattern.split(\".\");\n\n // If the pattern is `*.*`, return all tools\n if (category === \"*\" && tool === \"*\") {\n return Object.values(tools).flatMap((category) => Object.values(category));\n }\n\n if (category && !tools[category]) {\n throw new Error(`Tool category ${category} not found`);\n }\n\n // If the pattern is `users.*`, return all tools that start with `users.`\n if (category && tool === \"*\") {\n return Object.values(tools[category]);\n }\n\n // If the pattern is `users.getUser`, return the `getUser` tool\n if (category && tool && !tools[category][tool]) {\n throw new Error(`Tool ${pattern} not found`);\n }\n\n return [tools[category][tool]];\n}\n\n/**\n * Given a category and a list of permissions, return a list of tools that the user has permission to use.\n *\n * @param category - The category to get tools for\n * @param categoryPermissions - The permissions to use\n * @returns A list of tools that the user has permission to use\n */\nexport function getToolsWithPermissions(\n category: keyof typeof toolPermissions,\n categoryPermissions: Record<string, boolean | undefined>\n) {\n // Return all of the tools for the category that have permission\n const toolsInCategory = tools[category] as Record<string, KnockTool>;\n const toolPermissionsInCategory = toolPermissions[category] as Record<\n string,\n string[]\n >;\n\n // Look over each permission type, like `read: true`\n // If it's `true`, then find all of the tools that have that permission\n return Object.entries(categoryPermissions).reduce(\n (acc: KnockTool[], [permissionType, hasPermission]) => {\n if (hasPermission) {\n return acc.concat(\n toolPermissionsInCategory[permissionType].map(\n (toolName) => toolsInCategory[toolName]\n )\n );\n }\n return acc;\n },\n []\n );\n}\n\n/**\n * Given a config, return a list of tools for each category that the user has permission to use.\n *\n * @param config - The config to use\n * @returns A list of tools for each category that the user has permission to use\n */\nexport function getToolsByPermissionsInCategories(\n config: ToolkitConfig\n): Record<ToolCategory, KnockTool[]> {\n return Object.keys(config.permissions).reduce(\n (acc, category) => {\n const categoryKey = category as ToolCategory;\n const categoryPermissions = config.permissions[categoryKey];\n\n if (tools[categoryKey] && categoryPermissions) {\n const tools = getToolsWithPermissions(categoryKey, categoryPermissions);\n\n return { ...acc, [categoryKey]: tools };\n }\n\n return acc;\n },\n {} as Record<ToolCategory, KnockTool[]>\n );\n}\n","import { Knock } from \"@knocklabs/node\";\nimport KnockMgmt from \"@knocklabs/mgmt\";\nimport { Config } from \"../types.js\";\n\nconst serviceTokensToApiClients: Record<string, Record<string, Knock>> = {};\n\ntype KnockClient = ReturnType<typeof createKnockClient>;\n\nconst createKnockClient = (config: Config) => {\n const client = new KnockMgmt({\n serviceToken: config.serviceToken,\n });\n\n return Object.assign(client, {\n publicApi: async (_environment?: string): Promise<Knock> => {\n const environment = _environment ?? config.environment ?? \"development\";\n\n // If the client already exists for this service token and environment, return it\n if (serviceTokensToApiClients?.[config.serviceToken]?.[environment]) {\n return serviceTokensToApiClients[config.serviceToken][environment];\n }\n\n // Otherwise, fetch a public API key for this service token and environment\n const { api_key } = await client.apiKeys.exchange({ environment });\n\n // Create a new Knock client with the public API key\n const knock = new Knock(api_key);\n\n // Store the client in the cache\n if (!serviceTokensToApiClients[config.serviceToken]) {\n serviceTokensToApiClients[config.serviceToken] = {};\n }\n\n serviceTokensToApiClients[config.serviceToken][environment] = knock;\n\n return knock;\n },\n });\n};\n\nexport { createKnockClient, type KnockClient };\n"],"mappings":";;;;;;AAeO,SAAS,YACdA,QACA,SACa;AACb,MAAI,CA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B,YAAM,sBAAsB,OAAO,YAAY,WAAW;AAE1D,UAAI,MAAM,WAAW,KAAK,qBAAqB;AAC7C,cAAMA,SAAQ,wBAAwB,aAAa,mBAAmB;AAEtE,eAAO,EAAE,GAAG,KAAK,CAAC,WAAW,GAAGA,OAAM;AAAA,MACxC;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACF;;;AC/GA,SAAS,aAAa;AACtB,OAAO,eAAe;AAGtB,IAAM,4BAAmE,CAAC;AAI1E,IAAM,oBAAoB,CAAC,WAAmB;AAC5C,QAAM,SAAS,IAAI,UAAU;AAAA,IAC3B,cAAc,OAAO;AAAA,EACvB,CAAC;AAED,SAAO,OAAO,OAAO,QAAQ;AAAA,IAC3B,WAAW,OAAO,iBAA0C;AAC1D,YAAM,cAAc,gBAAgB,OAAO,eAAe;AAG1D,UAAI,4BAA4B,OAAO,YAAY,IAAI,WAAW,GAAG;AACnE,eAAO,0BAA0B,OAAO,YAAY,EAAE,WAAW;AAAA,MACnE;AAGA,YAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,QAAQ,SAAS,EAAE,YAAY,CAAC;AAGjE,YAAM,QAAQ,IAAI,MAAM,OAAO;AAG/B,UAAI,CAAC,0BAA0B,OAAO,YAAY,GAAG;AACnD,kCAA0B,OAAO,YAAY,IAAI,CAAC;AAAA,MACpD;AAEA,gCAA0B,OAAO,YAAY,EAAE,WAAW,IAAI;AAE9D,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;","names":["tools","category"]}
1
+ {"version":3,"sources":["../src/lib/utils.ts","../src/lib/knock-client.ts"],"sourcesContent":["import { KnockTool } from \"./knock-tool.js\";\nimport { toolPermissions, tools } from \"../lib/tools/index.js\";\nimport { ToolkitConfig } from \"../types.js\";\nimport { ToolCategory } from \"../types.js\";\n\n/**\n * Given a list of tools, and some config may describe the tools that should be provided to the LLM,\n * returns a filtered list of tools that match the config.\n *\n * Options:\n * `*` - All tools\n * `users.*` - All tools that start with `users.`\n * `users.getUser` - A specific tool\n *\n */\nexport function filterTools(\n tools: Record<string, Record<string, KnockTool>>,\n pattern: string | undefined\n): KnockTool[] {\n if (!pattern) {\n throw new Error(\"No pattern provided\");\n }\n\n // If the pattern is `*`, return all tools\n if (pattern === \"*\") {\n return Object.values(tools).flatMap((category) => Object.values(category));\n }\n\n const [category, tool] = pattern.split(\".\");\n\n // If the pattern is `*.*`, return all tools\n if (category === \"*\" && tool === \"*\") {\n return Object.values(tools).flatMap((category) => Object.values(category));\n }\n\n if (category && !tools[category]) {\n throw new Error(`Tool category ${category} not found`);\n }\n\n // If the pattern is `users.*`, return all tools that start with `users.`\n if (category && tool === \"*\") {\n return Object.values(tools[category]);\n }\n\n // If the pattern is `users.getUser`, return the `getUser` tool\n if (category && tool && !tools[category][tool]) {\n throw new Error(`Tool ${pattern} not found`);\n }\n\n return [tools[category][tool]];\n}\n\n/**\n * Given a category and a list of permissions, return a list of tools that the user has permission to use.\n *\n * @param category - The category to get tools for\n * @param categoryPermissions - The permissions to use\n * @returns A list of tools that the user has permission to use\n */\nexport function getToolsWithPermissions(\n category: keyof typeof toolPermissions,\n categoryPermissions: Record<string, boolean | undefined>\n) {\n // Return all of the tools for the category that have permission\n const toolsInCategory = tools[category] as Record<string, KnockTool>;\n const toolPermissionsInCategory = toolPermissions[category] as Record<\n string,\n string[]\n >;\n\n // Look over each permission type, like `read: true`\n // If it's `true`, then find all of the tools that have that permission\n return Object.entries(categoryPermissions).reduce(\n (acc: KnockTool[], [permissionType, hasPermission]) => {\n if (hasPermission) {\n return acc.concat(\n toolPermissionsInCategory[permissionType].map(\n (toolName) => toolsInCategory[toolName]\n )\n );\n }\n return acc;\n },\n []\n );\n}\n\n/**\n * Given a config, return a list of tools for each category that the user has permission to use.\n *\n * @param config - The config to use\n * @returns A list of tools for each category that the user has permission to use\n */\nexport function getToolsByPermissionsInCategories(\n config: ToolkitConfig\n): Record<ToolCategory, KnockTool[]> {\n return Object.keys(config.permissions).reduce(\n (acc, category) => {\n const categoryKey = category as ToolCategory;\n const categoryPermissions = config.permissions[categoryKey];\n\n if (tools[categoryKey] && categoryPermissions) {\n const tools = getToolsWithPermissions(categoryKey, categoryPermissions);\n\n return { ...acc, [categoryKey]: tools };\n }\n\n return acc;\n },\n {} as Record<ToolCategory, KnockTool[]>\n );\n}\n","import { Knock } from \"@knocklabs/node\";\nimport KnockMgmt from \"@knocklabs/mgmt\";\nimport { Config } from \"../types.js\";\n\nconst serviceTokensToApiClients: Record<string, Record<string, Knock>> = {};\n\ntype KnockClient = ReturnType<typeof createKnockClient>;\n\nconst createKnockClient = (config: Config) => {\n const client = new KnockMgmt({\n serviceToken: config.serviceToken,\n });\n\n return Object.assign(client, {\n publicApi: async (environmentSlug?: string): Promise<Knock> => {\n const environment =\n environmentSlug ?? config.environment ?? \"development\";\n\n // If the client already exists for this service token and environment, return it\n if (serviceTokensToApiClients?.[config.serviceToken]?.[environment]) {\n return serviceTokensToApiClients[config.serviceToken][environment];\n }\n\n // Otherwise, fetch a public API key for this service token and environment\n const { api_key } = await client.apiKeys.exchange({ environment });\n\n // Create a new Knock client with the public API key\n const knock = new Knock(api_key);\n\n // Store the client in the cache\n if (!serviceTokensToApiClients[config.serviceToken]) {\n serviceTokensToApiClients[config.serviceToken] = {};\n }\n\n serviceTokensToApiClients[config.serviceToken][environment] = knock;\n\n return knock;\n },\n });\n};\n\nexport { createKnockClient, type KnockClient };\n"],"mappings":";;;;;;AAeO,SAAS,YACdA,QACA,SACa;AACb,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAGA,MAAI,YAAY,KAAK;AACnB,WAAO,OAAO,OAAOA,MAAK,EAAE,QAAQ,CAACC,cAAa,OAAO,OAAOA,SAAQ,CAAC;AAAA,EAC3E;AAEA,QAAM,CAAC,UAAU,IAAI,IAAI,QAAQ,MAAM,GAAG;AAG1C,MAAI,aAAa,OAAO,SAAS,KAAK;AACpC,WAAO,OAAO,OAAOD,MAAK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BAAmE,CAAC;AAI1E,IAAM,oBAAoB,CAAC,WAAmB;AAC5C,QAAM,SAAS,IAAI,UAAU;AAAA,IAC3B,cAAc,OAAO;AAAA,EACvB,CAAC;AAED,SAAO,OAAO,OAAO,QAAQ;AAAA,IAC3B,WAAW,OAAO,oBAA6C;AAC7D,YAAM,cACJ,mBAAmB,OAAO,eAAe;AAG3C,UAAI,4BAA4B,OAAO,YAAY,IAAI,WAAW,GAAG;AACnE,eAAO,0BAA0B,OAAO,YAAY,EAAE,WAAW;AAAA,MACnE;AAGA,YAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,QAAQ,SAAS,EAAE,YAAY,CAAC;AAGjE,YAAM,QAAQ,IAAI,MAAM,OAAO;AAG/B,UAAI,CAAC,0BAA0B,OAAO,YAAY,GAAG;AACnD,kCAA0B,OAAO,YAAY,IAAI,CAAC;AAAA,MACpD;AAEA,gCAA0B,OAAO,YAAY,EAAE,WAAW,IAAI;AAE9D,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;","names":["tools","category"]}
@@ -1,12 +1,12 @@
1
1
  import { ZodObject } from 'zod';
2
- import { C as Config } from '../types-DyB12-Gk.js';
2
+ import { C as Config } from '../types-BePFw9M2.js';
3
3
  import { Knock } from '@knocklabs/node';
4
4
  import KnockMgmt from '@knocklabs/mgmt';
5
5
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
6
 
7
7
  type KnockClient = ReturnType<typeof createKnockClient>;
8
8
  declare const createKnockClient: (config: Config) => KnockMgmt & {
9
- publicApi: (_environment?: string) => Promise<Knock>;
9
+ publicApi: (environmentSlug?: string) => Promise<Knock>;
10
10
  };
11
11
 
12
12
  interface KnockToolDefinition {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createKnockMcpServer
3
- } from "../chunk-B6DIDKFY.js";
4
- import "../chunk-RPKDXX4O.js";
3
+ } from "../chunk-GGZXDBNR.js";
4
+ import "../chunk-3NU2K26A.js";
5
5
  export {
6
6
  createKnockMcpServer
7
7
  };
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- createKnockMcpServer
4
- } from "../chunk-B6DIDKFY.js";
5
2
  import {
6
3
  createKnockClient,
7
4
  filterTools
8
- } from "../chunk-ZV2SOIO7.js";
5
+ } from "../chunk-NOMOK3LZ.js";
6
+ import {
7
+ createKnockMcpServer
8
+ } from "../chunk-GGZXDBNR.js";
9
9
  import {
10
10
  tools
11
- } from "../chunk-RPKDXX4O.js";
11
+ } from "../chunk-3NU2K26A.js";
12
12
 
13
13
  // src/modelcontextprotocol/local-server.ts
14
14
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -1,5 +1,5 @@
1
1
  import { ChatCompletionTool, ChatCompletionMessageToolCall, ChatCompletionToolMessageParam } from 'openai/resources.mjs';
2
- import { T as ToolkitConfig, a as ToolCategory } from '../types-DyB12-Gk.js';
2
+ import { T as ToolkitConfig, a as ToolCategory } from '../types-BePFw9M2.js';
3
3
 
4
4
  declare const createKnockToolkit: (config: ToolkitConfig) => {
5
5
  /**
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createKnockClient,
3
3
  getToolsByPermissionsInCategories
4
- } from "../chunk-ZV2SOIO7.js";
5
- import "../chunk-RPKDXX4O.js";
4
+ } from "../chunk-NOMOK3LZ.js";
5
+ import "../chunk-3NU2K26A.js";
6
6
 
7
7
  // src/openai/tool-converter.ts
8
8
  import { z } from "zod";
@@ -37,7 +37,7 @@ declare const toolPermissions: {
37
37
  workflows: {
38
38
  read: string[];
39
39
  manage: string[];
40
- trigger: string[];
40
+ run: string[];
41
41
  };
42
42
  };
43
43
 
@@ -70,4 +70,4 @@ interface ToolkitConfig extends Config {
70
70
  }
71
71
  type ToolCategory = keyof typeof toolPermissions;
72
72
 
73
- export { type Config as C, type ToolkitConfig as T, type ToolCategory as a, toolPermissions as t };
73
+ export type { Config as C, ToolkitConfig as T, ToolCategory as a };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knocklabs/agent-toolkit",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A toolkit for working with Knock in Agent workflows.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/modelcontextprotocol/adapter.ts","../src/modelcontextprotocol/index.ts"],"sourcesContent":["import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport type { KnockTool } from \"../lib/knock-tool.js\";\nimport { Config } from \"../types.js\";\nimport { KnockClient } from \"../lib/knock-client.js\";\n\nexport class KnockMcpServer extends McpServer {\n constructor(knockClient: KnockClient, config: Config, tools: KnockTool[]) {\n super({ name: \"Knock\", version: \"0.1.0\" });\n\n tools.forEach((tool) => {\n const toolParams = tool.parameters ?? z.object({});\n\n this.tool(\n tool.name,\n tool.description,\n toolParams.shape,\n async (arg: unknown) => {\n const res = await tool.bindExecute(knockClient, config)(arg);\n\n return {\n content: [{ type: \"text\" as const, text: JSON.stringify(res) }],\n };\n }\n );\n });\n }\n}\n","import type { KnockTool } from \"../lib/knock-tool.js\";\nimport { allTools } from \"../lib/tools/index.js\";\nimport { KnockMcpServer } from \"./adapter.js\";\nimport { Config } from \"../types.js\";\nimport { KnockClient } from \"../lib/knock-client.js\";\n\ntype CreateKnockMcpServerParams = {\n /**\n * Array of Knock tools to enable in the server.\n */\n tools?: KnockTool[];\n\n /**\n * A Knock client to use for the server.\n */\n knockClient: KnockClient;\n\n /**\n * The config to use for the server.\n */\n config: Config;\n};\n\n/**\n * Creates a Knock MCP Server with the given parameters.\n */\nexport const createKnockMcpServer = async (\n params: CreateKnockMcpServerParams\n): Promise<KnockMcpServer> => {\n const { tools, knockClient, config } = params;\n\n return Promise.resolve(\n new KnockMcpServer(knockClient, config, tools || Object.values(allTools))\n );\n};\n"],"mappings":";;;;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,SAAS;AAKX,IAAM,iBAAN,cAA6B,UAAU;AAAA,EAC5C,YAAY,aAA0B,QAAgB,OAAoB;AACxE,UAAM,EAAE,MAAM,SAAS,SAAS,QAAQ,CAAC;AAEzC,UAAM,QAAQ,CAAC,SAAS;AACtB,YAAM,aAAa,KAAK,cAAc,EAAE,OAAO,CAAC,CAAC;AAEjD,WAAK;AAAA,QACH,KAAK;AAAA,QACL,KAAK;AAAA,QACL,WAAW;AAAA,QACX,OAAO,QAAiB;AACtB,gBAAM,MAAM,MAAM,KAAK,YAAY,aAAa,MAAM,EAAE,GAAG;AAE3D,iBAAO;AAAA,YACL,SAAS,CAAC,EAAE,MAAM,QAAiB,MAAM,KAAK,UAAU,GAAG,EAAE,CAAC;AAAA,UAChE;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;;;ACDO,IAAM,uBAAuB,OAClC,WAC4B;AAC5B,QAAM,EAAE,OAAO,aAAa,OAAO,IAAI;AAEvC,SAAO,QAAQ;AAAA,IACb,IAAI,eAAe,aAAa,QAAQ,SAAS,OAAO,OAAO,QAAQ,CAAC;AAAA,EAC1E;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/knock-tool.ts","../src/lib/tools/channels.ts","../src/lib/tools/commits.ts","../src/lib/tools/email-layouts.ts","../src/lib/tools/environments.ts","../src/lib/tools/messages.ts","../src/lib/tools/message-types.ts","../src/lib/tools/objects.ts","../src/lib/tools/partials.ts","../src/lib/tools/tenants.ts","../src/lib/tools/users.ts","../src/lib/tools/workflows.ts","../src/lib/tools/index.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","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 { 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","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","import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\n\nconst getMessageContent = KnockTool({\n method: \"get_message_content\",\n name: \"Get message content\",\n description: `\n Retrieves the complete contents of a single message, specified by the messageId. The message contents includes the rendered template that was sent to the recipient. Use this tool when you want to surface information about the emails, SMS, and push notifications that were sent to a user.\n `,\n parameters: z.object({\n messageId: z\n .string()\n .describe(\"(string): The messageId of the message to retrieve.\"),\n }),\n execute: (knockClient) => async (params) => {\n const publicClient = await knockClient.publicApi();\n return await publicClient.messages.getContent(params.messageId);\n },\n});\n\nexport const messages = {\n getMessageContent,\n};\n\nexport const permissions = {\n read: [\"getMessageContent\"],\n};\n","import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\nimport { MessageType } from \"@knocklabs/mgmt/resources/message-types.js\";\n\nconst listMessageTypes = KnockTool({\n method: \"list_message_types\",\n name: \"List message types\",\n description:\n \"List all message types available for the environment. Each message type returns the schema, which includes information about the variants and the fields available per-variant. Use this tool when you need to understand the different message types that are available for the environment for use in Guides.\",\n parameters: z.object({\n environment: z\n .string()\n .describe(\n \"(string): The environment to list message types for. Defaults to `development`.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const allMessageTypes: MessageType[] = [];\n for await (const messageType of knockClient.messageTypes.list({\n environment: params.environment ?? config.environment ?? \"development\",\n })) {\n allMessageTypes.push(messageType);\n }\n return allMessageTypes;\n },\n});\n\nconst createOrUpdateMessageType = KnockTool({\n method: \"create_or_update_message_type\",\n name: \"Create or update message type\",\n description: `\n Create or update a message type. A message type is a schema that defines fields available to an editor within Knock. Message types always have at least one variant, that MUST be named \"default\".\n \n Use this tool when you need to create a new message type, or update an existing message type. You must pass the FULL message type to this tool if you're going to update an existing message type.\n\n The preview is a string of HTML that will be rendered in the Knock UI as a representation of the message type. It is shared across all variants. It supports liquid, where the field name is available as a variable, so a field named \"text\" will be rendered as {{ text }}.\n\n <example>\n <description>\n Create a new message type for a banner component that has a text and an action URL.\n </description>\n <input>\n {\n \"messageTypeKey\": \"banner\",\n \"name\": \"Banner\",\n \"description\": \"A banner component that has a text and an action URL.\",\n \"preview\": \"<div>{{ text }}</div>\",\n \"variants\": [\n {\n \"key\": \"default\",\n \"name\": \"Default\",\n \"fields\": [\n {\n \"key\": \"text\",\n \"type\": \"text\",\n \"label\": \"Text\",\n \"settings\": {\n \"max_length\": 100,\n },\n },\n {\n \"key\": \"action_url\",\n \"type\": \"text\",\n \"label\": \"Action URL\",\n \"settings\": {\n \"placeholder\": \"https://example.com\",\n },\n }\n ]\n }\n ]\n }\n </input>\n </example>\n <example>\n <description>\n Create a message type for a card component that has an icon type, title, body, and a single action button.\n </description>\n <input>\n {\n \"messageTypeKey\": \"card\",\n \"name\": \"Card\",\n \"description\": \"A single-action card component.\",\n \"preview\": \"\n <div>\n <h2>{{ title }}</h2>\n <p>{{ body }}</p>\n <button>Action</button>\n </div>\n \",\n \"variants\": [\n {\n \"key\": \"default\",\n \"name\": \"Default\",\n \"fields\": [\n {\n \"key\": \"icon_type\",\n \"type\": \"select\",\n \"label\": \"Icon type\",\n \"settings\": {\n \"options\": [\n {\n \"value\": \"warning\",\n \"label\": \"Warning\",\n },\n {\n \"value\": \"success\",\n \"label\": \"Success\",\n },\n {\n \"value\": \"info\",\n \"label\": \"Info\",\n },\n {\n \"value\": \"error\",\n \"label\": \"Error\",\n },\n ]\n },\n },\n {\n \"key\": \"title\",\n \"type\": \"text\",\n \"label\": \"Title\",\n },\n {\n \"key\": \"description\",\n \"type\": \"markdown\",\n \"label\": \"Description\",\n },\n {\n \"key\": \"action_button\",\n \"type\": \"button\",\n \"label\": \"Action button\",\n },\n ]\n }\n ]\n }\n </input>\n </example>\n `,\n parameters: z.object({\n messageTypeKey: z\n .string()\n .describe(\"(string): The key of the message type to create or update.\"),\n name: z.string().describe(\"(string): The name of the message type.\"),\n description: z\n .string()\n .optional()\n .describe(\"(string): The description of the message type.\"),\n preview: z\n .string()\n .optional()\n .describe(\n \"(string): The preview of the variant. This is a string of HTML that will be rendered in the preview of the message type. There is a single preview shared by all variants.\"\n ),\n variants: z\n .array(\n z.object({\n key: z.string().describe(\"(string): The key of the variant.\"),\n name: z.string().describe(\"(string): The name of the variant.\"),\n description: z\n .string()\n .optional()\n .describe(\"(string): The description of the variant.\"),\n fields: z\n .array(\n z.object({\n key: z.string().describe(\"(string): The key of the field.\"),\n type: z\n .string()\n .describe(\n \"(string): The type of the field. One of `text`, `textarea`, `button`, `markdown`, `select`, `multi_select`.\"\n ),\n label: z.string().describe(\"(string): The label of the field.\"),\n settings: z\n .object({})\n .describe(\"(object): The settings of the field.\"),\n })\n )\n .describe(\"(array): The fields of the variant.\"),\n })\n )\n .describe(\"(array): The variants of the message type.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n return await knockClient.messageTypes.upsert(params.messageTypeKey, {\n message_type: {\n name: params.name,\n variants: params.variants,\n description: params.description ?? \"\",\n preview: params.preview ?? \"<div></div>\",\n },\n environment: params.environment ?? config.environment ?? \"development\",\n });\n },\n});\n\nexport const messageTypes = {\n listMessageTypes,\n createOrUpdateMessageType,\n};\n\nexport const permissions = {\n read: [\"listMessageTypes\"],\n manage: [\"createOrUpdateMessageType\"],\n};\n","import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\n\nconst listObjects = KnockTool({\n method: \"list_objects\",\n name: \"List objects\",\n description:\n \"List all objects in a single collection. Objects are used to model custom collections in Knock that are NOT users or tenants. Use this tool when you need to return a paginated list of objects in a single collection.\",\n parameters: z.object({\n collection: z\n .string()\n .describe(\"(string): The collection to list objects from.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n return await publicClient.objects.list(params.collection);\n },\n});\n\nconst getObject = KnockTool({\n method: \"get_object\",\n name: \"Get object\",\n description:\n \"Get an object wihin a collection. Returns information about the object including any custom properties. Use this tool when you need to retrieve an object to understand it's properties.\",\n parameters: z.object({\n collection: z\n .string()\n .describe(\"(string): The collection to get the object from.\"),\n objectId: z.string().describe(\"(string): The ID of the object to get.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n return await publicClient.objects.get(params.collection, params.objectId);\n },\n});\n\nconst createOrUpdateObject = KnockTool({\n method: \"create_or_update_object\",\n name: \"Create or update object\",\n description: `Create or update an object in a specific collection. Objects are used to model custom collections in Knock that are NOT users or tenants. If the object does not exist, it will be created. If the object exists, it will be updated with the provided properties. The update will always perform an upsert operation, so you do not need to provide the full properties each time.\n \n Use this tool when you need to create a new object, or update an existing custom-object. Custom objects can be used to subscribe users' to as lists, and also send non-user facing notifications to.`,\n parameters: z.object({\n collection: z\n .string()\n .describe(\"(string): The collection to create or update the object in.\"),\n objectId: z\n .string()\n .describe(\"(string): The ID of the object to create or update.\"),\n properties: z\n .record(z.string(), z.any())\n .describe(\"(object): The properties to set on the object.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n return await publicClient.objects.set(\n params.collection,\n params.objectId,\n params.properties\n );\n },\n});\n\nconst deleteObject = KnockTool({\n method: \"delete_object\",\n name: \"Delete object\",\n description: `Delete an object from a specific collection. Use this tool when you need to remove an object from the system.`,\n parameters: z.object({\n collection: z\n .string()\n .describe(\"(string): The collection to delete the object from.\"),\n objectId: z.string().describe(\"(string): The ID of the object to delete.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n await publicClient.objects.delete(params.collection, params.objectId);\n return { success: true };\n },\n});\n\nconst subscribeUsersToObject = KnockTool({\n method: \"subscribe_users_to_object\",\n name: \"Subscribe users to object\",\n description: `\n Subscribe a list of users to an object in a specific collection. We use this to model lists of users, for pub-sub use cases.\n \n Use this tool when you need to subscribe one or more users to an object where you will then trigger workflows for those lists of users to send notifications to.\n\n Before using this tool, you should create the object in the collection using the createOrUpdateObject tool.\n `,\n parameters: z.object({\n collection: z\n .string()\n .describe(\"(string): The collection to subscribe the user to.\"),\n objectId: z\n .string()\n .describe(\"(string): The ID of the object to subscribe the user to.\"),\n userIds: z\n .array(z.string())\n .describe(\n \"(array): The IDs of the users to subscribe to the object. If not provided, the current user will be subscribed.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n return await publicClient.objects.addSubscriptions(\n params.collection,\n params.objectId,\n {\n recipients: params.userIds ?? [config.userId],\n }\n );\n },\n});\n\nconst unsubscribeUsersFromObject = KnockTool({\n method: \"unsubscribe_users_from_object\",\n name: \"Unsubscribe users from object\",\n description: `Unsubscribe a list of users from an object in a specific collection. We use this to model lists of users, for pub-sub use cases.\n \n Use this tool when you need to unsubscribe one or more users from an object where you will then trigger workflows for those lists of users to send notifications to.`,\n parameters: z.object({\n collection: z\n .string()\n .describe(\"(string): The collection to unsubscribe the user from.\"),\n objectId: z\n .string()\n .describe(\"(string): The ID of the object to unsubscribe the user from.\"),\n userIds: z\n .array(z.string())\n .describe(\n \"(array): The IDs of the users to unsubscribe from the object.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n return await publicClient.objects.deleteSubscriptions(\n params.collection,\n params.objectId,\n {\n recipients: params.userIds ?? [config.userId],\n }\n );\n },\n});\n\nexport const objects = {\n listObjects,\n getObject,\n createOrUpdateObject,\n deleteObject,\n subscribeUsersToObject,\n unsubscribeUsersFromObject,\n};\n\nexport const permissions = {\n read: [\"listObjects\", \"getObject\"],\n manage: [\n \"createOrUpdateObject\",\n \"deleteObject\",\n \"subscribeUsersToObject\",\n \"unsubscribeUsersFromObject\",\n ],\n};\n","import { KnockTool } from \"../knock-tool.js\";\nimport { z } from \"zod\";\nimport { Partial } from \"@knocklabs/mgmt/resources/partials.js\";\n\nconst listPartials = KnockTool({\n method: \"list_partials\",\n name: \"List partials\",\n description: `List all partials within the environment given. Partials provide common building blocks for notification templates. Returns information about the partial, including the name and the key.\n \n Use this tool when you need to know the available partials for the environment, like when building a notification template and wanting to use a partial to build the template.`,\n parameters: z.object({\n environment: z\n .string()\n .describe(\n \"(string): The environment to list partials for. Defaults to `development`.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const allPartials: Partial[] = [];\n for await (const partial of knockClient.partials.list({\n environment: params.environment ?? config.environment ?? \"development\",\n })) {\n allPartials.push(partial);\n }\n return allPartials;\n },\n});\n\nexport const partials = {\n listPartials,\n};\n\nexport const permissions = {\n read: [\"listPartials\"],\n};\n","import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\n\nconst getTenant = KnockTool({\n method: \"get_tenant\",\n name: \"Get tenant\",\n description: `\n Retrieves a tenant by their ID. Tenants in Knock are used to model organizations, teams, and other groups of users. They are a special type of object.\n \n Use this tool when you need to lookup the information about a tenant, including name, and if there are any custom properties set.\n `,\n parameters: z.object({\n tenantId: z\n .string()\n .describe(\"(string): The ID of the tenant to retrieve.\"),\n }),\n execute: (knockClient) => async (params) => {\n const publicClient = await knockClient.publicApi();\n return await publicClient.tenants.get(params.tenantId);\n },\n});\n\nconst setTenant = KnockTool({\n method: \"set_tenant\",\n name: \"Set tenant\",\n description: `\n Creates or updates a tenant using the properties provided. Tenants in Knock are used to model organizations, teams, and other groups of users. They are a special type of object.\n \n Use this tool when you need to create a new tenant, or update an existing tenant's properties.\n `,\n parameters: z.object({\n tenantId: z.string().describe(\"(string): The ID of the tenant to update.\"),\n name: z.string().describe(\"(string): The name of the tenant.\"),\n properties: z\n .record(z.string(), z.any())\n .describe(\"(object): The properties to set on the tenant.\"),\n }),\n execute: (knockClient) => async (params) => {\n const publicClient = await knockClient.publicApi();\n return await publicClient.tenants.set(params.tenantId, {\n name: params.name,\n ...params.properties,\n });\n },\n});\n\nconst deleteTenant = KnockTool({\n method: \"delete_tenant\",\n name: \"Delete tenant\",\n description: `\n Deletes a tenant. Tenants in Knock are used to model organizations, teams, and other groups of users. They are a special type of object.\n \n Use this tool when you've been asked to remove a tenant from the system.\n `,\n parameters: z.object({\n tenantId: z.string().describe(\"(string): The ID of the tenant to delete.\"),\n }),\n execute: (knockClient) => async (params) => {\n const publicClient = await knockClient.publicApi();\n await publicClient.tenants.delete(params.tenantId);\n return { success: true };\n },\n});\n\nexport const tenants = {\n getTenant,\n setTenant,\n deleteTenant,\n};\n\nexport const permissions = {\n read: [\"getTenant\"],\n manage: [\"setTenant\", \"deleteTenant\"],\n};\n","import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\n\nconst getUser = KnockTool({\n method: \"get_user\",\n name: \"Get user\",\n description: `\n Retrieves the complete user object for the given userId, including email, name, phone number, and any custom properties. Use this tool when you need to retrieve a user's complete profile.\n\n If the userId is not provided, it will use the userId from the config.\n `,\n parameters: z.object({\n userId: z\n .string()\n .describe(\"(string): The userId of the User to retrieve.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n\n return await publicClient.users.get(params.userId ?? config.userId);\n },\n});\n\nconst createOrUpdateUser = KnockTool({\n method: \"create_or_update_user\",\n name: \"Create or update user\",\n description: `\n Creates a new user if they don't exist, or updates the user object for the given userId, including email, name, phone number, and any custom properties.\n \n Use this tool when you need to update a user's profile.\n\n If the userId is not provided, it will use the userId from the config.\n `,\n parameters: z.object({\n userId: z.string().describe(\"(string): The userId of the User to update.\"),\n email: z.string().describe(\"(string): The email of the User to update.\"),\n name: z.string().describe(\"(string): The name of the User to update.\"),\n phoneNumber: z\n .string()\n .describe(\"(string): The phone number of the User to update.\"),\n customProperties: z\n .record(z.string(), z.any())\n .describe(\n \"(object): A dictionary of custom properties to update for the User.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n\n return await publicClient.users.identify(params.userId, {\n email: params.email,\n name: params.name,\n phone_number: params.phoneNumber,\n ...(params.customProperties ?? {}),\n });\n },\n});\n\nconst deleteUser = KnockTool({\n method: \"delete_user\",\n name: \"Delete user\",\n description: `\n Deletes a user. Use this tool when you've been asked to remove a user from the system.\n `,\n parameters: z.object({\n userId: z.string().describe(\"(string): The userId of the User to delete.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n await publicClient.users.delete(params.userId);\n return { success: true };\n },\n});\n\nconst getUserPreferences = KnockTool({\n method: \"get_user_preferences\",\n name: \"Get user preferences\",\n description: `\n Retrieves the user's notification preferences for the given userId.\n\n If the userId is not provided, it will use the userId from the config. \n `,\n parameters: z.object({\n userId: z\n .string()\n .describe(\n \"(string): The userId of the User to retrieve Preferences for.\"\n ),\n preferenceSetId: z\n .string()\n .describe(\n \"(string): The preferenceSetId of the User to retrieve preferences for. Defaults to `default`.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n\n return await publicClient.users.getPreferences(\n params.userId ?? config.userId,\n {\n preferenceSet: params.preferenceSetId ?? \"default\",\n }\n );\n },\n});\n\nconst setUserPreferences = KnockTool({\n method: \"set_user_preferences\",\n name: \"Set user preferences\",\n description: `\n Overwrites the user's notification preferences for the given userId. Allows setting per-workflow, per-category, or per-channel notification preferences. Use this tool when you are asked to update a user's notification preferences.\n\n If the userId is not provided, it will use the userId from the config.\n\n Instructions:\n\n - You must ALWAYS provide a full preference set to this tool.\n - When setting per-workflow preferences, the key in the object should be the workflow key.\n - Workflow and category preferences should always have channel types underneath.\n - The channel types available to you are: email, sms, push, chat, and in_app_feed.\n - To turn OFF a preference, you must set it to false.\n - To turn ON a preference, you must set it to true.\n\n <examples>\n <example>\n <description>\n Update the user's preferences to turn off email notifications for the \"welcome\" workflow.\n </description>\n <input>\n {\n \"workflows\": {\n \"welcome\": {\n \"channel_types\": {\n \"email\": false\n }\n }\n }\n }\n </example>\n </examples>\n `,\n parameters: z.object({\n userId: z\n .string()\n .describe(\"(string): The userId of the User to update preferences for.\"),\n workflows: z\n .record(z.string(), z.any())\n .describe(\n \"(object): The workflows to update where the key is the workflow key, and the value of the object is an object that contains a `channel_types` key with a boolean value for each channel type.\"\n ),\n categories: z\n .record(z.string(), z.any())\n .describe(\n \"(object): The categories to update where the key is the category key, and the value of the object is an object that contains a `channel_types` key with a boolean value for each channel type.\"\n ),\n channel_types: z\n .record(z.string(), z.boolean())\n .describe(\n \"(object): The channel types to update where the key is the channel type, and the value of the object is a boolean value.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n\n const existingPreferences = await publicClient.users.getPreferences(\n params.userId ?? config.userId,\n {\n preferenceSet: \"default\",\n }\n );\n\n const updatedPreferences = {\n ...existingPreferences,\n workflows: {\n ...existingPreferences.workflows,\n ...params.workflows,\n },\n categories: {\n ...existingPreferences.categories,\n ...params.categories,\n },\n channel_types: {\n ...existingPreferences.channel_types,\n ...params.channel_types,\n },\n };\n\n return await publicClient.users.setPreferences(\n params.userId ?? config.userId,\n updatedPreferences\n );\n },\n});\n\nconst getUserMessages = KnockTool({\n method: \"get_user_messages\",\n name: \"Get user messages\",\n description: `\n Retrieves the messages that this user has received from the service. Use this tool when you need information about the notifications that the user has received, including if the message has been read, seen, or interacted with. This will return a list of messages across all of the channels.\n\n If the userId is not provided, it will use the userId from the config.\n `,\n parameters: z.object({\n userId: z\n .string()\n .describe(\"(string): The userId of the User to retrieve messages for.\"),\n workflowRunId: z\n .string()\n .describe(\n \"(string): The workflowRunId of the User to retrieve. Use this when you want to retrieve messages sent from a workflow trigger.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n\n return await publicClient.users.getMessages(\n params.userId ?? config.userId,\n {\n workflow_run_id: params.workflowRunId,\n }\n );\n },\n});\n\nexport const users = {\n getUser,\n deleteUser,\n createOrUpdateUser,\n getUserPreferences,\n setUserPreferences,\n getUserMessages,\n};\n\nexport const permissions = {\n read: [\"getUser\", \"getUserPreferences\", \"getUserMessages\"],\n manage: [\"createOrUpdateUser\", \"deleteUser\", \"setUserPreferences\"],\n};\n","import { z } from \"zod\";\nimport { KnockTool } from \"../knock-tool.js\";\nimport {\n Workflow,\n WorkflowUpsertParams,\n} from \"@knocklabs/mgmt/resources/index.js\";\n\nconst listWorkflows = KnockTool({\n method: \"list_workflows\",\n name: \"List workflows\",\n description: `\n List all workflows available for the given environment. Returns structural information about the workflows, including the key, name, description, and categories. Will also return the steps that make up the workflow. \n\n Use this tool when you need to understand which workflows are available to be called. \n `,\n parameters: z.object({\n environment: z\n .string()\n .describe(\n \"(string): The environment to list workflows for. Defaults to `development`.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const allWorkflows: Workflow[] = [];\n const listParams = {\n environment: params.environment ?? config.environment ?? \"development\",\n };\n\n for await (const workflow of knockClient.workflows.list(listParams)) {\n allWorkflows.push(workflow);\n }\n return allWorkflows;\n },\n});\n\nconst triggerWorkflow = KnockTool({\n method: \"trigger_workflow\",\n name: \"Trigger workflow\",\n description: `\n Trigger a workflow for one or more recipients.\n\n Use this tool when you need to trigger a workflow to send a notification across the channels configured for the workflow. The workflow must be committed in the environment for you to trigger it.\n\n When recipients aren't provided, the workflow will be triggered for the current user specified in the config.\n `,\n parameters: z.object({\n workflowKey: z\n .string()\n .describe(\"(string): The key of the workflow to trigger.\"),\n recipients: z\n .array(z.string())\n .describe(\"(array): The recipients to trigger the workflow for.\"),\n data: z\n .record(z.string(), z.any())\n .describe(\"(object): Data to pass to the workflow.\"),\n tenant: z\n .record(z.string(), z.any())\n .describe(\n \"(object): The tenant to trigger the workflow for. Must contain an id if being sent.\"\n ),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n\n const result = await publicClient.workflows.trigger(params.workflowKey, {\n recipients: params.recipients,\n data: params.data,\n tenant: params.tenant,\n });\n\n return result.workflow_run_id;\n },\n});\n\nconst createEmailWorkflow = KnockTool({\n method: \"create_email_workflow\",\n name: \"Create email workflow\",\n description: `\n Creates a simple email workflow with a single step that sends an email to the recipient. Use this tool when you need to need to create an email notification, and you don't need to specify any additional steps. You can only create workflows in the development environment.\n\n The content of the email you supply should ONLY ever be in markdown format for simplicity. You can supply dynamic variables to the subject and body of the email using the liquid template language.\n\n When writing markdown, be sure to use headings (##) to separate sections of the email. Use an informal writing style, and avoid using complex language.\n\n The following variables are available to use in the email subject and body:\n\n - \\`recipient.name\\`: The name of the recipient.\n - \\`recipient.email\\`: The email of the recipient.\n - \\`recipient.phone_number\\`: The phone number of the recipient.\n - \\`tenant.id\\`: The id of the tenant.\n - \\`tenant.name\\`: The name of the tenant.\n\n You can supply any other dynamic variables by referencing them under the \\`data\\` key in the \\`data\\` parameter when triggering the workflow. You add those like \\`{{ data.variable_name }}\\`.\n\n You can also supply a list of categories to the workflow. These are used to categorize workflows for notification preferences. Categories should be supplied as lowercase strings in kebab case.\n\n Once you've created the workflow, you should ask if you should commit the changes to the environment.\n `,\n parameters: z.object({\n environment: z\n .string()\n .describe(\n \"(string): The environment to create the workflow in. Defaults to `development`.\"\n ),\n workflowKey: z.string().describe(\"(string): The key of the workflow.\"),\n name: z.string().describe(\"(string): The name of the workflow.\"),\n categories: z\n .array(z.string())\n .describe(\"(array): The categories to add to the workflow.\"),\n subject: z.string().describe(\"(string): The subject of the email.\"),\n body: z.string().describe(\"(string): The body of the email.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const emailChannelsPage = await knockClient.channels.list();\n const emailChannels = emailChannelsPage.entries.filter(\n (channel) => channel.type === \"email\"\n );\n\n if (emailChannels.length === 0) {\n throw new Error(\"No email channels found\");\n }\n\n const workflowParams: WorkflowUpsertParams = {\n environment: params.environment ?? config.environment ?? \"development\",\n workflow: {\n name: params.name,\n categories: params.categories ?? [],\n steps: [\n {\n type: \"channel\",\n channel_key: emailChannels[0].key,\n template: {\n settings: {\n layout_key: \"default\",\n },\n subject: params.subject,\n visual_blocks: [\n // @ts-ignore\n {\n type: \"markdown\",\n content: params.body,\n },\n ],\n },\n name: \"Email\",\n ref: \"email_1\",\n },\n ],\n },\n };\n\n return await knockClient.workflows.upsert(\n params.workflowKey,\n workflowParams\n );\n },\n});\n\nconst createOneOffWorkflowSchedule = KnockTool({\n method: \"create_one_off_workflow_schedule\",\n name: \"Create one-off workflow schedule\",\n description: `\n Create a one-off workflow schedule for a user. Use this tool when you need to schedule the execution of a workflow for a specific user in the future, like to power a delayed notification.\n \n Schedules can accept a set of data that will be passed to the workflow trigger when it is executed. When the userId is not provided, the schedule will be created for the current user specified in the config.\n\n Examples:\n \n - In three days, send a welcome email to a user\n - In one hour, send a password reset email to a user\n - In two weeks, send a survey to a user\n `,\n parameters: z.object({\n workflowKey: z\n .string()\n .describe(\"(string): The key of the workflow to schedule.\"),\n userId: z\n .string()\n .describe(\n \"(string): The userId of the user to schedule the workflow for.\"\n ),\n scheduledAt: z\n .string()\n .describe(\n \"(string): The date and time to schedule the workflow for. Must be in ISO 8601 format.\"\n ),\n data: z\n .record(z.string(), z.any())\n .describe(\"(object): Data to pass to the workflow.\"),\n }),\n execute: (knockClient, config) => async (params) => {\n const publicClient = await knockClient.publicApi();\n\n return await publicClient.workflows.createSchedules(params.workflowKey, {\n recipients: [params.userId ?? config.userId],\n scheduled_at: params.scheduledAt,\n data: params.data,\n });\n },\n});\n\nexport const workflows = {\n listWorkflows,\n triggerWorkflow,\n createEmailWorkflow,\n createOneOffWorkflowSchedule,\n};\n\nexport const permissions = {\n read: [\"listWorkflows\"],\n manage: [\"createEmailWorkflow\", \"createOneOffWorkflowSchedule\"],\n trigger: [\"triggerWorkflow\"],\n};\n","import { channels, permissions as channelsPermissions } from \"./channels.js\";\nimport { commits, permissions as commitsPermissions } from \"./commits.js\";\nimport {\n emailLayouts,\n permissions as emailLayoutsPermissions,\n} from \"./email-layouts.js\";\nimport {\n environments,\n permissions as environmentsPermissions,\n} from \"./environments.js\";\nimport { messages, permissions as messagesPermissions } from \"./messages.js\";\nimport {\n messageTypes,\n permissions as messageTypesPermissions,\n} from \"./message-types.js\";\nimport { objects, permissions as objectsPermissions } from \"./objects.js\";\nimport { partials, permissions as partialsPermissions } from \"./partials.js\";\nimport { tenants, permissions as tenantsPermissions } from \"./tenants.js\";\nimport { users, permissions as usersPermissions } from \"./users.js\";\nimport { workflows, permissions as workflowsPermissions } from \"./workflows.js\";\n\nexport const tools = {\n channels,\n commits,\n emailLayouts,\n environments,\n messages,\n messageTypes,\n objects,\n partials,\n tenants,\n users,\n workflows,\n};\n\nexport const allTools = {\n ...channels,\n ...commits,\n ...emailLayouts,\n ...environments,\n ...messageTypes,\n ...messages,\n ...objects,\n ...partials,\n ...tenants,\n ...users,\n ...workflows,\n};\n\nexport const toolPermissions = {\n channels: channelsPermissions,\n commits: commitsPermissions,\n emailLayouts: emailLayoutsPermissions,\n environments: environmentsPermissions,\n messages: messagesPermissions,\n messageTypes: messageTypesPermissions,\n objects: objectsPermissions,\n partials: partialsPermissions,\n tenants: tenantsPermissions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A;AAAA,EACT,OAAOA;AAAA,EACP,WAAWA;AACb;","names":["z","z","permissions","z","permissions","permissions","z","z","permissions","z","z","permissions","z","z","permissions","z","permissions","z","z","permissions","z","z","permissions","z","z","permissions","permissions"]}