github-router 0.3.258 → 0.3.263
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{attribution-settings-CYBfjHzd.js → attribution-settings-DFIVIRG8.js} +4 -4
- package/dist/{attribution-settings-CYBfjHzd.js.map → attribution-settings-DFIVIRG8.js.map} +1 -1
- package/dist/{auth-CP4q2CjO.js → auth-WA88cE9q.js} +3 -3
- package/dist/{auth-CP4q2CjO.js.map → auth-WA88cE9q.js.map} +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{check-usage-6PB5IUFb.js → check-usage-v2apGKz7.js} +4 -4
- package/dist/{check-usage-6PB5IUFb.js.map → check-usage-v2apGKz7.js.map} +1 -1
- package/dist/{claude-DZ1VmE7I.js → claude-BCI3Sx6_.js} +16 -14
- package/dist/claude-BCI3Sx6_.js.map +1 -0
- package/dist/{codex-DwabDTOC.js → codex-DyJIrbJt.js} +8 -6
- package/dist/codex-DyJIrbJt.js.map +1 -0
- package/dist/{debug-CjmE9sgG.js → debug-vshv4nIv.js} +2 -2
- package/dist/{debug-CjmE9sgG.js.map → debug-vshv4nIv.js.map} +1 -1
- package/dist/engine-D8dlcSW6.js +2 -0
- package/dist/{gate-discovery-BpHK5pIq.js → gate-discovery-cMbt8Ct2.js} +5 -5
- package/dist/{gate-discovery-BpHK5pIq.js.map → gate-discovery-cMbt8Ct2.js.map} +1 -1
- package/dist/{get-copilot-usage-DD1N0Xlh.js → get-copilot-usage-DOFJWJaQ.js} +2 -2
- package/dist/{get-copilot-usage-DD1N0Xlh.js.map → get-copilot-usage-DOFJWJaQ.js.map} +1 -1
- package/dist/{internal-artifact-open-D2cQ2QCw.js → internal-artifact-open-CZGO831M.js} +2 -2
- package/dist/{internal-artifact-open-D2cQ2QCw.js.map → internal-artifact-open-CZGO831M.js.map} +1 -1
- package/dist/{internal-plan-review-ipnT3bhj.js → internal-plan-review-6gkcOAjT.js} +3 -3
- package/dist/{internal-plan-review-ipnT3bhj.js.map → internal-plan-review-6gkcOAjT.js.map} +1 -1
- package/dist/{internal-prompt-submit-DOj75_hh.js → internal-prompt-submit-C0XOPgcP.js} +4 -4
- package/dist/{internal-prompt-submit-DOj75_hh.js.map → internal-prompt-submit-C0XOPgcP.js.map} +1 -1
- package/dist/{internal-session-bind-DwK2iGW0.js → internal-session-bind-DtSBTkQe.js} +2 -2
- package/dist/{internal-session-bind-DwK2iGW0.js.map → internal-session-bind-DtSBTkQe.js.map} +1 -1
- package/dist/{internal-stop-hook-DiqatTCG.js → internal-stop-hook-CBcE2Js8.js} +5 -5
- package/dist/{internal-stop-hook-DiqatTCG.js.map → internal-stop-hook-CBcE2Js8.js.map} +1 -1
- package/dist/{internal-stop-review-AUcFssrW.js → internal-stop-review-_1Mqz7eT.js} +2 -2
- package/dist/{internal-stop-review-AUcFssrW.js.map → internal-stop-review-_1Mqz7eT.js.map} +1 -1
- package/dist/{lifecycle-Byw5s1G8.js → lifecycle-Bd1Fyf4B.js} +100 -3
- package/dist/lifecycle-Bd1Fyf4B.js.map +1 -0
- package/dist/lifecycle-CRTWEbiP.js +2 -0
- package/dist/lifecycle-DUPXAOQS.js +2 -0
- package/dist/{lifecycle-DD88ka3f.js → lifecycle-DjC9tC1A.js} +2 -2
- package/dist/{lifecycle-DD88ka3f.js.map → lifecycle-DjC9tC1A.js.map} +1 -1
- package/dist/main.js +14 -14
- package/dist/{models-B6UnGyRo.js → models-Cv6gprpy.js} +3 -3
- package/dist/{models-B6UnGyRo.js.map → models-Cv6gprpy.js.map} +1 -1
- package/dist/{orchestration-hRU4TdWr.js → orchestration-B6qidQAd.js} +2 -2
- package/dist/{orchestration-hRU4TdWr.js.map → orchestration-B6qidQAd.js.map} +1 -1
- package/dist/{paths-C1cLZ7Ga.js → paths-BXrbboAS.js} +3 -3
- package/dist/{paths-C1cLZ7Ga.js.map → paths-BXrbboAS.js.map} +1 -1
- package/dist/paths-Dz1WyRJG.js +2 -0
- package/dist/{peer-mcp-personas-DYT9RZBk.js → peer-mcp-personas-B22ncnbQ.js} +380 -77
- package/dist/peer-mcp-personas-B22ncnbQ.js.map +1 -0
- package/dist/{plan-review-hook-C8x0uKPf.js → plan-review-hook-Bo4y1r3j.js} +2 -2
- package/dist/{plan-review-hook-C8x0uKPf.js.map → plan-review-hook-Bo4y1r3j.js.map} +1 -1
- package/dist/{prompt-submit-hook-BrkkLAAB.js → prompt-submit-hook-BFRFLSk5.js} +2 -2
- package/dist/{prompt-submit-hook-BrkkLAAB.js.map → prompt-submit-hook-BFRFLSk5.js.map} +1 -1
- package/dist/{provision-C2wCxRK_.js → provision-DSpLQHC3.js} +4 -4
- package/dist/{provision-C2wCxRK_.js.map → provision-DSpLQHC3.js.map} +1 -1
- package/dist/{serve-DHTgMHKU.js → serve-D9tBVVoK.js} +19 -14
- package/dist/{serve-DHTgMHKU.js.map → serve-D9tBVVoK.js.map} +1 -1
- package/dist/{server-setup-CJzxzYks.js → server-setup-BM9Smfek.js} +318 -21
- package/dist/server-setup-BM9Smfek.js.map +1 -0
- package/dist/{start-DePkmXJt.js → start-D7Hx2T_T.js} +8 -5
- package/dist/start-D7Hx2T_T.js.map +1 -0
- package/dist/{stop-gate-hook-DQc2KV7B.js → stop-gate-hook-Bmwla_2u.js} +11 -6
- package/dist/{stop-gate-hook-DQc2KV7B.js.map → stop-gate-hook-Bmwla_2u.js.map} +1 -1
- package/dist/{stop-gate-policy-CHwWbuF_.js → stop-gate-policy-CoMKWSsS.js} +2 -2
- package/dist/{stop-gate-policy-CHwWbuF_.js.map → stop-gate-policy-CoMKWSsS.js.map} +1 -1
- package/dist/{token-R2ocFC3M.js → token-C8Uh7aUe.js} +95 -13
- package/dist/token-C8Uh7aUe.js.map +1 -0
- package/package.json +1 -1
- package/dist/claude-DZ1VmE7I.js.map +0 -1
- package/dist/codex-DwabDTOC.js.map +0 -1
- package/dist/engine-Cpu-wQ6p.js +0 -2
- package/dist/file-log-reporter-IFQcL5IK.js +0 -158
- package/dist/file-log-reporter-IFQcL5IK.js.map +0 -1
- package/dist/lifecycle-Byw5s1G8.js.map +0 -1
- package/dist/lifecycle-D80CaWie.js +0 -2
- package/dist/lifecycle-DzqCqDlM.js +0 -2
- package/dist/paths-CwKwc2pi.js +0 -2
- package/dist/peer-mcp-personas-DYT9RZBk.js.map +0 -1
- package/dist/server-setup-CJzxzYks.js.map +0 -1
- package/dist/start-DePkmXJt.js.map +0 -1
- package/dist/token-R2ocFC3M.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as getPackageVersion } from "./version-_Q1WpsQp.js";
|
|
2
|
-
import { t as PATHS } from "./paths-
|
|
3
|
-
import { C as copilotHeaders, E as githubAgentHeaders, O as state, S as copilotBaseUrl, T as githubAgentGraphQLHeaders, _ as withTransientRetry, b as GITHUB_API_BASE_URL, d as resolveModel, f as sleep$2, g as fetchWithTransientRetry, h as isAllowedCopilotHost, i as tryRefreshAndRetry, v as HTTPError, w as copilotVersion, x as GITHUB_GRAPHQL_URL } from "./token-
|
|
2
|
+
import { t as PATHS } from "./paths-BXrbboAS.js";
|
|
3
|
+
import { C as copilotHeaders, E as githubAgentHeaders, O as state, S as copilotBaseUrl, T as githubAgentGraphQLHeaders, _ as withTransientRetry, b as GITHUB_API_BASE_URL, d as resolveModel, f as sleep$2, g as fetchWithTransientRetry, h as isAllowedCopilotHost, i as tryRefreshAndRetry, v as HTTPError, w as copilotVersion, x as GITHUB_GRAPHQL_URL } from "./token-C8Uh7aUe.js";
|
|
4
4
|
import { a as resolveExecutable, c as runManagedExeCapture, i as parseIntEnv, r as parseBoolEnv } from "./exec-DTO2oin0.js";
|
|
5
|
-
import { i as registerExitHandlers$1, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-
|
|
5
|
+
import { i as registerExitHandlers$1, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-DjC9tC1A.js";
|
|
6
6
|
import { t as MCP_WORKSPACE_HEADER } from "./mcp-workspace-header-CGJbNeHb.js";
|
|
7
7
|
import { n as ArtifactError, r as applyInsecureTls, t as ArtifactClient } from "./client-CQMfroGV.js";
|
|
8
|
-
import { n as isPidAlive,
|
|
9
|
-
import { h as runGateChecks, m as sealedGateIds, p as resolveSealedGate } from "./stop-gate-hook-
|
|
10
|
-
import { t as liveExec } from "./orchestration-
|
|
8
|
+
import { n as isPidAlive, r as registerColbertExitHandlers, s as trackChild, t as getColbertInstanceUuid } from "./lifecycle-Bd1Fyf4B.js";
|
|
9
|
+
import { h as runGateChecks, m as sealedGateIds, p as resolveSealedGate } from "./stop-gate-hook-Bmwla_2u.js";
|
|
10
|
+
import { t as liveExec } from "./orchestration-B6qidQAd.js";
|
|
11
11
|
import { createRequire } from "node:module";
|
|
12
12
|
import consola from "consola";
|
|
13
13
|
import { chmodSync, closeSync, constants, cpSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
@@ -4534,8 +4534,11 @@ async function withFileLock(target, fn) {
|
|
|
4534
4534
|
const start = Date.now();
|
|
4535
4535
|
for (;;) try {
|
|
4536
4536
|
const fh = await fs$1.open(lockPath, "wx");
|
|
4537
|
-
|
|
4538
|
-
|
|
4537
|
+
try {
|
|
4538
|
+
await fh.writeFile(ownerToken);
|
|
4539
|
+
} finally {
|
|
4540
|
+
await fh.close().catch(() => {});
|
|
4541
|
+
}
|
|
4539
4542
|
break;
|
|
4540
4543
|
} catch (err) {
|
|
4541
4544
|
const code = err.code;
|
|
@@ -15305,7 +15308,7 @@ const BUILD_SPAWN_GRACE_MS = 3e4;
|
|
|
15305
15308
|
* route). A stable sha256-prefix of the canonical path is sufficient.
|
|
15306
15309
|
*/
|
|
15307
15310
|
function metaHashForWorkspace(workspace) {
|
|
15308
|
-
const canonical =
|
|
15311
|
+
const canonical = canonicalWorkspace(workspace);
|
|
15309
15312
|
let h = 2166136261;
|
|
15310
15313
|
for (let i = 0; i < canonical.length; i++) {
|
|
15311
15314
|
h ^= canonical.charCodeAt(i);
|
|
@@ -15317,11 +15320,79 @@ function metaPath(workspace) {
|
|
|
15317
15320
|
return path.join(PATHS.COLBERT_META_DIR, `${metaHashForWorkspace(workspace)}.json`);
|
|
15318
15321
|
}
|
|
15319
15322
|
/** Read the sidecar metadata for a workspace (null if none yet). */
|
|
15323
|
+
/**
|
|
15324
|
+
* Bump this when a router-side bug could have written a failure verdict that
|
|
15325
|
+
* was never the workspace's fault. A sidecar stamped with an older epoch gets
|
|
15326
|
+
* its watchdog-attributed streak cleared ONCE, then is stamped forward.
|
|
15327
|
+
*
|
|
15328
|
+
* Epoch 1: the fail-safe-probe fix. Before it, `indexDirSignature` could not
|
|
15329
|
+
* match colgrep's Windows extended-length `project_path`, so the inactivity
|
|
15330
|
+
* watchdog killed healthy builds and recorded `stuck` — which is refused
|
|
15331
|
+
* forever at a cap of 2. Those users are still capped after upgrading,
|
|
15332
|
+
* because the existing reset triggers on git/model/engine inputs and none of
|
|
15333
|
+
* those changed. This is the only thing that un-sticks them.
|
|
15334
|
+
* Epoch 2: widened to include `corrupt`, once it became clear the identity
|
|
15335
|
+
* bug MANUFACTURED corrupt verdicts (a null project-dir lookup was recorded
|
|
15336
|
+
* as corruption).
|
|
15337
|
+
*
|
|
15338
|
+
* Epoch 3: clearing the streak was not enough — `freshnessVerdict` returns
|
|
15339
|
+
* `failed` straight off `meta.status`, before it looks at the disk, so a
|
|
15340
|
+
* zeroed counter still short-circuited every query. The reset now drops the
|
|
15341
|
+
* status as well.
|
|
15342
|
+
*/
|
|
15343
|
+
const WATCHDOG_EPOCH = 3;
|
|
15344
|
+
/**
|
|
15345
|
+
* Failure classes the router-side bugs could have manufactured.
|
|
15346
|
+
*
|
|
15347
|
+
* `stuck`/`crashed` came from the blind watchdog. `corrupt` belongs here too,
|
|
15348
|
+
* which is not obvious: `repairCorruptIndex` recorded `failureClass:"corrupt"`
|
|
15349
|
+
* whenever `colbertProjectDir` returned null, and a null lookup is exactly
|
|
15350
|
+
* what the identity bug produced for a perfectly healthy index. So a stored
|
|
15351
|
+
* `corrupt` is not reliable evidence about the workspace — it may be evidence
|
|
15352
|
+
* about us. Observed on the machine where this was diagnosed: a `corrupt`
|
|
15353
|
+
* marker sitting next to an index that validates as coherent with 15 shards
|
|
15354
|
+
* and 1.24M embeddings.
|
|
15355
|
+
*
|
|
15356
|
+
* Clearing it is safe because it only resets the STREAK. The next query still
|
|
15357
|
+
* re-derives the verdict from the shards on disk, so an index that really is
|
|
15358
|
+
* corrupt is re-detected immediately and quarantined as before.
|
|
15359
|
+
*
|
|
15360
|
+
* `launch` stays excluded: a spawn failure (missing binary, unrunnable ORT)
|
|
15361
|
+
* is genuinely about the environment, and the existing engine-sha reset
|
|
15362
|
+
* already covers the case where an upgrade fixes it.
|
|
15363
|
+
*/
|
|
15364
|
+
const EPOCH_CLEARABLE = /* @__PURE__ */ new Set([
|
|
15365
|
+
"stuck",
|
|
15366
|
+
"crashed",
|
|
15367
|
+
"corrupt"
|
|
15368
|
+
]);
|
|
15369
|
+
/**
|
|
15370
|
+
* Clear a stale failure streak that a router-side bug produced.
|
|
15371
|
+
*
|
|
15372
|
+
* Bounded by construction: it fires only while the stored epoch is behind,
|
|
15373
|
+
* and the caller stamps the current epoch on the next write, so it is one
|
|
15374
|
+
* reset per epoch bump rather than a reset loop.
|
|
15375
|
+
*/
|
|
15376
|
+
function applyWatchdogEpoch(meta) {
|
|
15377
|
+
if ((meta.watchdogEpoch ?? 0) >= WATCHDOG_EPOCH) return meta;
|
|
15378
|
+
if (!(meta.status === "failed" && meta.failureClass !== void 0 && EPOCH_CLEARABLE.has(meta.failureClass))) return {
|
|
15379
|
+
...meta,
|
|
15380
|
+
watchdogEpoch: WATCHDOG_EPOCH
|
|
15381
|
+
};
|
|
15382
|
+
return {
|
|
15383
|
+
...meta,
|
|
15384
|
+
watchdogEpoch: WATCHDOG_EPOCH,
|
|
15385
|
+
status: "ready",
|
|
15386
|
+
failureClass: void 0,
|
|
15387
|
+
failedAttempts: 0,
|
|
15388
|
+
failedAt: void 0
|
|
15389
|
+
};
|
|
15390
|
+
}
|
|
15320
15391
|
async function readColbertMeta(workspace) {
|
|
15321
15392
|
try {
|
|
15322
15393
|
const raw = await fs$1.readFile(metaPath(workspace), "utf8");
|
|
15323
15394
|
const parsed = JSON.parse(raw);
|
|
15324
|
-
if (parsed && typeof parsed === "object" && typeof parsed.status === "string") return parsed;
|
|
15395
|
+
if (parsed && typeof parsed === "object" && typeof parsed.status === "string") return applyWatchdogEpoch(parsed);
|
|
15325
15396
|
return null;
|
|
15326
15397
|
} catch {
|
|
15327
15398
|
return null;
|
|
@@ -15340,15 +15411,23 @@ const _metaWriteChains = /* @__PURE__ */ new Map();
|
|
|
15340
15411
|
async function writeColbertMeta(meta) {
|
|
15341
15412
|
const key = metaHashForWorkspace(meta.workspace);
|
|
15342
15413
|
const next = (_metaWriteChains.get(key) ?? Promise.resolve()).then(() => writeColbertMetaUnchained(meta));
|
|
15343
|
-
|
|
15414
|
+
const settled = next.then(() => void 0, () => void 0);
|
|
15415
|
+
_metaWriteChains.set(key, settled);
|
|
15416
|
+
settled.then(() => {
|
|
15417
|
+
if (_metaWriteChains.get(key) === settled) _metaWriteChains.delete(key);
|
|
15418
|
+
});
|
|
15344
15419
|
return next;
|
|
15345
15420
|
}
|
|
15346
15421
|
async function writeColbertMetaUnchained(meta) {
|
|
15347
15422
|
await fs$1.mkdir(PATHS.COLBERT_META_DIR, { recursive: true });
|
|
15348
15423
|
const dest = metaPath(meta.workspace);
|
|
15424
|
+
const stamped = {
|
|
15425
|
+
...meta,
|
|
15426
|
+
watchdogEpoch: WATCHDOG_EPOCH
|
|
15427
|
+
};
|
|
15349
15428
|
const tmp = `${dest}.${process$1.pid}.${Math.random().toString(16).slice(2, 10)}.tmp`;
|
|
15350
15429
|
try {
|
|
15351
|
-
await fs$1.writeFile(tmp, JSON.stringify(
|
|
15430
|
+
await fs$1.writeFile(tmp, JSON.stringify(stamped, null, 2));
|
|
15352
15431
|
await fs$1.rename(tmp, dest);
|
|
15353
15432
|
} catch (err) {
|
|
15354
15433
|
await fs$1.rm(tmp, { force: true }).catch(() => {});
|
|
@@ -15447,17 +15526,112 @@ async function completedIndexOnDisk(workspace) {
|
|
|
15447
15526
|
if (!projectDir) return false;
|
|
15448
15527
|
return validateIndexIntegrity(path.join(projectDir, "index")).verdict !== "not-built";
|
|
15449
15528
|
}
|
|
15450
|
-
|
|
15451
|
-
|
|
15529
|
+
/**
|
|
15530
|
+
* Strip a Windows extended-length prefix.
|
|
15531
|
+
*
|
|
15532
|
+
* `\\?\Q:\dir` → `Q:\dir`, and `\\?\UNC\server\share` → `\\server\share`
|
|
15533
|
+
* (naively slicing 4 there would yield the relative `UNC\server\share`).
|
|
15534
|
+
* colgrep stores `project_path` in this form — 50 of 53 dirs on the machine
|
|
15535
|
+
* where this was diagnosed — so every comparison against its `project.json`
|
|
15536
|
+
* has to account for it.
|
|
15537
|
+
*/
|
|
15538
|
+
function stripExtendedPrefix(p) {
|
|
15539
|
+
if (p.startsWith("\\\\?\\UNC\\")) return `\\\\${p.slice(8)}`;
|
|
15540
|
+
if (p.startsWith("\\\\?\\")) return p.slice(4);
|
|
15541
|
+
return p;
|
|
15452
15542
|
}
|
|
15453
|
-
/**
|
|
15454
|
-
*
|
|
15455
|
-
|
|
15543
|
+
/**
|
|
15544
|
+
* Is the volume holding `p` case-insensitive?
|
|
15545
|
+
*
|
|
15546
|
+
* Probed at runtime rather than inferred from `process.platform`, because
|
|
15547
|
+
* the platform is wrong in both directions: APFS can be formatted
|
|
15548
|
+
* case-SENSITIVE (folding there merges two genuinely distinct workspaces),
|
|
15549
|
+
* and Linux routinely mounts case-INSENSITIVE volumes such as exfat/NTFS
|
|
15550
|
+
* (not folding there splits one workspace into two identities).
|
|
15551
|
+
*
|
|
15552
|
+
* Cheap and memoized per filesystem root: stat the path back through a
|
|
15553
|
+
* case-flipped spelling of its own basename. Falls back to the platform
|
|
15554
|
+
* default only when the probe itself cannot run.
|
|
15555
|
+
*/
|
|
15556
|
+
const _caseInsensitiveByRoot = /* @__PURE__ */ new Map();
|
|
15557
|
+
function volumeIsCaseInsensitive(p) {
|
|
15558
|
+
const root = path.parse(path.resolve(p)).root || path.sep;
|
|
15559
|
+
const cached = _caseInsensitiveByRoot.get(root);
|
|
15560
|
+
if (cached !== void 0) return cached;
|
|
15561
|
+
let result = process$1.platform === "win32" || process$1.platform === "darwin";
|
|
15562
|
+
try {
|
|
15563
|
+
let probe = path.resolve(p);
|
|
15564
|
+
for (let i = 0; i < 64 && !existsSync(probe); i++) {
|
|
15565
|
+
const parent = path.dirname(probe);
|
|
15566
|
+
if (parent === probe) break;
|
|
15567
|
+
probe = parent;
|
|
15568
|
+
}
|
|
15569
|
+
const base = path.basename(probe);
|
|
15570
|
+
if (base && /[a-z]/i.test(base)) {
|
|
15571
|
+
const flipped = base === base.toLowerCase() ? base.toUpperCase() : base.toLowerCase();
|
|
15572
|
+
const sibling = path.join(path.dirname(probe), flipped);
|
|
15573
|
+
result = existsSync(sibling);
|
|
15574
|
+
}
|
|
15575
|
+
} catch {}
|
|
15576
|
+
_caseInsensitiveByRoot.set(root, result);
|
|
15577
|
+
return result;
|
|
15578
|
+
}
|
|
15579
|
+
/**
|
|
15580
|
+
* THE canonical identity for a workspace. Every surface that answers "is this
|
|
15581
|
+
* the same workspace?" — the meta sidecar key, the colgrep project-dir lookup,
|
|
15582
|
+
* the watchdog signature, the init/search locks, and the argument handed to
|
|
15583
|
+
* colgrep — must go through this and nothing else.
|
|
15584
|
+
*
|
|
15585
|
+
* They previously disagreed four different ways, and the disagreement is what
|
|
15586
|
+
* made a healthy index invisible: colgrep writes `\\?\Q:\...`, the lookup
|
|
15587
|
+
* normalized it to `//?/q:/...`, and nothing ever matched.
|
|
15588
|
+
*
|
|
15589
|
+
* Order matters: realpath FIRST (it resolves symlinks — the macOS
|
|
15590
|
+
* `/var`→`/private/var` and `/tmp`→`/private/tmp` shapes — expands 8.3 short
|
|
15591
|
+
* names, and returns the true on-disk casing), THEN strip any extended-length
|
|
15592
|
+
* prefix from the *result*. `realpathSync.native` was measured to already
|
|
15593
|
+
* return a clean `Q:\Software\github-router` for all input spellings, so the
|
|
15594
|
+
* strip is belt-and-braces rather than load-bearing; it costs nothing and
|
|
15595
|
+
* covers the fallback path where realpath could not run at all.
|
|
15596
|
+
*/
|
|
15597
|
+
function canonicalWorkspace(p) {
|
|
15598
|
+
let out = stripExtendedPrefix(p);
|
|
15456
15599
|
try {
|
|
15457
|
-
|
|
15600
|
+
out = stripExtendedPrefix(realpathSync.native(out));
|
|
15601
|
+
} catch {
|
|
15602
|
+
out = resolveThroughExistingAncestor(out);
|
|
15603
|
+
}
|
|
15604
|
+
out = path.resolve(out);
|
|
15605
|
+
if (volumeIsCaseInsensitive(out)) out = out.toLowerCase();
|
|
15606
|
+
return process$1.platform === "win32" ? out.replaceAll("\\", "/") : out;
|
|
15607
|
+
}
|
|
15608
|
+
/**
|
|
15609
|
+
* Realpath as much of `p` as exists, then re-append the missing tail. Keeps a
|
|
15610
|
+
* not-yet-created or just-deleted path on the same canonical root as its live
|
|
15611
|
+
* self.
|
|
15612
|
+
*/
|
|
15613
|
+
function resolveThroughExistingAncestor(p) {
|
|
15614
|
+
const abs = path.resolve(p);
|
|
15615
|
+
const tail = [];
|
|
15616
|
+
let cur = abs;
|
|
15617
|
+
for (let i = 0; i < 64; i++) try {
|
|
15618
|
+
const real = stripExtendedPrefix(realpathSync.native(cur));
|
|
15619
|
+
return tail.length > 0 ? path.join(real, ...tail.reverse()) : real;
|
|
15458
15620
|
} catch {
|
|
15459
|
-
|
|
15621
|
+
const parent = path.dirname(cur);
|
|
15622
|
+
if (parent === cur) break;
|
|
15623
|
+
tail.push(path.basename(cur));
|
|
15624
|
+
cur = parent;
|
|
15460
15625
|
}
|
|
15626
|
+
return abs;
|
|
15627
|
+
}
|
|
15628
|
+
function canonicalForCompare(p) {
|
|
15629
|
+
return canonicalWorkspace(p);
|
|
15630
|
+
}
|
|
15631
|
+
/** Sync realpath-aware canonicalization. Retained as a named alias so call
|
|
15632
|
+
* sites read intentionally; `canonicalWorkspace` already realpaths. */
|
|
15633
|
+
function canonicalRealpathSync(p) {
|
|
15634
|
+
return canonicalWorkspace(p);
|
|
15461
15635
|
}
|
|
15462
15636
|
/** Recursive (bytes, fileCount) of a directory; sync + best-effort. A
|
|
15463
15637
|
* colgrep index is a bounded set of shards so the walk stays small. */
|
|
@@ -15483,23 +15657,13 @@ function dirSizeSync(dir) {
|
|
|
15483
15657
|
}
|
|
15484
15658
|
return [bytes, count];
|
|
15485
15659
|
}
|
|
15486
|
-
/**
|
|
15487
|
-
* (sync) Progress signature of a workspace's colgrep index dir for the init
|
|
15488
|
-
* inactivity watchdog: `${totalBytes}:${fileCount}` of the project dir, or
|
|
15489
|
-
* `null` if it isn't on disk yet. colgrep is SILENT on a non-TTY pipe
|
|
15490
|
-
* during the (potentially multi-hour) encode phase, so output is useless as
|
|
15491
|
-
* a progress signal — but it writes index shards incrementally, so a
|
|
15492
|
-
* changing signature means "still progressing" and a frozen one means
|
|
15493
|
-
* "hung". Successive signatures drive the watchdog: change ⇒ re-arm, frozen
|
|
15494
|
-
* ⇒ kill. Sync because it's called from a `setTimeout` (not awaited).
|
|
15495
|
-
*/
|
|
15496
15660
|
function indexDirSignature(workspace) {
|
|
15497
15661
|
const indicesDir = PATHS.COLBERT_INDICES_DIR;
|
|
15498
15662
|
let names;
|
|
15499
15663
|
try {
|
|
15500
15664
|
names = readdirSync(indicesDir);
|
|
15501
15665
|
} catch {
|
|
15502
|
-
return
|
|
15666
|
+
return { kind: "unknown" };
|
|
15503
15667
|
}
|
|
15504
15668
|
const want = canonicalRealpathSync(workspace);
|
|
15505
15669
|
for (const name of names) {
|
|
@@ -15514,10 +15678,14 @@ function indexDirSignature(workspace) {
|
|
|
15514
15678
|
}
|
|
15515
15679
|
const projPath = proj.path ?? proj.project_path;
|
|
15516
15680
|
if (!projPath || canonicalRealpathSync(projPath) !== want) continue;
|
|
15681
|
+
if (proj.model !== canonicalColbertModelDir()) continue;
|
|
15517
15682
|
const [bytes, count] = dirSizeSync(dir);
|
|
15518
|
-
return
|
|
15683
|
+
return {
|
|
15684
|
+
kind: "observed",
|
|
15685
|
+
signature: `${bytes}:${count}`
|
|
15686
|
+
};
|
|
15519
15687
|
}
|
|
15520
|
-
return
|
|
15688
|
+
return { kind: "not-created" };
|
|
15521
15689
|
}
|
|
15522
15690
|
/**
|
|
15523
15691
|
* Realpath-aware canonicalization for matching a workspace against
|
|
@@ -15527,11 +15695,7 @@ function indexDirSignature(workspace) {
|
|
|
15527
15695
|
* when realpath fails (path doesn't exist yet).
|
|
15528
15696
|
*/
|
|
15529
15697
|
async function realpathForCompare(p) {
|
|
15530
|
-
|
|
15531
|
-
return canonicalForCompare(await fs$1.realpath(p));
|
|
15532
|
-
} catch {
|
|
15533
|
-
return canonicalForCompare(p);
|
|
15534
|
-
}
|
|
15698
|
+
return canonicalWorkspace(p);
|
|
15535
15699
|
}
|
|
15536
15700
|
/**
|
|
15537
15701
|
* Compute the freshness verdict for a query against a workspace.
|
|
@@ -15747,18 +15911,13 @@ function envIntMs(name, fallback) {
|
|
|
15747
15911
|
*/
|
|
15748
15912
|
function makeIndexProgressProbe(workspace) {
|
|
15749
15913
|
let lastSig;
|
|
15750
|
-
let nullStreak = 0;
|
|
15751
15914
|
return () => {
|
|
15752
|
-
const
|
|
15753
|
-
if (
|
|
15754
|
-
nullStreak += 1;
|
|
15755
|
-
return nullStreak <= 1;
|
|
15756
|
-
}
|
|
15757
|
-
nullStreak = 0;
|
|
15915
|
+
const p = indexDirSignature(workspace);
|
|
15916
|
+
if (p.kind !== "observed") return true;
|
|
15758
15917
|
const prev = lastSig;
|
|
15759
|
-
lastSig =
|
|
15918
|
+
lastSig = p.signature;
|
|
15760
15919
|
if (prev === void 0) return true;
|
|
15761
|
-
return
|
|
15920
|
+
return p.signature !== prev;
|
|
15762
15921
|
};
|
|
15763
15922
|
}
|
|
15764
15923
|
/** Workspaces with a DETACHED indexing search in flight. A new search for
|
|
@@ -15809,10 +15968,18 @@ async function runSemanticSearch(opts) {
|
|
|
15809
15968
|
case "failed": return handleFailure(workspace, fresh.meta, false);
|
|
15810
15969
|
case "crashed": return handleFailure(workspace, fresh.meta, true);
|
|
15811
15970
|
case "corrupt": return repairCorruptIndex(workspace, fresh.meta);
|
|
15812
|
-
case "building":
|
|
15813
|
-
|
|
15814
|
-
|
|
15815
|
-
|
|
15971
|
+
case "building":
|
|
15972
|
+
if (!isInitInFlight(workspace) && !await completedIndexOnDisk(workspace)) {
|
|
15973
|
+
kickBackgroundInit(workspace);
|
|
15974
|
+
return {
|
|
15975
|
+
status: "building",
|
|
15976
|
+
notice: "semantic index build was interrupted; a rebuild was started — retry shortly (or use code_search now)"
|
|
15977
|
+
};
|
|
15978
|
+
}
|
|
15979
|
+
return {
|
|
15980
|
+
status: "building",
|
|
15981
|
+
notice: "semantic index is being built for this workspace; retry shortly (or use code_search now)"
|
|
15982
|
+
};
|
|
15816
15983
|
case "stale":
|
|
15817
15984
|
kickBackgroundInit(workspace);
|
|
15818
15985
|
return {
|
|
@@ -15871,6 +16038,13 @@ async function repairCorruptIndex(workspace, meta) {
|
|
|
15871
16038
|
status: "failed",
|
|
15872
16039
|
failureClass: "corrupt",
|
|
15873
16040
|
failedAttempts: attempts,
|
|
16041
|
+
failedAt: {
|
|
16042
|
+
head: meta?.lastIndexedHead,
|
|
16043
|
+
dirty: meta?.lastIndexedDirty,
|
|
16044
|
+
binarySha: colgrepBinAsset()?.sha256,
|
|
16045
|
+
ortSha: ortLibAsset()?.sha256,
|
|
16046
|
+
modelRev: MODEL_REVISION
|
|
16047
|
+
},
|
|
15874
16048
|
lastIndexedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
15875
16049
|
lastIndexedHead: meta?.lastIndexedHead,
|
|
15876
16050
|
lastIndexedDirty: meta?.lastIndexedDirty,
|
|
@@ -15881,7 +16055,14 @@ async function repairCorruptIndex(workspace, meta) {
|
|
|
15881
16055
|
notice: "semantic index was found corrupt but a writer is still active; returned results are disabled until it exits"
|
|
15882
16056
|
};
|
|
15883
16057
|
const projectDir = await colbertProjectDir(workspace);
|
|
15884
|
-
if (!projectDir)
|
|
16058
|
+
if (!projectDir) {
|
|
16059
|
+
kickBackgroundInit(workspace);
|
|
16060
|
+
return {
|
|
16061
|
+
status: "unavailable",
|
|
16062
|
+
isError: true,
|
|
16063
|
+
notice: "no semantic index for this workspace yet — a background index was started; retry shortly or use code_search"
|
|
16064
|
+
};
|
|
16065
|
+
}
|
|
15885
16066
|
if (!await quarantineProjectDir(projectDir)) {
|
|
15886
16067
|
await writeColbertMeta(failedMeta).catch(() => {});
|
|
15887
16068
|
return {
|
|
@@ -15898,10 +16079,69 @@ async function repairCorruptIndex(workspace, meta) {
|
|
|
15898
16079
|
notice: attempts < 2 ? "semantic index was found corrupt and quarantined; a clean rebuild was started — retry mode:\"semantic\" shortly" : "semantic index repeatedly failed integrity checks; automatic rebuild is capped — do NOT retry mode:\"semantic\", use lexical search with specific symbol/keyword terms and see proxy logs"
|
|
15899
16080
|
};
|
|
15900
16081
|
}
|
|
16082
|
+
/**
|
|
16083
|
+
* True when the inputs that produced the recorded failure streak differ from
|
|
16084
|
+
* the inputs in effect now — i.e. the streak is stale evidence and must not
|
|
16085
|
+
* veto a fresh attempt.
|
|
16086
|
+
*
|
|
16087
|
+
* Each signal answers "could this plausibly have fixed the cause?":
|
|
16088
|
+
* - engine/runtime sha: a colgrep or ONNX-runtime upgrade may fix the exact
|
|
16089
|
+
* bug that failed. Precedent: `freshnessVerdict` already forces a rebuild
|
|
16090
|
+
* on an engine-sha change for the same reason.
|
|
16091
|
+
* - model revision: a different embedding model is a different build.
|
|
16092
|
+
* - corpus identity: HEAD moved OR the working tree's dirty-state changed.
|
|
16093
|
+
* BOTH are needed — HEAD-only misses the most common local recovery
|
|
16094
|
+
* (fixing a malformed file without committing), and dirty-only misses a
|
|
16095
|
+
* branch switch.
|
|
16096
|
+
*
|
|
16097
|
+
* A legacy entry with no `failedAt` (written before this field existed) has no
|
|
16098
|
+
* baseline to compare, so it does NOT reset — it keeps today's behavior until
|
|
16099
|
+
* its next failure stamps one. That is the conservative direction: a missing
|
|
16100
|
+
* baseline must not read as "everything changed".
|
|
16101
|
+
*/
|
|
16102
|
+
function failureInputsChanged(meta, git) {
|
|
16103
|
+
const at = meta?.failedAt;
|
|
16104
|
+
if (!at) return false;
|
|
16105
|
+
const binarySha = colgrepBinAsset()?.sha256;
|
|
16106
|
+
const ortSha = ortLibAsset()?.sha256;
|
|
16107
|
+
if (at.binarySha !== void 0 && binarySha !== void 0 && at.binarySha !== binarySha) return true;
|
|
16108
|
+
if (at.ortSha !== void 0 && ortSha !== void 0 && at.ortSha !== ortSha) return true;
|
|
16109
|
+
if (at.modelRev !== void 0 && at.modelRev !== "07ef20f406c86badca122464808f4cac2f6e4b25") return true;
|
|
16110
|
+
if (at.head !== void 0 && git.head !== void 0 && at.head !== git.head) return true;
|
|
16111
|
+
if (at.dirty !== void 0 && git.dirty !== void 0 && at.dirty !== git.dirty) return true;
|
|
16112
|
+
return false;
|
|
16113
|
+
}
|
|
15901
16114
|
async function handleFailure(workspace, meta, crashedVerdict) {
|
|
15902
16115
|
const cls = crashedVerdict ? "crashed" : meta?.failureClass ?? "error";
|
|
15903
|
-
const attempts = crashedVerdict ? (meta?.failedAttempts ?? 0) + 1 : meta?.failedAttempts ?? 1;
|
|
15904
16116
|
const lastAt = meta?.lastIndexedAt;
|
|
16117
|
+
const lastMs = lastAt ? Date.parse(lastAt) : NaN;
|
|
16118
|
+
const backoffElapsed = !Number.isFinite(lastMs) || Date.now() - lastMs >= FAILED_RETRY_BACKOFF_MS;
|
|
16119
|
+
const at = meta?.failedAt;
|
|
16120
|
+
if (failureInputsChanged(meta, at?.head !== void 0 || at?.dirty !== void 0 ? await gitState(workspace).catch(() => ({})) : {})) {
|
|
16121
|
+
consola.warn(`colbert: index inputs changed since the last failure (class=${cls}); clearing the failure streak${backoffElapsed ? " and retrying" : ""} for ${workspace}`);
|
|
16122
|
+
await writeColbertMeta({
|
|
16123
|
+
workspace,
|
|
16124
|
+
model: meta?.model ?? "LateOn-Code-edge",
|
|
16125
|
+
modelRev: meta?.modelRev ?? "07ef20f406c86badca122464808f4cac2f6e4b25",
|
|
16126
|
+
binarySha: meta?.binarySha,
|
|
16127
|
+
ortSha: meta?.ortSha,
|
|
16128
|
+
status: "failed",
|
|
16129
|
+
failureClass: meta?.failureClass,
|
|
16130
|
+
failedAttempts: 0,
|
|
16131
|
+
failedAt: void 0,
|
|
16132
|
+
lastIndexedAt: meta?.lastIndexedAt,
|
|
16133
|
+
lastIndexedHead: meta?.lastIndexedHead,
|
|
16134
|
+
lastIndexedDirty: meta?.lastIndexedDirty,
|
|
16135
|
+
ownerInstanceId: getColbertInstanceUuid()
|
|
16136
|
+
}).catch(() => {});
|
|
16137
|
+
if (backoffElapsed) kickBackgroundInit(workspace);
|
|
16138
|
+
return {
|
|
16139
|
+
status: "failed",
|
|
16140
|
+
isError: true,
|
|
16141
|
+
notice: backoffElapsed ? "semantic index unavailable; inputs changed since the last failure so a rebuild was started — retry mode:\"semantic\" shortly, or use code_search with specific symbol/keyword terms now" : "semantic index unavailable (recent build failure); a rebuild is pending — retry mode:\"semantic\" shortly, or use code_search with specific symbol/keyword terms now"
|
|
16142
|
+
};
|
|
16143
|
+
}
|
|
16144
|
+
const attempts = crashedVerdict ? (meta?.failedAttempts ?? 0) + 1 : meta?.failedAttempts ?? 1;
|
|
15905
16145
|
if (crashedVerdict) await writeColbertMeta({
|
|
15906
16146
|
workspace,
|
|
15907
16147
|
model: meta?.model ?? "LateOn-Code-edge",
|
|
@@ -15909,14 +16149,19 @@ async function handleFailure(workspace, meta, crashedVerdict) {
|
|
|
15909
16149
|
status: "failed",
|
|
15910
16150
|
failureClass: "crashed",
|
|
15911
16151
|
failedAttempts: attempts,
|
|
16152
|
+
failedAt: {
|
|
16153
|
+
head: meta?.lastIndexedHead,
|
|
16154
|
+
dirty: meta?.lastIndexedDirty,
|
|
16155
|
+
binarySha: meta?.binarySha ?? colgrepBinAsset()?.sha256,
|
|
16156
|
+
ortSha: meta?.ortSha ?? ortLibAsset()?.sha256,
|
|
16157
|
+
modelRev: MODEL_REVISION
|
|
16158
|
+
},
|
|
15912
16159
|
lastIndexedAt: lastAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
15913
16160
|
lastIndexedHead: meta?.lastIndexedHead,
|
|
15914
16161
|
lastIndexedDirty: meta?.lastIndexedDirty,
|
|
15915
16162
|
ownerInstanceId: getColbertInstanceUuid()
|
|
15916
16163
|
}).catch(() => {});
|
|
15917
16164
|
const cap = cls === "stuck" || cls === "corrupt" ? 2 : MAX_FAILED_ATTEMPTS;
|
|
15918
|
-
const lastMs = lastAt ? Date.parse(lastAt) : NaN;
|
|
15919
|
-
const backoffElapsed = !Number.isFinite(lastMs) || Date.now() - lastMs >= FAILED_RETRY_BACKOFF_MS;
|
|
15920
16165
|
if (attempts < cap && backoffElapsed) {
|
|
15921
16166
|
kickBackgroundInit(workspace);
|
|
15922
16167
|
consola.debug(`colbert: re-kicking index (class=${cls}, attempt=${attempts}/${cap})`);
|
|
@@ -15931,11 +16176,11 @@ async function handleFailure(workspace, meta, crashedVerdict) {
|
|
|
15931
16176
|
isError: true,
|
|
15932
16177
|
notice: "semantic index unavailable (recent build failure); retry mode:\"semantic\" shortly, or use code_search with specific symbol/keyword terms now"
|
|
15933
16178
|
};
|
|
15934
|
-
consola.
|
|
16179
|
+
consola.warn(`colbert: index ${cls}, giving up (attempts=${attempts}) for ${workspace}`);
|
|
15935
16180
|
return {
|
|
15936
16181
|
status: "failed",
|
|
15937
16182
|
isError: true,
|
|
15938
|
-
notice: `semantic index
|
|
16183
|
+
notice: `semantic index unavailable (${cls}); use code_search with specific symbol/keyword terms`
|
|
15939
16184
|
};
|
|
15940
16185
|
}
|
|
15941
16186
|
async function spawnSearch(opts) {
|
|
@@ -16137,6 +16382,10 @@ function kickBackgroundInit(workspace) {
|
|
|
16137
16382
|
releaseInit(workspace);
|
|
16138
16383
|
consola.error("colbert: background init failed:", err);
|
|
16139
16384
|
const prior = await readColbertMeta(workspace);
|
|
16385
|
+
const g = await gitState(workspace).catch(() => ({
|
|
16386
|
+
head: void 0,
|
|
16387
|
+
dirty: void 0
|
|
16388
|
+
}));
|
|
16140
16389
|
await writeColbertMeta({
|
|
16141
16390
|
workspace,
|
|
16142
16391
|
model: prior?.model ?? "LateOn-Code-edge",
|
|
@@ -16146,6 +16395,13 @@ function kickBackgroundInit(workspace) {
|
|
|
16146
16395
|
status: "failed",
|
|
16147
16396
|
failureClass: "launch",
|
|
16148
16397
|
failedAttempts: (prior?.failedAttempts ?? 0) + 1,
|
|
16398
|
+
failedAt: {
|
|
16399
|
+
head: g.head,
|
|
16400
|
+
dirty: g.dirty,
|
|
16401
|
+
binarySha: colgrepBinAsset()?.sha256,
|
|
16402
|
+
ortSha: ortLibAsset()?.sha256,
|
|
16403
|
+
modelRev: MODEL_REVISION
|
|
16404
|
+
},
|
|
16149
16405
|
lastIndexedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16150
16406
|
lastIndexedHead: prior?.lastIndexedHead,
|
|
16151
16407
|
lastIndexedDirty: prior?.lastIndexedDirty,
|
|
@@ -16239,7 +16495,8 @@ async function runInit(workspace) {
|
|
|
16239
16495
|
buildPid: void 0,
|
|
16240
16496
|
ownerInstanceId: getColbertInstanceUuid(),
|
|
16241
16497
|
lastIndexedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16242
|
-
failedAttempts: prior?.failedAttempts ?? 0
|
|
16498
|
+
failedAttempts: prior?.failedAttempts ?? 0,
|
|
16499
|
+
failedAt: prior?.failedAt
|
|
16243
16500
|
};
|
|
16244
16501
|
try {
|
|
16245
16502
|
const g = await gitState(workspace);
|
|
@@ -16311,10 +16568,18 @@ async function runInit(workspace) {
|
|
|
16311
16568
|
if (ok) {
|
|
16312
16569
|
finalMeta.failedAttempts = 0;
|
|
16313
16570
|
finalMeta.failureClass = void 0;
|
|
16571
|
+
finalMeta.failedAt = void 0;
|
|
16314
16572
|
} else {
|
|
16315
16573
|
finalMeta.failureClass = failureClass;
|
|
16316
16574
|
finalMeta.failedAttempts = (prior?.failedAttempts ?? 0) + 1;
|
|
16317
|
-
|
|
16575
|
+
finalMeta.failedAt = {
|
|
16576
|
+
head: finalMeta.lastIndexedHead,
|
|
16577
|
+
dirty: finalMeta.lastIndexedDirty,
|
|
16578
|
+
binarySha: finalMeta.binarySha,
|
|
16579
|
+
ortSha: finalMeta.ortSha,
|
|
16580
|
+
modelRev: finalMeta.modelRev
|
|
16581
|
+
};
|
|
16582
|
+
consola.warn(`colbert: init ${failureClass} after ${Math.round(elapsedMs / 1e3)}s (attempt ${finalMeta.failedAttempts}) for ${workspace}`);
|
|
16318
16583
|
}
|
|
16319
16584
|
await writeColbertMeta(finalMeta).catch(() => {});
|
|
16320
16585
|
}
|
|
@@ -16391,6 +16656,36 @@ async function provisionAndIndexColbert(opts = {}) {
|
|
|
16391
16656
|
consola.debug("colbert: cwd git-detect skipped:", err);
|
|
16392
16657
|
}
|
|
16393
16658
|
}
|
|
16659
|
+
/**
|
|
16660
|
+
* One-line operator warning when this workspace's semantic index is sitting in
|
|
16661
|
+
* a terminal `failed` state, or `null` when there is nothing to say.
|
|
16662
|
+
*
|
|
16663
|
+
* This exists because the failure mode that motivated it was SILENCE: semantic
|
|
16664
|
+
* search degraded to lexical on a real repo for an unknown period — possibly
|
|
16665
|
+
* weeks — and nobody noticed, because the only signals were a `notice` string
|
|
16666
|
+
* the model reads and a `consola.debug` the file logger drops. Neither reaches
|
|
16667
|
+
* a human. The launcher writes this to stderr next to the readiness line so a
|
|
16668
|
+
* degraded capability is visible at the moment the user starts a session.
|
|
16669
|
+
*
|
|
16670
|
+
* `logsToFile` says where the failure detail actually went. `claude` and
|
|
16671
|
+
* `codex` call `enableFileLogging()`, which redirects warnings to
|
|
16672
|
+
* ERROR_LOG_PATH; `start` does not, so its warnings stay on the terminal and
|
|
16673
|
+
* pointing at the file would send the operator to a stale or absent one.
|
|
16674
|
+
*
|
|
16675
|
+
* Deliberately advisory and best-effort: lexical search still works, so this
|
|
16676
|
+
* must never block or fail a launch.
|
|
16677
|
+
*/
|
|
16678
|
+
async function colbertDegradedWarning(cwd, opts = {}) {
|
|
16679
|
+
if (!semanticSearchOptedIn()) return null;
|
|
16680
|
+
try {
|
|
16681
|
+
const meta = await readColbertMeta(cwd ?? process$1.cwd());
|
|
16682
|
+
if (!meta || meta.status !== "failed") return null;
|
|
16683
|
+
const cls = meta.failureClass ?? "error";
|
|
16684
|
+
return `Semantic search DEGRADED for this workspace (colbert: ${cls}) — lexical code search still works. ${opts.logsToFile ? `See ${PATHS.ERROR_LOG_PATH}` : "See the proxy log output"}.${cls === "stuck" ? " For a very large repo, raise GH_ROUTER_COLBERT_INIT_STALL_MS / GH_ROUTER_COLBERT_INIT_TIMEOUT_MS." : ""}`;
|
|
16685
|
+
} catch {
|
|
16686
|
+
return null;
|
|
16687
|
+
}
|
|
16688
|
+
}
|
|
16394
16689
|
//#endregion
|
|
16395
16690
|
//#region src/lib/unified-code-search.ts
|
|
16396
16691
|
/**
|
|
@@ -18072,7 +18367,7 @@ function logAudit$1(record) {
|
|
|
18072
18367
|
try {
|
|
18073
18368
|
const fs = await import("node:fs/promises");
|
|
18074
18369
|
const path = await import("node:path");
|
|
18075
|
-
const { PATHS } = await import("./paths-
|
|
18370
|
+
const { PATHS } = await import("./paths-Dz1WyRJG.js");
|
|
18076
18371
|
const dir = path.join(PATHS.APP_DIR, "browser-mcp");
|
|
18077
18372
|
await fs.mkdir(dir, { recursive: true });
|
|
18078
18373
|
const line = JSON.stringify({
|
|
@@ -27124,6 +27419,7 @@ function isAdvisorRequested(rawBetaHeader) {
|
|
|
27124
27419
|
* blocks the client expects.
|
|
27125
27420
|
*/
|
|
27126
27421
|
function injectAdvisorTool(rawBody) {
|
|
27422
|
+
if (rawBody.includes(`"name":"__anthropic_advisor"`) && !rawBody.includes("\"advisor_")) return rawBody;
|
|
27127
27423
|
let parsed;
|
|
27128
27424
|
try {
|
|
27129
27425
|
parsed = JSON.parse(rawBody);
|
|
@@ -29055,23 +29351,30 @@ function fetchUrlTool() {
|
|
|
29055
29351
|
let buf = "";
|
|
29056
29352
|
let bytes = 0;
|
|
29057
29353
|
let truncated = false;
|
|
29058
|
-
|
|
29059
|
-
|
|
29060
|
-
|
|
29061
|
-
|
|
29062
|
-
|
|
29063
|
-
|
|
29064
|
-
|
|
29065
|
-
|
|
29066
|
-
|
|
29067
|
-
|
|
29068
|
-
|
|
29069
|
-
|
|
29070
|
-
|
|
29071
|
-
|
|
29072
|
-
|
|
29073
|
-
|
|
29354
|
+
try {
|
|
29355
|
+
while (true) {
|
|
29356
|
+
const { done, value } = await reader.read();
|
|
29357
|
+
if (done) break;
|
|
29358
|
+
if (!value) continue;
|
|
29359
|
+
const chunk = value;
|
|
29360
|
+
const room = FETCH_URL_MAX_BYTES - bytes;
|
|
29361
|
+
if (chunk.byteLength <= room) {
|
|
29362
|
+
buf += decoder.decode(chunk, { stream: true });
|
|
29363
|
+
bytes += chunk.byteLength;
|
|
29364
|
+
} else {
|
|
29365
|
+
if (room > 0) buf += decoder.decode(chunk.subarray(0, room), { stream: true });
|
|
29366
|
+
truncated = true;
|
|
29367
|
+
try {
|
|
29368
|
+
await reader.cancel("size_cap");
|
|
29369
|
+
} catch {}
|
|
29370
|
+
break;
|
|
29371
|
+
}
|
|
29074
29372
|
}
|
|
29373
|
+
} catch (err) {
|
|
29374
|
+
try {
|
|
29375
|
+
await reader.cancel("read_error");
|
|
29376
|
+
} catch {}
|
|
29377
|
+
throw err;
|
|
29075
29378
|
}
|
|
29076
29379
|
buf += decoder.decode();
|
|
29077
29380
|
if (truncated) buf += `\n[fetch_url: truncated at ${FETCH_URL_MAX_BYTES} bytes]`;
|
|
@@ -33855,6 +34158,6 @@ function enumerateInjectedMcpToolNames(groupKeys, opts = {}) {
|
|
|
33855
34158
|
return [...new Set(names)];
|
|
33856
34159
|
}
|
|
33857
34160
|
//#endregion
|
|
33858
|
-
export { reviewerModel as $, searchWeb as A,
|
|
34161
|
+
export { reviewerModel as $, searchWeb as A, DEFAULT_CODEX_MODEL_FALLBACKS as At, readIteratorWithTimeout as B, buildToolbeltAwareness as C, CONDENSED_OPERATING_SEQUENCE as Ct, TOOLBELT_TOOLS$1 as D, toolbeltPathOverride as Dt, vscodeRipgrepPath as E, collapsePathKeys as Et, isAdvisorRequested as F, pickClaudeDefault as Ft, artifactToolsEnabled as G, handleMcpDelete as H, buildAnthropicErrorEvent as I, withOneMSuffix as It, browserCompoundToolsEnabled as J, brainstormModel as K, buildOpenAIErrorEvent as L, withInstallLock as Lt, ADVISOR_TOOL_INSTRUCTIONS as M, UPSTREAM_FETCH_TIMEOUT_MS as Mt, buildAdvisorStream as N, UPSTREAM_INACTIVITY_TIMEOUT_MS as Nt, assetFor as O, DEFAULT_CLAUDE_MODEL_FALLBACKS as Ot, injectAdvisorTool as P, generateRandomPort as Pt, nativeSubagentModel as Q, isControllerClosedError as R, availableToolCommands as S, warmTreeSitterPool as St, toolbeltSkipSet as T, shouldUseInsecureTls as Tt, handleMcpPost as U, relayAnthropicStream as V, agentToolsEnabled as W, fleetToolsEnabled as X, browserToolsEnabled as Y, geminiAvailable as Z, appendPlanReminder as _, hasSupportedBrowserInstalled as _t, buildPeerAwarenessSnippet as a, countTokens as at, runWorkerAgent as b, extractTarGzMember as bt, personasFor as c, assembleResponsesPayload as ct, EXPLORE_DEFAULT_MODEL as d, createResponses as dt, scoutModel as et, EXPLORE_DEFAULT_THINKING as f, createChatCompletions as ft, TEST_DEFAULT_MODEL as g, provisionBrowserAssets as gt, REVIEW_DEFAULT_MODEL as h, parseJsonOrDiagnose as ht, buildAgentPrompt as i, shimDefaultsToXhigh as it, ADVISOR_INTERNAL_TOOL_NAME as j, DEFAULT_PORT as jt, satisfiesMinVersion as k, DEFAULT_CODEX_MODEL as kt, BROWSE_DEFAULT_MODEL as l, resolveMcpToolTimeoutMs as lt, PLAN_DEFAULT_MODEL as m, readResponseBodyCapped as mt, MCP_GROUPS as n, standInToolEnabled as nt, buildPeerAwarenessSummary as o, createMessages as ot, IMPLEMENT_DEFAULT_MODEL as p, MAX_RESPONSE_BODY_BYTES as pt, browseAgentEnabled as q, assertMcpToolSurfaceConsistent as r, workerToolsEnabled as rt, enumerateInjectedMcpToolNames as s, getTokenCount as st, GROUP_META as t, scribeModel as tt, DEFAULT_MODEL as u, pickEndpoint as ut, resolveModeDefaults as v, colbertDegradedWarning as vt, toolbeltEnabled as w, DEFINITION_OF_GREATNESS as wt, buildEnv as x, extractZipMember as xt, resolveWorkerRunOpts as y, provisionAndIndexColbert as yt, logStreamError as z };
|
|
33859
34162
|
|
|
33860
|
-
//# sourceMappingURL=peer-mcp-personas-
|
|
34163
|
+
//# sourceMappingURL=peer-mcp-personas-B22ncnbQ.js.map
|