Commit Graph

1003 Commits

Author SHA1 Message Date
Alberto Schiabel dafe1389b1 chore(release): prepare Python 0.22.0 and TypeScript releases (#4563)
This PR:

- bumps Python `composio` and all 13 provider packages to `0.22.0`
- regenerates `uv.lock` and adds the coordinated Python and TypeScript
release changelog
- records the manually published `@composio/typesafe@0.1.0` as the
repository baseline
- replaces the original TypeSafe minor changeset with a patch release
for `0.1.1`, so post-publication runtime fixes ship instead of being
skipped
- keeps the existing Changesets train for `@composio/core@0.19.0`,
`@composio/slim@0.19.0`, and provider updates
- verifies the release workflow, changesets, all 20 TypeScript package
builds, 147 TypeSafe tests, 590 docs static tests, and all 28 Python
distributions with Twine
2026-09-21 23:02:55 +04:00
Palash Kala [zen] f372697eb3 docs: add changelog for auth configs fetch limit raised to 200
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-09-21 16:54:26 +00:00
Alberto Schiabel 9b3d487d0b docs: note how MCP-backed toolkits get their behavior tags (#4553)
This PR:

- reopens https://github.com/ComposioHQ/composio/pull/4473 (D4) directly
against `next`; the original was merged into the D2 branch by mistake,
and https://github.com/ComposioHQ/composio/pull/4471 has been trimmed
back to D2 only
- cherry-picks the original D4 commit unchanged onto `next` (1eb0330e0)
- adds one paragraph to the Configuring Sessions tags section: managed
and custom MCP toolkits carry the same four tags; `readOnlyHint` comes
from the server, everything else is classified into `createHint`,
`updateHint` or `destructiveHint` at sync; an unsynced toolkit may carry
only the server's annotations, and an enable filter hides tools without
a matching tag
- merge after: ComposioHQ/mercury#27190 (classify at sync) and
ComposioHQ/platform#12845 (sync diff hash). Kept as a draft until both
ship

PRD:
https://app.notion.com/p/composio/Session-Governance-via-hints-Across-toolkits-3daf261a6dfe80df8e0ce337a2b26e08
Linear workstream:
https://linear.app/composio/project/sessions-execution-governance-a0942233a0d0

Verification, run in `docs/` on this branch: `bun run types:check`
passes, `bun run lint:links` reports 0 errors. `pnpm exec prettier
--check` flags the touched mdx files on `next` already, so no
reformatting was applied.

Co-authored-by: Palash Kala <palash@composio.dev>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 19:22:47 +04:00
Alberto Schiabel 96bfd2cc5e docs: proxy execute follows the session's toolkit lists (#4552)
This PR:

- reopens https://github.com/ComposioHQ/composio/pull/4472 (D3) directly
against `next`; the original was merged into the D2 branch by mistake,
and https://github.com/ComposioHQ/composio/pull/4471 has been trimmed
back to D2 only
- cherry-picks the original D3 commit unchanged onto `next` (ba59d21c9)
- adds a "Session restrictions" section to the Proxy execute page:
toolkit enable and disable lists apply to proxy calls, including from
the sandbox; hint filters and per-toolkit tool rules do not; example
that turns proxy execution off with `sandbox={"enable_proxy_execution":
False}` / `sandbox: { enable: true, enableProxyExecution: false }`
- adds one sentence in the Configuring Sessions sandbox section pointing
to that section
- merge after: ComposioHQ/platform#12847 (enforce toolkit lists on the
session proxy execute route). Kept as a draft until that ships so it
cannot be merged out of order again

PRD:
https://app.notion.com/p/composio/Session-Governance-via-hints-Across-toolkits-3daf261a6dfe80df8e0ce337a2b26e08
Linear workstream:
https://linear.app/composio/project/sessions-execution-governance-a0942233a0d0

Verification, run in `docs/` on this branch: `bun run types:check`
passes, `bun run lint:links` reports 0 errors. `pnpm exec prettier
--check` flags the touched mdx files on `next` already, so no
reformatting was applied.

---------

Co-authored-by: Palash Kala <palash@composio.dev>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Brendan O'Leary <brendan@olearycrew.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-09-21 19:21:36 +04:00
Alberto Schiabel 54f65c5637 docs: session proxy execute requires the Proxy execute permission (#4554)
This PR:

- replaces https://github.com/ComposioHQ/composio/pull/4474 (D5), which
was merged into the D2 branch by mistake and conflicted with the
rewritten permissions reference on `next`;
https://github.com/ComposioHQ/composio/pull/4471 has been trimmed back
to D2 only
- rewrites the change against the current "Session tool execution" /
"Proxy execute (Legacy)" layout instead of the pre-rewrite page the
original targeted
- Session tool execution: drops the
`/tool_router/session/{session_id}/proxy_execute` row and says proxy
execution is not included; Proxy execute (Legacy): states it is the only
permission that grants the session proxy route, from
`session.proxyExecute()` or from the session's sandbox
- Proxy execute page callout: requires Proxy execute; Session tool
execution alone does not cover it
- KB article `platform-project-api-key-permissions` (source under
`docs/kb/articles`, generated guide regenerated with `bun run
generate:kb`): same correction
- merge after: ComposioHQ/platform#12846. Until it deploys, `next` is
correct and this page must not go live. Kept as a draft for that reason

PRD:
https://app.notion.com/p/composio/Session-Governance-via-hints-Across-toolkits-3daf261a6dfe80df8e0ce337a2b26e08
Linear workstream:
https://linear.app/composio/project/sessions-execution-governance-a0942233a0d0

Verification, run in `docs/` on this branch: `bun run types:check`
passes, `bun run lint:links` reports 0 errors. `pnpm exec prettier
--check` flags the touched mdx files on `next` already, so no
reformatting was applied.
2026-09-21 18:05:37 +04:00
sdkrelease[bot] 64f7efe69d docs: update TypeScript SDK reference from source (#4534)
## Summary
Auto-generated TypeScript SDK reference docs from
`ts/packages/core/src/`.

Regenerates pages at `docs/content/reference/sdk-reference/typescript/`
to reflect changes in the core package's public API (new methods,
updated signatures, changed types).

Co-authored-by: jkomyno <12381818+jkomyno@users.noreply.github.com>
2026-09-21 15:37:20 +04:00
palash-c af4cae6e7c docs: list POST /toolkits/multi as a read route for scoped API keys (#4539)
## Summary

Updates the Scoped Project API Key reference page to match the backend
fix in ComposioHQ/platform#13062
([PLEN-3940](https://linear.app/composio/issue/PLEN-3940/scoped-api-keys-post-toolkitsmulti-is-cataloged-as-write-so-read-only)).

`POST /toolkits/multi` only fetches toolkits, but it was cataloged as
the single write route of the Toolkits permission area, so a read-only
key got a 403 on it. The backend now treats it as a read, which leaves
Toolkits with no write routes.

- `/toolkits/multi` row: Write -> Read
- Toolkits available levels: "No access, Read only" (was all four
levels)
- Toolkits description: "View toolkits." (was "View and install
toolkits.")

## Merge order

Merge after ComposioHQ/platform#13062 is deployed, so the page does not
describe behavior that is not live yet.

Not in this PR: a changelog entry. It needs the backend deploy date.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 15:23:26 +04:00
sdkrelease[bot] 00d252dd49 docs: update Python SDK reference from source (#4500)
## Summary
Auto-generated Python SDK reference docs from `python/composio/`.

Regenerates pages at `docs/content/reference/sdk-reference/python/` to
reflect changes in the Python package's public API (new methods, updated
signatures, changed types).

Co-authored-by: jkomyno <12381818+jkomyno@users.noreply.github.com>
2026-09-18 18:29:59 +02:00
Brendan O'Leary 756ea915f7 docs: update TypeScript SDK reference from source (#4486)
## Summary
Auto-generated TypeScript SDK reference docs from
`ts/packages/core/src/`.

Regenerates pages at `docs/content/reference/sdk-reference/typescript/`
to reflect changes in the core package's public API (new methods,
updated signatures, changed types).
2026-09-18 10:21:52 -04:00
Brendan O'Leary a648ceff3f fix(docs): preserve generated parameter metadata 2026-09-17 12:01:49 -04:00
Brendan O'Leary 705888faff docs: describe the four verdict hints sessions filter on (#4470)
## Why
Requirement 1 of the PRD: sessions accept all four verdict hints. The
Configuring Sessions tag table listed the four MCP-spec hints, two of
which (idempotentHint, openWorldHint) are set on a minority of tools.
Every tool carries at least one of readOnlyHint, createHint, updateHint,
destructiveHint.

## What
- Tag table leads with the four verdict hints and says every tool
carries at least one; idempotentHint and openWorldHint noted as accepted
with partial coverage.
- Callout: the v3 tools endpoints default to the pinned version
00000000_00, sessions read latest.
- Python example uses createHint. The TypeScript twoslash example stays
on readOnlyHint so docs CI passes against the published SDK; switch it
to createHint when merging, after #4467 is released.
- Python and TypeScript SDK reference docs list the widened enum.

## Merge after
API: platform#12843 (accept createHint and updateHint). SDK:
composio#4467 released.

PRD:
https://app.notion.com/p/composio/Session-Governance-via-hints-Across-toolkits-3daf261a6dfe80df8e0ce337a2b26e08
Linear workstream:
https://linear.app/composio/project/sessions-execution-governance-a0942233a0d0

Stack order (merge top to bottom, each after its API change is
deployed): D1 verdict hints, D2 precedence, D3 proxy execute toolkit
lists, D4 MCP classification, D5 proxy execute API key permission.

Verification, run in `docs/` at the top of the stack (D5 head, which
contains this PR): `bun run types:check` passes, `bun run build`
compiles (twoslash blocks type-check against the published
`@composio/core`), `bun run lint:links` reports 0 errors, `bun run test`
568 pass. `pnpm exec prettier --check` flags the changed mdx files on
`next` already, so no reformatting was applied.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01VHkYsmhteM1jJQoaoruiP3
2026-09-17 11:48:08 -04:00
composio-zen[bot] ca2e4df0ed docs: remove Strava toolkit FAQ and KB content
Strava is no longer in the toolkit catalog (public/data/toolkits*.json
has no strava entry), so drop its orphaned FAQ page, KB guide, and
KB source/manifest/registry entries.

kb/semantic-index.json will go stale from the manifest change; it
regenerates via the existing "Docs - Rebuild KB Semantic Artifact"
workflow (or `bun run build:kb-semantic`).
2026-09-17 15:27:40 +00:00
jkomyno 796a541343 docs: auto-generate TypeScript SDK reference 2026-09-17 13:21:49 +00:00
Anshu Garg 3c5a645023 docs: update toolkits, API spec, and meta tools data (#4510)
## Summary
Automated sync of backend data into the docs site.

- Trigger: `schedule`
- Dispatch action: `n/a`
- Source commit: `n/a`

## What changed
- **Toolkit catalog** (`docs/public/data/toolkits.json`,
`toolkits-list.json`) — refreshed list of available toolkits, auth
schemes, and tools from the backend API
- **OpenAPI specs** (`docs/public/openapi.json`,
`docs/public/openapi-v3.json`, `docs/public/openapi-webhooks.json`) —
latest v3.1 and v3.0 API specifications plus the webhook-events spec,
fetched from production
- **API reference pages** (`docs/content/reference/api-reference/`,
`docs/content/reference/v3/api-reference/`) — regenerated index pages
for both API versions
- **Meta tools reference** (`docs/public/data/meta-tools.json`,
`docs/content/toolkits/meta-tools/*.mdx`) — updated meta tool schemas
and reference docs
2026-09-17 17:43:54 +05:30
Anshu Garg 91076fbd8a docs(auth): note the auto-populated connection display_name (#4503)
## Why

Support and customers (e.g. athena) keep asking how to tell apart
multiple connected accounts under one auth config. Platform
[#12507](https://github.com/ComposioHQ/platform/pull/12507) +
[#12519](https://github.com/ComposioHQ/platform/pull/12519) shipped an
auto-populated provider identity for this, but the docs never mention
it. Closes the docs follow-up on
[PLEN-3541](https://linear.app/composio/issue/PLEN-3541).

## What

One line in the **Aliases** section of *Managing multiple connected
accounts*: to identify an account by its provider-side identity (Gmail
address, GitHub username), read the read-only `display_name` Composio
auto-populates at `state.val.displayName` once the connection is active
— distinct from the user-set `alias`.

## Impact

Docs-only. No code, no API change.

## Rollout

The feature is currently in staging; merge/publish once PLEN-3541 is
live in prod.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-09-17 17:43:18 +05:30
Sushmithamallesh 5f7494cbaf docs: update toolkits and API data 2026-09-17 10:05:08 +00:00
Sushmithamallesh f1f06ebfae docs: update toolkits and API data 2026-09-16 20:04:25 +00:00
Anshu Garg 8232607769 docs(auth): note the auto-populated connection displayName
Explains how to identify a connected account by its provider-side
identity (state.val.displayName), separate from the user-set alias.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-17 00:16:37 +05:30
Alberto Schiabel 8bf92435ad Merge branch 'next' into docs/add-atomic-agent-connect 2026-09-16 15:27:51 +02:00
jkomyno e55b642f3c docs: keep trigger subscription sample buildable 2026-09-16 15:22:04 +02:00
jkomyno bc3e981986 Merge remote-tracking branch 'origin/next' into review-pr-4356-docs 2026-09-16 15:19:11 +02:00
jkomyno 2cfcb464d8 docs: clarify generated changelog notes 2026-09-16 15:09:46 +02:00
Alberto Schiabel b39a9b30e1 docs(py): render raises sections and normalize reST in SDK reference (#4491)
This PR:

- fixes the raw `:raises ...:` reST directives leaking into the
generated Python SDK reference, flagged by [Greptile on the
auto-generated docs
PR](https://github.com/ComposioHQ/composio/pull/4479#discussion_r4004672537)
- teaches `python/scripts/generate-docs.py` to parse `:raises Exc:`
docstring fields (plus `:raise`/`:except`/`:throws` synonyms) into a
structured `**Raises**` section, with indented continuation-line support
- normalizes inline reST in all rendered prose:
`:class:`/`:func:`/`:meth:`/`:mod:` roles honor `~` short-name
semantics, and double-backtick literals become single-backtick inline
code
- regenerates `docs/content/reference/sdk-reference/python/` pages
- adds regression tests for raises parsing and reST normalization in
`python/tests/test_generate_docs.py`

## Context

The Python SDK reference pages are generated by
`python/scripts/generate-docs.py` (workflow: `generate-sdk-docs.yml`),
so the fix lives in the generator rather than the MDX — hand-edits would
be overwritten by the next auto-regen PR. Unrecognized `:raises` lines
previously fell through into the `:returns:` description text.
2026-09-16 14:57:04 +02:00
Alberto Schiabel 11de45889a fix(core): contain async Pusher subscription errors (#4448)
## Summary
`PusherService.subscribe` binds `pusher:subscription_error` after the
Pusher subscription call returns. `pusher-js` dispatches this event
asynchronously without catching listener exceptions, so authentication,
permission, server, or network subscription failures could escape as
uncaught exceptions in Node applications.

Fixes #4445

## Changes
- Log asynchronous Pusher subscription errors at the SDK error boundary
instead of throwing from the event callback.
- Add regression coverage that emits `pusher:subscription_error` after
`subscribe()` resolves and verifies that it does not throw.
- Add a patch changeset for the fixed `@composio/core`/`@composio/slim`
package group.

## Type of change
- [x] Bug fix
- [ ] New feature
- [ ] Refactor/Chore
- [ ] Documentation
- [ ] Breaking change

## How Has This Been Tested?
- Node `v24.17.0` / pnpm `11.8.0`
- `pnpm --filter @composio/core exec vitest run
test/services/pusher.test.ts test/utils/pusher.test.ts` — 2 files, 5
tests passed
- `pnpm --filter @composio/core test` — 55 test files passed; 1,289
tests passed and 2 existing tests reported expected failures; command
exited successfully
- `pnpm --filter @composio/core typecheck`
- `pnpm lint` — passed with existing repository warnings
- `pnpm validate:changesets`
- `pusher-js` `v8.6.0` runtime probe confirmed that an exception thrown
from a `pusher:subscription_error` listener reaches Node's
`uncaughtException` handler; the regression test verifies the SDK
callback no longer throws.

## Screenshots (if applicable)

Not applicable.

## Checklist
- [x] I have read the Code of Conduct and this PR adheres to it
- [x] I ran linters/tests locally and they passed
- [x] I updated documentation as needed
- [x] I added tests or explain why not applicable
- [x] I added a changeset if this change affects published packages

## Additional context
This patch is intentionally limited to the live `PusherService` path.
XHR timeout handling is a separate concern and is not included here. The
older unreferenced `PusherUtils` helper is unchanged to keep this fix
scoped to the path used by `Triggers`.
2026-09-16 14:56:45 +02:00
jkomyno c2e70f66a6 fix(py): route establish-time subscription failures through on_subscription_error
pysher performs the channel-auth request synchronously inside
pusher.subscribe(), so an auth rejection raised on the websocket thread
before pusher:subscription_error could ever be bound or fire. The new
on_subscription_error callback was skipped for exactly the failures it
documents, and callers waited out the full connect timeout for a
generic ComposioSDKTimeoutError.

- _connection_handler catches subscribe() failures and routes them
  through the error path (log + callback with {'error': ...}).
- The failure is recorded on the subscription and the connect() wait
  loop re-raises it on its next poll, so subscribe() fails promptly
  with the underlying error and still tears down the pusher.
- Update the Python reference, guide, and docstrings; add regression
  coverage for the handler routing, the failure record, and fast-fail.

Addresses the Cursor Bugbot comment on triggers.py:1023.
2026-09-16 14:54:14 +02:00
Brendan O'Leary 7a63e5acd7 docs: add product architecture guides and KB entry points (#4294)
## Summary

Adds canonical guidance for common Composio product-integration
decisions and makes the main paths easy to find from the Knowledge Base
homepage. This PR is independent of #4258 and #4277 and targets `next`
directly.

## Changes

- Add guides for the Composio skill, consumer-agent architecture,
B2B-agent architecture, and moving from prototype to production
- Expand the white-labeling guide with a minimal setup path and FAQ
- Add five Start here cards to `/kb`, before support topics and toolkit
browsing
- Update OAuth callback examples and add relevant sidebar and quickstart
cross-links

## Type of change

- [x] Documentation

## How Has This Been Tested?

- `bun test tests/static/` (528 passed)
- `bun run lint:links`
- `bun run types:check`
- `bun run lint`
- `bun run build`

## Checklist

- [x] I have read the Code of Conduct and this PR adheres to it
- [x] I ran linters/tests locally and they passed
- [x] I updated documentation and structural homepage coverage
- [x] No changeset is required for docs-only changes
2026-09-15 13:26:59 -04:00
Brendan O'Leary a0dbc6fbae docs: clarify OAuth callback URL matching 2026-09-15 15:06:56 +00:00
mukund-composio 788476a526 docs: project API key permissions (#4246)
We've split project API key permissions from a broad **Sessions** into
**Session management** and **Session tool execution**.

I've also removed the v3/v3.1 prefixes to keep things simpler to
understand and remove duplication.

Backend: [#12279](https://github.com/ComposioHQ/platform/pull/12279),
[#12291](https://github.com/ComposioHQ/platform/pull/12291), [production
#12370](https://github.com/ComposioHQ/platform/pull/12370). Dashboard:
[#1384](https://github.com/ComposioHQ/dashboard/pull/1384).
2026-09-15 20:33:39 +05:30
jkomyno 27701dd541 feat(py): add optional on_subscription_error for trigger subscriptions
Mirror the TypeScript API surface from the previous commit:

- Triggers.subscribe accepts an optional on_subscription_error callback,
  threaded through _SubcriptionBuilder.connect and bound to pysher's
  pusher:subscription_error event on the trigger channel.
- TriggerSubscription._handle_subscription_error logs the failure at the
  SDK boundary and invokes the callback with the parsed payload (or
  {'raw': frame} for malformed frames); callback exceptions are
  contained and logged so a faulty handler cannot tear down pysher's
  dispatch thread.
- The parameter is optional; existing callers are unaffected.
- Update the Python triggers reference and the subscribing-to-events
  guide.

Python never bound pusher:subscription_error at all, so subscription
failures after connect() were previously invisible to hosts.
2026-09-15 16:58:37 +02:00
jkomyno 1024d1a48c feat(core): add optional onSubscriptionError callback for trigger subscriptions
- PusherService.subscribe and Triggers.subscribe accept an optional
  onSubscriptionError callback invoked with the raw pusher
  pusher:subscription_error payload, giving hosts a programmatic signal
  for post-resolution subscription failures (previously log-only).
- Exceptions thrown from the callback are contained and logged, never
  rethrown, so a faulty handler cannot crash the host.
- The parameter is optional; existing callers are unaffected.
- Document the new parameter in the TypeScript triggers reference and
  the subscribing-to-events guide; bump the changeset to minor for the
  new API surface.

Applies review finding #1 from the PR #4448 review.
2026-09-15 16:33:00 +02:00
Brendan O'Leary 3f31ef9609 Merge remote-tracking branch 'origin/next' into codex/docs-priority-guides
# Conflicts:
#	docs/tests/static/product-navigation.test.ts
2026-09-15 10:12:04 -04:00
Brendan O'Leary a92d4920f0 docs: finish priority guide integration 2026-09-15 10:08:10 -04:00
Brendan O'Leary e71a9a22b4 docs: broaden harness example category 2026-09-15 09:31:48 -04:00
Mukund 6c2bcc554f docs: correct session proxy permission callout 2026-09-15 18:45:04 +05:30
sosidudku1 5ea73718bc docs: add Atomic Agent to Composio Connect clients
Atomic Agent is a local-first agent (CLI and TUI) that ships a built-in
Composio integration: it connects to the hosted tool router over
Streamable HTTP MCP, so tools are registered at startup as
mcp.composio.*.

Setup is done from the Integrations tab or by adding COMPOSIO_API_KEY to
the agent's .env, so the entry documents that flow rather than the CLI
install used by other terminal agents.
2026-09-15 15:41:13 +03:00
jkomyno 3271679ee0 docs(py): render Raises sections and normalize reST in generated SDK reference
- parse :raises Exc: docstring fields (plus Sphinx synonyms) into a
  structured Raises section instead of leaking raw directives into the
  Returns description
- normalize inline reST in all rendered prose: roles (:class:, :func:,
  :meth:, ...) honor ~ short-name semantics; double-backtick literals
  become single-backtick inline code
- regenerate docs/content/reference/sdk-reference/python/ pages
- add regression tests for raises parsing and reST normalization

Flagged by Greptile on the legacy-repo auto-PR (ComposioHQ/composio#4479).
2026-09-15 13:12:25 +02:00
Mukund cc3c5836a9 docs: recommend write-only access for session creation 2026-09-15 15:58:19 +05:30
Mukund 65255d31ac docs: limit permission updates to session changes and reference labels 2026-09-15 15:54:48 +05:30
Mukund 77004dacdd docs: document session proxy access under session execution only 2026-09-15 13:58:34 +05:30
Mukund b7ac0ec68d docs: focus scoped key guidance on session permissions 2026-09-15 13:53:46 +05:30
Mukund befbd680fe Merge next and refresh scoped key permission guidance 2026-09-15 13:51:09 +05:30
Mukund 61a2674ef5 docs: simplify scoped key permissions and reconcile current routes 2026-09-15 13:49:57 +05:30
jkomyno 9db556c21f docs: auto-generate Python SDK reference 2026-09-14 22:12:59 +00:00
jkomyno 0faaacc48b Merge remote-tracking branch 'origin/next' into docs/tools-direct-examples
# Conflicts:
#	ts/packages/cli/test/src/commands/setup.cmd.test.ts
2026-09-15 00:11:37 +02:00
Kshitij Jhunjhunwala 333b067885 Merge branch 'next' into kj/restore-install-plugin-setup 2026-09-14 13:04:15 -07:00
Kshitij Jhunjhunwala 14e81b00b3 fix(cli): restore automatic plugin setup on install 2026-09-14 12:59:56 -07:00
Brendan O'Leary dcd1ac953f Merge branch 'next' into codex/token-custody-architecture 2026-09-14 12:10:16 -07:00
Brendan O'Leary e7c585ead8 Merge branch 'next' into codex/token-custody-architecture 2026-09-14 11:29:38 -07:00
Brendan O'Leary c42fa6ffe6 docs: use Python and TypeScript examples in token custody guide 2026-09-14 18:26:31 +00:00
DakshM on Exe (exe.dev) 0a1464d5e8 perf(cli): move the compiler and tokenizer out of the executable
`composio --version` goes from 288ms to 199ms, peak RSS from 97.8MB to
77.3MB, and the executable from 85.9MB to 79.7MB. Every command benefits.

A compiled Bun binary parses its whole embedded bundle before the first
line of JavaScript runs, and #4468 had already made sure the TypeScript
compiler and the tokenizer rank table were never *evaluated* unless
`generate`, `run`, or a large `execute` response needed them. They were
still *parsed* on every start: the compiler alone was 44% of the
executable's JavaScript and the o200k rank table another 28%, so
`--version` spent ~75ms reading code it could never call.

Both now ship as companion modules next to the executable, through the
mechanism `composio run` already uses for its own runtime helpers:

- `generation-runtime.mjs` carries `src/generation/*`, the `composio run`
  source rewrites, `typescript`, `@composio/ts-builders` and
  `openapi-typescript`. `generate ts`, `generate py` and `run` load it
  with `loadInstalledCompanionModule`; from a source checkout the loader
  resolves the `.ts` next to `run-companion-modules.ts` instead, so tests
  and `bun run src/bin.ts` need no build step.
- `execute-output-encoder-runtime.mjs` carries `js-tiktoken/lite` and the
  rank table. `execute` loads it only once a response exceeds the 10KB
  byte pre-filter.

A companion bundles its own copy of `effect`, and a fiber cannot run
primitives built by another copy of the runtime, so nothing Effect-shaped
crosses the boundary: the generation companion exposes plain functions
and promises, runs its pipelines on its own runtime, and returns failures
as values that `src/generation/errors.ts` rebuilds as the CLI's own error
classes, stack included. Generated output is byte-identical to #4468 for
`generate ts`, `generate ts --transpiled` and `generate py`.

Both modules join `RUN_COMPANION_MODULE_BASENAMES`, so the build, release
packaging, install verification, `upgrade` and the self-repair download
pick them up unchanged. The three hand-maintained uninstall lists and the
upgrade E2E fixture gain the two file names.

Two smaller startup costs go with it:

- `src/constants.ts` imported `constants` from `@composio/core`'s root
  entry for two strings and two URLs, which evaluated the whole SDK at
  startup (~25ms of module-scope work, mostly zod schemas). The four
  values are spelled out and pinned to core's by a test.
- `tool-file-uploads.ts` imported three core helpers at module scope that
  only a file upload reaches; they are imported on that path now.

The binary build gains a guard: after bundling the companions it bundles
`src/bin.ts` once more unminified and fails if the executable's graph
reaches `typescript`, `js-tiktoken`, core's root entry, `src/generation/*`
or a companion entry. Without it a stray static import would put the
compiler back into the executable with nothing to notice.

Building also surfaced that `assertBundledRuntimeFiles` blanked string
literals to same-length runs of spaces, which made the import patterns'
`^\s*` backtrack quadratically across the compiler's multi-megabyte
embedded lib strings and stalled the build for over ten minutes. String
bodies are dropped now. (The check itself has never matched a specifier,
since the specifiers it looks for are the string literals it removes;
that is left as it was.)

Measured on the pinned toolchain, Bun 1.4.1+4661e494f, linux-x64, best
of 15, telemetry disabled, both binaries built in the same session:

  composio --version       288ms -> 199ms
  tools execute --help     287ms -> 202ms
  peak RSS                 97.8MB -> 77.3MB
  executable               85.9MB -> 79.7MB
  executable JavaScript    8.3MB -> 2.1MB (minified)

The `execute` tail after `execute.tool_call.end` is unchanged for
responses under 10KB (~10ms) and ~20ms slower above it (351 -> 374ms),
which is the on-demand parse of the 2.2MB encoder companion.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wx9gEjuiHux2weiHjdNcDs
2026-09-14 15:52:49 +02:00