@enhance-eng/enhance 0.1.2 → 0.1.4

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/dist/main.mjs CHANGED
@@ -2,17 +2,21 @@
2
2
  import { Command } from "commander";
3
3
  import { FailedToExitError, createCli, parseRouter } from "trpc-cli";
4
4
  import { z } from "zod";
5
+ import { setTimeout } from "node:timers/promises";
5
6
  import process from "node:process";
6
7
  import { createInterface } from "node:readline";
7
- import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
8
+ import { chmodSync, createReadStream, createWriteStream, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
8
9
  import path from "node:path";
9
10
  import { TRPCClientError, createTRPCUntypedClient, httpLink } from "@trpc/client";
10
11
  import { createHash, randomUUID } from "node:crypto";
11
- import { chmod, mkdir, readFile, readdir, realpath, rename, stat, unlink, writeFile } from "node:fs/promises";
12
+ import { chmod, mkdir, mkdtemp, readFile, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
13
+ import { homedir, tmpdir } from "node:os";
14
+ import { Readable, Transform } from "node:stream";
15
+ import { pipeline } from "node:stream/promises";
16
+ import { ZipFile } from "yazl";
12
17
  import { proxify } from "trpc-cli/dist/proxify.js";
13
18
  import { TRPCError, initTRPC } from "@trpc/server";
14
19
  import { middlewareMarker } from "@trpc/server/unstable-core-do-not-import";
15
- import { homedir, tmpdir } from "node:os";
16
20
  //#region \0rolldown/runtime.js
17
21
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
18
22
  //#endregion
@@ -184,10 +188,10 @@ const restoreCanvasInputSchema = z.object({ canvasId: z.uuid() });
184
188
  const restoreCanvasOutputSchema = z.object({ canvasId: z.uuid() });
185
189
  //#endregion
186
190
  //#region ../../packages/contract/src/canvas/canvas-presentation.schema.ts
187
- const MAX_ABSOLUTE_VALUE$1 = 1e5;
191
+ const MAX_CANVAS_VALUE = 1e5;
188
192
  const MAX_ITEM_ID_LENGTH$1 = 200;
189
- const boundedNumber$1 = z.number().min(-1e5).max(MAX_ABSOLUTE_VALUE$1);
190
- const nonNegativeNumber$1 = z.number().nonnegative().max(MAX_ABSOLUTE_VALUE$1);
193
+ const boundedNumber$1 = z.number().min(-1e5).max(MAX_CANVAS_VALUE);
194
+ const nonNegativeNumber$1 = z.number().nonnegative().max(MAX_CANVAS_VALUE);
191
195
  const ratio = z.number().min(0).max(1);
192
196
  const itemId = z.string().min(1).max(MAX_ITEM_ID_LENGTH$1);
193
197
  const canvasColorSchema = z.object({
@@ -447,7 +451,7 @@ const canvasNodeLayoutSchema = z.object({
447
451
  flipHorizontal: z.boolean().optional(),
448
452
  flipVertical: z.boolean().optional(),
449
453
  aspectRatioLocked: z.boolean().optional(),
450
- aspectRatio: z.number().positive().max(MAX_ABSOLUTE_VALUE$1).optional(),
454
+ aspectRatio: z.number().positive().max(MAX_CANVAS_VALUE).optional(),
451
455
  horizontal: canvasSizeIntentSchema,
452
456
  vertical: canvasSizeIntentSchema,
453
457
  position: z.enum(["flow", "absolute"]),
@@ -465,20 +469,16 @@ const canvasNodeLayoutSchema = z.object({
465
469
  clipContent: z.boolean().optional(),
466
470
  container: canvasFlexLayoutSchema.optional()
467
471
  });
468
- //#endregion
469
- //#region ../../packages/contract/src/canvas/canvas-content-styles.schema.ts
470
- const MAX_ABSOLUTE_VALUE = 1e5;
471
- const MAX_FONT_WEIGHT = 1e3;
472
+ const MAX_CANVAS_FONT_WEIGHT = 1e3;
472
473
  const MAX_ITEM_ID_LENGTH = 200;
473
- const MAX_ASSET_ID_LENGTH = 500;
474
- const MAX_STYLE_VALUE_LENGTH = 1e4;
475
- const boundedNumber = z.number().min(-1e5).max(MAX_ABSOLUTE_VALUE);
476
- const nonNegativeNumber = z.number().nonnegative().max(MAX_ABSOLUTE_VALUE);
474
+ const MAX_CANVAS_ADDITIONAL_STYLE_VALUE_LENGTH = 1e4;
475
+ const boundedNumber = z.number().min(-1e5).max(MAX_CANVAS_VALUE);
476
+ const nonNegativeNumber = z.number().nonnegative().max(MAX_CANVAS_VALUE);
477
477
  const canvasTypographySchema = z.object({
478
- family: z.string().min(1).max(MAX_ASSET_ID_LENGTH),
479
- fallbackFamilies: z.array(z.string().min(1).max(MAX_ASSET_ID_LENGTH)).max(20),
478
+ family: z.string().min(1).max(500),
479
+ fallbackFamilies: z.array(z.string().min(1).max(500)).max(20),
480
480
  size: nonNegativeNumber,
481
- weight: z.number().int().min(1).max(MAX_FONT_WEIGHT),
481
+ weight: z.number().int().min(1).max(MAX_CANVAS_FONT_WEIGHT),
482
482
  style: z.enum([
483
483
  "normal",
484
484
  "italic",
@@ -538,7 +538,7 @@ const canvasTypographySchema = z.object({
538
538
  const unsafeStyleValue = /javascript|vbscript|data\s*:\s*text\/html|expression\s*\(|@import/iu;
539
539
  const blockedStyleProperty = /^(?:behavior|-moz-binding)$/iu;
540
540
  const canvasAdditionalStylePropertySchema = z.string().min(1).max(MAX_ITEM_ID_LENGTH).regex(/^(?:--[\w-]+|[a-z][a-z\d-]*)$/iu).refine((property) => !blockedStyleProperty.test(property), "unsafe CSS property");
541
- const canvasAdditionalStyleValueSchema = z.string().max(MAX_STYLE_VALUE_LENGTH).refine((value) => !unsafeStyleValue.test(value), "unsafe CSS value");
541
+ const canvasAdditionalStyleValueSchema = z.string().max(MAX_CANVAS_ADDITIONAL_STYLE_VALUE_LENGTH).refine((value) => !unsafeStyleValue.test(value), "unsafe CSS value");
542
542
  const canvasAdditionalStyleSchema = z.object({
543
543
  id: z.string().min(1).max(MAX_ITEM_ID_LENGTH),
544
544
  property: canvasAdditionalStylePropertySchema,
@@ -2752,6 +2752,141 @@ const requestPrototypeRuntimeTicketOutputSchema = z.object({
2752
2752
  bootUrl: z.url(),
2753
2753
  expiresAt: z.iso.datetime()
2754
2754
  });
2755
+ const PROTOTYPE_ARTIFACT_MANIFEST_PATH = "__enhance/manifest.json";
2756
+ const SHA256_HEX_LENGTH = 64;
2757
+ const CONTENT_TYPE_LENGTH = 200;
2758
+ const LAST_C0_CONTROL = 31;
2759
+ const DELETE_CONTROL = 127;
2760
+ const sha256Schema = z.string().length(SHA256_HEX_LENGTH).refine((value) => {
2761
+ for (const character of value) if (!/[\da-f]/u.test(character)) return false;
2762
+ return true;
2763
+ });
2764
+ const hasControlCharacter = (value) => {
2765
+ for (const character of value) {
2766
+ const point = character.codePointAt(0);
2767
+ if (point !== void 0 && (point === DELETE_CONTROL || point <= LAST_C0_CONTROL)) return true;
2768
+ }
2769
+ return false;
2770
+ };
2771
+ const foldPrototypeArtifactPath = (value) => value.normalize("NFKC").toUpperCase().toLowerCase();
2772
+ const prototypeArtifactPathSchema = z.string().min(1).refine((value) => value === value.normalize("NFC"), { message: "prototype paths must use NFC Unicode normalization" }).refine((value) => !value.startsWith("/") && !/^[A-Za-z]:\//u.test(value) && !value.endsWith("/") && !value.includes("\\") && !hasControlCharacter(value) && !value.startsWith("__enhance/") && value.split("/").every((part) => part !== "" && part !== "." && part !== ".."), { message: "prototype paths must be portable relative file paths" });
2773
+ const prototypeArtifactManifestFileSchema = z.object({
2774
+ path: prototypeArtifactPathSchema,
2775
+ contentType: z.string().trim().min(1).max(CONTENT_TYPE_LENGTH).refine((value) => !hasControlCharacter(value)),
2776
+ bytes: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
2777
+ sha256: sha256Schema
2778
+ });
2779
+ const prototypeArtifactManifestSchema = z.object({
2780
+ version: z.literal(1),
2781
+ entryPath: prototypeArtifactPathSchema,
2782
+ files: z.array(prototypeArtifactManifestFileSchema).min(1)
2783
+ });
2784
+ const prototypeArtifactLimitsSchema = z.object({
2785
+ artifactBytes: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2786
+ expandedBytes: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2787
+ fileBytes: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2788
+ manifestBytes: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2789
+ fileCount: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2790
+ pathBytes: z.number().int().positive().max(Number.MAX_SAFE_INTEGER)
2791
+ });
2792
+ const getPrototypeArtifactCapabilitiesInputSchema = z.object({});
2793
+ const getPrototypeArtifactCapabilitiesOutputSchema = z.object({
2794
+ protocolVersion: z.literal(1),
2795
+ format: z.literal("zip"),
2796
+ limits: prototypeArtifactLimitsSchema
2797
+ });
2798
+ const prototypeArtifactIdentitySchema = z.object({
2799
+ protocolVersion: z.literal(1),
2800
+ format: z.literal("zip"),
2801
+ bytes: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2802
+ sha256: sha256Schema,
2803
+ fileCount: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2804
+ expandedBytes: z.number().int().positive().max(Number.MAX_SAFE_INTEGER)
2805
+ });
2806
+ const createPrototypeArtifactInputSchema = z.object({
2807
+ canvasId: z.uuid(),
2808
+ prototypeId: z.uuid().optional(),
2809
+ clientToken: z.uuid(),
2810
+ nodeId: z.string().min(1),
2811
+ title: z.string().trim().min(1).max(200),
2812
+ entryPath: prototypeArtifactPathSchema,
2813
+ artifact: prototypeArtifactIdentitySchema,
2814
+ box: canvasSceneBoxSchema.extend({
2815
+ width: z.number().positive(),
2816
+ height: z.number().positive()
2817
+ })
2818
+ });
2819
+ const prototypeArtifactDeploymentStateSchema = z.enum([
2820
+ "uploading",
2821
+ "queued",
2822
+ "ingesting",
2823
+ "ready",
2824
+ "failed",
2825
+ "abandoned"
2826
+ ]);
2827
+ const createPrototypeArtifactOutputBaseSchema = z.object({
2828
+ prototypeId: z.uuid(),
2829
+ deploymentId: z.uuid(),
2830
+ nodeId: z.string().min(1),
2831
+ alreadyExists: z.boolean(),
2832
+ artifact: prototypeArtifactIdentitySchema
2833
+ });
2834
+ const createPrototypeArtifactOutputSchema = z.discriminatedUnion("state", [createPrototypeArtifactOutputBaseSchema.extend({
2835
+ state: z.literal("uploading"),
2836
+ upload: signedUploadSchema
2837
+ }), createPrototypeArtifactOutputBaseSchema.extend({ state: z.enum([
2838
+ "queued",
2839
+ "ingesting",
2840
+ "ready",
2841
+ "failed",
2842
+ "abandoned"
2843
+ ]) })]);
2844
+ const submitPrototypeArtifactInputSchema = z.object({
2845
+ canvasId: z.uuid(),
2846
+ deploymentId: z.uuid()
2847
+ });
2848
+ const submitPrototypeArtifactOutputSchema = z.object({
2849
+ deploymentId: z.uuid(),
2850
+ state: prototypeArtifactDeploymentStateSchema
2851
+ });
2852
+ const getPrototypePublishStatusInputSchema = z.object(submitPrototypeArtifactInputSchema.shape);
2853
+ const getPrototypePublishStatusBaseSchema = z.object({
2854
+ prototypeId: z.uuid(),
2855
+ deploymentId: z.uuid(),
2856
+ nodeId: z.string().min(1),
2857
+ fileCount: z.number().int().nonnegative(),
2858
+ totalBytes: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
2859
+ processedFiles: z.number().int().nonnegative()
2860
+ });
2861
+ const getPrototypePublishStatusOutputSchema = z.discriminatedUnion("state", [getPrototypePublishStatusBaseSchema.extend({
2862
+ state: z.literal("failed"),
2863
+ failure: z.object({
2864
+ code: z.string().min(1),
2865
+ message: z.string().min(1),
2866
+ path: prototypeArtifactPathSchema.optional()
2867
+ })
2868
+ }), getPrototypePublishStatusBaseSchema.extend({ state: z.enum([
2869
+ "uploading",
2870
+ "queued",
2871
+ "ingesting",
2872
+ "ready",
2873
+ "abandoned"
2874
+ ]) })]);
2875
+ const attachPrototypeArtifactInputSchema = z.object({
2876
+ canvasId: z.uuid(),
2877
+ deploymentId: z.uuid(),
2878
+ baseVersion: z.number().int().positive()
2879
+ });
2880
+ const attachPrototypeArtifactOutputSchema = z.object({
2881
+ canvasId: z.uuid(),
2882
+ prototypeId: z.uuid(),
2883
+ deploymentId: z.uuid(),
2884
+ nodeId: z.string().min(1),
2885
+ version: z.number().int().positive(),
2886
+ state: z.literal("ready"),
2887
+ origin: z.url(),
2888
+ openUrl: z.string().startsWith("/c/")
2889
+ });
2755
2890
  z.object({
2756
2891
  protocol: z.literal(1),
2757
2892
  type: z.literal("enhance.prototype.capture"),
@@ -2765,6 +2900,17 @@ z.object({
2765
2900
  protocol: z.literal(1),
2766
2901
  type: z.literal("enhance.prototype.escape")
2767
2902
  });
2903
+ z.object({
2904
+ protocol: z.literal(1),
2905
+ type: z.literal("enhance.prototype.navigate"),
2906
+ direction: z.enum(["back", "forward"])
2907
+ });
2908
+ z.object({
2909
+ protocol: z.literal(1),
2910
+ type: z.literal("enhance.prototype.navigation"),
2911
+ canGoBack: z.boolean(),
2912
+ canGoForward: z.boolean()
2913
+ });
2768
2914
  const capturedPrototypeScreenSchema = z.object({
2769
2915
  artifact: z.string().min(1),
2770
2916
  viewport: z.object({
@@ -3638,83 +3784,101 @@ var PartialBatchError = class extends CliError {
3638
3784
  };
3639
3785
  //#endregion
3640
3786
  //#region src/application/publish-prototype.composite.ts
3641
- const UPLOAD_CONCURRENCY = 8;
3787
+ const PUBLISH_WAIT_MS = 3e5;
3788
+ const INITIAL_POLL_MS = 50;
3789
+ const MAX_POLL_MS = 1e3;
3642
3790
  const PUBLISH_PROTOTYPE_PROCEDURES = [
3643
- "prototype.create",
3644
- "prototype.reserveUploads",
3645
- "prototype.complete"
3791
+ "prototype.getArtifactCapabilities",
3792
+ "prototype.createArtifact",
3793
+ "prototype.submitArtifact",
3794
+ "prototype.getPublishStatus",
3795
+ "prototype.attach"
3646
3796
  ];
3647
3797
  const invalidResponse$2 = (operation) => new CliError("INTERNAL", `The API returned an invalid prototype ${operation} response.`, "Run `enhance doctor`; report the API and CLI versions if they differ.");
3648
- const filesFor = (sources) => sources.map((file) => ({
3649
- path: file.path,
3650
- contentType: file.contentType,
3651
- bytes: file.body.byteLength
3652
- }));
3653
- const uploadPage = async (remote, sources, uploads) => {
3654
- for (let offset = 0; offset < uploads.length; offset += UPLOAD_CONCURRENCY) await Promise.all(uploads.slice(offset, offset + UPLOAD_CONCURRENCY).map(async (reserved) => {
3655
- const source = sources.get(reserved.path);
3656
- if (source === void 0) throw invalidResponse$2("upload reservation");
3657
- await remote.upload({
3658
- url: reserved.upload.url,
3659
- headers: reserved.upload.headers,
3660
- body: source.body
3661
- });
3662
- }));
3663
- };
3664
- const readFiles = async (files, input) => {
3665
- const sources = await files.read(input.directory);
3666
- return {
3667
- sources,
3668
- uploadedFiles: filesFor(sources)
3669
- };
3670
- };
3671
- const uploadDeployment = async (remote, input, deploymentId, sources) => {
3672
- const byPath = new Map(sources.map((source) => [source.path, source]));
3673
- let cursor = 0;
3674
- while (cursor !== null) {
3675
- const reserved = reservePrototypeUploadsOutputSchema.safeParse(await remote.mutate(PUBLISH_PROTOTYPE_PROCEDURES[1], {
3676
- canvasId: input.canvasId,
3677
- deploymentId,
3678
- cursor
3679
- }));
3680
- if (!reserved.success) throw invalidResponse$2("upload reservation");
3681
- await uploadPage(remote, byPath, reserved.data.uploads);
3682
- cursor = reserved.data.nextCursor ?? null;
3798
+ const waitUntilSettled = async (remote, input) => {
3799
+ const deadline = Date.now() + PUBLISH_WAIT_MS;
3800
+ let pollMs = INITIAL_POLL_MS;
3801
+ while (Date.now() < deadline) {
3802
+ const parsed = getPrototypePublishStatusOutputSchema.safeParse(await remote.query(PUBLISH_PROTOTYPE_PROCEDURES[3], input));
3803
+ if (!parsed.success) throw invalidResponse$2("status");
3804
+ if (parsed.data.state === "ready" || parsed.data.state === "failed") return parsed.data;
3805
+ if (parsed.data.state === "abandoned") throw new CliError("NOT_FOUND", `Prototype deployment ${input.deploymentId} was abandoned.`, "Publish the directory again with a new client token.");
3806
+ await setTimeout(pollMs);
3807
+ pollMs = Math.min(pollMs * 2, MAX_POLL_MS);
3683
3808
  }
3809
+ throw new Error("prototype ingestion is still running");
3684
3810
  };
3685
- const executePublish = async (remote, files, input) => {
3686
- const { sources, uploadedFiles } = await readFiles(files, input);
3687
- const created = createPrototypeDeploymentOutputSchema.safeParse(await remote.mutate(PUBLISH_PROTOTYPE_PROCEDURES[0], {
3811
+ const reserveAndUpload = async (remote, input, artifact, reserved) => {
3812
+ const created = createPrototypeArtifactOutputSchema.safeParse(await remote.mutate(PUBLISH_PROTOTYPE_PROCEDURES[1], {
3688
3813
  canvasId: input.canvasId,
3689
3814
  ...input.prototypeId !== null && { prototypeId: input.prototypeId },
3690
3815
  clientToken: input.clientToken,
3691
3816
  nodeId: input.nodeId,
3692
3817
  title: input.title,
3693
- entryPath: input.entryPath,
3694
- files: uploadedFiles,
3818
+ entryPath: artifact.manifest.entryPath,
3819
+ artifact: artifact.identity,
3695
3820
  box: input.box
3696
3821
  }));
3697
- if (!created.success) throw invalidResponse$2("creation");
3822
+ if (!created.success) throw invalidResponse$2("artifact creation");
3823
+ reserved(created.data.deploymentId);
3824
+ if (created.data.state === "uploading") await remote.upload({
3825
+ url: created.data.upload.url,
3826
+ headers: created.data.upload.headers,
3827
+ body: artifact.open()
3828
+ });
3829
+ if (created.data.state === "uploading" || created.data.state === "queued") {
3830
+ if (!submitPrototypeArtifactOutputSchema.safeParse(await remote.mutate(PUBLISH_PROTOTYPE_PROCEDURES[2], {
3831
+ canvasId: input.canvasId,
3832
+ deploymentId: created.data.deploymentId
3833
+ })).success) throw invalidResponse$2("artifact submission");
3834
+ }
3835
+ return created.data;
3836
+ };
3837
+ const requireSuccessfulIngestion = (status) => {
3838
+ if (status.state !== "failed") return;
3839
+ const { failure } = status;
3840
+ throw new CliError("BAD_REQUEST", failure.message, "Fix the build and publish it with a new client token.", failure.path === void 0 ? void 0 : { path: failure.path });
3841
+ };
3842
+ const executePublish = async (remote, artifacts, input) => {
3843
+ const capabilities = getPrototypeArtifactCapabilitiesOutputSchema.safeParse(await remote.query(PUBLISH_PROTOTYPE_PROCEDURES[0], {}));
3844
+ if (!capabilities.success) throw invalidResponse$2("capabilities");
3845
+ const artifact = await artifacts.package({
3846
+ directory: input.directory,
3847
+ entryPath: input.entryPath,
3848
+ limits: capabilities.data.limits
3849
+ });
3850
+ const progress = { deploymentId: null };
3698
3851
  try {
3699
- if (created.data.state !== "ready") await uploadDeployment(remote, input, created.data.deploymentId, sources);
3700
- const completed = completePrototypeDeploymentOutputSchema.safeParse(await remote.mutate(PUBLISH_PROTOTYPE_PROCEDURES[2], {
3852
+ const created = await reserveAndUpload(remote, input, artifact, (reservedId) => {
3853
+ progress.deploymentId = reservedId;
3854
+ });
3855
+ const status = await waitUntilSettled(remote, {
3856
+ canvasId: input.canvasId,
3857
+ deploymentId: created.deploymentId
3858
+ });
3859
+ requireSuccessfulIngestion(status);
3860
+ const attached = attachPrototypeArtifactOutputSchema.safeParse(await remote.mutate(PUBLISH_PROTOTYPE_PROCEDURES[4], {
3701
3861
  canvasId: input.canvasId,
3702
- deploymentId: created.data.deploymentId,
3862
+ deploymentId: created.deploymentId,
3703
3863
  baseVersion: input.baseVersion
3704
3864
  }));
3705
- if (!completed.success) throw invalidResponse$2("completion");
3865
+ if (!attached.success) throw invalidResponse$2("attachment");
3706
3866
  return {
3707
- ...completed.data,
3708
- fileCount: created.data.fileCount,
3709
- totalBytes: created.data.totalBytes,
3710
- alreadyExists: created.data.alreadyExists,
3711
- next: [completed.data.openUrl, `enhance canvas render --canvas ${input.canvasId} --node-id ${completed.data.nodeId} --expected-version ${String(completed.data.version)}`]
3867
+ ...attached.data,
3868
+ fileCount: status.fileCount,
3869
+ totalBytes: status.totalBytes,
3870
+ alreadyExists: created.alreadyExists,
3871
+ next: [attached.data.openUrl, `enhance canvas render --canvas ${input.canvasId} --node-id ${attached.data.nodeId} --expected-version ${String(attached.data.version)}`]
3712
3872
  };
3713
- } catch {
3714
- throw new PartialBatchError(`Prototype deployment ${created.data.deploymentId} was created, but publishing did not complete.`, `Retry 'enhance prototype publish' with the same --client-token ${input.clientToken}.`);
3873
+ } catch (error) {
3874
+ if (error instanceof CliError && (error.code === "BAD_REQUEST" || error.code === "NOT_FOUND")) throw error;
3875
+ if (progress.deploymentId === null) throw error;
3876
+ throw new PartialBatchError(`Prototype deployment ${progress.deploymentId} was created, but publishing did not complete.`, `Retry 'enhance prototype publish' with the same --client-token ${input.clientToken}.`);
3877
+ } finally {
3878
+ await artifact.dispose();
3715
3879
  }
3716
3880
  };
3717
- const createPublishPrototypeComposite = (remote, files) => ({ execute: async (input) => executePublish(remote, files, input) });
3881
+ const createPublishPrototypeComposite = (remote, artifacts) => ({ execute: async (input) => executePublish(remote, artifacts, input) });
3718
3882
  //#endregion
3719
3883
  //#region src/application/recording-fixture.composite.ts
3720
3884
  const CHUNK_LIMIT = 8 * 1048576;
@@ -5991,9 +6155,14 @@ const CLI_EXCLUDED_PROCEDURES = /* @__PURE__ */ new Set([
5991
6155
  "person.signOut",
5992
6156
  "person.signUp",
5993
6157
  "prototype.complete",
6158
+ "prototype.attach",
5994
6159
  "prototype.create",
6160
+ "prototype.createArtifact",
6161
+ "prototype.getArtifactCapabilities",
6162
+ "prototype.getPublishStatus",
5995
6163
  "prototype.requestRuntimeTicket",
5996
6164
  "prototype.reserveUploads",
6165
+ "prototype.submitArtifact",
5997
6166
  "telemetry.lifecycle",
5998
6167
  "telemetry.performance",
5999
6168
  "transcript.get"
@@ -6237,7 +6406,7 @@ const DEFAULT_POSITION = 48;
6237
6406
  const DEFAULT_WIDTH = 1440;
6238
6407
  const DEFAULT_HEIGHT = 900;
6239
6408
  const registerPrototypeProgram = (program, publish, mutationKey, output) => {
6240
- (program.commands.find((command) => command.name() === "prototype") ?? program.command("prototype").description("Publish static frontend prototypes.")).command("publish").description("Upload a built frontend and attach its interactive frame to a canvas.").requiredOption("--canvas-id <uuid>", "Canvas that receives the prototype.").requiredOption("--directory <path>", "Directory whose files should be uploaded.").requiredOption("--title <title>", "Label above the prototype frame.").requiredOption("--base-version <number>", "Current canvas document version.", positiveInteger).option("--prototype-id <uuid>", "Existing prototype identity to publish a new deployment.").option("--client-token <uuid>", "Stable retry token for this exact build.").option("--node-id <id>", "Stable canvas node id for a new prototype.").option("--entry <path>", "HTML entry relative to the uploaded directory.", "index.html").option("--x <pixels>", "Canvas x coordinate.", finiteNumber, DEFAULT_POSITION).option("--y <pixels>", "Canvas y coordinate.", finiteNumber, DEFAULT_POSITION).option("--width <pixels>", "Prototype viewport width.", positiveNumber, DEFAULT_WIDTH).option("--height <pixels>", "Prototype viewport height.", positiveNumber, DEFAULT_HEIGHT).action(async (options) => {
6409
+ (program.commands.find((command) => command.name() === "prototype") ?? program.command("prototype").description("Publish static frontend prototypes.")).command("publish").description("Package and publish an unpacked static build directory. The CLI creates the upload artifact.").requiredOption("--canvas-id <uuid>", "Canvas that receives the prototype.").requiredOption("--directory <path>", "Unpacked static build directory; do not pass a ZIP file.").requiredOption("--title <title>", "Label above the prototype frame.").requiredOption("--base-version <number>", "Current canvas document version.", positiveInteger).option("--prototype-id <uuid>", "Existing prototype identity to publish a new deployment.").option("--client-token <uuid>", "Stable retry token for this exact build.").option("--node-id <id>", "Stable canvas node id for a new prototype.").option("--entry <path>", "HTML entry relative to the uploaded directory.", "index.html").option("--x <pixels>", "Canvas x coordinate.", finiteNumber, DEFAULT_POSITION).option("--y <pixels>", "Canvas y coordinate.", finiteNumber, DEFAULT_POSITION).option("--width <pixels>", "Prototype viewport width.", positiveNumber, DEFAULT_WIDTH).option("--height <pixels>", "Prototype viewport height.", positiveNumber, DEFAULT_HEIGHT).action(async (options) => {
6241
6410
  const clientToken = options.clientToken ?? randomUUID();
6242
6411
  mutationKey.select(clientToken, true);
6243
6412
  output.result(await publish.execute({
@@ -6259,7 +6428,95 @@ const registerPrototypeProgram = (program, publish, mutationKey, output) => {
6259
6428
  });
6260
6429
  };
6261
6430
  //#endregion
6262
- //#region src/infrastructure/prototype-files.adapter.ts
6431
+ //#region src/infrastructure/prototype-zip.adapter.ts
6432
+ const NORMALIZED_MTIME = /* @__PURE__ */ new Date("1980-01-01T00:00:00.000Z");
6433
+ const REGULAR_FILE_MODE = 33188;
6434
+ const ZIP64_ENTRY_FLOOR = 65535;
6435
+ const badRequest$1 = (message, remediation) => new CliError("BAD_REQUEST", message, remediation);
6436
+ const hashingTransform = (source, completed) => {
6437
+ const hash = createHash("sha256");
6438
+ let bytes = 0;
6439
+ return new Transform({
6440
+ transform: (chunk, _encoding, callback) => {
6441
+ bytes += chunk.byteLength;
6442
+ hash.update(chunk);
6443
+ callback(null, chunk);
6444
+ },
6445
+ flush: (callback) => {
6446
+ if (bytes !== source.bytes) {
6447
+ callback(/* @__PURE__ */ new Error(`prototype file ${source.path} changed while it was packaged`));
6448
+ return;
6449
+ }
6450
+ completed({
6451
+ path: source.path,
6452
+ contentType: source.contentType,
6453
+ bytes,
6454
+ sha256: hash.digest("hex")
6455
+ });
6456
+ callback();
6457
+ }
6458
+ });
6459
+ };
6460
+ const addManifest = (input) => {
6461
+ const manifest = prototypeArtifactManifestSchema.parse({
6462
+ version: 1,
6463
+ entryPath: input.entryPath,
6464
+ files: input.files.map((file) => input.completed.get(file.path))
6465
+ });
6466
+ const body = Buffer.from(JSON.stringify(manifest), "utf8");
6467
+ if (body.byteLength > input.limits.manifestBytes) throw badRequest$1("The prototype manifest is too large.", `Shorten paths or reduce metadata below ${String(input.limits.manifestBytes)} bytes.`);
6468
+ input.zip.addBuffer(body, PROTOTYPE_ARTIFACT_MANIFEST_PATH, {
6469
+ mtime: NORMALIZED_MTIME,
6470
+ mode: REGULAR_FILE_MODE,
6471
+ compress: true,
6472
+ forceDosTimestamp: true
6473
+ });
6474
+ input.zip.end({
6475
+ forceZip64Format: input.files.length >= ZIP64_ENTRY_FLOOR,
6476
+ comment: ""
6477
+ });
6478
+ return manifest;
6479
+ };
6480
+ const createPrototypeZipAdapter = async (input) => {
6481
+ const zip = new ZipFile();
6482
+ const hash = createHash("sha256");
6483
+ const hashing = new Transform({ transform: (chunk, _encoding, callback) => {
6484
+ hash.update(chunk);
6485
+ callback(null, chunk);
6486
+ } });
6487
+ const completed = /* @__PURE__ */ new Map();
6488
+ const packaged = { manifest: null };
6489
+ const output = pipeline(zip.outputStream, hashing, createWriteStream(input.artifactPath));
6490
+ zip.on("error", (error) => hashing.destroy(error instanceof Error ? error : /* @__PURE__ */ new Error("prototype ZIP failed")));
6491
+ const complete = (file) => {
6492
+ completed.set(file.path, file);
6493
+ if (packaged.manifest === null && completed.size === input.files.length) packaged.manifest = addManifest({
6494
+ zip,
6495
+ completed,
6496
+ ...input
6497
+ });
6498
+ };
6499
+ for (const source of input.files) zip.addReadStreamLazy(source.path, {
6500
+ size: source.bytes,
6501
+ mtime: NORMALIZED_MTIME,
6502
+ mode: REGULAR_FILE_MODE,
6503
+ compress: true,
6504
+ forceDosTimestamp: true
6505
+ }, (callback) => {
6506
+ callback(null, createReadStream(source.absolutePath).pipe(hashingTransform(source, complete)));
6507
+ });
6508
+ await output;
6509
+ if (packaged.manifest === null) throw new Error("prototype ZIP completed without a manifest");
6510
+ const artifactStats = await stat(input.artifactPath);
6511
+ if (artifactStats.size > input.limits.artifactBytes) throw badRequest$1("The packaged prototype artifact is too large.", `This environment accepts ${String(input.limits.artifactBytes)} compressed bytes.`);
6512
+ return {
6513
+ manifest: packaged.manifest,
6514
+ bytes: artifactStats.size,
6515
+ sha256: hash.digest("hex")
6516
+ };
6517
+ };
6518
+ //#endregion
6519
+ //#region src/infrastructure/prototype-artifact.adapter.ts
6263
6520
  const CONTENT_TYPES = {
6264
6521
  ".avif": "image/avif",
6265
6522
  ".css": "text/css; charset=utf-8",
@@ -6295,37 +6552,93 @@ const statsFor = async (filePath) => {
6295
6552
  return null;
6296
6553
  }
6297
6554
  };
6298
- const walk = async (root, directory, ancestors) => {
6555
+ const byteLength = (value) => Buffer.byteLength(value, "utf8");
6556
+ const badRequest = (message, remediation) => new CliError("BAD_REQUEST", message, remediation);
6557
+ const validatePath = (relativePath, limits) => {
6558
+ if (!prototypeArtifactPathSchema.safeParse(relativePath).success) throw badRequest(`Cannot package the prototype path ${relativePath}.`, "Use portable relative NFC paths outside the reserved __enhance directory.");
6559
+ if (byteLength(relativePath) > limits.pathBytes) throw badRequest(`The prototype path ${relativePath} is too long.`, `Shorten it to at most ${String(limits.pathBytes)} UTF-8 bytes.`);
6560
+ };
6561
+ const walk = async (root, directory, ancestors, limits) => {
6299
6562
  const resolvedDirectory = await realpath(directory);
6300
- if (ancestors.has(resolvedDirectory)) throw new CliError("BAD_REQUEST", `Cannot upload the circular directory link at ${directory}.`, "Pass a directory tree that can be read once from top to bottom.");
6563
+ if (ancestors.has(resolvedDirectory)) throw badRequest(`Cannot package the circular directory link at ${directory}.`, "Pass a directory tree that can be read once from top to bottom.");
6301
6564
  const nextAncestors = new Set(ancestors).add(resolvedDirectory);
6302
- const readEntries = await readdir(directory, { withFileTypes: true });
6565
+ const { readdir } = await import("node:fs/promises");
6566
+ const entries = await readdir(directory, { withFileTypes: true });
6303
6567
  const files = [];
6304
- for (const entry of readEntries) {
6305
- const absolute = path.join(directory, entry.name);
6306
- const stats = await statsFor(absolute);
6568
+ const orderedEntries = entries.toSorted((left, right) => left.name.localeCompare(right.name));
6569
+ for (const entry of orderedEntries) {
6570
+ const absolutePath = path.join(directory, entry.name);
6571
+ const stats = await statsFor(absolutePath);
6307
6572
  if (stats?.isDirectory() === true) {
6308
- files.push(...await walk(root, absolute, nextAncestors));
6573
+ files.push(...await walk(root, absolutePath, nextAncestors, limits));
6309
6574
  continue;
6310
6575
  }
6311
- if (stats?.isFile() !== true) throw new CliError("BAD_REQUEST", `Cannot read ${absolute} as an uploadable file.`, "Pass a directory containing regular files.");
6312
- const relativePath = path.relative(root, absolute).split(path.sep).join("/");
6313
- const body = await readFile(absolute);
6576
+ if (stats?.isFile() !== true) throw badRequest(`Cannot read ${absolutePath} as a prototype file.`, "Pass a directory containing only regular files and directory links.");
6577
+ const relativePath = path.relative(root, absolutePath).split(path.sep).join("/").normalize("NFC");
6578
+ validatePath(relativePath, limits);
6314
6579
  files.push({
6580
+ absolutePath,
6315
6581
  path: relativePath,
6316
- contentType: contentTypeOf(absolute),
6317
- body
6582
+ bytes: Number(stats.size),
6583
+ contentType: contentTypeOf(absolutePath)
6318
6584
  });
6319
6585
  }
6320
6586
  return files;
6321
6587
  };
6322
- const createPrototypeFilesAdapter = () => ({ read: async (directory) => {
6323
- const root = path.resolve(directory);
6324
- const stats = await statsFor(root);
6325
- if (stats === null) throw new CliError("NOT_FOUND", `The prototype directory ${root} does not exist.`, "Build the app or pass the correct build directory.");
6326
- if (!stats.isDirectory()) throw new CliError("BAD_REQUEST", `${root} is not a directory.`, "Pass the directory produced by the frontend build.");
6327
- return walk(root, root, /* @__PURE__ */ new Set());
6328
- } });
6588
+ const validateSources = (files, entryPath, limits) => {
6589
+ if (files.length === 0) throw badRequest("The prototype build is empty.", "Build the app before publishing it.");
6590
+ if (files.length > limits.fileCount) throw badRequest(`The prototype has ${String(files.length)} files.`, `This environment currently accepts ${String(limits.fileCount)} files per deployment.`);
6591
+ const folded = /* @__PURE__ */ new Set();
6592
+ let totalBytes = 0;
6593
+ for (const file of files) {
6594
+ const key = foldPrototypeArtifactPath(file.path);
6595
+ if (folded.has(key)) throw badRequest(`The prototype path ${file.path} collides by case or Unicode normalization.`, "Rename one of the colliding files so the build is portable.");
6596
+ folded.add(key);
6597
+ if (file.bytes > limits.fileBytes) throw badRequest(`The prototype file ${file.path} is too large.`, `This environment accepts ${String(limits.fileBytes)} bytes in one runtime file.`);
6598
+ totalBytes += file.bytes;
6599
+ if (totalBytes > limits.expandedBytes) throw badRequest("The prototype build is too large.", `This environment accepts ${String(limits.expandedBytes)} expanded bytes.`);
6600
+ }
6601
+ const entry = files.find((file) => file.path === entryPath);
6602
+ if (entry === void 0) throw badRequest(`The prototype entry ${entryPath} is missing.`, "Pass --entry with an HTML file inside the build directory.");
6603
+ if (!entry.contentType.startsWith("text/html")) throw badRequest(`The prototype entry ${entryPath} is not HTML.`, "Pass an HTML entry file such as index.html.");
6604
+ };
6605
+ const packageArtifact = async (input) => {
6606
+ const root = path.resolve(input.directory);
6607
+ const rootStats = await statsFor(root);
6608
+ if (rootStats === null) throw new CliError("NOT_FOUND", `The prototype directory ${root} does not exist.`, "Build the app or pass the correct unpacked build directory.");
6609
+ if (!rootStats.isDirectory()) throw badRequest(`${root} is not an unpacked build directory.`, "Pass the build directory; the CLI creates the ZIP artifact automatically.");
6610
+ const entryPath = input.entryPath.split(path.sep).join("/").normalize("NFC");
6611
+ validatePath(entryPath, input.limits);
6612
+ const files = await walk(root, root, /* @__PURE__ */ new Set(), input.limits);
6613
+ validateSources(files, entryPath, input.limits);
6614
+ const tempDirectory = await mkdtemp(path.join(tmpdir(), "enhance-prototype-artifact-"));
6615
+ const artifactPath = path.join(tempDirectory, "artifact.zip");
6616
+ try {
6617
+ const packaged = await createPrototypeZipAdapter({
6618
+ artifactPath,
6619
+ files,
6620
+ entryPath,
6621
+ limits: input.limits
6622
+ });
6623
+ return {
6624
+ identity: {
6625
+ protocolVersion: 1,
6626
+ format: "zip",
6627
+ bytes: packaged.bytes,
6628
+ sha256: packaged.sha256,
6629
+ fileCount: packaged.manifest.files.length,
6630
+ expandedBytes: packaged.manifest.files.reduce((total, file) => total + file.bytes, 0)
6631
+ },
6632
+ manifest: packaged.manifest,
6633
+ open: () => createReadStream(artifactPath),
6634
+ dispose: async () => rm(tempDirectory, { recursive: true })
6635
+ };
6636
+ } catch (error) {
6637
+ await rm(tempDirectory, { recursive: true });
6638
+ throw error;
6639
+ }
6640
+ };
6641
+ const createPrototypeArtifactAdapter = () => ({ package: packageArtifact });
6329
6642
  //#endregion
6330
6643
  //#region src/application/snapshot-recording.composite.ts
6331
6644
  const POLL_MS = 250;
@@ -8887,7 +9200,101 @@ const runtimeTicketProcedure = (handlers) => canvasReaderProcedure.input(request
8887
9200
  expiresAt: issued.ticket.expiresAt.toISOString()
8888
9201
  };
8889
9202
  });
9203
+ const artifactCapabilitiesProcedure = (handlers) => agentProcedure.input(getPrototypeArtifactCapabilitiesInputSchema).output(getPrototypeArtifactCapabilitiesOutputSchema).query(() => ({
9204
+ protocolVersion: 1,
9205
+ format: "zip",
9206
+ limits: handlers.artifactPublishing.capabilities()
9207
+ }));
9208
+ const createArtifactProcedure = (handlers) => agentCanvasEditorProcedure.input(createPrototypeArtifactInputSchema).output(createPrototypeArtifactOutputSchema).mutation(async ({ input, ctx }) => {
9209
+ const created = orThrow(await handlers.artifactPublishing.create({
9210
+ ...input,
9211
+ prototypeId: input.prototypeId ?? null,
9212
+ personId: agentPersonId(ctx.viewer)
9213
+ }));
9214
+ const response = {
9215
+ prototypeId: created.prototype.id,
9216
+ deploymentId: created.deployment.id,
9217
+ nodeId: created.prototype.nodeId,
9218
+ alreadyExists: created.alreadyExists,
9219
+ artifact: created.deployment.artifact
9220
+ };
9221
+ if (created.deployment.state !== "uploading") return {
9222
+ ...response,
9223
+ state: created.deployment.state
9224
+ };
9225
+ if (created.upload === null) throw new TypeError("an uploading artifact has no upload");
9226
+ return {
9227
+ ...response,
9228
+ state: created.deployment.state,
9229
+ upload: {
9230
+ ...created.upload,
9231
+ expiresAt: created.upload.expiresAt.toISOString()
9232
+ }
9233
+ };
9234
+ });
9235
+ const submitArtifactProcedure = (handlers) => agentCanvasEditorProcedure.input(submitPrototypeArtifactInputSchema).output(submitPrototypeArtifactOutputSchema).mutation(async ({ input, ctx }) => {
9236
+ const deployment = orThrow(await handlers.artifactPublishing.submit({
9237
+ ...input,
9238
+ personId: agentPersonId(ctx.viewer)
9239
+ }));
9240
+ return {
9241
+ deploymentId: deployment.id,
9242
+ state: deployment.state
9243
+ };
9244
+ });
9245
+ const artifactStatusProcedure = (handlers) => agentCanvasEditorProcedure.input(getPrototypePublishStatusInputSchema).output(getPrototypePublishStatusOutputSchema).query(async ({ input, ctx }) => {
9246
+ const status = orThrow(await handlers.artifactPublishing.status({
9247
+ ...input,
9248
+ personId: agentPersonId(ctx.viewer)
9249
+ }));
9250
+ const response = {
9251
+ prototypeId: status.prototype.id,
9252
+ deploymentId: status.deployment.id,
9253
+ nodeId: status.prototype.nodeId,
9254
+ fileCount: status.deployment.artifact.fileCount,
9255
+ totalBytes: status.deployment.artifact.expandedBytes,
9256
+ processedFiles: status.deployment.processedFiles
9257
+ };
9258
+ if (status.deployment.state !== "failed") return {
9259
+ ...response,
9260
+ state: status.deployment.state
9261
+ };
9262
+ const failure = status.deployment.failure;
9263
+ if (failure === null) throw new TypeError("a failed artifact has no failure");
9264
+ return {
9265
+ ...response,
9266
+ state: status.deployment.state,
9267
+ failure: {
9268
+ code: failure.code,
9269
+ message: failure.message,
9270
+ ...failure.path !== null && { path: failure.path }
9271
+ }
9272
+ };
9273
+ });
9274
+ const attachArtifactProcedure = (handlers) => agentCanvasEditorProcedure.input(attachPrototypeArtifactInputSchema).output(attachPrototypeArtifactOutputSchema).mutation(async ({ input, ctx }) => {
9275
+ const publisher = agentPublisher(ctx.viewer);
9276
+ const completed = orThrow(await handlers.upload.complete({
9277
+ ...input,
9278
+ ...publisher
9279
+ }));
9280
+ const origin = handlers.runtimeConfig.originFor(completed.deployment.id);
9281
+ return {
9282
+ canvasId: input.canvasId,
9283
+ prototypeId: completed.prototype.id,
9284
+ deploymentId: completed.deployment.id,
9285
+ nodeId: completed.prototype.nodeId,
9286
+ version: completed.version,
9287
+ state: "ready",
9288
+ origin,
9289
+ openUrl: `/c/${input.canvasId}?prototype=${completed.prototype.id}`
9290
+ };
9291
+ });
8890
9292
  const createPrototypeRouter = (handlers) => trpcRouter({
9293
+ getArtifactCapabilities: artifactCapabilitiesProcedure(handlers),
9294
+ createArtifact: createArtifactProcedure(handlers),
9295
+ submitArtifact: submitArtifactProcedure(handlers),
9296
+ getPublishStatus: artifactStatusProcedure(handlers),
9297
+ attach: attachArtifactProcedure(handlers),
8891
9298
  create: createProcedure(handlers),
8892
9299
  reserveUploads: reserveProcedure(handlers),
8893
9300
  complete: completeProcedure(handlers),
@@ -9408,6 +9815,12 @@ const handlers = {
9408
9815
  },
9409
9816
  prototype: {
9410
9817
  publishing: { create: unavailable.execute },
9818
+ artifactPublishing: {
9819
+ capabilities: unavailable.execute,
9820
+ create: unavailable.execute,
9821
+ submit: unavailable.execute,
9822
+ status: unavailable.execute
9823
+ },
9411
9824
  upload: {
9412
9825
  reserve: unavailable.execute,
9413
9826
  complete: unavailable.execute
@@ -9553,7 +9966,7 @@ const registerUtilityPrograms = (program, input) => {
9553
9966
  mutationKey: input.mutationKey,
9554
9967
  output: input.output
9555
9968
  });
9556
- registerPrototypeProgram(program, createPublishPrototypeComposite(input.remote, createPrototypeFilesAdapter()), input.mutationKey, input.output);
9969
+ registerPrototypeProgram(program, createPublishPrototypeComposite(input.remote, createPrototypeArtifactAdapter()), input.mutationKey, input.output);
9557
9970
  registerTranscriptProgram(program, {
9558
9971
  remote: input.remote,
9559
9972
  output: input.output
@@ -9605,7 +10018,7 @@ const createCliProgram = (input) => {
9605
10018
  const configuredDirectory = process.env["ENHANCE3_CONFIG_DIR"];
9606
10019
  const configuredApi = process.env["ENHANCE3_API_URL"];
9607
10020
  const CLI_CONFIG = {
9608
- apiUrl: configuredApi === void 0 || configuredApi === "" ? "http://localhost:3000" : configuredApi,
10021
+ apiUrl: configuredApi === void 0 || configuredApi === "" ? "https://api.enhancelabs.ai" : configuredApi,
9609
10022
  configDirectory: configuredDirectory === void 0 || configuredDirectory === "" ? path.join(homedir(), ".config", "enhance") : configuredDirectory
9610
10023
  };
9611
10024
  //#endregion
@@ -9679,11 +10092,15 @@ const createHttpRemoteAdapter = (apiUrl, credentials, mutationKey) => {
9679
10092
  mutate: async (procedure, input) => clientFor(normalized, await credentials.read(), mutationKey.current(procedure, input)).mutation(procedure, input),
9680
10093
  download,
9681
10094
  upload: async (input) => {
9682
- const response = await fetch(input.url, {
10095
+ const isStreaming = !(input.body instanceof Uint8Array);
10096
+ const body = isStreaming ? Readable.toWeb(input.body) : input.body;
10097
+ const request = {
9683
10098
  method: "PUT",
9684
10099
  headers: input.headers,
9685
- body: input.body
9686
- });
10100
+ body,
10101
+ ...isStreaming && { duplex: "half" }
10102
+ };
10103
+ const response = await fetch(input.url, request);
9687
10104
  if (!response.ok) throw new CliError("INTERNAL", `Signed upload answered HTTP ${String(response.status)}.`, "Retry the fixture command with the same source file.");
9688
10105
  const etag = response.headers.get("etag");
9689
10106
  if (etag === null || etag === "") throw new CliError("INTERNAL", "Signed upload returned no ETag.", "Report the storage response and stop.");
@@ -9926,7 +10343,7 @@ const main = async () => {
9926
10343
  const credentials = createFileCredentialAdapter(CLI_CONFIG.configDirectory);
9927
10344
  const mutationKey = createMutationKeyAdapter();
9928
10345
  const cli = createCliProgram({
9929
- version: "0.1.2",
10346
+ version: "0.1.4",
9930
10347
  credentials,
9931
10348
  remote: createHttpRemoteAdapter(CLI_CONFIG.apiUrl, credentials, mutationKey),
9932
10349
  mutationKey,
@@ -9945,5 +10362,3 @@ const main = async () => {
9945
10362
  main();
9946
10363
  //#endregion
9947
10364
  export {};
9948
-
9949
- //# sourceMappingURL=main.mjs.map