@joiner-platform/cli 0.0.0-stage → 0.1.1

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 (303) hide show
  1. package/README.md +30 -2
  2. package/bundled-resources/poe-tile-templates/base/CLAUDE.md +72 -0
  3. package/bundled-resources/poe-tile-templates/base/README.md +7 -0
  4. package/bundled-resources/poe-tile-templates/base/_bunfig.toml +8 -0
  5. package/bundled-resources/poe-tile-templates/base/_gitignore +18 -0
  6. package/bundled-resources/poe-tile-templates/base/client.ts +12 -0
  7. package/bundled-resources/poe-tile-templates/base/package.json +36 -0
  8. package/bundled-resources/poe-tile-templates/base/playwright.config.ts +38 -0
  9. package/bundled-resources/poe-tile-templates/base/scripts/check-source.ts +148 -0
  10. package/bundled-resources/poe-tile-templates/base/scripts/dev.ts +19 -0
  11. package/bundled-resources/poe-tile-templates/base/scripts/doctor.sh +29 -0
  12. package/bundled-resources/poe-tile-templates/base/scripts/visual-check.ts +64 -0
  13. package/bundled-resources/poe-tile-templates/base/synced-store/backend-config.ts +9 -0
  14. package/bundled-resources/poe-tile-templates/base/synced-store/client-config.ts +8 -0
  15. package/bundled-resources/poe-tile-templates/base/synced-store/data/items.ts +16 -0
  16. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/index.ts +10 -0
  17. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/remove-todo.ts +5 -0
  18. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/set-todo.ts +20 -0
  19. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/types.ts +5 -0
  20. package/bundled-resources/poe-tile-templates/base/synced-store/mutators.test.ts +138 -0
  21. package/bundled-resources/poe-tile-templates/base/synced-store/schema.ts +40 -0
  22. package/bundled-resources/poe-tile-templates/base/tests/e2e.test.playwright.ts +92 -0
  23. package/bundled-resources/poe-tile-templates/base/tests/mobile-viewport.test.playwright.ts +111 -0
  24. package/bundled-resources/poe-tile-templates/base/tests/render-check.test.playwright.ts +128 -0
  25. package/bundled-resources/poe-tile-templates/base/tests/screenshot.test.playwright.ts +86 -0
  26. package/bundled-resources/poe-tile-templates/base/tests/setup-dom.ts +70 -0
  27. package/bundled-resources/poe-tile-templates/base/tile/src/backend.ts +3 -0
  28. package/bundled-resources/poe-tile-templates/base/tile/styles.css +47 -0
  29. package/bundled-resources/poe-tile-templates/base/tsconfig.json +13 -0
  30. package/bundled-resources/poe-tile-templates/coverage.config.json +6 -0
  31. package/bundled-resources/poe-tile-templates/index.ts +27 -0
  32. package/bundled-resources/poe-tile-templates/package.json +31 -0
  33. package/bundled-resources/poe-tile-templates/phaserjs/package.partial.json +6 -0
  34. package/bundled-resources/poe-tile-templates/phaserjs/tile/index.html +14 -0
  35. package/bundled-resources/poe-tile-templates/phaserjs/tile/src/entry.ts +35 -0
  36. package/bundled-resources/poe-tile-templates/phaserjs/ui/App.test.happydom.tsx +98 -0
  37. package/bundled-resources/poe-tile-templates/phaserjs/ui/App.ts +180 -0
  38. package/bundled-resources/poe-tile-templates/phaserjs/ui/phaser-scene.ts +174 -0
  39. package/bundled-resources/poe-tile-templates/phaserjs/vite.config.ts +28 -0
  40. package/bundled-resources/poe-tile-templates/preact/package.partial.json +9 -0
  41. package/bundled-resources/poe-tile-templates/preact/postcss.config.js +5 -0
  42. package/bundled-resources/poe-tile-templates/preact/tile/index.html +14 -0
  43. package/bundled-resources/poe-tile-templates/preact/tile/src/entry.tsx +36 -0
  44. package/bundled-resources/poe-tile-templates/preact/tile/styles.css +51 -0
  45. package/bundled-resources/poe-tile-templates/preact/tsconfig.json +15 -0
  46. package/bundled-resources/poe-tile-templates/preact/ui/App.test.happydom.tsx +69 -0
  47. package/bundled-resources/poe-tile-templates/preact/ui/App.tsx +116 -0
  48. package/bundled-resources/poe-tile-templates/preact/vite.config.ts +18 -0
  49. package/bundled-resources/poe-tile-templates/react/package.partial.json +12 -0
  50. package/bundled-resources/poe-tile-templates/react/postcss.config.js +5 -0
  51. package/bundled-resources/poe-tile-templates/react/tile/index.html +14 -0
  52. package/bundled-resources/poe-tile-templates/react/tile/src/entry.tsx +38 -0
  53. package/bundled-resources/poe-tile-templates/react/tile/styles.css +51 -0
  54. package/bundled-resources/poe-tile-templates/react/tsconfig.json +14 -0
  55. package/bundled-resources/poe-tile-templates/react/ui/App.test.happydom.tsx +71 -0
  56. package/bundled-resources/poe-tile-templates/react/ui/App.tsx +110 -0
  57. package/bundled-resources/poe-tile-templates/react/vite.config.ts +21 -0
  58. package/bundled-resources/poe-tile-templates/scripts/cleanup.ts +10 -0
  59. package/bundled-resources/poe-tile-templates/scripts/generate.ts +57 -0
  60. package/bundled-resources/poe-tile-templates/scripts/install-diagnostics.ts +52 -0
  61. package/bundled-resources/poe-tile-templates/scripts/paths.ts +7 -0
  62. package/bundled-resources/poe-tile-templates/scripts/sdk-dependency-key.ts +288 -0
  63. package/bundled-resources/poe-tile-templates/scripts/verify-all-sdks.ts +132 -0
  64. package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-command.ts +30 -0
  65. package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-tarball.ts +397 -0
  66. package/bundled-resources/poe-tile-templates/solidjs/_bunfig.toml +14 -0
  67. package/bundled-resources/poe-tile-templates/solidjs/package.partial.json +13 -0
  68. package/bundled-resources/poe-tile-templates/solidjs/postcss.config.js +5 -0
  69. package/bundled-resources/poe-tile-templates/solidjs/tests/solid-plugin.ts +49 -0
  70. package/bundled-resources/poe-tile-templates/solidjs/tile/index.html +14 -0
  71. package/bundled-resources/poe-tile-templates/solidjs/tile/src/entry.tsx +36 -0
  72. package/bundled-resources/poe-tile-templates/solidjs/tile/styles.css +51 -0
  73. package/bundled-resources/poe-tile-templates/solidjs/tsconfig.json +15 -0
  74. package/bundled-resources/poe-tile-templates/solidjs/ui/App.test.happydom.tsx +70 -0
  75. package/bundled-resources/poe-tile-templates/solidjs/ui/App.tsx +129 -0
  76. package/bundled-resources/poe-tile-templates/solidjs/vite.config.ts +18 -0
  77. package/bundled-resources/poe-tile-templates/tests/check-source.test.ts +131 -0
  78. package/bundled-resources/poe-tile-templates/tests/dev-script.test.slow.ts +166 -0
  79. package/bundled-resources/poe-tile-templates/tests/fixtures/customized-manager.ts +67 -0
  80. package/bundled-resources/poe-tile-templates/tests/fixtures/extended-mutators.ts.txt +106 -0
  81. package/bundled-resources/poe-tile-templates/tests/fixtures/multiplayer-verification.test.playwright.ts.txt +103 -0
  82. package/bundled-resources/poe-tile-templates/tests/fixtures/replace-starter-schema.ts +67 -0
  83. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/phaserjs.tsx.txt +85 -0
  84. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/preact.tsx.txt +69 -0
  85. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/react.tsx.txt +73 -0
  86. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/seating.ts.txt +54 -0
  87. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/solidjs.tsx.txt +70 -0
  88. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/vanilla-js.tsx.txt +85 -0
  89. package/bundled-resources/poe-tile-templates/tests/generated-templates.test.ts +278 -0
  90. package/bundled-resources/poe-tile-templates/tests/happy-dom-version.test.ts +27 -0
  91. package/bundled-resources/poe-tile-templates/tests/install-diagnostics.test.ts +99 -0
  92. package/bundled-resources/poe-tile-templates/tests/native-gesture-defaults.test.ts +23 -0
  93. package/bundled-resources/poe-tile-templates/tests/playwright-version.test.ts +84 -0
  94. package/bundled-resources/poe-tile-templates/tests/render-check-scaffold.test.ts +56 -0
  95. package/bundled-resources/poe-tile-templates/tests/sdk-dependency-key.test.ts +129 -0
  96. package/bundled-resources/poe-tile-templates/tests/visual-check.test.ts +90 -0
  97. package/bundled-resources/poe-tile-templates/vanilla-js/package.partial.json +3 -0
  98. package/bundled-resources/poe-tile-templates/vanilla-js/tile/index.html +14 -0
  99. package/bundled-resources/poe-tile-templates/vanilla-js/tile/src/entry.ts +35 -0
  100. package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.test.happydom.tsx +96 -0
  101. package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.ts +113 -0
  102. package/bundled-resources/poe-tile-templates/vanilla-js/vite.config.ts +17 -0
  103. package/cli.ts +134 -0
  104. package/index.ts +96 -0
  105. package/package.json +48 -5
  106. package/skills/audio-generation/.generated-by-poe-templated-docs +0 -0
  107. package/skills/audio-generation/SKILL.md +125 -0
  108. package/skills/finish-prototype/.generated-by-poe-templated-docs +0 -0
  109. package/skills/finish-prototype/SKILL.md +22 -0
  110. package/skills/help-me-build/.generated-by-poe-templated-docs +0 -0
  111. package/skills/help-me-build/SKILL.md +56 -0
  112. package/skills/image-generation/.generated-by-poe-templated-docs +0 -0
  113. package/skills/image-generation/SKILL.md +128 -0
  114. package/skills/one-shot/.generated-by-poe-templated-docs +0 -0
  115. package/skills/one-shot/SKILL.md +22 -0
  116. package/skills/platform-prototype/.generated-by-poe-templated-docs +0 -0
  117. package/skills/platform-prototype/SKILL.md +60 -0
  118. package/skills/platform-subagent/.generated-by-poe-templated-docs +0 -0
  119. package/skills/platform-subagent/SKILL.md +16 -0
  120. package/skills/poe-tiles-cli/.generated-by-poe-templated-docs +0 -0
  121. package/skills/poe-tiles-cli/SKILL.md +609 -0
  122. package/skills/poe-tiles-cli/references/device-motion.md +40 -0
  123. package/skills/poe-tiles-cli/references/player-updates.md +41 -0
  124. package/skills/prototype/.generated-by-poe-templated-docs +0 -0
  125. package/skills/prototype/SKILL.md +149 -0
  126. package/skills/publish/.generated-by-poe-templated-docs +0 -0
  127. package/skills/publish/SKILL.md +73 -0
  128. package/skills/synced-store/.generated-by-poe-templated-docs +0 -0
  129. package/skills/synced-store/SKILL.md +583 -0
  130. package/skills/synced-store/references/actions.md +85 -0
  131. package/skills/synced-store/references/api-patterns.md +245 -0
  132. package/skills/synced-store/references/architecture-scaling-and-performance.md +280 -0
  133. package/skills/synced-store/references/client-api-reference.md +263 -0
  134. package/skills/synced-store/references/data-visibility.md +95 -0
  135. package/skills/synced-store/references/external-stores.md +162 -0
  136. package/skills/synced-store/references/file-uploads.md +216 -0
  137. package/skills/synced-store/references/getting-user-info-of-members.md +228 -0
  138. package/skills/synced-store/references/limitations.md +72 -0
  139. package/skills/synced-store/references/live-data-limit-hook.md +131 -0
  140. package/skills/synced-store/references/mutator-rules.md +169 -0
  141. package/skills/synced-store/references/platform.md +49 -0
  142. package/skills/synced-store/references/schema-and-bindings.md +85 -0
  143. package/skills/synced-store/references/schema-libraries.md +57 -0
  144. package/skills/synced-store/references/schema-migrations.md +119 -0
  145. package/skills/synced-store/references/searchable-tables.md +27 -0
  146. package/skills/synced-store/references/server-forking.md +115 -0
  147. package/skills/synced-store/references/singleton-tables.md +61 -0
  148. package/skills/synced-store/references/sort-keys.md +253 -0
  149. package/skills/synced-store/references/ui-patterns.md +95 -0
  150. package/skills/tile-creator/.generated-by-poe-templated-docs +0 -0
  151. package/skills/tile-creator/SKILL.md +197 -0
  152. package/skills/tile-creator/references/assets.md +124 -0
  153. package/skills/tile-creator/references/backend-api.md +354 -0
  154. package/skills/tile-creator/references/cli-limitations.md +64 -0
  155. package/skills/tile-creator/references/cli.md +604 -0
  156. package/skills/tile-creator/references/client-api.md +2407 -0
  157. package/skills/tile-creator/references/composing-apps.md +166 -0
  158. package/skills/tile-creator/references/e2e-tests.md +55 -0
  159. package/skills/tile-creator/references/game-ux-best-practices.md +57 -0
  160. package/skills/tile-creator/references/migrating-pre-rename-tiles.md +79 -0
  161. package/skills/tile-creator/references/multiplayer-api-recipe.md +205 -0
  162. package/skills/tile-creator/references/native-results.md +100 -0
  163. package/skills/tile-creator/references/platform-integration.md +201 -0
  164. package/skills/tile-creator/references/power-report.md +199 -0
  165. package/skills/tile-creator/references/publish-rollout.md +166 -0
  166. package/skills/tile-creator/references/publishing.md +33 -0
  167. package/skills/tile-creator/references/push-notification-guidelines.md +58 -0
  168. package/skills/tile-creator/references/render-check.md +266 -0
  169. package/skills/tile-creator/references/running-the-client-api-on-a-server-owned-by-the-user.md +95 -0
  170. package/skills/tile-creator/references/safe-area-insets.md +79 -0
  171. package/skills/tile-creator/references/sandbox-limitations.md +32 -0
  172. package/skills/tile-creator/references/scaffolded-tile-folder-structure.md +48 -0
  173. package/skills/tile-creator/references/scaffolding-a-new-app.md +202 -0
  174. package/skills/tile-creator/references/simulations.md +125 -0
  175. package/skills/tile-creator/references/synced-store-client-reference.md +92 -0
  176. package/skills/tile-creator/references/troubleshooting.md +22 -0
  177. package/skills/tile-creator/references/turn-based-mutator.md +43 -0
  178. package/skills/tile-creator/references/user-erasure.md +14 -0
  179. package/skills/tile-creator/references/vite-plugin.md +166 -0
  180. package/skills/tile-creator/references/workspace-retention.md +72 -0
  181. package/src/admin-conversions-client.ts +28 -0
  182. package/src/admin-reviews-client.ts +36 -0
  183. package/src/api.generated.ts +1527 -0
  184. package/src/auth-token.ts +198 -0
  185. package/src/bounded-read.ts +35 -0
  186. package/src/bun-version.ts +33 -0
  187. package/src/checkout-base.ts +207 -0
  188. package/src/cli-bun-version.ts +16 -0
  189. package/src/cli-env.ts +28 -0
  190. package/src/cli-name.ts +23 -0
  191. package/src/client.ts +2474 -0
  192. package/src/collect-files.ts +226 -0
  193. package/src/commands/accounts.ts +55 -0
  194. package/src/commands/admin-abandon-conversion.ts +60 -0
  195. package/src/commands/admin-reviews.ts +66 -0
  196. package/src/commands/admin.ts +219 -0
  197. package/src/commands/auth.ts +89 -0
  198. package/src/commands/checkout-prototype.ts +67 -0
  199. package/src/commands/creator-source-capability.ts +11 -0
  200. package/src/commands/doctor-bun.ts +145 -0
  201. package/src/commands/doctor-command.ts +64 -0
  202. package/src/commands/doctor-package-json.ts +47 -0
  203. package/src/commands/doctor-sdk-pin.ts +156 -0
  204. package/src/commands/doctor-store-keys-lexer.ts +213 -0
  205. package/src/commands/doctor-store-keys-scan.ts +262 -0
  206. package/src/commands/doctor-store-keys.ts +196 -0
  207. package/src/commands/doctor.ts +371 -0
  208. package/src/commands/init/blank-scaffold-templates.ts +397 -0
  209. package/src/commands/init/index.ts +170 -0
  210. package/src/commands/init/internal-toolchain.ts +49 -0
  211. package/src/commands/init/manager-test-template.ts +107 -0
  212. package/src/commands/init/multiplayer-test-template.ts +217 -0
  213. package/src/commands/init/name-input.tsx +167 -0
  214. package/src/commands/init/no-store-scaffold-templates.ts +281 -0
  215. package/src/commands/init/no-store-scaffold.ts +134 -0
  216. package/src/commands/init/package-json-scripts.ts +72 -0
  217. package/src/commands/init/scaffold.ts +960 -0
  218. package/src/commands/init/sdk-tarball-url.generated.ts +4 -0
  219. package/src/commands/init/sdk-tarball-url.ts +31 -0
  220. package/src/commands/init/template-picker.tsx +147 -0
  221. package/src/commands/inspect-child-entry.ts +107 -0
  222. package/src/commands/inspect-contract.ts +87 -0
  223. package/src/commands/inspect-freshness.ts +217 -0
  224. package/src/commands/inspect-lock.ts +201 -0
  225. package/src/commands/inspect-options.ts +360 -0
  226. package/src/commands/inspect-orchestrate.ts +375 -0
  227. package/src/commands/inspect-process.ts +172 -0
  228. package/src/commands/inspect-ready.ts +65 -0
  229. package/src/commands/inspect-report.ts +235 -0
  230. package/src/commands/inspect-run-state.ts +296 -0
  231. package/src/commands/inspect-run.ts +157 -0
  232. package/src/commands/inspect-watchdog.ts +74 -0
  233. package/src/commands/install-joiner.ts +208 -0
  234. package/src/commands/login.ts +308 -0
  235. package/src/commands/models.ts +40 -0
  236. package/src/commands/parse-options.ts +36 -0
  237. package/src/commands/remix-package-json.ts +64 -0
  238. package/src/commands/remix.ts +379 -0
  239. package/src/commands/sdk-url.ts +141 -0
  240. package/src/commands/simulations.ts +133 -0
  241. package/src/commands/skills.ts +108 -0
  242. package/src/commands/store-files.ts +92 -0
  243. package/src/commands/stores.ts +703 -0
  244. package/src/commands/tiles-channel-commands.ts +115 -0
  245. package/src/commands/tiles-checkout.ts +351 -0
  246. package/src/commands/tiles-gallery-command.ts +95 -0
  247. package/src/commands/tiles-get-helpers.ts +27 -0
  248. package/src/commands/tiles-inspect.ts +276 -0
  249. package/src/commands/tiles-power-command.ts +308 -0
  250. package/src/commands/tiles-power-format.ts +396 -0
  251. package/src/commands/tiles-power-versions.ts +299 -0
  252. package/src/commands/tiles-publish-helpers.ts +145 -0
  253. package/src/commands/tiles-upload-command.ts +277 -0
  254. package/src/commands/tiles-version-commands.ts +201 -0
  255. package/src/commands/tiles-visibility-command.ts +103 -0
  256. package/src/commands/tiles.ts +257 -0
  257. package/src/commands/upgrade.ts +307 -0
  258. package/src/commit-in-progress.ts +42 -0
  259. package/src/creator-source-context.ts +97 -0
  260. package/src/creator-source-publish.ts +52 -0
  261. package/src/deferred-assets.ts +125 -0
  262. package/src/distribution.ts +28 -0
  263. package/src/errors.ts +61 -0
  264. package/src/install-command.ts +43 -0
  265. package/src/output.ts +62 -0
  266. package/src/poe-tile-config-files.ts +100 -0
  267. package/src/poe-tile-config-players.ts +168 -0
  268. package/src/poe-tile-config-remix.ts +166 -0
  269. package/src/poe-tile-config.ts +831 -0
  270. package/src/power-report-client.ts +55 -0
  271. package/src/prototype-startup.ts +21 -0
  272. package/src/publish-change-summary.ts +55 -0
  273. package/src/publish-overrides-validation.ts +49 -0
  274. package/src/publish-pack.ts +167 -0
  275. package/src/publish-phases.ts +57 -0
  276. package/src/publish-retry.ts +51 -0
  277. package/src/publish-tile-from-config.ts +434 -0
  278. package/src/recorder-stream.ts +169 -0
  279. package/src/remix-provenance.ts +156 -0
  280. package/src/resolve-client-credential.ts +71 -0
  281. package/src/resolve-media-uploads.ts +147 -0
  282. package/src/sdk-dependency.ts +54 -0
  283. package/src/sdk-skills.ts +85 -0
  284. package/src/should-skip-client-setup.ts +20 -0
  285. package/src/simulation-snapshot.ts +123 -0
  286. package/src/simulation-types.ts +74 -0
  287. package/src/simulations-client.ts +112 -0
  288. package/src/source-bundle.ts +466 -0
  289. package/src/staged-publish-cleanup.ts +44 -0
  290. package/src/staged-publish-deferred.ts +160 -0
  291. package/src/staged-publish.ts +401 -0
  292. package/src/store-file-upload.ts +268 -0
  293. package/src/store-request.ts +168 -0
  294. package/src/tar-canonical.ts +41 -0
  295. package/src/tar-extensions.ts +159 -0
  296. package/src/tar-extract.ts +193 -0
  297. package/src/tar-parse.ts +224 -0
  298. package/src/tar.ts +231 -0
  299. package/src/template-check-scripts.ts +18 -0
  300. package/src/tile-gallery-client.ts +82 -0
  301. package/src/types.ts +258 -0
  302. package/src/upload-concurrency.ts +54 -0
  303. package/src/whole-tile.ts +52 -0
@@ -0,0 +1,226 @@
1
+ // owner: jyoung-q
2
+
3
+ import { type Dirent, readdirSync, readFileSync, statSync } from "node:fs";
4
+ import { join, relative } from "node:path";
5
+
6
+ /**
7
+ * The runtime bundle limits, mirrored from `@lib/tar-parser`'s
8
+ * `DEFAULT_MAX_ENTRIES` and `DEFAULT_MAX_TOTAL_BYTES` because the CLI ships
9
+ * without workspace dependencies. The server refuses an archive over either at
10
+ * upload; checking here saves the creator the upload. See `docs/bundle-limits.md`.
11
+ */
12
+ export const RUNTIME_BUNDLE_MAX_FILES = 1000;
13
+ export const RUNTIME_BUNDLE_MAX_TOTAL_BYTES = 100 * 1024 * 1024;
14
+ /** Mirrors `DEFAULT_MAX_FILE_BYTES`: a browser memory bound on one asset. */
15
+ export const RUNTIME_BUNDLE_MAX_FILE_BYTES = 20 * 1024 * 1024;
16
+ /**
17
+ * Files under `deferred/` leave the tar and publish on their own, under their
18
+ * own limits (`deferred-assets.ts`), so they are charged to a separate budget
19
+ * here: one file up to 50 MiB, 250 MiB and 1,000 files in all.
20
+ */
21
+ const DEFERRED_MAX_FILES = 1000;
22
+ const DEFERRED_MAX_FILE_BYTES = 50 * 1024 * 1024;
23
+ const DEFERRED_MAX_TOTAL_BYTES = 250 * 1024 * 1024;
24
+
25
+ /**
26
+ * Appended to the bundle's size errors: a creator over a size limit can usually
27
+ * move big media out of the bundle. Matches the creator docs'
28
+ * `references/assets.md` ("Deferred files").
29
+ */
30
+ export const DEFERRED_ASSETS_TIP =
31
+ '(Tip) Split out large, non-critical assets like images or video using deferred assets: put them in tile/public/deferred/ and load them with Poe.bundle.loadAsset("/deferred/<file>"). Deferred files ship outside the bundle, up to 50 MiB each and 250 MiB in all. See tile-creator/references/assets.md skill.';
32
+
33
+ /** One budget the walk charges files to: the tar's, or the deferred files'. */
34
+ type Budget = {
35
+ files: number;
36
+ bytes: number;
37
+ maxFiles: number | undefined;
38
+ maxBytes: number;
39
+ maxFileBytes: number;
40
+ /** Appended to this budget's size errors; deferred files get none. */
41
+ tip: string | null;
42
+ };
43
+
44
+ /** @internal Exported for testing only. */
45
+ export interface CollectFilesOptions {
46
+ maxTotalBytes?: number;
47
+ maxFileCount?: number;
48
+ /** Names of entries directly under `dir` that the walk does not enter or read. */
49
+ skipTopLevel?: ReadonlySet<string>;
50
+ }
51
+
52
+ /** O(n) in files and total bytes; both are bounded by explicit limits. */
53
+ export function collectFiles(
54
+ dir: string,
55
+ baseDir: string,
56
+ options?: CollectFilesOptions,
57
+ ): { path: string; data: Uint8Array }[] {
58
+ const results: { path: string; data: Uint8Array }[] = [];
59
+ collectFilesRecursive(dir, baseDir, results, {
60
+ skipTopLevel: { dir, names: options?.skipTopLevel ?? new Set() },
61
+ tar: {
62
+ files: 0,
63
+ bytes: 0,
64
+ maxFiles: options?.maxFileCount,
65
+ maxBytes: options?.maxTotalBytes ?? RUNTIME_BUNDLE_MAX_TOTAL_BYTES,
66
+ maxFileBytes: RUNTIME_BUNDLE_MAX_FILE_BYTES,
67
+ tip: DEFERRED_ASSETS_TIP,
68
+ },
69
+ deferred: {
70
+ files: 0,
71
+ bytes: 0,
72
+ maxFiles: DEFERRED_MAX_FILES,
73
+ maxBytes: DEFERRED_MAX_TOTAL_BYTES,
74
+ maxFileBytes: DEFERRED_MAX_FILE_BYTES,
75
+ tip: null,
76
+ },
77
+ });
78
+ // Tar entry order is part of the content-addressed bundle id, and readdir
79
+ // order is filesystem-defined (ext4 seeds its hash order per filesystem),
80
+ // so identical files could otherwise publish as a new id on another machine.
81
+ return results.sort((a, b) => compareRuntimeBundlePaths(a.path, b.path));
82
+ }
83
+
84
+ const LEADING_PATHS = [".poe-tile-runtime.json", "index.html"];
85
+ const PAGE_CODE_EXTENSIONS = [".js", ".mjs", ".css"];
86
+
87
+ function runtimeBundleRank(path: string): number {
88
+ const leading = LEADING_PATHS.indexOf(path);
89
+ if (leading !== -1) return leading;
90
+ return PAGE_CODE_EXTENSIONS.some((extension) => path.endsWith(extension))
91
+ ? LEADING_PATHS.length
92
+ : LEADING_PATHS.length + 1;
93
+ }
94
+
95
+ /**
96
+ * Mirrors `@lib/tar-parser`'s `compareRuntimeBundlePaths` (the CLI ships
97
+ * without workspace dependencies): what a tile's page is built from first, so
98
+ * a cold open need not wait on media, then code-unit order.
99
+ */
100
+ export function compareRuntimeBundlePaths(a: string, b: string): number {
101
+ const byRank = runtimeBundleRank(a) - runtimeBundleRank(b);
102
+ if (byRank !== 0) return byRank;
103
+ return a < b ? -1 : a > b ? 1 : 0;
104
+ }
105
+
106
+ type Walk = {
107
+ skipTopLevel: { dir: string; names: ReadonlySet<string> };
108
+ tar: Budget;
109
+ deferred: Budget;
110
+ };
111
+
112
+ function collectFilesRecursive(
113
+ dir: string,
114
+ baseDir: string,
115
+ results: { path: string; data: Uint8Array }[],
116
+ walk: Walk,
117
+ ): void {
118
+ const skip = dir === walk.skipTopLevel.dir ? walk.skipTopLevel.names : null;
119
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
120
+ if (skip?.has(entry.name)) continue;
121
+ const fullPath = join(dir, entry.name);
122
+ if (entry.isDirectory()) {
123
+ collectFilesRecursive(fullPath, baseDir, results, walk);
124
+ continue;
125
+ }
126
+ const path = relative(baseDir, fullPath);
127
+ const budget = path.startsWith("deferred/") ? walk.deferred : walk.tar;
128
+ assertFileCountWithinLimit({
129
+ fileCount: budget.files + 1,
130
+ maxFileCount: budget.maxFiles,
131
+ });
132
+ admitEntry(entry, fullPath, baseDir, budget);
133
+ const data = readFileSync(fullPath);
134
+ // Charged after the read as well: the file may have grown since `stat`.
135
+ assertFileWithinLimit(path, data.length, budget.maxFileBytes, budget.tip);
136
+ assertWithinBudget(budget.bytes, data.length, budget.maxBytes, budget.tip);
137
+ budget.bytes += data.length;
138
+ budget.files += 1;
139
+ results.push({ path, data });
140
+ }
141
+ }
142
+
143
+ export function assertFileCountWithinLimit({
144
+ fileCount,
145
+ maxFileCount = RUNTIME_BUNDLE_MAX_FILES,
146
+ }: {
147
+ fileCount: number;
148
+ maxFileCount?: number;
149
+ }): void {
150
+ if (fileCount > maxFileCount) {
151
+ throw new Error(
152
+ `Too many files (limit: ${maxFileCount}). Reduce the number of files in the publish directory.`,
153
+ );
154
+ }
155
+ }
156
+
157
+ /**
158
+ * What is refused BEFORE a file is opened: an entry that is not a regular
159
+ * file (opening a named pipe with no writer blocks the process; a device or
160
+ * socket is never bundle content; a symlink is followed only to a regular
161
+ * file), and a file whose SIZE would pass the byte budget, so an oversized
162
+ * asset is never allocated. The check after the read catches a file that grew
163
+ * in between.
164
+ */
165
+ function admitEntry(
166
+ entry: Dirent,
167
+ fullPath: string,
168
+ baseDir: string,
169
+ budget: Budget,
170
+ ): void {
171
+ if (!isRegularFile(entry, fullPath)) {
172
+ throw new Error(
173
+ `Not a regular file: ${relative(baseDir, fullPath)}. The publish directory may contain only files and directories.`,
174
+ );
175
+ }
176
+ const size = statSync(fullPath).size;
177
+ assertFileWithinLimit(
178
+ relative(baseDir, fullPath),
179
+ size,
180
+ budget.maxFileBytes,
181
+ budget.tip,
182
+ );
183
+ assertWithinBudget(budget.bytes, size, budget.maxBytes, budget.tip);
184
+ }
185
+
186
+ export function assertFileWithinLimit(
187
+ path: string,
188
+ bytes: number,
189
+ maxFileBytes = RUNTIME_BUNDLE_MAX_FILE_BYTES,
190
+ tip: string | null = DEFERRED_ASSETS_TIP,
191
+ ): void {
192
+ if (bytes > maxFileBytes) {
193
+ throw new Error(
194
+ withTip(
195
+ `File "${path}" (${bytes} bytes) exceeds the ${maxFileBytes / (1024 * 1024)} MiB per-file limit. Split it into smaller files.`,
196
+ tip,
197
+ ),
198
+ );
199
+ }
200
+ }
201
+
202
+ export function assertWithinBudget(
203
+ totalBytes: number,
204
+ bytes: number,
205
+ maxTotalBytes: number,
206
+ tip: string | null = DEFERRED_ASSETS_TIP,
207
+ ): void {
208
+ if (totalBytes + bytes > maxTotalBytes) {
209
+ throw new Error(
210
+ withTip(
211
+ `Total file size (${totalBytes + bytes} bytes) exceeds the ${maxTotalBytes / (1024 * 1024)} MiB limit.`,
212
+ tip,
213
+ ),
214
+ );
215
+ }
216
+ }
217
+
218
+ function withTip(message: string, tip: string | null): string {
219
+ return tip ? `${message}\n${tip}` : message;
220
+ }
221
+
222
+ function isRegularFile(entry: Dirent, fullPath: string): boolean {
223
+ if (entry.isFile()) return true;
224
+ if (!entry.isSymbolicLink()) return false;
225
+ return statSync(fullPath, { throwIfNoEntry: false })?.isFile() === true;
226
+ }
@@ -0,0 +1,55 @@
1
+ // owner: jyoung-q
2
+ /**
3
+ * Account commands: list, unlink
4
+ */
5
+
6
+ import { Command } from "commander";
7
+ import type { SlopPoeClient } from "../client.js";
8
+ import { assertSuccess } from "../errors.js";
9
+ import { isJsonMode, printJson, printTable } from "../output.js";
10
+
11
+ export function createAccountsCommands(client: SlopPoeClient): Command {
12
+ const accounts = new Command("accounts").description(
13
+ "Connected account management",
14
+ );
15
+
16
+ accounts
17
+ .command("list")
18
+ .description("List connected accounts")
19
+ .action(async function (this: Command) {
20
+ const result = await client.getConnectedAccounts();
21
+ assertSuccess(result);
22
+ if (isJsonMode(this)) {
23
+ printJson(result.accounts);
24
+ } else {
25
+ if (result.accounts.length === 0) {
26
+ console.log("No connected accounts.");
27
+ return;
28
+ }
29
+ printTable({
30
+ headers: ["Provider ID", "Username", "Display Name"],
31
+ rows: result.accounts.map((a) => [
32
+ a.provider_id,
33
+ a.external_username ?? "",
34
+ a.external_display_name ?? "",
35
+ ]),
36
+ });
37
+ }
38
+ });
39
+
40
+ accounts
41
+ .command("unlink")
42
+ .description("Unlink a connected account")
43
+ .argument("<providerId>", "Provider ID to unlink")
44
+ .action(async function (this: Command, providerId: string) {
45
+ const result = await client.unlinkAccount(providerId);
46
+ assertSuccess(result);
47
+ if (isJsonMode(this)) {
48
+ printJson({ success: true });
49
+ } else {
50
+ console.log(`Unlinked account: ${providerId}`);
51
+ }
52
+ });
53
+
54
+ return accounts;
55
+ }
@@ -0,0 +1,60 @@
1
+ // owner: aaronroe
2
+ import { Command } from "commander";
3
+ import type { SlopPoeClient } from "../client";
4
+ import { isJsonMode, printJson } from "../output";
5
+
6
+ export function createAbandonConversionCommand(
7
+ client: Pick<SlopPoeClient, "adminConversions">,
8
+ ): Command {
9
+ return new Command("abandon-conversion")
10
+ .description(
11
+ "Inspect export paths, then explicitly abandon a pending conversion (admin only)",
12
+ )
13
+ .argument("<instanceId>")
14
+ .argument("<conversionId>")
15
+ .option(
16
+ "--allow-local-only-quarantine",
17
+ "Acknowledge that quarantined drafts can disappear on container replacement, even before 24 hours",
18
+ )
19
+ .action(async function (
20
+ this: Command,
21
+ instanceId: string,
22
+ conversionId: string,
23
+ options: { allowLocalOnlyQuarantine?: boolean },
24
+ ) {
25
+ const identity = { instanceId, conversionId };
26
+ const inspection = await client.adminConversions.inspect(identity);
27
+ const json = isJsonMode(this);
28
+ // Human output shows paths before the write. JSON retains both summaries
29
+ // in one value, including inspection data if the write subsequently fails.
30
+ if (!json || options.allowLocalOnlyQuarantine !== true)
31
+ printJson(inspection);
32
+ if (options.allowLocalOnlyQuarantine !== true)
33
+ throw new Error(
34
+ "Export any files you need first. To abandon, rerun with --allow-local-only-quarantine.",
35
+ );
36
+ await reportAbandonment(inspection, json, () =>
37
+ client.adminConversions.abandon({
38
+ ...identity,
39
+ allowLocalOnlyQuarantine: true,
40
+ }),
41
+ );
42
+ });
43
+ }
44
+
45
+ type Summary = Awaited<
46
+ ReturnType<SlopPoeClient["adminConversions"]["inspect"]>
47
+ >;
48
+ async function reportAbandonment(
49
+ inspection: Summary,
50
+ json: boolean,
51
+ abandon: () => Promise<Summary>,
52
+ ): Promise<void> {
53
+ try {
54
+ const abandonment = await abandon();
55
+ printJson(json ? { inspection, abandonment } : abandonment);
56
+ } catch (error) {
57
+ if (json) printJson({ inspection });
58
+ throw error;
59
+ }
60
+ }
@@ -0,0 +1,66 @@
1
+ // owner: aaronroe
2
+ import { Command, InvalidArgumentError, Option } from "commander";
3
+ import type { TileReviewScope } from "../admin-reviews-client";
4
+ import type { SlopPoeClient } from "../client";
5
+
6
+ function generation(value: string): number {
7
+ if (!/^\d+$/.test(value) || !Number.isSafeInteger(Number(value))) {
8
+ throw new InvalidArgumentError(
9
+ "Generation must be a non-negative safe integer from inspect output.",
10
+ );
11
+ }
12
+ return Number(value);
13
+ }
14
+
15
+ export function createAdminReviewCommands(client: SlopPoeClient): Command {
16
+ const reviews = new Command("reviews").description(
17
+ "Inspect or rerun platform Tile reviews (admin only)",
18
+ );
19
+ reviews
20
+ .command("inspect")
21
+ .argument("<reportId>")
22
+ .description("Show status, generation, provenance, and evidence")
23
+ .action(async (reportId: string) => {
24
+ console.log(
25
+ JSON.stringify(await client.adminReviews.inspect(reportId), null, 2),
26
+ );
27
+ });
28
+ reviews
29
+ .command("rerun")
30
+ .argument("<reportId>")
31
+ .description(
32
+ "Rerun a complete/failed review; duplicate requests do not start extra work",
33
+ )
34
+ .requiredOption(
35
+ "--generation <number>",
36
+ "Expected generation from inspect",
37
+ generation,
38
+ )
39
+ .addOption(
40
+ new Option(
41
+ "--scope <pass>",
42
+ "Select review work without invalidating other passes",
43
+ )
44
+ .choices(["full", "moderation", "quality", "classification"])
45
+ .default("full"),
46
+ )
47
+ .action(
48
+ async (
49
+ reportId: string,
50
+ options: { generation: number; scope: TileReviewScope },
51
+ ) => {
52
+ console.log(
53
+ JSON.stringify(
54
+ await client.adminReviews.rerun({
55
+ reportId,
56
+ expectedGeneration: options.generation,
57
+ scope: options.scope,
58
+ }),
59
+ null,
60
+ 2,
61
+ ),
62
+ );
63
+ },
64
+ );
65
+ return reviews;
66
+ }
@@ -0,0 +1,219 @@
1
+ // owner: jyoung-q
2
+ /**
3
+ * Admin-only commands. Require the authenticated user's verified phone
4
+ * number to be on the server's admin allowlist — a non-admin caller gets a
5
+ * connection failure (see `SlopPoeClient.openAdminRecorderSocket`).
6
+ */
7
+
8
+ import { Command } from "commander";
9
+ import type { CliWebSocket, SlopPoeClient } from "../client.js";
10
+ import { isNonRetryableError } from "../errors.js";
11
+ import { isJsonMode } from "../output.js";
12
+ import { streamRecorderSpans } from "../recorder-stream.js";
13
+ import { createAbandonConversionCommand } from "./admin-abandon-conversion";
14
+ import { createAdminReviewCommands } from "./admin-reviews";
15
+ import { parsePositiveIntegerOption } from "./parse-options.js";
16
+
17
+ const DEFAULT_RECORDER_TIMEOUT_MS = 15_000;
18
+ /** Base delay before retrying after a close/error (not a user Ctrl+C). */
19
+ const RECONNECT_DELAY_MS = 2_000;
20
+ /** Ceiling for the exponential backoff between failed connection attempts. */
21
+ const MAX_RECONNECT_DELAY_MS = 30_000;
22
+ /**
23
+ * Give up after this many CONSECUTIVE connection attempts that never opened.
24
+ * A transient handshake drop (e.g. a 1006 while the DO is under heavy load, or
25
+ * an idle close) is retried with backoff, and the counter resets the moment a
26
+ * connection opens. Bounding only the never-opened case means a genuinely
27
+ * unauthorized caller (persistent handshake rejection) still exits with an
28
+ * error instead of looping forever, while a busy or flaky DO recovers on its
29
+ * own instead of crashing the CLI.
30
+ */
31
+ const MAX_CONSECUTIVE_CONNECT_FAILURES = 8;
32
+
33
+ interface RecorderCommandOptions {
34
+ timeoutMs: string;
35
+ }
36
+
37
+ /**
38
+ * Wall-clock delay that also resolves early if the user hits Ctrl+C, so a
39
+ * reconnect backoff stays interruptible. (The streaming loop's own SIGINT
40
+ * handler only exists while a socket is open; between attempts there is none,
41
+ * so this installs a temporary one.) Returns whether the wait elapsed normally
42
+ * or was interrupted.
43
+ */
44
+ function delayWithSigint(ms: number): Promise<"elapsed" | "sigint"> {
45
+ return new Promise((resolve) => {
46
+ let timer: ReturnType<typeof setTimeout> | undefined;
47
+ const finish = (result: "elapsed" | "sigint"): void => {
48
+ if (timer !== undefined) clearTimeout(timer);
49
+ process.off("SIGINT", onSigint);
50
+ resolve(result);
51
+ };
52
+ const onSigint = (): void => finish("sigint");
53
+ // SIGINT handler is registered BEFORE the timer so that even if the
54
+ // timer fires synchronously (as the unit test's setTimeout stub does),
55
+ // finish removes an already-registered listener rather than leaking one
56
+ // that a later process.on would re-add after cleanup.
57
+ process.on("SIGINT", onSigint);
58
+ // biome-ignore lint: real reconnect backoff for a long-running CLI command, not a test — a real wall-clock delay is the point.
59
+ timer = setTimeout(() => finish("elapsed"), ms);
60
+ });
61
+ }
62
+
63
+ /**
64
+ * Wait out the pre-retry backoff (a no-op before the first attempt, where
65
+ * backoffMs is 0). Returns true when the user hit Ctrl+C during the wait.
66
+ */
67
+ async function retryBackoffInterrupted(backoffMs: number): Promise<boolean> {
68
+ if (backoffMs === 0) return false;
69
+ return (await delayWithSigint(backoffMs)) === "sigint";
70
+ }
71
+
72
+ interface RecorderConnectionParams {
73
+ client: SlopPoeClient;
74
+ typeId: string;
75
+ instanceId: string;
76
+ timeoutMs: number;
77
+ json: boolean;
78
+ }
79
+
80
+ type OpenAttempt =
81
+ | { ok: true; socket: CliWebSocket }
82
+ | { ok: false; error: unknown };
83
+
84
+ async function tryOpenRecorderSocket(
85
+ client: SlopPoeClient,
86
+ params: { typeId: string; instanceId: string; timeoutMs: number },
87
+ ): Promise<OpenAttempt> {
88
+ try {
89
+ return { ok: true, socket: await client.openAdminRecorderSocket(params) };
90
+ } catch (error) {
91
+ return { ok: false, error };
92
+ }
93
+ }
94
+
95
+ function logRecorderRetry(
96
+ json: boolean,
97
+ attemptNumber: number,
98
+ error: unknown,
99
+ backoffMs: number,
100
+ ): void {
101
+ if (json) return;
102
+ const message = error instanceof Error ? error.message : String(error);
103
+ console.error(
104
+ `Recorder connection attempt ${attemptNumber} failed (${message}); retrying in ${backoffMs}ms...`,
105
+ );
106
+ }
107
+
108
+ /**
109
+ * Open the recorder socket, retrying a transient handshake failure with
110
+ * exponential backoff instead of crashing. Returns the open socket, or
111
+ * `"sigint"` if the user interrupted during a backoff. Throws once
112
+ * MAX_CONSECUTIVE_CONNECT_FAILURES attempts in a row never open (a persistent
113
+ * authorization rejection or sustained outage, not a transient blip).
114
+ */
115
+ async function openRecorderSocketWithRetry(
116
+ params: RecorderConnectionParams,
117
+ ): Promise<CliWebSocket | "sigint"> {
118
+ const { client, typeId, instanceId, timeoutMs, json } = params;
119
+ let consecutiveFailures = 0;
120
+ // A `do … while` with a real exit condition (not `for (;;)` with an
121
+ // in-body throw): bun's line coverage plants an unreachable loop-exit
122
+ // counter on an infinite loop's lone closing brace, which intermittently
123
+ // failed this package's 100% gate. The give-up throw after the loop is the
124
+ // same behavior — MAX_CONSECUTIVE_CONNECT_FAILURES attempts, then surface
125
+ // the last error. The backoff wait sits at the TOP of an iteration
126
+ // (skipped on the first attempt) so the loop body ends where the exit
127
+ // condition is evaluated.
128
+ let backoffMs = 0;
129
+ let lastError: unknown = undefined;
130
+ do {
131
+ // biome-ignore lint/performance/noAwaitInLoops: sequential backoff + connection attempts, one per loop.
132
+ if (await retryBackoffInterrupted(backoffMs)) return "sigint";
133
+ const attempt = await tryOpenRecorderSocket(client, {
134
+ typeId,
135
+ instanceId,
136
+ timeoutMs,
137
+ });
138
+ if (attempt.ok) return attempt.socket;
139
+ // A permanent local/config failure (not logged in, no session cookie)
140
+ // is thrown by `ensureLoggedIn`/`openAdminRecorderSocket` before any
141
+ // WebSocket handshake. Retrying it 8× over ~2 minutes with misleading
142
+ // "connection attempt failed" messages only delays the real cause, so
143
+ // surface it immediately.
144
+ if (isNonRetryableError(attempt.error)) throw attempt.error;
145
+ lastError = attempt.error;
146
+ consecutiveFailures += 1;
147
+ if (consecutiveFailures < MAX_CONSECUTIVE_CONNECT_FAILURES) {
148
+ backoffMs = Math.min(
149
+ RECONNECT_DELAY_MS * 2 ** (consecutiveFailures - 1),
150
+ MAX_RECONNECT_DELAY_MS,
151
+ );
152
+ logRecorderRetry(json, consecutiveFailures, attempt.error, backoffMs);
153
+ }
154
+ } while (consecutiveFailures < MAX_CONSECUTIVE_CONNECT_FAILURES);
155
+ throw lastError;
156
+ }
157
+
158
+ /**
159
+ * Connect, stream until the socket closes, and reconnect — until the user
160
+ * hits Ctrl+C (or a connection can never be established, which throws). A
161
+ * server-side close (idle drop, or a 1006 while the DO is under load) just
162
+ * reconnects; only a persistent inability to open at all stops the loop.
163
+ */
164
+ async function runRecorderLoop(
165
+ params: RecorderConnectionParams,
166
+ ): Promise<void> {
167
+ const { json } = params;
168
+ for (;;) {
169
+ // biome-ignore lint/performance/noAwaitInLoops: one connect+stream cycle at a time.
170
+ const socket = await openRecorderSocketWithRetry(params);
171
+ if (socket === "sigint") return;
172
+ const reason = await streamRecorderSpans(socket, { json });
173
+ if (reason === "sigint") return;
174
+ if (!json) console.error("Reconnecting...");
175
+ if ((await delayWithSigint(RECONNECT_DELAY_MS)) === "sigint") return;
176
+ }
177
+ }
178
+
179
+ export function createAdminCommands(client: SlopPoeClient): Command {
180
+ const admin = new Command("admin").description(
181
+ "Admin-only operations (requires the admin phone allowlist)",
182
+ );
183
+ admin.addCommand(createAdminReviewCommands(client));
184
+ admin.addCommand(createAbandonConversionCommand(client));
185
+
186
+ admin
187
+ .command("recorder")
188
+ .description(
189
+ "Stream live activity ('recorder logs') from a Synced-Store DO instance until Ctrl+C. " +
190
+ "Shows activity for every user connected to that instance, not just one user.",
191
+ )
192
+ .argument("<typeId>", "Store type ID")
193
+ .argument("<instanceId>", "Store instance ID")
194
+ .option(
195
+ "--timeout-ms <ms>",
196
+ "WebSocket open timeout in milliseconds",
197
+ String(DEFAULT_RECORDER_TIMEOUT_MS),
198
+ )
199
+ .action(async function (
200
+ this: Command,
201
+ typeId: string,
202
+ instanceId: string,
203
+ opts: RecorderCommandOptions,
204
+ ) {
205
+ const timeoutMs = parsePositiveIntegerOption(
206
+ opts.timeoutMs,
207
+ "--timeout-ms",
208
+ );
209
+ const json = isJsonMode(this);
210
+ if (!json) {
211
+ console.error(
212
+ `Streaming recorder activity for ${typeId}/${instanceId}. Press Ctrl+C to stop.`,
213
+ );
214
+ }
215
+ await runRecorderLoop({ client, typeId, instanceId, timeoutMs, json });
216
+ });
217
+
218
+ return admin;
219
+ }