@knocklabs/agent-toolkit 0.2.0 → 0.4.0

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.
@@ -20,7 +20,23 @@ var KnockTool = (args) => {
20
20
  ...restOfArgs,
21
21
  parameters,
22
22
  fullDescription,
23
- bindExecute: (knockClient, config) => execute(knockClient, config)
23
+ bindExecute: (knockClient, config) => async (input) => {
24
+ try {
25
+ return await execute(knockClient, config)(input);
26
+ } catch (error) {
27
+ console.error(error);
28
+ if (error instanceof Error) {
29
+ return {
30
+ message: `An error occurred with the call to the Knock API: ${error.message}`,
31
+ error
32
+ };
33
+ }
34
+ return {
35
+ message: "An unknown error occurred with the call to the Knock API.",
36
+ error
37
+ };
38
+ }
39
+ }
24
40
  };
25
41
  };
26
42
 
@@ -251,8 +267,271 @@ var permissions5 = {
251
267
  read: ["listEnvironments"]
252
268
  };
253
269
 
254
- // src/lib/tools/message-types.ts
270
+ // src/lib/tools/guides.ts
271
+ import { z as z6 } from "zod";
272
+
273
+ // src/lib/tools/shared.ts
255
274
  import { z as z5 } from "zod";
275
+ var recipientSchema = z5.union([
276
+ z5.string().describe("A user ID (string)."),
277
+ z5.object({ id: z5.string(), collection: z5.string() }).describe("A reference to an object in a collection.")
278
+ ]).describe(
279
+ "A recipient can be a user ID or a reference to an object in a collection."
280
+ );
281
+ var conditionSchema = z5.object({
282
+ operator: z5.enum([
283
+ "equal_to",
284
+ "not_equal_to",
285
+ "greater_than",
286
+ "less_than",
287
+ "greater_than_or_equal_to",
288
+ "less_than_or_equal_to",
289
+ "contains",
290
+ "not_contains",
291
+ "contains_all",
292
+ "empty",
293
+ "not_empty"
294
+ ]).describe("(string): The operator to apply to the argument."),
295
+ value: z5.any().describe("(any): The value of the condition."),
296
+ argument: z5.string().optional().describe(
297
+ "(string): The argument of the condition. Can be empty when using empty or not_empty operators."
298
+ )
299
+ }).describe("(object): A condition.");
300
+
301
+ // src/lib/tools/guides.ts
302
+ function serializeGuide(guide) {
303
+ return {
304
+ key: guide.key,
305
+ name: guide.name,
306
+ description: guide.description,
307
+ type: guide.type,
308
+ active: guide.active,
309
+ steps: (guide.steps ?? []).map((step) => ({
310
+ ref: step.ref,
311
+ name: step.name,
312
+ schemaKey: step.schema_key,
313
+ schemaVariantKey: step.schema_variant_key,
314
+ schemaContent: step.values
315
+ }))
316
+ };
317
+ }
318
+ var listGuides = KnockTool({
319
+ method: "list_guides",
320
+ name: "List guides",
321
+ description: `
322
+ List all guides available for the given environment. Returns structural information about the guides, including the key, name, description, type, and status.
323
+
324
+ Use this tool when you need to understand which guides are available in the environment.
325
+ `,
326
+ parameters: z6.object({
327
+ environment: z6.string().optional().describe(
328
+ "(string): The environment to list guides for. Defaults to `development`."
329
+ ),
330
+ page_size: z6.number().optional().describe("(number): The number of guides to return per page."),
331
+ after: z6.string().optional().describe("(string): The cursor to use for pagination.")
332
+ }),
333
+ execute: (knockClient, config) => async (params) => {
334
+ const allGuides = [];
335
+ const listParams = {
336
+ environment: params.environment ?? config.environment ?? "development",
337
+ page_size: params.page_size,
338
+ after: params.after
339
+ };
340
+ for await (const guide of knockClient.guides.list(listParams)) {
341
+ allGuides.push(serializeGuide(guide));
342
+ }
343
+ return allGuides;
344
+ }
345
+ });
346
+ var getGuide = KnockTool({
347
+ method: "get_guide",
348
+ name: "Get guide",
349
+ description: `
350
+ Get a guide by its key. Returns structural information about the guide, including the key, name, description, type, and status.
351
+
352
+ Use this tool when you need to retrieve information about a specific guide.
353
+ `,
354
+ parameters: z6.object({
355
+ environment: z6.string().optional().describe(
356
+ "(string): The environment to get the guide for. Defaults to `development`."
357
+ ),
358
+ guideKey: z6.string().describe("(string): The key of the guide to get."),
359
+ hide_uncommitted_changes: z6.boolean().optional().describe(
360
+ "(boolean): Whether to hide uncommitted changes and return only published version."
361
+ )
362
+ }),
363
+ execute: (knockClient, config) => async (params) => {
364
+ const guide = await knockClient.guides.retrieve(params.guideKey, {
365
+ environment: params.environment ?? config.environment ?? "development",
366
+ hide_uncommitted_changes: params.hide_uncommitted_changes
367
+ });
368
+ return serializeGuide(guide);
369
+ }
370
+ });
371
+ var createOrUpdateGuide = KnockTool({
372
+ method: "upsert_guide",
373
+ name: "Upsert guide",
374
+ description: `
375
+ Create or update a guide. A guide defines an in-app guide that can be displayed to users based on priority and other conditions.
376
+
377
+ Use this tool when you need to create a new guide or update an existing one. The guide will be created with the specified configuration.
378
+
379
+ Note: This endpoint only operates on guides in the "development" environment.
380
+
381
+ ## Guide step schema
382
+
383
+ When working with guide steps, you must use a \`schemaKey\` and \`schemaVariantKey\` to reference the message type schema that the step's content conforms to. You can use the \`list_message_types\` tool to get a list of available message types and the available variants for that message type.
384
+
385
+ You **must** supply a \`schemaContent\` that sets the content for each of the fields in the \`fields\` object inside of the message type schema variant you select.
386
+
387
+ For example, if you have a message type schema with a \`fields\` object that looks like this:
388
+
389
+ \`\`\`json
390
+ {
391
+ "fields": {
392
+ "title": {
393
+ "type": "string",
394
+ "required": true
395
+ }
396
+ }
397
+ }
398
+ \`\`\`
399
+
400
+ You would need to supply a \`schemaContent\` that looks like this:
401
+
402
+ \`\`\`json
403
+ {
404
+ "title": "Hello, world!"
405
+ }
406
+ \`\`\`
407
+
408
+ ### Guide targeting
409
+
410
+ By default, a guide will target all users. If you want to target users with specific attributes, you can use \`targetPropertyConditions\` to describe the targeting conditions.
411
+
412
+ When using targeting conditions, you can use the following properties:
413
+
414
+ - \`recipient\`: Use a property on the recipient
415
+ - \`data\`: Use data coming from the application
416
+ - \`tenant\`: Use a property on the tenant
417
+
418
+ For example, if you want to target users with the email \`john.doe@example.com\`, you would supply the following targeting conditions:
419
+
420
+ \`\`\`json
421
+ [
422
+ { "operator": "equal_to", "value": "john.doe@example.com", "argument": "recipient.email" }
423
+ ]
424
+ \`\`\`
425
+
426
+ ### Activation location rules
427
+
428
+ You can supply a list of activation location rules to describe where in your application the guide should be shown. Each activation rule is a directive that describes whether the guide should be shown or hidden based on the pathname of the page.
429
+
430
+ For example, if you want to show the guide on all pages except for the \`admin\` path, you would supply the following activation location rules:
431
+
432
+ \`\`\`json
433
+ [
434
+ { "directive": "allow", "pathname": "*" },
435
+ { "directive": "block", "pathname": "/admin" }
436
+ ]
437
+ \`\`\`
438
+ `,
439
+ parameters: z6.object({
440
+ environment: z6.string().optional().describe(
441
+ "(string): The environment to upsert the guide for. Defaults to `development`."
442
+ ),
443
+ guideKey: z6.string().describe(
444
+ "(string): The key of the guide to upsert. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$."
445
+ ),
446
+ name: z6.string().describe(
447
+ "(string): A name for the guide. Must be at maximum 255 characters in length."
448
+ ),
449
+ channelKey: z6.string().optional().describe(
450
+ "(string): The key of the channel in which the guide exists. Defaults to `knock-guide`."
451
+ ).default("knock-guide"),
452
+ description: z6.string().optional().describe(
453
+ "(string): An arbitrary string attached to a guide object. Maximum of 280 characters allowed."
454
+ ),
455
+ step: z6.object({
456
+ name: z6.string().describe("(string): The name of the step.").optional().default("Default"),
457
+ ref: z6.string().describe("(string): The unique identifier of the step.").optional().default("default"),
458
+ schemaKey: z6.string().describe(
459
+ "(string): The key of the schema that the step's content conforms to."
460
+ ),
461
+ schemaVariantKey: z6.string().describe(
462
+ "(string): The key of the schema variant that the step's content conforms to."
463
+ ).optional().default("default"),
464
+ schemaContent: z6.record(z6.string(), z6.any()).describe(
465
+ "(object): A map of values that make up the step's content. Each value must conform to its respective template schema field settings."
466
+ )
467
+ }).describe("(object): The guide step to upsert."),
468
+ targetPropertyConditions: z6.array(conditionSchema).describe(
469
+ "(array): A list of property conditions that describe the target audience for the guide. Conditions are joined as AND operations."
470
+ ),
471
+ activationLocationRules: z6.array(
472
+ z6.object({
473
+ directive: z6.enum(["allow", "block"]).describe(
474
+ "(string): The directive to apply to the activation location rule (allow or block)."
475
+ ),
476
+ pathname: z6.string().describe(
477
+ "(string): The pathname to target. Should correspond to a URI in your application."
478
+ )
479
+ })
480
+ ).describe(
481
+ "(array): A list of activation location rules that describe where in your application the guide should be shown."
482
+ )
483
+ }),
484
+ execute: (knockClient, config) => async (params) => {
485
+ const messageType = await knockClient.messageTypes.retrieve(
486
+ params.step.schemaKey,
487
+ {
488
+ environment: params.environment ?? config.environment ?? "development"
489
+ }
490
+ );
491
+ const schemaVariant = messageType.variants.find(
492
+ (variant) => variant.key === params.step.schemaVariantKey
493
+ );
494
+ if (!schemaVariant) {
495
+ throw new Error(
496
+ `Schema variant ${params.step.schemaVariantKey} not found in message type ${messageType.key}`
497
+ );
498
+ }
499
+ const result = await knockClient.guides.upsert(params.guideKey, {
500
+ environment: params.environment ?? config.environment ?? "development",
501
+ guide: {
502
+ name: params.name,
503
+ description: params.description,
504
+ channel_key: params.channelKey ?? "knock-guide",
505
+ steps: [
506
+ {
507
+ ref: params.step.ref ?? "default",
508
+ schema_key: messageType.key,
509
+ schema_semver: messageType.semver,
510
+ schema_variant_key: schemaVariant.key,
511
+ values: params.step.schemaContent
512
+ }
513
+ ],
514
+ target_property_conditions: {
515
+ all: params.targetPropertyConditions
516
+ },
517
+ activation_location_rules: params.activationLocationRules
518
+ }
519
+ });
520
+ return serializeGuide(result.guide);
521
+ }
522
+ });
523
+ var guides = {
524
+ listGuides,
525
+ getGuide,
526
+ createOrUpdateGuide
527
+ };
528
+ var permissions6 = {
529
+ read: ["listGuides", "getGuide"],
530
+ manage: ["createOrUpdateGuide"]
531
+ };
532
+
533
+ // src/lib/tools/message-types.ts
534
+ import { z as z7 } from "zod";
256
535
  function serializeMessageTypeResponse(messageType) {
257
536
  return {
258
537
  key: messageType.key,
@@ -265,8 +544,8 @@ var listMessageTypes = KnockTool({
265
544
  method: "list_message_types",
266
545
  name: "List message types",
267
546
  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.",
268
- parameters: z5.object({
269
- environment: z5.string().optional().describe(
547
+ parameters: z7.object({
548
+ environment: z7.string().optional().describe(
270
549
  "(string): The environment to list message types for. Defaults to `development`."
271
550
  )
272
551
  }),
@@ -328,29 +607,29 @@ var createOrUpdateMessageType = KnockTool({
328
607
  }
329
608
  </example>
330
609
  `,
331
- parameters: z5.object({
332
- environment: z5.string().optional().describe(
610
+ parameters: z7.object({
611
+ environment: z7.string().optional().describe(
333
612
  "(string): The environment to create or update the message type in. Defaults to `development`."
334
613
  ),
335
- messageTypeKey: z5.string().describe("(string): The key of the message type to create or update."),
336
- name: z5.string().describe("(string): The name of the message type."),
337
- description: z5.string().optional().describe("(string): The description of the message type."),
338
- preview: z5.string().optional().describe(
614
+ messageTypeKey: z7.string().describe("(string): The key of the message type to create or update."),
615
+ name: z7.string().describe("(string): The name of the message type."),
616
+ description: z7.string().optional().describe("(string): The description of the message type."),
617
+ preview: z7.string().optional().describe(
339
618
  "(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."
340
619
  ),
341
- variants: z5.array(
342
- z5.object({
343
- key: z5.string().describe("(string): The key of the variant."),
344
- name: z5.string().describe("(string): The name of the variant."),
345
- description: z5.string().optional().describe("(string): The description of the variant."),
346
- fields: z5.array(
347
- z5.object({
348
- key: z5.string().describe("(string): The key of the field."),
349
- type: z5.string().describe(
620
+ variants: z7.array(
621
+ z7.object({
622
+ key: z7.string().describe("(string): The key of the variant."),
623
+ name: z7.string().describe("(string): The name of the variant."),
624
+ description: z7.string().optional().describe("(string): The description of the variant."),
625
+ fields: z7.array(
626
+ z7.object({
627
+ key: z7.string().describe("(string): The key of the field."),
628
+ type: z7.string().describe(
350
629
  "(string): The type of the field. One of `text`, `textarea`, `button`, `markdown`, `select`, `multi_select`, `image`."
351
630
  ),
352
- label: z5.string().describe("(string): The label of the field."),
353
- settings: z5.object({}).optional().describe("(object): The settings of the field.")
631
+ label: z7.string().describe("(string): The label of the field."),
632
+ settings: z7.object({}).optional().describe("(object): The settings of the field.")
354
633
  })
355
634
  ).describe("(array): The fields of the variant.")
356
635
  })
@@ -372,24 +651,24 @@ var messageTypes = {
372
651
  listMessageTypes,
373
652
  createOrUpdateMessageType
374
653
  };
375
- var permissions6 = {
654
+ var permissions7 = {
376
655
  read: ["listMessageTypes"],
377
656
  manage: ["createOrUpdateMessageType"]
378
657
  };
379
658
 
380
659
  // src/lib/tools/messages.ts
381
- import { z as z6 } from "zod";
660
+ import { z as z8 } from "zod";
382
661
  var getMessageContent = KnockTool({
383
662
  method: "get_message_content",
384
663
  name: "Get message content",
385
664
  description: `
386
665
  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.
387
666
  `,
388
- parameters: z6.object({
389
- environment: z6.string().optional().describe(
667
+ parameters: z8.object({
668
+ environment: z8.string().optional().describe(
390
669
  "(string): The environment to retrieve the message from. Defaults to `development`."
391
670
  ),
392
- messageId: z6.string().describe("(string): The messageId of the message to retrieve.")
671
+ messageId: z8.string().describe("(string): The messageId of the message to retrieve.")
393
672
  }),
394
673
  execute: (knockClient) => async (params) => {
395
674
  const publicClient = await knockClient.publicApi(params.environment);
@@ -399,21 +678,21 @@ var getMessageContent = KnockTool({
399
678
  var messages = {
400
679
  getMessageContent
401
680
  };
402
- var permissions7 = {
681
+ var permissions8 = {
403
682
  read: ["getMessageContent"]
404
683
  };
405
684
 
406
685
  // src/lib/tools/objects.ts
407
- import { z as z7 } from "zod";
686
+ import { z as z9 } from "zod";
408
687
  var listObjects = KnockTool({
409
688
  method: "list_objects",
410
689
  name: "List objects",
411
690
  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.",
412
- parameters: z7.object({
413
- environment: z7.string().optional().describe(
691
+ parameters: z9.object({
692
+ environment: z9.string().optional().describe(
414
693
  "(string): The environment to list objects from. Defaults to `development`."
415
694
  ),
416
- collection: z7.string().describe("(string): The collection to list objects from.")
695
+ collection: z9.string().describe("(string): The collection to list objects from.")
417
696
  }),
418
697
  execute: (knockClient, _config) => async (params) => {
419
698
  const publicClient = await knockClient.publicApi(params.environment);
@@ -424,12 +703,12 @@ var getObject = KnockTool({
424
703
  method: "get_object",
425
704
  name: "Get object",
426
705
  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.",
427
- parameters: z7.object({
428
- environment: z7.string().optional().describe(
706
+ parameters: z9.object({
707
+ environment: z9.string().optional().describe(
429
708
  "(string): The environment to get the object from. Defaults to `development`."
430
709
  ),
431
- collection: z7.string().describe("(string): The collection to get the object from."),
432
- objectId: z7.string().describe("(string): The ID of the object to get.")
710
+ collection: z9.string().describe("(string): The collection to get the object from."),
711
+ objectId: z9.string().describe("(string): The ID of the object to get.")
433
712
  }),
434
713
  execute: (knockClient, _config) => async (params) => {
435
714
  const publicClient = await knockClient.publicApi(params.environment);
@@ -442,13 +721,13 @@ var createOrUpdateObject = KnockTool({
442
721
  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.
443
722
 
444
723
  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.`,
445
- parameters: z7.object({
446
- environment: z7.string().optional().describe(
724
+ parameters: z9.object({
725
+ environment: z9.string().optional().describe(
447
726
  "(string): The environment to create or update the object in. Defaults to `development`."
448
727
  ),
449
- collection: z7.string().describe("(string): The collection to create or update the object in."),
450
- objectId: z7.string().describe("(string): The ID of the object to create or update."),
451
- properties: z7.record(z7.string(), z7.any()).optional().describe("(object): The properties to set on the object.")
728
+ collection: z9.string().describe("(string): The collection to create or update the object in."),
729
+ objectId: z9.string().describe("(string): The ID of the object to create or update."),
730
+ properties: z9.record(z9.string(), z9.any()).optional().describe("(object): The properties to set on the object.")
452
731
  }),
453
732
  execute: (knockClient, _config) => async (params) => {
454
733
  const publicClient = await knockClient.publicApi(params.environment);
@@ -469,13 +748,13 @@ var subscribeUsersToObject = KnockTool({
469
748
 
470
749
  Before using this tool, you should create the object in the collection using the createOrUpdateObject tool.
471
750
  `,
472
- parameters: z7.object({
473
- environment: z7.string().optional().describe(
751
+ parameters: z9.object({
752
+ environment: z9.string().optional().describe(
474
753
  "(string): The environment to subscribe the user to. Defaults to `development`."
475
754
  ),
476
- collection: z7.string().describe("(string): The collection to subscribe the user to."),
477
- objectId: z7.string().describe("(string): The ID of the object to subscribe the user to."),
478
- userIds: z7.array(z7.string()).describe(
755
+ collection: z9.string().describe("(string): The collection to subscribe the user to."),
756
+ objectId: z9.string().describe("(string): The ID of the object to subscribe the user to."),
757
+ userIds: z9.array(z9.string()).describe(
479
758
  "(array): The IDs of the users to subscribe to the object. If not provided, the current user will be subscribed."
480
759
  )
481
760
  }),
@@ -496,13 +775,13 @@ var unsubscribeUsersFromObject = KnockTool({
496
775
  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.
497
776
 
498
777
  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.`,
499
- parameters: z7.object({
500
- environment: z7.string().optional().describe(
778
+ parameters: z9.object({
779
+ environment: z9.string().optional().describe(
501
780
  "(string): The environment to unsubscribe the user from. Defaults to `development`."
502
781
  ),
503
- collection: z7.string().describe("(string): The collection to unsubscribe the user from."),
504
- objectId: z7.string().describe("(string): The ID of the object to unsubscribe the user from."),
505
- userIds: z7.array(z7.string()).describe(
782
+ collection: z9.string().describe("(string): The collection to unsubscribe the user from."),
783
+ objectId: z9.string().describe("(string): The ID of the object to unsubscribe the user from."),
784
+ userIds: z9.array(z9.string()).describe(
506
785
  "(array): The IDs of the users to unsubscribe from the object."
507
786
  )
508
787
  }),
@@ -524,7 +803,7 @@ var objects = {
524
803
  subscribeUsersToObject,
525
804
  unsubscribeUsersFromObject
526
805
  };
527
- var permissions8 = {
806
+ var permissions9 = {
528
807
  read: ["listObjects", "getObject"],
529
808
  manage: [
530
809
  "createOrUpdateObject",
@@ -534,7 +813,7 @@ var permissions8 = {
534
813
  };
535
814
 
536
815
  // src/lib/tools/partials.ts
537
- import { z as z8 } from "zod";
816
+ import { z as z10 } from "zod";
538
817
  function serializePartial(partial) {
539
818
  return {
540
819
  key: partial.key,
@@ -549,8 +828,8 @@ var listPartials = KnockTool({
549
828
  description: `
550
829
  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.
551
830
  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.`,
552
- parameters: z8.object({
553
- environment: z8.string().optional().describe(
831
+ parameters: z10.object({
832
+ environment: z10.string().optional().describe(
554
833
  "(string): The environment to list partials for. Defaults to `development`."
555
834
  )
556
835
  }),
@@ -570,11 +849,11 @@ var getPartial = KnockTool({
570
849
  description: `
571
850
  Get a partial by its key. Use this tool when you need to know if a specific partial exists by key.
572
851
  `,
573
- parameters: z8.object({
574
- environment: z8.string().optional().describe(
852
+ parameters: z10.object({
853
+ environment: z10.string().optional().describe(
575
854
  "(string): The environment to get the partial for. Defaults to `development`."
576
855
  ),
577
- key: z8.string().describe("(string): The key of the partial to get.")
856
+ key: z10.string().describe("(string): The key of the partial to get.")
578
857
  }),
579
858
  execute: (knockClient, config) => async (params) => {
580
859
  const partial = await knockClient.partials.retrieve(params.key, {
@@ -604,15 +883,15 @@ var createOrUpdatePartial = KnockTool({
604
883
 
605
884
  Changes to a partial MUST be committed before they can be used in a template.
606
885
  `,
607
- parameters: z8.object({
608
- environment: z8.string().optional().describe(
886
+ parameters: z10.object({
887
+ environment: z10.string().optional().describe(
609
888
  "(string): The environment to upsert the partial for. Defaults to `development`."
610
889
  ),
611
- key: z8.string().describe("(string): The key of the partial to upsert."),
612
- name: z8.string().describe("(string): The name of the partial."),
613
- description: z8.string().optional().describe("(string): The description of the partial."),
614
- content: z8.string().describe("(string): The content of the partial."),
615
- type: z8.enum(["html", "text", "json", "markdown"]).describe("(string): The type of the partial.")
890
+ key: z10.string().describe("(string): The key of the partial to upsert."),
891
+ name: z10.string().describe("(string): The name of the partial."),
892
+ description: z10.string().optional().describe("(string): The description of the partial."),
893
+ content: z10.string().describe("(string): The content of the partial."),
894
+ type: z10.enum(["html", "text", "json", "markdown"]).describe("(string): The type of the partial.")
616
895
  }),
617
896
  execute: (knockClient, config) => async (params) => {
618
897
  const partial = await knockClient.partials.upsert(params.key, {
@@ -632,13 +911,13 @@ var partials = {
632
911
  listPartials,
633
912
  createOrUpdatePartial
634
913
  };
635
- var permissions9 = {
914
+ var permissions10 = {
636
915
  read: ["getPartial", "listPartials"],
637
916
  manage: ["createOrUpdatePartial"]
638
917
  };
639
918
 
640
919
  // src/lib/tools/tenants.ts
641
- import { z as z9 } from "zod";
920
+ import { z as z11 } from "zod";
642
921
  var getTenant = KnockTool({
643
922
  method: "get_tenant",
644
923
  name: "Get tenant",
@@ -647,11 +926,11 @@ var getTenant = KnockTool({
647
926
 
648
927
  Use this tool when you need to lookup the information about a tenant, including name, and if there are any custom properties set.
649
928
  `,
650
- parameters: z9.object({
651
- environment: z9.string().optional().describe(
929
+ parameters: z11.object({
930
+ environment: z11.string().optional().describe(
652
931
  "(string): The environment to retrieve the tenant from. Defaults to `development`."
653
932
  ),
654
- tenantId: z9.string().describe("(string): The ID of the tenant to retrieve.")
933
+ tenantId: z11.string().describe("(string): The ID of the tenant to retrieve.")
655
934
  }),
656
935
  execute: (knockClient) => async (params) => {
657
936
  const publicClient = await knockClient.publicApi(params.environment);
@@ -666,8 +945,8 @@ var listTenants = KnockTool({
666
945
 
667
946
  Use this tool when you need to list all tenants in an environment.
668
947
  `,
669
- parameters: z9.object({
670
- environment: z9.string().optional().describe(
948
+ parameters: z11.object({
949
+ environment: z11.string().optional().describe(
671
950
  "(string): The environment to retrieve the tenants from. Defaults to `development`."
672
951
  )
673
952
  }),
@@ -684,13 +963,13 @@ var createOrUpdateTenant = KnockTool({
684
963
 
685
964
  Use this tool when you need to create a new tenant, or update an existing tenant's properties.
686
965
  `,
687
- parameters: z9.object({
688
- environment: z9.string().optional().describe(
966
+ parameters: z11.object({
967
+ environment: z11.string().optional().describe(
689
968
  "(string): The environment to set the tenant in. Defaults to `development`."
690
969
  ),
691
- tenantId: z9.string().describe("(string): The ID of the tenant to update."),
692
- name: z9.string().optional().describe("(string): The name of the tenant."),
693
- properties: z9.record(z9.string(), z9.any()).optional().describe("(object): The properties to set on the tenant.")
970
+ tenantId: z11.string().describe("(string): The ID of the tenant to update."),
971
+ name: z11.string().optional().describe("(string): The name of the tenant."),
972
+ properties: z11.record(z11.string(), z11.any()).optional().describe("(object): The properties to set on the tenant.")
694
973
  }),
695
974
  execute: (knockClient) => async (params) => {
696
975
  const publicClient = await knockClient.publicApi(params.environment);
@@ -705,28 +984,17 @@ var tenants = {
705
984
  listTenants,
706
985
  createOrUpdateTenant
707
986
  };
708
- var permissions10 = {
987
+ var permissions11 = {
709
988
  read: ["getTenant", "listTenants"],
710
989
  manage: ["createOrUpdateTenant"]
711
990
  };
712
991
 
713
992
  // src/lib/tools/users.ts
714
- import { z as z12 } from "zod";
993
+ import { z as z13 } from "zod";
715
994
 
716
995
  // src/lib/tools/workflows-as-tools.ts
717
996
  import jsonSchemaToZod from "json-schema-to-zod";
718
- import { z as z11 } from "zod";
719
-
720
- // src/lib/tools/shared.ts
721
- import { z as z10 } from "zod";
722
- var recipientSchema = z10.union([
723
- z10.string().describe("A user ID (string)."),
724
- z10.object({ id: z10.string(), collection: z10.string() }).describe("A reference to an object in a collection.")
725
- ]).describe(
726
- "A recipient can be a user ID or a reference to an object in a collection."
727
- );
728
-
729
- // src/lib/tools/workflows-as-tools.ts
997
+ import { z as z12 } from "zod";
730
998
  function workflowAsTool(workflow) {
731
999
  return KnockTool({
732
1000
  method: `trigger_${workflow.key.replace("-", "_")}_workflow`,
@@ -736,18 +1004,18 @@ function workflowAsTool(workflow) {
736
1004
  ${workflow.description ? `Additional information to consider on when to use this tool: ${workflow.description}` : ""}
737
1005
 
738
1006
  Returns the workflow run ID, which can be used to lookup messages produced by the workflow.`,
739
- parameters: z11.object({
740
- environment: z11.string().optional(),
1007
+ parameters: z12.object({
1008
+ environment: z12.string().optional(),
741
1009
  actor: recipientSchema.optional().describe("An optional actor to trigger the workflow with."),
742
- recipients: z11.array(recipientSchema).describe(
1010
+ recipients: z12.array(recipientSchema).describe(
743
1011
  "An optional array of recipients to trigger the workflow with."
744
1012
  ).optional(),
745
1013
  // Here we dynamically generate a zod schema from the workflow's `trigger_data_json_schema`
746
1014
  // This allows us to validate the data passed to the workflow
747
1015
  data: workflow.trigger_data_json_schema ? eval(jsonSchemaToZod(workflow.trigger_data_json_schema)).describe(
748
1016
  "The data to pass to the workflow."
749
- ) : z11.record(z11.string(), z11.any()).optional().describe("The data to pass to the workflow."),
750
- tenant: z11.string().optional().describe("The tenant ID to trigger the workflow for.")
1017
+ ) : z12.record(z12.string(), z12.any()).optional().describe("The data to pass to the workflow."),
1018
+ tenant: z12.string().optional().describe("The tenant ID to trigger the workflow for.")
751
1019
  }),
752
1020
  execute: (knockClient, config) => async (params) => {
753
1021
  const publicClient = await knockClient.publicApi(params.environment);
@@ -874,11 +1142,11 @@ var getUser = KnockTool({
874
1142
 
875
1143
  If the userId is not provided, it will use the userId from the config.
876
1144
  `,
877
- parameters: z12.object({
878
- environment: z12.string().optional().describe(
1145
+ parameters: z13.object({
1146
+ environment: z13.string().optional().describe(
879
1147
  "(string): The environment to retrieve the user from. Defaults to `development`."
880
1148
  ),
881
- userId: z12.string().optional().describe("(string): The userId of the User to retrieve.")
1149
+ userId: z13.string().optional().describe("(string): The userId of the User to retrieve.")
882
1150
  }),
883
1151
  execute: (knockClient, config) => async (params) => {
884
1152
  const publicClient = await knockClient.publicApi(params.environment);
@@ -896,15 +1164,15 @@ var createOrUpdateUser = KnockTool({
896
1164
 
897
1165
  If the userId is not provided, it will use the userId from the config.
898
1166
  `,
899
- parameters: z12.object({
900
- environment: z12.string().optional().describe(
1167
+ parameters: z13.object({
1168
+ environment: z13.string().optional().describe(
901
1169
  "(string): The environment to create or update the user in. Defaults to `development`."
902
1170
  ),
903
- userId: z12.string().optional().describe("(string): The userId of the User to update."),
904
- email: z12.string().optional().describe("(string): The email of the User to update."),
905
- name: z12.string().optional().describe("(string): The name of the User to update."),
906
- phoneNumber: z12.string().optional().describe("(string): The phone number of the User to update."),
907
- customProperties: z12.record(z12.string(), z12.any()).optional().describe(
1171
+ userId: z13.string().optional().describe("(string): The userId of the User to update."),
1172
+ email: z13.string().optional().describe("(string): The email of the User to update."),
1173
+ name: z13.string().optional().describe("(string): The name of the User to update."),
1174
+ phoneNumber: z13.string().optional().describe("(string): The phone number of the User to update."),
1175
+ customProperties: z13.record(z13.string(), z13.any()).optional().describe(
908
1176
  "(object): A dictionary of custom properties to update for the User."
909
1177
  )
910
1178
  }),
@@ -930,14 +1198,14 @@ var getUserPreferences = KnockTool({
930
1198
 
931
1199
  If the userId is not provided, it will use the userId from the config.
932
1200
  `,
933
- parameters: z12.object({
934
- environment: z12.string().optional().describe(
1201
+ parameters: z13.object({
1202
+ environment: z13.string().optional().describe(
935
1203
  "(string): The environment to retrieve the user preferences from. Defaults to `development`."
936
1204
  ),
937
- userId: z12.string().optional().describe(
1205
+ userId: z13.string().optional().describe(
938
1206
  "(string): The userId of the User to retrieve Preferences for."
939
1207
  ),
940
- preferenceSetId: z12.string().optional().describe(
1208
+ preferenceSetId: z13.string().optional().describe(
941
1209
  "(string): The preferenceSetId of the User to retrieve preferences for. Defaults to `default`."
942
1210
  )
943
1211
  }),
@@ -986,18 +1254,18 @@ var setUserPreferences = KnockTool({
986
1254
  </example>
987
1255
  </examples>
988
1256
  `,
989
- parameters: z12.object({
990
- environment: z12.string().optional().describe(
1257
+ parameters: z13.object({
1258
+ environment: z13.string().optional().describe(
991
1259
  "(string): The environment to set the user preferences in. Defaults to `development`."
992
1260
  ),
993
- userId: z12.string().optional().describe("(string): The userId of the User to update preferences for."),
994
- workflows: z12.record(z12.string(), z12.any()).optional().describe(
1261
+ userId: z13.string().optional().describe("(string): The userId of the User to update preferences for."),
1262
+ workflows: z13.record(z13.string(), z13.any()).optional().describe(
995
1263
  "(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."
996
1264
  ),
997
- categories: z12.record(z12.string(), z12.any()).optional().describe(
1265
+ categories: z13.record(z13.string(), z13.any()).optional().describe(
998
1266
  "(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."
999
1267
  ),
1000
- channel_types: z12.record(z12.string(), z12.boolean()).optional().describe(
1268
+ channel_types: z13.record(z13.string(), z13.boolean()).optional().describe(
1001
1269
  "(object): The channel types to update where the key is the channel type, and the value of the object is a boolean value."
1002
1270
  )
1003
1271
  }),
@@ -1038,12 +1306,12 @@ var getUserMessages = KnockTool({
1038
1306
 
1039
1307
  If the userId is not provided, it will use the userId from the config.
1040
1308
  `,
1041
- parameters: z12.object({
1042
- environment: z12.string().optional().describe(
1309
+ parameters: z13.object({
1310
+ environment: z13.string().optional().describe(
1043
1311
  "(string): The environment to retrieve the user messages from. Defaults to `development`."
1044
1312
  ),
1045
- userId: z12.string().optional().describe("(string): The userId of the User to retrieve messages for."),
1046
- workflowRunId: z12.string().optional().describe(
1313
+ userId: z13.string().optional().describe("(string): The userId of the User to retrieve messages for."),
1314
+ workflowRunId: z13.string().optional().describe(
1047
1315
  "(string): The workflowRunId of the User to retrieve. Use this when you want to retrieve messages sent from a workflow trigger."
1048
1316
  )
1049
1317
  }),
@@ -1065,16 +1333,16 @@ var users = {
1065
1333
  setUserPreferences,
1066
1334
  getUserMessages
1067
1335
  };
1068
- var permissions11 = {
1336
+ var permissions12 = {
1069
1337
  read: ["getUser", "getUserMessages", "getUserPreferences"],
1070
1338
  manage: ["createOrUpdateUser", "setUserPreferences"]
1071
1339
  };
1072
1340
 
1073
1341
  // src/lib/tools/workflows.ts
1074
- import { z as z14 } from "zod";
1342
+ import { z as z15 } from "zod";
1075
1343
 
1076
1344
  // src/lib/tools/workflow-steps.ts
1077
- import { z as z13 } from "zod";
1345
+ import { z as z14 } from "zod";
1078
1346
  function generateStepRef(stepType) {
1079
1347
  const randomString = Math.random().toString(36).substring(2, 7).toUpperCase();
1080
1348
  return `${stepType}_${randomString}`;
@@ -1136,39 +1404,39 @@ var SHARED_PROMPTS = {
1136
1404
  </example>
1137
1405
  `
1138
1406
  };
1139
- var contentBlockSchema = z13.union([
1140
- z13.object({
1141
- type: z13.literal("markdown"),
1142
- content: z13.string().describe("(string): The markdown content of the block.")
1407
+ var contentBlockSchema = z14.union([
1408
+ z14.object({
1409
+ type: z14.literal("markdown"),
1410
+ content: z14.string().describe("(string): The markdown content of the block.")
1143
1411
  }),
1144
- z13.object({
1145
- type: z13.literal("html"),
1146
- content: z13.string().describe("(string): The HTML content of the block.")
1412
+ z14.object({
1413
+ type: z14.literal("html"),
1414
+ content: z14.string().describe("(string): The HTML content of the block.")
1147
1415
  }),
1148
- z13.object({
1149
- type: z13.literal("image"),
1150
- url: z13.string().describe("(string): The URL of the image.")
1416
+ z14.object({
1417
+ type: z14.literal("image"),
1418
+ url: z14.string().describe("(string): The URL of the image.")
1151
1419
  }),
1152
- z13.object({
1153
- type: z13.literal("button_set"),
1154
- buttons: z13.array(
1155
- z13.object({
1156
- label: z13.string().describe("(string): The label of the button."),
1157
- action: z13.string().describe("(string): The action of the button."),
1158
- variant: z13.enum(["solid", "outline"]).default("solid").describe(
1420
+ z14.object({
1421
+ type: z14.literal("button_set"),
1422
+ buttons: z14.array(
1423
+ z14.object({
1424
+ label: z14.string().describe("(string): The label of the button."),
1425
+ action: z14.string().describe("(string): The action of the button."),
1426
+ variant: z14.enum(["solid", "outline"]).default("solid").describe(
1159
1427
  "(enum): The variant of the button. Defaults to `solid`."
1160
1428
  )
1161
1429
  })
1162
1430
  ).describe("(array): The buttons for the button set.")
1163
1431
  }),
1164
- z13.object({
1165
- type: z13.literal("divider")
1432
+ z14.object({
1433
+ type: z14.literal("divider")
1166
1434
  }),
1167
- z13.object({
1168
- type: z13.literal("partial"),
1169
- key: z13.string().describe("(string): The key of the partial to use."),
1170
- name: z13.string().describe("(string): The name of the partial."),
1171
- attrs: z13.record(z13.string(), z13.string()).describe(
1435
+ z14.object({
1436
+ type: z14.literal("partial"),
1437
+ key: z14.string().describe("(string): The key of the partial to use."),
1438
+ name: z14.string().describe("(string): The name of the partial."),
1439
+ attrs: z14.record(z14.string(), z14.string()).describe(
1172
1440
  "(object): The attributes for the partial. ALWAYS supply an empty object when you don't know which params are required."
1173
1441
  )
1174
1442
  })
@@ -1278,19 +1546,19 @@ Hello, {{ recipient.name }}."
1278
1546
 
1279
1547
  Unless asked otherwise, you should write content for the email in a concise and formal writing style. Do NOT use complex language or try to over explain. Keep the subject line to 8 words or less.
1280
1548
  `,
1281
- parameters: z13.object({
1282
- workflowKey: z13.string().describe("(string): The key of the workflow to add the step to."),
1283
- stepRef: z13.string().optional().describe(
1549
+ parameters: z14.object({
1550
+ workflowKey: z14.string().describe("(string): The key of the workflow to add the step to."),
1551
+ stepRef: z14.string().optional().describe(
1284
1552
  "(string): The reference of the step to update. If not provided, a new step will be created."
1285
1553
  ),
1286
- htmlContent: z13.string().describe(
1554
+ htmlContent: z14.string().optional().describe(
1287
1555
  "(string): The HTML content of the email template. Use this when not setting blocks."
1288
1556
  ),
1289
- blocks: z13.array(contentBlockSchema).describe(
1557
+ blocks: z14.array(contentBlockSchema).optional().describe(
1290
1558
  "(array): The blocks for the email step. Use this when you don't need to set HTML directly."
1291
1559
  ),
1292
- layoutKey: z13.string().describe("(string): The key of the layout to use for the email step."),
1293
- subject: z13.string().describe("(string): The subject of the email step.")
1560
+ layoutKey: z14.string().describe("(string): The key of the layout to use for the email step."),
1561
+ subject: z14.string().describe("(string): The subject of the email step.")
1294
1562
  }),
1295
1563
  execute: (knockClient, config) => async (params) => {
1296
1564
  const workflow2 = await knockClient.workflows.retrieve(params.workflowKey, {
@@ -1334,12 +1602,12 @@ var createOrUpdateSmsStepInWorkflow = KnockTool({
1334
1602
 
1335
1603
  ${SHARED_PROMPTS.liquid}
1336
1604
  `,
1337
- parameters: z13.object({
1338
- workflowKey: z13.string().describe("(string): The key of the workflow to add the step to."),
1339
- stepRef: z13.string().optional().describe(
1605
+ parameters: z14.object({
1606
+ workflowKey: z14.string().describe("(string): The key of the workflow to add the step to."),
1607
+ stepRef: z14.string().optional().describe(
1340
1608
  "(string): The reference of the step to update. If not provided, a new step will be created."
1341
1609
  ),
1342
- content: z13.string().describe("(string): The content of the SMS.")
1610
+ content: z14.string().describe("(string): The content of the SMS.")
1343
1611
  }),
1344
1612
  execute: (knockClient, config) => async (params) => {
1345
1613
  const workflow2 = await knockClient.workflows.retrieve(params.workflowKey, {
@@ -1380,13 +1648,13 @@ var createOrUpdatePushStepInWorkflow = KnockTool({
1380
1648
 
1381
1649
  Be terse in your writing as this is a push notification and should be direct and to the point.
1382
1650
  `,
1383
- parameters: z13.object({
1384
- workflowKey: z13.string().describe("(string): The key of the workflow to add the step to."),
1385
- stepRef: z13.string().optional().describe(
1651
+ parameters: z14.object({
1652
+ workflowKey: z14.string().describe("(string): The key of the workflow to add the step to."),
1653
+ stepRef: z14.string().optional().describe(
1386
1654
  "(string): The reference of the step to update. If not provided, a new step will be created."
1387
1655
  ),
1388
- title: z13.string().describe("(string): The title of the push notification."),
1389
- content: z13.string().describe("(string): The content (body) of the push notification.")
1656
+ title: z14.string().describe("(string): The title of the push notification."),
1657
+ content: z14.string().describe("(string): The content (body) of the push notification.")
1390
1658
  }),
1391
1659
  execute: (knockClient, config) => async (params) => {
1392
1660
  const workflow2 = await knockClient.workflows.retrieve(params.workflowKey, {
@@ -1426,15 +1694,15 @@ var createOrUpdateInAppFeedStepInWorkflow = KnockTool({
1426
1694
 
1427
1695
  ${SHARED_PROMPTS.liquid}
1428
1696
  `,
1429
- parameters: z13.object({
1430
- workflowKey: z13.string().describe("(string): The key of the workflow to add the step to."),
1431
- stepRef: z13.string().optional().describe(
1697
+ parameters: z14.object({
1698
+ workflowKey: z14.string().describe("(string): The key of the workflow to add the step to."),
1699
+ stepRef: z14.string().optional().describe(
1432
1700
  "(string): The reference of the step to update. If not provided, a new step will be created."
1433
1701
  ),
1434
- actionUrl: z13.string().describe(
1702
+ actionUrl: z14.string().describe(
1435
1703
  "(string): The URL to navigate to when the in app feed is tapped."
1436
1704
  ),
1437
- body: z13.string().describe("(string): The markdown content of the in app feed.")
1705
+ body: z14.string().describe("(string): The markdown content of the in app feed.")
1438
1706
  }),
1439
1707
  execute: (knockClient, config) => async (params) => {
1440
1708
  const workflow2 = await knockClient.workflows.retrieve(params.workflowKey, {
@@ -1474,12 +1742,12 @@ var createOrUpdateChatStepInWorkflow = KnockTool({
1474
1742
 
1475
1743
  ${SHARED_PROMPTS.liquid}
1476
1744
  `,
1477
- parameters: z13.object({
1478
- workflowKey: z13.string().describe("(string): The key of the workflow to add the step to."),
1479
- stepRef: z13.string().describe(
1745
+ parameters: z14.object({
1746
+ workflowKey: z14.string().describe("(string): The key of the workflow to add the step to."),
1747
+ stepRef: z14.string().describe(
1480
1748
  "(string): The reference of the step to update. If not provided, a new step will be created."
1481
1749
  ),
1482
- body: z13.string().describe("(string): The markdown content of the notification.")
1750
+ body: z14.string().describe("(string): The markdown content of the notification.")
1483
1751
  }),
1484
1752
  execute: (knockClient, config) => async (params) => {
1485
1753
  const workflow2 = await knockClient.workflows.retrieve(params.workflowKey, {
@@ -1525,13 +1793,13 @@ var createOrUpdateDelayStepInWorkflow = KnockTool({
1525
1793
  }
1526
1794
  </example>
1527
1795
  `,
1528
- parameters: z13.object({
1529
- workflowKey: z13.string().describe("(string): The key of the workflow to add the step to."),
1530
- stepRef: z13.string().optional().describe(
1796
+ parameters: z14.object({
1797
+ workflowKey: z14.string().describe("(string): The key of the workflow to add the step to."),
1798
+ stepRef: z14.string().optional().describe(
1531
1799
  "(string): The reference of the step to update. If not provided, a new step will be created."
1532
1800
  ),
1533
- delayValue: z13.number().describe("(number): The value of the delay."),
1534
- delayUnit: z13.enum(["seconds", "minutes", "hours", "days"]).describe("(enum): The unit of the delay.")
1801
+ delayValue: z14.number().describe("(number): The value of the delay."),
1802
+ delayUnit: z14.enum(["seconds", "minutes", "hours", "days"]).describe("(enum): The unit of the delay.")
1535
1803
  }),
1536
1804
  execute: (knockClient, config) => async (params) => {
1537
1805
  const workflow2 = await knockClient.workflows.retrieve(params.workflowKey, {
@@ -1584,14 +1852,14 @@ var createOrUpdateBatchStepInWorkflow = KnockTool({
1584
1852
  }
1585
1853
  </example>
1586
1854
  `,
1587
- parameters: z13.object({
1588
- workflowKey: z13.string().describe("(string): The key of the workflow to add the step to."),
1589
- stepRef: z13.string().optional().describe(
1855
+ parameters: z14.object({
1856
+ workflowKey: z14.string().describe("(string): The key of the workflow to add the step to."),
1857
+ stepRef: z14.string().optional().describe(
1590
1858
  "(string): The reference of the step to update. If not provided, a new step will be created."
1591
1859
  ),
1592
- batchWindow: z13.object({
1593
- value: z13.number().describe("(number): The value of the batch window."),
1594
- unit: z13.enum(["seconds", "minutes", "hours", "days"]).describe("(enum): The unit of the batch window.")
1860
+ batchWindow: z14.object({
1861
+ value: z14.number().describe("(number): The value of the batch window."),
1862
+ unit: z14.enum(["seconds", "minutes", "hours", "days"]).describe("(enum): The unit of the batch window.")
1595
1863
  })
1596
1864
  }),
1597
1865
  execute: (knockClient, config) => async (params) => {
@@ -1656,8 +1924,8 @@ var listWorkflows = KnockTool({
1656
1924
 
1657
1925
  Use this tool when you need to understand which workflows are available to be called.
1658
1926
  `,
1659
- parameters: z14.object({
1660
- environment: z14.string().optional().describe(
1927
+ parameters: z15.object({
1928
+ environment: z15.string().optional().describe(
1661
1929
  "(string): The environment to list workflows for. Defaults to `development`."
1662
1930
  )
1663
1931
  }),
@@ -1678,11 +1946,11 @@ var getWorkflow = KnockTool({
1678
1946
  description: `
1679
1947
  Get a workflow by key. Returns structural information about the workflow, including the key, name, description, and categories.
1680
1948
  `,
1681
- parameters: z14.object({
1682
- environment: z14.string().optional().describe(
1949
+ parameters: z15.object({
1950
+ environment: z15.string().optional().describe(
1683
1951
  "(string): The environment to get the workflow for. Defaults to `development`."
1684
1952
  ),
1685
- workflowKey: z14.string().describe("(string): The key of the workflow to get.")
1953
+ workflowKey: z15.string().describe("(string): The key of the workflow to get.")
1686
1954
  }),
1687
1955
  execute: (knockClient, config) => async (params) => {
1688
1956
  const workflow2 = await knockClient.workflows.retrieve(params.workflowKey, {
@@ -1703,16 +1971,16 @@ var triggerWorkflow = KnockTool({
1703
1971
 
1704
1972
  Returns the workflow run ID, which can be used to lookup messages produced by the workflow.
1705
1973
  `,
1706
- parameters: z14.object({
1707
- environment: z14.string().optional().describe(
1974
+ parameters: z15.object({
1975
+ environment: z15.string().optional().describe(
1708
1976
  "(string): The environment to trigger the workflow in. Defaults to `development`."
1709
1977
  ),
1710
- workflowKey: z14.string().describe("(string): The key of the workflow to trigger."),
1711
- recipients: z14.array(z14.string()).optional().describe(
1978
+ workflowKey: z15.string().describe("(string): The key of the workflow to trigger."),
1979
+ recipients: z15.array(z15.string()).optional().describe(
1712
1980
  "(array): The recipients to trigger the workflow for. This is an array of user IDs."
1713
1981
  ),
1714
- data: z14.record(z14.string(), z14.any()).optional().describe("(object): Data to pass to the workflow."),
1715
- tenant: z14.record(z14.string(), z14.any()).optional().describe(
1982
+ data: z15.record(z15.string(), z15.any()).optional().describe("(object): Data to pass to the workflow."),
1983
+ tenant: z15.record(z15.string(), z15.any()).optional().describe(
1716
1984
  "(object): The tenant to trigger the workflow for. Must contain an id if being sent."
1717
1985
  )
1718
1986
  }),
@@ -1732,16 +2000,16 @@ var createWorkflow = KnockTool({
1732
2000
  description: `
1733
2001
  Create a new workflow, which is used to control the flow of notifications. Use this tool when you're asked to create a new workflow, or you need to create a new workflow before adding a step to it.
1734
2002
  `,
1735
- parameters: z14.object({
1736
- environment: z14.string().optional().describe(
2003
+ parameters: z15.object({
2004
+ environment: z15.string().optional().describe(
1737
2005
  "(string): The environment to create the workflow in. Defaults to `development`."
1738
2006
  ),
1739
- workflowKey: z14.string().describe(
2007
+ workflowKey: z15.string().describe(
1740
2008
  "(string): The key of the workflow to create. Only use a kebab-case string with no spaces or special characters."
1741
2009
  ),
1742
- name: z14.string().describe("(string): The name of the workflow."),
1743
- description: z14.string().describe("(string): The description of the workflow."),
1744
- categories: z14.array(z14.string()).describe("(array): The categories to add to the workflow.")
2010
+ name: z15.string().describe("(string): The name of the workflow."),
2011
+ description: z15.string().describe("(string): The description of the workflow."),
2012
+ categories: z15.array(z15.string()).describe("(array): The categories to add to the workflow.")
1745
2013
  }),
1746
2014
  execute: (knockClient, config) => async (params) => {
1747
2015
  const result = await knockClient.workflows.upsert(params.workflowKey, {
@@ -1770,18 +2038,18 @@ var createOneOffWorkflowSchedule = KnockTool({
1770
2038
  - In one hour, send a password reset email to a user
1771
2039
  - In two weeks, send a survey to a user
1772
2040
  `,
1773
- parameters: z14.object({
1774
- environment: z14.string().optional().describe(
2041
+ parameters: z15.object({
2042
+ environment: z15.string().optional().describe(
1775
2043
  "(string): The environment to create the workflow in. Defaults to `development`."
1776
2044
  ),
1777
- workflowKey: z14.string().describe("(string): The key of the workflow to schedule."),
1778
- userId: z14.string().describe(
2045
+ workflowKey: z15.string().describe("(string): The key of the workflow to schedule."),
2046
+ userId: z15.string().describe(
1779
2047
  "(string): The userId of the user to schedule the workflow for."
1780
2048
  ),
1781
- scheduledAt: z14.string().describe(
2049
+ scheduledAt: z15.string().describe(
1782
2050
  "(string): The date and time to schedule the workflow for. Must be in ISO 8601 format."
1783
2051
  ),
1784
- data: z14.record(z14.string(), z14.any()).optional().describe("(object): Data to pass to the workflow.")
2052
+ data: z15.record(z15.string(), z15.any()).optional().describe("(object): Data to pass to the workflow.")
1785
2053
  }),
1786
2054
  execute: (knockClient, config) => async (params) => {
1787
2055
  const publicClient = await knockClient.publicApi(params.environment);
@@ -1800,7 +2068,7 @@ var workflows = {
1800
2068
  ...workflowStepTools,
1801
2069
  createOneOffWorkflowSchedule
1802
2070
  };
1803
- var permissions12 = {
2071
+ var permissions13 = {
1804
2072
  read: ["listWorkflows", "getWorkflow"],
1805
2073
  manage: [
1806
2074
  "createWorkflow",
@@ -1817,6 +2085,7 @@ var tools = {
1817
2085
  documentation,
1818
2086
  emailLayouts,
1819
2087
  environments,
2088
+ guides,
1820
2089
  messages,
1821
2090
  messageTypes,
1822
2091
  objects,
@@ -1831,6 +2100,7 @@ var allTools = {
1831
2100
  ...documentation,
1832
2101
  ...emailLayouts,
1833
2102
  ...environments,
2103
+ ...guides,
1834
2104
  ...messageTypes,
1835
2105
  ...messages,
1836
2106
  ...objects,
@@ -1845,13 +2115,14 @@ var toolPermissions = {
1845
2115
  documentation: permissions3,
1846
2116
  emailLayouts: permissions4,
1847
2117
  environments: permissions5,
1848
- messages: permissions7,
1849
- messageTypes: permissions6,
1850
- objects: permissions8,
1851
- partials: permissions9,
1852
- tenants: permissions10,
1853
- users: permissions11,
1854
- workflows: permissions12
2118
+ guides: permissions6,
2119
+ messages: permissions8,
2120
+ messageTypes: permissions7,
2121
+ objects: permissions9,
2122
+ partials: permissions10,
2123
+ tenants: permissions11,
2124
+ users: permissions12,
2125
+ workflows: permissions13
1855
2126
  };
1856
2127
 
1857
2128
  export {
@@ -1862,4 +2133,4 @@ export {
1862
2133
  getToolsByPermissionsInCategories,
1863
2134
  getToolMap
1864
2135
  };
1865
- //# sourceMappingURL=chunk-QG5UJT76.js.map
2136
+ //# sourceMappingURL=chunk-WSJ5XINN.js.map