@original-land/original-connect
v1.0.3
Published
Original Connect SDK — OAuth 2.1 / OIDC client for the Original AI ecosystem (login, chat, connectWorkspace).
Readme
@original-land/original-connect
Framework-agnostic TypeScript SDK for Original Connect — the OAuth 2.1 / OpenID Connect identity layer for the Original AI ecosystem. Log users in, chat with AI agents, add voice and file attachments — without ever exposing API keys to the user.
Install
npm install @original-land/original-connectThis is a public package on the npm registry — no authentication or .npmrc is required.
Which prompt should I use?
| Scenario | Prompts to use |
|---|---|
| My app has no backend (browser / frontend only) | getting-started.md + chat-browser-app.md |
| My app has a backend (Next.js, NestJS, SvelteKit…) | getting-started.md + chat-backend-app.md |
| I want to sell access to an agent (paid / marketplace) | getting-started.md + purchasable-agent.md |
| I want to add voice / audio | Also add: voice-enabled-app.md |
| I want to add file uploads | Also add: file-attachments.md |
Quick start (browser app with a fixed bot)
import { createBrowserClient } from '@original-land/original-connect/browser';
import { Scopes, agentChatScope, buildScope } from '@original-land/original-connect';
const BOT_ID = '<botId>';
const oa = createBrowserClient({
clientId: '<your-client-id>',
issuer: 'https://ai.original.land',
redirectUri: '<your-redirect-uri>',
responsesApiUrl: 'https://ai-api.original.land',
});
// 1. Login
oa.login({
scope: buildScope([Scopes.openid, Scopes.profile, agentChatScope(BOT_ID)]),
});
// 2. Handle the callback (on your redirect page)
if (window.location.search.includes('code=')) {
await oa.handleCallback();
}
// 3. Chat
const result = await oa.streamResponse(BOT_ID, {
input: [{ type: 'message', role: 'user', content: 'Hello!' }],
}, {
onTextDelta: (delta) => console.log(delta),
});See prompts/ for complete guides.
Prompts
Ready-to-paste prompts for coding agents live in prompts/:
| Prompt | Description | |---|---| | getting-started.md | Registration, scopes, security rules, end-to-end flow | | chat-browser-app.md | Browser-only app (PKCE, no backend) | | chat-backend-app.md | Backend app (confidential client) | | purchasable-agent.md | Paid agent / marketplace | | voice-enabled-app.md | Add-on: STT, TTS, Omni v3, live voice sessions | | file-attachments.md | Add-on: file upload and chat with documents |
Canonical domains
| What | URL |
|---|---|
| Issuer (OAuth) | https://ai.original.land |
| Discovery | https://ai.original.land/.well-known/openid-configuration |
| Registration | https://ai.original.land/oauth/register |
| Responses API (chat) | https://ai-api.original.land |
| Live Voice WebSocket | wss://ai-live-api.original.land/live |
| Agent list | https://ai.original.land/oauth/agents |
| Connection status | https://ai.original.land/oauth/connections/status |
| Workspace connect page | https://workspace.original.land/connect |
SDK exports
| Import | Runtime | Contents |
|---|---|---|
| @original-land/original-connect | any | types, PKCE utils, URL builders, discovery, error types, scopes, registerClient, extractOutputText |
| @original-land/original-connect/browser | browser | createBrowserClient → login, handleCallback, getChatToken, streamResponse, listAgents, uploadFiles, connectWorkspace |
| @original-land/original-connect/server | Node.js | createConfidentialClient → getAuthorizeUrl, exchangeCode, refresh, streamResponse, connectWorkspace |
| @original-land/original-connect/responses | any | streamResponse, createResponse, extractOutputText (low-level) |
| @original-land/original-connect/files | any | file upload utilities |
| @original-land/original-connect/voice | any | speechToText, textToSpeech |
| @original-land/original-connect/omni | any | streamOmniTurn, startOmniTurn, consumeOmniText, consumeOmniAudio, abortOmniConversation |
| @original-land/original-connect/voice-live | browser | startVoiceSession (full-duplex WebSocket) |
| @original-land/original-connect/register | any | registerClient (dynamic client registration) |
Development
pnpm install
pnpm test # vitest
pnpm typecheck
pnpm build # tsup → dist (ESM + CJS + d.ts)Every client call goes through an injectable fetch, so the SDK is fully unit-testable in isolation against the documented HTTP contracts (no live issuer required).
