# This service runs on Turn Zero Cloud The service in this folder is hosted on Turn Zero Cloud. It started from the platform's `server-ai-chat` template: a Node.js service with a web page and sign-in for its users. The page keeps a conversation with an AI model called through the platform's AI route. Calls draw the account's balance, with no key of your own. This file describes the template the service started from: keep it current as the service changes. ## Where you build Sign-up is open, and each signed-in person’s questions use the owner’s account balance for AI. To make new sign-ups invitation-only, set `audience` in `manifest.json` to `{"kind":"invited"}`. - The page: `client/`, plain HTML, CSS, and script, which the platform serves at the application's address. It keeps the conversation for the page's life and posts its turns with each message. - The routes: `src/server.mjs`. The service started with one route under `/api/`, `POST /api/ask`, which reads the signed-in user and answers the conversation's next turn. - The AI model: `src/ai.mjs`, which calls the platform's AI route with the conversation's most recent turns. Calls draw the account's balance, with no key of your own. ## Where the rules are Your AI coding tool reads Turn Zero Cloud's rules through the `turnzero` MCP server. That connection gives the tool access to the products on your account. Read the current rules there because they change with the platform. - Where the server is not connected, set up Turn Zero Cloud first: https://turnzero.ai/cloud/getting-started/set-up/ - Before you change or deploy this service, read the server's `deploy` skill, and before you change its sign-in or its AI call, the server's `add-sign-in` or `use-ai-generation` skill. ## What you run here - The tests: `npm test`, in this folder. - A local run and a deploy: the `deploy` skill gives each step and the line to run, in this order: `tzcloud_submit_manifest`, the local run, `tzcloud_deploy_command`. - To sign in during a local run, start it with `--sign-in` and the application's hostname. Open the local address that the command prints. The command forwards sign-in requests to that hostname. Without `--sign-in`, use the deployed application's address to sign in. The local page has no sign-in routes. Send the session token in the `Authorization: Bearer ` header to the local API.