@cogitator-ai/channels 0.16.0 → 0.18.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.
Files changed (112) hide show
  1. package/README.md +78 -14
  2. package/dist/approvals.d.ts +3 -0
  3. package/dist/approvals.d.ts.map +1 -1
  4. package/dist/approvals.js +1 -0
  5. package/dist/approvals.js.map +1 -1
  6. package/dist/assistant-config.d.ts +60 -0
  7. package/dist/assistant-config.d.ts.map +1 -1
  8. package/dist/assistant-config.js +102 -0
  9. package/dist/assistant-config.js.map +1 -1
  10. package/dist/channels/email/address.d.ts +44 -0
  11. package/dist/channels/email/address.d.ts.map +1 -0
  12. package/dist/channels/email/address.js +211 -0
  13. package/dist/channels/email/address.js.map +1 -0
  14. package/dist/channels/email/auth.d.ts +59 -0
  15. package/dist/channels/email/auth.d.ts.map +1 -0
  16. package/dist/channels/email/auth.js +212 -0
  17. package/dist/channels/email/auth.js.map +1 -0
  18. package/dist/channels/email/channel.d.ts +256 -0
  19. package/dist/channels/email/channel.d.ts.map +1 -0
  20. package/dist/channels/email/channel.js +701 -0
  21. package/dist/channels/email/channel.js.map +1 -0
  22. package/dist/channels/email/errors.d.ts +11 -0
  23. package/dist/channels/email/errors.d.ts.map +1 -0
  24. package/dist/channels/email/errors.js +13 -0
  25. package/dist/channels/email/errors.js.map +1 -0
  26. package/dist/channels/email/imap.d.ts +125 -0
  27. package/dist/channels/email/imap.d.ts.map +1 -0
  28. package/dist/channels/email/imap.js +309 -0
  29. package/dist/channels/email/imap.js.map +1 -0
  30. package/dist/channels/email/index.d.ts +7 -0
  31. package/dist/channels/email/index.d.ts.map +1 -0
  32. package/dist/channels/email/index.js +3 -0
  33. package/dist/channels/email/index.js.map +1 -0
  34. package/dist/channels/email/mime.d.ts +71 -0
  35. package/dist/channels/email/mime.d.ts.map +1 -0
  36. package/dist/channels/email/mime.js +83 -0
  37. package/dist/channels/email/mime.js.map +1 -0
  38. package/dist/channels/email/multipart.d.ts +28 -0
  39. package/dist/channels/email/multipart.d.ts.map +1 -0
  40. package/dist/channels/email/multipart.js +102 -0
  41. package/dist/channels/email/multipart.js.map +1 -0
  42. package/dist/channels/email/providers.d.ts +49 -0
  43. package/dist/channels/email/providers.d.ts.map +1 -0
  44. package/dist/channels/email/providers.js +292 -0
  45. package/dist/channels/email/providers.js.map +1 -0
  46. package/dist/channels/email/reply.d.ts +9 -0
  47. package/dist/channels/email/reply.d.ts.map +1 -0
  48. package/dist/channels/email/reply.js +122 -0
  49. package/dist/channels/email/reply.js.map +1 -0
  50. package/dist/channels/teams/activity.d.ts +108 -0
  51. package/dist/channels/teams/activity.d.ts.map +1 -0
  52. package/dist/channels/teams/activity.js +206 -0
  53. package/dist/channels/teams/activity.js.map +1 -0
  54. package/dist/channels/teams/auth.d.ts +65 -0
  55. package/dist/channels/teams/auth.d.ts.map +1 -0
  56. package/dist/channels/teams/auth.js +213 -0
  57. package/dist/channels/teams/auth.js.map +1 -0
  58. package/dist/channels/teams/cards.d.ts +23 -0
  59. package/dist/channels/teams/cards.d.ts.map +1 -0
  60. package/dist/channels/teams/cards.js +97 -0
  61. package/dist/channels/teams/cards.js.map +1 -0
  62. package/dist/channels/teams/channel.d.ts +303 -0
  63. package/dist/channels/teams/channel.d.ts.map +1 -0
  64. package/dist/channels/teams/channel.js +1071 -0
  65. package/dist/channels/teams/channel.js.map +1 -0
  66. package/dist/channels/teams/client.d.ts +72 -0
  67. package/dist/channels/teams/client.d.ts.map +1 -0
  68. package/dist/channels/teams/client.js +161 -0
  69. package/dist/channels/teams/client.js.map +1 -0
  70. package/dist/channels/teams/index.d.ts +7 -0
  71. package/dist/channels/teams/index.d.ts.map +1 -0
  72. package/dist/channels/teams/index.js +6 -0
  73. package/dist/channels/teams/index.js.map +1 -0
  74. package/dist/channels/teams/pacer.d.ts +47 -0
  75. package/dist/channels/teams/pacer.d.ts.map +1 -0
  76. package/dist/channels/teams/pacer.js +174 -0
  77. package/dist/channels/teams/pacer.js.map +1 -0
  78. package/dist/channels/teams/token.d.ts +47 -0
  79. package/dist/channels/teams/token.d.ts.map +1 -0
  80. package/dist/channels/teams/token.js +107 -0
  81. package/dist/channels/teams/token.js.map +1 -0
  82. package/dist/channels/telegram.d.ts.map +1 -1
  83. package/dist/channels/telegram.js +3 -0
  84. package/dist/channels/telegram.js.map +1 -1
  85. package/dist/formatters/html.d.ts +16 -0
  86. package/dist/formatters/html.d.ts.map +1 -0
  87. package/dist/formatters/html.js +535 -0
  88. package/dist/formatters/html.js.map +1 -0
  89. package/dist/formatters/markdown-images.d.ts +8 -0
  90. package/dist/formatters/markdown-images.d.ts.map +1 -0
  91. package/dist/formatters/markdown-images.js +181 -0
  92. package/dist/formatters/markdown-images.js.map +1 -0
  93. package/dist/formatters/markdown.d.ts.map +1 -1
  94. package/dist/formatters/markdown.js +22 -3
  95. package/dist/formatters/markdown.js.map +1 -1
  96. package/dist/gateway.d.ts +23 -1
  97. package/dist/gateway.d.ts.map +1 -1
  98. package/dist/gateway.js +113 -16
  99. package/dist/gateway.js.map +1 -1
  100. package/dist/inbound-debounce.d.ts +4 -1
  101. package/dist/inbound-debounce.d.ts.map +1 -1
  102. package/dist/inbound-debounce.js +4 -2
  103. package/dist/inbound-debounce.js.map +1 -1
  104. package/dist/index.d.ts +5 -2
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +5 -2
  107. package/dist/index.js.map +1 -1
  108. package/dist/runtime-builder.d.ts +9 -0
  109. package/dist/runtime-builder.d.ts.map +1 -1
  110. package/dist/runtime-builder.js +145 -1
  111. package/dist/runtime-builder.js.map +1 -1
  112. package/package.json +25 -8
package/README.md CHANGED
@@ -15,7 +15,8 @@ pnpm add discord.js # Discord
15
15
  pnpm add @slack/bolt # Slack
16
16
  pnpm add @whiskeysockets/baileys # WhatsApp, 6.x or 7.x (+ qrcode-terminal to print the pairing QR)
17
17
  pnpm add ws # WebChat
18
- pnpm add @atproto/api # Bluesky (Threads and GitHub need no SDK)
18
+ pnpm add @atproto/api # Bluesky (Threads, GitHub and Teams need no SDK)
19
+ pnpm add nodemailer imapflow postal-mime # Email: SMTP, IMAP and MIME parsing (webhooks need nodemailer, plus postal-mime for raw MIME)
19
20
 
20
21
  # RuntimeBuilder (`cogitator up`)
21
22
  pnpm add better-sqlite3 # SQLite memory, knowledge graph and core facts (always needed)
@@ -244,17 +245,58 @@ const github = githubChannel({
244
245
 
245
246
  The agent answers new issues and pull requests, comments on them, reviews with a body and comments on lines of a diff, from a repository or organization webhook. Each issue or pull request is a conversation, `channelId` `owner/repo#number`, and answers are comments on it. A comment on a line is answered in its review thread, which is the message's `topicId`, so each review thread is a conversation of its own. Deliveries are answered at once and handled after, each once by its `X-GitHub-Delivery` and the comment it carries (remembered in memory). It answers only the repository's owner, members and collaborators unless `associations` or `authors` say otherwise, since what people write steers an agent that holds the token, so give the bot an account and a token of its own scoped to its repositories. The bot skips its own comments and other bots (`allowBots` lets them in), and by default answers only mentions of `@login`, outside code and quotes, plus the next comment of someone it answered and comments in review threads it replied in. Answers go out finished (GitHub notifies people of a comment's first text, `stream: true` edits a comment as it grows, at most every 3 seconds), as several comments past 65536 characters. Reactions use GitHub's eight. GitHub has no upload API for comments, so `sendFile` links a file with a public `url` and refuses a buffer. A GitHub App installation token cannot read `GET /user`: set `login` to `<app-slug>[bot]`. Docs: [GitHub](https://cogitator.app/docs/channels/github).
246
247
 
248
+ ### Email
249
+
250
+ ```typescript
251
+ import { emailChannel } from '@cogitator-ai/channels';
252
+
253
+ const email = emailChannel({
254
+ address: 'assistant@example.com', // sends from it, never answers it
255
+ allowFrom: ['example.com', 'ann@partner.org'], // default: nobody, with a warning
256
+ imap: {
257
+ host: 'imap.gmail.com',
258
+ auth: { user: 'assistant@example.com', pass: process.env.EMAIL_IMAP_PASSWORD! },
259
+ },
260
+ smtp: {
261
+ host: 'smtp.gmail.com',
262
+ port: 587,
263
+ auth: { user: 'assistant@example.com', pass: process.env.EMAIL_SMTP_PASSWORD! },
264
+ }, // or { transport } for any nodemailer transport
265
+ // or instead of imap, a provider's inbound webhook:
266
+ // webhook: { provider: 'mailgun', signingKey: process.env.EMAIL_MAILGUN_SIGNING_KEY!, port: 8788 },
267
+ });
268
+ ```
269
+
270
+ The agent answers mail in its thread. Mail comes from a mailbox over IMAP (IDLE reports new mail at once, a poll every minute catches the rest, a message is marked read once the Gateway took it, so a restart reads only new mail, a refused or dropped one stays or becomes unread again, mail over 25 MB is skipped, a dropped connection is opened again with a wait that doubles up to a minute) or from the inbound webhook of Mailgun (HMAC of timestamp and token, refused after 5 minutes and handled once), Postmark or SendGrid (neither signs, so the URL carries basic auth or a `token`), answered `503` when the Gateway does not take the mail, so the provider retries. Answers go out over SMTP with `nodemailer`, as HTML rendered from the Markdown with a plain text alternative, a `Re:` subject and `In-Reply-To` and `References` set, so mail clients keep the thread. A sender is a conversation partner: `channelId` and `userId` are the address in lower case, and `topicId` is the thread's first `Message-ID`, so each email thread is a conversation of its own. The agent reads the plain text part (or the HTML as text) without the quoted history and the signature, with the subject on a thread's first mail, and attachments up to 10 MB. Mail from the bot itself, mail with the `X-Cogitator` header it puts on what it sends, auto-replies, bounces and bulk mail are skipped, and each `Message-ID` is handled once. Email is spoofable: the bot answers only `allowFrom` and `owners` (the address outside the quotes of `From`), drops mail whose DKIM, SPF or DMARC results fail for the `From` domain (`senderAuth: 'required'` also drops mail without results), and gives owner mail to the agent only with a passing result. It trusts only results the receiving side wrote: Mailgun's and SendGrid's, Postmark's spam tests, and over IMAP the `Authentication-Results` of `trustedAuthservIds` (such as `mx.google.com`), without which IMAP mail has no sender authentication. Answers cannot be edited. Docs: [Email](https://cogitator.app/docs/channels/email).
271
+
272
+ ### Microsoft Teams
273
+
274
+ ```typescript
275
+ import { teamsChannel } from '@cogitator-ai/channels';
276
+
277
+ const teams = teamsChannel({
278
+ appId: process.env.TEAMS_APP_ID!, // the Microsoft App ID of the Azure Bot
279
+ appPassword: process.env.TEAMS_APP_PASSWORD!, // a client secret of its app registration
280
+ tenantId: process.env.TEAMS_TENANT_ID!, // single-tenant: tokens come from this tenant
281
+ webhook: { port: 3978 }, // or mount teams.webhookListener() at /api/messages
282
+ // tenants: ['<tenant id>'], // default: only the bot's own tenant
283
+ // users: ['<Entra object id>'], // answer only these users
284
+ });
285
+ ```
286
+
287
+ The agent answers Microsoft Teams on the Bot Framework protocol, with no SDK. Bot Framework posts every activity with a JWT, checked with `node:crypto` alone: RS256 signed by a key of the published Bot Framework JWKS (cached, loaded again once a day, and for an unknown key at most every five minutes), issued by `https://api.botframework.com` for the App ID, valid now within five minutes of skew, with a `serviceurl` claim equal to the activity's `serviceUrl` and a key endorsed for `msteams` (`403` otherwise). Activities are answered at once and handled after, each once by its id. Answers go to the Bot Connector of the conversation's verified `serviceUrl` (optionally limited to `serviceUrlHosts`) with a client credentials token of the app registration (`appType: 'SingleTenant'` by default, `'MultiTenant'` for legacy bots, which take their token from `botframework.com`, or `'UserAssignedMSI'` with a `tokenProvider`), cached until shortly before it expires. Requests Teams throttles (`429`, `412`, `502`, `504`) are tried again with a backoff that doubles, with jitter, holding the whole conversation back meanwhile, and every request gives up after 30 seconds (`requestTimeout`). Requests to one conversation stay inside all four of Teams' limits (7 a second, 8 in 2 seconds, 60 in 30 seconds, 1800 an hour), edits and typing using at most three quarters of each, so new messages always find room. A user who blocked the bot fails with a `TeamsApiError` whose `errorCode` is `MessageWritesBlocked`, and the conversation gets nothing more until it writes again. `channelId` is the Teams conversation id of a personal chat, a group chat or a team channel, whose threads are topics (`topicId` is the thread's root message id), so every chat and every channel thread is a conversation of its own. `userId` is the user's Entra object id. In group chats and channels the bot answers @mentions, without the mention in the text (Teams sends it nothing else unless the app has the resource-specific consent `ChannelMessage.Read.Group` or `ChatMessage.Read.Chat`, then `trigger: 'all'` answers every message). It answers only users of its own tenant unless `tenants` says otherwise. Answers are Markdown (`textFormat: 'extendedmarkdown'`), up to 13653 characters a message (80 KB of JSON whatever the text), with images sent as links so an injected answer cannot leak through an image URL, and are edited as they stream, at most once a second per message. Buttons are Adaptive Cards: `Action.Execute`, whose press is answered in the response of its invoke, with an `Action.Submit` fallback, both delivered to `onAction`, so approval prompts get Approve and Deny buttons. `sendFile` uploads a buffer in personal chats through a file consent card (the manifest needs `supportsFiles`), and elsewhere sends an image with a public `url` inline and other files as a link. Docs: [Microsoft Teams](https://cogitator.app/docs/channels/teams).
288
+
247
289
  ## Platform Comparison
248
290
 
249
- | Feature | Telegram | Discord | Slack | WhatsApp | WebChat | Bluesky | Threads | GitHub |
250
- | ------------------ | ------------ | ------- | --------- | -------- | --------- | ------------------ | ------------------ | ------------------- |
251
- | Streaming (edit) | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ (sent finished) | ❌ (sent finished) | with `stream: true` |
252
- | Reactions | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ (8 kinds) |
253
- | Typing indicator | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ |
254
- | Photos → vision | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
255
- | Voice → STT | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
256
- | Max message length | 4096 | 2000 | 40000 | 65536 | unlimited | 300 per post | 500 per post | 65536 per comment |
257
- | Public URL needed | webhook only | no | HTTP only | no | no | no | webhooks only | yes (webhook) |
291
+ | Feature | Telegram | Discord | Slack | WhatsApp | WebChat | Bluesky | Threads | GitHub | Email | Teams |
292
+ | ------------------ | ------------ | ------- | --------- | -------- | --------- | ------------------ | ------------------ | ------------------- | ------------------ | ------------- |
293
+ | Streaming (edit) | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ (sent finished) | ❌ (sent finished) | with `stream: true` | ❌ (sent finished) | ✅ |
294
+ | Reactions | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ (8 kinds) | ❌ | ❌ |
295
+ | Typing indicator | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ |
296
+ | Photos → vision | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ (attachments) | ✅ |
297
+ | Voice → STT | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ (attachments) | ❌ |
298
+ | Max message length | 4096 | 2000 | 40000 | 65536 | unlimited | 300 per post | 500 per post | 65536 per comment | unlimited | 13653 |
299
+ | Public URL needed | webhook only | no | HTTP only | no | no | no | webhooks only | yes (webhook) | webhooks only | yes (webhook) |
258
300
 
259
301
  Outbound calls (`sendText`, `editText`, `sendFile`, `deleteMessage`) throw when the channel is not started, the target chat is unavailable or the platform rejects the request — wrap direct calls in `try/catch`. WebChat is the exception: only `sendText` throws for a disconnected client, the other calls are dropped. `sendText` returns the platform message id (for Discord, the id of the first chunk; continuation chunks are edited and deleted with it).
260
302
 
@@ -307,7 +349,7 @@ Docs: [Social Feeds](https://cogitator.app/docs/channels/feeds).
307
349
 
308
350
  Routes incoming messages to your agent. Handles:
309
351
 
310
- - Conversation threads: one per user per conversation (chat, forum topic, Slack thread, Bluesky or Threads post thread, GitHub issue, pull request or review thread), answered one message at a time
352
+ - Conversation threads: one per user per conversation (chat, forum topic, Slack thread, Bluesky or Threads post thread, GitHub issue, pull request or review thread, email thread, Teams chat or channel thread), answered one message at a time
311
353
  - Session management (per-user, per-channel) with an optional custom `sessionManager`
312
354
  - History compaction, hierarchical into a handoff of grounded atoms or with LLM-written summaries
313
355
  - Streaming with `StreamBuffer` when `stream` is set (message editing, splits at the platform limit without losing text); without `stream` the full answer is sent once the run finishes
@@ -362,10 +404,12 @@ A thread is the conversation memory and the queue of one user in one conversatio
362
404
  | Discord | channel, a thread is a channel of its own | `discord:98765:1234` |
363
405
  | Bluesky, Threads | the post thread's root (`conversationId`), not the reply post | `bluesky:thread:at://did:plc:a/app.bsky.feed.post/1:did:plc:b` |
364
406
  | GitHub | issue or pull request, plus the review thread (`topicId`) | `github:acme/app#12:583231`, `github:acme/app#12:1840022:583231` |
407
+ | Email | sender, plus the email thread (`topicId`, its first `Message-ID`) | `email:ann@example.com:<a1@example.com>:ann@example.com` |
408
+ | Teams | chat, plus the channel thread (`topicId`, its root message) | `teams:19:ops@thread.tacv2:1700000000000:<entra id>` |
365
409
  | WhatsApp | chat, a chat addressed by LID by the phone-number jid | `whatsapp:15550001111@s.whatsapp.net:15550001111` |
366
410
  | WebChat | client | `webchat:c7f2:c7f2` |
367
411
 
368
- So a user keeps a separate thread in their private chat, in each group and in each topic, and every reply in a Bluesky or Threads post thread lands in the same one. In a Slack channel each top-level message is answered in a new Slack thread, a conversation of its own without the history of earlier ones, and its follow-ups in that thread continue it, while a DM is one conversation. On GitHub each issue or pull request is a conversation, and each review thread another one. A WhatsApp chat that reaches a person by LID gets their phone-number jid as its `conversationId` when WhatsApp shares it, so it stays one thread with the chat addressed by phone number.
412
+ So a user keeps a separate thread in their private chat, in each group and in each topic, and every reply in a Bluesky or Threads post thread lands in the same one. In a Slack channel each top-level message is answered in a new Slack thread, a conversation of its own without the history of earlier ones, and its follow-ups in that thread continue it, while a DM is one conversation. On GitHub each issue or pull request is a conversation, and each review thread another one. By email each thread is a conversation, however its subject changes. In Teams each personal and group chat is a conversation, and each thread of a team channel another one. A WhatsApp chat that reaches a person by LID gets their phone-number jid as its `conversationId` when WhatsApp shares it, so it stays one thread with the chat addressed by phone number.
369
413
 
370
414
  The gateway keeps the conversations of each user in their session's metadata (`conversations`, up to 50, most recent first), and `compactAll()` finds their threads there after a restart. A run gets the `topicId` and `conversationId` of its message, and its tools see them in their context, so `schedule_task` stores them with the task and `HeartbeatScheduler` fires it into the same topic and thread, even when the user has moved on to another one. A task without them is answered in the topic and thread of the user's most recent conversation in its chat. With a custom `threadKey` the gateway keeps no conversations and leaves stored sessions out of `compactAll()`, except with `legacyThreadKey`, whose thread of each stored session it still finds.
371
415
 
@@ -393,7 +437,7 @@ Tools marked `requiresApproval` (for example `create_tool` from `capabilities.se
393
437
  2. The user replies `approve` / `yes` to run the calls, or `deny` / `no` to refuse, optionally followed by a reason (`no, too risky`) that the agent sees. Replies are case-insensitive and may end with punctuation; `да` / `одобряю` and `нет` / `отклоняю` work out of the box.
394
438
  3. The Gateway calls `cogitator.resume(agent, threadId, { userId, defaultDecision })` and delivers the result like any reply, streaming included. If the run pauses again, a new prompt is sent.
395
439
 
396
- On channels with buttons (Telegram), the prompt also carries **Approve** and **Deny** buttons. A press answers exactly like the reply words, through the same middleware and checks, and the buttons then show the decision. `approvals.buttons: false` turns them off and `approvals.buttonLabels` renames them. A press counts only from the user the prompt asked, while their run is still paused; any other press gets an alert (`notAllowedMessage`, or `expiredMessage` once the request was answered, dropped or predates a restart, when a reply word still works).
440
+ On channels with buttons (Telegram, Microsoft Teams), the prompt also carries **Approve** and **Deny** buttons. A press answers exactly like the reply words, through the same middleware and checks, and the buttons then show the decision. `approvals.buttons: false` turns them off and `approvals.buttonLabels` renames them. A press counts only from the user the prompt asked, while their run is still paused; any other press gets an alert (`notAllowedMessage`, or `expiredMessage` once the request was answered, dropped or predates a restart, when a reply word still works). A press in a group counts as a message of that group (`ChannelAction.groupId`), and a press while the Gateway stops gets `stoppingMessage` and leaves the request waiting.
397
441
 
398
442
  Any other message on a paused thread runs as usual, and the runtime answers the waiting calls as declined. An approve-only word with more text after it (`yes, but rename it`) counts as a new message, so nothing runs by accident.
399
443
 
@@ -689,7 +733,7 @@ session:
689
733
 
690
734
  For a parsed YAML file, validate it first with `new RuntimeBuilder(AssistantConfigSchema.parse(yamlObject), process.env)` (the schema is exported, along with the `AssistantConfigInput` / `AssistantConfigOutput` types).
691
735
 
692
- - **Channels:** the terminal REPL plus `channels.telegram` (`TG_TOKEN` or `TELEGRAM_TOKEN`), `channels.discord` (`DISCORD_TOKEN`) and `channels.slack` (`SLACK_BOT_TOKEN`, `SLACK_SIGNING_SECRET`, optional `SLACK_APP_TOKEN` / `SLACK_PORT`). A configured channel without its token is skipped with a warning. `channels.whatsapp` (`{ ownerIds?, sessionPath? }`, owner ids are phone numbers without `@s.whatsapp.net`, the session defaults to `~/.cogitator/whatsapp-session`) needs `@whiskeysockets/baileys`. `channels.webchat` (`{ port?, path? }`, default `8080` and `/ws`, no `ownerIds`) needs `ws` and starts only with `WEBCHAT_TOKEN` set, and clients connect with `?token=<WEBCHAT_TOKEN>`. `channels.bluesky` (`{ ownerIds?, posts?, directMessages?, pollInterval?, tokenPath? }`, owner ids are DIDs) needs `@atproto/api` and starts with `BLUESKY_HANDLE` and `BLUESKY_APP_PASSWORD`. `channels.threads` (`{ ownerIds?, webhook?: { port, path? }, pollInterval?, tokenPath? }`, owner ids are usernames) starts with `THREADS_ACCESS_TOKEN`, and with `THREADS_APP_SECRET` and `THREADS_VERIFY_TOKEN` for webhooks. Both keep their session or token in `tokenPath` (default `~/.cogitator/tokens.json`). `channels.github` (`{ ownerIds?, webhook?: { port?, path? }, trigger?, repositories?, associations?, authors?, login?, allowBots?, stream? }`, owner ids are numeric user ids, the webhook server defaults to port `8787` at `/github/webhook`) starts with `GITHUB_CHANNEL_TOKEN` (falling back to `GITHUB_TOKEN` with a warning) and `GITHUB_WEBHOOK_SECRET`, and calls `GITHUB_API_URL` when set (GitHub Enterprise Server).
736
+ - **Channels:** the terminal REPL plus `channels.telegram` (`TG_TOKEN` or `TELEGRAM_TOKEN`), `channels.discord` (`DISCORD_TOKEN`) and `channels.slack` (`SLACK_BOT_TOKEN`, `SLACK_SIGNING_SECRET`, optional `SLACK_APP_TOKEN` / `SLACK_PORT`). A configured channel without its token is skipped with a warning. `channels.whatsapp` (`{ ownerIds?, sessionPath? }`, owner ids are phone numbers without `@s.whatsapp.net`, the session defaults to `~/.cogitator/whatsapp-session`) needs `@whiskeysockets/baileys`. `channels.webchat` (`{ port?, path? }`, default `8080` and `/ws`, no `ownerIds`) needs `ws` and starts only with `WEBCHAT_TOKEN` set, and clients connect with `?token=<WEBCHAT_TOKEN>`. `channels.bluesky` (`{ ownerIds?, posts?, directMessages?, pollInterval?, tokenPath? }`, owner ids are DIDs) needs `@atproto/api` and starts with `BLUESKY_HANDLE` and `BLUESKY_APP_PASSWORD`. `channels.threads` (`{ ownerIds?, webhook?: { port, path? }, pollInterval?, tokenPath? }`, owner ids are usernames) starts with `THREADS_ACCESS_TOKEN`, and with `THREADS_APP_SECRET` and `THREADS_VERIFY_TOKEN` for webhooks. Both keep their session or token in `tokenPath` (default `~/.cogitator/tokens.json`). `channels.github` (`{ ownerIds?, webhook?: { port?, path? }, trigger?, repositories?, associations?, authors?, login?, allowBots?, stream? }`, owner ids are numeric user ids, the webhook server defaults to port `8787` at `/github/webhook`) starts with `GITHUB_CHANNEL_TOKEN` (falling back to `GITHUB_TOKEN` with a warning) and `GITHUB_WEBHOOK_SECRET`, and calls `GITHUB_API_URL` when set (GitHub Enterprise Server). `channels.email` (`{ ownerIds?, address?, name?, aliases?, allowFrom?, senderAuth?, trustedAuthservIds?, subject?, imap?: { host?, port?, secure?, mailbox?, pollInterval?, lookbackDays? }, smtp?: { host?, port?, secure? }, webhook?: { provider, port?, path? } }`, owner ids are addresses, allowed and given owner rights with a passing sender authentication, the webhook server defaults to port `8788` at `/email/webhook`) needs `nodemailer`, plus `imapflow` and `postal-mime` for IMAP. It takes the address, hosts and ports from the file or `EMAIL_ADDRESS`, `EMAIL_IMAP_HOST`, `EMAIL_IMAP_PORT`, `EMAIL_SMTP_HOST` and `EMAIL_SMTP_PORT`, the passwords from `EMAIL_IMAP_PASSWORD` and `EMAIL_SMTP_PASSWORD` (users `EMAIL_IMAP_USER` and `EMAIL_SMTP_USER`, default the address), and reads over IMAP when `imap` is set or `EMAIL_IMAP_HOST` is. A Mailgun webhook needs `EMAIL_MAILGUN_SIGNING_KEY`, Postmark and SendGrid `EMAIL_WEBHOOK_TOKEN` (`?token=` in the URL) or `EMAIL_WEBHOOK_USER` and `EMAIL_WEBHOOK_PASSWORD` (basic auth). `channels.teams` (`{ ownerIds?, appType?, tenantId?, tenants?, users?, trigger?, serviceUrlHosts?, webhook?: { port?, path? } }`, owner ids are Entra object ids, the messaging endpoint defaults to port `3978` at `/api/messages`) starts with `TEAMS_APP_ID` and `TEAMS_APP_PASSWORD`, and `TEAMS_TENANT_ID` (or `tenantId`) for a single-tenant bot. A multi-tenant bot needs `tenants`, and a `UserAssignedMSI` one is built in code with a `tokenProvider`.
693
737
 
694
738
  - **Memory:** `memory.adapter: sqlite` (default, `memory.path`, default `~/.cogitator/memory.db`) or `postgres` (`memory.connectionString`, `DATABASE_URL` or `POSTGRES_URL`, requires `pg`). Core facts always live in the SQLite file, as memory items with their history. The knowledge graph (`memory.knowledgeGraph`) and auto-extraction (`memory.autoExtract`) are on by default, and the memory tools keep memory items in the memory store too: `remember` keeps a fact as the user's (an `active` item, a core fact) only when its `quote` is in one of the run user's own messages on the thread's active branch, else as a suggestion, `recall` searches the items of the user and the thread, and `forget` lets go only the run's own that hold the query as whole words (a run without a user keeps its facts in the thread's memory). The assistant's agent id is its `name`, the same across restarts. `memory.compaction.threshold` enables history compaction, hierarchical, keeping about 4000 tokens of the newest turns verbatim.
695
739
  - **Fresh context:** the gateway builds an agent per message: instructions (with known user facts) and the `/model` override are resolved each time. The current date and time go to each run as its `brief`, with the input, so they do not change the instructions and their prompt cache. `runtime.agent` is the base agent.
@@ -739,6 +783,26 @@ GITHUB_TOKEN=ghp_... # capabilities.github, and the channel's fallba
739
783
  GITHUB_WEBHOOK_SECRET=... # the secret set on the webhook
740
784
  GITHUB_API_URL=... # GitHub Enterprise Server only, https://<host>/api/v3
741
785
 
786
+ # Email (channels.email, hosts and ports may be in cogitator.yml instead)
787
+ EMAIL_ADDRESS=assistant@example.com
788
+ EMAIL_IMAP_HOST=imap.gmail.com # reading over IMAP
789
+ EMAIL_IMAP_PORT=993
790
+ EMAIL_IMAP_USER=... # default EMAIL_ADDRESS
791
+ EMAIL_IMAP_PASSWORD=... # an app password for Gmail and Outlook
792
+ EMAIL_SMTP_HOST=smtp.gmail.com
793
+ EMAIL_SMTP_PORT=587 # 465 for TLS from the start
794
+ EMAIL_SMTP_USER=... # default EMAIL_ADDRESS
795
+ EMAIL_SMTP_PASSWORD=...
796
+ EMAIL_MAILGUN_SIGNING_KEY=... # webhook.provider: mailgun
797
+ EMAIL_WEBHOOK_TOKEN=... # webhook.provider: postmark or sendgrid, ?token= in the URL
798
+ EMAIL_WEBHOOK_USER=... # or basic auth in the URL, https://user:password@host/email/webhook
799
+ EMAIL_WEBHOOK_PASSWORD=...
800
+
801
+ # Microsoft Teams (channels.teams)
802
+ TEAMS_APP_ID=... # the Microsoft App ID of the Azure Bot
803
+ TEAMS_APP_PASSWORD=... # a client secret of its app registration
804
+ TEAMS_TENANT_ID=... # the tenant of the app registration (single-tenant)
805
+
742
806
  # STT (optional, for voice messages — pick one)
743
807
  DEEPGRAM_API_KEY=... # highest priority
744
808
  GROQ_API_KEY=... # free tier
@@ -30,8 +30,11 @@ export interface GatewayApprovalsConfig {
30
30
  };
31
31
  /** Shown on a press of buttons whose request was answered, dropped or is from before a restart */
32
32
  expiredMessage?: string;
33
+ /** Shown on a press while the gateway stops: the request stays paused and the buttons stay */
34
+ stoppingMessage?: string;
33
35
  }
34
36
  export declare const DEFAULT_EXPIRED_MESSAGE = "This request is no longer waiting. Reply \"approve\" or \"deny\" if it is still paused.";
37
+ export declare const DEFAULT_STOPPING_MESSAGE = "The assistant is restarting. Once it is back, reply \"approve\" or \"deny\": the request is still waiting.";
35
38
  /** The `data` of the approval buttons the gateway puts under its prompt. */
36
39
  export declare const APPROVE_ACTION = "cogitator:approve";
37
40
  export declare const DENY_ACTION = "cogitator:deny";
@@ -1 +1 @@
1
- {"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../src/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;AAE9D,MAAM,WAAW,kBAAkB;IACjC,YAAY,EA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SAAS,MAAM,EAAwC,CAAC;AAC5F,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAAsC,CAAC;AACvF,eAAO,MAAM,2BAA2B,kEACyB,CAAC;AAuBlE;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,kBAAkB,GACxB,oBAAoB,GAAG,IAAI,CAU7B;AAoBD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,SAAS,mBAAmB,EAAE,EACzC,KAAK,EAAE,kBAAkB,GACxB,MAAM,CAqBR"}
package/dist/approvals.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export const DEFAULT_EXPIRED_MESSAGE = 'This request is no longer waiting. Reply "approve" or "deny" if it is still paused.';
2
+ export const DEFAULT_STOPPING_MESSAGE = 'The assistant is restarting. Once it is back, reply "approve" or "deny": the request is still waiting.';
2
3
  /** The `data` of the approval buttons the gateway puts under its prompt. */
3
4
  export const APPROVE_ACTION = 'cogitator:approve';
4
5
  export const DENY_ACTION = 'cogitator:deny';
@@ -1 +1 @@
1
- {"version":3,"file":"approvals.js","sourceRoot":"","sources":["../src/approvals.ts"],"names":[],"mappings":"AAqCA,MAAM,CAAC,MAAM,uBAAuB,GAClC,qFAAqF,CAAC;AAExF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAClD,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAE5C,MAAM,CAAC,MAAM,qBAAqB,GAAsB,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAC5F,MAAM,CAAC,MAAM,kBAAkB,GAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AACvF,MAAM,CAAC,MAAM,2BAA2B,GACtC,+DAA+D,CAAC;AAElE,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,kBAAkB,GAAG,cAAc,CAA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KAAK,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG;QACZ,MAAM;YACJ,CAAC,CAAC,kDAAkD;YACpD,CAAC,CAAC,6CAA6C,SAAS,CAAC,MAAM,WAAW;QAC5E,EAAE;KACH,CAAC;IAEF,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;QACpC,MAAM,KAAK,GAAG,KAAK,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACpG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,IAAI,CACR,EAAE,EACF,SAAS,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,aAAa,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI;QAC5E,MAAM,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,6CAA6C,CACjF,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,4 +1,8 @@
1
1
  import { z } from 'zod';
2
+ /** An email address, as `channels.email` takes them */
3
+ export declare const EMAIL_ADDRESS_PATTERN: RegExp;
4
+ /** An entry of `channels.email.allowFrom`: an address, a domain, `*.domain`, `@domain` or `*` */
5
+ export declare const EMAIL_ALLOW_FROM_PATTERN: RegExp;
2
6
  export declare const AssistantConfigSchema: z.ZodObject<{
3
7
  name: z.ZodString;
4
8
  personality: z.ZodString;
@@ -71,6 +75,62 @@ export declare const AssistantConfigSchema: z.ZodObject<{
71
75
  allowBots: z.ZodOptional<z.ZodBoolean>;
72
76
  stream: z.ZodOptional<z.ZodBoolean>;
73
77
  }, z.core.$strip>>;
78
+ email: z.ZodOptional<z.ZodObject<{
79
+ ownerIds: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
80
+ address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
81
+ name: z.ZodOptional<z.ZodString>;
82
+ aliases: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
83
+ allowFrom: z.ZodOptional<z.ZodArray<z.ZodString>>;
84
+ senderAuth: z.ZodOptional<z.ZodEnum<{
85
+ required: "required";
86
+ "when-reported": "when-reported";
87
+ off: "off";
88
+ }>>;
89
+ trustedAuthservIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
90
+ subject: z.ZodOptional<z.ZodString>;
91
+ imap: z.ZodOptional<z.ZodObject<{
92
+ host: z.ZodOptional<z.ZodString>;
93
+ port: z.ZodOptional<z.ZodNumber>;
94
+ secure: z.ZodOptional<z.ZodBoolean>;
95
+ mailbox: z.ZodOptional<z.ZodString>;
96
+ pollInterval: z.ZodOptional<z.ZodNumber>;
97
+ lookbackDays: z.ZodOptional<z.ZodNumber>;
98
+ }, z.core.$strip>>;
99
+ smtp: z.ZodOptional<z.ZodObject<{
100
+ host: z.ZodOptional<z.ZodString>;
101
+ port: z.ZodOptional<z.ZodNumber>;
102
+ secure: z.ZodOptional<z.ZodBoolean>;
103
+ }, z.core.$strip>>;
104
+ webhook: z.ZodOptional<z.ZodObject<{
105
+ provider: z.ZodEnum<{
106
+ mailgun: "mailgun";
107
+ postmark: "postmark";
108
+ sendgrid: "sendgrid";
109
+ }>;
110
+ port: z.ZodDefault<z.ZodNumber>;
111
+ path: z.ZodOptional<z.ZodString>;
112
+ }, z.core.$strip>>;
113
+ }, z.core.$strip>>;
114
+ teams: z.ZodOptional<z.ZodObject<{
115
+ ownerIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
116
+ appType: z.ZodOptional<z.ZodEnum<{
117
+ SingleTenant: "SingleTenant";
118
+ MultiTenant: "MultiTenant";
119
+ UserAssignedMSI: "UserAssignedMSI";
120
+ }>>;
121
+ tenantId: z.ZodOptional<z.ZodString>;
122
+ tenants: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"*">]>>;
123
+ users: z.ZodOptional<z.ZodArray<z.ZodString>>;
124
+ trigger: z.ZodOptional<z.ZodEnum<{
125
+ mention: "mention";
126
+ all: "all";
127
+ }>>;
128
+ serviceUrlHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
129
+ webhook: z.ZodDefault<z.ZodObject<{
130
+ port: z.ZodDefault<z.ZodNumber>;
131
+ path: z.ZodOptional<z.ZodString>;
132
+ }, z.core.$strip>>;
133
+ }, z.core.$strip>>;
74
134
  }, z.core.$strip>>>;
75
135
  capabilities: z.ZodDefault<z.ZodOptional<z.ZodObject<{
76
136
  webSearch: z.ZodOptional<z.ZodBoolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"assistant-config.d.ts","sourceRoot":"","sources":["../src/assistant-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqLxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BhC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"assistant-config.d.ts","sourceRoot":"","sources":["../src/assistant-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,uDAAuD;AACvD,eAAO,MAAM,qBAAqB,QAA4C,CAAC;AAE/E,iGAAiG;AACjG,eAAO,MAAM,wBAAwB,QACwC,CAAC;AAgR9E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BhC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -10,6 +10,15 @@ const McpServerSchema = z.object({
10
10
  requiresApproval: z.boolean().optional(),
11
11
  });
12
12
  const OwnerIdsSchema = z.array(z.string()).optional();
13
+ /** An email address, as `channels.email` takes them */
14
+ export const EMAIL_ADDRESS_PATTERN = /^[^\s@<>]+@[^\s@<>.]+(?:\.[^\s@<>.]+)+$/;
15
+ /** An entry of `channels.email.allowFrom`: an address, a domain, `*.domain`, `@domain` or `*` */
16
+ export const EMAIL_ALLOW_FROM_PATTERN = /^(\*|(\*\.|@)?[^\s@*.]+(?:\.[^\s@*.]+)+|[^\s@]+@[^\s@.]+(?:\.[^\s@.]+)+)$/;
17
+ const EmailAddressSchema = z
18
+ .string()
19
+ .trim()
20
+ .regex(EMAIL_ADDRESS_PATTERN, 'Not an email address')
21
+ .transform((address) => address.toLowerCase());
13
22
  const AssistantChannelsSchema = z.object({
14
23
  telegram: z.object({ ownerIds: OwnerIdsSchema }).optional(),
15
24
  discord: z.object({ ownerIds: OwnerIdsSchema }).optional(),
@@ -98,6 +107,99 @@ const AssistantChannelsSchema = z.object({
98
107
  stream: z.boolean().optional(),
99
108
  })
100
109
  .optional(),
110
+ email: z
111
+ .object({
112
+ /**
113
+ * Owner addresses, also answered whatever `allowFrom` says, but only when their sender
114
+ * authentication passes (unless `senderAuth` is `off`), since a `From` can be forged
115
+ */
116
+ ownerIds: z.array(EmailAddressSchema).optional(),
117
+ /** The bot's address (default `EMAIL_ADDRESS` from the env) */
118
+ address: EmailAddressSchema.optional(),
119
+ /** The display name of the mail it sends */
120
+ name: z.string().optional(),
121
+ /** Other addresses of the bot, never answered */
122
+ aliases: z.array(EmailAddressSchema).optional(),
123
+ /** Who it answers: addresses, domains, `*.domain` or `*` (default nobody but the owners) */
124
+ allowFrom: z
125
+ .array(z
126
+ .string()
127
+ .regex(EMAIL_ALLOW_FROM_PATTERN, 'An allowFrom entry is an address, a domain, *.domain or *'))
128
+ .optional(),
129
+ /** `when-reported` (default), `required` or `off`: how DKIM, SPF and DMARC results are used */
130
+ senderAuth: z.enum(['required', 'when-reported', 'off']).optional(),
131
+ /** The authserv-ids whose Authentication-Results count (default the topmost header) */
132
+ trustedAuthservIds: z.array(z.string()).optional(),
133
+ /** The subject of mail that starts a conversation */
134
+ subject: z.string().optional(),
135
+ /** Read mail over IMAP, host, port, user and password may also come from EMAIL_IMAP_* */
136
+ imap: z
137
+ .object({
138
+ host: z.string().optional(),
139
+ port: z.number().int().positive().optional(),
140
+ secure: z.boolean().optional(),
141
+ mailbox: z.string().optional(),
142
+ pollInterval: z.number().int().positive().optional(),
143
+ lookbackDays: z.number().positive().optional(),
144
+ })
145
+ .optional(),
146
+ /** Send over SMTP, host, port, user and password may also come from EMAIL_SMTP_* */
147
+ smtp: z
148
+ .object({
149
+ host: z.string().optional(),
150
+ port: z.number().int().positive().optional(),
151
+ secure: z.boolean().optional(),
152
+ })
153
+ .optional(),
154
+ /** Take mail from a provider's inbound webhook, on its own server (default port 8788) */
155
+ webhook: z
156
+ .object({
157
+ provider: z.enum(['mailgun', 'postmark', 'sendgrid']),
158
+ port: z.number().int().positive().default(8788),
159
+ path: z
160
+ .string()
161
+ .regex(/^\//, 'The webhook path starts with /, such as /email/webhook')
162
+ .optional(),
163
+ })
164
+ .optional(),
165
+ })
166
+ .optional(),
167
+ teams: z
168
+ .object({
169
+ /** Owner ids: Entra object ids (`aadObjectId`) of the users given owner rights */
170
+ ownerIds: OwnerIdsSchema,
171
+ /** `SingleTenant` (default) or `MultiTenant` (legacy bots), a managed identity needs code */
172
+ appType: z.enum(['SingleTenant', 'MultiTenant', 'UserAssignedMSI']).optional(),
173
+ /** The tenant of the app registration (default `TEAMS_TENANT_ID` from the env) */
174
+ tenantId: z.string().trim().min(1).optional(),
175
+ /** The tenants whose users it answers, or `*` (default the bot's own tenant) */
176
+ tenants: z.union([z.array(z.string().trim().min(1)).min(1), z.literal('*')]).optional(),
177
+ /** Answer only these users, by Entra object id or Teams user id */
178
+ users: z.array(z.string().trim().min(1)).optional(),
179
+ /** `mention` (default) answers @mentions in group chats and channels, `all` every message */
180
+ trigger: z.enum(['mention', 'all']).optional(),
181
+ /** The hosts a service URL may have, such as smba.trafficmanager.net */
182
+ serviceUrlHosts: z.array(z.string().trim().min(1)).optional(),
183
+ /** The messaging endpoint the bot serves (default port 3978, path `/api/messages`) */
184
+ webhook: z
185
+ .object({
186
+ port: z.number().int().positive().default(3978),
187
+ path: z
188
+ .string()
189
+ .regex(/^\//, 'The webhook path starts with /, such as /api/messages')
190
+ .optional(),
191
+ })
192
+ .default({ port: 3978 }),
193
+ })
194
+ .refine((teams) => teams.appType !== 'MultiTenant' || teams.tenants !== undefined, {
195
+ message: 'A MultiTenant bot needs tenants: the tenants it answers, or *',
196
+ path: ['tenants'],
197
+ })
198
+ .refine((teams) => teams.appType !== 'UserAssignedMSI', {
199
+ message: 'A UserAssignedMSI bot needs a tokenProvider: create it with teamsChannel() in code',
200
+ path: ['appType'],
201
+ })
202
+ .optional(),
101
203
  });
102
204
  const ApprovalsSchema = z
103
205
  .object({
@@ -1 +1 @@
1
- {"version":3,"file":"assistant-config.js","sourceRoot":"","sources":["../src/assistant-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACzB,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAChD;;;OAGG;IACH,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;AAEtD,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC3D,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC1D,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxD,QAAQ,EAAE,CAAC;SACR,MAAM,CAAC;QACN,QAAQ,EAAE,cAAc;QACxB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACnC,CAAC;SACD,QAAQ,EAAE;IACb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,CAAC,MAAM,EAAE;IACvB,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC;QACZ,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;QAC7D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KAClB,CAAC;IACF,QAAQ,EAAE,uBAAuB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACxD,YAAY,EAAE,2BAA2B,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAChE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC,QAAQ,EAAE;IAC5D,MAAM,EAAE,qBAAqB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC;QAC/C,OAAO,EAAE,QAAQ;QACjB,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,IAAI;KACrB,CAAC;IACF,QAAQ,EAAE,cAAc;IACxB,SAAS,EAAE,eAAe;IAC1B,OAAO,EAAE,sBAAsB,CAAC,QAAQ,EAAE;IAC1C,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;QACtC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;KACrC,CAAC;SACD,QAAQ,EAAE;IACb,SAAS,EAAE,CAAC;SACT,MAAM,CAAC;QACN,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;KACrC,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC"}
@@ -0,0 +1,44 @@
1
+ /** A mailbox of an address header: the address and the display name, if any. */
2
+ export interface EmailMailbox {
3
+ address: string;
4
+ name?: string;
5
+ }
6
+ /** Headers of a message by lower-case name, in their order, duplicates kept. */
7
+ export type EmailHeaders = readonly (readonly [name: string, value: string])[];
8
+ /** An address in the form the channel keys senders by: trimmed and in lower case. */
9
+ export declare function normalizeAddress(address: string): string;
10
+ /** Whether `text` is a plain address, `local@domain.tld`. */
11
+ export declare function isAddress(text: string): boolean;
12
+ /** The domain of an address, in lower case. */
13
+ export declare function domainOf(address: string): string;
14
+ /** Header text with its RFC 2047 encoded words (`=?utf-8?B?...?=`, `=?utf-8?Q?...?=`) decoded. */
15
+ export declare function decodeMimeWords(text: string): string;
16
+ /**
17
+ * The first mailbox of an address header such as `From`: `"Ann Lee" <ann@example.com>`,
18
+ * `Ann <ann@example.com>` or `ann@example.com (Ann)`, with encoded words in the name decoded.
19
+ * The address is the angle address outside quoted strings and comments, so a display name that
20
+ * holds another address cannot pass for it.
21
+ */
22
+ export declare function parseMailbox(value: string | undefined): EmailMailbox | undefined;
23
+ /** The message ids (`<id@host>`) of a `Message-ID`, `In-Reply-To` or `References` header. */
24
+ export declare function messageIdsOf(value: string | undefined): string[];
25
+ /** The first message id of a header, if it has one. */
26
+ export declare function messageIdOf(value: string | undefined): string | undefined;
27
+ /** A header block (`Name: value` lines, folded lines continuing with whitespace) as headers. */
28
+ export declare function parseHeaderBlock(block: string): EmailHeaders;
29
+ /** The first value of a header, by its name in any letter case. */
30
+ export declare function headerOf(headers: EmailHeaders, name: string): string | undefined;
31
+ /** Every value of a header, top to bottom, by its name in any letter case. */
32
+ export declare function headersOf(headers: EmailHeaders, name: string): string[];
33
+ /**
34
+ * Whether `domain` is aligned with the author's domain `fromDomain` in the relaxed DMARC sense:
35
+ * the same domain, or one a subdomain of the other.
36
+ */
37
+ export declare function alignedDomains(domain: string, fromDomain: string): boolean;
38
+ /**
39
+ * Whether an allow list lets `address` in. Entries are addresses (`ann@example.com`), domains
40
+ * (`example.com` or `@example.com`, without subdomains), subdomain wildcards (`*.example.com`)
41
+ * or `*` for everyone, in any letter case.
42
+ */
43
+ export declare function allowsSender(list: readonly string[], address: string): boolean;
44
+ //# sourceMappingURL=address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../src/channels/email/address.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,gFAAgF;AAChF,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;AAI/E,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,6DAA6D;AAC7D,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED,+CAA+C;AAC/C,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGhD;AAUD,kGAAkG;AAClG,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoBpD;AAwED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAYhF;AAED,6FAA6F;AAC7F,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,CAMhE;AAED,uDAAuD;AACvD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAEzE;AAED,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAc5D;AAED,mEAAmE;AACnE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGhF;AAED,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,OAAO,EAAE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