create-pyric 0.1.0-alpha.12 → 0.1.0-alpha.13

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pyric",
3
- "version": "0.1.0-alpha.12",
3
+ "version": "0.1.0-alpha.13",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://pyric.dev",
6
6
  "repository": {
@@ -12,9 +12,11 @@ VITE_FIREBASE_DATABASE_URL=
12
12
  # production FCM token registration; the dev sandbox mints tokens without it.
13
13
  VITE_FIREBASE_VAPID_KEY=
14
14
 
15
- # Optional local OpenAI-compatible model. Leave both unset to use Pyric's
16
- # built-in scripted AI. MiniMax example:
17
- # PYRIC_AI_PROXY_UPSTREAM=http://localhost:8080/v1
18
- # PYRIC_AI_MODEL=minimax-m2.7
19
- PYRIC_AI_PROXY_UPSTREAM=
15
+ # Optional local model. Setting this switches from Pyric's scripted AI to its
16
+ # OpenAI-compatible engine and supplies the model name sent upstream.
17
+ # The model-only path uses Ollama at http://localhost:11434/v1 by default.
18
+ # Example: ollama pull qwen3:4b
20
19
  PYRIC_AI_MODEL=
20
+ # Override only for another OpenAI-compatible model server. This is the
21
+ # server-side base URL, not the browser proxy path; include /v1 when required.
22
+ PYRIC_AI_PROXY_UPSTREAM=
@@ -13,16 +13,41 @@ npm run dev
13
13
  ```
14
14
 
15
15
  With no model configuration, Pyric's built-in scripted engine answers locally.
16
- To use MiniMax or another OpenAI-compatible server, copy `.env.example` to
17
- `.env.local` and set both:
16
+ To use Ollama, pull a model, copy `.env.example` to `.env.local`, and select it:
17
+
18
+ ```bash
19
+ ollama pull qwen3:4b
20
+ ```
21
+
22
+ ```dotenv
23
+ PYRIC_AI_MODEL=qwen3:4b
24
+ ```
25
+
26
+ Pyric forwards the unchanged `firebase/ai` calls to Ollama's default
27
+ OpenAI-compatible endpoint at `http://localhost:11434/v1`. For another model
28
+ server, also set its base URL (including `/v1` when required):
18
29
 
19
30
  ```dotenv
20
- PYRIC_AI_PROXY_UPSTREAM=http://localhost:8080/v1
21
31
  PYRIC_AI_MODEL=minimax-m2.7
32
+ PYRIC_AI_PROXY_UPSTREAM=http://localhost:8080/v1
22
33
  ```
23
34
 
24
- Start that server separately, then restart Vite. The scaffold deliberately does
25
- not assume an operating system or a particular model launcher.
35
+ Start the model server separately, then restart Vite.
36
+ See the [Pyric AI Logic guide](https://pyric.dev/docs/build/ai-logic/) for the full
37
+ engine and proxy behaviour.
38
+
39
+ For a one-off run on macOS, Linux, or another POSIX shell, prefix the same
40
+ command with the variables:
41
+
42
+ ```bash
43
+ PYRIC_AI_MODEL=qwen3:4b \
44
+ PYRIC_AI_PROXY_UPSTREAM=http://localhost:11434/v1 \
45
+ npm run dev
46
+ ```
47
+
48
+ Do not put `&&` before `npm run dev`: that makes the values unexported shell
49
+ variables instead of environment variables for Vite. Use `.env.local` for the
50
+ normal, persistent setup.
26
51
 
27
52
  ## What runs in the sandbox
28
53
 
@@ -38,6 +63,15 @@ The same bundled module service worker handles `onBackgroundMessage` in local
38
63
  development and production. Local delivery still requires an open page to keep
39
64
  the Pyric sandbox alive.
40
65
 
66
+ ## Runtime status
67
+
68
+ Pyric adds a collapsed runtime chip to the bottom-right corner during Vite
69
+ development. It signals sandbox errors and tells you when the long-lived worker
70
+ needs an update. Open it to copy an error, activate the new worker safely,
71
+ or open Pyric Studio in a new tab. Updating finishes accepted sandbox work and
72
+ then reloads every connected tab onto the new worker. The chip is not included
73
+ in a normal production build.
74
+
41
75
  ## Test and build
42
76
 
43
77
  ```bash
@@ -24,7 +24,7 @@ export const onPresenceOnline = onValueCreated('/presence/{uid}', async (event)
24
24
  const profile = getFirestore().collection('users').doc(uid);
25
25
  const snapshot = await profile.get();
26
26
  const now = FieldValue.serverTimestamp();
27
- const seen = snapshot.exists && snapshot.get('firstSeenAt')
27
+ const seen = snapshot.exists && snapshot.data()?.firstSeenAt
28
28
  ? { lastSeenAt: now }
29
29
  : { firstSeenAt: now, lastSeenAt: now };
30
30
  await profile.set(seen, { merge: true });
@@ -1,4 +1,4 @@
1
- import { defineConfig, loadEnv } from 'vite';
1
+ import { defineConfig } from 'vite';
2
2
  import react from '@vitejs/plugin-react';
3
3
  import tailwindcss from '@tailwindcss/vite';
4
4
  import { pyric } from '@pyric/cli/vite';
@@ -11,44 +11,11 @@ import path from 'node:path';
11
11
  // self-contained sandbox preview you can serve under `pyric dev`, build with a
12
12
  // non-production mode: `vite build --mode development` (see the `build:sandbox`
13
13
  // script). That output is marked and can never be deployed.
14
- export default defineConfig(({ mode }) => {
15
- const env = loadEnv(mode, process.cwd(), '');
16
- const proxyUpstream = env.PYRIC_AI_PROXY_UPSTREAM;
17
- const model = env.PYRIC_AI_MODEL;
18
- if (Boolean(proxyUpstream) !== Boolean(model)) {
19
- throw new Error(
20
- 'PyChat local AI configuration requires both PYRIC_AI_PROXY_UPSTREAM and PYRIC_AI_MODEL.',
21
- );
22
- }
23
-
24
- return {
25
- plugins: [
26
- react(),
27
- tailwindcss(),
28
- pyric({
29
- bridge: true,
30
- // The authored 2+modules source is the source of truth; the plugin
31
- // resolves it in-memory, so no vendored firestore.rules is needed in
32
- // dev. `npm run rules:resolve` still generates it for Firebase deploy.
33
- rules: 'firestore.modules.rules',
34
- ...(proxyUpstream && model
35
- ? {
36
- ai: {
37
- proxyUpstream,
38
- engine: {
39
- kind: 'openai' as const,
40
- model,
41
- modelMap: { 'gemini-2.5-flash': model },
42
- },
43
- },
44
- }
45
- : {}),
46
- }),
47
- ],
48
- resolve: {
49
- alias: {
50
- '@': path.resolve(__dirname, './src'),
51
- },
14
+ export default defineConfig({
15
+ plugins: [react(), tailwindcss(), pyric()],
16
+ resolve: {
17
+ alias: {
18
+ '@': path.resolve(__dirname, './src'),
52
19
  },
53
- };
20
+ },
54
21
  });