@pyric/cli 0.1.0-alpha.19 → 0.1.0-alpha.21
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 +64 -89
- package/dist/assurance/.generated/conformance-verdicts.d.ts +68 -1
- package/dist/assurance/.generated/conformance-verdicts.d.ts.map +1 -1
- package/dist/assurance/.generated/conformance-verdicts.js +68 -1
- package/dist/assurance/.generated/conformance-verdicts.js.map +1 -1
- package/dist/bridge/client/dispatch.d.ts +25 -19
- package/dist/bridge/client/dispatch.d.ts.map +1 -1
- package/dist/bridge/client/dispatch.js +41 -48
- package/dist/bridge/client/dispatch.js.map +1 -1
- package/dist/bridge/client/tool-family-factories.d.ts +26 -0
- package/dist/bridge/client/tool-family-factories.d.ts.map +1 -0
- package/dist/bridge/client/tool-family-factories.js +10 -0
- package/dist/bridge/client/tool-family-factories.js.map +1 -0
- package/dist/bridge/server/mcp-contract.d.ts +7 -6
- package/dist/bridge/server/mcp-contract.d.ts.map +1 -1
- package/dist/bridge/server/mcp-contract.js +9 -48
- package/dist/bridge/server/mcp-contract.js.map +1 -1
- package/dist/bridge/server/peer.d.ts +11 -1
- package/dist/bridge/server/peer.d.ts.map +1 -1
- package/dist/bridge/server/peer.js +22 -1
- package/dist/bridge/server/peer.js.map +1 -1
- package/dist/bridge/server/tool-family-factories.d.ts +30 -0
- package/dist/bridge/server/tool-family-factories.d.ts.map +1 -0
- package/dist/bridge/server/tool-family-factories.js +22 -0
- package/dist/bridge/server/tool-family-factories.js.map +1 -0
- package/dist/bridge/server/tool-metadata.d.ts +17 -18
- package/dist/bridge/server/tool-metadata.d.ts.map +1 -1
- package/dist/bridge/server/tool-metadata.js +24 -59
- package/dist/bridge/server/tool-metadata.js.map +1 -1
- package/dist/bridge/tool-families.d.ts +48 -0
- package/dist/bridge/tool-families.d.ts.map +1 -0
- package/dist/bridge/tool-families.generated.d.ts +32 -0
- package/dist/bridge/tool-families.generated.d.ts.map +1 -0
- package/dist/bridge/tool-families.generated.js +15 -0
- package/dist/bridge/tool-families.generated.js.map +1 -0
- package/dist/bridge/tool-families.js +51 -0
- package/dist/bridge/tool-families.js.map +1 -0
- package/dist/bridge/tool-family-records/conformance.d.ts +7 -0
- package/dist/bridge/tool-family-records/conformance.d.ts.map +1 -0
- package/dist/bridge/tool-family-records/conformance.js +6 -0
- package/dist/bridge/tool-family-records/conformance.js.map +1 -0
- package/dist/bridge/tool-family-records/firestore-data.d.ts +7 -0
- package/dist/bridge/tool-family-records/firestore-data.d.ts.map +1 -0
- package/dist/bridge/tool-family-records/firestore-data.js +15 -0
- package/dist/bridge/tool-family-records/firestore-data.js.map +1 -0
- package/dist/bridge/tool-family-records/firestore-inspect.d.ts +7 -0
- package/dist/bridge/tool-family-records/firestore-inspect.d.ts.map +1 -0
- package/dist/bridge/tool-family-records/firestore-inspect.js +6 -0
- package/dist/bridge/tool-family-records/firestore-inspect.js.map +1 -0
- package/dist/bridge/tool-family-records/firestore-rules.d.ts +7 -0
- package/dist/bridge/tool-family-records/firestore-rules.d.ts.map +1 -0
- package/dist/bridge/tool-family-records/firestore-rules.js +15 -0
- package/dist/bridge/tool-family-records/firestore-rules.js.map +1 -0
- package/dist/bridge/tool-family-records/firestore-simulator.d.ts +7 -0
- package/dist/bridge/tool-family-records/firestore-simulator.d.ts.map +1 -0
- package/dist/bridge/tool-family-records/firestore-simulator.js +16 -0
- package/dist/bridge/tool-family-records/firestore-simulator.js.map +1 -0
- package/dist/bridge/tool-family-records/rtdb-inspection.d.ts +7 -0
- package/dist/bridge/tool-family-records/rtdb-inspection.d.ts.map +1 -0
- package/dist/bridge/tool-family-records/rtdb-inspection.js +6 -0
- package/dist/bridge/tool-family-records/rtdb-inspection.js.map +1 -0
- package/dist/bundler/externals.d.ts +37 -0
- package/dist/bundler/externals.d.ts.map +1 -0
- package/dist/bundler/externals.js +52 -0
- package/dist/bundler/externals.js.map +1 -0
- package/dist/bundler/index.d.ts +17 -0
- package/dist/bundler/index.d.ts.map +1 -0
- package/dist/bundler/index.js +17 -0
- package/dist/bundler/index.js.map +1 -0
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +48 -42
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/inlined-sdk-scanner.d.ts +6 -0
- package/dist/cli/inlined-sdk-scanner.d.ts.map +1 -0
- package/dist/cli/inlined-sdk-scanner.js +82 -0
- package/dist/cli/inlined-sdk-scanner.js.map +1 -0
- 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/sandbox-interlock.d.ts +97 -0
- package/dist/cli/sandbox-interlock.d.ts.map +1 -0
- package/dist/cli/sandbox-interlock.js +112 -0
- package/dist/cli/sandbox-interlock.js.map +1 -0
- package/dist/cli/{dev-runner.d.ts → sandbox-runner.d.ts} +53 -48
- package/dist/cli/sandbox-runner.d.ts.map +1 -0
- package/dist/cli/{dev-runner.js → sandbox-runner.js} +105 -67
- package/dist/cli/sandbox-runner.js.map +1 -0
- package/dist/cli/serve.d.ts +12 -14
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +155 -116
- package/dist/cli/serve.js.map +1 -1
- package/dist/cli/snapshot.js +5 -5
- package/dist/cli/snapshot.js.map +1 -1
- package/dist/cli/unsupported-runtime.d.ts +27 -0
- package/dist/cli/unsupported-runtime.d.ts.map +1 -0
- package/dist/cli/unsupported-runtime.js +63 -0
- package/dist/cli/unsupported-runtime.js.map +1 -0
- package/dist/cli/verify.js +1 -1
- package/dist/cli/verify.js.map +1 -1
- package/dist/conformance/.generated/can-i-use-browser.d.ts +1 -1
- package/dist/conformance/.generated/can-i-use-browser.d.ts.map +1 -1
- package/dist/conformance/.generated/can-i-use-browser.js +1 -1
- package/dist/conformance/.generated/can-i-use-browser.js.map +1 -1
- package/dist/conformance/.generated/can-i-use.d.ts +1 -1
- package/dist/conformance/.generated/can-i-use.d.ts.map +1 -1
- package/dist/conformance/.generated/can-i-use.js +1 -1
- package/dist/conformance/.generated/can-i-use.js.map +1 -1
- package/dist/conformance/.generated/conformance-docs.d.ts.map +1 -1
- package/dist/conformance/.generated/conformance-docs.js +1 -1
- package/dist/conformance/.generated/conformance-docs.js.map +1 -1
- package/dist/functions-rtdb/child.d.ts +37 -0
- package/dist/functions-rtdb/child.d.ts.map +1 -1
- package/dist/functions-rtdb/child.js +90 -21
- package/dist/functions-rtdb/child.js.map +1 -1
- package/dist/functions-rtdb/development-runtime.d.ts +3 -0
- package/dist/functions-rtdb/development-runtime.d.ts.map +1 -1
- package/dist/functions-rtdb/development-runtime.js +2 -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/google-endpoints.d.ts +67 -0
- package/dist/google-endpoints.d.ts.map +1 -0
- package/dist/google-endpoints.js +119 -0
- package/dist/google-endpoints.js.map +1 -0
- package/dist/next/guard.js +1 -1
- package/dist/next/guard.js.map +1 -1
- package/dist/next/runtime-env.d.ts.map +1 -1
- package/dist/next/runtime-env.js +5 -0
- package/dist/next/runtime-env.js.map +1 -1
- package/dist/next/with-pyric.d.ts +1 -1
- package/dist/next/with-pyric.js +1 -1
- package/dist/register/beacon.d.ts +69 -0
- package/dist/register/beacon.d.ts.map +1 -0
- package/dist/register/beacon.js +199 -0
- package/dist/register/beacon.js.map +1 -0
- package/dist/register/index.d.ts.map +1 -1
- package/dist/register/index.js +65 -6
- package/dist/register/index.js.map +1 -1
- package/dist/register/net-guard.d.ts +110 -0
- package/dist/register/net-guard.d.ts.map +1 -0
- package/dist/register/net-guard.js +462 -0
- package/dist/register/net-guard.js.map +1 -0
- 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/ai-diagnostics-relay.d.ts +63 -0
- package/dist/serve/ai-diagnostics-relay.d.ts.map +1 -0
- package/dist/serve/ai-diagnostics-relay.js +125 -0
- package/dist/serve/ai-diagnostics-relay.js.map +1 -0
- package/dist/serve/ai-proxy.d.ts +92 -0
- package/dist/serve/ai-proxy.d.ts.map +1 -0
- package/dist/serve/ai-proxy.js +269 -0
- package/dist/serve/ai-proxy.js.map +1 -0
- package/dist/serve/ai-status.d.ts +44 -0
- package/dist/serve/ai-status.d.ts.map +1 -0
- package/dist/serve/ai-status.js +77 -0
- package/dist/serve/ai-status.js.map +1 -0
- package/dist/serve/ai-terminal-blocks.d.ts +97 -0
- package/dist/serve/ai-terminal-blocks.d.ts.map +1 -0
- package/dist/serve/ai-terminal-blocks.js +128 -0
- package/dist/serve/ai-terminal-blocks.js.map +1 -0
- package/dist/serve/ai-terminal-text.d.ts +36 -0
- package/dist/serve/ai-terminal-text.d.ts.map +1 -0
- package/dist/serve/ai-terminal-text.js +48 -0
- package/dist/serve/ai-terminal-text.js.map +1 -0
- package/dist/serve/beacon-route.d.ts +53 -0
- package/dist/serve/beacon-route.d.ts.map +1 -0
- package/dist/serve/beacon-route.js +101 -0
- package/dist/serve/beacon-route.js.map +1 -0
- package/dist/serve/bundler.js +10 -10
- package/dist/serve/bundler.js.map +1 -1
- package/dist/serve/entries/active-auth-registry.d.ts +16 -0
- package/dist/serve/entries/active-auth-registry.d.ts.map +1 -0
- package/dist/serve/entries/active-auth-registry.js +48 -0
- package/dist/serve/entries/active-auth-registry.js.map +1 -0
- package/dist/serve/entries/active-auth.d.ts +18 -0
- package/dist/serve/entries/active-auth.d.ts.map +1 -0
- package/dist/serve/entries/active-auth.js +84 -0
- package/dist/serve/entries/active-auth.js.map +1 -0
- 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-core.d.ts +1 -0
- package/dist/serve/entries/auth-helper-core.d.ts.map +1 -1
- package/dist/serve/entries/auth-helper-core.js +4 -0
- package/dist/serve/entries/auth-helper-core.js.map +1 -1
- package/dist/serve/entries/auth-helper-dom.d.ts.map +1 -1
- package/dist/serve/entries/auth-helper-dom.js +29 -3
- 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/auth.d.ts.map +1 -1
- package/dist/serve/entries/auth.js +8 -0
- package/dist/serve/entries/auth.js.map +1 -1
- package/dist/serve/entries/bridge-url.d.ts +1 -1
- package/dist/serve/entries/bridge-url.js +1 -1
- package/dist/serve/entries/firestore.js +3 -3
- package/dist/serve/entries/firestore.js.map +1 -1
- package/dist/serve/entries/init.d.ts.map +1 -1
- package/dist/serve/entries/init.js +70 -4
- package/dist/serve/entries/init.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.d.ts.map +1 -1
- package/dist/serve/entries/runtime.js +30 -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 +20 -5
- package/dist/serve/namespace.d.ts.map +1 -1
- package/dist/serve/namespace.js +93 -129
- package/dist/serve/namespace.js.map +1 -1
- package/dist/serve/rules.d.ts.map +1 -1
- package/dist/serve/rules.js +44 -21
- package/dist/serve/rules.js.map +1 -1
- package/dist/serve/runtime/chip-config.d.ts.map +1 -1
- package/dist/serve/runtime/chip-config.js +16 -2
- package/dist/serve/runtime/chip-config.js.map +1 -1
- package/dist/serve/runtime/chip-dialog.d.ts +18 -0
- package/dist/serve/runtime/chip-dialog.d.ts.map +1 -0
- package/dist/serve/runtime/chip-dialog.js +315 -0
- package/dist/serve/runtime/chip-dialog.js.map +1 -0
- package/dist/serve/runtime/chip-install.d.ts +2 -0
- package/dist/serve/runtime/chip-install.d.ts.map +1 -1
- package/dist/serve/runtime/chip-install.js +9 -4
- package/dist/serve/runtime/chip-install.js.map +1 -1
- package/dist/serve/runtime/chip-user-search.d.ts +16 -0
- package/dist/serve/runtime/chip-user-search.d.ts.map +1 -0
- package/dist/serve/runtime/chip-user-search.js +354 -0
- package/dist/serve/runtime/chip-user-search.js.map +1 -0
- package/dist/serve/runtime/chip.d.ts +10 -0
- package/dist/serve/runtime/chip.d.ts.map +1 -1
- package/dist/serve/runtime/chip.js +149 -15
- package/dist/serve/runtime/chip.js.map +1 -1
- package/dist/serve/runtime/identity.d.ts +17 -0
- package/dist/serve/runtime/identity.d.ts.map +1 -0
- package/dist/serve/runtime/identity.js +10 -0
- package/dist/serve/runtime/identity.js.map +1 -0
- 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 +8 -0
- package/dist/serve/sandbox-session.d.ts.map +1 -1
- package/dist/serve/sandbox-session.js +12 -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.Bl-XMkhD.js → RulesCodeEditor.DsTAsKIa.js} +1 -1
- 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.BOr2kwae.js +115 -0
- package/dist/serve/site-ui/_astro/app.DhAcImFD.js +1 -0
- package/dist/serve/site-ui/_astro/app.pMSnN6Qw.css +1 -0
- package/dist/serve/site-ui/_astro/{chess-showcase.Dh5D8kqe.js → chess-showcase.Bn_pP6UJ.js} +2 -2
- package/dist/serve/site-ui/_astro/{example-runtime.CuyAjjiG.js → example-runtime.CXopTGv7.js} +1 -1
- 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.rOuZTOUG.js +510 -0
- package/dist/serve/site-ui/_astro/{seed.CSUkloMi.js → seed.03a08f9t.js} +2 -2
- package/dist/serve/site-ui/_astro/writes.BsPBG3dp.js +653 -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 +18 -15
- package/dist/serve/site-ui/docs/agent/set-up-your-agent.md +16 -16
- 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 +13 -2
- package/dist/serve/site-ui/docs/api-reference.md +8 -0
- package/dist/serve/site-ui/docs/app-compat/index.html +5 -2
- package/dist/serve/site-ui/docs/auth-compat/index.html +7 -4
- package/dist/serve/site-ui/docs/auth-compat.md +2 -2
- package/dist/serve/site-ui/docs/build/ai-logic/index.html +10 -2
- package/dist/serve/site-ui/docs/build/ai-logic.md +6 -0
- 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 +5 -2
- 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 +10 -3
- package/dist/serve/site-ui/docs/conformance-scores.md +5 -1
- 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 +48 -45
- package/dist/serve/site-ui/docs/database-compat.md +43 -43
- package/dist/serve/site-ui/docs/examples/chess/index.html +5 -2
- package/dist/serve/site-ui/docs/examples/index.html +5 -2
- package/dist/serve/site-ui/docs/firestore-compat/index.html +8 -5
- package/dist/serve/site-ui/docs/firestore-compat.md +3 -3
- package/dist/serve/site-ui/docs/firestore-flutter-compat/index.html +319 -0
- package/dist/serve/site-ui/docs/firestore-flutter-compat.md +344 -0
- package/dist/serve/site-ui/docs/functions-rtdb-compat/index.html +5 -2
- package/dist/serve/site-ui/docs/get-started/backend-bundlers/index.html +105 -0
- package/dist/serve/site-ui/docs/get-started/backend-bundlers.md +165 -0
- 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 +14 -9
- package/dist/serve/site-ui/docs/get-started/start-building.md +16 -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 +3128 -1613
- 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-analytics-reference-api/index.html +124 -0
- package/dist/serve/site-ui/docs/pyric-analytics-reference-api.md +287 -0
- package/dist/serve/site-ui/docs/pyric-app-check-reference-api/index.html +87 -0
- package/dist/serve/site-ui/docs/pyric-app-check-reference-api.md +199 -0
- 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 +10 -3
- package/dist/serve/site-ui/docs/pyric-auth-reference-api.md +2 -1
- 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 +6 -3
- package/dist/serve/site-ui/docs/pyric-cli-bridge-client-reference-api.md +1 -1
- package/dist/serve/site-ui/docs/pyric-cli-bridge-reference-api/index.html +5 -2
- package/dist/serve/site-ui/docs/pyric-cli-bundler-reference-api/index.html +56 -0
- package/dist/serve/site-ui/docs/pyric-cli-bundler-reference-api.md +72 -0
- package/dist/serve/site-ui/docs/pyric-cli-conformance-browser-reference-api/index.html +6 -2
- package/dist/serve/site-ui/docs/pyric-cli-conformance-browser-reference-api.md +1 -0
- 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 +6 -2
- package/dist/serve/site-ui/docs/pyric-cli-conformance-reference-api.md +1 -0
- 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 +6 -3
- package/dist/serve/site-ui/docs/pyric-cli-next-reference-api.md +1 -1
- 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 +39 -11
- package/dist/serve/site-ui/docs/pyric-cli-remote-reference-api.md +17 -9
- package/dist/serve/site-ui/docs/pyric-cli-serve-worker-reference-api/index.html +137 -94
- package/dist/serve/site-ui/docs/pyric-cli-serve-worker-reference-api.md +61 -1
- package/dist/serve/site-ui/docs/pyric-cli-verify-reference-api/index.html +6 -3
- package/dist/serve/site-ui/docs/pyric-cli-verify-reference-api.md +1 -1
- package/dist/serve/site-ui/docs/pyric-cli-vite-reference-api/index.html +6 -3
- package/dist/serve/site-ui/docs/pyric-cli-vite-reference-api.md +2 -2
- package/dist/serve/site-ui/docs/pyric-database-reference-api/index.html +167 -96
- package/dist/serve/site-ui/docs/pyric-database-reference-api.md +108 -2
- package/dist/serve/site-ui/docs/pyric-firestore-lite-reference-api/index.html +559 -0
- package/dist/serve/site-ui/docs/pyric-firestore-lite-reference-api.md +1240 -0
- package/dist/serve/site-ui/docs/pyric-firestore-reference-api/index.html +44 -12
- package/dist/serve/site-ui/docs/pyric-firestore-reference-api.md +18 -8
- package/dist/serve/site-ui/docs/pyric-functions-reference-api/index.html +67 -0
- package/dist/serve/site-ui/docs/pyric-functions-reference-api.md +149 -0
- 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-performance-reference-api/index.html +35 -0
- package/dist/serve/site-ui/docs/pyric-performance-reference-api.md +69 -0
- package/dist/serve/site-ui/docs/pyric-remote-config-reference-api/index.html +132 -0
- package/dist/serve/site-ui/docs/pyric-remote-config-reference-api.md +307 -0
- 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 +56 -18
- package/dist/serve/site-ui/docs/pyric-sandbox-database-reference-api.md +48 -9
- 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 +243 -50
- package/dist/serve/site-ui/docs/pyric-sandbox-reference-api.md +148 -31
- package/dist/serve/site-ui/docs/pyric-storage-reference-api/index.html +26 -5
- package/dist/serve/site-ui/docs/pyric-storage-reference-api.md +24 -2
- package/dist/serve/site-ui/docs/pyric-ui-agents-reference-api/index.html +30 -97
- package/dist/serve/site-ui/docs/pyric-ui-agents-reference-api.md +20 -51
- 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 +6 -3
- package/dist/serve/site-ui/docs/pyric-ui-auth-reference-api.md +1 -1
- 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 +6 -3
- package/dist/serve/site-ui/docs/pyric-ui-firestore-reference-api.md +1 -1
- package/dist/serve/site-ui/docs/pyric-ui-primitives-reference-api/index.html +128 -27
- package/dist/serve/site-ui/docs/pyric-ui-primitives-reference-api.md +58 -5
- 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 +8 -6
- package/dist/serve/site-ui/docs/pyric-ui-storage-reference-api.md +3 -4
- 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 +156 -0
- package/dist/serve/site-ui/docs/reference/cli.md +120 -0
- package/dist/serve/site-ui/docs/rules-compat/index.html +14 -3
- package/dist/serve/site-ui/docs/rules-compat.md +9 -1
- 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 +17 -14
- package/dist/serve/site-ui/docs/storage-compat.md +12 -12
- 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 +13 -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/disk-workspace.d.ts.map +1 -1
- package/dist/serve/studio/disk-workspace.js +64 -2
- package/dist/serve/studio/disk-workspace.js.map +1 -1
- 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-plugin.d.ts +7 -7
- package/dist/serve/vite-plugin.js +1 -1
- package/dist/serve/vite-plugin.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 +13 -1
- package/dist/serve/vite-sandbox-generation.js.map +1 -1
- package/dist/serve/worker/client/auth.js +1 -2
- package/dist/serve/worker/client/auth.js.map +1 -1
- package/dist/serve/worker/client/core.d.ts +21 -1
- package/dist/serve/worker/client/core.d.ts.map +1 -1
- package/dist/serve/worker/client/core.js +79 -3
- package/dist/serve/worker/client/core.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/client.d.ts +1 -1
- package/dist/serve/worker/client.d.ts.map +1 -1
- package/dist/serve/worker/client.js +1 -1
- package/dist/serve/worker/client.js.map +1 -1
- package/dist/serve/worker/context-resolver.d.ts +30 -0
- package/dist/serve/worker/context-resolver.d.ts.map +1 -0
- package/dist/serve/worker/context-resolver.js +44 -0
- package/dist/serve/worker/context-resolver.js.map +1 -0
- package/dist/serve/worker/entry.js +23 -19
- package/dist/serve/worker/entry.js.map +1 -1
- package/dist/serve/worker/host/core.d.ts +1 -0
- package/dist/serve/worker/host/core.d.ts.map +1 -1
- package/dist/serve/worker/host/core.js +12 -6
- package/dist/serve/worker/host/core.js.map +1 -1
- package/dist/serve/worker/host/storage.js +2 -2
- 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/host-auth.js +1 -2
- package/dist/serve/worker/host-auth.js.map +1 -1
- package/dist/serve/worker/index.d.ts +1 -1
- package/dist/serve/worker/index.d.ts.map +1 -1
- package/dist/serve/worker/index.js +2 -2
- package/dist/serve/worker/index.js.map +1 -1
- package/dist/serve/worker/port-lifecycle.d.ts +18 -0
- package/dist/serve/worker/port-lifecycle.d.ts.map +1 -0
- package/dist/serve/worker/port-lifecycle.js +28 -0
- package/dist/serve/worker/port-lifecycle.js.map +1 -0
- 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 +15 -3
- package/dist/serve/worker/serve-init.js.map +1 -1
- package/dist/verify/fixture.d.ts +1 -1
- package/package.json +17 -6
- package/src/assurance/.generated/conformance-verdicts.ts +68 -1
- package/src/bridge/client/dispatch.ts +52 -56
- package/src/bridge/client/tool-family-factories.ts +34 -0
- package/src/bridge/server/mcp-contract.ts +15 -59
- package/src/bridge/server/peer.ts +24 -1
- package/src/bridge/server/tool-family-factories.ts +40 -0
- package/src/bridge/server/tool-metadata.ts +29 -61
- package/src/bridge/tool-families.generated.ts +17 -0
- package/src/bridge/tool-families.ts +87 -0
- package/src/bridge/tool-family-records/conformance.ts +6 -0
- package/src/bridge/tool-family-records/firestore-data.ts +15 -0
- package/src/bridge/tool-family-records/firestore-inspect.ts +6 -0
- package/src/bridge/tool-family-records/firestore-rules.ts +15 -0
- package/src/bridge/tool-family-records/firestore-simulator.ts +16 -0
- package/src/bridge/tool-family-records/rtdb-inspection.ts +6 -0
- package/src/bundler/externals.ts +55 -0
- package/src/bundler/index.ts +21 -0
- package/src/cli/cli.test.ts +2 -46
- package/src/cli/index.ts +48 -42
- package/src/cli/inlined-sdk-scanner.ts +77 -0
- package/src/cli/mcp-proxy.ts +4 -4
- package/src/cli/parse-args.ts +61 -15
- package/src/cli/pyric-config.ts +45 -0
- package/src/cli/sandbox-interlock.ts +167 -0
- package/src/cli/{dev-runner.ts → sandbox-runner.ts} +142 -86
- package/src/cli/serve.ts +182 -115
- package/src/cli/snapshot.ts +5 -5
- package/src/cli/unsupported-runtime.ts +68 -0
- package/src/cli/verify.ts +1 -1
- package/src/conformance/.generated/can-i-use-browser.ts +2 -2
- package/src/conformance/.generated/can-i-use.ts +2 -2
- package/src/conformance/.generated/conformance-docs.ts +1 -1
- package/src/functions-rtdb/child.ts +115 -21
- package/src/functions-rtdb/development-runtime.ts +5 -1
- package/src/functions-rtdb/project.ts +8 -8
- package/src/google-endpoints.ts +155 -0
- package/src/next/guard.ts +1 -1
- package/src/next/runtime-env.ts +5 -0
- package/src/next/with-pyric.ts +1 -1
- package/src/register/beacon.ts +232 -0
- package/src/register/index.ts +68 -6
- package/src/register/net-guard.ts +567 -0
- package/src/remote/index.ts +9 -9
- package/src/serve/ai-diagnostics-relay.ts +243 -0
- package/src/serve/ai-proxy.ts +327 -0
- package/src/serve/ai-status.ts +109 -0
- package/src/serve/ai-terminal-blocks.ts +210 -0
- package/src/serve/ai-terminal-text.ts +52 -0
- package/src/serve/beacon-route.ts +141 -0
- package/src/serve/bundler.ts +10 -10
- package/src/serve/entries/active-auth-registry.ts +56 -0
- package/src/serve/entries/active-auth.ts +100 -0
- package/src/serve/entries/ai.ts +27 -1
- package/src/serve/entries/auth-helper-core.ts +5 -0
- package/src/serve/entries/auth-helper-dom.ts +27 -3
- package/src/serve/entries/auth-helper-runtime.ts +1 -1
- package/src/serve/entries/auth.ts +8 -0
- package/src/serve/entries/bridge-url.ts +1 -1
- package/src/serve/entries/firestore.ts +3 -3
- package/src/serve/entries/init.ts +78 -3
- package/src/serve/entries/keepalive.ts +1 -1
- package/src/serve/entries/runtime.ts +29 -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 +117 -145
- package/src/serve/rules.ts +47 -22
- package/src/serve/runtime/chip-config.ts +16 -2
- package/src/serve/runtime/chip-dialog.ts +366 -0
- package/src/serve/runtime/chip-install.ts +10 -4
- package/src/serve/runtime/chip-user-search.ts +391 -0
- package/src/serve/runtime/chip.ts +177 -15
- package/src/serve/runtime/identity.ts +26 -0
- package/src/serve/runtime/manifest.ts +1 -1
- package/src/serve/runtime/status.ts +24 -0
- package/src/serve/sandbox-session.ts +19 -4
- package/src/serve/server.ts +18 -1
- package/src/serve/studio/disk-workspace.ts +76 -2
- 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-plugin.ts +8 -8
- package/src/serve/vite-sandbox-generation.ts +16 -1
- package/src/serve/worker/client/auth.ts +1 -1
- package/src/serve/worker/client/core.ts +80 -3
- package/src/serve/worker/client/disconnect.ts +1 -1
- package/src/serve/worker/client/presence.ts +25 -5
- package/src/serve/worker/client.ts +1 -1
- package/src/serve/worker/context-resolver.ts +60 -0
- package/src/serve/worker/entry.ts +22 -18
- package/src/serve/worker/host/core.ts +9 -7
- package/src/serve/worker/host/storage.ts +2 -2
- package/src/serve/worker/host-ai.ts +15 -0
- package/src/serve/worker/host-auth.ts +1 -1
- package/src/serve/worker/index.ts +4 -1
- package/src/serve/worker/port-lifecycle.ts +45 -0
- package/src/serve/worker/protocol.ts +2 -1
- package/src/serve/worker/serve-init.ts +14 -3
- package/src/verify/fixture.ts +1 -1
- package/README.md.orig +0 -145
- 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/_slug_.CXh9yTP1.css +0 -1
- package/dist/serve/site-ui/_astro/_slug_.CupVK4TM.css +0 -1
- package/dist/serve/site-ui/_astro/_studio_.CfxiQWkk.css +0 -1
- package/dist/serve/site-ui/_astro/app.BsFsMjn0.css +0 -1
- package/dist/serve/site-ui/_astro/app.Ce3MTLQm.js +0 -1
- package/dist/serve/site-ui/_astro/app.taqzyjD0.js +0 -11
- package/dist/serve/site-ui/_astro/sandbox-controls.BP4M5f1M.js +0 -1169
- package/dist/serve/site-ui/_astro/writes.C57paAj2.js +0 -99
- 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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { type GuardMode } from '../register/net-guard.js';
|
|
2
|
+
/**
|
|
3
|
+
* What `pyric sandbox` can say about the interception it is about to hand the
|
|
4
|
+
* child, entirely from the env it just assembled: no waiting, no round trip.
|
|
5
|
+
*/
|
|
6
|
+
export interface InterlockStatus {
|
|
7
|
+
/** Net-guard mode the child will run under (`PYRIC_GUARD`, default warn). */
|
|
8
|
+
readonly guard: GuardMode;
|
|
9
|
+
/** Whether `NODE_OPTIONS` actually carries the register `--import`. */
|
|
10
|
+
readonly registerImported: boolean;
|
|
11
|
+
/** Where the child's handshake beacon will land, or null when the
|
|
12
|
+
* activator carries no bridge URL. */
|
|
13
|
+
readonly beacon: string | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Read the interlock off the child env. Everything here is synchronous by
|
|
17
|
+
* construction: it is a statement about the launch, printed before anything at
|
|
18
|
+
* runtime has had a chance to go wrong.
|
|
19
|
+
*/
|
|
20
|
+
export declare function describeInterlock(childEnv: NodeJS.ProcessEnv, registerUrl: string): InterlockStatus;
|
|
21
|
+
/**
|
|
22
|
+
* The startup status line, alongside the other `✔ <service>` checks.
|
|
23
|
+
*
|
|
24
|
+
* The healthy line is deliberately short: one fact per field and nothing the
|
|
25
|
+
* reader has to skim past. The degraded line is long because it reports a
|
|
26
|
+
* broken launch, which is worth every word.
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatInterlockLine(status: InterlockStatus): string;
|
|
29
|
+
export interface LaunchCheckOptions {
|
|
30
|
+
/** The environment the child is about to receive. */
|
|
31
|
+
readonly childEnv: NodeJS.ProcessEnv;
|
|
32
|
+
/** Absolute `file:` URL of the register module, to look for in NODE_OPTIONS. */
|
|
33
|
+
readonly registerUrl: string;
|
|
34
|
+
/** The child's argv, for the unsupported-runtime check. */
|
|
35
|
+
readonly argv: readonly string[];
|
|
36
|
+
readonly write: (line: string) => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Every statement the launcher makes about the child, printed in one block
|
|
40
|
+
* before the spawn, and the interlock status it derived on the way.
|
|
41
|
+
*
|
|
42
|
+
* Two checks: the interlock status line, from the env alone, and the
|
|
43
|
+
* unsupported-runtime warning for the other way interception can be absent, a
|
|
44
|
+
* child runtime that never evaluates Node loader hooks at all.
|
|
45
|
+
*/
|
|
46
|
+
export declare function reportLaunchChecks(opts: LaunchCheckOptions): InterlockStatus;
|
|
47
|
+
export interface BeaconWatchdogOptions {
|
|
48
|
+
/** The child command, for attribution in the warning. */
|
|
49
|
+
readonly label: string;
|
|
50
|
+
/** The endpoint the child would post to. Null means nothing to watch. */
|
|
51
|
+
readonly beacon: string | null;
|
|
52
|
+
/** Whether a beacon from this child has been recorded. */
|
|
53
|
+
readonly sawBeacon: () => boolean;
|
|
54
|
+
/** Whether the child is still running. */
|
|
55
|
+
readonly isAlive: () => boolean;
|
|
56
|
+
readonly warn: (line: string) => void;
|
|
57
|
+
readonly graceMs?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface BeaconWatchdog {
|
|
60
|
+
/** Cancel a pending check. Idempotent. */
|
|
61
|
+
stop(): void;
|
|
62
|
+
}
|
|
63
|
+
/** The warning itself: one paragraph naming what the silence means and what
|
|
64
|
+
* to check. Kept separate so its exact wording is testable. */
|
|
65
|
+
export declare function formatMissingBeaconWarning(opts: {
|
|
66
|
+
label: string;
|
|
67
|
+
graceMs: number;
|
|
68
|
+
beacon: string;
|
|
69
|
+
}): string;
|
|
70
|
+
/**
|
|
71
|
+
* The warn-only interlock watchdog.
|
|
72
|
+
*
|
|
73
|
+
* It never kills the child and never blocks a request. The reason is the
|
|
74
|
+
* signal's own honesty: beacon delivery is best-effort (see
|
|
75
|
+
* `register/beacon.ts`), and a plausible silent child is not the same thing as
|
|
76
|
+
* a broken one. A short-lived script that exits before its POST lands, a child
|
|
77
|
+
* that reaches the sandbox only through a grandchild, a dev server slow to
|
|
78
|
+
* boot: each would be killed by a fail-closed version of this check, and each
|
|
79
|
+
* is fine.
|
|
80
|
+
*
|
|
81
|
+
* So the heuristic is the simple, attributable one: the child is still alive
|
|
82
|
+
* `graceMs` after launch and no beacon has arrived. Both halves matter. An
|
|
83
|
+
* exited child was never expected to say anything, and a child whose beacon
|
|
84
|
+
* landed has already proved the point. One warning per child, guaranteed by
|
|
85
|
+
* the one-shot timer; the timer is unref'd so a watchdog can never be the
|
|
86
|
+
* reason a process stays up.
|
|
87
|
+
*
|
|
88
|
+
* `sawBeacon` is a count delta rather than a pid match, deliberately. The
|
|
89
|
+
* process that loads register is often a grandchild (`npm run dev` starts
|
|
90
|
+
* node, `next dev` starts its worker), so the spawned child's own pid is
|
|
91
|
+
* frequently not the pid in the beacon, and matching on it would warn about
|
|
92
|
+
* perfectly healthy launches. The delta's known imprecision runs the other
|
|
93
|
+
* way: a sibling runtime's beacon that lands inside the grace window can mask
|
|
94
|
+
* a real miss. Erring toward silence is the right bias for a warn-only check.
|
|
95
|
+
*/
|
|
96
|
+
export declare function startBeaconWatchdog(opts: BeaconWatchdogOptions): BeaconWatchdog;
|
|
97
|
+
//# sourceMappingURL=sandbox-interlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-interlock.d.ts","sourceRoot":"","sources":["../../src/cli/sandbox-interlock.ts"],"names":[],"mappings":"AAWA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAG1E;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC;2CACuC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,CAAC,UAAU,EAC3B,WAAW,EAAE,MAAM,GAClB,eAAe,CAMjB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAQnE;AAED,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC;IACrC,gFAAgF;IAChF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,GAAG,eAAe,CAM5E;AAKD,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC;IAClC,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,IAAI,IAAI,IAAI,CAAC;CACd;AAED;gEACgE;AAChE,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,MAAM,CAUT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc,CAc/E"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The interlock: the launcher's statement about interception in the child it
|
|
3
|
+
* is about to start, plus the warn-only watchdog for the child's answer.
|
|
4
|
+
*
|
|
5
|
+
* The status line is knowable synchronously from the env `pyric sandbox` just
|
|
6
|
+
* assembled: guard mode, whether NODE_OPTIONS really carries the register
|
|
7
|
+
* import, and where the child's handshake beacon will land. The watchdog is
|
|
8
|
+
* the other half: a child still alive well after launch that never posted a
|
|
9
|
+
* beacon is probably not intercepted.
|
|
10
|
+
*/
|
|
11
|
+
import { beaconEndpoint } from '../register/beacon.js';
|
|
12
|
+
import { parseGuardMode } from '../register/net-guard.js';
|
|
13
|
+
import { detectUnsupportedRuntime, formatUnsupportedRuntimeWarning } from './unsupported-runtime.js';
|
|
14
|
+
/**
|
|
15
|
+
* Read the interlock off the child env. Everything here is synchronous by
|
|
16
|
+
* construction: it is a statement about the launch, printed before anything at
|
|
17
|
+
* runtime has had a chance to go wrong.
|
|
18
|
+
*/
|
|
19
|
+
export function describeInterlock(childEnv, registerUrl) {
|
|
20
|
+
return {
|
|
21
|
+
guard: parseGuardMode(childEnv.PYRIC_GUARD),
|
|
22
|
+
registerImported: (childEnv.NODE_OPTIONS ?? '').includes(`--import ${registerUrl}`),
|
|
23
|
+
beacon: beaconEndpoint(childEnv.PYRIC_SANDBOX),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The startup status line, alongside the other `✔ <service>` checks.
|
|
28
|
+
*
|
|
29
|
+
* The healthy line is deliberately short: one fact per field and nothing the
|
|
30
|
+
* reader has to skim past. The degraded line is long because it reports a
|
|
31
|
+
* broken launch, which is worth every word.
|
|
32
|
+
*/
|
|
33
|
+
export function formatInterlockLine(status) {
|
|
34
|
+
if (!status.registerImported) {
|
|
35
|
+
return (`⚠ interlock guard=${status.guard}, register is NOT in the child's NODE_OPTIONS. ` +
|
|
36
|
+
`Its firebase-admin/firebase imports will NOT be rewritten and would reach LIVE Firebase.\n`);
|
|
37
|
+
}
|
|
38
|
+
return `✔ interlock guard=${status.guard}, register loaded via NODE_OPTIONS\n`;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Every statement the launcher makes about the child, printed in one block
|
|
42
|
+
* before the spawn, and the interlock status it derived on the way.
|
|
43
|
+
*
|
|
44
|
+
* Two checks: the interlock status line, from the env alone, and the
|
|
45
|
+
* unsupported-runtime warning for the other way interception can be absent, a
|
|
46
|
+
* child runtime that never evaluates Node loader hooks at all.
|
|
47
|
+
*/
|
|
48
|
+
export function reportLaunchChecks(opts) {
|
|
49
|
+
const interlock = describeInterlock(opts.childEnv, opts.registerUrl);
|
|
50
|
+
opts.write(formatInterlockLine(interlock));
|
|
51
|
+
const unsupportedRuntime = detectUnsupportedRuntime(opts.argv);
|
|
52
|
+
if (unsupportedRuntime !== null)
|
|
53
|
+
opts.write(formatUnsupportedRuntimeWarning(unsupportedRuntime));
|
|
54
|
+
return interlock;
|
|
55
|
+
}
|
|
56
|
+
/** How long a child may live without its beacon before we say something. */
|
|
57
|
+
const BEACON_GRACE_MS = 15_000;
|
|
58
|
+
/** The warning itself: one paragraph naming what the silence means and what
|
|
59
|
+
* to check. Kept separate so its exact wording is testable. */
|
|
60
|
+
export function formatMissingBeaconWarning(opts) {
|
|
61
|
+
const seconds = Math.round(opts.graceMs / 1000);
|
|
62
|
+
return (` ⚠ interlock: \`${opts.label}\` has been running ${seconds}s without posting a register ` +
|
|
63
|
+
`beacon to ${opts.beacon}. Its firebase-admin/firebase imports are probably NOT routed to ` +
|
|
64
|
+
`the pyric sandbox, which means they would reach LIVE Firebase. Check that the command starts ` +
|
|
65
|
+
`a Node process (bun and deno do not evaluate Node loader hooks), that it does not overwrite ` +
|
|
66
|
+
`NODE_OPTIONS, and that NODE_ENV is not production. Warning only: nothing was blocked, and ` +
|
|
67
|
+
`this is reported once per child.`);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The warn-only interlock watchdog.
|
|
71
|
+
*
|
|
72
|
+
* It never kills the child and never blocks a request. The reason is the
|
|
73
|
+
* signal's own honesty: beacon delivery is best-effort (see
|
|
74
|
+
* `register/beacon.ts`), and a plausible silent child is not the same thing as
|
|
75
|
+
* a broken one. A short-lived script that exits before its POST lands, a child
|
|
76
|
+
* that reaches the sandbox only through a grandchild, a dev server slow to
|
|
77
|
+
* boot: each would be killed by a fail-closed version of this check, and each
|
|
78
|
+
* is fine.
|
|
79
|
+
*
|
|
80
|
+
* So the heuristic is the simple, attributable one: the child is still alive
|
|
81
|
+
* `graceMs` after launch and no beacon has arrived. Both halves matter. An
|
|
82
|
+
* exited child was never expected to say anything, and a child whose beacon
|
|
83
|
+
* landed has already proved the point. One warning per child, guaranteed by
|
|
84
|
+
* the one-shot timer; the timer is unref'd so a watchdog can never be the
|
|
85
|
+
* reason a process stays up.
|
|
86
|
+
*
|
|
87
|
+
* `sawBeacon` is a count delta rather than a pid match, deliberately. The
|
|
88
|
+
* process that loads register is often a grandchild (`npm run dev` starts
|
|
89
|
+
* node, `next dev` starts its worker), so the spawned child's own pid is
|
|
90
|
+
* frequently not the pid in the beacon, and matching on it would warn about
|
|
91
|
+
* perfectly healthy launches. The delta's known imprecision runs the other
|
|
92
|
+
* way: a sibling runtime's beacon that lands inside the grace window can mask
|
|
93
|
+
* a real miss. Erring toward silence is the right bias for a warn-only check.
|
|
94
|
+
*/
|
|
95
|
+
export function startBeaconWatchdog(opts) {
|
|
96
|
+
const beacon = opts.beacon;
|
|
97
|
+
if (beacon === null)
|
|
98
|
+
return { stop: () => { } };
|
|
99
|
+
const graceMs = opts.graceMs ?? BEACON_GRACE_MS;
|
|
100
|
+
const timer = setTimeout(() => {
|
|
101
|
+
if (opts.sawBeacon() || !opts.isAlive())
|
|
102
|
+
return;
|
|
103
|
+
opts.warn(formatMissingBeaconWarning({ label: opts.label, graceMs, beacon }));
|
|
104
|
+
}, graceMs);
|
|
105
|
+
timer.unref?.();
|
|
106
|
+
return {
|
|
107
|
+
stop() {
|
|
108
|
+
clearTimeout(timer);
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=sandbox-interlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-interlock.js","sourceRoot":"","sources":["../../src/cli/sandbox-interlock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAkB,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAgBrG;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAA2B,EAC3B,WAAmB;IAEnB,OAAO;QACL,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC;QAC3C,gBAAgB,EAAE,CAAC,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,YAAY,WAAW,EAAE,CAAC;QACnF,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,aAAa,CAAC;KAC/C,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAuB;IACzD,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC7B,OAAO,CACL,qBAAqB,MAAM,CAAC,KAAK,iDAAiD;YAClF,4FAA4F,CAC7F,CAAC;IACJ,CAAC;IACD,OAAO,qBAAqB,MAAM,CAAC,KAAK,sCAAsC,CAAC;AACjF,CAAC;AAYD;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAwB;IACzD,MAAM,SAAS,GAAG,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACrE,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3C,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,IAAI,kBAAkB,KAAK,IAAI;QAAE,IAAI,CAAC,KAAK,CAAC,+BAA+B,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACjG,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,4EAA4E;AAC5E,MAAM,eAAe,GAAG,MAAM,CAAC;AAoB/B;gEACgE;AAChE,MAAM,UAAU,0BAA0B,CAAC,IAI1C;IACC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAChD,OAAO,CACL,oBAAoB,IAAI,CAAC,KAAK,uBAAuB,OAAO,+BAA+B;QAC3F,aAAa,IAAI,CAAC,MAAM,mEAAmE;QAC3F,+FAA+F;QAC/F,8FAA8F;QAC9F,4FAA4F;QAC5F,kCAAkC,CACnC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAA2B;IAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,eAAe,CAAC;IAChD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;QAC5B,IAAI,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YAAE,OAAO;QAChD,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAChF,CAAC,EAAE,OAAO,CAAC,CAAC;IACZ,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;IAChB,OAAO;QACL,IAAI;YACF,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `pyric
|
|
2
|
+
* The `pyric sandbox` child runner starts the configured application command
|
|
3
|
+
* after the host is ready:
|
|
3
4
|
* after the host is up, run the user's OWN dev command with the environment
|
|
4
5
|
* activated so their unchanged firebase-admin/firebase imports resolve to the
|
|
5
6
|
* pyric sandbox:
|
|
@@ -7,10 +8,9 @@
|
|
|
7
8
|
* PYRIC_SANDBOX=remote:<serve url> (the activator)
|
|
8
9
|
* NODE_OPTIONS += --import @pyric/cli/register (the substitution seam)
|
|
9
10
|
*
|
|
10
|
-
* Child-command precedence:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* defaults to host-only (an explicit `--` still wins — agents can opt in).
|
|
11
|
+
* Child-command precedence: `--no-run`, an explicit command, `--json`, the
|
|
12
|
+
* `pyric.json` command, then host-only. An explicit command still runs with
|
|
13
|
+
* `--json`.
|
|
14
14
|
*
|
|
15
15
|
* Everything decision-shaped here is pure and exported for the unit suite;
|
|
16
16
|
* only `spawnDevChild` touches the process table.
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import { type ChildProcess } from 'node:child_process';
|
|
19
19
|
/**
|
|
20
20
|
* Wait (bounded) for a browser tab to register as the bridge's sandbox peer
|
|
21
|
-
* before the child spawns. `pyric
|
|
21
|
+
* before the child spawns. `pyric sandbox` opens the tab and spawns the child in
|
|
22
22
|
* the same breath; a child whose first line is a sandbox op otherwise races
|
|
23
23
|
* the tab's boot and dies on the no-tab fail-fast — the exact first-run of
|
|
24
24
|
* the two-command story. Polls `/__pyric/health` (`sandboxConnected`).
|
|
@@ -33,37 +33,35 @@ export declare function waitForSandboxPeer(serveUrl: string, opts?: {
|
|
|
33
33
|
fetchImpl?: typeof fetch;
|
|
34
34
|
sleep?: (ms: number) => Promise<void>;
|
|
35
35
|
}): Promise<boolean>;
|
|
36
|
-
export
|
|
37
|
-
/**
|
|
38
|
-
export declare function detectPackageManager(cwd: string): PackageManager;
|
|
39
|
-
/** The project's `dev` script, or null (no package.json / no script). */
|
|
40
|
-
export declare function readDevScript(cwd: string): string | null;
|
|
41
|
-
export interface DevChildPlan {
|
|
42
|
-
/** argv to spawn — argv[0] is the executable, no shell. */
|
|
36
|
+
export interface SandboxChildPlan {
|
|
37
|
+
/** argv to spawn — argv[0] is the executable. */
|
|
43
38
|
argv: string[];
|
|
44
39
|
/** Human-readable command for the pre-spawn line. */
|
|
45
40
|
label: string;
|
|
46
41
|
}
|
|
42
|
+
export type DevChildPlan = SandboxChildPlan;
|
|
43
|
+
/**
|
|
44
|
+
* Tokenize a command string into an argv array, preserving quoted strings.
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseCommandString(cmd: string): string[];
|
|
47
|
+
export interface ResolveSandboxChildOptions {
|
|
48
|
+
explicitCommand?: string[] | null;
|
|
49
|
+
passthrough?: string[];
|
|
50
|
+
configCommand?: string | null;
|
|
51
|
+
noRun?: boolean;
|
|
52
|
+
json?: boolean;
|
|
53
|
+
}
|
|
47
54
|
/**
|
|
48
55
|
* Decide what (if anything) to run after the host is up.
|
|
49
56
|
*
|
|
50
|
-
*
|
|
51
|
-
* --no-run
|
|
52
|
-
*
|
|
53
|
-
* --json (no
|
|
54
|
-
*
|
|
55
|
-
* none of the above
|
|
56
|
-
*
|
|
57
|
-
* A `dev` script that itself invokes `pyric dev` is treated as absent —
|
|
58
|
-
* running it would recurse forever (pyric dev → npm run dev → pyric dev …).
|
|
57
|
+
* Precedence:
|
|
58
|
+
* --no-run → null, always
|
|
59
|
+
* explicit CLI command (args or `--`) → that command (wins over everything else)
|
|
60
|
+
* --json (with no explicit command) → null (machine mode defaults to host-only)
|
|
61
|
+
* pyric.json `command` → parsed command argv
|
|
62
|
+
* none of the above → null (host-only)
|
|
59
63
|
*/
|
|
60
|
-
export declare function
|
|
61
|
-
passthrough: string[];
|
|
62
|
-
noRun: boolean;
|
|
63
|
-
json: boolean;
|
|
64
|
-
devScript: string | null;
|
|
65
|
-
packageManager: PackageManager;
|
|
66
|
-
}): DevChildPlan | null;
|
|
64
|
+
export declare function resolveSandboxChild(opts: ResolveSandboxChildOptions): SandboxChildPlan | null;
|
|
67
65
|
/**
|
|
68
66
|
* The absolute `file:` URL of the register module, resolved from
|
|
69
67
|
* @pyric/cli' OWN installed location — `import.meta.resolve` walks this
|
|
@@ -73,25 +71,33 @@ export declare function resolveDevChild(opts: {
|
|
|
73
71
|
* dist/register/), for runtimes without a usable import.meta.resolve.
|
|
74
72
|
*/
|
|
75
73
|
export declare function registerModuleUrl(): string;
|
|
74
|
+
/** What the launcher has to put in a child's environment for interception. */
|
|
75
|
+
export interface ChildActivation {
|
|
76
|
+
/** The serve host the child's sandbox calls reach. */
|
|
77
|
+
readonly serveUrl: string;
|
|
78
|
+
/** Absolute `file:` URL of the register module. */
|
|
79
|
+
readonly registerUrl: string;
|
|
80
|
+
/** The per-launch secret the child's handshake beacon must present.
|
|
81
|
+
* Absent when the launcher runs no beacon receiver, as the Vite plugin's
|
|
82
|
+
* Functions runtime does; the child then reports on stderr only. */
|
|
83
|
+
readonly beaconToken?: string | undefined;
|
|
84
|
+
}
|
|
76
85
|
/**
|
|
77
|
-
* Child env: sets the activator and APPENDS the loader
|
|
78
|
-
*
|
|
79
|
-
* must survive). `file:` URLs are
|
|
80
|
-
* even for paths with spaces.
|
|
86
|
+
* Child env: sets the activator and the beacon secret, and APPENDS the loader
|
|
87
|
+
* to NODE_OPTIONS rather than replacing it (the user's own --inspect /
|
|
88
|
+
* --max-old-space-size and so on must survive). `file:` URLs are
|
|
89
|
+
* percent-encoded, so no quoting is needed even for paths with spaces.
|
|
81
90
|
*/
|
|
82
|
-
export declare function buildChildEnv(base: NodeJS.ProcessEnv, opts:
|
|
83
|
-
serveUrl: string;
|
|
84
|
-
registerUrl: string;
|
|
85
|
-
}): NodeJS.ProcessEnv;
|
|
91
|
+
export declare function buildChildEnv(base: NodeJS.ProcessEnv, opts: ChildActivation): NodeJS.ProcessEnv;
|
|
86
92
|
/**
|
|
87
93
|
* Format copy-pasteable POSIX export statements for host-only startup.
|
|
88
94
|
* Grouped in a cleanly formatted console block for easy selection and copying
|
|
89
95
|
* into a separate terminal (for example, when running Next.js independently).
|
|
96
|
+
*
|
|
97
|
+
* The beacon secret is part of the block: without it a process started this
|
|
98
|
+
* way still intercepts, but the dev server cannot confirm that it did.
|
|
90
99
|
*/
|
|
91
|
-
export declare function formatStartupEnvExport(opts:
|
|
92
|
-
serveUrl: string;
|
|
93
|
-
registerUrl: string;
|
|
94
|
-
}): string;
|
|
100
|
+
export declare function formatStartupEnvExport(opts: ChildActivation): string;
|
|
95
101
|
/**
|
|
96
102
|
* Incremental line prefixer: every child output line gets `[dev] `, partial
|
|
97
103
|
* lines are buffered until their newline (or flush at stream end).
|
|
@@ -100,22 +106,21 @@ export declare function createLinePrefixer(prefix: string, write: (line: string)
|
|
|
100
106
|
push(chunk: string): void;
|
|
101
107
|
flush(): void;
|
|
102
108
|
};
|
|
103
|
-
export interface
|
|
104
|
-
/** Resolves with the exit code to propagate once the child is gone. */
|
|
109
|
+
export interface SandboxChildHandle {
|
|
105
110
|
exited: Promise<number>;
|
|
106
|
-
/** Forward a signal (Ctrl-C / SIGTERM). Marks the exit as user-initiated
|
|
107
|
-
* so the propagated code is 0, and SIGKILLs a child that lingers. */
|
|
108
111
|
signal(sig: NodeJS.Signals): void;
|
|
109
112
|
child: ChildProcess;
|
|
110
113
|
}
|
|
114
|
+
export type DevChildHandle = SandboxChildHandle;
|
|
111
115
|
/**
|
|
112
116
|
* Spawn the child with inherited stdin and `[dev]`-prefixed stdout/stderr.
|
|
113
117
|
* In `--json` mode ALL child output goes to stderr — stdout carries exactly
|
|
114
118
|
* the one machine line (the serve --json contract).
|
|
115
119
|
*/
|
|
116
|
-
export declare function
|
|
120
|
+
export declare function spawnSandboxChild(plan: SandboxChildPlan, opts: {
|
|
117
121
|
cwd: string;
|
|
118
122
|
env: NodeJS.ProcessEnv;
|
|
119
123
|
json: boolean;
|
|
120
|
-
}):
|
|
121
|
-
|
|
124
|
+
}): SandboxChildHandle;
|
|
125
|
+
export declare const spawnDevChild: typeof spawnSandboxChild;
|
|
126
|
+
//# sourceMappingURL=sandbox-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-runner.d.ts","sourceRoot":"","sources":["../../src/cli/sandbox-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAK9D;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE;IACJ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC,GACL,OAAO,CAAC,OAAO,CAAC,CAmBlB;AAID,MAAM,WAAW,gBAAgB;IAC/B,iDAAiD;IACjD,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE5C;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAcxD;AAED,MAAM,WAAW,0BAA0B;IACzC,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,0BAA0B,GAAG,gBAAgB,GAAG,IAAI,CAuB7F;AAID;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAQ1C;AAED,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;yEAEqE;IACrE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,CAAC,UAAU,EACvB,IAAI,EAAE,eAAe,GACpB,MAAM,CAAC,UAAU,CASnB;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAgBpE;AAID;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC5B;IAAE,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,IAAI,IAAI,CAAA;CAAE,CAkB9C;AAOD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IAClC,KAAK,EAAE,YAAY,CAAC;CACrB;AAED,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEhD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC3D,kBAAkB,CA6FpB;AAED,eAAO,MAAM,aAAa,0BAAoB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `pyric
|
|
2
|
+
* The `pyric sandbox` child runner starts the configured application command
|
|
3
|
+
* after the host is ready:
|
|
3
4
|
* after the host is up, run the user's OWN dev command with the environment
|
|
4
5
|
* activated so their unchanged firebase-admin/firebase imports resolve to the
|
|
5
6
|
* pyric sandbox:
|
|
@@ -7,21 +8,19 @@
|
|
|
7
8
|
* PYRIC_SANDBOX=remote:<serve url> (the activator)
|
|
8
9
|
* NODE_OPTIONS += --import @pyric/cli/register (the substitution seam)
|
|
9
10
|
*
|
|
10
|
-
* Child-command precedence:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* defaults to host-only (an explicit `--` still wins — agents can opt in).
|
|
11
|
+
* Child-command precedence: `--no-run`, an explicit command, `--json`, the
|
|
12
|
+
* `pyric.json` command, then host-only. An explicit command still runs with
|
|
13
|
+
* `--json`.
|
|
14
14
|
*
|
|
15
15
|
* Everything decision-shaped here is pure and exported for the unit suite;
|
|
16
16
|
* only `spawnDevChild` touches the process table.
|
|
17
17
|
*/
|
|
18
18
|
import { spawn } from 'node:child_process';
|
|
19
|
-
import {
|
|
20
|
-
import { join } from 'node:path';
|
|
19
|
+
import { SHELL_OPERATORS } from './unsupported-runtime.js';
|
|
21
20
|
// ─── First-run race guard ───────────────────────────────────────────────────
|
|
22
21
|
/**
|
|
23
22
|
* Wait (bounded) for a browser tab to register as the bridge's sandbox peer
|
|
24
|
-
* before the child spawns. `pyric
|
|
23
|
+
* before the child spawns. `pyric sandbox` opens the tab and spawns the child in
|
|
25
24
|
* the same breath; a child whose first line is a sandbox op otherwise races
|
|
26
25
|
* the tab's boot and dies on the no-tab fail-fast — the exact first-run of
|
|
27
26
|
* the two-command story. Polls `/__pyric/health` (`sandboxConnected`).
|
|
@@ -53,51 +52,55 @@ export async function waitForSandboxPeer(serveUrl, opts = {}) {
|
|
|
53
52
|
await sleep(intervalMs);
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
catch {
|
|
74
|
-
return null;
|
|
55
|
+
/**
|
|
56
|
+
* Tokenize a command string into an argv array, preserving quoted strings.
|
|
57
|
+
*/
|
|
58
|
+
export function parseCommandString(cmd) {
|
|
59
|
+
const parts = [];
|
|
60
|
+
const regex = /[^\s"']+|"([^"]*)"|'([^']*)'/g;
|
|
61
|
+
let match;
|
|
62
|
+
while ((match = regex.exec(cmd)) !== null) {
|
|
63
|
+
if (match[1] !== undefined) {
|
|
64
|
+
parts.push(match[1]);
|
|
65
|
+
}
|
|
66
|
+
else if (match[2] !== undefined) {
|
|
67
|
+
parts.push(match[2]);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
parts.push(match[0]);
|
|
71
|
+
}
|
|
75
72
|
}
|
|
73
|
+
return parts;
|
|
76
74
|
}
|
|
77
75
|
/**
|
|
78
76
|
* Decide what (if anything) to run after the host is up.
|
|
79
77
|
*
|
|
80
|
-
*
|
|
81
|
-
* --no-run
|
|
82
|
-
*
|
|
83
|
-
* --json (no
|
|
84
|
-
*
|
|
85
|
-
* none of the above
|
|
86
|
-
*
|
|
87
|
-
* A `dev` script that itself invokes `pyric dev` is treated as absent —
|
|
88
|
-
* running it would recurse forever (pyric dev → npm run dev → pyric dev …).
|
|
78
|
+
* Precedence:
|
|
79
|
+
* --no-run → null, always
|
|
80
|
+
* explicit CLI command (args or `--`) → that command (wins over everything else)
|
|
81
|
+
* --json (with no explicit command) → null (machine mode defaults to host-only)
|
|
82
|
+
* pyric.json `command` → parsed command argv
|
|
83
|
+
* none of the above → null (host-only)
|
|
89
84
|
*/
|
|
90
|
-
export function
|
|
85
|
+
export function resolveSandboxChild(opts) {
|
|
91
86
|
if (opts.noRun)
|
|
92
87
|
return null;
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
let activeCommand = null;
|
|
89
|
+
if (opts.explicitCommand && opts.explicitCommand.length > 0) {
|
|
90
|
+
activeCommand = opts.explicitCommand;
|
|
91
|
+
}
|
|
92
|
+
else if (opts.passthrough && opts.passthrough.length > 0) {
|
|
93
|
+
activeCommand = opts.passthrough;
|
|
94
|
+
}
|
|
95
|
+
if (activeCommand !== null) {
|
|
96
|
+
return { argv: [...activeCommand], label: activeCommand.join(' ') };
|
|
95
97
|
}
|
|
96
98
|
if (opts.json)
|
|
97
99
|
return null;
|
|
98
|
-
if (opts.
|
|
99
|
-
const
|
|
100
|
-
|
|
100
|
+
if (opts.configCommand && opts.configCommand.trim().length > 0) {
|
|
101
|
+
const trimmed = opts.configCommand.trim();
|
|
102
|
+
const argv = parseCommandString(trimmed);
|
|
103
|
+
return { argv, label: trimmed };
|
|
101
104
|
}
|
|
102
105
|
return null;
|
|
103
106
|
}
|
|
@@ -122,35 +125,43 @@ export function registerModuleUrl() {
|
|
|
122
125
|
return new URL('../register/index.js', import.meta.url).href;
|
|
123
126
|
}
|
|
124
127
|
/**
|
|
125
|
-
* Child env: sets the activator and APPENDS the loader
|
|
126
|
-
*
|
|
127
|
-
* must survive). `file:` URLs are
|
|
128
|
-
* even for paths with spaces.
|
|
128
|
+
* Child env: sets the activator and the beacon secret, and APPENDS the loader
|
|
129
|
+
* to NODE_OPTIONS rather than replacing it (the user's own --inspect /
|
|
130
|
+
* --max-old-space-size and so on must survive). `file:` URLs are
|
|
131
|
+
* percent-encoded, so no quoting is needed even for paths with spaces.
|
|
129
132
|
*/
|
|
130
133
|
export function buildChildEnv(base, opts) {
|
|
131
134
|
const importFlag = `--import ${opts.registerUrl}`;
|
|
132
|
-
|
|
135
|
+
const env = {
|
|
133
136
|
...base,
|
|
134
137
|
PYRIC_SANDBOX: `remote:${opts.serveUrl}`,
|
|
135
138
|
NODE_OPTIONS: base.NODE_OPTIONS ? `${base.NODE_OPTIONS} ${importFlag}` : importFlag,
|
|
136
139
|
};
|
|
140
|
+
if (opts.beaconToken !== undefined)
|
|
141
|
+
env.PYRIC_BEACON_TOKEN = opts.beaconToken;
|
|
142
|
+
return env;
|
|
137
143
|
}
|
|
138
144
|
/**
|
|
139
145
|
* Format copy-pasteable POSIX export statements for host-only startup.
|
|
140
146
|
* Grouped in a cleanly formatted console block for easy selection and copying
|
|
141
147
|
* into a separate terminal (for example, when running Next.js independently).
|
|
148
|
+
*
|
|
149
|
+
* The beacon secret is part of the block: without it a process started this
|
|
150
|
+
* way still intercepts, but the dev server cannot confirm that it did.
|
|
142
151
|
*/
|
|
143
152
|
export function formatStartupEnvExport(opts) {
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
const lines = [`export PYRIC_SANDBOX="remote:${opts.serveUrl}"`];
|
|
154
|
+
if (opts.beaconToken !== undefined) {
|
|
155
|
+
lines.push(`export PYRIC_BEACON_TOKEN="${opts.beaconToken}"`);
|
|
156
|
+
}
|
|
157
|
+
lines.push(`export NODE_OPTIONS="--import ${opts.registerUrl}"`);
|
|
158
|
+
const width = Math.max(...lines.map((line) => line.length));
|
|
159
|
+
const divider = '─'.repeat(width + 4);
|
|
160
|
+
const body = lines.map((line) => ` ${line}\n`).join('');
|
|
149
161
|
return ('\n' +
|
|
150
162
|
' To run external commands against this sandbox, paste in another terminal:\n' +
|
|
151
163
|
` ${divider}\n` +
|
|
152
|
-
|
|
153
|
-
` ${line2}\n` +
|
|
164
|
+
body +
|
|
154
165
|
` ${divider}\n`);
|
|
155
166
|
}
|
|
156
167
|
// ─── Line prefixing (pure core) ────────────────────────────────────────────
|
|
@@ -177,6 +188,7 @@ export function createLinePrefixer(prefix, write) {
|
|
|
177
188
|
},
|
|
178
189
|
};
|
|
179
190
|
}
|
|
191
|
+
// ─── Spawn + lifecycle ─────────────────────────────────────────────────────
|
|
180
192
|
/** How long a signalled child may linger before SIGKILL. */
|
|
181
193
|
const FORCE_KILL_AFTER_MS = 2_000;
|
|
182
194
|
/**
|
|
@@ -184,17 +196,42 @@ const FORCE_KILL_AFTER_MS = 2_000;
|
|
|
184
196
|
* In `--json` mode ALL child output goes to stderr — stdout carries exactly
|
|
185
197
|
* the one machine line (the serve --json contract).
|
|
186
198
|
*/
|
|
187
|
-
export function
|
|
188
|
-
const
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
199
|
+
export function spawnSandboxChild(plan, opts) {
|
|
200
|
+
const parts = [...plan.argv];
|
|
201
|
+
const env = { ...opts.env };
|
|
202
|
+
// 1. Extract leading KEY=VAL assignments (e.g. PORT=8080 node server.js)
|
|
203
|
+
while (parts.length > 0 && /^[A-Za-z_][A-Za-z0-9_]*=/.test(parts[0])) {
|
|
204
|
+
const token = parts.shift();
|
|
205
|
+
const eq = token.indexOf('=');
|
|
206
|
+
const key = token.slice(0, eq);
|
|
207
|
+
const val = token.slice(eq + 1);
|
|
208
|
+
env[key] = val;
|
|
209
|
+
}
|
|
210
|
+
// 2. Check for discrete shell operators (&&, ||, |, ;) among top-level tokens
|
|
211
|
+
const hasShellOperators = parts.some((token) => SHELL_OPERATORS.has(token));
|
|
212
|
+
// The bun/deno warning is emitted by the launch seam in serve.ts, alongside
|
|
213
|
+
// the interlock line, so every pre-spawn statement about the child prints in
|
|
214
|
+
// one block and in order.
|
|
215
|
+
const [command, ...args] = parts;
|
|
216
|
+
let child;
|
|
217
|
+
if (hasShellOperators) {
|
|
218
|
+
child = spawn(plan.label, [], {
|
|
219
|
+
cwd: opts.cwd,
|
|
220
|
+
env,
|
|
221
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
222
|
+
shell: true,
|
|
223
|
+
detached: process.platform !== 'win32',
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
child = spawn(command, args, {
|
|
228
|
+
cwd: opts.cwd,
|
|
229
|
+
env,
|
|
230
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
231
|
+
shell: process.platform === 'win32',
|
|
232
|
+
detached: process.platform !== 'win32',
|
|
233
|
+
});
|
|
234
|
+
}
|
|
198
235
|
const outTarget = opts.json ? process.stderr : process.stdout;
|
|
199
236
|
const out = createLinePrefixer('[dev] ', (line) => outTarget.write(line));
|
|
200
237
|
const err = createLinePrefixer('[dev] ', (line) => process.stderr.write(line));
|
|
@@ -214,7 +251,7 @@ export function spawnDevChild(plan, opts) {
|
|
|
214
251
|
};
|
|
215
252
|
const exited = new Promise((resolve) => {
|
|
216
253
|
child.once('error', (e) => {
|
|
217
|
-
process.stderr.write(`pyric
|
|
254
|
+
process.stderr.write(`pyric sandbox: failed to run \`${plan.label}\`: ${e.message}\n`);
|
|
218
255
|
resolve(1);
|
|
219
256
|
});
|
|
220
257
|
child.once('exit', (code, signal) => {
|
|
@@ -254,4 +291,5 @@ export function spawnDevChild(plan, opts) {
|
|
|
254
291
|
},
|
|
255
292
|
};
|
|
256
293
|
}
|
|
257
|
-
|
|
294
|
+
export const spawnDevChild = spawnSandboxChild;
|
|
295
|
+
//# sourceMappingURL=sandbox-runner.js.map
|