@chosengeneration/light-code 0.209.0 → 0.212.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 (3) hide show
  1. package/dist/cli.cjs +351 -75
  2. package/dist/server.cjs +348 -72
  3. package/package.json +1 -1
package/dist/server.cjs CHANGED
@@ -40376,6 +40376,8 @@ var agentAssignmentSchema = external_exports.object({
40376
40376
  /** `cli` is the Claude command line; `profile` names one of the user's provider profiles. */
40377
40377
  kind: external_exports.enum(["cli", "profile"]),
40378
40378
  profileId: external_exports.string().optional(),
40379
+ /** A model from that profile's provider for this role, when not the profile's own (providers/seat.ts). */
40380
+ model: external_exports.string().min(1).max(200).optional(),
40379
40381
  /**
40380
40382
  * The role's system prompt, stored only when the user has edited it.
40381
40383
  *
@@ -40839,6 +40841,8 @@ var observerAgentConfigSchema = external_exports.object({
40839
40841
  enabled: external_exports.boolean(),
40840
40842
  /** Which provider profile answers. Its auth, certificates and headers are used exactly as for the chat. */
40841
40843
  profileId: external_exports.string().min(1),
40844
+ /** A model from that provider, when not the profile's own (providers/seat.ts). */
40845
+ model: external_exports.string().min(1).max(200),
40842
40846
  /**
40843
40847
  * The user's own instructions, replacing the shipped ones (`observers/prompts.ts`). The reply format and the
40844
40848
  * running-notes rule are always appended after them, so an edit cannot break parsing or the handoff.
@@ -41436,6 +41440,13 @@ var configSchema = external_exports.object({
41436
41440
  * whole suggestion. Every pause in typing is a request to the gateway, so off unless set to true.
41437
41441
  */
41438
41442
  composerCompletion: external_exports.boolean(),
41443
+ /**
41444
+ * Which provider profile suggests, when not the chat's own - a small, fast model. Reported: a large model
41445
+ * (gemini-4-argon) never produced its first words within the time limit, so no suggestion ever appeared.
41446
+ */
41447
+ composerCompletionProfileId: external_exports.string().min(1),
41448
+ /** A model from that provider for suggestions, when not the profile's own. */
41449
+ composerCompletionModel: external_exports.string().min(1).max(200),
41439
41450
  /**
41440
41451
  * The decision model (D3 from vLLM Semantic Router, or any OpenAI-compatible model that returns probabilities): a
41441
41452
  * provider profile, and what it decides. Nothing here does anything until `profileId` names a profile - Agent team
@@ -41445,6 +41456,8 @@ var configSchema = external_exports.object({
41445
41456
  */
41446
41457
  decisionModel: external_exports.object({
41447
41458
  profileId: external_exports.string().min(1).optional(),
41459
+ /** A model from that profile's provider, when not the profile's own (providers/seat.ts). */
41460
+ model: external_exports.string().min(1).max(200).optional(),
41448
41461
  /**
41449
41462
  * Where on the profile's base URL it is asked: blank = automatic (D3's `/systemone`, then chat completions),
41450
41463
  * a path such as `/d3/v1/systemone` (D3's API there, no fallback), or `chat` (chat completions only).
@@ -41478,6 +41491,8 @@ var configSchema = external_exports.object({
41478
41491
  */
41479
41492
  reranker: external_exports.object({
41480
41493
  profileId: external_exports.string().min(1).optional(),
41494
+ /** A model from that profile's provider, when not the profile's own (providers/seat.ts). */
41495
+ model: external_exports.string().min(1).max(200).optional(),
41481
41496
  endpoint: external_exports.string().max(200).optional(),
41482
41497
  minScore: external_exports.number().min(0).max(0.95).optional(),
41483
41498
  candidates: external_exports.number().int().min(5).max(200).optional(),
@@ -45645,6 +45660,8 @@ function capEvent(event) {
45645
45660
  return { ...event, text: cap(event.text, 4e4) };
45646
45661
  case "consultation":
45647
45662
  return event;
45663
+ case "behind":
45664
+ return { ...event, summary: cap(event.summary, EVENT_LIMITS.result) };
45648
45665
  }
45649
45666
  }
45650
45667
  var REFUSALS = [
@@ -47062,6 +47079,20 @@ ${answer.result.content}`).join("\n\n"),
47062
47079
  };
47063
47080
  }
47064
47081
 
47082
+ // ../../packages/core/dist/providers/seat.js
47083
+ function seatProfile(profile, model) {
47084
+ const chosen = model?.trim();
47085
+ if (chosen === void 0 || chosen === "" || chosen === profile.model)
47086
+ return profile;
47087
+ const { modelCapabilities: _own, ...rest } = profile;
47088
+ void _own;
47089
+ return { ...rest, model: chosen };
47090
+ }
47091
+ function seatLabel(profile, model) {
47092
+ const chosen = model?.trim();
47093
+ return chosen === void 0 || chosen === "" || chosen === profile.model ? profile.label : `${profile.label} \xB7 ${chosen}`;
47094
+ }
47095
+
47065
47096
  // ../../packages/core/dist/agents/team.js
47066
47097
  function defaultAssignment(role, context) {
47067
47098
  return role === "expert" && context.cliAvailable ? { kind: "cli" } : void 0;
@@ -47105,7 +47136,8 @@ function resolveTeam(context) {
47105
47136
  summary: info.summary,
47106
47137
  kind: "profile",
47107
47138
  ...assignment.profileId !== void 0 ? { profileId: assignment.profileId } : {},
47108
- label: profile?.label ?? assignment.profileId ?? "unassigned",
47139
+ ...assignment.model !== void 0 && assignment.model.trim() !== "" ? { model: assignment.model.trim() } : {},
47140
+ label: profile !== void 0 ? seatLabel(profile, assignment.model) : assignment.profileId ?? "unassigned",
47109
47141
  prompt,
47110
47142
  usesTools,
47111
47143
  canWrite,
@@ -50244,7 +50276,9 @@ async function reorder(reranking, query, items, text2, limit, signal) {
50244
50276
  if (items.length === 0)
50245
50277
  return { items: [], reranked: false, dropped: 0, ms: 0 };
50246
50278
  const result = await reranking.scores(query, items.map(text2), signal);
50279
+ const label = (item2) => (text2(item2).split("\n")[0] ?? "").slice(0, 80);
50247
50280
  if (!result.ok || result.scores === void 0) {
50281
+ reranking.report?.({ query, candidates: items.length, first: [], kept: Math.min(limit, items.length), dropped: 0, ok: false, error: result.error ?? "no scores", ms: result.ms });
50248
50282
  return {
50249
50283
  items: items.slice(0, limit).map((item2) => ({ item: item2 })),
50250
50284
  reranked: false,
@@ -50256,6 +50290,15 @@ async function reorder(reranking, query, items, text2, limit, signal) {
50256
50290
  const scored = items.map((item2, index) => ({ item: item2, score: result.scores?.[index] ?? 0 }));
50257
50291
  scored.sort((a, b) => b.score - a.score);
50258
50292
  const kept = scored.filter((entry) => entry.score >= reranking.minScore);
50293
+ reranking.report?.({
50294
+ query,
50295
+ candidates: items.length,
50296
+ first: kept.slice(0, 5).map((entry) => ({ label: label(entry.item), score: entry.score })),
50297
+ kept: Math.min(limit, kept.length),
50298
+ dropped: scored.length - kept.length,
50299
+ ok: true,
50300
+ ms: result.ms
50301
+ });
50259
50302
  return { items: kept.slice(0, limit), reranked: true, dropped: scored.length - kept.length, ms: result.ms };
50260
50303
  }
50261
50304
 
@@ -62861,7 +62904,7 @@ var SHARE_SECTIONS = [
62861
62904
  id: "workspace",
62862
62905
  label: "Workspace behaviour",
62863
62906
  description: "Mode, step cap, automatic compaction, retries, folders tools may read, and folders hidden from the @ picker.",
62864
- keys: ["modeId", "maxIterations", "autoCompact", "autoHandoff", "unlimitedSteps", "composerCompletion", "connection", "filesystem"],
62907
+ keys: ["modeId", "maxIterations", "autoCompact", "autoHandoff", "unlimitedSteps", "composerCompletion", "composerCompletionProfileId", "composerCompletionModel", "connection", "filesystem"],
62865
62908
  machineSpecific: true
62866
62909
  },
62867
62910
  {
@@ -69367,8 +69410,10 @@ function renderCodebaseInstructions(text2) {
69367
69410
  var import_node_crypto14 = require("node:crypto");
69368
69411
  var import_promises19 = __toESM(require("node:fs/promises"), 1);
69369
69412
  var import_node_path38 = __toESM(require("node:path"), 1);
69370
- var MEMORY_LIMIT = 100;
69413
+ var MEMORY_LIMIT = 500;
69371
69414
  var MEMORY_TEXT_LIMIT = 300;
69415
+ var MEMORY_SHOWN_CHARS = 6e3;
69416
+ var MEMORY_SHOWN_MAX = 40;
69372
69417
  function memoryPath(options) {
69373
69418
  if (options.codebaseDir !== void 0)
69374
69419
  return import_node_path38.default.join(options.codebaseDir, "memory", "memory.json");
@@ -69436,8 +69481,11 @@ async function addMemory(file2, points) {
69436
69481
  added.push(entry);
69437
69482
  }
69438
69483
  while (entries.length > MEMORY_LIMIT) {
69439
- const unused = entries.findIndex((entry) => entry.uses === 0 && entry.by !== "you");
69440
- entries.splice(unused >= 0 ? unused : 0, 1);
69484
+ const candidates = entries.map((entry, index) => ({ entry, index })).filter(({ entry }) => entry.by !== "you");
69485
+ if (candidates.length === 0)
69486
+ break;
69487
+ candidates.sort((a, b) => a.entry.uses - b.entry.uses || a.entry.at - b.entry.at);
69488
+ entries.splice(candidates[0].index, 1);
69441
69489
  }
69442
69490
  return entries;
69443
69491
  });
@@ -69454,13 +69502,44 @@ async function noteMemoryUsed(file2, ids) {
69454
69502
  return;
69455
69503
  await change(file2, (entries) => entries.map((entry) => ids.includes(entry.id) ? { ...entry, uses: entry.uses + 1, lastUsed: Date.now() } : entry));
69456
69504
  }
69457
- function renderMemoryForAgent(entries) {
69505
+ function selectMemory(entries, request2, scores) {
69506
+ const size = entries.reduce((sum, entry) => sum + entry.text.length + 3, 0);
69507
+ if (size <= MEMORY_SHOWN_CHARS && entries.length <= MEMORY_SHOWN_MAX)
69508
+ return { shown: [...entries], left: 0 };
69509
+ const asked = words(request2);
69510
+ const overlap = (text2) => {
69511
+ const own = words(text2);
69512
+ if (own.size === 0 || asked.size === 0)
69513
+ return 0;
69514
+ let shared = 0;
69515
+ for (const word of own)
69516
+ if (asked.has(word))
69517
+ shared += 1;
69518
+ return shared / own.size;
69519
+ };
69520
+ const ranked = entries.map((entry, index) => ({ entry, index, score: (scores?.[index] ?? overlap(entry.text)) + (entry.by === "you" ? 0.05 : 0) + Math.min(entry.uses, 5) * 0.02 })).sort((a, b) => b.score - a.score || b.entry.at - a.entry.at);
69521
+ const chosen = [];
69522
+ let used = 0;
69523
+ for (const candidate of ranked) {
69524
+ if (chosen.length >= MEMORY_SHOWN_MAX)
69525
+ break;
69526
+ const cost = candidate.entry.text.length + 3;
69527
+ if (used + cost > MEMORY_SHOWN_CHARS)
69528
+ continue;
69529
+ chosen.push(candidate);
69530
+ used += cost;
69531
+ }
69532
+ chosen.sort((a, b) => a.index - b.index);
69533
+ return { shown: chosen.map((c2) => c2.entry), left: entries.length - chosen.length };
69534
+ }
69535
+ function renderMemoryForAgent(entries, left = 0) {
69458
69536
  if (entries.length === 0)
69459
69537
  return "";
69460
69538
  return [
69461
69539
  "## Remembered guidance",
69462
69540
  "",
69463
69541
  "The user told you these in earlier chats on this codebase, and they still apply. Follow them as you would the user's own words; when one conflicts with what the user asks now, the user's request now wins - say that you are setting the remembered point aside.",
69542
+ ...left > 0 ? [`(These are the ones that bear on this request; ${String(left)} more are remembered for other work.)`] : [],
69464
69543
  "",
69465
69544
  ...entries.map((entry) => `- ${entry.text}`)
69466
69545
  ].join("\n");
@@ -88179,6 +88258,8 @@ var ObserverHub = class {
88179
88258
  } else {
88180
88259
  this.guard = started;
88181
88260
  this.guardProblem = void 0;
88261
+ if (this.memoryText !== void 0)
88262
+ started.pin({ kind: "memory", at: Date.now(), text: this.memoryText });
88182
88263
  }
88183
88264
  started.start();
88184
88265
  }
@@ -88198,18 +88279,23 @@ var ObserverHub = class {
88198
88279
  this.alert(signal.level, signal.message, "rules", signal.notify);
88199
88280
  }
88200
88281
  }
88201
- if (guard.enabled && event.kind !== "decision")
88282
+ if (guard.enabled && event.kind !== "decision" && event.kind !== "behind")
88202
88283
  this.toGuard(event);
88203
88284
  if (event.kind === "turnEnd")
88204
88285
  this.auditor?.flush();
88205
88286
  }
88206
- /** The memory as last given (`setMemory`) and as last sent to the Anti Hallucinator; the user's latest request. */
88287
+ /** The memory as last given (`setMemory`); the user's latest request. */
88207
88288
  memoryText;
88208
- memorySent;
88209
88289
  lastUserText = "";
88210
- /** The codebase's memory, numbered, for the Anti Hallucinator; sent with the next user request when it changed. */
88290
+ /**
88291
+ * The codebase's memory, numbered, for the Anti Hallucinator: pinned to it (`ObserverAgent.pin`), so it is sent now
88292
+ * when it changed, and first to every process it starts later - after a handoff, a crash or a restart.
88293
+ */
88211
88294
  setMemory(text2) {
88295
+ if (text2 === this.memoryText)
88296
+ return;
88212
88297
  this.memoryText = text2;
88298
+ this.guard?.pin(text2 === void 0 ? void 0 : { kind: "memory", at: Date.now(), text: text2 });
88213
88299
  }
88214
88300
  /** Events since the Anti Hallucinator's last step, and the request it is checking against. */
88215
88301
  guardStep = [];
@@ -88224,13 +88310,8 @@ var ObserverHub = class {
88224
88310
  * that needs one rather than on its own. A helper that predates `quiet` reviews it anyway, as before.
88225
88311
  */
88226
88312
  toGuard(event) {
88227
- if (event.kind === "turnStart") {
88313
+ if (event.kind === "turnStart")
88228
88314
  this.lastUserText = event.text;
88229
- if (this.memoryText !== void 0 && this.memoryText !== this.memorySent) {
88230
- this.memorySent = this.memoryText;
88231
- this.guard?.send({ kind: "memory", at: event.at, text: this.memoryText });
88232
- }
88233
- }
88234
88315
  const firstPass = this.deps.firstPass;
88235
88316
  if (firstPass === void 0) {
88236
88317
  this.guard?.send(event);
@@ -88420,6 +88501,8 @@ function redactEvent(event, secrets) {
88420
88501
  return { ...event, question: r(event.question), outcome: r(event.outcome) };
88421
88502
  case "consultation":
88422
88503
  return event;
88504
+ case "behind":
88505
+ return { ...event, summary: r(event.summary) };
88423
88506
  }
88424
88507
  }
88425
88508
 
@@ -88468,6 +88551,18 @@ ${this.recent.map((r) => `- ${r}`).join("\n")}`);
88468
88551
  this.stopped = false;
88469
88552
  this.launch(void 0);
88470
88553
  }
88554
+ /**
88555
+ * An event every process of this observer must have, whatever came before it: sent now, and first to each process
88556
+ * started later - after a handoff, a crash or a restart. The codebase's memory is one (asked: "when anti halucinator
88557
+ * starts, will it read the full memory to context?"); a handoff carries only the observer's own notes, so without
88558
+ * this a new process would not know the memory until it changed. `undefined` clears it.
88559
+ */
88560
+ pin(event) {
88561
+ this.pinned = event;
88562
+ if (event !== void 0)
88563
+ this.send(event);
88564
+ }
88565
+ pinned;
88471
88566
  /** `quiet`: the decision model's first pass was sure of this step - kept in context, reviewed with the next one. */
88472
88567
  send(event, quiet = false) {
88473
88568
  if (this.stopped)
@@ -88603,7 +88698,9 @@ ${this.recent.map((r) => `- ${r}`).join("\n")}`);
88603
88698
  model: this.options.model,
88604
88699
  handoff: this.handoffText()
88605
88700
  });
88606
- const waiting = [...pending ?? [], ...this.buffered];
88701
+ if (this.pinned !== void 0)
88702
+ this.writeTo(child, { type: "event", event: this.pinned });
88703
+ const waiting = [...pending ?? [], ...this.buffered].filter((event) => event !== this.pinned);
88607
88704
  this.buffered = [];
88608
88705
  for (const event of waiting)
88609
88706
  this.writeTo(child, { type: "event", event });
@@ -88663,25 +88760,45 @@ function guardPrompt(context) {
88663
88760
  }
88664
88761
 
88665
88762
  // ../../packages/core/dist/observers/report.js
88763
+ var LINES_PER_REQUEST = 40;
88666
88764
  function rolesReport(records) {
88667
88765
  const main = /* @__PURE__ */ new Map();
88668
88766
  const specialists = /* @__PURE__ */ new Map();
88669
88767
  const decisions = /* @__PURE__ */ new Map();
88670
88768
  const tools = /* @__PURE__ */ new Map();
88671
88769
  const participants = {};
88770
+ const timeline = [];
88771
+ const line = (at2, text2) => {
88772
+ let current = timeline.at(-1);
88773
+ if (current === void 0) {
88774
+ current = { at: at2, request: "(before the first request)", lines: [] };
88775
+ timeline.push(current);
88776
+ }
88777
+ if (current.lines.length < LINES_PER_REQUEST)
88778
+ current.lines.push(text2);
88779
+ else if (current.lines.length === LINES_PER_REQUEST)
88780
+ current.lines.push("\u2026 (more not shown - read_audit_log with action records has them all)");
88781
+ };
88672
88782
  let requests = 0;
88673
88783
  let from;
88674
88784
  let until;
88675
88785
  const reviews = { findings: 0, alerts: 0, notes: 0 };
88676
- for (const record2 of records) {
88786
+ for (const record2 of [...records].sort((a, b) => a.at - b.at)) {
88677
88787
  from = from === void 0 ? record2.at : Math.min(from, record2.at);
88678
88788
  until = until === void 0 ? record2.at : Math.max(until, record2.at);
88679
- if (record2.finding !== void 0)
88789
+ if (record2.finding !== void 0) {
88680
88790
  reviews.findings += 1;
88681
- if (record2.alert !== void 0)
88791
+ if (record2.finding.risk !== "none")
88792
+ line(record2.at, `Auditor (${record2.finding.risk} risk): ${record2.finding.summary.slice(0, 200)}`);
88793
+ }
88794
+ if (record2.alert !== void 0) {
88682
88795
  reviews.alerts += 1;
88683
- if (record2.note !== void 0)
88796
+ line(record2.at, `Alert (${record2.alert.level}): ${record2.alert.message.slice(0, 200)}`);
88797
+ }
88798
+ if (record2.note !== void 0) {
88684
88799
  reviews.notes += 1;
88800
+ line(record2.at, `Anti Hallucinator: ${record2.note.note.slice(0, 240)}`);
88801
+ }
88685
88802
  const e = record2.event;
88686
88803
  if (e === void 0)
88687
88804
  continue;
@@ -88693,6 +88810,7 @@ function rolesReport(records) {
88693
88810
  main.set(key4, entry);
88694
88811
  for (const [who, model] of Object.entries(e.participants ?? {}))
88695
88812
  participants[who] = model;
88813
+ timeline.push({ at: record2.at, request: e.text.replace(/\s+/g, " ").slice(0, 120), lines: [`${e.model}, ${e.mode} mode`] });
88696
88814
  } else if (e.kind === "consultation") {
88697
88815
  const key4 = `${e.role}|${e.model}`;
88698
88816
  const entry = specialists.get(key4) ?? { role: e.role, name: e.name, model: e.model, consultations: 0, failed: 0, seconds: 0, readOnly: 0 };
@@ -88703,10 +88821,19 @@ function rolesReport(records) {
88703
88821
  entry.readOnly += 1;
88704
88822
  entry.seconds += Math.round(e.ms / 1e3);
88705
88823
  specialists.set(key4, entry);
88824
+ line(record2.at, `Consulted ${e.name} (${e.model})${e.readOnly === true ? ", read-only" : ""} - ${String(Math.round(e.ms / 1e3))} s${e.ok ? "" : ", failed"}`);
88706
88825
  } else if (e.kind === "decision") {
88707
88826
  decisions.set(e.purpose, (decisions.get(e.purpose) ?? 0) + 1);
88827
+ const best = Object.entries(e.probabilities ?? {}).sort((a, b) => b[1] - a[1])[0];
88828
+ line(record2.at, `Decision model - ${e.purpose}: ${e.outcome}${best !== void 0 ? ` (${best[0]} ${best[1].toFixed(2)})` : ""}`);
88829
+ } else if (e.kind === "behind") {
88830
+ line(record2.at, e.summary);
88708
88831
  } else if (e.kind === "toolCall") {
88709
88832
  tools.set(e.tool, (tools.get(e.tool) ?? 0) + 1);
88833
+ } else if (e.kind === "approval" && e.decision === "denied") {
88834
+ line(record2.at, `You denied ${e.tool}`);
88835
+ } else if (e.kind === "refused") {
88836
+ line(record2.at, `Refused: ${e.tool} - ${e.reason.slice(0, 160)}`);
88710
88837
  }
88711
88838
  }
88712
88839
  const task = records.find((record2) => record2.task !== void 0)?.task;
@@ -88720,14 +88847,16 @@ function rolesReport(records) {
88720
88847
  decisions: [...decisions.entries()].map(([purpose, count3]) => ({ purpose, count: count3 })).sort((a, b) => b.count - a.count),
88721
88848
  participants,
88722
88849
  reviews,
88723
- tools: [...tools.entries()].map(([tool, calls]) => ({ tool, calls })).sort((a, b) => b.calls - a.calls).slice(0, 15)
88850
+ tools: [...tools.entries()].map(([tool, calls]) => ({ tool, calls })).sort((a, b) => b.calls - a.calls).slice(0, 15),
88851
+ timeline
88724
88852
  };
88725
88853
  }
88726
- function renderRolesReport(report, title = "Who worked on this task") {
88727
- if (report.requests === 0 && report.specialists.length === 0)
88854
+ function renderRolesReport(report, title = "What happened in this task") {
88855
+ if (report.requests === 0 && report.specialists.length === 0 && report.timeline.length === 0) {
88728
88856
  return `## ${title}
88729
88857
 
88730
88858
  Nothing recorded for it. The Auditor records only while it is switched on (Settings \u2192 Project \u2192 Auditor).`;
88859
+ }
88731
88860
  const when4 = (at2) => at2 === void 0 ? "?" : new Date(at2).toLocaleString();
88732
88861
  const lines2 = [`## ${title}`, "", `${String(report.requests)} request(s), ${when4(report.from)} to ${when4(report.until)}.`, "", "### Main agent", "", "| Model | Mode | Requests |", "| --- | --- | --- |"];
88733
88862
  for (const entry of report.main)
@@ -88751,6 +88880,14 @@ Nothing recorded for it. The Auditor records only while it is switched on (Setti
88751
88880
  lines2.push("", `Reviews: ${String(report.reviews.findings)} Auditor finding(s), ${String(report.reviews.alerts)} alert(s), ${String(report.reviews.notes)} Anti Hallucinator note(s).`);
88752
88881
  if (report.tools.length > 0)
88753
88882
  lines2.push("", `Tools used most: ${report.tools.map((t) => `${t.tool} (${String(t.calls)})`).join(", ")}.`);
88883
+ if (report.timeline.length > 0) {
88884
+ lines2.push("", "### Behind the scenes, request by request");
88885
+ for (const entry of report.timeline) {
88886
+ lines2.push("", `**${new Date(entry.at).toLocaleTimeString()} - ${entry.request}**`);
88887
+ for (const text2 of entry.lines)
88888
+ lines2.push(`- ${text2}`);
88889
+ }
88890
+ }
88754
88891
  return lines2.join("\n");
88755
88892
  }
88756
88893
 
@@ -88803,6 +88940,9 @@ function auditRow(record2) {
88803
88940
  } else if (e.kind === "decision") {
88804
88941
  row["decision"] = e.outcome;
88805
88942
  row["text"] = `${e.purpose}: ${e.question}${e.probabilities !== void 0 ? ` ${JSON.stringify(e.probabilities)}` : ""}`;
88943
+ } else if (e.kind === "behind") {
88944
+ row["area"] = e.area;
88945
+ row["text"] = e.summary;
88806
88946
  } else if (e.kind === "consultation") {
88807
88947
  row["role"] = e.role;
88808
88948
  row["model"] = e.model;
@@ -92535,20 +92675,29 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
92535
92675
  const id = settings?.profileId;
92536
92676
  if (settings === void 0 || id === void 0)
92537
92677
  return void 0;
92538
- const profile = (config2.profiles ?? []).find((candidate) => candidate.id === id);
92539
- if (profile === void 0 || profile.wireFormat !== "openai")
92678
+ const found2 = (config2.profiles ?? []).find((candidate) => candidate.id === id);
92679
+ if (found2 === void 0 || found2.wireFormat !== "openai")
92540
92680
  return void 0;
92681
+ const profile = seatProfile(found2, settings.model);
92541
92682
  const endpoint = settings.endpoint?.trim();
92542
- return { model: { profile, http: httpClient, auth: observerStrategy(config2, profile), ...endpoint !== void 0 && endpoint !== "" ? { endpoint } : {} }, settings, label: profile.label };
92683
+ return { model: { profile, http: httpClient, auth: observerStrategy(config2, found2), ...endpoint !== void 0 && endpoint !== "" ? { endpoint } : {} }, settings, label: seatLabel(found2, settings.model) };
92543
92684
  }
92544
92685
  function rerankingFor(use, timeoutMs) {
92545
92686
  const found2 = cachedReranker;
92546
92687
  if (found2 === void 0 || found2.settings[use] === false)
92547
92688
  return void 0;
92689
+ const what = { docs: "Tool and skill search", teamSkills: "Team skills search", codebase: "Codebase search", picks: "Skill and tool picks" }[use];
92548
92690
  return {
92549
92691
  scores: (query, texts, signal) => rerank(found2.model, query, texts, { ...signal !== void 0 ? { signal } : {}, ...timeoutMs !== void 0 ? { timeoutMs } : {} }),
92550
92692
  minScore: found2.settings.minScore ?? DEFAULT_MIN_SCORE,
92551
- candidates: found2.settings.candidates ?? DEFAULT_CANDIDATES
92693
+ candidates: found2.settings.candidates ?? DEFAULT_CANDIDATES,
92694
+ // For the Auditor: what it put first, what it set aside, or that it did not answer and the search kept its order.
92695
+ report: (outcome) => observerHub.event({
92696
+ kind: "behind",
92697
+ at: Date.now(),
92698
+ area: "reranker",
92699
+ summary: outcome.ok ? `${what}: the reranker (${found2.model.profile.model}) reordered ${String(outcome.candidates)} candidates for "${outcome.query.slice(0, 80)}" in ${(outcome.ms / 1e3).toFixed(1)} s - first ${outcome.first.map((f) => `${f.label} (${f.score.toFixed(2)})`).join(", ") || "none"}${outcome.dropped > 0 ? `; set aside ${String(outcome.dropped)} below ${String(found2.settings.minScore ?? DEFAULT_MIN_SCORE)}` : ""}.` : `${what}: the reranker (${found2.model.profile.model}) did not answer (${outcome.error ?? "no scores"}), so the search kept its own order.`
92700
+ })
92552
92701
  };
92553
92702
  }
92554
92703
  const withReranking = (use) => {
@@ -92591,11 +92740,12 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
92591
92740
  const id = config2.decisionModel?.profileId;
92592
92741
  if (id === void 0)
92593
92742
  return void 0;
92594
- const profile = (config2.profiles ?? []).find((candidate) => candidate.id === id);
92595
- if (profile === void 0 || profile.wireFormat !== "openai")
92743
+ const found2 = (config2.profiles ?? []).find((candidate) => candidate.id === id);
92744
+ if (found2 === void 0 || found2.wireFormat !== "openai")
92596
92745
  return void 0;
92746
+ const profile = seatProfile(found2, config2.decisionModel?.model);
92597
92747
  const endpoint = config2.decisionModel?.endpoint;
92598
- return { model: { profile, http: httpClient, auth: observerStrategy(config2, profile), ...endpoint !== void 0 && endpoint.trim() !== "" ? { endpoint: endpoint.trim() } : {} }, label: profile.label };
92748
+ return { model: { profile, http: httpClient, auth: observerStrategy(config2, found2), ...endpoint !== void 0 && endpoint.trim() !== "" ? { endpoint: endpoint.trim() } : {} }, label: seatLabel(found2, config2.decisionModel?.model) };
92599
92749
  }
92600
92750
  async function askDecisionModel(purpose, question, outcome, signal, timeoutMs = 1e4) {
92601
92751
  const found2 = decisionModelFrom(await loadSettings());
@@ -92772,9 +92922,10 @@ ${answer.slice(0, 12e3)}` }
92772
92922
  if (settings?.profileId === void 0) {
92773
92923
  return { problem: role === "auditor" ? "Recording only: choose a model for the Auditor to have each step reviewed and judged as well." : "Choose a model for the Anti Hallucinator." };
92774
92924
  }
92775
- const profile = (config2.profiles ?? []).find((p) => p.id === settings.profileId);
92776
- if (profile === void 0)
92925
+ const found2 = (config2.profiles ?? []).find((p) => p.id === settings.profileId);
92926
+ if (found2 === void 0)
92777
92927
  return { problem: `${name}'s provider profile no longer exists. Choose another.` };
92928
+ const profile = seatProfile(found2, settings.model);
92778
92929
  if (profile.wireFormat === "vscode-lm")
92779
92930
  return { problem: `${name} runs in its own process and cannot use GitHub Copilot through VS Code. Choose a profile that talks OpenAI, Anthropic or Gemini.` };
92780
92931
  const exe = services.fastFs;
@@ -92856,6 +93007,8 @@ ${answer.slice(0, 12e3)}` }
92856
93007
  if (added.length === 0)
92857
93008
  return;
92858
93009
  logger.info(`memory: kept ${String(added.length)} point(s) from the user's guidance`);
93010
+ for (const entry of added)
93011
+ observerHub.event({ kind: "behind", at: Date.now(), area: "memory", summary: `Memory: the Anti Hallucinator kept "${entry.text}"` });
92859
93012
  await postMemory();
92860
93013
  }).catch((error51) => logger.warn(`memory: could not save - ${error51 instanceof Error ? error51.message : String(error51)}`));
92861
93014
  },
@@ -92863,22 +93016,30 @@ ${answer.slice(0, 12e3)}` }
92863
93016
  if (memoryFile === void 0)
92864
93017
  return;
92865
93018
  const ids = numbers.map((n) => memoryShown[n - 1]?.id).filter((id) => id !== void 0);
93019
+ for (const n of numbers) {
93020
+ const entry = memoryShown[n - 1];
93021
+ if (entry !== void 0)
93022
+ observerHub.event({ kind: "behind", at: Date.now(), area: "memory", summary: `Memory: the Anti Hallucinator redirected the agent with "${entry.text}"` });
93023
+ }
92866
93024
  void noteMemoryUsed(memoryFile, ids).then(() => postMemory()).catch(() => void 0);
92867
93025
  }
92868
93026
  });
92869
93027
  function turnParticipants(config2) {
92870
- const model = (id) => id === void 0 ? void 0 : (config2.profiles ?? []).find((p) => p.id === id)?.model;
93028
+ const model = (id, seat) => {
93029
+ const found2 = id === void 0 ? void 0 : (config2.profiles ?? []).find((p) => p.id === id);
93030
+ return found2 === void 0 ? void 0 : seatProfile(found2, seat).model;
93031
+ };
92871
93032
  const out = {};
92872
- const decision = model(config2.decisionModel?.profileId);
93033
+ const decision = model(config2.decisionModel?.profileId, config2.decisionModel?.model);
92873
93034
  if (decision !== void 0)
92874
93035
  out["decision model"] = decision;
92875
- const reranker = model(config2.reranker?.profileId);
93036
+ const reranker = model(config2.reranker?.profileId, config2.reranker?.model);
92876
93037
  if (reranker !== void 0)
92877
93038
  out["reranker"] = reranker;
92878
- const auditor = config2.observers?.auditor?.enabled === true ? model(config2.observers.auditor.profileId) : void 0;
93039
+ const auditor = config2.observers?.auditor?.enabled === true ? model(config2.observers.auditor.profileId, config2.observers.auditor.model) : void 0;
92879
93040
  if (auditor !== void 0)
92880
93041
  out["Auditor"] = auditor;
92881
- const guard = config2.observers?.antiHallucination?.enabled === true ? model(config2.observers.antiHallucination.profileId) : void 0;
93042
+ const guard = config2.observers?.antiHallucination?.enabled === true ? model(config2.observers.antiHallucination.profileId, config2.observers.antiHallucination.model) : void 0;
92882
93043
  if (guard !== void 0)
92883
93044
  out["Anti Hallucinator"] = guard;
92884
93045
  return Object.keys(out).length > 0 ? { participants: out } : {};
@@ -92915,7 +93076,7 @@ ${answer.slice(0, 12e3)}` }
92915
93076
  };
92916
93077
  observerIndex = await resolveAuditIndex(config2);
92917
93078
  const profileOf = (id) => (config2.profiles ?? []).find((p) => p.id === id);
92918
- const modelKey = JSON.stringify([profileOf(o.auditor?.profileId), profileOf(o.antiHallucination?.profileId), config2.tls ?? null, config2.certDir ?? null, o.auditor?.prompt ?? "", o.antiHallucination?.prompt ?? ""]);
93079
+ const modelKey = JSON.stringify([profileOf(o.auditor?.profileId), profileOf(o.antiHallucination?.profileId), o.auditor?.model ?? "", o.antiHallucination?.model ?? "", config2.tls ?? null, config2.certDir ?? null, o.auditor?.prompt ?? "", o.antiHallucination?.prompt ?? ""]);
92919
93080
  const key4 = `${JSON.stringify(settings)}|${modelKey}`;
92920
93081
  if (key4 === observerKey)
92921
93082
  return;
@@ -93777,10 +93938,16 @@ ${answer.slice(0, 12e3)}` }
93777
93938
  const mailSearch = mailCollection === void 0 ? void 0 : await resolveMailSearch(config2);
93778
93939
  const searchIndexes = search?.opensearch !== void 0 ? await indexNamesFor(search.opensearch) : [];
93779
93940
  await boundedWait(skillsReady, "Skills");
93780
- const memory = memoryOn(config2) ? await readMemory(memoryFile) : [];
93941
+ const remembered = memoryOn(config2) ? await readMemory(memoryFile) : [];
93942
+ const memoryRanker = remembered.length > MEMORY_SHOWN_MAX || remembered.reduce((sum, e) => sum + e.text.length + 3, 0) > MEMORY_SHOWN_CHARS ? rerankingFor("docs", 3e3) : void 0;
93943
+ const memoryScores = memoryRanker === void 0 ? void 0 : await memoryRanker.scores(text2, remembered.map((entry) => entry.text)).then((result) => result.ok ? result.scores : void 0);
93944
+ const { shown: memory, left: memoryLeft } = selectMemory(remembered, text2, memoryScores);
93945
+ if (memoryLeft > 0) {
93946
+ observerHub.event({ kind: "behind", at: Date.now(), area: "memory", summary: `Memory: gave ${String(memory.length)} of ${String(remembered.length)} remembered points, chosen for this request ${memoryScores !== void 0 ? "by the reranker" : "by shared words"}.` });
93947
+ }
93781
93948
  memoryShown = memory;
93782
- observerHub.setMemory(memoryOn(config2) ? renderMemoryForGuard(memory) : void 0);
93783
- const codebaseInstructions = [renderCodebaseInstructions(await instructionsReady), renderMemoryForAgent(memory)].filter((part) => part.length > 0).join("\n\n");
93949
+ observerHub.setMemory(memoryOn(config2) && memory.length > 0 ? renderMemoryForGuard(memory) : void 0);
93950
+ const codebaseInstructions = [renderCodebaseInstructions(await instructionsReady), renderMemoryForAgent(memory, memoryLeft)].filter((part) => part.length > 0).join("\n\n");
93784
93951
  const activeMode = findMode(config2.modeId);
93785
93952
  turnModeId = activeMode.id;
93786
93953
  juniorTurnWithoutExpert = activeMode.id === "junior" && schedule === void 0;
@@ -94182,7 +94349,10 @@ ${suggestion}`;
94182
94349
  post({ type: "contextUsage", usage: { ...breakdown, supersededCount, compactedCount } });
94183
94350
  persistSoon();
94184
94351
  },
94185
- onCompacted: (summarisedCount) => post({ type: "compacted", summarisedCount }),
94352
+ onCompacted: (summarisedCount) => {
94353
+ observerHub.event({ kind: "behind", at: Date.now(), area: "context", summary: `Conversation compacted: ${String(summarisedCount)} older messages summarised to fit the model's window.` });
94354
+ post({ type: "compacted", summarisedCount });
94355
+ },
94186
94356
  onUsage: (counted) => recordTokens(profile.model, counted),
94187
94357
  onContextWindowLearned: (tokens) => {
94188
94358
  if (profile.modelCapabilities?.contextWindow !== void 0)
@@ -94200,6 +94370,7 @@ ${suggestion}`;
94200
94370
  },
94201
94371
  onRetry: (info) => {
94202
94372
  logger.warn(`model request retry ${String(info.retry)}/${String(info.maxRetries)}: ${info.reason}`);
94373
+ observerHub.event({ kind: "behind", at: Date.now(), area: "retry", summary: `Model request retried (${String(info.retry)} of ${String(info.maxRetries)}): ${info.reason}` });
94203
94374
  cumulativeText = "";
94204
94375
  cumulativeReasoning = "";
94205
94376
  post({
@@ -94655,8 +94826,32 @@ ${suggestion}`;
94655
94826
  post({ type: "commitMessageSuggestion", error: error51 instanceof Error ? error51.message : String(error51) });
94656
94827
  }
94657
94828
  }
94829
+ let completionProblem;
94830
+ let completionOk;
94831
+ async function postCompletionSettings() {
94832
+ const config2 = await loadSettings();
94833
+ let chatModel;
94834
+ let chatProfileId;
94835
+ try {
94836
+ const active = resolveActiveProfile(config2);
94837
+ chatModel = active.model;
94838
+ chatProfileId = active.id;
94839
+ } catch {
94840
+ chatModel = void 0;
94841
+ }
94842
+ post({
94843
+ type: "completionSettings",
94844
+ ...config2.composerCompletionProfileId !== void 0 ? { profileId: config2.composerCompletionProfileId } : {},
94845
+ ...chatModel !== void 0 ? { chatModel } : {},
94846
+ ...chatProfileId !== void 0 ? { chatProfileId } : {},
94847
+ ...config2.composerCompletionModel !== void 0 ? { model: config2.composerCompletionModel } : {},
94848
+ profiles: (config2.profiles ?? []).map((p) => ({ id: p.id, label: p.label, model: p.model })),
94849
+ ...completionProblem !== void 0 ? { lastProblem: completionProblem } : {},
94850
+ ...completionOk !== void 0 ? { lastOk: completionOk } : {}
94851
+ });
94852
+ }
94658
94853
  async function suggestCompletion(id, typed) {
94659
- completionAbort?.abort();
94854
+ completionAbort?.abort("superseded");
94660
94855
  const controller = new AbortController();
94661
94856
  completionAbort = controller;
94662
94857
  const answer = (text2) => {
@@ -94666,13 +94861,17 @@ ${suggestion}`;
94666
94861
  };
94667
94862
  if (!cachedComposerCompletion || typed.trim().length < TYPE_AHEAD_MIN_CHARS || typed.length > 4e3)
94668
94863
  return answer("");
94669
- const timer = setTimeout(() => controller.abort(), 8e3);
94864
+ const timer = setTimeout(() => controller.abort("timeout"), 12e3);
94865
+ const started = Date.now();
94866
+ let asking = "";
94670
94867
  let reply = "";
94671
94868
  try {
94672
94869
  const config2 = await loadSettings();
94673
- const profile = resolveActiveProfile(config2);
94870
+ const chosen = config2.composerCompletionProfileId === void 0 ? void 0 : (config2.profiles ?? []).find((p) => p.id === config2.composerCompletionProfileId);
94871
+ const profile = seatProfile(chosen ?? resolveActiveProfile(config2), config2.composerCompletionModel);
94872
+ asking = profile.model;
94674
94873
  const style = profile.thinking?.style ?? (/qwen/i.test(profile.model) ? "qwen" : void 0);
94675
- const quick = { ...profile, ...style !== void 0 || profile.thinking !== void 0 ? { thinking: { level: "off", ...style !== void 0 ? { style } : {} } } : {} };
94874
+ const quick = { ...profile, ...style !== void 0 || profile.thinking !== void 0 || profile.wireFormat === "gemini" ? { thinking: { level: "off", ...style !== void 0 ? { style } : {} } } : {} };
94676
94875
  const messages = typeAheadMessages(redact(typed, cachedSecretValues), conversation.toArray());
94677
94876
  const ask = async (asked) => {
94678
94877
  const provider = createChatProvider(asked, httpClient, authStrategyFor(config2, asked), logger, services.languageModels);
@@ -94691,11 +94890,25 @@ ${suggestion}`;
94691
94890
  let failed2 = await ask(quick);
94692
94891
  if (failed2 !== void 0 && reply.length === 0 && quick !== profile && !controller.signal.aborted)
94693
94892
  failed2 = await ask(profile);
94694
- if (failed2 !== void 0)
94695
- logger.info(`suggestion while typing: the model answered with an error - ${failed2.slice(0, 200)}`);
94893
+ if (controller.signal.reason === "superseded")
94894
+ return;
94895
+ if (controller.signal.reason === "timeout") {
94896
+ completionProblem = `${asking} did not start answering within 12 seconds - too slow for suggestions. Choose a small, fast model for them below.`;
94897
+ } else if (failed2 !== void 0) {
94898
+ completionProblem = `${asking} answered with an error: ${failed2.slice(0, 600)}${/HTTP 404/.test(failed2) ? ` - this model name is not available to this provider or key; pick one from the list under "Its model".` : ""}`;
94899
+ } else if (reply.trim().length > 0) {
94900
+ completionProblem = void 0;
94901
+ completionOk = { model: asking, ms: Date.now() - started };
94902
+ }
94903
+ if (completionProblem !== void 0 && (failed2 !== void 0 || controller.signal.reason === "timeout"))
94904
+ logger.info(`suggestion while typing: ${completionProblem}`);
94696
94905
  } catch (error51) {
94697
- if (!controller.signal.aborted)
94698
- logger.info(`suggestion while typing failed: ${error51 instanceof Error ? error51.message : String(error51)}`);
94906
+ if (controller.signal.reason === "timeout")
94907
+ completionProblem = `${asking} did not start answering within 12 seconds - too slow for suggestions. Choose a small, fast model for them below.`;
94908
+ else if (!controller.signal.aborted)
94909
+ completionProblem = `${asking}: ${error51 instanceof Error ? error51.message : String(error51)}`;
94910
+ if (completionProblem !== void 0 && controller.signal.reason !== "superseded")
94911
+ logger.info(`suggestion while typing: ${completionProblem}`);
94699
94912
  } finally {
94700
94913
  clearTimeout(timer);
94701
94914
  }
@@ -94845,6 +95058,7 @@ ${redact(shown2, cachedSecretValues)}` }
94845
95058
  summary: info.summary,
94846
95059
  ...agent !== void 0 ? { kind: agent.kind } : {},
94847
95060
  ...agent?.profileId !== void 0 ? { profileId: agent.profileId } : {},
95061
+ ...agent?.model !== void 0 ? { model: agent.model } : {},
94848
95062
  label: agent?.label ?? "Nobody",
94849
95063
  available: agent?.available ?? false,
94850
95064
  ...agent?.reason !== void 0 ? { reason: agent.reason } : {},
@@ -95135,14 +95349,14 @@ ${redact(shown2, cachedSecretValues)}` }
95135
95349
  if (profile === void 0) {
95136
95350
  throw new Error(`No profile "${expert.profileId ?? ""}" exists any more.`);
95137
95351
  }
95138
- const seatProfile = expert.thinking === void 0 ? profile : {
95352
+ const seatProfile2 = expert.thinking === void 0 ? profile : {
95139
95353
  ...profile,
95140
95354
  thinking: {
95141
95355
  ...profile.thinking ?? { level: expert.thinking },
95142
95356
  level: expert.thinking
95143
95357
  }
95144
95358
  };
95145
- const provider = createChatProvider(seatProfile, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
95359
+ const provider = createChatProvider(seatProfile2, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
95146
95360
  let text2 = "";
95147
95361
  for await (const chunk of provider.streamChat([
95148
95362
  { role: "system", content: expert.prompt },
@@ -100224,7 +100438,7 @@ ${answer.slice(0, 16e3)}` } }, (d) => d.best !== void 0 && d.best.probability >=
100224
100438
  }
100225
100439
  async function consultAgentNow(resolved, request2, readOnly) {
100226
100440
  const started = Date.now();
100227
- const model = resolved.kind === "cli" ? "Claude CLI" : ((await loadSettings()).profiles ?? []).find((p) => p.id === resolved.profileId)?.model ?? resolved.label;
100441
+ const model = resolved.kind === "cli" ? "Claude CLI" : resolved.model ?? ((await loadSettings()).profiles ?? []).find((p) => p.id === resolved.profileId)?.model ?? resolved.label;
100228
100442
  const record2 = (ok) => observerHub.event({ kind: "consultation", at: Date.now(), role: resolved.role, name: resolved.name, model, ms: Date.now() - started, ok, ...readOnly ? { readOnly: true } : {} });
100229
100443
  try {
100230
100444
  const answer = await consultAgentInner(resolved, request2, readOnly);
@@ -100297,15 +100511,16 @@ ${answer.slice(0, 16e3)}` } }, (d) => d.best !== void 0 && d.best.probability >=
100297
100511
  return { advice: answer.text, label: agent.label };
100298
100512
  }
100299
100513
  const { config: config2 } = await configManager.load();
100300
- const profile = config2.profiles?.find((candidate) => candidate.id === agent.profileId);
100301
- if (profile === void 0) {
100514
+ const found2 = config2.profiles?.find((candidate) => candidate.id === agent.profileId);
100515
+ if (found2 === void 0) {
100302
100516
  throw new Error(`No profile "${agent.profileId ?? ""}" exists any more.`);
100303
100517
  }
100304
- const seatProfile = agent.thinking === void 0 ? profile : {
100518
+ const profile = seatProfile(found2, agent.model);
100519
+ const seatProfile2 = agent.thinking === void 0 ? profile : {
100305
100520
  ...profile,
100306
100521
  thinking: { ...profile.thinking ?? { level: agent.thinking }, level: agent.thinking }
100307
100522
  };
100308
- const provider = createChatProvider(seatProfile, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
100523
+ const provider = createChatProvider(seatProfile2, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
100309
100524
  const extraTools = new Set(agent.role === "librarian" && !readOnly ? ["write_skill"] : []);
100310
100525
  if (agent.canWrite) {
100311
100526
  extraTools.add("write_to_file");
@@ -100332,8 +100547,8 @@ ${answer.slice(0, 16e3)}` } }, (d) => d.best !== void 0 && d.best.probability >=
100332
100547
  return decision === "approve";
100333
100548
  };
100334
100549
  const exe = services.fastFs;
100335
- const gemini = isGeminiModel(seatProfile.model, seatProfile.baseUrl);
100336
- if (exe !== void 0 && seatProfile.wireFormat !== "vscode-lm" && !gemini && (await fastFsAnswered)?.has("agent") === true) {
100550
+ const gemini = isGeminiModel(seatProfile2.model, seatProfile2.baseUrl);
100551
+ if (exe !== void 0 && seatProfile2.wireFormat !== "vscode-lm" && !gemini && (await fastFsAnswered)?.has("agent") === true) {
100337
100552
  const system = buildAgentPrompt({
100338
100553
  prompt: agent.prompt,
100339
100554
  question: "",
@@ -100342,7 +100557,7 @@ ${answer.slice(0, 16e3)}` } }, (d) => d.best !== void 0 && d.best.probability >=
100342
100557
  briefing: buildAgentBriefing({ tools: agentBriefingTools?.() ?? [], skills, team: cachedTeam, self: agent.role })
100343
100558
  });
100344
100559
  const question = prompt.startsWith(system) ? prompt.slice(system.length).trimStart() : prompt;
100345
- const process5 = await roleProcessFor(agent, seatProfile, config2, exe, system, context === void 0 ? [] : allowedTools);
100560
+ const process5 = await roleProcessFor(agent, seatProfile2, config2, exe, system, context === void 0 ? [] : allowedTools);
100346
100561
  const byName = new Map(allowedTools.map((tool) => [tool.name, tool]));
100347
100562
  const answer = await process5.consult({
100348
100563
  prompt: question,
@@ -100936,6 +101151,24 @@ ${answer.slice(0, 16e3)}` } }, (d) => d.best !== void 0 && d.best.probability >=
100936
101151
  void writeWebChatSetup(webChatFile, void 0).then(() => postWebChat("Removed."));
100937
101152
  } else if (message6.type === "requestAuditRolesReport") {
100938
101153
  reportFailure("auditRolesReport", readAuditTool.execute({ action: "roles", source: "local" }, {}).then((result) => post({ type: "auditRolesReport", text: result.content })));
101154
+ } else if (message6.type === "requestCompletionSettings") {
101155
+ reportFailure("postCompletionSettings", postCompletionSettings());
101156
+ } else if (message6.type === "setCompletionProfile") {
101157
+ const profileId = message6.profileId;
101158
+ const model = message6.model;
101159
+ reportFailure("setCompletionProfile", configManager.save("user", { composerCompletionProfileId: profileId, composerCompletionModel: model }).then(() => postCompletionSettings()));
101160
+ } else if (message6.type === "requestProfileModels") {
101161
+ const profileId = message6.profileId;
101162
+ reportFailure("requestProfileModels", (async () => {
101163
+ const config2 = await loadSettings();
101164
+ const profile = (config2.profiles ?? []).find((candidate) => candidate.id === profileId);
101165
+ if (profile === void 0) {
101166
+ post({ type: "profileModels", profileId, models: [], warning: "That profile no longer exists." });
101167
+ return;
101168
+ }
101169
+ const result = await listModelsFor(config2, profile).catch((error51) => ({ ids: [], warning: error51 instanceof Error ? error51.message : String(error51) }));
101170
+ post({ type: "profileModels", profileId, models: result.ids, model: profile.model, ...result.warning !== void 0 ? { warning: result.warning } : {} });
101171
+ })());
100939
101172
  } else if (message6.type === "requestCodebaseMemory") {
100940
101173
  reportFailure("postMemory", postMemory());
100941
101174
  } else if (message6.type === "addCodebaseMemory" || message6.type === "editCodebaseMemory" || message6.type === "deleteCodebaseMemory") {
@@ -101474,6 +101707,7 @@ ${answer.slice(0, 16e3)}` } }, (d) => d.best !== void 0 && d.best.probability >=
101474
101707
  roles[role] = {
101475
101708
  kind: assignment.kind,
101476
101709
  ...assignment.profileId !== void 0 ? { profileId: assignment.profileId } : {},
101710
+ ...assignment.kind === "profile" && assignment.model !== void 0 && assignment.model.trim() !== "" ? { model: assignment.model.trim() } : {},
101477
101711
  ...roles[role]?.prompt !== void 0 ? { prompt: roles[role].prompt } : {}
101478
101712
  };
101479
101713
  }
@@ -103447,8 +103681,10 @@ install contacts nothing until a provider is configured.
103447
103681
  MCP, Add-ons, Search, Agents, Schedules, Python, Tools, DevOps, Outlook, Custom data, Skills, Usage, Network and
103448
103682
  Appearance - plus **Team reviews** for team admins and owners with a change to decide, an add-on's own tab while it
103449
103683
  is enabled, and Review and Variables on a shared server (\`light-code --server\`) only. **Project** also holds Team
103450
- admins, the Auditor and the Anti Hallucinator. Beside the mode picker (Auto, Ask, Agent team) is **Strategy**,
103451
- once a specialist is assigned.
103684
+ admins, the Auditor (with **Report on this chat**: which roles and models took part), the Anti Hallucinator and the
103685
+ codebase's **Memory**. **Agents** holds the **Decision model** (D3) and the **Web chat**; **Search** holds the
103686
+ **Reranker**. Beside the mode picker (Auto, Ask, Agent team) is **Strategy**, once a specialist is assigned, and
103687
+ **Picks** (skill and tool for each request), once a decision model is set up.
103452
103688
 
103453
103689
  **Everything the panel writes goes into one JSON file**, and that file can be hand-edited \u2014 the UI
103454
103690
  and the loader share one schema, so a bad hand-edit and a bad save fail identically.
@@ -103612,6 +103848,13 @@ Folders you always want readable go in config:filesystem.readRoots.
103612
103848
  "qwen"
103613
103849
  ],
103614
103850
  body: `
103851
+ **Seats take a provider and a model.** Every seat - each specialist role in Agents, the decision model, the
103852
+ reranker, the Auditor, the Anti Hallucinator, suggestions while typing - chooses a provider profile and then **Its
103853
+ model** from that provider's own list (loaded by itself; a name can be typed too). Empty is the profile's own model. So
103854
+ one provider profile serves every seat that uses it - no need for a profile per model. In Settings \u2192 Providers the
103855
+ model list loads by itself as soon as the address and key are filled in (or when a saved profile is opened); Refresh is
103856
+ only for a list that changed.
103857
+
103615
103858
  **Settings \u2192 Providers.** Several named profiles, switchable from the composer. Three wire
103616
103859
  formats: OpenAI-compatible, Anthropic Messages, and Gemini - plus **GitHub Copilot from VS Code**
103617
103860
  (see the GitHub Copilot topic). Presets prefill a base URL and wire
@@ -105159,7 +105402,13 @@ still change files by hand.
105159
105402
  "roles report",
105160
105403
  "report on this chat",
105161
105404
  "who worked on",
105162
- "models used"
105405
+ "models used",
105406
+ "behind the scenes",
105407
+ "what happened",
105408
+ "task report",
105409
+ "audit report",
105410
+ "how the reranker was used",
105411
+ "how the decision model was used"
105163
105412
  ],
105164
105413
  body: `
105165
105414
  **Settings \u2192 Project \u2192 Auditor** and **Anti Hallucinator**, saved for the open project (\`observers\` in
@@ -105180,10 +105429,15 @@ them becomes one notice. With a model chosen, the Auditor also reviews each batc
105180
105429
  alerts. Agents can read the record back with **read_audit_log** (summary first, then records with filters;
105181
105430
  rows go straight into the dataframe tool for custom analysis).
105182
105431
 
105183
- **Which roles and models took part:** **Report on this chat** (in the Auditor panel), or ask the agent - it uses
105184
- \`read_audit_log\` with action \`roles\`. It lists the main agent's model and mode for each request, every specialist
105185
- consulted with its model, how often and how long (and which failed), the decision model's calls, the reranker and
105186
- the reviewers - read from the record as it happened.
105432
+ **What happened in a task:** **Report on this chat** (in the Auditor panel), or ask the agent - it uses
105433
+ \`read_audit_log\` with action \`roles\`. It lists who took part - the main agent's model and mode, every specialist
105434
+ consulted with its model, how often and how long (and which failed), the decision model, the reranker and the
105435
+ reviewers - and then, **request by request, everything that happened behind the scenes**: each decision model choice
105436
+ with its probability (routing, picks, loop verdicts, first passes), each time the reranker reordered a search (which
105437
+ search, how many candidates, what it put first with scores, what it set aside - or that it did not answer and the
105438
+ search kept its own order), the memory kept, selected or used to redirect the agent, specialists consulted, retried
105439
+ model requests, compaction, denials, refusals, alerts and the Anti Hallucinator's notes. Read from the record as it
105440
+ happened, so you can check things went the way you wanted. Recorded while the Auditor is on.
105187
105441
 
105188
105442
  **With a decision model** (Settings \u2192 Agents \u2192 Decision model, e.g. D3), the Anti Hallucinator gets a **first pass**:
105189
105443
  the decision model is asked, for each step, whether it is grounded in its tool results and still on your request. A
@@ -107531,6 +107785,11 @@ Also, each with its own switch in the same panel (all on once a decision model i
107531
107785
  approved as always. **Speed:** once per message (not per step); with both, the two questions go at once, and D3
107532
107786
  generates no text, so it is usually a fraction of a second before the reply starts; it never waits more than 4
107533
107787
  seconds, and a late answer is simply not used. A chat with Picks off asks nothing. Not for scheduled runs.
107788
+ **With a reranker too** (Settings \u2192 Search \u2192 Reranker, config:reranker.picks): the reranker first narrows every skill
107789
+ and tool to the ten most relevant to the request, and the decision model chooses among those - a choice between ten it
107790
+ can be sure about, where among a hundred and thirty the probability spread too thin to pass the threshold. The
107791
+ reranker gets 2 seconds; if it does not answer, the decision model chooses among all of them as before. See the
107792
+ reranker topic.
107534
107793
  - **Anti Hallucinator first pass** (config:decisionModel.firstPass): a step it is sure is grounded and on course
107535
107794
  (config:decisionModel.firstPassThreshold, default 0.85) is reviewed with the next one instead of on its own.
107536
107795
  - **Decision steps** in the Strategy window: a step whose next step it picks (see the strategies topic).
@@ -107581,6 +107840,16 @@ with -x", "we never edit generated files"), so they apply in every later chat. S
107581
107840
  - **You manage it**: every entry can be edited or removed, and you can add your own. Switch it off there
107582
107841
  (config:observers.antiHallucination.memory); nothing is then added or given to the agent.
107583
107842
 
107843
+ **Where it is kept:** a plain file per codebase, not a vector store - so it works with no search connection set up,
107844
+ and nothing about it is sent anywhere except to your own chat's model and the Anti Hallucinator.
107845
+
107846
+ **As it grows:** every entry is given while they fit (about 6,000 characters, 40 entries). Past that, each request gets
107847
+ the entries that bear on it - by the reranker when one is set up, otherwise shared words, with a little weight for
107848
+ entries you added and ones that redirected the agent before - so an old entry about this request is used and a new one
107849
+ about something else waits. The agent is told how many others there are. The Anti Hallucinator gets the same ones, and
107850
+ gets them again whenever its process is replaced (a handoff, a crash, a restart). Up to 500 are kept; an entry you
107851
+ added is never removed to make room.
107852
+
107584
107853
  Kept on this computer, outside the repository, one per codebase and shared by its chats. It is not part of an export.
107585
107854
  `
107586
107855
  },
@@ -107610,7 +107879,7 @@ Kept on this computer, outside the repository, one per codebase and shared by it
107610
107879
  ],
107611
107880
  body: `
107612
107881
  **The chat's model can suggest the rest of what you are typing**, in grey after the cursor. Off unless you turn
107613
- it on: Settings \u2192 Appearance \u2192 **Suggestions while typing** (config:composerCompletion).
107882
+ it on: Settings \u2192 Project \u2192 **Suggestions while typing** (config:composerCompletion).
107614
107883
 
107615
107884
  - **Tab** takes the next word, so you can take part of a suggestion and go on typing.
107616
107885
  - **Ctrl+Space**, or **Right arrow** with the cursor at the end, takes all of it.
@@ -107622,9 +107891,16 @@ output), and is cut to one line. Each pause is one request to that model's gatew
107622
107891
  slow or failing request shows nothing; it never puts an error in the chat. While the \`@\` or \`#\` picker is open,
107623
107892
  Tab and the arrows belong to the picker.
107624
107893
 
107625
- **With a thinking model** (Qwen3 and similar) the request asks it not to think (\`enable_thinking: false\`) - it used to
107626
- spend the whole time limit thinking, so nothing appeared. A gateway that refuses that option is asked again without
107627
- it. Why a suggestion did not come is written to the log.
107894
+ **With a thinking model** (Qwen3, Gemini 2.5 and later) the request asks it not to think (\`enable_thinking: false\`
107895
+ for Qwen, \`thinkingBudget: 0\` for Gemini) - it used to spend the whole time limit thinking, so nothing appeared. A
107896
+ suggestion has 12 seconds.
107897
+
107898
+ **No suggestion appears?** The panel says why under **Last suggestion** - most often that the model did not start
107899
+ answering within 12 seconds. A large model is usually too slow for this: choose the provider under **Model for
107900
+ suggestions** (config:composerCompletionProfileId) and a small, fast model from it under **Its model**
107901
+ (config:composerCompletionModel) - a Flash or mini model - and the chat keeps its own model. A 404 means the model
107902
+ name is not available to that provider or key: pick one from the list. Why a suggestion did not come is also written
107903
+ to the log.
107628
107904
  `
107629
107905
  },
107630
107906
  {