agentful 0.4.17 → 0.4.19

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
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  mod
34
34
  ));
35
35
 
36
- // ../../mainmvp/cli/node_modules/commander/lib/error.js
36
+ // node_modules/commander/lib/error.js
37
37
  var require_error = __commonJS({
38
- "../../mainmvp/cli/node_modules/commander/lib/error.js"(exports2) {
38
+ "node_modules/commander/lib/error.js"(exports2) {
39
39
  "use strict";
40
40
  var CommanderError2 = class extends Error {
41
41
  /**
@@ -69,9 +69,9 @@ var require_error = __commonJS({
69
69
  }
70
70
  });
71
71
 
72
- // ../../mainmvp/cli/node_modules/commander/lib/argument.js
72
+ // node_modules/commander/lib/argument.js
73
73
  var require_argument = __commonJS({
74
- "../../mainmvp/cli/node_modules/commander/lib/argument.js"(exports2) {
74
+ "node_modules/commander/lib/argument.js"(exports2) {
75
75
  "use strict";
76
76
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
77
77
  var Argument2 = class {
@@ -197,9 +197,9 @@ var require_argument = __commonJS({
197
197
  }
198
198
  });
199
199
 
200
- // ../../mainmvp/cli/node_modules/commander/lib/help.js
200
+ // node_modules/commander/lib/help.js
201
201
  var require_help = __commonJS({
202
- "../../mainmvp/cli/node_modules/commander/lib/help.js"(exports2) {
202
+ "node_modules/commander/lib/help.js"(exports2) {
203
203
  "use strict";
204
204
  var { humanReadableArgName } = require_argument();
205
205
  var Help2 = class {
@@ -612,9 +612,9 @@ var require_help = __commonJS({
612
612
  }
613
613
  });
614
614
 
615
- // ../../mainmvp/cli/node_modules/commander/lib/option.js
615
+ // node_modules/commander/lib/option.js
616
616
  var require_option = __commonJS({
617
- "../../mainmvp/cli/node_modules/commander/lib/option.js"(exports2) {
617
+ "node_modules/commander/lib/option.js"(exports2) {
618
618
  "use strict";
619
619
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
620
620
  var Option2 = class {
@@ -885,9 +885,9 @@ var require_option = __commonJS({
885
885
  }
886
886
  });
887
887
 
888
- // ../../mainmvp/cli/node_modules/commander/lib/suggestSimilar.js
888
+ // node_modules/commander/lib/suggestSimilar.js
889
889
  var require_suggestSimilar = __commonJS({
890
- "../../mainmvp/cli/node_modules/commander/lib/suggestSimilar.js"(exports2) {
890
+ "node_modules/commander/lib/suggestSimilar.js"(exports2) {
891
891
  "use strict";
892
892
  var maxDistance = 3;
893
893
  function editDistance(a, b) {
@@ -966,9 +966,9 @@ var require_suggestSimilar = __commonJS({
966
966
  }
967
967
  });
968
968
 
969
- // ../../mainmvp/cli/node_modules/commander/lib/command.js
969
+ // node_modules/commander/lib/command.js
970
970
  var require_command = __commonJS({
971
- "../../mainmvp/cli/node_modules/commander/lib/command.js"(exports2) {
971
+ "node_modules/commander/lib/command.js"(exports2) {
972
972
  "use strict";
973
973
  var EventEmitter = require("events").EventEmitter;
974
974
  var childProcess = require("child_process");
@@ -3010,9 +3010,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3010
3010
  }
3011
3011
  });
3012
3012
 
3013
- // ../../mainmvp/cli/node_modules/commander/index.js
3013
+ // node_modules/commander/index.js
3014
3014
  var require_commander = __commonJS({
3015
- "../../mainmvp/cli/node_modules/commander/index.js"(exports2) {
3015
+ "node_modules/commander/index.js"(exports2) {
3016
3016
  "use strict";
3017
3017
  var { Argument: Argument2 } = require_argument();
3018
3018
  var { Command: Command2 } = require_command();
@@ -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.19" ? "0.4.19" : null.version;
3048
3048
  brand = {
3049
3049
  name: "agentful",
3050
3050
  // the command users type
@@ -3103,9 +3103,9 @@ var init_branding = __esm({
3103
3103
  }
3104
3104
  });
3105
3105
 
3106
- // ../../mainmvp/cli/node_modules/ignore/index.js
3106
+ // node_modules/ignore/index.js
3107
3107
  var require_ignore = __commonJS({
3108
- "../../mainmvp/cli/node_modules/ignore/index.js"(exports2, module2) {
3108
+ "node_modules/ignore/index.js"(exports2, module2) {
3109
3109
  "use strict";
3110
3110
  function makeArray(subject) {
3111
3111
  return Array.isArray(subject) ? subject : [subject];
@@ -3521,6 +3521,23 @@ function dropEngineFarewell() {
3521
3521
  }
3522
3522
  });
3523
3523
 
3524
+ // src/lib/engineUpdate.ts
3525
+ var UPDATE_OVERRIDE_SOURCE;
3526
+ var init_engineUpdate = __esm({
3527
+ "src/lib/engineUpdate.ts"() {
3528
+ "use strict";
3529
+ UPDATE_OVERRIDE_SOURCE = String.raw`
3530
+ /** Hide the engine's /update. Returns the layer's dispose for api.lifecycle.onDispose. */
3531
+ function hideEngineUpdate(api) {
3532
+ return api.keymap.registerLayer({
3533
+ priority: 1,
3534
+ commands: [{ namespace: 'palette', name: 'opencode.update', hidden: true, run() {} }],
3535
+ })
3536
+ }
3537
+ `;
3538
+ }
3539
+ });
3540
+
3524
3541
  // src/branding/logo.txt
3525
3542
  var logo_default;
3526
3543
  var init_logo = __esm({
@@ -3566,13 +3583,15 @@ function tail(text, max) {
3566
3583
  const s = String(text)
3567
3584
  return s.length <= max ? s : '\u2026' + s.slice(s.length - (max - 1))
3568
3585
  }
3569
- ${FAREWELL_FILTER_SOURCE}
3586
+ ${FAREWELL_FILTER_SOURCE}${UPDATE_OVERRIDE_SOURCE}
3570
3587
  const plugin = {
3571
3588
  id: 'agentful-branding',
3572
3589
  tui(api) {
3573
3590
  // Through safe(): a throw here would make the host roll back the whole
3574
3591
  // plugin, and the design with it \u2014 for the sake of one line on quit.
3575
3592
  safe(() => api.lifecycle.onDispose(dropEngineFarewell))
3593
+ // Same for the /update override: without a keymap api it is just not there.
3594
+ safe(() => api.lifecycle.onDispose(hideEngineUpdate(api)))
3576
3595
 
3577
3596
  const Prompt = api.ui.Prompt
3578
3597
  const HostSlot = api.ui.Slot
@@ -3855,11 +3874,12 @@ var init_plugin = __esm({
3855
3874
  "use strict";
3856
3875
  init_branding();
3857
3876
  init_engineFarewell();
3877
+ init_engineUpdate();
3858
3878
  init_logo();
3859
3879
  }
3860
3880
  });
3861
3881
 
3862
- // ../../mainmvp/cli/node_modules/commander/esm.mjs
3882
+ // node_modules/commander/esm.mjs
3863
3883
  var import_index = __toESM(require_commander(), 1);
3864
3884
  var {
3865
3885
  program,
@@ -4821,7 +4841,7 @@ init_branding();
4821
4841
  var import_node_fs4 = require("fs");
4822
4842
  var import_node_path6 = require("path");
4823
4843
 
4824
- // ../../mainmvp/cli/node_modules/fflate/esm/index.mjs
4844
+ // node_modules/fflate/esm/index.mjs
4825
4845
  var import_module = require("module");
4826
4846
  var require2 = (0, import_module.createRequire)("/");
4827
4847
  var _a;
@@ -5801,28 +5821,7 @@ function announceRequestBody(zipBytes, sha256Hex, mode) {
5801
5821
  function completeRequestBody(uploadId, mode, declaration) {
5802
5822
  return { upload_id: uploadId, mode, clean: true, ...declaration ? { backend_declaration: declaration } : {} };
5803
5823
  }
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
- ]);
5824
+ var PREVIEW_MAX_PAGE_BYTES = 5.5 * 1024 * 1024;
5826
5825
  var SERVER_SKIP_DIRS = /* @__PURE__ */ new Set([
5827
5826
  "node_modules",
5828
5827
  ".git",
@@ -6528,15 +6527,8 @@ var CLASS_BY_EXTENSION = new Map(
6528
6527
  );
6529
6528
  var EMBEDDED_SCAN_CLASSES = /* @__PURE__ */ new Set(["html", "css", "script", "data"]);
6530
6529
  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";
6530
+ function previewTooLarge(rel, bytes2) {
6531
+ return /\.html?$/i.test(baseName(rel)) && bytes2 > PREVIEW_MAX_PAGE_BYTES;
6540
6532
  }
6541
6533
  function classOf(rel) {
6542
6534
  const base = baseName(rel);
@@ -6898,25 +6890,15 @@ function analyzePush(options) {
6898
6890
  });
6899
6891
  }
6900
6892
  }
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));
6893
+ 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
6894
  if (tooLargeForPreview.length > 0) {
6904
6895
  const one = tooLargeForPreview.length === 1;
6905
6896
  warnings.push({
6906
6897
  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.`,
6898
+ 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
6899
  paths: tooLargeForPreview.map((file) => file.path).slice(0, FINDING_PATHS)
6909
6900
  });
6910
6901
  }
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
6902
  const filesOmitted = Math.max(0, measured.length - budgets.fileListCap);
6921
6903
  if (filesOmitted > 0) {
6922
6904
  warnings.push({
@@ -7229,6 +7211,31 @@ async function putZip(ticket, zip, deps) {
7229
7211
  }
7230
7212
  }
7231
7213
 
7214
+ // src/lib/publishedCopy.ts
7215
+ function renderPublishedCopyLine(state) {
7216
+ switch (state) {
7217
+ case "updated":
7218
+ return { kind: "ok", text: "Your published site shows this push too." };
7219
+ case "incomplete":
7220
+ return {
7221
+ kind: "warn",
7222
+ 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."
7223
+ };
7224
+ case "failed":
7225
+ return {
7226
+ kind: "warn",
7227
+ 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."
7228
+ };
7229
+ case "check_failed":
7230
+ return {
7231
+ kind: "warn",
7232
+ 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."
7233
+ };
7234
+ default:
7235
+ return null;
7236
+ }
7237
+ }
7238
+
7232
7239
  // src/lib/pushReport.ts
7233
7240
  init_branding();
7234
7241
  var EXCLUDE_REASON = {
@@ -7830,6 +7837,9 @@ async function pushCommand(opts) {
7830
7837
  console.log("");
7831
7838
  ui.ok(`Live preview: ${ui.url(url)}`);
7832
7839
  ui.info(`Manage in the browser: ${ui.url(`https://app.agentful.dev/workspace/${userId}/${projectId}`)}`);
7840
+ const publishedCopy = renderPublishedCopyLine(upload.published_copy);
7841
+ if (publishedCopy?.kind === "ok") ui.ok(publishedCopy.text);
7842
+ else if (publishedCopy) ui.warn(publishedCopy.text);
7833
7843
  if (declaration) {
7834
7844
  const served = upload.auth?.applied && upload.auth.status !== "failed" && (upload.auth.requested?.length ?? 0) > 0 ? await fetchServedAuthMethods(projectId) : void 0;
7835
7845
  for (const line of renderBackendSyncLines(upload, declaration, served)) {
@@ -8018,7 +8028,7 @@ var import_node_stream = require("stream");
8018
8028
  var import_promises3 = require("stream/promises");
8019
8029
  init_branding();
8020
8030
  var ENGINE_BINARY = "agentful-engine";
8021
- var FALLBACK_ENGINE_VERSION = "v1.18.32";
8031
+ var FALLBACK_ENGINE_VERSION = "v1.19.4";
8022
8032
  function compareVersions(a, b) {
8023
8033
  const pa = a.replace(/^v/, "").split(".").map((n) => parseInt(n, 10) || 0);
8024
8034
  const pb = b.replace(/^v/, "").split(".").map((n) => parseInt(n, 10) || 0);
@@ -8441,12 +8451,11 @@ answer, such as whether a \`.gitignore\` is in effect
8441
8451
  than a source push only where a build produces the output folder; a site
8442
8452
  without a build step is the same upload either way. Never shrink,
8443
8453
  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.
8454
+ - **Pages the preview does not show** (\`preview_file_too_large\` in
8455
+ \`warnings\`): the push goes through, but the preview answers with an
8456
+ error instead of these HTML pages. Say which pages and why, with the
8457
+ wording of the warning, and ask whether to push anyway. Never shrink,
8458
+ convert or split them on your own.
8450
8459
  - **Compatibility findings** (\`"overridable": true\`): fix the cause in the
8451
8460
  code. \`--force\` only when the user asks to try the cloud build anyway.
8452
8461
  - **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.19",
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",