context-mode 2.2.1 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.zcode-plugin/plugin.json +1 -1
- package/README.md +72 -72
- package/SHA256SUMS +17 -17
- package/cli.mjs +17 -6
- package/copilot/plugin.json +1 -1
- package/gemini-extension.json +1 -1
- package/hook.mjs +100 -98
- package/hooks/claude-code.json +12 -0
- package/opencode/plugin.js +684 -397
- package/package.json +1 -1
- package/pi/index.js +835 -543
- package/qwen-extension.json +1 -1
- package/run.mjs +32 -14
- package/search.mjs +32 -14
- package/server.mjs +193 -64
package/server.mjs
CHANGED
|
@@ -28075,6 +28075,7 @@ function readReplaceTrigger(raw) {
|
|
|
28075
28075
|
var REPLACE_TRIGGER_BYTES = readReplaceTrigger(process.env[REPLACE_TRIGGER_ENV]);
|
|
28076
28076
|
var RANGE_READ_TOOLS = Object.freeze(["Read", "view"]);
|
|
28077
28077
|
var READ_RANGE_KEYS = Object.freeze(["offset", "limit", "view_range"]);
|
|
28078
|
+
var SKILL_LOAD_TOOLS = Object.freeze(["Skill"]);
|
|
28078
28079
|
var MAX_CHUNK_BYTES = 4096;
|
|
28079
28080
|
var SEARCH_PAGE_SIZE = 20;
|
|
28080
28081
|
var MEMORY_LABEL_PREFIX = "memory ";
|
|
@@ -28268,6 +28269,7 @@ var PLAIN_OUTPUT_ENV = Object.freeze({ NO_COLOR: "1", FORCE_COLOR: "0" });
|
|
|
28268
28269
|
var RUN_LABEL_PREFIX = "run.mjs:";
|
|
28269
28270
|
var RUN_SESSION_PREFIX = "mcp:";
|
|
28270
28271
|
var HOST_SESSION_ENV = Object.freeze({ "claude-code": "CLAUDE_CODE_SESSION_ID" });
|
|
28272
|
+
var HOST_SESSION_META = Object.freeze({ zcode: "session_id" });
|
|
28271
28273
|
var NODE_MIN = "24.15.0";
|
|
28272
28274
|
var DATA_ROOT = "~/.context-mode";
|
|
28273
28275
|
var DATA_DIR_ENV = "CONTEXT_MODE_DATA_DIR";
|
|
@@ -28451,7 +28453,7 @@ function PURGE_SUMMARY(rows, scope) {
|
|
|
28451
28453
|
var DECISION_SOURCE = "decision";
|
|
28452
28454
|
var DECISION_USER_LABEL = "decision (user)";
|
|
28453
28455
|
var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
|
|
28454
|
-
var BUNDLE_SHA = true ? "
|
|
28456
|
+
var BUNDLE_SHA = true ? "ae2e1bb106e462a19ab3c042e371cd8a7f691074" : void 0;
|
|
28455
28457
|
var DOCTOR_CHECK_ORDER = Object.freeze(["D1", "D2", "D3", "D4", "D5", "D5b", "D6", "D7", "D8", "D9", "D10", "D11"]);
|
|
28456
28458
|
var DOCTOR_LABEL = Object.freeze({
|
|
28457
28459
|
D1: "version",
|
|
@@ -28562,6 +28564,10 @@ function D7_DETAIL(got) {
|
|
|
28562
28564
|
return `resolved project source ${got} does not match the host's actual cwd`;
|
|
28563
28565
|
}
|
|
28564
28566
|
var D7_FIX = "restart the agent in the correct directory";
|
|
28567
|
+
function D7_NO_PROJECT_DETAIL(kind) {
|
|
28568
|
+
return `Project source ${kind} is missing`;
|
|
28569
|
+
}
|
|
28570
|
+
var DOCTOR_NEEDS_PROJECT_DETAIL = "runs once the project resolves; D7 names the project source";
|
|
28565
28571
|
function D8_STALE_SCHEMA_DETAIL(got, want) {
|
|
28566
28572
|
return `stale schema (v${got}, expected v${want})`;
|
|
28567
28573
|
}
|
|
@@ -29474,9 +29480,9 @@ var COLUMNS = "events(session_id, worktree, agent, kind, tool, key, path, ok, ex
|
|
|
29474
29480
|
var INSERT_SQL = "INSERT INTO " + COLUMNS;
|
|
29475
29481
|
var INSERT_COST_SQL = "INSERT OR IGNORE INTO " + COLUMNS;
|
|
29476
29482
|
var COST_SEQ_SQL = "SELECT seq FROM events WHERE kind = 'cost' AND session_id = ? AND turn = ?";
|
|
29477
|
-
function appendEvent(db, row5) {
|
|
29483
|
+
function appendEvent(db, row5, at) {
|
|
29478
29484
|
return withWrite(db, (h) => {
|
|
29479
|
-
const now = Date.now();
|
|
29485
|
+
const now = at ?? Date.now();
|
|
29480
29486
|
const isCost = row5.kind === "cost";
|
|
29481
29487
|
const res = h.raw.prepare(isCost ? INSERT_COST_SQL : INSERT_SQL).run(
|
|
29482
29488
|
row5.session_id,
|
|
@@ -29717,7 +29723,7 @@ function resolveConfigDir(env) {
|
|
|
29717
29723
|
}
|
|
29718
29724
|
|
|
29719
29725
|
// src/core/project/resolve.ts
|
|
29720
|
-
import { basename as basename2, dirname as dirname3, join as join3, resolve as resolve3 } from "node:path";
|
|
29726
|
+
import { basename as basename2, dirname as dirname3, isAbsolute as isAbsolute2, join as join3, resolve as resolve3 } from "node:path";
|
|
29721
29727
|
|
|
29722
29728
|
// src/core/project/contain.ts
|
|
29723
29729
|
import { dirname as dirname2, isAbsolute, join as join2, relative, resolve as resolve2, sep } from "node:path";
|
|
@@ -29929,12 +29935,7 @@ function dirOf(kind, src) {
|
|
|
29929
29935
|
}
|
|
29930
29936
|
}
|
|
29931
29937
|
function gitDirs(dir) {
|
|
29932
|
-
let cur;
|
|
29933
|
-
try {
|
|
29934
|
-
cur = realpathSync3.native(dir);
|
|
29935
|
-
} catch {
|
|
29936
|
-
throw new CtxError("NO_GIT_DIR", { path: dir });
|
|
29937
|
-
}
|
|
29938
|
+
let cur = nearestRealDir(dir);
|
|
29938
29939
|
const start = cur;
|
|
29939
29940
|
for (; ; ) {
|
|
29940
29941
|
const gitDir = gitDirAt(join3(cur, GIT_DIR_NAME));
|
|
@@ -29947,6 +29948,18 @@ function gitDirs(dir) {
|
|
|
29947
29948
|
cur = up;
|
|
29948
29949
|
}
|
|
29949
29950
|
}
|
|
29951
|
+
function nearestRealDir(dir) {
|
|
29952
|
+
const walk2 = isAbsolute2(dir);
|
|
29953
|
+
for (let d = walk2 ? resolve3(dir) : dir; ; ) {
|
|
29954
|
+
try {
|
|
29955
|
+
return realpathSync3.native(d);
|
|
29956
|
+
} catch {
|
|
29957
|
+
const up = dirname3(d);
|
|
29958
|
+
if (!walk2 || up === d) throw new CtxError("NO_GIT_DIR", { path: dir });
|
|
29959
|
+
d = up;
|
|
29960
|
+
}
|
|
29961
|
+
}
|
|
29962
|
+
}
|
|
29950
29963
|
function gitDirAt(dotGit) {
|
|
29951
29964
|
let gitDir;
|
|
29952
29965
|
try {
|
|
@@ -30009,7 +30022,7 @@ function resolveProject(agent, src) {
|
|
|
30009
30022
|
},
|
|
30010
30023
|
worktree,
|
|
30011
30024
|
get containmentRoot() {
|
|
30012
|
-
root ??= plain ?? containmentRootOf(
|
|
30025
|
+
root ??= plain ?? containmentRootOf(worktree, commonDir);
|
|
30013
30026
|
return root;
|
|
30014
30027
|
},
|
|
30015
30028
|
agent,
|
|
@@ -32454,43 +32467,53 @@ function parseSourceHandle(s) {
|
|
|
32454
32467
|
function pathLabel(p) {
|
|
32455
32468
|
return p.includes("\\") ? p.split("\\").join("/") : p;
|
|
32456
32469
|
}
|
|
32457
|
-
|
|
32458
|
-
|
|
32470
|
+
var EVERY_ROW = { scope: "project", sessionId: "", worktree: "" };
|
|
32471
|
+
var IN_SCOPE = "(:scope <> 'session' OR session_id = :session_id) AND (:scope <> 'worktree' OR worktree = :worktree)";
|
|
32472
|
+
var scopeArgs = (w) => ({ scope: w.scope, session_id: w.sessionId, worktree: w.worktree });
|
|
32473
|
+
function labelStored(db, label2, w) {
|
|
32474
|
+
return stmt(db.raw, "SELECT 1 AS x FROM sources WHERE label = :label AND " + IN_SCOPE + " LIMIT 1").get({ label: label2, ...scopeArgs(w) }) !== void 0;
|
|
32459
32475
|
}
|
|
32460
|
-
function storedLabel(db, source) {
|
|
32461
|
-
if (labelStored(db, source)) return source;
|
|
32476
|
+
function storedLabel(db, source, w = EVERY_ROW) {
|
|
32477
|
+
if (labelStored(db, source, w)) return source;
|
|
32462
32478
|
const canon = pathLabel(source);
|
|
32463
|
-
return canon !== source && labelStored(db, canon) ? canon : source;
|
|
32479
|
+
return canon !== source && labelStored(db, canon, w) ? canon : source;
|
|
32464
32480
|
}
|
|
32465
|
-
function newestId(db, label2) {
|
|
32466
|
-
const row5 = stmt(db.raw, "SELECT id FROM sources WHERE label =
|
|
32481
|
+
function newestId(db, label2, w) {
|
|
32482
|
+
const row5 = stmt(db.raw, "SELECT id FROM sources WHERE label = :label AND " + IN_SCOPE + " ORDER BY id DESC LIMIT 1").get({ label: label2, ...scopeArgs(w) });
|
|
32467
32483
|
return row5 === void 0 ? null : Number(row5.id);
|
|
32468
32484
|
}
|
|
32469
|
-
function labelOfId(db, id) {
|
|
32470
|
-
const row5 = stmt(db.raw, "SELECT label FROM sources WHERE id =
|
|
32485
|
+
function labelOfId(db, id, w) {
|
|
32486
|
+
const row5 = stmt(db.raw, "SELECT label FROM sources WHERE id = :id AND " + IN_SCOPE).get({ id, ...scopeArgs(w) });
|
|
32471
32487
|
return row5 === void 0 ? null : row5.label;
|
|
32472
32488
|
}
|
|
32473
|
-
function
|
|
32474
|
-
const named2 = storedLabel(db, source);
|
|
32489
|
+
function pickIn(db, source, suffix, w) {
|
|
32490
|
+
const named2 = storedLabel(db, source, w);
|
|
32475
32491
|
const id = parseSourceHandle(source);
|
|
32476
|
-
const own4 = newestId(db, named2);
|
|
32492
|
+
const own4 = newestId(db, named2, w);
|
|
32477
32493
|
if (own4 !== null) {
|
|
32478
|
-
const otherLabel = id === null || id === own4 ? null : labelOfId(db, id);
|
|
32494
|
+
const otherLabel = id === null || id === own4 ? null : labelOfId(db, id, EVERY_ROW);
|
|
32479
32495
|
return { label: named2, id: own4, via: "label", other: otherLabel === null || otherLabel === named2 ? null : { id, label: otherLabel } };
|
|
32480
32496
|
}
|
|
32481
32497
|
if (id !== null) {
|
|
32482
|
-
const label2 = labelOfId(db, id);
|
|
32498
|
+
const label2 = labelOfId(db, id, w);
|
|
32483
32499
|
if (label2 !== null) return { label: label2, id, via: "handle", other: null };
|
|
32484
32500
|
}
|
|
32485
32501
|
if (suffix) {
|
|
32486
32502
|
const prefix = named2 + LABEL_SUFFIX_SEP;
|
|
32487
|
-
const rows = stmt(db.raw, "SELECT id, label FROM sources WHERE substr(label, 1,
|
|
32503
|
+
const rows = stmt(db.raw, "SELECT id, label FROM sources WHERE substr(label, 1, :n) = :prefix AND " + IN_SCOPE + " ORDER BY id DESC").all({ n: prefix.length, prefix, ...scopeArgs(w) });
|
|
32488
32504
|
for (const r of rows) {
|
|
32489
32505
|
if (r.label.lastIndexOf(LABEL_SUFFIX_SEP) === named2.length) return { label: r.label, id: Number(r.id), via: "suffix", other: null };
|
|
32490
32506
|
}
|
|
32491
32507
|
}
|
|
32492
32508
|
return { label: source, id: null, via: "none", other: null };
|
|
32493
32509
|
}
|
|
32510
|
+
function pickSource(db, source, suffix = true, w = EVERY_ROW) {
|
|
32511
|
+
if (w.scope !== "project") {
|
|
32512
|
+
const here = pickIn(db, source, suffix, w);
|
|
32513
|
+
if (here.via !== "none") return here;
|
|
32514
|
+
}
|
|
32515
|
+
return pickIn(db, source, suffix, EVERY_ROW);
|
|
32516
|
+
}
|
|
32494
32517
|
function collisionLine(value, pick4) {
|
|
32495
32518
|
if (pick4.other === null || pick4.id === null) return null;
|
|
32496
32519
|
return "Source " + JSON.stringify(value) + ": used the label " + shownLabel(pick4.label, null) + " (" + sourceHandle(pick4.id) + "); handle " + sourceHandle(pick4.other.id) + " is " + shownLabel(pick4.other.label, null) + (isLongLabel(pick4.other.label) ? ", search it by its full label." : ", search it with source:" + JSON.stringify(pick4.other.label) + ".");
|
|
@@ -44647,10 +44670,11 @@ function sourceCount(db, scope, ctx, source) {
|
|
|
44647
44670
|
function zeroHits(db, scope, ctx, source, mem, nm, queries, offset = 0) {
|
|
44648
44671
|
const inScope = sourceCount(db, scope, ctx, source);
|
|
44649
44672
|
const n = inScope + mem.rows.length;
|
|
44650
|
-
if (offset > 0) return reply("No more hits past offset " + offset + ' in scope "' + scope + '" across ' + n + " source(s).", false);
|
|
44651
44673
|
const head = 'No hits in scope "' + scope + '" across ' + n + " source(s).";
|
|
44652
44674
|
const pick4 = nm.pick;
|
|
44653
|
-
if (pick4 === null || mem.named || inScope > 0)
|
|
44675
|
+
if (pick4 === null || mem.named || inScope > 0) {
|
|
44676
|
+
return reply(offset > 0 ? "No more hits past offset " + offset + ' in scope "' + scope + '" across ' + n + " source(s)." : head, false);
|
|
44677
|
+
}
|
|
44654
44678
|
if (pick4.id !== null) {
|
|
44655
44679
|
const wider = scope === "session" && sourceCount(db, "worktree", ctx, source) > 0 ? "worktree" : "project";
|
|
44656
44680
|
return reply(head + "\nSource " + JSON.stringify(nm.arg) + ' is stored in scope "' + wider + '": ' + callText(queries, wider, nm.arg, "") + " searches it.", false);
|
|
@@ -44935,7 +44959,8 @@ async function handler(input, ctx) {
|
|
|
44935
44959
|
const db = await openDb(ctx.project, { readOnly: true });
|
|
44936
44960
|
try {
|
|
44937
44961
|
const given = input.source;
|
|
44938
|
-
const
|
|
44962
|
+
const within = { scope, sessionId: ctx.sessionId, worktree: ctx.project.worktree };
|
|
44963
|
+
const pick4 = given !== void 0 && given !== DECISION_SOURCE ? pickSource(db, given, true, within) : null;
|
|
44939
44964
|
if (pick4 !== null) input = { ...input, source: pick4.label };
|
|
44940
44965
|
const nm = named(given, pick4);
|
|
44941
44966
|
const indexed = pick4 !== null && pick4.id !== null;
|
|
@@ -45193,6 +45218,7 @@ var SHELL_TOOL_NAMES = Object.freeze(["Bash", "PowerShell"]);
|
|
|
45193
45218
|
var POWERSHELL_TOOL = "PowerShell";
|
|
45194
45219
|
var SHELL_CANONICAL = "Bash";
|
|
45195
45220
|
var CLAUDE_SHAPE_EVENTS = ["SessionStart", "UserPromptSubmit", "PreToolUse", "PostToolUse"];
|
|
45221
|
+
var FAILURE_EVENT = "PostToolUseFailure";
|
|
45196
45222
|
var MCP_PREFIX = "mcp__";
|
|
45197
45223
|
var MCP_SEP = "__";
|
|
45198
45224
|
var CLAUDE_SOURCES = { startup: "startup", resume: "resume", clear: "clear", compact: "compact" };
|
|
@@ -45366,7 +45392,14 @@ function requireFields(raw) {
|
|
|
45366
45392
|
}
|
|
45367
45393
|
function decode3(raw) {
|
|
45368
45394
|
requireFields(raw);
|
|
45369
|
-
const
|
|
45395
|
+
const failure3 = typeof raw === "object" && raw !== null && !Array.isArray(raw) && raw.hook_event_name === FAILURE_EVENT;
|
|
45396
|
+
const payload = failure3 ? { ...raw, hook_event_name: "PostToolUse" } : raw;
|
|
45397
|
+
const ev = decodeClaudeShape(payload, "claude-code", TOOL_NAME_PREFIX, CLAUDE_SOURCES);
|
|
45398
|
+
if (failure3) {
|
|
45399
|
+
const error42 = raw.error;
|
|
45400
|
+
const text = typeof error42 === "string" ? error42 : error42 === void 0 ? "" : JSON.stringify(error42);
|
|
45401
|
+
ev.result = { isError: true, bytes: Buffer.byteLength(text), text, keep: true };
|
|
45402
|
+
}
|
|
45370
45403
|
if (ev.tool !== void 0 && ev.tool.name === POWERSHELL_TOOL) ev.tool.canonicalName = SHELL_CANONICAL;
|
|
45371
45404
|
if (ev.cwd === "") ev.cwd = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
45372
45405
|
if (ev.event === "PostToolUse" && ev.tool !== void 0 && ev.tool.callId === void 0) {
|
|
@@ -45545,9 +45578,9 @@ var NATIVE_TO_CANONICAL2 = {
|
|
|
45545
45578
|
grep_search: "Grep",
|
|
45546
45579
|
web_fetch: "WebFetch"
|
|
45547
45580
|
};
|
|
45548
|
-
var
|
|
45581
|
+
var FAILURE_EVENT2 = "PostToolUseFailure";
|
|
45549
45582
|
function decode6(raw) {
|
|
45550
|
-
const failure3 = typeof raw === "object" && raw !== null && !Array.isArray(raw) && raw.hook_event_name ===
|
|
45583
|
+
const failure3 = typeof raw === "object" && raw !== null && !Array.isArray(raw) && raw.hook_event_name === FAILURE_EVENT2;
|
|
45551
45584
|
const payload = failure3 ? { ...raw, hook_event_name: "PostToolUse" } : raw;
|
|
45552
45585
|
const ev = decodeClaudeShape(payload, "qwen", TOOL_NAME_PREFIX4, QWEN_SOURCES);
|
|
45553
45586
|
if (ev.tool !== void 0 && Object.hasOwn(NATIVE_TO_CANONICAL2, ev.tool.name)) ev.tool.canonicalName = NATIVE_TO_CANONICAL2[ev.tool.name];
|
|
@@ -45867,12 +45900,12 @@ var TOOL_NAME_PREFIX8 = "mcp__context-mode__";
|
|
|
45867
45900
|
var PLUGIN_TOOL_NAME_PREFIX = "mcp__plugin_context-mode_context-mode__";
|
|
45868
45901
|
var ZCODE_SOURCES = { startup: "startup", resume: "resume", clear: "clear", compact: "compact" };
|
|
45869
45902
|
var TWINS = { hook_event_name: "hookEventName", session_id: "sessionId" };
|
|
45870
|
-
var
|
|
45903
|
+
var FAILURE_EVENT3 = "PostToolUseFailure";
|
|
45871
45904
|
function decode10(raw) {
|
|
45872
45905
|
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) throw new Error("zcode: hook payload is not a JSON object");
|
|
45873
45906
|
const p = { ...raw };
|
|
45874
45907
|
for (const [snake, camel] of Object.entries(TWINS)) if (p[snake] === void 0) p[snake] = p[camel];
|
|
45875
|
-
const failure3 = p.hook_event_name ===
|
|
45908
|
+
const failure3 = p.hook_event_name === FAILURE_EVENT3;
|
|
45876
45909
|
if (failure3) p.hook_event_name = "PostToolUse";
|
|
45877
45910
|
const toolName2 = typeof p.tool_name === "string" ? p.tool_name : "";
|
|
45878
45911
|
const prefix = toolName2.startsWith(PLUGIN_TOOL_NAME_PREFIX) ? PLUGIN_TOOL_NAME_PREFIX : TOOL_NAME_PREFIX8;
|
|
@@ -45963,7 +45996,8 @@ var OPENCODE_EVENTS = {
|
|
|
45963
45996
|
var SHELL_TOOL_NAME = "bash";
|
|
45964
45997
|
var READ_TOOL_NAME = "read";
|
|
45965
45998
|
var SHELL_TOOL_NAMES5 = Object.freeze([SHELL_TOOL_NAME, "shell"]);
|
|
45966
|
-
var
|
|
45999
|
+
var SKILL_TOOL_NAME = "skill";
|
|
46000
|
+
var NATIVE_TO_CANONICAL7 = { webfetch: "WebFetch", [READ_TOOL_NAME]: "Read", [SKILL_TOOL_NAME]: "Skill", ...Object.fromEntries(SHELL_TOOL_NAMES5.map((n) => [n, "Bash"])) };
|
|
45967
46001
|
function toCanonicalTool(name) {
|
|
45968
46002
|
if (name.startsWith(OWN_WIRE_PREFIX)) return name.slice(OWN_WIRE_PREFIX.length);
|
|
45969
46003
|
return Object.prototype.hasOwnProperty.call(NATIVE_TO_CANONICAL7, name) ? NATIVE_TO_CANONICAL7[name] : name;
|
|
@@ -46268,7 +46302,7 @@ function ownBundleDir() {
|
|
|
46268
46302
|
|
|
46269
46303
|
// src/core/ops/doctor-config.ts
|
|
46270
46304
|
import { existsSync as existsSync12, readdirSync as readdirSync7, readFileSync as readFileSync11 } from "node:fs";
|
|
46271
|
-
import { dirname as dirname7, isAbsolute as
|
|
46305
|
+
import { dirname as dirname7, isAbsolute as isAbsolute5, join as join13, resolve as resolve4 } from "node:path";
|
|
46272
46306
|
|
|
46273
46307
|
// src/core/ops/host-text.ts
|
|
46274
46308
|
var BOM_CODE = 65279;
|
|
@@ -49165,7 +49199,7 @@ function detectV1(agent, home, scope = {}) {
|
|
|
49165
49199
|
|
|
49166
49200
|
// src/core/ops/plugin-root.ts
|
|
49167
49201
|
import { existsSync as existsSync8, readdirSync as readdirSync6, readFileSync as readFileSync7, realpathSync as realpathSync4 } from "node:fs";
|
|
49168
|
-
import { dirname as dirname6, isAbsolute as
|
|
49202
|
+
import { dirname as dirname6, isAbsolute as isAbsolute3, join as join10, sep as sep2 } from "node:path";
|
|
49169
49203
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
49170
49204
|
function missing(agent, path8) {
|
|
49171
49205
|
return new CtxError("PLUGIN_ROOT_MISSING", { agent, path: path8 });
|
|
@@ -49277,7 +49311,7 @@ function configEntryRoot(adapter, env) {
|
|
|
49277
49311
|
const value = parseHostConfig(adapter.id, file2, current.text, current.format);
|
|
49278
49312
|
const args = hostConfigValueAt(value, [...spec.key, MCP_ARGS_FIELD]);
|
|
49279
49313
|
const script = Array.isArray(args) ? args[0] : void 0;
|
|
49280
|
-
if (typeof script !== "string" || !
|
|
49314
|
+
if (typeof script !== "string" || !isAbsolute3(script)) throw missing(adapter.id, file2);
|
|
49281
49315
|
return dirname6(script);
|
|
49282
49316
|
}
|
|
49283
49317
|
function packageDirOf(dir) {
|
|
@@ -49384,7 +49418,7 @@ function piInstalledIn(env, home, pkgDir, cwd) {
|
|
|
49384
49418
|
|
|
49385
49419
|
// src/core/ops/doctor-env.ts
|
|
49386
49420
|
import { existsSync as existsSync10, readFileSync as readFileSync9, realpathSync as realpathSync6 } from "node:fs";
|
|
49387
|
-
import { isAbsolute as
|
|
49421
|
+
import { isAbsolute as isAbsolute4, join as join11, relative as relative2 } from "node:path";
|
|
49388
49422
|
function pass(id, detail = DOCTOR_PASS_DETAIL) {
|
|
49389
49423
|
return { id, label: DOCTOR_LABEL[id], status: "PASS", detail };
|
|
49390
49424
|
}
|
|
@@ -49553,7 +49587,7 @@ function checkMcp(ctx, adapter) {
|
|
|
49553
49587
|
function piCwdInside(worktree, piCwd) {
|
|
49554
49588
|
if (piCwd === void 0 || !existsSync10(piCwd)) return false;
|
|
49555
49589
|
const rel = relative2(worktree, realpathSync6.native(piCwd));
|
|
49556
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
49590
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute4(rel);
|
|
49557
49591
|
}
|
|
49558
49592
|
function checkProject(i) {
|
|
49559
49593
|
const bad = fail("D7", D7_DETAIL(i.project.source), D7_FIX);
|
|
@@ -49561,6 +49595,20 @@ function checkProject(i) {
|
|
|
49561
49595
|
if (i.adapter.projectSource === "pi:ctx.cwd" && !piCwdInside(i.project.worktree, i.piCwd)) return bad;
|
|
49562
49596
|
return pass("D7");
|
|
49563
49597
|
}
|
|
49598
|
+
function projectOrMissing(ctx) {
|
|
49599
|
+
try {
|
|
49600
|
+
return { project: ctx.project };
|
|
49601
|
+
} catch (err) {
|
|
49602
|
+
if (err instanceof CtxError && err.code === "NO_PROJECT") return { missing: String(err.vars.kind) };
|
|
49603
|
+
throw err;
|
|
49604
|
+
}
|
|
49605
|
+
}
|
|
49606
|
+
function noProjectRow(kind) {
|
|
49607
|
+
return fail("D7", D7_NO_PROJECT_DETAIL(kind), D7_FIX);
|
|
49608
|
+
}
|
|
49609
|
+
function needsProjectRow(id) {
|
|
49610
|
+
return unknown4(id, DOCTOR_NEEDS_PROJECT_DETAIL);
|
|
49611
|
+
}
|
|
49564
49612
|
function checkMode(adapter, hostPermission) {
|
|
49565
49613
|
if (hostPermission === "missing") return fail("D10", D10_PERMISSION_MISSING_DETAIL, D10_PERMISSION_FIX);
|
|
49566
49614
|
if (hostPermission === "wired") return pass("D10", D10_PERMISSION_DETAIL(adapter.denyChannel));
|
|
@@ -49878,7 +49926,7 @@ function opencodeDirPlugins(dirs) {
|
|
|
49878
49926
|
const loads = lits.some((p) => {
|
|
49879
49927
|
if (isModule(p)) return packageResolves(dirname7(f));
|
|
49880
49928
|
const bare2 = p.startsWith(FILE_URL_PREFIX) ? p.slice(FILE_URL_PREFIX.length) : p;
|
|
49881
|
-
return existsSync12(
|
|
49929
|
+
return existsSync12(isAbsolute5(bare2) ? bare2 : resolve4(dirname7(f), bare2));
|
|
49882
49930
|
});
|
|
49883
49931
|
out.push({ file: f, loads });
|
|
49884
49932
|
}
|
|
@@ -52805,9 +52853,11 @@ function hookLogTail(env) {
|
|
|
52805
52853
|
}
|
|
52806
52854
|
async function journalRows(ctx) {
|
|
52807
52855
|
const head = ["| kind | tool | bytes | ok | exit_code | created_at |", "|---|---|---|---|---|---|"];
|
|
52808
|
-
|
|
52856
|
+
const p = projectOrMissing(ctx);
|
|
52857
|
+
if ("missing" in p) return [`(no project: ${D7_NO_PROJECT_DETAIL(p.missing)})`];
|
|
52858
|
+
if (!existsSync17(p.project.dbPath)) return [`(context.db is absent at ${p.project.dbPath})`];
|
|
52809
52859
|
try {
|
|
52810
|
-
const db = await openDb(
|
|
52860
|
+
const db = await openDb(p.project, { readOnly: true });
|
|
52811
52861
|
try {
|
|
52812
52862
|
const rows = db.raw.prepare(`SELECT kind, tool, bytes, ok, exit_code, created_at FROM events ORDER BY seq DESC LIMIT ${DOCTOR_JOURNAL_ROWS}`).all();
|
|
52813
52863
|
const cell5 = (v) => v === null || v === void 0 ? "" : String(v);
|
|
@@ -52866,6 +52916,7 @@ async function buildIssueBody(i) {
|
|
|
52866
52916
|
const failRows = i.rows.filter((r) => r.status !== "PASS");
|
|
52867
52917
|
const envNames = DOCTOR_ENV_NAMES.map((n) => i.env[n] === void 0 ? `${n} (unset)` : `${n}=${i.env[n]}`);
|
|
52868
52918
|
const pathTools = DOCTOR_PATH_TOOLS.map((t) => `PATH holds ${t}: ${onPath(i.env, t).join(", ") || "(absent)"}`);
|
|
52919
|
+
const p = projectOrMissing(i.ctx);
|
|
52869
52920
|
const sections = {
|
|
52870
52921
|
"Summary": [summaryOf(agent, i.rows, i.unsupported)],
|
|
52871
52922
|
"ctx-report": [i.table],
|
|
@@ -52876,7 +52927,7 @@ async function buildIssueBody(i) {
|
|
|
52876
52927
|
],
|
|
52877
52928
|
"Hook errors": ["hook-errors.log, last " + DOCTOR_HOOK_LOG_LINES + " lines (UTC):", "```", ...hookLogTail(i.env), "```"],
|
|
52878
52929
|
"Journal rows": ["events, newest first, last " + DOCTOR_JOURNAL_ROWS + " (bodies stay local):", ...await journalRows(i.ctx)],
|
|
52879
|
-
"Agent config": agentConfig(i.adapter, i.env,
|
|
52930
|
+
"Agent config": agentConfig(i.adapter, i.env, "project" in p ? p.project.worktree : process.cwd()),
|
|
52880
52931
|
"Expected": ["Expected: <the agent fills this in: what should happen, with the byte count>"],
|
|
52881
52932
|
"Steps": [
|
|
52882
52933
|
"Reproduced: <yes (2 of 2) or 1 of 2>",
|
|
@@ -52897,7 +52948,7 @@ async function buildIssueBody(i) {
|
|
|
52897
52948
|
`git: ${gitVersion(i.env)}`,
|
|
52898
52949
|
...pathTools,
|
|
52899
52950
|
...envNames,
|
|
52900
|
-
`Project: ${
|
|
52951
|
+
"project" in p ? `Project: ${p.project.worktree} (key ${p.project.projectKey})` : `Project: ${D7_NO_PROJECT_DETAIL(p.missing)}`,
|
|
52901
52952
|
"Filed by: <your agent name, version, model id>"
|
|
52902
52953
|
]
|
|
52903
52954
|
};
|
|
@@ -52955,10 +53006,10 @@ async function guard(id, run) {
|
|
|
52955
53006
|
return { id, label: DOCTOR_LABEL[id], status: "UNKNOWN", detail: lineOf(err) };
|
|
52956
53007
|
}
|
|
52957
53008
|
}
|
|
52958
|
-
async function codexDb(
|
|
52959
|
-
if (adapter.id !== "codex" || !existsSync18(
|
|
53009
|
+
async function codexDb(project, adapter) {
|
|
53010
|
+
if (adapter.id !== "codex" || !existsSync18(project.dbPath)) return null;
|
|
52960
53011
|
try {
|
|
52961
|
-
return await openDb(
|
|
53012
|
+
return await openDb(project, { readOnly: true });
|
|
52962
53013
|
} catch {
|
|
52963
53014
|
return null;
|
|
52964
53015
|
}
|
|
@@ -52969,12 +53020,12 @@ function d1UpdateCommand(agent, env, other) {
|
|
|
52969
53020
|
function unsupportedRow(id, h) {
|
|
52970
53021
|
return { id, label: DOCTOR_LABEL[id], status: "WARN", detail: UNSUPPORTED_HOST_LINE(h.name) };
|
|
52971
53022
|
}
|
|
52972
|
-
async function hookRow(ctx, adapter, host) {
|
|
52973
|
-
const db = await codexDb(
|
|
53023
|
+
async function hookRow(ctx, project, adapter, host) {
|
|
53024
|
+
const db = await codexDb(project, adapter);
|
|
52974
53025
|
const runStart = Date.now();
|
|
52975
53026
|
try {
|
|
52976
53027
|
const row5 = await checkHookRoundTrip({
|
|
52977
|
-
worktree:
|
|
53028
|
+
worktree: project.worktree,
|
|
52978
53029
|
agent: adapter.id,
|
|
52979
53030
|
bundleDir: host.bundleDir,
|
|
52980
53031
|
env: buildChildEnv(host.env),
|
|
@@ -53003,7 +53054,9 @@ function ownServerId(configDir, projectKey) {
|
|
|
53003
53054
|
async function runDoctorChecks(ctx, adapter, host0) {
|
|
53004
53055
|
const host = adapter.id === "codex" ? { ...host0, env: { ...host0.env, CODEX_HOME: codexRunDirOf(host0.env, homeDirOf(host0.env) ?? "", host0.bundleDir) } } : host0;
|
|
53005
53056
|
const env = host.env;
|
|
53006
|
-
const
|
|
53057
|
+
const p = projectOrMissing(ctx);
|
|
53058
|
+
if ("missing" in p) return noProjectRows(ctx, adapter, host, p.missing);
|
|
53059
|
+
const project = p.project;
|
|
53007
53060
|
const other = adapter.installMode === "in-process" ? void 0 : unsupportedHostOf({ clientName: ctx.clientInfo?.name, bundleDir: host.bundleDir, env });
|
|
53008
53061
|
let integrityFailed = false;
|
|
53009
53062
|
let orphan = [];
|
|
@@ -53013,7 +53066,7 @@ async function runDoctorChecks(ctx, adapter, host0) {
|
|
|
53013
53066
|
D3: () => other !== void 0 ? unsupportedRow("D3", other) : checkHostConfig(adapter, env, project.worktree),
|
|
53014
53067
|
// D-UNSUPPORTED-HOSTS-1
|
|
53015
53068
|
D4: () => checkV1Leftovers(adapter.id, requireHomeDir(env), { project: project.worktree, piAgentDir: piAgentDirOf(env, requireHomeDir(env)), claudeDir: claudeDirOf(env, requireHomeDir(env)), codexDir: codexDirOf(env, requireHomeDir(env)), geminiDir: geminiDirOf(env, requireHomeDir(env)), copilotDir: copilotDirOf(env, requireHomeDir(env)), kiroDir: kiroDirOf(env, requireHomeDir(env)), opencodeDir: opencodeDirOf(env, requireHomeDir(env)) }),
|
|
53016
|
-
D5: () => other !== void 0 ? unsupportedRow("D5", other) : hookRow(ctx, adapter, host),
|
|
53069
|
+
D5: () => other !== void 0 ? unsupportedRow("D5", other) : hookRow(ctx, project, adapter, host),
|
|
53017
53070
|
D5b: () => checkDoubleFire(adapter.id, project.worktree),
|
|
53018
53071
|
D6: () => checkMcp(ctx, adapter),
|
|
53019
53072
|
D7: () => checkProject({ project, adapter, piCwd: host.piCwd }),
|
|
@@ -53043,6 +53096,28 @@ async function runDoctorChecks(ctx, adapter, host0) {
|
|
|
53043
53096
|
});
|
|
53044
53097
|
return rows;
|
|
53045
53098
|
}
|
|
53099
|
+
async function noProjectRows(ctx, adapter, host, missing2) {
|
|
53100
|
+
const env = host.env;
|
|
53101
|
+
const other = adapter.installMode === "in-process" ? void 0 : unsupportedHostOf({ clientName: ctx.clientInfo?.name, bundleDir: host.bundleDir, env });
|
|
53102
|
+
const wait = (id) => () => needsProjectRow(id);
|
|
53103
|
+
const checks = {
|
|
53104
|
+
D1: () => checkVersion({ bundleSha: BUNDLE_SHA, version: bundleVersion(host.bundleDir), registryUrl: D1_REGISTRY_URL, timeoutMs: DOCTOR_GIT_TIMEOUT_MS, env: buildChildEnv(env), cwd: process.cwd(), signal: ctx.signal, updateCommand: d1UpdateCommand(adapter.id, env, other) }),
|
|
53105
|
+
D2: () => checkNode({ nodeVersion: process.version, bunVersion: process.versions.bun }),
|
|
53106
|
+
D3: other !== void 0 ? () => unsupportedRow("D3", other) : wait("D3"),
|
|
53107
|
+
D4: () => checkV1Leftovers(adapter.id, requireHomeDir(env), { piAgentDir: piAgentDirOf(env, requireHomeDir(env)), claudeDir: claudeDirOf(env, requireHomeDir(env)), codexDir: codexDirOf(env, requireHomeDir(env)), geminiDir: geminiDirOf(env, requireHomeDir(env)), copilotDir: copilotDirOf(env, requireHomeDir(env)), kiroDir: kiroDirOf(env, requireHomeDir(env)), opencodeDir: opencodeDirOf(env, requireHomeDir(env)) }),
|
|
53108
|
+
D5: other !== void 0 ? () => unsupportedRow("D5", other) : wait("D5"),
|
|
53109
|
+
D5b: wait("D5b"),
|
|
53110
|
+
D6: () => checkMcp(ctx, adapter),
|
|
53111
|
+
D7: () => noProjectRow(missing2),
|
|
53112
|
+
D8: wait("D8"),
|
|
53113
|
+
D9: wait("D9"),
|
|
53114
|
+
D10: () => checkMode(adapter, ctx.hostPermission),
|
|
53115
|
+
D11: () => checkRuntimes(env, checkShell(env))
|
|
53116
|
+
};
|
|
53117
|
+
const rows = [];
|
|
53118
|
+
for (const id of DOCTOR_CHECK_ORDER) rows.push(await guard(id, checks[id]));
|
|
53119
|
+
return rows;
|
|
53120
|
+
}
|
|
53046
53121
|
function reportEnv(env) {
|
|
53047
53122
|
const out = {};
|
|
53048
53123
|
for (const key of Object.keys(REPORT_ENV_ENUMS)) {
|
|
@@ -53052,7 +53127,7 @@ function reportEnv(env) {
|
|
|
53052
53127
|
return out;
|
|
53053
53128
|
}
|
|
53054
53129
|
async function doctorReply(ctx, host) {
|
|
53055
|
-
const adapter = getAdapter(ctx.project.agent);
|
|
53130
|
+
const adapter = getAdapter(ctx.agent ?? ctx.project.agent);
|
|
53056
53131
|
const runtime = runtimeInfo(host.env, ctx.signal);
|
|
53057
53132
|
const rows = await runDoctorChecks(ctx, adapter, host);
|
|
53058
53133
|
const failed = rows.some((r) => r.status === "FAIL");
|
|
@@ -53074,9 +53149,11 @@ async function doctorReply(ctx, host) {
|
|
|
53074
53149
|
const whole2 = [envLine2, table3, ...docs, ...info, ...notes].join("\n");
|
|
53075
53150
|
const bytes5 = Buffer.byteLength(whole2, "utf8");
|
|
53076
53151
|
if (bytes5 <= REPORT_CAP) return { text: whole2, isError: false, sandboxBytes: bytes5 };
|
|
53077
|
-
const
|
|
53152
|
+
const p = projectOrMissing(ctx);
|
|
53153
|
+
if ("missing" in p) return { text: whole2, isError: false, sandboxBytes: bytes5 };
|
|
53154
|
+
const db = await openDb(p.project);
|
|
53078
53155
|
try {
|
|
53079
|
-
indexText(db,
|
|
53156
|
+
indexText(db, p.project, ctx.sessionId, REPORT_SOURCE_LABEL, whole2, "text");
|
|
53080
53157
|
} finally {
|
|
53081
53158
|
closeDb(db);
|
|
53082
53159
|
}
|
|
@@ -53497,6 +53574,7 @@ function globSeg(pat, name) {
|
|
|
53497
53574
|
}
|
|
53498
53575
|
|
|
53499
53576
|
// src/core/sandbox/fetch.ts
|
|
53577
|
+
import { randomBytes } from "node:crypto";
|
|
53500
53578
|
import { readFileSync as readFileSync16 } from "node:fs";
|
|
53501
53579
|
import { lookup } from "node:dns/promises";
|
|
53502
53580
|
import http from "node:http";
|
|
@@ -53531,6 +53609,26 @@ var PRIVATE_RANGES = [
|
|
|
53531
53609
|
];
|
|
53532
53610
|
var BLOCKED = new BlockList();
|
|
53533
53611
|
for (const [net, prefix, type] of PRIVATE_RANGES) BLOCKED.addSubnet(net, prefix, type);
|
|
53612
|
+
var FAKE_IP_POOL = new BlockList();
|
|
53613
|
+
FAKE_IP_POOL.addSubnet("198.18.0.0", 15, "ipv4");
|
|
53614
|
+
var FAKE_IP_PROBE_TLD = ".invalid";
|
|
53615
|
+
var FAKE_IP_PROBE_BYTES = 8;
|
|
53616
|
+
var FAKE_IP_PROBE_MS = 1500;
|
|
53617
|
+
var fakeIpProbe;
|
|
53618
|
+
function inFakeIpPool(address) {
|
|
53619
|
+
return isIP(address) === 4 && FAKE_IP_POOL.check(address, "ipv4");
|
|
53620
|
+
}
|
|
53621
|
+
function fakeIpResolver() {
|
|
53622
|
+
fakeIpProbe ??= new Promise((resolve10) => {
|
|
53623
|
+
const timer = setTimeout(() => resolve10(false), FAKE_IP_PROBE_MS);
|
|
53624
|
+
timer.unref();
|
|
53625
|
+
lookup(randomBytes(FAKE_IP_PROBE_BYTES).toString("hex") + FAKE_IP_PROBE_TLD, { all: true }).then(
|
|
53626
|
+
(addrs) => resolve10(addrs.length > 0 && addrs.every((a) => inFakeIpPool(a.address))),
|
|
53627
|
+
() => resolve10(false)
|
|
53628
|
+
).finally(() => clearTimeout(timer));
|
|
53629
|
+
});
|
|
53630
|
+
return fakeIpProbe;
|
|
53631
|
+
}
|
|
53534
53632
|
var STATUS_OK_FIRST = 200;
|
|
53535
53633
|
var STATUS_OK_END = 300;
|
|
53536
53634
|
var STATUS_REDIRECT = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
@@ -53633,8 +53731,15 @@ function checkAddress(hostname2, address) {
|
|
|
53633
53731
|
throw new CtxError("SSRF", { host: hostname2 });
|
|
53634
53732
|
}
|
|
53635
53733
|
}
|
|
53636
|
-
async function
|
|
53637
|
-
const
|
|
53734
|
+
async function checkResolved(host, addrs, signal) {
|
|
53735
|
+
const pooled = isIP(host) === 0 ? addrs.filter((a) => inFakeIpPool(a.address)) : [];
|
|
53736
|
+
for (const a of addrs) if (!pooled.includes(a)) checkAddress(host, a.address);
|
|
53737
|
+
if (pooled.length === 0) return;
|
|
53738
|
+
const fakeIp = await fakeIpResolver();
|
|
53739
|
+
if (signal.aborted) throw fail5("ABORT_ERR");
|
|
53740
|
+
if (!fakeIp) checkAddress(host, pooled[0].address);
|
|
53741
|
+
}
|
|
53742
|
+
async function lookupAll(host, signal) {
|
|
53638
53743
|
let addrs;
|
|
53639
53744
|
try {
|
|
53640
53745
|
addrs = await lookup(host, { all: true });
|
|
@@ -53643,9 +53748,26 @@ async function resolveTarget(u, signal) {
|
|
|
53643
53748
|
}
|
|
53644
53749
|
if (signal.aborted) throw fail5("ABORT_ERR");
|
|
53645
53750
|
if (addrs.length === 0) throw fail5("ENOTFOUND");
|
|
53646
|
-
|
|
53751
|
+
return addrs;
|
|
53752
|
+
}
|
|
53753
|
+
async function resolveTarget(u, signal, checked) {
|
|
53754
|
+
const host = bare(u.hostname);
|
|
53755
|
+
const addrs = await lookupAll(host, signal);
|
|
53756
|
+
if (checked) await checkResolved(host, addrs, signal);
|
|
53647
53757
|
return { host, port: u.port === "" ? defaultPort(u.protocol) : Number(u.port), address: addrs[0].address };
|
|
53648
53758
|
}
|
|
53759
|
+
async function checkProxiedTarget(u, signal) {
|
|
53760
|
+
const host = bare(u.hostname);
|
|
53761
|
+
if (isIP(host) !== 0) return checkAddress(host, host);
|
|
53762
|
+
let addrs;
|
|
53763
|
+
try {
|
|
53764
|
+
addrs = await lookupAll(host, signal);
|
|
53765
|
+
} catch (err) {
|
|
53766
|
+
if (signal.aborted) throw err;
|
|
53767
|
+
return;
|
|
53768
|
+
}
|
|
53769
|
+
await checkResolved(host, addrs, signal);
|
|
53770
|
+
}
|
|
53649
53771
|
function tlsName(host) {
|
|
53650
53772
|
return isIP(host) === 0 ? host : void 0;
|
|
53651
53773
|
}
|
|
@@ -53703,9 +53825,8 @@ async function safeFetch(url4, signal) {
|
|
|
53703
53825
|
for (let hop = 0; ; hop += 1) {
|
|
53704
53826
|
if (signal.aborted) throw fail5("ABORT_ERR");
|
|
53705
53827
|
const proxy = pickProxy(current);
|
|
53706
|
-
|
|
53707
|
-
|
|
53708
|
-
const conn = await resolveTarget(proxy === void 0 ? current : proxy.url, signal);
|
|
53828
|
+
if (proxy !== void 0) await checkProxiedTarget(current, signal);
|
|
53829
|
+
const conn = await resolveTarget(proxy === void 0 ? current : proxy.url, signal, proxy === void 0);
|
|
53709
53830
|
const res = await request(current, conn, proxy, signal);
|
|
53710
53831
|
const status = res.statusCode ?? 0;
|
|
53711
53832
|
const location = res.headers.location;
|
|
@@ -57734,8 +57855,11 @@ var ctxPurge = Object.freeze({
|
|
|
57734
57855
|
|
|
57735
57856
|
// src/core/compaction/candidates.ts
|
|
57736
57857
|
function firstLine3(body) {
|
|
57737
|
-
const
|
|
57738
|
-
|
|
57858
|
+
const i = body.length - body.trimStart().length;
|
|
57859
|
+
if (i === body.length) return "";
|
|
57860
|
+
const start = i === 0 ? 0 : body.lastIndexOf("\n", i) + 1;
|
|
57861
|
+
const nl = body.indexOf("\n", i);
|
|
57862
|
+
return (start === 0 && nl < 0 ? body : body.slice(start, nl < 0 ? body.length : nl)).replaceAll("\r", " ");
|
|
57739
57863
|
}
|
|
57740
57864
|
function make(section, row5, text, repeatCount, query) {
|
|
57741
57865
|
const bytes5 = Buffer.byteLength(text, "utf8");
|
|
@@ -58910,6 +59034,9 @@ function metaNumber(meta3, key) {
|
|
|
58910
59034
|
function sessionIdOf(meta3, agent, env, serverId) {
|
|
58911
59035
|
const fromMeta = metaString(meta3, "sessionId");
|
|
58912
59036
|
if (fromMeta !== void 0) return fromMeta;
|
|
59037
|
+
const metaKey = agent === void 0 ? void 0 : HOST_SESSION_META[agent];
|
|
59038
|
+
const fromHostMeta = metaKey === void 0 ? void 0 : metaString(meta3, metaKey);
|
|
59039
|
+
if (fromHostMeta !== void 0) return fromHostMeta;
|
|
58913
59040
|
const key = agent === void 0 ? void 0 : HOST_SESSION_ENV[agent];
|
|
58914
59041
|
const fromHost = key === void 0 ? void 0 : env[key];
|
|
58915
59042
|
if (typeof fromHost === "string" && fromHost !== "") return fromHost;
|
|
@@ -59025,6 +59152,8 @@ async function startServer(argv, env) {
|
|
|
59025
59152
|
get project() {
|
|
59026
59153
|
return projectOf();
|
|
59027
59154
|
},
|
|
59155
|
+
...agent === void 0 ? {} : { agent },
|
|
59156
|
+
// D-1410-DOCTOR-NO-PROJECT-1
|
|
59028
59157
|
sessionId: sessionIdOf(meta3, agent, env, serverId),
|
|
59029
59158
|
turn: metaNumber(meta3, "turn") ?? 0,
|
|
59030
59159
|
signal: req.mcpReq.signal,
|