agentful 0.4.17 → 0.4.18

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 CHANGED
@@ -46,11 +46,9 @@ site, and asks you before it changes a file or pushes.
46
46
  `push` respects your `.gitignore` and always excludes `.git`, `node_modules`,
47
47
  build output and every `.env` file. A push carries at most 25 MiB of files
48
48
  (32 MiB compressed) and 2,000 files, and a static site or a prebuilt upload needs
49
- an `index.html` at its top level. The preview does not deliver every file yet:
50
- images, fonts and PDFs up to about 4.4 MiB each, pages and scripts up to about
51
- 5.5 MiB, and no video or audio. `push` names the files this concerns and uploads
52
- them all the same. `push` checks all of this before it signs you
53
- in or creates a project.
49
+ an `index.html` at its top level. The preview answers an HTML page over about
50
+ 5.5 MiB with an error; `push` names such pages and uploads them all the same.
51
+ `push` checks all of this before it signs you in or creates a project.
54
52
 
55
53
  `agentful push --dry-run` shows that check on its own: what would be uploaded
56
54
  and what is left out, the largest files, identical copies, media embedded in
package/dist/index.cjs CHANGED
@@ -3044,7 +3044,7 @@ var VERSION, brand, useColor, wrap, paint, tuiDesign, sym, ui;
3044
3044
  var init_branding = __esm({
3045
3045
  "src/branding.ts"() {
3046
3046
  "use strict";
3047
- VERSION = "0.4.17" ? "0.4.17" : null.version;
3047
+ VERSION = "0.4.18" ? "0.4.18" : null.version;
3048
3048
  brand = {
3049
3049
  name: "agentful",
3050
3050
  // the command users type
@@ -5801,28 +5801,7 @@ function announceRequestBody(zipBytes, sha256Hex, mode) {
5801
5801
  function completeRequestBody(uploadId, mode, declaration) {
5802
5802
  return { upload_id: uploadId, mode, clean: true, ...declaration ? { backend_declaration: declaration } : {} };
5803
5803
  }
5804
- var PREVIEW_BINARY_MEASURED_PASS_BYTES = 4666163;
5805
- var PREVIEW_MAX_BINARY_BYTES = PREVIEW_BINARY_MEASURED_PASS_BYTES;
5806
- var PREVIEW_MAX_TEXT_BYTES = 5.5 * 1024 * 1024;
5807
- var PREVIEW_BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
5808
- "avif",
5809
- "apng",
5810
- "webp",
5811
- "png",
5812
- "jpg",
5813
- "jpeg",
5814
- "gif",
5815
- "svg",
5816
- "ico",
5817
- "bmp",
5818
- "tiff",
5819
- "woff",
5820
- "woff2",
5821
- "ttf",
5822
- "otf",
5823
- "eot",
5824
- "pdf"
5825
- ]);
5804
+ var PREVIEW_MAX_PAGE_BYTES = 5.5 * 1024 * 1024;
5826
5805
  var SERVER_SKIP_DIRS = /* @__PURE__ */ new Set([
5827
5806
  "node_modules",
5828
5807
  ".git",
@@ -6528,15 +6507,8 @@ var CLASS_BY_EXTENSION = new Map(
6528
6507
  );
6529
6508
  var EMBEDDED_SCAN_CLASSES = /* @__PURE__ */ new Set(["html", "css", "script", "data"]);
6530
6509
  var baseName = (rel) => rel.slice(rel.lastIndexOf("/") + 1);
6531
- var TEXT_CLASSES = /* @__PURE__ */ new Set(["html", "css", "script", "data"]);
6532
- var UNDELIVERED_CLASSES = /* @__PURE__ */ new Set(["image", "font", "document", "video", "audio", "archive"]);
6533
- function previewDelivery(rel, bytes2) {
6534
- const base = baseName(rel);
6535
- const ext = base.includes(".") ? base.slice(base.lastIndexOf(".") + 1).toLowerCase() : "";
6536
- if (PREVIEW_BINARY_EXTENSIONS.has(ext)) return bytes2 > PREVIEW_MAX_BINARY_BYTES ? "too_large" : "ok";
6537
- const cls = classOf(rel);
6538
- if (TEXT_CLASSES.has(cls)) return bytes2 > PREVIEW_MAX_TEXT_BYTES ? "too_large" : "ok";
6539
- return UNDELIVERED_CLASSES.has(cls) || ext === "wasm" ? "not_delivered" : "ok";
6510
+ function previewTooLarge(rel, bytes2) {
6511
+ return /\.html?$/i.test(baseName(rel)) && bytes2 > PREVIEW_MAX_PAGE_BYTES;
6540
6512
  }
6541
6513
  function classOf(rel) {
6542
6514
  const base = baseName(rel);
@@ -6898,25 +6870,15 @@ function analyzePush(options) {
6898
6870
  });
6899
6871
  }
6900
6872
  }
6901
- const servedAsIs = stored.filter((file) => mode === "dist" || framework === "vanilla" || /^(public|static)\//.test(view.stored.get(file.path) ?? ""));
6902
- const tooLargeForPreview = servedAsIs.filter((file) => previewDelivery(file.path, file.bytes) === "too_large").sort((a, b) => b.bytes - a.bytes || byPath(a, b));
6873
+ const tooLargeForPreview = stored.filter((file) => mode === "dist" || framework === "vanilla" || /^(public|static)\//.test(view.stored.get(file.path) ?? "")).filter((file) => previewTooLarge(file.path, file.bytes)).sort((a, b) => b.bytes - a.bytes || byPath(a, b));
6903
6874
  if (tooLargeForPreview.length > 0) {
6904
6875
  const one = tooLargeForPreview.length === 1;
6905
6876
  warnings.push({
6906
6877
  code: "preview_file_too_large",
6907
- message: `${plural(tooLargeForPreview.length, "file is", "files are")} larger than the preview delivers (about ${formatBytes(PREVIEW_MAX_BINARY_BYTES, "down")} for images, fonts and PDFs, about ${formatBytes(PREVIEW_MAX_TEXT_BYTES, "down")} for pages, scripts and other text): ${samplePaths(tooLargeForPreview.map((file) => `${file.path} (${formatBytes(file.bytes)})`))}. ${one ? "It is" : "They are"} uploaded, but the preview answers with an error instead of the file.`,
6878
+ message: `${plural(tooLargeForPreview.length, "page is", "pages are")} larger than the preview delivers (about ${formatBytes(PREVIEW_MAX_PAGE_BYTES, "down")} for an HTML page): ${samplePaths(tooLargeForPreview.map((file) => `${file.path} (${formatBytes(file.bytes)})`))}. ${one ? "It is" : "They are"} uploaded, but the preview answers with an error instead of the page.`,
6908
6879
  paths: tooLargeForPreview.map((file) => file.path).slice(0, FINDING_PATHS)
6909
6880
  });
6910
6881
  }
6911
- const notDeliveredByPreview = servedAsIs.filter((file) => previewDelivery(file.path, file.bytes) === "not_delivered").sort(byPath);
6912
- if (notDeliveredByPreview.length > 0) {
6913
- const one = notDeliveredByPreview.length === 1;
6914
- warnings.push({
6915
- code: "preview_type_not_delivered",
6916
- message: `${plural(notDeliveredByPreview.length, "file is", "files are")} of a kind the preview does not deliver intact (video, audio, archives and other binary formats): ${samplePaths(notDeliveredByPreview.map((file) => file.path))}. ${one ? "It is" : "They are"} uploaded, but ${one ? "it does" : "they do"} not play or open in the preview.`,
6917
- paths: notDeliveredByPreview.map((file) => file.path).slice(0, FINDING_PATHS)
6918
- });
6919
- }
6920
6882
  const filesOmitted = Math.max(0, measured.length - budgets.fileListCap);
6921
6883
  if (filesOmitted > 0) {
6922
6884
  warnings.push({
@@ -7229,6 +7191,31 @@ async function putZip(ticket, zip, deps) {
7229
7191
  }
7230
7192
  }
7231
7193
 
7194
+ // src/lib/publishedCopy.ts
7195
+ function renderPublishedCopyLine(state) {
7196
+ switch (state) {
7197
+ case "updated":
7198
+ return { kind: "ok", text: "Your published site shows this push too." };
7199
+ case "incomplete":
7200
+ return {
7201
+ kind: "warn",
7202
+ text: "Your published site was only partly updated: copying this many files to it ran out of time, so it may show the previous push or a mix of both. The preview shows this push."
7203
+ };
7204
+ case "failed":
7205
+ return {
7206
+ kind: "warn",
7207
+ text: "Your published site was only partly updated: writing to it failed, so it may show the previous push or a mix of both. Push again to retry."
7208
+ };
7209
+ case "check_failed":
7210
+ return {
7211
+ kind: "warn",
7212
+ text: "Could not check whether this project has a published site; if it has one, it still shows the previous push. Push again to retry."
7213
+ };
7214
+ default:
7215
+ return null;
7216
+ }
7217
+ }
7218
+
7232
7219
  // src/lib/pushReport.ts
7233
7220
  init_branding();
7234
7221
  var EXCLUDE_REASON = {
@@ -7830,6 +7817,9 @@ async function pushCommand(opts) {
7830
7817
  console.log("");
7831
7818
  ui.ok(`Live preview: ${ui.url(url)}`);
7832
7819
  ui.info(`Manage in the browser: ${ui.url(`https://app.agentful.dev/workspace/${userId}/${projectId}`)}`);
7820
+ const publishedCopy = renderPublishedCopyLine(upload.published_copy);
7821
+ if (publishedCopy?.kind === "ok") ui.ok(publishedCopy.text);
7822
+ else if (publishedCopy) ui.warn(publishedCopy.text);
7833
7823
  if (declaration) {
7834
7824
  const served = upload.auth?.applied && upload.auth.status !== "failed" && (upload.auth.requested?.length ?? 0) > 0 ? await fetchServedAuthMethods(projectId) : void 0;
7835
7825
  for (const line of renderBackendSyncLines(upload, declaration, served)) {
@@ -8441,12 +8431,11 @@ answer, such as whether a \`.gitignore\` is in effect
8441
8431
  than a source push only where a build produces the output folder; a site
8442
8432
  without a build step is the same upload either way. Never shrink,
8443
8433
  re-encode, move or delete the user's files on your own.
8444
- - **Files the preview does not show** (\`preview_file_too_large\`,
8445
- \`preview_type_not_delivered\` in \`warnings\`): the push goes through, but
8446
- the preview does not deliver these files, so a page that needs one of them
8447
- looks broken there. Say which files and why, with the wording of the
8448
- warning, and ask whether to push anyway. Never shrink, convert or split
8449
- them on your own.
8434
+ - **Pages the preview does not show** (\`preview_file_too_large\` in
8435
+ \`warnings\`): the push goes through, but the preview answers with an
8436
+ error instead of these HTML pages. Say which pages and why, with the
8437
+ wording of the warning, and ask whether to push anyway. Never shrink,
8438
+ convert or split them on your own.
8450
8439
  - **Compatibility findings** (\`"overridable": true\`): fix the cause in the
8451
8440
  code. \`--force\` only when the user asks to try the cloud build anyway.
8452
8441
  - **Files that would be missing on the site:** the warnings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentful",
3
- "version": "0.4.17",
3
+ "version": "0.4.18",
4
4
  "description": "Agentful in your terminal — local development with push-to-cloud previews",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://agentful.dev",