@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,462 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The runtime network guard: the enforcement half of the production-leak
|
|
3
|
+
* invariant.
|
|
4
|
+
*
|
|
5
|
+
* A sandboxed app's Firebase traffic all routes to the local `/__pyric/*`
|
|
6
|
+
* namespace. So a pyric-launched process that opens a connection to a real
|
|
7
|
+
* Google/Firebase endpoint has escaped the sandbox: it is reading or writing
|
|
8
|
+
* live production data with the developer believing otherwise. This module
|
|
9
|
+
* detects that egress and, depending on one knob, warns about it or fails it.
|
|
10
|
+
*
|
|
11
|
+
* Where it hooks, and why exactly there
|
|
12
|
+
* -------------------------------------
|
|
13
|
+
* 1. `Symbol.for('undici.globalDispatcher.1')`, the undici global dispatcher.
|
|
14
|
+
* Measured against Next 15.5 / Node 24 / undici 7, this one seam covers
|
|
15
|
+
* Node route handlers, edge route handlers and middleware, under both the
|
|
16
|
+
* webpack and turbopack dev servers. Patching `globalThis.fetch` does not:
|
|
17
|
+
* the edge sandbox bundles its own undici, and that copy's
|
|
18
|
+
* `getGlobalDispatcher()` reads the host realm's symbol, which is precisely
|
|
19
|
+
* why hooking the dispatcher reaches it and hooking `fetch` does not.
|
|
20
|
+
*
|
|
21
|
+
* Three mechanics the seam depends on:
|
|
22
|
+
* - undici installs the property `configurable: false, writable: true`, so
|
|
23
|
+
* we install by plain assignment. A `defineProperty` with
|
|
24
|
+
* `configurable: true` throws a TypeError and takes the dev server down
|
|
25
|
+
* with it. Accessor traps are useless anyway, because
|
|
26
|
+
* `setGlobalDispatcher` uses `defineProperty`, which bypasses setters.
|
|
27
|
+
* - The property does not exist until undici is first touched, and undici
|
|
28
|
+
* only installs a default agent when it finds the slot empty. So we
|
|
29
|
+
* materialize it first with `new Headers()` (loads undici, zero
|
|
30
|
+
* network) and wrap whatever real Agent that produces.
|
|
31
|
+
* - The `handler` argument of `dispatch(opts, handler)` must pass through
|
|
32
|
+
* opaque and by identity. Edge hands a v6-shaped handler to the host's
|
|
33
|
+
* v7 Agent and that cross-version handoff only survives untouched. We
|
|
34
|
+
* read `opts.origin` and nothing else.
|
|
35
|
+
*
|
|
36
|
+
* 2. `net.connect` / `net.createConnection` / `tls.connect`, plus the
|
|
37
|
+
* `createConnection` on the `http.Agent` and `https.Agent` prototypes: the
|
|
38
|
+
* backstop for traffic that never goes through undici, such as
|
|
39
|
+
* `http.request`, gRPC, database drivers, anything holding a raw socket.
|
|
40
|
+
* Same catalog, same policy. (undici itself connects through `net.connect`,
|
|
41
|
+
* so a warn-mode fetch would report twice; the once-per-host dedupe below
|
|
42
|
+
* collapses that.)
|
|
43
|
+
*
|
|
44
|
+
* The Agent prototypes need their own patch because
|
|
45
|
+
* `http.Agent.prototype.createConnection` is a copied reference to
|
|
46
|
+
* `net.createConnection`, taken when `_http_agent` first loaded. If anything
|
|
47
|
+
* loaded `node:http` before this module ran, that copy is the unpatched
|
|
48
|
+
* function and every plain `http.request` would sail past the backstop,
|
|
49
|
+
* including a request to the metadata server. It is also why the socket
|
|
50
|
+
* patches are installed BEFORE the dispatcher is materialized: materializing
|
|
51
|
+
* loads undici, which loads `_http_agent`.
|
|
52
|
+
*
|
|
53
|
+
* Policy
|
|
54
|
+
* ------
|
|
55
|
+
* One knob, `PYRIC_GUARD=warn|block|off`, default `warn`:
|
|
56
|
+
* warn report the egress, let it through
|
|
57
|
+
* block report it and fail the request
|
|
58
|
+
* off no hooks at all, one notice line at install time
|
|
59
|
+
* The GCE metadata IP (`169.254.169.254`, `alwaysBlock` in the catalog) is
|
|
60
|
+
* refused in warn mode and cannot be allowlisted, since its only use from a
|
|
61
|
+
* dev process is credential theft. `off` is genuinely off, metadata IP
|
|
62
|
+
* included; the off notice says so out loud.
|
|
63
|
+
*
|
|
64
|
+
* A blocked fetch surfaces to app code as a bare `TypeError: fetch failed`
|
|
65
|
+
* (the reason is buried on `error.cause`), so the guard must log its own
|
|
66
|
+
* denial: the app's error will never explain itself.
|
|
67
|
+
*
|
|
68
|
+
* The allowlist seam
|
|
69
|
+
* ------------------
|
|
70
|
+
* `PYRIC_GUARD_ALLOW` is a comma/whitespace separated list of hosts or URLs,
|
|
71
|
+
* matched on label boundaries, permitting an otherwise-flagged catalog host
|
|
72
|
+
* (an allowlisted hit is still reported once). Env is the seam by design:
|
|
73
|
+
* - the AI engine baseUrls live in the user's Vite config
|
|
74
|
+
* (`PyricAiOptions.engine.baseUrl`, `serve/vite-ai-config.ts`), which is
|
|
75
|
+
* read by the Vite plugin inside the serve host, a different process from
|
|
76
|
+
* the one this module loads into, and not parsed by the CLI at all;
|
|
77
|
+
* - `pyric.json` is read asynchronously by `runServe` (`cli/pyric-config.ts`)
|
|
78
|
+
* and this module runs on the `--import` hot path of every child, where a
|
|
79
|
+
* synchronous config-file read has no business being.
|
|
80
|
+
* `cli/sandbox-runner.ts:buildChildEnv` spreads the parent env into the child,
|
|
81
|
+
* so anything the pyric process exports reaches every descendant for free
|
|
82
|
+
* (`NODE_OPTIONS` already propagates the register import the same way). To
|
|
83
|
+
* wire a `pyric.json` `guardAllow` through, the whole change is: add the field
|
|
84
|
+
* to `PyricConfig`, and have `buildChildEnv` set `PYRIC_GUARD_ALLOW` from it
|
|
85
|
+
* at the `cli/serve.ts` call site, where `pyricConfig` is already in scope.
|
|
86
|
+
*
|
|
87
|
+
* Bun and Deno are out of scope: neither evaluates Node loader hooks (the
|
|
88
|
+
* register module never loads there) and neither routes `fetch` through
|
|
89
|
+
* undici's global dispatcher. `installNetGuard` degrades to the socket
|
|
90
|
+
* backstop instead of throwing.
|
|
91
|
+
*/
|
|
92
|
+
import { createRequire } from 'node:module';
|
|
93
|
+
import { lookupGoogleEndpoint, matchesHostSuffix, normalizeHostname, } from '../google-endpoints.js';
|
|
94
|
+
/** undici's global-dispatcher slot. Version-suffixed by undici itself. */
|
|
95
|
+
const UNDICI_GLOBAL_DISPATCHER = Symbol.for('undici.globalDispatcher.1');
|
|
96
|
+
/** Marks a rejection as the guard's, so callers can tell it from a DNS/TLS
|
|
97
|
+
* failure. A blocked `fetch` only exposes it as `error.cause.code`. */
|
|
98
|
+
export const GUARD_BLOCKED_CODE = 'PYRIC_GUARD_BLOCKED';
|
|
99
|
+
const LOG_PREFIX = '@pyric/cli/register: net-guard';
|
|
100
|
+
/** How often to check that nobody replaced the global dispatcher under us. */
|
|
101
|
+
const REASSERT_INTERVAL_MS = 5_000;
|
|
102
|
+
/** `PYRIC_GUARD` → mode. Unset, empty or unrecognised all mean the safe
|
|
103
|
+
* default: report, do not break the developer's app. */
|
|
104
|
+
export function parseGuardMode(raw) {
|
|
105
|
+
const value = (raw ?? '').trim().toLowerCase();
|
|
106
|
+
if (value === 'block')
|
|
107
|
+
return 'block';
|
|
108
|
+
if (value === 'off')
|
|
109
|
+
return 'off';
|
|
110
|
+
return 'warn';
|
|
111
|
+
}
|
|
112
|
+
/** `PYRIC_GUARD_ALLOW` → hostnames. Accepts bare hosts and full URLs, because
|
|
113
|
+
* the values it carries are configured as URLs (AI engine baseUrls). */
|
|
114
|
+
export function parseAllowHosts(raw) {
|
|
115
|
+
if (!raw)
|
|
116
|
+
return [];
|
|
117
|
+
const out = [];
|
|
118
|
+
for (const token of raw.split(/[\s,]+/)) {
|
|
119
|
+
const entry = token.trim();
|
|
120
|
+
if (entry.length === 0)
|
|
121
|
+
continue;
|
|
122
|
+
out.push(hostnameOf(entry));
|
|
123
|
+
}
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
126
|
+
/** Only a trailing `:port` is stripped; a bare IPv6 address is left alone. */
|
|
127
|
+
const HOST_WITH_PORT = /^(.+):\d+$/;
|
|
128
|
+
/**
|
|
129
|
+
* Best-effort hostname from a host, `host:port`, or full URL. Normalization
|
|
130
|
+
* and suffix matching are the catalog's, so the guard and the catalog can
|
|
131
|
+
* never disagree about what a hostname is.
|
|
132
|
+
*/
|
|
133
|
+
function hostnameOf(value) {
|
|
134
|
+
const trimmed = value.trim();
|
|
135
|
+
if (trimmed.includes('://')) {
|
|
136
|
+
try {
|
|
137
|
+
return normalizeHostname(new URL(trimmed).hostname).replace(/^\[|\]$/g, '');
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
// Not a parseable URL: fall through to the textual forms.
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const withoutPath = trimmed.split('/')[0] ?? trimmed;
|
|
144
|
+
const portMatch = HOST_WITH_PORT.exec(withoutPath);
|
|
145
|
+
let hostPart;
|
|
146
|
+
if (portMatch === null) {
|
|
147
|
+
hostPart = withoutPath;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
hostPart = portMatch[1];
|
|
151
|
+
}
|
|
152
|
+
return normalizeHostname(hostPart);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The whole verdict, pure: catalog lookup, then `alwaysBlock`, then the
|
|
156
|
+
* allowlist, then the mode. `null` means nothing to say: either not a
|
|
157
|
+
* production endpoint, or the guard is off.
|
|
158
|
+
*/
|
|
159
|
+
export function evaluateEgress(hostname, policy) {
|
|
160
|
+
if (policy.mode === 'off')
|
|
161
|
+
return null;
|
|
162
|
+
const host = hostnameOf(hostname);
|
|
163
|
+
if (host.length === 0)
|
|
164
|
+
return null;
|
|
165
|
+
const entry = lookupGoogleEndpoint(host);
|
|
166
|
+
if (entry === undefined)
|
|
167
|
+
return null;
|
|
168
|
+
// `alwaysBlock` outranks both the mode and the allowlist: the metadata
|
|
169
|
+
// server is never a legitimate destination for a sandboxed dev process, so
|
|
170
|
+
// there is no configuration that should be able to permit it.
|
|
171
|
+
if (entry.alwaysBlock === true) {
|
|
172
|
+
return {
|
|
173
|
+
verdict: 'block',
|
|
174
|
+
permitted: false,
|
|
175
|
+
host,
|
|
176
|
+
endpoint: entry.host,
|
|
177
|
+
service: entry.service,
|
|
178
|
+
alwaysBlock: true,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
if (policy.allow.some((allowed) => matchesHostSuffix(host, allowed))) {
|
|
182
|
+
return { verdict: 'allow', permitted: true, host, endpoint: entry.host, service: entry.service };
|
|
183
|
+
}
|
|
184
|
+
if (policy.mode === 'block') {
|
|
185
|
+
return {
|
|
186
|
+
verdict: 'block',
|
|
187
|
+
permitted: false,
|
|
188
|
+
host,
|
|
189
|
+
endpoint: entry.host,
|
|
190
|
+
service: entry.service,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
return { verdict: 'warn', permitted: true, host, endpoint: entry.host, service: entry.service };
|
|
194
|
+
}
|
|
195
|
+
/** One stderr line per verdict: structured (fixed leading fields, so it is
|
|
196
|
+
* greppable) and attributable (service + transport + initiating command).
|
|
197
|
+
* The request PATH is deliberately never logged: it carries ids and tokens. */
|
|
198
|
+
export function formatGuardLine(verdict, transport, context) {
|
|
199
|
+
let where = `via ${transport}`;
|
|
200
|
+
if (context !== undefined && context.length > 0)
|
|
201
|
+
where = `${where} from ${context}`;
|
|
202
|
+
const head = `${LOG_PREFIX} ${verdict.verdict.toUpperCase()} ${verdict.host} (${verdict.service}) ${where}:`;
|
|
203
|
+
const tail = 'Further attempts to this host are not logged.';
|
|
204
|
+
if (verdict.verdict === 'allow') {
|
|
205
|
+
return `${head} live production egress permitted by PYRIC_GUARD_ALLOW. ${tail}\n`;
|
|
206
|
+
}
|
|
207
|
+
if (verdict.verdict === 'warn') {
|
|
208
|
+
return (`${head} LIVE production egress. A sandboxed app routes Firebase traffic to /__pyric/*, ` +
|
|
209
|
+
`so this is reaching real data. Set PYRIC_GUARD=block to fail these requests instead. ${tail}\n`);
|
|
210
|
+
}
|
|
211
|
+
let why;
|
|
212
|
+
if (verdict.alwaysBlock === true) {
|
|
213
|
+
why = 'the credential metadata server is refused in every mode except PYRIC_GUARD=off';
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
why = 'live production egress refused (PYRIC_GUARD=block)';
|
|
217
|
+
}
|
|
218
|
+
// What the app actually observes differs by seam: undici swallows our throw
|
|
219
|
+
// into the opaque `TypeError: fetch failed`, while a raw socket caller gets
|
|
220
|
+
// the error itself. Say which, or the developer cannot connect the two.
|
|
221
|
+
let surfaces;
|
|
222
|
+
if (transport === 'fetch') {
|
|
223
|
+
surfaces = `the caller sees \`TypeError: fetch failed\` with cause ${GUARD_BLOCKED_CODE}`;
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
surfaces = `the caller sees an error with code ${GUARD_BLOCKED_CODE}`;
|
|
227
|
+
}
|
|
228
|
+
return `${head} ${why}; ${surfaces}. ${tail}\n`;
|
|
229
|
+
}
|
|
230
|
+
function blockedError(verdict, transport) {
|
|
231
|
+
return Object.assign(new Error(`pyric net-guard blocked ${transport} egress to ${verdict.host} (${verdict.service}): ` +
|
|
232
|
+
`this is LIVE production, not the pyric sandbox. ` +
|
|
233
|
+
`Set PYRIC_GUARD=warn to allow it, or PYRIC_GUARD_ALLOW to permit this host.`), { code: GUARD_BLOCKED_CODE, host: verdict.host, service: verdict.service });
|
|
234
|
+
}
|
|
235
|
+
function createReporter(options) {
|
|
236
|
+
const write = options.write ?? ((line) => void process.stderr.write(line));
|
|
237
|
+
const policy = { mode: options.mode, allow: options.allow };
|
|
238
|
+
const reported = options.reported ?? new Set();
|
|
239
|
+
return {
|
|
240
|
+
check(hostname, transport) {
|
|
241
|
+
if (hostname === undefined)
|
|
242
|
+
return;
|
|
243
|
+
const verdict = evaluateEgress(hostname, policy);
|
|
244
|
+
if (verdict === null)
|
|
245
|
+
return;
|
|
246
|
+
// A dev server retries relentlessly; one line per host is the signal,
|
|
247
|
+
// and it also collapses the undici-over-net.connect double report.
|
|
248
|
+
const key = `${verdict.verdict}:${verdict.host}`;
|
|
249
|
+
if (!reported.has(key)) {
|
|
250
|
+
reported.add(key);
|
|
251
|
+
write(formatGuardLine(verdict, transport, options.context));
|
|
252
|
+
}
|
|
253
|
+
if (!verdict.permitted)
|
|
254
|
+
throw blockedError(verdict, transport);
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/** `opts.origin` is a URL or an origin string; anything else means "no idea",
|
|
259
|
+
* and an unrecognisable origin is passed through rather than guessed at. */
|
|
260
|
+
function originHost(opts) {
|
|
261
|
+
const origin = opts?.origin;
|
|
262
|
+
if (origin === undefined || origin === null)
|
|
263
|
+
return undefined;
|
|
264
|
+
if (typeof origin === 'object' && 'hostname' in origin) {
|
|
265
|
+
const hostname = origin.hostname;
|
|
266
|
+
return typeof hostname === 'string' ? hostname.toLowerCase() : undefined;
|
|
267
|
+
}
|
|
268
|
+
if (typeof origin !== 'string')
|
|
269
|
+
return undefined;
|
|
270
|
+
try {
|
|
271
|
+
return new URL(origin).hostname.toLowerCase();
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
return undefined;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Wrap a dispatcher so `dispatch` is guarded and every other member still
|
|
279
|
+
* belongs to the real instance.
|
|
280
|
+
*
|
|
281
|
+
* A `Proxy` rather than a subclass or a copy: undici's Agent keeps state in
|
|
282
|
+
* private fields and internal symbols, and every forwarded call must run with
|
|
283
|
+
* `this` bound to the REAL instance (hence `Reflect.get(target, prop, target)`
|
|
284
|
+
* and the bind) or those fields are not there. `instanceof` keeps working.
|
|
285
|
+
*/
|
|
286
|
+
export function wrapDispatcher(real, options) {
|
|
287
|
+
const reporter = createReporter(options);
|
|
288
|
+
const guardedDispatch = (opts, handler) => {
|
|
289
|
+
reporter.check(originHost(opts), 'fetch');
|
|
290
|
+
// Both arguments cross UNTOUCHED. Edge hands a v6 handler to the host's
|
|
291
|
+
// v7 Agent, and that handoff only survives by identity.
|
|
292
|
+
return real.dispatch(opts, handler);
|
|
293
|
+
};
|
|
294
|
+
return new Proxy(real, {
|
|
295
|
+
get(target, prop) {
|
|
296
|
+
if (prop === 'dispatch')
|
|
297
|
+
return guardedDispatch;
|
|
298
|
+
const value = Reflect.get(target, prop, target);
|
|
299
|
+
return typeof value === 'function' ? value.bind(target) : value;
|
|
300
|
+
},
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/** `basename(argv[1])`, the cheapest honest attribution available. */
|
|
304
|
+
function contextFrom(argv) {
|
|
305
|
+
const entry = argv?.[1];
|
|
306
|
+
if (typeof entry !== 'string' || entry.length === 0)
|
|
307
|
+
return undefined;
|
|
308
|
+
const parts = entry.split(/[\\/]/);
|
|
309
|
+
return parts[parts.length - 1] || undefined;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Materialize undici's lazy global dispatcher without touching the network.
|
|
313
|
+
* `new Headers()` loads Node's undici, whose module body installs a default
|
|
314
|
+
* Agent into the symbol only if the slot is still empty, so this must run
|
|
315
|
+
* before we put anything there. It also loads `_http_agent`, which is why the
|
|
316
|
+
* socket patches go in first.
|
|
317
|
+
*/
|
|
318
|
+
function materializeGlobalDispatcher() {
|
|
319
|
+
try {
|
|
320
|
+
new Headers();
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
// No WHATWG Headers, or a runtime that never had undici. The socket
|
|
324
|
+
// backstop still applies.
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* The `http.Agent` and `https.Agent` prototypes, or an empty list on a runtime
|
|
329
|
+
* without them. Each carries its own `createConnection`: `http`'s is a copied
|
|
330
|
+
* reference to `net.createConnection` snapshotted at `_http_agent` load time,
|
|
331
|
+
* so patching `net` alone leaves it unguarded whenever `node:http` loaded
|
|
332
|
+
* first.
|
|
333
|
+
*/
|
|
334
|
+
function nodeAgentPrototypes() {
|
|
335
|
+
const require = createRequire(import.meta.url);
|
|
336
|
+
const prototypes = [];
|
|
337
|
+
for (const id of ['node:http', 'node:https']) {
|
|
338
|
+
try {
|
|
339
|
+
const mod = require(id);
|
|
340
|
+
const prototype = mod.Agent?.prototype;
|
|
341
|
+
if (typeof prototype === 'object' && prototype !== null) {
|
|
342
|
+
prototypes.push(prototype);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
catch {
|
|
346
|
+
// Runtime without that module: the other seams still apply.
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return prototypes;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Install the guard. Gated on `PYRIC_SANDBOX` exactly like the rest of the
|
|
353
|
+
* register module: without the activator this is a no-op, so the module stays
|
|
354
|
+
* safe to import anywhere. Returns `null` when nothing was installed.
|
|
355
|
+
*/
|
|
356
|
+
export function installNetGuard(hooks = {}) {
|
|
357
|
+
const env = hooks.env ?? process.env;
|
|
358
|
+
if (!env.PYRIC_SANDBOX)
|
|
359
|
+
return null;
|
|
360
|
+
const write = hooks.write ?? ((line) => void process.stderr.write(line));
|
|
361
|
+
const mode = parseGuardMode(env.PYRIC_GUARD);
|
|
362
|
+
if (mode === 'off') {
|
|
363
|
+
write(`${LOG_PREFIX} disabled (PYRIC_GUARD=off): egress from this process to live ` +
|
|
364
|
+
`Google/Firebase endpoints is neither reported nor blocked, not even the GCE ` +
|
|
365
|
+
`metadata server (169.254.169.254).\n`);
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
const allow = parseAllowHosts(env.PYRIC_GUARD_ALLOW);
|
|
369
|
+
const context = contextFrom(hooks.argv ?? process.argv);
|
|
370
|
+
const reporterOptions = { mode, allow, write, context, reported: new Set() };
|
|
371
|
+
const scope = hooks.scope ?? globalThis;
|
|
372
|
+
// ── socket backstop: http.request, gRPC, DB drivers, raw sockets ──
|
|
373
|
+
//
|
|
374
|
+
// This runs FIRST, before the dispatcher is materialized. Materializing
|
|
375
|
+
// loads undici, which loads `_http_agent`, which snapshots
|
|
376
|
+
// `net.createConnection` onto `http.Agent.prototype.createConnection`. With
|
|
377
|
+
// the order reversed, that snapshot is the unpatched function and every
|
|
378
|
+
// plain `http.request` escapes the guard, the metadata server included.
|
|
379
|
+
const require = createRequire(import.meta.url);
|
|
380
|
+
const netModule = hooks.net ?? require('node:net');
|
|
381
|
+
const tlsModule = hooks.tls ?? require('node:tls');
|
|
382
|
+
const reporter = createReporter(reporterOptions);
|
|
383
|
+
const guardConnect = (target, name) => {
|
|
384
|
+
const original = target[name];
|
|
385
|
+
if (typeof original !== 'function')
|
|
386
|
+
return;
|
|
387
|
+
const wrapped = function (...args) {
|
|
388
|
+
reporter.check(connectHost(args), 'socket');
|
|
389
|
+
return original.apply(this, args);
|
|
390
|
+
};
|
|
391
|
+
target[name] = wrapped;
|
|
392
|
+
};
|
|
393
|
+
guardConnect(netModule, 'connect');
|
|
394
|
+
guardConnect(netModule, 'createConnection');
|
|
395
|
+
guardConnect(tlsModule, 'connect');
|
|
396
|
+
// And the Agent prototypes, so a `node:http` that loaded before this module
|
|
397
|
+
// is still covered. `https.Agent` also reaches the patched `tls.connect`, so
|
|
398
|
+
// its own patch is a second check on the same egress; the once-per-host
|
|
399
|
+
// dedupe keeps that from printing twice.
|
|
400
|
+
for (const prototype of hooks.agentPrototypes ?? nodeAgentPrototypes()) {
|
|
401
|
+
guardConnect(prototype, 'createConnection');
|
|
402
|
+
}
|
|
403
|
+
let installed;
|
|
404
|
+
const wrapGlobalDispatcher = () => {
|
|
405
|
+
const current = scope[UNDICI_GLOBAL_DISPATCHER];
|
|
406
|
+
if (current === undefined || current === null)
|
|
407
|
+
return;
|
|
408
|
+
if (current === installed)
|
|
409
|
+
return;
|
|
410
|
+
if (typeof current.dispatch !== 'function')
|
|
411
|
+
return;
|
|
412
|
+
// PLAIN ASSIGNMENT. undici's own property is
|
|
413
|
+
// `configurable: false, writable: true`; a `defineProperty` that tries to
|
|
414
|
+
// make it configurable throws and takes the process down.
|
|
415
|
+
installed = wrapDispatcher(current, reporterOptions);
|
|
416
|
+
scope[UNDICI_GLOBAL_DISPATCHER] = installed;
|
|
417
|
+
};
|
|
418
|
+
if (hooks.scope === undefined)
|
|
419
|
+
materializeGlobalDispatcher();
|
|
420
|
+
wrapGlobalDispatcher();
|
|
421
|
+
let timer;
|
|
422
|
+
if (hooks.scope === undefined) {
|
|
423
|
+
timer = setInterval(wrapGlobalDispatcher, REASSERT_INTERVAL_MS);
|
|
424
|
+
// Never hold the event loop open: a guarded child must still exit.
|
|
425
|
+
timer.unref?.();
|
|
426
|
+
}
|
|
427
|
+
return {
|
|
428
|
+
mode,
|
|
429
|
+
allow,
|
|
430
|
+
reassert: wrapGlobalDispatcher,
|
|
431
|
+
stop() {
|
|
432
|
+
if (timer !== undefined)
|
|
433
|
+
clearInterval(timer);
|
|
434
|
+
},
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Extract the destination host from `net.connect` / `tls.connect` arguments,
|
|
439
|
+
* across all of their overloads: `(options[, cb])`, `(port[, host][, cb])`,
|
|
440
|
+
* `(path[, cb])`. An IPC path or a portless local socket has no host, which is
|
|
441
|
+
* exactly the "nothing to say" answer.
|
|
442
|
+
*/
|
|
443
|
+
function connectHost(args) {
|
|
444
|
+
const first = args[0];
|
|
445
|
+
if (typeof first === 'object' && first !== null) {
|
|
446
|
+
const host = first.host ??
|
|
447
|
+
first.hostname;
|
|
448
|
+
return typeof host === 'string' ? host : undefined;
|
|
449
|
+
}
|
|
450
|
+
if (typeof first === 'number' || (typeof first === 'string' && /^\d+$/.test(first))) {
|
|
451
|
+
// (port, host?, ...): the host, when given, is the next string argument.
|
|
452
|
+
const second = args[1];
|
|
453
|
+
if (typeof second === 'string')
|
|
454
|
+
return second;
|
|
455
|
+
if (typeof second === 'object' && second !== null) {
|
|
456
|
+
const host = second.host;
|
|
457
|
+
return typeof host === 'string' ? host : undefined;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return undefined;
|
|
461
|
+
}
|
|
462
|
+
//# sourceMappingURL=net-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"net-guard.js","sourceRoot":"","sources":["../../src/register/net-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,wBAAwB,CAAC;AAEhC,0EAA0E;AAC1E,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAEzE;wEACwE;AACxE,MAAM,CAAC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAExD,MAAM,UAAU,GAAG,gCAAgC,CAAC;AAEpD,8EAA8E;AAC9E,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAwBnC;yDACyD;AACzD,MAAM,UAAU,cAAc,CAAC,GAAuB;IACpD,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC/C,IAAI,KAAK,KAAK,OAAO;QA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;QAChD,MAAM,IAAI,GAAI,KAAgD,CAAC,IAAI;YAChE,KAAgC,CAAC,QAAQ,CAAC;QAC7C,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACrD,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACpF,yEAAyE;QACzE,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC;QAC9C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YAClD,MAAM,IAAI,GAAI,MAA6B,CAAC,IAAI,CAAC;YACjD,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QACrD,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/remote/index.d.ts
CHANGED
|
@@ -192,7 +192,7 @@ export declare function createRemoteSandboxHandle(opts: {
|
|
|
192
192
|
close: () => void;
|
|
193
193
|
}): RemoteSandbox;
|
|
194
194
|
/**
|
|
195
|
-
* Discover the running `pyric
|
|
195
|
+
* Discover the running `pyric sandbox --bridge`, attach to its bridge WS as a
|
|
196
196
|
* worker-relay CONSUMER (never a peer — attaching cannot kick the browser
|
|
197
197
|
* tab out of last-connection-wins), and return the typed remote handle.
|
|
198
198
|
*
|
package/dist/remote/index.js
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
|
*
|
|
@@ -116,7 +116,7 @@ export function createRemoteSandboxCore(transport, opts) {
|
|
|
116
116
|
if (pending.has(id)) {
|
|
117
117
|
pending.delete(id);
|
|
118
118
|
updateLoopHold();
|
|
119
|
-
reject(remoteError('deadline-exceeded', `remote sandbox op timed out after ${opTimeoutMs}ms (op: ${payload.method})
|
|
119
|
+
reject(remoteError('deadline-exceeded', `remote sandbox op timed out after ${opTimeoutMs}ms (op: ${payload.method}). Is pyric sandbox still running?` +
|
|
120
120
|
// A version-skewed old worker accepts frames it cannot
|
|
121
121
|
// handle and never responds — a timeout is its signature.
|
|
122
122
|
(versionSkewGuidance ? ` ${versionSkewGuidance}` : '')));
|
|
@@ -165,8 +165,8 @@ export function createRemoteSandboxCore(transport, opts) {
|
|
|
165
165
|
typeof msg.serveVersion === 'string' &&
|
|
166
166
|
msg.serveVersion !== cliVersion()) {
|
|
167
167
|
versionSkewGuidance =
|
|
168
|
-
`pyric
|
|
169
|
-
`${cliVersion()}
|
|
168
|
+
`pyric sandbox is running version ${msg.serveVersion}, this client is ` +
|
|
169
|
+
`${cliVersion()}. Restart pyric sandbox and reload the browser tab.`;
|
|
170
170
|
process.stderr.write(`pyric: ${versionSkewGuidance}\n`);
|
|
171
171
|
}
|
|
172
172
|
if (msg.peerConnected)
|
|
@@ -196,7 +196,7 @@ export function createRemoteSandboxCore(transport, opts) {
|
|
|
196
196
|
// Version skew: a live tab whose SharedWorker predates this op.
|
|
197
197
|
// Other open pages of this origin keep the old worker alive.
|
|
198
198
|
message +=
|
|
199
|
-
'
|
|
199
|
+
'. The running sandbox may predate this feature. Restart pyric sandbox ' +
|
|
200
200
|
'and close other open pages of this origin, then reload.';
|
|
201
201
|
}
|
|
202
202
|
call.reject(remoteError(code, message, msg.error?.denialContext, msg.error?.envelope));
|
|
@@ -456,7 +456,7 @@ export function createRemoteSandboxHandle(opts) {
|
|
|
456
456
|
},
|
|
457
457
|
onCurrentUserChanged: () => throwMember('onCurrentUserChanged', 'the browser tab owns the auth session; subscribe there instead'),
|
|
458
458
|
enableTabSync: () => throwMember('enableTabSync', 'tab sync is a browser concern; enable it in the page'),
|
|
459
|
-
enablePersistence: () => throwMember('enablePersistence', 'the browser worker owns persistence; it is already enabled by `pyric
|
|
459
|
+
enablePersistence: () => throwMember('enablePersistence', 'the browser worker owns persistence; it is already enabled by `pyric sandbox`'),
|
|
460
460
|
flush: () => throwMember('flush()', 'the browser worker owns persistence and flushes itself'),
|
|
461
461
|
clearPersistence: () => throwMember('clearPersistence()', 'clear the persisted state from the browser tab or Pyric Studio'),
|
|
462
462
|
registerPersistableService: () => throwMember('registerPersistableService', 'the browser worker owns persistence; services register there'),
|
|
@@ -465,7 +465,7 @@ export function createRemoteSandboxHandle(opts) {
|
|
|
465
465
|
}
|
|
466
466
|
// ─── connect ───────────────────────────────────────────────────────────────
|
|
467
467
|
/**
|
|
468
|
-
* Discover the running `pyric
|
|
468
|
+
* Discover the running `pyric sandbox --bridge`, attach to its bridge WS as a
|
|
469
469
|
* worker-relay CONSUMER (never a peer — attaching cannot kick the browser
|
|
470
470
|
* tab out of last-connection-wins), and return the typed remote handle.
|
|
471
471
|
*
|
|
@@ -489,7 +489,7 @@ export async function connectRemoteSandbox(options = {}) {
|
|
|
489
489
|
else {
|
|
490
490
|
const found = await discoverServe(cwd);
|
|
491
491
|
if (!found) {
|
|
492
|
-
throw remoteError('not-found', 'no running `pyric
|
|
492
|
+
throw remoteError('not-found', 'no running `pyric sandbox --bridge` found (looked for .pyric/serve.json in ' +
|
|
493
493
|
`${cwd} and the default ports) — start your dev server with the bridge enabled and retry.`);
|
|
494
494
|
}
|
|
495
495
|
serveUrl = found.url;
|
|
@@ -637,7 +637,7 @@ export function createLazyRemoteSandbox(connect, options = {}) {
|
|
|
637
637
|
// Before discovery the URL is unknown; op-level errors always carry the
|
|
638
638
|
// real URL (they come from the inner connect), and `serveUrl` is patched
|
|
639
639
|
// to the discovered value as soon as the first connect succeeds.
|
|
640
|
-
serveUrl: options.url?.replace(/\/$/, '') ?? '<pyric
|
|
640
|
+
serveUrl: options.url?.replace(/\/$/, '') ?? '<pyric sandbox url (pending discovery)>',
|
|
641
641
|
close() {
|
|
642
642
|
if (closed)
|
|
643
643
|
return;
|