@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.
Files changed (642) hide show
  1. package/README.md +64 -89
  2. package/dist/assurance/.generated/conformance-verdicts.d.ts +68 -1
  3. package/dist/assurance/.generated/conformance-verdicts.d.ts.map +1 -1
  4. package/dist/assurance/.generated/conformance-verdicts.js +68 -1
  5. package/dist/assurance/.generated/conformance-verdicts.js.map +1 -1
  6. package/dist/bridge/client/dispatch.d.ts +25 -19
  7. package/dist/bridge/client/dispatch.d.ts.map +1 -1
  8. package/dist/bridge/client/dispatch.js +41 -48
  9. package/dist/bridge/client/dispatch.js.map +1 -1
  10. package/dist/bridge/client/tool-family-factories.d.ts +26 -0
  11. package/dist/bridge/client/tool-family-factories.d.ts.map +1 -0
  12. package/dist/bridge/client/tool-family-factories.js +10 -0
  13. package/dist/bridge/client/tool-family-factories.js.map +1 -0
  14. package/dist/bridge/server/mcp-contract.d.ts +7 -6
  15. package/dist/bridge/server/mcp-contract.d.ts.map +1 -1
  16. package/dist/bridge/server/mcp-contract.js +9 -48
  17. package/dist/bridge/server/mcp-contract.js.map +1 -1
  18. package/dist/bridge/server/peer.d.ts +11 -1
  19. package/dist/bridge/server/peer.d.ts.map +1 -1
  20. package/dist/bridge/server/peer.js +22 -1
  21. package/dist/bridge/server/peer.js.map +1 -1
  22. package/dist/bridge/server/tool-family-factories.d.ts +30 -0
  23. package/dist/bridge/server/tool-family-factories.d.ts.map +1 -0
  24. package/dist/bridge/server/tool-family-factories.js +22 -0
  25. package/dist/bridge/server/tool-family-factories.js.map +1 -0
  26. package/dist/bridge/server/tool-metadata.d.ts +17 -18
  27. package/dist/bridge/server/tool-metadata.d.ts.map +1 -1
  28. package/dist/bridge/server/tool-metadata.js +24 -59
  29. package/dist/bridge/server/tool-metadata.js.map +1 -1
  30. package/dist/bridge/tool-families.d.ts +48 -0
  31. package/dist/bridge/tool-families.d.ts.map +1 -0
  32. package/dist/bridge/tool-families.generated.d.ts +32 -0
  33. package/dist/bridge/tool-families.generated.d.ts.map +1 -0
  34. package/dist/bridge/tool-families.generated.js +15 -0
  35. package/dist/bridge/tool-families.generated.js.map +1 -0
  36. package/dist/bridge/tool-families.js +51 -0
  37. package/dist/bridge/tool-families.js.map +1 -0
  38. package/dist/bridge/tool-family-records/conformance.d.ts +7 -0
  39. package/dist/bridge/tool-family-records/conformance.d.ts.map +1 -0
  40. package/dist/bridge/tool-family-records/conformance.js +6 -0
  41. package/dist/bridge/tool-family-records/conformance.js.map +1 -0
  42. package/dist/bridge/tool-family-records/firestore-data.d.ts +7 -0
  43. package/dist/bridge/tool-family-records/firestore-data.d.ts.map +1 -0
  44. package/dist/bridge/tool-family-records/firestore-data.js +15 -0
  45. package/dist/bridge/tool-family-records/firestore-data.js.map +1 -0
  46. package/dist/bridge/tool-family-records/firestore-inspect.d.ts +7 -0
  47. package/dist/bridge/tool-family-records/firestore-inspect.d.ts.map +1 -0
  48. package/dist/bridge/tool-family-records/firestore-inspect.js +6 -0
  49. package/dist/bridge/tool-family-records/firestore-inspect.js.map +1 -0
  50. package/dist/bridge/tool-family-records/firestore-rules.d.ts +7 -0
  51. package/dist/bridge/tool-family-records/firestore-rules.d.ts.map +1 -0
  52. package/dist/bridge/tool-family-records/firestore-rules.js +15 -0
  53. package/dist/bridge/tool-family-records/firestore-rules.js.map +1 -0
  54. package/dist/bridge/tool-family-records/firestore-simulator.d.ts +7 -0
  55. package/dist/bridge/tool-family-records/firestore-simulator.d.ts.map +1 -0
  56. package/dist/bridge/tool-family-records/firestore-simulator.js +16 -0
  57. package/dist/bridge/tool-family-records/firestore-simulator.js.map +1 -0
  58. package/dist/bridge/tool-family-records/rtdb-inspection.d.ts +7 -0
  59. package/dist/bridge/tool-family-records/rtdb-inspection.d.ts.map +1 -0
  60. package/dist/bridge/tool-family-records/rtdb-inspection.js +6 -0
  61. package/dist/bridge/tool-family-records/rtdb-inspection.js.map +1 -0
  62. package/dist/bundler/externals.d.ts +37 -0
  63. package/dist/bundler/externals.d.ts.map +1 -0
  64. package/dist/bundler/externals.js +52 -0
  65. package/dist/bundler/externals.js.map +1 -0
  66. package/dist/bundler/index.d.ts +17 -0
  67. package/dist/bundler/index.d.ts.map +1 -0
  68. package/dist/bundler/index.js +17 -0
  69. package/dist/bundler/index.js.map +1 -0
  70. package/dist/cli/index.d.ts +2 -2
  71. package/dist/cli/index.d.ts.map +1 -1
  72. package/dist/cli/index.js +48 -42
  73. package/dist/cli/index.js.map +1 -1
  74. package/dist/cli/inlined-sdk-scanner.d.ts +6 -0
  75. package/dist/cli/inlined-sdk-scanner.d.ts.map +1 -0
  76. package/dist/cli/inlined-sdk-scanner.js +82 -0
  77. package/dist/cli/inlined-sdk-scanner.js.map +1 -0
  78. package/dist/cli/mcp-proxy.js +3 -3
  79. package/dist/cli/mcp-proxy.js.map +1 -1
  80. package/dist/cli/parse-args.d.ts +1 -1
  81. package/dist/cli/parse-args.d.ts.map +1 -1
  82. package/dist/cli/parse-args.js +51 -15
  83. package/dist/cli/parse-args.js.map +1 -1
  84. package/dist/cli/pyric-config.d.ts +24 -0
  85. package/dist/cli/pyric-config.d.ts.map +1 -0
  86. package/dist/cli/pyric-config.js +28 -0
  87. package/dist/cli/pyric-config.js.map +1 -0
  88. package/dist/cli/sandbox-interlock.d.ts +97 -0
  89. package/dist/cli/sandbox-interlock.d.ts.map +1 -0
  90. package/dist/cli/sandbox-interlock.js +112 -0
  91. package/dist/cli/sandbox-interlock.js.map +1 -0
  92. package/dist/cli/{dev-runner.d.ts → sandbox-runner.d.ts} +53 -48
  93. package/dist/cli/sandbox-runner.d.ts.map +1 -0
  94. package/dist/cli/{dev-runner.js → sandbox-runner.js} +105 -67
  95. package/dist/cli/sandbox-runner.js.map +1 -0
  96. package/dist/cli/serve.d.ts +12 -14
  97. package/dist/cli/serve.d.ts.map +1 -1
  98. package/dist/cli/serve.js +155 -116
  99. package/dist/cli/serve.js.map +1 -1
  100. package/dist/cli/snapshot.js +5 -5
  101. package/dist/cli/snapshot.js.map +1 -1
  102. package/dist/cli/unsupported-runtime.d.ts +27 -0
  103. package/dist/cli/unsupported-runtime.d.ts.map +1 -0
  104. package/dist/cli/unsupported-runtime.js +63 -0
  105. package/dist/cli/unsupported-runtime.js.map +1 -0
  106. package/dist/cli/verify.js +1 -1
  107. package/dist/cli/verify.js.map +1 -1
  108. package/dist/conformance/.generated/can-i-use-browser.d.ts +1 -1
  109. package/dist/conformance/.generated/can-i-use-browser.d.ts.map +1 -1
  110. package/dist/conformance/.generated/can-i-use-browser.js +1 -1
  111. package/dist/conformance/.generated/can-i-use-browser.js.map +1 -1
  112. package/dist/conformance/.generated/can-i-use.d.ts +1 -1
  113. package/dist/conformance/.generated/can-i-use.d.ts.map +1 -1
  114. package/dist/conformance/.generated/can-i-use.js +1 -1
  115. package/dist/conformance/.generated/can-i-use.js.map +1 -1
  116. package/dist/conformance/.generated/conformance-docs.d.ts.map +1 -1
  117. package/dist/conformance/.generated/conformance-docs.js +1 -1
  118. package/dist/conformance/.generated/conformance-docs.js.map +1 -1
  119. package/dist/functions-rtdb/child.d.ts +37 -0
  120. package/dist/functions-rtdb/child.d.ts.map +1 -1
  121. package/dist/functions-rtdb/child.js +90 -21
  122. package/dist/functions-rtdb/child.js.map +1 -1
  123. package/dist/functions-rtdb/development-runtime.d.ts +3 -0
  124. package/dist/functions-rtdb/development-runtime.d.ts.map +1 -1
  125. package/dist/functions-rtdb/development-runtime.js +2 -1
  126. package/dist/functions-rtdb/development-runtime.js.map +1 -1
  127. package/dist/functions-rtdb/project.js +8 -8
  128. package/dist/functions-rtdb/project.js.map +1 -1
  129. package/dist/google-endpoints.d.ts +67 -0
  130. package/dist/google-endpoints.d.ts.map +1 -0
  131. package/dist/google-endpoints.js +119 -0
  132. package/dist/google-endpoints.js.map +1 -0
  133. package/dist/next/guard.js +1 -1
  134. package/dist/next/guard.js.map +1 -1
  135. package/dist/next/runtime-env.d.ts.map +1 -1
  136. package/dist/next/runtime-env.js +5 -0
  137. package/dist/next/runtime-env.js.map +1 -1
  138. package/dist/next/with-pyric.d.ts +1 -1
  139. package/dist/next/with-pyric.js +1 -1
  140. package/dist/register/beacon.d.ts +69 -0
  141. package/dist/register/beacon.d.ts.map +1 -0
  142. package/dist/register/beacon.js +199 -0
  143. package/dist/register/beacon.js.map +1 -0
  144. package/dist/register/index.d.ts.map +1 -1
  145. package/dist/register/index.js +65 -6
  146. package/dist/register/index.js.map +1 -1
  147. package/dist/register/net-guard.d.ts +110 -0
  148. package/dist/register/net-guard.d.ts.map +1 -0
  149. package/dist/register/net-guard.js +462 -0
  150. package/dist/register/net-guard.js.map +1 -0
  151. package/dist/remote/index.d.ts +1 -1
  152. package/dist/remote/index.js +9 -9
  153. package/dist/remote/index.js.map +1 -1
  154. package/dist/serve/ai-diagnostics-relay.d.ts +63 -0
  155. package/dist/serve/ai-diagnostics-relay.d.ts.map +1 -0
  156. package/dist/serve/ai-diagnostics-relay.js +125 -0
  157. package/dist/serve/ai-diagnostics-relay.js.map +1 -0
  158. package/dist/serve/ai-proxy.d.ts +92 -0
  159. package/dist/serve/ai-proxy.d.ts.map +1 -0
  160. package/dist/serve/ai-proxy.js +269 -0
  161. package/dist/serve/ai-proxy.js.map +1 -0
  162. package/dist/serve/ai-status.d.ts +44 -0
  163. package/dist/serve/ai-status.d.ts.map +1 -0
  164. package/dist/serve/ai-status.js +77 -0
  165. package/dist/serve/ai-status.js.map +1 -0
  166. package/dist/serve/ai-terminal-blocks.d.ts +97 -0
  167. package/dist/serve/ai-terminal-blocks.d.ts.map +1 -0
  168. package/dist/serve/ai-terminal-blocks.js +128 -0
  169. package/dist/serve/ai-terminal-blocks.js.map +1 -0
  170. package/dist/serve/ai-terminal-text.d.ts +36 -0
  171. package/dist/serve/ai-terminal-text.d.ts.map +1 -0
  172. package/dist/serve/ai-terminal-text.js +48 -0
  173. package/dist/serve/ai-terminal-text.js.map +1 -0
  174. package/dist/serve/beacon-route.d.ts +53 -0
  175. package/dist/serve/beacon-route.d.ts.map +1 -0
  176. package/dist/serve/beacon-route.js +101 -0
  177. package/dist/serve/beacon-route.js.map +1 -0
  178. package/dist/serve/bundler.js +10 -10
  179. package/dist/serve/bundler.js.map +1 -1
  180. package/dist/serve/entries/active-auth-registry.d.ts +16 -0
  181. package/dist/serve/entries/active-auth-registry.d.ts.map +1 -0
  182. package/dist/serve/entries/active-auth-registry.js +48 -0
  183. package/dist/serve/entries/active-auth-registry.js.map +1 -0
  184. package/dist/serve/entries/active-auth.d.ts +18 -0
  185. package/dist/serve/entries/active-auth.d.ts.map +1 -0
  186. package/dist/serve/entries/active-auth.js +84 -0
  187. package/dist/serve/entries/active-auth.js.map +1 -0
  188. package/dist/serve/entries/ai.d.ts.map +1 -1
  189. package/dist/serve/entries/ai.js +27 -1
  190. package/dist/serve/entries/ai.js.map +1 -1
  191. package/dist/serve/entries/auth-helper-core.d.ts +1 -0
  192. package/dist/serve/entries/auth-helper-core.d.ts.map +1 -1
  193. package/dist/serve/entries/auth-helper-core.js +4 -0
  194. package/dist/serve/entries/auth-helper-core.js.map +1 -1
  195. package/dist/serve/entries/auth-helper-dom.d.ts.map +1 -1
  196. package/dist/serve/entries/auth-helper-dom.js +29 -3
  197. package/dist/serve/entries/auth-helper-dom.js.map +1 -1
  198. package/dist/serve/entries/auth-helper-runtime.js +1 -1
  199. package/dist/serve/entries/auth-helper-runtime.js.map +1 -1
  200. package/dist/serve/entries/auth.d.ts.map +1 -1
  201. package/dist/serve/entries/auth.js +8 -0
  202. package/dist/serve/entries/auth.js.map +1 -1
  203. package/dist/serve/entries/bridge-url.d.ts +1 -1
  204. package/dist/serve/entries/bridge-url.js +1 -1
  205. package/dist/serve/entries/firestore.js +3 -3
  206. package/dist/serve/entries/firestore.js.map +1 -1
  207. package/dist/serve/entries/init.d.ts.map +1 -1
  208. package/dist/serve/entries/init.js +70 -4
  209. package/dist/serve/entries/init.js.map +1 -1
  210. package/dist/serve/entries/keepalive.js +1 -1
  211. package/dist/serve/entries/keepalive.js.map +1 -1
  212. package/dist/serve/entries/runtime.d.ts.map +1 -1
  213. package/dist/serve/entries/runtime.js +30 -14
  214. package/dist/serve/entries/runtime.js.map +1 -1
  215. package/dist/serve/entries/storage.js +1 -1
  216. package/dist/serve/entries/storage.js.map +1 -1
  217. package/dist/serve/entries/worker-runtime.js +1 -1
  218. package/dist/serve/entries/worker-runtime.js.map +1 -1
  219. package/dist/serve/init-payload.d.ts +4 -0
  220. package/dist/serve/init-payload.d.ts.map +1 -1
  221. package/dist/serve/namespace.d.ts +20 -5
  222. package/dist/serve/namespace.d.ts.map +1 -1
  223. package/dist/serve/namespace.js +93 -129
  224. package/dist/serve/namespace.js.map +1 -1
  225. package/dist/serve/rules.d.ts.map +1 -1
  226. package/dist/serve/rules.js +44 -21
  227. package/dist/serve/rules.js.map +1 -1
  228. package/dist/serve/runtime/chip-config.d.ts.map +1 -1
  229. package/dist/serve/runtime/chip-config.js +16 -2
  230. package/dist/serve/runtime/chip-config.js.map +1 -1
  231. package/dist/serve/runtime/chip-dialog.d.ts +18 -0
  232. package/dist/serve/runtime/chip-dialog.d.ts.map +1 -0
  233. package/dist/serve/runtime/chip-dialog.js +315 -0
  234. package/dist/serve/runtime/chip-dialog.js.map +1 -0
  235. package/dist/serve/runtime/chip-install.d.ts +2 -0
  236. package/dist/serve/runtime/chip-install.d.ts.map +1 -1
  237. package/dist/serve/runtime/chip-install.js +9 -4
  238. package/dist/serve/runtime/chip-install.js.map +1 -1
  239. package/dist/serve/runtime/chip-user-search.d.ts +16 -0
  240. package/dist/serve/runtime/chip-user-search.d.ts.map +1 -0
  241. package/dist/serve/runtime/chip-user-search.js +354 -0
  242. package/dist/serve/runtime/chip-user-search.js.map +1 -0
  243. package/dist/serve/runtime/chip.d.ts +10 -0
  244. package/dist/serve/runtime/chip.d.ts.map +1 -1
  245. package/dist/serve/runtime/chip.js +149 -15
  246. package/dist/serve/runtime/chip.js.map +1 -1
  247. package/dist/serve/runtime/identity.d.ts +17 -0
  248. package/dist/serve/runtime/identity.d.ts.map +1 -0
  249. package/dist/serve/runtime/identity.js +10 -0
  250. package/dist/serve/runtime/identity.js.map +1 -0
  251. package/dist/serve/runtime/manifest.d.ts +1 -1
  252. package/dist/serve/runtime/manifest.d.ts.map +1 -1
  253. package/dist/serve/runtime/manifest.js +1 -1
  254. package/dist/serve/runtime/manifest.js.map +1 -1
  255. package/dist/serve/runtime/status.d.ts.map +1 -1
  256. package/dist/serve/runtime/status.js +23 -0
  257. package/dist/serve/runtime/status.js.map +1 -1
  258. package/dist/serve/sandbox-session.d.ts +8 -0
  259. package/dist/serve/sandbox-session.d.ts.map +1 -1
  260. package/dist/serve/sandbox-session.js +12 -4
  261. package/dist/serve/sandbox-session.js.map +1 -1
  262. package/dist/serve/server.d.ts +7 -0
  263. package/dist/serve/server.d.ts.map +1 -1
  264. package/dist/serve/server.js +15 -1
  265. package/dist/serve/server.js.map +1 -1
  266. package/dist/serve/site-ui/404.html +1 -1
  267. package/dist/serve/site-ui/_astro/{RulesCodeEditor.Bl-XMkhD.js → RulesCodeEditor.DsTAsKIa.js} +1 -1
  268. package/dist/serve/site-ui/_astro/_slug_.Da5VLhW1.css +1 -0
  269. package/dist/serve/site-ui/_astro/_studio_.BnfYCKoI.css +1 -0
  270. package/dist/serve/site-ui/_astro/app.BOr2kwae.js +115 -0
  271. package/dist/serve/site-ui/_astro/app.DhAcImFD.js +1 -0
  272. package/dist/serve/site-ui/_astro/app.pMSnN6Qw.css +1 -0
  273. package/dist/serve/site-ui/_astro/{chess-showcase.Dh5D8kqe.js → chess-showcase.Bn_pP6UJ.js} +2 -2
  274. package/dist/serve/site-ui/_astro/{example-runtime.CuyAjjiG.js → example-runtime.CXopTGv7.js} +1 -1
  275. package/dist/serve/site-ui/_astro/index.Tb-31efc.css +1 -0
  276. package/dist/serve/site-ui/_astro/index.UkCBr-_0.css +1 -0
  277. package/dist/serve/site-ui/_astro/sandbox-controls.rOuZTOUG.js +510 -0
  278. package/dist/serve/site-ui/_astro/{seed.CSUkloMi.js → seed.03a08f9t.js} +2 -2
  279. package/dist/serve/site-ui/_astro/writes.BsPBG3dp.js +653 -0
  280. package/dist/serve/site-ui/auth/index.html +5 -3
  281. package/dist/serve/site-ui/david-east.jpg +0 -0
  282. package/dist/serve/site-ui/docs/_rhythm/index.html +6 -3
  283. package/dist/serve/site-ui/docs/_rhythm.md +1 -1
  284. package/dist/serve/site-ui/docs/agent/set-up-your-agent/index.html +18 -15
  285. package/dist/serve/site-ui/docs/agent/set-up-your-agent.md +16 -16
  286. package/dist/serve/site-ui/docs/agent/watch-and-review/index.html +6 -5
  287. package/dist/serve/site-ui/docs/agent/watch-and-review.md +1 -5
  288. package/dist/serve/site-ui/docs/agent/work-with-an-agent/index.html +8 -5
  289. package/dist/serve/site-ui/docs/agent/work-with-an-agent.md +4 -4
  290. package/dist/serve/site-ui/docs/ai-compat/index.html +5 -2
  291. package/dist/serve/site-ui/docs/api-reference/index.html +13 -2
  292. package/dist/serve/site-ui/docs/api-reference.md +8 -0
  293. package/dist/serve/site-ui/docs/app-compat/index.html +5 -2
  294. package/dist/serve/site-ui/docs/auth-compat/index.html +7 -4
  295. package/dist/serve/site-ui/docs/auth-compat.md +2 -2
  296. package/dist/serve/site-ui/docs/build/ai-logic/index.html +10 -2
  297. package/dist/serve/site-ui/docs/build/ai-logic.md +6 -0
  298. package/dist/serve/site-ui/docs/build/authentication/index.html +7 -4
  299. package/dist/serve/site-ui/docs/build/authentication.md +2 -2
  300. package/dist/serve/site-ui/docs/build/cloud-firestore/index.html +5 -2
  301. package/dist/serve/site-ui/docs/build/cloud-messaging/index.html +5 -2
  302. package/dist/serve/site-ui/docs/build/cloud-storage/index.html +6 -3
  303. package/dist/serve/site-ui/docs/build/cloud-storage.md +1 -1
  304. package/dist/serve/site-ui/docs/build/realtime-database/index.html +9 -6
  305. package/dist/serve/site-ui/docs/build/realtime-database.md +4 -4
  306. package/dist/serve/site-ui/docs/conformance-scores/index.html +10 -3
  307. package/dist/serve/site-ui/docs/conformance-scores.md +5 -1
  308. package/dist/serve/site-ui/docs/create-pyric-reference-api/index.html +6 -3
  309. package/dist/serve/site-ui/docs/create-pyric-reference-api.md +1 -1
  310. package/dist/serve/site-ui/docs/database-compat/index.html +48 -45
  311. package/dist/serve/site-ui/docs/database-compat.md +43 -43
  312. package/dist/serve/site-ui/docs/examples/chess/index.html +5 -2
  313. package/dist/serve/site-ui/docs/examples/index.html +5 -2
  314. package/dist/serve/site-ui/docs/firestore-compat/index.html +8 -5
  315. package/dist/serve/site-ui/docs/firestore-compat.md +3 -3
  316. package/dist/serve/site-ui/docs/firestore-flutter-compat/index.html +319 -0
  317. package/dist/serve/site-ui/docs/firestore-flutter-compat.md +344 -0
  318. package/dist/serve/site-ui/docs/functions-rtdb-compat/index.html +5 -2
  319. package/dist/serve/site-ui/docs/get-started/backend-bundlers/index.html +105 -0
  320. package/dist/serve/site-ui/docs/get-started/backend-bundlers.md +165 -0
  321. package/dist/serve/site-ui/docs/get-started/how-the-swap-works/index.html +9 -6
  322. package/dist/serve/site-ui/docs/get-started/how-the-swap-works.md +5 -5
  323. package/dist/serve/site-ui/docs/get-started/nextjs/index.html +9 -6
  324. package/dist/serve/site-ui/docs/get-started/nextjs.md +4 -4
  325. package/dist/serve/site-ui/docs/get-started/start-building/index.html +14 -9
  326. package/dist/serve/site-ui/docs/get-started/start-building.md +16 -10
  327. package/dist/serve/site-ui/docs/get-started/vite/index.html +6 -3
  328. package/dist/serve/site-ui/docs/get-started/vite.md +1 -1
  329. package/dist/serve/site-ui/docs/index.json +3128 -1613
  330. package/dist/serve/site-ui/docs/messaging-compat/index.html +5 -2
  331. package/dist/serve/site-ui/docs/observe/resolve-runtime-status/index.html +5 -2
  332. package/dist/serve/site-ui/docs/observe/see-whats-happening/index.html +6 -4
  333. package/dist/serve/site-ui/docs/observe/see-whats-happening.md +2 -4
  334. package/dist/serve/site-ui/docs/observe/shape-your-data/index.html +9 -6
  335. package/dist/serve/site-ui/docs/observe/shape-your-data.md +4 -4
  336. package/dist/serve/site-ui/docs/overview/index.html +16 -10
  337. package/dist/serve/site-ui/docs/overview.md +19 -11
  338. package/dist/serve/site-ui/docs/pyric-admin-app-reference-api/index.html +5 -2
  339. package/dist/serve/site-ui/docs/pyric-admin-auth-reference-api/index.html +5 -2
  340. package/dist/serve/site-ui/docs/pyric-admin-database-reference-api/index.html +5 -2
  341. package/dist/serve/site-ui/docs/pyric-admin-firestore-reference-api/index.html +8 -5
  342. package/dist/serve/site-ui/docs/pyric-admin-firestore-reference-api.md +3 -3
  343. package/dist/serve/site-ui/docs/pyric-admin-messaging-reference-api/index.html +5 -2
  344. package/dist/serve/site-ui/docs/pyric-admin-reference-api/index.html +501 -0
  345. package/dist/serve/site-ui/docs/pyric-admin-reference-api.md +587 -0
  346. package/dist/serve/site-ui/docs/pyric-admin-storage-reference-api/index.html +5 -2
  347. package/dist/serve/site-ui/docs/pyric-ai-reference-api/index.html +5 -2
  348. package/dist/serve/site-ui/docs/pyric-ai-scripting-reference-api/index.html +5 -2
  349. package/dist/serve/site-ui/docs/pyric-analytics-reference-api/index.html +124 -0
  350. package/dist/serve/site-ui/docs/pyric-analytics-reference-api.md +287 -0
  351. package/dist/serve/site-ui/docs/pyric-app-check-reference-api/index.html +87 -0
  352. package/dist/serve/site-ui/docs/pyric-app-check-reference-api.md +199 -0
  353. package/dist/serve/site-ui/docs/pyric-app-reference-api/index.html +5 -2
  354. package/dist/serve/site-ui/docs/pyric-auth-reference-api/index.html +10 -3
  355. package/dist/serve/site-ui/docs/pyric-auth-reference-api.md +2 -1
  356. package/dist/serve/site-ui/docs/pyric-cli-assurance-browser-reference-api/index.html +5 -2
  357. package/dist/serve/site-ui/docs/pyric-cli-assurance-reference-api/index.html +5 -2
  358. package/dist/serve/site-ui/docs/pyric-cli-bridge-client-reference-api/index.html +6 -3
  359. package/dist/serve/site-ui/docs/pyric-cli-bridge-client-reference-api.md +1 -1
  360. package/dist/serve/site-ui/docs/pyric-cli-bridge-reference-api/index.html +5 -2
  361. package/dist/serve/site-ui/docs/pyric-cli-bundler-reference-api/index.html +56 -0
  362. package/dist/serve/site-ui/docs/pyric-cli-bundler-reference-api.md +72 -0
  363. package/dist/serve/site-ui/docs/pyric-cli-conformance-browser-reference-api/index.html +6 -2
  364. package/dist/serve/site-ui/docs/pyric-cli-conformance-browser-reference-api.md +1 -0
  365. package/dist/serve/site-ui/docs/pyric-cli-conformance-docs-reference-api/index.html +5 -2
  366. package/dist/serve/site-ui/docs/pyric-cli-conformance-reference-api/index.html +6 -2
  367. package/dist/serve/site-ui/docs/pyric-cli-conformance-reference-api.md +1 -0
  368. package/dist/serve/site-ui/docs/pyric-cli-credentials-node-reference-api/index.html +5 -2
  369. package/dist/serve/site-ui/docs/pyric-cli-discover-reference-api/index.html +5 -2
  370. package/dist/serve/site-ui/docs/pyric-cli-next-reference-api/index.html +6 -3
  371. package/dist/serve/site-ui/docs/pyric-cli-next-reference-api.md +1 -1
  372. package/dist/serve/site-ui/docs/pyric-cli-register-app-bridge-reference-api/index.html +5 -2
  373. package/dist/serve/site-ui/docs/pyric-cli-register-reference-api/index.html +5 -2
  374. package/dist/serve/site-ui/docs/pyric-cli-remote-reference-api/index.html +39 -11
  375. package/dist/serve/site-ui/docs/pyric-cli-remote-reference-api.md +17 -9
  376. package/dist/serve/site-ui/docs/pyric-cli-serve-worker-reference-api/index.html +137 -94
  377. package/dist/serve/site-ui/docs/pyric-cli-serve-worker-reference-api.md +61 -1
  378. package/dist/serve/site-ui/docs/pyric-cli-verify-reference-api/index.html +6 -3
  379. package/dist/serve/site-ui/docs/pyric-cli-verify-reference-api.md +1 -1
  380. package/dist/serve/site-ui/docs/pyric-cli-vite-reference-api/index.html +6 -3
  381. package/dist/serve/site-ui/docs/pyric-cli-vite-reference-api.md +2 -2
  382. package/dist/serve/site-ui/docs/pyric-database-reference-api/index.html +167 -96
  383. package/dist/serve/site-ui/docs/pyric-database-reference-api.md +108 -2
  384. package/dist/serve/site-ui/docs/pyric-firestore-lite-reference-api/index.html +559 -0
  385. package/dist/serve/site-ui/docs/pyric-firestore-lite-reference-api.md +1240 -0
  386. package/dist/serve/site-ui/docs/pyric-firestore-reference-api/index.html +44 -12
  387. package/dist/serve/site-ui/docs/pyric-firestore-reference-api.md +18 -8
  388. package/dist/serve/site-ui/docs/pyric-functions-reference-api/index.html +67 -0
  389. package/dist/serve/site-ui/docs/pyric-functions-reference-api.md +149 -0
  390. package/dist/serve/site-ui/docs/pyric-messaging-reference-api/index.html +10 -4
  391. package/dist/serve/site-ui/docs/pyric-messaging-reference-api.md +5 -2
  392. package/dist/serve/site-ui/docs/pyric-messaging-sw-reference-api/index.html +10 -4
  393. package/dist/serve/site-ui/docs/pyric-messaging-sw-reference-api.md +5 -2
  394. package/dist/serve/site-ui/docs/pyric-performance-reference-api/index.html +35 -0
  395. package/dist/serve/site-ui/docs/pyric-performance-reference-api.md +69 -0
  396. package/dist/serve/site-ui/docs/pyric-remote-config-reference-api/index.html +132 -0
  397. package/dist/serve/site-ui/docs/pyric-remote-config-reference-api.md +307 -0
  398. package/dist/serve/site-ui/docs/pyric-rules-reference-api/index.html +5 -2
  399. package/dist/serve/site-ui/docs/pyric-sandbox-database-reference-api/index.html +56 -18
  400. package/dist/serve/site-ui/docs/pyric-sandbox-database-reference-api.md +48 -9
  401. package/dist/serve/site-ui/docs/pyric-sandbox-firestore-reference-api/index.html +6 -3
  402. package/dist/serve/site-ui/docs/pyric-sandbox-firestore-reference-api.md +2 -2
  403. package/dist/serve/site-ui/docs/pyric-sandbox-reference-api/index.html +243 -50
  404. package/dist/serve/site-ui/docs/pyric-sandbox-reference-api.md +148 -31
  405. package/dist/serve/site-ui/docs/pyric-storage-reference-api/index.html +26 -5
  406. package/dist/serve/site-ui/docs/pyric-storage-reference-api.md +24 -2
  407. package/dist/serve/site-ui/docs/pyric-ui-agents-reference-api/index.html +30 -97
  408. package/dist/serve/site-ui/docs/pyric-ui-agents-reference-api.md +20 -51
  409. package/dist/serve/site-ui/docs/pyric-ui-auth-hooks-reference-api/index.html +5 -2
  410. package/dist/serve/site-ui/docs/pyric-ui-auth-reference-api/index.html +6 -3
  411. package/dist/serve/site-ui/docs/pyric-ui-auth-reference-api.md +1 -1
  412. package/dist/serve/site-ui/docs/pyric-ui-events-hooks-reference-api/index.html +5 -2
  413. package/dist/serve/site-ui/docs/pyric-ui-events-reference-api/index.html +5 -2
  414. package/dist/serve/site-ui/docs/pyric-ui-firestore-hooks-reference-api/index.html +5 -2
  415. package/dist/serve/site-ui/docs/pyric-ui-firestore-reference-api/index.html +6 -3
  416. package/dist/serve/site-ui/docs/pyric-ui-firestore-reference-api.md +1 -1
  417. package/dist/serve/site-ui/docs/pyric-ui-primitives-reference-api/index.html +128 -27
  418. package/dist/serve/site-ui/docs/pyric-ui-primitives-reference-api.md +58 -5
  419. package/dist/serve/site-ui/docs/pyric-ui-rtdb-reference-api/index.html +5 -2
  420. package/dist/serve/site-ui/docs/pyric-ui-rules-hooks-reference-api/index.html +5 -2
  421. package/dist/serve/site-ui/docs/pyric-ui-rules-reference-api/index.html +5 -2
  422. package/dist/serve/site-ui/docs/pyric-ui-storage-hooks-reference-api/index.html +5 -2
  423. package/dist/serve/site-ui/docs/pyric-ui-storage-reference-api/index.html +8 -6
  424. package/dist/serve/site-ui/docs/pyric-ui-storage-reference-api.md +3 -4
  425. package/dist/serve/site-ui/docs/pyric-ui-traffic-hooks-reference-api/index.html +5 -2
  426. package/dist/serve/site-ui/docs/pyric-ui-traffic-reference-api/index.html +5 -2
  427. package/dist/serve/site-ui/docs/reference/cli/index.html +156 -0
  428. package/dist/serve/site-ui/docs/reference/cli.md +120 -0
  429. package/dist/serve/site-ui/docs/rules-compat/index.html +14 -3
  430. package/dist/serve/site-ui/docs/rules-compat.md +9 -1
  431. package/dist/serve/site-ui/docs/secure/audit-your-rules/index.html +5 -2
  432. package/dist/serve/site-ui/docs/secure/firestore-rules-limits/index.html +5 -2
  433. package/dist/serve/site-ui/docs/secure/read-a-denial/index.html +6 -3
  434. package/dist/serve/site-ui/docs/secure/read-a-denial.md +1 -1
  435. package/dist/serve/site-ui/docs/secure/rtdb-rules-in-typescript/index.html +5 -2
  436. package/dist/serve/site-ui/docs/secure/rules-standard-library/index.html +5 -2
  437. package/dist/serve/site-ui/docs/secure/secure-it-with-rules/index.html +5 -2
  438. package/dist/serve/site-ui/docs/secure/simulate-and-lint/index.html +5 -2
  439. package/dist/serve/site-ui/docs/secure/write-a-rules-test-suite/index.html +5 -2
  440. package/dist/serve/site-ui/docs/ship/ship-to-production/index.html +7 -4
  441. package/dist/serve/site-ui/docs/ship/ship-to-production.md +2 -2
  442. package/dist/serve/site-ui/docs/ship/test-in-node/index.html +9 -6
  443. package/dist/serve/site-ui/docs/ship/test-in-node.md +4 -4
  444. package/dist/serve/site-ui/docs/storage-compat/index.html +17 -14
  445. package/dist/serve/site-ui/docs/storage-compat.md +12 -12
  446. package/dist/serve/site-ui/docs/trust/how-we-know-it-matches-firebase/index.html +5 -2
  447. package/dist/serve/site-ui/docs/trust/rules-standard-library/index.html +5 -2
  448. package/dist/serve/site-ui/docs/trust/versioning-and-compatibility/index.html +5 -2
  449. package/dist/serve/site-ui/docs/tutorial/index.html +10 -7
  450. package/dist/serve/site-ui/docs/tutorial.md +4 -4
  451. package/dist/serve/site-ui/examples/chess/index.html +4 -2
  452. package/dist/serve/site-ui/firestore/index.html +5 -3
  453. package/dist/serve/site-ui/hero-charcoal.jpg +0 -0
  454. package/dist/serve/site-ui/index.html +9 -7
  455. package/dist/serve/site-ui/llms.txt +13 -3
  456. package/dist/serve/site-ui/pyric-campfire-full.png +0 -0
  457. package/dist/serve/site-ui/pyric-campfire.png +0 -0
  458. package/dist/serve/site-ui/rtdb/index.html +5 -3
  459. package/dist/serve/site-ui/settings/index.html +5 -3
  460. package/dist/serve/site-ui/storage/index.html +5 -3
  461. package/dist/serve/site-ui/studio/index.html +13 -0
  462. package/dist/serve/site-ui/studio-routes.json +1 -1
  463. package/dist/serve/site-ui/traffic/index.html +5 -3
  464. package/dist/serve/studio/disk-workspace.d.ts.map +1 -1
  465. package/dist/serve/studio/disk-workspace.js +64 -2
  466. package/dist/serve/studio/disk-workspace.js.map +1 -1
  467. package/dist/serve/studio/routes.d.ts +9 -0
  468. package/dist/serve/studio/routes.d.ts.map +1 -1
  469. package/dist/serve/studio/routes.js +47 -7
  470. package/dist/serve/studio/routes.js.map +1 -1
  471. package/dist/serve/vite-ai-config.d.ts.map +1 -1
  472. package/dist/serve/vite-ai-config.js +38 -8
  473. package/dist/serve/vite-ai-config.js.map +1 -1
  474. package/dist/serve/vite-module-swap.d.ts.map +1 -1
  475. package/dist/serve/vite-module-swap.js +0 -28
  476. package/dist/serve/vite-module-swap.js.map +1 -1
  477. package/dist/serve/vite-plugin.d.ts +7 -7
  478. package/dist/serve/vite-plugin.js +1 -1
  479. package/dist/serve/vite-plugin.js.map +1 -1
  480. package/dist/serve/vite-sandbox-generation.d.ts +1 -1
  481. package/dist/serve/vite-sandbox-generation.d.ts.map +1 -1
  482. package/dist/serve/vite-sandbox-generation.js +13 -1
  483. package/dist/serve/vite-sandbox-generation.js.map +1 -1
  484. package/dist/serve/worker/client/auth.js +1 -2
  485. package/dist/serve/worker/client/auth.js.map +1 -1
  486. package/dist/serve/worker/client/core.d.ts +21 -1
  487. package/dist/serve/worker/client/core.d.ts.map +1 -1
  488. package/dist/serve/worker/client/core.js +79 -3
  489. package/dist/serve/worker/client/core.js.map +1 -1
  490. package/dist/serve/worker/client/disconnect.js +1 -1
  491. package/dist/serve/worker/client/disconnect.js.map +1 -1
  492. package/dist/serve/worker/client/presence.d.ts.map +1 -1
  493. package/dist/serve/worker/client/presence.js +18 -5
  494. package/dist/serve/worker/client/presence.js.map +1 -1
  495. package/dist/serve/worker/client.d.ts +1 -1
  496. package/dist/serve/worker/client.d.ts.map +1 -1
  497. package/dist/serve/worker/client.js +1 -1
  498. package/dist/serve/worker/client.js.map +1 -1
  499. package/dist/serve/worker/context-resolver.d.ts +30 -0
  500. package/dist/serve/worker/context-resolver.d.ts.map +1 -0
  501. package/dist/serve/worker/context-resolver.js +44 -0
  502. package/dist/serve/worker/context-resolver.js.map +1 -0
  503. package/dist/serve/worker/entry.js +23 -19
  504. package/dist/serve/worker/entry.js.map +1 -1
  505. package/dist/serve/worker/host/core.d.ts +1 -0
  506. package/dist/serve/worker/host/core.d.ts.map +1 -1
  507. package/dist/serve/worker/host/core.js +12 -6
  508. package/dist/serve/worker/host/core.js.map +1 -1
  509. package/dist/serve/worker/host/storage.js +2 -2
  510. package/dist/serve/worker/host-ai.d.ts.map +1 -1
  511. package/dist/serve/worker/host-ai.js +15 -0
  512. package/dist/serve/worker/host-ai.js.map +1 -1
  513. package/dist/serve/worker/host-auth.js +1 -2
  514. package/dist/serve/worker/host-auth.js.map +1 -1
  515. package/dist/serve/worker/index.d.ts +1 -1
  516. package/dist/serve/worker/index.d.ts.map +1 -1
  517. package/dist/serve/worker/index.js +2 -2
  518. package/dist/serve/worker/index.js.map +1 -1
  519. package/dist/serve/worker/port-lifecycle.d.ts +18 -0
  520. package/dist/serve/worker/port-lifecycle.d.ts.map +1 -0
  521. package/dist/serve/worker/port-lifecycle.js +28 -0
  522. package/dist/serve/worker/port-lifecycle.js.map +1 -0
  523. package/dist/serve/worker/protocol.d.ts +4 -0
  524. package/dist/serve/worker/protocol.d.ts.map +1 -1
  525. package/dist/serve/worker/protocol.js.map +1 -1
  526. package/dist/serve/worker/serve-init.d.ts.map +1 -1
  527. package/dist/serve/worker/serve-init.js +15 -3
  528. package/dist/serve/worker/serve-init.js.map +1 -1
  529. package/dist/verify/fixture.d.ts +1 -1
  530. package/package.json +17 -6
  531. package/src/assurance/.generated/conformance-verdicts.ts +68 -1
  532. package/src/bridge/client/dispatch.ts +52 -56
  533. package/src/bridge/client/tool-family-factories.ts +34 -0
  534. package/src/bridge/server/mcp-contract.ts +15 -59
  535. package/src/bridge/server/peer.ts +24 -1
  536. package/src/bridge/server/tool-family-factories.ts +40 -0
  537. package/src/bridge/server/tool-metadata.ts +29 -61
  538. package/src/bridge/tool-families.generated.ts +17 -0
  539. package/src/bridge/tool-families.ts +87 -0
  540. package/src/bridge/tool-family-records/conformance.ts +6 -0
  541. package/src/bridge/tool-family-records/firestore-data.ts +15 -0
  542. package/src/bridge/tool-family-records/firestore-inspect.ts +6 -0
  543. package/src/bridge/tool-family-records/firestore-rules.ts +15 -0
  544. package/src/bridge/tool-family-records/firestore-simulator.ts +16 -0
  545. package/src/bridge/tool-family-records/rtdb-inspection.ts +6 -0
  546. package/src/bundler/externals.ts +55 -0
  547. package/src/bundler/index.ts +21 -0
  548. package/src/cli/cli.test.ts +2 -46
  549. package/src/cli/index.ts +48 -42
  550. package/src/cli/inlined-sdk-scanner.ts +77 -0
  551. package/src/cli/mcp-proxy.ts +4 -4
  552. package/src/cli/parse-args.ts +61 -15
  553. package/src/cli/pyric-config.ts +45 -0
  554. package/src/cli/sandbox-interlock.ts +167 -0
  555. package/src/cli/{dev-runner.ts → sandbox-runner.ts} +142 -86
  556. package/src/cli/serve.ts +182 -115
  557. package/src/cli/snapshot.ts +5 -5
  558. package/src/cli/unsupported-runtime.ts +68 -0
  559. package/src/cli/verify.ts +1 -1
  560. package/src/conformance/.generated/can-i-use-browser.ts +2 -2
  561. package/src/conformance/.generated/can-i-use.ts +2 -2
  562. package/src/conformance/.generated/conformance-docs.ts +1 -1
  563. package/src/functions-rtdb/child.ts +115 -21
  564. package/src/functions-rtdb/development-runtime.ts +5 -1
  565. package/src/functions-rtdb/project.ts +8 -8
  566. package/src/google-endpoints.ts +155 -0
  567. package/src/next/guard.ts +1 -1
  568. package/src/next/runtime-env.ts +5 -0
  569. package/src/next/with-pyric.ts +1 -1
  570. package/src/register/beacon.ts +232 -0
  571. package/src/register/index.ts +68 -6
  572. package/src/register/net-guard.ts +567 -0
  573. package/src/remote/index.ts +9 -9
  574. package/src/serve/ai-diagnostics-relay.ts +243 -0
  575. package/src/serve/ai-proxy.ts +327 -0
  576. package/src/serve/ai-status.ts +109 -0
  577. package/src/serve/ai-terminal-blocks.ts +210 -0
  578. package/src/serve/ai-terminal-text.ts +52 -0
  579. package/src/serve/beacon-route.ts +141 -0
  580. package/src/serve/bundler.ts +10 -10
  581. package/src/serve/entries/active-auth-registry.ts +56 -0
  582. package/src/serve/entries/active-auth.ts +100 -0
  583. package/src/serve/entries/ai.ts +27 -1
  584. package/src/serve/entries/auth-helper-core.ts +5 -0
  585. package/src/serve/entries/auth-helper-dom.ts +27 -3
  586. package/src/serve/entries/auth-helper-runtime.ts +1 -1
  587. package/src/serve/entries/auth.ts +8 -0
  588. package/src/serve/entries/bridge-url.ts +1 -1
  589. package/src/serve/entries/firestore.ts +3 -3
  590. package/src/serve/entries/init.ts +78 -3
  591. package/src/serve/entries/keepalive.ts +1 -1
  592. package/src/serve/entries/runtime.ts +29 -14
  593. package/src/serve/entries/storage.ts +1 -1
  594. package/src/serve/entries/worker-runtime.ts +1 -1
  595. package/src/serve/init-payload.ts +4 -0
  596. package/src/serve/namespace.ts +117 -145
  597. package/src/serve/rules.ts +47 -22
  598. package/src/serve/runtime/chip-config.ts +16 -2
  599. package/src/serve/runtime/chip-dialog.ts +366 -0
  600. package/src/serve/runtime/chip-install.ts +10 -4
  601. package/src/serve/runtime/chip-user-search.ts +391 -0
  602. package/src/serve/runtime/chip.ts +177 -15
  603. package/src/serve/runtime/identity.ts +26 -0
  604. package/src/serve/runtime/manifest.ts +1 -1
  605. package/src/serve/runtime/status.ts +24 -0
  606. package/src/serve/sandbox-session.ts +19 -4
  607. package/src/serve/server.ts +18 -1
  608. package/src/serve/studio/disk-workspace.ts +76 -2
  609. package/src/serve/studio/routes.ts +63 -7
  610. package/src/serve/vite-ai-config.ts +37 -7
  611. package/src/serve/vite-module-swap.ts +0 -28
  612. package/src/serve/vite-plugin.ts +8 -8
  613. package/src/serve/vite-sandbox-generation.ts +16 -1
  614. package/src/serve/worker/client/auth.ts +1 -1
  615. package/src/serve/worker/client/core.ts +80 -3
  616. package/src/serve/worker/client/disconnect.ts +1 -1
  617. package/src/serve/worker/client/presence.ts +25 -5
  618. package/src/serve/worker/client.ts +1 -1
  619. package/src/serve/worker/context-resolver.ts +60 -0
  620. package/src/serve/worker/entry.ts +22 -18
  621. package/src/serve/worker/host/core.ts +9 -7
  622. package/src/serve/worker/host/storage.ts +2 -2
  623. package/src/serve/worker/host-ai.ts +15 -0
  624. package/src/serve/worker/host-auth.ts +1 -1
  625. package/src/serve/worker/index.ts +4 -1
  626. package/src/serve/worker/port-lifecycle.ts +45 -0
  627. package/src/serve/worker/protocol.ts +2 -1
  628. package/src/serve/worker/serve-init.ts +14 -3
  629. package/src/verify/fixture.ts +1 -1
  630. package/README.md.orig +0 -145
  631. package/dist/cli/dev-runner.d.ts.map +0 -1
  632. package/dist/cli/dev-runner.js.map +0 -1
  633. package/dist/serve/site-ui/_astro/_slug_.CXh9yTP1.css +0 -1
  634. package/dist/serve/site-ui/_astro/_slug_.CupVK4TM.css +0 -1
  635. package/dist/serve/site-ui/_astro/_studio_.CfxiQWkk.css +0 -1
  636. package/dist/serve/site-ui/_astro/app.BsFsMjn0.css +0 -1
  637. package/dist/serve/site-ui/_astro/app.Ce3MTLQm.js +0 -1
  638. package/dist/serve/site-ui/_astro/app.taqzyjD0.js +0 -11
  639. package/dist/serve/site-ui/_astro/sandbox-controls.BP4M5f1M.js +0 -1169
  640. package/dist/serve/site-ui/_astro/writes.C57paAj2.js +0 -99
  641. package/dist/serve/site-ui/docs/trust/storage-rules-stdlib-research/index.html +0 -582
  642. package/dist/serve/site-ui/docs/trust/storage-rules-stdlib-research.md +0 -448
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-env.js","sourceRoot":"","sources":["../../src/next/runtime-env.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,UAAU,iBAAiB,CAAC,MAAwB,EAAE,OAA0B;IACpF,IAAI,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A8B,GAAG,SAAS,CAAC;IACvD,WAAW,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAC3C,aAAa,CAAC,GAAG,GAAG,WAAW,CAAC;IAChC,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -5,7 +5,7 @@ import type { NextConfig, PyricNextOptions } from './types.js';
5
5
  /**
6
6
  * Higher-order configuration wrapper for Next.js (`next.config.js` or `next.config.mjs`).
7
7
  *
8
- * During development mode (`pyric dev` or non-production NODE_ENV):
8
+ * During development mode (`pyric sandbox` or non-production NODE_ENV):
9
9
  * - Applies Webpack and Turbopack alias mappings to swap `firebase/*` imports
10
10
  * for Pyric local sandbox mirrors on client components.
11
11
  * - Adds `firebase` and `firebase-admin` to `serverExternalPackages` to prevent
@@ -18,7 +18,7 @@ function applyPyricEnhancements(config, options) {
18
18
  /**
19
19
  * Higher-order configuration wrapper for Next.js (`next.config.js` or `next.config.mjs`).
20
20
  *
21
- * During development mode (`pyric dev` or non-production NODE_ENV):
21
+ * During development mode (`pyric sandbox` or non-production NODE_ENV):
22
22
  * - Applies Webpack and Turbopack alias mappings to swap `firebase/*` imports
23
23
  * for Pyric local sandbox mirrors on client components.
24
24
  * - Adds `firebase` and `firebase-admin` to `serverExternalPackages` to prevent
@@ -0,0 +1,69 @@
1
+ import type { GuardMode } from './net-guard.js';
2
+ /** The dev server route that receives beacons (`serve/beacon-route.ts`). */
3
+ export declare const BEACON_PATH = "/__pyric/beacon";
4
+ /** Header carrying the per-launch secret from `PYRIC_BEACON_TOKEN`. The route
5
+ * rejects a beacon that does not present it. */
6
+ export declare const BEACON_TOKEN_HEADER = "x-pyric-beacon-token";
7
+ /** What one activated child asserts about itself. Wire shape of the POST body
8
+ * and the fields of the stderr line, kept identical on purpose. */
9
+ export interface BeaconReport {
10
+ /** The child's own pid, the only durable handle a parent has on it. */
11
+ readonly pid: number;
12
+ /** Net-guard mode actually in force in this process. */
13
+ readonly guard: GuardMode;
14
+ /** Whether module resolution hooks were installed. `false` means imports
15
+ * are NOT being rewritten, which is the whole thing worth knowing. */
16
+ readonly hooks: boolean;
17
+ /** The activator verbatim, so the parent can attribute the beacon. */
18
+ readonly sandbox: string;
19
+ }
20
+ export interface BeaconHooks {
21
+ readonly write?: (line: string) => void;
22
+ /** Delivery seam for the machine channel. Defaults to
23
+ * {@link sendBeaconRequest}. */
24
+ readonly send?: (endpoint: string, body: string, token: string) => void;
25
+ /** Environment read for the beacon secret and the stderr gate. Defaults to
26
+ * `process.env`. */
27
+ readonly env?: Record<string, string | undefined>;
28
+ }
29
+ /**
30
+ * POST one beacon body, fire and forget, over an unref'd socket. See the
31
+ * module header for why this is `node:http` and not `fetch`.
32
+ *
33
+ * `token` is the per-launch secret from `PYRIC_BEACON_TOKEN`; the route
34
+ * rejects a beacon without it.
35
+ */
36
+ export declare function sendBeaconRequest(endpoint: string, body: string, token: string): void;
37
+ /**
38
+ * The beacon endpoint implied by an activator value, or `null` when none is.
39
+ * Accepts `remote:<url>` (what `buildChildEnv` writes) and a bare URL; any
40
+ * non-http(s) scheme, and anything unparseable, is `null`: an unfetchable
41
+ * guess is worse than an honest absence.
42
+ */
43
+ export declare function beaconEndpoint(sandbox: string | undefined): string | null;
44
+ /**
45
+ * One stderr line, structured the way net-guard's verdict lines are: fixed
46
+ * leading fields first so it is greppable (`beacon ACTIVE pid= guard= hooks=
47
+ * bridge=`), then the explanation.
48
+ */
49
+ export declare function formatBeaconLine(report: BeaconReport, endpoint: string | null): string;
50
+ /**
51
+ * Whether the stderr channel prints.
52
+ *
53
+ * Quiet by default: a healthy first run should not carry a line per launched
54
+ * process, and the POST already tells the dev server what happened. The line
55
+ * prints when the developer asked for detail (`PYRIC_GUARD` set explicitly,
56
+ * `PYRIC_DEBUG`, or `PYRIC_VERBOSE`), and always when the report itself is bad
57
+ * news, since a child whose hooks did not install may have no other way to say
58
+ * so.
59
+ */
60
+ export declare function beaconLineIsPrinted(report: BeaconReport, env: Record<string, string | undefined>): boolean;
61
+ /**
62
+ * Emit the beacon. Never throws, never returns a promise: the caller is the
63
+ * `--import` hot path of every pyric-launched process.
64
+ *
65
+ * The POST always goes out. The stderr line is conditional, see
66
+ * {@link beaconLineIsPrinted}.
67
+ */
68
+ export declare function emitBeacon(report: BeaconReport, hooks?: BeaconHooks): void;
69
+ //# sourceMappingURL=beacon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"beacon.d.ts","sourceRoot":"","sources":["../../src/register/beacon.ts"],"names":[],"mappings":"AAuDA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,4EAA4E;AAC5E,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAE7C;iDACiD;AACjD,eAAO,MAAM,mBAAmB,yBAAyB,CAAC;AAI1D;oEACoE;AACpE,MAAM,WAAW,YAAY;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B;2EACuE;IACvE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;qCACiC;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxE;yBACqB;IACrB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CACnD;AAWD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CA0CrF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAczE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAYtF;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GACtC,OAAO,CAKT;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,GAAE,WAAgB,GAAG,IAAI,CAa9E"}
@@ -0,0 +1,199 @@
1
+ /**
2
+ * The handshake beacon: register's proof that interception is live in this
3
+ * process.
4
+ *
5
+ * `pyric sandbox` sets `PYRIC_SANDBOX` and appends `--import
6
+ * @pyric/cli/register` to the child's `NODE_OPTIONS`, and then assumes the
7
+ * rest. Every link in that chain is silently breakable by the user's own
8
+ * command: a `bun`/`deno` runner that never evaluates Node loader hooks, a
9
+ * script that overwrites `NODE_OPTIONS` wholesale, a `NODE_ENV=production`
10
+ * that trips the activation refusal, an intermediate process that strips the
11
+ * env. In every one of those cases the child comes up looking perfectly
12
+ * healthy while its `firebase-admin` and `firebase` imports resolve to the
13
+ * real SDKs and reach live Firebase.
14
+ *
15
+ * The beacon closes that gap the only honest way: the child says so itself,
16
+ * after the hooks and the net-guard are actually installed.
17
+ *
18
+ * Two channels, on purpose
19
+ * ------------------------
20
+ * 1. A fire-and-forget `POST <bridge>/__pyric/beacon`, whenever a bridge URL
21
+ * is knowable from the child's own env. That is the machine channel: it
22
+ * reaches the dev server across an arbitrary depth of intermediate
23
+ * processes (npm, then next, then its worker), where stderr scraping stops
24
+ * being attributable. It carries the per-launch secret from
25
+ * `PYRIC_BEACON_TOKEN`, which is what the route authorizes on.
26
+ * 2. One structured stderr line, printed when the developer asked for detail
27
+ * or when the report is bad news (see {@link beaconLineIsPrinted}). It is
28
+ * the fallback for a process with no reachable server, no port, no network.
29
+ *
30
+ * Where the bridge URL comes from
31
+ * -------------------------------
32
+ * `cli/sandbox-runner.ts:buildChildEnv` sets
33
+ * `PYRIC_SANDBOX=remote:<serveUrl>`, so the activator is the address. Nothing
34
+ * else needs to be plumbed, and the beacon works for any descendant that
35
+ * inherited the env, not just the direct child. When the activator carries no
36
+ * URL (`PYRIC_SANDBOX=local`, or a hand-set value), there is no endpoint and
37
+ * the line says `bridge=none` rather than guessing.
38
+ *
39
+ * The POST must never be able to hurt the child
40
+ * ---------------------------------------------
41
+ * It is diagnostics. A refused connection, a 500, an unreachable host: every
42
+ * one of those is swallowed. `emitBeacon` is `void`, never awaited.
43
+ *
44
+ * It is sent over a raw `node:http` request, an unref'd socket under a hard
45
+ * one-second bound (see {@link BEACON_TIMEOUT_MS}), rather than `fetch`, whose
46
+ * pending promise has neither knob. A short `node seed.js` child must not sit
47
+ * around after finishing its work just to deliver a diagnostic. A child that
48
+ * exits before the beacon lands simply loses the machine channel, which is
49
+ * exactly why the watchdog on the other end is warn-only.
50
+ *
51
+ * The POST targets loopback, which is not in the shared Google endpoint
52
+ * catalog, so it passes the net-guard installed moments earlier without a
53
+ * verdict.
54
+ */
55
+ import { createRequire } from 'node:module';
56
+ /** The dev server route that receives beacons (`serve/beacon-route.ts`). */
57
+ export const BEACON_PATH = '/__pyric/beacon';
58
+ /** Header carrying the per-launch secret from `PYRIC_BEACON_TOKEN`. The route
59
+ * rejects a beacon that does not present it. */
60
+ export const BEACON_TOKEN_HEADER = 'x-pyric-beacon-token';
61
+ const LOG_PREFIX = '@pyric/cli/register: beacon';
62
+ /**
63
+ * The hard bound on how long a beacon may delay a child's exit.
64
+ *
65
+ * One second, because this is loopback: the bridge is the dev server that
66
+ * launched us. If it has not accepted a connection in a second it is not
67
+ * going to, and no diagnostic is worth more of the child's life than that.
68
+ */
69
+ const BEACON_TIMEOUT_MS = 1_000;
70
+ /**
71
+ * POST one beacon body, fire and forget, over an unref'd socket. See the
72
+ * module header for why this is `node:http` and not `fetch`.
73
+ *
74
+ * `token` is the per-launch secret from `PYRIC_BEACON_TOKEN`; the route
75
+ * rejects a beacon without it.
76
+ */
77
+ export function sendBeaconRequest(endpoint, body, token) {
78
+ const require = createRequire(import.meta.url);
79
+ const secure = endpoint.startsWith('https:');
80
+ const http = require(secure ? 'node:https' : 'node:http');
81
+ const req = http.request(endpoint, {
82
+ method: 'POST',
83
+ headers: {
84
+ 'content-type': 'application/json',
85
+ 'content-length': Buffer.byteLength(body),
86
+ [BEACON_TOKEN_HEADER]: token,
87
+ },
88
+ });
89
+ // The bound on how long this can delay the child's exit is the unref'd timer
90
+ // below, not the socket and not a request timeout. A pending connect holds
91
+ // the event loop open regardless of `socket.unref()`, and `req.setTimeout()`
92
+ // does not arm until the `connect` event, so against a blackholed loopback
93
+ // address a 300 ms request timeout was measured firing at 5006 ms, when the
94
+ // kernel reset the connection. The timer destroys the request instead: it
95
+ // cannot hold the loop by itself, and it always gets to run.
96
+ const abort = setTimeout(() => req.destroy(), BEACON_TIMEOUT_MS);
97
+ abort.unref?.();
98
+ const settle = () => clearTimeout(abort);
99
+ req.on('socket', (socket) => {
100
+ socket.unref?.();
101
+ });
102
+ // A refused/reset connection is an expected outcome, not an error the child
103
+ // should ever hear about.
104
+ req.on('error', settle);
105
+ req.on('close', settle);
106
+ req.on('response', (res) => {
107
+ res.resume?.();
108
+ settle();
109
+ });
110
+ req.end(body);
111
+ }
112
+ /**
113
+ * The beacon endpoint implied by an activator value, or `null` when none is.
114
+ * Accepts `remote:<url>` (what `buildChildEnv` writes) and a bare URL; any
115
+ * non-http(s) scheme, and anything unparseable, is `null`: an unfetchable
116
+ * guess is worse than an honest absence.
117
+ */
118
+ export function beaconEndpoint(sandbox) {
119
+ if (sandbox === undefined)
120
+ return null;
121
+ const raw = sandbox.trim();
122
+ if (raw.length === 0)
123
+ return null;
124
+ const value = raw.startsWith('remote:') ? raw.slice('remote:'.length).trim() : raw;
125
+ if (value.length === 0)
126
+ return null;
127
+ let url;
128
+ try {
129
+ url = new URL(value);
130
+ }
131
+ catch {
132
+ return null;
133
+ }
134
+ if (url.protocol !== 'http:' && url.protocol !== 'https:')
135
+ return null;
136
+ return `${url.origin}${BEACON_PATH}`;
137
+ }
138
+ /**
139
+ * One stderr line, structured the way net-guard's verdict lines are: fixed
140
+ * leading fields first so it is greppable (`beacon ACTIVE pid= guard= hooks=
141
+ * bridge=`), then the explanation.
142
+ */
143
+ export function formatBeaconLine(report, endpoint) {
144
+ const head = `${LOG_PREFIX} ACTIVE pid=${report.pid} guard=${report.guard} ` +
145
+ `hooks=${report.hooks ? 1 : 0} bridge=${endpoint ?? 'none'}`;
146
+ let hooksNote;
147
+ if (report.hooks) {
148
+ hooksNote = 'firebase-admin/firebase imports in this process are rewritten to the pyric sandbox';
149
+ }
150
+ else {
151
+ hooksNote =
152
+ 'module hooks did NOT install, so firebase-admin/firebase imports in this process are NOT rewritten';
153
+ }
154
+ return `${head}: ${hooksNote}, net-guard mode ${report.guard}.\n`;
155
+ }
156
+ /**
157
+ * Whether the stderr channel prints.
158
+ *
159
+ * Quiet by default: a healthy first run should not carry a line per launched
160
+ * process, and the POST already tells the dev server what happened. The line
161
+ * prints when the developer asked for detail (`PYRIC_GUARD` set explicitly,
162
+ * `PYRIC_DEBUG`, or `PYRIC_VERBOSE`), and always when the report itself is bad
163
+ * news, since a child whose hooks did not install may have no other way to say
164
+ * so.
165
+ */
166
+ export function beaconLineIsPrinted(report, env) {
167
+ if (!report.hooks)
168
+ return true;
169
+ if ((env.PYRIC_GUARD ?? '').trim().length > 0)
170
+ return true;
171
+ if (env.PYRIC_DEBUG)
172
+ return true;
173
+ return Boolean(env.PYRIC_VERBOSE);
174
+ }
175
+ /**
176
+ * Emit the beacon. Never throws, never returns a promise: the caller is the
177
+ * `--import` hot path of every pyric-launched process.
178
+ *
179
+ * The POST always goes out. The stderr line is conditional, see
180
+ * {@link beaconLineIsPrinted}.
181
+ */
182
+ export function emitBeacon(report, hooks = {}) {
183
+ const env = hooks.env ?? process.env;
184
+ const write = hooks.write ?? ((line) => void process.stderr.write(line));
185
+ const endpoint = beaconEndpoint(report.sandbox);
186
+ if (beaconLineIsPrinted(report, env))
187
+ write(formatBeaconLine(report, endpoint));
188
+ if (endpoint === null)
189
+ return;
190
+ const token = env.PYRIC_BEACON_TOKEN ?? '';
191
+ try {
192
+ (hooks.send ?? sendBeaconRequest)(endpoint, JSON.stringify(report), token);
193
+ }
194
+ catch {
195
+ // A runtime with no usable http module, or an endpoint that slipped the
196
+ // URL parse, loses the machine channel only.
197
+ }
198
+ }
199
+ //# sourceMappingURL=beacon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"beacon.js","sourceRoot":"","sources":["../../src/register/beacon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAE7C;iDACiD;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC;AAE1D,MAAM,UAAU,GAAG,6BAA6B,CAAC;AA0BjD;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,IAAY,EAAE,KAAa;IAC7E,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAM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"AAoIA;;yEAEyE;AACzE,eAAO,IAAI,MAAM,SAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/register/index.ts"],"names":[],"mappings":"AAkMA;;yEAEyE;AACzE,eAAO,IAAI,MAAM,SAAQ,CAAC"}
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * `@pyric/cli/register` — the Node substitution seam (adoption layer 2).
3
3
  *
4
- * Loaded via `node --import @pyric/cli/register` (which `pyric dev` injects
5
- * through NODE_OPTIONS), it makes the user's UNCHANGED `firebase-admin` /
6
- * `firebase` imports resolve to `pyric-admin` / `pyric`, every subpath 1:1,
4
+ * Loaded via `node --import @pyric/cli/register` (which `pyric sandbox`
5
+ * injects through NODE_OPTIONS), it makes the user's UNCHANGED `firebase-admin`
6
+ * and `firebase` imports resolve to `pyric-admin` and `pyric`, every subpath 1:1,
7
7
  * and installs the sandbox-factory global that `pyric-admin`'s ambient
8
8
  * `initializeApp()` consumes.
9
9
  *
@@ -17,6 +17,17 @@
17
17
  * `require()` and `import`. On older 22.x it falls back to
18
18
  * `module.register()` (ESM-only) with a warning that CJS require() is not
19
19
  * rewritten.
20
+ *
21
+ * On activation it also installs the NETWORK GUARD (`./net-guard.js`), which
22
+ * reports egress from this process to live Google/Firebase endpoints, or
23
+ * refuses it under `PYRIC_GUARD=block`. See that module for the policy and the
24
+ * `PYRIC_GUARD` and `PYRIC_GUARD_ALLOW` knobs.
25
+ *
26
+ * Finally it emits the HANDSHAKE BEACON (`./beacon.js`): a fire-and-forget
27
+ * `POST /__pyric/beacon` when the activator carries a bridge URL, plus a
28
+ * stderr line when the developer asked for detail. That is how `pyric sandbox`
29
+ * learns that interception actually reached this child rather than assuming
30
+ * it did.
20
31
  */
21
32
  import Module from 'node:module';
22
33
  import { readFileSync } from 'node:fs';
@@ -24,6 +35,8 @@ import { dirname, join } from 'node:path';
24
35
  import { pathToFileURL } from 'node:url';
25
36
  import { mapFirebaseSpecifier } from './mapping.js';
26
37
  import { resolveEsmOnlySubpath } from './esm-exports.js';
38
+ import { installNetGuard, parseGuardMode } from './net-guard.js';
39
+ import { emitBeacon } from './beacon.js';
27
40
  import { remoteSandbox } from '../remote/index.js';
28
41
  /** The shared seam with pyric-admin's ambient init: a synchronous factory
29
42
  * returning the lazy branded handle. `Symbol.for` so both packages agree
@@ -68,7 +81,28 @@ function resolveEsmOnlyForRequire(mapped) {
68
81
  }
69
82
  }
70
83
  function activate() {
84
+ // FIRST, before any hook or global: the network guard.
85
+ //
86
+ // Order matters in one direction only. Everything after this line makes the
87
+ // process load MORE code (the resolution hooks pull in the pyric mirrors,
88
+ // the factory global pulls in the remote sandbox) and any of it could open
89
+ // a socket. Installing the guard first leaves no window in which
90
+ // sandbox-substituted code runs unguarded. The reverse ordering buys
91
+ // nothing: the guard mutates globals only (`undici.globalDispatcher.1`,
92
+ // `net`/`tls` connect) and depends on nothing the hooks establish.
93
+ //
94
+ // It stays BELOW the NODE_ENV=production refusal, deliberately. A refused
95
+ // process is a real production run that we declined to touch, and warning
96
+ // about its perfectly legitimate Google traffic, let alone blocking it,
97
+ // would be actively harmful. `PYRIC_SANDBOX` plus no refusal is the only
98
+ // state in which "traffic to live Google is a bug" is a true statement.
99
+ const guard = installNetGuard();
100
+ // Whether module resolution is actually being intercepted. Both branches
101
+ // below install SOMETHING, but a runtime with neither API installs nothing,
102
+ // which is precisely the state the beacon exists to make visible.
103
+ let hooksInstalled = false;
71
104
  if (typeof moduleApi.registerHooks === 'function') {
105
+ hooksInstalled = true;
72
106
  moduleApi.registerHooks({
73
107
  resolve(specifier, context, nextResolve) {
74
108
  const mapped = mapFirebaseSpecifier(specifier, context.parentURL);
@@ -94,16 +128,41 @@ function activate() {
94
128
  });
95
129
  }
96
130
  else {
97
- process.stderr.write('@pyric/cli/register: this Node version lacks module.registerHooks (needs >= 22.15) ' +
98
- 'falling back to module.register: ESM imports of firebase-admin/firebase are rewritten, ' +
131
+ process.stderr.write('@pyric/cli/register: this Node version lacks module.registerHooks (needs >= 22.15). ' +
132
+ 'Falling back to module.register: ESM imports of firebase-admin/firebase are rewritten, ' +
99
133
  "but CJS require('firebase-admin') is NOT intercepted. Upgrade Node to >= 22.15 for full coverage.\n");
134
+ hooksInstalled = typeof moduleApi.register === 'function';
100
135
  moduleApi.register?.(new URL('./hooks.js', import.meta.url));
101
136
  }
102
137
  // The factory global — exact contract shared with pyric-admin's ambient
103
138
  // init: synchronous, returns the lazy branded handle.
104
139
  globalThis[SANDBOX_FACTORY] = (opts) => remoteSandbox(opts);
105
- process.stderr.write(`@pyric/cli/register: active firebase-admin/firebase imports now resolve to the ` +
140
+ process.stderr.write(`@pyric/cli/register: active. firebase-admin/firebase imports now resolve to the ` +
106
141
  `pyric sandbox (PYRIC_SANDBOX=${process.env.PYRIC_SANDBOX}).\n`);
142
+ // LAST: the handshake beacon, after the guard, the hooks and the factory
143
+ // global are all in place. Its whole claim is "interception is live in this
144
+ // process", so it must not be able to run before that is true. See
145
+ // `./beacon.js` for the two channels and why the POST is fire-and-forget.
146
+ emitBeacon({
147
+ pid: process.pid,
148
+ guard: installedGuardMode(guard),
149
+ hooks: hooksInstalled,
150
+ sandbox: process.env.PYRIC_SANDBOX ?? '',
151
+ });
152
+ }
153
+ /**
154
+ * The net-guard mode actually in force, for the beacon to report.
155
+ *
156
+ * Policy: the installed guard is the authority when there is one. There is no
157
+ * guard object in exactly one case, `PYRIC_GUARD=off` (the `PYRIC_SANDBOX`
158
+ * gate `installNetGuard` shares with this module has already passed by the
159
+ * time it runs), and re-parsing the env is how that case names itself rather
160
+ * than guessing a default.
161
+ */
162
+ function installedGuardMode(guard) {
163
+ if (guard !== null)
164
+ return guard.mode;
165
+ return parseGuardMode(process.env.PYRIC_GUARD);
107
166
  }
108
167
  /** Whether this process's firebase-admin/firebase imports are being rewritten
109
168
  * to the pyric sandbox — true only when `PYRIC_SANDBOX` was set (and not
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/register/index.ts"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AChC,KAAK,EAAE,cAAc;QACrB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE;KACzC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CAAC,KAAiC;IAC3D,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC;IACtC,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACjD,CAAC;AAED;;yEAEyE;AACzE,MAAM,CAAC,IAAI,MAAM,GAAG,KAAK,CAAC;AAE1B,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;IAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,KAAK,GAAG,EAAE,CAAC;QACrF,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,wEAAwE;YACtE,qDAAqD;YACrD,wDAAwD,CAC3D,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,QAAQ,EAAE,CAAC;QACX,MAAM,GAAG,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AACD,8EAA8E"}
@@ -0,0 +1,110 @@
1
+ /** Marks a rejection as the guard's, so callers can tell it from a DNS/TLS
2
+ * failure. A blocked `fetch` only exposes it as `error.cause.code`. */
3
+ export declare const GUARD_BLOCKED_CODE = "PYRIC_GUARD_BLOCKED";
4
+ export type GuardMode = 'warn' | 'block' | 'off';
5
+ /** What the guard decided about one outbound connection. */
6
+ export interface EgressVerdict {
7
+ /** `warn` reported-and-permitted, `block` refused, `allow` allowlisted. */
8
+ readonly verdict: 'warn' | 'block' | 'allow';
9
+ /** Whether the connection may proceed. */
10
+ readonly permitted: boolean;
11
+ /**
12
+ * The hostname actually being contacted, which is what the developer needs
13
+ * in order to find the call. Not the catalog suffix: `cloudfunctions.net`
14
+ * does not tell you which region or project a callable went to.
15
+ */
16
+ readonly host: string;
17
+ /** The catalog suffix that matched (`host` when the match was exact). */
18
+ readonly endpoint: string;
19
+ /** Human service label, verbatim from the shared catalog. */
20
+ readonly service: string;
21
+ /** Present only for catalog entries that can never be a false positive. */
22
+ readonly alwaysBlock?: true;
23
+ }
24
+ /** `PYRIC_GUARD` → mode. Unset, empty or unrecognised all mean the safe
25
+ * default: report, do not break the developer's app. */
26
+ export declare function parseGuardMode(raw: string | undefined): GuardMode;
27
+ /** `PYRIC_GUARD_ALLOW` → hostnames. Accepts bare hosts and full URLs, because
28
+ * the values it carries are configured as URLs (AI engine baseUrls). */
29
+ export declare function parseAllowHosts(raw: string | undefined): string[];
30
+ /**
31
+ * The whole verdict, pure: catalog lookup, then `alwaysBlock`, then the
32
+ * allowlist, then the mode. `null` means nothing to say: either not a
33
+ * production endpoint, or the guard is off.
34
+ */
35
+ export declare function evaluateEgress(hostname: string, policy: {
36
+ mode: GuardMode;
37
+ allow: readonly string[];
38
+ }): EgressVerdict | null;
39
+ /** One stderr line per verdict: structured (fixed leading fields, so it is
40
+ * greppable) and attributable (service + transport + initiating command).
41
+ * The request PATH is deliberately never logged: it carries ids and tokens. */
42
+ export declare function formatGuardLine(verdict: EgressVerdict, transport: 'fetch' | 'socket', context: string | undefined): string;
43
+ export interface ReporterOptions {
44
+ readonly mode: GuardMode;
45
+ readonly allow: readonly string[];
46
+ readonly write?: (line: string) => void;
47
+ /** Initiating command, for attribution. Usually `basename(argv[1])`. */
48
+ readonly context?: string;
49
+ /**
50
+ * The shared "already reported" ledger. `installNetGuard` hands the SAME set
51
+ * to the dispatcher wrapper and the socket backstop, because undici connects
52
+ * through `net.connect`: a warn-mode fetch trips both seams and would
53
+ * otherwise print the same host twice. It also survives a re-assert, so
54
+ * being re-wrapped does not restart the noise.
55
+ */
56
+ readonly reported?: Set<string>;
57
+ }
58
+ interface Dispatcher {
59
+ dispatch(opts: unknown, handler: unknown): unknown;
60
+ }
61
+ /**
62
+ * Wrap a dispatcher so `dispatch` is guarded and every other member still
63
+ * belongs to the real instance.
64
+ *
65
+ * A `Proxy` rather than a subclass or a copy: undici's Agent keeps state in
66
+ * private fields and internal symbols, and every forwarded call must run with
67
+ * `this` bound to the REAL instance (hence `Reflect.get(target, prop, target)`
68
+ * and the bind) or those fields are not there. `instanceof` keeps working.
69
+ */
70
+ export declare function wrapDispatcher<T extends Dispatcher>(real: T, options: ReporterOptions): T;
71
+ type ConnectFn = (...args: unknown[]) => unknown;
72
+ /** A `createConnection`-bearing object: an `http.Agent`/`https.Agent`
73
+ * prototype in production, a stand-in under test. */
74
+ type AgentPrototype = {
75
+ createConnection?: unknown;
76
+ };
77
+ export interface NetGuardHooks {
78
+ /** Object carrying the undici dispatcher symbol. Defaults to `globalThis`. */
79
+ scope?: Record<symbol, unknown>;
80
+ env?: Record<string, string | undefined>;
81
+ argv?: readonly string[];
82
+ write?: (line: string) => void;
83
+ net?: {
84
+ connect: ConnectFn;
85
+ createConnection: ConnectFn;
86
+ };
87
+ tls?: {
88
+ connect: ConnectFn;
89
+ };
90
+ /** Prototypes whose `createConnection` is patched. Defaults to the
91
+ * `http.Agent` and `https.Agent` prototypes. */
92
+ agentPrototypes?: readonly AgentPrototype[];
93
+ }
94
+ export interface NetGuard {
95
+ readonly mode: GuardMode;
96
+ readonly allow: readonly string[];
97
+ /** Re-wrap the global dispatcher if something replaced it (a future Next
98
+ * calling `setGlobalDispatcher` would otherwise silently unhook us). */
99
+ reassert(): void;
100
+ /** Stop the periodic re-assert. Used by the CLI's own tests. */
101
+ stop(): void;
102
+ }
103
+ /**
104
+ * Install the guard. Gated on `PYRIC_SANDBOX` exactly like the rest of the
105
+ * register module: without the activator this is a no-op, so the module stays
106
+ * safe to import anywhere. Returns `null` when nothing was installed.
107
+ */
108
+ export declare function installNetGuard(hooks?: NetGuardHooks): NetGuard | null;
109
+ export {};
110
+ //# sourceMappingURL=net-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"net-guard.d.ts","sourceRoot":"","sources":["../../src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