samva 0.47.0 → 0.48.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.
@@ -53,4 +53,5 @@ export declare function defineAgent<const Tools extends Readonly<Record<string,
53
53
  readonly tools?: Tools;
54
54
  readonly events?: Readonly<Record<string, AgentEventHandler>>;
55
55
  readonly schedules?: Readonly<Record<string, AgentScheduleHandler>>;
56
+ readonly workflows?: ReadonlyArray<string>;
56
57
  }): AgentDefinition<Tools>;
@@ -43,7 +43,8 @@ function defineAgent(definition) {
43
43
  skills,
44
44
  tools,
45
45
  events,
46
- schedules
46
+ schedules,
47
+ workflows: definition.workflows ?? []
47
48
  };
48
49
  return agent;
49
50
  }
@@ -27,14 +27,29 @@ async function invokeAgent(agent, operation, capability, authority) {
27
27
  }
28
28
  });
29
29
  const counts = /* @__PURE__ */ new Map();
30
+ const samva = operation.kind === "event" ? clientWithIdempotency(client, (method) => {
31
+ const count = (counts.get(method) ?? 0) + 1;
32
+ counts.set(method, count);
33
+ return `${capability.agentId}:${operation.event.id}:${method}:${count}`;
34
+ }) : client;
35
+ const state = (call) => authority.state ? authority.state(call) : Promise.reject(/* @__PURE__ */ new Error("Agent module state is unavailable"));
30
36
  const ctx = {
31
37
  capability,
32
- samva: operation.kind === "event" ? clientWithIdempotency(client, (method) => {
33
- const count = (counts.get(method) ?? 0) + 1;
34
- counts.set(method, count);
35
- return `${capability.agentId}:${operation.event.id}:${method}:${count}`;
36
- }) : client,
38
+ samva,
37
39
  connections: { call: (integrationId, tool, input) => authority.connection(integrationId, tool, input) },
40
+ workflows: { start: (input) => authority.startWorkflow ? authority.startWorkflow(input) : Promise.reject(/* @__PURE__ */ new Error("Agent workflows are unavailable")) },
41
+ state: {
42
+ agent: { call: (name, input) => state({
43
+ scope: "agent",
44
+ operation: name,
45
+ input
46
+ }) },
47
+ conversation: { call: (name, input) => state({
48
+ scope: "conversation",
49
+ operation: name,
50
+ input
51
+ }) }
52
+ },
38
53
  memory: {
39
54
  search: (query) => authority.searchMemory(query),
40
55
  remember: (content) => authority.remember(content)
@@ -53,6 +68,12 @@ async function invokeAgent(agent, operation, capability, authority) {
53
68
  if (skill === void 0) throw new Error(`Unknown agent skill: ${operation.name}`);
54
69
  return skill;
55
70
  }
71
+ case "schedule": {
72
+ if (capability.trigger.kind !== "schedule" || capability.trigger.cron !== operation.cron || capability.trigger.scheduledAt !== operation.scheduledAt) throw new Error("The agent schedule does not match its call capability");
73
+ const handler = agent.schedules[operation.cron];
74
+ if (handler === void 0) throw new Error("Unknown agent schedule");
75
+ return await handler(ctx) ?? null;
76
+ }
56
77
  case "event": {
57
78
  if (capability.trigger.kind !== "event" || capability.trigger.eventId !== operation.event.id || capability.trigger.eventType !== operation.event.type || capability.trigger.attempt !== operation.attempt) throw new Error("The agent event does not match its call capability");
58
79
  const handler = agent.events[operation.event.type];
@@ -54,12 +54,32 @@ export interface AgentContext {
54
54
  readonly connections: {
55
55
  call(integrationId: string, tool: string, input: Readonly<Record<string, unknown>>): Promise<unknown>;
56
56
  };
57
+ readonly workflows?: {
58
+ start(input: AgentWorkflowStart): Promise<string>;
59
+ };
60
+ readonly state?: {
61
+ readonly agent: AgentState;
62
+ readonly conversation: AgentState;
63
+ };
57
64
  readonly memory: {
58
65
  search(query: string): Promise<ReadonlyArray<AgentMemoryMatch>>;
59
66
  remember(content: string): Promise<void>;
60
67
  };
61
68
  log(...values: ReadonlyArray<unknown>): void;
62
69
  }
70
+ export interface AgentWorkflowStart {
71
+ readonly exportName: string;
72
+ readonly idempotencyKey: string;
73
+ readonly input: Schema.Json;
74
+ }
75
+ export interface AgentState {
76
+ call(operation: string, input: Schema.Json): Promise<Schema.Json>;
77
+ }
78
+ export interface AgentStateCall {
79
+ readonly scope: "agent" | "conversation";
80
+ readonly operation: string;
81
+ readonly input: Schema.Json;
82
+ }
63
83
  export interface AgentEvent<Data = unknown> {
64
84
  readonly id: string;
65
85
  readonly type: string;
@@ -83,6 +103,7 @@ export interface AgentDefinition<Tools extends Readonly<Record<string, AgentTool
83
103
  readonly tools: Tools;
84
104
  readonly events: Readonly<Record<string, AgentEventHandler>>;
85
105
  readonly schedules: Readonly<Record<string, AgentScheduleHandler>>;
106
+ readonly workflows?: ReadonlyArray<string>;
86
107
  }
87
108
  /** The host calls one operation with one call-local authority over Workers RPC. */
88
109
  export type AgentModuleOperation = {
@@ -102,6 +123,10 @@ export type AgentModuleOperation = {
102
123
  readonly kind: "event";
103
124
  readonly event: AgentEvent;
104
125
  readonly attempt: number;
126
+ } | {
127
+ readonly kind: "schedule";
128
+ readonly cron: string;
129
+ readonly scheduledAt: number;
105
130
  };
106
131
  export interface AgentModuleRequest {
107
132
  readonly method: string;
@@ -120,4 +145,6 @@ export interface AgentModuleAuthority {
120
145
  searchMemory(query: string): Promise<ReadonlyArray<AgentMemoryMatch>>;
121
146
  remember(content: string): Promise<void>;
122
147
  log(values: ReadonlyArray<unknown>): Promise<void>;
148
+ state?(call: AgentStateCall): Promise<Schema.Json>;
149
+ startWorkflow?(input: AgentWorkflowStart): Promise<string>;
123
150
  }
@@ -2712,14 +2712,16 @@ export declare class Templates {
2712
2712
  static listFamilies<ThrowOnError extends boolean = false>(parameters?: {
2713
2713
  limit?: number | null | undefined;
2714
2714
  cursor?: string | undefined;
2715
+ namespaceId?: NamespaceId | undefined;
2715
2716
  }, options?: Options<never, ThrowOnError>): RequestResult<TemplatesListFamiliesResponses, TemplatesListFamiliesErrors, ThrowOnError>;
2716
2717
  /**
2717
2718
  * Create a template family
2718
2719
  *
2719
- * Creates an empty template family with the supplied name and returns it with status 201.
2720
+ * Creates an empty template family with the supplied name, in `namespaceId` or at organization level, and returns it with status 201.
2720
2721
  */
2721
2722
  static createFamily<ThrowOnError extends boolean = false>(parameters: {
2722
2723
  name: string;
2724
+ namespaceId?: NamespaceId | null | undefined;
2723
2725
  }, options?: Options<never, ThrowOnError>): RequestResult<TemplatesCreateFamilyResponses, TemplatesCreateFamilyErrors, ThrowOnError>;
2724
2726
  /**
2725
2727
  * Delete a template family
@@ -2749,7 +2751,7 @@ export declare class Templates {
2749
2751
  /**
2750
2752
  * Create a family from a template
2751
2753
  *
2752
- * Creates a template family containing the specified template and returns the new family with status 201.
2754
+ * Creates a template family containing the specified template, in that template's namespace, and returns the new family with status 201.
2753
2755
  */
2754
2756
  static createFamilyFromTemplate<ThrowOnError extends boolean = false>(parameters: {
2755
2757
  templateId: TemplateId;
@@ -2767,7 +2769,7 @@ export declare class Templates {
2767
2769
  /**
2768
2770
  * Attach a template to a family
2769
2771
  *
2770
- * Adds an existing template as a channel member of the family and returns the updated family.
2772
+ * Adds an existing template as a channel member of the family and returns the updated family. The template must be in the family's namespace; another namespace's template answers 409.
2771
2773
  */
2772
2774
  static attachFamilyMember<ThrowOnError extends boolean = false>(parameters: {
2773
2775
  id: TemplateFamilyId;
@@ -2817,22 +2819,25 @@ export declare class Templates {
2817
2819
  /**
2818
2820
  * Suggest designs for a brief
2819
2821
  *
2820
- * Ranks Samva's gallery designs for a brief and returns the three to start a new email from, best first, each with the `galleryTemplateId` that creates a template from it. When the brief names a company's email, `recreation` says whether the gallery recreates that kind of email from it, recreates another kind (start from it for the look), or has none. The ranking is deterministic: the same brief returns the same designs.
2822
+ * Ranks Samva's gallery designs for a brief and returns the three to start a new email from (or, with `channel: "whatsapp"`, Samva's WhatsApp starters), best first, each with the `galleryTemplateId` that creates a template from it. When the brief names a company's email, `recreation` says whether the gallery recreates that kind of email from it, recreates another kind (start from it for the look), or has none. The ranking is deterministic: the same brief returns the same designs.
2821
2823
  */
2822
2824
  static suggestStarters<ThrowOnError extends boolean = false>(parameters: {
2823
2825
  brief: string;
2826
+ channel?: "email" | "whatsapp" | null | undefined;
2824
2827
  }, options?: Options<never, ThrowOnError>): RequestResult<TemplatesSuggestStartersResponses, TemplatesSuggestStartersErrors, ThrowOnError>;
2825
2828
  /**
2826
2829
  * Create a template from a brief
2827
2830
  *
2828
- * Creates an email template project from the gallery design that best fits a brief (the first of `POST /v1/templates/suggestions`, or the `galleryTemplateId` you name) and returns it with status 201, the design it started from, the other suggestions, any company email the brief named, and the request that makes the template assistant adapt the design. The assistant runs when that request is sent in the editor; an agent of your own adapts the design through the workspace endpoints instead.
2831
+ * Creates an email template project (or a WhatsApp one, with `channel: "whatsapp"`) from the gallery design that best fits a brief (the first of `POST /v1/templates/suggestions`, or the `galleryTemplateId` you name) and returns it with status 201, the design it started from, the other suggestions, any company email the brief named, and the request that makes the template assistant adapt the design. The assistant runs when that request is sent in the editor; an agent of your own adapts the design through the workspace endpoints instead.
2829
2832
  */
2830
2833
  static createFromBrief<ThrowOnError extends boolean = false>(parameters: {
2831
2834
  brief: string;
2835
+ channel?: "email" | "whatsapp" | null | undefined;
2832
2836
  name?: string | null | undefined;
2833
2837
  galleryTemplateId?: string | null | undefined;
2834
2838
  useBrand?: boolean | null | undefined;
2835
2839
  namespaceId?: NamespaceId | null | undefined;
2840
+ variantOf?: TemplateId | null | undefined;
2836
2841
  }, options?: Options<never, ThrowOnError>): RequestResult<TemplatesCreateFromBriefResponses, TemplatesCreateFromBriefErrors, ThrowOnError>;
2837
2842
  /**
2838
2843
  * Create a template from a website
@@ -8321,13 +8321,20 @@ var Templates = class {
8321
8321
  * Returns the organization's template families with their members, newest first. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page.
8322
8322
  */
8323
8323
  static listFamilies(parameters, options) {
8324
- const params = buildClientParams([parameters], [{ args: [{
8325
- in: "query",
8326
- key: "limit"
8327
- }, {
8328
- in: "query",
8329
- key: "cursor"
8330
- }] }]);
8324
+ const params = buildClientParams([parameters], [{ args: [
8325
+ {
8326
+ in: "query",
8327
+ key: "limit"
8328
+ },
8329
+ {
8330
+ in: "query",
8331
+ key: "cursor"
8332
+ },
8333
+ {
8334
+ in: "query",
8335
+ key: "namespaceId"
8336
+ }
8337
+ ] }]);
8331
8338
  return requestWithPolicy(options?.client ?? client, "templatesListFamilies", options, (headers) => (options?.client ?? client).get({
8332
8339
  security: [{
8333
8340
  name: "x-api-key",
@@ -8345,12 +8352,15 @@ var Templates = class {
8345
8352
  /**
8346
8353
  * Create a template family
8347
8354
  *
8348
- * Creates an empty template family with the supplied name and returns it with status 201.
8355
+ * Creates an empty template family with the supplied name, in `namespaceId` or at organization level, and returns it with status 201.
8349
8356
  */
8350
8357
  static createFamily(parameters, options) {
8351
8358
  const params = buildClientParams([parameters], [{ args: [{
8352
8359
  in: "body",
8353
8360
  key: "name"
8361
+ }, {
8362
+ in: "body",
8363
+ key: "namespaceId"
8354
8364
  }] }]);
8355
8365
  return requestWithPolicy(options?.client ?? client, "templatesCreateFamily", options, (headers) => (options?.client ?? client).post({
8356
8366
  security: [{
@@ -8448,7 +8458,7 @@ var Templates = class {
8448
8458
  /**
8449
8459
  * Create a family from a template
8450
8460
  *
8451
- * Creates a template family containing the specified template and returns the new family with status 201.
8461
+ * Creates a template family containing the specified template, in that template's namespace, and returns the new family with status 201.
8452
8462
  */
8453
8463
  static createFamilyFromTemplate(parameters, options) {
8454
8464
  const params = buildClientParams([parameters], [{ args: [{
@@ -8504,7 +8514,7 @@ var Templates = class {
8504
8514
  /**
8505
8515
  * Attach a template to a family
8506
8516
  *
8507
- * Adds an existing template as a channel member of the family and returns the updated family.
8517
+ * Adds an existing template as a channel member of the family and returns the updated family. The template must be in the family's namespace; another namespace's template answers 409.
8508
8518
  */
8509
8519
  static attachFamilyMember(parameters, options) {
8510
8520
  const params = buildClientParams([parameters], [{ args: [{
@@ -8608,12 +8618,15 @@ var Templates = class {
8608
8618
  /**
8609
8619
  * Suggest designs for a brief
8610
8620
  *
8611
- * Ranks Samva's gallery designs for a brief and returns the three to start a new email from, best first, each with the `galleryTemplateId` that creates a template from it. When the brief names a company's email, `recreation` says whether the gallery recreates that kind of email from it, recreates another kind (start from it for the look), or has none. The ranking is deterministic: the same brief returns the same designs.
8621
+ * Ranks Samva's gallery designs for a brief and returns the three to start a new email from (or, with `channel: "whatsapp"`, Samva's WhatsApp starters), best first, each with the `galleryTemplateId` that creates a template from it. When the brief names a company's email, `recreation` says whether the gallery recreates that kind of email from it, recreates another kind (start from it for the look), or has none. The ranking is deterministic: the same brief returns the same designs.
8612
8622
  */
8613
8623
  static suggestStarters(parameters, options) {
8614
8624
  const params = buildClientParams([parameters], [{ args: [{
8615
8625
  in: "body",
8616
8626
  key: "brief"
8627
+ }, {
8628
+ in: "body",
8629
+ key: "channel"
8617
8630
  }] }]);
8618
8631
  return requestWithPolicy(options?.client ?? client, "templatesSuggestStarters", options, (headers) => (options?.client ?? client).post({
8619
8632
  security: [{
@@ -8634,7 +8647,7 @@ var Templates = class {
8634
8647
  /**
8635
8648
  * Create a template from a brief
8636
8649
  *
8637
- * Creates an email template project from the gallery design that best fits a brief (the first of `POST /v1/templates/suggestions`, or the `galleryTemplateId` you name) and returns it with status 201, the design it started from, the other suggestions, any company email the brief named, and the request that makes the template assistant adapt the design. The assistant runs when that request is sent in the editor; an agent of your own adapts the design through the workspace endpoints instead.
8650
+ * Creates an email template project (or a WhatsApp one, with `channel: "whatsapp"`) from the gallery design that best fits a brief (the first of `POST /v1/templates/suggestions`, or the `galleryTemplateId` you name) and returns it with status 201, the design it started from, the other suggestions, any company email the brief named, and the request that makes the template assistant adapt the design. The assistant runs when that request is sent in the editor; an agent of your own adapts the design through the workspace endpoints instead.
8638
8651
  */
8639
8652
  static createFromBrief(parameters, options) {
8640
8653
  const params = buildClientParams([parameters], [{ args: [
@@ -8642,6 +8655,10 @@ var Templates = class {
8642
8655
  in: "body",
8643
8656
  key: "brief"
8644
8657
  },
8658
+ {
8659
+ in: "body",
8660
+ key: "channel"
8661
+ },
8645
8662
  {
8646
8663
  in: "body",
8647
8664
  key: "name"
@@ -8657,6 +8674,10 @@ var Templates = class {
8657
8674
  {
8658
8675
  in: "body",
8659
8676
  key: "namespaceId"
8677
+ },
8678
+ {
8679
+ in: "body",
8680
+ key: "variantOf"
8660
8681
  }
8661
8682
  ] }]);
8662
8683
  return requestWithPolicy(options?.client ?? client, "templatesCreateFromBrief", options, (headers) => (options?.client ?? client).post({
@@ -43,14 +43,22 @@ export type ResourceNotFoundError = {
43
43
  id: string;
44
44
  message: string;
45
45
  };
46
+ /**
47
+ * `templateChannelVariantId` identifies the exact content last submitted. A journey step or scheduled send pins it with `id` in `pinnedRegistration` and sends only while this registration holds that content approved.
48
+ */
46
49
  export type TemplateRegistration = {
47
50
  id: TemplateRegistrationId;
48
51
  templateId: TemplateId;
49
52
  publicationId: TemplatePublicationId;
53
+ templateChannelVariantId: TemplateChannelVariantId;
50
54
  target: TemplateRegistrationTarget;
51
55
  name: string;
52
56
  language: string;
53
57
  status: "draft" | "submitted" | "approved" | "rejected" | "paused" | "disabled";
58
+ /**
59
+ * Content a submission sent to the provider whose outcome is not yet recorded, because its request failed or is still in flight; the provider may already hold it. While it is set nothing sends from this registration, even when `status` is `approved`. Submitting again settles it.
60
+ */
61
+ pendingTemplateChannelVariantId: TemplateChannelVariantId | null;
54
62
  category: "marketing" | "utility" | "authentication" | "transactional" | "service_implicit" | "service_explicit" | "promotional";
55
63
  providerCategory: "marketing" | "utility" | "authentication" | "transactional" | "service_implicit" | "service_explicit" | "promotional" | null;
56
64
  providerTemplateId: string | null;
@@ -60,6 +68,7 @@ export type TemplateRegistration = {
60
68
  createdAt: string;
61
69
  updatedAt: string;
62
70
  };
71
+ export type TemplateChannelVariantId = string;
63
72
  export type TemplateRegistrationTarget = WhatsAppRegistrationTarget | DltRegistrationTarget;
64
73
  export type DltRegistrationTarget = {
65
74
  provider: "dlt";
@@ -728,7 +737,6 @@ export type JsonObject = {
728
737
  export type JsonObjectWritable = {
729
738
  [key: string]: JsonValueWritable | undefined;
730
739
  };
731
- export type TemplateChannelVariantId = string;
732
740
  export type MailboxSmsEndpointBinding = {
733
741
  channel: "sms";
734
742
  phoneNumberId: SmsPhoneNumberId;
@@ -1779,6 +1787,7 @@ export type ApiKeyWithSecret = {
1779
1787
  start: string | null;
1780
1788
  end: string | null;
1781
1789
  description?: string | null | undefined;
1790
+ source?: string | null | undefined;
1782
1791
  createdAt: string;
1783
1792
  expiresAt: string | null;
1784
1793
  lastUsedAt: string | null;
@@ -1798,6 +1807,7 @@ export type ApiKey = {
1798
1807
  start: string | null;
1799
1808
  end: string | null;
1800
1809
  description?: string | null | undefined;
1810
+ source?: string | null | undefined;
1801
1811
  createdAt: string;
1802
1812
  expiresAt: string | null;
1803
1813
  lastUsedAt: string | null;
@@ -2379,9 +2389,13 @@ export type TemplateStarterSuggestion = {
2379
2389
  */
2380
2390
  galleryTemplateId: string;
2381
2391
  /**
2382
- * The design's gallery page, under /templates/.
2392
+ * The channel the design's template sends on.
2383
2393
  */
2384
- slug: string;
2394
+ channel: "email" | "whatsapp";
2395
+ /**
2396
+ * The design's public gallery page, under /templates/. Null for a design without one, such as a WhatsApp starter.
2397
+ */
2398
+ slug: string | null;
2385
2399
  name: string;
2386
2400
  description: string;
2387
2401
  /**
@@ -2408,16 +2422,24 @@ export type TemplateStarterSuggestion = {
2408
2422
  };
2409
2423
  export type CreateTemplateFromBriefPayload = {
2410
2424
  /**
2411
- * What the email is for, as a person would ask for it: who sends it, to whom, and why. Naming a company's email ("like the Vercel login email") starts from Samva's recreation of it when the gallery has one.
2425
+ * What the message is for, as a person would ask for it: who sends it, to whom, and why. Naming a company's email ("like the Vercel login email") starts from Samva's recreation of it when the gallery has one.
2412
2426
  */
2413
2427
  brief: string;
2428
+ /**
2429
+ * The channel to start a template for. Defaults to email. WhatsApp starts from Samva's WhatsApp starters and is available where WhatsApp is enabled for the organization.
2430
+ */
2431
+ channel?: "email" | "whatsapp" | null | undefined;
2414
2432
  name?: string | null | undefined;
2415
2433
  galleryTemplateId?: string | null | undefined;
2416
2434
  useBrand?: boolean | null | undefined;
2417
2435
  /**
2418
- * The namespace the new template project belongs to. Omit for organization level. A namespace-scoped key always creates in its own namespace.
2436
+ * The namespace the new template project belongs to. Omit for organization level. A namespace-scoped key always creates in its own namespace. With `variantOf`, omit it or name the source's namespace.
2419
2437
  */
2420
2438
  namespaceId?: NamespaceId | null | undefined;
2439
+ /**
2440
+ * Make this template another channel's version of an existing template the caller can change: it is created in that template's namespace, holds that template's current draft as a read-only resource the template assistant reads facts from, and joins that template's family (one is made when it has none). The returned `ask` says where the snapshot is mounted; its `variant-source.json` names the source, its entry and the revision taken. A retry with the same idempotency key finishes the same version; the key refuses a different source, or a request without `variantOf`. Refused when `channel` is the source's own or its family already has a template on `channel`. The source's files are mounted whole: a project with more than 31 files, a file over 4 MB, or more than 8 MB in all is refused before anything is created.
2441
+ */
2442
+ variantOf?: TemplateId | null | undefined;
2421
2443
  };
2422
2444
  export type TemplateStarterSuggestions = {
2423
2445
  /**
@@ -2428,9 +2450,13 @@ export type TemplateStarterSuggestions = {
2428
2450
  };
2429
2451
  export type SuggestTemplateStartersPayload = {
2430
2452
  /**
2431
- * What the email is for, as a person would ask for it: who sends it, to whom, and why. Naming a company's email ("like the Vercel login email") starts from Samva's recreation of it when the gallery has one.
2453
+ * What the message is for, as a person would ask for it: who sends it, to whom, and why. Naming a company's email ("like the Vercel login email") starts from Samva's recreation of it when the gallery has one.
2432
2454
  */
2433
2455
  brief: string;
2456
+ /**
2457
+ * The channel to start a template for. Defaults to email. WhatsApp starts from Samva's WhatsApp starters and is available where WhatsApp is enabled for the organization.
2458
+ */
2459
+ channel?: "email" | "whatsapp" | null | undefined;
2434
2460
  };
2435
2461
  export type ShareLinkUnavailable = {
2436
2462
  _tag: "ShareLinkUnavailable";
@@ -2463,6 +2489,10 @@ export type CreateTemplatePayload = {
2463
2489
  export type TemplateFamily = {
2464
2490
  id: TemplateFamilyId;
2465
2491
  name: string;
2492
+ /**
2493
+ * The namespace the family belongs to, which every member it gains shares. Null at organization level. A namespace-scoped key reaches only its own namespace's families.
2494
+ */
2495
+ namespaceId: NamespaceId | null;
2466
2496
  members: Array<TemplateFamilyMember>;
2467
2497
  createdAt: string;
2468
2498
  updatedAt: string;
@@ -2479,6 +2509,13 @@ export type TemplateFamilyMember = {
2479
2509
  export type TemplateFamilyName = {
2480
2510
  name: string;
2481
2511
  };
2512
+ export type CreateTemplateFamilyPayload = {
2513
+ name: string;
2514
+ /**
2515
+ * The namespace the family belongs to; every member it gains must be in it. Omit for organization level. A namespace-scoped key always creates in its own namespace.
2516
+ */
2517
+ namespaceId?: NamespaceId | null | undefined;
2518
+ };
2482
2519
  export type TemplateFamilyPage = {
2483
2520
  items: Array<TemplateFamily>;
2484
2521
  nextCursor: string | null;
@@ -3461,7 +3498,7 @@ export type ShopifyShop = string;
3461
3498
  export type JourneyGoal = {
3462
3499
  eventName: JourneyEventName;
3463
3500
  };
3464
- export type JourneyEventName = JourneyCustomEventName | "contact.created" | "contact.tag_added" | "contact.joined_group";
3501
+ export type JourneyEventName = JourneyCustomEventName | "contact.created" | "contact.tag_added" | "contact.joined_group" | "contact.connection_completed";
3465
3502
  export type JourneyCustomEventName = string;
3466
3503
  export type JourneyNode = JourneySendEmailNode | WhatsAppJourneySendNode | JourneyWaitNode | JourneyWaitForEventNode | JourneyBranchNode | JourneyUpdateTagsNode | JourneyWebhookNode | JourneyExitNode;
3467
3504
  export type JourneyNodeWritable = JourneySendEmailNodeWritable | WhatsAppJourneySendNodeWritable | JourneyWaitNode | JourneyWaitForEventNode | JourneyBranchNode | JourneyUpdateTagsNode | JourneyWebhookNodeWritable | JourneyExitNode;
@@ -19958,6 +19995,10 @@ export type TemplatesListFamiliesData = {
19958
19995
  query?: {
19959
19996
  limit?: number | null | undefined;
19960
19997
  cursor?: string | undefined;
19998
+ /**
19999
+ * Only this namespace's families. A namespace-scoped key always lists its own namespace's.
20000
+ */
20001
+ namespaceId?: NamespaceId | undefined;
19961
20002
  };
19962
20003
  url: "/v1/templates/families";
19963
20004
  };
@@ -19998,6 +20039,10 @@ export type TemplatesListFamiliesResponse = TemplatesListFamiliesResponses[keyof
19998
20039
  export type TemplatesCreateFamilyData = {
19999
20040
  body: {
20000
20041
  name: string;
20042
+ /**
20043
+ * The namespace the family belongs to; every member it gains must be in it. Omit for organization level. A namespace-scoped key always creates in its own namespace.
20044
+ */
20045
+ namespaceId?: NamespaceId | null | undefined;
20001
20046
  };
20002
20047
  path?: never;
20003
20048
  query?: never;
@@ -20016,6 +20061,10 @@ export type TemplatesCreateFamilyErrors = {
20016
20061
  * ForbiddenError
20017
20062
  */
20018
20063
  403: ForbiddenError;
20064
+ /**
20065
+ * ResourceNotFoundError
20066
+ */
20067
+ 404: ResourceNotFoundError;
20019
20068
  /**
20020
20069
  * ValidationError
20021
20070
  */
@@ -20498,9 +20547,13 @@ export type TemplatesUpdateResponse = TemplatesUpdateResponses[keyof TemplatesUp
20498
20547
  export type TemplatesSuggestStartersData = {
20499
20548
  body: {
20500
20549
  /**
20501
- * What the email is for, as a person would ask for it: who sends it, to whom, and why. Naming a company's email ("like the Vercel login email") starts from Samva's recreation of it when the gallery has one.
20550
+ * What the message is for, as a person would ask for it: who sends it, to whom, and why. Naming a company's email ("like the Vercel login email") starts from Samva's recreation of it when the gallery has one.
20502
20551
  */
20503
20552
  brief: string;
20553
+ /**
20554
+ * The channel to start a template for. Defaults to email. WhatsApp starts from Samva's WhatsApp starters and is available where WhatsApp is enabled for the organization.
20555
+ */
20556
+ channel?: "email" | "whatsapp" | null | undefined;
20504
20557
  };
20505
20558
  path?: never;
20506
20559
  query?: never;
@@ -20543,16 +20596,24 @@ export type TemplatesSuggestStartersResponse = TemplatesSuggestStartersResponses
20543
20596
  export type TemplatesCreateFromBriefData = {
20544
20597
  body: {
20545
20598
  /**
20546
- * What the email is for, as a person would ask for it: who sends it, to whom, and why. Naming a company's email ("like the Vercel login email") starts from Samva's recreation of it when the gallery has one.
20599
+ * What the message is for, as a person would ask for it: who sends it, to whom, and why. Naming a company's email ("like the Vercel login email") starts from Samva's recreation of it when the gallery has one.
20547
20600
  */
20548
20601
  brief: string;
20602
+ /**
20603
+ * The channel to start a template for. Defaults to email. WhatsApp starts from Samva's WhatsApp starters and is available where WhatsApp is enabled for the organization.
20604
+ */
20605
+ channel?: "email" | "whatsapp" | null | undefined;
20549
20606
  name?: string | null | undefined;
20550
20607
  galleryTemplateId?: string | null | undefined;
20551
20608
  useBrand?: boolean | null | undefined;
20552
20609
  /**
20553
- * The namespace the new template project belongs to. Omit for organization level. A namespace-scoped key always creates in its own namespace.
20610
+ * The namespace the new template project belongs to. Omit for organization level. A namespace-scoped key always creates in its own namespace. With `variantOf`, omit it or name the source's namespace.
20554
20611
  */
20555
20612
  namespaceId?: NamespaceId | null | undefined;
20613
+ /**
20614
+ * Make this template another channel's version of an existing template the caller can change: it is created in that template's namespace, holds that template's current draft as a read-only resource the template assistant reads facts from, and joins that template's family (one is made when it has none). The returned `ask` says where the snapshot is mounted; its `variant-source.json` names the source, its entry and the revision taken. A retry with the same idempotency key finishes the same version; the key refuses a different source, or a request without `variantOf`. Refused when `channel` is the source's own or its family already has a template on `channel`. The source's files are mounted whole: a project with more than 31 files, a file over 4 MB, or more than 8 MB in all is refused before anything is created.
20615
+ */
20616
+ variantOf?: TemplateId | null | undefined;
20556
20617
  };
20557
20618
  headers: {
20558
20619
  "idempotency-key": string;
@@ -31647,7 +31708,7 @@ export type TemplateRegistrationsSubmitErrors = {
31647
31708
  export type TemplateRegistrationsSubmitError = TemplateRegistrationsSubmitErrors[keyof TemplateRegistrationsSubmitErrors];
31648
31709
  export type TemplateRegistrationsSubmitResponses = {
31649
31710
  /**
31650
- * TemplateRegistration
31711
+ * `templateChannelVariantId` identifies the exact content last submitted. A journey step or scheduled send pins it with `id` in `pinnedRegistration` and sends only while this registration holds that content approved.
31651
31712
  */
31652
31713
  201: TemplateRegistration;
31653
31714
  };
@@ -31694,7 +31755,7 @@ export type TemplateRegistrationsGetErrors = {
31694
31755
  export type TemplateRegistrationsGetError = TemplateRegistrationsGetErrors[keyof TemplateRegistrationsGetErrors];
31695
31756
  export type TemplateRegistrationsGetResponses = {
31696
31757
  /**
31697
- * TemplateRegistration
31758
+ * `templateChannelVariantId` identifies the exact content last submitted. A journey step or scheduled send pins it with `id` in `pinnedRegistration` and sends only while this registration holds that content approved.
31698
31759
  */
31699
31760
  200: TemplateRegistration;
31700
31761
  };
@@ -53,6 +53,7 @@ export declare const list: ((input?: {
53
53
  readonly start: string | null;
54
54
  readonly end: string | null;
55
55
  readonly description?: string | null;
56
+ readonly source?: string | null;
56
57
  readonly createdAt: string;
57
58
  readonly expiresAt: string | null;
58
59
  readonly lastUsedAt: string | null;
@@ -106,6 +107,7 @@ export declare const list: ((input?: {
106
107
  readonly start: string | null;
107
108
  readonly end: string | null;
108
109
  readonly description?: string | null;
110
+ readonly source?: string | null;
109
111
  readonly createdAt: string;
110
112
  readonly expiresAt: string | null;
111
113
  readonly lastUsedAt: string | null;