Commit Graph

449 Commits

Author SHA1 Message Date
github-actions[bot] 28cbcb2994 Version Packages (#192)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
chat@4.18.0 @chat-adapter/telegram@4.18.0 @chat-adapter/teams@4.18.0 @chat-adapter/state-redis@4.18.0 @chat-adapter/state-pg@4.18.0 @chat-adapter/state-memory@4.18.0 @chat-adapter/state-ioredis@4.18.0 @chat-adapter/slack@4.18.0 @chat-adapter/shared@4.18.0 @chat-adapter/linear@4.18.0 @chat-adapter/github@4.18.0 @chat-adapter/gchat@4.18.0 @chat-adapter/discord@4.18.0
2026-03-07 12:39:16 -08:00
Malte Ubl a3cfc1aee3 Support native tables in slack (#194)
* Support native tables in slack

Brand new per https://docs.slack.dev/reference/block-kit/blocks/table-block/
Only one per message.

* Record streams

* Error handling

* Debugging

* fix-delta

* fix-delta2

* fix-delta3

* fix-delta4

* fix-delta5

* show-table

* show-table2

* replay-test

* changeset

* lint-types
2026-03-07 12:31:18 -08:00
Hayden Bleasel ebbe108b76 Fix code scanning issues 2026-03-06 17:15:03 -08:00
bai 8fe175f7fe Implement state adapter based on Postgres (#154)
* Initial work on postgres state store

* Run fix

* Replace pre-written CHANGELOG with proper changeset

The CHANGELOG was manually written with a version entry. This repo uses
Changesets to manage versioning, so add a proper changeset file instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add missing @vitest/coverage-v8 dev dependency

The vitest config specifies coverage provider "v8" but the package
was missing from devDependencies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Drop drizzle-orm, use raw postgres queries

The adapter only needs 3 simple tables with basic CRUD. drizzle-orm is
a full ORM that adds significant dependency weight for no real benefit
here. The ensureSchema() method was already using raw queries. This
halves the dependency surface to just the postgres driver.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add comprehensive unit tests for postgres state adapter

Test factory function edge cases (missing URL, env var fallbacks,
custom keyPrefix) and ensureConnected guard for all state operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Document expired row cleanup limitation for postgres adapter

Unlike Redis, Postgres doesn't auto-delete expired rows. Document the
opportunistic cleanup behavior and provide SQL for periodic cleanup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove stale drizzle keyword from package.json

drizzle-orm was removed in a prior commit but the keyword remained.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix expiresAt parsing in acquireLock

The postgres library returns timestamptz columns as JavaScript Date
objects, not strings. Wrapping in new Date() was unnecessary overhead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Document lock atomicity difference vs Redis adapters

The Postgres ON CONFLICT approach relies on row-level locking rather
than a single atomic SET NX PX like Redis. Note this for users who
need high-contention distributed locking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Use crypto.randomUUID() for lock token generation

Math.random() is not cryptographically secure and has a higher
collision risk in distributed environments. crypto.randomUUID() is
available in Node 16+ and provides better uniqueness guarantees.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Delete CHANGELOG.md

* Add comprehensive unit tests for postgres state adapter

Mock the postgres module and SQL client to achieve 100% coverage
across statements, branches, functions, and lines. Tests cover
factory function, connection lifecycle, subscriptions, locking,
cache operations, and the owned-client disconnect path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add setIfNotExists method and merge with main

Implement the setIfNotExists method added to the StateAdapter
interface since this branch diverged. Uses INSERT ... ON CONFLICT
DO NOTHING with RETURNING to atomically check-and-set.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add postgres to state docs navigation and memory adapter callout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Migrate postgres state adapter from postgres to pg (node-postgres)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Rename state-postgres to state-pg and align version to 4.17.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Hayden Bleasel <hello@haydenbleasel.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 17:05:32 -08:00
github-actions[bot] 3f881daf07 Version Packages (#186)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
chat@4.17.0 @chat-adapter/telegram@4.17.0 @chat-adapter/teams@4.17.0 @chat-adapter/state-redis@4.17.0 @chat-adapter/state-memory@4.17.0 @chat-adapter/state-ioredis@4.17.0 @chat-adapter/slack@4.17.0 @chat-adapter/shared@4.17.0 @chat-adapter/linear@4.17.0 @chat-adapter/github@4.17.0 @chat-adapter/gchat@4.17.0 @chat-adapter/discord@4.17.0
2026-03-06 00:01:23 -08:00
Hayden Bleasel c744bdc2ef Update teams.mdx 2026-03-05 17:08:16 -08:00
Hayden Bleasel b35bb34dd5 feat: make adapter constructors default to env vars (#182)
* Update adapter configs

* Update tests

* Add new adapter config tests

* Update index.mdx

* Update index.test.ts

* Fix polynomial regex issue

* Update index.ts

* Remove unused suppressions

* Misc fixes

* Update index.test.ts

* Update index.test.ts

* Update index.ts

* Update index.mdx

* Test and lint fixes
2026-03-05 16:29:44 -08:00
Hayden Bleasel cc65dc3111 fix: atomic message deduplication to prevent silent app_mention drops (#189)
* Add setIfNotExists

* Update chat.test.ts

* Improve tests

* Create bright-regions-dance.md
2026-03-05 16:16:03 -08:00
Hayden Bleasel d3db36ec35 fix(slack): check text value truthiness for file-only posts (#187)
* Update index.ts

* Update index.test.ts

* Create odd-news-jam.md
2026-03-05 16:15:51 -08:00
Hayden Bleasel 10b0e6b6ec fix(slack): allow file_share and other content subtypes through (#188)
* Update index.ts

* Update index.test.ts

* Create fluffy-onions-unite.md
2026-03-05 16:15:44 -08:00
Hayden Bleasel a3f8656243 Teams: support certificate and federated credentials (#190)
* Add federated auth support to Teams

* Update index.test.ts

* Create teams-certificate-federated-auth.md
2026-03-05 16:15:36 -08:00
Hayden Bleasel 5cfd9be5fa Fix JSX issues (#161)
* Fix JSX issues

* fix: add null guards for event.thread in onAction handlers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-05 16:13:33 -08:00
Hayden Bleasel e09ce7ea4a Switch to using chatApi.media.download (#168) 2026-03-05 16:13:26 -08:00
Dardan Bujupaj 5f32506c2d fix discord thread starter root message parsing (#185)
* fix discord thread starter root message parsing

* use original thread start message as raw
2026-03-05 13:27:49 -08:00
github-actions[bot] e937e0d3dd Version Packages (#181)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
chat@4.16.1 @chat-adapter/telegram@4.16.1 @chat-adapter/teams@4.16.1 @chat-adapter/state-redis@4.16.1 @chat-adapter/state-memory@4.16.1 @chat-adapter/state-ioredis@4.16.1 @chat-adapter/slack@4.16.1 @chat-adapter/shared@4.16.1 @chat-adapter/linear@4.16.1 @chat-adapter/github@4.16.1 @chat-adapter/gchat@4.16.1 @chat-adapter/discord@4.16.1
2026-03-04 15:27:16 -08:00
Hayden Bleasel fcaee5c671 Update docs 2026-03-04 11:33:41 -08:00
zm2231 f27c89b424 feat(slack): streaming StreamChunk support + url_verification fix (#173)
* feat(slack): support streaming task_update, plan_update, markdown_text chunks

- Add StreamChunk type for structured streaming content
- Extend stream() to accept AsyncIterable<string | StreamChunk>
- Add taskDisplayMode option to StreamOptions
- Slack adapter passes structured chunks directly to Slack's streaming API
- Handle url_verification before signature check to prevent Slack from
  silently disabling event delivery when signing secret is misconfigured
- Add tests for StreamChunk handling in thread.post()

* review fixes: type safety, security, dedup

- Replace loose StreamChunk interface (index signature) with
  discriminated union (MarkdownTextChunk | TaskUpdateChunk | PlanUpdateChunk)
- Move url_verification back after signature check to prevent
  unauthenticated challenge responses
- Remove redundant AsyncIterable<string> from PostableMessage union
- Extract pushTextAndFlush helper to deduplicate markdown flush logic
- Remove unnecessary `as string` casts after type guards
- Export individual chunk types from package index

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* add changeset

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Hayden Bleasel <hello@haydenbleasel.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-04 11:31:30 -08:00
Hayden Bleasel 460eecc6db Update ci.yml 2026-03-04 11:15:51 -08:00
John Pham 130e780418 fix openModal crash when action has no thread context (#174)
* fix openModal crash when action has no thread context

Home tab actions (e.g. Change Team) have no thread → openModal closure
crashed accessing thread.channel on null. Guard thread access in the
openModal closure and pass undefined to storeModalContext.

Add test for empty threadId action → openModal works with null thread.

* add changeset

* make ActionEvent.thread nullable, remove unsafe cast

- Change `ActionEvent.thread` type from `Thread` to `Thread | null`
- Remove `null as unknown as Thread` unsafe cast in handleActionEvent
- Update test files to use null guards and optional chaining

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Hayden Bleasel <hello@haydenbleasel.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-04 11:15:33 -08:00
Utopia f0dfa4d64d fix: preserve nesting depth when rendering lists in all chat adapters (#177)
* fix: preserve nesting depth when rendering lists in all chat adapters

All format converters (Slack, Discord, Teams, Google Chat) were flattening
nested lists during Markdown→platform conversion. When a listItem had a
paragraph followed by a child list, the child list output was concatenated
directly onto the parent item's text with no indentation or separating
newline, producing garbled output like "• parent• child 1\n• child 2".

Add an optional `depth` parameter to each adapter's private `nodeToX()`
method. The `isListNode` handler now builds lines explicitly: paragraph
content is prefixed with the bullet/number at the correct indent level
(`"  ".repeat(depth)`), and nested list nodes are rendered recursively
at `depth + 1`. Sibling items at the same depth are unaffected.

Add regression tests covering:
- nested unordered lists (2 levels)
- nested ordered lists (2 levels)
- deeply nested lists (3 levels)
- flat sibling items (no regressions)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: extract renderList() helper to eliminate dead depth parameter

The previous fix added `depth = 0` to each adapter's general nodeToX()
method, but only the isListNode branch ever used it — a dead parameter
across ~10 other branches that made the signature misleading.

Extract a private renderList(node: List, depth: number) method in each
adapter. nodeToX() stays as a clean single-argument node converter;
all depth-aware list logic lives exclusively inside renderList(), which
recurses into itself for nested lists and calls nodeToX() for leaf nodes.

Import the List type from the chat package to give renderList() an
explicit, narrowed parameter type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Deduplicate renderList into BaseFormatConverter, fix start offset, add mixed list tests

- Extract shared renderList() into BaseFormatConverter with configurable bullet char
- Respect List.start property for ordered lists starting at non-1 values
- Remove dead isListItemNode branches from all adapters
- Add mixed ordered/unordered nesting test to all adapters

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Hayden Bleasel <hello@haydenbleasel.com>
2026-03-04 11:06:32 -08:00
Malte Ubl ff954f938b Correctly handle AI SDK stream concatenation (#170)
* Correctly handle AI SDK stream concatenation

* changset

* docs

---------

Co-authored-by: Hayden Bleasel <hello@haydenbleasel.com>
2026-03-04 11:02:02 -08:00
Rich Haines 6b2a165e32 Make sitemap.md static via generateStaticParams (#176) 2026-03-04 10:56:38 -08:00
Hayden Bleasel 7bcf9d1578 Docs for f0c7050349 2026-03-04 10:52:06 -08:00
github-actions[bot] 0ab742c62d Version Packages (#133)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@chat-adapter/teams@4.16.0 chat@4.16.0 @chat-adapter/telegram@4.16.0 @chat-adapter/state-redis@4.16.0 @chat-adapter/state-memory@4.16.0 @chat-adapter/state-ioredis@4.16.0 @chat-adapter/slack@4.16.0 @chat-adapter/shared@4.16.0 @chat-adapter/linear@4.16.0 @chat-adapter/github@4.16.0 @chat-adapter/gchat@4.16.0 @chat-adapter/discord@4.16.0
2026-03-04 00:32:57 -08:00
Nicolás Montone f0c7050349 add member_joined_channel event support to Slack adapter (#167)
* Add member_joined_channel event support to Slack adapter

* changset

* Apply suggestion from @NicolasMontone

* fix
2026-03-03 16:24:40 -08:00
Hayden Bleasel bbe4de55bf Add docs for 73de82dbef 2026-03-03 12:57:17 -08:00
Hayden Bleasel deda3e59d4 Add docs for 02e7ef605c 2026-03-03 12:55:25 -08:00
Hayden Bleasel dc72b893ae Improve usage docs 2026-03-03 12:52:30 -08:00
Malte Ubl 02e7ef605c Implement markdown and AST rendering for tables across adapters (#160)
* Implement markdown and AST rendering for tables across adapters

* Render the default instead

* Fix bot app

* lint

* streaming-rendering

* fix-streaming

* fix-streaming-agent

* fix-streaming-again2

* fix-streaming-again3

* prefix tests

* no final edit

* changeset

* feedback

* lint

* Copilot feedback
2026-03-03 09:43:18 -08:00
Hayden Bleasel 73de82dbef Add remend for streaming markdown healing (#163)
* Add remend

* Create sixty-wasps-hope.md

* feat: wrap message content in markdown objects (#164)

Update 'fallbackStream' and 'handleStream' to send '{ markdown: string }'. Adjust tests for '{ markdown: string }'.

Slack-Thread: https://vercel.slack.com/archives/C08077A6JDB/p1772491650055389?thread_ts=1772491650.055389&cid=C08077A6JDB

Co-authored-by: v0 <v0[bot]@users.noreply.github.com>

---------

Co-authored-by: v0 <v0[bot]@users.noreply.github.com>
2026-03-03 07:59:58 -08:00
Hayden Bleasel 6e4b2e7a09 Fix teams adapter tests 2026-03-02 15:24:34 -08:00
Hayden Bleasel 394336fffe Update index.test.ts 2026-03-02 14:48:12 -08:00
Hayden Bleasel 8a6f0ce8fa Improve test coverage 2026-03-02 14:42:32 -08:00
Hayden Bleasel d93d5470f6 Add unit tests for newline streaming issue 2026-03-02 14:17:34 -08:00
Timo Lins 24532a715c [Telegram] Enable Telegram auto/polling mode for local bots without public webhooks (#141)
* Add Telegram auto mode polling and init username fallback

* Expose Telegram resetWebhook API

* Refine Telegram API to longPolling and safer auto mode

* Fix: Environment variable cleanup sets `process.env.VERCEL` to the string `"undefined"` (truthy) instead of removing it, leaking a truthy VERCEL env var into subsequent tests.

This commit fixes the issue reported at packages/adapter-telegram/src/index.test.ts:661

**Bug explanation:**

In the test "auto mode stays in webhook mode on serverless runtime" (line 622), the cleanup code in the `finally` block at line 662 uses `process.env.VERCEL = undefined` when the env var wasn't previously set. In Node.js, `process.env` coerces all values to strings, so `process.env.VERCEL = undefined` actually sets `process.env.VERCEL` to the string `"undefined"`. This is truthy (`Boolean("undefined")` === `true`).

This was verified empirically:
```
process.env.TEST_VAR = undefined;
typeof process.env.TEST_VAR  // "string"
process.env.TEST_VAR         // "undefined"  
Boolean(process.env.TEST_VAR) // true
```

The consequence is that after this test runs, `process.env.VERCEL` remains set to the truthy string `"undefined"`, causing `isLikelyServerlessRuntime()` to return `true` for all subsequent tests that run in the same process. This could cause any auto-mode tests that follow to incorrectly detect a serverless runtime and behave differently than expected.

**Fix explanation:**

Changed `process.env.VERCEL = undefined` to `delete process.env.VERCEL`, which properly removes the environment variable from `process.env`. After `delete`, `process.env.VERCEL` is `undefined` (the actual undefined value, not the string), and `Boolean(process.env.VERCEL)` correctly returns `false`. This matches the standard pattern for cleaning up environment variables in Node.js tests.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: timolins <me@timo.sh>

* Fix lint: replace delete env cleanup with Reflect.deleteProperty

* Harden Telegram polling tests and polish polling docs

* Improve Telegram polling docs with clearer motivation and examples

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 23:08:00 +01:00
Hayden Bleasel da7e05d521 Fix Discord reaction events missing thread context (#158)
* Initial fix

* Add tests

* Create cute-nights-send.md

* Misc improvements
2026-03-02 13:44:00 -08:00
Hayden Bleasel 2bd16286a4 Update package.json 2026-03-02 13:24:06 -08:00
Peter Clement f01b92fec4 Ensure handling of Discord slash commands (#152)
* Correctly handle discord slash commands

* chore: remove unintended bot.tsx formatting churn

* tidy up

* Expand subcommand path into event.command

* Fix race condition

* Run fix

* Fix duplicate slash-context check

* Fix integration test mock

* Run fix

* Update docs

---------

Co-authored-by: Hayden Bleasel <hello@haydenbleasel.com>
2026-03-02 13:21:25 -08:00
Hayden Bleasel f6d56ea903 Fix Discord thread channel ID for reactions and delete (#135)
* Update index.ts

* Create sour-sheep-fry.md
2026-03-02 13:13:42 -08:00
Hayden Bleasel b38fda49fa Fix formatting 2026-03-02 13:10:22 -08:00
handlebauer 9522b04243 feat(chat, adapter-gchat, adapter-discord): add disabled prop to Button (#150)
* feat(chat, adapter-gchat): add disabled prop to Button

Google Chat Cards v2 natively supports `disabled` on buttons, but
`ButtonOptions` / `ButtonElement` didn't expose it. Add the prop to
the core type and thread it through the gchat adapter serializer.

Closes #149

Made-with: Cursor

* feat(adapter-discord): thread disabled prop through Discord button serializer

DiscordButton already had `disabled` in its type but convertButtonElement
never set it from ButtonElement. Wire it through so disabled buttons
render correctly on Discord too.

Made-with: Cursor
2026-03-02 12:39:16 -08:00
Rich Haines dadf46f603 Add sitemap.md route for LLM-friendly documentation indexing (#155) 2026-03-02 12:21:11 -08:00
Hayden Bleasel b9266cee5b Add logos to og:image 2026-03-01 11:11:52 -08:00
Hayden Bleasel 2b941db687 Create logos.tsx 2026-03-01 11:05:22 -08:00
Hayden Bleasel aba4643bd3 Improve formatting file specificity 2026-03-01 11:04:06 -08:00
Hayden Bleasel 572ce34d2e Update index.test.ts 2026-03-01 10:52:07 -08:00
Hayden Bleasel a563031ea0 Update knip.json 2026-03-01 10:45:02 -08:00
Hayden Bleasel 6e11a94c1f Port manual main deploy script 2026-03-01 10:40:14 -08:00
Malte Ubl bc510b8ab7 Clarify how to get designated as a vendor-official adapter 2026-03-01 10:15:57 -08:00
dependabot[bot] 3574a5b47e Bump next from 16.0.10 to 16.1.5 (#146)
Bumps [next](https://github.com/vercel/next.js) from 16.0.10 to 16.1.5.
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/compare/v16.0.10...v16.1.5)

---
updated-dependencies:
- dependency-name: next
  dependency-version: 16.1.5
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-28 20:28:30 -08:00