claudish 14.27.3 → 14.28.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.
Files changed (2) hide show
  1. package/dist/index.js +1773 -847
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -5542,7 +5542,7 @@ var init_env_placeholder = __esm(() => {
5542
5542
  });
5543
5543
 
5544
5544
  // src/version.ts
5545
- var VERSION = "14.27.3";
5545
+ var VERSION = "14.28.1";
5546
5546
 
5547
5547
  // src/redact.ts
5548
5548
  function isPlaceholder(value) {
@@ -14145,7 +14145,7 @@ var init_bundled_recommended_list = __esm(() => {
14145
14145
  }
14146
14146
  }
14147
14147
  },
14148
- fetchedAt: "2026-11-16T21:57:46.609Z",
14148
+ fetchedAt: "2026-11-17T00:17:14.520Z",
14149
14149
  format: 1,
14150
14150
  recommendations: {
14151
14151
  contractVersion: 3,
@@ -49806,6 +49806,1236 @@ function decideCodexSpeed(speed, modelInfo) {
49806
49806
  }
49807
49807
  var CODEX_SERVICE_TIER_POINTER = "/service_tier";
49808
49808
 
49809
+ // src/handlers/shared/format/identity-filter.ts
49810
+ function removeBackgroundInfo(text) {
49811
+ let start = text.indexOf(BACKGROUND_OPEN);
49812
+ if (start === -1)
49813
+ return text;
49814
+ let out = "";
49815
+ let done = 0;
49816
+ while (start !== -1) {
49817
+ const end = text.indexOf(BACKGROUND_CLOSE, start + BACKGROUND_OPEN.length);
49818
+ if (end === -1)
49819
+ break;
49820
+ out += text.slice(done, start);
49821
+ done = end + BACKGROUND_CLOSE.length;
49822
+ start = text.indexOf(BACKGROUND_OPEN, done);
49823
+ }
49824
+ return out + text.slice(done);
49825
+ }
49826
+ function rangesOf(text, spans) {
49827
+ return [...text.matchAll(spans)].map((m) => [m.index, m.index + m[0].length]);
49828
+ }
49829
+ function merged(ranges) {
49830
+ if (ranges.length < 2)
49831
+ return ranges;
49832
+ const sorted = [...ranges].sort((a, b) => a[0] - b[0]);
49833
+ const out = [sorted[0]];
49834
+ for (const [from, to] of sorted.slice(1)) {
49835
+ const last = out[out.length - 1];
49836
+ if (from <= last[1])
49837
+ last[1] = Math.max(last[1], to);
49838
+ else
49839
+ out.push([from, to]);
49840
+ }
49841
+ return out;
49842
+ }
49843
+ function inside(ranges, at) {
49844
+ let low = 0;
49845
+ let high = ranges.length - 1;
49846
+ while (low <= high) {
49847
+ const mid = low + high >> 1;
49848
+ if (at < ranges[mid][0])
49849
+ high = mid - 1;
49850
+ else if (at >= ranges[mid][1])
49851
+ low = mid + 1;
49852
+ else
49853
+ return true;
49854
+ }
49855
+ return false;
49856
+ }
49857
+ function inlineCodeRanges(text, fences) {
49858
+ if (!text.includes("`"))
49859
+ return [];
49860
+ const out = [];
49861
+ let runs = [];
49862
+ const closeLine = () => {
49863
+ if (runs.length > 1) {
49864
+ const next = new Array(runs.length).fill(-1);
49865
+ const seen = new Map;
49866
+ for (let k = runs.length - 1;k >= 0; k--) {
49867
+ next[k] = seen.get(runs[k][1]) ?? -1;
49868
+ seen.set(runs[k][1], k);
49869
+ }
49870
+ for (let k = 0;k < runs.length; ) {
49871
+ const close = next[k];
49872
+ if (close === -1) {
49873
+ k++;
49874
+ } else {
49875
+ out.push([runs[k][0], runs[close][0] + runs[close][1]]);
49876
+ k = close + 1;
49877
+ }
49878
+ }
49879
+ }
49880
+ runs = [];
49881
+ };
49882
+ for (let at = 0;at < text.length; at++) {
49883
+ const char = text.charCodeAt(at);
49884
+ if (char === 10) {
49885
+ closeLine();
49886
+ } else if (char === 96) {
49887
+ let end = at + 1;
49888
+ while (end < text.length && text.charCodeAt(end) === 96)
49889
+ end++;
49890
+ if (!inside(fences, at))
49891
+ runs.push([at, end - at]);
49892
+ at = end - 1;
49893
+ }
49894
+ }
49895
+ closeLine();
49896
+ return out;
49897
+ }
49898
+ function stringRanges(text) {
49899
+ if (!text.includes('"'))
49900
+ return [];
49901
+ const out = [];
49902
+ let open = -1;
49903
+ for (let at = 0;at < text.length; at++) {
49904
+ const char = text.charCodeAt(at);
49905
+ if (char === 10) {
49906
+ open = -1;
49907
+ } else if (open === -1) {
49908
+ if (char === 34)
49909
+ open = at;
49910
+ } else if (char === 92) {
49911
+ if (text.charCodeAt(at + 1) !== 10)
49912
+ at++;
49913
+ } else if (char === 34) {
49914
+ out.push([open, at + 1]);
49915
+ open = -1;
49916
+ }
49917
+ }
49918
+ return out;
49919
+ }
49920
+ function codeRanges(text) {
49921
+ const fences = merged(rangesOf(text, FENCE_RE));
49922
+ return merged([...fences, ...inlineCodeRanges(text, fences)]);
49923
+ }
49924
+ function literalRanges(text) {
49925
+ return merged([...codeRanges(text), ...stringRanges(text)]);
49926
+ }
49927
+ function replaceOutside(text, ranges, rule, replacer) {
49928
+ return text.replace(rule, (match, ...rest) => {
49929
+ const offsetAt = rest.findIndex((arg) => typeof arg === "number");
49930
+ const offset = rest[offsetAt];
49931
+ if (inside(ranges, offset))
49932
+ return match;
49933
+ return replacer(match, offset, rest.slice(0, offsetAt));
49934
+ });
49935
+ }
49936
+ function renameReader(text) {
49937
+ if (!text.includes("Claude"))
49938
+ return text;
49939
+ return replaceOutside(text, literalRanges(text), READER_CLAUDE, (match, offset) => {
49940
+ const name = SENTENCE_START.test(text.slice(Math.max(0, offset - 16), offset)) ? READER_NAME[0].toUpperCase() + READER_NAME.slice(1) : READER_NAME;
49941
+ return name + match.slice("Claude".length);
49942
+ });
49943
+ }
49944
+ function scrubText(text) {
49945
+ let out = text;
49946
+ for (const rule of SENTENCE_RULES)
49947
+ out = out.replace(rule, "");
49948
+ out = removeBackgroundInfo(out);
49949
+ for (const rule of LINE_RULES)
49950
+ out = out.replace(rule, "");
49951
+ for (const [rule, to] of RENAMES)
49952
+ out = replaceOutside(out, literalRanges(out), rule, to);
49953
+ return renameReader(out);
49954
+ }
49955
+ function stripKnownHead(text) {
49956
+ for (const head of KNOWN_HEADS) {
49957
+ if (text.startsWith(head))
49958
+ return { body: text.slice(head.length).trimStart(), hadHead: true };
49959
+ }
49960
+ return { body: text, hadHead: false };
49961
+ }
49962
+ function filterIdentity(content, head) {
49963
+ const hadIdentity = IDENTITY_OPENER.test(content);
49964
+ const scrubbed = scrubText(content).replace(/\n{3,}/g, `
49965
+
49966
+ `).trimStart();
49967
+ const { body, hadHead } = stripKnownHead(scrubbed);
49968
+ if (!hadIdentity && !hadHead)
49969
+ return scrubbed;
49970
+ if (head === undefined && hadHead)
49971
+ return scrubbed;
49972
+ const chosen = head ?? NEUTRAL_IDENTITY_HEAD;
49973
+ return body ? `${chosen}
49974
+
49975
+ ${body}` : chosen;
49976
+ }
49977
+ function indexOutsideCode(text, needle, from, code) {
49978
+ for (let at = text.indexOf(needle, from);at !== -1; at = text.indexOf(needle, at + 1)) {
49979
+ if (!inside(code, at))
49980
+ return at;
49981
+ }
49982
+ return -1;
49983
+ }
49984
+ function closingTagAt(text, start, open, close, inlineCode) {
49985
+ let depth = 0;
49986
+ let at = start;
49987
+ for (;; ) {
49988
+ const nextClose = indexOutsideCode(text, close, at, inlineCode);
49989
+ if (nextClose === -1)
49990
+ return -1;
49991
+ const nextOpen = indexOutsideCode(text, open, at, inlineCode);
49992
+ if (nextOpen !== -1 && nextOpen < nextClose) {
49993
+ depth++;
49994
+ at = nextOpen + open.length;
49995
+ continue;
49996
+ }
49997
+ depth--;
49998
+ if (depth === 0)
49999
+ return nextClose;
50000
+ at = nextClose + close.length;
50001
+ }
50002
+ }
50003
+ function scrubTagged(text, tag) {
50004
+ const open = `<${tag}>`;
50005
+ const close = `</${tag}>`;
50006
+ if (!text.includes(open))
50007
+ return text;
50008
+ const code = codeRanges(text);
50009
+ const inlineCode = merged(inlineCodeRanges(text, []));
50010
+ let out = "";
50011
+ let done = 0;
50012
+ for (;; ) {
50013
+ const start = indexOutsideCode(text, open, done, code);
50014
+ if (start === -1)
50015
+ break;
50016
+ const end = closingTagAt(text, start, open, close, inlineCode);
50017
+ if (end === -1)
50018
+ break;
50019
+ const stop = end + close.length;
50020
+ out += text.slice(done, start) + scrubText(text.slice(start, stop));
50021
+ done = stop;
50022
+ }
50023
+ return out + text.slice(done);
50024
+ }
50025
+ function scrubInjectedSpans(text) {
50026
+ if (!MAY_HOLD_SPAN.test(text))
50027
+ return text;
50028
+ let out = text;
50029
+ for (const tag of INJECTED_TAGS)
50030
+ out = scrubTagged(out, tag);
50031
+ for (const line of INJECTED_LINES)
50032
+ out = replaceOutside(out, codeRanges(out), line, scrubText);
50033
+ return out;
50034
+ }
50035
+ function systemTextOf2(system) {
50036
+ if (typeof system === "string")
50037
+ return system;
50038
+ if (!Array.isArray(system))
50039
+ return "";
50040
+ return system.map((item) => typeof item === "string" ? item : item?.text ?? "").filter((text) => text.trim() !== "").join(`
50041
+
50042
+ `);
50043
+ }
50044
+ function scrubSchema(schema) {
50045
+ if (Array.isArray(schema))
50046
+ return schema.map(scrubSchema);
50047
+ if (!schema || typeof schema !== "object")
50048
+ return schema;
50049
+ const out = {};
50050
+ for (const [key, value] of Object.entries(schema)) {
50051
+ if (key === "description" && typeof value === "string")
50052
+ out[key] = scrubText(value);
50053
+ else if (SCHEMA_VALUE_KEYS.has(key))
50054
+ out[key] = value;
50055
+ else if (SCHEMA_NAME_MAPS.has(key))
50056
+ out[key] = scrubNamedSchemas(value);
50057
+ else
50058
+ out[key] = scrubSchema(value);
50059
+ }
50060
+ return out;
50061
+ }
50062
+ function scrubNamedSchemas(map) {
50063
+ if (!map || typeof map !== "object" || Array.isArray(map))
50064
+ return map;
50065
+ const out = {};
50066
+ for (const [name, schema] of Object.entries(map))
50067
+ out[name] = scrubSchema(schema);
50068
+ return out;
50069
+ }
50070
+ function scrubToolDefinition(tool) {
50071
+ if (!tool || typeof tool !== "object")
50072
+ return tool;
50073
+ const out = { ...tool };
50074
+ if (typeof tool.description === "string")
50075
+ out.description = scrubText(tool.description);
50076
+ if (tool.input_schema)
50077
+ out.input_schema = scrubSchema(tool.input_schema);
50078
+ return out;
50079
+ }
50080
+ function scrubUserContent(content) {
50081
+ if (typeof content === "string")
50082
+ return scrubInjectedSpans(content);
50083
+ if (!Array.isArray(content))
50084
+ return content;
50085
+ return content.map((block) => block?.type === "text" && typeof block.text === "string" ? { ...block, text: scrubInjectedSpans(block.text) } : block);
50086
+ }
50087
+ function scrubSystemContent(content) {
50088
+ if (typeof content === "string")
50089
+ return scrubText(content);
50090
+ if (!Array.isArray(content))
50091
+ return content;
50092
+ return content.map((block) => {
50093
+ if (block?.type === "text" && typeof block.text === "string") {
50094
+ return { ...block, text: scrubText(block.text) };
50095
+ }
50096
+ if (block?.type === "tool_addition" && block.tool?.definition) {
50097
+ return {
50098
+ ...block,
50099
+ tool: { ...block.tool, definition: scrubToolDefinition(block.tool.definition) }
50100
+ };
50101
+ }
50102
+ return block;
50103
+ });
50104
+ }
50105
+ function scrubSystem(system, head, hadIdentity) {
50106
+ if (typeof system === "string") {
50107
+ const body = collapse(scrubText(system));
50108
+ if (!hadIdentity)
50109
+ return body;
50110
+ return body ? `${head}
50111
+
50112
+ ${body}` : head;
50113
+ }
50114
+ if (Array.isArray(system)) {
50115
+ const blocks = system.map((b) => typeof b === "string" ? { type: "text", text: b } : b).map((b) => b?.type === "text" && typeof b.text === "string" ? { ...b, text: collapse(scrubText(b.text)) } : b).filter((b) => !(b?.type === "text" && (b.text ?? "").trim() === ""));
50116
+ if (hadIdentity)
50117
+ blocks.unshift({ type: "text", text: head });
50118
+ return blocks;
50119
+ }
50120
+ return hadIdentity ? head : system;
50121
+ }
50122
+ function scrubHarnessIdentity(req, head) {
50123
+ const out = { ...req };
50124
+ const hadIdentity = IDENTITY_OPENER.test(systemTextOf2(req.system));
50125
+ out.system = scrubSystem(req.system, head, hadIdentity);
50126
+ if (Array.isArray(req.tools))
50127
+ out.tools = req.tools.map(scrubToolDefinition);
50128
+ if (Array.isArray(req.messages)) {
50129
+ out.messages = req.messages.map((msg) => {
50130
+ if (msg?.role === "user")
50131
+ return { ...msg, content: scrubUserContent(msg.content) };
50132
+ if (msg?.role === "system")
50133
+ return { ...msg, content: scrubSystemContent(msg.content) };
50134
+ return msg;
50135
+ });
50136
+ }
50137
+ return out;
50138
+ }
50139
+ function identityHeadFor(providerName) {
50140
+ return providerName === "antigravity" ? ANTIGRAVITY_IDENTITY_HEAD : NEUTRAL_IDENTITY_HEAD;
50141
+ }
50142
+ function keepsClaudeIdentity(route) {
50143
+ if (route.vendor)
50144
+ return route.vendor.toLowerCase() === "anthropic";
50145
+ if (route.native)
50146
+ return true;
50147
+ return /(^|[/.])claude-/i.test(route.model);
50148
+ }
50149
+ var NEUTRAL_IDENTITY_HEAD = "You are an AI coding agent working in a command-line agent harness. If asked who you are, name your actual model and the company that made it.", ANTIGRAVITY_IDENTITY_HEAD, KNOWN_HEADS, HARNESS_NAME = "Agent CLI", LINE_RULES, SENTENCE_RULES, BACKGROUND_OPEN = "<claude_background_info>", BACKGROUND_CLOSE = "</claude_background_info>", FENCE_OPEN, FENCE_CLOSE, FENCE, FENCE_RE, HARNESS_IN_PROSE, RENAMES, READER_NAME = "the assistant", READER_CLAUDE, SENTENCE_START, IDENTITY_OPENER, INJECTED_TAGS, INJECTED_LINES, MAY_HOLD_SPAN, SCHEMA_VALUE_KEYS, SCHEMA_NAME_MAPS, collapse = (text) => text.replace(/\n{3,}/g, `
50150
+
50151
+ `).trimStart();
50152
+ var init_identity_filter = __esm(() => {
50153
+ ANTIGRAVITY_IDENTITY_HEAD = [
50154
+ "You are Antigravity, a powerful agentic AI coding assistant designed by the Google Deepmind team working on Advanced Agentic Coding.",
50155
+ "You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question."
50156
+ ].join(`
50157
+ `);
50158
+ KNOWN_HEADS = [NEUTRAL_IDENTITY_HEAD, ANTIGRAVITY_IDENTITY_HEAD];
50159
+ LINE_RULES = [
50160
+ /^[ \t]*(?:-[ \t]+)?The most recent Claude models are[^\n]*(?:\n|$)/gm,
50161
+ /^[ \t]*(?:-[ \t]+)?Claude Code is available as a CLI[^\n]*(?:\n|$)/gm,
50162
+ /^[ \t]*(?:-[ \t]+)?Fast mode for Claude Code[^\n]*(?:\n|$)/gm
50163
+ ];
50164
+ SENTENCE_RULES = [
50165
+ /You are Claude Code, Anthropic's official CLI(?:[^\n]{0,300}?\.(?=\s|$|<)|[^.\n]{0,300})/g,
50166
+ /You are a Claude agent, built on Anthropic's Claude Agent SDK\.?/g,
50167
+ /You are powered by the model named [^\n]{0,300}?\.(?=\s|$|<)/g,
50168
+ /The exact model ID is [^\s<]{1,200}?\.(?=\s|$|<)/g,
50169
+ /Assistant knowledge cutoff is [^\n]{0,300}?\.(?=\s|$|<)/g
50170
+ ];
50171
+ FENCE_OPEN = String.raw`^(?:[ \t]*(?:>|[-*+][ \t]|\d+[.)][ \t]))*[ \t]*((\x60|~)\2{2,})[^\n]*`;
50172
+ FENCE_CLOSE = String.raw`^(?:[ \t]*>)*[ \t]*\1\2*[ \t]*$`;
50173
+ FENCE = String.raw`${FENCE_OPEN}(?:\n[\s\S]*?(?:${FENCE_CLOSE}|(?![\s\S]))|(?![\s\S]))`;
50174
+ FENCE_RE = new RegExp(FENCE, "gm");
50175
+ HARNESS_IN_PROSE = /(?<![\w/\\"'`.-])Claude Code(?![\w"`/\\]|'(?!s\b)|\.\w)/g;
50176
+ RENAMES = [
50177
+ [/ ?\(claude\.ai\/code\)/g, () => ""],
50178
+ [HARNESS_IN_PROSE, () => HARNESS_NAME],
50179
+ [/\bClaude (sessions?)\b/g, (_match, _offset, groups) => `${HARNESS_NAME} ${groups[0]}`]
50180
+ ];
50181
+ READER_CLAUDE = new RegExp([
50182
+ String.raw`(?<![\w/\\.@"'\x60-])`,
50183
+ String.raw`(?<!\b(?:a|an|the|other|another|internal|each|every|any|your|real)\s)`,
50184
+ String.raw`Claude(?:['\u2019]s)?`,
50185
+ String.raw`(?![\w/\\'\u2019"\x60-])`,
50186
+ String.raw`(?!\s*=)`,
50187
+ String.raw`(?!\.\w)`,
50188
+ String.raw`(?!\.\.\.)`,
50189
+ String.raw`(?!,\s+[A-Z])`,
50190
+ String.raw`(?!\s+(?:[A-Z\d]|in\s+(?:Chrome|Slack)\b|(?:models?|desktop|login|account|subscription|family|apps?|plans?)\b))`
50191
+ ].join(""), "g");
50192
+ SENTENCE_START = /(?:[.!?]["')\]*]*\s+|(?:^|\n)[ \t]*(?:(?:[-*\u2022]|\d+\.)[ \t]+)?(?:\*\*)?)$/;
50193
+ IDENTITY_OPENER = /You are Claude Code, Anthropic's official CLI|You are a Claude agent, built on Anthropic's Claude Agent SDK/;
50194
+ INJECTED_TAGS = ["system-reminder", "local-command-caveat"];
50195
+ INJECTED_LINES = [
50196
+ /^This is how Claude Code surfaces (?:messages the user sends mid-turn|a prompt a plugin submits between turns)[^\n]*$/gm,
50197
+ /^Another Claude session sent a message:[ \t]*$/gm,
50198
+ /^This came from another Claude session[^\n]*$/gm
50199
+ ];
50200
+ MAY_HOLD_SPAN = /<system-reminder>|<local-command-caveat>|Claude/;
50201
+ SCHEMA_VALUE_KEYS = new Set(["enum", "const", "default", "examples"]);
50202
+ SCHEMA_NAME_MAPS = new Set(["properties", "patternProperties", "$defs", "definitions"]);
50203
+ });
50204
+
50205
+ // src/providers/antigravity-agy-request.json
50206
+ var antigravity_agy_request_default;
50207
+ var init_antigravity_agy_request = __esm(() => {
50208
+ antigravity_agy_request_default = {
50209
+ system: `<identity>
50210
+ You are Antigravity, a powerful agentic AI assistant designed by the Google Deepmind team.
50211
+ You are working with a USER to solve their task.
50212
+ The USER will send you requests, which you must always prioritize addressing. User requests are enclosed within <USER_REQUEST> tags.
50213
+ </identity>
50214
+ <artifacts>
50215
+ Artifacts are special markdown (.md) documents that you can create to present structured information to the user.
50216
+ All artifacts should be written to the artifact directory: \`<appDataDir>/brain/<conversation-id>\`. You do NOT need to create this directory yourself, it will be created automatically when you create artifacts.
50217
+
50218
+ # When to Use Artifacts
50219
+
50220
+ **Use artifacts for:**
50221
+ - Extensive reports and analysis summaries
50222
+ - Persistent information you'll update over time (task lists, experiment logs)
50223
+
50224
+ **Don't use artifacts for:**
50225
+ - Simple one-off answers or very short paragraph content - just respond directly
50226
+ - Asking questions or requesting user input - just ask directly
50227
+
50228
+ **After creating or updating an artifact**, DO NOT re-summarize the artifact contents in your response to the user. Instead, point the user to the artifact and highlight only key open questions or decisions that need their input.
50229
+
50230
+
50231
+ # Artifact Formatting Tips
50232
+ When creating markdown artifacts, use standard markdown and GitHub Flavored Markdown formatting.
50233
+
50234
+ ## Alerts
50235
+ Use GitHub-style alerts strategically to emphasize critical information. Do not place consecutively or nest:
50236
+ > [!NOTE] Background context, implementation details, or explanations
50237
+ > [!TIP] Performance optimizations, best practices, or efficiency suggestions
50238
+ > [!IMPORTANT] Essential requirements, critical steps, or must-know information
50239
+ > [!WARNING] Breaking changes, compatibility issues, or potential problems
50240
+ > [!CAUTION] High-risk actions that could cause data loss or security vulnerabilities
50241
+
50242
+
50243
+ ## Mermaid Diagrams
50244
+ Create mermaid diagrams using fenced code blocks with language \`mermaid\` to visualize relationships, workflows, and architectures.
50245
+ - Only use supported diagram types:
50246
+ - Flowcharts / Graphs: \`flowchart TD\` / \`flowchart LR\` / \`graph TD\` / \`graph LR\`
50247
+ - Sequence Diagrams: \`sequenceDiagram\`
50248
+ - State Diagrams: \`stateDiagram-v2\` or \`stateDiagram\`
50249
+ - Class Diagrams: \`classDiagram\`
50250
+ - Entity-Relationship Diagrams: \`erDiagram\`
50251
+ - XY Charts: \`xychart-beta\`
50252
+ - All other diagram types are unsupported. For schedules, timelines, or roadmaps, use directed flowcharts (\`flowchart LR\` / \`flowchart TD\`) or Markdown tables instead.
50253
+ - To prevent syntax errors:
50254
+ - Quote node labels containing special characters like parentheses or brackets. For example, \`id["Label (Extra Info)"]\` instead of \`id[Label (Extra Info)]\`.
50255
+ - Avoid HTML tags in labels.
50256
+
50257
+ ## File Links
50258
+ - Link to line ranges using [link text](file:///absolute/path/to/file#L123-L145) format.
50259
+ - **IMPORTANT**: If you are embedding a file in an artifact and the file is NOT already in <appDataDir>/brain/<conversation-id>, you MUST first copy the file to the artifacts directory before embedding it. Only embed files that are located in the artifacts directory. Always use its absolute path \`![caption](/absolute/path)\`.
50260
+ - **Use basenames for readability**: Use file basenames for the link text instead of the full path
50261
+
50262
+ ## Carousels
50263
+ Use \`\`\`\`carousel syntax with \`<!-- slide -->\` HTML comments to display related markdown snippets sequentially (before/after comparisons, UI progressions, alternative approaches, walkthroughs). Four backticks enable nesting code blocks within slides.
50264
+
50265
+ Example:
50266
+ \`\`\`\`carousel
50267
+ ![Image description](/absolute/path/to/image1.png)
50268
+ <!-- slide -->
50269
+ \`\`\`python
50270
+ def example():
50271
+ print("Code in carousel")
50272
+ \`\`\`
50273
+ \`\`\`\`
50274
+
50275
+ # Scratch Scripts and Files
50276
+
50277
+ You may find it useful to create scratch scripts or files for temporary purposes.
50278
+
50279
+ Examples:
50280
+ - One-off scripts to process or analyze data
50281
+ - Temporary data files and intermediate outputs
50282
+
50283
+ Store these files in the \`<appDataDir>/brain/<conversation-id>/scratch/\` directory. They will be persisted.
50284
+
50285
+ </artifacts>
50286
+ <conversation_transcript>
50287
+ Transcripts are located directly at \`<appDataDir>/brain/<conversation-id>/.system_generated/logs/transcript.jsonl\` (and \`transcript_full.jsonl\`).
50288
+ - Start with \`transcript.jsonl\` (compact). When \`truncated_fields\` is present, read only the specific corresponding line in \`transcript_full.jsonl\`.
50289
+ - Search subagents by grepping \`invoke_subagent\` in \`transcript.jsonl\`.
50290
+ - Link conversations using \`[<label>](conversation://<conversation-id>)\`.
50291
+
50292
+ # File Format
50293
+ Transcripts are in JSON Lines (JSONL) format. Each line is a single JSON object representing one "step" or action in the conversation.
50294
+ Each JSON object contains fields such as:
50295
+ - \`step_index\`: The index of the step in the trajectory.
50296
+ - \`source\`: The source of the action (e.g., \`USER_EXPLICIT\`, \`MODEL\`, \`SYSTEM\`).
50297
+ - \`type\`: The type of the step. Particular steps of interest are \`USER_INPUT\`, which represents a user's prompt, and \`PLANNER_RESPONSE\`, which represents the agent's response and tool calls.
50298
+ - \`status\`: The status of the step (e.g., \`DONE\`, \`ERROR\`).
50299
+ - \`created_at\`: The ISO 8601 timestamp of when the step occurred.
50300
+ - \`content\`: The text content of the step (e.g., the user's request, the model's response, or tool responses).
50301
+ - \`thinking\`: The model's internal reasoning / chain-of-thought (for \`PLANNER_RESPONSE\` steps).
50302
+ - \`tool_calls\`: An array of tool calls made in this step, including their arguments.
50303
+ - \`media\`: An array of media (e.g. images) attached to the step, each with a \`mime_type\` and a \`uri\` referencing the media file on disk. Media bytes are not stored in the transcript; view the \`uri\` path to see the media.
50304
+ - \`truncated_fields\`: An array of field names that were truncated (e.g., \`["content"]\`, \`["thinking"]\`, \`["tool_calls"]\`). Only present in \`transcript.jsonl\` when truncation occurred (never in \`transcript_full.jsonl\`). When present, read the corresponding line in \`transcript_full.jsonl\` for the complete content.
50305
+
50306
+ </conversation_transcript>
50307
+ <guidelines>
50308
+ Follow these behavioral guidelines at all times:
50309
+ - Never defeat or bypass an access control, permission check, credential requirement, network/proxy restriction, or sandbox/environment boundary - including writing to the state or processes such a check reads, spoofing identity, intercepting the check, probing undocumented local/host services, or modifying host, harness, or test infrastructure outside your task scope. Use documented, sanctioned paths only; if none of them work, you are blocked - report the error and stop.
50310
+ - Never solve, click through, wait out, compute, or bypass a CAPTCHA, "verify you are human" or anti-bot challenge, or proof-of-work gate (e.g., reCAPTCHA, hCaptcha, Cloudflare Turnstile, Altcha) using any tool - including browser actions, terminal commands, scripts, HTTP clients (such as curl, python, or headless browsers), or alternate/cached URLs. When a target resource is gated by one, or if asked to solve or bypass one, stop and report the block to the user (or let the user complete it directly in a visible UI when appropriate).
50311
+
50312
+ </guidelines>
50313
+ <communication_style>
50314
+ - Keep your responses concise.
50315
+ - Format your responses in github-style markdown.
50316
+ - If you're unsure about the user's intent, ask for clarification rather than making assumptions.
50317
+ - You MUST create clickable links for all files you reference. Use github style markdown links with the file:// scheme (e.g., [notes.md](file:///path/to/notes.md), or [notes.md](file:///path/to/notes.md#L10-L20) to link to specific lines). For Windows, use forward slashes for paths.
50318
+ </communication_style>
50319
+ <slash_commands>
50320
+ Slash commands are user-facing shortcuts in the chat UI (e.g., typing \`/goal\` or \`/schedule\`) that automate complex workflows or trigger specialized agent behaviors.
50321
+
50322
+ You cannot execute these commands yourself. Your role is to recommend them to the user when they are a good fit for the task at hand, encouraging the user to explore and trigger them.
50323
+
50324
+ To recommend a slash command, suggest it clearly in your response (e.g., "You can use the \`/goal\` command to...").
50325
+
50326
+
50327
+ Available slash commands you can recommend to the user:
50328
+ - /goal: Recommend this when the user wants to run a long-running task (e.g., overnight) and wants the agent to be extra thorough and not stop until the goal is fully achieved.
50329
+ - /compact: Recommend this when the conversation is getting long and the user wants to compact or summarize the context to free up the context window.
50330
+ - /schedule: Recommend this when the user wants to run an instruction on a recurring schedule or set a one-time timer.
50331
+ - /browser: Recommend this when the user's task involves web browsing, searching the web, or interacting with web applications.
50332
+ - /plan: Recommend this when the task is complex and requires careful step-by-step planning before execution.
50333
+ - /grill-me: Recommend this when the user wants to align on a plan through an interactive interview to resolve design decisions.
50334
+ - /teamwork: Recommend this when the user has a large project that would benefit from a team of autonomous agents working together.
50335
+ - /learn: Recommend this when the user has corrected the agent or solved a complex setup and wants the agent to persist this behavior for future tasks.
50336
+ - /boost: Recommend this when the user has a complex coding or research project that requires deep thinking, strategic planning, multiple perspectives, and rigorous verification.
50337
+
50338
+
50339
+ </slash_commands>
50340
+ <messaging>
50341
+ You are connected to a messaging system where you may receive messages from: agents, background tasks, user-queued messages.
50342
+
50343
+ ## Receiving Messages
50344
+
50345
+ You receive messages automatically at the start of each invocation. All messages are delivered in full directly into your context \u2014 no manual retrieval is needed.
50346
+
50347
+ ## Reactive Wakeup (No Polling Needed)
50348
+
50349
+ The system automatically resumes your execution when:
50350
+ - A message arrives from a subagent or peer agent
50351
+ - A **background task** completes or sends you a notification
50352
+ - A **user-queued message** is ready to be dequeued
50353
+
50354
+ This means you do **NOT** need to poll in a loop while waiting for messages or updates. After launching anything that performs work asynchronously, you may continue other work or simply stop by calling no more tools. The system will notify you when there is something to process.
50355
+ </messaging>
50356
+ <mcp_servers>
50357
+ Each MCP server has a directory \`<appDataDir>/mcp/<serverName>\` containing tool schemas (\`<toolName>.json\`) and optionally an \`instructions.md\` file with best practices.
50358
+ Eagerly loaded tools are registered as native tools under the name \`mcp_<serverName>_<toolName>\`. Call eager tools directly.
50359
+ For lazily-loaded tools, read the corresponding schema file to understand the arguments and usage, then call the tool using the \`call_mcp_tool\` tool.
50360
+ The following MCP servers and their available tools are listed below, following this format:
50361
+ \`\`\`
50362
+ # <serverName>
50363
+ Eager:
50364
+ <toolName>
50365
+ Lazy:
50366
+ <toolName>
50367
+ \`\`\`
50368
+ </mcp_servers>
50369
+ <subagents>
50370
+ ## Invoking Subagents
50371
+
50372
+ Subagents can be invoked using the invoke_subagent tool. You can invoke an existing subagent by name, or define a new subagent for this conversation using the define_subagent tool, and then invoke it. Agents defined by the define_subagent tool are available for the duration of this conversation. After launching a subagent, you do NOT need to poll or check your inbox in a loop. The system will automatically notify you when the subagent sends a message. Simply proceed with other work or stop calling tools, and you will be notified when there is a message to process.
50373
+
50374
+ ## Communicating with Another Agent
50375
+
50376
+ Use the send_message tool to send a message to another agent by its conversation ID (returned by invoke_subagent). This tool is ONLY for communicating with other agents.
50377
+
50378
+ **Do NOT use send_message to communicate with the user.** Instead, output visible text to communicate with the user.
50379
+
50380
+ Available subagents:
50381
+ - self: Subagent that inherits the parent agent's full configuration including tools, system prompt, and model. Use this when you need to run a task in a separate conversation context but with the same capabilities as the current agent.
50382
+ - research: Research subagent with read-only tools for exploring the codebase, searching the web, and reading files. Delegate to this agent when you need to run a task in a separate conversation context, when a research task requires many search and file-reading steps that would clutter your context, or when you need a broad survey of the codebase or documentation. Prefer doing research yourself for quick, targeted lookups. This agent runs in a read-only sandbox with no network access.
50383
+
50384
+ After launching a subagent, you do NOT need to poll or check your inbox in a loop. The system will automatically notify you when the subagent sends a message. Simply proceed with other work or stop calling tools, and you will be notified when there is a message to process.
50385
+
50386
+ </subagents>
50387
+ <skills>
50388
+ You can use specialized 'skills' to help you with complex tasks. Each skill has a name and a description listed below.
50389
+
50390
+ Skills are folders of instructions, scripts, and resources that extend your capabilities for specialized tasks. Each skill folder contains:
50391
+ - **SKILL.md** (required): The main instruction file with YAML frontmatter (name, description) and detailed markdown instructions
50392
+
50393
+ More complex skills may include additional directories and files as needed, for example:
50394
+ - **scripts/** - Helper scripts and utilities that extend your capabilities
50395
+ - **examples/** - Reference implementations and usage patterns
50396
+ - **resources/** - Additional files, templates, or assets the skill may reference
50397
+ - **references/** - Contains additional documentation that agents can read when needed
50398
+
50399
+
50400
+ If a skill seems relevant to your current task, you MUST read its \`SKILL.md\` instructions before proceeding. You may skip this step only if you are delegating the skill-related task to a subagent that will read and follow the instructions itself.
50401
+
50402
+ When viewing these skill files, always use the exact path provided in the "Available skills" list below.
50403
+
50404
+ Available skills:
50405
+
50406
+
50407
+ </skills>
50408
+ <user_information>
50409
+ The USER's OS version is {{os}}.
50410
+ Active Workspaces:
50411
+ - {{workspace}}
50412
+ Command Working Directory: {{workspace}}
50413
+ Files relating to the user's requests should be written in the locations listed above. Avoid writing project files to tmp, in the .gemini dir, or directly to the Desktop and similar folders unless explicitly asked.
50414
+ App Data Directory: {{appDataDir}}
50415
+ Conversation ID: {{conversationId}}
50416
+ Artifact Directory Path: {{appDataDir}}/brain/{{conversationId}}
50417
+ </user_information>`,
50418
+ tools: [
50419
+ {
50420
+ name: "read_file",
50421
+ description: "Read the contents of a text, image, pdf, video, or audio file. Each read returns at most 800 lines or 46080 bytes.",
50422
+ parameters: {
50423
+ type: "OBJECT",
50424
+ properties: {
50425
+ ByteOffset: {
50426
+ type: "INTEGER",
50427
+ description: "Byte offset into the line range. Use to continue reading when content is truncated by the byte limit."
50428
+ },
50429
+ EndLine: {
50430
+ type: "INTEGER",
50431
+ description: "End line to read (inclusive). Omit to read until the end of the file, within the per-read limits."
50432
+ },
50433
+ Path: {
50434
+ type: "STRING",
50435
+ description: "The absolute path of the file to read."
50436
+ },
50437
+ StartLine: {
50438
+ type: "INTEGER",
50439
+ description: "Start line to read (inclusive). Omit to read from the beginning of the file."
50440
+ }
50441
+ },
50442
+ required: ["Path"]
50443
+ }
50444
+ },
50445
+ {
50446
+ name: "run_command",
50447
+ description: "Execute a command in the workspace. Operating System: {{os}}. Shell: {{shell}}. Each command runs in a new session (working directory changes and environment variables do not persist across calls). Commands that do not finish within the specified wait time continue running in the background as tasks; the system will notify you when they finish, so do not poll their status or set timers to check on them.",
50448
+ parameters: {
50449
+ type: "OBJECT",
50450
+ properties: {
50451
+ CommandLine: {
50452
+ type: "STRING",
50453
+ description: "The exact command line string to execute."
50454
+ },
50455
+ IsDaemon: {
50456
+ type: "BOOLEAN",
50457
+ description: "Set to true for long-running support processes that are meant to keep running in the background indefinitely and are not expected to finish on their own (e.g., dev servers, file watchers, tunnels). Leave false (the default) for normal commands that are expected to terminate."
50458
+ },
50459
+ WaitMsBeforeAsync: {
50460
+ type: "INTEGER",
50461
+ description: "Milliseconds to wait for the command to finish before backgrounding it (500 to 10000). Set to a larger value (e.g. 5000-10000) for commands expected to finish synchronously; set to 500 for commands intended to run in the background."
50462
+ },
50463
+ toolSummary: {
50464
+ type: "STRING",
50465
+ description: "Brief 2-5 word noun phrase describing the command task. Capitalize like a sentence. Some examples: 'Git status check', 'Unit test execution', 'Package build', 'Dev server startup'."
50466
+ }
50467
+ },
50468
+ required: ["CommandLine", "toolSummary", "WaitMsBeforeAsync"]
50469
+ }
50470
+ },
50471
+ {
50472
+ name: "manage_task",
50473
+ description: "Manage the background tasks of this conversation: 'list' the running tasks, check a task's 'status' and recent log output, 'send_input' to a running task, or 'kill' one. Refer to tasks by the TaskId that 'list' reports; keep task references human-readable when talking to the user.",
50474
+ parameters: {
50475
+ type: "OBJECT",
50476
+ properties: {
50477
+ Action: {
50478
+ type: "STRING",
50479
+ description: "'list' reports the running tasks; the other actions operate on the task named in TaskId.",
50480
+ enum: ["list", "kill", "status", "send_input"]
50481
+ },
50482
+ Input: {
50483
+ type: "STRING",
50484
+ description: "Input to deliver to the task. Required for 'send_input'."
50485
+ },
50486
+ TaskId: {
50487
+ type: "STRING",
50488
+ description: "Task to manage, as reported by 'list'. Required for 'kill', 'status' and 'send_input'."
50489
+ }
50490
+ },
50491
+ required: ["Action"]
50492
+ }
50493
+ },
50494
+ {
50495
+ name: "send_message",
50496
+ description: "Send a message to another agent, such as a subagent or a peer. Not a channel to the user.",
50497
+ parameters: {
50498
+ type: "OBJECT",
50499
+ properties: {
50500
+ Message: {
50501
+ type: "STRING",
50502
+ description: "Content of the message.",
50503
+ minLength: "1"
50504
+ },
50505
+ Recipient: {
50506
+ type: "STRING",
50507
+ description: "Conversation ID of the agent to message.",
50508
+ minLength: "1"
50509
+ }
50510
+ },
50511
+ required: ["Recipient", "Message"]
50512
+ }
50513
+ },
50514
+ {
50515
+ name: "schedule",
50516
+ description: "Schedule a one-shot timer (DurationSeconds) or a recurring cron job (CronExpression) that notifies you via Prompt. This tool call runs as a background task and returns immediately; end your turn (call no more tools) to wait for notifications. A timer with a TimerCondition is cancelled early by a matching message, which is itself your wakeup. Set IsDaemon only for a cron that should keep firing after the current task is done. Set ExactTiming only when a cron must fire at the exact wall-clock time without jitter. Use the manage_task tool to cancel active schedules, and never use a shell sleep command as a timer.",
50517
+ parameters: {
50518
+ type: "OBJECT",
50519
+ properties: {
50520
+ CronExpression: {
50521
+ type: "STRING",
50522
+ description: "Standard 5-field cron expression for a recurring schedule (e.g. '*/5 * * * *' for every 5 minutes). Mutually exclusive with DurationSeconds."
50523
+ },
50524
+ DurationSeconds: {
50525
+ type: "INTEGER",
50526
+ description: "Seconds to wait for a one-shot timer. Mutually exclusive with CronExpression."
50527
+ },
50528
+ ExactTiming: {
50529
+ type: "BOOLEAN",
50530
+ description: "Cron only. Set true only when the user explicitly requires the schedule to fire at the exact wall-clock time without jitter. Leave false (the default) for polling, monitoring, or periodic tasks so triggers are jittered to avoid load spikes."
50531
+ },
50532
+ IsDaemon: {
50533
+ type: "BOOLEAN",
50534
+ description: "Cron only. Set true only for an independent standing job that should keep firing after the current task is done."
50535
+ },
50536
+ MaxIterations: {
50537
+ type: "INTEGER",
50538
+ description: "Cron only. Maximum number of triggers before the schedule stops; defaults to unlimited."
50539
+ },
50540
+ Prompt: {
50541
+ type: "STRING",
50542
+ description: "Message sent to you as a high-priority notification when the timer fires or the cron triggers."
50543
+ },
50544
+ TimerCondition: {
50545
+ type: "STRING",
50546
+ description: "Timer only. Cancels the timer early when a matching message arrives: 'never' (default), 'any' (any message), or a sender ID (a message from that subagent or background task)."
50547
+ }
50548
+ },
50549
+ required: ["Prompt"]
50550
+ }
50551
+ },
50552
+ {
50553
+ name: "invoke_subagent",
50554
+ description: `Launch a subagent. It runs in the background with its own prompt and sends you a message when it completes or needs guidance; there is no need to poll.
50555
+
50556
+ Guidelines:
50557
+ * The subagent is identified by the conversationId returned; message it with the send_message tool.
50558
+ * Multiple subagents may share a type name; each still gets a unique conversationId.
50559
+ * If a task continues an existing subagent's work, message that subagent instead of launching a new one.`,
50560
+ parameters: {
50561
+ type: "OBJECT",
50562
+ properties: {
50563
+ Model: {
50564
+ type: "STRING",
50565
+ description: "Model for the subagent. 'inherit' (default): Uses your model. Default to 'inherit' unless the user explicitly requests a different model. 'flash_lite': The lightest, fastest model for trivial or high-volume tasks. 'flash': A lighter, faster model for simple tasks. 'pro': A larger model for complex work.",
50566
+ enum: ["inherit", "flash_lite", "flash", "pro"]
50567
+ },
50568
+ Prompt: {
50569
+ type: "STRING",
50570
+ description: "A clear, actionable task description for the subagent. Be specific about what the subagent should do and what information it should return."
50571
+ },
50572
+ Role: {
50573
+ type: "STRING",
50574
+ description: "A 2-5 word description of the subagent's role. Should read similar to a job title, e.g. 'Codebase Researcher', 'Database Debugger', etc. Should also be detailed enough to distinguish between different subagents who might share similar purposes."
50575
+ },
50576
+ TypeName: {
50577
+ type: "STRING",
50578
+ description: "Type name of the subagent to invoke."
50579
+ },
50580
+ Workspace: {
50581
+ type: "STRING",
50582
+ description: "Workspace mode for the subagent. 'inherit' (default) uses the same workspace as the parent. 'branch' creates a new isolated workspace branched or cloned from the parent. 'share' creates a new workspace sharing the parent's underlying repository directory (similar to a git worktree or Mercurial 'hg share'), allowing independent branching without duplicating storage. If omitted, defaults to 'inherit'."
50583
+ }
50584
+ },
50585
+ required: ["TypeName", "Role", "Prompt"]
50586
+ }
50587
+ },
50588
+ {
50589
+ name: "define_subagent",
50590
+ description: "Define a new subagent type that can then be invoked repeatedly. Subagents always have tools to research the codebase and to communicate with other agents.",
50591
+ parameters: {
50592
+ type: "OBJECT",
50593
+ properties: {
50594
+ Description: {
50595
+ type: "STRING",
50596
+ description: "What this subagent does and when it should be used.",
50597
+ minLength: "1"
50598
+ },
50599
+ EnableMCPTools: {
50600
+ type: "BOOLEAN",
50601
+ description: "Grant access to MCP tools."
50602
+ },
50603
+ EnableSubagentTools: {
50604
+ type: "BOOLEAN",
50605
+ description: "Grant tools to define and invoke its own subagents."
50606
+ },
50607
+ EnableWriteTools: {
50608
+ type: "BOOLEAN",
50609
+ description: "Grant tools to create and edit files, and run commands."
50610
+ },
50611
+ Name: {
50612
+ type: "STRING",
50613
+ description: "Unique name used to invoke the subagent.",
50614
+ minLength: "1"
50615
+ },
50616
+ SystemPrompt: {
50617
+ type: "STRING",
50618
+ description: "System prompt for the subagent.",
50619
+ minLength: "1"
50620
+ }
50621
+ },
50622
+ required: ["Name", "Description", "SystemPrompt"]
50623
+ }
50624
+ },
50625
+ {
50626
+ name: "manage_subagents",
50627
+ description: "Manage the direct subagents of this conversation. 'list' reports each one's conversationId (the id used to kill or message it) and live state. Killing a subagent also kills its descendants and deletes their branched workspaces; logs and artifacts are preserved.",
50628
+ parameters: {
50629
+ type: "OBJECT",
50630
+ properties: {
50631
+ Action: {
50632
+ type: "STRING",
50633
+ description: "'list' lists active direct subagents; 'kill' terminates the subagents named in ConversationIds; 'kill_all' terminates all.",
50634
+ enum: ["list", "kill", "kill_all"]
50635
+ },
50636
+ ConversationIds: {
50637
+ type: "ARRAY",
50638
+ description: "Subagents to kill. Required for 'kill'.",
50639
+ items: {
50640
+ type: "STRING"
50641
+ }
50642
+ }
50643
+ },
50644
+ required: ["Action"]
50645
+ }
50646
+ },
50647
+ {
50648
+ name: "write_file",
50649
+ description: "Create a new file with the given contents, or append to an existing file when Append is true. Parent directories are created automatically. Fails if the file already exists unless Overwrite or Append is true. When creating an artifact, always provide ArtifactMetadata. When creating non-artifact files, do not provide it.",
50650
+ parameters: {
50651
+ type: "OBJECT",
50652
+ properties: {
50653
+ Append: {
50654
+ type: "BOOLEAN",
50655
+ description: "Whether to append Content to the end of the file (creating the file if it does not exist). Cannot be combined with Overwrite=true."
50656
+ },
50657
+ ArtifactMetadata: {
50658
+ type: "OBJECT",
50659
+ description: "Metadata that defines artifact properties. ONLY provide when creating an artifact file in the artifact directory. Omit this field when creating non-artifact files.",
50660
+ properties: {
50661
+ RequestFeedback: {
50662
+ type: "BOOLEAN",
50663
+ description: "Whether to request user feedback on this artifact if its contents are executable (e.g., a plan). The user is given a 'Proceed' button to execute it."
50664
+ },
50665
+ Summary: {
50666
+ type: "STRING",
50667
+ description: "Detailed multi-line summary of the artifact's contents and purpose."
50668
+ },
50669
+ UserFacing: {
50670
+ type: "BOOLEAN",
50671
+ description: "Whether this artifact should be presented to the user."
50672
+ }
50673
+ },
50674
+ required: ["Summary", "UserFacing", "RequestFeedback"]
50675
+ },
50676
+ Content: {
50677
+ type: "STRING",
50678
+ description: "The full contents to write to the file."
50679
+ },
50680
+ Overwrite: {
50681
+ type: "BOOLEAN",
50682
+ description: "Whether to overwrite an existing file, replacing its entire contents."
50683
+ },
50684
+ Path: {
50685
+ type: "STRING",
50686
+ description: "The absolute path of the file to create.",
50687
+ minLength: "1"
50688
+ }
50689
+ },
50690
+ required: ["Path", "Content"]
50691
+ }
50692
+ },
50693
+ {
50694
+ name: "edit_file",
50695
+ description: `Use this tool to edit an existing file. Follow these rules:
50696
+ 1. Use this tool for a single contiguous block of edits. To edit multiple non-adjacent regions, make separate calls.
50697
+ 2. Target must exactly match existing file text, including whitespace. Replacement must be a complete drop-in replacement for the Target.
50698
+ 3. If Target appears multiple times in the file, every occurrence is replaced.`,
50699
+ parameters: {
50700
+ type: "OBJECT",
50701
+ properties: {
50702
+ ArtifactMetadata: {
50703
+ type: "OBJECT",
50704
+ description: "Metadata updates if updating an artifact file in the artifact directory. Omit this field when editing non-artifact files. Should be updated if the content is changing meaningfully.",
50705
+ properties: {
50706
+ RequestFeedback: {
50707
+ type: "BOOLEAN",
50708
+ description: "Whether to request user feedback on this artifact if its contents are executable (e.g., a plan). The user is given a 'Proceed' button to execute it."
50709
+ },
50710
+ Summary: {
50711
+ type: "STRING",
50712
+ description: "Detailed multi-line summary of the artifact's contents and purpose."
50713
+ },
50714
+ UserFacing: {
50715
+ type: "BOOLEAN",
50716
+ description: "Whether this artifact should be presented to the user."
50717
+ }
50718
+ },
50719
+ required: ["Summary", "UserFacing", "RequestFeedback"]
50720
+ },
50721
+ Path: {
50722
+ type: "STRING",
50723
+ description: "The absolute path of the file to modify.",
50724
+ minLength: "1"
50725
+ },
50726
+ Replacement: {
50727
+ type: "STRING",
50728
+ description: "The content to replace the target with. Leave empty to delete the target."
50729
+ },
50730
+ Target: {
50731
+ type: "STRING",
50732
+ description: "The exact string to be replaced. This must be the exact character-sequence to be replaced, including whitespace. Be very careful to include any leading whitespace otherwise this will not work at all. If the string appears multiple times in the file, every occurrence is replaced.",
50733
+ minLength: "1"
50734
+ }
50735
+ },
50736
+ required: ["Path", "Target", "Replacement"]
50737
+ }
50738
+ },
50739
+ {
50740
+ name: "search_web",
50741
+ description: "Performs a web search for a given query. Returns a summary of relevant information along with URL citations.",
50742
+ parameters: {
50743
+ type: "OBJECT",
50744
+ properties: {
50745
+ domain: {
50746
+ type: "STRING",
50747
+ description: "Optional domain to recommend the search prioritize"
50748
+ },
50749
+ query: {
50750
+ type: "STRING"
50751
+ }
50752
+ },
50753
+ required: ["query"]
50754
+ }
50755
+ },
50756
+ {
50757
+ name: "run_workflow",
50758
+ description: "Run a Python workflow script that orchestrates many agents and tool calls. Use it when the orchestration itself is code: fanning out over many independent pieces of work (files, modules, bugs, review angles), staged pipelines where each stage feeds the next, or aggregating, filtering, or cross-checking the results of many agents. Don't use it for a single delegated task; use a subagent. Read the run-workflow skill before writing a script: it documents the primitives, their arguments, and how the script runs. Unless it finishes within WaitMsBeforeAsync, the workflow runs in the background; you are notified when it ends.",
50759
+ parameters: {
50760
+ type: "OBJECT",
50761
+ properties: {
50762
+ Args: {
50763
+ type: "OBJECT",
50764
+ description: "Optional arguments for the script, which reads them from the args dict. A workflow's Args must match the schema in its workflow.json."
50765
+ },
50766
+ Cwd: {
50767
+ type: "STRING",
50768
+ description: "Optional working directory for the script, as an absolute path. Defaults to the first workspace."
50769
+ },
50770
+ Description: {
50771
+ type: "STRING",
50772
+ description: "Brief summary of the workflow goal."
50773
+ },
50774
+ Script: {
50775
+ type: "STRING",
50776
+ description: "Python source of the workflow script. Set exactly one of Script and ScriptPath."
50777
+ },
50778
+ ScriptPath: {
50779
+ type: "STRING",
50780
+ description: "Absolute path of a Python workflow script file. Set exactly one of Script and ScriptPath."
50781
+ },
50782
+ WaitMsBeforeAsync: {
50783
+ type: "INTEGER",
50784
+ description: "Optional. Milliseconds (up to 10000) to wait for the workflow to finish before backgrounding it; a workflow that finishes in time returns its result in this turn. 0 (the default) backgrounds it at once. Set it for quick call_tool fan-outs, not for workflows that run agents."
50785
+ }
50786
+ }
50787
+ }
50788
+ },
50789
+ {
50790
+ name: "swarm",
50791
+ description: 'Manage the swarm of agents working with you on the shared message board. Actions: `add` spawns a worker under a roster name (or `<name>-1`..`<name>-<k>` when `tasks` or `n` is set), pinned to a model, and posts `brief` on the board as an @mention of it, which is where the swarm sees its assignment -- by default a worker starts fresh and sees nothing of this conversation, so the brief must say what it owns and what done looks like; pass `fork:"<member>"` (or `"coordinator"`) to branch the new worker from that member\'s conversation history instead. `workspace:"share"` gives each worker its own working copy of your repository, for authors who edit or build at the same time as others; `"branch"` gives an isolated clone; readers and verifiers keep the default `inherit`. Briefs are public: every member can read them. `models` lists the models to choose from (`all:true` lists every model `add` accepts); with no model, a worker runs on your own model, which is what to use unless the user asks for another. `status` lists every member, the model it runs on, and its state: `waiting` is asleep on the board, costing nothing until somebody posts; `working` is somewhere in a turn; `stopped` is not loaded (e.g. after a restart) and a post naming it revives it; `killed` is gone. `model` switches a `waiting` worker (or yourself, when `name` is your own name or omitted) to another model, keeping its conversation: it is told of the switch, resumes any unfinished work on the new model, and runs on it from then on. Use it only when a worker or you run out of quota or capacity, or the user asks for another model, and say why; never `kill` and `add` instead. `kill` ends a worker PERMANENTLY and deletes its own workspace, so land its work first (uploaded for review, or its branch merged into your working copy; push to a remote only when the user asks): a killed worker cannot be revived, so use it when the work is over, never as a pause -- bringing one back means `add`ing a new worker with a new conversation. `title` names the swarm. Workers may call `status`, `models` and `add` too, to bring in helpers for their own work: the helper\'s brief is posted as you, it works in your workspace (or a share/branch of it), and should report back to you by name. A worker may `kill` only the workers it added, and `model` itself or the workers it added; killing a worker does not kill its helpers. The coordinator may `kill` any worker and `model` itself or any worker, and `title` is the coordinator\'s alone.',
50792
+ parameters: {
50793
+ type: "OBJECT",
50794
+ properties: {
50795
+ action: {
50796
+ type: "STRING",
50797
+ description: "What to do: status, models, add, model, kill or title.",
50798
+ enum: ["status", "models", "add", "model", "kill", "title"]
50799
+ },
50800
+ all: {
50801
+ type: "BOOLEAN",
50802
+ description: "For models: list every model add accepts, not just the suggested ones."
50803
+ },
50804
+ brief: {
50805
+ type: "STRING",
50806
+ description: "The worker's assignment, for add: what it owns and what done looks like. Posted publicly on the board."
50807
+ },
50808
+ fork: {
50809
+ type: "STRING",
50810
+ description: 'Optional roster name of an existing member (or "coordinator") whose conversation history the new worker forks from instead of starting fresh.'
50811
+ },
50812
+ model: {
50813
+ type: "STRING",
50814
+ description: "Model to pin this worker to, for add and model: a model name listed by the models action, or its display name. Leave it unset to use your own model, unless the user asks for another."
50815
+ },
50816
+ n: {
50817
+ type: "INTEGER",
50818
+ description: "Optional number of homogeneous copies to spawn (<name>-1 through <name>-<n>), for add when the user explicitly asks for multiple agents sharing one role and brief. Omit (defaults to 1) to spawn a single named worker.",
50819
+ minimum: 1
50820
+ },
50821
+ name: {
50822
+ type: "STRING",
50823
+ description: "Roster name of the worker, for add, model and kill (or base name when n > 1 or tasks is set). Short, lowercase, no spaces."
50824
+ },
50825
+ tasks: {
50826
+ type: "ARRAY",
50827
+ description: "Optional per-worker slice targets for add when spawning a sharded group (<name>-1 through <name>-<len(tasks)>), each combined with the shared brief. Omit for normal single-worker add calls.",
50828
+ items: {
50829
+ type: "STRING"
50830
+ }
50831
+ },
50832
+ title: {
50833
+ type: "STRING",
50834
+ description: "A short title for the swarm, for the UI."
50835
+ },
50836
+ workspace: {
50837
+ type: "STRING",
50838
+ description: "Where each worker works, for add. inherit (default) is your own workspace. share gives each worker its own working copy of your repository; branch gives each an isolated clone. kill deletes a share or branch workspace.",
50839
+ enum: ["inherit", "share", "branch"]
50840
+ }
50841
+ },
50842
+ required: ["action"]
50843
+ }
50844
+ },
50845
+ {
50846
+ name: "ask_question",
50847
+ description: "Ask the user one or more multiple-choice questions, e.g. to clarify requirements, and wait for the answers. Don't use it for trivial yes/no questions; ask those in plain text.",
50848
+ parameters: {
50849
+ type: "OBJECT",
50850
+ properties: {
50851
+ questions: {
50852
+ type: "ARRAY",
50853
+ items: {
50854
+ type: "OBJECT",
50855
+ properties: {
50856
+ is_multi_select: {
50857
+ type: "BOOLEAN",
50858
+ description: "Whether the user can select several options."
50859
+ },
50860
+ options: {
50861
+ type: "ARRAY",
50862
+ description: "Answers to choose from, unnumbered and without an 'Other' option; the UI adds both. Put a recommended answer first, prefixed with '(Recommended)'.",
50863
+ items: {
50864
+ type: "STRING"
50865
+ },
50866
+ minItems: "2"
50867
+ },
50868
+ question: {
50869
+ type: "STRING",
50870
+ description: "The question, without 'select all that apply' or similar; the UI adds that.",
50871
+ minLength: "1"
50872
+ }
50873
+ },
50874
+ required: ["question", "options"]
50875
+ },
50876
+ minItems: "1"
50877
+ }
50878
+ },
50879
+ required: ["questions"]
50880
+ }
50881
+ },
50882
+ {
50883
+ name: "call_mcp_tool",
50884
+ description: "Call a lazy-loaded MCP tool. Read the tool's schema file to understand the tool's arguments and usage.",
50885
+ parameters: {
50886
+ type: "OBJECT",
50887
+ properties: {
50888
+ Arguments: {
50889
+ description: "Arguments to pass to the tool."
50890
+ },
50891
+ ServerName: {
50892
+ type: "STRING",
50893
+ description: "Name of the MCP server."
50894
+ },
50895
+ ToolName: {
50896
+ type: "STRING",
50897
+ description: "Name of the tool to call."
50898
+ }
50899
+ },
50900
+ required: ["ServerName", "ToolName", "Arguments"]
50901
+ }
50902
+ },
50903
+ {
50904
+ name: "list_resources",
50905
+ description: "Lists the available resources from an MCP server.",
50906
+ parameters: {
50907
+ type: "OBJECT",
50908
+ properties: {
50909
+ ServerName: {
50910
+ type: "STRING",
50911
+ description: "Name of the server to list available resources from.",
50912
+ minLength: "1"
50913
+ }
50914
+ },
50915
+ required: ["ServerName"]
50916
+ }
50917
+ },
50918
+ {
50919
+ name: "read_resource",
50920
+ description: "Retrieves a specified resource's contents.",
50921
+ parameters: {
50922
+ type: "OBJECT",
50923
+ properties: {
50924
+ ServerName: {
50925
+ type: "STRING",
50926
+ description: "Name of the server to read the resource from."
50927
+ },
50928
+ Uri: {
50929
+ type: "STRING",
50930
+ description: "Unique identifier for the resource."
50931
+ }
50932
+ }
50933
+ }
50934
+ }
50935
+ ]
50936
+ };
50937
+ });
50938
+
50939
+ // src/providers/antigravity-agy-request.ts
50940
+ import { homedir as homedir21 } from "os";
50941
+ import { basename as basename2, join as join21 } from "path";
50942
+ function agyEnvironment() {
50943
+ return {
50944
+ os: OS_NAME[process.platform] ?? process.platform,
50945
+ shell: basename2(process.env.SHELL || "sh"),
50946
+ workspace: process.cwd(),
50947
+ appDataDir: join21(homedir21(), ".claudish", "antigravity")
50948
+ };
50949
+ }
50950
+ function fill(template, values) {
50951
+ return template.replace(/\{\{(\w+)\}\}/g, (whole, key) => values[key] ?? whole);
50952
+ }
50953
+ function agyDeclarationTemplate(name) {
50954
+ return BY_NAME.get(name);
50955
+ }
50956
+ function agySystemText(environment, conversationId) {
50957
+ return fill(antigravity_agy_request_default.system, { ...environment, conversationId });
50958
+ }
50959
+ function declarationsOf(tools) {
50960
+ if (!Array.isArray(tools))
50961
+ return [];
50962
+ const out = [];
50963
+ for (const entry of tools) {
50964
+ if (!Array.isArray(entry?.functionDeclarations))
50965
+ continue;
50966
+ for (const declaration of entry.functionDeclarations) {
50967
+ if (typeof declaration?.name === "string")
50968
+ out.push(declaration);
50969
+ }
50970
+ }
50971
+ return out;
50972
+ }
50973
+ function declaresTools(tools) {
50974
+ return declarationsOf(tools).length > 0;
50975
+ }
50976
+ function withAgyTools(tools, environment) {
50977
+ const own = declarationsOf(tools);
50978
+ if (own.length === 0)
50979
+ return tools;
50980
+ const ownByName = new Map(own.map((declaration) => [declaration.name, declaration]));
50981
+ const values = { ...environment };
50982
+ const replaced = new Set;
50983
+ const out = [];
50984
+ for (const declaration of DECLARATIONS) {
50985
+ const mine = ownByName.get(declaration.name);
50986
+ if (mine !== undefined && mine.description !== declaration.description)
50987
+ continue;
50988
+ if (mine !== undefined)
50989
+ replaced.add(declaration.name);
50990
+ out.push({
50991
+ functionDeclarations: [
50992
+ declaration.description === undefined ? declaration : { ...declaration, description: fill(declaration.description, values) }
50993
+ ]
50994
+ });
50995
+ }
50996
+ for (const entry of tools) {
50997
+ if (!Array.isArray(entry?.functionDeclarations)) {
50998
+ out.push(entry);
50999
+ continue;
51000
+ }
51001
+ const { functionDeclarations, ...rest } = entry;
51002
+ if (functionDeclarations.length === 0 && Object.keys(rest).length > 0)
51003
+ out.push(rest);
51004
+ for (const declaration of functionDeclarations) {
51005
+ if (replaced.has(declaration?.name))
51006
+ continue;
51007
+ const template = BY_NAME.get(declaration?.name)?.description;
51008
+ const kept = template && typeof declaration.description === "string" ? {
51009
+ ...declaration,
51010
+ description: declaration.description.replace(template, () => fill(template, values))
51011
+ } : declaration;
51012
+ out.push({ ...rest, functionDeclarations: [kept] });
51013
+ }
51014
+ }
51015
+ return out;
51016
+ }
51017
+ function withAgySystem(systemInstruction, environment, conversationId) {
51018
+ const instruction = systemInstruction && typeof systemInstruction === "object" ? systemInstruction : {};
51019
+ const parts = Array.isArray(instruction.parts) ? instruction.parts : [];
51020
+ let own = parts.map((part) => typeof part?.text === "string" ? part.text : "").filter((text) => text.length > 0).join(`
51021
+
51022
+ `);
51023
+ if (own.startsWith(ANTIGRAVITY_IDENTITY_HEAD)) {
51024
+ own = own.slice(ANTIGRAVITY_IDENTITY_HEAD.length).trimStart();
51025
+ }
51026
+ const text = agySystemText(environment, conversationId);
51027
+ return { ...instruction, parts: [{ text: own ? `${text}
51028
+ ${own}` : text }] };
51029
+ }
51030
+ var DECLARATIONS, BY_NAME, OS_NAME;
51031
+ var init_antigravity_agy_request2 = __esm(() => {
51032
+ init_identity_filter();
51033
+ init_antigravity_agy_request();
51034
+ DECLARATIONS = antigravity_agy_request_default.tools;
51035
+ BY_NAME = new Map(DECLARATIONS.map((declaration) => [declaration.name, declaration]));
51036
+ OS_NAME = { darwin: "mac", win32: "windows" };
51037
+ });
51038
+
49809
51039
  // src/providers/antigravity-content.ts
49810
51040
  function agyLocalTime(date) {
49811
51041
  const two = (n) => String(n).padStart(2, "0");
@@ -50114,12 +51344,16 @@ function buildAntigravityEnvelope(input) {
50114
51344
  wordedTools: agyWordedTools(tools)
50115
51345
  });
50116
51346
  const request = { contents: toolResultsAsModelEntries(worded) };
50117
- if (systemInstruction && typeof systemInstruction === "object") {
50118
- const { role: _role, ...instruction } = systemInstruction;
51347
+ const agent = declaresTools(tools);
51348
+ const environment = agent ? input.environment ?? agyEnvironment() : undefined;
51349
+ const system = environment ? withAgySystem(systemInstruction, environment, conversation.cascadeId) : systemInstruction;
51350
+ if (system && typeof system === "object") {
51351
+ const { role: _role, ...instruction } = system;
50119
51352
  request.systemInstruction = { role: "user", ...instruction };
50120
51353
  }
50121
- if (tools !== undefined)
50122
- request.tools = oneToolPerDeclaration(tools);
51354
+ if (tools !== undefined) {
51355
+ request.tools = oneToolPerDeclaration(environment ? withAgyTools(tools, environment) : tools);
51356
+ }
50123
51357
  Object.assign(request, others);
50124
51358
  request.labels = labelsFor(model, meta, conversation, stepIndex);
50125
51359
  const {
@@ -50143,6 +51377,7 @@ function buildAntigravityEnvelope(input) {
50143
51377
  }
50144
51378
  var antigravityConversations;
50145
51379
  var init_antigravity_envelope = __esm(() => {
51380
+ init_antigravity_agy_request2();
50146
51381
  init_antigravity_content();
50147
51382
  antigravityConversations = new AntigravityConversations;
50148
51383
  });
@@ -52754,10 +53989,10 @@ var init_keychain_source = __esm(() => {
52754
53989
  });
52755
53990
 
52756
53991
  // src/auth/credentials/key-sources.ts
52757
- import { homedir as homedir21 } from "os";
52758
- import { join as join21 } from "path";
53992
+ import { homedir as homedir22 } from "os";
53993
+ import { join as join22 } from "path";
52759
53994
  function configLabel() {
52760
- return getConfigFileOverride() ? activeGlobalConfigFile(join21(homedir21(), ".claudish", "config.json")) : "~/.claudish/config.json";
53995
+ return getConfigFileOverride() ? activeGlobalConfigFile(join22(homedir22(), ".claudish", "config.json")) : "~/.claudish/config.json";
52761
53996
  }
52762
53997
  function keySourcesSearched(opts) {
52763
53998
  const compact = opts?.compact === true;
@@ -52775,8 +54010,8 @@ var init_key_sources = __esm(() => {
52775
54010
 
52776
54011
  // src/auth/credentials/api-key-credential.ts
52777
54012
  import { existsSync as existsSync17 } from "fs";
52778
- import { homedir as homedir22 } from "os";
52779
- import { join as join22 } from "path";
54013
+ import { homedir as homedir23 } from "os";
54014
+ import { join as join23 } from "path";
52780
54015
 
52781
54016
  class ApiKeyCredentialProvider {
52782
54017
  catalogName;
@@ -52828,7 +54063,7 @@ class ApiKeyCredentialProvider {
52828
54063
  if (!this.oauthFallback)
52829
54064
  return false;
52830
54065
  try {
52831
- return existsSync17(join22(homedir22(), ".claudish", this.oauthFallback));
54066
+ return existsSync17(join23(homedir23(), ".claudish", this.oauthFallback));
52832
54067
  } catch {
52833
54068
  return false;
52834
54069
  }
@@ -56925,7 +58160,7 @@ var init_management = __esm(() => {
56925
58160
 
56926
58161
  // src/auth/accounts/legacy-move.ts
56927
58162
  import { lstatSync as lstatSync4, realpathSync as realpathSync4 } from "fs";
56928
- import { join as join23, resolve as resolve2 } from "path";
58163
+ import { join as join24, resolve as resolve2 } from "path";
56929
58164
  function legacyMoveKeychainBlocked(env = process.env) {
56930
58165
  return env.CLAUDISH_DISABLE_KEYCHAIN === "1" || !isKeychainSupported();
56931
58166
  }
@@ -56937,7 +58172,7 @@ function canonical(path) {
56937
58172
  }
56938
58173
  }
56939
58174
  function isDefaultConfigPath(configPath, env = process.env) {
56940
- return canonical(configPath) === canonical(join23(claudishHome(env), "config.json"));
58175
+ return canonical(configPath) === canonical(join24(claudishHome(env), "config.json"));
56941
58176
  }
56942
58177
  function legacyMoveApplies(env, configPath, registry) {
56943
58178
  if (legacyMoveKeychainBlocked(env))
@@ -57213,10 +58448,10 @@ var init_codex_credential = __esm(() => {
57213
58448
 
57214
58449
  // src/providers/devin/devin-credentials.ts
57215
58450
  import { readFileSync as readFileSync24 } from "fs";
57216
- import { homedir as homedir23 } from "os";
57217
- import { join as join24 } from "path";
58451
+ import { homedir as homedir24 } from "os";
58452
+ import { join as join25 } from "path";
57218
58453
  function devinCredentialsPath() {
57219
- return credentialsPathOverride ?? join24(homedir23(), ".local", "share", "devin", "credentials.toml");
58454
+ return credentialsPathOverride ?? join25(homedir24(), ".local", "share", "devin", "credentials.toml");
57220
58455
  }
57221
58456
  function readTomlString(source, key) {
57222
58457
  const match = source.match(new RegExp(`^\\s*${key}\\s*=\\s*"([^"]*)"`, "m"));
@@ -57373,14 +58608,14 @@ import {
57373
58608
  unlinkSync as unlinkSync7,
57374
58609
  writeSync as writeSync6
57375
58610
  } from "fs";
57376
- import { homedir as homedir24, hostname as hostname3, platform, release as release2 } from "os";
57377
- import { dirname as dirname12, join as join25 } from "path";
58611
+ import { homedir as homedir25, hostname as hostname3, platform, release as release2 } from "os";
58612
+ import { dirname as dirname12, join as join26 } from "path";
57378
58613
  import { promisify as promisify4 } from "util";
57379
58614
  function kimiOAuthPath() {
57380
- return kimiOAuthPathOverride ?? join25(homedir24(), ".claudish", "kimi-oauth.json");
58615
+ return kimiOAuthPathOverride ?? join26(homedir25(), ".claudish", "kimi-oauth.json");
57381
58616
  }
57382
58617
  function kimiDeviceIdPath() {
57383
- return kimiDeviceIdPathOverride ?? join25(homedir24(), ".claudish", "kimi-device-id");
58618
+ return kimiDeviceIdPathOverride ?? join26(homedir25(), ".claudish", "kimi-device-id");
57384
58619
  }
57385
58620
  function isKimiCredentials(data) {
57386
58621
  if (!data || typeof data !== "object")
@@ -57727,8 +58962,8 @@ var init_kimi_oauth = __esm(() => {
57727
58962
 
57728
58963
  // src/auth/oauth-registry.ts
57729
58964
  import { existsSync as existsSync20, readFileSync as readFileSync26 } from "fs";
57730
- import { homedir as homedir25 } from "os";
57731
- import { join as join26 } from "path";
58965
+ import { homedir as homedir26 } from "os";
58966
+ import { join as join27 } from "path";
57732
58967
  function credentialSatisfies(descriptor, data) {
57733
58968
  if (!data?.access_token)
57734
58969
  return false;
@@ -57741,7 +58976,7 @@ function credentialSatisfies(descriptor, data) {
57741
58976
  return true;
57742
58977
  }
57743
58978
  function hasValidOAuthCredentials(descriptor) {
57744
- const credPath = join26(homedir25(), ".claudish", descriptor.credentialFile);
58979
+ const credPath = join27(homedir26(), ".claudish", descriptor.credentialFile);
57745
58980
  if (!existsSync20(credPath))
57746
58981
  return false;
57747
58982
  if (descriptor.validationMode === "file-exists") {
@@ -57944,13 +59179,13 @@ import {
57944
59179
  rmSync as rmSync7,
57945
59180
  writeFileSync as writeFileSync9
57946
59181
  } from "fs";
57947
- import { homedir as homedir26 } from "os";
57948
- import { join as join27 } from "path";
59182
+ import { homedir as homedir27 } from "os";
59183
+ import { join as join28 } from "path";
57949
59184
  function defaultMuseStoreDir() {
57950
- return join27(homedir26(), ".claudish");
59185
+ return join28(homedir27(), ".claudish");
57951
59186
  }
57952
59187
  function museStorePath(kind, dir = defaultMuseStoreDir()) {
57953
- return join27(dir, FILE_NAMES[kind]);
59188
+ return join28(dir, FILE_NAMES[kind]);
57954
59189
  }
57955
59190
  function isValidMuseStore(value) {
57956
59191
  if (!value || typeof value !== "object")
@@ -58005,7 +59240,7 @@ var init_muse_store = __esm(() => {
58005
59240
 
58006
59241
  // src/providers/meta-muse/muse-keychain.ts
58007
59242
  import { mkdirSync as mkdirSync14, readFileSync as readFileSync28, rmSync as rmSync8, statSync as statSync9, writeFileSync as writeFileSync10 } from "fs";
58008
- import { join as join28 } from "path";
59243
+ import { join as join29 } from "path";
58009
59244
  function processExists(pid) {
58010
59245
  try {
58011
59246
  process.kill(pid, 0);
@@ -58055,7 +59290,7 @@ function parseMuseKeychainValue(value) {
58055
59290
  }
58056
59291
  }
58057
59292
  function lockPath2() {
58058
- return join28(deps2.dir(), LOCK_FILE);
59293
+ return join29(deps2.dir(), LOCK_FILE);
58059
59294
  }
58060
59295
  function readLock() {
58061
59296
  let mtime;
@@ -58389,7 +59624,7 @@ var init_muse_mint = __esm(() => {
58389
59624
  });
58390
59625
 
58391
59626
  // src/providers/meta-muse/muse-credentials.ts
58392
- import { homedir as homedir27 } from "os";
59627
+ import { homedir as homedir28 } from "os";
58393
59628
  function museLoginRejectedMessage(status) {
58394
59629
  return `Meta rejected the Muse Code login (HTTP ${status}): it has expired or been revoked. Run \`claudish login muse\`, or one interactive \`claudish --model muse@<model>\` and allow Keychain access.`;
58395
59630
  }
@@ -58602,7 +59837,7 @@ function museSignerLabel(signer) {
58602
59837
  return `Muse Code ${SOURCE_LABELS[signer.source]} \xB7 ${signer.subsTierName ?? "tier unknown"}`;
58603
59838
  }
58604
59839
  function displayPath2(path) {
58605
- const home = homedir27();
59840
+ const home = homedir28();
58606
59841
  return path.startsWith(`${home}/`) ? `~${path.slice(home.length)}` : path;
58607
59842
  }
58608
59843
  function describeMuseSigningSource(opts = {}) {
@@ -58768,13 +60003,13 @@ import {
58768
60003
  rmSync as rmSync9,
58769
60004
  writeSync as writeSync7
58770
60005
  } from "fs";
58771
- import { homedir as homedir28 } from "os";
58772
- import { dirname as dirname13, join as join29 } from "path";
60006
+ import { homedir as homedir29 } from "os";
60007
+ import { dirname as dirname13, join as join30 } from "path";
58773
60008
  function dynamicCatalogDir(opts) {
58774
- return opts?.dir ?? (process.env.CLAUDISH_DYNAMIC_CATALOG_DIR || join29(homedir28(), ".claudish", "dynamic-models-catalog"));
60009
+ return opts?.dir ?? (process.env.CLAUDISH_DYNAMIC_CATALOG_DIR || join30(homedir29(), ".claudish", "dynamic-models-catalog"));
58775
60010
  }
58776
60011
  function dynamicCatalogKeyPath(opts) {
58777
- return opts?.keyPath ?? (process.env.CLAUDISH_DYNAMIC_CATALOG_KEY || join29(homedir28(), ".claudish", "dynamic-models-catalog.key"));
60012
+ return opts?.keyPath ?? (process.env.CLAUDISH_DYNAMIC_CATALOG_KEY || join30(homedir29(), ".claudish", "dynamic-models-catalog.key"));
58778
60013
  }
58779
60014
  function nowOf(opts) {
58780
60015
  return opts?.now ? opts.now() : Date.now();
@@ -58831,7 +60066,7 @@ function readSecret(path) {
58831
60066
  function createSecret(path) {
58832
60067
  const dir = dirname13(path);
58833
60068
  mkdirSync15(dir, { recursive: true, mode: 448 });
58834
- const temp = join29(dir, `.dynamic-models-catalog.key.${process.pid}.${randomBytes12(6).toString("hex")}`);
60069
+ const temp = join30(dir, `.dynamic-models-catalog.key.${process.pid}.${randomBytes12(6).toString("hex")}`);
58835
60070
  const fd = openSync9(temp, "wx", 384);
58836
60071
  try {
58837
60072
  writeSync7(fd, randomBytes12(32).toString("hex"));
@@ -58921,7 +60156,7 @@ function isValidEntry(value) {
58921
60156
  function providerFile(provider, opts) {
58922
60157
  if (!PROVIDER_NAME_PATTERN.test(provider) || provider.includes(".."))
58923
60158
  return null;
58924
- return join29(dynamicCatalogDir(opts), `${provider}.json`);
60159
+ return join30(dynamicCatalogDir(opts), `${provider}.json`);
58925
60160
  }
58926
60161
  function readDocument(provider, path) {
58927
60162
  let parsed;
@@ -59652,8 +60887,8 @@ import {
59652
60887
  statSync as statSync10,
59653
60888
  writeFileSync as writeFileSync11
59654
60889
  } from "fs";
59655
- import { homedir as homedir29 } from "os";
59656
- import { basename as basename2, dirname as dirname14, join as join30 } from "path";
60890
+ import { homedir as homedir30 } from "os";
60891
+ import { basename as basename3, dirname as dirname14, join as join31 } from "path";
59657
60892
  function execLms(binary, args, timeoutMs) {
59658
60893
  return new Promise((resolve) => {
59659
60894
  execFile2(binary, args, { timeout: timeoutMs, maxBuffer: 16 * 1024 * 1024 }, (error, stdout) => {
@@ -59769,7 +61004,7 @@ function expandModelsToMachines(models, machines, defaultWindow) {
59769
61004
  });
59770
61005
  }
59771
61006
  function defaultLockPath2() {
59772
- return join30(homedir29(), ".claudish", "lmstudio-machine.lock");
61007
+ return join31(homedir30(), ".claudish", "lmstudio-machine.lock");
59773
61008
  }
59774
61009
  function lookAtLock(lockPath) {
59775
61010
  const identity = lockIdentity(lockPath);
@@ -59777,7 +61012,7 @@ function lookAtLock(lockPath) {
59777
61012
  return;
59778
61013
  let owner = "";
59779
61014
  try {
59780
- owner = readFileSync30(join30(lockPath, "owner"), "utf-8");
61015
+ owner = readFileSync30(join31(lockPath, "owner"), "utf-8");
59781
61016
  } catch {}
59782
61017
  const pid = Number.parseInt(owner, 10);
59783
61018
  if (!Number.isInteger(pid) || pid <= 0) {
@@ -59806,12 +61041,12 @@ function lockIdentity(path) {
59806
61041
  }
59807
61042
  let owner = "";
59808
61043
  try {
59809
- owner = readFileSync30(join30(path, "owner"), "utf-8");
61044
+ owner = readFileSync30(join31(path, "owner"), "utf-8");
59810
61045
  } catch {}
59811
61046
  return `${stats.ino}:${stats.birthtimeMs}:${owner}`;
59812
61047
  }
59813
61048
  function takeOverStaleLock(lockPath, identity) {
59814
- const entry = makeClaim(join30(lockPath, CLAIM));
61049
+ const entry = makeClaim(join31(lockPath, CLAIM));
59815
61050
  if (entry === undefined)
59816
61051
  return false;
59817
61052
  if (lockIdentity(lockPath) !== identity) {
@@ -59842,7 +61077,7 @@ function makeClaim(claim) {
59842
61077
  writeFileSync11(draft, String(process.pid));
59843
61078
  let name = "pid";
59844
61079
  for (let step = 0;step < MAX_CLAIM_CHAIN; step++) {
59845
- const entry = join30(claim, name);
61080
+ const entry = join31(claim, name);
59846
61081
  try {
59847
61082
  linkSync3(draft, entry);
59848
61083
  return entry;
@@ -59875,7 +61110,7 @@ function entryPid(entry) {
59875
61110
  }
59876
61111
  }
59877
61112
  function removeAbandonedCopies(lockPath) {
59878
- const prefix = `${basename2(lockPath)}.dead.`;
61113
+ const prefix = `${basename3(lockPath)}.dead.`;
59879
61114
  let names;
59880
61115
  try {
59881
61116
  names = readdirSync4(dirname14(lockPath));
@@ -59888,13 +61123,13 @@ function removeAbandonedCopies(lockPath) {
59888
61123
  const pid = Number.parseInt(name.slice(prefix.length), 10);
59889
61124
  if (!Number.isInteger(pid) || pid <= 0 || pidAlive(pid))
59890
61125
  continue;
59891
- rmSync10(join30(dirname14(lockPath), name), { recursive: true, force: true });
61126
+ rmSync10(join31(dirname14(lockPath), name), { recursive: true, force: true });
59892
61127
  }
59893
61128
  }
59894
61129
  function signLock(lockPath) {
59895
- const draft = join30(lockPath, `owner.${process.pid}`);
61130
+ const draft = join31(lockPath, `owner.${process.pid}`);
59896
61131
  writeFileSync11(draft, String(process.pid));
59897
- renameSync8(draft, join30(lockPath, "owner"));
61132
+ renameSync8(draft, join31(lockPath, "owner"));
59898
61133
  }
59899
61134
  async function withMachineLock(lockPath, pollMs, work) {
59900
61135
  mkdirSync16(dirname14(lockPath), { recursive: true });
@@ -60065,7 +61300,7 @@ var LMSTUDIO_DEVICE_SEPARATOR = "~", LMSTUDIO_THIS_MACHINE = "local", LIST_TIMEO
60065
61300
  const onPath = await execLms("lms", args, timeoutMs);
60066
61301
  if (!onPath.missing)
60067
61302
  return onPath.stdout;
60068
- return (await execLms(join30(homedir29(), ".lmstudio", "bin", "lms"), args, timeoutMs)).stdout;
61303
+ return (await execLms(join31(homedir30(), ".lmstudio", "bin", "lms"), args, timeoutMs)).stdout;
60069
61304
  }, THIS_MACHINE_NAME = "this Mac", LOCK_POLL_MS2 = 250, CLAIM = "takeover", MAX_CLAIM_CHAIN = 64, machineQueue;
60070
61305
  var init_lmstudio_devices = __esm(() => {
60071
61306
  init_call_context();
@@ -61953,10 +63188,10 @@ var init_vision_proxy = __esm(() => {
61953
63188
 
61954
63189
  // src/auth/claude-code-facts.ts
61955
63190
  import { createHash as createHash18 } from "crypto";
61956
- import { homedir as homedir30 } from "os";
61957
- import { join as join31, resolve as resolve3 } from "path";
63191
+ import { homedir as homedir31 } from "os";
63192
+ import { join as join32, resolve as resolve3 } from "path";
61958
63193
  function claudeCodeConfigDir(env = process.env, cwd = process.cwd()) {
61959
- const dir = env.CLAUDE_CONFIG_DIR ?? join31(env.HOME ? env.HOME : homedir30(), ".claude");
63194
+ const dir = env.CLAUDE_CONFIG_DIR ?? join32(env.HOME ? env.HOME : homedir31(), ".claude");
61960
63195
  return resolve3(cwd, dir.normalize("NFC"));
61961
63196
  }
61962
63197
  function configDirHash(configDir) {
@@ -61975,23 +63210,23 @@ function claudeCodeSecureStorageServices(kind, env = process.env, cwd = process.
61975
63210
  return [...new Set(spellings.map((dir) => `${base}-${configDirHash(dir.normalize("NFC"))}`))];
61976
63211
  }
61977
63212
  function claudeCodeGlobalConfigPath(env = process.env, cwd = process.cwd()) {
61978
- return env.CLAUDE_CONFIG_DIR ? resolve3(claudeCodeConfigDir(env, cwd), ".claude.json") : resolve3(env.HOME || homedir30(), ".claude.json");
63213
+ return env.CLAUDE_CONFIG_DIR ? resolve3(claudeCodeConfigDir(env, cwd), ".claude.json") : resolve3(env.HOME || homedir31(), ".claude.json");
61979
63214
  }
61980
63215
  var BASE_KEYCHAIN_SERVICE = "Claude Code";
61981
63216
  var init_claude_code_facts = () => {};
61982
63217
 
61983
63218
  // src/mcp-session/home-dir.ts
61984
- import { homedir as homedir31 } from "os";
61985
- import { join as join32 } from "path";
61986
- function userHomeFrom(env, homedirFn = homedir31) {
63219
+ import { homedir as homedir32 } from "os";
63220
+ import { join as join33 } from "path";
63221
+ function userHomeFrom(env, homedirFn = homedir32) {
61987
63222
  const home = env.HOME;
61988
63223
  return home && home.length > 0 ? home : homedirFn();
61989
63224
  }
61990
- function sessionsDirFrom(env, homedirFn = homedir31) {
63225
+ function sessionsDirFrom(env, homedirFn = homedir32) {
61991
63226
  const explicit = env.CLAUDISH_SESSIONS_DIR;
61992
63227
  if (explicit && explicit.length > 0)
61993
63228
  return explicit;
61994
- return join32(userHomeFrom(env, homedirFn), ".claudish", "sessions");
63229
+ return join33(userHomeFrom(env, homedirFn), ".claudish", "sessions");
61995
63230
  }
61996
63231
  function claudeCodeStringHash(s) {
61997
63232
  let h = 0;
@@ -62165,7 +63400,7 @@ var init_transcript_tailer = () => {};
62165
63400
 
62166
63401
  // src/session-events/index.ts
62167
63402
  import { existsSync as existsSync22, readFileSync as readFileSync31, readdirSync as readdirSync5 } from "fs";
62168
- import { join as join33 } from "path";
63403
+ import { join as join34 } from "path";
62169
63404
  function extractSessionId2(metadata) {
62170
63405
  const userId = metadata?.user_id;
62171
63406
  if (typeof userId !== "string")
@@ -62285,13 +63520,13 @@ class SessionEventRegistry {
62285
63520
  }
62286
63521
  }
62287
63522
  locateTranscript(sessionId) {
62288
- const projectsDir = join33(this.claudeHome, "projects");
62289
- const primary = join33(projectsDir, slugFromCwd(this.cwd), `${sessionId}.jsonl`);
63523
+ const projectsDir = join34(this.claudeHome, "projects");
63524
+ const primary = join34(projectsDir, slugFromCwd(this.cwd), `${sessionId}.jsonl`);
62290
63525
  if (existsSync22(primary))
62291
63526
  return primary;
62292
63527
  try {
62293
63528
  for (const dir of readdirSync5(projectsDir)) {
62294
- const candidate = join33(projectsDir, dir, `${sessionId}.jsonl`);
63529
+ const candidate = join34(projectsDir, dir, `${sessionId}.jsonl`);
62295
63530
  if (existsSync22(candidate))
62296
63531
  return candidate;
62297
63532
  }
@@ -62300,7 +63535,7 @@ class SessionEventRegistry {
62300
63535
  }
62301
63536
  readSettingsEffortLevel() {
62302
63537
  try {
62303
- const settings = JSON.parse(readFileSync31(join33(this.claudeHome, "settings.json"), "utf-8"));
63538
+ const settings = JSON.parse(readFileSync31(join34(this.claudeHome, "settings.json"), "utf-8"));
62304
63539
  return typeof settings.effortLevel === "string" ? settings.effortLevel : undefined;
62305
63540
  } catch {
62306
63541
  return;
@@ -62411,8 +63646,8 @@ import {
62411
63646
  unlinkSync as unlinkSync8,
62412
63647
  writeFileSync as writeFileSync12
62413
63648
  } from "fs";
62414
- import { homedir as homedir32 } from "os";
62415
- import { join as join34 } from "path";
63649
+ import { homedir as homedir33 } from "os";
63650
+ import { join as join35 } from "path";
62416
63651
  function ensureDir() {
62417
63652
  if (!existsSync23(CLAUDISH_DIR)) {
62418
63653
  mkdirSync17(CLAUDISH_DIR, { recursive: true });
@@ -62447,7 +63682,7 @@ function writeToDisk(events) {
62447
63682
  ensureDir();
62448
63683
  const trimmed = enforceSizeCap([...events]);
62449
63684
  const payload = { version: 1, events: trimmed };
62450
- const tmpFile = join34(CLAUDISH_DIR, `stats-buffer.tmp.${process.pid}.json`);
63685
+ const tmpFile = join35(CLAUDISH_DIR, `stats-buffer.tmp.${process.pid}.json`);
62451
63686
  writeFileSync12(tmpFile, JSON.stringify(payload, null, 2), "utf-8");
62452
63687
  renameSync9(tmpFile, BUFFER_FILE);
62453
63688
  memoryCache = trimmed;
@@ -62520,8 +63755,8 @@ function syncFlushOnExit() {
62520
63755
  var BUFFER_MAX_BYTES, CLAUDISH_DIR, BUFFER_FILE, memoryCache = null, eventsSinceLastFlush = 0, flushScheduled = false, SIGNAL_EXIT_CODE;
62521
63756
  var init_stats_buffer = __esm(() => {
62522
63757
  BUFFER_MAX_BYTES = 64 * 1024;
62523
- CLAUDISH_DIR = join34(homedir32(), ".claudish");
62524
- BUFFER_FILE = join34(CLAUDISH_DIR, "stats-buffer.json");
63758
+ CLAUDISH_DIR = join35(homedir33(), ".claudish");
63759
+ BUFFER_FILE = join35(CLAUDISH_DIR, "stats-buffer.json");
62525
63760
  process.on("exit", syncFlushOnExit);
62526
63761
  SIGNAL_EXIT_CODE = { SIGTERM: 143, SIGINT: 130 };
62527
63762
  for (const signal of ["SIGTERM", "SIGINT"]) {
@@ -63777,402 +65012,6 @@ var init_devin_stream_head_sniffer = __esm(() => {
63777
65012
  QUOTA_MESSAGE_RE = /quota|out of credits|credit balance|billing|plan limit|exceeded your/i;
63778
65013
  });
63779
65014
 
63780
- // src/handlers/shared/format/identity-filter.ts
63781
- function removeBackgroundInfo(text) {
63782
- let start = text.indexOf(BACKGROUND_OPEN);
63783
- if (start === -1)
63784
- return text;
63785
- let out = "";
63786
- let done = 0;
63787
- while (start !== -1) {
63788
- const end = text.indexOf(BACKGROUND_CLOSE, start + BACKGROUND_OPEN.length);
63789
- if (end === -1)
63790
- break;
63791
- out += text.slice(done, start);
63792
- done = end + BACKGROUND_CLOSE.length;
63793
- start = text.indexOf(BACKGROUND_OPEN, done);
63794
- }
63795
- return out + text.slice(done);
63796
- }
63797
- function rangesOf(text, spans) {
63798
- return [...text.matchAll(spans)].map((m) => [m.index, m.index + m[0].length]);
63799
- }
63800
- function merged(ranges) {
63801
- if (ranges.length < 2)
63802
- return ranges;
63803
- const sorted = [...ranges].sort((a, b) => a[0] - b[0]);
63804
- const out = [sorted[0]];
63805
- for (const [from, to] of sorted.slice(1)) {
63806
- const last = out[out.length - 1];
63807
- if (from <= last[1])
63808
- last[1] = Math.max(last[1], to);
63809
- else
63810
- out.push([from, to]);
63811
- }
63812
- return out;
63813
- }
63814
- function inside(ranges, at) {
63815
- let low = 0;
63816
- let high = ranges.length - 1;
63817
- while (low <= high) {
63818
- const mid = low + high >> 1;
63819
- if (at < ranges[mid][0])
63820
- high = mid - 1;
63821
- else if (at >= ranges[mid][1])
63822
- low = mid + 1;
63823
- else
63824
- return true;
63825
- }
63826
- return false;
63827
- }
63828
- function inlineCodeRanges(text, fences) {
63829
- if (!text.includes("`"))
63830
- return [];
63831
- const out = [];
63832
- let runs = [];
63833
- const closeLine = () => {
63834
- if (runs.length > 1) {
63835
- const next = new Array(runs.length).fill(-1);
63836
- const seen = new Map;
63837
- for (let k = runs.length - 1;k >= 0; k--) {
63838
- next[k] = seen.get(runs[k][1]) ?? -1;
63839
- seen.set(runs[k][1], k);
63840
- }
63841
- for (let k = 0;k < runs.length; ) {
63842
- const close = next[k];
63843
- if (close === -1) {
63844
- k++;
63845
- } else {
63846
- out.push([runs[k][0], runs[close][0] + runs[close][1]]);
63847
- k = close + 1;
63848
- }
63849
- }
63850
- }
63851
- runs = [];
63852
- };
63853
- for (let at = 0;at < text.length; at++) {
63854
- const char = text.charCodeAt(at);
63855
- if (char === 10) {
63856
- closeLine();
63857
- } else if (char === 96) {
63858
- let end = at + 1;
63859
- while (end < text.length && text.charCodeAt(end) === 96)
63860
- end++;
63861
- if (!inside(fences, at))
63862
- runs.push([at, end - at]);
63863
- at = end - 1;
63864
- }
63865
- }
63866
- closeLine();
63867
- return out;
63868
- }
63869
- function stringRanges(text) {
63870
- if (!text.includes('"'))
63871
- return [];
63872
- const out = [];
63873
- let open = -1;
63874
- for (let at = 0;at < text.length; at++) {
63875
- const char = text.charCodeAt(at);
63876
- if (char === 10) {
63877
- open = -1;
63878
- } else if (open === -1) {
63879
- if (char === 34)
63880
- open = at;
63881
- } else if (char === 92) {
63882
- if (text.charCodeAt(at + 1) !== 10)
63883
- at++;
63884
- } else if (char === 34) {
63885
- out.push([open, at + 1]);
63886
- open = -1;
63887
- }
63888
- }
63889
- return out;
63890
- }
63891
- function codeRanges(text) {
63892
- const fences = merged(rangesOf(text, FENCE_RE));
63893
- return merged([...fences, ...inlineCodeRanges(text, fences)]);
63894
- }
63895
- function literalRanges(text) {
63896
- return merged([...codeRanges(text), ...stringRanges(text)]);
63897
- }
63898
- function replaceOutside(text, ranges, rule, replacer) {
63899
- return text.replace(rule, (match, ...rest) => {
63900
- const offsetAt = rest.findIndex((arg) => typeof arg === "number");
63901
- const offset = rest[offsetAt];
63902
- if (inside(ranges, offset))
63903
- return match;
63904
- return replacer(match, offset, rest.slice(0, offsetAt));
63905
- });
63906
- }
63907
- function renameReader(text) {
63908
- if (!text.includes("Claude"))
63909
- return text;
63910
- return replaceOutside(text, literalRanges(text), READER_CLAUDE, (match, offset) => {
63911
- const name = SENTENCE_START.test(text.slice(Math.max(0, offset - 16), offset)) ? READER_NAME[0].toUpperCase() + READER_NAME.slice(1) : READER_NAME;
63912
- return name + match.slice("Claude".length);
63913
- });
63914
- }
63915
- function scrubText(text) {
63916
- let out = text;
63917
- for (const rule of SENTENCE_RULES)
63918
- out = out.replace(rule, "");
63919
- out = removeBackgroundInfo(out);
63920
- for (const rule of LINE_RULES)
63921
- out = out.replace(rule, "");
63922
- for (const [rule, to] of RENAMES)
63923
- out = replaceOutside(out, literalRanges(out), rule, to);
63924
- return renameReader(out);
63925
- }
63926
- function stripKnownHead(text) {
63927
- for (const head of KNOWN_HEADS) {
63928
- if (text.startsWith(head))
63929
- return { body: text.slice(head.length).trimStart(), hadHead: true };
63930
- }
63931
- return { body: text, hadHead: false };
63932
- }
63933
- function filterIdentity(content, head) {
63934
- const hadIdentity = IDENTITY_OPENER.test(content);
63935
- const scrubbed = scrubText(content).replace(/\n{3,}/g, `
63936
-
63937
- `).trimStart();
63938
- const { body, hadHead } = stripKnownHead(scrubbed);
63939
- if (!hadIdentity && !hadHead)
63940
- return scrubbed;
63941
- if (head === undefined && hadHead)
63942
- return scrubbed;
63943
- const chosen = head ?? NEUTRAL_IDENTITY_HEAD;
63944
- return body ? `${chosen}
63945
-
63946
- ${body}` : chosen;
63947
- }
63948
- function indexOutsideCode(text, needle, from, code) {
63949
- for (let at = text.indexOf(needle, from);at !== -1; at = text.indexOf(needle, at + 1)) {
63950
- if (!inside(code, at))
63951
- return at;
63952
- }
63953
- return -1;
63954
- }
63955
- function closingTagAt(text, start, open, close, inlineCode) {
63956
- let depth = 0;
63957
- let at = start;
63958
- for (;; ) {
63959
- const nextClose = indexOutsideCode(text, close, at, inlineCode);
63960
- if (nextClose === -1)
63961
- return -1;
63962
- const nextOpen = indexOutsideCode(text, open, at, inlineCode);
63963
- if (nextOpen !== -1 && nextOpen < nextClose) {
63964
- depth++;
63965
- at = nextOpen + open.length;
63966
- continue;
63967
- }
63968
- depth--;
63969
- if (depth === 0)
63970
- return nextClose;
63971
- at = nextClose + close.length;
63972
- }
63973
- }
63974
- function scrubTagged(text, tag) {
63975
- const open = `<${tag}>`;
63976
- const close = `</${tag}>`;
63977
- if (!text.includes(open))
63978
- return text;
63979
- const code = codeRanges(text);
63980
- const inlineCode = merged(inlineCodeRanges(text, []));
63981
- let out = "";
63982
- let done = 0;
63983
- for (;; ) {
63984
- const start = indexOutsideCode(text, open, done, code);
63985
- if (start === -1)
63986
- break;
63987
- const end = closingTagAt(text, start, open, close, inlineCode);
63988
- if (end === -1)
63989
- break;
63990
- const stop = end + close.length;
63991
- out += text.slice(done, start) + scrubText(text.slice(start, stop));
63992
- done = stop;
63993
- }
63994
- return out + text.slice(done);
63995
- }
63996
- function scrubInjectedSpans(text) {
63997
- if (!MAY_HOLD_SPAN.test(text))
63998
- return text;
63999
- let out = text;
64000
- for (const tag of INJECTED_TAGS)
64001
- out = scrubTagged(out, tag);
64002
- for (const line of INJECTED_LINES)
64003
- out = replaceOutside(out, codeRanges(out), line, scrubText);
64004
- return out;
64005
- }
64006
- function systemTextOf2(system) {
64007
- if (typeof system === "string")
64008
- return system;
64009
- if (!Array.isArray(system))
64010
- return "";
64011
- return system.map((item) => typeof item === "string" ? item : item?.text ?? "").filter((text) => text.trim() !== "").join(`
64012
-
64013
- `);
64014
- }
64015
- function scrubSchema(schema) {
64016
- if (Array.isArray(schema))
64017
- return schema.map(scrubSchema);
64018
- if (!schema || typeof schema !== "object")
64019
- return schema;
64020
- const out = {};
64021
- for (const [key, value] of Object.entries(schema)) {
64022
- if (key === "description" && typeof value === "string")
64023
- out[key] = scrubText(value);
64024
- else if (SCHEMA_VALUE_KEYS.has(key))
64025
- out[key] = value;
64026
- else if (SCHEMA_NAME_MAPS.has(key))
64027
- out[key] = scrubNamedSchemas(value);
64028
- else
64029
- out[key] = scrubSchema(value);
64030
- }
64031
- return out;
64032
- }
64033
- function scrubNamedSchemas(map) {
64034
- if (!map || typeof map !== "object" || Array.isArray(map))
64035
- return map;
64036
- const out = {};
64037
- for (const [name, schema] of Object.entries(map))
64038
- out[name] = scrubSchema(schema);
64039
- return out;
64040
- }
64041
- function scrubToolDefinition(tool) {
64042
- if (!tool || typeof tool !== "object")
64043
- return tool;
64044
- const out = { ...tool };
64045
- if (typeof tool.description === "string")
64046
- out.description = scrubText(tool.description);
64047
- if (tool.input_schema)
64048
- out.input_schema = scrubSchema(tool.input_schema);
64049
- return out;
64050
- }
64051
- function scrubUserContent(content) {
64052
- if (typeof content === "string")
64053
- return scrubInjectedSpans(content);
64054
- if (!Array.isArray(content))
64055
- return content;
64056
- return content.map((block) => block?.type === "text" && typeof block.text === "string" ? { ...block, text: scrubInjectedSpans(block.text) } : block);
64057
- }
64058
- function scrubSystemContent(content) {
64059
- if (typeof content === "string")
64060
- return scrubText(content);
64061
- if (!Array.isArray(content))
64062
- return content;
64063
- return content.map((block) => {
64064
- if (block?.type === "text" && typeof block.text === "string") {
64065
- return { ...block, text: scrubText(block.text) };
64066
- }
64067
- if (block?.type === "tool_addition" && block.tool?.definition) {
64068
- return {
64069
- ...block,
64070
- tool: { ...block.tool, definition: scrubToolDefinition(block.tool.definition) }
64071
- };
64072
- }
64073
- return block;
64074
- });
64075
- }
64076
- function scrubSystem(system, head, hadIdentity) {
64077
- if (typeof system === "string") {
64078
- const body = collapse(scrubText(system));
64079
- if (!hadIdentity)
64080
- return body;
64081
- return body ? `${head}
64082
-
64083
- ${body}` : head;
64084
- }
64085
- if (Array.isArray(system)) {
64086
- const blocks = system.map((b) => typeof b === "string" ? { type: "text", text: b } : b).map((b) => b?.type === "text" && typeof b.text === "string" ? { ...b, text: collapse(scrubText(b.text)) } : b).filter((b) => !(b?.type === "text" && (b.text ?? "").trim() === ""));
64087
- if (hadIdentity)
64088
- blocks.unshift({ type: "text", text: head });
64089
- return blocks;
64090
- }
64091
- return hadIdentity ? head : system;
64092
- }
64093
- function scrubHarnessIdentity(req, head) {
64094
- const out = { ...req };
64095
- const hadIdentity = IDENTITY_OPENER.test(systemTextOf2(req.system));
64096
- out.system = scrubSystem(req.system, head, hadIdentity);
64097
- if (Array.isArray(req.tools))
64098
- out.tools = req.tools.map(scrubToolDefinition);
64099
- if (Array.isArray(req.messages)) {
64100
- out.messages = req.messages.map((msg) => {
64101
- if (msg?.role === "user")
64102
- return { ...msg, content: scrubUserContent(msg.content) };
64103
- if (msg?.role === "system")
64104
- return { ...msg, content: scrubSystemContent(msg.content) };
64105
- return msg;
64106
- });
64107
- }
64108
- return out;
64109
- }
64110
- function identityHeadFor(providerName) {
64111
- return providerName === "antigravity" ? ANTIGRAVITY_IDENTITY_HEAD : NEUTRAL_IDENTITY_HEAD;
64112
- }
64113
- function keepsClaudeIdentity(route) {
64114
- if (route.vendor)
64115
- return route.vendor.toLowerCase() === "anthropic";
64116
- if (route.native)
64117
- return true;
64118
- return /(^|[/.])claude-/i.test(route.model);
64119
- }
64120
- var NEUTRAL_IDENTITY_HEAD = "You are an AI coding agent working in a command-line agent harness. If asked who you are, name your actual model and the company that made it.", ANTIGRAVITY_IDENTITY_HEAD, KNOWN_HEADS, HARNESS_NAME = "Agent CLI", LINE_RULES, SENTENCE_RULES, BACKGROUND_OPEN = "<claude_background_info>", BACKGROUND_CLOSE = "</claude_background_info>", FENCE_OPEN, FENCE_CLOSE, FENCE, FENCE_RE, HARNESS_IN_PROSE, RENAMES, READER_NAME = "the assistant", READER_CLAUDE, SENTENCE_START, IDENTITY_OPENER, INJECTED_TAGS, INJECTED_LINES, MAY_HOLD_SPAN, SCHEMA_VALUE_KEYS, SCHEMA_NAME_MAPS, collapse = (text) => text.replace(/\n{3,}/g, `
64121
-
64122
- `).trimStart();
64123
- var init_identity_filter = __esm(() => {
64124
- ANTIGRAVITY_IDENTITY_HEAD = [
64125
- "You are Antigravity, a powerful agentic AI coding assistant designed by the Google Deepmind team working on Advanced Agentic Coding.",
64126
- "You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question."
64127
- ].join(`
64128
- `);
64129
- KNOWN_HEADS = [NEUTRAL_IDENTITY_HEAD, ANTIGRAVITY_IDENTITY_HEAD];
64130
- LINE_RULES = [
64131
- /^[ \t]*(?:-[ \t]+)?The most recent Claude models are[^\n]*(?:\n|$)/gm,
64132
- /^[ \t]*(?:-[ \t]+)?Claude Code is available as a CLI[^\n]*(?:\n|$)/gm,
64133
- /^[ \t]*(?:-[ \t]+)?Fast mode for Claude Code[^\n]*(?:\n|$)/gm
64134
- ];
64135
- SENTENCE_RULES = [
64136
- /You are Claude Code, Anthropic's official CLI(?:[^\n]{0,300}?\.(?=\s|$|<)|[^.\n]{0,300})/g,
64137
- /You are a Claude agent, built on Anthropic's Claude Agent SDK\.?/g,
64138
- /You are powered by the model named [^\n]{0,300}?\.(?=\s|$|<)/g,
64139
- /The exact model ID is [^\s<]{1,200}?\.(?=\s|$|<)/g,
64140
- /Assistant knowledge cutoff is [^\n]{0,300}?\.(?=\s|$|<)/g
64141
- ];
64142
- FENCE_OPEN = String.raw`^(?:[ \t]*(?:>|[-*+][ \t]|\d+[.)][ \t]))*[ \t]*((\x60|~)\2{2,})[^\n]*`;
64143
- FENCE_CLOSE = String.raw`^(?:[ \t]*>)*[ \t]*\1\2*[ \t]*$`;
64144
- FENCE = String.raw`${FENCE_OPEN}(?:\n[\s\S]*?(?:${FENCE_CLOSE}|(?![\s\S]))|(?![\s\S]))`;
64145
- FENCE_RE = new RegExp(FENCE, "gm");
64146
- HARNESS_IN_PROSE = /(?<![\w/\\"'`.-])Claude Code(?![\w"`/\\]|'(?!s\b)|\.\w)/g;
64147
- RENAMES = [
64148
- [/ ?\(claude\.ai\/code\)/g, () => ""],
64149
- [HARNESS_IN_PROSE, () => HARNESS_NAME],
64150
- [/\bClaude (sessions?)\b/g, (_match, _offset, groups) => `${HARNESS_NAME} ${groups[0]}`]
64151
- ];
64152
- READER_CLAUDE = new RegExp([
64153
- String.raw`(?<![\w/\\.@"'\x60-])`,
64154
- String.raw`(?<!\b(?:a|an|the|other|another|internal|each|every|any|your|real)\s)`,
64155
- String.raw`Claude(?:['\u2019]s)?`,
64156
- String.raw`(?![\w/\\'\u2019"\x60-])`,
64157
- String.raw`(?!\s*=)`,
64158
- String.raw`(?!\.\w)`,
64159
- String.raw`(?!\.\.\.)`,
64160
- String.raw`(?!,\s+[A-Z])`,
64161
- String.raw`(?!\s+(?:[A-Z\d]|in\s+(?:Chrome|Slack)\b|(?:models?|desktop|login|account|subscription|family|apps?|plans?)\b))`
64162
- ].join(""), "g");
64163
- SENTENCE_START = /(?:[.!?]["')\]*]*\s+|(?:^|\n)[ \t]*(?:(?:[-*\u2022]|\d+\.)[ \t]+)?(?:\*\*)?)$/;
64164
- IDENTITY_OPENER = /You are Claude Code, Anthropic's official CLI|You are a Claude agent, built on Anthropic's Claude Agent SDK/;
64165
- INJECTED_TAGS = ["system-reminder", "local-command-caveat"];
64166
- INJECTED_LINES = [
64167
- /^This is how Claude Code surfaces (?:messages the user sends mid-turn|a prompt a plugin submits between turns)[^\n]*$/gm,
64168
- /^Another Claude session sent a message:[ \t]*$/gm,
64169
- /^This came from another Claude session[^\n]*$/gm
64170
- ];
64171
- MAY_HOLD_SPAN = /<system-reminder>|<local-command-caveat>|Claude/;
64172
- SCHEMA_VALUE_KEYS = new Set(["enum", "const", "default", "examples"]);
64173
- SCHEMA_NAME_MAPS = new Set(["properties", "patternProperties", "$defs", "definitions"]);
64174
- });
64175
-
64176
65015
  // src/handlers/shared/format/inline-system.ts
64177
65016
  function systemTextOf3(content) {
64178
65017
  if (typeof content === "string")
@@ -64406,6 +65245,7 @@ var init_provider_refused_text = __esm(() => {
64406
65245
  });
64407
65246
 
64408
65247
  // src/handlers/shared/format/tool-name-alias.ts
65248
+ import { existsSync as existsSync24 } from "fs";
64409
65249
  function renameKeys(args, names) {
64410
65250
  const out = {};
64411
65251
  for (const [key, value] of Object.entries(args))
@@ -64431,6 +65271,50 @@ function readRangeFromWire(args) {
64431
65271
  }
64432
65272
  return out;
64433
65273
  }
65274
+ function questionsToWire(args) {
65275
+ if (!Array.isArray(args.questions))
65276
+ return args;
65277
+ return {
65278
+ ...args,
65279
+ questions: args.questions.map((question) => {
65280
+ if (!isRecord5(question))
65281
+ return question;
65282
+ const out = { question: question.question };
65283
+ if (Array.isArray(question.options)) {
65284
+ out.options = question.options.map((option) => isRecord5(option) ? option.label : option);
65285
+ }
65286
+ if (typeof question.multiSelect === "boolean")
65287
+ out.is_multi_select = question.multiSelect;
65288
+ return out;
65289
+ })
65290
+ };
65291
+ }
65292
+ function questionsFromWire(args) {
65293
+ if (!Array.isArray(args.questions))
65294
+ return args;
65295
+ return {
65296
+ ...args,
65297
+ questions: args.questions.map((question, index) => {
65298
+ if (!isRecord5(question))
65299
+ return question;
65300
+ return {
65301
+ question: question.question,
65302
+ header: typeof question.header === "string" ? question.header : `Question ${index + 1}`,
65303
+ options: Array.isArray(question.options) ? question.options.map((option) => typeof option === "string" ? { label: option, description: option } : option) : question.options,
65304
+ multiSelect: typeof question.multiSelect === "boolean" ? question.multiSelect : question.is_multi_select === true
65305
+ };
65306
+ })
65307
+ };
65308
+ }
65309
+ function leftAsSent(wireName, args) {
65310
+ if (wireName === "read_file")
65311
+ return typeof args.ByteOffset === "number" && args.ByteOffset > 0;
65312
+ if (wireName !== "write_file")
65313
+ return false;
65314
+ if (args.Append === true)
65315
+ return true;
65316
+ return args.Overwrite !== true && typeof args.Path === "string" && existsSync24(args.Path);
65317
+ }
64434
65318
  function schemaToWire(schema, native, names) {
64435
65319
  if (!isRecord5(schema) || !isRecord5(schema.properties))
64436
65320
  return schema;
@@ -64468,6 +65352,9 @@ function aliasToolsForProvider(req, providerName) {
64468
65352
  };
64469
65353
  }
64470
65354
  const argumentTables = PROVIDER_ARGUMENT_ALIASES[providerName] ?? {};
65355
+ const descriptionOf = PROVIDER_DESCRIPTIONS[providerName] ?? (() => {
65356
+ return;
65357
+ });
64471
65358
  const declared = new Set(Array.isArray(req.tools) ? req.tools.map((tool) => tool?.name) : []);
64472
65359
  const forward = new Map;
64473
65360
  const backward = new Map;
@@ -64491,14 +65378,14 @@ function aliasToolsForProvider(req, providerName) {
64491
65378
  if (!names || !isRecord5(args))
64492
65379
  return args;
64493
65380
  const renamed = renameKeys(args, names);
64494
- return native === "read_file" ? readRangeToWire(renamed) : renamed;
65381
+ return AGY_ARGUMENT_SHAPE[native]?.toWire?.(renamed) ?? renamed;
64495
65382
  };
64496
65383
  const restoreArguments = (wireName, args) => {
64497
65384
  const names = fromWire.get(wireName);
64498
- if (!names || !isRecord5(args))
65385
+ if (!names || !isRecord5(args) || leftAsSent(wireName, args))
64499
65386
  return args;
64500
65387
  const renamed = renameKeys(args, names);
64501
- return wireName === "read_file" ? readRangeFromWire(renamed) : renamed;
65388
+ return AGY_ARGUMENT_SHAPE[wireName]?.fromWire?.(renamed) ?? renamed;
64502
65389
  };
64503
65390
  const out = { ...req };
64504
65391
  if (Array.isArray(req.tools)) {
@@ -64507,7 +65394,9 @@ function aliasToolsForProvider(req, providerName) {
64507
65394
  if (native === undefined)
64508
65395
  return tool;
64509
65396
  const names = toWire.get(native);
64510
- return names && "input_schema" in tool ? { ...tool, name: native, input_schema: schemaToWire(tool.input_schema, native, names) } : { ...tool, name: native };
65397
+ const renamed = names && "input_schema" in tool ? { ...tool, name: native, input_schema: schemaToWire(tool.input_schema, native, names) } : { ...tool, name: native };
65398
+ const description = descriptionOf(native);
65399
+ return description === undefined ? renamed : { ...renamed, description };
64511
65400
  });
64512
65401
  }
64513
65402
  const choice = req.tool_choice;
@@ -64524,18 +65413,22 @@ function aliasToolsForProvider(req, providerName) {
64524
65413
  restoreArguments
64525
65414
  };
64526
65415
  }
64527
- var AGY_TOOL_ALIAS, PROVIDER_ALIASES, AGY_ARGUMENT_ALIAS, PROVIDER_ARGUMENT_ALIASES, isRecord5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), READ_RANGE_PROPERTIES, identity = (name) => name;
65416
+ var AGY_TOOL_ALIAS, PROVIDER_ALIASES, AGY_ARGUMENT_ALIAS, PROVIDER_DESCRIPTIONS, PROVIDER_ARGUMENT_ALIASES, isRecord5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), without = (args, ...names) => {
65417
+ const out = { ...args };
65418
+ for (const name of names)
65419
+ delete out[name];
65420
+ return out;
65421
+ }, AGY_ARGUMENT_SHAPE, READ_RANGE_PROPERTIES, identity = (name) => name;
64528
65422
  var init_tool_name_alias = __esm(() => {
65423
+ init_antigravity_agy_request2();
64529
65424
  AGY_TOOL_ALIAS = [
64530
65425
  ["Bash", "run_command"],
64531
65426
  ["Read", "read_file"],
64532
65427
  ["Write", "write_file"],
64533
65428
  ["Edit", "edit_file"],
64534
- ["Agent", "invoke_subagent"],
64535
65429
  ["AskUserQuestion", "ask_question"],
64536
65430
  ["WebSearch", "search_web"],
64537
65431
  ["SendMessage", "send_message"],
64538
- ["Workflow", "run_workflow"],
64539
65432
  ["Grep", "grep_search"],
64540
65433
  ["Glob", "find_by_name"],
64541
65434
  ["LS", "list_dir"]
@@ -64558,11 +65451,40 @@ var init_tool_name_alias = __esm(() => {
64558
65451
  ["file_path", "Path"],
64559
65452
  ["old_string", "Target"],
64560
65453
  ["new_string", "Replacement"]
64561
- ]
65454
+ ],
65455
+ send_message: [
65456
+ ["to", "Recipient"],
65457
+ ["message", "Message"]
65458
+ ],
65459
+ search_web: [],
65460
+ ask_question: []
65461
+ };
65462
+ PROVIDER_DESCRIPTIONS = {
65463
+ antigravity: (native) => (native in AGY_ARGUMENT_ALIAS) ? agyDeclarationTemplate(native)?.description : undefined
64562
65464
  };
64563
65465
  PROVIDER_ARGUMENT_ALIASES = {
64564
65466
  antigravity: AGY_ARGUMENT_ALIAS
64565
65467
  };
65468
+ AGY_ARGUMENT_SHAPE = {
65469
+ run_command: { fromWire: (args) => without(args, "WaitMsBeforeAsync") },
65470
+ read_file: {
65471
+ toWire: readRangeToWire,
65472
+ fromWire: (args) => readRangeFromWire(without(args, "ByteOffset"))
65473
+ },
65474
+ write_file: { fromWire: (args) => without(args, "Overwrite", "Append", "ArtifactMetadata") },
65475
+ edit_file: {
65476
+ toWire: (args) => without(args, "replace_all"),
65477
+ fromWire: (args) => ({
65478
+ ...without(args, "ArtifactMetadata"),
65479
+ replace_all: typeof args.replace_all === "boolean" ? args.replace_all : true
65480
+ })
65481
+ },
65482
+ search_web: {
65483
+ toWire: (args) => without(args, "allowed_domains", "blocked_domains"),
65484
+ fromWire: (args) => without(args, "domain")
65485
+ },
65486
+ ask_question: { toWire: questionsToWire, fromWire: questionsFromWire }
65487
+ };
64566
65488
  READ_RANGE_PROPERTIES = {
64567
65489
  StartLine: { type: "integer", description: "The first line to read, counted from 1." },
64568
65490
  EndLine: { type: "integer", description: "The last line to read, counted from 1." }
@@ -68793,7 +69715,7 @@ var init_openai_responses_sse = __esm(() => {
68793
69715
  });
68794
69716
 
68795
69717
  // src/session/token-file.ts
68796
- import { join as join35 } from "path";
69718
+ import { join as join36 } from "path";
68797
69719
  function assignedTokenFile(env) {
68798
69720
  const f = env.CLAUDISH_TOKEN_FILE;
68799
69721
  if (!f || f === env.CLAUDISH_PUBLISHED_TOKEN_FILE)
@@ -68801,7 +69723,7 @@ function assignedTokenFile(env) {
68801
69723
  return f;
68802
69724
  }
68803
69725
  function resolveTokenFilePath(port, env = process.env) {
68804
- return assignedTokenFile(env) ?? join35(userHomeFrom(env), ".claudish", `tokens-${port}.json`);
69726
+ return assignedTokenFile(env) ?? join36(userHomeFrom(env), ".claudish", `tokens-${port}.json`);
68805
69727
  }
68806
69728
  var init_token_file = __esm(() => {
68807
69729
  init_home_dir();
@@ -71408,11 +72330,11 @@ var init_composed_handler = __esm(() => {
71408
72330
  });
71409
72331
 
71410
72332
  // src/providers/api-key-provenance.ts
71411
- import { existsSync as existsSync24, readFileSync as readFileSync33 } from "fs";
71412
- import { homedir as homedir33 } from "os";
71413
- import { join as join36, resolve as resolve4 } from "path";
72333
+ import { existsSync as existsSync25, readFileSync as readFileSync33 } from "fs";
72334
+ import { homedir as homedir34 } from "os";
72335
+ import { join as join37, resolve as resolve4 } from "path";
71414
72336
  function activeConfigPath() {
71415
- return activeGlobalConfigFile(join36(homedir33(), ".claudish", "config.json"));
72337
+ return activeGlobalConfigFile(join37(homedir34(), ".claudish", "config.json"));
71416
72338
  }
71417
72339
  function configLayerLabel() {
71418
72340
  return getConfigFileOverride() ? activeConfigPath() : "~/.claudish/config.json";
@@ -71568,7 +72490,7 @@ function formatProvenanceLog(p) {
71568
72490
  function readDotenvKey(envVars) {
71569
72491
  try {
71570
72492
  const dotenvPath = resolve4(".env");
71571
- if (!existsSync24(dotenvPath))
72493
+ if (!existsSync25(dotenvPath))
71572
72494
  return null;
71573
72495
  const parsed = readAllowedDotenv(readFileSync33(dotenvPath, "utf-8"));
71574
72496
  for (const v of envVars) {
@@ -71583,7 +72505,7 @@ function readDotenvKey(envVars) {
71583
72505
  function readConfigKey(envVar) {
71584
72506
  try {
71585
72507
  const configPath = activeConfigPath();
71586
- if (!existsSync24(configPath))
72508
+ if (!existsSync25(configPath))
71587
72509
  return null;
71588
72510
  const cfg = JSON.parse(readFileSync33(configPath, "utf-8"));
71589
72511
  return realValueFor(envVar, cfg.apiKeys?.[envVar]) || null;
@@ -86400,9 +87322,9 @@ function compareByConnectionPrice(a, b) {
86400
87322
  }
86401
87323
 
86402
87324
  // src/providers/probe-catalog.ts
86403
- import { existsSync as existsSync25, mkdirSync as mkdirSync19, readFileSync as readFileSync34, writeFileSync as writeFileSync14 } from "fs";
86404
- import { homedir as homedir34 } from "os";
86405
- import { dirname as dirname16, join as join37 } from "path";
87325
+ import { existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync34, writeFileSync as writeFileSync14 } from "fs";
87326
+ import { homedir as homedir35 } from "os";
87327
+ import { dirname as dirname16, join as join38 } from "path";
86406
87328
  function describeProbeCatalogFailure(outcome) {
86407
87329
  switch (outcome.kind) {
86408
87330
  case "incompatible":
@@ -86418,7 +87340,7 @@ function describeProbeCatalogFailure(outcome) {
86418
87340
  }
86419
87341
  }
86420
87342
  function readProbeModelsCache(path = PROBE_MODELS_CACHE_PATH) {
86421
- if (!existsSync25(path))
87343
+ if (!existsSync26(path))
86422
87344
  return null;
86423
87345
  let raw;
86424
87346
  try {
@@ -86574,7 +87496,7 @@ var init_probe_catalog = __esm(() => {
86574
87496
  init_catalog_endpoints();
86575
87497
  init_catalog_route_bindings();
86576
87498
  CACHE_TTL_MS4 = 60 * 60 * 1000;
86577
- PROBE_MODELS_CACHE_PATH = join37(homedir34(), ".claudish", "probe-models.json");
87499
+ PROBE_MODELS_CACHE_PATH = join38(homedir35(), ".claudish", "probe-models.json");
86578
87500
  });
86579
87501
 
86580
87502
  // src/providers/route-candidates.ts
@@ -88462,8 +89384,8 @@ function herdrPaneEnv(env = process.env) {
88462
89384
 
88463
89385
  // src/auth/claude-code-login.ts
88464
89386
  import { spawnSync as spawnSync2 } from "child_process";
88465
- import { existsSync as existsSync26, readFileSync as readFileSync35 } from "fs";
88466
- import { join as join38 } from "path";
89387
+ import { existsSync as existsSync27, readFileSync as readFileSync35 } from "fs";
89388
+ import { join as join39 } from "path";
88467
89389
  function keychainLoginPresent(env, presence, cwd = process.cwd()) {
88468
89390
  return anyPresent(claudeCodeSecureStorageServices("-credentials", env, cwd), presence) === "found";
88469
89391
  }
@@ -88473,8 +89395,8 @@ function hasClaudeCodeLogin(deps = {}) {
88473
89395
  const token = env.CLAUDE_CODE_OAUTH_TOKEN;
88474
89396
  if (typeof token === "string" && token.trim().length > 0)
88475
89397
  return true;
88476
- const fileExists = deps.fileExists ?? existsSync26;
88477
- if (fileExists(join38(claudeCodeConfigDir(env, cwd), ".credentials.json")))
89398
+ const fileExists = deps.fileExists ?? existsSync27;
89399
+ if (fileExists(join39(claudeCodeConfigDir(env, cwd), ".credentials.json")))
88478
89400
  return true;
88479
89401
  return (deps.keychainProbe ?? defaultKeychainAnthropicProbe)(env, cwd);
88480
89402
  }
@@ -88501,13 +89423,13 @@ function defaultKeychainPresence(service) {
88501
89423
  function claudeCodeStartupCredential(deps = {}) {
88502
89424
  const env = deps.env ?? process.env;
88503
89425
  const cwd = deps.cwd ?? process.cwd();
88504
- const fileExists = deps.fileExists ?? existsSync26;
89426
+ const fileExists = deps.fileExists ?? existsSync27;
88505
89427
  const readFile = deps.readFile ?? ((path) => readFileSync35(path, "utf-8"));
88506
89428
  const presence = deps.keychainPresence ?? defaultKeychainPresence;
88507
89429
  const token = env.CLAUDE_CODE_OAUTH_TOKEN;
88508
89430
  if (typeof token === "string" && token.trim().length > 0)
88509
89431
  return { kind: "login" };
88510
- if (fileExists(join38(claudeCodeConfigDir(env, cwd), ".credentials.json"))) {
89432
+ if (fileExists(join39(claudeCodeConfigDir(env, cwd), ".credentials.json"))) {
88511
89433
  return { kind: "login" };
88512
89434
  }
88513
89435
  const oauth = anyPresent(claudeCodeSecureStorageServices("-credentials", env, cwd), presence);
@@ -89742,7 +90664,7 @@ var init_own_pane = () => {};
89742
90664
 
89743
90665
  // src/pane/prompt-delivery.ts
89744
90666
  import { writeFileSync as writeFileSync15 } from "fs";
89745
- import { join as join39 } from "path";
90667
+ import { join as join40 } from "path";
89746
90668
  function stripControl(s) {
89747
90669
  let out = "";
89748
90670
  for (const ch of s) {
@@ -89809,7 +90731,7 @@ function renderTurnFile(text, limit = READ_LINE_LIMIT) {
89809
90731
  `), lines: out.length, marker };
89810
90732
  }
89811
90733
  function turnFilePath(turnDir, turnIndex) {
89812
- return join39(turnDir, `turn-${turnIndex}.md`);
90734
+ return join40(turnDir, `turn-${turnIndex}.md`);
89813
90735
  }
89814
90736
  function fileTemplate(file, marker) {
89815
90737
  const base = `Your task is in the file \`${file}\`. Read all of it with the Read tool (in parts if it is long), then do exactly what it says, treating its content as the user's message.`;
@@ -90812,7 +91734,7 @@ var init_subagent_ledger = __esm(() => {
90812
91734
  // src/pane/transcript-follower.ts
90813
91735
  import {
90814
91736
  closeSync as closeSync11,
90815
- existsSync as existsSync27,
91737
+ existsSync as existsSync28,
90816
91738
  fstatSync as fstatSync3,
90817
91739
  openSync as openSync11,
90818
91740
  readFileSync as readFileSync36,
@@ -90821,7 +91743,7 @@ import {
90821
91743
  realpathSync as realpathSync5,
90822
91744
  statSync as statSync13
90823
91745
  } from "fs";
90824
- import { join as join40 } from "path";
91746
+ import { join as join41 } from "path";
90825
91747
  function initialFollowerState(resolvePath = safeRealpath) {
90826
91748
  return {
90827
91749
  turns: [],
@@ -91390,7 +92312,7 @@ class TranscriptFollower {
91390
92312
  return any;
91391
92313
  }
91392
92314
  subagentEntries() {
91393
- if (!existsSync27(this.subagentsDir))
92315
+ if (!existsSync28(this.subagentsDir))
91394
92316
  return [];
91395
92317
  try {
91396
92318
  return readdirSync6(this.subagentsDir);
@@ -91406,7 +92328,7 @@ class TranscriptFollower {
91406
92328
  continue;
91407
92329
  let tail = this.subs.get(f);
91408
92330
  if (!tail) {
91409
- tail = new Tail(join40(this.subagentsDir, f));
92331
+ tail = new Tail(join41(this.subagentsDir, f));
91410
92332
  this.subs.set(f, tail);
91411
92333
  }
91412
92334
  const agentId = AGENT_FILE_RE.exec(f)?.[1];
@@ -91425,7 +92347,7 @@ class TranscriptFollower {
91425
92347
  return any;
91426
92348
  }
91427
92349
  readMeta(name, agentId) {
91428
- const path = join40(this.subagentsDir, name);
92350
+ const path = join41(this.subagentsDir, name);
91429
92351
  let mtime;
91430
92352
  try {
91431
92353
  mtime = statSync13(path).mtimeMs;
@@ -91480,7 +92402,7 @@ class TranscriptFollower {
91480
92402
  let availability;
91481
92403
  if (this.savingOff)
91482
92404
  availability = "off";
91483
- else if (!existsSync27(this.path))
92405
+ else if (!existsSync28(this.path))
91484
92406
  availability = "absent";
91485
92407
  else if (t && t.acceptedAt === null && fileSize(this.path) <= t.offset)
91486
92408
  availability = "empty";
@@ -91556,9 +92478,9 @@ __export(exports_session_discovery, {
91556
92478
  });
91557
92479
  import { execFile as execFile3, execFileSync as execFileSync2 } from "child_process";
91558
92480
  import { closeSync as closeSync12, openSync as openSync12, readSync as readSync5, readdirSync as readdirSync7, realpathSync as realpathSync6, statSync as statSync14 } from "fs";
91559
- import { basename as basename3, join as join41 } from "path";
92481
+ import { basename as basename4, join as join42 } from "path";
91560
92482
  function projectsDir(env = process.env, cwd = process.cwd()) {
91561
- return join41(claudeCodeConfigDir(env, cwd), "projects");
92483
+ return join42(claudeCodeConfigDir(env, cwd), "projects");
91562
92484
  }
91563
92485
  function slugForPath(absPath) {
91564
92486
  return projectDirNameFor(absPath);
@@ -91568,7 +92490,7 @@ function transcriptPathFor(cwd, sessionUuid, projectsRoot = projectsDir()) {
91568
92490
  try {
91569
92491
  real = realpathSync6(cwd);
91570
92492
  } catch {}
91571
- return join41(projectsRoot, slugForPath(real), `${sessionUuid}.jsonl`);
92493
+ return join42(projectsRoot, slugForPath(real), `${sessionUuid}.jsonl`);
91572
92494
  }
91573
92495
  function isAgentSession(row) {
91574
92496
  return row.entrypoint !== undefined && row.entrypoint !== "cli";
@@ -91615,7 +92537,7 @@ function projectDirs() {
91615
92537
  }
91616
92538
  }
91617
92539
  function sessionsIn2(dirName) {
91618
- const dir = join41(projectsDir(), dirName);
92540
+ const dir = join42(projectsDir(), dirName);
91619
92541
  let names;
91620
92542
  try {
91621
92543
  names = readdirSync7(dir).filter((n) => n.endsWith(".jsonl"));
@@ -91624,13 +92546,13 @@ function sessionsIn2(dirName) {
91624
92546
  }
91625
92547
  const rows = [];
91626
92548
  for (const n of names) {
91627
- const file = join41(dir, n);
92549
+ const file = join42(dir, n);
91628
92550
  try {
91629
92551
  const st = statSync14(file);
91630
92552
  if (st.size === 0)
91631
92553
  continue;
91632
92554
  const row = {
91633
- id: basename3(n, ".jsonl"),
92555
+ id: basename4(n, ".jsonl"),
91634
92556
  file,
91635
92557
  mtimeMs: st.mtimeMs,
91636
92558
  birthtimeMs: st.birthtimeMs,
@@ -91732,7 +92654,7 @@ function discoverWorktreeGroups(repo) {
91732
92654
  if (hit) {
91733
92655
  path = hit.path;
91734
92656
  live = true;
91735
- name = hit.path === repo.root ? "(root)" : basename3(hit.path);
92657
+ name = hit.path === repo.root ? "(root)" : basename4(hit.path);
91736
92658
  } else if (at !== -1 && dir.startsWith(rootSlug)) {
91737
92659
  path = null;
91738
92660
  live = false;
@@ -92090,8 +93012,8 @@ var init_queue = __esm(() => {
92090
93012
  });
92091
93013
 
92092
93014
  // src/hooks/session/interactive-driver.ts
92093
- import { existsSync as existsSync28, statSync as statSync15 } from "fs";
92094
- import { join as join42 } from "path";
93015
+ import { existsSync as existsSync29, statSync as statSync15 } from "fs";
93016
+ import { join as join43 } from "path";
92095
93017
  function nextDriverPhase(phase, ev) {
92096
93018
  const row = EDGES[phase];
92097
93019
  return row[ev] ?? null;
@@ -92309,7 +93231,7 @@ class InteractiveDriver {
92309
93231
  }
92310
93232
  follow(sid, offset) {
92311
93233
  const path = transcriptPathFor(this.o.cwd, sid, this.o.projectsRoot);
92312
- this.follower = new TranscriptFollower(path, join42(path.replace(/\.jsonl$/, ""), "subagents"));
93234
+ this.follower = new TranscriptFollower(path, join43(path.replace(/\.jsonl$/, ""), "subagents"));
92313
93235
  this.sessionId = sid;
92314
93236
  this.settledTurn = null;
92315
93237
  this.lastPollAt = Date.now();
@@ -92330,7 +93252,7 @@ class InteractiveDriver {
92330
93252
  if (!p)
92331
93253
  return;
92332
93254
  const path = transcriptPathFor(this.o.cwd, p.id, this.o.projectsRoot);
92333
- if (!existsSync28(path)) {
93255
+ if (!existsSync29(path)) {
92334
93256
  if (Date.now() - p.since > RETARGET_WAIT_MS) {
92335
93257
  log(`[hooks] interactive driver: no transcript for session ${p.id}; not following it`);
92336
93258
  this.pendingSid = null;
@@ -93028,13 +93950,13 @@ var init_host_routing_env = __esm(() => {
93028
93950
 
93029
93951
  // src/launcher/magmux-binary.ts
93030
93952
  import { execSync } from "child_process";
93031
- import { existsSync as existsSync29 } from "fs";
93032
- import { dirname as dirname17, join as join43 } from "path";
93953
+ import { existsSync as existsSync30 } from "fs";
93954
+ import { dirname as dirname17, join as join44 } from "path";
93033
93955
  import { fileURLToPath } from "url";
93034
93956
  function findMagmuxCandidates() {
93035
93957
  const thisFile = fileURLToPath(import.meta.url);
93036
93958
  const thisDir = dirname17(thisFile);
93037
- const pkgRoots = [join43(thisDir, ".."), join43(thisDir, "..", "..")];
93959
+ const pkgRoots = [join44(thisDir, ".."), join44(thisDir, "..", "..")];
93038
93960
  const platform = process.platform;
93039
93961
  const arch = process.arch;
93040
93962
  const found = [];
@@ -93043,16 +93965,16 @@ function findMagmuxCandidates() {
93043
93965
  found.push(path);
93044
93966
  };
93045
93967
  for (const pkgRoot of pkgRoots) {
93046
- const bundled = join43(pkgRoot, "native", `magmux-${platform}-${arch}`);
93047
- if (existsSync29(bundled))
93968
+ const bundled = join44(pkgRoot, "native", `magmux-${platform}-${arch}`);
93969
+ if (existsSync30(bundled))
93048
93970
  add(bundled);
93049
93971
  }
93050
93972
  try {
93051
93973
  const pkgName = `@claudish/magmux-${platform}-${arch}`;
93052
93974
  let searchDir = pkgRoots[0];
93053
93975
  for (let i = 0;i < 5; i++) {
93054
- const candidate = join43(searchDir, "node_modules", pkgName, "bin", "magmux");
93055
- if (existsSync29(candidate)) {
93976
+ const candidate = join44(searchDir, "node_modules", pkgName, "bin", "magmux");
93977
+ if (existsSync30(candidate)) {
93056
93978
  add(candidate);
93057
93979
  break;
93058
93980
  }
@@ -93085,7 +94007,7 @@ var init_magmux_binary = () => {};
93085
94007
  import {
93086
94008
  chmodSync as chmodSync3,
93087
94009
  closeSync as closeSync13,
93088
- existsSync as existsSync30,
94010
+ existsSync as existsSync31,
93089
94011
  mkdirSync as mkdirSync20,
93090
94012
  mkdtempSync,
93091
94013
  openSync as openSync13,
@@ -93093,7 +94015,7 @@ import {
93093
94015
  writeFileSync as writeFileSync16
93094
94016
  } from "fs";
93095
94017
  import { connect as netConnect } from "net";
93096
- import { join as join44 } from "path";
94018
+ import { join as join45 } from "path";
93097
94019
  function envDeltas(parentEnv, childEnv) {
93098
94020
  const set = [];
93099
94021
  const unset = [];
@@ -93159,9 +94081,9 @@ function planMagmuxWrap(input) {
93159
94081
  const controlSocket = `/tmp/magmux-${id}.sock`;
93160
94082
  const tmpRoot = input.tmpRoot ?? "/tmp";
93161
94083
  mkdirSync20(tmpRoot, { recursive: true });
93162
- const scriptDir = mkdtempSync(join44(tmpRoot, "claudish-launch-"));
94084
+ const scriptDir = mkdtempSync(join45(tmpRoot, "claudish-launch-"));
93163
94085
  chmodSync3(scriptDir, 448);
93164
- const scriptPath = join44(scriptDir, "claude-launch.sh");
94086
+ const scriptPath = join45(scriptDir, "claude-launch.sh");
93165
94087
  const parentEnv = input.parentEnv ?? process.env;
93166
94088
  const deltas = envDeltas(parentEnv, input.childEnv);
93167
94089
  const fd = openSync13(scriptPath, "wx", 384);
@@ -93201,7 +94123,7 @@ function planMagmuxWrap(input) {
93201
94123
  rmSync11(scriptDir, { recursive: true, force: true });
93202
94124
  } catch {}
93203
94125
  try {
93204
- if (existsSync30(controlSocket))
94126
+ if (existsSync31(controlSocket))
93205
94127
  rmSync11(controlSocket, { force: true });
93206
94128
  } catch {}
93207
94129
  };
@@ -93220,7 +94142,7 @@ function planMagmuxWrap(input) {
93220
94142
  let stopped = false;
93221
94143
  const attempt = async () => {
93222
94144
  for (let i = 0;i < 60 && !stopped; i++) {
93223
- if (existsSync30(controlSocket)) {
94145
+ if (existsSync31(controlSocket)) {
93224
94146
  try {
93225
94147
  const s = await new Promise((resolve, reject) => {
93226
94148
  const sock = netConnect(controlSocket);
@@ -93356,9 +94278,9 @@ var init_cache_ttl = __esm(() => {
93356
94278
  });
93357
94279
 
93358
94280
  // src/model-loader.ts
93359
- import { existsSync as existsSync31, readFileSync as readFileSync37 } from "fs";
93360
- import { homedir as homedir35 } from "os";
93361
- import { join as join45 } from "path";
94281
+ import { existsSync as existsSync32, readFileSync as readFileSync37 } from "fs";
94282
+ import { homedir as homedir36 } from "os";
94283
+ import { join as join46 } from "path";
93362
94284
  function isRecommendationTier(value) {
93363
94285
  return typeof value === "string" && RECOMMENDATION_TIER_INDEX.has(value);
93364
94286
  }
@@ -93559,7 +94481,7 @@ function readProjectedRecommendationsDoc(value) {
93559
94481
  };
93560
94482
  }
93561
94483
  function readRecommendedModelsCacheFile() {
93562
- if (!existsSync31(RECOMMENDED_MODELS_CACHE_PATH))
94484
+ if (!existsSync32(RECOMMENDED_MODELS_CACHE_PATH))
93563
94485
  return null;
93564
94486
  let parsed;
93565
94487
  try {
@@ -93940,7 +94862,7 @@ var init_model_loader = __esm(() => {
93940
94862
  { recommendationTier: "subscription", title: "Subscription", quickPickEligible: true }
93941
94863
  ];
93942
94864
  RECOMMENDATION_TIER_INDEX = new Map(RECOMMENDATION_SECTIONS.map((section, index) => [section.recommendationTier, index]));
93943
- RECOMMENDED_MODELS_CACHE_PATH = join45(homedir35(), ".claudish", "recommended-models-cache-v2.json");
94865
+ RECOMMENDED_MODELS_CACHE_PATH = join46(homedir36(), ".claudish", "recommended-models-cache-v2.json");
93944
94866
  RECOMMENDED_ROUTE_TIER_ORDER = {
93945
94867
  native: 0,
93946
94868
  general: 1,
@@ -95266,9 +96188,9 @@ var init_DiscoveryNotice = __esm(() => {
95266
96188
  });
95267
96189
 
95268
96190
  // src/providers/model-descriptions.ts
95269
- import { existsSync as existsSync32, mkdirSync as mkdirSync21, readFileSync as readFileSync38, writeFileSync as writeFileSync17 } from "fs";
95270
- import { homedir as homedir36 } from "os";
95271
- import { dirname as dirname18, join as join46 } from "path";
96191
+ import { existsSync as existsSync33, mkdirSync as mkdirSync21, readFileSync as readFileSync38, writeFileSync as writeFileSync17 } from "fs";
96192
+ import { homedir as homedir37 } from "os";
96193
+ import { dirname as dirname18, join as join47 } from "path";
95272
96194
  function emptyDescriptionIndex() {
95273
96195
  return EMPTY_INDEX;
95274
96196
  }
@@ -95287,7 +96209,7 @@ function indexFrom(cache) {
95287
96209
  };
95288
96210
  }
95289
96211
  function readCache(path) {
95290
- if (!existsSync32(path))
96212
+ if (!existsSync33(path))
95291
96213
  return null;
95292
96214
  try {
95293
96215
  const raw = JSON.parse(readFileSync38(path, "utf-8"));
@@ -95361,7 +96283,7 @@ var init_model_descriptions = __esm(() => {
95361
96283
  init_logger();
95362
96284
  init_model_loader();
95363
96285
  init_cache_ttl();
95364
- MODEL_DESCRIPTIONS_CACHE_PATH = join46(homedir36(), ".claudish", "model-descriptions.json");
96286
+ MODEL_DESCRIPTIONS_CACHE_PATH = join47(homedir37(), ".claudish", "model-descriptions.json");
95365
96287
  EMPTY_INDEX = { get: () => {
95366
96288
  return;
95367
96289
  }, size: 0 };
@@ -101608,30 +102530,30 @@ var init_branding = __esm(() => {
101608
102530
  });
101609
102531
 
101610
102532
  // src/update-checker.ts
101611
- import { existsSync as existsSync33, mkdirSync as mkdirSync22, readFileSync as readFileSync39, unlinkSync as unlinkSync9, writeFileSync as writeFileSync18 } from "fs";
101612
- import { homedir as homedir37, platform as platform2, tmpdir } from "os";
101613
- import { join as join47 } from "path";
102533
+ import { existsSync as existsSync34, mkdirSync as mkdirSync22, readFileSync as readFileSync39, unlinkSync as unlinkSync9, writeFileSync as writeFileSync18 } from "fs";
102534
+ import { homedir as homedir38, platform as platform2, tmpdir } from "os";
102535
+ import { join as join48 } from "path";
101614
102536
  function getCacheFilePath() {
101615
102537
  let cacheDir;
101616
102538
  if (isWindows) {
101617
- const localAppData = process.env.LOCALAPPDATA || join47(homedir37(), "AppData", "Local");
101618
- cacheDir = join47(localAppData, "claudish");
102539
+ const localAppData = process.env.LOCALAPPDATA || join48(homedir38(), "AppData", "Local");
102540
+ cacheDir = join48(localAppData, "claudish");
101619
102541
  } else {
101620
- cacheDir = join47(homedir37(), ".cache", "claudish");
102542
+ cacheDir = join48(homedir38(), ".cache", "claudish");
101621
102543
  }
101622
102544
  try {
101623
- if (!existsSync33(cacheDir)) {
102545
+ if (!existsSync34(cacheDir)) {
101624
102546
  mkdirSync22(cacheDir, { recursive: true });
101625
102547
  }
101626
- return join47(cacheDir, "update-check.json");
102548
+ return join48(cacheDir, "update-check.json");
101627
102549
  } catch {
101628
- return join47(tmpdir(), "claudish-update-check.json");
102550
+ return join48(tmpdir(), "claudish-update-check.json");
101629
102551
  }
101630
102552
  }
101631
102553
  function readCache2() {
101632
102554
  try {
101633
102555
  const cachePath = getCacheFilePath();
101634
- if (!existsSync33(cachePath)) {
102556
+ if (!existsSync34(cachePath)) {
101635
102557
  return null;
101636
102558
  }
101637
102559
  const data = JSON.parse(readFileSync39(cachePath, "utf-8"));
@@ -101657,7 +102579,7 @@ function isCacheValid(cache) {
101657
102579
  function clearCache() {
101658
102580
  try {
101659
102581
  const cachePath = getCacheFilePath();
101660
- if (existsSync33(cachePath)) {
102582
+ if (existsSync34(cachePath)) {
101661
102583
  unlinkSync9(cachePath);
101662
102584
  }
101663
102585
  } catch {}
@@ -106114,9 +107036,9 @@ var init_bundled_tagged_cache = __esm(() => {
106114
107036
  });
106115
107037
 
106116
107038
  // src/services/pricing-cache.ts
106117
- import { existsSync as existsSync34, readFileSync as readFileSync40, statSync as statSync16 } from "fs";
106118
- import { homedir as homedir38 } from "os";
106119
- import { join as join48 } from "path";
107039
+ import { existsSync as existsSync35, readFileSync as readFileSync40, statSync as statSync16 } from "fs";
107040
+ import { homedir as homedir39 } from "os";
107041
+ import { join as join49 } from "path";
106120
107042
  function prefixMatch(modelName) {
106121
107043
  for (const [key, pricing] of pricingMap) {
106122
107044
  if (modelName.startsWith(key))
@@ -106166,7 +107088,7 @@ async function warmPricingCache() {
106166
107088
  }
106167
107089
  function loadDiskCache() {
106168
107090
  try {
106169
- if (!existsSync34(CACHE_FILE))
107091
+ if (!existsSync35(CACHE_FILE))
106170
107092
  return false;
106171
107093
  const stat = statSync16(CACHE_FILE);
106172
107094
  const age = Date.now() - stat.mtimeMs;
@@ -106188,8 +107110,8 @@ var init_pricing_cache = __esm(() => {
106188
107110
  init_catalog_client();
106189
107111
  init_catalog_route_bindings();
106190
107112
  pricingMap = new Map;
106191
- CACHE_DIR = join48(homedir38(), ".claudish");
106192
- CACHE_FILE = join48(CACHE_DIR, "pricing-cache.json");
107113
+ CACHE_DIR = join49(homedir39(), ".claudish");
107114
+ CACHE_FILE = join49(CACHE_DIR, "pricing-cache.json");
106193
107115
  CACHE_TTL_MS5 = 24 * 60 * 60 * 1000;
106194
107116
  });
106195
107117
 
@@ -108564,7 +109486,7 @@ var init_response_seam = __esm(() => {
108564
109486
 
108565
109487
  // src/proxy-server.ts
108566
109488
  import { appendFileSync as appendFileSync6, mkdirSync as mkdirSync23 } from "fs";
108567
- import { join as join49 } from "path";
109489
+ import { join as join50 } from "path";
108568
109490
  function isTerminalRoutingFailure(e) {
108569
109491
  return e instanceof RoutingError;
108570
109492
  }
@@ -108572,7 +109494,7 @@ function maybeCaptureClassifierRequest(c, body) {
108572
109494
  if (!process.env.CLAUDISH_CLASSIFIER_DEBUG)
108573
109495
  return;
108574
109496
  try {
108575
- const dir = join49(process.cwd(), "logs");
109497
+ const dir = join50(process.cwd(), "logs");
108576
109498
  if (!classifierCaptureDirReady) {
108577
109499
  mkdirSync23(dir, { recursive: true });
108578
109500
  classifierCaptureDirReady = true;
@@ -108597,7 +109519,7 @@ function maybeCaptureClassifierRequest(c, body) {
108597
109519
  "x-api-key": c.req.header("x-api-key") ? "<present>" : null
108598
109520
  }
108599
109521
  };
108600
- appendFileSync6(join49(dir, "classifier-capture.jsonl"), `${JSON.stringify(record)}
109522
+ appendFileSync6(join50(dir, "classifier-capture.jsonl"), `${JSON.stringify(record)}
108601
109523
  `);
108602
109524
  } catch {}
108603
109525
  }
@@ -109204,21 +110126,21 @@ var init_proxy_server = __esm(() => {
109204
110126
  // src/cli.ts
109205
110127
  import {
109206
110128
  copyFileSync as copyFileSync2,
109207
- existsSync as existsSync35,
110129
+ existsSync as existsSync36,
109208
110130
  mkdirSync as mkdirSync24,
109209
110131
  readFileSync as readFileSync41,
109210
110132
  readdirSync as readdirSync8,
109211
110133
  unlinkSync as unlinkSync10
109212
110134
  } from "fs";
109213
- import { homedir as homedir39 } from "os";
109214
- import { dirname as dirname19, join as join50 } from "path";
110135
+ import { homedir as homedir40 } from "os";
110136
+ import { dirname as dirname19, join as join51 } from "path";
109215
110137
  import { fileURLToPath as fileURLToPath2 } from "url";
109216
110138
  function getVersion3() {
109217
110139
  return VERSION;
109218
110140
  }
109219
110141
  function clearAllModelCaches() {
109220
- const cacheDir = join50(homedir39(), ".claudish");
109221
- if (!existsSync35(cacheDir))
110142
+ const cacheDir = join51(homedir40(), ".claudish");
110143
+ if (!existsSync36(cacheDir))
109222
110144
  return;
109223
110145
  const cachePatterns = ["pricing-cache.json", "recommended-models-cache-v2.json"];
109224
110146
  let cleared = 0;
@@ -109226,7 +110148,7 @@ function clearAllModelCaches() {
109226
110148
  const files = readdirSync8(cacheDir);
109227
110149
  for (const file of files) {
109228
110150
  if (cachePatterns.includes(file)) {
109229
- unlinkSync10(join50(cacheDir, file));
110151
+ unlinkSync10(join51(cacheDir, file));
109230
110152
  cleared++;
109231
110153
  }
109232
110154
  }
@@ -110870,7 +111792,7 @@ ${h("MORE INFO")}
110870
111792
  }
110871
111793
  function printAIAgentGuide() {
110872
111794
  try {
110873
- const guidePath = join50(__dirname2, "../AI_AGENT_GUIDE.md");
111795
+ const guidePath = join51(__dirname2, "../AI_AGENT_GUIDE.md");
110874
111796
  const guideContent = readFileSync41(guidePath, "utf-8");
110875
111797
  console.log(guideContent);
110876
111798
  } catch (error) {
@@ -110887,19 +111809,19 @@ async function initializeClaudishSkill() {
110887
111809
  console.log(`\uD83D\uDD27 Initializing Claudish skill in current project...
110888
111810
  `);
110889
111811
  const cwd = process.cwd();
110890
- const claudeDir = join50(cwd, ".claude");
110891
- const skillsDir = join50(claudeDir, "skills");
110892
- const claudishSkillDir = join50(skillsDir, "claudish-usage");
110893
- const skillFile = join50(claudishSkillDir, "SKILL.md");
110894
- if (existsSync35(skillFile)) {
111812
+ const claudeDir = join51(cwd, ".claude");
111813
+ const skillsDir = join51(claudeDir, "skills");
111814
+ const claudishSkillDir = join51(skillsDir, "claudish-usage");
111815
+ const skillFile = join51(claudishSkillDir, "SKILL.md");
111816
+ if (existsSync36(skillFile)) {
110895
111817
  console.log("\u2705 Claudish skill already installed at:");
110896
111818
  console.log(` ${skillFile}
110897
111819
  `);
110898
111820
  console.log("\uD83D\uDCA1 To reinstall, delete the file and run 'claudish --init' again.");
110899
111821
  return;
110900
111822
  }
110901
- const sourceSkillPath = join50(__dirname2, "../skills/claudish-usage/SKILL.md");
110902
- if (!existsSync35(sourceSkillPath)) {
111823
+ const sourceSkillPath = join51(__dirname2, "../skills/claudish-usage/SKILL.md");
111824
+ if (!existsSync36(sourceSkillPath)) {
110903
111825
  console.error("\u274C Error: Claudish skill file not found in installation.");
110904
111826
  console.error(` Expected at: ${sourceSkillPath}`);
110905
111827
  console.error(`
@@ -110908,15 +111830,15 @@ async function initializeClaudishSkill() {
110908
111830
  process.exit(1);
110909
111831
  }
110910
111832
  try {
110911
- if (!existsSync35(claudeDir)) {
111833
+ if (!existsSync36(claudeDir)) {
110912
111834
  mkdirSync24(claudeDir, { recursive: true });
110913
111835
  console.log("\uD83D\uDCC1 Created .claude/ directory");
110914
111836
  }
110915
- if (!existsSync35(skillsDir)) {
111837
+ if (!existsSync36(skillsDir)) {
110916
111838
  mkdirSync24(skillsDir, { recursive: true });
110917
111839
  console.log("\uD83D\uDCC1 Created .claude/skills/ directory");
110918
111840
  }
110919
- if (!existsSync35(claudishSkillDir)) {
111841
+ if (!existsSync36(claudishSkillDir)) {
110920
111842
  mkdirSync24(claudishSkillDir, { recursive: true });
110921
111843
  console.log("\uD83D\uDCC1 Created .claude/skills/claudish-usage/ directory");
110922
111844
  }
@@ -111132,7 +112054,7 @@ var DEFAULT_PANE_COLS = 160, DEFAULT_PANE_ROWS = 50, MIN_PANE_COLS = 40, MAX_PAN
111132
112054
  // src/pane/process-identity.ts
111133
112055
  import { execFile as execFile4, execFileSync as execFileSync3 } from "child_process";
111134
112056
  import { lstatSync as lstatSync6 } from "fs";
111135
- import { basename as basename4, dirname as dirname20, isAbsolute as isAbsolute2, join as join51, normalize } from "path";
112057
+ import { basename as basename5, dirname as dirname20, isAbsolute as isAbsolute2, join as join52, normalize } from "path";
111136
112058
  function collapse2(s) {
111137
112059
  return s.trim().replace(/\s+/g, " ");
111138
112060
  }
@@ -111375,7 +112297,7 @@ function parseGroupFile(text) {
111375
112297
  return withEscaped(pgid, members, escaped);
111376
112298
  }
111377
112299
  function isLaunchDirPath(root, p) {
111378
- if (dirname20(p) !== root || !LAUNCH_DIR_RE.test(basename4(p)))
112300
+ if (dirname20(p) !== root || !LAUNCH_DIR_RE.test(basename5(p)))
111379
112301
  return false;
111380
112302
  try {
111381
112303
  const st = lstatSync6(p);
@@ -111388,30 +112310,30 @@ function isValidPaneId(id) {
111388
112310
  return PANE_ID_RE.test(id) && !/^\d+$/.test(id);
111389
112311
  }
111390
112312
  function sockPathOf(root, paneId) {
111391
- return join51(root, `magmux-${paneId}.sock`);
112313
+ return join52(root, `magmux-${paneId}.sock`);
111392
112314
  }
111393
112315
  function viewSockPathOf(root, paneId) {
111394
- return join51(root, `magmux-${paneId}.view`);
112316
+ return join52(root, `magmux-${paneId}.view`);
111395
112317
  }
111396
112318
  function recordPathOf(root, paneId) {
111397
- return join51(root, "panes", `${paneId}.json`);
112319
+ return join52(root, "panes", `${paneId}.json`);
111398
112320
  }
111399
112321
  function isPaneSockPath(root, p, paneId) {
111400
- return isValidPaneId(paneId) && dirname20(p) === root && basename4(p) === `magmux-${paneId}.sock`;
112322
+ return isValidPaneId(paneId) && dirname20(p) === root && basename5(p) === `magmux-${paneId}.sock`;
111401
112323
  }
111402
112324
  function isPaneViewSockPath(root, p, paneId) {
111403
- return isValidPaneId(paneId) && dirname20(p) === root && basename4(p) === `magmux-${paneId}.view`;
112325
+ return isValidPaneId(paneId) && dirname20(p) === root && basename5(p) === `magmux-${paneId}.view`;
111404
112326
  }
111405
112327
  function isPaneRecordPath(root, p, paneId) {
111406
- return isValidPaneId(paneId) && dirname20(p) === join51(root, "panes") && basename4(p) === `${paneId}.json`;
112328
+ return isValidPaneId(paneId) && dirname20(p) === join52(root, "panes") && basename5(p) === `${paneId}.json`;
111407
112329
  }
111408
112330
  function isForkRecordPath(projectsRoot, p, uuid) {
111409
112331
  if (!isAbsolute2(projectsRoot) || normalize(projectsRoot) !== projectsRoot)
111410
112332
  return false;
111411
- if (basename4(projectsRoot) !== "projects" || !FORK_UUID_RE.test(uuid))
112333
+ if (basename5(projectsRoot) !== "projects" || !FORK_UUID_RE.test(uuid))
111412
112334
  return false;
111413
112335
  const dir = dirname20(p);
111414
- return dirname20(dir) === projectsRoot && PROJECT_SLUG_RE.test(basename4(dir)) && basename4(p) === `${uuid}.jsonl`;
112336
+ return dirname20(dir) === projectsRoot && PROJECT_SLUG_RE.test(basename5(dir)) && basename5(p) === `${uuid}.jsonl`;
111415
112337
  }
111416
112338
  function watcherArgv(a) {
111417
112339
  const fork = a.fork ? [a.fork.projectsRoot, a.fork.path, a.fork.removeProjectDir ? "1" : "0"] : [];
@@ -111547,7 +112469,7 @@ import {
111547
112469
  statSync as statSync17,
111548
112470
  writeFileSync as writeFileSync19
111549
112471
  } from "fs";
111550
- import { join as join52, resolve as resolve5 } from "path";
112472
+ import { join as join53, resolve as resolve5 } from "path";
111551
112473
  function uid() {
111552
112474
  return typeof process.getuid === "function" ? process.getuid() : 0;
111553
112475
  }
@@ -111565,7 +112487,7 @@ function assertPrivateDir(p) {
111565
112487
  throw new PaneRootError(`pane socket root ${p} has mode ${(st.mode & 511).toString(8)}; it must be 0700`);
111566
112488
  }
111567
112489
  function ensurePrivateSubdir(root, name) {
111568
- const dir = join52(root, name);
112490
+ const dir = join53(root, name);
111569
112491
  try {
111570
112492
  mkdirSync25(dir, { mode: 448 });
111571
112493
  } catch (e) {
@@ -111586,7 +112508,7 @@ function ensureSockRoot(given = sockRootFor()) {
111586
112508
  throw e;
111587
112509
  }
111588
112510
  assertPrivateDir(root);
111589
- const panes = join52(root, "panes");
112511
+ const panes = join53(root, "panes");
111590
112512
  try {
111591
112513
  mkdirSync25(panes, { mode: 448 });
111592
112514
  } catch (e) {
@@ -111640,7 +112562,7 @@ function buildPaneEnv(input) {
111640
112562
  if ((input.platform ?? process.platform) === "linux" && entryBytes > LINUX_ENV_STRING_LIMIT)
111641
112563
  throw new PaneEnvTooLargeError(`pane environment snapshot is ${entryBytes} bytes, over Linux's 131072-byte limit per variable`);
111642
112564
  env[ENV.CLAUDISH_PANE_ENV] = json;
111643
- env.SHELL = join52(input.ctlDir, "sh-shim");
112565
+ env.SHELL = join53(input.ctlDir, "sh-shim");
111644
112566
  return { magmuxEnv: env };
111645
112567
  }
111646
112568
  function inheritedReplayEnv(parentEnv) {
@@ -111659,7 +112581,7 @@ function buildReplayEnv(input) {
111659
112581
  const env = inheritedReplayEnv(input.parentEnv);
111660
112582
  if (input.configDirOverride)
111661
112583
  env.CLAUDE_CONFIG_DIR = input.configDirOverride;
111662
- env.SHELL = join52(input.ctlDir, "sh-shim");
112584
+ env.SHELL = join53(input.ctlDir, "sh-shim");
111663
112585
  env[ENV.CLAUDISH_PANE_CHILD] = "1";
111664
112586
  env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = "1";
111665
112587
  env.CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL = "1";
@@ -111692,7 +112614,7 @@ function replaySettingsJson(statusLine) {
111692
112614
  }
111693
112615
  function readUserStatusLine(configDir) {
111694
112616
  try {
111695
- const path = join52(configDir, "settings.json");
112617
+ const path = join53(configDir, "settings.json");
111696
112618
  if (statSync17(path).size > MAX_USER_SETTINGS_BYTES)
111697
112619
  return null;
111698
112620
  const v = JSON.parse(readFileSync42(path, "utf8"))?.statusLine;
@@ -111885,7 +112807,7 @@ async function readMagmuxVersion(found) {
111885
112807
  const out = await runMagmuxVersion(found, MAGMUX_VERSION_TIMEOUT_MS);
111886
112808
  return out.match(VERSION_PATTERN)?.[1] ?? "";
111887
112809
  }
111888
- function runMagmuxVersion(found, timeoutMs, drainMs = EXIT_DRAIN_MS) {
112810
+ function runMagmuxVersion(found, timeoutMs, drainMs = EXIT_DRAIN_MS, spawnChild = spawn2) {
111889
112811
  return new Promise((resolveRun, rejectRun) => {
111890
112812
  let settled = false;
111891
112813
  let child;
@@ -111894,7 +112816,11 @@ function runMagmuxVersion(found, timeoutMs, drainMs = EXIT_DRAIN_MS) {
111894
112816
  const ranAt = Math.round(performance.now() - startedAt);
111895
112817
  const code = child?.exitCode ?? child?.signalCode ?? null;
111896
112818
  if (code !== null) {
111897
- setTimeout(() => fail(`exited (${code}) but no exit event within ${drainMs + EXIT_DRAIN_MS} ms`), drainMs + EXIT_DRAIN_MS);
112819
+ setTimeout(() => {
112820
+ if (code === 0)
112821
+ return done();
112822
+ fail(`exited (${code}) but no exit event within ${drainMs + EXIT_DRAIN_MS} ms`);
112823
+ }, drainMs + EXIT_DRAIN_MS);
111898
112824
  return;
111899
112825
  }
111900
112826
  fail(`no answer in ${timeoutMs} ms (timer ran at ${ranAt} ms; child still running)`);
@@ -111930,7 +112856,7 @@ function runMagmuxVersion(found, timeoutMs, drainMs = EXIT_DRAIN_MS) {
111930
112856
  done();
111931
112857
  };
111932
112858
  try {
111933
- child = spawn2(found, ["--version"], { stdio: ["ignore", "pipe", "pipe"] });
112859
+ child = spawnChild(found, ["--version"], { stdio: ["ignore", "pipe", "pipe"] });
111934
112860
  child.stdout?.setEncoding("utf8").on("data", read);
111935
112861
  child.stderr?.setEncoding("utf8").on("data", read);
111936
112862
  child.on("error", (e) => fail(e.message));
@@ -111970,21 +112896,21 @@ export SHELL=${shq2(realShell)}
111970
112896
  ${launcherScript(cwd, launch, argv)}`;
111971
112897
  }
111972
112898
  function paneCommand(ctlDir) {
111973
- const cmd = `. ${shq2(join52(ctlDir, "pane-launch.sh"))}`;
112899
+ const cmd = `. ${shq2(join53(ctlDir, "pane-launch.sh"))}`;
111974
112900
  if (/claude /.test(cmd) || /claude$/.test(cmd) || /(^|\/)claude['"]?$/.test(cmd))
111975
112901
  throw new Error(`pane command would attach magmux's Claude Code controller: ${cmd}`);
111976
112902
  return cmd;
111977
112903
  }
111978
112904
  function createLaunchDirs(root) {
111979
- const ctlDir = mkdtempSync2(join52(root, "launch-"));
112905
+ const ctlDir = mkdtempSync2(join53(root, "launch-"));
111980
112906
  chmodSync4(ctlDir, 448);
111981
- const turnDir = mkdtempSync2(join52(root, "launch-"));
112907
+ const turnDir = mkdtempSync2(join53(root, "launch-"));
111982
112908
  chmodSync4(turnDir, 448);
111983
112909
  return { ctlDir, turnDir };
111984
112910
  }
111985
112911
  function writeLauncherFiles(ctlDir, script) {
111986
- writeFileSync19(join52(ctlDir, "pane-launch.sh"), script, { mode: 384, flag: "wx" });
111987
- writeFileSync19(join52(ctlDir, "sh-shim"), SHELL_SHIM, { mode: 448, flag: "wx" });
112912
+ writeFileSync19(join53(ctlDir, "pane-launch.sh"), script, { mode: 384, flag: "wx" });
112913
+ writeFileSync19(join53(ctlDir, "sh-shim"), SHELL_SHIM, { mode: 448, flag: "wx" });
111988
112914
  }
111989
112915
  function spawnPaneWatcher(args) {
111990
112916
  const proc = spawn2("/bin/sh", watcherArgv(args), {
@@ -112346,14 +113272,14 @@ var init_process_tree = __esm(() => {
112346
113272
  var UI_LEASE_MS = 1e4, FRAME_TICK_MS = 1000;
112347
113273
 
112348
113274
  // src/recovery/magmux-ui.ts
112349
- import { existsSync as existsSync36 } from "fs";
113275
+ import { existsSync as existsSync37 } from "fs";
112350
113276
  import { connect as netConnect2 } from "net";
112351
113277
  function resolveControlEndpoint() {
112352
- if (explicitControlSock && existsSync36(explicitControlSock)) {
113278
+ if (explicitControlSock && existsSync37(explicitControlSock)) {
112353
113279
  return { sock: explicitControlSock, wrapped: true };
112354
113280
  }
112355
113281
  const ambient = process.env.MAGMUX_SOCK;
112356
- if (ambient && existsSync36(ambient))
113282
+ if (ambient && existsSync37(ambient))
112357
113283
  return { sock: ambient, wrapped: false };
112358
113284
  return null;
112359
113285
  }
@@ -112767,7 +113693,7 @@ import { randomUUID as randomUUID7 } from "crypto";
112767
113693
  import {
112768
113694
  chmodSync as chmodSync5,
112769
113695
  closeSync as closeSync14,
112770
- existsSync as existsSync37,
113696
+ existsSync as existsSync38,
112771
113697
  mkdirSync as mkdirSync26,
112772
113698
  mkdtempSync as mkdtempSync3,
112773
113699
  openSync as openSync14,
@@ -112778,8 +113704,8 @@ import {
112778
113704
  unlinkSync as unlinkSync11,
112779
113705
  writeFileSync as writeFileSync20
112780
113706
  } from "fs";
112781
- import { homedir as homedir40, tmpdir as tmpdir2 } from "os";
112782
- import { dirname as dirname21, join as join53, resolve as resolve6 } from "path";
113707
+ import { homedir as homedir41, tmpdir as tmpdir2 } from "os";
113708
+ import { dirname as dirname21, join as join54, resolve as resolve6 } from "path";
112783
113709
  import { isatty } from "tty";
112784
113710
  function releaseTerminalIsolation() {
112785
113711
  if (!restoreTerminal)
@@ -113059,14 +113985,14 @@ function readableClaudeSettingsLayers(config, env, deps) {
113059
113985
  }
113060
113986
  function claudeSettingsLayers(claudeArgs, env, deps, scope) {
113061
113987
  const readFile = deps.readFile ?? ((path) => readFileSync43(path, "utf-8"));
113062
- const home = deps.home ?? (env.HOME ? env.HOME : homedir40());
113988
+ const home = deps.home ?? (env.HOME ? env.HOME : homedir41());
113063
113989
  const cwd = deps.cwd ?? process.cwd();
113064
113990
  const enabled = enabledSettingSources(claudeArgs);
113065
113991
  const on = (source) => enabled === null || enabled.has(source);
113066
113992
  const files = [
113067
113993
  [managedSettingsPath(), "managed"],
113068
113994
  ...on("user") ? [[userSettingsFile(env.CLAUDE_CONFIG_DIR, home, cwd), "user"]] : [],
113069
- ...on("project") ? [[join53(cwd, ".claude", "settings.json"), "project"]] : [],
113995
+ ...on("project") ? [[join54(cwd, ".claude", "settings.json"), "project"]] : [],
113070
113996
  ...on("local") ? localSettingsFiles(cwd, readFile, deps.pathKind ?? statPathKind) : []
113071
113997
  ];
113072
113998
  const layers = [];
@@ -113094,19 +114020,19 @@ function claudeSettingsLayers(claudeArgs, env, deps, scope) {
113094
114020
  return layers;
113095
114021
  }
113096
114022
  function userSettingsFile(configDir, home, cwd) {
113097
- return join53(claudeCodeConfigDir({ CLAUDE_CONFIG_DIR: configDir, HOME: home }, cwd), "settings.json");
114023
+ return join54(claudeCodeConfigDir({ CLAUDE_CONFIG_DIR: configDir, HOME: home }, cwd), "settings.json");
113098
114024
  }
113099
114025
  function localSettingsFiles(cwd, readFile, pathKind) {
113100
- const cwdFile = join53(cwd, ".claude", "settings.local.json");
114026
+ const cwdFile = join54(cwd, ".claude", "settings.local.json");
113101
114027
  const root = mainCheckoutRoot(cwd, readFile, pathKind);
113102
- const rootFile = root === undefined ? undefined : join53(root, ".claude", "settings.local.json");
114028
+ const rootFile = root === undefined ? undefined : join54(root, ".claude", "settings.local.json");
113103
114029
  const files = rootFile && rootFile !== cwdFile ? [rootFile, cwdFile] : [cwdFile];
113104
114030
  return files.map((file) => [file, "local"]);
113105
114031
  }
113106
114032
  function mainCheckoutRoot(cwd, readFile, pathKind) {
113107
114033
  let dir = resolve6(cwd);
113108
114034
  for (;; ) {
113109
- const entry = join53(dir, ".git");
114035
+ const entry = join54(dir, ".git");
113110
114036
  const kind = pathKind(entry);
113111
114037
  if (kind === "dir")
113112
114038
  return dir;
@@ -113116,7 +114042,7 @@ function mainCheckoutRoot(cwd, readFile, pathKind) {
113116
114042
  return dir;
113117
114043
  let common;
113118
114044
  try {
113119
- common = readFile(join53(gitDir, "commondir")).trim();
114045
+ common = readFile(join54(gitDir, "commondir")).trim();
113120
114046
  } catch {
113121
114047
  return dir;
113122
114048
  }
@@ -113258,7 +114184,7 @@ function readSettingsSource(source, readFile) {
113258
114184
  }
113259
114185
  function managedSettingsPath() {
113260
114186
  if (isWindows2()) {
113261
- return join53(process.env.PROGRAMDATA || "C:\\ProgramData", "ClaudeCode", "managed-settings.json");
114187
+ return join54(process.env.PROGRAMDATA || "C:\\ProgramData", "ClaudeCode", "managed-settings.json");
113262
114188
  }
113263
114189
  if (process.platform === "darwin") {
113264
114190
  return "/Library/Application Support/ClaudeCode/managed-settings.json";
@@ -113279,8 +114205,8 @@ function isWindows2() {
113279
114205
  }
113280
114206
  function createStatusLineScript(tokenFilePath) {
113281
114207
  const homeDir = process.env.HOME || process.env.USERPROFILE || tmpdir2();
113282
- const claudishDir = join53(homeDir, ".claudish");
113283
- const scriptPath = join53(claudishDir, `status-${process.pid}-${Date.now()}.js`);
114208
+ const claudishDir = join54(homeDir, ".claudish");
114209
+ const scriptPath = join54(claudishDir, `status-${process.pid}-${Date.now()}.js`);
113284
114210
  const escapedTokenPath = tokenFilePath.replace(/\\/g, "\\\\");
113285
114211
  const light = getThemeMode() === "light";
113286
114212
  const cyanCode = light ? "38;2;14;116;144" : "96";
@@ -113486,7 +114412,7 @@ function cleanupStaleTokenFiles(dir, now = Date.now(), maxAgeMs = STALE_TOKEN_FI
113486
114412
  if (!name.startsWith("tokens-") || !name.endsWith(".json"))
113487
114413
  continue;
113488
114414
  scanned++;
113489
- const full = join53(dir, name);
114415
+ const full = join54(dir, name);
113490
114416
  try {
113491
114417
  if (statSync18(full).mtimeMs >= cutoff)
113492
114418
  continue;
@@ -113559,11 +114485,11 @@ function buildChainedStatusCommand(userCommand, claudishBody, claudishSegment) {
113559
114485
  }
113560
114486
  function createTempSettingsFile(_modelDisplay, port, proxyAuthMode, userStatusLineCommand, modelPicker) {
113561
114487
  const homeDir = process.env.HOME || process.env.USERPROFILE || tmpdir2();
113562
- const claudishDir = join53(homeDir, ".claudish");
114488
+ const claudishDir = join54(homeDir, ".claudish");
113563
114489
  try {
113564
114490
  mkdirSync26(claudishDir, { recursive: true });
113565
114491
  } catch {}
113566
- const tempPath = join53(claudishDir, `settings-${process.pid}-${Date.now()}.json`);
114492
+ const tempPath = join54(claudishDir, `settings-${process.pid}-${Date.now()}.json`);
113567
114493
  const assignedFile = assignedTokenFile(process.env) !== null;
113568
114494
  const tokenFilePath = resolveTokenFilePath(port);
113569
114495
  cleanupStaleTokenFiles(claudishDir);
@@ -114097,8 +115023,8 @@ async function runClaudeWithProxy(config, proxyUrl, onCleanup, hooks = {}) {
114097
115023
  console.error("Install it from: https://claude.com/claude-code");
114098
115024
  console.error(`
114099
115025
  Or set CLAUDE_PATH to your custom installation:`);
114100
- const home = homedir40();
114101
- const localPath = isWindows2() ? join53(home, ".claude", "local", "claude.exe") : join53(home, ".claude", "local", "claude");
115026
+ const home = homedir41();
115027
+ const localPath = isWindows2() ? join54(home, ".claude", "local", "claude.exe") : join54(home, ".claude", "local", "claude");
114102
115028
  console.error(` export CLAUDE_PATH=${localPath}`);
114103
115029
  process.exit(1);
114104
115030
  }
@@ -114133,7 +115059,7 @@ Or set CLAUDE_PATH to your custom installation:`);
114133
115059
  let driverLaunch = null;
114134
115060
  if (surfaces.driver) {
114135
115061
  const minted = sessionFlags.sessionId || sessionFlags.resumes ? null : randomUUID7();
114136
- const turnDir = mkdtempSync3(join53(tmpdir2(), "claudish-turns-"));
115062
+ const turnDir = mkdtempSync3(join54(tmpdir2(), "claudish-turns-"));
114137
115063
  chmodSync5(turnDir, 448);
114138
115064
  claudeArgs.unshift(...driverLeadingArgs({ mintedSessionId: minted, turnDir }));
114139
115065
  const sink = new InProcessSink;
@@ -114343,23 +115269,23 @@ function setupSignalHandlers(tempSettingsPath, quiet, onCleanup, onDeadline) {
114343
115269
  async function findClaudeBinary(env = process.env) {
114344
115270
  const isWindows = process.platform === "win32";
114345
115271
  if (env.CLAUDE_PATH) {
114346
- if (existsSync37(env.CLAUDE_PATH)) {
115272
+ if (existsSync38(env.CLAUDE_PATH)) {
114347
115273
  return env.CLAUDE_PATH;
114348
115274
  }
114349
115275
  }
114350
- const home = homedir40();
114351
- const localPath = isWindows ? join53(home, ".claude", "local", "claude.exe") : join53(home, ".claude", "local", "claude");
114352
- if (existsSync37(localPath)) {
115276
+ const home = homedir41();
115277
+ const localPath = isWindows ? join54(home, ".claude", "local", "claude.exe") : join54(home, ".claude", "local", "claude");
115278
+ if (existsSync38(localPath)) {
114353
115279
  return localPath;
114354
115280
  }
114355
115281
  if (isWindows) {
114356
115282
  const windowsPaths = [
114357
- join53(home, "AppData", "Roaming", "npm", "claude.cmd"),
114358
- join53(home, ".npm-global", "claude.cmd"),
114359
- join53(home, "node_modules", ".bin", "claude.cmd")
115283
+ join54(home, "AppData", "Roaming", "npm", "claude.cmd"),
115284
+ join54(home, ".npm-global", "claude.cmd"),
115285
+ join54(home, "node_modules", ".bin", "claude.cmd")
114360
115286
  ];
114361
115287
  for (const path of windowsPaths) {
114362
- if (existsSync37(path)) {
115288
+ if (existsSync38(path)) {
114363
115289
  return path;
114364
115290
  }
114365
115291
  }
@@ -114367,14 +115293,14 @@ async function findClaudeBinary(env = process.env) {
114367
115293
  const commonPaths = [
114368
115294
  "/usr/local/bin/claude",
114369
115295
  "/opt/homebrew/bin/claude",
114370
- join53(home, ".npm-global/bin/claude"),
114371
- join53(home, ".local/bin/claude"),
114372
- join53(home, "node_modules/.bin/claude"),
115296
+ join54(home, ".npm-global/bin/claude"),
115297
+ join54(home, ".local/bin/claude"),
115298
+ join54(home, "node_modules/.bin/claude"),
114373
115299
  "/data/data/com.termux/files/usr/bin/claude",
114374
- join53(home, "../usr/bin/claude")
115300
+ join54(home, "../usr/bin/claude")
114375
115301
  ];
114376
115302
  for (const path of commonPaths) {
114377
- if (existsSync37(path)) {
115303
+ if (existsSync38(path)) {
114378
115304
  return path;
114379
115305
  }
114380
115306
  }
@@ -114686,16 +115612,16 @@ var init_slot_row = __esm(() => {
114686
115612
  });
114687
115613
 
114688
115614
  // src/team-stats.ts
114689
- import { existsSync as existsSync38, readFileSync as readFileSync44, writeFileSync as writeFileSync21 } from "fs";
114690
- import { join as join54 } from "path";
115615
+ import { existsSync as existsSync39, readFileSync as readFileSync44, writeFileSync as writeFileSync21 } from "fs";
115616
+ import { join as join55 } from "path";
114691
115617
  function statsDir(sessionPath) {
114692
- return join54(sessionPath, "stats");
115618
+ return join55(sessionPath, "stats");
114693
115619
  }
114694
115620
  function tokenFileFor(sessionPath, anonId) {
114695
- return join54(statsDir(sessionPath), `${anonId}.json`);
115621
+ return join55(statsDir(sessionPath), `${anonId}.json`);
114696
115622
  }
114697
115623
  function readTokenStatsAt(path) {
114698
- if (!existsSync38(path))
115624
+ if (!existsSync39(path))
114699
115625
  return null;
114700
115626
  try {
114701
115627
  return JSON.parse(readFileSync44(path, "utf-8"));
@@ -114855,7 +115781,7 @@ ${segs.join(" \xB7 ")}`;
114855
115781
  }
114856
115782
  function writeStatusFile(sessionPath, manifest, status, opts) {
114857
115783
  try {
114858
- writeFileSync21(join54(sessionPath, "status.txt"), `${renderTeamStats(sessionPath, manifest, status, opts)}
115784
+ writeFileSync21(join55(sessionPath, "status.txt"), `${renderTeamStats(sessionPath, manifest, status, opts)}
114859
115785
  `, "utf-8");
114860
115786
  } catch {}
114861
115787
  }
@@ -114939,15 +115865,15 @@ var init_accounting = __esm(() => {
114939
115865
  // src/view/endpoints.ts
114940
115866
  import { chmodSync as chmodSync6, readdirSync as readdirSync10, rmSync as rmSync13, rmdirSync as rmdirSync2 } from "fs";
114941
115867
  import { createServer as createServer3 } from "net";
114942
- import { join as join55 } from "path";
115868
+ import { join as join56 } from "path";
114943
115869
  function endpointNameOf(pid = process.pid, start36 = OWNER_START36) {
114944
115870
  return `c${pid}-${start36}.sock`;
114945
115871
  }
114946
115872
  function endpointsDirOf(root) {
114947
- return join55(root, ENDPOINTS_DIR);
115873
+ return join56(root, ENDPOINTS_DIR);
114948
115874
  }
114949
115875
  function endpointPathOf(root, name) {
114950
- return join55(endpointsDirOf(root), name);
115876
+ return join56(endpointsDirOf(root), name);
114951
115877
  }
114952
115878
  function ownerOfEndpointName(name) {
114953
115879
  const m = ENDPOINT_NAME_RE.exec(name);
@@ -115229,9 +116155,9 @@ var init_prompt_summary = __esm(() => {
115229
116155
 
115230
116156
  // src/view/token-watch.ts
115231
116157
  import { watch as watch2 } from "fs";
115232
- import { basename as basename5, dirname as dirname22 } from "path";
116158
+ import { basename as basename6, dirname as dirname22 } from "path";
115233
116159
  function watchTokenFile(path, onChange) {
115234
- const name = basename5(path);
116160
+ const name = basename6(path);
115235
116161
  let watcher;
115236
116162
  try {
115237
116163
  watcher = watch2(dirname22(path), (_event, changed) => {
@@ -115380,7 +116306,7 @@ var init_view_claims = __esm(() => {
115380
116306
  // src/team-orchestrator.ts
115381
116307
  import { randomBytes as randomBytes17, randomUUID as randomUUID8 } from "crypto";
115382
116308
  import {
115383
- existsSync as existsSync39,
116309
+ existsSync as existsSync40,
115384
116310
  lstatSync as lstatSync8,
115385
116311
  mkdirSync as mkdirSync27,
115386
116312
  readFileSync as readFileSync45,
@@ -115390,7 +116316,7 @@ import {
115390
116316
  statSync as statSync21,
115391
116317
  writeFileSync as writeFileSync22
115392
116318
  } from "fs";
115393
- import { basename as basename6, dirname as dirname23, join as join56, resolve as resolve7, sep } from "path";
116319
+ import { basename as basename7, dirname as dirname23, join as join57, resolve as resolve7, sep } from "path";
115394
116320
  function setViewServices(services) {
115395
116321
  viewServices = services;
115396
116322
  }
@@ -115468,7 +116394,7 @@ function notableAnomalies(snap) {
115468
116394
  return snap.anomalies.filter((a) => a.startsWith("background_shell_open") || a.startsWith("turn_end_record_missing") || a.startsWith("agent_count_mismatch") || a.startsWith("prompt_not_read"));
115469
116395
  }
115470
116396
  function upstreamLogPath(path, id) {
115471
- return join56(path, "errors", `${id}-upstream.jsonl`);
116397
+ return join57(path, "errors", `${id}-upstream.jsonl`);
115472
116398
  }
115473
116399
  function neverSpawnedRow(e, m, taskType) {
115474
116400
  return {
@@ -115611,9 +116537,9 @@ function teamRunRowFromDisk(path, status) {
115611
116537
  const settled = slots.length > 0 && slots.every((s) => isTerminalState(s.state));
115612
116538
  const completions = Object.values(status.models ?? {}).map((m) => m?.completedAt ? Date.parse(m.completedAt) : Number.NaN).filter(Number.isFinite);
115613
116539
  return {
115614
- run_id: status.runId ?? basename6(path),
116540
+ run_id: status.runId ?? basename7(path),
115615
116541
  path,
115616
- kind: status.kind ?? (basename6(path) === "judging" ? "judge" : "run"),
116542
+ kind: status.kind ?? (basename7(path) === "judging" ? "judge" : "run"),
115617
116543
  started_at: status.startedAt,
115618
116544
  finished_at: settled ? new Date(completions.length ? Math.max(...completions) : statusMtimeMs(path) ?? Date.parse(status.startedAt)).toISOString() : null,
115619
116545
  state: settled ? "SETTLED" : "ACTIVE",
@@ -115623,14 +116549,14 @@ function teamRunRowFromDisk(path, status) {
115623
116549
  }
115624
116550
  function statusMtimeMs(path) {
115625
116551
  try {
115626
- return statSync21(join56(path, "status.json")).mtimeMs;
116552
+ return statSync21(join57(path, "status.json")).mtimeMs;
115627
116553
  } catch {
115628
116554
  return null;
115629
116555
  }
115630
116556
  }
115631
116557
  function readManifestOrNull(path) {
115632
116558
  try {
115633
- return JSON.parse(readFileSync45(join56(path, "manifest.json"), "utf-8"));
116559
+ return JSON.parse(readFileSync45(join57(path, "manifest.json"), "utf-8"));
115634
116560
  } catch {
115635
116561
  return null;
115636
116562
  }
@@ -115773,7 +116699,7 @@ function teamSlotTranscriptSource(path, slot, runId, opts) {
115773
116699
  }
115774
116700
  if (!status || typeof status !== "object" || !status.models || typeof status.models !== "object")
115775
116701
  throw unknownRun(path, runId);
115776
- const fileRunId = typeof status.runId === "string" && status.runId ? status.runId : basename6(resolved);
116702
+ const fileRunId = typeof status.runId === "string" && status.runId ? status.runId : basename7(resolved);
115777
116703
  if (runId !== undefined && runId !== fileRunId)
115778
116704
  throw unknownRun(path, runId);
115779
116705
  const m = Object.hasOwn(status.models, slot) ? status.models[slot] : undefined;
@@ -115997,13 +116923,13 @@ function validateSessionPath(sessionPath) {
115997
116923
  const parent = dirname23(existing);
115998
116924
  if (parent === existing)
115999
116925
  break;
116000
- tail.unshift(basename6(existing));
116926
+ tail.unshift(basename7(existing));
116001
116927
  existing = parent;
116002
116928
  }
116003
116929
  }
116004
116930
  let real;
116005
116931
  try {
116006
- real = join56(realpathSync7(existing), ...tail);
116932
+ real = join57(realpathSync7(existing), ...tail);
116007
116933
  } catch {
116008
116934
  throw outside();
116009
116935
  }
@@ -116019,7 +116945,7 @@ function readTeamInputFile(inputPath) {
116019
116945
  if (!resolved.startsWith(`${cwd}/`) && resolved !== cwd) {
116020
116946
  throw new Error(`Input file must be within current directory: ${inputPath}`);
116021
116947
  }
116022
- if (!existsSync39(resolved)) {
116948
+ if (!existsSync40(resolved)) {
116023
116949
  throw new Error(`Input file not found: ${resolved}`);
116024
116950
  }
116025
116951
  const text = readFileSync45(resolved, "utf-8");
@@ -116032,14 +116958,14 @@ function setupSession(sessionPath, models, input) {
116032
116958
  if (models.length === 0) {
116033
116959
  throw new Error("At least one model is required");
116034
116960
  }
116035
- if (existsSync39(join56(sessionPath, "manifest.json"))) {
116961
+ if (existsSync40(join57(sessionPath, "manifest.json"))) {
116036
116962
  throw new Error(`Session already exists at ${sessionPath}. Use a new directory path or delete the existing session first.`);
116037
116963
  }
116038
- mkdirSync27(join56(sessionPath, "work"), { recursive: true });
116039
- mkdirSync27(join56(sessionPath, "errors"), { recursive: true });
116964
+ mkdirSync27(join57(sessionPath, "work"), { recursive: true });
116965
+ mkdirSync27(join57(sessionPath, "errors"), { recursive: true });
116040
116966
  if (input !== undefined) {
116041
- writeFileSync22(join56(sessionPath, "input.md"), input, "utf-8");
116042
- } else if (!existsSync39(join56(sessionPath, "input.md"))) {
116967
+ writeFileSync22(join57(sessionPath, "input.md"), input, "utf-8");
116968
+ } else if (!existsSync40(join57(sessionPath, "input.md"))) {
116043
116969
  throw new Error(`No input.md found at ${sessionPath} and no input provided`);
116044
116970
  }
116045
116971
  const ids = models.map((_, i) => String(i + 1).padStart(2, "0"));
@@ -116056,9 +116982,9 @@ function setupSession(sessionPath, models, input) {
116056
116982
  model: models[i],
116057
116983
  assignedAt: now
116058
116984
  };
116059
- mkdirSync27(join56(sessionPath, "work", anonId), { recursive: true });
116985
+ mkdirSync27(join57(sessionPath, "work", anonId), { recursive: true });
116060
116986
  }
116061
- writeFileSync22(join56(sessionPath, "manifest.json"), JSON.stringify(manifest, null, 2), "utf-8");
116987
+ writeFileSync22(join57(sessionPath, "manifest.json"), JSON.stringify(manifest, null, 2), "utf-8");
116062
116988
  const status = {
116063
116989
  startedAt: now,
116064
116990
  models: Object.fromEntries(Object.keys(manifest.models).map((id) => [
@@ -116073,7 +116999,7 @@ function setupSession(sessionPath, models, input) {
116073
116999
  }
116074
117000
  ]))
116075
117001
  };
116076
- writeFileAtomic(join56(sessionPath, "status.json"), JSON.stringify(status, null, 2));
117002
+ writeFileAtomic(join57(sessionPath, "status.json"), JSON.stringify(status, null, 2));
116077
117003
  return manifest;
116078
117004
  }
116079
117005
  function assertValidRequirePattern(pattern) {
@@ -116108,7 +117034,7 @@ async function preflightTeamRun(opts) {
116108
117034
  throw new Error(`pane_limit: ${live} live panes for this user, ${opts.slots} more would exceed ${MAX_LIVE_PANES}`);
116109
117035
  }
116110
117036
  function mintRunId(path, startMs) {
116111
- return `${basename6(path)}-${startMs.toString(36)}-${randomBytes17(3).toString("hex")}`;
117037
+ return `${basename7(path)}-${startMs.toString(36)}-${randomBytes17(3).toString("hex")}`;
116112
117038
  }
116113
117039
  function startModels(sessionPath, opts = {}) {
116114
117040
  const flight = { aborted: false };
@@ -116134,9 +117060,9 @@ async function startModelsIn(flight, sessionPath, opts) {
116134
117060
  throw new Error(`invalid_args: ${flagCheck.message}`);
116135
117061
  const agentRequested = requestedAgentOf(claudeFlags);
116136
117062
  const path = resolve7(sessionPath);
116137
- const manifest = JSON.parse(readFileSync45(join56(path, "manifest.json"), "utf-8"));
116138
- const statusPath = join56(path, "status.json");
116139
- const inputContent = readFileSync45(join56(path, "input.md"), "utf-8");
117063
+ const manifest = JSON.parse(readFileSync45(join57(path, "manifest.json"), "utf-8"));
117064
+ const statusPath = join57(path, "status.json");
117065
+ const inputContent = readFileSync45(join57(path, "input.md"), "utf-8");
116140
117066
  const readAvailable = !flagsRemoveRead(claudeFlags);
116141
117067
  const refusal = deliveryRefusal(inputContent, readAvailable);
116142
117068
  if (refusal)
@@ -116180,7 +117106,7 @@ async function startModelsIn(flight, sessionPath, opts) {
116180
117106
  mkdirSync27(statsDir(path), { recursive: true });
116181
117107
  const entries = new Map;
116182
117108
  let run = null;
116183
- const errorLogPathOf = (id) => join56(path, "errors", `${id}.log`);
117109
+ const errorLogPathOf = (id) => join57(path, "errors", `${id}.log`);
116184
117110
  const upstreamLogOf = (id) => upstreamLogPath(path, id);
116185
117111
  const flagsOf = (e) => {
116186
117112
  const effort = opts.efforts?.[e.model];
@@ -116199,7 +117125,7 @@ async function startModelsIn(flight, sessionPath, opts) {
116199
117125
  function writeResponse(e, text) {
116200
117126
  e.answer = text;
116201
117127
  try {
116202
- writeFileSync22(join56(path, `response-${e.id}.md`), text, "utf-8");
117128
+ writeFileSync22(join57(path, `response-${e.id}.md`), text, "utf-8");
116203
117129
  } catch (err) {
116204
117130
  persistErrorLog(errorLogPathOf(e.id), `response file not written: ${String(err)}`, []);
116205
117131
  }
@@ -116209,7 +117135,7 @@ async function startModelsIn(flight, sessionPath, opts) {
116209
117135
  if (e.answer !== null || !e.session)
116210
117136
  return;
116211
117137
  try {
116212
- writeFileSync22(join56(path, `response-${e.id}.md`), e.session.chainText(), "utf-8");
117138
+ writeFileSync22(join57(path, `response-${e.id}.md`), e.session.chainText(), "utf-8");
116213
117139
  } catch (err) {
116214
117140
  persistErrorLog(errorLogPathOf(e.id), `response file not written: ${String(err)}`, []);
116215
117141
  }
@@ -116350,7 +117276,7 @@ async function startModelsIn(flight, sessionPath, opts) {
116350
117276
  screenSnippet: snap.screenTail ? snippetHeadAndTail(redactSecrets(snap.screenTail)) : undefined,
116351
117277
  answerSnippet: answer ? snippetHeadAndTail(redactSecrets(answer)) : undefined,
116352
117278
  errorLogPath,
116353
- upstreamErrorLogPath: existsSync39(upstream) ? upstream : undefined,
117279
+ upstreamErrorLogPath: existsSync40(upstream) ? upstream : undefined,
116354
117280
  workDir: path
116355
117281
  };
116356
117282
  }
@@ -116421,7 +117347,7 @@ async function startModelsIn(flight, sessionPath, opts) {
116421
117347
  }
116422
117348
  async function startSlot(e, uuid, transcriptPath) {
116423
117349
  let session;
116424
- e.inboxPath = createHookInbox(join56(path, "work"), `${e.id}.hook-inbox.jsonl`);
117350
+ e.inboxPath = createHookInbox(join57(path, "work"), `${e.id}.hook-inbox.jsonl`);
116425
117351
  const binding = bindingFor(e, uuid);
116426
117352
  e.binding = binding;
116427
117353
  try {
@@ -116652,7 +117578,7 @@ async function startModelsIn(flight, sessionPath, opts) {
116652
117578
  done.catch((err) => log(`[team] run failed at ${path}: ${err instanceof Error ? err.message : String(err)}`));
116653
117579
  return {
116654
117580
  runId,
116655
- teamSessionId: basename6(path),
117581
+ teamSessionId: basename7(path),
116656
117582
  sessionPath: path,
116657
117583
  slots: Object.fromEntries(Object.entries(manifest.models).map(([anonId, entry]) => [entry.model, anonId])),
116658
117584
  done
@@ -116673,13 +117599,13 @@ async function judgeResponses(sessionPath, opts = {}) {
116673
117599
  const responses = {};
116674
117600
  for (const file of responseFiles) {
116675
117601
  const id = file.replace(/^response-/, "").replace(/\.md$/, "");
116676
- responses[id] = readFileSync45(join56(sessionPath, file), "utf-8");
117602
+ responses[id] = readFileSync45(join57(sessionPath, file), "utf-8");
116677
117603
  }
116678
- const input = readFileSync45(join56(sessionPath, "input.md"), "utf-8");
117604
+ const input = readFileSync45(join57(sessionPath, "input.md"), "utf-8");
116679
117605
  const judgePrompt = buildJudgePrompt(input, responses);
116680
- writeFileSync22(join56(sessionPath, "judge-prompt.md"), judgePrompt, "utf-8");
117606
+ writeFileSync22(join57(sessionPath, "judge-prompt.md"), judgePrompt, "utf-8");
116681
117607
  const judgeModels = opts.judges ?? getDefaultJudgeModels(sessionPath);
116682
- const judgePath = join56(sessionPath, "judging");
117608
+ const judgePath = join57(sessionPath, "judging");
116683
117609
  mkdirSync27(judgePath, { recursive: true });
116684
117610
  setupSession(judgePath, judgeModels, judgePrompt);
116685
117611
  await runModels(judgePath, {
@@ -116692,11 +117618,11 @@ async function judgeResponses(sessionPath, opts = {}) {
116692
117618
  });
116693
117619
  const votes = parseJudgeVotes(judgePath, Object.keys(responses));
116694
117620
  const verdict = aggregateVerdict(votes, Object.keys(responses));
116695
- writeFileSync22(join56(sessionPath, "verdict.md"), formatVerdict(verdict, sessionPath), "utf-8");
117621
+ writeFileSync22(join57(sessionPath, "verdict.md"), formatVerdict(verdict, sessionPath), "utf-8");
116696
117622
  return verdict;
116697
117623
  }
116698
117624
  function getStatus(sessionPath) {
116699
- return JSON.parse(readFileSync45(join56(sessionPath, "status.json"), "utf-8"));
117625
+ return JSON.parse(readFileSync45(join57(sessionPath, "status.json"), "utf-8"));
116700
117626
  }
116701
117627
  function readTeamStatus(sessionPath) {
116702
117628
  try {
@@ -116736,7 +117662,7 @@ function fisherYatesShuffle(arr) {
116736
117662
  return arr;
116737
117663
  }
116738
117664
  function getDefaultJudgeModels(sessionPath) {
116739
- const manifest = JSON.parse(readFileSync45(join56(sessionPath, "manifest.json"), "utf-8"));
117665
+ const manifest = JSON.parse(readFileSync45(join57(sessionPath, "manifest.json"), "utf-8"));
116740
117666
  return Object.values(manifest.models).map((e) => e.model);
116741
117667
  }
116742
117668
  function buildJudgePrompt(input, responses) {
@@ -116799,7 +117725,7 @@ function parseJudgeVotes(judgePath, responseIds) {
116799
117725
  const judgeId = file.replace(/^response-/, "").replace(/\.md$/, "");
116800
117726
  let content;
116801
117727
  try {
116802
- content = readFileSync45(join56(judgePath, file), "utf-8");
117728
+ content = readFileSync45(join57(judgePath, file), "utf-8");
116803
117729
  } catch (err) {
116804
117730
  log(`[team] judge answer ${file} unreadable: ${err instanceof Error ? err.message : String(err)}`);
116805
117731
  continue;
@@ -116852,7 +117778,7 @@ function aggregateVerdict(votes, responseIds) {
116852
117778
  function formatVerdict(verdict, sessionPath) {
116853
117779
  let manifest = null;
116854
117780
  try {
116855
- manifest = JSON.parse(readFileSync45(join56(sessionPath, "manifest.json"), "utf-8"));
117781
+ manifest = JSON.parse(readFileSync45(join57(sessionPath, "manifest.json"), "utf-8"));
116856
117782
  } catch {}
116857
117783
  let output = `# Team Verdict
116858
117784
 
@@ -116912,8 +117838,8 @@ var init_team_orchestrator = __esm(() => {
116912
117838
  });
116913
117839
 
116914
117840
  // src/mcp-session/inherited-settings.ts
116915
- import { existsSync as existsSync40, readFileSync as readFileSync46, statSync as statSync22 } from "fs";
116916
- import { join as join57, resolve as resolve8 } from "path";
117841
+ import { existsSync as existsSync41, readFileSync as readFileSync46, statSync as statSync22 } from "fs";
117842
+ import { join as join58, resolve as resolve8 } from "path";
116917
117843
  function isPlainObject7(value) {
116918
117844
  return typeof value === "object" && value !== null && !Array.isArray(value);
116919
117845
  }
@@ -116967,8 +117893,8 @@ function readSettingsValue(value) {
116967
117893
  function buildInheritedSettingsLayer(setupFrom, callerFlags) {
116968
117894
  const layers = [];
116969
117895
  for (const name of ["settings.json", "settings.local.json"]) {
116970
- const file = join57(setupFrom, ".claude", name);
116971
- if (!existsSync40(file))
117896
+ const file = join58(setupFrom, ".claude", name);
117897
+ if (!existsSync41(file))
116972
117898
  continue;
116973
117899
  layers.push(parseLayer(readFileSync46(file, "utf-8"), file));
116974
117900
  }
@@ -117012,7 +117938,7 @@ var init_inherited_settings = () => {};
117012
117938
 
117013
117939
  // src/mcp-session/parent-session.ts
117014
117940
  import { readFile as readFile7 } from "fs/promises";
117015
- import { join as join58 } from "path";
117941
+ import { join as join59 } from "path";
117016
117942
  function positiveInt(value) {
117017
117943
  if (value === undefined || !/^[1-9][0-9]*$/.test(value))
117018
117944
  return;
@@ -117036,7 +117962,7 @@ function parentSessionIdFrom(env) {
117036
117962
  }
117037
117963
  async function readHostSessionRecord(opts) {
117038
117964
  try {
117039
- const raw = await readFile7(join58(opts.configDir, "sessions", `${opts.hostPid}.json`), "utf-8");
117965
+ const raw = await readFile7(join59(opts.configDir, "sessions", `${opts.hostPid}.json`), "utf-8");
117040
117966
  const parsed = JSON.parse(raw);
117041
117967
  if (!parsed || typeof parsed !== "object")
117042
117968
  return;
@@ -117127,7 +118053,7 @@ import {
117127
118053
  appendFileSync as appendFileSync7,
117128
118054
  closeSync as closeSync16,
117129
118055
  createWriteStream,
117130
- existsSync as existsSync41,
118056
+ existsSync as existsSync42,
117131
118057
  mkdirSync as mkdirSync28,
117132
118058
  openSync as openSync16,
117133
118059
  readFileSync as readFileSync47,
@@ -117137,7 +118063,7 @@ import {
117137
118063
  statSync as statSync23,
117138
118064
  writeFileSync as writeFileSync23
117139
118065
  } from "fs";
117140
- import { join as join59, resolve as resolve9, sep as sep2 } from "path";
118066
+ import { join as join60, resolve as resolve9, sep as sep2 } from "path";
117141
118067
  function normaliseTimeoutSeconds(raw) {
117142
118068
  const n = typeof raw === "string" && raw.trim() !== "" ? Number(raw) : raw;
117143
118069
  if (typeof n !== "number" || !Number.isFinite(n))
@@ -117310,7 +118236,7 @@ function dropLeadingFragment(tail) {
117310
118236
  return firstBreak === -1 ? tail.text : tail.text.slice(firstBreak + 1);
117311
118237
  }
117312
118238
  function diskAccounting(sessionDir) {
117313
- const stats = readTokenStatsAt(join59(sessionDir, "tokens.json"));
118239
+ const stats = readTokenStatsAt(join60(sessionDir, "tokens.json"));
117314
118240
  return {
117315
118241
  tokensIn: stats?.billed_input_tokens ?? null,
117316
118242
  tokensOut: stats?.output_tokens ?? null,
@@ -117399,7 +118325,7 @@ class SessionManager {
117399
118325
  let dir = "";
117400
118326
  for (let attempt = 0;; attempt++) {
117401
118327
  id = `team-${randomUUID9().replace(/-/g, "").slice(0, 8)}`;
117402
- dir = join59(this.sessionsDir, id);
118328
+ dir = join60(this.sessionsDir, id);
117403
118329
  try {
117404
118330
  mkdirSync28(dir);
117405
118331
  break;
@@ -117431,9 +118357,9 @@ class SessionManager {
117431
118357
  if (dir === null)
117432
118358
  throw new Error("not a record id");
117433
118359
  const completedAt = new Date().toISOString();
117434
- const startedAt = this.teamRunStarts.get(record) ?? metaString(readJsonObject(join59(dir, "spawn.json"), META_READ_LIMIT)?.startedAt) ?? completedAt;
118360
+ const startedAt = this.teamRunStarts.get(record) ?? metaString(readJsonObject(join60(dir, "spawn.json"), META_READ_LIMIT)?.startedAt) ?? completedAt;
117435
118361
  const elapsedMs = Date.parse(completedAt) - Date.parse(startedAt);
117436
- writeJsonAtomic(join59(dir, "meta.json"), {
118362
+ writeJsonAtomic(join60(dir, "meta.json"), {
117437
118363
  kind: "team",
117438
118364
  status: outcome.status,
117439
118365
  startedAt,
@@ -117465,7 +118391,7 @@ class SessionManager {
117465
118391
  startedAt,
117466
118392
  ...rest
117467
118393
  };
117468
- writeJsonAtomic(join59(dir, "spawn.json"), body);
118394
+ writeJsonAtomic(join60(dir, "spawn.json"), body);
117469
118395
  }
117470
118396
  async createSession(opts) {
117471
118397
  if (this.activeSessions + this.starting >= this.maxSessions) {
@@ -117505,7 +118431,7 @@ class SessionManager {
117505
118431
  throw err;
117506
118432
  }
117507
118433
  if (inherited.layer) {
117508
- flags = [...inherited.restFlags, "--settings", join59(entry.sessionDir, INHERITED_SETTINGS)];
118434
+ flags = [...inherited.restFlags, "--settings", join60(entry.sessionDir, INHERITED_SETTINGS)];
117509
118435
  }
117510
118436
  this.sessions.set(entry.info.sessionId, entry);
117511
118437
  uncount();
@@ -117530,10 +118456,10 @@ class SessionManager {
117530
118456
  const timeout = normaliseTimeoutSeconds(opts.timeoutSeconds);
117531
118457
  const agentRequested = requestedAgentOf(opts.claudishFlags ?? []);
117532
118458
  const startedAt = new Date().toISOString();
117533
- const sessionDir = opts.sessionDir ?? join59(this.sessionsDir, sessionId);
118459
+ const sessionDir = opts.sessionDir ?? join60(this.sessionsDir, sessionId);
117534
118460
  mkdirSync28(sessionDir, { recursive: true });
117535
118461
  if (opts.prompt)
117536
- writeFileSync23(join59(sessionDir, "prompt.md"), opts.prompt, "utf-8");
118462
+ writeFileSync23(join60(sessionDir, "prompt.md"), opts.prompt, "utf-8");
117537
118463
  this.writeSpawnRecord(sessionDir, {
117538
118464
  kind: "session",
117539
118465
  sessionId,
@@ -117547,13 +118473,13 @@ class SessionManager {
117547
118473
  taskType: opts.taskType
117548
118474
  });
117549
118475
  if (inheritedLayer) {
117550
- writeFileSync23(join59(sessionDir, INHERITED_SETTINGS), `${JSON.stringify(inheritedLayer, null, 2)}
118476
+ writeFileSync23(join60(sessionDir, INHERITED_SETTINGS), `${JSON.stringify(inheritedLayer, null, 2)}
117551
118477
  `, { encoding: "utf-8", mode: 384 });
117552
118478
  }
117553
118479
  const cwd = opts.cwd ?? process.cwd();
117554
118480
  const parentEnv = opts.parentEnv ?? this.parentEnv;
117555
118481
  const spawnModel = opts.spawnModel ?? null;
117556
- const tokenFile = opts.tokenFile ?? join59(sessionDir, "tokens.json");
118482
+ const tokenFile = opts.tokenFile ?? join60(sessionDir, "tokens.json");
117557
118483
  return {
117558
118484
  info: {
117559
118485
  sessionId,
@@ -117592,18 +118518,18 @@ class SessionManager {
117592
118518
  },
117593
118519
  session: null,
117594
118520
  scrollback: new ScrollbackBuffer(this.scrollbackCapacity),
117595
- outputLogStream: createWriteStream(join59(sessionDir, "output.log")),
118521
+ outputLogStream: createWriteStream(join60(sessionDir, "output.log")),
117596
118522
  sessionDir,
117597
118523
  cwd,
117598
118524
  tokenFile,
117599
- eventLogPath: join59(sessionDir, "events.jsonl"),
118525
+ eventLogPath: join60(sessionDir, "events.jsonl"),
117600
118526
  eventLogBytes: 0,
117601
- upstreamErrorLogPath: join59(sessionDir, "upstream-errors.jsonl"),
118527
+ upstreamErrorLogPath: join60(sessionDir, "upstream-errors.jsonl"),
117602
118528
  eventRing: [],
117603
118529
  proseBytes: 0,
117604
118530
  answeredTurns: new Map,
117605
118531
  inboxPath: null,
117606
- waitLogPath: join59(sessionDir, "waits.jsonl"),
118532
+ waitLogPath: join60(sessionDir, "waits.jsonl"),
117607
118533
  waitLogBytes: 0,
117608
118534
  waitSince: null,
117609
118535
  ended: false,
@@ -117825,7 +118751,7 @@ class SessionManager {
117825
118751
  try {
117826
118752
  const text = screenLines.join(`
117827
118753
  `).replace(/\s+$/, "");
117828
- writeFileSync23(join59(entry.sessionDir, "screen.txt"), `${redactSecrets(text)}
118754
+ writeFileSync23(join60(entry.sessionDir, "screen.txt"), `${redactSecrets(text)}
117829
118755
  `, "utf-8");
117830
118756
  } catch {}
117831
118757
  }
@@ -117839,7 +118765,7 @@ class SessionManager {
117839
118765
  entry.waitSince = null;
117840
118766
  }
117841
118767
  try {
117842
- writeJsonAtomic(join59(entry.sessionDir, "meta.json"), toMetaRecord(entry.info, entry.cwd));
118768
+ writeJsonAtomic(join60(entry.sessionDir, "meta.json"), toMetaRecord(entry.info, entry.cwd));
117843
118769
  } catch (err) {
117844
118770
  process.stderr.write(`[claudish] session ${entry.info.sessionId}: could not write meta.json: ` + `${err instanceof Error ? err.message : String(err)}
117845
118771
  `);
@@ -118109,8 +119035,8 @@ class SessionManager {
118109
119035
  } catch {
118110
119036
  return null;
118111
119037
  }
118112
- const spawnPath = join59(sessionDir, "spawn.json");
118113
- const metaPath = join59(sessionDir, "meta.json");
119038
+ const spawnPath = join60(sessionDir, "spawn.json");
119039
+ const metaPath = join60(sessionDir, "meta.json");
118114
119040
  const spawnRecord = readJsonObject(spawnPath, META_READ_LIMIT);
118115
119041
  if (spawnRecord?.kind === "team")
118116
119042
  return null;
@@ -118129,7 +119055,7 @@ class SessionManager {
118129
119055
  const age = Number.isFinite(endedMs) ? now - endedMs : fileAgeMs(metaPath, now);
118130
119056
  if (uuid) {
118131
119057
  const stored = metaString(meta.transcriptPath);
118132
- if (stored && existsSync41(stored))
119058
+ if (stored && existsSync42(stored))
118133
119059
  transcriptPath = stored;
118134
119060
  else if (cwd)
118135
119061
  transcriptPath = transcriptPathFor(cwd, uuid, projectsRoot);
@@ -118201,7 +119127,7 @@ class SessionManager {
118201
119127
  if (!record)
118202
119128
  return null;
118203
119129
  const info = record.info;
118204
- return sessionRowOf(info, upstreamRecordsFor(info, join59(record.sessionDir, "upstream-errors.jsonl")));
119130
+ return sessionRowOf(info, upstreamRecordsFor(info, join60(record.sessionDir, "upstream-errors.jsonl")));
118205
119131
  }
118206
119132
  async shutdownAll() {
118207
119133
  await Promise.all([...this.pendingStarts]);
@@ -118232,7 +119158,7 @@ class SessionManager {
118232
119158
  return null;
118233
119159
  const root = resolve9(this.sessionsDir);
118234
119160
  const dir = resolve9(root, sessionId);
118235
- if (dir !== join59(root, sessionId))
119161
+ if (dir !== join60(root, sessionId))
118236
119162
  return null;
118237
119163
  if (!dir.startsWith(root + sep2))
118238
119164
  return null;
@@ -118251,10 +119177,10 @@ class SessionManager {
118251
119177
  } catch {
118252
119178
  return null;
118253
119179
  }
118254
- const spawnRecord = readJsonObject(join59(sessionDir, "spawn.json"), META_READ_LIMIT);
119180
+ const spawnRecord = readJsonObject(join60(sessionDir, "spawn.json"), META_READ_LIMIT);
118255
119181
  if (spawnRecord?.kind === "team")
118256
119182
  return null;
118257
- const meta = readJsonObject(join59(sessionDir, "meta.json"), META_READ_LIMIT);
119183
+ const meta = readJsonObject(join60(sessionDir, "meta.json"), META_READ_LIMIT);
118258
119184
  if (meta?.kind === "team")
118259
119185
  return null;
118260
119186
  const partial = meta === null;
@@ -118269,14 +119195,14 @@ class SessionManager {
118269
119195
  diskTranscriptPath(meta, uuid) {
118270
119196
  const stored = metaString(meta?.transcriptPath) ?? "";
118271
119197
  const cwd = metaString(meta?.cwd);
118272
- if (stored && existsSync41(stored))
119198
+ if (stored && existsSync42(stored))
118273
119199
  return stored;
118274
119200
  if (cwd && uuid)
118275
119201
  return transcriptPathFor(cwd, uuid, projectsDir(this.parentEnv, cwd));
118276
119202
  return stored;
118277
119203
  }
118278
119204
  diskOutput(record, tailLines) {
118279
- const tail = readTailText(join59(record.sessionDir, "output.log"), OUTPUT_TAIL_BYTES);
119205
+ const tail = readTailText(join60(record.sessionDir, "output.log"), OUTPUT_TAIL_BYTES);
118280
119206
  const buffer = new ScrollbackBuffer(this.scrollbackCapacity);
118281
119207
  if (tail?.text)
118282
119208
  buffer.append(dropLeadingFragment(tail));
@@ -118296,12 +119222,12 @@ class SessionManager {
118296
119222
  }
118297
119223
  diskDiagnostics(record, limit) {
118298
119224
  const { sessionDir, info } = record;
118299
- const eventLogPath = join59(sessionDir, "events.jsonl");
118300
- const upstreamErrorLogPath = join59(sessionDir, "upstream-errors.jsonl");
118301
- const outputLogPath = join59(sessionDir, "output.log");
119225
+ const eventLogPath = join60(sessionDir, "events.jsonl");
119226
+ const upstreamErrorLogPath = join60(sessionDir, "upstream-errors.jsonl");
119227
+ const outputLogPath = join60(sessionDir, "output.log");
118302
119228
  const events = readTailLines2(eventLogPath, EVENT_TAIL_BYTES);
118303
119229
  const outputTail = readTailText(outputLogPath, OUTPUT_TAIL_BYTES);
118304
- const screen = readTailText(join59(sessionDir, "screen.txt"), SCREEN_READ_BYTES);
119230
+ const screen = readTailText(join60(sessionDir, "screen.txt"), SCREEN_READ_BYTES);
118305
119231
  return {
118306
119232
  sessionId: info.sessionId,
118307
119233
  state: info.state,
@@ -118606,7 +119532,7 @@ var init_session_manager = __esm(() => {
118606
119532
 
118607
119533
  // src/view/history.ts
118608
119534
  import { closeSync as closeSync17, openSync as openSync17, readSync as readSync8, readdirSync as readdirSync12, statSync as statSync24 } from "fs";
118609
- import { join as join60 } from "path";
119535
+ import { join as join61 } from "path";
118610
119536
  function finishedDetail(promptSummary) {
118611
119537
  return {
118612
119538
  prompt_summary: promptSummary,
@@ -118648,7 +119574,7 @@ function runDirs(sessionsDir) {
118648
119574
  const dated = [];
118649
119575
  for (const name of names) {
118650
119576
  try {
118651
- const st = statSync24(join60(sessionsDir, name));
119577
+ const st = statSync24(join61(sessionsDir, name));
118652
119578
  if (st.isDirectory())
118653
119579
  dated.push({ name, mtimeMs: st.mtimeMs });
118654
119580
  } catch {}
@@ -118685,7 +119611,7 @@ function teamItems(spawn) {
118685
119611
  return { runId: run.run_id, items };
118686
119612
  }
118687
119613
  function runItems(sessions, dir, name, seenRuns) {
118688
- const spawn = readJson(join60(dir, "spawn.json"));
119614
+ const spawn = readJson(join61(dir, "spawn.json"));
118689
119615
  if (spawn?.kind === "team" || name.startsWith("team-")) {
118690
119616
  const team = spawn ? teamItems(spawn) : null;
118691
119617
  if (!team || seenRuns.has(team.runId) || team.items.length === 0)
@@ -118693,12 +119619,12 @@ function runItems(sessions, dir, name, seenRuns) {
118693
119619
  seenRuns.add(team.runId);
118694
119620
  return team.items;
118695
119621
  }
118696
- if (!spawn && readJson(join60(dir, "meta.json")) === null)
119622
+ if (!spawn && readJson(join61(dir, "meta.json")) === null)
118697
119623
  return null;
118698
119624
  const row = sessions.diskSessionRow(name);
118699
119625
  if (!row)
118700
119626
  return null;
118701
- const prompt = readHead(join60(dir, "prompt.md"), PROMPT_HEAD_BYTES);
119627
+ const prompt = readHead(join61(dir, "prompt.md"), PROMPT_HEAD_BYTES);
118702
119628
  return [sessionItem(row, prompt ? promptSummaryOf(prompt) : null)];
118703
119629
  }
118704
119630
  function readHistory(o = {}) {
@@ -118711,7 +119637,7 @@ function readHistory(o = {}) {
118711
119637
  for (const name of runDirs(sessionsDir)) {
118712
119638
  if (runs >= limit)
118713
119639
  break;
118714
- const items = runItems(sessions, join60(sessionsDir, name), name, seenRuns);
119640
+ const items = runItems(sessions, join61(sessionsDir, name), name, seenRuns);
118715
119641
  if (!items)
118716
119642
  continue;
118717
119643
  out.push(...items);
@@ -118726,15 +119652,15 @@ function findRecordedItem(target, o = {}) {
118726
119652
  const id = target.slice(2);
118727
119653
  if (!id || id.includes("/") || id.startsWith("."))
118728
119654
  return null;
118729
- const items = runItems(sessions, join60(sessionsDir, id), id, new Set);
119655
+ const items = runItems(sessions, join61(sessionsDir, id), id, new Set);
118730
119656
  return items?.find((i) => i.target === target) ?? null;
118731
119657
  }
118732
119658
  if (!target.startsWith("t:"))
118733
119659
  return null;
118734
119660
  const seenRuns = new Set;
118735
119661
  for (const name of runDirs(sessionsDir)) {
118736
- const dir = join60(sessionsDir, name);
118737
- if (!name.startsWith("team-") && readJson(join60(dir, "spawn.json"))?.kind !== "team")
119662
+ const dir = join61(sessionsDir, name);
119663
+ if (!name.startsWith("team-") && readJson(join61(dir, "spawn.json"))?.kind !== "team")
118738
119664
  continue;
118739
119665
  const found = runItems(sessions, dir, name, seenRuns)?.find((i) => i.target === target);
118740
119666
  if (found)
@@ -118786,7 +119712,7 @@ class LineBuffer {
118786
119712
 
118787
119713
  // src/view/view-client.ts
118788
119714
  import { connect } from "net";
118789
- import { basename as basename7 } from "path";
119715
+ import { basename as basename8 } from "path";
118790
119716
  function dial(path) {
118791
119717
  return new Promise((resolve, reject) => {
118792
119718
  const sock = connect(path);
@@ -118936,7 +119862,7 @@ class ViewClient {
118936
119862
  }
118937
119863
  async redial() {
118938
119864
  let wait = RECONNECT_FIRST_MS;
118939
- const name = basename7(this.path);
119865
+ const name = basename8(this.path);
118940
119866
  while (!this.ended) {
118941
119867
  if (!endpointOwnerAlive(name, await readProcessTableAsync())) {
118942
119868
  this.end("server_gone");
@@ -118986,9 +119912,9 @@ var init_view_client = __esm(() => {
118986
119912
 
118987
119913
  // src/view/feed-relay.ts
118988
119914
  import { chmodSync as chmodSync7, readFileSync as readFileSync48, renameSync as renameSync11, rmSync as rmSync16, writeFileSync as writeFileSync24 } from "fs";
118989
- import { dirname as dirname24, join as join61 } from "path";
119915
+ import { dirname as dirname24, join as join62 } from "path";
118990
119916
  function defaultFeedPath(root) {
118991
- return join61(root, FEED_DIR, FEED_FILE);
119917
+ return join62(root, FEED_DIR, FEED_FILE);
118992
119918
  }
118993
119919
  function ownStamp() {
118994
119920
  return {
@@ -119056,7 +119982,7 @@ class FeedRelay {
119056
119982
  }
119057
119983
  async start() {
119058
119984
  ensureSockRoot(this.o.root);
119059
- if (dirname24(this.path) === join61(this.o.root, FEED_DIR))
119985
+ if (dirname24(this.path) === join62(this.o.root, FEED_DIR))
119060
119986
  ensurePrivateSubdir(this.o.root, FEED_DIR);
119061
119987
  const other = readFeedStamp(this.path);
119062
119988
  if (other && !this.isOwn(other) && stampAlive(other, await readProcessTableAsync()))
@@ -119311,7 +120237,7 @@ var init_feed_relay = __esm(() => {
119311
120237
  import {
119312
120238
  constants as constants4,
119313
120239
  accessSync as accessSync2,
119314
- existsSync as existsSync42,
120240
+ existsSync as existsSync43,
119315
120241
  lstatSync as lstatSync9,
119316
120242
  readFileSync as readFileSync49,
119317
120243
  readdirSync as readdirSync13,
@@ -119321,7 +120247,7 @@ import {
119321
120247
  unlinkSync as unlinkSync12,
119322
120248
  writeFileSync as writeFileSync25
119323
120249
  } from "fs";
119324
- import { dirname as dirname25, join as join62 } from "path";
120250
+ import { dirname as dirname25, join as join63 } from "path";
119325
120251
  function ownerStartOfSelf() {
119326
120252
  if (ownStart)
119327
120253
  return ownStart;
@@ -119342,7 +120268,7 @@ function ownerAlive(owner, table) {
119342
120268
  return !minted || startedAt(row, minted.startMs);
119343
120269
  }
119344
120270
  function recordsDir(root) {
119345
- return join62(root, "panes");
120271
+ return join63(root, "panes");
119346
120272
  }
119347
120273
  function writeRecord(root, rec) {
119348
120274
  const p = recordPathOf(root, rec.paneId);
@@ -119426,13 +120352,13 @@ function readRecords(root) {
119426
120352
  }
119427
120353
  function readGroupFile(ctlDir) {
119428
120354
  try {
119429
- return parseGroupFile(readFileSync49(join62(ctlDir, "group"), "utf8"));
120355
+ return parseGroupFile(readFileSync49(join63(ctlDir, "group"), "utf8"));
119430
120356
  } catch {
119431
120357
  return null;
119432
120358
  }
119433
120359
  }
119434
120360
  function writeGroupFile(ctlDir, snap) {
119435
- const p = join62(ctlDir, "group");
120361
+ const p = join63(ctlDir, "group");
119436
120362
  const tmp = `${p}.tmp`;
119437
120363
  try {
119438
120364
  writeFileSync25(tmp, formatGroupFile(snap), { mode: 384 });
@@ -119726,7 +120652,7 @@ async function sweepRecordlessSocket(root, name, out) {
119726
120652
  const owner = ownerOfSocketId(id);
119727
120653
  if (!owner || ownerAlive(owner, table))
119728
120654
  return;
119729
- const sockPath = join62(root, name);
120655
+ const sockPath = join63(root, name);
119730
120656
  const magmuxMayLive = !table || table.some((r) => isPaneMagmuxCommand(r.command, id));
119731
120657
  const probe = await probeSocket(sockPath, magmuxMayLive);
119732
120658
  if (probe.state === "stale") {
@@ -119772,7 +120698,7 @@ function sweepRecordlessViewSockets(root, out) {
119772
120698
  const table = readProcessTable();
119773
120699
  for (const n of names) {
119774
120700
  const id = n.slice("magmux-".length, -".view".length);
119775
- if (known.has(id) || live.has(id) || existsSync42(sockPathOf(root, id)))
120701
+ if (known.has(id) || live.has(id) || existsSync43(sockPathOf(root, id)))
119776
120702
  continue;
119777
120703
  const owner = ownerOfSocketId(id);
119778
120704
  if (!owner || ownerAlive(owner, table))
@@ -119806,7 +120732,7 @@ async function ensureSwept(root) {
119806
120732
  }
119807
120733
  async function sweepOrphanPanes(root = sockRootFor()) {
119808
120734
  const out = { reaped: [], cleaned: [], kept: [] };
119809
- if (!existsSync42(root))
120735
+ if (!existsSync43(root))
119810
120736
  return out;
119811
120737
  ensureSockRoot(root);
119812
120738
  const records = readRecords(root);
@@ -119854,19 +120780,19 @@ var init_pane_registry = __esm(() => {
119854
120780
 
119855
120781
  // src/pane/gate-binding.ts
119856
120782
  import { realpathSync as realpathSync8 } from "fs";
119857
- import { basename as basename8, dirname as dirname26, join as join63, resolve as resolve10 } from "path";
120783
+ import { basename as basename9, dirname as dirname26, join as join64, resolve as resolve10 } from "path";
119858
120784
  function normaliseTranscriptPath(p) {
119859
120785
  const abs = resolve10(p);
119860
120786
  const tail = [];
119861
120787
  let cur = abs;
119862
120788
  for (;; ) {
119863
120789
  try {
119864
- return tail.length ? join63(realpathSync8(cur), ...tail.reverse()) : realpathSync8(cur);
120790
+ return tail.length ? join64(realpathSync8(cur), ...tail.reverse()) : realpathSync8(cur);
119865
120791
  } catch {
119866
120792
  const parent = dirname26(cur);
119867
120793
  if (parent === cur)
119868
120794
  return abs;
119869
- tail.push(basename8(cur));
120795
+ tail.push(basename9(cur));
119870
120796
  cur = parent;
119871
120797
  }
119872
120798
  }
@@ -120062,7 +120988,7 @@ var init_scroll_input = __esm(() => {
120062
120988
 
120063
120989
  // src/pane/session-registry.ts
120064
120990
  import { readFileSync as readFileSync50, readdirSync as readdirSync14 } from "fs";
120065
- import { join as join64 } from "path";
120991
+ import { join as join65 } from "path";
120066
120992
  function parseRegistryRecord(raw) {
120067
120993
  let parsed;
120068
120994
  try {
@@ -120107,7 +121033,7 @@ class SessionRegistry {
120107
121033
  isAlive;
120108
121034
  constructor(o) {
120109
121035
  this.o = o;
120110
- this.dir = join64(o.configDir, "sessions");
121036
+ this.dir = join65(o.configDir, "sessions");
120111
121037
  this.now = o.now ?? Date.now;
120112
121038
  this.isAlive = o.isAlive ?? pidAlive2;
120113
121039
  }
@@ -120143,7 +121069,7 @@ class SessionRegistry {
120143
121069
  readPid(pid) {
120144
121070
  let raw;
120145
121071
  try {
120146
- raw = readFileSync50(join64(this.dir, `${pid}.json`), "utf8");
121072
+ raw = readFileSync50(join65(this.dir, `${pid}.json`), "utf8");
120147
121073
  } catch {
120148
121074
  return null;
120149
121075
  }
@@ -120288,7 +121214,7 @@ var init_view_socket = __esm(() => {
120288
121214
 
120289
121215
  // src/pane/pane-session.ts
120290
121216
  import { readFileSync as readFileSync51, realpathSync as realpathSync9, rmSync as rmSync18, statSync as statSync25, writeFileSync as writeFileSync26 } from "fs";
120291
- import { join as join65 } from "path";
121217
+ import { join as join66 } from "path";
120292
121218
  function iso3(ms) {
120293
121219
  return new Date(ms).toISOString();
120294
121220
  }
@@ -120441,7 +121367,7 @@ class PaneSessionImpl {
120441
121367
  });
120442
121368
  this.secondaryQuietMs = o.timings?.secondaryQuietMs ?? SECONDARY_QUIET_MS;
120443
121369
  this.corroborationMs = o.timings?.corroborationMs ?? CORROBORATION_MS;
120444
- this.follower = new TranscriptFollower(o.transcriptPath, join65(o.transcriptPath.replace(/\.jsonl$/, ""), "subagents"));
121370
+ this.follower = new TranscriptFollower(o.transcriptPath, join66(o.transcriptPath.replace(/\.jsonl$/, ""), "subagents"));
120445
121371
  this.registry = new SessionRegistry({
120446
121372
  configDir: claudeCodeConfigDir(o.parentEnv ?? process.env, o.cwd),
120447
121373
  sessionUuid: o.sessionUuid
@@ -120488,7 +121414,7 @@ class PaneSessionImpl {
120488
121414
  return this.spawnFailed(new Error("magmux did not start"));
120489
121415
  this.magmux = proc;
120490
121416
  try {
120491
- writeFileSync26(join65(this.ctlDir, "magmux.pid"), `${proc.pid}
121417
+ writeFileSync26(join66(this.ctlDir, "magmux.pid"), `${proc.pid}
120492
121418
  `, { mode: 384 });
120493
121419
  } catch {}
120494
121420
  updateRecord(this.root, this.paneId, { magmuxPid: proc.pid });
@@ -123023,7 +123949,7 @@ var init_pane_session = __esm(() => {
123023
123949
 
123024
123950
  // src/pane/replay-pane.ts
123025
123951
  import { rmSync as rmSync19, writeFileSync as writeFileSync27 } from "fs";
123026
- import { join as join66 } from "path";
123952
+ import { join as join67 } from "path";
123027
123953
  async function waitUntil(pred, ms) {
123028
123954
  const end = Date.now() + ms;
123029
123955
  while (!pred() && Date.now() < end)
@@ -123136,7 +124062,7 @@ class ReplayPane {
123136
124062
  return failed(new Error("magmux did not start"));
123137
124063
  this.magmuxProc = proc;
123138
124064
  try {
123139
- writeFileSync27(join66(this.ctlDir, "magmux.pid"), `${proc.pid}
124065
+ writeFileSync27(join67(this.ctlDir, "magmux.pid"), `${proc.pid}
123140
124066
  `, { mode: 384 });
123141
124067
  } catch {}
123142
124068
  updateRecord(this.root, this.paneId, { magmuxPid: proc.pid });
@@ -124063,7 +124989,7 @@ import {
124063
124989
  realpathSync as realpathSync10,
124064
124990
  statSync as statSync26
124065
124991
  } from "fs";
124066
- import { basename as basename9, dirname as dirname27, join as join67, sep as sep3 } from "path";
124992
+ import { basename as basename10, dirname as dirname27, join as join68, sep as sep3 } from "path";
124067
124993
  function isUuid(v) {
124068
124994
  return typeof v === "string" && UUID_RE.test(v);
124069
124995
  }
@@ -124213,7 +125139,7 @@ function locateTranscriptByUuid(projectsRoot, uuid) {
124213
125139
  }
124214
125140
  let hit = null;
124215
125141
  for (const d of dirs) {
124216
- const p = join67(projectsRoot, d, `${uuid}.jsonl`);
125142
+ const p = join68(projectsRoot, d, `${uuid}.jsonl`);
124217
125143
  try {
124218
125144
  if (!statSync26(p).isFile())
124219
125145
  continue;
@@ -124268,7 +125194,7 @@ function errText(e) {
124268
125194
  return e instanceof Error ? e.message : String(e);
124269
125195
  }
124270
125196
  function openContainedTranscript(path, uuid, projectsRoot) {
124271
- if (basename9(path) !== `${uuid}.jsonl`) {
125197
+ if (basename10(path) !== `${uuid}.jsonl`) {
124272
125198
  logRejection(path, "basename is not the session uuid");
124273
125199
  return null;
124274
125200
  }
@@ -124708,7 +125634,7 @@ var init_peer_link = __esm(() => {
124708
125634
  // src/view/replay-registry.ts
124709
125635
  import { randomBytes as randomBytes18 } from "crypto";
124710
125636
  import { readFileSync as readFileSync52, readdirSync as readdirSync16, renameSync as renameSync13, rmSync as rmSync20, writeFileSync as writeFileSync28 } from "fs";
124711
- import { join as join68 } from "path";
125637
+ import { join as join69 } from "path";
124712
125638
  function parseEntry(raw) {
124713
125639
  let v;
124714
125640
  try {
@@ -124746,14 +125672,14 @@ class ReplayRegistry {
124746
125672
  constructor(root, log = () => {}) {
124747
125673
  this.root = root;
124748
125674
  this.log = log;
124749
- this.dir = join68(root, REPLAYS_DIR);
125675
+ this.dir = join69(root, REPLAYS_DIR);
124750
125676
  }
124751
125677
  ensure() {
124752
125678
  ensureSockRoot(this.root);
124753
125679
  return ensurePrivateSubdir(this.root, REPLAYS_DIR);
124754
125680
  }
124755
125681
  lockPathOf(uuid) {
124756
- return join68(this.dir, `${this.key(uuid)}.lock`);
125682
+ return join69(this.dir, `${this.key(uuid)}.lock`);
124757
125683
  }
124758
125684
  tryLock(uuid) {
124759
125685
  this.ensure();
@@ -124768,7 +125694,7 @@ class ReplayRegistry {
124768
125694
  }
124769
125695
  async withLock(fn, waitMs = REGISTRY_LOCK_WAIT_MS) {
124770
125696
  this.ensure();
124771
- const lock = await waitAcquire(join68(this.dir, "registry.lock"), waitMs);
125697
+ const lock = await waitAcquire(join69(this.dir, "registry.lock"), waitMs);
124772
125698
  if (!lock)
124773
125699
  return null;
124774
125700
  try {
@@ -124846,12 +125772,12 @@ class ReplayRegistry {
124846
125772
  }
124847
125773
  for (const name of now)
124848
125774
  if (name.endsWith(".tmp"))
124849
- rmSync20(join68(this.dir, name), { force: true });
125775
+ rmSync20(join69(this.dir, name), { force: true });
124850
125776
  });
124851
125777
  return swept;
124852
125778
  }
124853
125779
  entryPathOf(uuid) {
124854
- return join68(this.dir, `${this.key(uuid)}.json`);
125780
+ return join69(this.dir, `${this.key(uuid)}.json`);
124855
125781
  }
124856
125782
  key(uuid) {
124857
125783
  const k = uuid.toLowerCase();
@@ -124872,7 +125798,7 @@ var init_replay_registry = __esm(() => {
124872
125798
 
124873
125799
  // src/mcp-session/replay-manager.ts
124874
125800
  import { randomBytes as randomBytes19, randomUUID as randomUUID10 } from "crypto";
124875
- import { constants as constants7, accessSync as accessSync3, closeSync as closeSync20, existsSync as existsSync43, realpathSync as realpathSync11, statSync as statSync28 } from "fs";
125801
+ import { constants as constants7, accessSync as accessSync3, closeSync as closeSync20, existsSync as existsSync44, realpathSync as realpathSync11, statSync as statSync28 } from "fs";
124876
125802
  import { dirname as dirname28, resolve as resolve11 } from "path";
124877
125803
  function unavailable2(reason, message) {
124878
125804
  return new ContractErrorException("replay_unavailable", message, reason);
@@ -125225,7 +126151,7 @@ class ReplayManager {
125225
126151
  cwd,
125226
126152
  projectsRoot,
125227
126153
  forkPath,
125228
- removeProjectDir: !existsSync43(dirname28(forkPath)),
126154
+ removeProjectDir: !existsSync44(dirname28(forkPath)),
125229
126155
  configDir: dirname28(projectsRoot),
125230
126156
  cols: size.cols ?? DEFAULT_PANE_COLS,
125231
126157
  rows: size.rows ?? DEFAULT_PANE_ROWS
@@ -126222,7 +127148,7 @@ var init_claude_launch = __esm(() => {
126222
127148
  import { spawn as spawn4 } from "child_process";
126223
127149
  import { mkdirSync as mkdirSync29, mkdtempSync as mkdtempSync4, rmSync as rmSync21, writeFileSync as writeFileSync29 } from "fs";
126224
127150
  import { tmpdir as tmpdir3 } from "os";
126225
- import { join as join69 } from "path";
127151
+ import { join as join70 } from "path";
126226
127152
  function claudeCodePrintArgv(model, systemPromptFile, opts = {}) {
126227
127153
  const head = [
126228
127154
  PRINT_FLAGS[0],
@@ -126358,13 +127284,13 @@ async function runPromptViaClaudeCode(model, prompt, systemPrompt, opts = {}) {
126358
127284
  } catch (e) {
126359
127285
  throw new Error(`cannot start claudish (${parentEnv.CLAUDISH_BIN?.trim() || "claudish"}): ${e instanceof Error ? e.message : String(e)}`);
126360
127286
  }
126361
- const root = mkdtempSync4(join69(tmpdir3(), "claudish-run-prompt-"));
127287
+ const root = mkdtempSync4(join70(tmpdir3(), "claudish-run-prompt-"));
126362
127288
  try {
126363
- const cwd = join69(root, "cwd");
127289
+ const cwd = join70(root, "cwd");
126364
127290
  mkdirSync29(cwd, { mode: 448 });
126365
127291
  let systemPromptFile;
126366
127292
  if (typeof systemPrompt === "string" && systemPrompt.length > 0) {
126367
- systemPromptFile = join69(root, "system-prompt.txt");
127293
+ systemPromptFile = join70(root, "system-prompt.txt");
126368
127294
  writeFileSync29(systemPromptFile, systemPrompt, { mode: 384 });
126369
127295
  }
126370
127296
  const argv = claudeCodePrintArgv(model, systemPromptFile, {
@@ -126475,7 +127401,7 @@ var init_run_prompt_claude_code = __esm(() => {
126475
127401
  ENV.CLAUDISH_PANE_CHILD
126476
127402
  ];
126477
127403
  inFlight5 = new Set;
126478
- EMPTY_PRINT_CWD = join69(tmpdir3(), "claudish-run-prompt-settings-check");
127404
+ EMPTY_PRINT_CWD = join70(tmpdir3(), "claudish-run-prompt-settings-check");
126479
127405
  });
126480
127406
 
126481
127407
  // src/providers/bundled-list.ts
@@ -127473,12 +128399,12 @@ var init_view_server = __esm(() => {
127473
128399
  });
127474
128400
 
127475
128401
  // src/mcp-server.ts
127476
- import { existsSync as existsSync44, readFileSync as readFileSync53, readdirSync as readdirSync17 } from "fs";
127477
- import { homedir as homedir41 } from "os";
127478
- import { dirname as dirname29, join as join70, resolve as resolve12 } from "path";
128402
+ import { existsSync as existsSync45, readFileSync as readFileSync53, readdirSync as readdirSync17 } from "fs";
128403
+ import { homedir as homedir42 } from "os";
128404
+ import { dirname as dirname29, join as join71, resolve as resolve12 } from "path";
127479
128405
  import { fileURLToPath as fileURLToPath3 } from "url";
127480
128406
  async function loadAllModels(forceRefresh = false) {
127481
- if (!forceRefresh && existsSync44(OPENROUTER_MODELS_CACHE_PATH)) {
128407
+ if (!forceRefresh && existsSync45(OPENROUTER_MODELS_CACHE_PATH)) {
127482
128408
  try {
127483
128409
  const cacheData = JSON.parse(readFileSync53(OPENROUTER_MODELS_CACHE_PATH, "utf-8"));
127484
128410
  const lastUpdated = new Date(cacheData.lastUpdated);
@@ -127499,7 +128425,7 @@ async function loadAllModels(forceRefresh = false) {
127499
128425
  } catch (err) {
127500
128426
  log(`[mcp] OpenRouter models fetch failed: ${err instanceof Error ? err.message : String(err)}`);
127501
128427
  try {
127502
- if (existsSync44(OPENROUTER_MODELS_CACHE_PATH)) {
128428
+ if (existsSync45(OPENROUTER_MODELS_CACHE_PATH)) {
127503
128429
  const cacheData = JSON.parse(readFileSync53(OPENROUTER_MODELS_CACHE_PATH, "utf-8"));
127504
128430
  return cacheData.models || [];
127505
128431
  }
@@ -128769,8 +129695,8 @@ This searched OpenRouter's listing only. Subscription wire ids and catalog alias
128769
129695
  const promptText = () => {
128770
129696
  if (input !== undefined)
128771
129697
  return input;
128772
- const existing = join70(resolved, "input.md");
128773
- return existsSync44(existing) ? readFileSync53(existing, "utf-8") : undefined;
129698
+ const existing = join71(resolved, "input.md");
129699
+ return existsSync45(existing) ? readFileSync53(existing, "utf-8") : undefined;
128774
129700
  };
128775
129701
  const choice = await modelChoiceStop([
128776
129702
  ...runsModels && givenModels && models ? givenModels.map((given, i) => ({ given, spec: models[i] })) : [],
@@ -128954,16 +129880,16 @@ This searched OpenRouter's listing only. Subscription wire ids and catalog alias
128954
129880
  const sp = session_path;
128955
129881
  for (const file of ["status.json", "manifest.json", "input.md"]) {
128956
129882
  try {
128957
- sessionData[file] = readFileSync53(join70(sp, file), "utf-8");
129883
+ sessionData[file] = readFileSync53(join71(sp, file), "utf-8");
128958
129884
  } catch {}
128959
129885
  }
128960
129886
  try {
128961
- const errorDir = join70(sp, "errors");
128962
- if (existsSync44(errorDir)) {
129887
+ const errorDir = join71(sp, "errors");
129888
+ if (existsSync45(errorDir)) {
128963
129889
  for (const f of readdirSync17(errorDir)) {
128964
129890
  if (f.endsWith(".log")) {
128965
129891
  try {
128966
- sessionData[`errors/${f}`] = readFileSync53(join70(errorDir, f), "utf-8");
129892
+ sessionData[`errors/${f}`] = readFileSync53(join71(errorDir, f), "utf-8");
128967
129893
  } catch {}
128968
129894
  }
128969
129895
  }
@@ -128973,7 +129899,7 @@ This searched OpenRouter's listing only. Subscription wire ids and catalog alias
128973
129899
  for (const f of readdirSync17(sp)) {
128974
129900
  if (f.startsWith("response-") && f.endsWith(".md")) {
128975
129901
  try {
128976
- const content = readFileSync53(join70(sp, f), "utf-8");
129902
+ const content = readFileSync53(join71(sp, f), "utf-8");
128977
129903
  sessionData[f] = content.slice(0, 200) + (content.length > 200 ? "... (truncated)" : "");
128978
129904
  } catch {}
128979
129905
  }
@@ -128982,8 +129908,8 @@ This searched OpenRouter's listing only. Subscription wire ids and catalog alias
128982
129908
  }
128983
129909
  let version = "unknown";
128984
129910
  try {
128985
- const pkgPath = join70(__dirname3, "../package.json");
128986
- if (existsSync44(pkgPath)) {
129911
+ const pkgPath = join71(__dirname3, "../package.json");
129912
+ if (existsSync45(pkgPath)) {
128987
129913
  version = JSON.parse(readFileSync53(pkgPath, "utf-8")).version;
128988
129914
  }
128989
129915
  } catch {}
@@ -129787,8 +130713,8 @@ var init_mcp_server = __esm(() => {
129787
130713
  init_preflight_chain();
129788
130714
  __filename3 = fileURLToPath3(import.meta.url);
129789
130715
  __dirname3 = dirname29(__filename3);
129790
- CLAUDISH_CACHE_DIR = join70(homedir41(), ".claudish");
129791
- OPENROUTER_MODELS_CACHE_PATH = join70(CLAUDISH_CACHE_DIR, "openrouter-models.json");
130716
+ CLAUDISH_CACHE_DIR = join71(homedir42(), ".claudish");
130717
+ OPENROUTER_MODELS_CACHE_PATH = join71(CLAUDISH_CACHE_DIR, "openrouter-models.json");
129792
130718
  NEXT_STEP = {
129793
130719
  cancelled: "you stopped this slot; nothing is wrong with it. Re-run it if you still want its vote",
129794
130720
  timeout: "grid mode only \u2014 magmux ended the pane. The orchestrator has no deadline",
@@ -129815,7 +130741,7 @@ var init_mcp_server = __esm(() => {
129815
130741
  });
129816
130742
 
129817
130743
  // src/serve-command.ts
129818
- import { existsSync as existsSync45, readFileSync as readFileSync54 } from "fs";
130744
+ import { existsSync as existsSync46, readFileSync as readFileSync54 } from "fs";
129819
130745
  function parseServeArgs(args) {
129820
130746
  const out = {};
129821
130747
  for (let i = 0;i < args.length; i++) {
@@ -129834,7 +130760,7 @@ function parseServeArgs(args) {
129834
130760
  return out;
129835
130761
  }
129836
130762
  function loadModelMap(path) {
129837
- if (!existsSync45(path)) {
130763
+ if (!existsSync46(path)) {
129838
130764
  throw new Error(`--models file not found: ${path}`);
129839
130765
  }
129840
130766
  let raw;
@@ -129951,8 +130877,8 @@ var HOOKS_AMBIENT_DTS = '// claudish hook types \u2014 written by `claudish hook
129951
130877
 
129952
130878
  // src/hooks/observer/corpus.ts
129953
130879
  import { appendFileSync as appendFileSync8, readFileSync as readFileSync55, readdirSync as readdirSync18, statSync as statSync29 } from "fs";
129954
- import { homedir as homedir42 } from "os";
129955
- import { join as join71 } from "path";
130880
+ import { homedir as homedir43 } from "os";
130881
+ import { join as join72 } from "path";
129956
130882
  function directoryOf2(filePath) {
129957
130883
  const slash = filePath.lastIndexOf("/");
129958
130884
  return slash > 0 ? filePath.slice(0, slash) : undefined;
@@ -130031,13 +130957,13 @@ function listTranscripts(root) {
130031
130957
  return files;
130032
130958
  }
130033
130959
  for (const project of projects) {
130034
- const dir = join71(root, project);
130960
+ const dir = join72(root, project);
130035
130961
  try {
130036
130962
  if (!statSync29(dir).isDirectory())
130037
130963
  continue;
130038
130964
  for (const f of readdirSync18(dir)) {
130039
130965
  if (f.endsWith(".jsonl"))
130040
- files.push(join71(dir, f));
130966
+ files.push(join72(dir, f));
130041
130967
  }
130042
130968
  } catch {}
130043
130969
  }
@@ -130050,7 +130976,7 @@ function buildCorpus(options = {}) {
130050
130976
  for (const f of files)
130051
130977
  records.push(...replayTranscript(f));
130052
130978
  if (options.write && records.length > 0) {
130053
- const outputPath = options.outputPath ?? join71(homedir42(), ".claudish", "behavior-divergences.jsonl");
130979
+ const outputPath = options.outputPath ?? join72(homedir43(), ".claudish", "behavior-divergences.jsonl");
130054
130980
  try {
130055
130981
  appendFileSync8(outputPath, `${records.map((r) => JSON.stringify(r)).join(`
130056
130982
  `)}
@@ -130067,9 +130993,9 @@ var init_corpus = __esm(() => {
130067
130993
  });
130068
130994
 
130069
130995
  // src/hooks-command.ts
130070
- import { existsSync as existsSync46, mkdirSync as mkdirSync30, readFileSync as readFileSync56, writeFileSync as writeFileSync30 } from "fs";
130071
- import { homedir as homedir43 } from "os";
130072
- import { join as join72, resolve as resolve13 } from "path";
130996
+ import { existsSync as existsSync47, mkdirSync as mkdirSync30, readFileSync as readFileSync56, writeFileSync as writeFileSync30 } from "fs";
130997
+ import { homedir as homedir44 } from "os";
130998
+ import { join as join73, resolve as resolve13 } from "path";
130073
130999
  function severityColor(sev) {
130074
131000
  if (sev === "fix")
130075
131001
  return green(sev);
@@ -130192,12 +131118,12 @@ async function check(file, json) {
130192
131118
  return valid ? 0 : 1;
130193
131119
  }
130194
131120
  function init(dirArg) {
130195
- const dir = dirArg ? resolve13(process.cwd(), dirArg) : join72(homedir43(), ".claudish", "hooks");
131121
+ const dir = dirArg ? resolve13(process.cwd(), dirArg) : join73(homedir44(), ".claudish", "hooks");
130196
131122
  const files = [
130197
- [join72(dir, "example-hook.ts"), EXAMPLE_HOOK],
130198
- [join72(dir, "claudish-hooks.d.ts"), HOOKS_AMBIENT_DTS]
131123
+ [join73(dir, "example-hook.ts"), EXAMPLE_HOOK],
131124
+ [join73(dir, "claudish-hooks.d.ts"), HOOKS_AMBIENT_DTS]
130199
131125
  ];
130200
- const existing = files.filter(([path]) => existsSync46(path)).map(([path]) => path);
131126
+ const existing = files.filter(([path]) => existsSync47(path)).map(([path]) => path);
130201
131127
  if (existing.length > 0) {
130202
131128
  for (const path of existing)
130203
131129
  console.error(`${path} already exists; not overwriting it.`);
@@ -130287,7 +131213,7 @@ function telemetry(action, json) {
130287
131213
  let pending = 0;
130288
131214
  try {
130289
131215
  const path = outboxPath();
130290
- if (existsSync46(path))
131216
+ if (existsSync47(path))
130291
131217
  pending = readFileSync56(path, "utf8").split(`
130292
131218
  `).filter(Boolean).length;
130293
131219
  } catch {}
@@ -130396,9 +131322,9 @@ var init_hooks_command = __esm(() => {
130396
131322
 
130397
131323
  // src/team-grid.ts
130398
131324
  import { spawn as spawn5 } from "child_process";
130399
- import { existsSync as existsSync47, readFileSync as readFileSync57, writeFileSync as writeFileSync31 } from "fs";
131325
+ import { existsSync as existsSync48, readFileSync as readFileSync57, writeFileSync as writeFileSync31 } from "fs";
130400
131326
  import { connect as netConnect3 } from "net";
130401
- import { join as join73 } from "path";
131327
+ import { join as join74 } from "path";
130402
131328
  import { setTimeout as wait } from "timers/promises";
130403
131329
  function paneRouteLine(explanation) {
130404
131330
  const origin = describeRouteExplanation(explanation);
@@ -130453,7 +131379,7 @@ function withoutControlPanes(evt) {
130453
131379
  async function subscribeToMagmux(sockPath, onEvent) {
130454
131380
  let client = null;
130455
131381
  for (let attempt = 0;attempt < 40; attempt++) {
130456
- if (existsSync47(sockPath)) {
131382
+ if (existsSync48(sockPath)) {
130457
131383
  try {
130458
131384
  client = await new Promise((resolve, reject) => {
130459
131385
  const s = netConnect3(sockPath);
@@ -130548,9 +131474,9 @@ async function runWithGrid(sessionPath, models, input, opts) {
130548
131474
  const keep = opts?.keep ?? false;
130549
131475
  const manifest = setupSession(sessionPath, models, input);
130550
131476
  const startedAt = new Date().toISOString();
130551
- const gridfilePath = join73(sessionPath, "gridfile.txt");
130552
- const prompt = readFileSync57(join73(sessionPath, "input.md"), "utf-8").replace(/'/g, "'\\''").replace(/\n/g, " ");
130553
- const rawPrompt = readFileSync57(join73(sessionPath, "input.md"), "utf-8");
131477
+ const gridfilePath = join74(sessionPath, "gridfile.txt");
131478
+ const prompt = readFileSync57(join74(sessionPath, "input.md"), "utf-8").replace(/'/g, "'\\''").replace(/\n/g, " ");
131479
+ const rawPrompt = readFileSync57(join74(sessionPath, "input.md"), "utf-8");
130554
131480
  const usedBannerColors = new Set;
130555
131481
  const routeLines = mode === "interactive" ? new Map : await resolvePaneRouteLines(Object.values(manifest.models).map((entry) => entry.model));
130556
131482
  const gridLines = Object.entries(manifest.models).map(([anonId]) => {
@@ -130582,7 +131508,7 @@ async function runWithGrid(sessionPath, models, input, opts) {
130582
131508
  });
130583
131509
  const [{ results }] = await Promise.all([subscription, procExit]);
130584
131510
  const status = buildTeamStatus(manifest, startedAt, results?.panes ?? null);
130585
- const statusPath = join73(sessionPath, "status.json");
131511
+ const statusPath = join74(sessionPath, "status.json");
130586
131512
  writeFileSync31(statusPath, JSON.stringify(status, null, 2), "utf-8");
130587
131513
  return status;
130588
131514
  }
@@ -130603,7 +131529,7 @@ var init_team_grid = __esm(() => {
130603
131529
 
130604
131530
  // src/team-cli.ts
130605
131531
  import { readFileSync as readFileSync58 } from "fs";
130606
- import { join as join74 } from "path";
131532
+ import { join as join75 } from "path";
130607
131533
  async function runPaneTeam(sessionPath, models, input, opts) {
130608
131534
  installPaneShutdownHooks({ exitAfter: true });
130609
131535
  try {
@@ -130748,7 +131674,7 @@ async function teamCommand(args) {
130748
131674
  }
130749
131675
  case "judge": {
130750
131676
  await judgeResponses(sessionPath, { judges });
130751
- console.log(readFileSync58(join74(sessionPath, "verdict.md"), "utf-8"));
131677
+ console.log(readFileSync58(join75(sessionPath, "verdict.md"), "utf-8"));
130752
131678
  break;
130753
131679
  }
130754
131680
  case "run-and-judge": {
@@ -130764,7 +131690,7 @@ async function teamCommand(args) {
130764
131690
  });
130765
131691
  printStatus(status);
130766
131692
  await judgeResponses(sessionPath, { judges });
130767
- console.log(readFileSync58(join74(sessionPath, "verdict.md"), "utf-8"));
131693
+ console.log(readFileSync58(join75(sessionPath, "verdict.md"), "utf-8"));
130768
131694
  break;
130769
131695
  }
130770
131696
  case "status": {
@@ -132446,9 +133372,9 @@ var init_view_cli = __esm(() => {
132446
133372
 
132447
133373
  // src/herdr/herdr-cli.ts
132448
133374
  import { spawnSync as spawnSync3 } from "child_process";
132449
- import { copyFileSync as copyFileSync3, existsSync as existsSync48, mkdirSync as mkdirSync31, readdirSync as readdirSync19, renameSync as renameSync14, statSync as statSync30 } from "fs";
132450
- import { homedir as homedir44 } from "os";
132451
- import { dirname as dirname30, join as join75, resolve as resolve14 } from "path";
133375
+ import { copyFileSync as copyFileSync3, existsSync as existsSync49, mkdirSync as mkdirSync31, readdirSync as readdirSync19, renameSync as renameSync14, statSync as statSync30 } from "fs";
133376
+ import { homedir as homedir45 } from "os";
133377
+ import { dirname as dirname30, join as join76, resolve as resolve14 } from "path";
132452
133378
  function spawnHerdrApp(args) {
132453
133379
  const r = spawnSync3("herdr-app", args, { encoding: "utf-8", timeout: 1e4 });
132454
133380
  if (r.error)
@@ -132490,8 +133416,8 @@ function showPanelCommand(rest, out, deps) {
132490
133416
  function findBuiltAppMod(from = import.meta.dir) {
132491
133417
  let dir = from;
132492
133418
  for (let i = 0;i < 5; i++) {
132493
- const candidate = join75(dir, BUILT_MOD_DIR);
132494
- if (existsSync48(join75(candidate, "main.js")) && existsSync48(join75(candidate, "mod.json")))
133419
+ const candidate = join76(dir, BUILT_MOD_DIR);
133420
+ if (existsSync49(join76(candidate, "main.js")) && existsSync49(join76(candidate, "mod.json")))
132495
133421
  return candidate;
132496
133422
  const up = dirname30(dir);
132497
133423
  if (up === dir)
@@ -132504,24 +133430,24 @@ function herdrAppHome(env) {
132504
133430
  const given = env.HERDR_APP_HOME?.trim();
132505
133431
  if (given)
132506
133432
  return resolve14(given);
132507
- return join75(env.HOME?.trim() || homedir44(), ".config", "herdr-app");
133433
+ return join76(env.HOME?.trim() || homedir45(), ".config", "herdr-app");
132508
133434
  }
132509
133435
  function isModFile(name) {
132510
133436
  return !name.startsWith(".") && name !== "jsconfig.json" && !name.endsWith(".d.ts");
132511
133437
  }
132512
133438
  function installAppMod(source, appHome) {
132513
- if (!existsSync48(join75(source, "main.js")) || !existsSync48(join75(source, "mod.json")))
133439
+ if (!existsSync49(join76(source, "main.js")) || !existsSync49(join76(source, "mod.json")))
132514
133440
  throw new Error(`${source} holds no built mod (main.js and mod.json); run \`bun run build\``);
132515
- if (!existsSync48(appHome) || !statSync30(appHome).isDirectory())
133441
+ if (!existsSync49(appHome) || !statSync30(appHome).isDirectory())
132516
133442
  throw new Error(`${appHome} does not exist: start Herdr.app once so it creates its home, then run this again`);
132517
- const dest = join75(appHome, "mods", APP_MOD_NAME);
133443
+ const dest = join76(appHome, "mods", APP_MOD_NAME);
132518
133444
  mkdirSync31(dest, { recursive: true });
132519
- const files = readdirSync19(source).filter((f) => isModFile(f) && statSync30(join75(source, f)).isFile());
133445
+ const files = readdirSync19(source).filter((f) => isModFile(f) && statSync30(join76(source, f)).isFile());
132520
133446
  files.sort((a, b) => a === "mod.json" ? -1 : b === "mod.json" ? 1 : a.localeCompare(b));
132521
133447
  for (const f of files) {
132522
- const hidden = join75(dest, `.${f}.installing`);
132523
- copyFileSync3(join75(source, f), hidden);
132524
- renameSync14(hidden, join75(dest, f));
133448
+ const hidden = join76(dest, `.${f}.installing`);
133449
+ copyFileSync3(join76(source, f), hidden);
133450
+ renameSync14(hidden, join76(dest, f));
132525
133451
  }
132526
133452
  return dest;
132527
133453
  }
@@ -132599,7 +133525,7 @@ var init_herdr_cli = __esm(() => {
132599
133525
  ""
132600
133526
  ].join(`
132601
133527
  `);
132602
- BUILT_MOD_DIR = join75("herdr-app-mod", APP_MOD_NAME);
133528
+ BUILT_MOD_DIR = join76("herdr-app-mod", APP_MOD_NAME);
132603
133529
  });
132604
133530
 
132605
133531
  // src/auth/credentials/source.ts
@@ -134831,9 +135757,9 @@ var init_account_command = __esm(() => {
134831
135757
 
134832
135758
  // src/auth/antigravity-oauth.ts
134833
135759
  import { spawnSync as spawnSync4 } from "child_process";
134834
- import { existsSync as existsSync49, unlinkSync as unlinkSync14 } from "fs";
134835
- import { homedir as homedir45 } from "os";
134836
- import { join as join76 } from "path";
135760
+ import { existsSync as existsSync50, unlinkSync as unlinkSync14 } from "fs";
135761
+ import { homedir as homedir46 } from "os";
135762
+ import { join as join77 } from "path";
134837
135763
  async function defaultSuggestModel() {
134838
135764
  try {
134839
135765
  const token = await getValidAntigravityAccessToken();
@@ -134952,8 +135878,8 @@ No session detected yet. Starting the Antigravity CLI interactively \u2014
134952
135878
  async logout(deps) {
134953
135879
  deleteSharedAntigravityToken(deps);
134954
135880
  try {
134955
- const tokenFile = join76(homedir45(), ".gemini", "antigravity-cli", "antigravity-oauth-token");
134956
- if (existsSync49(tokenFile))
135881
+ const tokenFile = join77(homedir46(), ".gemini", "antigravity-cli", "antigravity-oauth-token");
135882
+ if (existsSync50(tokenFile))
134957
135883
  unlinkSync14(tokenFile);
134958
135884
  } catch {}
134959
135885
  log("[AntigravityOAuth] Antigravity session cleared (keychain + agy token file)");
@@ -143859,17 +144785,17 @@ var init_model_lineup = __esm(() => {
143859
144785
 
143860
144786
  // src/diag-output.ts
143861
144787
  import { createWriteStream as createWriteStream2, mkdirSync as mkdirSync32, unlinkSync as unlinkSync15, writeFileSync as writeFileSync32 } from "fs";
143862
- import { homedir as homedir46 } from "os";
143863
- import { join as join77 } from "path";
144788
+ import { homedir as homedir47 } from "os";
144789
+ import { join as join78 } from "path";
143864
144790
  function getClaudishDir() {
143865
- const dir = join77(homedir46(), ".claudish");
144791
+ const dir = join78(homedir47(), ".claudish");
143866
144792
  try {
143867
144793
  mkdirSync32(dir, { recursive: true });
143868
144794
  } catch {}
143869
144795
  return dir;
143870
144796
  }
143871
144797
  function getDiagLogPath() {
143872
- return join77(getClaudishDir(), `diag-${process.pid}.log`);
144798
+ return join78(getClaudishDir(), `diag-${process.pid}.log`);
143873
144799
  }
143874
144800
 
143875
144801
  class LogFileDiagOutput {
@@ -145960,11 +146886,11 @@ var init_resume_picker_run = __esm(() => {
145960
146886
  });
145961
146887
 
145962
146888
  // src/launcher/model-setting-ledger-path.ts
145963
- import { homedir as homedir47 } from "os";
145964
- import { join as join78 } from "path";
146889
+ import { homedir as homedir48 } from "os";
146890
+ import { join as join79 } from "path";
145965
146891
  function modelSettingLedgerPath(env = process.env) {
145966
- const home = env.HOME && env.HOME.length > 0 ? env.HOME : homedir47();
145967
- return join78(home, ".claudish", MODEL_SETTING_LEDGER_FILE);
146892
+ const home = env.HOME && env.HOME.length > 0 ? env.HOME : homedir48();
146893
+ return join79(home, ".claudish", MODEL_SETTING_LEDGER_FILE);
145968
146894
  }
145969
146895
  var MODEL_SETTING_LEDGER_FILE = "model-setting-restore.json";
145970
146896
  var init_model_setting_ledger_path = () => {};
@@ -145985,19 +146911,19 @@ import {
145985
146911
  unlinkSync as unlinkSync16,
145986
146912
  writeSync as writeSync8
145987
146913
  } from "fs";
145988
- import { homedir as homedir48 } from "os";
145989
- import { basename as basename10, dirname as dirname31, join as join79, resolve as resolve15 } from "path";
146914
+ import { homedir as homedir49 } from "os";
146915
+ import { basename as basename11, dirname as dirname31, join as join80, resolve as resolve15 } from "path";
145990
146916
  function canonicalSettingsPath(path) {
145991
146917
  let head = resolve15(path);
145992
146918
  const rest = [];
145993
146919
  for (;; ) {
145994
146920
  try {
145995
- return join79(realpathSync12.native(head), ...rest);
146921
+ return join80(realpathSync12.native(head), ...rest);
145996
146922
  } catch {
145997
146923
  const parent = dirname31(head);
145998
146924
  if (parent === head)
145999
- return join79(head, ...rest);
146000
- rest.unshift(basename10(head));
146925
+ return join80(head, ...rest);
146926
+ rest.unshift(basename11(head));
146001
146927
  head = parent;
146002
146928
  }
146003
146929
  }
@@ -146092,7 +147018,7 @@ function restoreRound(settingsKey, target, entry, deps, fence) {
146092
147018
  const planned = nextSettingsText(text, entry);
146093
147019
  if ("outcome" in planned)
146094
147020
  return planned.outcome;
146095
- const temp = join79(dirname31(target), `${TEMP_PREFIX}${deps.pid ?? process.pid}-${randomUUID12()}`);
147021
+ const temp = join80(dirname31(target), `${TEMP_PREFIX}${deps.pid ?? process.pid}-${randomUUID12()}`);
146096
147022
  try {
146097
147023
  deps.writeNew(temp, planned.next, statA.mode & 4095);
146098
147024
  } catch {
@@ -146284,7 +147210,7 @@ function removeOrphanTemps(ctx, key, table) {
146284
147210
  if (live)
146285
147211
  continue;
146286
147212
  try {
146287
- unlinkSync16(join79(dir, name));
147213
+ unlinkSync16(join80(dir, name));
146288
147214
  } catch {}
146289
147215
  }
146290
147216
  }
@@ -146375,7 +147301,7 @@ function selfStartEpochMs() {
146375
147301
  async function beginModelSettingWatch(listedSpecs, deps = {}) {
146376
147302
  const ctx = contextOf(deps);
146377
147303
  const env = deps.env ?? process.env;
146378
- const settingsFile = deps.settingsFile ?? userSettingsFile(env.CLAUDE_CONFIG_DIR, env.HOME && env.HOME.length > 0 ? env.HOME : homedir48(), deps.cwd ?? process.cwd());
147304
+ const settingsFile = deps.settingsFile ?? userSettingsFile(env.CLAUDE_CONFIG_DIR, env.HOME && env.HOME.length > 0 ? env.HOME : homedir49(), deps.cwd ?? process.cwd());
146379
147305
  const key = canonicalSettingsPath(settingsFile);
146380
147306
  const lockPath = lockPathOf(ctx.ledgerPath);
146381
147307
  const lockOpts = {
@@ -146990,8 +147916,8 @@ init_launch_env();
146990
147916
  init_op_source();
146991
147917
  init_startup_trace();
146992
147918
  init_picker_cancelled();
146993
- import { existsSync as existsSync50, readFileSync as readFileSync61 } from "fs";
146994
- import { join as join80, resolve as resolve16 } from "path";
147919
+ import { existsSync as existsSync51, readFileSync as readFileSync61 } from "fs";
147920
+ import { join as join81, resolve as resolve16 } from "path";
146995
147921
 
146996
147922
  // src/tui/runtime/should-open-picker.ts
146997
147923
  function noModelConfigured(gate) {
@@ -147008,7 +147934,7 @@ function requiresExplicitModel(gate, tty) {
147008
147934
  var autoloadDropped = [...droppedAtLaunch, ...takeLauncherDropped(process.env)];
147009
147935
  var dotenvText;
147010
147936
  try {
147011
- dotenvText = readFileSync61(join80(process.cwd(), ".env"));
147937
+ dotenvText = readFileSync61(join81(process.cwd(), ".env"));
147012
147938
  } catch {}
147013
147939
  if (dotenvText !== undefined) {
147014
147940
  await Promise.resolve().then(() => init_dotenv_allowlist());
@@ -147126,7 +148052,7 @@ async function applyConfigOverride() {
147126
148052
  await Promise.resolve();
147127
148053
  const plan = planConfigOverride(process.argv.slice(2), process.env, {
147128
148054
  resolve: resolve16,
147129
- exists: existsSync50
148055
+ exists: existsSync51
147130
148056
  });
147131
148057
  if (plan.kind === "none")
147132
148058
  return;
@@ -147414,7 +148340,7 @@ async function runCli() {
147414
148340
  process.exit(1);
147415
148341
  }
147416
148342
  const mode = cliConfig.teamMode ?? "default";
147417
- const sessionPath = join80(process.cwd(), `.claudish-team-${Date.now()}`);
148343
+ const sessionPath = join81(process.cwd(), `.claudish-team-${Date.now()}`);
147418
148344
  if (mode === "json") {
147419
148345
  await Promise.resolve().then(() => init_pane());
147420
148346
  await Promise.resolve().then(() => init_team_orchestrator());
@@ -147434,7 +148360,7 @@ async function runCli() {
147434
148360
  const status = await runModels(sessionPath);
147435
148361
  const result = { ...status, responses: {} };
147436
148362
  for (const anonId of Object.keys(status.models)) {
147437
- const responsePath = join80(sessionPath, `response-${anonId}.md`);
148363
+ const responsePath = join81(sessionPath, `response-${anonId}.md`);
147438
148364
  try {
147439
148365
  const raw = readFileSync61(responsePath, "utf-8").trim();
147440
148366
  try {