agentful 0.2.2 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.cjs +35 -7
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -3044,7 +3044,7 @@ var VERSION, brand, useColor, wrap, paint, sym, ui;
3044
3044
  var init_branding = __esm({
3045
3045
  "src/branding.ts"() {
3046
3046
  "use strict";
3047
- VERSION = "0.2.2" ? "0.2.2" : null.version;
3047
+ VERSION = "0.2.4" ? "0.2.4" : null.version;
3048
3048
  brand = {
3049
3049
  name: "agentful",
3050
3050
  // the command users type
@@ -6336,6 +6336,25 @@ var CLOUD_AGENT = "agentful-build";
6336
6336
  var LOCAL_AGENT = "local-only";
6337
6337
  var CLOUD_AGENT_PROMPT = `You are the Agentful Cloud build agent: everything you build in this directory targets deployment on Agentful Cloud via \`agentful push\`. Follow the platform contract in AGENTFUL_CLOUD.md strictly \u2014 static files only, no server process, no build-time env vars or secrets. When a push or cloud build fails, diagnose ONLY from the \`agentful push\` output and \`agentful build-status\`; quote the record and never invent causes or settings it does not show. If the user wants development that is not meant for the platform, suggest the ${LOCAL_AGENT} agent (Tab).`;
6338
6338
  var LOCAL_AGENT_PROMPT = "You are in local-only mode: free local development with no cloud deployment target \u2014 any stack is fine. Be clear that this directory will NOT be deployable with `agentful push` unless it satisfies the platform contract in AGENTFUL_CLOUD.md (static files only). If the user asks to deploy or push, check the contract first and say honestly whether the project can ship on the platform; never claim cloud deployability without evidence.";
6339
+ function readAuthFile(path) {
6340
+ try {
6341
+ return (0, import_node_fs11.readFileSync)(path, "utf8");
6342
+ } catch {
6343
+ return null;
6344
+ }
6345
+ }
6346
+ function mergedAuthJson(existingRaw, sessionToken) {
6347
+ let auth = {};
6348
+ if (existingRaw) {
6349
+ try {
6350
+ const parsed = JSON.parse(existingRaw);
6351
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) auth = parsed;
6352
+ } catch {
6353
+ }
6354
+ }
6355
+ auth[PROVIDER_ID] = { apiKey: sessionToken };
6356
+ return JSON.stringify(auth, null, 2);
6357
+ }
6339
6358
  function buildEngineConfig(opts) {
6340
6359
  const models = {};
6341
6360
  for (const entry of opts.catalog.models) models[entry.id] = { name: entry.name };
@@ -6434,9 +6453,8 @@ async function writeEngineSession(session, catalog, localProviders = {}, framewo
6434
6453
  instructionPaths
6435
6454
  });
6436
6455
  (0, import_node_fs11.writeFileSync)((0, import_node_path13.join)(configDir2, "config.json"), JSON.stringify(config, null, 2));
6437
- (0, import_node_fs11.writeFileSync)((0, import_node_path13.join)(dataDir, "auth.json"), JSON.stringify({
6438
- [PROVIDER_ID]: { apiKey: session.token }
6439
- }, null, 2));
6456
+ const authPath2 = (0, import_node_path13.join)(dataDir, "auth.json");
6457
+ (0, import_node_fs11.writeFileSync)(authPath2, mergedAuthJson(readAuthFile(authPath2), session.token));
6440
6458
  const { brandingPluginSource: brandingPluginSource2 } = await Promise.resolve().then(() => (init_plugin(), plugin_exports));
6441
6459
  const pluginPath = (0, import_node_path13.join)(pluginsDir, "agentful-branding.tsx");
6442
6460
  (0, import_node_fs11.writeFileSync)(pluginPath, brandingPluginSource2());
@@ -7028,13 +7046,23 @@ async function upgradeCommand() {
7028
7046
  console.log(banner());
7029
7047
  let latest = "";
7030
7048
  try {
7031
- const manifest = await request(
7032
- `${APP_URL}/cli/engine-manifest.json`,
7049
+ const registry = await request(
7050
+ `https://registry.npmjs.org/${brand.name}/latest`,
7033
7051
  { timeoutMs: 8e3 }
7034
7052
  );
7035
- latest = manifest.latest_cli_version || "";
7053
+ latest = registry.version || "";
7036
7054
  } catch {
7037
7055
  }
7056
+ if (!latest) {
7057
+ try {
7058
+ const manifest = await request(
7059
+ `${APP_URL}/cli/engine-manifest.json`,
7060
+ { timeoutMs: 8e3 }
7061
+ );
7062
+ latest = manifest.latest_cli_version || "";
7063
+ } catch {
7064
+ }
7065
+ }
7038
7066
  if (latest && compareVersions(VERSION, latest) >= 0) {
7039
7067
  ui.ok(`Already on the latest version (v${VERSION}).`);
7040
7068
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentful",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
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",