@cogitator-ai/channels 0.17.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.
- package/README.md +37 -14
- package/dist/approvals.d.ts +3 -0
- package/dist/approvals.d.ts.map +1 -1
- package/dist/approvals.js +1 -0
- package/dist/approvals.js.map +1 -1
- package/dist/assistant-config.d.ts +20 -0
- package/dist/assistant-config.d.ts.map +1 -1
- package/dist/assistant-config.js +36 -0
- package/dist/assistant-config.js.map +1 -1
- package/dist/channels/teams/activity.d.ts +108 -0
- package/dist/channels/teams/activity.d.ts.map +1 -0
- package/dist/channels/teams/activity.js +206 -0
- package/dist/channels/teams/activity.js.map +1 -0
- package/dist/channels/teams/auth.d.ts +65 -0
- package/dist/channels/teams/auth.d.ts.map +1 -0
- package/dist/channels/teams/auth.js +213 -0
- package/dist/channels/teams/auth.js.map +1 -0
- package/dist/channels/teams/cards.d.ts +23 -0
- package/dist/channels/teams/cards.d.ts.map +1 -0
- package/dist/channels/teams/cards.js +97 -0
- package/dist/channels/teams/cards.js.map +1 -0
- package/dist/channels/teams/channel.d.ts +303 -0
- package/dist/channels/teams/channel.d.ts.map +1 -0
- package/dist/channels/teams/channel.js +1071 -0
- package/dist/channels/teams/channel.js.map +1 -0
- package/dist/channels/teams/client.d.ts +72 -0
- package/dist/channels/teams/client.d.ts.map +1 -0
- package/dist/channels/teams/client.js +161 -0
- package/dist/channels/teams/client.js.map +1 -0
- package/dist/channels/teams/index.d.ts +7 -0
- package/dist/channels/teams/index.d.ts.map +1 -0
- package/dist/channels/teams/index.js +6 -0
- package/dist/channels/teams/index.js.map +1 -0
- package/dist/channels/teams/pacer.d.ts +47 -0
- package/dist/channels/teams/pacer.d.ts.map +1 -0
- package/dist/channels/teams/pacer.js +174 -0
- package/dist/channels/teams/pacer.js.map +1 -0
- package/dist/channels/teams/token.d.ts +47 -0
- package/dist/channels/teams/token.d.ts.map +1 -0
- package/dist/channels/teams/token.js +107 -0
- package/dist/channels/teams/token.js.map +1 -0
- package/dist/channels/telegram.d.ts.map +1 -1
- package/dist/channels/telegram.js +3 -0
- package/dist/channels/telegram.js.map +1 -1
- package/dist/formatters/markdown-images.d.ts +8 -0
- package/dist/formatters/markdown-images.d.ts.map +1 -0
- package/dist/formatters/markdown-images.js +181 -0
- package/dist/formatters/markdown-images.js.map +1 -0
- package/dist/formatters/markdown.d.ts.map +1 -1
- package/dist/formatters/markdown.js +21 -3
- package/dist/formatters/markdown.js.map +1 -1
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +9 -2
- package/dist/gateway.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime-builder.d.ts.map +1 -1
- package/dist/runtime-builder.js +35 -1
- package/dist/runtime-builder.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ 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
|
|
18
|
+
pnpm add @atproto/api # Bluesky (Threads, GitHub and Teams need no SDK)
|
|
19
19
|
pnpm add nodemailer imapflow postal-mime # Email: SMTP, IMAP and MIME parsing (webhooks need nodemailer, plus postal-mime for raw MIME)
|
|
20
20
|
|
|
21
21
|
# RuntimeBuilder (`cogitator up`)
|
|
@@ -269,17 +269,34 @@ const email = emailChannel({
|
|
|
269
269
|
|
|
270
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
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
|
+
|
|
272
289
|
## Platform Comparison
|
|
273
290
|
|
|
274
|
-
| Feature | Telegram | Discord | Slack | WhatsApp | WebChat | Bluesky | Threads | GitHub | Email |
|
|
275
|
-
| ------------------ | ------------ | ------- | --------- | -------- | --------- | ------------------ | ------------------ | ------------------- | ------------------ |
|
|
276
|
-
| Streaming (edit) | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ (sent finished) | ❌ (sent finished) | with `stream: true` | ❌ (sent finished) |
|
|
277
|
-
| Reactions | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ (8 kinds) | ❌ |
|
|
278
|
-
| Typing indicator | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
279
|
-
| Photos → vision | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ (attachments) |
|
|
280
|
-
| Voice → STT | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ (attachments) |
|
|
281
|
-
| Max message length | 4096 | 2000 | 40000 | 65536 | unlimited | 300 per post | 500 per post | 65536 per comment | unlimited |
|
|
282
|
-
| Public URL needed | webhook only | no | HTTP only | no | no | no | webhooks only | yes (webhook) | webhooks only |
|
|
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) |
|
|
283
300
|
|
|
284
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).
|
|
285
302
|
|
|
@@ -332,7 +349,7 @@ Docs: [Social Feeds](https://cogitator.app/docs/channels/feeds).
|
|
|
332
349
|
|
|
333
350
|
Routes incoming messages to your agent. Handles:
|
|
334
351
|
|
|
335
|
-
- 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), 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
|
|
336
353
|
- Session management (per-user, per-channel) with an optional custom `sessionManager`
|
|
337
354
|
- History compaction, hierarchical into a handoff of grounded atoms or with LLM-written summaries
|
|
338
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
|
|
@@ -388,10 +405,11 @@ A thread is the conversation memory and the queue of one user in one conversatio
|
|
|
388
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` |
|
|
389
406
|
| GitHub | issue or pull request, plus the review thread (`topicId`) | `github:acme/app#12:583231`, `github:acme/app#12:1840022:583231` |
|
|
390
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>` |
|
|
391
409
|
| WhatsApp | chat, a chat addressed by LID by the phone-number jid | `whatsapp:15550001111@s.whatsapp.net:15550001111` |
|
|
392
410
|
| WebChat | client | `webchat:c7f2:c7f2` |
|
|
393
411
|
|
|
394
|
-
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. 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.
|
|
395
413
|
|
|
396
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.
|
|
397
415
|
|
|
@@ -419,7 +437,7 @@ Tools marked `requiresApproval` (for example `create_tool` from `capabilities.se
|
|
|
419
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.
|
|
420
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.
|
|
421
439
|
|
|
422
|
-
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.
|
|
423
441
|
|
|
424
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.
|
|
425
443
|
|
|
@@ -715,7 +733,7 @@ session:
|
|
|
715
733
|
|
|
716
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).
|
|
717
735
|
|
|
718
|
-
- **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).
|
|
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`.
|
|
719
737
|
|
|
720
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.
|
|
721
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.
|
|
@@ -780,6 +798,11 @@ EMAIL_WEBHOOK_TOKEN=... # webhook.provider: postmark or sendgrid, ?toke
|
|
|
780
798
|
EMAIL_WEBHOOK_USER=... # or basic auth in the URL, https://user:password@host/email/webhook
|
|
781
799
|
EMAIL_WEBHOOK_PASSWORD=...
|
|
782
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
|
+
|
|
783
806
|
# STT (optional, for voice messages — pick one)
|
|
784
807
|
DEEPGRAM_API_KEY=... # highest priority
|
|
785
808
|
GROQ_API_KEY=... # free tier
|
package/dist/approvals.d.ts
CHANGED
|
@@ -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";
|
package/dist/approvals.d.ts.map
CHANGED
|
@@ -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,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,mBAAmB,EAAE,EAAE,KAAK,EAAE,kBAAkB,KAAK,MAAM,CAAC;IAC1F,oFAAoF;IACpF,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,sFAAsF;IACtF,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uEAAuE;IACvE,YAAY,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,M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AsB,CAAC;AAClD,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAE5C,eAAO,MAAM,qBAAqB,EAAE,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';
|
package/dist/approvals.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approvals.js","sourceRoot":"","sources":["../src/approvals.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"approvals.js","sourceRoot":"","sources":["../src/approvals.ts"],"names":[],"mappings":"AAuCA,MAAM,CAAC,MAAM,uBAAuB,GAClC,qFAAqF,CAAC;AAExF,MAAM,CAAC,MAAM,wBAAwB,GACnC,wGAAwG,CAAC;AAE3G,4EAA4E;AAC5E,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAClD,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAE5C,MAAM,CAAC,MAAM,qBAAqB,GAAs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Optional<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>>;
|
|
114
134
|
}, z.core.$strip>>>;
|
|
115
135
|
capabilities: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
116
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;AAexB,uDAAuD;AACvD,eAAO,MAAM,qBAAqB,QAA4C,CAAC;AAE/E,iGAAiG;AACjG,eAAO,MAAM,wBAAwB,QACwC,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"}
|
package/dist/assistant-config.js
CHANGED
|
@@ -164,6 +164,42 @@ const AssistantChannelsSchema = z.object({
|
|
|
164
164
|
.optional(),
|
|
165
165
|
})
|
|
166
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(),
|
|
167
203
|
});
|
|
168
204
|
const ApprovalsSchema = z
|
|
169
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,E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AC,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,108 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const AttachmentSchema: z.ZodObject<{
|
|
3
|
+
contentType: z.ZodString;
|
|
4
|
+
contentUrl: z.ZodOptional<z.ZodString>;
|
|
5
|
+
name: z.ZodOptional<z.ZodString>;
|
|
6
|
+
content: z.ZodOptional<z.ZodUnknown>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
declare const ActivitySchema: z.ZodObject<{
|
|
9
|
+
type: z.ZodString;
|
|
10
|
+
id: z.ZodOptional<z.ZodString>;
|
|
11
|
+
name: z.ZodOptional<z.ZodString>;
|
|
12
|
+
channelId: z.ZodString;
|
|
13
|
+
serviceUrl: z.ZodString;
|
|
14
|
+
from: z.ZodObject<{
|
|
15
|
+
id: z.ZodString;
|
|
16
|
+
name: z.ZodOptional<z.ZodString>;
|
|
17
|
+
aadObjectId: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
recipient: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
name: z.ZodOptional<z.ZodString>;
|
|
22
|
+
aadObjectId: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
conversation: z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
conversationType: z.ZodOptional<z.ZodString>;
|
|
27
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
text: z.ZodOptional<z.ZodString>;
|
|
30
|
+
replyToId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
32
|
+
entities: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
33
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
34
|
+
channelData: z.ZodOptional<z.ZodUnknown>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
/** An activity Bot Framework posts to the bot, reduced to what the channel reads. */
|
|
37
|
+
export type TeamsActivity = z.infer<typeof ActivitySchema>;
|
|
38
|
+
/** An attachment of an activity. */
|
|
39
|
+
export type TeamsAttachment = z.infer<typeof AttachmentSchema>;
|
|
40
|
+
/** The kind of a Teams conversation: a personal chat, a group chat or a thread of a team channel. */
|
|
41
|
+
export type TeamsConversationType = 'personal' | 'groupChat' | 'channel';
|
|
42
|
+
/** Reads an activity, or throws when the JSON is not one. */
|
|
43
|
+
export declare function parseActivity(json: unknown): TeamsActivity;
|
|
44
|
+
/**
|
|
45
|
+
* A conversation id split into the conversation and the thread inside it: a channel thread is
|
|
46
|
+
* `<channel id>;messageid=<root message id>`, other conversations have no thread.
|
|
47
|
+
*/
|
|
48
|
+
export declare function splitConversation(id: string): {
|
|
49
|
+
channelId: string;
|
|
50
|
+
topicId?: string;
|
|
51
|
+
};
|
|
52
|
+
/** The conversation id of a chat and the thread inside it, as {@link splitConversation} reads it. */
|
|
53
|
+
export declare function joinConversation(channelId: string, topicId?: string): string;
|
|
54
|
+
/** The kind of a conversation: as the activity says, or guessed from the shape of its id. */
|
|
55
|
+
export declare function conversationTypeOf(id: string, declared?: string): TeamsConversationType;
|
|
56
|
+
/**
|
|
57
|
+
* The tenant an activity comes from, or `undefined` when it names none, or two that differ in
|
|
58
|
+
* `channelData.tenant.id` and `conversation.tenantId`, which no activity of Teams does.
|
|
59
|
+
*/
|
|
60
|
+
export declare function tenantOf(activity: TeamsActivity): string | undefined;
|
|
61
|
+
/** Whether an activity names two tenants that differ. */
|
|
62
|
+
export declare function tenantsDisagree(activity: TeamsActivity): boolean;
|
|
63
|
+
/** The team a channel activity comes from. */
|
|
64
|
+
export declare function teamOf(activity: TeamsActivity): string | undefined;
|
|
65
|
+
/** Whether the activity mentions the bot. */
|
|
66
|
+
export declare function mentionsBot(activity: TeamsActivity): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The text of a message without the bot's mentions (`<at>Bot</at>`), trimmed. Mentions of other
|
|
69
|
+
* people stay. Linear in the length of the text.
|
|
70
|
+
*/
|
|
71
|
+
export declare function textWithoutMention(activity: TeamsActivity): string;
|
|
72
|
+
/** The attachments of an activity that can be read. */
|
|
73
|
+
export declare function attachmentsOf(activity: TeamsActivity): TeamsAttachment[];
|
|
74
|
+
/** A file a user sent in a personal chat, with a download URL that needs no token. */
|
|
75
|
+
export declare const FILE_DOWNLOAD_INFO = "application/vnd.microsoft.teams.file.download.info";
|
|
76
|
+
declare const DownloadInfoSchema: z.ZodObject<{
|
|
77
|
+
downloadUrl: z.ZodString;
|
|
78
|
+
fileType: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
/** The download URL and file type of a {@link FILE_DOWNLOAD_INFO} attachment. */
|
|
81
|
+
export declare function downloadInfoOf(attachment: TeamsAttachment): z.infer<typeof DownloadInfoSchema> | undefined;
|
|
82
|
+
/** What kind of attachment a MIME type is, so images reach vision and audio speech to text. */
|
|
83
|
+
export declare function attachmentTypeOf(mimeType: string): 'image' | 'audio' | 'video' | 'file';
|
|
84
|
+
/** The MIME type of a file type (an extension, as Teams names it). */
|
|
85
|
+
export declare function mimeTypeOf(fileType: string | undefined): string;
|
|
86
|
+
declare const FileConsentSchema: z.ZodObject<{
|
|
87
|
+
type: z.ZodOptional<z.ZodLiteral<"fileUpload">>;
|
|
88
|
+
action: z.ZodEnum<{
|
|
89
|
+
accept: "accept";
|
|
90
|
+
decline: "decline";
|
|
91
|
+
}>;
|
|
92
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
uploadId: z.ZodString;
|
|
94
|
+
}, z.core.$strip>>;
|
|
95
|
+
uploadInfo: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
uploadUrl: z.ZodString;
|
|
98
|
+
contentUrl: z.ZodString;
|
|
99
|
+
uniqueId: z.ZodString;
|
|
100
|
+
fileType: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
/** The answer to a file consent card: accepted with where to upload, or declined. */
|
|
104
|
+
export type FileConsentAnswer = z.infer<typeof FileConsentSchema>;
|
|
105
|
+
/** Reads the value of a `fileConsent/invoke` activity. */
|
|
106
|
+
export declare function fileConsentOf(value: unknown): FileConsentAnswer | undefined;
|
|
107
|
+
export {};
|
|
108
|
+
//# sourceMappingURL=activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../../src/channels/teams/activity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyBxB,QAAA,MAAM,gBAAgB;;;;;iBAKpB,CAAC;AAEH,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAelB,CAAC;AAEH,qFAAqF;AACrF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc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iBAGtB,CAAC;AAEH,iFAAiF;AACjF,wBAAgB,cAAc,CAC5B,UAAU,EAAE,eAAe,GAC1B,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,GAAG,SAAS,CAIhD;AA2BD,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAKvF;AAED,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAE/D;AAED,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;iBAarB,CAAC;AAEH,qFAAqF;AACrF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,0DAA0D;AAC1D,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,GAAG,SAAS,CAG3E"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const AccountSchema = z.object({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
name: z.string().optional(),
|
|
5
|
+
aadObjectId: z.string().optional(),
|
|
6
|
+
});
|
|
7
|
+
const ConversationSchema = z.object({
|
|
8
|
+
id: z.string().min(1),
|
|
9
|
+
conversationType: z.string().optional(),
|
|
10
|
+
tenantId: z.string().optional(),
|
|
11
|
+
});
|
|
12
|
+
const ChannelDataSchema = z.object({
|
|
13
|
+
tenant: z.object({ id: z.string() }).optional(),
|
|
14
|
+
team: z.object({ id: z.string() }).optional(),
|
|
15
|
+
});
|
|
16
|
+
const MentionSchema = z.object({
|
|
17
|
+
type: z.literal('mention'),
|
|
18
|
+
text: z.string().optional(),
|
|
19
|
+
mentioned: z.object({ id: z.string() }),
|
|
20
|
+
});
|
|
21
|
+
const AttachmentSchema = z.object({
|
|
22
|
+
contentType: z.string(),
|
|
23
|
+
contentUrl: z.string().optional(),
|
|
24
|
+
name: z.string().optional(),
|
|
25
|
+
content: z.unknown().optional(),
|
|
26
|
+
});
|
|
27
|
+
const ActivitySchema = z.object({
|
|
28
|
+
type: z.string(),
|
|
29
|
+
id: z.string().optional(),
|
|
30
|
+
name: z.string().optional(),
|
|
31
|
+
channelId: z.string(),
|
|
32
|
+
serviceUrl: z.string().min(1),
|
|
33
|
+
from: AccountSchema,
|
|
34
|
+
recipient: AccountSchema.optional(),
|
|
35
|
+
conversation: ConversationSchema,
|
|
36
|
+
text: z.string().optional(),
|
|
37
|
+
replyToId: z.string().optional(),
|
|
38
|
+
value: z.unknown().optional(),
|
|
39
|
+
entities: z.array(z.unknown()).optional(),
|
|
40
|
+
attachments: z.array(z.unknown()).optional(),
|
|
41
|
+
channelData: z.unknown().optional(),
|
|
42
|
+
});
|
|
43
|
+
/** Reads an activity, or throws when the JSON is not one. */
|
|
44
|
+
export function parseActivity(json) {
|
|
45
|
+
return ActivitySchema.parse(json);
|
|
46
|
+
}
|
|
47
|
+
const THREAD_MARKER = ';messageid=';
|
|
48
|
+
/**
|
|
49
|
+
* A conversation id split into the conversation and the thread inside it: a channel thread is
|
|
50
|
+
* `<channel id>;messageid=<root message id>`, other conversations have no thread.
|
|
51
|
+
*/
|
|
52
|
+
export function splitConversation(id) {
|
|
53
|
+
const at = id.indexOf(THREAD_MARKER);
|
|
54
|
+
if (at < 0)
|
|
55
|
+
return { channelId: id };
|
|
56
|
+
const topicId = id.slice(at + THREAD_MARKER.length);
|
|
57
|
+
return { channelId: id.slice(0, at), ...(topicId && { topicId }) };
|
|
58
|
+
}
|
|
59
|
+
/** The conversation id of a chat and the thread inside it, as {@link splitConversation} reads it. */
|
|
60
|
+
export function joinConversation(channelId, topicId) {
|
|
61
|
+
if (!topicId || channelId.includes(THREAD_MARKER))
|
|
62
|
+
return channelId;
|
|
63
|
+
return `${channelId}${THREAD_MARKER}${topicId}`;
|
|
64
|
+
}
|
|
65
|
+
/** The kind of a conversation: as the activity says, or guessed from the shape of its id. */
|
|
66
|
+
export function conversationTypeOf(id, declared) {
|
|
67
|
+
if (declared === 'personal' || declared === 'groupChat' || declared === 'channel') {
|
|
68
|
+
return declared;
|
|
69
|
+
}
|
|
70
|
+
if (id.startsWith('a:'))
|
|
71
|
+
return 'personal';
|
|
72
|
+
return id.includes('@thread.tacv2') || id.includes('@thread.skype') ? 'channel' : 'groupChat';
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The tenant an activity comes from, or `undefined` when it names none, or two that differ in
|
|
76
|
+
* `channelData.tenant.id` and `conversation.tenantId`, which no activity of Teams does.
|
|
77
|
+
*/
|
|
78
|
+
export function tenantOf(activity) {
|
|
79
|
+
if (tenantsDisagree(activity))
|
|
80
|
+
return undefined;
|
|
81
|
+
const data = ChannelDataSchema.safeParse(activity.channelData);
|
|
82
|
+
return (data.success ? data.data.tenant?.id : undefined) ?? activity.conversation.tenantId;
|
|
83
|
+
}
|
|
84
|
+
/** Whether an activity names two tenants that differ. */
|
|
85
|
+
export function tenantsDisagree(activity) {
|
|
86
|
+
const data = ChannelDataSchema.safeParse(activity.channelData);
|
|
87
|
+
const fromData = data.success ? data.data.tenant?.id : undefined;
|
|
88
|
+
const fromConversation = activity.conversation.tenantId;
|
|
89
|
+
return (!!fromData && !!fromConversation && fromData.toLowerCase() !== fromConversation.toLowerCase());
|
|
90
|
+
}
|
|
91
|
+
/** The team a channel activity comes from. */
|
|
92
|
+
export function teamOf(activity) {
|
|
93
|
+
const data = ChannelDataSchema.safeParse(activity.channelData);
|
|
94
|
+
return data.success ? data.data.team?.id : undefined;
|
|
95
|
+
}
|
|
96
|
+
/** The mentions of the bot in an activity: its `mention` entities that name the recipient. */
|
|
97
|
+
function botMentions(activity) {
|
|
98
|
+
const botId = activity.recipient?.id;
|
|
99
|
+
if (!botId)
|
|
100
|
+
return [];
|
|
101
|
+
const texts = [];
|
|
102
|
+
for (const entity of activity.entities ?? []) {
|
|
103
|
+
const mention = MentionSchema.safeParse(entity);
|
|
104
|
+
if (mention.success && mention.data.mentioned.id === botId) {
|
|
105
|
+
texts.push(mention.data.text ?? '');
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return texts;
|
|
109
|
+
}
|
|
110
|
+
/** Whether the activity mentions the bot. */
|
|
111
|
+
export function mentionsBot(activity) {
|
|
112
|
+
return botMentions(activity).length > 0;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The text of a message without the bot's mentions (`<at>Bot</at>`), trimmed. Mentions of other
|
|
116
|
+
* people stay. Linear in the length of the text.
|
|
117
|
+
*/
|
|
118
|
+
export function textWithoutMention(activity) {
|
|
119
|
+
let text = activity.text ?? '';
|
|
120
|
+
for (const mention of botMentions(activity)) {
|
|
121
|
+
if (mention)
|
|
122
|
+
text = text.split(mention).join('');
|
|
123
|
+
}
|
|
124
|
+
return text.trim();
|
|
125
|
+
}
|
|
126
|
+
/** The attachments of an activity that can be read. */
|
|
127
|
+
export function attachmentsOf(activity) {
|
|
128
|
+
const attachments = [];
|
|
129
|
+
for (const entry of activity.attachments ?? []) {
|
|
130
|
+
const parsed = AttachmentSchema.safeParse(entry);
|
|
131
|
+
if (parsed.success)
|
|
132
|
+
attachments.push(parsed.data);
|
|
133
|
+
}
|
|
134
|
+
return attachments;
|
|
135
|
+
}
|
|
136
|
+
/** A file a user sent in a personal chat, with a download URL that needs no token. */
|
|
137
|
+
export const FILE_DOWNLOAD_INFO = 'application/vnd.microsoft.teams.file.download.info';
|
|
138
|
+
const DownloadInfoSchema = z.object({
|
|
139
|
+
downloadUrl: z.string(),
|
|
140
|
+
fileType: z.string().optional(),
|
|
141
|
+
});
|
|
142
|
+
/** The download URL and file type of a {@link FILE_DOWNLOAD_INFO} attachment. */
|
|
143
|
+
export function downloadInfoOf(attachment) {
|
|
144
|
+
if (attachment.contentType !== FILE_DOWNLOAD_INFO)
|
|
145
|
+
return undefined;
|
|
146
|
+
const parsed = DownloadInfoSchema.safeParse(attachment.content);
|
|
147
|
+
return parsed.success ? parsed.data : undefined;
|
|
148
|
+
}
|
|
149
|
+
const MIME_TYPES = {
|
|
150
|
+
png: 'image/png',
|
|
151
|
+
jpg: 'image/jpeg',
|
|
152
|
+
jpeg: 'image/jpeg',
|
|
153
|
+
gif: 'image/gif',
|
|
154
|
+
webp: 'image/webp',
|
|
155
|
+
pdf: 'application/pdf',
|
|
156
|
+
txt: 'text/plain',
|
|
157
|
+
md: 'text/markdown',
|
|
158
|
+
csv: 'text/csv',
|
|
159
|
+
json: 'application/json',
|
|
160
|
+
mp3: 'audio/mpeg',
|
|
161
|
+
m4a: 'audio/mp4',
|
|
162
|
+
wav: 'audio/wav',
|
|
163
|
+
ogg: 'audio/ogg',
|
|
164
|
+
mp4: 'video/mp4',
|
|
165
|
+
mov: 'video/quicktime',
|
|
166
|
+
webm: 'video/webm',
|
|
167
|
+
aac: 'audio/aac',
|
|
168
|
+
flac: 'audio/flac',
|
|
169
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
170
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
171
|
+
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
172
|
+
};
|
|
173
|
+
/** What kind of attachment a MIME type is, so images reach vision and audio speech to text. */
|
|
174
|
+
export function attachmentTypeOf(mimeType) {
|
|
175
|
+
if (mimeType.startsWith('image/'))
|
|
176
|
+
return 'image';
|
|
177
|
+
if (mimeType.startsWith('audio/'))
|
|
178
|
+
return 'audio';
|
|
179
|
+
if (mimeType.startsWith('video/'))
|
|
180
|
+
return 'video';
|
|
181
|
+
return 'file';
|
|
182
|
+
}
|
|
183
|
+
/** The MIME type of a file type (an extension, as Teams names it). */
|
|
184
|
+
export function mimeTypeOf(fileType) {
|
|
185
|
+
return MIME_TYPES[fileType?.toLowerCase() ?? ''] ?? 'application/octet-stream';
|
|
186
|
+
}
|
|
187
|
+
const FileConsentSchema = z.object({
|
|
188
|
+
type: z.literal('fileUpload').optional(),
|
|
189
|
+
action: z.enum(['accept', 'decline']),
|
|
190
|
+
context: z.object({ uploadId: z.string() }).optional(),
|
|
191
|
+
uploadInfo: z
|
|
192
|
+
.object({
|
|
193
|
+
name: z.string(),
|
|
194
|
+
uploadUrl: z.string(),
|
|
195
|
+
contentUrl: z.string(),
|
|
196
|
+
uniqueId: z.string(),
|
|
197
|
+
fileType: z.string().optional(),
|
|
198
|
+
})
|
|
199
|
+
.optional(),
|
|
200
|
+
});
|
|
201
|
+
/** Reads the value of a `fileConsent/invoke` activity. */
|
|
202
|
+
export function fileConsentOf(value) {
|
|
203
|
+
const parsed = FileConsentSchema.safeParse(value);
|
|
204
|
+
return parsed.success ? parsed.data : undefined;
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=activity.js.map
|