Composer SDK

Add suggestions to your existing editor and choose how they appear.

Start with the SDK quickstart for installation and proxy setup.

Use your existing composer

The SDK includes a headless CompletionController, useTabCompletion, TabCompletionInput and an optional assistant-ui adapter. The default remains complete ghost text, Tab inserts without sending, and your normal Enter or send button submits.

SDK 0.4.0 adds optional typewriter presentation, bounded client requests and opt-in Clone mode. These features are absent from 0.3.1. Download the archive and checksum from release v0.4.0. Keep existing integrations pinned until the upgrade passes in your composer. Release instructions.

import { TabCompletionInput } from '@clone-ai/tab-completion/react';
import { createPredictionTransport } from '@clone-ai/tab-completion';

// Define once; the proxy authenticates the user and owns CLONE_APP_KEY.
const transport = createPredictionTransport('/api/clone/predict');

<TabCompletionInput
  value={draft}
  onValueChange={setDraft}
  context={context}
  transport={transport}
  presentation="instant"
  requestTimeoutMs={15000}
/>

Choose presentation="typewriter" only if your customer wants progressive display. It animates an already-complete JSON result, using whole graphemes. It is not API streaming. Tab acceptance waits until the entire candidate is visible. Edits, selection changes, dismissal and expiry cancel the animation.

useTabCompletion returns completion, canAccept, input bindings and state. Headless consumers render state.visibleCompletion. Do not send a partial or unseen suggestion.

Server client

import { CloneClient } from '@clone-ai/tab-completion/server';
const clone = new CloneClient({
  apiKey: process.env.CLONE_APP_KEY!,
  baseUrl: 'https://api.clone.is',
  requestTimeoutMs: 15000,
  maxConcurrentRequests: 16,
});
const result = await clone.predict(authenticatedUser.id, body, { signal });

Keep one client per backend integration, not one per request. The deadline includes response-body reads; local saturation fails quickly. Both safeguards leave the application's core send path independent.

Agent installation choices

Before wiring the UI, the installation agent uses AskUserQuestion or its equivalent to resolve choices the customer has not already supplied: suggestion triggers, instant/typewriter display, product preferences versus optional Clone personalization, whether to expose Clone mode, its turn/time bounds, and rollout controls. Framework, routes and session storage should be discovered from the code.

Production card registration remains part of initial onboarding. The customer personally completes billing consent and card entry; the agent reads back verified state and resumes installation. See the agent entry guide.