@bike4mind/cli 4.8.0 → 4.10.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 (39) hide show
  1. package/README.md +21 -0
  2. package/bin/bike4mind-cli.mjs +342 -239
  3. package/dist/{AgentHistoryStore-Bvmcy2kf.mjs → AgentHistoryStore-CjGVgxLR.mjs} +305 -644
  4. package/dist/{ApiClient-Yp2LPlX3.mjs → ApiClient-SVXSI3HI.mjs} +3 -3
  5. package/dist/{BubblewrapRuntime-OI4qFPNB.mjs → BubblewrapRuntime-CTc_KPnd.mjs} +2 -2
  6. package/dist/{ConfigStore-CP1W86Ui.mjs → ConfigStore-B2Dy-PT9.mjs} +7 -8
  7. package/dist/ConfigStore-zlY0PikB.mjs +2 -0
  8. package/dist/{Logger-3RbeTZ9o.mjs → Logger-7MmrU5w6.mjs} +4845 -1126
  9. package/dist/{SandboxOrchestrator-lpxVEFO7.mjs → SandboxOrchestrator-CeDwd6Fj.mjs} +1 -1
  10. package/dist/{SandboxRuntimeAdapter-u6c_IrjP.mjs → SandboxRuntimeAdapter-CFEIywKt.mjs} +1 -1
  11. package/dist/{SandboxRuntimeAdapter-C3xICJtQ.mjs → SandboxRuntimeAdapter-CjNDzYSf.mjs} +2 -2
  12. package/dist/{SeatbeltRuntime-Ccd_QbjX.mjs → SeatbeltRuntime-CQItj-F1.mjs} +2 -2
  13. package/dist/{WorkItemsClient-D4sFGL9X.mjs → WorkItemsClient-C9_pjHCo.mjs} +3 -4
  14. package/dist/{buildToolSearch-CqHKSLtG.mjs → buildToolSearch-8xyBwXRx.mjs} +2 -2
  15. package/dist/commands/acpCommand.mjs +6 -7
  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 +10 -11
  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-DHgMhdzV.mjs +10138 -0
  28. package/dist/{fit-BOnDsgbk.mjs → fit-D8Quui6j.mjs} +3 -3
  29. package/dist/index.mjs +732 -69
  30. package/dist/{modelServers-B7zI5XnO.mjs → modelServers-JsKBm7Wn.mjs} +1 -1
  31. package/dist/{package-WlxLVpUb.mjs → package-r_xumsGY.mjs} +1 -1
  32. package/dist/{serve-DpsV0mag.mjs → serve-BM9PKMLH.mjs} +873 -60
  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-BOqaLeZU.mjs} +1 -1
  36. package/package.json +12 -44
  37. package/dist/ConfigStore-Bo4od3Eu.mjs +0 -2
  38. package/dist/dist-BPhZ0dCz.mjs +0 -4776
  39. package/dist/store-Bpdo9Syo.mjs +0 -2
@@ -1,17 +1,16 @@
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";
5
- import { n as COMMANDS, r as isReservedCommandName } from "./RemoteSkillSource-D_F99yBR.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-B2Dy-PT9.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-DHgMhdzV.mjs";
4
+ import { At as isExpectedToolError, B as LOW_CONFIDENCE_COMPLETION_MODES, Et as googleMapsSearchUrl, G as NotFoundError, I as ExpectedToolError, Jt as signImageUrl, Kt as secureParameters, M as DecisionTextPartSchema, Mt as isProviderRefusalStopReason, N as DecisionsRequestSchema, Nt as isRetryableError, T as ChatModels, U as McpServerName, Ut as reasoningChannelOf, V as MODEL_DECLINED_MESSAGE, Y as PermissionDeniedError, Yt as splitEquals, _t as createReasoningWithholder, a as htmlFirstH1, an as withholdsReasoning, at as SEARCH_RESULT_CARDS_LANGUAGE, ft as WORK_ITEM_STATUSES, h as ApiKeyType, i as htmlErrorTitle, in as withRetry, jt as isPlaceholderImageSigningSecret, 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, wt as getMcpProviderMetadata, x as CONFIDENCE_GATE_MODES, xt as fromCliTodos, z as LOCATION_MAP_LANGUAGE, zt as obfuscateApiKey } from "./Logger-7MmrU5w6.mjs";
5
+ import { 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-JsKBm7Wn.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";
13
13
  import path, { dirname, join } from "path";
14
- import { v4 } from "uuid";
15
14
  import path$1, * as path$2 from "node:path";
16
15
  import { promises as promises$1 } from "node:fs";
17
16
  import { AsyncFzf } from "fzf";
@@ -19,7 +18,6 @@ import ignore from "ignore";
19
18
  import fs, { mkdir, readFile, stat, writeFile } from "fs/promises";
20
19
  import { z as z$1 } from "zod";
21
20
  import { isAxiosError } from "axios";
22
- import Fuse from "fuse.js";
23
21
  import { execFile, spawn } from "child_process";
24
22
  import { promisify } from "util";
25
23
  import * as fsp from "node:fs/promises";
@@ -29,7 +27,6 @@ import * as turndownPluginGfm from "@joplin/turndown-plugin-gfm";
29
27
  import * as cheerio from "cheerio";
30
28
  import FirecrawlDefault, { FirecrawlError } from "@mendable/firecrawl-js";
31
29
  import { lookup } from "node:dns/promises";
32
- import "@aws-sdk/client-cloudwatch";
33
30
  import random from "lodash/random.js";
34
31
  import sum from "lodash/sum.js";
35
32
  import times from "lodash/times.js";
@@ -416,33 +413,6 @@ function isBinaryFile(filePath) {
416
413
  */
417
414
  const MAX_FILE_SIZE$3 = 10485760;
418
415
  //#endregion
419
- //#region src/utils/fuzzySearch.ts
420
- /**
421
- * Fuzzy search options for command matching
422
- */
423
- const fuseOptions = {
424
- keys: [{
425
- name: "name",
426
- weight: .7
427
- }, {
428
- name: "description",
429
- weight: .3
430
- }],
431
- threshold: .4,
432
- includeScore: true,
433
- minMatchCharLength: 1
434
- };
435
- /**
436
- * Search commands using fuzzy matching
437
- * @param query - The search query (without the leading /)
438
- * @param commands - Optional custom commands array (defaults to built-in COMMANDS)
439
- * @returns Array of matching commands, sorted by relevance
440
- */
441
- function searchCommands(query, commands = COMMANDS) {
442
- if (!query || query.trim() === "") return commands;
443
- return new Fuse(commands, fuseOptions).search(query).map((result) => result.item);
444
- }
445
- //#endregion
446
416
  //#region src/storage/SessionStore.ts
447
417
  /**
448
418
  * Manages conversation sessions stored as JSON files
@@ -478,7 +448,7 @@ var SessionStore = class {
478
448
  if (session.messages.length === 0) throw new Error("Cannot save session with no messages");
479
449
  await this.init();
480
450
  const filePath = this.sessionFilePath(session.id);
481
- const tempPath = `${filePath}.${v4()}.tmp`;
451
+ const tempPath = `${filePath}.${crypto.randomUUID()}.tmp`;
482
452
  try {
483
453
  await promises.writeFile(tempPath, JSON.stringify(session, null, 2), "utf-8");
484
454
  await promises.rename(tempPath, filePath);
@@ -500,7 +470,7 @@ var SessionStore = class {
500
470
  session.messages = session.messages.map((msg) => {
501
471
  if (!msg.id) return {
502
472
  ...msg,
503
- id: v4()
473
+ id: crypto.randomUUID()
504
474
  };
505
475
  return msg;
506
476
  });
@@ -532,7 +502,7 @@ var SessionStore = class {
532
502
  session.messages = session.messages.map((msg) => {
533
503
  if (!msg.id) return {
534
504
  ...msg,
535
- id: v4()
505
+ id: crypto.randomUUID()
536
506
  };
537
507
  return msg;
538
508
  });
@@ -1286,6 +1256,7 @@ var apiKeyService_exports$1 = /* @__PURE__ */ __exportAll$2({
1286
1256
  getApiKey: () => getApiKey,
1287
1257
  getApiKeySchema: () => getApiKeySchema,
1288
1258
  getEffectiveApiKey: () => getEffectiveApiKey,
1259
+ getEffectiveApiKeyWithSource: () => getEffectiveApiKeyWithSource,
1289
1260
  getEffectiveLLMApiKeys: () => getEffectiveLLMApiKeys,
1290
1261
  getFirecrawlConfig: () => getFirecrawlConfig,
1291
1262
  getFmpApiKey: () => getFmpApiKey,
@@ -1298,7 +1269,8 @@ var apiKeyService_exports$1 = /* @__PURE__ */ __exportAll$2({
1298
1269
  listOwnApiKeys: () => listOwnApiKeys,
1299
1270
  setApiKey: () => setApiKey,
1300
1271
  sharedAdminKeyProviders: () => sharedAdminKeyProviders,
1301
- t: () => apiKeyService_exports$2
1272
+ t: () => apiKeyService_exports$2,
1273
+ userKeyProviders: () => userKeyProviders
1302
1274
  });
1303
1275
  const createApiKeySchema = z$1.object({
1304
1276
  apiKey: z$1.string().min(6),
@@ -1408,25 +1380,47 @@ const getFmpApiKey = async (adapters) => {
1408
1380
  const { db } = adapters;
1409
1381
  return (await db.adminSettings.findBySettingName("FmpApiKey"))?.settingValue;
1410
1382
  };
1411
- const getEffectiveApiKey = async (userId, params, adapters) => {
1383
+ /**
1384
+ * getEffectiveApiKey, also reporting whether the key is the user's own or the platform's, so a
1385
+ * usage record can tell platform-quota consumption apart from calls billed to a user's own account.
1386
+ */
1387
+ const getEffectiveApiKeyWithSource = async (userId, params, adapters) => {
1412
1388
  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;
1389
+ const userKey = (await getApiKey(userId, params, adapters))?.apiKey;
1390
+ if (userKey) return {
1391
+ key: userKey,
1392
+ source: "user"
1393
+ };
1394
+ const demoKeyName = params.demoKeyName || DEMO_KEY_MAP[params.type];
1395
+ if (demoKeyName) {
1396
+ const settings = await db.adminSettings.findBySettingName(demoKeyName);
1397
+ if (settings?.settingValue) return {
1398
+ key: settings.settingValue,
1399
+ source: "platform"
1400
+ };
1421
1401
  }
1422
- return key;
1402
+ const envName = ENV_KEY_MAP[params.type];
1403
+ const selfHostKey = envName ? envKey(envName) : null;
1404
+ return selfHostKey ? {
1405
+ key: selfHostKey,
1406
+ source: "platform"
1407
+ } : void 0;
1423
1408
  };
1409
+ const getEffectiveApiKey = async (userId, params, adapters) => (await getEffectiveApiKeyWithSource(userId, params, adapters))?.key;
1424
1410
  const sharedAdminKeySources = /* @__PURE__ */ new WeakMap();
1425
1411
  /**
1426
1412
  * For a result of getEffectiveLLMApiKeys: which providers resolved to the shared admin-setting
1427
1413
  * key (not a user's own key, not 'expired', not a self-host env key). Undefined for any other object.
1428
1414
  */
1429
1415
  const sharedAdminKeyProviders = (keys) => sharedAdminKeySources.get(keys);
1416
+ const userKeySources = /* @__PURE__ */ new WeakMap();
1417
+ /**
1418
+ * For a result of getEffectiveLLMApiKeys: which providers resolved to the user's own saved key
1419
+ * (including an expired one), as opposed to a platform admin-setting or self-host env key. Lets a
1420
+ * caller tell a provider rejecting the user's key (user-side) from one rejecting ours (outage).
1421
+ * Empty for any other object.
1422
+ */
1423
+ const userKeyProviders = (keys) => userKeySources.get(keys) ?? /* @__PURE__ */ new Set();
1430
1424
  const getEffectiveLLMApiKeys = async (userId, adapters, options) => {
1431
1425
  const { db } = adapters;
1432
1426
  const logger = options?.logger;
@@ -1504,6 +1498,18 @@ const getEffectiveLLMApiKeys = async (userId, adapters, options) => {
1504
1498
  openai: !openaiUserKey && !!openaiDemoKey,
1505
1499
  anthropic: !anthropicUserKey && !!anthropicDemoKey
1506
1500
  });
1501
+ const userKeyByProvider = {
1502
+ openai: openaiUserKey,
1503
+ anthropic: anthropicUserKey,
1504
+ gemini: geminiUserKey,
1505
+ bfl: bflUserKey,
1506
+ xai: xaiUserKey,
1507
+ kimi: kimiUserKey,
1508
+ deepseek: deepseekUserKey,
1509
+ voyageai: voyageaiUserKey,
1510
+ typesafe: typesafeUserKey
1511
+ };
1512
+ userKeySources.set(keys, new Set(Object.keys(userKeyByProvider).filter((provider) => userKeyByProvider[provider] !== null)));
1507
1513
  return keys;
1508
1514
  };
1509
1515
  const setApiKeySchema = z$1.object({
@@ -1547,6 +1553,7 @@ var apiKeyService_exports$2 = /* @__PURE__ */ __exportAll({
1547
1553
  getApiKey: () => getApiKey,
1548
1554
  getApiKeySchema: () => getApiKeySchema,
1549
1555
  getEffectiveApiKey: () => getEffectiveApiKey,
1556
+ getEffectiveApiKeyWithSource: () => getEffectiveApiKeyWithSource,
1550
1557
  getEffectiveLLMApiKeys: () => getEffectiveLLMApiKeys,
1551
1558
  getFirecrawlConfig: () => getFirecrawlConfig,
1552
1559
  getFmpApiKey: () => getFmpApiKey,
@@ -1558,7 +1565,8 @@ var apiKeyService_exports$2 = /* @__PURE__ */ __exportAll({
1558
1565
  getWolframAlphaKey: () => getWolframAlphaKey,
1559
1566
  listOwnApiKeys: () => listOwnApiKeys,
1560
1567
  setApiKey: () => setApiKey,
1561
- sharedAdminKeyProviders: () => sharedAdminKeyProviders
1568
+ sharedAdminKeyProviders: () => sharedAdminKeyProviders,
1569
+ userKeyProviders: () => userKeyProviders
1562
1570
  });
1563
1571
  //#endregion
1564
1572
  //#region ../../b4m-core/services/dist/apiKeyService/index.mjs
@@ -2303,178 +2311,6 @@ const webFetchTool = {
2303
2311
  })
2304
2312
  };
2305
2313
  //#endregion
2306
- //#region ../../b4m-core/utils/dist/globMatches.mjs
2307
- /**
2308
- * Backtrack-free glob match where `*` is the only wildcard and every other character is a
2309
- * literal. Deliberately not a compiled RegExp: escaping the pattern still leaves `*` live as
2310
- * `.*`, and a chained-`*` pattern (`'*a'.repeat(12) + 'Z'`) then costs the regex engine
2311
- * exponential time - measured at over 120s of blocked event loop against a 40-char subject.
2312
- * This two-pointer walk is O(text * pattern) worst case with no backtracking stack, so a
2313
- * hostile pattern cannot outrun its input.
2314
- *
2315
- * Use this anywhere a user-supplied glob is matched against a name on a request path:
2316
- * lattice rule entity references, agent allowed/denied tool patterns. Reaching for
2317
- * `escapeRegex` instead does NOT close the hole - the whole point of these patterns is that
2318
- * `*` survives escaping.
2319
- *
2320
- * Import from the lightweight subpath (`@bike4mind/utils/globMatches`), NOT the package
2321
- * barrel, which eagerly evaluates `Logger`/embedding-model code.
2322
- *
2323
- * @example
2324
- * globMatches('mcp__github__create_issue', 'mcp__*__create_*') // true
2325
- * globMatches('a.b', 'a.b') // true - `.` is a literal here, not "any char"
2326
- * globMatches('axb', 'a.b') // false - same reason
2327
- */
2328
- function globMatches(text, pattern) {
2329
- let textIndex = 0;
2330
- let patternIndex = 0;
2331
- let lastStarPattern = -1;
2332
- let lastStarText = 0;
2333
- while (textIndex < text.length) if (patternIndex < pattern.length && pattern[patternIndex] === "*") {
2334
- lastStarPattern = patternIndex++;
2335
- lastStarText = textIndex;
2336
- } else if (patternIndex < pattern.length && pattern[patternIndex] === text[textIndex]) {
2337
- patternIndex++;
2338
- textIndex++;
2339
- } else if (lastStarPattern >= 0) {
2340
- patternIndex = lastStarPattern + 1;
2341
- textIndex = ++lastStarText;
2342
- } else return false;
2343
- while (patternIndex < pattern.length && pattern[patternIndex] === "*") patternIndex++;
2344
- return patternIndex === pattern.length;
2345
- }
2346
- //#endregion
2347
- //#region ../../b4m-core/utils/dist/normalizeId.mjs
2348
- /**
2349
- * Coerce an id-ish value to its primitive string form, or `undefined` when absent.
2350
- *
2351
- * Handles the three shapes a Mongo id arrives in across request layers: a plain string,
2352
- * a Mongo `ObjectId` (via `toHexString`), and a populated Mongoose document (`{ _id }` /
2353
- * `{ id }`). Plain `String()` is NOT enough - it turns a populated document into
2354
- * "[object Object]", which is exactly the silent-comparison trap that lets a value match a
2355
- * casting Mongo query yet fail an in-memory strict `===`/`!==`. Normalize both sides of any
2356
- * such comparison through this so the two never disagree.
2357
- */
2358
- function normalizeId(value) {
2359
- if (value == null) return void 0;
2360
- if (typeof value === "string") return value || void 0;
2361
- if (typeof value === "object") {
2362
- const obj = value;
2363
- if (typeof obj.toHexString === "function") return obj.toHexString() || void 0;
2364
- if (obj._id != null) return normalizeId(obj._id);
2365
- if (typeof obj.id === "string") return obj.id || void 0;
2366
- return;
2367
- }
2368
- return typeof value === "number" && Number.isFinite(value) ? String(value) : void 0;
2369
- }
2370
- //#endregion
2371
- //#region ../../b4m-core/services/dist/weather-DkuXq1cq.mjs
2372
- /**
2373
- * A user paying for themselves with no credit purchase and no active plan (own or an org seat):
2374
- * the paid signals the API key trust gate reads (userApiKeyService/trust.ts), plan read lazily as
2375
- * there. Org-paid spend is never free tier, since no org-level signal says whether the pool is funded.
2376
- */
2377
- async function isFreeTierHolder(holder) {
2378
- if (holder.organization || holder.user.lastCreditsPurchasedAt) return false;
2379
- return !await holder.activePlans.hasActivePlan(holder.user.id);
2380
- }
2381
- /**
2382
- * One request's or turn's view of `isOperationalBillingEnabled`: the settings and plan reads run
2383
- * at most once per holder, so repeated spend in the same unit of work does not repeat them. A
2384
- * rejected read is not kept. Never share one across requests: it would pin a stale answer.
2385
- */
2386
- function memoizeOperationalBillingCheck(db, logger) {
2387
- const memo = /* @__PURE__ */ new Map();
2388
- return (holder) => {
2389
- const key = holder ? `${holder.user.id}:${holder.organization?.id ?? ""}` : "";
2390
- let pending = memo.get(key);
2391
- if (!pending) {
2392
- pending = isOperationalBillingEnabled(db, logger, holder);
2393
- memo.set(key, pending);
2394
- pending.catch(() => memo.delete(key));
2395
- }
2396
- return pending;
2397
- };
2398
- }
2399
- /**
2400
- * Whether operational usage (auto-naming, summarization, tagging, embeddings for search and file
2401
- * indexing) actually debits credits. Requires `enforceCredits`, the platform-wide metering master
2402
- * switch (off on self-host). On top of it, `billOperationalUsage` opts every holder in; with it
2403
- * off, only a free-tier `holder` is billed. Without a `holder` the free-tier carve-out cannot
2404
- * apply, so the answer is the toggle alone.
2405
- *
2406
- * Shared by `recordOperationalUsage` (the settlement) and every credit pre-flight that guards a
2407
- * path settling through it, so the two provably agree on when a debit can happen. They MUST stay
2408
- * in sync, including passing the same holder: a pre-flight stricter than the settlement rejects
2409
- * work that would never have been billed, and a looser one leaves the gap the pre-flight exists
2410
- * to close.
2411
- *
2412
- * Owns the fetch rather than taking a settings map, so no caller can narrow it to the
2413
- * wrong keys: under `skipCache` a `names` list that omits a key reads `undefined` for
2414
- * it and silently gates billing OFF - turning a pre-flight into a no-op with no error
2415
- * anywhere. `skipCache` is required for the same reason: a long-lived host's process
2416
- * cache can lag another process's admin write until its TTL expires.
2417
- *
2418
- * Throws if the settings store or the plan read does: a caller that must not fail on a
2419
- * billing-store blip has to catch this and decide its own fallback.
2420
- */
2421
- async function isOperationalBillingEnabled(db, logger, holder) {
2422
- const settings = await getSettingsMap(db, {
2423
- logger,
2424
- names: ["billOperationalUsage", "enforceCredits"],
2425
- skipCache: true
2426
- });
2427
- if (!(getSettingsValue("enforceCredits", settings) ?? false)) return false;
2428
- if (getSettingsValue("billOperationalUsage", settings) ?? false) return true;
2429
- return holder ? isFreeTierHolder(holder) : false;
2430
- }
2431
- async function fetchWeatherData(db, params) {
2432
- const openWeatherKey = await (0, apiKeyService_exports.getOpenWeatherKey)({ db });
2433
- if (!openWeatherKey) throw new Error("OpenWeather API key is not configured.");
2434
- let response;
2435
- try {
2436
- response = await fetch(`https://api.openweathermap.org/data/2.5/weather?lat=${params.lat}&lon=${params.lon}&appid=${openWeatherKey}&units=${params.units || "imperial"}`);
2437
- } catch (err) {
2438
- throw new Error(`OpenWeather fetch failed: ${err instanceof Error ? err.message : String(err)}`);
2439
- }
2440
- if (!response.ok) throw new Error(`OpenWeather error: ${response.statusText}`);
2441
- const data = await response.json();
2442
- return `Right now it's ${data?.main?.temp}° in ${data?.name}, with ${data?.weather?.[0]?.description}.`;
2443
- }
2444
- const weatherTool = {
2445
- name: "weather_info",
2446
- implementation: (context) => ({
2447
- toolFn: async (value) => {
2448
- const params = value;
2449
- await context.onStart?.("weather_info", params);
2450
- return fetchWeatherData(context.db, params);
2451
- },
2452
- toolSchema: {
2453
- name: "weather_info",
2454
- description: "Get current weather info from the OpenWeather API using latitude and longitude",
2455
- parameters: {
2456
- type: "object",
2457
- properties: {
2458
- lat: {
2459
- type: "number",
2460
- description: "Latitude of the location"
2461
- },
2462
- lon: {
2463
- type: "number",
2464
- description: "Longitude of the location"
2465
- },
2466
- units: {
2467
- type: "string",
2468
- description: "Units: either \"imperial\" or \"metric\"",
2469
- enum: ["imperial", "metric"]
2470
- }
2471
- },
2472
- required: ["lat", "lon"]
2473
- }
2474
- }
2475
- })
2476
- };
2477
- //#endregion
2478
2314
  //#region ../../b4m-core/services/dist/prompts-CD7UjAcG.mjs
2479
2315
  /**
2480
2316
  * Teaches the `b4m_cards` fence, appended to a web_search result ONLY when that search actually
@@ -2532,7 +2368,7 @@ const WEB_SEARCH_MAP_PROMPT = [
2532
2368
  "explanation or citations. Omit it only if none of the places actually answer the question."
2533
2369
  ].join("\n");
2534
2370
  //#endregion
2535
- //#region ../../b4m-core/services/dist/websearch-CqYLXC6T.mjs
2371
+ //#region ../../b4m-core/services/dist/websearch-Bm2eZQma.mjs
2536
2372
  /**
2537
2373
  * Shown to the model under tool results that carry the turn's shared numbers, so it cites them the
2538
2374
  * way forced retrieval's header asks it to cite the documents numbered before them. Keep it a directive:
@@ -2669,6 +2505,41 @@ function safeImageUrl(value) {
2669
2505
  function dedupeImages(values) {
2670
2506
  return [...new Set(values.filter((v) => !!v))].slice(0, MAX_IMAGES_PER_RESULT);
2671
2507
  }
2508
+ const GOOGLE_HOSTS = /* @__PURE__ */ new Set(["google.com", "www.google.com"]);
2509
+ /** Host of a breadcrumb-style `displayed_link` ("https://host > a > b"), or undefined when it is not a URL. */
2510
+ function breadcrumbHost(displayedLink) {
2511
+ if (typeof displayedLink !== "string" || !displayedLink) return void 0;
2512
+ try {
2513
+ const shown = new URL(displayedLink.trim().split(/[\s\u203a>]/)[0]);
2514
+ return (shown.protocol === "https:" || shown.protocol === "http:") && !GOOGLE_HOSTS.has(shown.hostname) ? shown.hostname : void 0;
2515
+ } catch {
2516
+ return;
2517
+ }
2518
+ }
2519
+ const MAX_PLATFORM_NAME_CHARS = 40;
2520
+ /** Platform name from SerpAPI's `source` ("Reddit \u00b7 r/investing" -> "Reddit"), never a Google name. */
2521
+ function sourcePlatformName(source) {
2522
+ if (typeof source !== "string") return void 0;
2523
+ const name = source.split(/\s\u00b7\s/)[0]?.replace(/[[\]()\r\n]/g, "").trim();
2524
+ return name && !/^google\b/i.test(name) ? name.slice(0, MAX_PLATFORM_NAME_CHARS) : void 0;
2525
+ }
2526
+ /**
2527
+ * SerpAPI can return Google's own redirect (`google.com/goto?url=<opaque token>`) as `link`, which
2528
+ * hides the destination. Returns what to label it with, or undefined for any other link: the host
2529
+ * of the breadcrumb-style `displayed_link` when that is a URL, else the platform name from `source`
2530
+ * for hits whose breadcrumb is an engagement count ("10+ comments", "920+ views"). Only the host is
2531
+ * read from the breadcrumb: its path follows the site's own breadcrumb names, not its URL path, and
2532
+ * is cut short with an ellipsis when long, while the host always comes first and survives both.
2533
+ */
2534
+ function googleRedirectDisplayHost(link, displayedLink, source) {
2535
+ try {
2536
+ const parsed = new URL(link);
2537
+ if (!GOOGLE_HOSTS.has(parsed.hostname) || !/^\/(goto|url)$/.test(parsed.pathname)) return void 0;
2538
+ } catch {
2539
+ return;
2540
+ }
2541
+ return breadcrumbHost(displayedLink) ?? sourcePlatformName(source);
2542
+ }
2672
2543
  /**
2673
2544
  * `inline_images` and `shopping_results` are sibling arrays rather than nested under the organic
2674
2545
  * hits, so they are attached by exact link match only - a positional or same-host guess would
@@ -2992,10 +2863,12 @@ function createSerpApiProvider(adapters) {
2992
2863
  const extraImages = indexImagesByLink(data.inline_images, data.shopping_results);
2993
2864
  return organic.filter((r) => !!r && typeof r.link === "string").map((r) => {
2994
2865
  const images = dedupeImages([...extraImages.get(r.link) ?? [], safeImageUrl(r.thumbnail)]);
2866
+ const displayHost = googleRedirectDisplayHost(r.link, r.displayed_link, r.source);
2995
2867
  return {
2996
2868
  title: r.title ?? r.link,
2997
2869
  url: r.link,
2998
2870
  snippet: r.snippet ?? "",
2871
+ ...displayHost ? { displayHost } : {},
2999
2872
  ...images.length > 0 ? {
3000
2873
  thumbnail: images[0],
3001
2874
  images
@@ -3455,6 +3328,7 @@ async function performWebSearch(adapters, params, imageUrlSigningSecret = "", re
3455
3328
  sourceSystem: "web_search",
3456
3329
  relevanceScore: 1 - index * .1,
3457
3330
  fullContext: result.snippet,
3331
+ ...result.displayHost ? { displayHost: result.displayHost } : {},
3458
3332
  ...withImages && result.thumbnail ? {
3459
3333
  thumbnail: result.thumbnail,
3460
3334
  images: result.images
@@ -3467,7 +3341,7 @@ async function performWebSearch(adapters, params, imageUrlSigningSecret = "", re
3467
3341
  const resultLabel = (index) => numberedCitables ? `[${numberedCitables[index].metadata?.citationIndex}]` : `${index + 1}.`;
3468
3342
  const formattedResults = results.map((result, index) => {
3469
3343
  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`;
3344
+ return `${resultLabel(index)} **${stripNewlines(result.title)}**\n${stripNewlines(result.snippet)}\n` + imageLine + `Source: [${stripNewlines(result.displayHost ?? safeHostname(result.url))}](${result.url})\n`;
3471
3345
  }).join("\n");
3472
3346
  const imageSection = withImages && imageResults.length ? `\n${formatImageResults(imageResults, imageUrlSigningSecret)}\n` : "";
3473
3347
  const placeSection = withPlaces ? `\n${formatPlaceResults(places, anchor, numberedCitables ? citationNumbersById(numberedCitables) : void 0)}\n` : "";
@@ -3546,7 +3420,120 @@ const webSearchTool = {
3546
3420
  }
3547
3421
  };
3548
3422
  }
3549
- };
3423
+ };
3424
+ //#endregion
3425
+ //#region ../../b4m-core/services/dist/weather-jxxOpyX5.mjs
3426
+ async function fetchWeatherData(db, params) {
3427
+ const openWeatherKey = await (0, apiKeyService_exports.getOpenWeatherKey)({ db });
3428
+ if (!openWeatherKey) throw new Error("OpenWeather API key is not configured.");
3429
+ let response;
3430
+ try {
3431
+ response = await fetch(`https://api.openweathermap.org/data/2.5/weather?lat=${params.lat}&lon=${params.lon}&appid=${openWeatherKey}&units=${params.units || "imperial"}`);
3432
+ } catch (err) {
3433
+ throw new Error(`OpenWeather fetch failed: ${err instanceof Error ? err.message : String(err)}`);
3434
+ }
3435
+ if (!response.ok) throw new Error(`OpenWeather error: ${response.statusText}`);
3436
+ const data = await response.json();
3437
+ return `Right now it's ${data?.main?.temp}° in ${data?.name}, with ${data?.weather?.[0]?.description}.`;
3438
+ }
3439
+ const weatherTool = {
3440
+ name: "weather_info",
3441
+ implementation: (context) => ({
3442
+ toolFn: async (value) => {
3443
+ const params = value;
3444
+ await context.onStart?.("weather_info", params);
3445
+ return fetchWeatherData(context.db, params);
3446
+ },
3447
+ toolSchema: {
3448
+ name: "weather_info",
3449
+ description: "Get current weather info from the OpenWeather API using latitude and longitude",
3450
+ parameters: {
3451
+ type: "object",
3452
+ properties: {
3453
+ lat: {
3454
+ type: "number",
3455
+ description: "Latitude of the location"
3456
+ },
3457
+ lon: {
3458
+ type: "number",
3459
+ description: "Longitude of the location"
3460
+ },
3461
+ units: {
3462
+ type: "string",
3463
+ description: "Units: either \"imperial\" or \"metric\"",
3464
+ enum: ["imperial", "metric"]
3465
+ }
3466
+ },
3467
+ required: ["lat", "lon"]
3468
+ }
3469
+ }
3470
+ })
3471
+ };
3472
+ //#endregion
3473
+ //#region ../../b4m-core/utils/dist/globMatches.mjs
3474
+ /**
3475
+ * Backtrack-free glob match where `*` is the only wildcard and every other character is a
3476
+ * literal. Deliberately not a compiled RegExp: escaping the pattern still leaves `*` live as
3477
+ * `.*`, and a chained-`*` pattern (`'*a'.repeat(12) + 'Z'`) then costs the regex engine
3478
+ * exponential time - measured at over 120s of blocked event loop against a 40-char subject.
3479
+ * This two-pointer walk is O(text * pattern) worst case with no backtracking stack, so a
3480
+ * hostile pattern cannot outrun its input.
3481
+ *
3482
+ * Use this anywhere a user-supplied glob is matched against a name on a request path:
3483
+ * lattice rule entity references, agent allowed/denied tool patterns. Reaching for
3484
+ * `escapeRegex` instead does NOT close the hole - the whole point of these patterns is that
3485
+ * `*` survives escaping.
3486
+ *
3487
+ * Import from the lightweight subpath (`@bike4mind/utils/globMatches`), NOT the package
3488
+ * barrel, which eagerly evaluates `Logger`/embedding-model code.
3489
+ *
3490
+ * @example
3491
+ * globMatches('mcp__github__create_issue', 'mcp__*__create_*') // true
3492
+ * globMatches('a.b', 'a.b') // true - `.` is a literal here, not "any char"
3493
+ * globMatches('axb', 'a.b') // false - same reason
3494
+ */
3495
+ function globMatches(text, pattern) {
3496
+ let textIndex = 0;
3497
+ let patternIndex = 0;
3498
+ let lastStarPattern = -1;
3499
+ let lastStarText = 0;
3500
+ while (textIndex < text.length) if (patternIndex < pattern.length && pattern[patternIndex] === "*") {
3501
+ lastStarPattern = patternIndex++;
3502
+ lastStarText = textIndex;
3503
+ } else if (patternIndex < pattern.length && pattern[patternIndex] === text[textIndex]) {
3504
+ patternIndex++;
3505
+ textIndex++;
3506
+ } else if (lastStarPattern >= 0) {
3507
+ patternIndex = lastStarPattern + 1;
3508
+ textIndex = ++lastStarText;
3509
+ } else return false;
3510
+ while (patternIndex < pattern.length && pattern[patternIndex] === "*") patternIndex++;
3511
+ return patternIndex === pattern.length;
3512
+ }
3513
+ //#endregion
3514
+ //#region ../../b4m-core/utils/dist/normalizeId.mjs
3515
+ /**
3516
+ * Coerce an id-ish value to its primitive string form, or `undefined` when absent.
3517
+ *
3518
+ * Handles the three shapes a Mongo id arrives in across request layers: a plain string,
3519
+ * a Mongo `ObjectId` (via `toHexString`), and a populated Mongoose document (`{ _id }` /
3520
+ * `{ id }`). Plain `String()` is NOT enough - it turns a populated document into
3521
+ * "[object Object]", which is exactly the silent-comparison trap that lets a value match a
3522
+ * casting Mongo query yet fail an in-memory strict `===`/`!==`. Normalize both sides of any
3523
+ * such comparison through this so the two never disagree.
3524
+ */
3525
+ function normalizeId(value) {
3526
+ if (value == null) return void 0;
3527
+ if (typeof value === "string") return value || void 0;
3528
+ if (typeof value === "object") {
3529
+ const obj = value;
3530
+ if (typeof obj.toHexString === "function") return obj.toHexString() || void 0;
3531
+ if (obj._id != null) return normalizeId(obj._id);
3532
+ if (typeof obj.id === "string") return obj.id || void 0;
3533
+ return;
3534
+ }
3535
+ return typeof value === "number" && Number.isFinite(value) ? String(value) : void 0;
3536
+ }
3550
3537
  //#endregion
3551
3538
  //#region ../../b4m-core/services/dist/latticeModelService-DTKpo_hV.mjs
3552
3539
  /**
@@ -3647,7 +3634,68 @@ async function getModelForWrite(user, modelId, deps) {
3647
3634
  return isModelOwner(model, user) ? model : null;
3648
3635
  }
3649
3636
  //#endregion
3650
- //#region ../../b4m-core/services/dist/toolGenerators-ByeEdDON.mjs
3637
+ //#region ../../b4m-core/services/dist/isOperationalBillingEnabled-CAzm2mhR.mjs
3638
+ /**
3639
+ * A user paying for themselves with no credit purchase and no active plan (own or an org seat):
3640
+ * the paid signals the API key trust gate reads (userApiKeyService/trust.ts), plan read lazily as
3641
+ * there. Org-paid spend is never free tier, since no org-level signal says whether the pool is funded.
3642
+ */
3643
+ async function isFreeTierHolder(holder) {
3644
+ if (holder.organization || holder.user.lastCreditsPurchasedAt) return false;
3645
+ return !await holder.activePlans.hasActivePlan(holder.user.id);
3646
+ }
3647
+ /**
3648
+ * One request's or turn's view of `isOperationalBillingEnabled`: the settings and plan reads run
3649
+ * at most once per holder, so repeated spend in the same unit of work does not repeat them. A
3650
+ * rejected read is not kept. Never share one across requests: it would pin a stale answer.
3651
+ */
3652
+ function memoizeOperationalBillingCheck(db, logger) {
3653
+ const memo = /* @__PURE__ */ new Map();
3654
+ return (holder) => {
3655
+ const key = holder ? `${holder.user.id}:${holder.organization?.id ?? ""}` : "";
3656
+ let pending = memo.get(key);
3657
+ if (!pending) {
3658
+ pending = isOperationalBillingEnabled(db, logger, holder);
3659
+ memo.set(key, pending);
3660
+ pending.catch(() => memo.delete(key));
3661
+ }
3662
+ return pending;
3663
+ };
3664
+ }
3665
+ /**
3666
+ * Whether operational usage (auto-naming, summarization, tagging, embeddings for search and file
3667
+ * indexing) actually debits credits. Requires `enforceCredits`, the platform-wide metering master
3668
+ * switch (off on self-host). On top of it, `billOperationalUsage` opts every holder in; with it
3669
+ * off, only a free-tier `holder` is billed. Without a `holder` the free-tier carve-out cannot
3670
+ * apply, so the answer is the toggle alone.
3671
+ *
3672
+ * Shared by `recordOperationalUsage` (the settlement) and every credit pre-flight that guards a
3673
+ * path settling through it, so the two provably agree on when a debit can happen. They MUST stay
3674
+ * in sync, including passing the same holder: a pre-flight stricter than the settlement rejects
3675
+ * work that would never have been billed, and a looser one leaves the gap the pre-flight exists
3676
+ * to close.
3677
+ *
3678
+ * Owns the fetch rather than taking a settings map, so no caller can narrow it to the
3679
+ * wrong keys: under `skipCache` a `names` list that omits a key reads `undefined` for
3680
+ * it and silently gates billing OFF - turning a pre-flight into a no-op with no error
3681
+ * anywhere. `skipCache` is required for the same reason: a long-lived host's process
3682
+ * cache can lag another process's admin write until its TTL expires.
3683
+ *
3684
+ * Throws if the settings store or the plan read does: a caller that must not fail on a
3685
+ * billing-store blip has to catch this and decide its own fallback.
3686
+ */
3687
+ async function isOperationalBillingEnabled(db, logger, holder) {
3688
+ const settings = await getSettingsMap(db, {
3689
+ logger,
3690
+ names: ["billOperationalUsage", "enforceCredits"],
3691
+ skipCache: true
3692
+ });
3693
+ if (!(getSettingsValue("enforceCredits", settings) ?? false)) return false;
3694
+ if (getSettingsValue("billOperationalUsage", settings) ?? false) return true;
3695
+ return holder ? isFreeTierHolder(holder) : false;
3696
+ }
3697
+ //#endregion
3698
+ //#region ../../b4m-core/services/dist/toolGenerators-Bh6zx8vU.mjs
3651
3699
  const diceRoll = async (parameters) => {
3652
3700
  if (!parameters?.sides || !parameters?.times) throw new Error("Tool dice roll: Missing required parameters");
3653
3701
  return sum(times(parameters.times, () => random(1, parameters.sides))).toString();
@@ -7759,7 +7807,7 @@ function isWriteTargetingPlanFile(writePath, cwd = process.cwd()) {
7759
7807
  * it and the live mode so they never exceed the parent but still honor a mid-run plan switch.
7760
7808
  */
7761
7809
  async function resolveInteractionMode(override) {
7762
- const { useCliStore } = await import("./store-Bpdo9Syo.mjs");
7810
+ const { useCliStore } = await import("./store-OGMXhD4A.mjs");
7763
7811
  const liveInteractionMode = useCliStore.getState().interactionMode;
7764
7812
  return override ? clampInteractionMode(liveInteractionMode, override) : liveInteractionMode;
7765
7813
  }
@@ -16542,37 +16590,6 @@ function createSkillTool(deps) {
16542
16590
  //#endregion
16543
16591
  //#region src/tools/writeTodosTool.ts
16544
16592
  /**
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
16593
  * Format todos for display output
16577
16594
  */
16578
16595
  function formatTodosOutput(todos) {
@@ -16584,7 +16601,7 @@ function formatTodosOutput(todos) {
16584
16601
  };
16585
16602
  return todos.map((todo, index) => {
16586
16603
  const emoji = statusEmoji[todo.status];
16587
- return `${index + 1}. ${emoji} [${todo.status}] ${todo.description}`;
16604
+ return `${index + 1}. ${emoji} [${todo.status}] ${todo.content}`;
16588
16605
  }).join("\n");
16589
16606
  }
16590
16607
  /**
@@ -16605,10 +16622,15 @@ function formatTodosOutput(todos) {
16605
16622
  function createWriteTodosTool(todoStore) {
16606
16623
  return {
16607
16624
  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)}`;
16625
+ const todos = args?.todos;
16626
+ if (!Array.isArray(todos)) throw new Error("write_todos: todos must be an array");
16627
+ const { plan, warnings } = fromCliTodos(todos);
16628
+ const notes = warnings.length > 0 ? `\n\nNotes:\n${warnings.map((w) => `- ${w}`).join("\n")}` : "";
16629
+ if (todos.length > 0 && plan.items.length === 0) throw new Error(`write_todos: no valid todo items; the existing list was kept.${notes}`);
16630
+ todoStore.todos = plan.items;
16631
+ todoStore.onUpdate?.(plan.items);
16632
+ if (plan.items.length === 0) return "Todo list cleared.";
16633
+ return `Todo list updated successfully:\n\n${formatTodosOutput(plan.items)}${notes}`;
16612
16634
  },
16613
16635
  toolSchema: {
16614
16636
  name: "write_todos",
@@ -16622,7 +16644,7 @@ function createWriteTodosTool(todoStore) {
16622
16644
  **Important guidelines:**
16623
16645
  - Call this tool early when receiving complex requests
16624
16646
  - Update the list immediately when starting, completing, or cancelling tasks
16625
- - Only ONE task should be 'in_progress' at a time
16647
+ - Only ONE task should be 'in_progress' at a time (extra ones are reset to pending)
16626
16648
  - Never batch updates - update as soon as state changes
16627
16649
 
16628
16650
  **Status values:**
@@ -16641,13 +16663,19 @@ If asked to "create a new React component with tests", break it down:
16641
16663
  type: "object",
16642
16664
  properties: { todos: {
16643
16665
  type: "array",
16644
- description: "Complete list of todo items. This replaces any existing list. Each item needs a description and status.",
16666
+ description: "Complete list of todo items (at most 50). This replaces any existing list. Each item needs content and a status.",
16645
16667
  items: {
16646
16668
  type: "object",
16647
16669
  properties: {
16648
- description: {
16670
+ content: {
16671
+ type: "string",
16672
+ description: "Clear, concise description of the task (imperative, e.g. \"Run tests\")",
16673
+ maxLength: 200
16674
+ },
16675
+ activeForm: {
16649
16676
  type: "string",
16650
- description: "Clear, concise description of the task"
16677
+ description: "Present-continuous form shown while in progress (e.g. \"Running tests\")",
16678
+ maxLength: 200
16651
16679
  },
16652
16680
  status: {
16653
16681
  type: "string",
@@ -16660,7 +16688,7 @@ If asked to "create a new React component with tests", break it down:
16660
16688
  description: "Current status of the task. Only ONE task can be 'in_progress' at a time."
16661
16689
  }
16662
16690
  },
16663
- required: ["description", "status"]
16691
+ required: ["content", "status"]
16664
16692
  }
16665
16693
  } },
16666
16694
  required: ["todos"]
@@ -16677,6 +16705,11 @@ function createTodoStore(onUpdate) {
16677
16705
  onUpdate
16678
16706
  };
16679
16707
  }
16708
+ /** Empty the plan and tell listeners (the Ink plan block) it is gone. */
16709
+ function resetTodoStore(store) {
16710
+ store.todos = [];
16711
+ store.onUpdate?.([]);
16712
+ }
16680
16713
  //#endregion
16681
16714
  //#region src/tools/findDefinitionTool.ts
16682
16715
  const execFileAsync = promisify(execFile);
@@ -17313,378 +17346,6 @@ function createGetFileStructureTool(allowedDirectories) {
17313
17346
  };
17314
17347
  }
17315
17348
  //#endregion
17316
- //#region src/tools/decisionLogTool.ts
17317
- /**
17318
- * Validate log_decision parameters
17319
- * @throws Error if validation fails
17320
- */
17321
- function validateParams$1(args) {
17322
- const params = args;
17323
- if (typeof params.summary !== "string" || params.summary.trim() === "") throw new Error("log_decision: summary must be a non-empty string");
17324
- if (typeof params.rationale !== "string" || params.rationale.trim() === "") throw new Error("log_decision: rationale must be a non-empty string");
17325
- if (params.alternatives !== void 0) {
17326
- if (!Array.isArray(params.alternatives)) throw new Error("log_decision: alternatives must be an array of strings");
17327
- for (const alt of params.alternatives) if (typeof alt !== "string") throw new Error("log_decision: each alternative must be a string");
17328
- }
17329
- if (params.context !== void 0 && typeof params.context !== "string") throw new Error("log_decision: context must be a string");
17330
- return {
17331
- summary: params.summary.trim(),
17332
- rationale: params.rationale.trim(),
17333
- alternatives: params.alternatives,
17334
- context: typeof params.context === "string" ? params.context.trim() : void 0
17335
- };
17336
- }
17337
- /**
17338
- * Format decisions for display output
17339
- */
17340
- function formatDecisionsOutput(decisions) {
17341
- if (decisions.length === 0) return "No decisions logged in this session.";
17342
- return decisions.map((decision, index) => {
17343
- const lines = [`${index + 1}. **${decision.summary}**`, ` Rationale: ${decision.rationale}`];
17344
- if (decision.alternatives && decision.alternatives.length > 0) lines.push(` Alternatives considered: ${decision.alternatives.join(", ")}`);
17345
- if (decision.context) lines.push(` Context: ${decision.context}`);
17346
- const timestamp = new Date(decision.timestamp).toLocaleTimeString();
17347
- lines.push(` Logged at: ${timestamp}`);
17348
- return lines.join("\n");
17349
- }).join("\n\n");
17350
- }
17351
- /**
17352
- * Create the log_decision tool.
17353
- *
17354
- * Allows the AI to record significant decisions with rationale during a session.
17355
- * Decisions are persisted in the session's workflow state for audit trail
17356
- * and cross-session continuity.
17357
- */
17358
- function createDecisionLogTool(store) {
17359
- return {
17360
- toolFn: async (args) => {
17361
- const params = validateParams$1(args);
17362
- const decision = {
17363
- id: v4(),
17364
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
17365
- summary: params.summary,
17366
- rationale: params.rationale,
17367
- alternatives: params.alternatives,
17368
- context: params.context
17369
- };
17370
- store.decisions.push(decision);
17371
- if (store.onUpdate) store.onUpdate(store.decisions);
17372
- return `Decision logged (#${store.decisions.length}): ${decision.summary}`;
17373
- },
17374
- toolSchema: {
17375
- name: "log_decision",
17376
- description: `Record a significant decision with its rationale for audit trail and session continuity.
17377
-
17378
- **When to use:**
17379
- - Architecture or design choices (e.g., "chose Zustand over Redux because...")
17380
- - Scope narrowing or direction changes in research
17381
- - Trade-off decisions between viable alternatives
17382
- - Interpretation of ambiguous requirements
17383
-
17384
- **When NOT to use:**
17385
- - Routine operations (reading files, running tests)
17386
- - Trivial choices that wouldn't matter to someone resuming this work
17387
- - Implementation details that are obvious from the code
17388
-
17389
- Log decisions that would matter if someone needed to understand WHY you did something.`,
17390
- parameters: {
17391
- type: "object",
17392
- properties: {
17393
- summary: {
17394
- type: "string",
17395
- description: "What was decided — a clear, concise statement"
17396
- },
17397
- rationale: {
17398
- type: "string",
17399
- description: "Why this decision was made — the reasoning behind it"
17400
- },
17401
- alternatives: {
17402
- type: "array",
17403
- items: { type: "string" },
17404
- description: "What alternatives were considered (optional)"
17405
- },
17406
- context: {
17407
- type: "string",
17408
- description: "What triggered this decision — the situation or constraint (optional)"
17409
- }
17410
- },
17411
- required: ["summary", "rationale"]
17412
- }
17413
- }
17414
- };
17415
- }
17416
- /**
17417
- * Create a new empty DecisionStore
17418
- */
17419
- function createDecisionStore(onUpdate) {
17420
- return {
17421
- decisions: [],
17422
- onUpdate
17423
- };
17424
- }
17425
- //#endregion
17426
- //#region src/tools/blockerTool.ts
17427
- /**
17428
- * Format blockers for display output
17429
- */
17430
- function formatBlockersOutput(blockers) {
17431
- if (blockers.length === 0) return "No blockers tracked in this session.";
17432
- const open = blockers.filter((b) => b.status === "open");
17433
- const resolved = blockers.filter((b) => b.status === "resolved");
17434
- const lines = [];
17435
- if (open.length > 0) {
17436
- lines.push(`**Open blockers (${open.length}):**`);
17437
- for (const blocker of open) lines.push(` - [${blocker.id.slice(0, 8)}] ${blocker.description}`);
17438
- }
17439
- if (resolved.length > 0) {
17440
- if (open.length > 0) lines.push("");
17441
- lines.push(`**Resolved blockers (${resolved.length}):**`);
17442
- for (const blocker of resolved) {
17443
- lines.push(` - [${blocker.id.slice(0, 8)}] ${blocker.description}`);
17444
- lines.push(` Resolution: ${blocker.resolution ?? "(no resolution recorded)"}`);
17445
- }
17446
- }
17447
- return lines.join("\n");
17448
- }
17449
- /**
17450
- * Create the track_blocker and resolve_blocker tools.
17451
- *
17452
- * Allows the AI to track what's blocking progress and record resolutions.
17453
- * Blockers are persisted in the session's workflow state for audit trail
17454
- * and cross-session continuity.
17455
- */
17456
- function createBlockerTools(store) {
17457
- return [{
17458
- toolFn: async (args) => {
17459
- const params = args;
17460
- if (typeof params.description !== "string" || params.description.trim() === "") throw new Error("track_blocker: description must be a non-empty string");
17461
- const blocker = {
17462
- id: v4(),
17463
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
17464
- description: params.description.trim(),
17465
- status: "open"
17466
- };
17467
- store.blockers.push(blocker);
17468
- if (store.onUpdate) store.onUpdate(store.blockers);
17469
- const openCount = store.blockers.filter((b) => b.status === "open").length;
17470
- return `Blocker tracked [${blocker.id.slice(0, 8)}]: ${blocker.description}\n(${openCount} open blocker${openCount === 1 ? "" : "s"})`;
17471
- },
17472
- toolSchema: {
17473
- name: "track_blocker",
17474
- description: `Track something that is blocking progress.
17475
-
17476
- **When to use:**
17477
- - Missing information or unclear requirements
17478
- - External dependencies (waiting on API access, credentials, data)
17479
- - Technical constraints discovered during work
17480
- - Ambiguous requirements that need human clarification
17481
-
17482
- **When NOT to use:**
17483
- - Normal challenges that are part of the work
17484
- - Things you can resolve immediately`,
17485
- parameters: {
17486
- type: "object",
17487
- properties: { description: {
17488
- type: "string",
17489
- description: "What is blocking progress — be specific about what is needed to unblock"
17490
- } },
17491
- required: ["description"]
17492
- }
17493
- }
17494
- }, {
17495
- toolFn: async (args) => {
17496
- const params = args;
17497
- if (typeof params.blocker_id !== "string" || params.blocker_id.trim() === "") throw new Error("resolve_blocker: blocker_id must be a non-empty string");
17498
- if (typeof params.resolution !== "string" || params.resolution.trim() === "") throw new Error("resolve_blocker: resolution must be a non-empty string");
17499
- const blockerId = params.blocker_id.trim();
17500
- const blocker = store.blockers.find((b) => b.id === blockerId || b.id.startsWith(blockerId));
17501
- if (!blocker) {
17502
- const openBlockers = store.blockers.filter((b) => b.status === "open");
17503
- if (openBlockers.length === 0) return "No open blockers to resolve.";
17504
- return `Blocker not found. Open blockers:\n${openBlockers.map((b) => ` [${b.id.slice(0, 8)}] ${b.description}`).join("\n")}`;
17505
- }
17506
- if (blocker.status === "resolved") return `Blocker [${blocker.id.slice(0, 8)}] is already resolved.`;
17507
- blocker.status = "resolved";
17508
- blocker.resolvedAt = (/* @__PURE__ */ new Date()).toISOString();
17509
- blocker.resolution = params.resolution.trim();
17510
- if (store.onUpdate) store.onUpdate(store.blockers);
17511
- const openCount = store.blockers.filter((b) => b.status === "open").length;
17512
- return `Blocker resolved [${blocker.id.slice(0, 8)}]: ${blocker.resolution}\n(${openCount} open blocker${openCount === 1 ? "" : "s"} remaining)`;
17513
- },
17514
- toolSchema: {
17515
- name: "resolve_blocker",
17516
- description: `Mark a blocker as resolved with a description of how it was resolved.
17517
-
17518
- Use the blocker ID (or its first 8 characters) from the track_blocker output.`,
17519
- parameters: {
17520
- type: "object",
17521
- properties: {
17522
- blocker_id: {
17523
- type: "string",
17524
- description: "The ID of the blocker to resolve (full ID or first 8 characters)"
17525
- },
17526
- resolution: {
17527
- type: "string",
17528
- description: "How the blocker was resolved"
17529
- }
17530
- },
17531
- required: ["blocker_id", "resolution"]
17532
- }
17533
- }
17534
- }];
17535
- }
17536
- /**
17537
- * Create a new empty BlockerStore
17538
- */
17539
- function createBlockerStore(onUpdate) {
17540
- return {
17541
- blockers: [],
17542
- onUpdate
17543
- };
17544
- }
17545
- //#endregion
17546
- //#region src/tools/reviewGateTool.ts
17547
- const MAX_DESCRIPTION_LENGTH = 2e3;
17548
- const MAX_RECOMMENDATION_LENGTH = 1e3;
17549
- const MAX_OPTION_LENGTH = 500;
17550
- const MAX_OPTIONS_COUNT = 10;
17551
- /**
17552
- * Validate request_review_gate parameters
17553
- * @throws Error if validation fails
17554
- */
17555
- function validateParams(args) {
17556
- const params = args;
17557
- if (typeof params.description !== "string" || params.description.trim() === "") throw new Error("request_review_gate: description must be a non-empty string");
17558
- if (params.description.length > MAX_DESCRIPTION_LENGTH) throw new Error(`request_review_gate: description must be ${MAX_DESCRIPTION_LENGTH} characters or fewer`);
17559
- if (params.options !== void 0) {
17560
- if (!Array.isArray(params.options)) throw new Error("request_review_gate: options must be an array of strings");
17561
- if (params.options.length > MAX_OPTIONS_COUNT) throw new Error(`request_review_gate: options must contain ${MAX_OPTIONS_COUNT} entries or fewer`);
17562
- for (const opt of params.options) {
17563
- if (typeof opt !== "string") throw new Error("request_review_gate: each option must be a string");
17564
- if (opt.length > MAX_OPTION_LENGTH) throw new Error(`request_review_gate: each option must be ${MAX_OPTION_LENGTH} characters or fewer`);
17565
- }
17566
- }
17567
- if (params.recommendation !== void 0) {
17568
- if (typeof params.recommendation !== "string") throw new Error("request_review_gate: recommendation must be a string");
17569
- if (params.recommendation.length > MAX_RECOMMENDATION_LENGTH) throw new Error(`request_review_gate: recommendation must be ${MAX_RECOMMENDATION_LENGTH} characters or fewer`);
17570
- }
17571
- const options = params.options?.map((o) => o.trim()).filter((o) => o.length > 0);
17572
- return {
17573
- description: params.description.trim(),
17574
- options: options && options.length > 0 ? options : void 0,
17575
- recommendation: typeof params.recommendation === "string" ? params.recommendation.trim() : void 0
17576
- };
17577
- }
17578
- /**
17579
- * Format review gates for display output
17580
- */
17581
- function formatReviewGatesOutput(gates) {
17582
- if (gates.length === 0) return "No review gates recorded in this session.";
17583
- return gates.map((gate, index) => {
17584
- const lines = [`${index + 1}. **${gate.description}**`, ` Status: ${gate.status}`];
17585
- if (gate.recommendation) lines.push(` Recommendation: ${gate.recommendation}`);
17586
- if (gate.options && gate.options.length > 0) {
17587
- lines.push(" Options:");
17588
- for (const opt of gate.options) lines.push(` • ${opt}`);
17589
- }
17590
- if (gate.userNote) lines.push(` Note: ${gate.userNote}`);
17591
- const requested = new Date(gate.timestamp).toLocaleTimeString();
17592
- lines.push(` Requested at: ${requested}`);
17593
- if (gate.resolvedAt) {
17594
- const resolved = new Date(gate.resolvedAt).toLocaleTimeString();
17595
- lines.push(` Resolved at: ${resolved}`);
17596
- }
17597
- return lines.join("\n");
17598
- }).join("\n\n");
17599
- }
17600
- /**
17601
- * Create the request_review_gate tool.
17602
- *
17603
- * Pauses agent execution and prompts the user for explicit approval at a
17604
- * significant decision point. The agent halts until the user responds.
17605
- *
17606
- * Decisions are persisted in the session's workflow state (`reviewGates`)
17607
- * for audit trail and cross-session continuity.
17608
- */
17609
- function createReviewGateTool(store, requestReviewFn) {
17610
- return {
17611
- toolFn: async (args) => {
17612
- const params = validateParams(args);
17613
- const id = v4();
17614
- const requestedAt = (/* @__PURE__ */ new Date()).toISOString();
17615
- const response = await requestReviewFn({
17616
- id,
17617
- description: params.description,
17618
- options: params.options,
17619
- recommendation: params.recommendation
17620
- });
17621
- const trimmedNote = response.note?.trim();
17622
- const entry = {
17623
- id,
17624
- timestamp: requestedAt,
17625
- description: params.description,
17626
- status: response.decision,
17627
- resolvedAt: (/* @__PURE__ */ new Date()).toISOString(),
17628
- userNote: trimmedNote && trimmedNote.length > 0 ? trimmedNote : void 0,
17629
- options: params.options,
17630
- recommendation: params.recommendation
17631
- };
17632
- store.reviewGates.push(entry);
17633
- if (store.onUpdate) store.onUpdate(store.reviewGates);
17634
- const verdict = response.decision === "approved" ? "APPROVED" : "REJECTED";
17635
- const noteText = entry.userNote ? `\nUser note: ${entry.userNote}` : "";
17636
- return `Review gate ${verdict} [${id.slice(0, 8)}]: ${params.description}${noteText}`;
17637
- },
17638
- toolSchema: {
17639
- name: "request_review_gate",
17640
- description: `Pause execution and request explicit human approval at a significant decision point.
17641
-
17642
- Review gates protect meaning. Stop before crossing decisions that affect interpretation, evidence, cost, credentials, platform, or public commitment.
17643
-
17644
- **When to use:**
17645
- - Synthesizing findings before narrowing research scope
17646
- - Hard-to-reverse decisions (refactors, architectural pivots, dependency swaps)
17647
- - Decisions affecting cost, credentials, or external commitments
17648
- - Major direction changes after exploration
17649
-
17650
- **When NOT to use:**
17651
- - Routine operations (reading files, running tests, listing directories)
17652
- - Operations already covered by the standard permission system (file edits, bash commands)
17653
- - Trivial choices that wouldn't matter to someone resuming this work
17654
-
17655
- The agent will pause until the user explicitly approves or rejects. The user may attach an optional note to their decision (e.g., to redirect or clarify scope). Treat a rejection as a hard stop — re-plan rather than retry.`,
17656
- parameters: {
17657
- type: "object",
17658
- properties: {
17659
- description: {
17660
- type: "string",
17661
- description: "Clear explanation of what the user is being asked to approve, including relevant context"
17662
- },
17663
- options: {
17664
- type: "array",
17665
- items: { type: "string" },
17666
- description: "Optional list of alternatives the user can choose between"
17667
- },
17668
- recommendation: {
17669
- type: "string",
17670
- description: "Optional recommendation from the AI on the preferred path and why"
17671
- }
17672
- },
17673
- required: ["description"]
17674
- }
17675
- }
17676
- };
17677
- }
17678
- /**
17679
- * Create a new empty ReviewGateStore
17680
- */
17681
- function createReviewGateStore(onUpdate) {
17682
- return {
17683
- reviewGates: [],
17684
- onUpdate
17685
- };
17686
- }
17687
- //#endregion
17688
17349
  //#region src/utils/StreamLogger.ts
17689
17350
  /**
17690
17351
  * StreamLogger manages intelligent batching of SSE stream debug logs.
@@ -20000,8 +19661,8 @@ async function buildSandbox(input) {
20000
19661
  const { config, sessionId, permissionManager, checkpointStore } = input;
20001
19662
  const log = input.log ?? consoleLog;
20002
19663
  const [{ createSandboxRuntime }, { SandboxOrchestrator }, { DEFAULT_SANDBOX_CONFIG }, { ProxyManager }, { ViolationLogStore }] = await Promise.all([
20003
- import("./SandboxRuntimeAdapter-u6c_IrjP.mjs"),
20004
- import("./SandboxOrchestrator-lpxVEFO7.mjs"),
19664
+ import("./SandboxRuntimeAdapter-CFEIywKt.mjs"),
19665
+ import("./SandboxOrchestrator-CeDwd6Fj.mjs"),
20005
19666
  import("./types-BFIvwByC.mjs"),
20006
19667
  import("./ProxyManager-TxEKlgdO.mjs"),
20007
19668
  import("./ViolationLogStore-byEhxa2A.mjs")
@@ -21366,7 +21027,7 @@ var SubagentOrchestrator = class {
21366
21027
  const depth = options.depth ?? 1;
21367
21028
  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
21029
  const resumeId = options.resumeId ?? `sub-${randomBytes(4).toString("hex")}`;
21369
- const { useCliStore } = await import("./store-Bpdo9Syo.mjs");
21030
+ const { useCliStore } = await import("./store-OGMXhD4A.mjs");
21370
21031
  const parentInteractionMode = options.parentInteractionMode ?? useCliStore.getState().interactionMode;
21371
21032
  const effectiveInteractionMode = clampInteractionMode(options.interactionMode ?? parentInteractionMode, parentInteractionMode);
21372
21033
  let agentDef;
@@ -22116,4 +21777,4 @@ var AgentHistoryStore = class {
22116
21777
  }
22117
21778
  };
22118
21779
  //#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 };
21780
+ export { signInUncheckedMessage as $, FallbackLlmBackend as A, DEFAULT_THOROUGHNESS as B, resetTodoStore as C, DEFAULT_SUBAGENT_HISTORY_TTL_MS as Ct, createResumeAgentTool as D, createCoordinateTaskTool as E, generateCliTools as F, SIGN_IN_DURING_TURN as G, LOGGED_OUT_RESTART as H, ALWAYS_DENIED_FOR_AGENTS as I, SIGN_IN_HINT as J, SIGN_IN_EXPIRED as K, DEFAULT_AGENT_MODEL as L, substituteArguments as M, PermissionManager as N, createBackgroundAgentTools as O, buildCliToolList as P, signInUncheckedLoginMessage as Q, DEFAULT_MAX_ITERATIONS as R, createWriteTodosTool as S, COMPACTION_SUMMARY_MARKER as St, parseAgentConfig as T, USAGE_CACHE_TTL as Tt, NoLocalModelsError as U, LOCAL_SESSION_CONTINUES as V, SIGNED_OUT_BANNER as W, loginBlocked as X, SignedOutCloudBackend as Y, signInUncheckedHeadlessMessage as Z, createSseBackend as _, CommandHistoryStore as _t, loadProjectContext as a, ReActAgent as at, createFindDefinitionTool as b, searchFiles as bt, checkSavedSignIn as c, wrapTools as ct, attachLocalModels as d, classifyCommandRisk as dt, signedOutCommandMessage as et, buildLlmBackend as f, getPlanModeFilePath as ft, withSignedOutLocalDefault as g, CheckpointStore as gt, resolveSignedOutHeadlessModel as h, hasFileReferences as ht, buildProjectAgentStore as i, DeferredToolRegistry as it, isConnectionDrop as j, createAgentDelegateTool as k, settleSignInRefresh as l, getProcessHooks as lt, resolveHeadlessModel as m, processFileReferences as mt, BackgroundAgentManager as n, buildSystemPrompt as nt, McpManager as o, createToolSearchTool as ot, defaultLlmBackendDeps as p, CustomCommandStore as pt, SIGN_IN_EXPIRED_HEADLESS as q, SubagentOrchestrator as r, buildSkillsPromptSection as rt, buildSandbox as s, findIterationBoundary as st, AgentHistoryStore as t, signedOutNoMatchMessage as tt, startupMode as u, setWebSocketToolExecutor as ut, createGetFileStructureTool as v, SessionStore as vt, createSkillTool as w, MAX_PASTE_SIZE as wt, createTodoStore as x, warmFileCache as xt, createWorkItemTools as y, formatFileSize as yt, DEFAULT_RETRY_CONFIG as z };