@joiner-platform/cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -2
- package/bundled-resources/poe-tile-templates/base/CLAUDE.md +72 -0
- package/bundled-resources/poe-tile-templates/base/README.md +7 -0
- package/bundled-resources/poe-tile-templates/base/_bunfig.toml +8 -0
- package/bundled-resources/poe-tile-templates/base/_gitignore +18 -0
- package/bundled-resources/poe-tile-templates/base/client.ts +12 -0
- package/bundled-resources/poe-tile-templates/base/package.json +36 -0
- package/bundled-resources/poe-tile-templates/base/playwright.config.ts +38 -0
- package/bundled-resources/poe-tile-templates/base/scripts/check-source.ts +148 -0
- package/bundled-resources/poe-tile-templates/base/scripts/dev.ts +19 -0
- package/bundled-resources/poe-tile-templates/base/scripts/doctor.sh +29 -0
- package/bundled-resources/poe-tile-templates/base/scripts/visual-check.ts +64 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/backend-config.ts +9 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/client-config.ts +8 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/data/items.ts +16 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/index.ts +10 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/remove-todo.ts +5 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/set-todo.ts +20 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/types.ts +5 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators.test.ts +138 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/schema.ts +40 -0
- package/bundled-resources/poe-tile-templates/base/tests/e2e.test.playwright.ts +92 -0
- package/bundled-resources/poe-tile-templates/base/tests/mobile-viewport.test.playwright.ts +111 -0
- package/bundled-resources/poe-tile-templates/base/tests/render-check.test.playwright.ts +128 -0
- package/bundled-resources/poe-tile-templates/base/tests/screenshot.test.playwright.ts +86 -0
- package/bundled-resources/poe-tile-templates/base/tests/setup-dom.ts +70 -0
- package/bundled-resources/poe-tile-templates/base/tile/src/backend.ts +3 -0
- package/bundled-resources/poe-tile-templates/base/tile/styles.css +47 -0
- package/bundled-resources/poe-tile-templates/base/tsconfig.json +13 -0
- package/bundled-resources/poe-tile-templates/coverage.config.json +6 -0
- package/bundled-resources/poe-tile-templates/index.ts +27 -0
- package/bundled-resources/poe-tile-templates/package.json +31 -0
- package/bundled-resources/poe-tile-templates/phaserjs/package.partial.json +6 -0
- package/bundled-resources/poe-tile-templates/phaserjs/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/phaserjs/tile/src/entry.ts +35 -0
- package/bundled-resources/poe-tile-templates/phaserjs/ui/App.test.happydom.tsx +98 -0
- package/bundled-resources/poe-tile-templates/phaserjs/ui/App.ts +180 -0
- package/bundled-resources/poe-tile-templates/phaserjs/ui/phaser-scene.ts +174 -0
- package/bundled-resources/poe-tile-templates/phaserjs/vite.config.ts +28 -0
- package/bundled-resources/poe-tile-templates/preact/package.partial.json +9 -0
- package/bundled-resources/poe-tile-templates/preact/postcss.config.js +5 -0
- package/bundled-resources/poe-tile-templates/preact/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/preact/tile/src/entry.tsx +36 -0
- package/bundled-resources/poe-tile-templates/preact/tile/styles.css +51 -0
- package/bundled-resources/poe-tile-templates/preact/tsconfig.json +15 -0
- package/bundled-resources/poe-tile-templates/preact/ui/App.test.happydom.tsx +69 -0
- package/bundled-resources/poe-tile-templates/preact/ui/App.tsx +116 -0
- package/bundled-resources/poe-tile-templates/preact/vite.config.ts +18 -0
- package/bundled-resources/poe-tile-templates/react/package.partial.json +12 -0
- package/bundled-resources/poe-tile-templates/react/postcss.config.js +5 -0
- package/bundled-resources/poe-tile-templates/react/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/react/tile/src/entry.tsx +38 -0
- package/bundled-resources/poe-tile-templates/react/tile/styles.css +51 -0
- package/bundled-resources/poe-tile-templates/react/tsconfig.json +14 -0
- package/bundled-resources/poe-tile-templates/react/ui/App.test.happydom.tsx +71 -0
- package/bundled-resources/poe-tile-templates/react/ui/App.tsx +110 -0
- package/bundled-resources/poe-tile-templates/react/vite.config.ts +21 -0
- package/bundled-resources/poe-tile-templates/scripts/cleanup.ts +10 -0
- package/bundled-resources/poe-tile-templates/scripts/generate.ts +57 -0
- package/bundled-resources/poe-tile-templates/scripts/install-diagnostics.ts +52 -0
- package/bundled-resources/poe-tile-templates/scripts/paths.ts +7 -0
- package/bundled-resources/poe-tile-templates/scripts/sdk-dependency-key.ts +288 -0
- package/bundled-resources/poe-tile-templates/scripts/verify-all-sdks.ts +132 -0
- package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-command.ts +30 -0
- package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-tarball.ts +397 -0
- package/bundled-resources/poe-tile-templates/solidjs/_bunfig.toml +14 -0
- package/bundled-resources/poe-tile-templates/solidjs/package.partial.json +13 -0
- package/bundled-resources/poe-tile-templates/solidjs/postcss.config.js +5 -0
- package/bundled-resources/poe-tile-templates/solidjs/tests/solid-plugin.ts +49 -0
- package/bundled-resources/poe-tile-templates/solidjs/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/solidjs/tile/src/entry.tsx +36 -0
- package/bundled-resources/poe-tile-templates/solidjs/tile/styles.css +51 -0
- package/bundled-resources/poe-tile-templates/solidjs/tsconfig.json +15 -0
- package/bundled-resources/poe-tile-templates/solidjs/ui/App.test.happydom.tsx +70 -0
- package/bundled-resources/poe-tile-templates/solidjs/ui/App.tsx +129 -0
- package/bundled-resources/poe-tile-templates/solidjs/vite.config.ts +18 -0
- package/bundled-resources/poe-tile-templates/tests/check-source.test.ts +131 -0
- package/bundled-resources/poe-tile-templates/tests/dev-script.test.slow.ts +166 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/customized-manager.ts +67 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/extended-mutators.ts.txt +106 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/multiplayer-verification.test.playwright.ts.txt +103 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/replace-starter-schema.ts +67 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/phaserjs.tsx.txt +85 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/preact.tsx.txt +69 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/react.tsx.txt +73 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/seating.ts.txt +54 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/solidjs.tsx.txt +70 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/vanilla-js.tsx.txt +85 -0
- package/bundled-resources/poe-tile-templates/tests/generated-templates.test.ts +278 -0
- package/bundled-resources/poe-tile-templates/tests/happy-dom-version.test.ts +27 -0
- package/bundled-resources/poe-tile-templates/tests/install-diagnostics.test.ts +99 -0
- package/bundled-resources/poe-tile-templates/tests/native-gesture-defaults.test.ts +23 -0
- package/bundled-resources/poe-tile-templates/tests/playwright-version.test.ts +84 -0
- package/bundled-resources/poe-tile-templates/tests/render-check-scaffold.test.ts +56 -0
- package/bundled-resources/poe-tile-templates/tests/sdk-dependency-key.test.ts +129 -0
- package/bundled-resources/poe-tile-templates/tests/visual-check.test.ts +90 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/package.partial.json +3 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/tile/src/entry.ts +35 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.test.happydom.tsx +96 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.ts +113 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/vite.config.ts +17 -0
- package/cli.ts +134 -0
- package/index.ts +96 -0
- package/package.json +48 -5
- package/skills/audio-generation/.generated-by-poe-templated-docs +0 -0
- package/skills/audio-generation/SKILL.md +125 -0
- package/skills/finish-prototype/.generated-by-poe-templated-docs +0 -0
- package/skills/finish-prototype/SKILL.md +22 -0
- package/skills/help-me-build/.generated-by-poe-templated-docs +0 -0
- package/skills/help-me-build/SKILL.md +56 -0
- package/skills/image-generation/.generated-by-poe-templated-docs +0 -0
- package/skills/image-generation/SKILL.md +128 -0
- package/skills/one-shot/.generated-by-poe-templated-docs +0 -0
- package/skills/one-shot/SKILL.md +22 -0
- package/skills/platform-prototype/.generated-by-poe-templated-docs +0 -0
- package/skills/platform-prototype/SKILL.md +60 -0
- package/skills/platform-subagent/.generated-by-poe-templated-docs +0 -0
- package/skills/platform-subagent/SKILL.md +16 -0
- package/skills/poe-tiles-cli/.generated-by-poe-templated-docs +0 -0
- package/skills/poe-tiles-cli/SKILL.md +609 -0
- package/skills/poe-tiles-cli/references/device-motion.md +40 -0
- package/skills/poe-tiles-cli/references/player-updates.md +41 -0
- package/skills/prototype/.generated-by-poe-templated-docs +0 -0
- package/skills/prototype/SKILL.md +148 -0
- package/skills/publish/.generated-by-poe-templated-docs +0 -0
- package/skills/publish/SKILL.md +73 -0
- package/skills/synced-store/.generated-by-poe-templated-docs +0 -0
- package/skills/synced-store/SKILL.md +583 -0
- package/skills/synced-store/references/actions.md +85 -0
- package/skills/synced-store/references/api-patterns.md +245 -0
- package/skills/synced-store/references/architecture-scaling-and-performance.md +280 -0
- package/skills/synced-store/references/client-api-reference.md +263 -0
- package/skills/synced-store/references/data-visibility.md +95 -0
- package/skills/synced-store/references/external-stores.md +162 -0
- package/skills/synced-store/references/file-uploads.md +216 -0
- package/skills/synced-store/references/getting-user-info-of-members.md +228 -0
- package/skills/synced-store/references/limitations.md +72 -0
- package/skills/synced-store/references/live-data-limit-hook.md +131 -0
- package/skills/synced-store/references/mutator-rules.md +169 -0
- package/skills/synced-store/references/platform.md +49 -0
- package/skills/synced-store/references/schema-and-bindings.md +85 -0
- package/skills/synced-store/references/schema-libraries.md +57 -0
- package/skills/synced-store/references/schema-migrations.md +119 -0
- package/skills/synced-store/references/searchable-tables.md +27 -0
- package/skills/synced-store/references/server-forking.md +115 -0
- package/skills/synced-store/references/singleton-tables.md +61 -0
- package/skills/synced-store/references/sort-keys.md +253 -0
- package/skills/synced-store/references/ui-patterns.md +95 -0
- package/skills/tile-creator/.generated-by-poe-templated-docs +0 -0
- package/skills/tile-creator/SKILL.md +196 -0
- package/skills/tile-creator/references/assets.md +124 -0
- package/skills/tile-creator/references/backend-api.md +308 -0
- package/skills/tile-creator/references/cli-limitations.md +64 -0
- package/skills/tile-creator/references/cli.md +604 -0
- package/skills/tile-creator/references/client-api.md +2407 -0
- package/skills/tile-creator/references/composing-apps.md +166 -0
- package/skills/tile-creator/references/e2e-tests.md +55 -0
- package/skills/tile-creator/references/game-ux-best-practices.md +57 -0
- package/skills/tile-creator/references/migrating-pre-rename-tiles.md +79 -0
- package/skills/tile-creator/references/multiplayer-api-recipe.md +205 -0
- package/skills/tile-creator/references/native-results.md +100 -0
- package/skills/tile-creator/references/platform-integration.md +201 -0
- package/skills/tile-creator/references/power-report.md +199 -0
- package/skills/tile-creator/references/publish-rollout.md +166 -0
- package/skills/tile-creator/references/publishing.md +33 -0
- package/skills/tile-creator/references/push-notification-guidelines.md +58 -0
- package/skills/tile-creator/references/render-check.md +266 -0
- package/skills/tile-creator/references/running-the-client-api-on-a-server-owned-by-the-user.md +95 -0
- package/skills/tile-creator/references/safe-area-insets.md +79 -0
- package/skills/tile-creator/references/sandbox-limitations.md +32 -0
- package/skills/tile-creator/references/scaffolded-tile-folder-structure.md +48 -0
- package/skills/tile-creator/references/scaffolding-a-new-app.md +202 -0
- package/skills/tile-creator/references/simulations.md +125 -0
- package/skills/tile-creator/references/synced-store-client-reference.md +92 -0
- package/skills/tile-creator/references/troubleshooting.md +22 -0
- package/skills/tile-creator/references/turn-based-mutator.md +43 -0
- package/skills/tile-creator/references/user-erasure.md +14 -0
- package/skills/tile-creator/references/vite-plugin.md +166 -0
- package/skills/tile-creator/references/workspace-retention.md +72 -0
- package/src/admin-conversions-client.ts +28 -0
- package/src/admin-reviews-client.ts +36 -0
- package/src/api.generated.ts +1527 -0
- package/src/auth-token.ts +198 -0
- package/src/bounded-read.ts +35 -0
- package/src/bun-version.ts +33 -0
- package/src/checkout-base.ts +207 -0
- package/src/cli-bun-version.ts +16 -0
- package/src/cli-env.ts +28 -0
- package/src/cli-name.ts +23 -0
- package/src/client.ts +2474 -0
- package/src/collect-files.ts +226 -0
- package/src/commands/accounts.ts +55 -0
- package/src/commands/admin-abandon-conversion.ts +60 -0
- package/src/commands/admin-reviews.ts +66 -0
- package/src/commands/admin.ts +219 -0
- package/src/commands/auth.ts +89 -0
- package/src/commands/checkout-prototype.ts +67 -0
- package/src/commands/creator-source-capability.ts +11 -0
- package/src/commands/doctor-bun.ts +145 -0
- package/src/commands/doctor-command.ts +64 -0
- package/src/commands/doctor-package-json.ts +47 -0
- package/src/commands/doctor-sdk-pin.ts +156 -0
- package/src/commands/doctor-store-keys-lexer.ts +213 -0
- package/src/commands/doctor-store-keys-scan.ts +262 -0
- package/src/commands/doctor-store-keys.ts +196 -0
- package/src/commands/doctor.ts +371 -0
- package/src/commands/init/blank-scaffold-templates.ts +397 -0
- package/src/commands/init/index.ts +170 -0
- package/src/commands/init/internal-toolchain.ts +49 -0
- package/src/commands/init/manager-test-template.ts +107 -0
- package/src/commands/init/multiplayer-test-template.ts +217 -0
- package/src/commands/init/name-input.tsx +167 -0
- package/src/commands/init/no-store-scaffold-templates.ts +281 -0
- package/src/commands/init/no-store-scaffold.ts +134 -0
- package/src/commands/init/package-json-scripts.ts +72 -0
- package/src/commands/init/scaffold.ts +960 -0
- package/src/commands/init/sdk-tarball-url.generated.ts +4 -0
- package/src/commands/init/sdk-tarball-url.ts +31 -0
- package/src/commands/init/template-picker.tsx +147 -0
- package/src/commands/inspect-child-entry.ts +107 -0
- package/src/commands/inspect-contract.ts +87 -0
- package/src/commands/inspect-freshness.ts +217 -0
- package/src/commands/inspect-lock.ts +201 -0
- package/src/commands/inspect-options.ts +360 -0
- package/src/commands/inspect-orchestrate.ts +375 -0
- package/src/commands/inspect-process.ts +172 -0
- package/src/commands/inspect-ready.ts +65 -0
- package/src/commands/inspect-report.ts +235 -0
- package/src/commands/inspect-run-state.ts +296 -0
- package/src/commands/inspect-run.ts +157 -0
- package/src/commands/inspect-watchdog.ts +74 -0
- package/src/commands/install-joiner.ts +208 -0
- package/src/commands/login.ts +308 -0
- package/src/commands/models.ts +40 -0
- package/src/commands/parse-options.ts +36 -0
- package/src/commands/remix-package-json.ts +64 -0
- package/src/commands/remix.ts +379 -0
- package/src/commands/sdk-url.ts +141 -0
- package/src/commands/simulations.ts +133 -0
- package/src/commands/skills.ts +108 -0
- package/src/commands/store-files.ts +92 -0
- package/src/commands/stores.ts +703 -0
- package/src/commands/tiles-channel-commands.ts +115 -0
- package/src/commands/tiles-checkout.ts +351 -0
- package/src/commands/tiles-gallery-command.ts +95 -0
- package/src/commands/tiles-get-helpers.ts +27 -0
- package/src/commands/tiles-inspect.ts +276 -0
- package/src/commands/tiles-power-command.ts +308 -0
- package/src/commands/tiles-power-format.ts +396 -0
- package/src/commands/tiles-power-versions.ts +299 -0
- package/src/commands/tiles-publish-helpers.ts +145 -0
- package/src/commands/tiles-upload-command.ts +277 -0
- package/src/commands/tiles-version-commands.ts +201 -0
- package/src/commands/tiles-visibility-command.ts +103 -0
- package/src/commands/tiles.ts +257 -0
- package/src/commands/upgrade.ts +307 -0
- package/src/commit-in-progress.ts +42 -0
- package/src/creator-source-context.ts +97 -0
- package/src/creator-source-publish.ts +52 -0
- package/src/deferred-assets.ts +125 -0
- package/src/distribution.ts +28 -0
- package/src/errors.ts +61 -0
- package/src/install-command.ts +43 -0
- package/src/output.ts +62 -0
- package/src/poe-tile-config-files.ts +100 -0
- package/src/poe-tile-config-players.ts +168 -0
- package/src/poe-tile-config-remix.ts +166 -0
- package/src/poe-tile-config.ts +831 -0
- package/src/power-report-client.ts +55 -0
- package/src/prototype-startup.ts +21 -0
- package/src/publish-change-summary.ts +55 -0
- package/src/publish-overrides-validation.ts +49 -0
- package/src/publish-pack.ts +167 -0
- package/src/publish-phases.ts +57 -0
- package/src/publish-retry.ts +51 -0
- package/src/publish-tile-from-config.ts +434 -0
- package/src/recorder-stream.ts +169 -0
- package/src/remix-provenance.ts +156 -0
- package/src/resolve-client-credential.ts +71 -0
- package/src/resolve-media-uploads.ts +147 -0
- package/src/sdk-dependency.ts +54 -0
- package/src/sdk-skills.ts +85 -0
- package/src/should-skip-client-setup.ts +20 -0
- package/src/simulation-snapshot.ts +123 -0
- package/src/simulation-types.ts +74 -0
- package/src/simulations-client.ts +112 -0
- package/src/source-bundle.ts +466 -0
- package/src/staged-publish-cleanup.ts +44 -0
- package/src/staged-publish-deferred.ts +160 -0
- package/src/staged-publish.ts +401 -0
- package/src/store-file-upload.ts +268 -0
- package/src/store-request.ts +168 -0
- package/src/tar-canonical.ts +41 -0
- package/src/tar-extensions.ts +159 -0
- package/src/tar-extract.ts +193 -0
- package/src/tar-parse.ts +224 -0
- package/src/tar.ts +231 -0
- package/src/template-check-scripts.ts +18 -0
- package/src/tile-gallery-client.ts +82 -0
- package/src/types.ts +258 -0
- package/src/upload-concurrency.ts +54 -0
- package/src/whole-tile.ts +52 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `GET /me/created-tiles/power-report`: the 7-day battery and heat report
|
|
3
|
+
* for the caller's own tiles. A session reads every tile it owns, or the one
|
|
4
|
+
* owned tile `tileId` names; a Creator publish credential reads only the
|
|
5
|
+
* tile its session is bound to, so in a sandbox `tileId` is normally omitted.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { components, paths } from "./api.generated";
|
|
9
|
+
|
|
10
|
+
export type TilePowerReportResponse =
|
|
11
|
+
paths["/me/created-tiles/power-report"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
12
|
+
export type TilePowerReport =
|
|
13
|
+
components["schemas"]["MeCreatedTilesPowerReportSuccess"];
|
|
14
|
+
/** The report as the CLI prints it, without the success flag. */
|
|
15
|
+
export type TilePowerReportBody = Omit<TilePowerReport, "success">;
|
|
16
|
+
/** What a report says apart from its tiles: when it was built and the baselines. */
|
|
17
|
+
export type TilePowerReportEnvelope = Omit<
|
|
18
|
+
TilePowerReportBody,
|
|
19
|
+
"tiles" | "next_cursor"
|
|
20
|
+
>;
|
|
21
|
+
export type TilePowerTile = components["schemas"]["TilePowerTile"];
|
|
22
|
+
export type TilePowerFleet = components["schemas"]["TilePowerFleet"];
|
|
23
|
+
|
|
24
|
+
export function createPowerReportClient(transport: {
|
|
25
|
+
get<T>(path: string): Promise<T>;
|
|
26
|
+
sendsCreatorCredential(): boolean;
|
|
27
|
+
}) {
|
|
28
|
+
return {
|
|
29
|
+
/**
|
|
30
|
+
* Whether the read goes out under a Creator publish credential, whose
|
|
31
|
+
* 403 and 404 mean something different from a session's: the server
|
|
32
|
+
* reads only the credential's bound tile, and has none until the
|
|
33
|
+
* session publishes.
|
|
34
|
+
*/
|
|
35
|
+
readsAsCreatorSession(): boolean {
|
|
36
|
+
return transport.sendsCreatorCredential();
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* The report; with `versionNumber`, one published version's own, sent
|
|
40
|
+
* with the tile when one is given and alone otherwise (the route
|
|
41
|
+
* accepts that for a Creator publish credential bound to a tile).
|
|
42
|
+
*/
|
|
43
|
+
read(
|
|
44
|
+
tileId?: string,
|
|
45
|
+
versionNumber?: number,
|
|
46
|
+
): Promise<TilePowerReportResponse> {
|
|
47
|
+
const params = new URLSearchParams();
|
|
48
|
+
if (tileId !== undefined) params.set("tile_id", tileId);
|
|
49
|
+
if (versionNumber !== undefined)
|
|
50
|
+
params.set("version_number", String(versionNumber));
|
|
51
|
+
const query = params.size === 0 ? "" : `?${params.toString()}`;
|
|
52
|
+
return transport.get(`/api/v1/me/created-tiles/power-report${query}`);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// owner: aaronroe
|
|
2
|
+
/** The workspace phase is explicit; backend presence cannot identify SDK use. */
|
|
3
|
+
export function declarePrototypeStartup(
|
|
4
|
+
files: Map<string, Uint8Array>,
|
|
5
|
+
prototype = false,
|
|
6
|
+
): void {
|
|
7
|
+
if (!prototype) return;
|
|
8
|
+
const path = ".poe-tile-runtime.json";
|
|
9
|
+
const existing = files.get(path);
|
|
10
|
+
const manifest = existing
|
|
11
|
+
? JSON.parse(new TextDecoder().decode(existing))
|
|
12
|
+
: { minKernelVersion: null };
|
|
13
|
+
// Only the upload changes. Integration removes .poe-prototype, so its next
|
|
14
|
+
// publish cannot inherit metadata written into local build output earlier.
|
|
15
|
+
files.set(
|
|
16
|
+
path,
|
|
17
|
+
new TextEncoder().encode(
|
|
18
|
+
JSON.stringify({ ...manifest, startupMode: "paint" }),
|
|
19
|
+
),
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// owner: aaronroe
|
|
2
|
+
import { CliError } from "./errors";
|
|
3
|
+
|
|
4
|
+
export const CHANGE_SUMMARY_MAX_LENGTH = 500;
|
|
5
|
+
|
|
6
|
+
export function normalizeChangeSummary(
|
|
7
|
+
value: string | undefined,
|
|
8
|
+
): string | undefined {
|
|
9
|
+
if (value === undefined) return undefined;
|
|
10
|
+
const normalized = value.replace(/\s+/g, " ").trim();
|
|
11
|
+
if (normalized === "") {
|
|
12
|
+
throw new CliError("--change-summary must not be empty.");
|
|
13
|
+
}
|
|
14
|
+
if (normalized.length > CHANGE_SUMMARY_MAX_LENGTH) {
|
|
15
|
+
throw new CliError(
|
|
16
|
+
`--change-summary is ${normalized.length} characters; the maximum is ${CHANGE_SUMMARY_MAX_LENGTH}.`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return normalized;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const VERSION_NAME_MAX_LENGTH = 60;
|
|
23
|
+
export const VERSION_NOTES_MAX_LENGTH = 2000;
|
|
24
|
+
|
|
25
|
+
export function normalizeVersionName(
|
|
26
|
+
value: string | undefined,
|
|
27
|
+
): string | undefined {
|
|
28
|
+
if (value === undefined) return undefined;
|
|
29
|
+
const normalized = value.trim();
|
|
30
|
+
if (normalized === "") {
|
|
31
|
+
throw new CliError("--version-name must not be empty.");
|
|
32
|
+
}
|
|
33
|
+
if (normalized.length > VERSION_NAME_MAX_LENGTH) {
|
|
34
|
+
throw new CliError(
|
|
35
|
+
`--version-name is ${normalized.length} characters; the maximum is ${VERSION_NAME_MAX_LENGTH}.`,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return normalized;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function normalizeVersionNotes(
|
|
42
|
+
value: string | undefined,
|
|
43
|
+
): string | undefined {
|
|
44
|
+
if (value === undefined) return undefined;
|
|
45
|
+
const normalized = value.trim();
|
|
46
|
+
if (normalized === "") {
|
|
47
|
+
throw new CliError("--version-notes must not be empty.");
|
|
48
|
+
}
|
|
49
|
+
if (normalized.length > VERSION_NOTES_MAX_LENGTH) {
|
|
50
|
+
throw new CliError(
|
|
51
|
+
`--version-notes is ${normalized.length} characters; the maximum is ${VERSION_NOTES_MAX_LENGTH}.`,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return normalized;
|
|
55
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// owner: aaronroe
|
|
2
|
+
|
|
3
|
+
import { CliError } from "./errors.js";
|
|
4
|
+
import { isSourceBundleVisibility } from "./source-bundle.js";
|
|
5
|
+
|
|
6
|
+
export interface PublishBoundaryOverrides {
|
|
7
|
+
/** Source-code directory uploaded beside the runtime bundle. */
|
|
8
|
+
sourceBundle?: string;
|
|
9
|
+
/** Access policy for a newly uploaded source bundle. */
|
|
10
|
+
sourceBundleVisibility?: string;
|
|
11
|
+
/** Extra source-bundle ignore rules. */
|
|
12
|
+
sourceBundleIgnore?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function validatePublishBoundaryOverrides(
|
|
16
|
+
overrides: PublishBoundaryOverrides,
|
|
17
|
+
): void {
|
|
18
|
+
validateSourceBundleMatrix(overrides);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function validateSourceBundleMatrix(overrides: PublishBoundaryOverrides): void {
|
|
22
|
+
if (overrides.sourceBundle && !overrides.sourceBundleVisibility) {
|
|
23
|
+
throw new CliError(
|
|
24
|
+
"--source-bundle-visibility is required when --source-bundle is set " +
|
|
25
|
+
"(owner_only | public). Pass --source-bundle-visibility=public to " +
|
|
26
|
+
"share for remixing, or --source-bundle-visibility=owner_only to " +
|
|
27
|
+
"keep the source private.",
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
if (!overrides.sourceBundle && overrides.sourceBundleVisibility) {
|
|
31
|
+
throw new CliError(
|
|
32
|
+
"--source-bundle-visibility is only meaningful with --source-bundle.",
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
if (!overrides.sourceBundle && overrides.sourceBundleIgnore) {
|
|
36
|
+
throw new CliError(
|
|
37
|
+
"--source-bundle-ignore is only meaningful with --source-bundle.",
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
if (
|
|
41
|
+
overrides.sourceBundleVisibility !== undefined &&
|
|
42
|
+
!isSourceBundleVisibility(overrides.sourceBundleVisibility)
|
|
43
|
+
) {
|
|
44
|
+
throw new CliError(
|
|
45
|
+
`--source-bundle-visibility must be "owner_only" or "public" ` +
|
|
46
|
+
`(got "${overrides.sourceBundleVisibility}").`,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// owner: aaronroe
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The client-side packing of a publish: the runtime bundle collected, split
|
|
5
|
+
* into its client and backend bundles and gzipped, then the source bundle when
|
|
6
|
+
* the publish carries one. Split from
|
|
7
|
+
* `SlopPoeClient.publishTile` so the whole step can be timed as one phase
|
|
8
|
+
* (`pack`, see `publish-phases.ts`) — including when it throws, which it does
|
|
9
|
+
* on an empty directory, a missing `index.html`, or a bundle past its caps.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
assertFileCountWithinLimit,
|
|
14
|
+
assertFileWithinLimit,
|
|
15
|
+
assertWithinBudget,
|
|
16
|
+
collectFiles,
|
|
17
|
+
compareRuntimeBundlePaths,
|
|
18
|
+
RUNTIME_BUNDLE_MAX_TOTAL_BYTES,
|
|
19
|
+
} from "./collect-files.js";
|
|
20
|
+
import {
|
|
21
|
+
POE_TILES_API_KEY_FILENAME,
|
|
22
|
+
POE_TILES_SESSION_TOKEN_FILENAME,
|
|
23
|
+
} from "./auth-token.js";
|
|
24
|
+
import { CHECKOUT_BASE_FILE } from "./checkout-base.js";
|
|
25
|
+
import { partitionDeferredFiles } from "./deferred-assets.js";
|
|
26
|
+
import { declarePrototypeStartup } from "./prototype-startup.js";
|
|
27
|
+
import { buildSourceBundleTarGz } from "./source-bundle.js";
|
|
28
|
+
import { buildTarGz } from "./tar.js";
|
|
29
|
+
import { buildCanonicalTarGz } from "./tar-canonical.js";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The archive as it will be sent: `declarePrototypeStartup` can add a
|
|
33
|
+
* manifest to a directory that passed collection exactly at the limit, and the
|
|
34
|
+
* server would refuse the result at upload. O(files).
|
|
35
|
+
*/
|
|
36
|
+
function assertPublishBudget(files: ReadonlyMap<string, Uint8Array>): void {
|
|
37
|
+
assertFileCountWithinLimit({ fileCount: files.size });
|
|
38
|
+
let totalBytes = 0;
|
|
39
|
+
for (const [path, data] of files) {
|
|
40
|
+
assertFileWithinLimit(path, data.byteLength);
|
|
41
|
+
assertWithinBudget(
|
|
42
|
+
totalBytes,
|
|
43
|
+
data.byteLength,
|
|
44
|
+
RUNTIME_BUNDLE_MAX_TOTAL_BYTES,
|
|
45
|
+
);
|
|
46
|
+
totalBytes += data.byteLength;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The build's backend entries. The server keeps them out of the bundle players
|
|
52
|
+
* download, so they travel in their own `backend-bundle` and the client bundle
|
|
53
|
+
* is stored exactly as packed here, with no server-side re-encode. Mirrors
|
|
54
|
+
* `CLIENT_BUNDLE_EXCLUDED_ENTRY_PATHS` in
|
|
55
|
+
* `packages/poe-tiles-api/src/quickjs-backend-artifact.ts`.
|
|
56
|
+
*/
|
|
57
|
+
export const BACKEND_BUNDLE_ENTRY_PATHS: ReadonlySet<string> = new Set([
|
|
58
|
+
"synced-store-backend-config.js",
|
|
59
|
+
"synced-store-backend-config.quickjs",
|
|
60
|
+
]);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The packed build: the client bundle, the backend bundle when it has one,
|
|
64
|
+
* and the `deferred/` files the client bundle left out and indexed, which
|
|
65
|
+
* upload on their own beside it.
|
|
66
|
+
*/
|
|
67
|
+
export type PackedRuntime = {
|
|
68
|
+
client: Uint8Array;
|
|
69
|
+
backend: Uint8Array | undefined;
|
|
70
|
+
deferred: ReadonlyMap<string, Uint8Array> | undefined;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Entries at the tile root that a runtime bundle collected there
|
|
75
|
+
* (`runtimeBundle.dir: "."`, a Creator prototype) leaves out: the agent
|
|
76
|
+
* instructions and skills `tiles checkout` writes, the checkout's version
|
|
77
|
+
* record, VCS and dependency folders, and local credential files. None of
|
|
78
|
+
* them is part of the tile, and the bundle is public. `.poe-prototype` and
|
|
79
|
+
* `.poe-tile.json` stay in: Creator restores a prototype from this bundle,
|
|
80
|
+
* and the marker is what tells a prototype from a full tile.
|
|
81
|
+
*/
|
|
82
|
+
export const TILE_ROOT_RUNTIME_IGNORES: ReadonlySet<string> = new Set([
|
|
83
|
+
".claude",
|
|
84
|
+
".agents",
|
|
85
|
+
"AGENTS.md",
|
|
86
|
+
"CLAUDE.md",
|
|
87
|
+
CHECKOUT_BASE_FILE,
|
|
88
|
+
".git",
|
|
89
|
+
"node_modules",
|
|
90
|
+
".poe-tiles-token",
|
|
91
|
+
POE_TILES_API_KEY_FILENAME,
|
|
92
|
+
POE_TILES_SESSION_TOKEN_FILENAME,
|
|
93
|
+
]);
|
|
94
|
+
|
|
95
|
+
export function packPublishBundles(
|
|
96
|
+
dir: string,
|
|
97
|
+
options: {
|
|
98
|
+
prototype?: boolean;
|
|
99
|
+
/** `dir` is the tile root, the folder of `.poe-tile.json`. */
|
|
100
|
+
runtimeBundleAtTileRoot?: boolean;
|
|
101
|
+
sourceBundle?: { dir: string; ignoreFile?: string };
|
|
102
|
+
},
|
|
103
|
+
): { runtime: PackedRuntime; sourceTarGz: Uint8Array | undefined } {
|
|
104
|
+
const files = collectFiles(
|
|
105
|
+
dir,
|
|
106
|
+
dir,
|
|
107
|
+
options.runtimeBundleAtTileRoot
|
|
108
|
+
? { skipTopLevel: TILE_ROOT_RUNTIME_IGNORES }
|
|
109
|
+
: undefined,
|
|
110
|
+
);
|
|
111
|
+
if (files.length === 0) {
|
|
112
|
+
throw new Error(`No files found in ${dir}`);
|
|
113
|
+
}
|
|
114
|
+
if (!files.some((f) => f.path === "index.html")) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
"index.html not found in directory. The publish directory must contain index.html.",
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
runtime: packRuntimeBundle(files, options),
|
|
121
|
+
sourceTarGz: options.sourceBundle
|
|
122
|
+
? buildSourceBundleTarGz(options.sourceBundle.dir, {
|
|
123
|
+
ignoreFile: options.sourceBundle.ignoreFile,
|
|
124
|
+
})
|
|
125
|
+
: undefined,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* O(files + bytes): apply runtime metadata and enforce limits before
|
|
131
|
+
* compression, then split the backend entries out. The limits apply to the
|
|
132
|
+
* whole build, as the server's runtime limits did to the single bundle.
|
|
133
|
+
*/
|
|
134
|
+
export function packRuntimeBundle(
|
|
135
|
+
files: ReturnType<typeof collectFiles>,
|
|
136
|
+
options: { prototype?: boolean },
|
|
137
|
+
): PackedRuntime {
|
|
138
|
+
const fileMap = new Map<string, Uint8Array>();
|
|
139
|
+
for (const file of files) {
|
|
140
|
+
fileMap.set(file.path, file.data);
|
|
141
|
+
}
|
|
142
|
+
declarePrototypeStartup(fileMap, options.prototype);
|
|
143
|
+
const client = new Map<string, Uint8Array>();
|
|
144
|
+
const backend = new Map<string, Uint8Array>();
|
|
145
|
+
// Sorted again after the metadata step, which may add the manifest that a
|
|
146
|
+
// cold open needs at the front of the archive.
|
|
147
|
+
const ordered = [...fileMap].sort(([a], [b]) =>
|
|
148
|
+
compareRuntimeBundlePaths(a, b),
|
|
149
|
+
);
|
|
150
|
+
for (const [path, data] of ordered)
|
|
151
|
+
(BACKEND_BUNDLE_ENTRY_PATHS.has(path) ? backend : client).set(path, data);
|
|
152
|
+
// Deferred files have their own limits (checked here) and leave the tar,
|
|
153
|
+
// which keeps their index instead, so the tar's limits apply to what it keeps.
|
|
154
|
+
const partition = partitionDeferredFiles(client);
|
|
155
|
+
const kept = partition?.kept ?? client;
|
|
156
|
+
assertPublishBudget(new Map([...kept, ...backend]));
|
|
157
|
+
return {
|
|
158
|
+
// The canonical encoder the server's runtime-bundle re-encode uses, so a
|
|
159
|
+
// split publish stores the very bytes (and id) that re-encode produced:
|
|
160
|
+
// ids stay stable across the switch, and a predicted id (the manager's
|
|
161
|
+
// `readManagerBundleArtifactsFromDist`) still matches. fflate's one-shot
|
|
162
|
+
// gzip emits different bytes for large inputs.
|
|
163
|
+
client: buildCanonicalTarGz(kept),
|
|
164
|
+
backend: backend.size === 0 ? undefined : buildTarGz(backend),
|
|
165
|
+
deferred: partition?.deferred,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// owner: aaronroe
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Where a publish spends its time on the CLIENT, for a caller that measures.
|
|
5
|
+
*
|
|
6
|
+
* The server times its own half (`poe_tiles.publish_commit.phase.duration`);
|
|
7
|
+
* what happened before the first byte left — walking the bundle directory,
|
|
8
|
+
* gzipping the runtime and source bundles — and how long each wave of PUTs
|
|
9
|
+
* and the commit took were invisible. Creator's automatic preview publish
|
|
10
|
+
* runs this code in its own process and reports these under its boundary's
|
|
11
|
+
* timing sample. The CLI itself passes no observer.
|
|
12
|
+
*/
|
|
13
|
+
export type PublishPhase =
|
|
14
|
+
/** Collecting and gzipping the runtime bundle, then the source bundle. */
|
|
15
|
+
| "pack"
|
|
16
|
+
/** One wave of artifact PUTs; a second sample on the missing-artifact retry. */
|
|
17
|
+
| "upload"
|
|
18
|
+
/**
|
|
19
|
+
* One commit POST, plus a sample for the missing-artifact retry and one
|
|
20
|
+
* per poll while an earlier attempt's commit is still in progress.
|
|
21
|
+
*/
|
|
22
|
+
| "commit";
|
|
23
|
+
|
|
24
|
+
export type PublishPhaseObserver = (
|
|
25
|
+
phase: PublishPhase,
|
|
26
|
+
durationMs: number,
|
|
27
|
+
) => void;
|
|
28
|
+
|
|
29
|
+
/** Time one step, recording it whether the step resolves or throws. */
|
|
30
|
+
export async function observedStep<T>(
|
|
31
|
+
observe: PublishPhaseObserver | undefined,
|
|
32
|
+
phase: PublishPhase,
|
|
33
|
+
step: () => Promise<T>,
|
|
34
|
+
): Promise<T> {
|
|
35
|
+
if (observe === undefined) return await step();
|
|
36
|
+
const startedAt = Date.now();
|
|
37
|
+
try {
|
|
38
|
+
return await step();
|
|
39
|
+
} finally {
|
|
40
|
+
observe(phase, Date.now() - startedAt);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The synchronous twin of {@link observedStep}, for the packing step. */
|
|
45
|
+
export function observedSyncStep<T>(
|
|
46
|
+
observe: PublishPhaseObserver | undefined,
|
|
47
|
+
phase: PublishPhase,
|
|
48
|
+
step: () => T,
|
|
49
|
+
): T {
|
|
50
|
+
if (observe === undefined) return step();
|
|
51
|
+
const startedAt = Date.now();
|
|
52
|
+
try {
|
|
53
|
+
return step();
|
|
54
|
+
} finally {
|
|
55
|
+
observe(phase, Date.now() - startedAt);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// owner: aaronroe
|
|
2
|
+
|
|
3
|
+
type FetchLike = (
|
|
4
|
+
input: string | URL | Request,
|
|
5
|
+
init?: RequestInit,
|
|
6
|
+
) => Promise<Response>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The waits before each retry of one publish request.
|
|
10
|
+
*
|
|
11
|
+
* On 2026-09-29 a creator's preview failed on a five-second production D1
|
|
12
|
+
* overload: the one immediate retry landed 50 ms after the first attempt,
|
|
13
|
+
* inside the same window. These waits outlast it.
|
|
14
|
+
*/
|
|
15
|
+
export const PUBLISH_RETRY_DELAYS_MS = [500, 2_000, 5_000] as const;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Up to 50% extra on each wait, so the concurrent uploads of one publish do
|
|
19
|
+
* not retry in step: they share one user's staging prefix, and R2 rate-limits
|
|
20
|
+
* concurrent lists of the same prefix.
|
|
21
|
+
*/
|
|
22
|
+
function jittered(ms: number): number {
|
|
23
|
+
return Math.round(ms * (1 + Math.random() * 0.5));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* One publish request, retried with backoff on a server error or a lost
|
|
28
|
+
* response. A lost response is safe to retry because artifact PUTs and commit
|
|
29
|
+
* are idempotent for one publish id. A 4xx is the server's answer and returns
|
|
30
|
+
* at once. After the last wait, the final attempt's response or throw is the
|
|
31
|
+
* caller's.
|
|
32
|
+
*/
|
|
33
|
+
export async function fetchRetry(
|
|
34
|
+
fetchFn: FetchLike,
|
|
35
|
+
url: string,
|
|
36
|
+
init: RequestInit,
|
|
37
|
+
sleep: (ms: number) => Promise<void>,
|
|
38
|
+
): Promise<Response> {
|
|
39
|
+
for (const delayMs of PUBLISH_RETRY_DELAYS_MS) {
|
|
40
|
+
try {
|
|
41
|
+
// biome-ignore lint/performance/noAwaitInLoops: each attempt starts only after the previous one failed.
|
|
42
|
+
const response = await fetchFn(url, init);
|
|
43
|
+
if (response.status < 500) return response;
|
|
44
|
+
} catch {
|
|
45
|
+
// Lost response: retry below.
|
|
46
|
+
}
|
|
47
|
+
// biome-ignore lint: the backoff must elapse before the next attempt; the wait is the point.
|
|
48
|
+
await sleep(jittered(delayMs));
|
|
49
|
+
}
|
|
50
|
+
return fetchFn(url, init);
|
|
51
|
+
}
|