发布

  • feat(sdk): workbench sandbox compute tier + connectedAccounts.link() allow_multiple (#3304)

    frostbyte_neo 发布于 2026-04-28 12:10:48 +00:00

    Description

    Two SDK additions on top of next, plus the test-mock alignment that
    fell out of the bundled stainless-client bump. User-facing docs have
    been split into a separate branch (zen/sdk-sandbox-size-docs-12ur1a)
    so they can land alongside the release PR for these patches — opening
    them in this PR would fail the docs build until @composio/core /
    composio ship the new versions.

    1. workbench.sandboxSize / workbench.sandbox_size

    Expose a workbench sandbox compute-tier knob on ToolRouter.create() so
    callers can pick standard (default), medium, large, or xlarge.
    Server-default is unchanged when the field is omitted, so existing
    callers keep current behavior.

    • Bump stainless clients to pick up the field on the wire:
      • @composio/client 0.1.0-alpha.66 → 0.1.0-alpha.67
      • composio-client 1.33.0 → 1.34.0
    • TS: extend ToolRouterCreateSessionConfigSchema.workbench with
      sandboxSize and forward it as snake_case sandbox_size. Export
      SandboxSize type and SandboxSizeSchema zod enum.
    • Python: extend ToolRouterWorkbenchConfig TypedDict with
      sandbox_size and forward it on the create payload. Export
      SandboxSize literal alias.
    • Changeset: @composio/core patch.

    2. connectedAccounts.link() allow_multiple guard (SEC-339)

    Bring link() to parity with initiate() so the duplicate-connection
    guard moves with customers as Composio-managed redirectable-OAuth
    callers migrate from connected_accounts/create to
    connected_accounts/link.

    • TS: add allowMultiple?: boolean to
      CreateConnectedAccountLinkOptions. link() now pre-flights
      connectedAccounts.list({ statuses: ['ACTIVE'] }) and throws
      ComposioMultipleConnectedAccountsError when an active connection
      exists and allowMultiple is not true.
    • Python: add allow_multiple: bool = False to
      connected_accounts.link() with the same guard and the same
      ComposioMultipleConnectedAccountsError.
    • Behavior change is intentional and patched separately with
      .changeset/sdk-link-allow-multiple.md.

    3. Test-mock fix (alpha.67 fallout)

    The @composio/client alpha.66 → alpha.67 bump above added two
    newly-required fields on SessionCreateResponse that the CLI
    tool-router test mocks did not return: config_version: number at the
    top level and preload: { tools: string[] } inside config. Added both
    to every toolRouter.create mock in
    ts/packages/cli/test/src/commands/** so pnpm typecheck:test passes
    again. The values are arbitrary fixtures (config_version: 1, empty
    preload.tools) — none of these tests assert on those fields.

    How did I test this PR

    • TypeScript: new tests in
      ts/packages/core/test/models/toolRouter.test.ts cover the snake_case
      forwarding and the zod enum rejection for invalid sandboxSize values.
      New tests in
      ts/packages/core/test/connectedAccounts/connectedAccounts.test.ts
      cover the empty-list (link succeeds), duplicate-active (link throws
      ComposioMultipleConnectedAccountsError), and allowMultiple: true
      (link skips the guard) paths.
    • Python: new tests in python/tests/test_tool_router.py for
      sandbox_size forwarding and enum coverage. New tests in
      python/tests/test_connected_accounts.py and parity tests in
      python/tests/test_tool_router.py for allow_multiple=True skipping
      the guard.
    • CLI typecheck: ran pnpm exec tsgo --noEmit -p ./tsconfig.test.json from ts/packages/cli/ and full repo pnpm typecheck after adding config_version / preload to the test mocks —
      clean.
    • CI: all 20 checks green on the latest commit (50758892),
      including all six runtime E2E targets (Node 20.18 / 20.19 / 22.12, Deno
      2.6.7, Cloudflare Workerd, CLI scratch).

    Docs and changelog entries
    (docs/content/docs/{configuring-sessions,workbench}.mdx +
    docs/content/changelog/04-28-26-sdk-{sandbox-size,link-allow-multiple}.mdx)
    live on zen/sdk-sandbox-size-docs-12ur1a and will be opened as a
    separate PR once these patches are released.

    下载附件