@bike4mind/cli 4.8.0 → 4.9.0

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 (38) hide show
  1. package/README.md +21 -0
  2. package/bin/bike4mind-cli.mjs +342 -239
  3. package/dist/{AgentHistoryStore-Bvmcy2kf.mjs → AgentHistoryStore-jktM0SmD.mjs} +125 -64
  4. package/dist/{ApiClient-Yp2LPlX3.mjs → ApiClient-CczpydlW.mjs} +3 -3
  5. package/dist/{BubblewrapRuntime-OI4qFPNB.mjs → BubblewrapRuntime-aGfDSJPY.mjs} +2 -2
  6. package/dist/ConfigStore-BAJ4hIHa.mjs +2 -0
  7. package/dist/{ConfigStore-CP1W86Ui.mjs → ConfigStore-CO6kREaL.mjs} +2 -2
  8. package/dist/{Logger-3RbeTZ9o.mjs → Logger-CHKCF5hd.mjs} +3334 -336
  9. package/dist/{SandboxOrchestrator-lpxVEFO7.mjs → SandboxOrchestrator-ULWvuUct.mjs} +1 -1
  10. package/dist/{SandboxRuntimeAdapter-C3xICJtQ.mjs → SandboxRuntimeAdapter-DpDSET-A.mjs} +2 -2
  11. package/dist/{SandboxRuntimeAdapter-u6c_IrjP.mjs → SandboxRuntimeAdapter-FpZRkE6D.mjs} +1 -1
  12. package/dist/{SeatbeltRuntime-Ccd_QbjX.mjs → SeatbeltRuntime-C0GJ3nnY.mjs} +2 -2
  13. package/dist/{WorkItemsClient-D4sFGL9X.mjs → WorkItemsClient-aCxMV_Wm.mjs} +1 -1
  14. package/dist/{buildToolSearch-CqHKSLtG.mjs → buildToolSearch-CbLeZ5wP.mjs} +2 -2
  15. package/dist/commands/acpCommand.mjs +5 -5
  16. package/dist/commands/apiCommand.mjs +1 -1
  17. package/dist/commands/doctorCommand.mjs +2 -2
  18. package/dist/commands/envCommand.mjs +1 -1
  19. package/dist/commands/headlessCommand.mjs +6 -6
  20. package/dist/commands/hostCommand.mjs +1 -1
  21. package/dist/commands/mcpCommand.mjs +3 -3
  22. package/dist/commands/mirrorCommand.mjs +2 -2
  23. package/dist/commands/modelsCommand.mjs +4 -4
  24. package/dist/commands/pluginCommand.mjs +1 -1
  25. package/dist/commands/skillsCommand.mjs +3 -3
  26. package/dist/commands/updateCommand.mjs +2 -2
  27. package/dist/{dist-BPhZ0dCz.mjs → dist-BOxr8LQA.mjs} +138 -2
  28. package/dist/{fit-BOnDsgbk.mjs → fit-BHDTSpfd.mjs} +3 -3
  29. package/dist/index.mjs +288 -30
  30. package/dist/{modelServers-B7zI5XnO.mjs → modelServers-CVufZd1f.mjs} +1 -1
  31. package/dist/{package-WlxLVpUb.mjs → package-TACInPbw.mjs} +1 -1
  32. package/dist/{serve-DpsV0mag.mjs → serve-OywSzShu.mjs} +726 -59
  33. package/dist/{store-xeJRhBtO.mjs → store-CmOg7JIt.mjs} +2 -0
  34. package/dist/store-OGMXhD4A.mjs +2 -0
  35. package/dist/{updateChecker-Boq0RruU.mjs → updateChecker-5v_8LhXy.mjs} +1 -1
  36. package/package.json +12 -12
  37. package/dist/ConfigStore-Bo4od3Eu.mjs +0 -2
  38. package/dist/store-Bpdo9Syo.mjs +0 -2
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { C as NotAuthenticatedError, D as sanitizeTerminalText, d as sandboxedCommandArg, l as commandTextOf, p as writePathOf, s as loadContextFiles, u as isReadOnlyTool, w as SessionRevokedError } from "./ConfigStore-CP1W86Ui.mjs";
3
- import { a as extractErrorMessage, d as BaseStorage, f as isPrivateIP, l as OllamaBackend, n as B4mStreamEndedError, o as getSettingsMap, p as Logger, r as createClient, s as getSettingsValue, t as B4mApiError, u as OpenAICompatibleBackend } from "./dist-BPhZ0dCz.mjs";
4
- import { $t as frontmatterHasSourceStamp, A as DecisionTextPartSchema, B as MODEL_DECLINED_MESSAGE, Dt as obfuscateApiKey, Ft as splitEquals, Gt as withholdsReasoning, H as McpServerName, J as PermissionDeniedError, Mt as secureParameters, P as ExpectedToolError, Pt as signImageUrl, R as LOCATION_MAP_LANGUAGE, St as isRetryableError, T as ChatModels, W as NotFoundError, Wt as withRetry, X as SEARCH_RESULT_CARDS_LANGUAGE, a as htmlFirstH1, bt as isPlaceholderImageSigningSecret, et as UnprocessableEntityError, h as ApiKeyType, ht as googleMapsSearchUrl, i as htmlErrorTitle, it as assertAuthOriginMatchesApiKey, j as DecisionsRequestSchema, kt as reasoningChannelOf, n as SESSION_ID_PATTERN, o as escapeArtifactBodyJson, pt as getMcpProviderMetadata, r as isValidSessionId, rt as WORK_ITEM_STATUSES, st as createReasoningWithholder, t as logger, w as CUSTOM_MCP_DATA_NOTICE, x as CONFIDENCE_GATE_MODES, xt as isProviderRefusalStopReason, yt as isExpectedToolError, z as LOW_CONFIDENCE_COMPLETION_MODES } from "./Logger-3RbeTZ9o.mjs";
2
+ import { C as NotAuthenticatedError, D as sanitizeTerminalText, d as sandboxedCommandArg, l as commandTextOf, p as writePathOf, s as loadContextFiles, u as isReadOnlyTool, w as SessionRevokedError } from "./ConfigStore-CO6kREaL.mjs";
3
+ import { a as extractErrorMessage, d as BaseStorage, f as isPrivateIP, l as OllamaBackend, n as B4mStreamEndedError, o as getSettingsMap, p as Logger, r as createClient, s as getSettingsValue, t as B4mApiError, u as OpenAICompatibleBackend } from "./dist-BOxr8LQA.mjs";
4
+ import { At as isPlaceholderImageSigningSecret, B as LOW_CONFIDENCE_COMPLETION_MODES, Ct as getMcpProviderMetadata, G as NotFoundError, Ht as reasoningChannelOf, I as ExpectedToolError, Jt as signImageUrl, Kt as secureParameters, M as DecisionTextPartSchema, Mt as isRetryableError, N as DecisionsRequestSchema, Rt as obfuscateApiKey, T as ChatModels, Tt as googleMapsSearchUrl, U as McpServerName, V as MODEL_DECLINED_MESSAGE, Y as PermissionDeniedError, Yt as splitEquals, a as htmlFirstH1, an as withholdsReasoning, at as SEARCH_RESULT_CARDS_LANGUAGE, bt as fromCliTodos, ft as WORK_ITEM_STATUSES, gt as createReasoningWithholder, h as ApiKeyType, i as htmlErrorTitle, in as withRetry, jt as isProviderRefusalStopReason, kt as isExpectedToolError, lt as UnprocessableEntityError, n as SESSION_ID_PATTERN, o as escapeArtifactBodyJson, pn as frontmatterHasSourceStamp, pt as assertAuthOriginMatchesApiKey, r as isValidSessionId, t as logger, w as CUSTOM_MCP_DATA_NOTICE, x as CONFIDENCE_GATE_MODES, z as LOCATION_MAP_LANGUAGE } from "./Logger-CHKCF5hd.mjs";
5
5
  import { n as COMMANDS, r as isReservedCommandName } from "./RemoteSkillSource-D_F99yBR.mjs";
6
6
  import { n as isPathAllowed, t as assertPathAllowed } from "./pathValidation-BRqf4HFX-CHwtwp3O.mjs";
7
7
  import { n as isTerminalShellStatus, t as getShellSessionManager } from "./ShellSessionManager-6o8KZzl1-vrbPAUTq.mjs";
8
8
  import { d as detectRuntimes, m as modelBlobsOf } from "./dist-K7a9yOUb.mjs";
9
- import { A as serverRuntimeId, B as parseGenerationInput, Ct as withDefaultOllamaPort, F as GENERATION_FIELDS, H as parseModelContextSetting, I as LOCAL_OLLAMA_RUNTIME_ID, L as REASONING_EFFORT_SETTINGS, R as effortSent, S as desktopUserDataFile, V as parseLocalModelId, X as clean, a as needsCredential, f as serverFetch, i as loginHint, l as resolveServerTarget, m as unusableStatus, r as loadModelServers, y as SSH_PROBE_TIMEOUT_MS, z as localModelId } from "./modelServers-B7zI5XnO.mjs";
9
+ import { A as serverRuntimeId, B as parseGenerationInput, Ct as withDefaultOllamaPort, F as GENERATION_FIELDS, H as parseModelContextSetting, I as LOCAL_OLLAMA_RUNTIME_ID, L as REASONING_EFFORT_SETTINGS, R as effortSent, S as desktopUserDataFile, V as parseLocalModelId, X as clean, a as needsCredential, f as serverFetch, i as loginHint, l as resolveServerTarget, m as unusableStatus, r as loadModelServers, y as SSH_PROBE_TIMEOUT_MS, z as localModelId } from "./modelServers-CVufZd1f.mjs";
10
10
  import { createHash, randomBytes } from "crypto";
11
11
  import { existsSync, lstatSync, promises, readdirSync, realpathSync, rmSync, statSync } from "fs";
12
12
  import os, { homedir } from "os";
@@ -1286,6 +1286,7 @@ var apiKeyService_exports$1 = /* @__PURE__ */ __exportAll$2({
1286
1286
  getApiKey: () => getApiKey,
1287
1287
  getApiKeySchema: () => getApiKeySchema,
1288
1288
  getEffectiveApiKey: () => getEffectiveApiKey,
1289
+ getEffectiveApiKeyWithSource: () => getEffectiveApiKeyWithSource,
1289
1290
  getEffectiveLLMApiKeys: () => getEffectiveLLMApiKeys,
1290
1291
  getFirecrawlConfig: () => getFirecrawlConfig,
1291
1292
  getFmpApiKey: () => getFmpApiKey,
@@ -1298,7 +1299,8 @@ var apiKeyService_exports$1 = /* @__PURE__ */ __exportAll$2({
1298
1299
  listOwnApiKeys: () => listOwnApiKeys,
1299
1300
  setApiKey: () => setApiKey,
1300
1301
  sharedAdminKeyProviders: () => sharedAdminKeyProviders,
1301
- t: () => apiKeyService_exports$2
1302
+ t: () => apiKeyService_exports$2,
1303
+ userKeyProviders: () => userKeyProviders
1302
1304
  });
1303
1305
  const createApiKeySchema = z$1.object({
1304
1306
  apiKey: z$1.string().min(6),
@@ -1408,25 +1410,47 @@ const getFmpApiKey = async (adapters) => {
1408
1410
  const { db } = adapters;
1409
1411
  return (await db.adminSettings.findBySettingName("FmpApiKey"))?.settingValue;
1410
1412
  };
1411
- const getEffectiveApiKey = async (userId, params, adapters) => {
1413
+ /**
1414
+ * getEffectiveApiKey, also reporting whether the key is the user's own or the platform's, so a
1415
+ * usage record can tell platform-quota consumption apart from calls billed to a user's own account.
1416
+ */
1417
+ const getEffectiveApiKeyWithSource = async (userId, params, adapters) => {
1412
1418
  const { db } = adapters;
1413
- let key = (await getApiKey(userId, params, adapters))?.apiKey;
1414
- if (!key) {
1415
- const demoKeyName = params.demoKeyName || DEMO_KEY_MAP[params.type];
1416
- if (demoKeyName) key = (await db.adminSettings.findBySettingName(demoKeyName))?.settingValue;
1417
- }
1418
- if (!key) {
1419
- const envName = ENV_KEY_MAP[params.type];
1420
- if (envName) key = envKey(envName) ?? void 0;
1419
+ const userKey = (await getApiKey(userId, params, adapters))?.apiKey;
1420
+ if (userKey) return {
1421
+ key: userKey,
1422
+ source: "user"
1423
+ };
1424
+ const demoKeyName = params.demoKeyName || DEMO_KEY_MAP[params.type];
1425
+ if (demoKeyName) {
1426
+ const settings = await db.adminSettings.findBySettingName(demoKeyName);
1427
+ if (settings?.settingValue) return {
1428
+ key: settings.settingValue,
1429
+ source: "platform"
1430
+ };
1421
1431
  }
1422
- return key;
1432
+ const envName = ENV_KEY_MAP[params.type];
1433
+ const selfHostKey = envName ? envKey(envName) : null;
1434
+ return selfHostKey ? {
1435
+ key: selfHostKey,
1436
+ source: "platform"
1437
+ } : void 0;
1423
1438
  };
1439
+ const getEffectiveApiKey = async (userId, params, adapters) => (await getEffectiveApiKeyWithSource(userId, params, adapters))?.key;
1424
1440
  const sharedAdminKeySources = /* @__PURE__ */ new WeakMap();
1425
1441
  /**
1426
1442
  * For a result of getEffectiveLLMApiKeys: which providers resolved to the shared admin-setting
1427
1443
  * key (not a user's own key, not 'expired', not a self-host env key). Undefined for any other object.
1428
1444
  */
1429
1445
  const sharedAdminKeyProviders = (keys) => sharedAdminKeySources.get(keys);
1446
+ const userKeySources = /* @__PURE__ */ new WeakMap();
1447
+ /**
1448
+ * For a result of getEffectiveLLMApiKeys: which providers resolved to the user's own saved key
1449
+ * (including an expired one), as opposed to a platform admin-setting or self-host env key. Lets a
1450
+ * caller tell a provider rejecting the user's key (user-side) from one rejecting ours (outage).
1451
+ * Empty for any other object.
1452
+ */
1453
+ const userKeyProviders = (keys) => userKeySources.get(keys) ?? /* @__PURE__ */ new Set();
1430
1454
  const getEffectiveLLMApiKeys = async (userId, adapters, options) => {
1431
1455
  const { db } = adapters;
1432
1456
  const logger = options?.logger;
@@ -1504,6 +1528,18 @@ const getEffectiveLLMApiKeys = async (userId, adapters, options) => {
1504
1528
  openai: !openaiUserKey && !!openaiDemoKey,
1505
1529
  anthropic: !anthropicUserKey && !!anthropicDemoKey
1506
1530
  });
1531
+ const userKeyByProvider = {
1532
+ openai: openaiUserKey,
1533
+ anthropic: anthropicUserKey,
1534
+ gemini: geminiUserKey,
1535
+ bfl: bflUserKey,
1536
+ xai: xaiUserKey,
1537
+ kimi: kimiUserKey,
1538
+ deepseek: deepseekUserKey,
1539
+ voyageai: voyageaiUserKey,
1540
+ typesafe: typesafeUserKey
1541
+ };
1542
+ userKeySources.set(keys, new Set(Object.keys(userKeyByProvider).filter((provider) => userKeyByProvider[provider] !== null)));
1507
1543
  return keys;
1508
1544
  };
1509
1545
  const setApiKeySchema = z$1.object({
@@ -1547,6 +1583,7 @@ var apiKeyService_exports$2 = /* @__PURE__ */ __exportAll({
1547
1583
  getApiKey: () => getApiKey,
1548
1584
  getApiKeySchema: () => getApiKeySchema,
1549
1585
  getEffectiveApiKey: () => getEffectiveApiKey,
1586
+ getEffectiveApiKeyWithSource: () => getEffectiveApiKeyWithSource,
1550
1587
  getEffectiveLLMApiKeys: () => getEffectiveLLMApiKeys,
1551
1588
  getFirecrawlConfig: () => getFirecrawlConfig,
1552
1589
  getFmpApiKey: () => getFmpApiKey,
@@ -1558,7 +1595,8 @@ var apiKeyService_exports$2 = /* @__PURE__ */ __exportAll({
1558
1595
  getWolframAlphaKey: () => getWolframAlphaKey,
1559
1596
  listOwnApiKeys: () => listOwnApiKeys,
1560
1597
  setApiKey: () => setApiKey,
1561
- sharedAdminKeyProviders: () => sharedAdminKeyProviders
1598
+ sharedAdminKeyProviders: () => sharedAdminKeyProviders,
1599
+ userKeyProviders: () => userKeyProviders
1562
1600
  });
1563
1601
  //#endregion
1564
1602
  //#region ../../b4m-core/services/dist/apiKeyService/index.mjs
@@ -2532,7 +2570,7 @@ const WEB_SEARCH_MAP_PROMPT = [
2532
2570
  "explanation or citations. Omit it only if none of the places actually answer the question."
2533
2571
  ].join("\n");
2534
2572
  //#endregion
2535
- //#region ../../b4m-core/services/dist/websearch-CqYLXC6T.mjs
2573
+ //#region ../../b4m-core/services/dist/websearch-Bm2eZQma.mjs
2536
2574
  /**
2537
2575
  * Shown to the model under tool results that carry the turn's shared numbers, so it cites them the
2538
2576
  * way forced retrieval's header asks it to cite the documents numbered before them. Keep it a directive:
@@ -2669,6 +2707,41 @@ function safeImageUrl(value) {
2669
2707
  function dedupeImages(values) {
2670
2708
  return [...new Set(values.filter((v) => !!v))].slice(0, MAX_IMAGES_PER_RESULT);
2671
2709
  }
2710
+ const GOOGLE_HOSTS = /* @__PURE__ */ new Set(["google.com", "www.google.com"]);
2711
+ /** Host of a breadcrumb-style `displayed_link` ("https://host > a > b"), or undefined when it is not a URL. */
2712
+ function breadcrumbHost(displayedLink) {
2713
+ if (typeof displayedLink !== "string" || !displayedLink) return void 0;
2714
+ try {
2715
+ const shown = new URL(displayedLink.trim().split(/[\s\u203a>]/)[0]);
2716
+ return (shown.protocol === "https:" || shown.protocol === "http:") && !GOOGLE_HOSTS.has(shown.hostname) ? shown.hostname : void 0;
2717
+ } catch {
2718
+ return;
2719
+ }
2720
+ }
2721
+ const MAX_PLATFORM_NAME_CHARS = 40;
2722
+ /** Platform name from SerpAPI's `source` ("Reddit \u00b7 r/investing" -> "Reddit"), never a Google name. */
2723
+ function sourcePlatformName(source) {
2724
+ if (typeof source !== "string") return void 0;
2725
+ const name = source.split(/\s\u00b7\s/)[0]?.replace(/[[\]()\r\n]/g, "").trim();
2726
+ return name && !/^google\b/i.test(name) ? name.slice(0, MAX_PLATFORM_NAME_CHARS) : void 0;
2727
+ }
2728
+ /**
2729
+ * SerpAPI can return Google's own redirect (`google.com/goto?url=<opaque token>`) as `link`, which
2730
+ * hides the destination. Returns what to label it with, or undefined for any other link: the host
2731
+ * of the breadcrumb-style `displayed_link` when that is a URL, else the platform name from `source`
2732
+ * for hits whose breadcrumb is an engagement count ("10+ comments", "920+ views"). Only the host is
2733
+ * read from the breadcrumb: its path follows the site's own breadcrumb names, not its URL path, and
2734
+ * is cut short with an ellipsis when long, while the host always comes first and survives both.
2735
+ */
2736
+ function googleRedirectDisplayHost(link, displayedLink, source) {
2737
+ try {
2738
+ const parsed = new URL(link);
2739
+ if (!GOOGLE_HOSTS.has(parsed.hostname) || !/^\/(goto|url)$/.test(parsed.pathname)) return void 0;
2740
+ } catch {
2741
+ return;
2742
+ }
2743
+ return breadcrumbHost(displayedLink) ?? sourcePlatformName(source);
2744
+ }
2672
2745
  /**
2673
2746
  * `inline_images` and `shopping_results` are sibling arrays rather than nested under the organic
2674
2747
  * hits, so they are attached by exact link match only - a positional or same-host guess would
@@ -2992,10 +3065,12 @@ function createSerpApiProvider(adapters) {
2992
3065
  const extraImages = indexImagesByLink(data.inline_images, data.shopping_results);
2993
3066
  return organic.filter((r) => !!r && typeof r.link === "string").map((r) => {
2994
3067
  const images = dedupeImages([...extraImages.get(r.link) ?? [], safeImageUrl(r.thumbnail)]);
3068
+ const displayHost = googleRedirectDisplayHost(r.link, r.displayed_link, r.source);
2995
3069
  return {
2996
3070
  title: r.title ?? r.link,
2997
3071
  url: r.link,
2998
3072
  snippet: r.snippet ?? "",
3073
+ ...displayHost ? { displayHost } : {},
2999
3074
  ...images.length > 0 ? {
3000
3075
  thumbnail: images[0],
3001
3076
  images
@@ -3455,6 +3530,7 @@ async function performWebSearch(adapters, params, imageUrlSigningSecret = "", re
3455
3530
  sourceSystem: "web_search",
3456
3531
  relevanceScore: 1 - index * .1,
3457
3532
  fullContext: result.snippet,
3533
+ ...result.displayHost ? { displayHost: result.displayHost } : {},
3458
3534
  ...withImages && result.thumbnail ? {
3459
3535
  thumbnail: result.thumbnail,
3460
3536
  images: result.images
@@ -3467,7 +3543,7 @@ async function performWebSearch(adapters, params, imageUrlSigningSecret = "", re
3467
3543
  const resultLabel = (index) => numberedCitables ? `[${numberedCitables[index].metadata?.citationIndex}]` : `${index + 1}.`;
3468
3544
  const formattedResults = results.map((result, index) => {
3469
3545
  const imageLine = withImages && result.images?.length ? `Images: ${result.images.map((url) => signImageUrl(url, imageUrlSigningSecret)).join(" | ")}\n` : "";
3470
- return `${resultLabel(index)} **${stripNewlines(result.title)}**\n${stripNewlines(result.snippet)}\n` + imageLine + `Source: [${safeHostname(result.url)}](${result.url})\n`;
3546
+ return `${resultLabel(index)} **${stripNewlines(result.title)}**\n${stripNewlines(result.snippet)}\n` + imageLine + `Source: [${stripNewlines(result.displayHost ?? safeHostname(result.url))}](${result.url})\n`;
3471
3547
  }).join("\n");
3472
3548
  const imageSection = withImages && imageResults.length ? `\n${formatImageResults(imageResults, imageUrlSigningSecret)}\n` : "";
3473
3549
  const placeSection = withPlaces ? `\n${formatPlaceResults(places, anchor, numberedCitables ? citationNumbersById(numberedCitables) : void 0)}\n` : "";
@@ -7759,7 +7835,7 @@ function isWriteTargetingPlanFile(writePath, cwd = process.cwd()) {
7759
7835
  * it and the live mode so they never exceed the parent but still honor a mid-run plan switch.
7760
7836
  */
7761
7837
  async function resolveInteractionMode(override) {
7762
- const { useCliStore } = await import("./store-Bpdo9Syo.mjs");
7838
+ const { useCliStore } = await import("./store-OGMXhD4A.mjs");
7763
7839
  const liveInteractionMode = useCliStore.getState().interactionMode;
7764
7840
  return override ? clampInteractionMode(liveInteractionMode, override) : liveInteractionMode;
7765
7841
  }
@@ -16542,37 +16618,6 @@ function createSkillTool(deps) {
16542
16618
  //#endregion
16543
16619
  //#region src/tools/writeTodosTool.ts
16544
16620
  /**
16545
- * Valid status values for validation
16546
- */
16547
- const VALID_STATUSES = [
16548
- "pending",
16549
- "in_progress",
16550
- "completed",
16551
- "cancelled"
16552
- ];
16553
- /**
16554
- * Validate todo items
16555
- * @throws Error if validation fails
16556
- */
16557
- function validateTodos(todos) {
16558
- if (!Array.isArray(todos)) throw new Error("write_todos: todos must be an array");
16559
- if (todos.length === 0) throw new Error("write_todos: todos array cannot be empty");
16560
- let inProgressCount = 0;
16561
- const validatedTodos = todos.map((item, index) => {
16562
- if (!item || typeof item !== "object") throw new Error(`write_todos: item at index ${index} must be an object`);
16563
- const { description, status } = item;
16564
- if (typeof description !== "string" || description.trim() === "") throw new Error(`write_todos: item at index ${index} must have a non-empty description`);
16565
- if (typeof status !== "string" || !VALID_STATUSES.includes(status)) throw new Error(`write_todos: item at index ${index} has invalid status "${status}". Must be one of: ${VALID_STATUSES.join(", ")}`);
16566
- if (status === "in_progress") inProgressCount++;
16567
- return {
16568
- description: description.trim(),
16569
- status
16570
- };
16571
- });
16572
- if (inProgressCount > 1) throw new Error(`write_todos: only one task can be 'in_progress' at a time, but found ${inProgressCount}`);
16573
- return validatedTodos;
16574
- }
16575
- /**
16576
16621
  * Format todos for display output
16577
16622
  */
16578
16623
  function formatTodosOutput(todos) {
@@ -16584,7 +16629,7 @@ function formatTodosOutput(todos) {
16584
16629
  };
16585
16630
  return todos.map((todo, index) => {
16586
16631
  const emoji = statusEmoji[todo.status];
16587
- return `${index + 1}. ${emoji} [${todo.status}] ${todo.description}`;
16632
+ return `${index + 1}. ${emoji} [${todo.status}] ${todo.content}`;
16588
16633
  }).join("\n");
16589
16634
  }
16590
16635
  /**
@@ -16605,10 +16650,15 @@ function formatTodosOutput(todos) {
16605
16650
  function createWriteTodosTool(todoStore) {
16606
16651
  return {
16607
16652
  toolFn: async (args) => {
16608
- const validatedTodos = validateTodos(args.todos);
16609
- todoStore.todos = validatedTodos;
16610
- if (todoStore.onUpdate) todoStore.onUpdate(validatedTodos);
16611
- return `Todo list updated successfully:\n\n${formatTodosOutput(validatedTodos)}`;
16653
+ const todos = args?.todos;
16654
+ if (!Array.isArray(todos)) throw new Error("write_todos: todos must be an array");
16655
+ const { plan, warnings } = fromCliTodos(todos);
16656
+ const notes = warnings.length > 0 ? `\n\nNotes:\n${warnings.map((w) => `- ${w}`).join("\n")}` : "";
16657
+ if (todos.length > 0 && plan.items.length === 0) throw new Error(`write_todos: no valid todo items; the existing list was kept.${notes}`);
16658
+ todoStore.todos = plan.items;
16659
+ todoStore.onUpdate?.(plan.items);
16660
+ if (plan.items.length === 0) return "Todo list cleared.";
16661
+ return `Todo list updated successfully:\n\n${formatTodosOutput(plan.items)}${notes}`;
16612
16662
  },
16613
16663
  toolSchema: {
16614
16664
  name: "write_todos",
@@ -16622,7 +16672,7 @@ function createWriteTodosTool(todoStore) {
16622
16672
  **Important guidelines:**
16623
16673
  - Call this tool early when receiving complex requests
16624
16674
  - Update the list immediately when starting, completing, or cancelling tasks
16625
- - Only ONE task should be 'in_progress' at a time
16675
+ - Only ONE task should be 'in_progress' at a time (extra ones are reset to pending)
16626
16676
  - Never batch updates - update as soon as state changes
16627
16677
 
16628
16678
  **Status values:**
@@ -16641,13 +16691,19 @@ If asked to "create a new React component with tests", break it down:
16641
16691
  type: "object",
16642
16692
  properties: { todos: {
16643
16693
  type: "array",
16644
- description: "Complete list of todo items. This replaces any existing list. Each item needs a description and status.",
16694
+ description: "Complete list of todo items (at most 50). This replaces any existing list. Each item needs content and a status.",
16645
16695
  items: {
16646
16696
  type: "object",
16647
16697
  properties: {
16648
- description: {
16698
+ content: {
16649
16699
  type: "string",
16650
- description: "Clear, concise description of the task"
16700
+ description: "Clear, concise description of the task (imperative, e.g. \"Run tests\")",
16701
+ maxLength: 200
16702
+ },
16703
+ activeForm: {
16704
+ type: "string",
16705
+ description: "Present-continuous form shown while in progress (e.g. \"Running tests\")",
16706
+ maxLength: 200
16651
16707
  },
16652
16708
  status: {
16653
16709
  type: "string",
@@ -16660,7 +16716,7 @@ If asked to "create a new React component with tests", break it down:
16660
16716
  description: "Current status of the task. Only ONE task can be 'in_progress' at a time."
16661
16717
  }
16662
16718
  },
16663
- required: ["description", "status"]
16719
+ required: ["content", "status"]
16664
16720
  }
16665
16721
  } },
16666
16722
  required: ["todos"]
@@ -16677,6 +16733,11 @@ function createTodoStore(onUpdate) {
16677
16733
  onUpdate
16678
16734
  };
16679
16735
  }
16736
+ /** Empty the plan and tell listeners (the Ink plan block) it is gone. */
16737
+ function resetTodoStore(store) {
16738
+ store.todos = [];
16739
+ store.onUpdate?.([]);
16740
+ }
16680
16741
  //#endregion
16681
16742
  //#region src/tools/findDefinitionTool.ts
16682
16743
  const execFileAsync = promisify(execFile);
@@ -20000,8 +20061,8 @@ async function buildSandbox(input) {
20000
20061
  const { config, sessionId, permissionManager, checkpointStore } = input;
20001
20062
  const log = input.log ?? consoleLog;
20002
20063
  const [{ createSandboxRuntime }, { SandboxOrchestrator }, { DEFAULT_SANDBOX_CONFIG }, { ProxyManager }, { ViolationLogStore }] = await Promise.all([
20003
- import("./SandboxRuntimeAdapter-u6c_IrjP.mjs"),
20004
- import("./SandboxOrchestrator-lpxVEFO7.mjs"),
20064
+ import("./SandboxRuntimeAdapter-FpZRkE6D.mjs"),
20065
+ import("./SandboxOrchestrator-ULWvuUct.mjs"),
20005
20066
  import("./types-BFIvwByC.mjs"),
20006
20067
  import("./ProxyManager-TxEKlgdO.mjs"),
20007
20068
  import("./ViolationLogStore-byEhxa2A.mjs")
@@ -21366,7 +21427,7 @@ var SubagentOrchestrator = class {
21366
21427
  const depth = options.depth ?? 1;
21367
21428
  if (depth >= 3) throw new Error(`Cannot spawn agent "${agentName}": subagent nesting depth ${depth} reached the limit of 3. Deeper delegation is blocked to prevent unbounded recursion.`);
21368
21429
  const resumeId = options.resumeId ?? `sub-${randomBytes(4).toString("hex")}`;
21369
- const { useCliStore } = await import("./store-Bpdo9Syo.mjs");
21430
+ const { useCliStore } = await import("./store-OGMXhD4A.mjs");
21370
21431
  const parentInteractionMode = options.parentInteractionMode ?? useCliStore.getState().interactionMode;
21371
21432
  const effectiveInteractionMode = clampInteractionMode(options.interactionMode ?? parentInteractionMode, parentInteractionMode);
21372
21433
  let agentDef;
@@ -22116,4 +22177,4 @@ var AgentHistoryStore = class {
22116
22177
  }
22117
22178
  };
22118
22179
  //#endregion
22119
- export { SIGN_IN_DURING_TURN as $, createTodoStore as A, warmFileCache as At, substituteArguments as B, formatBlockersOutput as C, hasFileReferences as Ct, createGetFileStructureTool as D, searchCommands as Dt, formatDecisionsOutput as E, SessionStore as Et, createResumeAgentTool as F, DEFAULT_AGENT_MODEL as G, buildCliToolList as H, createBackgroundAgentTools as I, DEFAULT_THOROUGHNESS as J, DEFAULT_MAX_ITERATIONS as K, createAgentDelegateTool as L, createSkillTool as M, DEFAULT_SUBAGENT_HISTORY_TTL_MS as Mt, parseAgentConfig as N, MAX_PASTE_SIZE as Nt, createWorkItemTools as O, formatFileSize as Ot, createCoordinateTaskTool as P, USAGE_CACHE_TTL as Pt, SIGNED_OUT_BANNER as Q, FallbackLlmBackend as R, createBlockerTools as S, processFileReferences as St, createDecisionStore as T, CommandHistoryStore as Tt, generateCliTools as U, PermissionManager as V, ALWAYS_DENIED_FOR_AGENTS as W, LOGGED_OUT_RESTART as X, LOCAL_SESSION_CONTINUES as Y, NoLocalModelsError as Z, createSseBackend as _, getProcessHooks as _t, loadProjectContext as a, signInUncheckedHeadlessMessage as at, formatReviewGatesOutput as b, getPlanModeFilePath as bt, checkSavedSignIn as c, signedOutCommandMessage as ct, attachLocalModels as d, buildSkillsPromptSection as dt, SIGN_IN_EXPIRED as et, buildLlmBackend as f, DeferredToolRegistry as ft, withSignedOutLocalDefault as g, wrapTools as gt, resolveSignedOutHeadlessModel as h, findIterationBoundary as ht, buildProjectAgentStore as i, loginBlocked as it, createWriteTodosTool as j, COMPACTION_SUMMARY_MARKER as jt, createFindDefinitionTool as k, searchFiles as kt, settleSignInRefresh as l, signedOutNoMatchMessage as lt, resolveHeadlessModel as m, createToolSearchTool as mt, BackgroundAgentManager as n, SIGN_IN_HINT as nt, McpManager as o, signInUncheckedLoginMessage as ot, defaultLlmBackendDeps as p, ReActAgent as pt, DEFAULT_RETRY_CONFIG as q, SubagentOrchestrator as r, SignedOutCloudBackend as rt, buildSandbox as s, signInUncheckedMessage as st, AgentHistoryStore as t, SIGN_IN_EXPIRED_HEADLESS as tt, startupMode as u, buildSystemPrompt as ut, createReviewGateStore as v, setWebSocketToolExecutor as vt, createDecisionLogTool as w, CheckpointStore as wt, createBlockerStore as x, CustomCommandStore as xt, createReviewGateTool as y, classifyCommandRisk as yt, isConnectionDrop as z };
22180
+ export { SIGNED_OUT_BANNER as $, createTodoStore as A, searchFiles as At, isConnectionDrop as B, formatBlockersOutput as C, processFileReferences as Ct, createGetFileStructureTool as D, SessionStore as Dt, formatDecisionsOutput as E, CommandHistoryStore as Et, createCoordinateTaskTool as F, USAGE_CACHE_TTL as Ft, ALWAYS_DENIED_FOR_AGENTS as G, PermissionManager as H, createResumeAgentTool as I, DEFAULT_RETRY_CONFIG as J, DEFAULT_AGENT_MODEL as K, createBackgroundAgentTools as L, resetTodoStore as M, COMPACTION_SUMMARY_MARKER as Mt, createSkillTool as N, DEFAULT_SUBAGENT_HISTORY_TTL_MS as Nt, createWorkItemTools as O, searchCommands as Ot, parseAgentConfig as P, MAX_PASTE_SIZE as Pt, NoLocalModelsError as Q, createAgentDelegateTool as R, createBlockerTools as S, CustomCommandStore as St, createDecisionStore as T, CheckpointStore as Tt, buildCliToolList as U, substituteArguments as V, generateCliTools as W, LOCAL_SESSION_CONTINUES as X, DEFAULT_THOROUGHNESS as Y, LOGGED_OUT_RESTART as Z, createSseBackend as _, wrapTools as _t, loadProjectContext as a, loginBlocked as at, formatReviewGatesOutput as b, classifyCommandRisk as bt, checkSavedSignIn as c, signInUncheckedMessage as ct, attachLocalModels as d, buildSystemPrompt as dt, SIGN_IN_DURING_TURN as et, buildLlmBackend as f, buildSkillsPromptSection as ft, withSignedOutLocalDefault as g, findIterationBoundary as gt, resolveSignedOutHeadlessModel as h, createToolSearchTool as ht, buildProjectAgentStore as i, SignedOutCloudBackend as it, createWriteTodosTool as j, warmFileCache as jt, createFindDefinitionTool as k, formatFileSize as kt, settleSignInRefresh as l, signedOutCommandMessage as lt, resolveHeadlessModel as m, ReActAgent as mt, BackgroundAgentManager as n, SIGN_IN_EXPIRED_HEADLESS as nt, McpManager as o, signInUncheckedHeadlessMessage as ot, defaultLlmBackendDeps as p, DeferredToolRegistry as pt, DEFAULT_MAX_ITERATIONS as q, SubagentOrchestrator as r, SIGN_IN_HINT as rt, buildSandbox as s, signInUncheckedLoginMessage as st, AgentHistoryStore as t, SIGN_IN_EXPIRED as tt, startupMode as u, signedOutNoMatchMessage as ut, createReviewGateStore as v, getProcessHooks as vt, createDecisionLogTool as w, hasFileReferences as wt, createBlockerStore as x, getPlanModeFilePath as xt, createReviewGateTool as y, setWebSocketToolExecutor as yt, FallbackLlmBackend as z };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { b as AuthenticatedApiClient, t as ConfigStore, x as DeviceFlowClient } from "./ConfigStore-CP1W86Ui.mjs";
3
- import { t as logger } from "./Logger-3RbeTZ9o.mjs";
4
- import { t as version } from "./package-WlxLVpUb.mjs";
2
+ import { b as AuthenticatedApiClient, t as ConfigStore, x as DeviceFlowClient } from "./ConfigStore-CO6kREaL.mjs";
3
+ import { t as logger } from "./Logger-CHKCF5hd.mjs";
4
+ import { t as version } from "./package-TACInPbw.mjs";
5
5
  import { isAxiosError } from "axios";
6
6
  import { Readable } from "node:stream";
7
7
  //#region src/auth/OAuthClient.ts
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as logger } from "./Logger-3RbeTZ9o.mjs";
3
- import { a as getContainerSocketPaths, c as resolveSandboxPath, o as getProtectedWorkspacePaths, s as isBinaryAvailable, t as assertProxyPort } from "./SandboxRuntimeAdapter-C3xICJtQ.mjs";
2
+ import { t as logger } from "./Logger-CHKCF5hd.mjs";
3
+ import { a as getContainerSocketPaths, c as resolveSandboxPath, o as getProtectedWorkspacePaths, s as isBinaryAvailable, t as assertProxyPort } from "./SandboxRuntimeAdapter-DpDSET-A.mjs";
4
4
  import { lstatSync, mkdirSync, statSync } from "fs";
5
5
  import os from "os";
6
6
  import path from "path";
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export { t as ConfigStore } from "./ConfigStore-CO6kREaL.mjs";
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { T as ChatModels, t as logger } from "./Logger-3RbeTZ9o.mjs";
2
+ import { T as ChatModels, t as logger } from "./Logger-CHKCF5hd.mjs";
3
3
  import { t as DEFAULT_SANDBOX_CONFIG } from "./types-CxrzVXel.mjs";
4
+ import { isDeepStrictEqual } from "node:util";
4
5
  import { existsSync, promises } from "fs";
5
6
  import { homedir, hostname } from "os";
6
7
  import path from "path";
@@ -10,7 +11,6 @@ import * as fs from "node:fs";
10
11
  import { z as z$1 } from "zod";
11
12
  import axios, { isAxiosError } from "axios";
12
13
  import { createHash } from "node:crypto";
13
- import { isDeepStrictEqual } from "node:util";
14
14
  import { homedir as homedir$1 } from "node:os";
15
15
  //#region src/utils/sanitizeTerminalText.ts
16
16
  /**