=============== LIBRARY RULES =============== From library maintainers: - Keep the secret Connect API key on the server; only the publishable key may reach the browser. - Load the Presenter module once from the PRESENTER_URL your server supplies, declare in the DOM, then call initializeWithConnectKey() before present(). - Wait for the presenter to reach Ready before calling present(); check PresentationResult.success and its code/message on failure. - Pick avatar, scene and voice IDs from the catalog endpoints rather than hardcoding them in production. ### Quick start setup commands Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Commands to copy the environment file, install dependencies, and start the development server. Requires Node >=22. The .env file must be configured with the required Perxona Connect API keys. ```bash cp .env.example .env # then open .env and set the required values: # PERXONA_API_BASE_URL → e.g. https://console.perxona.ai/asia # PERXONA_CONNECT_SECRET_KEY → a secret Connect API key # PERXONA_CONNECT_PUBLISHABLE_KEY → a publishable Connect API key npm install npm run dev # open the URL it prints (default http://localhost:8083) ``` -------------------------------- ### Create local config and install dependencies Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Run these commands in the sample directory to set up your local configuration and install dependencies. Requires Node >=22 and a Perxona Connect account with two API keys. ```bash cp .env.example .env # 1. create your local config npm install # 2. install dependencies ``` -------------------------------- ### Start the Express sample with npm run dev or npm start Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Use `npm run dev` for live reload (node --watch) or `npm start` to start without watch. The terminal prints the local URL, the API it targets, and whether it's in live or mock mode. ```bash npm run dev # start with live reload (node --watch) # or npm start # start without watch ``` -------------------------------- ### Start the Express server Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/public/demos/studio/README.md Command to start the server from the express/ directory. The alternative node server.mjs is also shown. ```bash npm start # or: node server.mjs ``` -------------------------------- ### Start the server with npm run dev or npm start Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/quickstart.md Run the server with live reload using npm run dev, or without watch using npm start. The terminal prints the local URL, e.g., http://localhost:8083. ```bash npm run dev # with live reload (node --watch) # or npm start # without watch ``` -------------------------------- ### Install dependencies and run tests Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/tools/vrm-uploader/README.md Run these commands to install dependencies and execute the test suite. The tests build .vrm files byte by byte and use a local stub server, so no credentials are needed and the real API is never contacted. ```bash pnpm install ``` ```bash pnpm test ``` -------------------------------- ### Install dependencies with npm install Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/quickstart.md Install project dependencies. Requires Node >=22; older versions cause npm install to refuse with an upgrade message. ```bash npm install ``` -------------------------------- ### Embed presenter and start with connect key Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/README.md Use this HTML and JavaScript to embed the web component and start a presentation. The page fetches the presenter URL from /api/config and the connect key from /api/connect-key, then initializes with avatar, scene, and voice IDs. Note that present() never rejects; check the result object for success and error details. ```html ``` -------------------------------- ### GET /api/scenes Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Lists scenes. ```APIDOC ## [GET] /api/scenes ### Description List scenes. ### Method GET ### Endpoint /api/scenes ``` -------------------------------- ### Create local config from .env.example Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/quickstart.md Copy the example environment file to .env for local configuration. ```bash cp .env.example .env ``` -------------------------------- ### Add a weather lookup tool via POST /api/chatbots Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/public/demos/studio/README.md Defines a function tool for a chatbot that calls an external HTTP API. The tool is passed in the `tools` field when creating a chatbot. The example shows a weather lookup tool with a GET request to wttr.in, including query parameters and no authentication. ```json { "name": "Weather Bot", "custom_instructions": "You are a weather assistant. Use the weather_lookup tool to answer questions.", "tools": [ { "name": "weather_lookup", "description": "Look up current weather for a city. Use when the user asks about the weather.", "settings": { "request": { "method": "get", "url": "https://wttr.in", "query_params": { "type": "object", "properties": { "format": { "type": "string", "description": "Response format, use '3'" }, "location": { "type": "string", "description": "City name in English" } }, "required": ["location", "format"] } }, "auth": { "secret_type": "no_auth" }, "response": { "body_schema": {} } } } ] } ``` -------------------------------- ### GET /api/scenes/:id Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/sample-api-adapter.md Scene detail. ```APIDOC ## [GET] /api/scenes/:id ### Description Scene detail. ### Method GET ### Endpoint /api/scenes/:id ### Parameters #### Path Parameters - **id** (string) - Required - The scene identifier. ### Response #### Success Response (200) - Scene object. ``` -------------------------------- ### Run the sample on your laptop (Path B) Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/README.md Clone the repository, copy the environment file, and start the development server. Requires Node 22+ and your two Connect API keys pasted into the .env file. The app runs at http://localhost:8083. ```bash git clone https://github.com/XRSPACE-Inc/perxona-connect-kit.git cd perxona-connect-kit/samples/express cp .env.example .env # paste your two keys npm install && npm run dev ``` -------------------------------- ### GET /api/avatars Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Lists avatars. ```APIDOC ## [GET] /api/avatars ### Description List avatars. ### Method GET ### Endpoint /api/avatars ``` -------------------------------- ### GET /chatbots Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt Lists chatbots. ```APIDOC ## GET /chatbots ### Description Lists chatbots. ### Method GET ### Endpoint /chatbots ``` -------------------------------- ### GET /api/connect-key Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/sample-api-adapter.md Serve the browser the publishable key. Pass it directly into presenter.initializeWithConnectKey(). ```APIDOC ## [GET] /api/connect-key ### Description Serve the browser the **publishable** key. Pass it directly into `presenter.initializeWithConnectKey(connectKey, { avatarId, sceneId, voiceId })`. This is never `PERXONA_CONNECT_SECRET_KEY` — that one carries chat and chatbot management, which no browser should hold. `Cache-Control: no-store`. Returns `501` in mock mode, where there are no keys to serve. ### Method GET ### Endpoint /api/connect-key ### Response #### Success Response (200) - **connect_key** (string) - The publishable key. #### Error Response (501) - Returned in mock mode, where there are no keys to serve. ### Response Example ```json { "connect_key": "pk_..." } ``` ``` -------------------------------- ### GET /api/connect-key Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Hands the browser the publishable key, which can be passed directly into `presenter.initializeWithConnectKey()`. ```APIDOC ## [GET] /api/connect-key ### Description Hand the browser the publishable key — pass straight into `presenter.initializeWithConnectKey()`. ### Method GET ### Endpoint /api/connect-key ``` -------------------------------- ### GET /api/config Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Returns static per-process flags and demo defaults. No upstream probe is performed. ```APIDOC ## [GET] /api/config ### Description Static per-process flags (`mock`, `chat`, `presenterUrl`) plus demo defaults. No upstream probe. ### Method GET ### Endpoint /api/config ``` -------------------------------- ### GET /api/config Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/sample-api-adapter.md Static per-process flags. No upstream probe, cheap to call. ```APIDOC ## [GET] /api/config ### Description Static per-process flags. No upstream probe — cheap to call. ### Method GET ### Endpoint /api/config ### Response #### Success Response (200) - **mock** (boolean) - Whether mock mode is enabled. - **chat** (boolean) - Reflects presence of `LLM_API_KEY` only, never the key itself. - **presenterUrl** (string) - The presenter URL. ### Response Example ```json { "mock": false, "chat": true, "presenterUrl": "https://example.com" } ``` ``` -------------------------------- ### Run checks for Express sample Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/CONTRIBUTING.md Run from the repository root. Installs CI dependencies and the Express sample dependencies, then checks syntax, lints, and type-checks the sample. The type check validates demo calls against @perxona/presenter-types. ```bash npm ci --prefix .github/ci (cd samples/express && npm ci) (cd samples/express && for f in server.mjs scripts/*.mjs public/demos/*/app.js; do node --check "$f"; done) .github/ci/node_modules/.bin/eslint --config .github/ci/eslint.config.mjs samples .github/ci/node_modules/.bin/tsc --noEmit --checkJs --allowJs \ --module nodenext --moduleResolution nodenext --target es2022 --skipLibCheck \ samples/express/public/demos/*/app.js ``` -------------------------------- ### Install dependencies and regenerate docs Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/tools/handbook-to-markdown/README.md Run these commands to regenerate docs/, llms.txt, and llms-full.txt from the single-page handbook. Requires Python 3 and curl. ```bash pip install beautifulsoup4 markdownify ``` ```bash curl -s https://connect.perxona.ai/ -o /tmp/handbook.html ``` ```bash python3 tools/handbook-to-markdown/handbook2md.py /tmp/handbook.html . ``` -------------------------------- ### GET /api/scenes Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/sample-api-adapter.md List scenes. Returns a paginated list of scene items. ```APIDOC ## [GET] /api/scenes ### Description List scenes. Response: `Page { items: [{ id, name, … }] }`. (`id` normalized from `scene_id`.) ### Method GET ### Endpoint /api/scenes ### Response #### Success Response (200) - **items** (array) - List of scene objects. - **id** (string) - Scene identifier (normalized from `scene_id`). - **name** (string) - Scene name. ### Response Example ```json { "items": [ { "id": "scene_1", "name": "Office" } ] } ``` ``` -------------------------------- ### Run tests, lint, and shellcheck Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/tools/vrm-uploader/AGENTS.md Commands to install dependencies, run tests, lint, and shellcheck the upload script. Run all three plus `bash -n` before proposing a change; Shellcheck must stay at zero findings. ```bash pnpm install && pnpm test pnpm lint shellcheck --format=gcc upload-vrm.sh ``` -------------------------------- ### settings.response body_schema example Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/public/demos/studio/docs/connect-chat-bot-function-tools.md Example of settings.response with a body_schema. body_schema is not validated; it is only written into the tool description for the LLM. The actual response is passed back to the model as-is (parsed as JSON if possible, otherwise as plain text). ```jsonc { "body_schema": { "type": "object", "properties": { "temp_c": { "type": "number" } }, }, } ``` -------------------------------- ### GET /api/chatbots Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/sample-api-adapter.md List all chatbots. Returns a paginated list of chatbot summaries. ```APIDOC ## [GET] /api/chatbots ### Description List all chatbots. ### Method GET ### Endpoint /api/chatbots ### Response #### Success Response (200) - **items** (array) - List of chatbot objects - **id** (string) - Chatbot ID - **name** (string) - Chatbot name - **status** (string) - Chatbot status ``` -------------------------------- ### GET /api/avatars/:id/motions Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Lists motions for a specific avatar. ```APIDOC ## [GET] /api/avatars/:id/motions ### Description List motions for an avatar. ### Method GET ### Endpoint /api/avatars/:id/motions ### Parameters #### Path Parameters - **id** (string) - Required - Avatar identifier. ``` -------------------------------- ### GET /api/scenes/:id Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Retrieves details for a specific scene. ```APIDOC ## [GET] /api/scenes/:id ### Description Get scene details. ### Method GET ### Endpoint /api/scenes/:id ### Parameters #### Path Parameters - **id** (string) - Required - Scene identifier. ``` -------------------------------- ### Full integration: subscribe, load, initialize, chat, present Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/public/demos/embed/README.md The complete integration flow for the embed demo. Subscribe to PRESENTER_STATUS before awaiting anything, then load the presenter engine, initialize with a connect key, and per message resume audio playback once, request a chat reply, and present it. Errors are kept off the page; the stage shows a fixed 'not available' sentence if start() rejects or the stage fails. ```javascript // Subscribe before anything can await — see "Why the order matters" below. presenter.addEventListener("PRESENTER_STATUS", (event) => { if (event.detail?.status !== "Ready") return; document.getElementById("stage-loading").remove(); // drop the placeholder chatPanel.hidden = false; appendMessage("assistant", GREETING); // written, not spoken — see below }); const config = await request("/api/config"); await loadPresenterEngine(config.presenterUrl); const { connect_key } = await request("/api/connect-key"); await presenter.initializeWithConnectKey(connect_key, config.fixedTarget); // Then, per message. config.chatbotId is null on an account with no chatbot // Embed can use (disabled and app-managed ones are skipped), // which is why start() refuses to bring the widget up at all in that case — // there is nothing to converse with, so the stage shows the fixed // "not available" sentence instead of the chat. await presenter.resumeAudioPlayback(); // once, on the first send const { reply_text } = await request(`/api/chatbots/${config.chatbotId}/chat`, { method: "POST", body: { messages: toConnectMessages(history) }, }); await presenter.present(reply_text); ``` -------------------------------- ### GET /chatbots Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/api-reference.md List chatbots. Returns a list of chatbot objects. ```APIDOC ## GET /chatbots ### Description List chatbots. ### Method GET ### Endpoint `/chatbots` ### Response #### Success Response (200) - (array) - List of chatbot objects. ``` -------------------------------- ### GET /api/scenes Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/AGENTS.md Lists all scenes from the Connect API, proxied through the server. Normalizes the `scene_id` field to `id`. ```APIDOC ## [GET] /api/scenes ### Description Lists all scenes from the Connect API, proxied through the server. Normalizes the `scene_id` field to `id`. ### Method GET ### Endpoint /api/scenes ``` -------------------------------- ### GET /assets/scenes/{scene_id} Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt Reads a scene's detail. ```APIDOC ## GET /assets/scenes/{scene_id} ### Description Reads a scene's detail. ### Method GET ### Endpoint /assets/scenes/{scene_id} ### Parameters #### Path Parameters - **scene_id** (string) - Required - The unique identifier of the scene. ``` -------------------------------- ### GET /api/chatbots Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt List chatbots. Returns a paginated list of chatbot summaries. ```APIDOC ## GET /api/chatbots ### Description List chatbots. ### Method GET ### Endpoint /api/chatbots ### Response #### Success Response (200) - **items** (array) - List of chatbots, each with `id`, `name`, `status`. ``` -------------------------------- ### GET /api/avatars Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/sample-api-adapter.md List avatars. Returns a paginated list of avatar items. ```APIDOC ## [GET] /api/avatars ### Description List avatars. Response: `Page { items: [{ id, name, thumbnail_urls, … }] }`. (`id` is normalized from the upstream `avatar_id`.) ### Method GET ### Endpoint /api/avatars ### Response #### Success Response (200) - **items** (array) - List of avatar objects. - **id** (string) - Avatar identifier (normalized from `avatar_id`). - **name** (string) - Avatar name. - **thumbnail_urls** (array) - Thumbnail URLs. ### Response Example ```json { "items": [ { "id": "avatar_123", "name": "Alice", "thumbnail_urls": ["https://example.com/thumb.png"] } ] } ``` ``` -------------------------------- ### GET /assets/scenes Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt Lists active scenes available to the authenticated organization. ```APIDOC ## GET /assets/scenes ### Description Lists active scenes available to the authenticated organization. ### Method GET ### Endpoint /assets/scenes ``` -------------------------------- ### GET /api/avatars/:id Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Retrieves details for a specific avatar. ```APIDOC ## [GET] /api/avatars/:id ### Description Get avatar details. ### Method GET ### Endpoint /api/avatars/:id ### Parameters #### Path Parameters - **id** (string) - Required - Avatar identifier. ``` -------------------------------- ### GET /credit Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt Reads the organization's current credit usage. Secret-key only. ```APIDOC ## GET /credit ### Description Reads the organization's current credit usage. Secret-key only. ### Method GET ### Endpoint /credit ### Response #### Success Response (200) - **used** (number) - The amount of credit used. - **total** (number) - The total amount of credit. - **remaining** (number) - The remaining credit. - **period_start** (string) - The start of the current period. - **period_end** (string) - The end of the current period. ``` -------------------------------- ### GET /api/voices Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/sample-api-adapter.md List voices. Returns a paginated list of voice items. ```APIDOC ## [GET] /api/voices ### Description List voices. Response: `Page { items: [{ id, name, … }] }`. ### Method GET ### Endpoint /api/voices ### Response #### Success Response (200) - **items** (array) - List of voice objects. - **id** (string) - Voice identifier. - **name** (string) - Voice name. ### Response Example ```json { "items": [ { "id": "voice_1", "name": "Female" } ] } ``` ``` -------------------------------- ### Run checks for VRM uploader Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/CONTRIBUTING.md Run from tools/vrm-uploader/. Checks shell script syntax, lints with shellcheck, installs dependencies, lints with ESLint, and runs tests with Vitest. ```bash bash -n upload-vrm.sh shellcheck --format=gcc upload-vrm.sh pnpm install --frozen-lockfile pnpm exec eslint . pnpm exec vitest run ``` -------------------------------- ### GET /api/credit Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Returns the Studio's Credit Usage panel data: used/total/remaining credit points and the current period's end. ```APIDOC ## [GET] /api/credit ### Description Studio's Credit Usage panel: used/total/remaining credit points and the current period's end. ### Method GET ### Endpoint /api/credit ``` -------------------------------- ### POST /api/chatbots Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/AGENTS.md Creates a new Connect chatbot from code. Used by the InterviewCoach demo on the first Start action. ```APIDOC ## [POST] /api/chatbots ### Description Creates a new Connect chatbot from code. Used by the InterviewCoach demo on the first Start action. ### Method POST ### Endpoint /api/chatbots ``` -------------------------------- ### GET /voices Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt Lists custom voices. Supports language and provider filters. ```APIDOC ## GET /voices ### Description Lists custom voices. Supports language and provider filters. ### Method GET ### Endpoint /voices ### Parameters #### Query Parameters - **language** (string) - Optional - Filter by language code (e.g., 'ja'). - **provider** (string) - Optional - Filter by provider. - **page** (integer) - Optional - Page number for pagination. - **size** (integer) - Optional - Page size (default 50, max 100). ### Response #### Success Response (200) - **items** (array) - List of voice objects. - **total** (integer) - Total number of voices. - **page** (integer) - Current page number. - **size** (integer) - Page size. - **pages** (integer) - Total number of pages. ### Request Example ```bash curl -X GET "$CONNECT_API_BASE/voices?language=ja" \ -H "X-Connect-Key: pxc_..." ``` #### Response Example ```json { "items": [ { "id": "8f14e45f-...", "name": "Sakura", "description": null, "languages": ["ja"], "provider": "azure" } ], "total": 1, "page": 1, "size": 50, "pages": 1 } ``` ``` -------------------------------- ### GET /api/config Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt Returns static per-process configuration flags. Does not probe upstream, so it is cheap to call. The `chat` flag reflects presence of `LLM_API_KEY` only, never the key itself. ```APIDOC ## GET /api/config ### Description Static per-process flags. No upstream probe — cheap to call. ### Method GET ### Endpoint /api/config ### Response #### Success Response (200) - **mock** (boolean) - Whether mock mode is enabled. - **chat** (boolean) - Whether chat is enabled (presence of `LLM_API_KEY`). - **presenterUrl** (string) - The presenter URL. ### Response Example ```json { "mock": false, "chat": true, "presenterUrl": "https://example.com/presenter" } ``` ``` -------------------------------- ### GET /assets/avatars Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt Lists active avatars available to the authenticated organization. ```APIDOC ## GET /assets/avatars ### Description Lists active avatars available to the authenticated organization. ### Method GET ### Endpoint /assets/avatars ``` -------------------------------- ### GET /api/voices Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Lists available voices. Each item carries `languages` — the short codes (e.g., `en`, `ja`) the voice can speak. ```APIDOC ## [GET] /api/voices ### Description List voices. Each item carries `languages` — the short codes (`en`, `ja`, …) the voice can speak. ### Method GET ### Endpoint /api/voices ``` -------------------------------- ### GET /api/avatars/:id Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/sample-api-adapter.md Avatar detail (raw, includes lod_urls, lipsync_configs, etc.). ```APIDOC ## [GET] /api/avatars/:id ### Description Avatar detail (raw, includes `lod_urls`, `lipsync_configs`, etc.). ### Method GET ### Endpoint /api/avatars/:id ### Parameters #### Path Parameters - **id** (string) - Required - The avatar identifier. ### Response #### Success Response (200) - Raw avatar object including `lod_urls`, `lipsync_configs`, etc. ``` -------------------------------- ### GET /api/scenes Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt Lists scenes. Returns a paginated response with scene items, where the `id` is normalized from `scene_id`. ```APIDOC ## GET /api/scenes ### Description List scenes. Response: `Page { items: [{ id, name, … }] }`. (`id` normalized from `scene_id`.) ### Method GET ### Endpoint /api/scenes ### Response #### Success Response (200) - **items** (array) - List of scene objects. - **id** (string) - Scene identifier (normalized). - **name** (string) - Scene name. ### Response Example ```json { "items": [ { "id": "scene_1", "name": "Office" } ] } ``` ``` -------------------------------- ### Clone the sample repository Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/quickstart.md Clone the perxona-connect-kit repository and navigate to the Express sample directory. ```bash git clone https://github.com/XRSPACE-Inc/perxona-connect-kit.git cd perxona-connect-kit/samples/express ``` -------------------------------- ### GET /api/chatbots/:id Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/AGENTS.md Gets chatbot detail including tools. ```APIDOC ## [GET] /api/chatbots/:id ### Description Gets chatbot detail including tools. ### Method GET ### Endpoint /api/chatbots/:id ### Parameters #### Path Parameters - **id** (string) - Required - The chatbot ID. ``` -------------------------------- ### GET /api/voices Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt Lists voices. Returns a paginated response with voice items. ```APIDOC ## GET /api/voices ### Description List voices. Response: `Page { items: [{ id, name, … }] }`. ### Method GET ### Endpoint /api/voices ### Response #### Success Response (200) - **items** (array) - List of voice objects. - **id** (string) - Voice identifier. - **name** (string) - Voice name. ### Response Example ```json { "items": [ { "id": "voice_1", "name": "Default" } ] } ``` ``` -------------------------------- ### POST /api/v1/connect/presentation Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/AGENTS.md Direct Connect API endpoint for creating a presentation. The sample does not proxy this endpoint. Optional emotion and intensity fields guide facial-expression selection for suggested motions and soft-rank motion candidates. ```APIDOC ## [POST] /api/v1/connect/presentation ### Description Direct Connect API endpoint for creating a presentation. The sample does not proxy this endpoint. Optional emotion and intensity fields guide facial-expression selection for suggested motions and soft-rank motion candidates. ### Method POST ### Endpoint /api/v1/connect/presentation ### Parameters #### Request Body - **emotion** (string) - Optional - Guides facial-expression selection for suggested motions - **intensity** (string) - Optional - Accepted values: low, neutral, high. Use 'intensity', not 'intens'. ### Notes - When both emotion and intensity are omitted, no facial expression is attached. - Consult docs/openapi.yaml for accepted emotion values and complete schema. - Keep direct calls server-side so the secret key is not exposed in browser code. ``` -------------------------------- ### presenter.initializeWithConnectKey(connectKey, target) Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Boots the presenter by resolving the target (avatarId, sceneId, voiceId) and minting a speech token against the Connect API. Must be called after resumeAudioPlayback() and with a valid connect key. ```APIDOC ## presenter.initializeWithConnectKey(connectKey, target) ### Description Boots the presenter: resolves `target` (`{ avatarId, sceneId, voiceId }`) and mints its own speech token against the Connect API. Must be called after `resumeAudioPlayback()` and with a valid connect key. ### Parameters - **connectKey** (string) - Required - The publishable Connect key. - **target** (object) - Required - Target configuration with `avatarId`, `sceneId`, and optional `voiceId`. ### Response Resolves when initialization completes. Emits `PRESENTER_STATUS` events as it becomes Ready. ### Request Example ```js await presenter.initializeWithConnectKey(connect_key, { avatarId, sceneId, voiceId, // optional — omit to use presentWithAudio() instead of present() }); ``` ``` -------------------------------- ### GET /api/chatbots/:id Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt Get details of a specific chatbot by its ID. ```APIDOC ## GET /api/chatbots/:id ### Description Chatbot detail. ### Method GET ### Endpoint /api/chatbots/:id ### Parameters #### Path Parameters - **id** (string) - Required - The chatbot ID. ### Response #### Success Response (200) - **id** (string) - Chatbot ID. - **name** (string) - Chatbot name. - **custom_instructions** (string) - Custom instructions. - **status** (string) - Chatbot status. - **tools** (array) - List of tools. ``` -------------------------------- ### GET /assets/avatars/{avatar_id} Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt Reads avatar detail, including its runtime configuration. ```APIDOC ## GET /assets/avatars/{avatar_id} ### Description Reads avatar detail, including its runtime configuration. ### Method GET ### Endpoint /assets/avatars/{avatar_id} ### Parameters #### Path Parameters - **avatar_id** (string) - Required - The unique identifier of the avatar. ``` -------------------------------- ### GET /api/health Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Liveness and diagnostics endpoint. Probes the backend on each call and reports upstream reachability, including mock mode. ```APIDOC ## [GET] /api/health ### Description Liveness + diagnostics (`upstream` reachability; reads `mock` in mock mode). Probes the backend on each call. ### Method GET ### Endpoint /api/health ``` -------------------------------- ### GET /api/health Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/sample-api-adapter.md Liveness and upstream diagnostics. Always returns 200 with a status and upstream reachability indicator. ```APIDOC ## [GET] /api/health ### Description Liveness + upstream diagnostics. Always returns `200`. Probes the upstream API on every call. ### Method GET ### Endpoint /api/health ### Response #### Success Response (200) - **status** (string) - Always `"ok"`. - **upstream** (string) - `"reachable"` or `"unreachable"`. ### Response Example ```json { "status": "ok", "upstream": "reachable" } ``` ``` -------------------------------- ### GET /api/config Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/AGENTS.md Fetches the presenter configuration including the presenter URL, chatbot ID, and fixed target. Used by the demo applications to dynamically load the presenter script and configure the chat widget. ```APIDOC ## [GET] /api/config ### Description Fetches the presenter configuration including the presenter URL, chatbot ID, and fixed target. Used by the demo applications to dynamically load the presenter script and configure the chat widget. ### Method GET ### Endpoint /api/config ### Response #### Success Response (200) - **presenterUrl** (string) - URL of the presenter script to load - **chatbotId** (string) - ID of the chatbot to use - **fixedTarget** (string) - Fixed target for the conversation - **chat** (boolean) - Indicates whether the own-LLM source is enabled ``` -------------------------------- ### Initialize presenter with connect key and unlock audio Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Core initialization flow: unlock audio from user gesture, fetch publishable connect key, then initialize presenter with target. Must run after user gesture for autoplay policy. ```javascript // 1. Unlock audio from the user's launch-button click (autoplay policy). await presenter.resumeAudioPlayback(); // 2. Fetch the publishable Connect key this server holds for the browser. const { connect_key } = await api("/api/connect-key"); // 3. Initialize — the presenter resolves avatarId/sceneId/voiceId against the // Connect API itself and emits PRESENTER_STATUS as it becomes Ready. await presenter.initializeWithConnectKey(connect_key, { avatarId, sceneId, voiceId, // optional — omit to use presentWithAudio() instead of present() }); ``` -------------------------------- ### GET /v1/business-hours Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/public/demos/studio/docs/connect-chat-bot-function-tools.md Get the current business hours. Call this whenever the user asks when the store is open. ```APIDOC ## [GET] /v1/business-hours ### Description Get the current business hours. Call this whenever the user asks when the store is open. ### Method GET ### Endpoint https://api.example.com/v1/business-hours ### Parameters None ### Request Example ```jsonc { "name": "get_business_hours", "description": "Get the current business hours. Call this whenever the user asks when the store is open.", "settings": { "request": { "method": "get", "url": "https://api.example.com/v1/business-hours" } } } ``` ### Response No response schema provided. ``` -------------------------------- ### Example response for voice list Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/api-reference.md Shows the JSON structure returned by the voice list endpoint. The 'languages' array uses short codes (e.g., 'ja'), and an empty array means 'unknown', not 'supports nothing'. The response is one page; use 'page' and 'size' query parameters to paginate. ```json { "items": [ { "id": "8f14e45f-...", "name": "Sakura", "description": null, "languages": ["ja"], "provider": "azure" } ], "total": 1, "page": 1, "size": 50, "pages": 1 } ``` -------------------------------- ### GET /api/chatbots Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/AGENTS.md Lists all chatbots. ```APIDOC ## [GET] /api/chatbots ### Description Lists all chatbots. ### Method GET ### Endpoint /api/chatbots ``` -------------------------------- ### Initialize and present with Connect Kit Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/overview.md Use the `sv-presenter` element to initialize with a connect key and present a message. Requires `resumeAudioPlayback()` before initialization to satisfy browser autoplay policies. ```javascript // Presentation Engine — available now const presenter = document.querySelector("sv-presenter"); button.addEventListener("click", async () => { await presenter.resumeAudioPlayback(); await presenter.initializeWithConnectKey(connectKey, { avatarId, sceneId, voiceId }); presenter.present("Hello world! I'm Perxona agent and I can talk to you."); }); ``` -------------------------------- ### presenter.presentWithAudio(audio, content) Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Plays back a supplied speech audio buffer with the provided content as the transcript for the performance. ```APIDOC ## presenter.presentWithAudio(audio, content) ### Description Plays back a supplied speech audio buffer with `content` as the transcript for the performance. ### Parameters - **audio** (AudioBuffer) - Required - The speech audio buffer to play. - **content** (string) - Required - The transcript text for the performance. ### Response Resolves with a `PresentationResult` object. ``` -------------------------------- ### GET /chatbots/{chat_bot_id} Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/api-reference.md Read a chatbot's details. ```APIDOC ## GET /chatbots/{chat_bot_id} ### Description Read a chatbot's details. ### Method GET ### Endpoint `/chatbots/{chat_bot_id}` ### Parameters #### Path Parameters - **chat_bot_id** (string) - Required - The ID of the chatbot. ### Response #### Success Response (200) - (chatbot object) - The chatbot details. ``` -------------------------------- ### GET /assets/scenes/{scene_id} Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/api-reference.md Reads one scene's detail. ```APIDOC ## [GET] /assets/scenes/{scene_id} ### Description Reads one scene's detail. ### Method GET ### Endpoint /assets/scenes/{scene_id} ### Parameters #### Path Parameters - **scene_id** (string) - Required - The unique identifier of the scene ### Authentication Requires `X-Connect-Key` header. ``` -------------------------------- ### initializeWithConnectKey(connectKey, target) Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/sdk-reference.md Boots the presenter by resolving the target (avatarId/sceneId/voiceId) against the Connect API and minting a speech token. Returns a Promise that resolves when the presenter is ready. ```APIDOC ## initializeWithConnectKey(connectKey, target) ### Description Boots the presenter by resolving the target (avatarId/sceneId/voiceId) against the Connect API and minting a speech token. Returns a Promise that resolves when the presenter is ready. ### Method initializeWithConnectKey ### Parameters - **connectKey** (string) - Required - The publishable Connect API key. - **target** (object) - Required - An object containing `avatarId`, `sceneId`, and optionally `voiceId`. ### Response Returns a Promise that resolves when the presenter is ready. ``` -------------------------------- ### GET /assets/scenes Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/api-reference.md Lists active scenes available to the authenticated organization. ```APIDOC ## [GET] /assets/scenes ### Description Lists active scenes available to the authenticated organization. ### Method GET ### Endpoint /assets/scenes ### Authentication Requires `X-Connect-Key` header. ``` -------------------------------- ### GET /assets/avatars Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/api-reference.md Lists active avatars available to the authenticated organization. ```APIDOC ## [GET] /assets/avatars ### Description Lists active avatars available to the authenticated organization. ### Method GET ### Endpoint /assets/avatars ### Authentication Requires `X-Connect-Key` header. ``` -------------------------------- ### Fill in required environment variables Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/quickstart.md Set the three required values in .env. The secret key stays on the server; the publishable key is given to the browser. ```bash PERXONA_API_BASE_URL=https://console.perxona.ai/asia PERXONA_CONNECT_SECRET_KEY=pxc_... PERXONA_CONNECT_PUBLISHABLE_KEY=pxc_... ``` -------------------------------- ### GET + query params tool definition Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/public/demos/studio/docs/connect-chat-bot-function-tools.md Defines a tool that performs a GET request with query parameters. The query_params schema requires an email and includes an optional limit with a default of 10. Uses bearer token authentication and specifies a response body schema for orders. ```jsonc { "name": "search_orders", "description": "Search a customer's orders by email. Use when the user asks about their order status or history.", "settings": { "request": { "method": "get", "url": "https://api.example.com/v1/orders", "headers": { "X-Tenant-Id": "acme" }, "query_params": { "type": "object", "properties": { "email": { "type": "string", "description": "Customer email address", }, "limit": { "type": "integer", "description": "Max results, default 10", }, }, "required": ["email"], }, }, "auth": { "secret_type": "bearer_token", "bearer_token": "eyJhbGci..." }, "response": { "body_schema": { "type": "object", "properties": { "orders": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "status": { "type": "string" }, "total": { "type": "number" }, }, }, }, }, }, }, }, } ``` -------------------------------- ### Present speech and play motion after Ready Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md After PRESENTER_STATUS reports Ready, present speech and play a body motion independently. present() builds speech+motion internally; playMotion() does not affect speech queue. ```javascript const result = await presenter.present("Hello!"); // Play a body motion without waiting for or changing the speech queue. const motionResult = await presenter.playMotion("known-motion-id"); ``` -------------------------------- ### Full initialization flow with connect key and presentation Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/docs/en/sdk-reference.md Complete flow: fetch publishable key from backend, listen for status events, resume audio in a user gesture, initialize with connect key, present content, handle key rejection, and interrupt playback. `present()` never rejects; check `result.success`. A refused key has no retry. ```javascript // Your backend serves the publishable key. It never serves the secret one. const getConnectKeyFromYourBackend = async () => { const response = await fetch('/your-backend/connect-key'); return response.json(); }; // Listen for state changes before launching the component. presenter.addEventListener('PRESENTER_STATUS', (e) => { // e.detail.status: 'Uninitialized' | 'Initializing' | 'Ready' console.log('Presenter status:', e.detail.status); }); launchButton.addEventListener('click', async () => { // Must run inside a direct user gesture to unlock autoplay. await presenter.resumeAudioPlayback(); const { connectKey } = await getConnectKeyFromYourBackend(); await presenter.initializeWithConnectKey(connectKey, { avatarId: selectedAvatarId, sceneId: selectedSceneId, voiceId: selectedVoiceId, // optional }); // present() never rejects; inspect the returned result instead. const result = await presenter.present('Hello from Perxona!'); if (!result.success) console.warn(result.code, result.message); }); // A refused key has no refresh to fall back on: it is revoked, expired, // restricted to other domains, or was never granted the scope, and // presenting it again fails the same way. presenter.addEventListener('CONNECT_KEY_REJECTED', () => { console.error('Connect key rejected — reissue it in the console, then launch again.'); }); // Stop current playback and clear the queue when your UI needs it. presenter.interruptPresentation(); ``` -------------------------------- ### GET /api/voices Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/AGENTS.md Lists all voices from the Connect API, proxied through the server. Normalizes the `voice_id` field to `id`. ```APIDOC ## [GET] /api/voices ### Description Lists all voices from the Connect API, proxied through the server. Normalizes the `voice_id` field to `id`. ### Method GET ### Endpoint /api/voices ``` -------------------------------- ### File structure of the Studio demo Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/public/demos/studio/README.md Shows the layout of the demo directory, listing the main files and their roles. ```text demos/studio/ ├── index.html — page layout (sidebar + presenter stage + chat panel) ├── app.js — all client-side logic (CRUD, chat, presenter integration) ├── style.css — dark-theme styles scoped to this demo └── README.md — this file ``` -------------------------------- ### GET /api/avatars Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/AGENTS.md Lists all avatars from the Connect API, proxied through the server. Normalizes the `avatar_id` field to `id`. ```APIDOC ## [GET] /api/avatars ### Description Lists all avatars from the Connect API, proxied through the server. Normalizes the `avatar_id` field to `id`. ### Method GET ### Endpoint /api/avatars ``` -------------------------------- ### POST /presentation Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/llms-full.txt Generates a one-shot presentation payload. ```APIDOC ## POST /presentation ### Description Generates a one-shot presentation payload. ### Method POST ### Endpoint /presentation ### Parameters #### Request Body - **avatar_id** (string) - Required - The avatar ID to use. - **message** (string) - Required - The message to present. - **voice_id** (string) - Optional - The voice ID to use. - **emotion** (string) - Optional - The emotion to use. - **intensity** (number) - Optional - The intensity of the emotion. ``` -------------------------------- ### presenter.present(content) Source: https://github.com/xrspace-inc/perxona-connect-kit/blob/main/samples/express/README.md Synthesizes the provided content into speech and plays it back on the avatar. Builds the speech and motion performance internally via the Connect API. ```APIDOC ## presenter.present(content) ### Description Synthesizes `content` into speech and plays it back on the avatar. Builds the speech and motion performance internally via the Connect API. ### Parameters - **content** (string) - Required - The text to synthesize into speech. ### Response Resolves with a `PresentationResult` object. Never rejects; `success` is `false` with `code`/`message` on failure. ### Request Example ```js const result = await presenter.present("Hello!"); ``` ```