Skip to content

Commit 0d93d95

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/gchat-endpoint-url-audience
2 parents b669bc6 + 93a58af commit 0d93d95

648 files changed

Lines changed: 64340 additions & 15615 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
name: add-adapter
3+
description: Add a vendor-official or community adapter to the Chat SDK catalog and docs — adapters.json registry, chat/adapters catalog entry, the docs MDX page, meta.json, integration-test lists, and a changeset. Use when a developer wants to add, list, register, or submit a third-party (vendor-official or community) adapter to this repo, add an adapter to the catalog, or create or edit an adapter docs page under apps/docs/content/adapters/vendor-official or apps/docs/content/adapters/community.
4+
---
5+
6+
# Add a catalog adapter (vendor-official or community)
7+
8+
Use this to list a **third-party** adapter in the Chat SDK catalog and docs. It is not for building a first-party `packages/adapter-*` package.
9+
10+
## Gather the source — never invent details
11+
12+
Ask the user for:
13+
14+
1. Their adapter's **GitHub repository URL**.
15+
2. Their **docs or README**.
16+
17+
Read both. Everything you write into the catalog and docs must come **directly** from those sources or from the user. Do not assume or guess any information:
18+
19+
- **`packageName`** — read it from the repo's `package.json`, verbatim.
20+
- **Factory export** (e.g. `createFooAdapter`) — read it from the package's exports/source. Do not guess it from the display name.
21+
- **`type`** (`platform` or `state`), **env vars**, and the **feature matrix** — base these on what the code and README actually document.
22+
- **Install and usage snippets** — take them from the README; do not write example code the adapter may not support.
23+
24+
If the repo or README does not make something clear, **stop and ask the user** rather than filling it in. When in doubt, ask.
25+
26+
Choose the `slug` (kebab-case) and confirm it is not already taken: `ls apps/docs/content/adapters/*/`.
27+
28+
## Pick the tier
29+
30+
- **community** — listed in the docs only. No `chat/adapters` catalog entry, no changeset.
31+
- **vendor-official** — a maintained/blessed adapter. Everything community has, plus a `chat/adapters` catalog entry, a matching `create-chat-sdk` scaffold-spec entry, and a changeset. Frontmatter adds `vendorOfficial: true` and `author`.
32+
33+
## Files to change
34+
35+
`<tier>` is `vendor-official` or `community`.
36+
37+
1. **`apps/docs/content/adapters/<tier>/<slug>.mdx`** — the docs page. Start from [assets/adapter.mdx](assets/adapter.mdx). The filename basename must equal the `slug` frontmatter field, and the page must render `<FeatureSupport />`.
38+
2. **`apps/docs/content/adapters/<tier>/meta.json`** — add `"<slug>"` to the `pages` array.
39+
3. **`apps/docs/adapters.json`** — add a registry entry: `name`, `slug`, `type`, `community: true`, `description`, `packageName`, `author`, `readme` (the GitHub URL). Add `vendorOfficial: true` for vendor-official.
40+
4. **`packages/integration-tests/src/docs-adapters.test.ts`** — add `"<slug>"` to the hardcoded expected list for its tier.
41+
5. **`packages/integration-tests/src/documentation-test-utils.ts`** — add the `packageName` to `VALID_DOC_PACKAGES`, plus every import specifier used in the MDX code blocks (subpaths count separately).
42+
43+
**Vendor-official also:**
44+
45+
6. **`packages/chat/src/adapters/index.ts`** — add an `ADAPTERS` entry with `group: "vendor-official"`. Reuse the `env`/`secretEnv`/`urlEnv` helpers; use `env: { notes: "…" }` when there are no env vars. See `packages/chat/src/adapters/AGENTS.md`.
46+
7. **`packages/create-chat-sdk/src/catalog/scaffold-spec.ts`** — add a matching `"<slug>": { invocation: … }` entry, modeled on a similar adapter. This is a required registration step, not a behavior change: the object is `satisfies Record<AdapterSlug, …>`, so every catalog slug must have one or `create-chat-sdk` fails to type-check.
47+
8. **`.changeset/<slug>-adapter.md`**`"chat": patch` + `"create-chat-sdk": patch`, one line describing the addition.
48+
49+
## Invariants the tests enforce
50+
51+
- **Registry ↔ catalog parity.** `Object.keys(ADAPTERS)` must equal the adapters.json slugs where `!community || vendorOfficial`. So vendor-official **must** be in `chat/adapters`; community-only **must not** be. This is why community adapters skip steps 6–8.
52+
- **peerDeps ↔ PackageInstall.** The catalog entry's `peerDeps` (sorted) must exactly equal the extra packages in the MDX `<PackageInstall package="…" />`, after removing the adapter's own `packageName`, `chat`, and any `@chat-adapter/state-*`. Easiest: `peerDeps: []`, install only `<packageName> chat` (plus a state adapter) in `PackageInstall`, and keep any other imports in fenced code blocks.
53+
- **Fields match.** `packageName`, `type`, `community`, and `vendorOfficial` must match between the MDX frontmatter and the adapters.json entry.
54+
- **Required frontmatter:** `title`, `description`, `packageName`, `slug`, `tagline`, `type` (`platform` | `state`), `mdxBody: true`, `community: true` (plus `vendorOfficial: true` and `author` for vendor-official).
55+
- **Imports.** Every import in an MDX code block must be listed in `VALID_DOC_PACKAGES`.
56+
57+
## Validate
58+
59+
```bash
60+
pnpm --filter chat build # regenerate the catalog the tests import
61+
pnpm --filter @chat-adapter/integration-tests test
62+
pnpm --filter chat typecheck
63+
pnpm --filter create-chat-sdk typecheck # vendor-official only
64+
pnpm check && pnpm konsistent
65+
```
66+
67+
## Resources
68+
69+
- MDX template: [assets/adapter.mdx](assets/adapter.mdx)
70+
- Catalog conventions: `packages/chat/src/adapters/AGENTS.md`
71+
- Examples to copy: `apps/docs/content/adapters/vendor-official/` and `apps/docs/content/adapters/community/`
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
title: Foo
3+
description: One-to-two sentence summary of what the Foo adapter connects to and its headline capabilities. Shown in search and listings.
4+
packageName: "@foo/chat-sdk-adapter"
5+
slug: foo
6+
type: platform
7+
tagline: One-line pitch shown on the adapter card — what it does and for whom.
8+
community: true
9+
# vendor-official only — delete both lines for a community adapter:
10+
vendorOfficial: true
11+
author: Foo
12+
mdxBody: true
13+
# Feature matrix. Use `yes` / `no`, or `{ status: partial|yes, label: "…" }`.
14+
# PLATFORM adapters use these keys:
15+
features:
16+
postMessage: yes
17+
editMessage: no
18+
deleteMessage: no
19+
fileUploads: no
20+
streaming: no
21+
scheduledMessages: no
22+
cardFormat: no
23+
buttons: no
24+
linkButtons: no
25+
selectMenus: no
26+
tables: no
27+
fields: no
28+
imagesInCards: no
29+
modals: no
30+
slashCommands: no
31+
mentions: no
32+
addReactions: no
33+
removeReactions: no
34+
typingIndicator: no
35+
directMessages: yes
36+
ephemeralMessages: no
37+
userLookup: no
38+
customApiEndpoint: no
39+
fetchMessages: no
40+
fetchSingleMessage: no
41+
fetchThreadInfo: no
42+
fetchChannelMessages: no
43+
listThreads: no
44+
fetchChannelInfo: no
45+
postChannelMessage: no
46+
# STATE adapters (type: state) use these keys instead of the platform set above:
47+
# persistence, multiInstance, subscriptions, distributedLocking, keyValueCache,
48+
# lists, queues, automaticReconnect, cluster, sentinel, keyPrefix
49+
---
50+
51+
## Install
52+
53+
{/* Only the adapter package + chat (+ optional state adapter). Extra imports
54+
used below go in code blocks, NOT here — see the peerDeps invariant. */}
55+
<PackageInstall package="@foo/chat-sdk-adapter chat @chat-adapter/state-memory" />
56+
57+
## Quick start
58+
59+
```typescript title="lib/bot.ts" lineNumbers
60+
import { Chat } from "chat";
61+
import { createMemoryState } from "@chat-adapter/state-memory";
62+
import { createFooAdapter } from "@foo/chat-sdk-adapter";
63+
64+
export const bot = new Chat({
65+
userName: "mybot",
66+
state: createMemoryState(),
67+
adapters: {
68+
foo: createFooAdapter({
69+
apiKey: process.env.FOO_API_KEY,
70+
webhookSecret: process.env.FOO_WEBHOOK_SECRET,
71+
}),
72+
},
73+
});
74+
75+
bot.onDirectMessage(async (thread, message) => {
76+
await thread.post(`You said: ${message.text}`);
77+
});
78+
```
79+
80+
## Configuration
81+
82+
<TypeTable
83+
type={{
84+
apiKey: { type: "string", description: "Foo API key. Falls back to `FOO_API_KEY`." },
85+
webhookSecret: { type: "string", description: "Signing secret for inbound webhook verification. Falls back to `FOO_WEBHOOK_SECRET`." },
86+
}}
87+
/>
88+
89+
## Webhooks
90+
91+
```typescript title="app/api/webhooks/foo/route.ts" lineNumbers
92+
import { bot } from "@/lib/bot";
93+
94+
export async function POST(request: Request): Promise<Response> {
95+
return bot.webhooks.foo(request);
96+
}
97+
```
98+
99+
{/* Add the sections that apply: sending, reactions, attachments, thread IDs,
100+
limitations, links. Keep it faithful to the adapter's real behavior. */}
101+
102+
## Feature support
103+
104+
<FeatureSupport />

.changeset/add-tests-package.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

.changeset/calm-users-email.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@chat-adapter/teams": patch
3+
---
4+
5+
Fall back to Microsoft Graph's user principal name when a Teams user has no mail address.

.changeset/chat-ai-tools.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

.changeset/config.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
"access": "public",
88
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
10-
"ignore": [
11-
"example-nextjs-chat",
12-
"example-telegram-chat",
13-
"@chat-adapter/integration-tests"
14-
]
10+
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
11+
"onlyUpdatePeerDependentsWhenOutOfRange": true
12+
},
13+
"ignore": ["example-*", "@chat-adapter/integration-tests"]
1514
}

.changeset/fresh-masks-punch.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

.changeset/konsistent-conventions.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

.changeset/light-sails-beg.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/rare-donuts-count.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)