@chosengeneration/light-code 0.186.0 → 0.187.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.
package/dist/server.cjs CHANGED
@@ -24414,6 +24414,8 @@ function buildConnectOptions(options, env2 = process.env) {
24414
24414
  }
24415
24415
 
24416
24416
  // ../../packages/core/dist/platform/http.js
24417
+ var CONNECT_TIMEOUT_MS = 6e4;
24418
+ var FAMILY_ATTEMPT_MS = 1e3;
24417
24419
  function tlsKey(tls2) {
24418
24420
  const hash3 = (0, import_node_crypto.createHash)("sha256");
24419
24421
  for (const part of [tls2.cert, tls2.key, tls2.pfx, ...tls2.ca ?? []]) {
@@ -24468,8 +24470,11 @@ var FetchHttpClient = class {
24468
24470
  ...tls2 !== void 0 ? buildConnectOptions(tls2) : { ca: buildConnectOptions({}).ca },
24469
24471
  // Happy Eyeballs. Without it a host whose AAAA record is black-holed — ordinary on a
24470
24472
  // corporate network with partial IPv6 — hangs instead of falling back to IPv4.
24471
- autoSelectFamily: true
24472
- }
24473
+ autoSelectFamily: true,
24474
+ autoSelectFamilyAttemptTimeout: FAMILY_ATTEMPT_MS,
24475
+ timeout: CONNECT_TIMEOUT_MS
24476
+ },
24477
+ proxyTls: { timeout: CONNECT_TIMEOUT_MS }
24473
24478
  });
24474
24479
  this.proxyAgents.set(key3, agent);
24475
24480
  return agent;
@@ -24484,7 +24489,9 @@ var FetchHttpClient = class {
24484
24489
  ...buildConnectOptions(tls2),
24485
24490
  // Happy Eyeballs, for the same reason as the proxy path: a black-holed AAAA record is a
24486
24491
  // hang rather than an error, and every other client on the machine falls back.
24487
- autoSelectFamily: true
24492
+ autoSelectFamily: true,
24493
+ autoSelectFamilyAttemptTimeout: FAMILY_ATTEMPT_MS,
24494
+ timeout: CONNECT_TIMEOUT_MS
24488
24495
  }
24489
24496
  });
24490
24497
  this.agents.set(key3, agent);
@@ -41469,13 +41476,17 @@ function compareMentionCandidates(query) {
41469
41476
  return a.localeCompare(b);
41470
41477
  };
41471
41478
  }
41479
+ function withoutTrailingSlash(candidate) {
41480
+ return candidate.endsWith("/") ? candidate.slice(0, -1) : candidate;
41481
+ }
41472
41482
  function fileNameOf(candidate) {
41473
- const slash = candidate.lastIndexOf("/");
41474
- return slash < 0 ? candidate : candidate.slice(slash + 1);
41483
+ const trimmed = withoutTrailingSlash(candidate);
41484
+ const slash = trimmed.lastIndexOf("/");
41485
+ return slash < 0 ? trimmed : trimmed.slice(slash + 1);
41475
41486
  }
41476
41487
  function depthOf(candidate) {
41477
41488
  let depth = 0;
41478
- for (const character of candidate)
41489
+ for (const character of withoutTrailingSlash(candidate))
41479
41490
  if (character === "/")
41480
41491
  depth += 1;
41481
41492
  return depth;
@@ -41492,6 +41503,13 @@ function rank(candidate, needle) {
41492
41503
  return 2;
41493
41504
  if (name.includes(needle))
41494
41505
  return 3;
41506
+ const folders = withoutTrailingSlash(candidate).toLowerCase().split("/").slice(0, -1);
41507
+ if (folders.some((folder) => folder === needle))
41508
+ return 3.25;
41509
+ if (folders.some((folder) => folder.startsWith(needle)))
41510
+ return 3.5;
41511
+ if (folders.some((folder) => folder.includes(needle)))
41512
+ return 3.75;
41495
41513
  return 4;
41496
41514
  }
41497
41515
  function matchesMentionQuery(query) {
@@ -41524,8 +41542,28 @@ function mentionSegment(query) {
41524
41542
 
41525
41543
  // ../../packages/core/dist/context/mentionSearch.js
41526
41544
  var import_node_path2 = __toESM(require("node:path"), 1);
41545
+ var FOLDER_SCAN_LIMIT = 300;
41546
+ var FOLDERS_OPENED = 2;
41547
+ var FILES_PER_FOLDER = 40;
41527
41548
  async function searchMentions(find2, workspaceRoot, query, excludeFolders, scanLimit, resultLimit, otherRoot) {
41528
41549
  const segment = mentionSegment(query);
41550
+ const base = otherRoot ?? workspaceRoot;
41551
+ const relative = (absolute) => import_node_path2.default.relative(workspaceRoot, absolute).split(import_node_path2.default.sep).join("/");
41552
+ const typedFolder = folderPart(query);
41553
+ if (typedFolder !== void 0) {
41554
+ const inside = import_node_path2.default.resolve(base, typedFolder);
41555
+ const within = import_node_path2.default.relative(base, inside);
41556
+ if (within.length > 0 && !within.startsWith("..") && !import_node_path2.default.isAbsolute(within)) {
41557
+ const [files2, folders2] = await Promise.all([
41558
+ find2(segment, scanLimit, excludeFolders, void 0, void 0, inside).catch(() => []),
41559
+ find2(segment, FOLDER_SCAN_LIMIT, excludeFolders, "folders", void 0, inside).catch(() => [])
41560
+ ]);
41561
+ if (files2.length > 0 || folders2.length > 0) {
41562
+ const insideQuery = `${typedFolder.replace(/\\/g, "/").replace(/\/+$/, "")}/${segment}`;
41563
+ return rank2([...folders2.map((f) => `${relative(f)}/`), ...files2.map(relative)], insideQuery, resultLimit);
41564
+ }
41565
+ }
41566
+ }
41529
41567
  let found2 = await find2(segment, scanLimit, excludeFolders, void 0, void 0, otherRoot);
41530
41568
  if (found2.length >= scanLimit && segment.length > 0) {
41531
41569
  const leading = [];
@@ -41534,7 +41572,32 @@ async function searchMentions(find2, workspaceRoot, query, excludeFolders, scanL
41534
41572
  }
41535
41573
  found2 = [.../* @__PURE__ */ new Set([...leading, ...found2])];
41536
41574
  }
41537
- return found2.map((absolute) => import_node_path2.default.relative(workspaceRoot, absolute).split(import_node_path2.default.sep).join("/")).filter(matchesMentionQuery(query)).sort(compareMentionCandidates(query)).slice(0, resultLimit);
41575
+ const files = found2.map(relative);
41576
+ if (segment.length === 0)
41577
+ return rank2(files, query, resultLimit);
41578
+ const needle = segment.toLowerCase();
41579
+ const folderList = await find2(segment, FOLDER_SCAN_LIMIT, excludeFolders, "folders", void 0, otherRoot).catch(() => []);
41580
+ const folders = new Set(folderList.map((f) => `${relative(f)}/`));
41581
+ for (const file2 of files) {
41582
+ const parts = file2.split("/");
41583
+ for (let i = 0; i < parts.length - 1; i++) {
41584
+ if ((parts[i] ?? "").toLowerCase().includes(needle))
41585
+ folders.add(`${parts.slice(0, i + 1).join("/")}/`);
41586
+ }
41587
+ }
41588
+ const best = [...folders].filter(matchesMentionQuery(query)).sort(compareMentionCandidates(query)).slice(0, FOLDERS_OPENED);
41589
+ const opened = await Promise.all(best.map((folder) => find2("", FILES_PER_FOLDER, excludeFolders, void 0, void 0, import_node_path2.default.join(workspaceRoot, folder)).catch(() => [])));
41590
+ return rank2([...folders, ...files, ...opened.flat().map(relative)], query, resultLimit);
41591
+ }
41592
+ function rank2(candidates, query, limit) {
41593
+ return [...new Set(candidates)].filter((c2) => c2 !== "/" && !c2.startsWith("../")).filter(matchesMentionQuery(query)).sort(compareMentionCandidates(query)).slice(0, limit);
41594
+ }
41595
+ function folderPart(query) {
41596
+ const trimmed = query.trim();
41597
+ const separator = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
41598
+ if (separator <= 0)
41599
+ return void 0;
41600
+ return trimmed.slice(0, separator);
41538
41601
  }
41539
41602
 
41540
41603
  // ../../packages/core/dist/python/jupyter.js
@@ -42774,16 +42837,26 @@ function describeTlsError(error51) {
42774
42837
  if (/EPROTO|SSL routines|SSL alert|handshake|TLSV1|BAD_CERTIFICATE/i.test(combined)) {
42775
42838
  return "the TLS handshake failed. The gateway may require a client certificate, or may have rejected the one presented.";
42776
42839
  }
42840
+ const code = transportCode(combined);
42841
+ if (/UND_ERR_CONNECT_TIMEOUT|Connect Timeout/i.test(combined)) {
42842
+ return `the connection could not be made in time (${code ?? "UND_ERR_CONNECT_TIMEOUT"}). The network may be slow or the host unreachable.`;
42843
+ }
42777
42844
  if (/ECONNREFUSED/i.test(combined))
42778
- return "the connection was refused.";
42845
+ return "the connection was refused (ECONNREFUSED).";
42779
42846
  if (/ENOTFOUND|EAI_AGAIN/i.test(combined))
42780
- return "the host could not be resolved.";
42847
+ return `the host could not be resolved (${code ?? "ENOTFOUND"}). Check the address, or the network's name lookup.`;
42781
42848
  if (/ECONNRESET|socket hang up/i.test(combined)) {
42782
- return "the connection was closed by the server. A gateway that requires a client certificate often does this when none is presented.";
42849
+ return `the connection was closed before an answer came (${code ?? "ECONNRESET"}). On an unreliable network this passes on a second try; if it happens every time, the gateway may want a client identity that was not presented.`;
42783
42850
  }
42851
+ if (/ETIMEDOUT/i.test(combined))
42852
+ return "the connection timed out (ETIMEDOUT). The network may be slow or the host unreachable.";
42784
42853
  const deepest = chain[chain.length - 1];
42785
42854
  const deepestMessage = deepest instanceof Error ? deepest.message : String(deepest);
42786
- return message6 === "fetch failed" && deepestMessage !== message6 ? deepestMessage : message6;
42855
+ const chosen = message6 === "fetch failed" && deepestMessage !== message6 ? deepestMessage : message6;
42856
+ return code !== void 0 && !chosen.includes(code) ? `${chosen} (${code})` : chosen;
42857
+ }
42858
+ function transportCode(combined) {
42859
+ return /\b(UND_ERR_[A-Z_]+|E(?:CONNRESET|CONNREFUSED|CONNABORTED|TIMEDOUT|NOTFOUND|PIPE|HOSTUNREACH|NETUNREACH|AI_AGAIN))\b/.exec(combined)?.[1];
42787
42860
  }
42788
42861
 
42789
42862
  // ../../packages/core/dist/providers/auth/certs.js
@@ -52722,15 +52795,15 @@ ${record2.preview}`.toLowerCase();
52722
52795
  const hits = await options.semantic.searcher.searchByVector(options.semantic.collection, vector, {
52723
52796
  size: Math.min(100, Math.max(limit * 4, 40))
52724
52797
  });
52725
- const rank3 = /* @__PURE__ */ new Map();
52798
+ const rank4 = /* @__PURE__ */ new Map();
52726
52799
  hits.forEach((hit, position) => {
52727
52800
  const id = hit.path.startsWith("mail:") ? hit.path.slice("mail:".length) : hit.path;
52728
- if (!rank3.has(id))
52729
- rank3.set(id, position);
52801
+ if (!rank4.has(id))
52802
+ rank4.set(id, position);
52730
52803
  });
52731
52804
  ordered = [...candidates].sort((a, b) => {
52732
- const left = rank3.get(a.id);
52733
- const right = rank3.get(b.id);
52805
+ const left = rank4.get(a.id);
52806
+ const right = rank4.get(b.id);
52734
52807
  if (left !== void 0 && right !== void 0)
52735
52808
  return left - right;
52736
52809
  if (left !== void 0)
@@ -64143,9 +64216,9 @@ async function truncateToolResult(content, store, maxChars = DEFAULT_MAX_CHARS,
64143
64216
 
64144
64217
  // ../../packages/core/dist/agent/transient.js
64145
64218
  var TRANSIENT_STATUS = /HTTP (408|409|425|429|500|502|503|504|520|521|522|523|524|529)\b/;
64146
- var TRANSIENT_TRANSPORT = /ECONNRESET|ECONNREFUSED|ETIMEDOUT|ECONNABORTED|EPIPE|EAI_AGAIN|ENETUNREACH|EHOSTUNREACH|socket hang up|other side closed|terminated|fetch failed|network error|UND_ERR_(SOCKET|CONNECT_TIMEOUT|HEADERS_TIMEOUT|BODY_TIMEOUT|CLOSED)|No reply from .* within/i;
64219
+ var TRANSIENT_TRANSPORT = /ECONNRESET|ECONNREFUSED|ETIMEDOUT|ECONNABORTED|EPIPE|EAI_AGAIN|ENOTFOUND|ENETUNREACH|EHOSTUNREACH|socket hang up|other side closed|terminated|fetch failed|network error|Connect Timeout|UND_ERR_(SOCKET|CONNECT_TIMEOUT|HEADERS_TIMEOUT|BODY_TIMEOUT|CLOSED)|No reply from .* within/i;
64147
64220
  var TRANSIENT_PROVIDER = /overloaded|rate.?limit|too many requests|temporarily unavailable|service unavailable|RESOURCE_EXHAUSTED|UNAVAILABLE|try again later|server_error|internal server error/i;
64148
- var PERMANENT = /HTTP (400|401|402|403|404|405|413|422)\b|credits? (are |is )?depleted|insufficient (credit|balance|funds)|billing|certificate|self[- ]signed|unable to verify|CERT_|key (does not|doesn't) match|passphrase|credential missing|context.{0,20}(length|window|limit)|too many tokens|prompt is too long/i;
64221
+ var PERMANENT = /HTTP (400|401|402|403|404|405|413|422)\b|credits? (are |is )?depleted|insufficient (credit|balance|funds)|billing|server certificate|certificate (could not|has expired|is not valid)|TLS handshake failed|self[- ]signed|unable to verify|CERT_|key (does not|doesn't) match|passphrase|credential missing|context.{0,20}(length|window|limit)|too many tokens|prompt is too long/i;
64149
64222
  function isTransientError(message6) {
64150
64223
  if (PERMANENT.test(message6))
64151
64224
  return false;
@@ -74107,7 +74180,7 @@ function backEdges(spec) {
74107
74180
  visit(node.id);
74108
74181
  return back;
74109
74182
  }
74110
- function rank2(spec, back) {
74183
+ function rank3(spec, back) {
74111
74184
  const incoming = /* @__PURE__ */ new Map();
74112
74185
  for (const node of spec.nodes)
74113
74186
  incoming.set(node.id, []);
@@ -74168,7 +74241,7 @@ function order(spec, ranks, back) {
74168
74241
  function layoutDiagram(spec) {
74169
74242
  const sideways = spec.direction === "right";
74170
74243
  const back = backEdges(spec);
74171
- const ranks = rank2(spec, back);
74244
+ const ranks = rank3(spec, back);
74172
74245
  const rows = order(spec, ranks, back);
74173
74246
  const byId = new Map(spec.nodes.map((node) => [node.id, node]));
74174
74247
  const sizes = /* @__PURE__ */ new Map();
@@ -86291,6 +86364,40 @@ ${preview.text}` } : {}
86291
86364
  void postDatasetStatus();
86292
86365
  }
86293
86366
  });
86367
+ const indexNames = /* @__PURE__ */ new WeakMap();
86368
+ function indexNamesFor(client) {
86369
+ const held = indexNames.get(client);
86370
+ if (held !== void 0 && Date.now() - held.at < 5 * 6e4)
86371
+ return held.names;
86372
+ const names = Promise.race([
86373
+ client.listIndexes().then((list2) => list2.map((i) => i.name)),
86374
+ new Promise((resolve) => setTimeout(() => resolve([]), 5e3).unref?.())
86375
+ ]).catch(() => []);
86376
+ indexNames.set(client, { at: Date.now(), names });
86377
+ return names;
86378
+ }
86379
+ function early(promise2) {
86380
+ promise2.catch(() => void 0);
86381
+ return promise2;
86382
+ }
86383
+ let pythonConfiguring = Promise.resolve();
86384
+ function configurePython(config2) {
86385
+ const next = pythonConfiguring.catch(() => void 0).then(() => python.configure({ ...config2.python ?? {}, ...pythonFolders(config2) }));
86386
+ pythonConfiguring = next;
86387
+ return next;
86388
+ }
86389
+ let gitCheck;
86390
+ function gitAvailable() {
86391
+ if (gitCheck === void 0 || Date.now() - gitCheck.at > 6e4) {
86392
+ const answer = ShadowGit.isGitAvailable();
86393
+ gitCheck = { at: Date.now(), answer };
86394
+ void answer.then((ok) => {
86395
+ if (ok)
86396
+ gitCheck = { at: Number.POSITIVE_INFINITY, answer };
86397
+ });
86398
+ }
86399
+ return gitCheck.answer;
86400
+ }
86294
86401
  const defaultSkillsDir = workspaceRoot !== void 0 ? import_node_path55.default.join(workspaceRoot, ".lightcode", "skills") : void 0;
86295
86402
  let skillsDir = defaultSkillsDir;
86296
86403
  let localSkillsDir = defaultSkillsDir;
@@ -86790,7 +86897,7 @@ ${preview.text}` } : {}
86790
86897
  });
86791
86898
  {
86792
86899
  const latest = (await configManager.load()).config;
86793
- await python.configure({ ...latest.python ?? {}, ...pythonFolders(latest) });
86900
+ await configurePython(latest);
86794
86901
  }
86795
86902
  await python.refresh();
86796
86903
  await postPython();
@@ -86810,7 +86917,7 @@ ${preview.text}` } : {}
86810
86917
  });
86811
86918
  {
86812
86919
  const latest = (await configManager.load()).config;
86813
- await python.configure({ ...latest.python ?? {}, ...pythonFolders(latest) });
86920
+ await configurePython(latest);
86814
86921
  }
86815
86922
  await python.refresh();
86816
86923
  await postPython();
@@ -89504,8 +89611,17 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89504
89611
  await knownSecretValues();
89505
89612
  const profile = resolveActiveProfile(config2);
89506
89613
  const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
89507
- const capabilities = withReportedWindow(resolveModelCapabilities(profile.model, profile.modelCapabilities), await reportedWindowFor(config2, profile), profile.modelCapabilities);
89508
- const expertCliInfo = await resolveExpert(config2);
89614
+ const windowReady = early(reportedWindowFor(config2, profile));
89615
+ const expertReady = early(resolveExpert(config2));
89616
+ const skillsReady = early(refreshSkills());
89617
+ const instructionsReady = early(readCodebaseInstructions(codebaseInstructionsFile));
89618
+ const toolsReady = early((async () => {
89619
+ await syncMcpFromConfig(config2);
89620
+ await mcp.ensureConnected();
89621
+ await configurePython(config2);
89622
+ })());
89623
+ const capabilities = withReportedWindow(resolveModelCapabilities(profile.model, profile.modelCapabilities), await windowReady, profile.modelCapabilities);
89624
+ const expertCliInfo = await expertReady;
89509
89625
  const search = await resolveSearch(config2);
89510
89626
  const embedder = await resolveEmbedder(config2);
89511
89627
  const codebaseIndex = codebaseIndexName(config2);
@@ -89513,9 +89629,9 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89513
89629
  const teamSkillsResolved = resolveTeamSkills(config2, search, embedder);
89514
89630
  const mailCollection = config2.mail?.enabled === true ? mailCollectionName(config2) : void 0;
89515
89631
  const mailSearch = mailCollection === void 0 ? void 0 : await resolveMailSearch(config2);
89516
- const searchIndexes = search?.opensearch !== void 0 ? await search.opensearch.listIndexes().then((list2) => list2.map((i) => i.name)).catch(() => []) : [];
89517
- await refreshSkills();
89518
- const codebaseInstructions = renderCodebaseInstructions(await readCodebaseInstructions(codebaseInstructionsFile));
89632
+ const searchIndexes = search?.opensearch !== void 0 ? await indexNamesFor(search.opensearch) : [];
89633
+ await skillsReady;
89634
+ const codebaseInstructions = renderCodebaseInstructions(await instructionsReady);
89519
89635
  const activeMode = findMode(config2.modeId);
89520
89636
  juniorTurnWithoutExpert = activeMode.id === "junior" && schedule === void 0;
89521
89637
  const scheduledGuidance = schedule === void 0 ? void 0 : scheduledRunGuidance(schedule, filterToolsForSchedule(currentToolRegistry(void 0, void 0, void 0, void 0, false).list(), schedule).map((tool) => tool.name).filter((name) => name !== "attempt_completion"));
@@ -89641,9 +89757,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89641
89757
  });
89642
89758
  if (conversation.systemPrompt() !== desiredPrompt)
89643
89759
  conversation.setSystemPrompt(desiredPrompt);
89644
- await syncMcpFromConfig(config2);
89645
- await mcp.ensureConnected();
89646
- await python.configure({ ...config2.python ?? {}, ...pythonFolders(config2) });
89760
+ await toolsReady;
89647
89761
  const toolContext = {
89648
89762
  fs: new NodeFileSystem(),
89649
89763
  // The shell the user chose, or the platform default. Read per turn, so changing it
@@ -89802,7 +89916,7 @@ ${direction}` : attachMentions(text2, mentions);
89802
89916
  message: `${profile.model} does not accept images. Attachments were not sent \u2014 set "Supports images" in the profile's advanced settings if that is wrong.`
89803
89917
  });
89804
89918
  }
89805
- if (shadowGit !== void 0 && await ShadowGit.isGitAvailable()) {
89919
+ if (shadowGit !== void 0 && await gitAvailable()) {
89806
89920
  turnOptions.shadowGit = shadowGit;
89807
89921
  } else {
89808
89922
  logger.warn("git not found on PATH \u2014 edits will proceed without a rollback checkpoint");
@@ -91838,7 +91952,7 @@ ${redact(shown2, cachedSecretValues)}` }
91838
91952
  }
91839
91953
  await syncMcpFromConfig(config2);
91840
91954
  await mcp.ensureConnected();
91841
- await python.configure({ ...config2.python ?? {}, ...pythonFolders(config2) });
91955
+ await configurePython(config2);
91842
91956
  const registry2 = currentToolRegistry();
91843
91957
  const tool = registry2.get(name) ?? registry2.get(`py__${name}`);
91844
91958
  if (tool === void 0) {
@@ -94391,7 +94505,7 @@ ${last}` : ""}`);
94391
94505
  if (userTurnRunning || runningScheduleId !== void 0)
94392
94506
  return;
94393
94507
  const config2 = await loadSettings();
94394
- await python.configure({ ...config2.python ?? {}, ...pythonFolders(config2) });
94508
+ await configurePython(config2);
94395
94509
  }
94396
94510
  const usageLog = new UsageLog(storageDir);
94397
94511
  const usageInstance = usageInstanceId(storageDir);
@@ -95054,7 +95168,7 @@ ${last}` : ""}`);
95054
95168
  }
95055
95169
  });
95056
95170
  const { config: config2 } = await configManager.load();
95057
- await python.configure({ ...config2.python ?? {}, ...pythonFolders(config2) });
95171
+ await configurePython(config2);
95058
95172
  await postPython();
95059
95173
  } catch (error51) {
95060
95174
  post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
@@ -97034,6 +97148,27 @@ ${notes.join("\n")}` } : answer;
97034
97148
  await postAddons().catch(() => void 0);
97035
97149
  }
97036
97150
  })();
97151
+ void (async () => {
97152
+ try {
97153
+ const config2 = await loadSettings();
97154
+ const parts = [knownSecretValues(), refreshSkills(), configurePython(config2), gitAvailable(), resolveExpert(config2)];
97155
+ if ((config2.profiles ?? []).length > 0) {
97156
+ const profile = resolveActiveProfile(config2);
97157
+ parts.push((async () => {
97158
+ if (profile.wireFormat !== "vscode-lm")
97159
+ await authStrategyFor(config2, profile).resolveHeaders();
97160
+ await reportedWindowFor(config2, profile);
97161
+ })());
97162
+ }
97163
+ const results = await Promise.allSettled(parts);
97164
+ for (const result of results) {
97165
+ if (result.status === "rejected")
97166
+ logger.info(`Preparing the session: ${describeFailure2(result.reason, true)}`);
97167
+ }
97168
+ } catch (error51) {
97169
+ logger.info(`Preparing the session was skipped: ${describeFailure2(error51, true)}`);
97170
+ }
97171
+ })();
97037
97172
  void (async () => {
97038
97173
  try {
97039
97174
  await restoreActiveTaskOnLoad();
@@ -101378,9 +101513,29 @@ always asks you).
101378
101513
  "needs my approval",
101379
101514
  "short name",
101380
101515
  "codebase name",
101381
- "review python tools once"
101516
+ "review python tools once",
101517
+ "export setup",
101518
+ "import setup",
101519
+ "new machine",
101520
+ "another computer",
101521
+ "other machine",
101522
+ "move to a new laptop",
101523
+ "same setup",
101524
+ "set up again",
101525
+ "export codebases",
101526
+ "import codebases",
101527
+ "export chats",
101528
+ "migrate fire code"
101382
101529
  ],
101383
101530
  body: `
101531
+ **Moving to another computer**: Settings \u2192 Setup \u2192 **Export\u2026** saves every codebase with its open chats by name (and,
101532
+ if ticked, each codebase's Light Code settings) to \`fire-code-setup.json\`. On the other computer, Settings \u2192 Setup \u2192
101533
+ **Import\u2026** lists them: each folder can be pointed at where that codebase is there (Browse), a codebase already in
101534
+ Fire Code is left alone, and a JupyterHub codebase keeps its hub, user and folders and asks for its token - a saved
101535
+ credential with the same name is picked by itself. Chats arrive empty under their names; conversations stay where they
101536
+ were. The file holds no password or token: export credentials separately (Settings \u2192 Credentials \u2192 Export, under a
101537
+ passphrase) if the other computer needs them.
101538
+
101384
101539
  **Agents asking each other**: the agent in one codebase can ask the agent in another for help, or to do something
101385
101540
  there, with \`ask_codebase_agent\` - you approve it, seeing the exact request and which codebase it goes to. Fire Code
101386
101541
  opens a new tab on that codebase ("From <codebase>: ...") without switching to it, and that agent starts on the
@@ -102592,7 +102747,19 @@ walkthrough, whose steps link straight into the tab each one is about. On the No
102592
102747
  "crash log",
102593
102748
  "why did it crash",
102594
102749
  "exit code",
102595
- "out of memory"
102750
+ "out of memory",
102751
+ "slow network",
102752
+ "network slowness",
102753
+ "flaky network",
102754
+ "unreliable network",
102755
+ "connection reset",
102756
+ "could not reach",
102757
+ "reaching the model",
102758
+ "first reply slow",
102759
+ "first message slow",
102760
+ "first prompt slow",
102761
+ "folder names",
102762
+ "directory names"
102596
102763
  ],
102597
102764
  body: `
102598
102765
  **The agent crashed, or python.exe "stopped working".** A Python tool's worker that crashes is restarted on the
@@ -102642,7 +102809,20 @@ Then check that the command is on the list, which the panel shows in full.
102642
102809
  **\`@\` does not find a file** \u2014 the picker searches the workspace only, and skips \`node_modules\`,
102643
102810
  \`.venv\`, build output and similar. config:filesystem.excludeFromMentions changes that list. Typing
102644
102811
  more of the name narrows it; matching is case-insensitive and matches letters in order, so
102645
- \`mrank\` finds \`mentionRanking.ts\`.
102812
+ \`mrank\` finds \`mentionRanking.ts\`. Folder names count too: \`@reports\` offers the \`reports/\` folder
102813
+ and the files in it, and choosing a folder keeps the picker open inside it, as does typing a path
102814
+ such as \`@src/reports/\`.
102815
+
102816
+ **Errors reaching the model on a slow or unreliable network** \u2014 a connection gets a minute to come up
102817
+ (it used to be ten seconds), and a dropped or reset connection, a slow name lookup or a timeout is
102818
+ tried again by itself, up to config:connection (retries) times, showing "Retrying in Ns" with the
102819
+ reason. An error that says nothing about retrying is one a retry would not fix: a certificate this
102820
+ computer does not trust, a 401, an address that is wrong.
102821
+
102822
+ **The first reply of a chat is slow and the rest are quick** \u2014 the first message used to wait for
102823
+ Python tools to load, skills to be read and the gateway's sign-in, one after another. These now start
102824
+ as soon as the chat opens, while you type; if you send before they finish, the message waits only for
102825
+ what is still running.
102646
102826
 
102647
102827
  **A tool call times out** \u2014 config:tools.timeoutSeconds is the global limit, and a single tool or
102648
102828
  MCP server can have its own; the Tools tab shows which number applies. If raising it changes
@@ -103600,14 +103780,14 @@ ${entry.record.text}`.toLowerCase();
103600
103780
  const hits = await options.semantic.searcher.searchByVector(options.semantic.collection, vector, {
103601
103781
  size: Math.min(100, Math.max(limit * 4, 40))
103602
103782
  });
103603
- const rank3 = /* @__PURE__ */ new Map();
103783
+ const rank4 = /* @__PURE__ */ new Map();
103604
103784
  hits.forEach((hit, position) => {
103605
- if (!rank3.has(hit.path))
103606
- rank3.set(hit.path, position);
103785
+ if (!rank4.has(hit.path))
103786
+ rank4.set(hit.path, position);
103607
103787
  });
103608
103788
  ordered = [...candidates].sort((a, b) => {
103609
- const left = rank3.get(`data:${a.datasetId}:${a.record.id}`);
103610
- const right = rank3.get(`data:${b.datasetId}:${b.record.id}`);
103789
+ const left = rank4.get(`data:${a.datasetId}:${a.record.id}`);
103790
+ const right = rank4.get(`data:${b.datasetId}:${b.record.id}`);
103611
103791
  if (left !== void 0 && right !== void 0)
103612
103792
  return left - right;
103613
103793
  if (left !== void 0)
@@ -105422,7 +105602,7 @@ var ToolBackedSecretStore = class _ToolBackedSecretStore {
105422
105602
  };
105423
105603
 
105424
105604
  // src/httpDeadline.ts
105425
- var HEADERS_DEADLINE_MS = 45e3;
105605
+ var HEADERS_DEADLINE_MS = 15e4;
105426
105606
  function withHeadersDeadline(inner, budgetMs = HEADERS_DEADLINE_MS) {
105427
105607
  return {
105428
105608
  /*
@@ -105628,11 +105808,13 @@ function createBrowserUi(workspaceRoot, post, fastFs, shared) {
105628
105808
  root: searchRoot,
105629
105809
  needle: segment,
105630
105810
  mode: mode ?? "contains",
105811
+ ...mode === "folders" ? { folders: true } : {},
105631
105812
  ...depth !== void 0 ? { depth } : {},
105632
105813
  limit,
105633
105814
  exclude: excludeFolders
105634
105815
  });
105635
- if (answer.ok === true && Array.isArray(answer.paths)) return answer.paths;
105816
+ const understood = mode !== "folders" || answer.folders === true;
105817
+ if (understood && answer.ok === true && Array.isArray(answer.paths)) return answer.paths;
105636
105818
  } catch {
105637
105819
  }
105638
105820
  }
@@ -105652,8 +105834,10 @@ function createBrowserUi(workspaceRoot, post, fastFs, shared) {
105652
105834
  if (entry.name.startsWith(".") && entry.name !== ".env") continue;
105653
105835
  const full = import_node_path65.default.join(dir, entry.name);
105654
105836
  if (entry.isDirectory()) {
105655
- if (!skip.has(entry.name)) await walk(full, level2 + 1);
105656
- } else if (depth !== void 0 && level2 !== depth) {
105837
+ if (skip.has(entry.name)) continue;
105838
+ if (mode === "folders" && (needle.length === 0 || entry.name.toLowerCase().includes(needle))) found2.push(full);
105839
+ await walk(full, level2 + 1);
105840
+ } else if (mode === "folders" || depth !== void 0 && level2 !== depth) {
105657
105841
  continue;
105658
105842
  } else if (needle.length === 0 || (mode === "prefix" ? entry.name.toLowerCase().startsWith(needle) : entry.name.toLowerCase().includes(needle))) {
105659
105843
  found2.push(full);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chosengeneration/light-code",
3
- "version": "0.186.0",
3
+ "version": "0.187.0",
4
4
  "description": "A minimal agentic coding assistant, served to your browser from a local Node server",
5
5
  "license": "MIT",
6
6
  "type": "module",