agentful 0.1.2 → 0.1.3

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 +27 -15
  2. package/package.json +2 -2
package/dist/index.cjs CHANGED
@@ -3432,7 +3432,7 @@ var {
3432
3432
  } = import_index.default;
3433
3433
 
3434
3434
  // src/branding.ts
3435
- var VERSION = "0.1.2" ? "0.1.2" : null.version;
3435
+ var VERSION = "0.1.3" ? "0.1.3" : null.version;
3436
3436
  var brand = {
3437
3437
  name: "agentful",
3438
3438
  // the command users type
@@ -5096,7 +5096,7 @@ var IF_NOT_LINKED = 'If the command reports "No Agentful project here", this dir
5096
5096
  var SLASH_COMMANDS = {
5097
5097
  setup: {
5098
5098
  description: `${brand.displayName}: create or link the cloud project for this directory`,
5099
- template: 'Check whether .agentful/project.json exists. If it does, report the linked project title and id and stop. Otherwise ask me for a project title, then run `agentful init --title "<title>"` using the bash tool and report what it created. Do not modify any other project files.'
5099
+ template: 'Check whether .agentful/project.json exists. If it does, report the linked project title and id and stop. Otherwise run `agentful init --title "<name>"` using the bash tool, where <name> is $ARGUMENTS if I gave one, otherwise the current directory name. Report what it created and mention the title I can change it to. Do not modify any other project files.'
5100
5100
  },
5101
5101
  push: {
5102
5102
  description: `${brand.displayName}: deploy this project and get a preview URL`,
@@ -5235,6 +5235,8 @@ async function writeEngineSession(session, catalog, localProviders = {}) {
5235
5235
 
5236
5236
  // src/lib/models.ts
5237
5237
  async function fetchModelCatalog(auth, fallback) {
5238
+ const regionDefaultsToBedrock = fallback.ai_region === "eu" || fallback.ai_region === "de";
5239
+ const isAgenticCapable = (id) => id !== "auto" && !id.includes("bedrock");
5238
5240
  let catalog = null;
5239
5241
  try {
5240
5242
  catalog = await request(`${PB_URL}/api/llm/available-models`, {
@@ -5292,7 +5294,11 @@ async function fetchModelCatalog(auth, fallback) {
5292
5294
  }
5293
5295
  }
5294
5296
  const ids = new Set(entries.map((e) => e.id));
5295
- const defaultModel = catalog.default_model && ids.has(catalog.default_model) ? catalog.default_model : ids.has("auto") ? "auto" : entries[0]?.id || fallback.default_model;
5297
+ let defaultModel = catalog.default_model && ids.has(catalog.default_model) ? catalog.default_model : ids.has("auto") ? "auto" : entries[0]?.id || fallback.default_model;
5298
+ if (regionDefaultsToBedrock && !isAgenticCapable(defaultModel)) {
5299
+ const working = entries.find((e) => isAgenticCapable(e.id));
5300
+ if (working) defaultModel = working.id;
5301
+ }
5296
5302
  return {
5297
5303
  models: entries,
5298
5304
  defaultModel,
@@ -5404,25 +5410,31 @@ function writeLocalProvidersExample() {
5404
5410
  var import_node_fs10 = require("fs");
5405
5411
  var import_node_path11 = require("path");
5406
5412
  var import_node_child_process4 = require("child_process");
5407
- var SEP = "";
5408
- function sqlite(dbPath, sql) {
5409
- const res = (0, import_node_child_process4.spawnSync)("sqlite3", ["-readonly", dbPath, sql], { encoding: "utf8" });
5410
- if (res.status !== 0 || !res.stdout) return null;
5411
- return res.stdout.trim().split("\n").filter(Boolean);
5412
- }
5413
5413
  function lastSessionForDirectory(cwd = process.cwd()) {
5414
5414
  const dbPath = (0, import_node_path11.join)(engineXdg().dataHome, "opencode", "opencode.db");
5415
5415
  if (!(0, import_node_fs10.existsSync)(dbPath)) return null;
5416
5416
  const escaped = cwd.replace(/'/g, "''");
5417
- const rows = sqlite(
5418
- dbPath,
5419
- `SELECT id || char(31) || COALESCE(title, slug, '') FROM session
5417
+ const res = (0, import_node_child_process4.spawnSync)(
5418
+ "sqlite3",
5419
+ [
5420
+ "-readonly",
5421
+ "-json",
5422
+ dbPath,
5423
+ `SELECT id, COALESCE(title, slug, '') AS title FROM session
5420
5424
  WHERE directory = '${escaped}' AND time_archived IS NULL
5421
5425
  ORDER BY COALESCE(time_updated, time_created) DESC LIMIT 1;`
5426
+ ],
5427
+ { encoding: "utf8" }
5422
5428
  );
5423
- if (!rows?.length) return null;
5424
- const [id, title] = rows[0].split(SEP);
5425
- return id ? { id, title: title || "" } : null;
5429
+ if (res.status !== 0 || !res.stdout.trim()) return null;
5430
+ try {
5431
+ const rows = JSON.parse(res.stdout);
5432
+ const row = rows[0];
5433
+ if (!row?.id) return null;
5434
+ return { id: row.id, title: row.title || "" };
5435
+ } catch {
5436
+ return null;
5437
+ }
5426
5438
  }
5427
5439
 
5428
5440
  // src/commands/tui.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agentful",
3
- "version": "0.1.2",
4
- "description": "Agentful in your terminal \u2014 local development with push-to-cloud previews",
3
+ "version": "0.1.3",
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",
7
7
  "bin": {