create-spatius-app 0.1.3-beta.1 → 0.1.3-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +11 -10
  2. package/dist/cli.js +87 -162
  3. package/dist/templates.js +71 -154
  4. package/package.json +2 -2
  5. package/templates/cloudflare-livekit/AGENTS.md +2 -0
  6. package/templates/cloudflare-livekit/agent/README.md +13 -0
  7. package/templates/cloudflare-livekit/agent/pyproject.toml +1 -1
  8. package/templates/cloudflare-livekit/agent/src/agent.py +2 -1
  9. package/templates/cloudflare-livekit/agent/tests/test_agent_startup.py +49 -0
  10. package/templates/cloudflare-livekit/agent/uv.lock +14 -14
  11. package/templates/cloudflare-livekit/gitignore +1 -0
  12. package/templates/cloudflare-livekit/package-lock.json +177 -16
  13. package/templates/cloudflare-livekit/package.json +8 -7
  14. package/templates/cloudflare-livekit/pnpm-lock.yaml +104 -24
  15. package/templates/cloudflare-livekit/tests/dev-fixtures.mjs +7 -2
  16. package/templates/cloudflare-livekit/tests/dev-supervision.test.mjs +17 -14
  17. package/templates/layers/agora/AGENTS.md +9 -4
  18. package/templates/layers/agora/README.md +14 -8
  19. package/templates/layers/agora/package-lock.json +1344 -424
  20. package/templates/layers/agora/package.json +17 -11
  21. package/templates/layers/agora/pnpm-lock.yaml +1069 -237
  22. package/templates/layers/agora/scripts/check-worker.mjs +98 -0
  23. package/templates/layers/agora/tsconfig.worker.json +23 -0
  24. package/templates/layers/agora/worker/agora.test.ts +2 -0
  25. package/templates/layers/agora/worker/agora.ts +1 -10
  26. package/templates/layers/agora/worker/index.test.ts +66 -0
  27. package/templates/layers/agora/worker/index.ts +4 -0
  28. package/templates/layers/agora/wrangler.jsonc +24 -0
  29. package/templates/cloudflare-livekit/worker-configuration.d.ts +0 -17184
  30. package/templates/layers/agora/tsconfig.json +0 -16
  31. package/templates/layers/node/Dockerfile +0 -12
  32. package/templates/layers/node/dockerignore +0 -10
  33. package/templates/layers/node/package-lock.json +0 -5569
  34. package/templates/layers/node/pnpm-lock.yaml +0 -3470
  35. package/templates/layers/node/railway.json +0 -8
  36. package/templates/layers/node/scripts/dev-service.mjs +0 -14
  37. package/templates/layers/node/scripts/dev-web.mjs +0 -22
  38. package/templates/layers/node/server/index.ts +0 -92
  39. package/templates/layers/node/vite.config.ts +0 -17
  40. package/templates/layers/railway-agent/agent/railway.json +0 -5
  41. /package/templates/layers/agora/{env.example → dev.vars.example} +0 -0
@@ -95,20 +95,24 @@ async function supervise(f, extraEnv) {
95
95
  return { child, done };
96
96
  }
97
97
 
98
- for (const [name, side, code] of [
98
+ for (const [name, side, code, probe] of [
99
99
  ['web exits zero', 'web', '0'],
100
100
  ['web fails', 'web', '7'],
101
101
  ['agent exits zero', 'agent', '0'],
102
102
  ['agent fails', 'agent', '29'],
103
+ ['web exits zero after a timed-out CLI probe', 'web', '0', 'version-hang'],
103
104
  ]) {
104
105
  test(
105
106
  `root dev supervisor: ${name} stops its sibling and all grandchildren`,
106
107
  { timeout: 15000 },
107
108
  async (t) => {
108
- const f = await fixture(t);
109
+ // Windows has only a preflight python.exe stub. Use the runnable uv shim
110
+ // so a slow CLI probe can fall back without exiting before registration.
111
+ const f = await fixture(t, { uv: windows || Boolean(probe) });
109
112
  const run = await supervise(f, {
110
113
  DEV_TEST_RUNTIME_HOLD: '1',
111
114
  DEV_TEST_GRANDCHILD: '1',
115
+ ...(probe ? { DEV_TEST_PROBE: probe } : {}),
112
116
  ...(side === 'web'
113
117
  ? { DEV_TEST_WEB_EXIT: code }
114
118
  : { DEV_TEST_EXIT_WHEN_RELEASED: '1', DEV_TEST_RUNTIME_EXIT: code }),
@@ -130,15 +134,14 @@ for (const [name, side, code] of [
130
134
  await assertStopped(events.map(({ pid }) => pid));
131
135
  // A bounded CLI probe may select Python fallback on a busy machine.
132
136
  // Supervision must launch exactly one runtime through either supported path.
133
- assert.equal(
134
- (await readEvents(f.events)).filter(
135
- ({ role, args, type }) =>
136
- ['lk', 'uv', 'python'].includes(role) &&
137
- type === 'invoked' &&
138
- args.includes('src/agent.py'),
139
- ).length,
140
- 1,
137
+ const runtimes = (await readEvents(f.events)).filter(
138
+ ({ role, args, type }) =>
139
+ ['lk', 'uv', 'python'].includes(role) &&
140
+ type === 'invoked' &&
141
+ args.includes('src/agent.py'),
141
142
  );
143
+ assert.equal(runtimes.length, 1);
144
+ if (probe) assert.equal(runtimes[0].role, 'uv');
142
145
  },
143
146
  );
144
147
  }
@@ -152,7 +155,7 @@ test(
152
155
  'Node cannot send console Ctrl+C events on Windows; taskkill tree cleanup is tested separately.',
153
156
  },
154
157
  async (t) => {
155
- const f = await fixture(t);
158
+ const f = await fixture(t, { uv: windows });
156
159
  const run = await supervise(f, {
157
160
  DEV_TEST_RUNTIME_HOLD: '1',
158
161
  DEV_TEST_GRANDCHILD: '1',
@@ -252,7 +255,7 @@ test(
252
255
  'agent failure before registration never starts web',
253
256
  { timeout: 15000 },
254
257
  async (t) => {
255
- const f = await fixture(t);
258
+ const f = await fixture(t, { uv: windows });
256
259
  const run = await supervise(f, { DEV_TEST_RUNTIME_EXIT: '29' });
257
260
  const result = await run.done;
258
261
  assert.notEqual(result.code, 0);
@@ -265,7 +268,7 @@ test(
265
268
  'registration timeout stops the agent without starting web',
266
269
  { timeout: 15000 },
267
270
  async (t) => {
268
- const f = await fixture(t);
271
+ const f = await fixture(t, { uv: windows });
269
272
  // Accelerate only the copied fixture's deadline; exercise the real web gate.
270
273
  const path = join(f.root, 'scripts', 'wait-for-agent.mjs');
271
274
  await writeFile(
@@ -290,7 +293,7 @@ test(
290
293
  'Ctrl+C while waiting for registration stops the agent without starting web',
291
294
  { timeout: 15000, skip: windows },
292
295
  async (t) => {
293
- const f = await fixture(t);
296
+ const f = await fixture(t, { uv: windows });
294
297
  const run = await supervise(f, {
295
298
  DEV_TEST_RUNTIME_HOLD: '1',
296
299
  DEV_TEST_REGISTER: join(f.root, 'never-register'),
@@ -1,8 +1,13 @@
1
1
  # Generated Agora application
2
2
 
3
3
  Use `__DEV__` for local development and `__CHECK__` for verification.
4
- The Node backend calls hosted Conversational AI over HTTP; do not add a Python
5
- worker. Browser audio uses Agora RTC, text input and transcripts use the official
4
+ The Cloudflare Worker API calls hosted Conversational AI over HTTP. Agora owns
5
+ the conversational agent; this application has no Python worker or Node server.
6
+ Browser audio uses Agora RTC, and text input and transcripts use the official
6
7
  Agora client toolkit. Spatius renders the avatar locally.
7
- Keep secrets in .env.local or deployment environment variables. Preserve session
8
- cleanup on disconnect and failed startup. See DEPLOYMENT.md for Zeabur setup.
8
+
9
+ Keep secrets in `.dev.vars` locally and Cloudflare Worker secrets in production.
10
+ Wrangler generates the ignored `worker-configuration.d.ts` during installation
11
+ and before lint, type checking, and builds. Update `wrangler.jsonc` to change bindings.
12
+ Preserve session cleanup on disconnect and failed startup.
13
+ Use mocks for provider calls in tests. See DEPLOYMENT.md for Cloudflare setup.
@@ -1,6 +1,9 @@
1
- # Spatius voice assistant — Zeabur + Agora
1
+ # Spatius voice assistant — Cloudflare + Agora
2
+
3
+ A minimal React avatar conversation with a Cloudflare Worker API and Agora
4
+ Conversational AI. The frontend and API deploy together on Cloudflare Workers;
5
+ Agora hosts the conversational agent.
2
6
 
3
- A minimal React avatar conversation with an HTTP backend and Agora Conversational AI.
4
7
  Requires Node.js 22.12+, an Agora project with Conversational AI and RTM enabled,
5
8
  a published English assistant pipeline, and Spatius credentials. No Python is needed.
6
9
 
@@ -10,10 +13,13 @@ npx create-spatius-app setup . --interactive
10
13
  __DEV__
11
14
  ```
12
15
 
13
- Open the Vite URL, start a conversation, and speak or type. Microphone permission
14
- is optional: typed messages go to the model through Agora RTM. The transcript
15
- stays visible after disconnecting. Configure the assistant persona, speech
16
- recognition language, model, and voice in the published Agora pipeline. Match
17
- AGORA_AVATAR_SAMPLE_RATE to that pipeline's TTS output.
16
+ Local setup saves credentials in `.dev.vars`. The Vite Cloudflare plugin runs
17
+ both the frontend and Worker API locally. Open the printed URL, start a
18
+ conversation, and speak or type. Microphone permission is optional: typed
19
+ messages use Agora RTM. The transcript stays visible after disconnecting.
20
+
21
+ Configure the assistant persona, speech recognition language, model, and voice
22
+ in the published Agora pipeline. Match `AGORA_AVATAR_SAMPLE_RATE` to its TTS output.
18
23
 
19
- See DEPLOYMENT.md to deploy the frontend and API together to Zeabur.
24
+ Run `__CHECK__` to verify the application. See [DEPLOYMENT.md](DEPLOYMENT.md)
25
+ to deploy the frontend and API together to Cloudflare Workers.