@automagik/omni 2.260901.2 → 2.260902.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/commands/send.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgcpC,wBAAgB,iBAAiB,IAAI,OAAO,CAgG3C"}
1
+ {"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/commands/send.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4dpC,wBAAgB,iBAAiB,IAAI,OAAO,CAiG3C"}
@@ -7,7 +7,36 @@
7
7
  * omni webhooks update <id> [--name <name>] [--enabled]
8
8
  * omni webhooks delete <id>
9
9
  * omni webhooks trigger --type <event-type> --payload <json> [--instance <id>]
10
+ *
11
+ * The signature secret can come from argv (`--signature-secret`, visible in
12
+ * shell history and `ps`), an environment variable (`--signature-secret-env`),
13
+ * or stdin (`--signature-secret-stdin`, for `pass show ... | omni webhooks ...`).
10
14
  */
15
+ import type { WebhookSignatureConfigBody } from '@omni/sdk';
11
16
  import { Command } from 'commander';
17
+ interface SignatureSecretOptions {
18
+ signatureSecret?: string;
19
+ signatureSecretEnv?: string;
20
+ signatureSecretStdin?: boolean;
21
+ }
22
+ /**
23
+ * Resolve the signature secret from exactly one of the three sources, or
24
+ * undefined when none is given. Throws (caught by the command's error path)
25
+ * on conflicting flags, a missing/empty env var, empty stdin, or a value
26
+ * outside the API's bounds — the CLI fails before any request is sent.
27
+ */
28
+ declare function resolveSignatureSecret(options: SignatureSecretOptions, readStdin?: () => Promise<string>): Promise<string | undefined>;
29
+ /** Assemble a signatureConfig from the --signature-* flags, or undefined when none given. */
30
+ declare function buildSignatureConfig(options: {
31
+ signatureAlgorithm?: string;
32
+ signatureHeader?: string;
33
+ signaturePrefix?: string;
34
+ }): WebhookSignatureConfigBody | undefined;
12
35
  export declare function createWebhooksCommand(): Command;
36
+ /** Test-only surface — not part of the CLI contract. */
37
+ export declare const __testables: {
38
+ resolveSignatureSecret: typeof resolveSignatureSecret;
39
+ buildSignatureConfig: typeof buildSignatureConfig;
40
+ };
41
+ export {};
13
42
  //# sourceMappingURL=webhooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/commands/webhooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4BpC,wBAAgB,qBAAqB,IAAI,OAAO,CA0O/C"}
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/commands/webhooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,UAAU,sBAAsB;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAcD;;;;;GAKG;AACH,iBAAe,sBAAsB,CACnC,OAAO,EAAE,sBAAsB,EAC/B,SAAS,GAAE,MAAM,OAAO,CAAC,MAAM,CAAuB,GACrD,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAqC7B;AAED,6FAA6F;AAC7F,iBAAS,oBAAoB,CAAC,OAAO,EAAE;IACrC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,0BAA0B,GAAG,SAAS,CAczC;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CA0P/C;AAED,wDAAwD;AACxD,eAAO,MAAM,WAAW;;;CAAmD,CAAC"}
package/dist/index.js CHANGED
@@ -128289,7 +128289,7 @@ import { fileURLToPath } from "url";
128289
128289
  // package.json
128290
128290
  var package_default = {
128291
128291
  name: "@automagik/omni",
128292
- version: "2.260901.2",
128292
+ version: "2.260902.1",
128293
128293
  description: "LLM-optimized CLI for Omni",
128294
128294
  type: "module",
128295
128295
  bin: {
@@ -140127,6 +140127,16 @@ function parseLoadingMessages(value) {
140127
140127
  const messages3 = value?.split(",").map((item) => item.trim()).filter(Boolean);
140128
140128
  return messages3?.length ? messages3 : undefined;
140129
140129
  }
140130
+ var SENT_BY_VALUES = ["agent", "user"];
140131
+ function resolveSentBy(value) {
140132
+ if (value === undefined)
140133
+ return;
140134
+ const sentBy = SENT_BY_VALUES.find((v4) => v4 === value);
140135
+ if (!sentBy) {
140136
+ error(`Invalid --sent-by: ${value}`, { validValues: SENT_BY_VALUES });
140137
+ }
140138
+ return sentBy;
140139
+ }
140130
140140
  var messageSenders = {
140131
140141
  async text(client, instanceId, options3) {
140132
140142
  const { to, text: text3 } = options3;
@@ -140137,7 +140147,8 @@ var messageSenders = {
140137
140147
  to,
140138
140148
  text: text3,
140139
140149
  replyTo: options3.replyTo,
140140
- threadId: options3.threadId
140150
+ threadId: options3.threadId,
140151
+ sentBy: resolveSentBy(options3.sentBy)
140141
140152
  });
140142
140153
  success("Message sent", result);
140143
140154
  },
@@ -140160,7 +140171,8 @@ var messageSenders = {
140160
140171
  filename,
140161
140172
  caption: options3.caption,
140162
140173
  voiceNote: options3.voice,
140163
- threadId: options3.threadId
140174
+ threadId: options3.threadId,
140175
+ sentBy: resolveSentBy(options3.sentBy)
140164
140176
  });
140165
140177
  success("Media sent", result);
140166
140178
  },
@@ -140188,7 +140200,8 @@ var messageSenders = {
140188
140200
  const result = await client.messages.sendSticker({
140189
140201
  instanceId,
140190
140202
  to,
140191
- ...isBase64 ? { base64: sticker } : { url: sticker }
140203
+ ...isBase64 ? { base64: sticker } : { url: sticker },
140204
+ sentBy: resolveSentBy(options3.sentBy)
140192
140205
  });
140193
140206
  success("Sticker sent", result);
140194
140207
  },
@@ -140207,7 +140220,8 @@ var messageSenders = {
140207
140220
  name,
140208
140221
  phone: options3.phone,
140209
140222
  email: options3.email
140210
- }
140223
+ },
140224
+ sentBy: resolveSentBy(options3.sentBy)
140211
140225
  });
140212
140226
  success("Contact sent", result);
140213
140227
  },
@@ -140224,7 +140238,8 @@ var messageSenders = {
140224
140238
  to,
140225
140239
  latitude: lat,
140226
140240
  longitude: lng,
140227
- address: options3.address
140241
+ address: options3.address,
140242
+ sentBy: resolveSentBy(options3.sentBy)
140228
140243
  });
140229
140244
  success("Location sent", result);
140230
140245
  },
@@ -140243,7 +140258,8 @@ var messageSenders = {
140243
140258
  question: poll,
140244
140259
  answers,
140245
140260
  multiSelect: options3.multiSelect,
140246
- durationHours: options3.duration
140261
+ durationHours: options3.duration,
140262
+ sentBy: resolveSentBy(options3.sentBy)
140247
140263
  });
140248
140264
  success("Poll sent", result);
140249
140265
  },
@@ -140257,7 +140273,8 @@ var messageSenders = {
140257
140273
  title: options3.title,
140258
140274
  description: options3.description,
140259
140275
  color: options3.color,
140260
- url: options3.url
140276
+ url: options3.url,
140277
+ sentBy: resolveSentBy(options3.sentBy)
140261
140278
  });
140262
140279
  success("Embed sent", result);
140263
140280
  },
@@ -140289,7 +140306,8 @@ var messageSenders = {
140289
140306
  to,
140290
140307
  text: tts,
140291
140308
  voiceId: options3.voiceId,
140292
- presenceDelay: options3.presenceDelay
140309
+ presenceDelay: options3.presenceDelay,
140310
+ sentBy: resolveSentBy(options3.sentBy)
140293
140311
  });
140294
140312
  success("TTS voice note sent", result);
140295
140313
  },
@@ -140309,7 +140327,8 @@ var messageSenders = {
140309
140327
  instanceId,
140310
140328
  to,
140311
140329
  messageId: message2,
140312
- fromChatId: fromChat
140330
+ fromChatId: fromChat,
140331
+ sentBy: resolveSentBy(options3.sentBy)
140313
140332
  });
140314
140333
  success("Message forwarded", result);
140315
140334
  }
@@ -140383,6 +140402,10 @@ function buildGroupedSendHelp() {
140383
140402
  {
140384
140403
  flags: "--to <recipient>",
140385
140404
  description: "Recipient: WA JID (5511@s.whatsapp.net), phone (+5511...), or Omni chat/person UUID"
140405
+ },
140406
+ {
140407
+ flags: "--sent-by <agent|user>",
140408
+ description: "Authorship: 'agent' attributes the send to the instance's configured agent (not for --reaction/--presence)"
140386
140409
  }
140387
140410
  ];
140388
140411
  const textOptions = [
@@ -140481,7 +140504,7 @@ function createSendCommand() {
140481
140504
  send.configureHelp({
140482
140505
  formatHelp: () => buildGroupedSendHelp()
140483
140506
  });
140484
- send.description("Send a message to a recipient").argument("[file]", "File to send as media (shorthand for --media, uses context for instance/chat)").option("--instance <id>", "Instance ID (uses default if not specified)").option("--to <recipient>", "Recipient: WA JID, phone number, or Omni chat/person UUID").option("--text <text>", "Send text message").option("--reply-to <id>", "Reply to a message ID").option("--thread-id <id>", "Thread/topic ID (Telegram forum topic, etc.)").option("--media <path>", "Send media file (image, audio, video, document)").option("--caption <text>", "Caption for media").option("--voice", "Send audio as voice note").option("--reaction <emoji>", "Send reaction emoji").option("--message <id>", "Message ID to react to").option("--sticker <url>", "Send sticker (URL or base64)").option("--contact", "Send contact card").option("--name <name>", "Contact name").option("--phone <phone>", "Contact phone number").option("--email <email>", "Contact email").option("--location", "Send location").option("--lat <latitude>", "Latitude", Number.parseFloat).option("--lng <longitude>", "Longitude", Number.parseFloat).option("--address <address>", "Location address").option("--poll <question>", "Send poll with question").option("--options <answers>", "Poll options (comma-separated)").option("--multi-select", "Allow multiple selections").option("--duration <hours>", "Poll duration in hours", Number.parseInt).option("--embed", "Send embed message").option("--title <title>", "Embed title").option("--description <desc>", "Embed description").option("--color <color>", "Embed color (hex)", Number.parseInt).option("--url <url>", "Embed URL").option("--presence <type>", "Send presence indicator (typing, recording, paused)").option("--status <text>", "Custom status text for channels that support it").option("--loading-messages <items>", "Comma-separated rotating loading messages").option("--tts <text>", "Send TTS voice note (text-to-speech)").option("--voice-id <id>", "ElevenLabs voice ID for TTS").option("--presence-delay <ms>", "Recording presence duration in ms", Number.parseInt).option("--forward", "Forward a message to another chat").option("--from-chat <chatId>", "Source chat ID for forwarding").action(async (file, options3) => {
140507
+ send.description("Send a message to a recipient").argument("[file]", "File to send as media (shorthand for --media, uses context for instance/chat)").option("--instance <id>", "Instance ID (uses default if not specified)").option("--to <recipient>", "Recipient: WA JID, phone number, or Omni chat/person UUID").option("--sent-by <agent|user>", "Authorship: 'agent' attributes the send to the instance's configured agent").option("--text <text>", "Send text message").option("--reply-to <id>", "Reply to a message ID").option("--thread-id <id>", "Thread/topic ID (Telegram forum topic, etc.)").option("--media <path>", "Send media file (image, audio, video, document)").option("--caption <text>", "Caption for media").option("--voice", "Send audio as voice note").option("--reaction <emoji>", "Send reaction emoji").option("--message <id>", "Message ID to react to").option("--sticker <url>", "Send sticker (URL or base64)").option("--contact", "Send contact card").option("--name <name>", "Contact name").option("--phone <phone>", "Contact phone number").option("--email <email>", "Contact email").option("--location", "Send location").option("--lat <latitude>", "Latitude", Number.parseFloat).option("--lng <longitude>", "Longitude", Number.parseFloat).option("--address <address>", "Location address").option("--poll <question>", "Send poll with question").option("--options <answers>", "Poll options (comma-separated)").option("--multi-select", "Allow multiple selections").option("--duration <hours>", "Poll duration in hours", Number.parseInt).option("--embed", "Send embed message").option("--title <title>", "Embed title").option("--description <desc>", "Embed description").option("--color <color>", "Embed color (hex)", Number.parseInt).option("--url <url>", "Embed URL").option("--presence <type>", "Send presence indicator (typing, recording, paused)").option("--status <text>", "Custom status text for channels that support it").option("--loading-messages <items>", "Comma-separated rotating loading messages").option("--tts <text>", "Send TTS voice note (text-to-speech)").option("--voice-id <id>", "ElevenLabs voice ID for TTS").option("--presence-delay <ms>", "Recording presence duration in ms", Number.parseInt).option("--forward", "Forward a message to another chat").option("--from-chat <chatId>", "Source chat ID for forwarding").action(async (file, options3) => {
140485
140508
  if (file && !options3.media) {
140486
140509
  options3.media = file;
140487
140510
  if (!options3.to) {
@@ -142578,8 +142601,59 @@ ${lines.join(`
142578
142601
  }
142579
142602
 
142580
142603
  // src/commands/webhooks.ts
142604
+ init_zod();
142581
142605
  init_output();
142582
142606
  var SIGNATURE_ALGORITHMS = ["hmac-sha256", "hmac-sha1", "token-match"];
142607
+ var signatureSecretSchema = exports_external.string().min(8, "at least 8 characters").max(512, "at most 512 characters");
142608
+ var SECRET_SOURCE_FLAGS = "--signature-secret, --signature-secret-env, --signature-secret-stdin";
142609
+ async function readSecretFromStdin() {
142610
+ if (process.stdin.isTTY) {
142611
+ throw new Error('--signature-secret-stdin requires piped stdin (e.g. `printf %s "$SECRET" | omni webhooks ...`)');
142612
+ }
142613
+ const chunks = [];
142614
+ for await (const chunk of process.stdin) {
142615
+ chunks.push(Buffer.from(chunk));
142616
+ }
142617
+ return Buffer.concat(chunks).toString("utf-8");
142618
+ }
142619
+ async function resolveSignatureSecret(options3, readStdin = readSecretFromStdin) {
142620
+ const sources = [
142621
+ options3.signatureSecret !== undefined,
142622
+ options3.signatureSecretEnv !== undefined,
142623
+ options3.signatureSecretStdin === true
142624
+ ].filter(Boolean).length;
142625
+ if (sources === 0)
142626
+ return;
142627
+ if (sources > 1) {
142628
+ throw new Error(`Use only one of ${SECRET_SOURCE_FLAGS}`);
142629
+ }
142630
+ let raw2;
142631
+ let origin;
142632
+ if (options3.signatureSecretEnv !== undefined) {
142633
+ const name = options3.signatureSecretEnv;
142634
+ if (!name)
142635
+ throw new Error("--signature-secret-env requires a variable name");
142636
+ raw2 = process.env[name];
142637
+ origin = `environment variable ${name}`;
142638
+ if (raw2 === undefined || raw2 === "") {
142639
+ throw new Error(`${origin} is not set or empty`);
142640
+ }
142641
+ } else if (options3.signatureSecretStdin) {
142642
+ raw2 = (await readStdin()).replace(/\r?\n$/, "");
142643
+ origin = "stdin";
142644
+ if (!raw2)
142645
+ throw new Error("no secret received on stdin");
142646
+ } else {
142647
+ raw2 = options3.signatureSecret;
142648
+ origin = "--signature-secret";
142649
+ }
142650
+ const parsed = signatureSecretSchema.safeParse(raw2);
142651
+ if (!parsed.success) {
142652
+ const reason = parsed.error.issues.map((issue) => issue.message).join("; ");
142653
+ throw new Error(`Invalid signature secret from ${origin}: ${reason}`);
142654
+ }
142655
+ return parsed.data;
142656
+ }
142583
142657
  function buildSignatureConfig(options3) {
142584
142658
  const { signatureAlgorithm, signatureHeader, signaturePrefix } = options3;
142585
142659
  if (!signatureAlgorithm && !signatureHeader && !signaturePrefix)
@@ -142632,7 +142706,7 @@ function createWebhooksCommand() {
142632
142706
  error(`Failed to get webhook source: ${message2}`);
142633
142707
  }
142634
142708
  });
142635
- webhooks.command("create").description("Create a webhook source").requiredOption("--name <name>", "Webhook source name").option("--description <desc>", "Description").option("--disabled", "Create in disabled state").option("--headers <json>", `Expected headers as JSON (e.g., '{"X-Secret": true}')`).option("--signature-algorithm <alg>", "Signature verification: hmac-sha256, hmac-sha1, or token-match").option("--signature-header <name>", "Header carrying the signature/token (e.g., X-Hub-Signature-256)").option("--signature-prefix <prefix>", "Prefix before the hex digest (e.g., 'sha256=')").option("--signature-secret <secret>", "Shared secret for signature verification (write-only)").action(async (options3) => {
142709
+ webhooks.command("create").description("Create a webhook source").requiredOption("--name <name>", "Webhook source name").option("--description <desc>", "Description").option("--disabled", "Create in disabled state").option("--headers <json>", `Expected headers as JSON (e.g., '{"X-Secret": true}')`).option("--signature-algorithm <alg>", "Signature verification: hmac-sha256, hmac-sha1, or token-match").option("--signature-header <name>", "Header carrying the signature/token (e.g., X-Hub-Signature-256)").option("--signature-prefix <prefix>", "Prefix before the hex digest (e.g., 'sha256=')").option("--signature-secret <secret>", "Shared secret for signature verification (write-only). Visible in shell history and process lists \u2014 prefer --signature-secret-env or --signature-secret-stdin").option("--signature-secret-env <VAR>", "Read the shared secret from environment variable VAR").option("--signature-secret-stdin", "Read the shared secret from stdin (trailing newline stripped)").action(async (options3) => {
142636
142710
  const client = getClient();
142637
142711
  try {
142638
142712
  let expectedHeaders;
@@ -142644,13 +142718,14 @@ function createWebhooksCommand() {
142644
142718
  }
142645
142719
  }
142646
142720
  const signatureConfig = buildSignatureConfig(options3);
142721
+ const signatureSecret = await resolveSignatureSecret(options3);
142647
142722
  const source = await client.webhooks.createSource({
142648
142723
  name: options3.name,
142649
142724
  description: options3.description,
142650
142725
  enabled: !options3.disabled,
142651
142726
  expectedHeaders,
142652
142727
  signatureConfig,
142653
- signatureSecret: options3.signatureSecret
142728
+ signatureSecret
142654
142729
  });
142655
142730
  const details = {
142656
142731
  id: source.id,
@@ -142666,7 +142741,7 @@ function createWebhooksCommand() {
142666
142741
  error(`Failed to create webhook source: ${message2}`);
142667
142742
  }
142668
142743
  });
142669
- webhooks.command("update <id>").description("Update a webhook source").option("--name <name>", "New name").option("--description <desc>", "New description").option("--enable", "Enable the webhook").option("--disable", "Disable the webhook").option("--signature-algorithm <alg>", "Signature verification: hmac-sha256, hmac-sha1, or token-match").option("--signature-header <name>", "Header carrying the signature/token (e.g., X-Hub-Signature-256)").option("--signature-prefix <prefix>", "Prefix before the hex digest (e.g., 'sha256=')").option("--signature-secret <secret>", "Shared secret for signature verification (write-only)").option("--clear-signature", "Remove the signature config and stored secret").action(async (id, options3) => {
142744
+ webhooks.command("update <id>").description("Update a webhook source").option("--name <name>", "New name").option("--description <desc>", "New description").option("--enable", "Enable the webhook").option("--disable", "Disable the webhook").option("--signature-algorithm <alg>", "Signature verification: hmac-sha256, hmac-sha1, or token-match").option("--signature-header <name>", "Header carrying the signature/token (e.g., X-Hub-Signature-256)").option("--signature-prefix <prefix>", "Prefix before the hex digest (e.g., 'sha256=')").option("--signature-secret <secret>", "Shared secret for signature verification (write-only). Visible in shell history and process lists \u2014 prefer --signature-secret-env or --signature-secret-stdin").option("--signature-secret-env <VAR>", "Read the shared secret from environment variable VAR").option("--signature-secret-stdin", "Read the shared secret from stdin (trailing newline stripped)").option("--clear-signature", "Remove the signature config and stored secret").action(async (id, options3) => {
142670
142745
  const resolvedId = await resolveWebhookId(id);
142671
142746
  const client = getClient();
142672
142747
  try {
@@ -142685,8 +142760,9 @@ function createWebhooksCommand() {
142685
142760
  const signatureConfig = buildSignatureConfig(options3);
142686
142761
  if (signatureConfig)
142687
142762
  updates.signatureConfig = signatureConfig;
142688
- if (options3.signatureSecret)
142689
- updates.signatureSecret = options3.signatureSecret;
142763
+ const signatureSecret = await resolveSignatureSecret(options3);
142764
+ if (signatureSecret)
142765
+ updates.signatureSecret = signatureSecret;
142690
142766
  }
142691
142767
  const source = await client.webhooks.updateSource(resolvedId, updates);
142692
142768
  success(`Webhook source updated: ${source.id}`, {
@@ -261,6 +261,12 @@ export interface CreateInstanceBody {
261
261
  twilioWebhookUrl?: string;
262
262
  twilioValidateSignature?: boolean;
263
263
  }
264
+ /**
265
+ * Authorship marker accepted by the send routes (#912). 'agent' attributes the
266
+ * message to the instance's configured agent server-side — the agent id is
267
+ * never taken from the caller.
268
+ */
269
+ export type SentBy = 'agent' | 'user';
264
270
  /**
265
271
  * Body for sending a message
266
272
  */
@@ -270,6 +276,12 @@ export interface SendMessageBody {
270
276
  text: string;
271
277
  replyTo?: string;
272
278
  threadId?: string;
279
+ /**
280
+ * Authorship of this send. 'agent' attributes the message to the instance's
281
+ * configured agent (the response echoes the resolved `senderAgentId`, null
282
+ * when the instance has no configured agent). Default: unattributed.
283
+ */
284
+ sentBy?: SentBy;
273
285
  }
274
286
  /**
275
287
  * Query parameters for listing events
@@ -622,26 +634,33 @@ export interface ListWebhookSourcesParams {
622
634
  enabled?: boolean;
623
635
  }
624
636
  /**
625
- * Signature verification contract for a webhook source (issue #928)
637
+ * Signature verification contract for a webhook source (issue #928).
638
+ * Derived from the generated OpenAPI component so it cannot drift from the API.
626
639
  */
627
- export interface WebhookSignatureConfigBody {
628
- algorithm: 'hmac-sha256' | 'hmac-sha1' | 'token-match';
629
- /** Header carrying the signature/token (e.g. 'X-Hub-Signature-256') */
630
- header: string;
631
- /** Prefix before the hex digest (e.g. 'sha256=') */
632
- prefix?: string;
633
- }
640
+ export type WebhookSignatureConfigBody = components['schemas']['WebhookSignatureConfig'];
634
641
  /**
635
- * Body for creating a webhook source
642
+ * Body for creating a webhook source.
643
+ *
644
+ * Hand-written on purpose: the generated `CreateWebhookSourceRequest` marks
645
+ * `enabled` as required because the API schema gives it a default, while for
646
+ * a caller it is optional. Field set and semantics mirror that component.
636
647
  */
637
648
  export interface CreateWebhookSourceBody {
638
649
  name: string;
639
650
  description?: string;
640
651
  expectedHeaders?: Record<string, boolean>;
641
- /** Required for the source to be reachable on the public ingress route */
652
+ /**
653
+ * Required for the source to be reachable on the public ingress route.
654
+ * Always paired with `signatureSecret`: a config without a stored secret is
655
+ * rejected, and clearing the config (null) also clears the stored secret.
656
+ */
642
657
  signatureConfig?: WebhookSignatureConfigBody | null;
643
- /** Shared secret used by signatureConfig (write-only, never returned) */
658
+ /**
659
+ * Shared secret used by signatureConfig (write-only, never returned; 8-512
660
+ * chars). Cannot be set without a signatureConfig; null clears it.
661
+ */
644
662
  signatureSecret?: string | null;
663
+ /** Defaults to true server-side */
645
664
  enabled?: boolean;
646
665
  }
647
666
  /**
@@ -696,9 +715,15 @@ export interface SendMediaBody {
696
715
  caption?: string;
697
716
  voiceNote?: boolean;
698
717
  threadId?: string;
718
+ /**
719
+ * Authorship of this send. 'agent' attributes the message to the instance's
720
+ * configured agent (the response echoes the resolved `senderAgentId`, null
721
+ * when the instance has no configured agent). Default: unattributed.
722
+ */
723
+ sentBy?: SentBy;
699
724
  }
700
725
  /**
701
- * Body for sending a reaction
726
+ * Body for sending a reaction (no `sentBy`: reactions are not attributable sends)
702
727
  */
703
728
  export interface SendReactionBody {
704
729
  instanceId: string;
@@ -721,6 +746,12 @@ export interface SendForwardBody {
721
746
  to: string;
722
747
  messageId: string;
723
748
  fromChatId: string;
749
+ /**
750
+ * Authorship of this send. 'agent' attributes the message to the instance's
751
+ * configured agent (the response echoes the resolved `senderAgentId`, null
752
+ * when the instance has no configured agent). Default: unattributed.
753
+ */
754
+ sentBy?: SentBy;
724
755
  }
725
756
  /**
726
757
  * Body for sending a sticker
@@ -730,6 +761,12 @@ export interface SendStickerBody {
730
761
  to: string;
731
762
  url?: string;
732
763
  base64?: string;
764
+ /**
765
+ * Authorship of this send. 'agent' attributes the message to the instance's
766
+ * configured agent (the response echoes the resolved `senderAgentId`, null
767
+ * when the instance has no configured agent). Default: unattributed.
768
+ */
769
+ sentBy?: SentBy;
733
770
  }
734
771
  /**
735
772
  * Body for sending a contact
@@ -743,6 +780,12 @@ export interface SendContactBody {
743
780
  email?: string;
744
781
  organization?: string;
745
782
  };
783
+ /**
784
+ * Authorship of this send. 'agent' attributes the message to the instance's
785
+ * configured agent (the response echoes the resolved `senderAgentId`, null
786
+ * when the instance has no configured agent). Default: unattributed.
787
+ */
788
+ sentBy?: SentBy;
746
789
  }
747
790
  /**
748
791
  * Body for sending a TTS voice note
@@ -756,6 +799,12 @@ export interface SendTtsBody {
756
799
  stability?: number;
757
800
  similarityBoost?: number;
758
801
  presenceDelay?: number;
802
+ /**
803
+ * Authorship of this send. 'agent' attributes the message to the instance's
804
+ * configured agent (the response echoes the resolved `senderAgentId`, null
805
+ * when the instance has no configured agent). Default: unattributed.
806
+ */
807
+ sentBy?: SentBy;
759
808
  }
760
809
  /**
761
810
  * TTS voice configuration
@@ -775,6 +824,8 @@ export interface TtsResponse {
775
824
  audioSizeKb: number;
776
825
  durationMs: number;
777
826
  timestamp: number;
827
+ /** Present when the request set `sentBy: 'agent'`; null when the instance has no configured agent */
828
+ senderAgentId?: string | null;
778
829
  }
779
830
  /**
780
831
  * Body for sending a location
@@ -786,6 +837,12 @@ export interface SendLocationBody {
786
837
  longitude: number;
787
838
  name?: string;
788
839
  address?: string;
840
+ /**
841
+ * Authorship of this send. 'agent' attributes the message to the instance's
842
+ * configured agent (the response echoes the resolved `senderAgentId`, null
843
+ * when the instance has no configured agent). Default: unattributed.
844
+ */
845
+ sentBy?: SentBy;
789
846
  }
790
847
  /**
791
848
  * Body for sending a poll (Discord)
@@ -798,6 +855,12 @@ export interface SendPollBody {
798
855
  durationHours?: number;
799
856
  multiSelect?: boolean;
800
857
  replyTo?: string;
858
+ /**
859
+ * Authorship of this send. 'agent' attributes the message to the instance's
860
+ * configured agent (the response echoes the resolved `senderAgentId`, null
861
+ * when the instance has no configured agent). Default: unattributed.
862
+ */
863
+ sentBy?: SentBy;
801
864
  }
802
865
  /**
803
866
  * Body for sending an embed (Discord)
@@ -827,6 +890,12 @@ export interface SendEmbedBody {
827
890
  inline?: boolean;
828
891
  }>;
829
892
  replyTo?: string;
893
+ /**
894
+ * Authorship of this send. 'agent' attributes the message to the instance's
895
+ * configured agent (the response echoes the resolved `senderAgentId`, null
896
+ * when the instance has no configured agent). Default: unattributed.
897
+ */
898
+ sentBy?: SentBy;
830
899
  }
831
900
  /**
832
901
  * Body for connecting an instance