teapot-coding-agent 0.33.0 → 0.34.1

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.
@@ -228,8 +228,9 @@ Most session state is not injected into prompts — fetch it with tools instead:
228
228
  → your durable notes (memory.md). add_memory appends and cannot lose earlier
229
229
  notes; forget_memory removes the lines matching a substring, so a stale note can
230
230
  be corrected instead of piling up; set_memory REPLACES the whole file. Pass a
231
- query to read_memory to search rather than dumping everything. The notes are NOT
232
- in your prompt — read them.
231
+ query to read_memory to search rather than dumping everything. Your prompt carries
232
+ a DIGEST (headings and one line each) — the notes themselves are not in it, so
233
+ read_memory(query) is how you actually get one.
233
234
  - get_todo() / set_todo(content) → the operator-maintained task list
234
235
  (todo.md); check it when picking up work, keep it current as you go.
235
236
  - When corrected, add_feedback(rule) so it sticks; review via get_feedback().
@@ -276,10 +277,21 @@ Most session state is not injected into prompts — fetch it with tools instead:
276
277
  panel) — do NOT also repeat the same content as a chat message; end the
277
278
  turn right after the call (a short "reported." is fine).
278
279
  - Be frugal: prefer small precise edits, avoid runaway loops.
279
- - When the operator asks you to remember something, WRITE it with add_memory. When
280
- earlier context might be relevant again (a decision, a gotcha, where you left off),
281
- SEARCH it with read_memory(query) and use what you find. Nothing is injected: an
282
- unread note is an unwritten note.`;
280
+ - When the operator asks you to remember something, WRITE it with add_memory.
281
+ Write the KIND of thing that stays true and saves work later: a decision and
282
+ why, a gotcha that cost time, a command that works here, where you left off.
283
+ Do not write a narrative of what you did — the log already has that.
284
+ - WHEN to consult your notes — a decision boundary, not "always search":
285
+ skip it for a self-contained request (a one-line shell command, a simple
286
+ rewrite, a question about the current file). Use it by DEFAULT when the task
287
+ touches this workspace's history, conventions or prior choices; when the
288
+ operator asks for consistency with earlier work; when the task is ambiguous in
289
+ a way earlier context would settle; or when you are picking up something you
290
+ started before. If unsure, do one quick pass.
291
+ - A quick pass is cheap and bounded: search the digest in your prompt with
292
+ read_memory(query), open at most one or two of the notes that match, and stop.
293
+ If nothing is relevant, carry on — do not keep searching, and do not read the
294
+ whole file "just in case". An unread note is an unwritten note.`;
283
295
  /**
284
296
  * A message whose ENTIRE text is parenthesised is an acknowledgement, not work.
285
297
  *
@@ -477,6 +489,15 @@ export class Agent {
477
489
  */
478
490
  auditAttempts = 0;
479
491
  lastRejectedAudit = null;
492
+ /**
493
+ * What the agent had done BEFORE an audit rejected its first finish (#94).
494
+ *
495
+ * Captured at rejection time because that is the last moment the pre-rejection work is still
496
+ * the bulk of the history. The eventual approved final would otherwise report only the retry,
497
+ * which is a narrow fix-up — the parent would be judging hours of work from its last few
498
+ * minutes.
499
+ */
500
+ preRejectionTurns = [];
480
501
  lastAuditOutcome = null;
481
502
  constructor(opts) {
482
503
  this.opts = {
@@ -605,6 +626,66 @@ export class Agent {
605
626
  * against, so a skill with a poor description is effectively undiscoverable;
606
627
  * that is worth knowing when authoring one.
607
628
  */
629
+ /**
630
+ * A bounded DIGEST of memory.md: every heading, plus its first line.
631
+ *
632
+ * MEASURED reason this exists. The notes are agent-scoped now (they outlive a session) and
633
+ * they are genuinely long — 2.6KB is the median, and the largest hold full project briefs. A
634
+ * model that never sees them cannot decide to consult them: that is the whole finding of #48
635
+ * (182 writes, 13 reads after a write). A model that sees the WHOLE file pays for it on every
636
+ * request and breaks the prefix cache.
637
+ *
638
+ * Codex solves this with a `MEMORY_SUMMARY` in the prompt plus a searchable registry on disk.
639
+ * This is the same shape: the digest says what memory HOLDS, `read_memory(query)` fetches the
640
+ * part that matters.
641
+ *
642
+ * The budget is deliberately small. This is an index, and an index that costs as much as the
643
+ * content has no reason to be an index.
644
+ */
645
+ memoryDigestText() {
646
+ let text;
647
+ try {
648
+ text = readFileSync(this.memoryFile, "utf8");
649
+ }
650
+ catch {
651
+ return ""; // no notes yet
652
+ }
653
+ if (!text.trim())
654
+ return "";
655
+ const MAX_CHARS = 1_400;
656
+ const lines = text.split(/\r?\n/);
657
+ const out = [];
658
+ let used = 0;
659
+ for (let i = 0; i < lines.length; i++) {
660
+ const line = lines[i].trim();
661
+ if (!line)
662
+ continue;
663
+ // provenance markers are bookkeeping, not content
664
+ // bookkeeping, not content: an old-style provenance comment, or a `_from:_` line — the
665
+ // latter is reachable through read_memory(query), where it is useful, but in a DIGEST it
666
+ // would be noise under every heading
667
+ if (/^<!--/.test(line) || /^_from:/.test(line))
668
+ continue;
669
+ const isHeading = /^#{1,6}\s/.test(line);
670
+ const isBullet = /^[-*]\s/.test(line);
671
+ // headings and the FIRST line under one: enough to recognise a topic without
672
+ // reproducing the note. A bullet is included only as a one-line sample.
673
+ if (!isHeading && !isBullet) {
674
+ // a continuation of the previous line — skip, the heading already names the topic
675
+ if (!out.length)
676
+ out.push(line.slice(0, 100));
677
+ continue;
678
+ }
679
+ const rendered = isHeading ? line.slice(0, 90) : ` · ${line.slice(0, 80)}`;
680
+ if (used + rendered.length > MAX_CHARS) {
681
+ out.push(`(… ${lines.length} lines total — call read_memory(query) to search the rest)`);
682
+ break;
683
+ }
684
+ out.push(rendered);
685
+ used += rendered.length + 1;
686
+ }
687
+ return out.join("\n").trim();
688
+ }
608
689
  skillCatalogueText() {
609
690
  if (!this.skillsCache.length)
610
691
  return "";
@@ -923,6 +1004,7 @@ export class Agent {
923
1004
  }
924
1005
  async init() {
925
1006
  await this.log.load();
1007
+ await this.migrateMemoryToAgentScope();
926
1008
  // NOTE: the workspace is NOT created here. Boot-time mkdir resurrected
927
1009
  // deleted project directories on every restart, which operators hated.
928
1010
  // It is created lazily in ensureWorkspace() when the agent first needs
@@ -1032,7 +1114,29 @@ export class Agent {
1032
1114
  get goalFile() {
1033
1115
  return path.join(this.opts.sessionDir, "goal.md");
1034
1116
  }
1117
+ /**
1118
+ * Durable notes — AGENT-scoped, not session-scoped.
1119
+ *
1120
+ * MEASURED: memory.md lived in `sessionDir`, so starting a new session for an agent
1121
+ * silently orphaned everything it had learned. Across this machine, 66 agents had more
1122
+ * than one session (median 6 each) and only 5 of them had notes in any session at all —
1123
+ * the notes were written, then abandoned when the next session was minted. A "durable
1124
+ * note" that dies with the timeline is not durable.
1125
+ *
1126
+ * The file lives next to the agent's session DIRECTORY (`sessions/<agent>/memory.md`),
1127
+ * a level above the per-session dirs, so every session of that agent sees the same
1128
+ * notes. A session's own `memory.md` from an older build is migrated on first read.
1129
+ */
1035
1130
  get memoryFile() {
1131
+ const perSession = path.join(this.opts.sessionDir, "memory.md");
1132
+ const agentWide = path.join(path.dirname(this.opts.sessionDir), "memory.md");
1133
+ // `sessionDir` may itself be the agent-level directory in older layouts; only use the
1134
+ // parent when the basename looks like a session (<agent>-<hex>)
1135
+ const looksPerSession = /-[0-9a-f]{6,}$/i.test(path.basename(this.opts.sessionDir));
1136
+ return looksPerSession ? agentWide : perSession;
1137
+ }
1138
+ /** the pre-migration location, read once so notes are not lost on upgrade */
1139
+ get legacyMemoryFile() {
1036
1140
  return path.join(this.opts.sessionDir, "memory.md");
1037
1141
  }
1038
1142
  get todoFile() {
@@ -1071,6 +1175,42 @@ export class Agent {
1071
1175
  to: this.goalFile,
1072
1176
  });
1073
1177
  }
1178
+ /**
1179
+ * Move notes from the per-session file into the agent-wide one — once.
1180
+ *
1181
+ * Older builds wrote memory.md inside the session dir. Those notes are real knowledge and
1182
+ * must not be abandoned by the upgrade that makes them durable, so the session's file is
1183
+ * APPENDED to the agent-wide one (never replacing it: the agent-wide file may already hold
1184
+ * notes from other sessions) and then removed so a later session does not re-import it.
1185
+ */
1186
+ async migrateMemoryToAgentScope() {
1187
+ const from = this.legacyMemoryFile;
1188
+ const to = this.memoryFile;
1189
+ if (from === to)
1190
+ return;
1191
+ let legacy;
1192
+ try {
1193
+ legacy = (await fs.readFile(from, "utf8")).trim();
1194
+ }
1195
+ catch {
1196
+ return; // nothing to migrate
1197
+ }
1198
+ if (!legacy) {
1199
+ await fs.rm(from, { force: true }).catch(() => { });
1200
+ return;
1201
+ }
1202
+ try {
1203
+ const existing = (await fs.readFile(to, "utf8").catch(() => "")).trim();
1204
+ const merged = (existing ? `${existing}\n` : "") +
1205
+ `<!-- migrated from session ${path.basename(this.opts.sessionDir)} -->\n${legacy}\n`;
1206
+ await fs.writeFile(to, merged, "utf8");
1207
+ await fs.rm(from, { force: true });
1208
+ console.log(`[teapot] memory: migrated ${legacy.length} bytes to ${path.basename(to)} (agent scope)`);
1209
+ }
1210
+ catch {
1211
+ /* keep the session copy if the agent-wide write failed — losing notes is worse */
1212
+ }
1213
+ }
1074
1214
  /**
1075
1215
  * Rebuild the in-memory conversation from the JSONL event log so a restart
1076
1216
  * continues where the agent left off instead of starting blank.
@@ -2529,11 +2669,44 @@ export class Agent {
2529
2669
  return "next";
2530
2670
  }
2531
2671
  const needle = query.toLowerCase();
2532
- const hits = mem
2533
- .split(/\r?\n/)
2534
- .filter((line) => line.toLowerCase().includes(needle));
2672
+ const lines = mem.split(/\r?\n/);
2673
+ const hits = lines.filter((line) => line.toLowerCase().includes(needle));
2674
+ /**
2675
+ * Give each hit its CONTEXT, not just the bare line.
2676
+ *
2677
+ * A matching line on its own is often meaningless — "the cache lies" says nothing
2678
+ * without the heading it sits under. And a note needs to be dateable to be usable: a
2679
+ * lesson harvested from a compaction three weeks ago should not read with the same
2680
+ * authority as one from today. So each hit is reported with its nearest preceding
2681
+ * heading and any `_from:_` provenance line.
2682
+ */
2683
+ const headingAt = (idx) => {
2684
+ for (let i = idx; i >= 0; i--) {
2685
+ const l = lines[i].trim();
2686
+ if (/^#{1,6}\s/.test(l))
2687
+ return l;
2688
+ }
2689
+ return "";
2690
+ };
2691
+ const provenanceAt = (idx) => {
2692
+ // the `_from:_` line lives within a few lines above its lesson block
2693
+ for (let i = idx; i >= Math.max(0, idx - 6); i--) {
2694
+ const l = lines[i].trim();
2695
+ if (/^_from:/.test(l))
2696
+ return l.replace(/^_|_$/g, "");
2697
+ }
2698
+ return "";
2699
+ };
2700
+ const rendered = hits.slice(0, 40).map((line) => {
2701
+ const idx = lines.indexOf(line);
2702
+ const head = headingAt(idx);
2703
+ const prov = provenanceAt(idx);
2704
+ const where = [head, prov].filter(Boolean).join(" · ");
2705
+ return where ? `${line}\n ↳ ${where}` : line;
2706
+ });
2535
2707
  await this.answerMeta(call, hits.length
2536
- ? `${hits.length} line(s) matching ${JSON.stringify(query)}:\n${hits.join("\n")}`
2708
+ ? `${hits.length} line(s) matching ${JSON.stringify(query)}` +
2709
+ `${hits.length > 40 ? ` (showing the first 40)` : ""}:\n${rendered.join("\n")}`
2537
2710
  : `(no line in memory.md matches ${JSON.stringify(query)} — ${mem.split(/\r?\n/).length} lines searched; call read_memory with no query to see all of it)`);
2538
2711
  return "next";
2539
2712
  },
@@ -3005,6 +3178,8 @@ export class Agent {
3005
3178
  * for the session and the provider prefix cache survives.
3006
3179
  */
3007
3180
  skillCatalogue = "";
3181
+ /** the compact digest of memory.md put into the frozen prompt (Codex's MEMORY_SUMMARY) */
3182
+ memoryDigest = "";
3008
3183
  systemPrompt() {
3009
3184
  if (!this.agentsMdLoaded) {
3010
3185
  this.agentsMdLoaded = true;
@@ -3078,6 +3253,7 @@ export class Agent {
3078
3253
  // #31: capture the skill catalogue in the SAME one-shot block, so the
3079
3254
  // system prompt stays byte-identical for the session (prefix cache).
3080
3255
  this.skillCatalogue = this.skillCatalogueText();
3256
+ this.memoryDigest = this.memoryDigestText();
3081
3257
  }
3082
3258
  let sys = SYSTEM_TEMPLATE;
3083
3259
  if (this.agentsMd.trim()) {
@@ -3102,6 +3278,27 @@ export class Agent {
3102
3278
  `pass what you want done so the instructions arrive with the playbook. ` +
3103
3279
  `list_skills() shows the full detail.`;
3104
3280
  }
3281
+ /**
3282
+ * A DIGEST of the durable notes — Codex's `MEMORY_SUMMARY`, not the notes themselves.
3283
+ *
3284
+ * The full file cannot go here (it is unbounded, and re-injecting it every turn is the
3285
+ * prefix-cache break that made takos' design a bad fit). But leaving the notes entirely
3286
+ * behind a tool call was measured to fail the other way: the model never learned they
3287
+ * existed, so it never asked. Codex resolves exactly this by injecting a compact summary
3288
+ * and telling the model to search the rest — the summary names WHAT is in memory, the tool
3289
+ * fetches the detail.
3290
+ *
3291
+ * Captured in the same one-shot block as AGENTS.md and the skills catalogue, so the prompt
3292
+ * stays byte-identical for the session.
3293
+ */
3294
+ if (this.memoryDigest) {
3295
+ sys +=
3296
+ `\n\n## Your durable notes (memory.md — a DIGEST, not the whole file)\n${this.memoryDigest}\n` +
3297
+ `The full notes are NOT in this prompt. When any of the above may bear on the task — ` +
3298
+ `prior decisions, gotchas, where you left off — search them: ` +
3299
+ `read_memory(query) returns the matching lines, read_memory() with no query returns everything. ` +
3300
+ `Write with add_memory(text) (appends; never loses an earlier note).`;
3301
+ }
3105
3302
  return sys;
3106
3303
  }
3107
3304
  /**
@@ -3264,6 +3461,14 @@ export class Agent {
3264
3461
  // #94: the rejection survives in memory so the eventual approved
3265
3462
  // final can name what the first attempt was told
3266
3463
  this.lastRejectedAudit = { feedback, attempt: this.auditAttempts };
3464
+ /**
3465
+ * …AND capture the work that was just rejected, once. This runs before the retry
3466
+ * prompt is queued, so the history still holds the original task; capturing later
3467
+ * (at the approved finish) would read only the fix-up.
3468
+ */
3469
+ if (!this.preRejectionTurns.length) {
3470
+ this.preRejectionTurns = await this.captureRecentTurns();
3471
+ }
3267
3472
  }
3268
3473
  // `operatorFacing: true` — the verdict is written for the TIMELINE
3269
3474
  // only. The audit ran in its own side conversation (a tools-less call
@@ -3371,6 +3576,29 @@ export class Agent {
3371
3576
  /** The `final: true` event — the parent's notification (#89: never before the goal settles). */
3372
3577
  async appendFinalMessage(args) {
3373
3578
  const recent = await this.captureRecentTurns();
3579
+ /**
3580
+ * #94: an APPROVED finish after a REJECTION must describe the WHOLE task.
3581
+ *
3582
+ * `captureRecentTurns()` reads the last six meaningful messages, which after a
3583
+ * changes-required verdict is exactly the RETRY — so the parent was told about the last few
3584
+ * minutes of work and nothing about the hours that came before it. The rejection branch
3585
+ * already queues the auditor's feedback as the retry prompt, so the retry is a narrow fix-up;
3586
+ * reporting only that makes the work look trivial and the parent has no basis to judge it.
3587
+ *
3588
+ * The pre-rejection activity is captured when the reject arrives (`preRejectionTurns`) and is
3589
+ * prepended here, clearly labelled, so the parent reads "this is what was done, and this is
3590
+ * what the audit then required". Bounded to the same six entries so the report stays a report.
3591
+ */
3592
+ const before = this.preRejectionTurns;
3593
+ this.preRejectionTurns = [];
3594
+ const combined = before.length
3595
+ ? [
3596
+ `[before the audit rejected the first finish — ${before.length} entries]`,
3597
+ ...before,
3598
+ `[after the rejection — the retry — ${recent.length} entries]`,
3599
+ ...recent,
3600
+ ]
3601
+ : recent;
3374
3602
  // #91/#94: the final says how it relates to the audit — approved on which
3375
3603
  // attempt, what the previous attempt was told. Cleared on emit: a later
3376
3604
  // unaudited finish must not inherit stale lineage.
@@ -3380,7 +3608,7 @@ export class Agent {
3380
3608
  role: "assistant",
3381
3609
  final: true,
3382
3610
  content: String(args.summary ?? ""),
3383
- ...(recent.length ? { recentContext: recent } : {}),
3611
+ ...(combined.length ? { recentContext: combined } : {}),
3384
3612
  ...(outcome
3385
3613
  ? {
3386
3614
  audited: outcome.audited,
@@ -4151,7 +4379,22 @@ export class Agent {
4151
4379
  const lessons = m?.[1]?.trim();
4152
4380
  if (!lessons)
4153
4381
  return;
4154
- const stamped = `\n<!-- lessons harvested from compaction ${new Date().toISOString()} -->\n${lessons}\n`;
4382
+ /**
4383
+ * PROVENANCE, in a form the model can READ.
4384
+ *
4385
+ * The stamp used to be an HTML comment. It recorded exactly the right thing — which
4386
+ * session and which compaction a note came from — and nothing ever read it back: a
4387
+ * `read_memory(query)` returned the lesson with no way to tell whether it was observed
4388
+ * today or inherited from a compaction three weeks ago. A note you cannot date is a note
4389
+ * you cannot safely act on.
4390
+ *
4391
+ * It is now a visible `_from:_` line, which survives search, survives the digest (it is
4392
+ * indented under the heading and skipped as a continuation), and answers "where did this
4393
+ * come from?" in the reply itself.
4394
+ */
4395
+ const session = path.basename(this.opts.sessionDir);
4396
+ const stamped = `\n## lessons from compaction ${new Date().toISOString().slice(0, 16).replace("T", " ")}\n` +
4397
+ `_from: session ${session}, branch ${this.currentBranch}_\n${lessons}\n`;
4155
4398
  await fs.appendFile(this.memoryFile, stamped, "utf8").catch(() => { });
4156
4399
  }
4157
4400
  async recordProgress(argsJson) {
@@ -474,6 +474,73 @@ function trailingWsMatches(srcLines, patLines) {
474
474
  }
475
475
  return hits;
476
476
  }
477
+ /**
478
+ * Did `anchor` resolve to a span far larger than it asked for? Returns the refusal, or null.
479
+ *
480
+ * ## Why this is a separate function
481
+ *
482
+ * The first version was inlined and measured `text.indexOf(anchor)` — which by definition finds
483
+ * exactly `anchor.length` characters, so it could NEVER fire, and its test passed with the guard
484
+ * disabled. The overshoot does not come from the exact match: it comes from the TOLERANT path,
485
+ * where a model that omits indentation or trailing spaces hands over a short anchor and the
486
+ * per-line comparison then accepts a much longer region.
487
+ *
488
+ * So the question is: how many file lines does the anchor's FIRST line's text actually cover
489
+ * once tolerance is applied? If that region is more than twice the anchor's own line count, the
490
+ * anchor is not specific enough and the edit would rewrite something unintended.
491
+ *
492
+ * MEASURED basis (#83): `old_text not found` is 117 of 168 edit failures, and the near-miss
493
+ * cases are exactly the ones where tolerance decides what matched. Being wrong there is silent.
494
+ */
495
+ export function disproportionateSpan(text, anchor) {
496
+ const anchorLines = anchor.split("\n");
497
+ const askedLines = anchorLines.length;
498
+ if (askedLines < 2)
499
+ return null; // a single line cannot span disproportionately
500
+ /**
501
+ * Do NOT require an exact substring match.
502
+ *
503
+ * The whole point is the near-miss case: the anchor does not appear verbatim, which is why the
504
+ * tolerant path is consulted at all and why it can overshoot. Requiring `indexOf` here made
505
+ * the guard unreachable exactly when it matters.
506
+ */
507
+ const anchorFirst = anchorLines[0].trimEnd();
508
+ const start = text.split("\n").findIndex((l) => l.trimEnd() === anchorFirst);
509
+ if (start < 0)
510
+ return null; // its first line is not in the file at all: not this guard's case
511
+ /**
512
+ * How many file lines does the anchor COVER, allowing the same trailing-whitespace tolerance
513
+ * the tolerant matcher uses?
514
+ *
515
+ * This walks the file and the anchor together, and counts file lines consumed. If matching
516
+ * the anchor requires consuming more than twice its own line count, the anchor is too loose:
517
+ * applying it would replace a region the model did not point at.
518
+ */
519
+ const srcLines = text.split("\n");
520
+ const firstLine = start;
521
+ let fileAt = firstLine;
522
+ let consumed = 0;
523
+ for (let a = 0; a < anchorLines.length; a++) {
524
+ const want = anchorLines[a].trimEnd();
525
+ let found = -1;
526
+ for (let f = fileAt; f < srcLines.length; f++) {
527
+ if (srcLines[f].trimEnd() === want) {
528
+ found = f;
529
+ break;
530
+ }
531
+ }
532
+ if (found < 0)
533
+ return null; // did not resolve under tolerance; not this guard's business
534
+ consumed = found - firstLine + 1;
535
+ if (consumed > askedLines * 2) {
536
+ return (`old_text spans ${askedLines} line(s) but only resolves after covering ${consumed} ` +
537
+ `lines of the file — refusing a disproportionate match. An anchor this loose would ` +
538
+ `rewrite a region you did not intend. Re-read the file and copy a tighter block.`);
539
+ }
540
+ fileAt = found + 1;
541
+ }
542
+ return null;
543
+ }
477
544
  export const DEFAULT_TIMEOUT_MS = 120_000;
478
545
  /* ---------- read_url cache ---------- */
479
546
  const URL_CACHE_TTL_MS = 3_600_000;
@@ -1335,6 +1402,29 @@ export const TOOLS = [
1335
1402
  }
1336
1403
  }
1337
1404
  let count = hashNote ? 0 : text.split(oldText).length - 1;
1405
+ /**
1406
+ * A MINIMUM ANCHOR LENGTH, from Gemini's `edit.ts`.
1407
+ *
1408
+ * Below this, an anchor cannot identify anything: " }" or "\n\n" appear everywhere, and
1409
+ * any tolerant matching on them either fails ambiguously or picks a wrong span. MEASURED
1410
+ * across every session (#83): `old_text not found` is 117 of 168 edit failures, and a
1411
+ * large share of those are anchors too short to be unique, sent by a model that believed
1412
+ * them specific.
1413
+ *
1414
+ * Short anchors are still ACCEPTED when they match exactly once — a one-character edit is
1415
+ * legitimate. What is refused is trying to make a short anchor work by relaxing the match.
1416
+ */
1417
+ const MIN_FUZZY_ANCHOR = 10;
1418
+ /**
1419
+ * A MULTI-LINE anchor is specific by construction: two matching lines pin both a start
1420
+ * and a continuation, which is far stronger evidence than 10 characters on one line.
1421
+ * Gemini's floor is about single-line anchors, where " }" and "foo();" genuinely cannot
1422
+ * identify anything. Applying it by raw character count rejected `foo\nbar` — a perfectly
1423
+ * unambiguous two-line anchor — which is the guard making normal editing harder, the
1424
+ * exact failure mode #157 warns about.
1425
+ */
1426
+ const anchorLines = oldText.split("\n").length;
1427
+ const anchorTooShort = anchorLines < 2 && oldText.trim().length < MIN_FUZZY_ANCHOR;
1338
1428
  let normalized = false;
1339
1429
  if (count === 0 && oldText.includes("\n") && text.includes("\r\n")) {
1340
1430
  const lf = text.replace(/\r\n/g, "\n");
@@ -1347,7 +1437,7 @@ export const TOOLS = [
1347
1437
  }
1348
1438
  // tolerate patterns whose only difference is trailing whitespace per line
1349
1439
  // (the most common near-miss) — applied only when it resolves uniquely
1350
- if (count === 0) {
1440
+ if (count === 0 && !anchorTooShort) {
1351
1441
  const srcLines = text.replace(/\r\n/g, "\n").split("\n");
1352
1442
  const patLines = oldText.replace(/\r\n/g, "\n").split("\n");
1353
1443
  const hits = trailingWsMatches(srcLines, patLines);
@@ -1397,6 +1487,18 @@ export const TOOLS = [
1397
1487
  result: `old_text matched ${count} times (lines ${at.slice(0, 5).join(", ")}) and must be unique — add surrounding lines to old_text, or pass replace_all=true`,
1398
1488
  };
1399
1489
  }
1490
+ /**
1491
+ * DISPROPORTIONATE MATCH guard, from OpenCode's `isDisproportionateMatch`.
1492
+ *
1493
+ * The dangerous shape is not "no match" — that is loud and recoverable — but a match far
1494
+ * LARGER than the anchor, where asking to change one call site silently rewrites a whole
1495
+ * function. A confident wrong edit is worse than a failed one.
1496
+ */
1497
+ if (!hashSpan) {
1498
+ const over = disproportionateSpan(text, oldText);
1499
+ if (over)
1500
+ return { ok: false, result: over };
1501
+ }
1400
1502
  // A verified hashline block is addressed BY LINE INDEX: the anchors
1401
1503
  // already proved which lines it means, so a block whose content occurs
1402
1504
  // twice must still edit the anchored occurrence rather than fail the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.33.0",
3
+ "version": "0.34.1",
4
4
  "description": "A lightweight, always-on multi-agent harness for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-or-later",
@@ -0,0 +1 @@
1
+ :root{--bg-darkest:#1a1c22;--bg-dark:#232630;--bg-mid:#2b2e39;--bg-light:#343845;--fg:#dcdee4;--dim:#9298a5;--muted:#6b7280;--line:#1d2027;--acc:#5865f2;--ok:#3ba55d;--warn:#faa81a;--err:#ed4245;--tool:#3ba0c9;--term-bg:#0d0e12;--term-fg:#dcdee4;--text-xs:11px;--text-sm:13px;--text-md:14px;--text-lg:16px;--text-xl:20px;--leading-tight:1.25;--leading-normal:1.45;--leading-relaxed:1.6;--tracking-tight:-.011em;--tracking-tighter:-.02em;--space-1:2px;--space-2:4px;--space-3:6px;--space-4:8px;--space-5:12px;--space-6:16px;--space-7:24px;--radius-sm:6px;--radius-md:9px;--radius-lg:12px;--radius-xl:16px;--radius-pill:999px;--ease-out:cubic-bezier(.22, 1, .36, 1);--dur-fast:.12s;--dur-base:.2s;--dur-slow:.24s;--shadow-sm:0 1px 2px #0006;--shadow-lg:0 8px 24px -6px #000a;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;font-family:Inter,Geist,SF Pro Text,system-ui,-apple-system,Segoe UI,Helvetica Neue,Arial,sans-serif}[data-theme=midnight]{--bg-darkest:#0d0f18;--bg-dark:#12141f;--bg-mid:#1b1f31;--bg-light:#252a42;--fg:#dfe2f2;--dim:#8a90ad;--line:#0a0c14;--acc:#8b7cf7;--ok:#54c08a;--warn:#e5b567;--err:#ef6a6a;--tool:#6aa9e9;--term-bg:#0a0c13;--term-fg:#dfe2f2}[data-theme=tea]{--bg-darkest:#241c16;--bg-dark:#2e241c;--bg-mid:#3b2f24;--bg-light:#493b2d;--fg:#f0e4d2;--dim:#b39d82;--line:#1b140f;--acc:#d98e32;--ok:#7fa653;--warn:#e0b058;--err:#cf5b47;--tool:#c9975f;--term-bg:#1d1712;--term-fg:#ecdcc3}[data-theme=coffee]{--bg-darkest:#191410;--bg-dark:#211a14;--bg-mid:#30271e;--bg-light:#403527;--fg:#ede3d0;--dim:#a89478;--line:#120d07;--acc:#c68a4b;--ok:#8aa15c;--warn:#d9a441;--err:#c25450;--tool:#a67c52;--term-bg:#15100c;--term-fg:#e8dcc5}[data-theme=matcha]{--bg-darkest:#1b2217;--bg-dark:#232b1e;--bg-mid:#2f3a28;--bg-light:#3c4a33;--fg:#e8eeda;--dim:#9aab84;--line:#131a10;--acc:#8db64e;--ok:#6fae4e;--warn:#d8b13c;--err:#cd5c50;--tool:#5da88f;--term-bg:#151b11;--term-fg:#dfe8cb}[data-theme=matrix]{--bg-darkest:#060a06;--bg-dark:#0a0f0a;--bg-mid:#122116;--bg-light:#18301d;--fg:#c9f2cf;--dim:#6fa075;--line:#030603;--acc:#2fd558;--ok:#39c95f;--warn:#b8d977;--err:#ff6b6b;--tool:#57c99b;--term-bg:#030503;--term-fg:#3f7}[data-theme=sunset]{--bg-darkest:#1c1422;--bg-dark:#241b2b;--bg-mid:#33253e;--bg-light:#452f52;--fg:#f2e6ea;--dim:#ab93a8;--line:#150e1b;--acc:#f2784b;--ok:#63b46f;--warn:#eda63d;--err:#e25563;--tool:#b06ac9;--term-bg:#170f1d;--term-fg:#f0dfe4}[data-theme=light]{--bg-darkest:#eceef4;--bg-dark:#f6f7fa;--bg-mid:#e2e5ee;--bg-light:#fff;--fg:#24272f;--dim:#5d6470;--line:#d8dbe4;--acc:#4757d8;--ok:#2b8a4b;--warn:#b97a0f;--err:#d83c3f;--tool:#2278a8;--term-bg:#fff;--term-fg:#24272f;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}[data-theme=strawberry]{--bg-darkest:#fbe4ea;--bg-dark:#fdf0f3;--bg-mid:#f7d4de;--bg-light:#fffafb;--fg:#4a2733;--dim:#96707e;--line:#f0ccd6;--acc:#e05575;--ok:#4d9e63;--warn:#c98a2d;--err:#d43d51;--tool:#b05687;--term-bg:#fff5f8;--term-fg:#4a2733;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}[data-theme=ramune]{--bg-darkest:#ddeff7;--bg-dark:#ecf7fb;--bg-mid:#c9e7f4;--bg-light:#fbfeff;--fg:#173342;--dim:#5b7d90;--line:#c2e2ef;--acc:#1d86ae;--ok:#3a9e6e;--warn:#cf9a2a;--err:#d64f5c;--tool:#3a9db8;--term-bg:#f4fbfd;--term-fg:#173342;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--bg-dark);color:var(--fg);font-size:var(--text-md);background-image:linear-gradient(color-mix(in srgb, var(--bg-dark) calc(var(--bg-image-dim,.55) * 100%), transparent), color-mix(in srgb, var(--bg-dark) calc(var(--bg-image-dim,.55) * 100%), transparent)), var(--bg-image,none);background-position:50%;background-repeat:no-repeat;background-size:cover;background-attachment:fixed}.layout{grid-template-columns:250px 1fr clamp(320px,370px,32vw);height:100dvh;display:grid;overflow:hidden}.layout.right-hidden{grid-template-columns:250px 1fr}.layout.right-hidden .rightbar{display:none}@media (width<=1100px){.layout,.layout.right-hidden{grid-template-columns:220px 1fr}.layout.right-hidden .rightbar,.layout .rightbarbackdrop{display:block}.rightbar .rightbarhead{z-index:1;display:flex;position:sticky;top:0}.rightbar{z-index:5;width:min(420px,92vw);box-shadow:none;transition:transform .18s,box-shadow .18s;position:fixed;top:0;bottom:0;right:0;transform:translate(100%)}.rightbar.open{transform:none;box-shadow:-8px 0 24px #0007}}.sidebar{background:var(--bg-darkest);flex-direction:column;padding:10px 8px;display:flex;overflow:hidden auto}.themepop{background:var(--bg-mid);border:1px solid var(--bg-light);border-radius:var(--radius-lg);gap:var(--space-4);flex-direction:column;padding:10px;display:flex;position:static}.trow{align-items:center;gap:var(--space-3);font-size:var(--text-sm);color:var(--fg);cursor:pointer;display:flex}.trow select{background:var(--bg-darkest);border-radius:var(--radius-md);color:var(--fg);border:none;outline:none;padding:3px 6px}.themegrid{gap:var(--space-2);grid-template-columns:1fr 1fr;display:grid}.themebtn{align-items:center;gap:var(--space-3);background:var(--bg-light);color:var(--fg);border-radius:var(--radius-md);cursor:pointer;font-size:var(--text-xs);text-align:left;border:1px solid #0000;min-width:0;padding:5px 8px;display:flex;overflow:hidden}.themebtn>:last-child{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.themebtn:hover{filter:brightness(1.15)}.themebtn.on{border-color:var(--acc)}.swdots{gap:var(--space-1);flex-shrink:0;display:inline-flex}.themepick{gap:var(--space-3);margin-top:var(--space-3);grid-template-columns:repeat(auto-fill,minmax(104px,1fr));display:grid}.themecard{gap:var(--space-2);cursor:pointer;color:var(--fg);font-size:var(--text-xs);text-align:left;background:0 0;border:none;flex-direction:column;min-width:0;padding:0;display:flex}.themecard-preview{border-radius:var(--radius-md);border:1px solid var(--line);width:100%;height:62px;transition:border-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);display:block;overflow:hidden}.themecard:hover .themecard-preview{border-color:var(--dim);transform:translateY(-1px)}.themecard.on .themecard-preview{border-color:var(--acc);box-shadow:0 0 0 2px var(--acc)}.themecard-label{text-overflow:ellipsis;white-space:nowrap;color:var(--dim);overflow:hidden}.themecard.on .themecard-label{color:var(--fg);font-weight:600}.tprev{width:100%;height:100%;display:block;position:relative}.tprev-nav{width:22%;position:absolute;inset:0 auto 0 0}.tprev-head{height:18%;position:absolute;top:0;left:22%;right:0}.tprev-panel{border-radius:3px;margin:5%;position:absolute;inset:18% 0 0 22%}.tprev-line{border-radius:2px;height:5%;position:absolute}.tprev-dot{border-radius:50%;width:7px;height:7px;position:absolute}.themeeditor{margin-top:var(--space-5)}.cfgsub{font-size:var(--text-xs);text-transform:uppercase;letter-spacing:.04em;color:var(--dim);margin:var(--space-5) 0 var(--space-3);font-weight:600}.paletterows{gap:var(--space-2) var(--space-4);margin:var(--space-3) 0;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));display:grid}.paletterow{align-items:center;gap:var(--space-2);font-size:var(--text-xs);min-width:0;display:flex}.paletterow input[type=color]{border:1px solid var(--line);border-radius:var(--radius-sm);cursor:pointer;background:0 0;flex-shrink:0;width:26px;height:22px;padding:0}.paletterow-label{color:var(--dim);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.paletterow-hex{background:var(--bg-darkest);border:1px solid var(--line);width:8.5em;color:var(--fg);border-radius:var(--radius-sm);padding:2px var(--space-2);font-size:var(--text-xs);flex-shrink:0}.paletterow-hex:focus{border-color:var(--acc);outline:none}.bgpreview{margin-top:var(--space-3)}.bgpreview img{object-fit:cover;border-radius:var(--radius-md);border:1px solid var(--line);max-width:100%;max-height:120px;display:block}.bgpreview .btnrow{margin-top:var(--space-2);align-items:center}.swdots i{border-radius:50%;width:9px;height:9px;display:inline-block;box-shadow:inset 0 0 0 1px #0004}.agent-list{flex:1;min-width:0;min-height:0;overflow-y:auto}.wsheader{align-items:center;gap:var(--space-3);font-size:var(--text-xs);letter-spacing:.04em;text-transform:uppercase;color:var(--dim);cursor:pointer;-webkit-user-select:none;user-select:none;border-top:1px solid var(--line);margin-top:6px;padding:10px 10px 4px;font-weight:600;display:flex}.wsheader:first-child{border-top:none;margin-top:0}.wsheader:hover{color:var(--fg)}.wsheader .wscaret{width:12px;font-size:var(--text-xs);flex-shrink:0}.wsheader .wscount{border-radius:var(--radius-pill);background:var(--bg-light);color:var(--dim);font-size:var(--text-xs);letter-spacing:0;flex-shrink:0;margin-left:auto;padding:0 6px;font-weight:600;line-height:15px}.agent-item{align-items:center;gap:var(--space-4);border-radius:var(--radius-md);cursor:pointer;color:var(--fg);min-width:0;margin-bottom:2px;padding:7px 10px;display:flex}.agent-item>span:not(.dot):not(.caret):not(.caret-spacer):not(.notifbadge):not(.subcount):not(.subtag):not(.ghosttag):not(.mini-cron):not(.goaldone){text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.agent-item .subtag{color:var(--dim);font-size:var(--text-xs)}.agent-item .goaldone{flex-shrink:0}.caret{cursor:pointer;width:12px;color:var(--dim);font-size:var(--text-xs);text-align:center;-webkit-user-select:none;user-select:none;flex-shrink:0}.caret:hover{color:var(--fg)}.caret-spacer{flex-shrink:0;width:12px}.agent-item:hover{background:var(--bg-mid)}.agent-item.collapsed{cursor:pointer}.agent-item.sel{background:var(--bg-mid)}.agent-item.sub-row{color:var(--dim)}.agent-item.sub-row.sel{color:var(--fg)}.dot{border-radius:50%;flex-shrink:0;width:9px;height:9px}.dot.running{background:var(--ok);box-shadow:0 0 6px var(--ok)}.dot.waiting{background:var(--acc);box-shadow:0 0 6px var(--acc);animation:1.6s ease-in-out infinite pulse}.badge.waiting{color:var(--acc)}.dot.idle{background:var(--warn)}.dot.stopped{background:var(--dim)}.dot.error{background:var(--err);box-shadow:0 0 6px var(--err)}.sidebar .metrics{font-size:var(--text-xs);color:var(--dim);border-top:1px solid var(--line);margin-top:12px;padding:8px 10px;line-height:1.7}.sidebar-footer{border-top:1px solid var(--line);gap:var(--space-1);flex-direction:column;margin-top:auto;padding-top:8px;display:flex}.footer-row{align-items:center;gap:var(--space-4);display:flex}.footer-row .conn{margin-left:0}.sidebar-footer .metrics{border-top:none;margin-top:4px;padding:0}.brand{align-items:center;gap:var(--space-4);font-size:var(--text-md);color:var(--fg);display:flex}.version{color:var(--dim);font-size:var(--text-xs);font-family:ui-monospace,Menlo,monospace}.channel{flex-direction:column;min-width:0;min-height:0;display:flex;position:relative;overflow:hidden}.chan-head{align-items:center;gap:var(--space-3);padding:var(--space-4) var(--space-6);border-bottom:1px solid var(--line);background:var(--bg-dark);flex-shrink:0;display:flex}.chan-head .hash{color:var(--dim);font-size:var(--text-xl);font-weight:300}.chan-head .title{font-weight:600;font-size:var(--text-lg);letter-spacing:var(--tracking-tight)}.chan-head .sub{color:var(--dim);font-size:var(--text-xs);margin-left:var(--space-2);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.chan-head .head-actions{align-items:center;gap:var(--space-2);margin-left:auto;display:flex}.chan-head .head-sep{width:1px;margin:var(--space-1) var(--space-1);background:var(--line);align-self:stretch}.chan-head .runbtn{min-width:74px;height:24px;padding:0 var(--space-4);background:var(--ok);color:#fff;border-radius:var(--radius-md);cursor:pointer;font-size:var(--text-sm);transition:background-color var(--dur-fast) ease, filter var(--dur-fast) ease;border:none;justify-content:center;align-items:center;font-weight:700;line-height:1;display:inline-flex}.chan-head .runbtn:hover{filter:brightness(1.12)}.chan-head .runbtn.danger{background:var(--err)}.badge{font-size:var(--text-xs);border-radius:var(--radius-pill);padding:1px var(--space-4);background:var(--bg-light);vertical-align:middle;font-weight:500}.badge.running{color:var(--ok)}.badge.error{color:var(--err)}.badge.idle{color:var(--warn)}.badge.done{color:var(--acc)}.badge.queued{color:var(--warn);white-space:nowrap;background:#faa81a1a;border:1px solid #faa81a44}html[data-feedcv=on] .feed>.msg{content-visibility:auto;contain-intrinsic-size:auto 140px}.feed{padding:var(--space-5) 0;overscroll-behavior:contain;flex:1;min-height:0;overflow-y:auto}.msg{gap:var(--space-6);padding:var(--space-2) var(--space-6);transition:background-color var(--dur-fast) ease;display:flex}.msg:hover{background:#ffffff08}.msg.pending{opacity:.75}.msg.pending .ts{color:var(--warn);font-weight:600}.msg.pending .avatar{animation:1.6s ease-in-out infinite pulse}.msg.pending .editbtn.cancel{color:var(--err)}.msg.withdrawn{opacity:.55}.msg.withdrawn .msg-body{text-decoration:line-through;-webkit-text-decoration-color:var(--muted);text-decoration-color:var(--muted)}.msg.withdrawn .msg-head{text-decoration:none}.msg.withdrawn .ts{color:var(--muted);font-weight:600}.msg.grouped{padding-top:0}.avatar{width:38px;height:38px;font-size:var(--text-lg);border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;margin-top:2px;display:flex}.msg-body{flex:1;min-width:0}.msg-head{gap:var(--space-4);align-items:baseline;display:flex}.actor{color:var(--warn);font-size:var(--text-xs);white-space:nowrap}.runcard{gap:var(--space-4);flex-direction:column;display:flex}.statgrid{gap:var(--space-3);grid-template-columns:repeat(3,1fr);display:grid}.stat{background:var(--bg-mid);border-radius:var(--radius-md);gap:var(--space-1);flex-direction:column;min-width:0;padding:5px 8px;display:flex}.stat span{color:var(--dim);font-size:var(--text-xs);text-transform:uppercase;letter-spacing:.05em}.stat b{font-size:var(--text-md);text-overflow:ellipsis;overflow:hidden}.statrow{align-items:center;gap:var(--space-4);font-size:var(--text-sm);min-width:0;display:flex}.statrow .k{color:var(--dim);text-transform:uppercase;font-size:var(--text-xs);letter-spacing:.05em;white-space:nowrap;flex-shrink:0;width:auto;min-width:58px}.pill{border-radius:var(--radius-pill);font-size:var(--text-xs);background:var(--bg-mid);white-space:nowrap;margin-left:auto;padding:1px 8px}.pill.ok{color:var(--ok)}.pill.warn{color:var(--warn)}.pill.crit{color:var(--err);background:#ed42451a}.bartrack{border-radius:var(--radius-sm);background:var(--bg-light);height:6px;margin-top:2px;overflow:hidden}.rtgrid{gap:var(--space-2);grid-template-columns:repeat(3,minmax(0,1fr));display:grid}.rtcell{background:var(--bg-dark);border-radius:var(--radius-md);flex-direction:column;gap:1px;min-width:0;padding:5px 7px;display:flex;overflow:hidden}.rtcell>span{color:var(--dim);font-size:var(--text-xs);text-transform:uppercase;letter-spacing:.05em;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.rtcell>b{font-size:var(--text-md);white-space:nowrap;text-overflow:ellipsis;font-variant-numeric:tabular-nums;font-weight:600;line-height:1.15;overflow:hidden}.rtcell>em{color:var(--dim);white-space:nowrap;text-overflow:ellipsis;font-size:10.5px;font-style:normal;overflow:hidden}.rtsep{color:var(--dim);padding:0 2px;font-weight:400}.barfill{border-radius:var(--radius-sm);background:var(--ok);min-width:2px;height:100%;transition:width .3s}.barfill.warn{background:var(--warn)}.barfill.crit{background:var(--err)}.author{font-weight:600;font-size:var(--text-md);letter-spacing:var(--tracking-tight)}.ts{color:var(--dim);font-size:var(--text-xs)}.content{white-space:pre-wrap;word-break:break-word;line-height:1.45}.content p{margin:2px 0}.content pre{background:var(--bg-darkest);border-radius:var(--radius-md);padding:8px;overflow-x:auto}.content pre>code{white-space:pre-wrap;overflow-wrap:anywhere}.content code{background:var(--bg-darkest);border-radius:var(--radius-sm);font-size:var(--text-sm);padding:1px 4px}.content pre code{background:0 0;padding:0}.content h1,.content h2,.content h3,.content h4,.content h5,.content h6{font-size:var(--text-md);margin:8px 0 2px}.content h1{font-size:var(--text-lg);letter-spacing:var(--tracking-tight)}.content h2{font-size:var(--text-md)}.content blockquote{border-left:3px solid var(--bg-light);color:var(--dim);background:#ffffff05;border-radius:0 4px 4px 0;margin:4px 0;padding:2px 10px}.content blockquote p{margin:2px 0}.content hr{border:none;border-top:1px solid var(--bg-light);margin:8px 0}.content del{color:var(--dim)}.content img{border-radius:var(--radius-md);max-width:100%}.content li.task{margin-left:-18px;list-style:none}.content li:has(>input[type=checkbox]){margin-left:-18px;list-style:none}.content li input[type=checkbox]{accent-color:var(--ok);margin-right:6px}input[type=checkbox]{accent-color:var(--acc)}.content a{color:var(--tool);text-decoration:underline;-webkit-text-decoration-color:color-mix(in srgb, var(--tool) 45%, transparent);text-decoration-color:color-mix(in srgb, var(--tool) 45%, transparent);text-underline-offset:2px}.content a:hover{filter:brightness(1.15)}.themebtn.on{background:var(--acc);color:#fff}.trow select:focus{outline:1px solid var(--acc)}.tbl{margin:6px 0;overflow-x:auto}.tbl table{border-collapse:collapse;font-size:var(--text-sm)}.tbl th,.tbl td{border:1px solid var(--bg-light);text-align:left;padding:3px 9px}.tbl th{background:var(--bg-darkest);font-weight:600}.embed{border-left:3px solid var(--tool);background:var(--bg-darkest);border-radius:var(--radius-sm);font-size:var(--text-sm);margin-top:3px;padding:6px 10px}.msg{--grouped-gap:var(--space-2)}.msg.grouped .avatar.avghost{align-self:flex-start;width:38px;height:0;min-height:0;margin-top:0}.msg.grouped{padding:0 var(--space-6)}.embed.grouped{margin-top:var(--grouped-gap)}.msg:not(.grouped).next-grouped{padding-bottom:0}.msg:not(.grouped).next-grouped .embed{margin-bottom:0}.msg.grouped:not(.next-grouped){padding-bottom:3px}.embed.grouped{border-radius:var(--radius-sm)}.embed.fail{border-color:var(--err)}.embed.warn-embed{border-color:var(--warn)}.embed.warn-embed .mono{color:var(--warn)}.embed.done{border-color:var(--ok)}.embed.running{border-color:var(--warn)}.embed.running summary .meta:after{content:"⋯";color:var(--warn);margin-left:6px;animation:1s step-end infinite blink;display:inline-block}.embed summary{gap:var(--space-4)}.embed summary .mono{font-family:ui-monospace,Menlo,monospace}.toolbody{background:var(--bg-darkest);border-radius:var(--radius-sm);white-space:pre-wrap;word-break:break-word;max-height:340px;font-size:var(--text-sm);margin:4px 0;padding:6px 8px;overflow-y:auto}.toolbody.del{border-left:2px solid var(--err);color:#f0a5a6;background:#ed424514}.toolbody.add{border-left:2px solid var(--ok);color:#9fd8ae;background:#3ba55d14}.toolbody.patch{padding:4px 8px}.toolbody.patch .pline{white-space:pre-wrap;word-break:break-word}.toolbody.patch .pline.add{color:#9fd8ae;border-left:2px solid var(--ok);background:#3ba55d14;padding-left:4px}.toolbody.patch .pline.del{color:#f0a5a6;border-left:2px solid var(--err);background:#ed424514;padding-left:4px}.toolbody.patch .pline.meta{color:var(--dim)}.embed.question{border-color:var(--acc);background:#5865f20f}.qopts{gap:var(--space-3);flex-wrap:wrap;margin-top:6px;display:flex}.qopt{background:var(--acc);color:#fff;border-radius:var(--radius-pill);cursor:pointer;font-size:var(--text-sm);border:none;padding:3px 12px}.qopt:hover{filter:brightness(1.15)}.qopt:disabled{opacity:.45;cursor:default;filter:none}.embed.question.answered{opacity:.75}.qfree{gap:var(--space-3);margin-top:8px;display:flex}.qfree input{background:var(--bg-mid);border:1px solid var(--bg-light);border-radius:var(--radius-md);color:var(--fg);font-size:var(--text-sm);outline:none;flex:1;padding:4px 10px}.qfree input:focus{border-color:var(--acc)}.qfree button{background:var(--bg-light);color:var(--fg);border-radius:var(--radius-md);cursor:pointer;font-size:var(--text-sm);border:none;padding:4px 12px}.qfree button:disabled{opacity:.45;cursor:default}.bashelapsed{color:var(--warn);font-size:var(--text-xs);margin-left:8px}.embed.question .meta{margin-top:6px}.embed.decision{border-color:var(--acc);background:#5865f20f}.embed.decision summary .meta{margin-left:6px}.embed.decision .content{font-size:var(--text-sm);margin-top:3px}.embed summary{cursor:pointer;-webkit-user-select:none;user-select:none;list-style-position:outside}.embed summary::marker{color:var(--dim)}.embed[open] summary{margin-bottom:4px}.embed .mono{font-family:ui-monospace,Menlo,monospace;font-size:var(--text-sm);white-space:pre-wrap;word-break:break-word;max-height:340px;overflow-y:auto}.embed .meta{color:var(--dim);font-size:var(--text-xs);margin-top:3px}.reasoning{border-left:3px dashed var(--bg-light);color:var(--dim);font-size:var(--text-sm);border-radius:var(--radius-sm);background:#ffffff05;margin:2px 0;padding:2px 10px}.reasoning summary{cursor:pointer;-webkit-user-select:none;user-select:none;opacity:.75}.reasoning summary:hover{opacity:1;color:var(--fg)}.reasoning[open] summary{margin-bottom:4px}.reasoning .mono{white-space:pre-wrap;word-break:break-word;max-height:260px;overflow-y:auto}.msg.live .avatar{animation:1.6s ease-in-out infinite pulse}.cursor{color:var(--acc);animation:1s step-end infinite blink}.interrupted{color:var(--warn);font-size:var(--text-xs);margin-top:3px}@keyframes blink{50%{opacity:0}}@keyframes pulse{50%{opacity:.55}}.conn{background:var(--err);vertical-align:middle;width:8px;height:8px;box-shadow:0 0 6px var(--err);border-radius:50%;display:inline-block}.conn.ok{background:var(--ok);box-shadow:0 0 6px var(--ok)}.copybtn{border:1px solid var(--bg-light);color:var(--dim);border-radius:var(--radius-sm);font-size:var(--text-xs);cursor:pointer;background:0 0;flex-shrink:0;padding:0 5px;line-height:16px}.copybtn:hover{color:var(--fg);filter:brightness(1.3)}.embed summary{align-items:center;gap:var(--space-3);display:flex}.toolcopy{gap:var(--space-2);flex-shrink:0;margin-left:auto;display:flex}.msgfoot{align-items:center;gap:var(--space-3);color:var(--dim);font-size:var(--text-xs);margin-top:4px;display:flex}.imgstage{gap:var(--space-3);flex-wrap:wrap;margin-bottom:6px;display:flex}.imgchip{display:inline-flex;position:relative}.imgchip img{object-fit:cover;border-radius:var(--radius-md);border:1px solid var(--line);width:64px;height:64px}.imgchip .imgx{background:var(--err);color:#fff;width:16px;height:16px;font-size:var(--text-xs);cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;line-height:1;display:inline-flex;position:absolute;top:-5px;right:-5px}.promptimgs{gap:var(--space-3);flex-wrap:wrap;margin-top:4px;display:flex}img.promptimg{border-radius:var(--radius-md);border:1px solid var(--line);max-width:180px;max-height:120px}.bgjob-note{color:var(--warn)}.bgjob-note b{color:var(--fg);font-family:ui-monospace,Menlo,monospace}details.reasoning .thinkscroll{white-space:pre-wrap;word-break:break-word;scrollbar-gutter:stable;max-height:220px;overflow-y:auto}.thinktimer{color:var(--dim);font-size:var(--text-xs);margin-left:6px;font-weight:400}.termdrawer{background:var(--term-bg);border-top:1px solid var(--line);flex-direction:column;display:flex}.termgrip{cursor:ns-resize;background:var(--bg-light);opacity:.6;border-bottom:1px solid var(--line);height:6px}.termgrip:hover{opacity:1}.termbar{font-size:var(--text-xs);color:var(--dim);border-bottom:1px solid var(--line);background:var(--bg-darkest);justify-content:space-between;align-items:center;padding:4px 10px;display:flex}.termtabs{gap:var(--space-1);flex:1;align-items:center;min-width:0;display:flex;overflow-x:auto}.termtab{align-items:center;gap:var(--space-3);border-radius:var(--radius-md);cursor:pointer;color:var(--dim);font-size:var(--text-xs);white-space:nowrap;background:var(--bg-mid);padding:2px 8px;display:inline-flex}.termtab.active{color:var(--fg);background:var(--bg-light)}.termtab:hover{filter:brightness(1.15)}.tabx{color:inherit;opacity:.5;cursor:pointer;font-size:var(--text-xs);background:0 0;border:none;padding:0}.tabx:hover{opacity:1;color:var(--err)}.termbody{gap:var(--space-2);background:var(--term-bg);flex:1;min-height:0;padding:4px;display:flex}.termbody.split .termpane{width:50%}.termpane{border-radius:var(--radius-md);background:var(--term-bg);flex:1;min-width:0;position:relative;overflow:hidden}.termpane:not(.focused){opacity:.9}.termpane.focused{box-shadow:none}.termhost{position:absolute;inset:0}.termsession{padding:4px 6px;position:absolute;inset:0}.termsplit{background:var(--line);border-radius:var(--radius-sm);cursor:col-resize;flex-shrink:0;width:3px}.termempty{font-size:var(--text-xs);color:var(--dim);place-items:center;display:grid;position:absolute;inset:0}.jump{background:var(--acc);color:#fff;border-radius:var(--radius-pill);padding:var(--space-3) var(--space-5);cursor:pointer;font-size:var(--text-sm);letter-spacing:var(--tracking-tight);box-shadow:var(--shadow-lg);z-index:2;transition:opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);border:none;font-weight:600;position:absolute;top:-34px;left:50%;transform:translate(-50%)}.jump:hover{filter:brightness(1.08)}.jump:active{transform:translate(-50%)translateY(1px)}@starting-style{.jump{opacity:0;transform:translate(-50%)translateY(6px)}}.channel:has(.termdrawer) .composer:not(.maximized) .jump{top:auto;bottom:calc(var(--termh,300px) + 100% + 6px);left:50%}.channel:has(.termdrawer) div.composer.maximized .jump{inset:10px 16px auto auto;transform:none}.divider-msg{align-items:center;gap:var(--space-5);color:var(--dim);font-size:var(--text-xs);padding:4px 18px;display:flex}.divider-msg:before,.divider-msg:after{content:"";background:var(--line);flex:1;height:1px}.divider-msg.err{color:var(--err)}.divider-msg.compacting{color:var(--acc);animation:1.6s ease-in-out infinite pulse}.goalline{color:var(--dim);font-size:var(--text-xs);padding:4px 18px}.goalline-label{color:var(--dim);display:block}.goalline.warn .goalline-label{color:var(--warn)}.goalline.err .goalline-label{color:var(--err)}.goalline .card{text-align:left;margin-top:6px}.day-divider{align-items:center;gap:var(--space-5);padding:14px 18px 6px;display:flex}.day-divider:before,.day-divider:after{content:"";background:var(--bg-light);flex:1;height:1px}.day-divider span{color:var(--dim);font-size:var(--text-xs)}.composer{padding:0 16px 18px;position:relative}.composer form{background:var(--bg-light);border-radius:var(--radius-lg);gap:var(--space-4);align-items:flex-end;padding:10px 12px;display:flex}.composer textarea{color:var(--fg);font:inherit;resize:none;background:0 0;border:none;outline:none;flex:1;line-height:1.4;overflow-y:auto}.cmds{background:var(--bg-mid);border:1px solid var(--bg-light);border-radius:var(--radius-lg);z-index:3;position:absolute;bottom:calc(100% - 8px);left:16px;right:16px;overflow:hidden;box-shadow:0 -6px 20px #0007}.cmdrow{gap:var(--space-5);cursor:pointer;font-size:var(--text-sm);align-items:baseline;padding:7px 12px;display:flex}.cmdrow:hover{background:var(--bg-light)}.cmdrow.active{background:var(--acc);color:#fff}.cmdrow.active .muted{color:#e6e9ff}.cmdrow .muted{font-size:var(--text-xs)}.composer button{background:var(--acc);color:#fff;border-radius:var(--radius-lg);cursor:pointer;border:none;padding:7px 14px;font-weight:600}.composer button:hover{opacity:.9}.composer label{color:var(--dim);font-size:var(--text-xs);gap:var(--space-2);white-space:nowrap;align-items:center;display:flex}.hint{color:var(--dim);font-size:var(--text-xs);margin-top:5px}.helpsec{margin-bottom:var(--space-5)}.helprow{gap:var(--space-4);font-size:var(--text-sm);border-bottom:1px solid var(--bg-light);grid-template-columns:minmax(96px,auto) 1fr;align-items:baseline;padding:4px 0;display:grid}.helprow:last-child{border-bottom:none}.helprow>b{color:var(--fg);white-space:nowrap;font-weight:600}.helprow>span{color:var(--dim);line-height:1.5}.helprow kbd{text-align:center;background:var(--bg-light);border-radius:var(--radius-sm);min-width:20px;font-family:ui-monospace,Menlo,Consolas,monospace;font-size:var(--text-xs);color:var(--fg);padding:1px 5px;display:inline-block}.helprow code{background:var(--bg-darkest);border-radius:var(--radius-sm);padding:0 4px;font-size:11.5px}.rightbarbackdrop{z-index:4;background:#0004;display:none;position:fixed;inset:0}.rightbarhead{justify-content:space-between;align-items:center;gap:var(--space-4);background:var(--bg-dark);border-bottom:1px solid var(--line);margin:-14px -14px 0;padding:10px 14px;display:none}.rightbarhead .muted{font-size:var(--text-xs);text-transform:uppercase;letter-spacing:.04em}.rightbar{background:var(--bg-dark);border-left:1px solid var(--line);font-size:var(--text-sm);scrollbar-gutter:stable;flex-direction:column;min-height:0;padding:14px;display:flex;overflow-y:auto}.rightbar>*{flex-shrink:0}.rightbar h3{font-size:var(--text-xs);text-transform:uppercase;letter-spacing:.04em;color:var(--dim);margin:14px 0 6px}.rightbar h3:first-of-type{margin-top:0}.card{background:var(--bg-darkest);border-radius:var(--radius-lg);white-space:pre-wrap;word-break:break-word;max-height:200px;padding:10px;overflow-y:auto}.card.runcard{max-height:none;overflow-y:visible}.muted{color:var(--dim)}.prog .progrow{gap:var(--space-4);margin-bottom:4px;display:flex}.prog .progrow b{color:var(--dim);text-transform:uppercase;font-size:var(--text-xs);letter-spacing:.05em;flex-shrink:0;min-width:62px;padding-top:2px}.embed .progrow{gap:var(--space-4);margin-bottom:4px;display:flex}.embed .progrow b{color:var(--dim);text-transform:uppercase;font-size:var(--text-xs);letter-spacing:.05em;flex-shrink:0;min-width:62px;padding-top:2px}.embed .progrow span{min-width:0}.inline-md{display:inline}.inline-md>:first-child{margin-top:0}.inline-md>:last-child{margin-bottom:0}.prog .progrow.warn span{color:var(--err)}.msg-head .editbtn{color:var(--dim);cursor:pointer;font-size:var(--text-xs);opacity:0;background:0 0;border:none;padding:0 2px;transition:opacity .12s}.msg:hover .msg-head .editbtn,.msg.pending .msg-head .editbtn{opacity:1}.msg-head .editbtn:focus-visible{opacity:1;outline:2px solid var(--acc);outline-offset:1px}.msg-head .editbtn:hover{color:var(--acc)}.branch-row{color:var(--dim);font-size:var(--text-xs);cursor:pointer;justify-content:space-between;padding:3px 0;display:flex}.branch-row:hover,.branch-row.cur{color:var(--fg)}.mini-cron{font-size:var(--text-xs);opacity:.75;margin-left:auto}.sched-row{border-radius:var(--radius-md);cursor:pointer;margin-bottom:2px;padding:6px 8px}.sched-row:hover,.sched-row.cur{background:var(--bg-mid)}.sched-top{gap:var(--space-3);font-size:var(--text-sm);align-items:baseline;display:flex}.sched-row .sched-meta{color:var(--dim);font-size:var(--text-xs);margin-top:2px}.sched-row .sched-prompt{color:var(--dim);font-size:var(--text-xs);text-overflow:ellipsis;white-space:nowrap;margin-top:2px;overflow:hidden}.badge.cron{color:var(--tool);white-space:nowrap;background:#3ba0c91a;border:1px solid #3ba0c944}.sesscard{gap:var(--space-3);font-size:var(--text-sm);flex-direction:column;display:flex}.sessrow{align-items:center;gap:var(--space-4);display:flex}.filebox{background:var(--bg-darkest);border-radius:var(--radius-lg);height:260px;padding:4px;overflow-y:auto}.filerow{align-items:center;gap:var(--space-3);cursor:pointer;font-size:var(--text-sm);color:var(--fg);border-radius:var(--radius-sm);padding:3px 8px;display:flex}.filerow:hover{background:var(--bg-mid)}.filerow .ficon{width:10px;color:var(--dim);font-size:var(--text-xs);text-align:center;flex-shrink:0}.filerow.isdir .fname{font-weight:600}.fname{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.fsize{color:var(--dim);font-size:var(--text-xs);flex-shrink:0;margin-left:auto}.sessrow .k{color:var(--dim);text-transform:uppercase;width:74px;font-size:var(--text-xs);letter-spacing:.05em;flex-shrink:0}.ellip{text-overflow:ellipsis;white-space:nowrap;text-align:left;direction:rtl;overflow:hidden}.modelbox{gap:var(--space-3);background:var(--bg-darkest);border-radius:var(--radius-lg);flex-direction:column;padding:10px;display:flex}.modelbox select,.modelbox input[type=text]{background:var(--bg-mid);border-radius:var(--radius-md);color:var(--fg);font:inherit;border:none;outline:none;min-width:0;padding:6px 8px}.modelbox button{background:var(--acc);border-radius:var(--radius-md);color:#fff;cursor:pointer;font-weight:600;font-size:var(--text-sm);white-space:nowrap;box-sizing:border-box;justify-content:center;align-items:center;gap:var(--space-2);border:none;min-width:7.5em;height:28px;padding:6px 10px;line-height:1;display:inline-flex}.modelbox button:hover{opacity:.9}.modelbox .meta{color:var(--dim);font-size:var(--text-xs)}.btnrow{gap:var(--space-3);margin:8px 0;display:flex}.btnrow button{background:var(--bg-light);color:var(--fg);border-radius:var(--radius-md);cursor:pointer;font-size:var(--text-sm);border:none;padding:6px 10px}.btnrow button:hover{filter:brightness(1.2)}.btnrow .runbtn{background:var(--ok);color:#fff;font-weight:600}.btnrow .runbtn,.btnrow .danger{min-width:74px}.btnrow .danger{background:var(--err);color:#fff;font-weight:600}.ctrlrow{align-items:center;gap:var(--space-4);font-size:var(--text-sm);margin-top:6px;display:flex}.ctrlrow label{align-items:center;gap:var(--space-3);cursor:pointer;color:var(--fg);white-space:nowrap;display:flex}.ctrlrow .muted{font-size:var(--text-xs)}.goalstate{background:var(--bg-light);color:var(--fg);border-radius:var(--radius-md);cursor:pointer;font-size:var(--text-xs);border:none;padding:3px 10px}.goalstate.on.active{background:var(--ok);color:#fff;font-weight:600}.goalstate.on.done{background:var(--acc);color:#fff;font-weight:600}.goalstate.on.paused{background:var(--warn);color:#fff;font-weight:600}.goalstate:disabled{cursor:default;filter:none}.verifycard{border-left:3px solid var(--tool);margin-top:6px}.auditcard{border-left:3px solid var(--warn);margin-top:6px}.auditcard.ok{border-left-color:var(--ok)}.vtitle{font-weight:600;font-size:var(--text-xs);color:var(--dim);text-transform:uppercase;letter-spacing:.04em;align-items:center;gap:var(--space-3);margin-bottom:4px;display:flex}.iconbtn{background:var(--bg-light);color:var(--fg);border-radius:var(--radius-md);cursor:pointer;width:26px;height:24px;font-size:var(--text-sm);transition:background-color var(--dur-fast) ease, filter var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);border:none;flex:none;justify-content:center;align-self:flex-end;align-items:center;padding:0;display:inline-flex}.iconbtn-glyph{justify-content:center;align-items:center;width:100%;height:100%;line-height:1;display:inline-flex}.iconbtn:hover{filter:brightness(1.3)}.iconbtn.active{background:var(--acc);color:#fff}.overlay{z-index:10;background:#0009;place-items:center;display:grid;position:fixed;inset:0}.modal{background:var(--bg-mid);border-radius:var(--radius-lg);width:min(760px,94vw);max-height:88vh;padding:16px 18px;overflow-y:auto}.modal:has(.cfgbody){flex-direction:column;height:min(660px,88vh);display:flex;overflow:hidden}.modal:has(.cfgbody)>form{flex-direction:column;flex:1;min-height:0;display:flex}.cfgbody{flex:1;gap:0;min-height:0;display:flex}.modal:has(.cfgbody){flex-direction:column;display:flex}.cfgmenu{gap:var(--space-1);border-right:1px solid var(--bg-light);border-bottom:none;flex-direction:column;flex:0 0 148px;padding:2px 10px 2px 0;display:flex;overflow-y:auto}.cfgmenu-item{text-align:left;border-radius:var(--radius-md);width:100%;color:var(--dim);font:inherit;font-size:var(--text-sm);cursor:pointer;white-space:nowrap;background:0 0;border:1px solid #0000;padding:7px 9px;display:block}.cfgmenu-item:hover{color:var(--fg);background:var(--bg-darkest)}.cfgmenu-item.on{color:var(--fg);background:var(--bg-darkest);border-color:var(--acc);box-shadow:inset 2px 0 0 var(--acc);font-weight:600}.cfgmenu-label{pointer-events:none}.cfgpanel{flex:1;min-width:0;padding:2px 0 2px 14px;overflow-y:auto}.cfgpanel fieldset.hide,.cfgpanel legend{display:none}.cfgpanel fieldset{border:none;margin:0;padding:0}.cfgfoot{gap:var(--space-5);border-top:1px solid var(--bg-light);flex:none;justify-content:flex-end;align-items:center;padding-top:10px;display:flex}.cfgsave{background:var(--acc);border-radius:var(--radius-md);color:#fff;cursor:pointer;font:inherit;border:none;padding:7px 16px;font-weight:600}.cfgsave:hover{filter:brightness(1.12)}.cfgtoggle{align-items:center;gap:var(--space-3);font-size:var(--text-sm);color:var(--fg);cursor:pointer;flex-flow:wrap;margin-top:8px;display:flex}.mcpcard{border:1px solid var(--bg-light);border-radius:var(--radius-lg);margin-bottom:8px;padding:8px}.mcpcard .cfgrow{margin-bottom:5px}.mcpcard .cfgrow:last-child{margin-bottom:0}.mcpresult{font-size:var(--text-xs);overflow-wrap:anywhere;margin-top:3px}.mcpstate{font-size:var(--text-xs);white-space:nowrap;color:var(--dim)}.mcpstate.connected{color:var(--ok)}.mcpstate.error{color:var(--err)}.mcpstate.disabled{color:var(--dim)}.cfgrow.archrow{align-items:center;gap:var(--space-4);flex-wrap:nowrap}.archmain{gap:var(--space-1);flex-direction:column;flex:1;min-width:0;display:flex}.archmain b{font-size:var(--text-sm)}.archmain .muted{font-size:var(--text-xs)}.archmain .mono{font-size:var(--text-xs);max-width:100%}.archrow button{white-space:nowrap;flex:none}.archrow .archrestore{background:var(--acc);border-color:var(--acc);color:#fff;font-weight:600}.archrow .archrestore:hover{filter:brightness(1.12)}@media (width<=620px){.cfgrow.archrow{flex-wrap:wrap}.archrow button{flex:auto}.cfgbody{flex-direction:column}.cfgmenu{border-right:none;border-bottom:1px solid var(--bg-light);flex-flow:row;flex:none;padding:0 0 6px;overflow-x:auto}.cfgmenu-item{width:auto}.cfgpanel{padding:10px 0 0}}.modal-head{margin-bottom:var(--space-5);font-size:var(--text-lg);letter-spacing:var(--tracking-tight);justify-content:space-between;align-items:center;display:flex}.modal label{gap:var(--space-2);color:var(--dim);font-size:var(--text-sm);flex-direction:column;display:flex}.modal input[type=text],.modal input[type=number],.modal input[type=password],.modal input[type=url],.modal input[type=email],.modal select,.modal textarea{background:var(--bg-darkest);border-radius:var(--radius-md);color:var(--fg);font:inherit;border:1px solid #0000;outline:none;min-width:0;padding:7px 9px}.modal input:focus,.modal select:focus,.modal textarea:focus{border-color:var(--acc)}.modal ::placeholder{color:#7c818f;opacity:1}.modal select option{background:var(--bg-darkest);color:var(--fg)}.modal input.compact{font-size:var(--text-sm);padding:5px 8px}.modal textarea{resize:vertical}.w100{width:100%}.mono{font-family:ui-monospace,Menlo,monospace;font-size:var(--text-sm)}.modal fieldset{border:1px solid var(--bg-light);border-radius:var(--radius-lg);margin:0 0 4px;padding:10px}.modal fieldset legend{color:var(--dim);font-size:var(--text-xs);text-transform:uppercase;letter-spacing:.05em;padding:0 6px}.cfgrow{gap:var(--space-3);flex-wrap:wrap;align-items:center;margin-bottom:6px;display:flex}.cfgrow input{background:var(--bg-darkest);border:1px solid var(--bg-light);border-radius:var(--radius-md);color:var(--fg);font-size:var(--text-sm);flex:1;min-width:0;padding:5px 8px}.cfgrow select{background:var(--bg-darkest);border:1px solid var(--bg-light);border-radius:var(--radius-md);color:var(--fg);font-size:var(--text-sm);padding:5px 8px}.cfgrow .cfgname{width:90px;color:var(--warn);flex:none;font-weight:600}.cfgrow .cfgkeys{gap:var(--space-2);flex-direction:column;flex-basis:100%;padding-left:96px;display:flex}.cfgrow .cfgkeyrow{gap:var(--space-2);align-items:center;display:flex}.cfgrow .cfgkeyrow input{flex:1}.cfgrow .cfgkeyrow button,.cfgrow .cfgkeys>button{flex:none}.cfgrow .cfgkeys>button{align-self:flex-start}.cfgrow button{background:var(--bg-mid);border:1px solid var(--bg-light);color:var(--fg);border-radius:var(--radius-md);cursor:pointer;font-size:var(--text-xs);padding:4px 8px}.cfgrow button:hover{background:var(--bg-light)}.cfgrow button.danger{background:var(--err);border-color:var(--err);color:#fff}.cfggrid{gap:var(--space-4);grid-template-columns:repeat(auto-fit,minmax(150px,1fr));display:grid}.cfggrid label,.cfgcol label{gap:var(--space-2);color:var(--dim);font-size:var(--text-xs);flex-direction:column;display:flex}.cfggrid input{background:var(--bg-darkest);border:1px solid var(--bg-light);border-radius:var(--radius-md);color:var(--fg);width:100%;padding:5px 8px}.cfgcol{margin-bottom:8px}.cfgcol textarea{background:var(--bg-darkest);border:1px solid var(--bg-light);border-radius:var(--radius-md);color:var(--fg);font:inherit;font-size:var(--text-sm);width:100%;margin-top:4px;padding:5px 8px}.presetbtn{background:var(--bg-light);color:var(--fg);border-radius:var(--radius-md);cursor:pointer;font-size:var(--text-sm);border:1px solid #0000;flex:1;padding:7px 10px}.presetbtn.active{background:var(--acc);color:#fff}.wizmodels{gap:var(--space-1);border:1px solid var(--bg-light);border-radius:var(--radius-md);background:var(--bg-darkest);flex-direction:column;max-height:190px;padding:4px;display:flex;overflow-y:auto}.wizmodel{align-items:baseline;gap:var(--space-4);text-align:left;border-radius:var(--radius-sm);width:100%;color:var(--fg);cursor:pointer;font-size:var(--text-sm);background:0 0;border:1px solid #0000;padding:4px 7px;display:flex}.wizmodel:hover{background:var(--bg-light)}.wizmodel.active{border-color:var(--acc)}.wizmodel .muted{font-size:var(--text-xs);white-space:nowrap;margin-left:auto}.forkchip{align-items:center;gap:var(--space-2);white-space:nowrap;color:var(--dim);font-size:var(--text-xs);cursor:pointer;display:flex}.dirlist{background:var(--bg-darkest);border-radius:var(--radius-md);height:220px;padding:4px;overflow-y:auto}.direntry{border-radius:var(--radius-sm);cursor:pointer;font-size:var(--text-md);padding:4px 8px}.direntry:hover{background:var(--bg-light)}.filepreview{border-radius:var(--radius-lg);max-height:62vh;overflow:auto}.filetoolbar{gap:var(--space-3);margin-bottom:8px;display:flex}.filetoolbar button{background:var(--bg-light);color:var(--dim);border-radius:var(--radius-md);cursor:pointer;font-size:var(--text-sm);border:none;padding:4px 12px}.filetoolbar button:hover{color:var(--fg);filter:brightness(1.15)}.filetoolbar button.on{background:var(--acc);color:#fff;font-weight:600}.fileeditor{gap:var(--space-4);flex-direction:column;display:flex}.fileeditor textarea{background:var(--bg-darkest);min-height:55vh;max-height:65vh;color:var(--fg);border:1px solid var(--bg-light);border-radius:var(--radius-lg);font-size:var(--text-sm);white-space:pre;padding:10px;line-height:1.45;overflow:auto}.filerow-actions{justify-content:flex-end;align-items:center;gap:var(--space-5);display:flex}.savebtn{background:var(--ok);color:#fff;border-radius:var(--radius-md);cursor:pointer;font-weight:600;font-size:var(--text-sm);border:none;padding:5px 14px}.savebtn:disabled{opacity:.4;cursor:default}.mdpreview{background:var(--bg-darkest);border-radius:var(--radius-lg);max-height:62vh;padding:14px 16px;overflow:auto}.filepreview .shiki,.filepreview .shiki span{color:var(--shiki-light);font-family:ui-monospace,Menlo,monospace;font-size:var(--text-sm)}html[data-appearance=dark] .filepreview .shiki,html[data-appearance=dark] .filepreview .shiki span{color:var(--shiki-dark)}.filepreview .shiki{background-color:var(--shiki-dark-bg);font-size:var(--text-sm);white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;margin:0;padding:10px 12px}html[data-appearance=light] .filepreview .shiki{background-color:var(--shiki-light-bg)}.notifbtn{position:relative}.notifbtn.has-unread{color:var(--acc)}.notifdot{background:var(--err);color:#fff;border-radius:var(--radius-pill);font-size:var(--text-xs);padding:2px 4px;font-style:normal;font-weight:700;line-height:1;position:absolute;top:-4px;right:-4px}.brand-row{align-items:center;margin-top:2px;display:flex}.notifbackdrop{z-index:7;position:fixed;inset:0}.notifpanel{z-index:8;background:var(--bg-mid);border:1px solid var(--bg-light);border-radius:var(--radius-lg);width:min(360px,88vw);position:absolute;bottom:8px;left:8px;overflow:hidden;box-shadow:0 8px 30px #000a}.notifhead{border-bottom:1px solid var(--line);font-size:var(--text-xs);text-transform:uppercase;letter-spacing:.04em;color:var(--dim);justify-content:space-between;align-items:center;padding:8px 12px;display:flex}.notiflist{max-height:46vh;overflow-y:auto}.notifitem{border-bottom:1px solid var(--line);cursor:pointer;padding:8px 12px}.notifitem:last-child{border-bottom:none}.notifitem:hover{background:var(--bg-light)}.notifitem .nhead{align-items:baseline;gap:var(--space-3);min-width:0;display:flex}.notifitem .ntitle{font-weight:600;font-size:var(--text-sm);text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.notifitem.error .ntitle{color:var(--err)}.notifitem.finish .ntitle{color:var(--ok)}.notifitem.question .ntitle{color:var(--acc)}.notifitem .nbody{font-size:var(--text-xs);color:var(--dim);word-break:break-word;margin-top:3px}.subcount{font-size:var(--text-xs);color:var(--dim);background:var(--bg-light);border-radius:var(--radius-pill);white-space:nowrap;flex-shrink:0;padding:1px 7px}.subcount.live{color:var(--ok)}.mediapreview{gap:var(--space-4);flex-direction:column;align-items:center;display:flex}.mediapreview img{border-radius:var(--radius-lg);background:var(--bg-darkest);max-width:100%;max-height:65vh}.mediapreview video{border-radius:var(--radius-lg);background:#000;max-width:100%;max-height:65vh}.mediapreview audio{width:100%}.composer{flex-direction:column;display:flex}.composer .hint{flex-shrink:0}.composer.maximized{z-index:5;background:var(--bg-dark);padding:16px 16px 18px;position:absolute;inset:0}.composer.maximized:before{content:"";background:var(--bg-dark);z-index:-1;position:absolute;inset:0}.composer.maximized form{flex:1;align-items:stretch;min-height:0}.composer.maximized textarea{resize:none;flex:1;max-height:none;height:auto!important}.composer.maximized .maxbtn,.composer.maximized form>button[type=submit]{align-self:flex-end}.maxbtn{font-size:var(--text-xs);justify-content:center;align-items:center;line-height:1;display:inline-flex;padding:0!important}.filerow.gitignored .fname,.filerow.gitignored .ficon,.filerow.gitignored .fsize{opacity:.38}.embed.compaction{border-left-color:var(--tool)}.embed.compaction summary .meta{color:var(--tool)}.avatar.ghosted{opacity:.35;transition:opacity .15s}.msg:hover .avatar.ghosted{opacity:1}.grouptime{display:none}.notifitem{opacity:1}.notifitem.read{opacity:.55}.notifitem.read .ntitle{font-weight:400}.nreadbtn{font-size:var(--text-xs);flex-shrink:0;width:auto;padding:0 6px}.flash-target{outline:2px solid var(--acc);border-radius:var(--radius-lg);transition:outline-color .6s}.msg.flash-target{background:color-mix(in srgb, var(--acc) 12%, transparent)}.agent-item .ghost{opacity:.55}.ghosttag{font-size:var(--text-xs);flex-shrink:0}.filetoggle{text-align:center;flex-shrink:0;width:26px;padding:0}h3 .filetoggle{margin-left:0}.notifbadge{font-size:var(--text-xs);color:var(--acc);background:var(--bg-light);border-radius:var(--radius-pill);white-space:nowrap;flex-shrink:0;margin-left:auto;padding:1px 6px}.agent-item.sel .notifbadge{background:var(--bg-darkest)}input[type=checkbox]{background-color:var(--bg-darkest);border:1px solid var(--dim);border-radius:var(--radius-sm)}input[type=number]{appearance:textfield}input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}.modal>button,.modal button:not(.iconbtn):not([class]){background:var(--bg-light);color:var(--fg);border:1px solid var(--dim);border-radius:var(--radius-md);font:inherit;cursor:pointer;padding:6px 10px}.modal>button:hover,.modal button:not(.iconbtn):not([class]):hover{background:var(--bg-mid);border-color:var(--acc)}.modal>button:focus-visible,.modal button:not(.iconbtn):not([class]):focus-visible{outline:2px solid var(--acc);outline-offset:1px}.todopane,.todopane-edit{box-sizing:border-box;border-radius:var(--radius-md);background:var(--bg-darkest);width:100%;height:11.5em;min-height:7em;max-height:40vh;color:var(--fg);font-size:var(--text-sm);resize:vertical;border:none;padding:6px 8px;line-height:1.45;display:block;overflow-y:auto}.todopane-edit{font-family:ui-monospace,Menlo,monospace}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}