TypeScript client
A browser client on native fetch. You own the UI and conversation lifecycle.
Create the client with the user returned by your backend. The first input can create a conversation; keep its session ID to continue.
import { createApplicationClient } from '@aimount/application-client';
const client = createApplicationClient({
baseUrl: apiBaseUrl,
applicationId: issued.user.application_id,
userId: issued.user.id,
getAccessToken: getCurrentUserToken,
});
const operation = client.prepareInput({
agent_id: selectedAgentId,
text: 'Where is my order?',
});
// Persist the operation before dispatch for recovery.
const ack = await client.submitInput(operation);
// Keep ack.session_id to continue this conversation.
// Accepted is not answered: read history/events separately.Save a prepared operation before sending it. If the result is unknown, retry the same operation instead of creating a new one.