@pyric/cli 0.1.0-alpha.18 → 0.1.0-alpha.20
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/README.md +14 -9
- package/dist/bridge/server/mcp-contract.d.ts +2 -2
- package/dist/bridge/server/mcp-contract.d.ts.map +1 -1
- package/dist/bridge/server/mcp-contract.js +3 -0
- package/dist/bridge/server/mcp-contract.js.map +1 -1
- package/dist/cli/index.d.ts +3 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +51 -42
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp-proxy.d.ts.map +1 -1
- package/dist/cli/mcp-proxy.js +3 -3
- package/dist/cli/mcp-proxy.js.map +1 -1
- package/dist/cli/parse-args.d.ts +1 -1
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +51 -15
- package/dist/cli/parse-args.js.map +1 -1
- package/dist/cli/pyric-config.d.ts +24 -0
- package/dist/cli/pyric-config.d.ts.map +1 -0
- package/dist/cli/pyric-config.js +28 -0
- package/dist/cli/pyric-config.js.map +1 -0
- package/dist/cli/rules.d.ts +1 -0
- package/dist/cli/rules.d.ts.map +1 -1
- package/dist/cli/rules.js +18 -4
- package/dist/cli/rules.js.map +1 -1
- package/dist/cli/{dev-runner.d.ts → sandbox-runner.d.ts} +33 -36
- package/dist/cli/sandbox-runner.d.ts.map +1 -0
- package/dist/cli/{dev-runner.js → sandbox-runner.js} +90 -55
- package/dist/cli/sandbox-runner.js.map +1 -0
- package/dist/cli/serve.d.ts +6 -4
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +99 -40
- package/dist/cli/serve.js.map +1 -1
- package/dist/cli/service-command-records/storage-rules-resolve.d.ts +4 -0
- package/dist/cli/service-command-records/storage-rules-resolve.d.ts.map +1 -0
- package/dist/cli/service-command-records/storage-rules-resolve.js +3 -0
- package/dist/cli/service-command-records/storage-rules-resolve.js.map +1 -0
- package/dist/cli/service-commands.generated.d.ts +3 -0
- package/dist/cli/service-commands.generated.d.ts.map +1 -1
- package/dist/cli/service-commands.generated.js +2 -0
- package/dist/cli/service-commands.generated.js.map +1 -1
- package/dist/cli/snapshot.js +5 -5
- package/dist/cli/snapshot.js.map +1 -1
- package/dist/cli/verify.js +1 -1
- package/dist/cli/verify.js.map +1 -1
- package/dist/functions-rtdb/development-runtime.js +1 -1
- package/dist/functions-rtdb/development-runtime.js.map +1 -1
- package/dist/functions-rtdb/project.js +8 -8
- package/dist/functions-rtdb/project.js.map +1 -1
- package/dist/next/guard.js +1 -1
- package/dist/next/guard.js.map +1 -1
- package/dist/remote/index.d.ts +1 -1
- package/dist/remote/index.js +9 -9
- package/dist/remote/index.js.map +1 -1
- package/dist/serve/bundler.js +10 -10
- package/dist/serve/bundler.js.map +1 -1
- package/dist/serve/entries/ai.d.ts.map +1 -1
- package/dist/serve/entries/ai.js +27 -1
- package/dist/serve/entries/ai.js.map +1 -1
- package/dist/serve/entries/auth-helper-dom.js +1 -1
- package/dist/serve/entries/auth-helper-dom.js.map +1 -1
- package/dist/serve/entries/auth-helper-runtime.js +1 -1
- package/dist/serve/entries/auth-helper-runtime.js.map +1 -1
- package/dist/serve/entries/firestore.js +3 -3
- package/dist/serve/entries/firestore.js.map +1 -1
- package/dist/serve/entries/keepalive.js +1 -1
- package/dist/serve/entries/keepalive.js.map +1 -1
- package/dist/serve/entries/runtime.js +21 -14
- package/dist/serve/entries/runtime.js.map +1 -1
- package/dist/serve/entries/storage.js +1 -1
- package/dist/serve/entries/storage.js.map +1 -1
- package/dist/serve/entries/worker-runtime.js +1 -1
- package/dist/serve/entries/worker-runtime.js.map +1 -1
- package/dist/serve/init-payload.d.ts +4 -0
- package/dist/serve/init-payload.d.ts.map +1 -1
- package/dist/serve/namespace.d.ts +6 -0
- package/dist/serve/namespace.d.ts.map +1 -1
- package/dist/serve/namespace.js +36 -5
- package/dist/serve/namespace.js.map +1 -1
- package/dist/serve/rules.d.ts +3 -3
- package/dist/serve/rules.d.ts.map +1 -1
- package/dist/serve/rules.js +56 -25
- package/dist/serve/rules.js.map +1 -1
- package/dist/serve/runtime/chip.d.ts.map +1 -1
- package/dist/serve/runtime/chip.js +32 -1
- package/dist/serve/runtime/chip.js.map +1 -1
- package/dist/serve/runtime/manifest.d.ts +1 -1
- package/dist/serve/runtime/manifest.d.ts.map +1 -1
- package/dist/serve/runtime/manifest.js +1 -1
- package/dist/serve/runtime/manifest.js.map +1 -1
- package/dist/serve/runtime/status.d.ts.map +1 -1
- package/dist/serve/runtime/status.js +23 -0
- package/dist/serve/runtime/status.js.map +1 -1
- package/dist/serve/sandbox-session.d.ts +1 -0
- package/dist/serve/sandbox-session.d.ts.map +1 -1
- package/dist/serve/sandbox-session.js +10 -4
- package/dist/serve/sandbox-session.js.map +1 -1
- package/dist/serve/server.d.ts +7 -0
- package/dist/serve/server.d.ts.map +1 -1
- package/dist/serve/server.js +15 -1
- package/dist/serve/server.js.map +1 -1
- package/dist/serve/site-ui/404.html +1 -1
- package/dist/serve/site-ui/_astro/{RulesCodeEditor.CzwHdCi9.js → RulesCodeEditor.XtDmHOlN.js} +1 -1
- package/dist/serve/site-ui/_astro/_example_.B9DG9HLJ.css +1 -0
- package/dist/serve/site-ui/_astro/_slug_.Da5VLhW1.css +1 -0
- package/dist/serve/site-ui/_astro/_studio_.BnfYCKoI.css +1 -0
- package/dist/serve/site-ui/_astro/app.B52xr-DK.js +1 -0
- package/dist/serve/site-ui/_astro/app.DWBraPUw.js +12 -0
- package/dist/serve/site-ui/_astro/app.pMSnN6Qw.css +1 -0
- package/dist/serve/site-ui/_astro/chess-showcase.B72XYeoh.js +354 -0
- package/dist/serve/site-ui/_astro/{example-runtime.B0byNQOl.js → example-runtime.C25_lx6Z.js} +2 -26
- package/dist/serve/site-ui/_astro/index.Tb-31efc.css +1 -0
- package/dist/serve/site-ui/_astro/index.UkCBr-_0.css +1 -0
- package/dist/serve/site-ui/_astro/sandbox-controls.DEpnKg-O.js +1169 -0
- package/dist/serve/site-ui/_astro/seed.Co0yUJY5.js +20 -0
- package/dist/serve/site-ui/_astro/writes.rpjrFzmu.js +102 -0
- package/dist/serve/site-ui/auth/index.html +5 -3
- package/dist/serve/site-ui/david-east.jpg +0 -0
- package/dist/serve/site-ui/docs/_rhythm/index.html +6 -3
- package/dist/serve/site-ui/docs/_rhythm.md +1 -1
- package/dist/serve/site-ui/docs/agent/set-up-your-agent/index.html +45 -17
- package/dist/serve/site-ui/docs/agent/set-up-your-agent.md +20 -17
- package/dist/serve/site-ui/docs/agent/watch-and-review/index.html +6 -5
- package/dist/serve/site-ui/docs/agent/watch-and-review.md +1 -5
- package/dist/serve/site-ui/docs/agent/work-with-an-agent/index.html +8 -5
- package/dist/serve/site-ui/docs/agent/work-with-an-agent.md +4 -4
- package/dist/serve/site-ui/docs/ai-compat/index.html +5 -2
- package/dist/serve/site-ui/docs/api-reference/index.html +6 -2
- package/dist/serve/site-ui/docs/api-reference.md +1 -0
- package/dist/serve/site-ui/docs/app-compat/index.html +5 -2
- package/dist/serve/site-ui/docs/auth-compat/index.html +5 -2
- package/dist/serve/site-ui/docs/build/ai-logic/index.html +5 -2
- package/dist/serve/site-ui/docs/build/authentication/index.html +7 -4
- package/dist/serve/site-ui/docs/build/authentication.md +2 -2
- package/dist/serve/site-ui/docs/build/cloud-firestore/index.html +34 -53
- package/dist/serve/site-ui/docs/build/cloud-firestore.md +40 -36
- package/dist/serve/site-ui/docs/build/cloud-messaging/index.html +5 -2
- package/dist/serve/site-ui/docs/build/cloud-storage/index.html +6 -3
- package/dist/serve/site-ui/docs/build/cloud-storage.md +1 -1
- package/dist/serve/site-ui/docs/build/realtime-database/index.html +9 -6
- package/dist/serve/site-ui/docs/build/realtime-database.md +4 -4
- package/dist/serve/site-ui/docs/conformance-scores/index.html +5 -2
- package/dist/serve/site-ui/docs/create-pyric-reference-api/index.html +6 -3
- package/dist/serve/site-ui/docs/create-pyric-reference-api.md +1 -1
- package/dist/serve/site-ui/docs/database-compat/index.html +5 -2
- package/dist/serve/site-ui/docs/examples/chess/index.html +649 -250
- package/dist/serve/site-ui/docs/examples/chess.md +45 -16
- package/dist/serve/site-ui/docs/examples/index.html +6 -3
- package/dist/serve/site-ui/docs/firestore-compat/index.html +5 -2
- package/dist/serve/site-ui/docs/functions-rtdb-compat/index.html +5 -2
- package/dist/serve/site-ui/docs/get-started/how-the-swap-works/index.html +9 -6
- package/dist/serve/site-ui/docs/get-started/how-the-swap-works.md +5 -5
- package/dist/serve/site-ui/docs/get-started/nextjs/index.html +9 -6
- package/dist/serve/site-ui/docs/get-started/nextjs.md +4 -4
- package/dist/serve/site-ui/docs/get-started/start-building/index.html +41 -10
- package/dist/serve/site-ui/docs/get-started/start-building.md +21 -10
- package/dist/serve/site-ui/docs/get-started/vite/index.html +6 -3
- package/dist/serve/site-ui/docs/get-started/vite.md +1 -1
- package/dist/serve/site-ui/docs/index.json +203 -168
- package/dist/serve/site-ui/docs/messaging-compat/index.html +5 -2
- package/dist/serve/site-ui/docs/observe/resolve-runtime-status/index.html +5 -2
- package/dist/serve/site-ui/docs/observe/see-whats-happening/index.html +6 -4
- package/dist/serve/site-ui/docs/observe/see-whats-happening.md +2 -4
- package/dist/serve/site-ui/docs/observe/shape-your-data/index.html +9 -6
- package/dist/serve/site-ui/docs/observe/shape-your-data.md +4 -4
- package/dist/serve/site-ui/docs/overview/index.html +16 -10
- package/dist/serve/site-ui/docs/overview.md +19 -11
- package/dist/serve/site-ui/docs/pyric-admin-app-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-admin-auth-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-admin-database-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-admin-firestore-reference-api/index.html +8 -5
- package/dist/serve/site-ui/docs/pyric-admin-firestore-reference-api.md +3 -3
- package/dist/serve/site-ui/docs/pyric-admin-messaging-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-admin-reference-api/index.html +501 -0
- package/dist/serve/site-ui/docs/pyric-admin-reference-api.md +587 -0
- package/dist/serve/site-ui/docs/pyric-admin-storage-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ai-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ai-scripting-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-app-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-auth-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-assurance-browser-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-assurance-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-bridge-client-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-bridge-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-conformance-browser-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-conformance-docs-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-conformance-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-credentials-node-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-discover-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-next-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-register-app-bridge-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-register-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-remote-reference-api/index.html +6 -3
- package/dist/serve/site-ui/docs/pyric-cli-remote-reference-api.md +1 -1
- package/dist/serve/site-ui/docs/pyric-cli-serve-worker-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-verify-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-vite-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-database-reference-api/index.html +166 -95
- package/dist/serve/site-ui/docs/pyric-database-reference-api.md +107 -1
- package/dist/serve/site-ui/docs/pyric-firestore-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-messaging-reference-api/index.html +10 -4
- package/dist/serve/site-ui/docs/pyric-messaging-reference-api.md +5 -2
- package/dist/serve/site-ui/docs/pyric-messaging-sw-reference-api/index.html +10 -4
- package/dist/serve/site-ui/docs/pyric-messaging-sw-reference-api.md +5 -2
- package/dist/serve/site-ui/docs/pyric-rules-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-sandbox-database-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-sandbox-firestore-reference-api/index.html +6 -3
- package/dist/serve/site-ui/docs/pyric-sandbox-firestore-reference-api.md +2 -2
- package/dist/serve/site-ui/docs/pyric-sandbox-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-storage-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-agents-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-auth-hooks-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-auth-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-events-hooks-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-events-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-firestore-hooks-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-firestore-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-primitives-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-rtdb-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-rules-hooks-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-rules-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-storage-hooks-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-storage-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-traffic-hooks-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-ui-traffic-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/reference/cli/index.html +153 -0
- package/dist/serve/site-ui/docs/reference/cli.md +114 -0
- package/dist/serve/site-ui/docs/rules-compat/index.html +5 -2
- package/dist/serve/site-ui/docs/secure/audit-your-rules/index.html +5 -2
- package/dist/serve/site-ui/docs/secure/firestore-rules-limits/index.html +5 -2
- package/dist/serve/site-ui/docs/secure/read-a-denial/index.html +6 -3
- package/dist/serve/site-ui/docs/secure/read-a-denial.md +1 -1
- package/dist/serve/site-ui/docs/secure/rtdb-rules-in-typescript/index.html +5 -2
- package/dist/serve/site-ui/docs/secure/rules-standard-library/index.html +5 -2
- package/dist/serve/site-ui/docs/secure/secure-it-with-rules/index.html +5 -2
- package/dist/serve/site-ui/docs/secure/simulate-and-lint/index.html +5 -2
- package/dist/serve/site-ui/docs/secure/write-a-rules-test-suite/index.html +5 -2
- package/dist/serve/site-ui/docs/ship/ship-to-production/index.html +7 -4
- package/dist/serve/site-ui/docs/ship/ship-to-production.md +2 -2
- package/dist/serve/site-ui/docs/ship/test-in-node/index.html +9 -6
- package/dist/serve/site-ui/docs/ship/test-in-node.md +4 -4
- package/dist/serve/site-ui/docs/storage-compat/index.html +5 -2
- package/dist/serve/site-ui/docs/trust/how-we-know-it-matches-firebase/index.html +5 -2
- package/dist/serve/site-ui/docs/trust/rules-standard-library/index.html +5 -2
- package/dist/serve/site-ui/docs/trust/versioning-and-compatibility/index.html +5 -2
- package/dist/serve/site-ui/docs/tutorial/index.html +10 -7
- package/dist/serve/site-ui/docs/tutorial.md +4 -4
- package/dist/serve/site-ui/examples/chess/index.html +4 -2
- package/dist/serve/site-ui/firestore/index.html +5 -3
- package/dist/serve/site-ui/hero-charcoal.jpg +0 -0
- package/dist/serve/site-ui/index.html +9 -7
- package/dist/serve/site-ui/llms.txt +4 -3
- package/dist/serve/site-ui/pyric-campfire-full.png +0 -0
- package/dist/serve/site-ui/pyric-campfire.png +0 -0
- package/dist/serve/site-ui/rtdb/index.html +5 -3
- package/dist/serve/site-ui/settings/index.html +5 -3
- package/dist/serve/site-ui/storage/index.html +5 -3
- package/dist/serve/site-ui/studio/index.html +13 -0
- package/dist/serve/site-ui/studio-routes.json +1 -1
- package/dist/serve/site-ui/traffic/index.html +5 -3
- package/dist/serve/studio/routes.d.ts +9 -0
- package/dist/serve/studio/routes.d.ts.map +1 -1
- package/dist/serve/studio/routes.js +47 -7
- package/dist/serve/studio/routes.js.map +1 -1
- package/dist/serve/vite-ai-config.d.ts.map +1 -1
- package/dist/serve/vite-ai-config.js +38 -8
- package/dist/serve/vite-ai-config.js.map +1 -1
- package/dist/serve/vite-module-swap.d.ts.map +1 -1
- package/dist/serve/vite-module-swap.js +0 -28
- package/dist/serve/vite-module-swap.js.map +1 -1
- package/dist/serve/vite-rules-source.d.ts.map +1 -1
- package/dist/serve/vite-rules-source.js +28 -7
- package/dist/serve/vite-rules-source.js.map +1 -1
- package/dist/serve/vite-sandbox-generation.d.ts +1 -1
- package/dist/serve/vite-sandbox-generation.d.ts.map +1 -1
- package/dist/serve/vite-sandbox-generation.js +1 -1
- package/dist/serve/vite-sandbox-generation.js.map +1 -1
- package/dist/serve/worker/client/disconnect.js +1 -1
- package/dist/serve/worker/client/disconnect.js.map +1 -1
- package/dist/serve/worker/client/presence.d.ts.map +1 -1
- package/dist/serve/worker/client/presence.js +18 -5
- package/dist/serve/worker/client/presence.js.map +1 -1
- package/dist/serve/worker/host-ai.d.ts.map +1 -1
- package/dist/serve/worker/host-ai.js +15 -0
- package/dist/serve/worker/host-ai.js.map +1 -1
- package/dist/serve/worker/protocol.d.ts +4 -0
- package/dist/serve/worker/protocol.d.ts.map +1 -1
- package/dist/serve/worker/protocol.js.map +1 -1
- package/dist/serve/worker/serve-init.d.ts.map +1 -1
- package/dist/serve/worker/serve-init.js +7 -1
- package/dist/serve/worker/serve-init.js.map +1 -1
- package/package.json +5 -5
- package/src/bridge/server/mcp-contract.ts +3 -0
- package/src/cli/cli.test.ts +2 -2
- package/src/cli/index.ts +51 -42
- package/src/cli/mcp-proxy.ts +10 -11
- package/src/cli/parse-args.ts +61 -15
- package/src/cli/pyric-config.ts +45 -0
- package/src/cli/rules.ts +31 -4
- package/src/cli/{dev-runner.ts → sandbox-runner.ts} +117 -72
- package/src/cli/serve.ts +115 -47
- package/src/cli/service-command-records/storage-rules-resolve.ts +4 -0
- package/src/cli/service-commands.generated.ts +2 -0
- package/src/cli/snapshot.ts +5 -5
- package/src/cli/verify.ts +1 -1
- package/src/functions-rtdb/development-runtime.ts +1 -1
- package/src/functions-rtdb/project.ts +8 -8
- package/src/next/guard.ts +1 -1
- package/src/remote/index.ts +9 -9
- package/src/serve/bundler.ts +10 -10
- package/src/serve/entries/ai.ts +27 -1
- package/src/serve/entries/auth-helper-dom.ts +1 -1
- package/src/serve/entries/auth-helper-runtime.ts +1 -1
- package/src/serve/entries/firestore.ts +3 -3
- package/src/serve/entries/keepalive.ts +1 -1
- package/src/serve/entries/runtime.ts +19 -14
- package/src/serve/entries/storage.ts +1 -1
- package/src/serve/entries/worker-runtime.ts +1 -1
- package/src/serve/init-payload.ts +4 -0
- package/src/serve/namespace.ts +44 -5
- package/src/serve/rules.ts +61 -26
- package/src/serve/runtime/chip.ts +38 -1
- package/src/serve/runtime/manifest.ts +1 -1
- package/src/serve/runtime/status.ts +24 -0
- package/src/serve/sandbox-session.ts +10 -4
- package/src/serve/server.ts +18 -1
- package/src/serve/studio/routes.ts +63 -7
- package/src/serve/vite-ai-config.ts +37 -7
- package/src/serve/vite-module-swap.ts +0 -28
- package/src/serve/vite-rules-source.ts +29 -7
- package/src/serve/vite-sandbox-generation.ts +1 -1
- package/src/serve/worker/client/disconnect.ts +1 -1
- package/src/serve/worker/client/presence.ts +25 -5
- package/src/serve/worker/host-ai.ts +15 -0
- package/src/serve/worker/protocol.ts +2 -1
- package/src/serve/worker/serve-init.ts +5 -1
- package/README.md.orig +0 -141
- package/dist/cli/dev-runner.d.ts.map +0 -1
- package/dist/cli/dev-runner.js.map +0 -1
- package/dist/serve/site-ui/_astro/_example_.jevZ7OdV.css +0 -1
- package/dist/serve/site-ui/_astro/_slug_.C6QfVOxJ.css +0 -1
- package/dist/serve/site-ui/_astro/_slug_.CXh9yTP1.css +0 -1
- package/dist/serve/site-ui/_astro/_studio_.B6b_G1ev.css +0 -1
- package/dist/serve/site-ui/_astro/app.B7pBzz5N.js +0 -11
- package/dist/serve/site-ui/_astro/app.BsFsMjn0.css +0 -1
- package/dist/serve/site-ui/_astro/app.boex5SnQ.js +0 -1
- package/dist/serve/site-ui/_astro/chess-showcase.DDqE-QGe.js +0 -1
- package/dist/serve/site-ui/_astro/chess-source-explorer.C5k9c5yK.js +0 -1
- package/dist/serve/site-ui/_astro/chess-v2.CFHmd3UL.js +0 -354
- package/dist/serve/site-ui/_astro/index.uwPvjH_1.js +0 -1
- package/dist/serve/site-ui/_astro/jsx-runtime.D_zvdyIk.js +0 -9
- package/dist/serve/site-ui/_astro/reads.Dh3z0fJy.js +0 -1
- package/dist/serve/site-ui/_astro/sandbox-controls.C2IqtoSw.js +0 -1252
- package/dist/serve/site-ui/_astro/seed.CCmj00su.js +0 -20
- package/dist/serve/site-ui/docs/trust/storage-rules-stdlib-research/index.html +0 -582
- package/dist/serve/site-ui/docs/trust/storage-rules-stdlib-research.md +0 -448
- package/dist/serve/site-ui/examples/firestore-first-write/index.html +0 -2
|
@@ -10,6 +10,7 @@ import firestoreRulesResolve from './service-command-records/firestore-rules-res
|
|
|
10
10
|
import firestoreRulesSimulate from './service-command-records/firestore-rules-simulate.js';
|
|
11
11
|
import firestoreRulesValidate from './service-command-records/firestore-rules-validate.js';
|
|
12
12
|
import storageRulesLint from './service-command-records/storage-rules-lint.js';
|
|
13
|
+
import storageRulesResolve from './service-command-records/storage-rules-resolve.js';
|
|
13
14
|
import storageRulesSimulate from './service-command-records/storage-rules-simulate.js';
|
|
14
15
|
|
|
15
16
|
export const SERVICE_COMMANDS = [
|
|
@@ -23,5 +24,6 @@ export const SERVICE_COMMANDS = [
|
|
|
23
24
|
{ path: ["firestore","rules","simulate"], run: firestoreRulesSimulate },
|
|
24
25
|
{ path: ["firestore","rules","validate"], run: firestoreRulesValidate },
|
|
25
26
|
{ path: ["storage","rules","lint"], run: storageRulesLint },
|
|
27
|
+
{ path: ["storage","rules","resolve"], run: storageRulesResolve },
|
|
26
28
|
{ path: ["storage","rules","simulate"], run: storageRulesSimulate },
|
|
27
29
|
] as const satisfies readonly ServiceCommand[];
|
package/src/cli/snapshot.ts
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* pyric snapshot [--out FILE] [--port N] [--force] [--json]
|
|
7
7
|
*
|
|
8
8
|
* Source preference:
|
|
9
|
-
* 1.
|
|
9
|
+
* 1. Live state from a running `pyric sandbox --persist`
|
|
10
10
|
* (`GET /__pyric/state` — `--port`, else the 3473+ scan window),
|
|
11
11
|
* 2. else the on-disk `.pyric/state/state.json`,
|
|
12
12
|
* 3. else exit 2 with a clear message.
|
|
13
13
|
*
|
|
14
14
|
* The output is a `PyricStateFile` envelope — directly re-servable:
|
|
15
|
-
* `pyric
|
|
15
|
+
* `pyric sandbox --seed <out>` (the state-file shape is detected by its
|
|
16
16
|
* `version` key and seeds docs + users).
|
|
17
17
|
*/
|
|
18
18
|
import { existsSync, writeFileSync } from 'node:fs';
|
|
@@ -44,7 +44,7 @@ async function fetchLive(port: number): Promise<LiveState | null> {
|
|
|
44
44
|
if (!body || typeof body !== 'object' || !('version' in body)) return null;
|
|
45
45
|
return { envelope: body, projectDir: res.headers.get('x-pyric-project-dir') };
|
|
46
46
|
} catch {
|
|
47
|
-
return null; //
|
|
47
|
+
return null; // No Pyric sandbox is listening. Fall through.
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -110,7 +110,7 @@ export async function runSnapshot(parsed: ParsedArgs, deps: SnapshotDeps = {}):
|
|
|
110
110
|
}
|
|
111
111
|
if (!envelope) {
|
|
112
112
|
err.write(
|
|
113
|
-
'pyric snapshot: no state found
|
|
113
|
+
'pyric snapshot: no state found. No `pyric sandbox --persist` is running here and ' +
|
|
114
114
|
'no .pyric/state/state.json exists. Run with --persist (and use the app) first.\n',
|
|
115
115
|
);
|
|
116
116
|
return 2;
|
|
@@ -158,7 +158,7 @@ export async function runSnapshot(parsed: ParsedArgs, deps: SnapshotDeps = {}):
|
|
|
158
158
|
if (redactedCount > 0) {
|
|
159
159
|
report.write(` ⓘ redacted ${redactedCount} password(s) — re-run with --include-passwords to keep them\n`);
|
|
160
160
|
}
|
|
161
|
-
report.write(` Re-serve it: pyric
|
|
161
|
+
report.write(` Re-serve it: pyric sandbox --seed ${typeof outFlag === 'string' ? outFlag : 'pyric-state.json'}\n`);
|
|
162
162
|
if (json) out.write(JSON.stringify({ out: outPath, docs, users, source, redactedPasswords: redactedCount }) + '\n');
|
|
163
163
|
return 0;
|
|
164
164
|
}
|
package/src/cli/verify.ts
CHANGED
|
@@ -108,7 +108,7 @@ export async function runVerify(parsed: ParsedArgs, deps: VerifyCliDeps = {}): P
|
|
|
108
108
|
} else {
|
|
109
109
|
process.stderr.write(
|
|
110
110
|
`pyric verify: no captured session at ${SERVE_CAPTURE_PATH}.\n` +
|
|
111
|
-
' Run `pyric
|
|
111
|
+
' Run `pyric sandbox`, exercise your app, then `pyric verify`, or pass a fixture path.\n',
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
114
|
return 2;
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type FunctionsRtdbChildReady,
|
|
7
7
|
type SpawnFunctionsRtdbChildOptions,
|
|
8
8
|
} from './child.js';
|
|
9
|
-
import { buildChildEnv, createLinePrefixer } from '../cli/
|
|
9
|
+
import { buildChildEnv, createLinePrefixer } from '../cli/sandbox-runner.js';
|
|
10
10
|
|
|
11
11
|
const INITIAL_PEER_TIMEOUT_MS = 30_000;
|
|
12
12
|
const RELOAD_PEER_TIMEOUT_MS = 5_000;
|
|
@@ -22,7 +22,7 @@ export function discoverFunctionsRtdbProject(cwd: string): FunctionsRtdbProject
|
|
|
22
22
|
config = JSON.parse(readFileSync(firebaseJsonPath, 'utf8')) as FirebaseJson;
|
|
23
23
|
} catch (error) {
|
|
24
24
|
throw new Error(
|
|
25
|
-
`pyric
|
|
25
|
+
`pyric sandbox: failed to parse firebase.json while discovering Functions: ` +
|
|
26
26
|
`${error instanceof Error ? error.message : String(error)}`,
|
|
27
27
|
);
|
|
28
28
|
}
|
|
@@ -33,23 +33,23 @@ export function discoverFunctionsRtdbProject(cwd: string): FunctionsRtdbProject
|
|
|
33
33
|
: [config.functions as FunctionsConfig];
|
|
34
34
|
if (declared.length !== 1) {
|
|
35
35
|
throw new Error(
|
|
36
|
-
'pyric
|
|
36
|
+
'pyric sandbox: multiple Functions codebases are not supported by the first ' +
|
|
37
37
|
'onValueCreated slice; configure one source for this development session.',
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
const functions = declared[0];
|
|
41
41
|
if (typeof functions !== 'object' || functions === null) {
|
|
42
|
-
throw new Error('pyric
|
|
42
|
+
throw new Error('pyric sandbox: firebase.json `functions` must be an object with a source.');
|
|
43
43
|
}
|
|
44
44
|
if (functions.source !== undefined && typeof functions.source !== 'string') {
|
|
45
|
-
throw new Error('pyric
|
|
45
|
+
throw new Error('pyric sandbox: firebase.json `functions.source` must be a string.');
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
const sourceDir = resolve(cwd, functions.source ?? 'functions');
|
|
49
49
|
const packageJsonPath = join(sourceDir, 'package.json');
|
|
50
50
|
if (!existsSync(packageJsonPath)) {
|
|
51
51
|
throw new Error(
|
|
52
|
-
`pyric
|
|
52
|
+
`pyric sandbox: Functions source is declared but ${packageJsonPath} does not exist.`,
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -58,17 +58,17 @@ export function discoverFunctionsRtdbProject(cwd: string): FunctionsRtdbProject
|
|
|
58
58
|
packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as { main?: unknown };
|
|
59
59
|
} catch (error) {
|
|
60
60
|
throw new Error(
|
|
61
|
-
`pyric
|
|
61
|
+
`pyric sandbox: failed to parse ${packageJsonPath}: ` +
|
|
62
62
|
`${error instanceof Error ? error.message : String(error)}`,
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
65
|
if (packageJson.main !== undefined && typeof packageJson.main !== 'string') {
|
|
66
|
-
throw new Error(`pyric
|
|
66
|
+
throw new Error(`pyric sandbox: ${packageJsonPath} \`main\` must be a string.`);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
const entry = resolve(sourceDir, packageJson.main ?? 'index.js');
|
|
70
70
|
if (!existsSync(entry) || !statSync(entry).isFile()) {
|
|
71
|
-
throw new Error(`pyric
|
|
71
|
+
throw new Error(`pyric sandbox: Functions entry does not exist: ${entry}`);
|
|
72
72
|
}
|
|
73
73
|
return { sourceDir, entry };
|
|
74
74
|
}
|
package/src/next/guard.ts
CHANGED
|
@@ -54,7 +54,7 @@ export function enforceSandboxGuard(options?: PyricNextOptions): void {
|
|
|
54
54
|
const errorMessage =
|
|
55
55
|
'[Pyric] Next.js development server started without active Pyric sandbox environment variables.\n' +
|
|
56
56
|
'To prevent accidental connections to production Firebase databases, launch this server using:\n' +
|
|
57
|
-
' pyric
|
|
57
|
+
' pyric sandbox -- next dev\n' +
|
|
58
58
|
'or source environment keys via `pyric env`.\n' +
|
|
59
59
|
'To disable this guard, pass { guard: false } to withPyric(config, options).';
|
|
60
60
|
throw new Error(errorMessage);
|
package/src/remote/index.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Server-side Node code (ultimately `pyric-admin`'s remote dispatch arm)
|
|
6
6
|
* reaches the ONE sandbox the app + Studio + agent share:
|
|
7
7
|
*
|
|
8
|
-
* Node process
|
|
8
|
+
* Node process -> `pyric sandbox --bridge` -> browser tab
|
|
9
9
|
* (attach/consumer leg) (peer leg)
|
|
10
10
|
* ──MessagePort──> SharedWorker
|
|
11
11
|
*
|
|
@@ -320,7 +320,7 @@ export function createRemoteSandboxCore(
|
|
|
320
320
|
reject(
|
|
321
321
|
remoteError(
|
|
322
322
|
'deadline-exceeded',
|
|
323
|
-
`remote sandbox op timed out after ${opTimeoutMs}ms (op: ${payload.method})
|
|
323
|
+
`remote sandbox op timed out after ${opTimeoutMs}ms (op: ${payload.method}). Is pyric sandbox still running?` +
|
|
324
324
|
// A version-skewed old worker accepts frames it cannot
|
|
325
325
|
// handle and never responds — a timeout is its signature.
|
|
326
326
|
(versionSkewGuidance ? ` ${versionSkewGuidance}` : ''),
|
|
@@ -379,8 +379,8 @@ export function createRemoteSandboxCore(
|
|
|
379
379
|
msg.serveVersion !== cliVersion()
|
|
380
380
|
) {
|
|
381
381
|
versionSkewGuidance =
|
|
382
|
-
`pyric
|
|
383
|
-
`${cliVersion()}
|
|
382
|
+
`pyric sandbox is running version ${msg.serveVersion}, this client is ` +
|
|
383
|
+
`${cliVersion()}. Restart pyric sandbox and reload the browser tab.`;
|
|
384
384
|
process.stderr.write(`pyric: ${versionSkewGuidance}\n`);
|
|
385
385
|
}
|
|
386
386
|
if (msg.peerConnected) readyResolve();
|
|
@@ -405,7 +405,7 @@ export function createRemoteSandboxCore(
|
|
|
405
405
|
// Version skew: a live tab whose SharedWorker predates this op.
|
|
406
406
|
// Other open pages of this origin keep the old worker alive.
|
|
407
407
|
message +=
|
|
408
|
-
'
|
|
408
|
+
'. The running sandbox may predate this feature. Restart pyric sandbox ' +
|
|
409
409
|
'and close other open pages of this origin, then reload.';
|
|
410
410
|
}
|
|
411
411
|
call.reject(remoteError(code, message, msg.error?.denialContext, (msg.error as any)?.envelope));
|
|
@@ -721,7 +721,7 @@ export function createRemoteSandboxHandle(opts: {
|
|
|
721
721
|
enablePersistence: () =>
|
|
722
722
|
throwMember(
|
|
723
723
|
'enablePersistence',
|
|
724
|
-
'the browser worker owns persistence; it is already enabled by `pyric
|
|
724
|
+
'the browser worker owns persistence; it is already enabled by `pyric sandbox`',
|
|
725
725
|
),
|
|
726
726
|
flush: () =>
|
|
727
727
|
throwMember('flush()', 'the browser worker owns persistence and flushes itself'),
|
|
@@ -742,7 +742,7 @@ export function createRemoteSandboxHandle(opts: {
|
|
|
742
742
|
// ─── connect ───────────────────────────────────────────────────────────────
|
|
743
743
|
|
|
744
744
|
/**
|
|
745
|
-
* Discover the running `pyric
|
|
745
|
+
* Discover the running `pyric sandbox --bridge`, attach to its bridge WS as a
|
|
746
746
|
* worker-relay CONSUMER (never a peer — attaching cannot kick the browser
|
|
747
747
|
* tab out of last-connection-wins), and return the typed remote handle.
|
|
748
748
|
*
|
|
@@ -770,7 +770,7 @@ export async function connectRemoteSandbox(
|
|
|
770
770
|
if (!found) {
|
|
771
771
|
throw remoteError(
|
|
772
772
|
'not-found',
|
|
773
|
-
'no running `pyric
|
|
773
|
+
'no running `pyric sandbox --bridge` found (looked for .pyric/serve.json in ' +
|
|
774
774
|
`${cwd} and the default ports) — start your dev server with the bridge enabled and retry.`,
|
|
775
775
|
);
|
|
776
776
|
}
|
|
@@ -953,7 +953,7 @@ export function createLazyRemoteSandbox(
|
|
|
953
953
|
// Before discovery the URL is unknown; op-level errors always carry the
|
|
954
954
|
// real URL (they come from the inner connect), and `serveUrl` is patched
|
|
955
955
|
// to the discovered value as soon as the first connect succeeds.
|
|
956
|
-
serveUrl: options.url?.replace(/\/$/, '') ?? '<pyric
|
|
956
|
+
serveUrl: options.url?.replace(/\/$/, '') ?? '<pyric sandbox url (pending discovery)>',
|
|
957
957
|
close() {
|
|
958
958
|
if (closed) return;
|
|
959
959
|
closed = true;
|
package/src/serve/bundler.ts
CHANGED
|
@@ -52,7 +52,7 @@ export function defaultSdkEntries(): Record<string, string> {
|
|
|
52
52
|
if (existsSync(js)) return js;
|
|
53
53
|
const ts = join(here, 'entries', `${name}.ts`);
|
|
54
54
|
if (existsSync(ts)) return ts;
|
|
55
|
-
throw new Error(`pyric
|
|
55
|
+
throw new Error(`pyric sandbox: missing SDK entry '${name}' next to ${here}`);
|
|
56
56
|
};
|
|
57
57
|
return {
|
|
58
58
|
ai: pick('ai'),
|
|
@@ -94,7 +94,7 @@ export function pyricPackageRoot(): string {
|
|
|
94
94
|
}
|
|
95
95
|
const pkg = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8')) as { name?: string };
|
|
96
96
|
if (pkg.name !== 'pyric') {
|
|
97
|
-
throw new Error(`pyric
|
|
97
|
+
throw new Error(`pyric sandbox: expected to resolve the pyric package, found '${pkg.name}' at ${dir}`);
|
|
98
98
|
}
|
|
99
99
|
return dir;
|
|
100
100
|
}
|
|
@@ -131,7 +131,7 @@ export const NODE_BUILTIN_RE = /^(node:)?(url|fs|path)$/;
|
|
|
131
131
|
* through its own resolveId/load + optimizeDeps esbuild pass, instead of
|
|
132
132
|
* re-deriving them. */
|
|
133
133
|
export const NODE_BUILTIN_SHIMS: Record<string, string> = {
|
|
134
|
-
fs: `const no = () => { throw new Error('pyric
|
|
134
|
+
fs: `const no = () => { throw new Error('pyric sandbox: fs is not available in the browser'); };
|
|
135
135
|
export const readFileSync = no; export const existsSync = () => false;
|
|
136
136
|
export const readdirSync = no; export const writeFileSync = no; export const mkdirSync = no;
|
|
137
137
|
export default { readFileSync, existsSync, readdirSync, writeFileSync, mkdirSync };`,
|
|
@@ -315,13 +315,13 @@ export async function bundleSdk(opts: BundleOptions): Promise<BundleResult> {
|
|
|
315
315
|
// self-identify as the sandbox shim, not the real Firebase SDK.
|
|
316
316
|
chunkNames: 'pyric-sandbox-[hash]',
|
|
317
317
|
banner: {
|
|
318
|
-
js: '/* pyric
|
|
318
|
+
js: '/* pyric sandbox shim serving firebase/*. This is not the real Firebase SDK. */',
|
|
319
319
|
},
|
|
320
320
|
plugins: [pyricResolvePlugin(), nodeShimPlugin()],
|
|
321
321
|
});
|
|
322
322
|
if (result.errors.length > 0) {
|
|
323
323
|
throw new Error(
|
|
324
|
-
`pyric
|
|
324
|
+
`pyric sandbox: SDK bundle failed:\n${result.errors.map((e) => e.text).join('\n')}`,
|
|
325
325
|
);
|
|
326
326
|
}
|
|
327
327
|
writeFileSync(join(outDir, '.complete'), new Date().toISOString());
|
|
@@ -348,7 +348,7 @@ export function workerEntryPath(): string {
|
|
|
348
348
|
if (existsSync(js)) return js;
|
|
349
349
|
const ts = join(here, 'worker', 'entry.ts');
|
|
350
350
|
if (existsSync(ts)) return ts;
|
|
351
|
-
throw new Error(`pyric
|
|
351
|
+
throw new Error(`pyric sandbox: missing SharedWorker entry next to ${here}`);
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
export interface WorkerBundleOptions {
|
|
@@ -371,7 +371,7 @@ const WORKER_EPOCH_FILE = '.worker-epoch';
|
|
|
371
371
|
function readWorkerBundleEpoch(outDir: string): string {
|
|
372
372
|
const epoch = readFileSync(join(outDir, WORKER_EPOCH_FILE), 'utf8').trim();
|
|
373
373
|
if (!/^[a-f0-9]{16}$/.test(epoch)) {
|
|
374
|
-
throw new Error(`pyric
|
|
374
|
+
throw new Error(`pyric sandbox: invalid SharedWorker epoch in ${join(outDir, WORKER_EPOCH_FILE)}`);
|
|
375
375
|
}
|
|
376
376
|
return epoch;
|
|
377
377
|
}
|
|
@@ -479,18 +479,18 @@ export async function bundleWorker(opts: WorkerBundleOptions): Promise<WorkerBun
|
|
|
479
479
|
// with the resulting epoch (same width, so the sourcemap stays aligned).
|
|
480
480
|
define: { __PYRIC_WORKER_VERSION__: JSON.stringify(WORKER_EPOCH_PLACEHOLDER) },
|
|
481
481
|
banner: {
|
|
482
|
-
js: '/* pyric
|
|
482
|
+
js: '/* pyric sandbox SharedWorker host serving firebase/*. This is not the real Firebase SDK. */',
|
|
483
483
|
},
|
|
484
484
|
plugins: [pyricResolvePlugin(), nodeShimPlugin()],
|
|
485
485
|
});
|
|
486
486
|
if (result.errors.length > 0) {
|
|
487
487
|
throw new Error(
|
|
488
|
-
`pyric
|
|
488
|
+
`pyric sandbox: SharedWorker bundle failed:\n${result.errors.map((e) => e.text).join('\n')}`,
|
|
489
489
|
);
|
|
490
490
|
}
|
|
491
491
|
const canonicalSource = readFileSync(outFile, 'utf8');
|
|
492
492
|
if (!canonicalSource.includes(WORKER_EPOCH_PLACEHOLDER)) {
|
|
493
|
-
throw new Error('pyric
|
|
493
|
+
throw new Error('pyric sandbox: SharedWorker bundle omitted its epoch placeholder');
|
|
494
494
|
}
|
|
495
495
|
const epochHash = createHash('sha256').update(canonicalSource);
|
|
496
496
|
if (opts.epochSalt) epochHash.update('\0').update(opts.epochSalt);
|
package/src/serve/entries/ai.ts
CHANGED
|
@@ -105,6 +105,16 @@ function toEngineWire(engine: EngineOption | undefined): AiEngineConfigWire | un
|
|
|
105
105
|
...(openai.modelMap !== undefined ? { modelMap: openai.modelMap } : {}),
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
+
if (config.kind === 'gemini') {
|
|
109
|
+
const gemini = config as Extract<EngineOption, { kind: 'gemini' }>;
|
|
110
|
+
const hasBaseUrl = gemini.baseUrl !== undefined;
|
|
111
|
+
const hasApiKey = gemini.apiKey !== undefined;
|
|
112
|
+
return {
|
|
113
|
+
kind: 'gemini',
|
|
114
|
+
...(hasBaseUrl ? { baseUrl: gemini.baseUrl } : {}),
|
|
115
|
+
...(hasApiKey ? { apiKey: gemini.apiKey } : {}),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
108
118
|
const scripted = config as Extract<EngineOption, { kind: 'scripted' }>;
|
|
109
119
|
return {
|
|
110
120
|
kind: 'scripted',
|
|
@@ -139,6 +149,21 @@ function wireToEngineOption(wire: AiEngineConfigWire): EngineOption {
|
|
|
139
149
|
...(wire.modelMap !== undefined ? { modelMap: wire.modelMap } : {}),
|
|
140
150
|
} as EngineOption;
|
|
141
151
|
}
|
|
152
|
+
const isGeminiWire = wire.kind === 'gemini';
|
|
153
|
+
if (isGeminiWire) {
|
|
154
|
+
const result: Record<string, unknown> = {
|
|
155
|
+
kind: 'gemini',
|
|
156
|
+
};
|
|
157
|
+
const hasBaseUrl = wire.baseUrl !== undefined;
|
|
158
|
+
if (hasBaseUrl) {
|
|
159
|
+
result.baseUrl = wire.baseUrl;
|
|
160
|
+
}
|
|
161
|
+
const hasApiKey = wire.apiKey !== undefined;
|
|
162
|
+
if (hasApiKey) {
|
|
163
|
+
result.apiKey = wire.apiKey;
|
|
164
|
+
}
|
|
165
|
+
return result as unknown as EngineOption;
|
|
166
|
+
}
|
|
142
167
|
return {
|
|
143
168
|
kind: 'scripted',
|
|
144
169
|
...(wire.script !== undefined
|
|
@@ -274,10 +299,11 @@ export const getAI = (
|
|
|
274
299
|
"Use a structured { kind: 'scripted' } or { kind: 'openai' } engine config.",
|
|
275
300
|
);
|
|
276
301
|
}
|
|
302
|
+
const wire = toEngineWire(engine) ?? pluginEngineWire();
|
|
277
303
|
return createTransportAI(
|
|
278
304
|
resolved,
|
|
279
305
|
options,
|
|
280
|
-
portEngine(workerClientForApp(resolved),
|
|
306
|
+
portEngine(workerClientForApp(resolved), wire),
|
|
281
307
|
assertAlive,
|
|
282
308
|
);
|
|
283
309
|
}
|
|
@@ -67,7 +67,7 @@ export function mountAuthHelperDialog(helper: ServeAuthHelper): void {
|
|
|
67
67
|
h2.textContent = `Sign in with ${provider}`;
|
|
68
68
|
const p = document.createElement('p');
|
|
69
69
|
p.textContent =
|
|
70
|
-
'pyric
|
|
70
|
+
'pyric sandbox sign-in helper. Pick a test account or add one. Custom claims let rules using request.auth.token.* run against this identity.';
|
|
71
71
|
dialog.append(h2, p);
|
|
72
72
|
|
|
73
73
|
if (snap.identities.length > 0) {
|
|
@@ -13,7 +13,7 @@ export function resolveServeAuthFlow(
|
|
|
13
13
|
): Promise<UserCredential> {
|
|
14
14
|
if (!resolver) {
|
|
15
15
|
return Promise.reject(
|
|
16
|
-
new Error('pyric
|
|
16
|
+
new Error('pyric sandbox provider helper is not initialized; load /__pyric/sdk/init.js first'),
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
return kind === 'popup' ? resolver.openPopup(request) : resolver.openRedirect(request);
|
|
@@ -103,8 +103,8 @@ function acceptedNoOp(name: string): void {
|
|
|
103
103
|
if (cacheNoticeShown) return;
|
|
104
104
|
cacheNoticeShown = true;
|
|
105
105
|
console.info(
|
|
106
|
-
`[pyric
|
|
107
|
-
'
|
|
106
|
+
`[pyric sandbox] ${name}(): client cache and persistence settings are accepted but unused. ` +
|
|
107
|
+
'The Pyric sandbox is the source of truth. Durable state is the worker store or `pyric sandbox --persist`.',
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -184,7 +184,7 @@ export async function enableNetwork(_db?: unknown): Promise<void> {
|
|
|
184
184
|
export async function terminate(db?: unknown): Promise<void> {
|
|
185
185
|
if (useWorker) {
|
|
186
186
|
console.info(
|
|
187
|
-
'[pyric
|
|
187
|
+
'[pyric sandbox] terminate(): the SharedWorker-hosted sandbox is shared across every tab; ' +
|
|
188
188
|
'it is not torn down by a single tab calling terminate().',
|
|
189
189
|
);
|
|
190
190
|
return;
|
|
@@ -27,7 +27,7 @@ export function keepaliveSafe(
|
|
|
27
27
|
if (!warnedLargeState) {
|
|
28
28
|
warnedLargeState = true;
|
|
29
29
|
warn(
|
|
30
|
-
`[pyric
|
|
30
|
+
`[pyric sandbox] persisted state is ${Math.round(bytes / 1024)}KB. It is too large for an ` +
|
|
31
31
|
'unload-time flush; the final unsaved change may be lost if you CLOSE the tab before ' +
|
|
32
32
|
'the next auto-flush. Reloads and normal saves are unaffected.',
|
|
33
33
|
);
|
|
@@ -140,10 +140,15 @@ if (!useWorker) try {
|
|
|
140
140
|
diagnostics.rulesDeployed = true;
|
|
141
141
|
diagnostics.rulesHash = payload.rulesHash;
|
|
142
142
|
}
|
|
143
|
+
const db = getDatabase(sandbox);
|
|
143
144
|
if (payload.databaseRules) {
|
|
144
|
-
rtdbSandbox.setRules(
|
|
145
|
+
rtdbSandbox.setRules(db, payload.databaseRules);
|
|
145
146
|
diagnostics.databaseRulesDeployed = true;
|
|
146
147
|
diagnostics.databaseRulesHash = payload.databaseRulesHash ?? null;
|
|
148
|
+
} else if (payload.permissive) {
|
|
149
|
+
rtdbSandbox.setDefaultPolicy(db, 'allow');
|
|
150
|
+
} else {
|
|
151
|
+
rtdbSandbox.setDefaultPolicy(db, 'deny');
|
|
147
152
|
}
|
|
148
153
|
// Open the ONE per-sandbox storage service eagerly: the FIRST open wins the
|
|
149
154
|
// rules AND the project-scoped IDB name (`pyric-storage:<projectKey>`,
|
|
@@ -212,7 +217,7 @@ if (!useWorker) try {
|
|
|
212
217
|
readOnly = true;
|
|
213
218
|
diagnostics.persistReadOnly = true;
|
|
214
219
|
console.warn(
|
|
215
|
-
'[pyric
|
|
220
|
+
'[pyric sandbox] another tab is the persist writer. This tab is read-only ' +
|
|
216
221
|
'(your changes here will NOT be saved). Close the other tab and reload to take over.',
|
|
217
222
|
);
|
|
218
223
|
};
|
|
@@ -288,7 +293,7 @@ if (!useWorker) try {
|
|
|
288
293
|
if (res.status === 423) lostWriterLock();
|
|
289
294
|
else if (res.ok) diagnostics.lastFlushAt = Date.now();
|
|
290
295
|
},
|
|
291
|
-
(e) => console.warn('[pyric
|
|
296
|
+
(e) => console.warn('[pyric sandbox] auth state flush failed:', e),
|
|
292
297
|
);
|
|
293
298
|
}, 500);
|
|
294
299
|
});
|
|
@@ -353,7 +358,7 @@ if (!useWorker) try {
|
|
|
353
358
|
if (existing) {
|
|
354
359
|
diagnostics.seedSkipped = true;
|
|
355
360
|
console.info(
|
|
356
|
-
'[pyric
|
|
361
|
+
'[pyric sandbox] --seed skipped because the sandbox already has restored data. The fixture would ' +
|
|
357
362
|
'have overwritten it. Use `--persist --fresh` to discard existing state and re-seed.',
|
|
358
363
|
);
|
|
359
364
|
} else {
|
|
@@ -367,7 +372,7 @@ if (!useWorker) try {
|
|
|
367
372
|
diagnostics.initError = e instanceof Error ? e.message : String(e);
|
|
368
373
|
runtimeStatus.reportError(e, 'runtime');
|
|
369
374
|
console.error(
|
|
370
|
-
'[pyric
|
|
375
|
+
'[pyric sandbox] init failed. The sandbox is running without your project rules:',
|
|
371
376
|
diagnostics.initError,
|
|
372
377
|
);
|
|
373
378
|
}
|
|
@@ -390,7 +395,7 @@ if (!useWorker && activityTokenFromPayload) {
|
|
|
390
395
|
// Source says `firebase/*`; what runs is the pyric sandbox — say so loudly
|
|
391
396
|
// once, and explain any stack frame that points into /__pyric/sdk/. ────────
|
|
392
397
|
console.info(
|
|
393
|
-
`[pyric
|
|
398
|
+
`[pyric sandbox] firebase/* on this page is served by the Pyric sandbox` +
|
|
394
399
|
(useWorker
|
|
395
400
|
? ' in a SharedWorker (one backend for all tabs; rules/seed/persist owned by the worker)'
|
|
396
401
|
: diagnostics.rulesHash || diagnostics.databaseRulesHash || diagnostics.storageRulesHash
|
|
@@ -405,7 +410,7 @@ function explainSandboxFrame(stackOrUrl: string | undefined): boolean {
|
|
|
405
410
|
if (!provenanceHintShown) {
|
|
406
411
|
provenanceHintShown = true;
|
|
407
412
|
console.info(
|
|
408
|
-
'[pyric
|
|
413
|
+
'[pyric sandbox] the error above originates in the Pyric sandbox shim serving firebase/*, ' +
|
|
409
414
|
'not the real Firebase SDK — behavior can differ where COMPAT coverage is incomplete.',
|
|
410
415
|
);
|
|
411
416
|
}
|
|
@@ -452,7 +457,7 @@ async function connectBridgePeer(rawUrl: string): Promise<void> {
|
|
|
452
457
|
connectBridge(sandbox, { url });
|
|
453
458
|
}
|
|
454
459
|
diagnostics.bridgeConnected = true;
|
|
455
|
-
console.info('[pyric
|
|
460
|
+
console.info('[pyric sandbox] sandbox registered with the MCP bridge at', url);
|
|
456
461
|
}
|
|
457
462
|
if (bridgeUrlFromPayload) {
|
|
458
463
|
// In-page path: bridgeUrlFromPayload came from the (already-blocking) init
|
|
@@ -461,7 +466,7 @@ if (bridgeUrlFromPayload) {
|
|
|
461
466
|
await connectBridgePeer(bridgeUrlFromPayload);
|
|
462
467
|
} catch (e) {
|
|
463
468
|
runtimeStatus.reportError(e, 'runtime');
|
|
464
|
-
console.error('[pyric
|
|
469
|
+
console.error('[pyric sandbox] bridge connect failed:', e instanceof Error ? e.message : String(e));
|
|
465
470
|
}
|
|
466
471
|
} else if (useWorker) {
|
|
467
472
|
// Worker path: the worker owns serve-init, so the page skipped the init.json
|
|
@@ -476,7 +481,7 @@ if (bridgeUrlFromPayload) {
|
|
|
476
481
|
if (url) await connectBridgePeer(url);
|
|
477
482
|
} catch (e) {
|
|
478
483
|
runtimeStatus.reportError(e, 'runtime');
|
|
479
|
-
console.error('[pyric
|
|
484
|
+
console.error('[pyric sandbox] bridge connect failed:', e instanceof Error ? e.message : String(e));
|
|
480
485
|
}
|
|
481
486
|
})();
|
|
482
487
|
}
|
|
@@ -547,10 +552,10 @@ if (!useWorker && typeof EventSource !== 'undefined') {
|
|
|
547
552
|
if (lint.parseError) throw new Error(JSON.stringify(lint.parseError));
|
|
548
553
|
diagnostics.rulesDeployed = true;
|
|
549
554
|
diagnostics.rulesHash = rulesHash;
|
|
550
|
-
console.info(`[pyric
|
|
555
|
+
console.info(`[pyric sandbox] firestore.rules hot-reloaded (hash ${rulesHash})`);
|
|
551
556
|
} catch (err) {
|
|
552
557
|
runtimeStatus.reportError(err, 'runtime');
|
|
553
|
-
console.error('[pyric
|
|
558
|
+
console.error('[pyric sandbox] rules hot-reload failed:', err instanceof Error ? err.message : String(err));
|
|
554
559
|
}
|
|
555
560
|
});
|
|
556
561
|
events.addEventListener('rtdb-rules-update', (e) => {
|
|
@@ -567,7 +572,7 @@ if (!useWorker && typeof EventSource !== 'undefined') {
|
|
|
567
572
|
newHash = rulesHash;
|
|
568
573
|
}
|
|
569
574
|
diagnostics.databaseRulesHash = newHash;
|
|
570
|
-
console.info(`[pyric
|
|
575
|
+
console.info(`[pyric sandbox] database.rules.json hot-reloaded (hash ${rulesHash})`);
|
|
571
576
|
} catch (err) {
|
|
572
577
|
runtimeStatus.reportError(err, 'runtime');
|
|
573
578
|
const isErrorInstance = err instanceof Error;
|
|
@@ -575,7 +580,7 @@ if (!useWorker && typeof EventSource !== 'undefined') {
|
|
|
575
580
|
if (isErrorInstance) {
|
|
576
581
|
errorMessage = (err as Error).message;
|
|
577
582
|
}
|
|
578
|
-
console.error('[pyric
|
|
583
|
+
console.error('[pyric sandbox] database rules hot-reload failed:', errorMessage);
|
|
579
584
|
}
|
|
580
585
|
});
|
|
581
586
|
}
|
|
@@ -66,7 +66,7 @@ export function connectStorageEmulator(
|
|
|
66
66
|
_options?: unknown,
|
|
67
67
|
): void {
|
|
68
68
|
console.info(
|
|
69
|
-
'[pyric
|
|
69
|
+
'[pyric sandbox] Pyric replaces the Firebase emulator; connectStorageEmulator is a no-op.',
|
|
70
70
|
);
|
|
71
71
|
if (!useWorker) ip.connectStorageEmulator(storage as FirebaseStorage, _host, _port, _options as never);
|
|
72
72
|
}
|
|
@@ -125,7 +125,7 @@ if (useWorker && typeof document !== 'undefined') {
|
|
|
125
125
|
? ' This is the only connected page — reload it to pick up the new worker.'
|
|
126
126
|
: '';
|
|
127
127
|
console.warn(
|
|
128
|
-
`[pyric
|
|
128
|
+
`[pyric sandbox] the SharedWorker is running older code (build ${runningVersion}) than what is now `
|
|
129
129
|
+ `served (build ${servedVersion}). A SharedWorker can't hot-update — CLOSE ALL TABS of this origin `
|
|
130
130
|
+ 'and reopen to load the new worker. (All tabs share one worker, so a partial reload leaves '
|
|
131
131
|
+ `the old code running for everyone.)${othersHint}`,
|
|
@@ -4,11 +4,15 @@ import type { AiEngineConfigWire } from './worker/protocol.js';
|
|
|
4
4
|
export interface InitPayload {
|
|
5
5
|
/** Per-server capability for the warning-only activity report endpoint. */
|
|
6
6
|
activityToken?: string;
|
|
7
|
+
/** Per-boot session capability token required on workspace and project endpoints. */
|
|
8
|
+
sessionToken?: string;
|
|
7
9
|
rules: string | null;
|
|
8
10
|
rulesHash: string | null;
|
|
9
11
|
databaseRules?: { rules: Record<string, unknown> } | null;
|
|
10
12
|
databaseRulesHash?: string | null;
|
|
11
13
|
databaseUrl?: string | null;
|
|
14
|
+
/** Explicit opt-in to permissive default access when rules are unconfigured. */
|
|
15
|
+
permissive?: boolean;
|
|
12
16
|
/** Storage rules are installed once, before the first Storage operation. */
|
|
13
17
|
storageRules: string | null;
|
|
14
18
|
storageRulesHash: string | null;
|