Skip to main content

chat-adapter-linear

Linear adapter for chat-py. Python port of upstream packages/adapter-linear.

Handles Linear comment webhooks and optional Agent Session threads; supports API-key, OAuth access-token, multi-tenant OAuth, and client-credentials auth.

Install

uv add chat-py chat-py-adapter-linear chat-py-adapter-state-redis

Auth / config

LinearAdapterConfig — discriminated union of four variants:

Mode Required fields Env var fallbacks
API key apiKey LINEAR_API_KEY
OAuth access token accessToken LINEAR_ACCESS_TOKEN
Multi-tenant OAuth clientId + clientSecret LINEAR_CLIENT_ID, LINEAR_CLIENT_SECRET
Client credentials clientCredentials (id + secret + scopes) —

All variants additionally accept: webhookSecret, mode ("comments" or "agent-sessions"), apiUrl, userName.

Minimal example

from chat import Chat
from chat_adapter_linear import create_linear_adapter
from chat_adapter_state_redis import create_redis_state

bot = Chat(
    user_name="mybot",
    adapters={"linear": create_linear_adapter(
        apiKey="lin_api_...",
        webhookSecret="...",
    )},
    state=create_redis_state(url="redis://localhost:6379"),
)


@bot.on_new_mention
async def triage(thread, message):
    await thread.post("Investigating.")

Mount bot.handle_webhook("linear", body, headers) under /api/webhooks/linear.

Thread ID

Linear thread IDs are linear:{organizationId}:{issueId[:commentId][/agentSession=<id>]}. Agent Session overlays nest under a comment thread — see LinearAgentSessionThreadId and assert_agent_session_thread.

Features

  • HMAC signature verify (verify_linear_signature)
  • GraphQL-layer error unwrapping (handle_linear_graphql_body returns the first typed error from a Linear GraphQL response body)
  • OAuth token refresh for OAuth / multi-tenant modes
  • Comment mode and Agent Session mode (LinearAdapterMode)
  • Linear-flavoured markdown ↔ mdast (LinearFormatConverter)
  • Card → Linear markdown (card_to_linear_markdown)

Parity notes

  • No native cards or streaming — Linear comments are markdown-only.
  • Agent Session support mirrors upstream's beta mode.

Test

uv run pytest packages/chat-adapter-linear

# Live
LINEAR_API_KEY=... uv run pytest packages/chat-integration-tests -k linear

Upstream

https://github.com/vercel/chat/tree/main/packages/adapter-linear

Metadata

Release files for chat-py-adapter-linear 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chat-py-adapter-linear 0.1.0
File Size Uploaded Provenance Actions
chat_py_adapter_linear-0.1.0.tar.gz 31.4 kB Without provenance Details for chat_py_adapter_linear-0.1.0.tar.gz

Release files / chat_py_adapter_linear-0.1.0.tar.gz

Download URL chat_py_adapter_linear-0.1.0.tar.gz
Size 31.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b5357360747857dcfe86c72634a2243c2a383a2132fecc98eac45928640a57f5
BLAKE2b-256 checksum
How to use checksums
cc413eb64fb42d5793b5c811bca57d72e8c3237eb88983088b3af9a1697cbb7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.20 {"installer":{"name":"uv","version":"0.9.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for chat-py-adapter-linear 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page