github-router 0.3.372 → 0.3.374
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/ado-tools-BOW1k1KW.js +1 -0
- package/dist/{aic-ledger-Cp7Yk9-Q.js → aic-ledger-CeSXqTEE.js} +5 -7
- package/dist/{aic-ledger-Cp7Yk9-Q.js.map → aic-ledger-CeSXqTEE.js.map} +1 -1
- package/dist/{aic-statusline-settings-B5EMMSFC.js → aic-statusline-settings-BKveu679.js} +3 -4
- package/dist/{aic-statusline-settings-B5EMMSFC.js.map → aic-statusline-settings-BKveu679.js.map} +1 -1
- package/dist/{attribution-settings-HI_5bN_-.js → attribution-settings-BLTnz2_A.js} +33 -53
- package/dist/{attribution-settings-HI_5bN_-.js.map → attribution-settings-BLTnz2_A.js.map} +1 -1
- package/dist/{auth-B1egtvt4.js → auth-BZHpTtfF.js} +5 -6
- package/dist/{auth-B1egtvt4.js.map → auth-BZHpTtfF.js.map} +1 -1
- package/dist/{balanced-profile-contract-Dm_usmw7.js → balanced-profile-contract-B6pSoWjm.js} +2 -3
- package/dist/{balanced-profile-contract-Dm_usmw7.js.map → balanced-profile-contract-B6pSoWjm.js.map} +1 -1
- package/dist/{bluebird-client-ByCRusGQ.js → bluebird-client-BasIdv5J.js} +8 -12
- package/dist/{bluebird-client-ByCRusGQ.js.map → bluebird-client-BasIdv5J.js.map} +1 -1
- package/dist/{bluebird-client-CY6NBHQu.js → bluebird-client-BvoMTmEv.js} +1 -1
- package/dist/browser-bridge/index.js +84 -55
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{check-usage-T_z84Pgc.js → check-usage-BlIWDuV2.js} +5 -6
- package/dist/{check-usage-T_z84Pgc.js.map → check-usage-BlIWDuV2.js.map} +1 -1
- package/dist/{claude-BBSsqwln.js → claude-DSXrdz0v.js} +37 -43
- package/dist/{claude-BBSsqwln.js.map → claude-DSXrdz0v.js.map} +1 -1
- package/dist/{claude-md-injection-BMon6WUD.js → claude-md-injection-DU5KYXNc.js} +6 -7
- package/dist/{claude-md-injection-BMon6WUD.js.map → claude-md-injection-DU5KYXNc.js.map} +1 -1
- package/dist/{client-CQMfroGV.js → client-Bjp3XAMK.js} +3 -5
- package/dist/{client-CQMfroGV.js.map → client-Bjp3XAMK.js.map} +1 -1
- package/dist/{codex-PRWoBiOH.js → codex-DGMUk65v.js} +10 -11
- package/dist/{codex-PRWoBiOH.js.map → codex-DGMUk65v.js.map} +1 -1
- package/dist/{copilot-discount-T-cfWmc4.js → copilot-discount-CHNQLYDJ.js} +3 -4
- package/dist/{copilot-discount-T-cfWmc4.js.map → copilot-discount-CHNQLYDJ.js.map} +1 -1
- package/dist/{debug-DL2JsRqY.js → debug-1HUHCWFl.js} +3 -4
- package/dist/{debug-DL2JsRqY.js.map → debug-1HUHCWFl.js.map} +1 -1
- package/dist/engine-BC4TF4pt.js +1 -0
- package/dist/{exec-Bf8g_bIR.js → exec-BC0MAnoA.js} +2 -3
- package/dist/{exec-Bf8g_bIR.js.map → exec-BC0MAnoA.js.map} +1 -1
- package/dist/{fast-profile-contract-JOnZBgFB.js → fast-profile-contract-BLnKg0Ay.js} +2 -3
- package/dist/{fast-profile-contract-JOnZBgFB.js.map → fast-profile-contract-BLnKg0Ay.js.map} +1 -1
- package/dist/{gate-discovery-BNy8GKsC.js → gate-discovery-DiXu_olc.js} +8 -10
- package/dist/{gate-discovery-BNy8GKsC.js.map → gate-discovery-DiXu_olc.js.map} +1 -1
- package/dist/{get-copilot-usage-BSXeQEx8.js → get-copilot-usage-CKg42gSH.js} +5 -6
- package/dist/{get-copilot-usage-BSXeQEx8.js.map → get-copilot-usage-CKg42gSH.js.map} +1 -1
- package/dist/{hook-mcp-client-DERIkeR7.js → hook-mcp-client-CYx10nlU.js} +2 -3
- package/dist/hook-mcp-client-CYx10nlU.js.map +1 -0
- package/dist/hooks.mjs +1766 -1548
- package/dist/hooks.sha256 +1 -1
- package/dist/{index-cmd-CjRcmYk3.js → index-cmd-BPXhTfGQ.js} +8 -9
- package/dist/index-cmd-BPXhTfGQ.js.map +1 -0
- package/dist/{internal-aic-status-CY0QxSa7.js → internal-aic-status-FQB1DQzX.js} +6 -8
- package/dist/{internal-aic-status-CY0QxSa7.js.map → internal-aic-status-FQB1DQzX.js.map} +1 -1
- package/dist/{internal-artifact-open-NAGn9Mgt.js → internal-artifact-open-DbHjipxU.js} +5 -7
- package/dist/{internal-artifact-open-NAGn9Mgt.js.map → internal-artifact-open-DbHjipxU.js.map} +1 -1
- package/dist/{internal-fast-dispatch-guard-De_DJOyZ.js → internal-fast-dispatch-guard-DMzqs-r8.js} +1 -1
- package/dist/{internal-fast-dispatch-guard-_n-A8hgo.js → internal-fast-dispatch-guard-PDdlkPU3.js} +6 -8
- package/dist/{internal-fast-dispatch-guard-_n-A8hgo.js.map → internal-fast-dispatch-guard-PDdlkPU3.js.map} +1 -1
- package/dist/{internal-first-mate-guard-GufCUMl3.js → internal-first-mate-guard-4Yro9xNM.js} +5 -7
- package/dist/{internal-first-mate-guard-GufCUMl3.js.map → internal-first-mate-guard-4Yro9xNM.js.map} +1 -1
- package/dist/{internal-first-mate-guard-C8GwLbaX.js → internal-first-mate-guard-BxPDUsV3.js} +1 -1
- package/dist/{internal-max-dispatch-guard-4rh6KSd8.js → internal-max-dispatch-guard-D3L00YXj.js} +5 -7
- package/dist/{internal-max-dispatch-guard-4rh6KSd8.js.map → internal-max-dispatch-guard-D3L00YXj.js.map} +1 -1
- package/dist/{internal-max-dispatch-guard-CKnzgJje.js → internal-max-dispatch-guard-fhBX_w49.js} +1 -1
- package/dist/{internal-plan-review-ChFx8wTX.js → internal-plan-review-BfHLeszV.js} +6 -7
- package/dist/{internal-plan-review-ChFx8wTX.js.map → internal-plan-review-BfHLeszV.js.map} +1 -1
- package/dist/{internal-prompt-submit-BW5g3MjD.js → internal-prompt-submit-BbnaMF2R.js} +7 -8
- package/dist/{internal-prompt-submit-BW5g3MjD.js.map → internal-prompt-submit-BbnaMF2R.js.map} +1 -1
- package/dist/{internal-prompt-submit-C4uDwr7G.js → internal-prompt-submit-DKzCckz-.js} +2 -2
- package/dist/{internal-rebrief-DvBS8myn.js → internal-rebrief-aEvxp7jw.js} +7 -9
- package/dist/{internal-rebrief-DvBS8myn.js.map → internal-rebrief-aEvxp7jw.js.map} +1 -1
- package/dist/{internal-session-bind-dsUOcKxU.js → internal-session-bind-pN1V11Mn.js} +3 -4
- package/dist/{internal-session-bind-dsUOcKxU.js.map → internal-session-bind-pN1V11Mn.js.map} +1 -1
- package/dist/{internal-stop-hook-CXlOsW63.js → internal-stop-hook-VQuOYpUC.js} +9 -10
- package/dist/{internal-stop-hook-CXlOsW63.js.map → internal-stop-hook-VQuOYpUC.js.map} +1 -1
- package/dist/{internal-stop-review-D_KEV_04.js → internal-stop-review-BWp-4XWW.js} +4 -5
- package/dist/{internal-stop-review-D_KEV_04.js.map → internal-stop-review-BWp-4XWW.js.map} +1 -1
- package/dist/{internal-worker-guard-DB6shBIn.js → internal-worker-guard-C9OZPgzu.js} +3 -4
- package/dist/{internal-worker-guard-DB6shBIn.js.map → internal-worker-guard-C9OZPgzu.js.map} +1 -1
- package/dist/{internal-workspace-header-DBg5Y7oN.js → internal-workspace-header-B4TXFBLU.js} +3 -4
- package/dist/{internal-workspace-header-DBg5Y7oN.js.map → internal-workspace-header-B4TXFBLU.js.map} +1 -1
- package/dist/lib/tree-sitter-pool/{lifecycle-Dx0SnP7Z.js → lifecycle-BPpOigPZ.js} +1 -2
- package/dist/lib/tree-sitter-pool/{lifecycle-C7W8D2lx.js → lifecycle-C3vsqXjS.js} +1 -3
- package/dist/lib/tree-sitter-pool/worker.js +29 -35
- package/dist/lifecycle-BENRuuX6.js +1 -0
- package/dist/{lifecycle-K9oVtGde.mjs → lifecycle-DBKu1T5r.mjs} +0 -1
- package/dist/{lifecycle-Gge2Dadd.js → lifecycle-Dh9y8OF1.js} +3 -4
- package/dist/{lifecycle-Gge2Dadd.js.map → lifecycle-Dh9y8OF1.js.map} +1 -1
- package/dist/lifecycle-Dli9vGI2.js +1 -0
- package/dist/{lifecycle-9nX09dBl.js → lifecycle-vjHAFCaY.js} +4 -6
- package/dist/{lifecycle-9nX09dBl.js.map → lifecycle-vjHAFCaY.js.map} +1 -1
- package/dist/main.js +26 -27
- package/dist/{max-profile-contract-CRj7N211.js → max-profile-contract-DLLTsSs2.js} +5 -8
- package/dist/{max-profile-contract-CRj7N211.js.map → max-profile-contract-DLLTsSs2.js.map} +1 -1
- package/dist/{mcp-workspace-header-Xw9B1W6T.js → mcp-workspace-header-C5-dOWNa.js} +3 -4
- package/dist/{mcp-workspace-header-Xw9B1W6T.js.map → mcp-workspace-header-C5-dOWNa.js.map} +1 -1
- package/dist/{models-Ca-HQTYi.js → models-B6nH1sS6.js} +4 -5
- package/dist/{models-Ca-HQTYi.js.map → models-B6nH1sS6.js.map} +1 -1
- package/dist/{orchestration-D3-2ulhX.js → orchestration-B93jxrWI.js} +4 -5
- package/dist/{orchestration-D3-2ulhX.js.map → orchestration-B93jxrWI.js.map} +1 -1
- package/dist/{package-root-B-osctCk.js → package-root-BXgdIM3q.js} +2 -3
- package/dist/{package-root-B-osctCk.js.map → package-root-BXgdIM3q.js.map} +1 -1
- package/dist/paths-Be9_ujQ3.js +1 -0
- package/dist/{paths-C5477RGC.js → paths-CVEO8jEH.js} +5 -7
- package/dist/{paths-C5477RGC.js.map → paths-CVEO8jEH.js.map} +1 -1
- package/dist/{peer-mcp-personas-Dxxw5X1g.js → peer-mcp-personas-Cv21q_YR.js} +244 -372
- package/dist/peer-mcp-personas-Cv21q_YR.js.map +1 -0
- package/dist/{pi-IYAvKF50.js → pi-DI2QtaiZ.js} +305 -89
- package/dist/pi-DI2QtaiZ.js.map +1 -0
- package/dist/{pi-memory-bridge-DEU1SUDz.js → pi-memory-bridge-Dvj1T3e3.js} +2 -3
- package/dist/{pi-memory-bridge-DEU1SUDz.js.map → pi-memory-bridge-Dvj1T3e3.js.map} +1 -1
- package/dist/{plan-review-hook-C9K-em4D.js → plan-review-hook-MhjK92wq.js} +5 -6
- package/dist/{plan-review-hook-C9K-em4D.js.map → plan-review-hook-MhjK92wq.js.map} +1 -1
- package/dist/{provision-CIn6I4w_.js → provision-CRmtV6ew.js} +10 -14
- package/dist/{provision-CIn6I4w_.js.map → provision-CRmtV6ew.js.map} +1 -1
- package/dist/rolldown-runtime-D3PmRqjj.js +4 -0
- package/dist/{self-invocation-BtcGj-lY.js → self-invocation-DMUnXVGT.js} +5 -7
- package/dist/{self-invocation-BtcGj-lY.js.map → self-invocation-DMUnXVGT.js.map} +1 -1
- package/dist/{serve-CttHP8dJ.js → serve-DRASJ-ZO.js} +24 -30
- package/dist/{serve-CttHP8dJ.js.map → serve-DRASJ-ZO.js.map} +1 -1
- package/dist/{server-setup-D7XHUrhM.js → server-setup-DldGizZR.js} +67 -117
- package/dist/{server-setup-D7XHUrhM.js.map → server-setup-DldGizZR.js.map} +1 -1
- package/dist/{service-backend-B6D_DY1Z.js → service-backend-Ce6b2XEe.js} +146 -146
- package/dist/service-backend-Ce6b2XEe.js.map +1 -0
- package/dist/{start-XU5HwLd9.js → start-C0gngUPK.js} +6 -8
- package/dist/{start-XU5HwLd9.js.map → start-C0gngUPK.js.map} +1 -1
- package/dist/{state-DzsaGHr9.js → state-CCGDJ43X.js} +2 -3
- package/dist/{state-DzsaGHr9.js.map → state-CCGDJ43X.js.map} +1 -1
- package/dist/{static-context-pack-CsOAC87F.js → static-context-pack-DwC69_VA.js} +14 -24
- package/dist/{static-context-pack-CsOAC87F.js.map → static-context-pack-DwC69_VA.js.map} +1 -1
- package/dist/{stop-gate-hook-DnLC09Lg.js → stop-gate-hook-CBVLD8iB.js} +9 -14
- package/dist/{stop-gate-hook-DnLC09Lg.js.map → stop-gate-hook-CBVLD8iB.js.map} +1 -1
- package/dist/{stop-gate-policy-Dx9c98_d.js → stop-gate-policy-BehNiNix.js} +4 -5
- package/dist/{stop-gate-policy-Dx9c98_d.js.map → stop-gate-policy-BehNiNix.js.map} +1 -1
- package/dist/{token-Dqjs5ixP.js → token-CPzYxU4Y.js} +16 -28
- package/dist/{token-Dqjs5ixP.js.map → token-CPzYxU4Y.js.map} +1 -1
- package/dist/{token-CVG0yI_j.js → token-DHEkiO4g.js} +3 -4
- package/dist/{token-CVG0yI_j.js.map → token-DHEkiO4g.js.map} +1 -1
- package/dist/{upstream-retry-i1k1Xai2.js → upstream-retry-VNR-bCuT.js} +2 -3
- package/dist/{upstream-retry-i1k1Xai2.js.map → upstream-retry-VNR-bCuT.js.map} +1 -1
- package/dist/{version-C8x2hQrZ.js → version-CTqwKr26.js} +3 -4
- package/dist/{version-C8x2hQrZ.js.map → version-CTqwKr26.js.map} +1 -1
- package/dist/{worker-dispatch-B1w2qfjX.js → worker-dispatch-C7RtNOXv.js} +3 -4
- package/dist/{worker-dispatch-B1w2qfjX.js.map → worker-dispatch-C7RtNOXv.js.map} +1 -1
- package/dist/{workiq-qnJR5_n2.js → workiq-CQauEAMc.js} +3 -4
- package/dist/{workiq-qnJR5_n2.js.map → workiq-CQauEAMc.js.map} +1 -1
- package/dist/{workiq-tools-CMoDjrO0.js → workiq-tools-7n2xXMrQ.js} +1 -1
- package/package.json +19 -17
- package/dist/ado-tools-CAtopk36.js +0 -1
- package/dist/engine-CDZdAx8N.js +0 -1
- package/dist/hook-mcp-client-DERIkeR7.js.map +0 -1
- package/dist/index-cmd-CjRcmYk3.js.map +0 -1
- package/dist/lifecycle-C_CT13c9.js +0 -1
- package/dist/lifecycle-DibiH857.js +0 -1
- package/dist/paths-CEswtFj5.js +0 -1
- package/dist/peer-mcp-personas-Dxxw5X1g.js.map +0 -1
- package/dist/pi-IYAvKF50.js.map +0 -1
- package/dist/service-backend-B6D_DY1Z.js.map +0 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as __require } from "./rolldown-runtime-D3PmRqjj.js";
|
|
2
|
+
import { t as PATHS } from "./paths-CVEO8jEH.js";
|
|
3
|
+
import { d as runManagedExeCapture, f as spawnTaskkillBestEffort, n as isWindowsScriptShim, s as resolveExecutable } from "./exec-BC0MAnoA.js";
|
|
4
|
+
import { c as untrackChild, n as isPidAlive, s as trackChild, t as getColbertInstanceUuid } from "./lifecycle-vjHAFCaY.js";
|
|
4
5
|
import { createRequire } from "node:module";
|
|
5
6
|
import consola from "consola";
|
|
6
7
|
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
7
|
-
import * as path
|
|
8
|
-
import path, { dirname, join } from "node:path";
|
|
8
|
+
import * as path from "node:path";
|
|
9
|
+
import path$1, { dirname, join } from "node:path";
|
|
9
10
|
import { fileURLToPath } from "node:url";
|
|
10
11
|
import { createHash, randomBytes } from "node:crypto";
|
|
11
12
|
import fs$1, { chmod, mkdir, open, readFile, rename, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
12
|
-
import os, * as os
|
|
13
|
+
import os$1, * as os from "node:os";
|
|
13
14
|
import process$1 from "node:process";
|
|
14
15
|
import { execFileSync, spawn } from "node:child_process";
|
|
15
16
|
import { performance } from "node:perf_hooks";
|
|
@@ -18,10 +19,7 @@ import { Language, Parser } from "web-tree-sitter";
|
|
|
18
19
|
import { Worker } from "node:worker_threads";
|
|
19
20
|
import { gunzipSync, inflateRawSync } from "node:zlib";
|
|
20
21
|
import * as net from "node:net";
|
|
21
|
-
|
|
22
|
-
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/lib/update-lock.ts
|
|
22
|
+
// src/lib/update-lock.ts
|
|
25
23
|
/**
|
|
26
24
|
* Cross-process install lock for the auto-update / self-update paths.
|
|
27
25
|
*
|
|
@@ -34,7 +32,7 @@ var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
|
34
32
|
/** A lock older than this is treated as stale (crashed holder) and stolen. */
|
|
35
33
|
const STALE_LOCK_MS = 6e5;
|
|
36
34
|
function lockPath(name) {
|
|
37
|
-
return path.join(os.homedir(), ".local", "share", "github-router", name);
|
|
35
|
+
return path$1.join(os$1.homedir(), ".local", "share", "github-router", name);
|
|
38
36
|
}
|
|
39
37
|
/**
|
|
40
38
|
* Run `fn` while holding an exclusive lockfile named `name` under the
|
|
@@ -75,8 +73,7 @@ async function tryCreateLock(p) {
|
|
|
75
73
|
return null;
|
|
76
74
|
}
|
|
77
75
|
}
|
|
78
|
-
|
|
79
|
-
//#region src/lib/tree-sitter-assets/files.ts
|
|
76
|
+
// src/lib/tree-sitter-assets/files.ts
|
|
80
77
|
/** WASM assets code search loads from tree-sitter-wasms. */
|
|
81
78
|
const TREE_SITTER_GRAMMAR_FILES = {
|
|
82
79
|
typescript: "tree-sitter-typescript.wasm",
|
|
@@ -91,8 +88,7 @@ const TREE_SITTER_GRAMMAR_FILES = {
|
|
|
91
88
|
csharp: "tree-sitter-c_sharp.wasm"
|
|
92
89
|
};
|
|
93
90
|
const TREE_SITTER_RUNTIME_FILE = "tree-sitter.wasm";
|
|
94
|
-
|
|
95
|
-
//#region src/lib/tree-sitter-assets/provision.ts
|
|
91
|
+
// src/lib/tree-sitter-assets/provision.ts
|
|
96
92
|
const PUBLISH_ATTEMPTS = 3;
|
|
97
93
|
let _provisioned = false;
|
|
98
94
|
let _inFlight;
|
|
@@ -114,12 +110,12 @@ function provisionImpl() {
|
|
|
114
110
|
try {
|
|
115
111
|
const require = createRequire(import.meta.url);
|
|
116
112
|
const grammarPackage = require.resolve("tree-sitter-wasms/package.json");
|
|
117
|
-
const grammarRoot = path.join(path.dirname(grammarPackage), "out");
|
|
113
|
+
const grammarRoot = path$1.join(path$1.dirname(grammarPackage), "out");
|
|
118
114
|
const runtime = require.resolve("web-tree-sitter/tree-sitter.wasm");
|
|
119
115
|
const destination = PATHS.TREE_SITTER_ASSETS_DIR;
|
|
120
116
|
mkdirSync(destination, { recursive: true });
|
|
121
|
-
let complete = publishAsset(runtime, path.join(destination, TREE_SITTER_RUNTIME_FILE));
|
|
122
|
-
for (const filename of Object.values(TREE_SITTER_GRAMMAR_FILES)) complete = publishAsset(path.join(grammarRoot, filename), path.join(destination, filename)) && complete;
|
|
117
|
+
let complete = publishAsset(runtime, path$1.join(destination, TREE_SITTER_RUNTIME_FILE));
|
|
118
|
+
for (const filename of Object.values(TREE_SITTER_GRAMMAR_FILES)) complete = publishAsset(path$1.join(grammarRoot, filename), path$1.join(destination, filename)) && complete;
|
|
123
119
|
return complete;
|
|
124
120
|
} catch (err) {
|
|
125
121
|
consola.debug("[tree-sitter-assets] provisioning skipped:", err);
|
|
@@ -187,7 +183,7 @@ function stableTreeSitterAssetsComplete() {
|
|
|
187
183
|
const dir = PATHS.TREE_SITTER_ASSETS_DIR;
|
|
188
184
|
return [TREE_SITTER_RUNTIME_FILE, ...Object.values(TREE_SITTER_GRAMMAR_FILES)].every((name) => {
|
|
189
185
|
try {
|
|
190
|
-
return statSync(path.join(dir, name)).isFile();
|
|
186
|
+
return statSync(path$1.join(dir, name)).isFile();
|
|
191
187
|
} catch {
|
|
192
188
|
return false;
|
|
193
189
|
}
|
|
@@ -391,7 +387,7 @@ const IDENTIFIER_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
|
391
387
|
* structural pass).
|
|
392
388
|
*/
|
|
393
389
|
function getLanguageKeyForPath(filePath) {
|
|
394
|
-
const ext = path
|
|
390
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
395
391
|
return EXTENSION_TO_LANG[ext] ?? null;
|
|
396
392
|
}
|
|
397
393
|
let _grammarBundle;
|
|
@@ -408,7 +404,7 @@ function resolveGrammarRoot() {
|
|
|
408
404
|
if (stableTreeSitterAssetsComplete()) return PATHS.TREE_SITTER_ASSETS_DIR;
|
|
409
405
|
try {
|
|
410
406
|
const pkgPath = __require.resolve("tree-sitter-wasms/package.json");
|
|
411
|
-
return path
|
|
407
|
+
return path.join(path.dirname(pkgPath), "out");
|
|
412
408
|
} catch {
|
|
413
409
|
return null;
|
|
414
410
|
}
|
|
@@ -420,7 +416,7 @@ function resolveGrammarRoot() {
|
|
|
420
416
|
*/
|
|
421
417
|
function parserInitOptions() {
|
|
422
418
|
if (!stableTreeSitterAssetsComplete()) return void 0;
|
|
423
|
-
return { locateFile: () => path
|
|
419
|
+
return { locateFile: () => path.join(PATHS.TREE_SITTER_ASSETS_DIR, TREE_SITTER_RUNTIME_FILE) };
|
|
424
420
|
}
|
|
425
421
|
/**
|
|
426
422
|
* Pre-load all grammars at module-init time so the first search
|
|
@@ -444,7 +440,7 @@ function getGrammarBundle() {
|
|
|
444
440
|
return out;
|
|
445
441
|
}
|
|
446
442
|
for (const [key, filename] of Object.entries(GRAMMAR_FILES)) {
|
|
447
|
-
const wasmPath = path
|
|
443
|
+
const wasmPath = path.join(root, filename);
|
|
448
444
|
try {
|
|
449
445
|
const lang = await Language.load(wasmPath);
|
|
450
446
|
out.set(key, lang);
|
|
@@ -840,8 +836,7 @@ async function outlineFile(absPath, signal) {
|
|
|
840
836
|
} catch {}
|
|
841
837
|
}
|
|
842
838
|
}
|
|
843
|
-
|
|
844
|
-
//#region src/lib/tree-sitter-pool/pool.ts
|
|
839
|
+
// src/lib/tree-sitter-pool/pool.ts
|
|
845
840
|
/**
|
|
846
841
|
* Warm `worker_threads` pool that parallelizes the synchronous web-tree-sitter
|
|
847
842
|
* parses the `code_search` structural pass would otherwise serialize on the one
|
|
@@ -914,7 +909,7 @@ function computePoolSize() {
|
|
|
914
909
|
}
|
|
915
910
|
let cpus;
|
|
916
911
|
try {
|
|
917
|
-
cpus = os
|
|
912
|
+
cpus = os.cpus().length;
|
|
918
913
|
} catch {
|
|
919
914
|
cpus = 1;
|
|
920
915
|
}
|
|
@@ -1353,8 +1348,7 @@ async function warmTreeSitterPool() {
|
|
|
1353
1348
|
_pool = null;
|
|
1354
1349
|
}
|
|
1355
1350
|
}
|
|
1356
|
-
|
|
1357
|
-
//#region src/lib/search-concurrency.ts
|
|
1351
|
+
// src/lib/search-concurrency.ts
|
|
1358
1352
|
/**
|
|
1359
1353
|
* Search-specific concurrency control for `code_search`.
|
|
1360
1354
|
*
|
|
@@ -1398,7 +1392,7 @@ const WEIGHTS = {
|
|
|
1398
1392
|
};
|
|
1399
1393
|
function cpuCount() {
|
|
1400
1394
|
try {
|
|
1401
|
-
const n = os
|
|
1395
|
+
const n = os.cpus().length;
|
|
1402
1396
|
return Number.isSafeInteger(n) && n > 0 ? n : 4;
|
|
1403
1397
|
} catch {
|
|
1404
1398
|
return 4;
|
|
@@ -1508,8 +1502,7 @@ function recommendedRgThreads() {
|
|
|
1508
1502
|
const cpus = cpuCount();
|
|
1509
1503
|
return Math.max(1, Math.floor(cpus / Math.max(1, Math.ceil(activeWeight))));
|
|
1510
1504
|
}
|
|
1511
|
-
|
|
1512
|
-
//#region src/lib/rerank.ts
|
|
1505
|
+
// src/lib/rerank.ts
|
|
1513
1506
|
/**
|
|
1514
1507
|
* JIT cross-encoder reranking for lexical results (Phase 3).
|
|
1515
1508
|
*
|
|
@@ -1627,8 +1620,7 @@ async function rerankDocuments(query, documents, topN, signal) {
|
|
|
1627
1620
|
if (timer) clearTimeout(timer);
|
|
1628
1621
|
}
|
|
1629
1622
|
}
|
|
1630
|
-
|
|
1631
|
-
//#region src/lib/worker-agent/paths.ts
|
|
1623
|
+
// src/lib/worker-agent/paths.ts
|
|
1632
1624
|
/**
|
|
1633
1625
|
* Workspace confinement + sensitive-file denylist for worker tools.
|
|
1634
1626
|
*
|
|
@@ -1714,7 +1706,7 @@ function splitSegments(p) {
|
|
|
1714
1706
|
* but free correctness).
|
|
1715
1707
|
*/
|
|
1716
1708
|
function isSensitivePath(absPath, workspaceAbs) {
|
|
1717
|
-
const rel = path
|
|
1709
|
+
const rel = path.relative(workspaceAbs, absPath);
|
|
1718
1710
|
if (rel === "") return false;
|
|
1719
1711
|
const segments = splitSegments(rel);
|
|
1720
1712
|
for (const seg of segments) {
|
|
@@ -1766,21 +1758,21 @@ function confineToWorkspaceResult(rawPath, workspaceAbs) {
|
|
|
1766
1758
|
ok: false,
|
|
1767
1759
|
error: "rejected: parent-directory segment"
|
|
1768
1760
|
};
|
|
1769
|
-
const candidate = path
|
|
1761
|
+
const candidate = path.isAbsolute(rawPath) ? path.normalize(rawPath) : path.normalize(path.join(workspaceAbs, rawPath));
|
|
1770
1762
|
let canonical;
|
|
1771
1763
|
try {
|
|
1772
1764
|
canonical = realpathSync.native(candidate);
|
|
1773
1765
|
} catch {
|
|
1774
|
-
const parent = path
|
|
1775
|
-
const base = path
|
|
1766
|
+
const parent = path.dirname(candidate);
|
|
1767
|
+
const base = path.basename(candidate);
|
|
1776
1768
|
try {
|
|
1777
1769
|
const realParent = realpathSync.native(parent);
|
|
1778
|
-
canonical = path
|
|
1770
|
+
canonical = path.join(realParent, base);
|
|
1779
1771
|
} catch {
|
|
1780
1772
|
canonical = candidate;
|
|
1781
1773
|
}
|
|
1782
1774
|
}
|
|
1783
|
-
const wsWithSep = workspaceAbs.endsWith(path
|
|
1775
|
+
const wsWithSep = workspaceAbs.endsWith(path.sep) ? workspaceAbs : workspaceAbs + path.sep;
|
|
1784
1776
|
if (!(canonical === workspaceAbs || canonical.startsWith(wsWithSep))) return {
|
|
1785
1777
|
ok: false,
|
|
1786
1778
|
error: "rejected: outside workspace"
|
|
@@ -1790,8 +1782,7 @@ function confineToWorkspaceResult(rawPath, workspaceAbs) {
|
|
|
1790
1782
|
abs: canonical
|
|
1791
1783
|
};
|
|
1792
1784
|
}
|
|
1793
|
-
|
|
1794
|
-
//#region src/lib/code-search.ts
|
|
1785
|
+
// src/lib/code-search.ts
|
|
1795
1786
|
/**
|
|
1796
1787
|
* `code_search` MCP tool implementation.
|
|
1797
1788
|
*
|
|
@@ -1971,7 +1962,7 @@ function resolveRipgrep() {
|
|
|
1971
1962
|
};
|
|
1972
1963
|
return _rgResolution;
|
|
1973
1964
|
}
|
|
1974
|
-
const toolbeltPath = path
|
|
1965
|
+
const toolbeltPath = path.join(PATHS.TOOLBELT_BIN_DIR, process.platform === "win32" ? "rg.exe" : "rg");
|
|
1975
1966
|
if (existsSync(toolbeltPath)) {
|
|
1976
1967
|
_rgResolution = {
|
|
1977
1968
|
rgPath: toolbeltPath,
|
|
@@ -2049,7 +2040,7 @@ function validateInputs(input) {
|
|
|
2049
2040
|
* COPILOT_HOST_ALLOWLIST pattern in `src/lib/utils.ts`).
|
|
2050
2041
|
*/
|
|
2051
2042
|
function validateWorkspace(workspace) {
|
|
2052
|
-
if (!path
|
|
2043
|
+
if (!path.isAbsolute(workspace)) return {
|
|
2053
2044
|
ok: false,
|
|
2054
2045
|
error: "workspace must be an absolute path"
|
|
2055
2046
|
};
|
|
@@ -2256,7 +2247,7 @@ async function parseRgJsonStream(child, opts) {
|
|
|
2256
2247
|
child.stdout.setEncoding("utf8");
|
|
2257
2248
|
const rl = createInterface({
|
|
2258
2249
|
input: child.stdout,
|
|
2259
|
-
crlfDelay:
|
|
2250
|
+
crlfDelay: 1e400
|
|
2260
2251
|
});
|
|
2261
2252
|
const onAbort = () => {
|
|
2262
2253
|
cancelled = true;
|
|
@@ -2475,7 +2466,7 @@ async function runStructuralPassPooled(opts) {
|
|
|
2475
2466
|
for (const [relFile, entries] of opts.byFile) {
|
|
2476
2467
|
const langKey = getLanguageKeyForPath(relFile);
|
|
2477
2468
|
if (!langKey || !opts.grammars.has(langKey)) continue;
|
|
2478
|
-
const absPath = path
|
|
2469
|
+
const absPath = path.join(opts.workspaceRoot, relFile);
|
|
2479
2470
|
let mtimeMs;
|
|
2480
2471
|
try {
|
|
2481
2472
|
const st = statSync(absPath);
|
|
@@ -2556,7 +2547,7 @@ async function runStructuralPassInProcess(opts) {
|
|
|
2556
2547
|
const langKey = getLanguageKeyForPath(relFile);
|
|
2557
2548
|
if (!langKey) return { kind: "skip" };
|
|
2558
2549
|
if (!grammars.get(langKey)) return { kind: "skip" };
|
|
2559
|
-
const absPath = path
|
|
2550
|
+
const absPath = path.join(opts.workspaceRoot, relFile);
|
|
2560
2551
|
let mtimeMs;
|
|
2561
2552
|
let size;
|
|
2562
2553
|
try {
|
|
@@ -2625,7 +2616,7 @@ async function runStructuralPassInProcess(opts) {
|
|
|
2625
2616
|
if (!langKey) continue;
|
|
2626
2617
|
const lang = grammars.get(langKey);
|
|
2627
2618
|
if (!lang) continue;
|
|
2628
|
-
const absPath = path
|
|
2619
|
+
const absPath = path.join(opts.workspaceRoot, relFile);
|
|
2629
2620
|
let cached;
|
|
2630
2621
|
if (input.kind === "cached") cached = input.cached;
|
|
2631
2622
|
else if (input.kind === "readfail") {
|
|
@@ -2917,7 +2908,7 @@ function resolveAstGrep() {
|
|
|
2917
2908
|
"ast-grep"
|
|
2918
2909
|
] : ["sg", "ast-grep"];
|
|
2919
2910
|
for (const name of toolbeltNames) {
|
|
2920
|
-
const candidate = path
|
|
2911
|
+
const candidate = path.resolve(toolbeltDir, name);
|
|
2921
2912
|
if (existsSync(candidate)) return candidate;
|
|
2922
2913
|
}
|
|
2923
2914
|
const fromPath = resolveExecutable("ast-grep", { env: process.env });
|
|
@@ -3003,7 +2994,7 @@ async function runAstGrep(opts) {
|
|
|
3003
2994
|
if (typeof m.file !== "string") continue;
|
|
3004
2995
|
const rel = relativizeToWorkspace(m.file, opts.workspaceCanonical);
|
|
3005
2996
|
if (rel === null) continue;
|
|
3006
|
-
if (isSensitivePath(path
|
|
2997
|
+
if (isSensitivePath(path.join(opts.workspaceCanonical, rel), opts.workspaceCanonical)) continue;
|
|
3007
2998
|
const startLine = m.range?.start?.line;
|
|
3008
2999
|
const line1 = typeof startLine === "number" ? startLine + 1 : 1;
|
|
3009
3000
|
const snippetSrc = typeof m.text === "string" && m.text.length > 0 ? m.text : typeof m.lines === "string" ? m.lines : "";
|
|
@@ -3032,9 +3023,9 @@ async function runAstGrep(opts) {
|
|
|
3032
3023
|
*/
|
|
3033
3024
|
function relativizeToWorkspace(file, workspaceCanonical) {
|
|
3034
3025
|
try {
|
|
3035
|
-
const abs = path
|
|
3036
|
-
const rel = path
|
|
3037
|
-
if (rel === "" || rel.startsWith("..") || path
|
|
3026
|
+
const abs = path.resolve(workspaceCanonical, file);
|
|
3027
|
+
const rel = path.relative(workspaceCanonical, abs);
|
|
3028
|
+
if (rel === "" || rel.startsWith("..") || path.isAbsolute(rel)) return null;
|
|
3038
3029
|
return rel;
|
|
3039
3030
|
} catch {
|
|
3040
3031
|
return null;
|
|
@@ -3093,7 +3084,7 @@ async function enumerateWorkspaceFiles(opts) {
|
|
|
3093
3084
|
child.stdout.setEncoding("utf8");
|
|
3094
3085
|
const rl = createInterface({
|
|
3095
3086
|
input: child.stdout,
|
|
3096
|
-
crlfDelay:
|
|
3087
|
+
crlfDelay: 1e400
|
|
3097
3088
|
});
|
|
3098
3089
|
let stdoutBytes = 0;
|
|
3099
3090
|
for await (const rawLine of rl) {
|
|
@@ -3108,9 +3099,9 @@ async function enumerateWorkspaceFiles(opts) {
|
|
|
3108
3099
|
}
|
|
3109
3100
|
const rel = normalizeRelFile(rawLine.trim());
|
|
3110
3101
|
if (rel.length === 0) continue;
|
|
3111
|
-
if (path
|
|
3102
|
+
if (path.isAbsolute(rel) || rel.split("/").includes("..")) continue;
|
|
3112
3103
|
if (!getLanguageKeyForPath(rel)) continue;
|
|
3113
|
-
if (isSensitivePath(path
|
|
3104
|
+
if (isSensitivePath(path.join(opts.workspaceCanonical, rel), opts.workspaceCanonical)) continue;
|
|
3114
3105
|
total += 1;
|
|
3115
3106
|
if (files.length < SCAN_MAX_FILES) files.push(rel);
|
|
3116
3107
|
else capped = true;
|
|
@@ -3372,7 +3363,7 @@ async function searchCode(rawInput, externalSignal) {
|
|
|
3372
3363
|
const outlineDeadline = wantScan ? scanDeadline : Date.now() + 2e3;
|
|
3373
3364
|
for (const file of distinct) {
|
|
3374
3365
|
if (ac.signal.aborted || Date.now() > outlineDeadline) break;
|
|
3375
|
-
const abs = path
|
|
3366
|
+
const abs = path.resolve(ws.canonical, file);
|
|
3376
3367
|
let result;
|
|
3377
3368
|
const pooled = structuralOutlines?.get(file);
|
|
3378
3369
|
if (pooled) result = {
|
|
@@ -3423,8 +3414,7 @@ async function searchCode(rawInput, externalSignal) {
|
|
|
3423
3414
|
function round4(x) {
|
|
3424
3415
|
return Math.round(x * 1e4) / 1e4;
|
|
3425
3416
|
}
|
|
3426
|
-
|
|
3427
|
-
//#region src/lib/colbert/manifest.ts
|
|
3417
|
+
// src/lib/colbert/manifest.ts
|
|
3428
3418
|
/** ONNX Runtime version colgrep pins (`onnx_runtime.rs:33`). */
|
|
3429
3419
|
const ORT_VERSION = "1.23.0";
|
|
3430
3420
|
/** ColBERT model HF repo id (`model.rs:5`). */
|
|
@@ -3465,39 +3455,57 @@ const COLGREP_BIN = {
|
|
|
3465
3455
|
};
|
|
3466
3456
|
/**
|
|
3467
3457
|
* ONNX Runtime CPU dylib archive, keyed `<platform>-<arch>`. `member`
|
|
3468
|
-
* is the VERSIONED dylib basename inside the archive
|
|
3469
|
-
*
|
|
3470
|
-
* import libs — we extract ONLY the `.dll`. On POSIX the archive ships
|
|
3471
|
-
* the versioned dylib plus an unversioned soname symlink; the
|
|
3472
|
-
* provisioner re-creates the soname symlink colgrep's `ORT_LIB_NAME`
|
|
3458
|
+
* is the VERSIONED dylib basename inside the archive. The provisioner
|
|
3459
|
+
* re-creates the unversioned soname symlink colgrep's `ORT_LIB_NAME`
|
|
3473
3460
|
* expects (`libonnxruntime.so` → `…so.1.23.0`,
|
|
3474
3461
|
* `libonnxruntime.dylib` → `…1.23.0.dylib`).
|
|
3462
|
+
*
|
|
3463
|
+
* These used to be the official GitHub release tarballs. On 2026-11-17
|
|
3464
|
+
* `github.com/microsoft/onnxruntime` — repo, releases and every tag —
|
|
3465
|
+
* started returning 404, with no redirect, no rename and no GitHub-side
|
|
3466
|
+
* notice, while every OTHER GitHub release we pin stayed up. The CUDA
|
|
3467
|
+
* postinstall of `onnxruntime-node` broke on it in CI the same day
|
|
3468
|
+
* (`tests/dependency-install-safety.test.ts`). A sidecar that cannot be
|
|
3469
|
+
* provisioned is a silent semantic-search outage, so the source moved to
|
|
3470
|
+
* the CPU wheels on PyPI, which are versioned, immutable, and served from
|
|
3471
|
+
* `files.pythonhosted.org` rather than a single vendor page.
|
|
3472
|
+
*
|
|
3473
|
+
* A wheel is a zip, so `extractZipMember` reads it as-is: it matches on
|
|
3474
|
+
* BASENAME, and each wheel ships exactly one `libonnxruntime*`/
|
|
3475
|
+
* `onnxruntime.dll`, so the nested `onnxruntime/capi/` path is harmless.
|
|
3476
|
+
* The `cp312` builds are pinned because the dylib and `.so` differ
|
|
3477
|
+
* byte-wise per Python ABI; which build we take is arbitrary as long as
|
|
3478
|
+
* it is pinned, since the dylib is loaded via `ORT_DYLIB_PATH` by
|
|
3479
|
+
* `colgrep`, not by Python. The NuGet CPU package carries the SAME
|
|
3480
|
+
* `libonnxruntime` bytes (verified byte-for-byte for osx-arm64), so this
|
|
3481
|
+
* is a mirror move, not an upgrade: `ORT_VERSION`, the soname suffix and
|
|
3482
|
+
* colgrep's own pinned runtime are unchanged.
|
|
3475
3483
|
*/
|
|
3476
3484
|
const ORT_LIB = {
|
|
3477
3485
|
"win32-x64": {
|
|
3478
|
-
url: "https://
|
|
3479
|
-
sha256: "
|
|
3486
|
+
url: "https://files.pythonhosted.org/packages/19/90/d5b4ea0bd6805f3f21aac2fe549a5b58ee10d1c99c499d867539620a002b/onnxruntime-1.23.0-cp312-cp312-win_amd64.whl",
|
|
3487
|
+
sha256: "e100f3869da4c12b17a9b942934a96a542406f860eb8beb74a68342ea43aaa55",
|
|
3480
3488
|
archive: "zip",
|
|
3481
3489
|
member: "onnxruntime.dll"
|
|
3482
3490
|
},
|
|
3483
3491
|
"darwin-arm64": {
|
|
3484
|
-
url: "https://
|
|
3485
|
-
sha256: "
|
|
3486
|
-
archive: "
|
|
3492
|
+
url: "https://files.pythonhosted.org/packages/fb/33/ec5395c9539423246e4976d6ec7c4e7a4624ad8bcbe783fea5c629d7980a/onnxruntime-1.23.0-cp312-cp312-macosx_13_0_arm64.whl",
|
|
3493
|
+
sha256: "5921f2e106f5faf2b32095b2ecdfae047e445c3bce063e439dadc75c212e7be7",
|
|
3494
|
+
archive: "zip",
|
|
3487
3495
|
member: "libonnxruntime.1.23.0.dylib",
|
|
3488
3496
|
soname: "libonnxruntime.dylib"
|
|
3489
3497
|
},
|
|
3490
3498
|
"darwin-x64": {
|
|
3491
|
-
url: "https://
|
|
3492
|
-
sha256: "
|
|
3493
|
-
archive: "
|
|
3499
|
+
url: "https://files.pythonhosted.org/packages/f0/3c/d1976a9933e075291a3d67f4e949c667ff36a3e3a4a0cbd883af3c4eae5a/onnxruntime-1.23.0-cp312-cp312-macosx_13_0_x86_64.whl",
|
|
3500
|
+
sha256: "053df2f9c6522b258055bce4b776aa9ea3adb4b28d2530ab07b204a3d4b04bf9",
|
|
3501
|
+
archive: "zip",
|
|
3494
3502
|
member: "libonnxruntime.1.23.0.dylib",
|
|
3495
3503
|
soname: "libonnxruntime.dylib"
|
|
3496
3504
|
},
|
|
3497
3505
|
"linux-x64": {
|
|
3498
|
-
url: "https://
|
|
3499
|
-
sha256: "
|
|
3500
|
-
archive: "
|
|
3506
|
+
url: "https://files.pythonhosted.org/packages/0b/62/84f23952d01e07ce8aa02e657e3a0c8fa40aba0d5e11a0e9904a9063af76/onnxruntime-1.23.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
|
|
3507
|
+
sha256: "05f67edb93678cab5cd77eda89b65bb1b58f3d4c0742058742cfad8b172cfa83",
|
|
3508
|
+
archive: "zip",
|
|
3501
3509
|
member: "libonnxruntime.so.1.23.0",
|
|
3502
3510
|
soname: "libonnxruntime.so"
|
|
3503
3511
|
}
|
|
@@ -3618,8 +3626,7 @@ function nextPlaidServerPromoted(variant, platform = process.platform, arch = pr
|
|
|
3618
3626
|
const asset = nextPlaidServerAsset(variant, platform, arch);
|
|
3619
3627
|
return asset !== void 0 && asset.sha256.length > 0;
|
|
3620
3628
|
}
|
|
3621
|
-
|
|
3622
|
-
//#region src/lib/toolbelt/extract.ts
|
|
3629
|
+
// src/lib/toolbelt/extract.ts
|
|
3623
3630
|
/**
|
|
3624
3631
|
* Minimal, dependency-free archive extraction for the toolbelt.
|
|
3625
3632
|
*
|
|
@@ -3812,8 +3819,7 @@ function readZipLocalEntry(buf, localOffset, method, compSize) {
|
|
|
3812
3819
|
}
|
|
3813
3820
|
return null;
|
|
3814
3821
|
}
|
|
3815
|
-
|
|
3816
|
-
//#region src/lib/colbert/provision.ts
|
|
3822
|
+
// src/lib/colbert/provision.ts
|
|
3817
3823
|
/**
|
|
3818
3824
|
* ColBERT sidecar provisioner: download + SHA-verify + extract the three
|
|
3819
3825
|
* artifacts (`colgrep` binary, ONNX Runtime dylib, ColBERT INT8 model)
|
|
@@ -3844,11 +3850,11 @@ const SMOKE_TIMEOUT_MS = 3e4;
|
|
|
3844
3850
|
const EXE_EXT = process$1.platform === "win32" ? ".exe" : "";
|
|
3845
3851
|
/** Absolute path the provisioned colgrep binary lives at. */
|
|
3846
3852
|
function colgrepBinaryPath() {
|
|
3847
|
-
return path.join(PATHS.COLBERT_BIN_DIR, "colgrep" + EXE_EXT);
|
|
3853
|
+
return path$1.join(PATHS.COLBERT_BIN_DIR, "colgrep" + EXE_EXT);
|
|
3848
3854
|
}
|
|
3849
3855
|
/** Absolute path the provisioned model dir lives at (pinned revision). */
|
|
3850
3856
|
function colbertModelDir() {
|
|
3851
|
-
return path.join(PATHS.COLBERT_MODELS_DIR, "LateOn-Code-edge", modelDirName());
|
|
3857
|
+
return path$1.join(PATHS.COLBERT_MODELS_DIR, "LateOn-Code-edge", modelDirName());
|
|
3852
3858
|
}
|
|
3853
3859
|
/**
|
|
3854
3860
|
* Canonical model argument for every colgrep invocation and project lookup.
|
|
@@ -3856,12 +3862,12 @@ function colbertModelDir() {
|
|
|
3856
3862
|
* index into distinct project keys on Windows.
|
|
3857
3863
|
*/
|
|
3858
3864
|
function canonicalColbertModelDir() {
|
|
3859
|
-
return path.resolve(colbertModelDir());
|
|
3865
|
+
return path$1.resolve(colbertModelDir());
|
|
3860
3866
|
}
|
|
3861
3867
|
/** Absolute path a provisioned next-plaid-api server binary lives at. */
|
|
3862
3868
|
function nextPlaidServerBinaryPath(variant) {
|
|
3863
3869
|
const suffix = variant === "cuda" ? "-cuda" : "";
|
|
3864
|
-
return path.join(PATHS.COLBERT_BIN_DIR, `next-plaid-api${suffix}${EXE_EXT}`);
|
|
3870
|
+
return path$1.join(PATHS.COLBERT_BIN_DIR, `next-plaid-api${suffix}${EXE_EXT}`);
|
|
3865
3871
|
}
|
|
3866
3872
|
/**
|
|
3867
3873
|
* Provision the next-plaid-api server binary for the requested variant.
|
|
@@ -3891,7 +3897,7 @@ async function provisionNextPlaidServer(variant) {
|
|
|
3891
3897
|
/** Absolute path the provisioned ORT dylib lives at. */
|
|
3892
3898
|
function colbertOrtDylibPath() {
|
|
3893
3899
|
const lib = ortLibAsset()?.member ?? "libonnxruntime.so";
|
|
3894
|
-
return path.join(PATHS.COLBERT_ORT_DIR, ORT_VERSION, "cpu", lib);
|
|
3900
|
+
return path$1.join(PATHS.COLBERT_ORT_DIR, ORT_VERSION, "cpu", lib);
|
|
3895
3901
|
}
|
|
3896
3902
|
/**
|
|
3897
3903
|
* Cheap on-disk presence check (no download, no smoke). Used by the
|
|
@@ -3900,7 +3906,7 @@ function colbertOrtDylibPath() {
|
|
|
3900
3906
|
* all exist on disk.
|
|
3901
3907
|
*/
|
|
3902
3908
|
function colbertArtifactsPresent() {
|
|
3903
|
-
return existsSync(colgrepBinaryPath()) && existsSync(path.join(colbertModelDir(), "model_int8.onnx")) && existsSync(colbertOrtDylibPath());
|
|
3909
|
+
return existsSync(colgrepBinaryPath()) && existsSync(path$1.join(colbertModelDir(), "model_int8.onnx")) && existsSync(colbertOrtDylibPath());
|
|
3904
3910
|
}
|
|
3905
3911
|
/**
|
|
3906
3912
|
* Router credentials that must NOT reach a colgrep child. colgrep is a
|
|
@@ -3926,7 +3932,7 @@ function dropColgrepSecrets(env) {
|
|
|
3926
3932
|
}
|
|
3927
3933
|
/** Marker file written next to the model dir once the smoke test passed. */
|
|
3928
3934
|
function smokeMarkerPath() {
|
|
3929
|
-
return path.join(PATHS.COLBERT_DIR, ".smoke-ok");
|
|
3935
|
+
return path$1.join(PATHS.COLBERT_DIR, ".smoke-ok");
|
|
3930
3936
|
}
|
|
3931
3937
|
/**
|
|
3932
3938
|
* The content written into `.smoke-ok` on a successful smoke test:
|
|
@@ -4025,7 +4031,7 @@ async function provisionColbert() {
|
|
|
4025
4031
|
async function provisionBinary(asset, dest) {
|
|
4026
4032
|
const sidecar = `${dest}.sha256`;
|
|
4027
4033
|
if (await installedArtifactIsIntact(sidecar, dest, asset.sha256)) return;
|
|
4028
|
-
await mkdir(path.dirname(dest), { recursive: true });
|
|
4034
|
+
await mkdir(path$1.dirname(dest), { recursive: true });
|
|
4029
4035
|
const archive = await download(asset.url);
|
|
4030
4036
|
verifySha(archive, asset.sha256, "colgrep binary");
|
|
4031
4037
|
const member = await extractMember(asset, archive, "colgrep");
|
|
@@ -4036,7 +4042,7 @@ async function provisionBinary(asset, dest) {
|
|
|
4036
4042
|
async function provisionOrt(asset, dest) {
|
|
4037
4043
|
const sidecar = `${dest}.sha256`;
|
|
4038
4044
|
if (await installedArtifactIsIntact(sidecar, dest, asset.sha256)) return;
|
|
4039
|
-
await mkdir(path.dirname(dest), { recursive: true });
|
|
4045
|
+
await mkdir(path$1.dirname(dest), { recursive: true });
|
|
4040
4046
|
const archive = await download(asset.url);
|
|
4041
4047
|
verifySha(archive, asset.sha256, "ONNX Runtime");
|
|
4042
4048
|
const member = await extractMember(asset, archive, asset.member ?? "");
|
|
@@ -4044,15 +4050,15 @@ async function provisionOrt(asset, dest) {
|
|
|
4044
4050
|
await atomicWrite(dest, member, true);
|
|
4045
4051
|
await writeFile(sidecar, sidecarContent(asset.sha256, member)).catch(() => {});
|
|
4046
4052
|
if (process$1.platform !== "win32" && asset.soname) {
|
|
4047
|
-
const link = path.join(path.dirname(dest), asset.soname);
|
|
4053
|
+
const link = path$1.join(path$1.dirname(dest), asset.soname);
|
|
4048
4054
|
await rm(link, { force: true }).catch(() => {});
|
|
4049
|
-
await symlink(path.basename(dest), link).catch((err) => consola.debug("colbert: ORT soname symlink skipped:", err));
|
|
4055
|
+
await symlink(path$1.basename(dest), link).catch((err) => consola.debug("colbert: ORT soname symlink skipped:", err));
|
|
4050
4056
|
}
|
|
4051
4057
|
}
|
|
4052
4058
|
async function provisionModel(modelDir) {
|
|
4053
4059
|
await mkdir(modelDir, { recursive: true });
|
|
4054
4060
|
for (const file of MODEL_FILES) {
|
|
4055
|
-
const dest = path.join(modelDir, file.name);
|
|
4061
|
+
const dest = path$1.join(modelDir, file.name);
|
|
4056
4062
|
if (existsSync(dest)) try {
|
|
4057
4063
|
const have = await readFile(dest);
|
|
4058
4064
|
if (createHash("sha256").update(have).digest("hex") === file.sha256) continue;
|
|
@@ -4067,7 +4073,7 @@ async function extractMember(asset, archive, wantBasename) {
|
|
|
4067
4073
|
if (asset.archive === "zip") return extractZipMember(archive, wantBasename);
|
|
4068
4074
|
if (asset.archive === "tar.gz") return extractTarGzMember(archive, wantBasename);
|
|
4069
4075
|
if (asset.archive === "tar.xz") {
|
|
4070
|
-
const tmp = path.join(PATHS.COLBERT_DIR, `xz-tmp-${process$1.pid}-${randomBytes(4).toString("hex")}`);
|
|
4076
|
+
const tmp = path$1.join(PATHS.COLBERT_DIR, `xz-tmp-${process$1.pid}-${randomBytes(4).toString("hex")}`);
|
|
4071
4077
|
try {
|
|
4072
4078
|
return await extractTarXzMember(archive, wantBasename, tmp);
|
|
4073
4079
|
} finally {
|
|
@@ -4171,13 +4177,13 @@ function sidecarContent(archiveSha, installed) {
|
|
|
4171
4177
|
* the dylib didn't load and we fail the smoke test even on exit 0.
|
|
4172
4178
|
*/
|
|
4173
4179
|
async function runSmokeTest(binaryPath, ortDylibPath) {
|
|
4174
|
-
const tmp = path.join(PATHS.COLBERT_DIR, `smoke-${process$1.pid}-${randomBytes(4).toString("hex")}`);
|
|
4175
|
-
const fixtureDir = path.join(tmp, "fixture");
|
|
4176
|
-
const dataDir = path.join(tmp, "data");
|
|
4180
|
+
const tmp = path$1.join(PATHS.COLBERT_DIR, `smoke-${process$1.pid}-${randomBytes(4).toString("hex")}`);
|
|
4181
|
+
const fixtureDir = path$1.join(tmp, "fixture");
|
|
4182
|
+
const dataDir = path$1.join(tmp, "data");
|
|
4177
4183
|
try {
|
|
4178
4184
|
await mkdir(fixtureDir, { recursive: true });
|
|
4179
4185
|
await mkdir(dataDir, { recursive: true });
|
|
4180
|
-
await writeFile(path.join(fixtureDir, "smoke.py"), "def smoke_test_function():\n return 1\n");
|
|
4186
|
+
await writeFile(path$1.join(fixtureDir, "smoke.py"), "def smoke_test_function():\n return 1\n");
|
|
4181
4187
|
} catch {
|
|
4182
4188
|
return {
|
|
4183
4189
|
ok: false,
|
|
@@ -4190,7 +4196,7 @@ async function runSmokeTest(binaryPath, ortDylibPath) {
|
|
|
4190
4196
|
COLGREP_DATA_DIR: dataDir,
|
|
4191
4197
|
ORT_DYLIB_PATH: ortDylibPath,
|
|
4192
4198
|
COLGREP_FORCE_CPU: "1",
|
|
4193
|
-
PATH: `${path.dirname(ortDylibPath)}${path.delimiter}${process$1.env.PATH ?? ""}`
|
|
4199
|
+
PATH: `${path$1.dirname(ortDylibPath)}${path$1.delimiter}${process$1.env.PATH ?? ""}`
|
|
4194
4200
|
});
|
|
4195
4201
|
const res = await runManagedExeCapture(binaryPath, [
|
|
4196
4202
|
"search",
|
|
@@ -4236,8 +4242,7 @@ async function runSmokeTest(binaryPath, ortDylibPath) {
|
|
|
4236
4242
|
}).catch(() => {});
|
|
4237
4243
|
}
|
|
4238
4244
|
}
|
|
4239
|
-
|
|
4240
|
-
//#region src/lib/colbert/index-store.ts
|
|
4245
|
+
// src/lib/colbert/index-store.ts
|
|
4241
4246
|
/**
|
|
4242
4247
|
* ColBERT index store: router-owned sidecar metadata, the per-query
|
|
4243
4248
|
* freshness verdict (git HEAD / dirty check), the `COLGREP_DATA_DIR`
|
|
@@ -4283,7 +4288,7 @@ function metaHashForWorkspace(workspace) {
|
|
|
4283
4288
|
return (h >>> 0).toString(16).padStart(8, "0");
|
|
4284
4289
|
}
|
|
4285
4290
|
function metaPath(workspace) {
|
|
4286
|
-
return path.join(PATHS.COLBERT_META_DIR, `${metaHashForWorkspace(workspace)}.json`);
|
|
4291
|
+
return path$1.join(PATHS.COLBERT_META_DIR, `${metaHashForWorkspace(workspace)}.json`);
|
|
4287
4292
|
}
|
|
4288
4293
|
/** Read the sidecar metadata for a workspace (null if none yet). */
|
|
4289
4294
|
/**
|
|
@@ -4426,10 +4431,10 @@ async function colbertProjectDir(workspace) {
|
|
|
4426
4431
|
const wantCanonical = await realpathForCompare(workspace);
|
|
4427
4432
|
for (const name of names) {
|
|
4428
4433
|
if (name === ".gh-router-meta" || name.includes(".corrupt-")) continue;
|
|
4429
|
-
const dir = path.join(indicesDir, name);
|
|
4434
|
+
const dir = path$1.join(indicesDir, name);
|
|
4430
4435
|
let proj;
|
|
4431
4436
|
try {
|
|
4432
|
-
proj = JSON.parse(await fs$1.readFile(path.join(dir, "project.json"), "utf8"));
|
|
4437
|
+
proj = JSON.parse(await fs$1.readFile(path$1.join(dir, "project.json"), "utf8"));
|
|
4433
4438
|
} catch {
|
|
4434
4439
|
continue;
|
|
4435
4440
|
}
|
|
@@ -4473,7 +4478,7 @@ function validateIndexIntegrity(projectIndexDir) {
|
|
|
4473
4478
|
if (names.length === 0) return { verdict: "not-built" };
|
|
4474
4479
|
let sum = 0;
|
|
4475
4480
|
for (const name of names) try {
|
|
4476
|
-
const parsed = JSON.parse(readFileSync(path.join(projectIndexDir, name), "utf8"));
|
|
4481
|
+
const parsed = JSON.parse(readFileSync(path$1.join(projectIndexDir, name), "utf8"));
|
|
4477
4482
|
const start = parsed.embedding_offset;
|
|
4478
4483
|
const count = parsed.num_embeddings;
|
|
4479
4484
|
if (typeof start !== "number" || typeof count !== "number" || !Number.isSafeInteger(start) || !Number.isSafeInteger(count) || start < 0 || count < 0) return {
|
|
@@ -4496,7 +4501,7 @@ function validateIndexIntegrity(projectIndexDir) {
|
|
|
4496
4501
|
async function completedIndexOnDisk(workspace) {
|
|
4497
4502
|
const projectDir = await colbertProjectDir(workspace);
|
|
4498
4503
|
if (!projectDir) return false;
|
|
4499
|
-
return validateIndexIntegrity(path.join(projectDir, "index")).verdict !== "not-built";
|
|
4504
|
+
return validateIndexIntegrity(path$1.join(projectDir, "index")).verdict !== "not-built";
|
|
4500
4505
|
}
|
|
4501
4506
|
/**
|
|
4502
4507
|
* Strip a Windows extended-length prefix.
|
|
@@ -4527,21 +4532,21 @@ function stripExtendedPrefix(p) {
|
|
|
4527
4532
|
*/
|
|
4528
4533
|
const _caseInsensitiveByRoot = /* @__PURE__ */ new Map();
|
|
4529
4534
|
function volumeIsCaseInsensitive(p) {
|
|
4530
|
-
const root = path.parse(path.resolve(p)).root || path.sep;
|
|
4535
|
+
const root = path$1.parse(path$1.resolve(p)).root || path$1.sep;
|
|
4531
4536
|
const cached = _caseInsensitiveByRoot.get(root);
|
|
4532
4537
|
if (cached !== void 0) return cached;
|
|
4533
4538
|
let result = process$1.platform === "win32" || process$1.platform === "darwin";
|
|
4534
4539
|
try {
|
|
4535
|
-
let probe = path.resolve(p);
|
|
4540
|
+
let probe = path$1.resolve(p);
|
|
4536
4541
|
for (let i = 0; i < 64 && !existsSync(probe); i++) {
|
|
4537
|
-
const parent = path.dirname(probe);
|
|
4542
|
+
const parent = path$1.dirname(probe);
|
|
4538
4543
|
if (parent === probe) break;
|
|
4539
4544
|
probe = parent;
|
|
4540
4545
|
}
|
|
4541
|
-
const base = path.basename(probe);
|
|
4546
|
+
const base = path$1.basename(probe);
|
|
4542
4547
|
if (base && /[a-z]/i.test(base)) {
|
|
4543
4548
|
const flipped = base === base.toLowerCase() ? base.toUpperCase() : base.toLowerCase();
|
|
4544
|
-
const sibling = path.join(path.dirname(probe), flipped);
|
|
4549
|
+
const sibling = path$1.join(path$1.dirname(probe), flipped);
|
|
4545
4550
|
result = existsSync(sibling);
|
|
4546
4551
|
}
|
|
4547
4552
|
} catch {}
|
|
@@ -4573,7 +4578,7 @@ function canonicalWorkspace(p) {
|
|
|
4573
4578
|
} catch {
|
|
4574
4579
|
out = resolveThroughExistingAncestor(out);
|
|
4575
4580
|
}
|
|
4576
|
-
out = path.resolve(out);
|
|
4581
|
+
out = path$1.resolve(out);
|
|
4577
4582
|
if (volumeIsCaseInsensitive(out)) out = out.toLowerCase();
|
|
4578
4583
|
return process$1.platform === "win32" ? out.replaceAll("\\", "/") : out;
|
|
4579
4584
|
}
|
|
@@ -4583,16 +4588,16 @@ function canonicalWorkspace(p) {
|
|
|
4583
4588
|
* self.
|
|
4584
4589
|
*/
|
|
4585
4590
|
function resolveThroughExistingAncestor(p) {
|
|
4586
|
-
const abs = path.resolve(p);
|
|
4591
|
+
const abs = path$1.resolve(p);
|
|
4587
4592
|
const tail = [];
|
|
4588
4593
|
let cur = abs;
|
|
4589
4594
|
for (let i = 0; i < 64; i++) try {
|
|
4590
4595
|
const real = stripExtendedPrefix(realpathSync.native(cur));
|
|
4591
|
-
return tail.length > 0 ? path.join(real, ...tail.reverse()) : real;
|
|
4596
|
+
return tail.length > 0 ? path$1.join(real, ...tail.reverse()) : real;
|
|
4592
4597
|
} catch {
|
|
4593
|
-
const parent = path.dirname(cur);
|
|
4598
|
+
const parent = path$1.dirname(cur);
|
|
4594
4599
|
if (parent === cur) break;
|
|
4595
|
-
tail.push(path.basename(cur));
|
|
4600
|
+
tail.push(path$1.basename(cur));
|
|
4596
4601
|
cur = parent;
|
|
4597
4602
|
}
|
|
4598
4603
|
return abs;
|
|
@@ -4617,7 +4622,7 @@ function dirSizeSync(dir) {
|
|
|
4617
4622
|
return [0, 0];
|
|
4618
4623
|
}
|
|
4619
4624
|
for (const e of entries) {
|
|
4620
|
-
const p = path.join(dir, e.name);
|
|
4625
|
+
const p = path$1.join(dir, e.name);
|
|
4621
4626
|
if (e.isDirectory()) {
|
|
4622
4627
|
const [b, c] = dirSizeSync(p);
|
|
4623
4628
|
bytes += b;
|
|
@@ -4641,10 +4646,10 @@ function indexDirSignature(workspace) {
|
|
|
4641
4646
|
for (const name of names) {
|
|
4642
4647
|
if (name === ".gh-router-meta") continue;
|
|
4643
4648
|
if (name.includes(".corrupt-")) continue;
|
|
4644
|
-
const dir = path.join(indicesDir, name);
|
|
4649
|
+
const dir = path$1.join(indicesDir, name);
|
|
4645
4650
|
let proj;
|
|
4646
4651
|
try {
|
|
4647
|
-
proj = JSON.parse(readFileSync(path.join(dir, "project.json"), "utf8"));
|
|
4652
|
+
proj = JSON.parse(readFileSync(path$1.join(dir, "project.json"), "utf8"));
|
|
4648
4653
|
} catch {
|
|
4649
4654
|
continue;
|
|
4650
4655
|
}
|
|
@@ -4730,7 +4735,7 @@ async function freshnessVerdict(workspace) {
|
|
|
4730
4735
|
verdict: "building",
|
|
4731
4736
|
meta
|
|
4732
4737
|
};
|
|
4733
|
-
const integrity = validateIndexIntegrity(path.join(projectDir, "index"));
|
|
4738
|
+
const integrity = validateIndexIntegrity(path$1.join(projectDir, "index"));
|
|
4734
4739
|
if (integrity.verdict === "not-built") return {
|
|
4735
4740
|
verdict: "building",
|
|
4736
4741
|
meta
|
|
@@ -4971,8 +4976,7 @@ function releaseInit(workspace) {
|
|
|
4971
4976
|
function initKey(workspace) {
|
|
4972
4977
|
return `${MODEL_ID}::${canonicalForCompare(workspace)}`;
|
|
4973
4978
|
}
|
|
4974
|
-
|
|
4975
|
-
//#region src/lib/colbert/runner.ts
|
|
4979
|
+
// src/lib/colbert/runner.ts
|
|
4976
4980
|
/**
|
|
4977
4981
|
* ColBERT sidecar runner: spawn `colgrep search` / `colgrep init` with
|
|
4978
4982
|
* the isolating env + flags, parse `--json`, trim to the minimal MCP
|
|
@@ -5067,17 +5071,17 @@ let _runManagedExeCapture = runManagedExeCapture;
|
|
|
5067
5071
|
* by tests (via the alias below).
|
|
5068
5072
|
*/
|
|
5069
5073
|
async function waitForInit(workspace) {
|
|
5070
|
-
await _initPromises.get(path.resolve(workspace));
|
|
5074
|
+
await _initPromises.get(path$1.resolve(workspace));
|
|
5071
5075
|
}
|
|
5072
5076
|
/** Build the isolating env for any colgrep child (search or init). */
|
|
5073
5077
|
function colgrepEnv() {
|
|
5074
|
-
const ortDir = path.dirname(colbertOrtDylibPath());
|
|
5078
|
+
const ortDir = path$1.dirname(colbertOrtDylibPath());
|
|
5075
5079
|
return dropColgrepSecrets({
|
|
5076
5080
|
...process$1.env,
|
|
5077
5081
|
COLGREP_DATA_DIR: PATHS.COLBERT_INDICES_DIR,
|
|
5078
5082
|
ORT_DYLIB_PATH: colbertOrtDylibPath(),
|
|
5079
5083
|
COLGREP_FORCE_CPU: "1",
|
|
5080
|
-
PATH: `${ortDir}${path.delimiter}${process$1.env.PATH ?? ""}`
|
|
5084
|
+
PATH: `${ortDir}${path$1.delimiter}${process$1.env.PATH ?? ""}`
|
|
5081
5085
|
});
|
|
5082
5086
|
}
|
|
5083
5087
|
/**
|
|
@@ -5183,7 +5187,7 @@ async function quarantineProjectDir(projectDir) {
|
|
|
5183
5187
|
return true;
|
|
5184
5188
|
}
|
|
5185
5189
|
async function repairCorruptIndex(workspace, meta) {
|
|
5186
|
-
const wsKey = path.resolve(workspace);
|
|
5190
|
+
const wsKey = path$1.resolve(workspace);
|
|
5187
5191
|
const attempts = (meta?.failureClass === "corrupt" ? meta.failedAttempts ?? 0 : 0) + 1;
|
|
5188
5192
|
const failedMeta = {
|
|
5189
5193
|
workspace,
|
|
@@ -5365,7 +5369,7 @@ async function spawnSearch(opts) {
|
|
|
5365
5369
|
];
|
|
5366
5370
|
if (opts.pattern) args.push("-e", opts.pattern);
|
|
5367
5371
|
args.push(opts.query, opts.workspace);
|
|
5368
|
-
const wsKey = path.resolve(opts.workspace);
|
|
5372
|
+
const wsKey = path$1.resolve(opts.workspace);
|
|
5369
5373
|
if (_searchIndexInFlight.has(wsKey)) return {
|
|
5370
5374
|
status: "building",
|
|
5371
5375
|
notice: "semantic index is busy (another search is running); retry shortly"
|
|
@@ -5506,7 +5510,7 @@ function relativize(file, workspace, workspaceReal) {
|
|
|
5506
5510
|
const normalizedFile = stripExtendedPathPrefix(file);
|
|
5507
5511
|
for (const rawBase of [workspace, workspaceReal]) try {
|
|
5508
5512
|
const base = stripExtendedPathPrefix(rawBase);
|
|
5509
|
-
const flavor = /^[a-z]:[\\/]/i.test(base) || base.startsWith("\\\\") ? path.win32 : path;
|
|
5513
|
+
const flavor = /^[a-z]:[\\/]/i.test(base) || base.startsWith("\\\\") ? path$1.win32 : path$1;
|
|
5510
5514
|
const rel = flavor.relative(base, normalizedFile);
|
|
5511
5515
|
if (rel && !rel.startsWith("..") && !flavor.isAbsolute(rel)) return rel;
|
|
5512
5516
|
} catch {}
|
|
@@ -5535,7 +5539,7 @@ function clampLimit(limit) {
|
|
|
5535
5539
|
function kickBackgroundInit(workspace) {
|
|
5536
5540
|
if (isInitInFlight(workspace)) return;
|
|
5537
5541
|
if (!tryClaimInit(workspace)) return;
|
|
5538
|
-
const key = path.resolve(workspace);
|
|
5542
|
+
const key = path$1.resolve(workspace);
|
|
5539
5543
|
const promise = runInit(workspace).catch(async (err) => {
|
|
5540
5544
|
releaseInit(workspace);
|
|
5541
5545
|
consola.error("colbert: background init failed:", err);
|
|
@@ -5604,7 +5608,7 @@ async function startupKickAllowed(workspace) {
|
|
|
5604
5608
|
function colbertParallelSessions() {
|
|
5605
5609
|
const raw = Number(process$1.env.GH_ROUTER_COLBERT_PARALLEL);
|
|
5606
5610
|
if (Number.isSafeInteger(raw) && raw > 0) return raw;
|
|
5607
|
-
const threads = os.availableParallelism?.() ?? os.cpus?.().length ?? 4;
|
|
5611
|
+
const threads = os$1.availableParallelism?.() ?? os$1.cpus?.().length ?? 4;
|
|
5608
5612
|
return Math.max(2, Math.floor(threads * .25));
|
|
5609
5613
|
}
|
|
5610
5614
|
/**
|
|
@@ -5696,7 +5700,7 @@ async function runInit(workspace) {
|
|
|
5696
5700
|
ok = !res.stalled && !res.timedOut && res.code === 0;
|
|
5697
5701
|
if (ok) {
|
|
5698
5702
|
const projectDir = await colbertProjectDir(workspace);
|
|
5699
|
-
ok = projectDir !== null && validateIndexIntegrity(path.join(projectDir, "index")).verdict === "coherent";
|
|
5703
|
+
ok = projectDir !== null && validateIndexIntegrity(path$1.join(projectDir, "index")).verdict === "coherent";
|
|
5700
5704
|
if (!ok) {
|
|
5701
5705
|
failureClass = "corrupt";
|
|
5702
5706
|
if (projectDir) await quarantineProjectDir(projectDir);
|
|
@@ -5741,8 +5745,7 @@ async function runInit(workspace) {
|
|
|
5741
5745
|
}
|
|
5742
5746
|
await writeColbertMeta(finalMeta).catch(() => {});
|
|
5743
5747
|
}
|
|
5744
|
-
|
|
5745
|
-
//#region src/lib/colbert/service.ts
|
|
5748
|
+
// src/lib/colbert/service.ts
|
|
5746
5749
|
/**
|
|
5747
5750
|
* next-plaid-api service client + managed lifecycle (Phase 2e).
|
|
5748
5751
|
*
|
|
@@ -6124,7 +6127,7 @@ function serverParallelSessions(foreground = false) {
|
|
|
6124
6127
|
if (Number.isSafeInteger(raw) && raw > 0) return raw;
|
|
6125
6128
|
let cpus = 4;
|
|
6126
6129
|
try {
|
|
6127
|
-
cpus = os
|
|
6130
|
+
cpus = os.cpus().length;
|
|
6128
6131
|
} catch {}
|
|
6129
6132
|
if (foreground) return Math.max(1, cpus);
|
|
6130
6133
|
return Math.max(1, Math.floor(cpus * .25));
|
|
@@ -6138,8 +6141,7 @@ function indexNameForWorkspace(canonicalWorkspace) {
|
|
|
6138
6141
|
}
|
|
6139
6142
|
return `ws-${(h >>> 0).toString(16).padStart(8, "0")}`;
|
|
6140
6143
|
}
|
|
6141
|
-
|
|
6142
|
-
//#region src/lib/colbert/units.ts
|
|
6144
|
+
// src/lib/colbert/units.ts
|
|
6143
6145
|
/**
|
|
6144
6146
|
* Semantic code-unit extraction (Phase 2b).
|
|
6145
6147
|
*
|
|
@@ -6326,8 +6328,7 @@ async function extractUnits(absPath, relPath, signal) {
|
|
|
6326
6328
|
} catch {}
|
|
6327
6329
|
}
|
|
6328
6330
|
}
|
|
6329
|
-
|
|
6330
|
-
//#region src/lib/colbert/service-backend.ts
|
|
6331
|
+
// src/lib/colbert/service-backend.ts
|
|
6331
6332
|
/**
|
|
6332
6333
|
* Service-backed semantic search orchestration (Phase 2e query path).
|
|
6333
6334
|
*
|
|
@@ -6461,7 +6462,7 @@ async function ensureServer(opts = {}) {
|
|
|
6461
6462
|
const resolved = await resolveServerBinaryWithVariant(await selectServerVariant());
|
|
6462
6463
|
if (!resolved) return null;
|
|
6463
6464
|
_starting = (async () => {
|
|
6464
|
-
const ortDir = path.dirname(colbertOrtDylibPath());
|
|
6465
|
+
const ortDir = path$1.dirname(colbertOrtDylibPath());
|
|
6465
6466
|
const svc = await startManagedServer({
|
|
6466
6467
|
binaryPath: resolved.binary,
|
|
6467
6468
|
modelDir: canonicalColbertModelDir(),
|
|
@@ -6470,7 +6471,7 @@ async function ensureServer(opts = {}) {
|
|
|
6470
6471
|
cuda: resolved.cuda,
|
|
6471
6472
|
env: {
|
|
6472
6473
|
ORT_DYLIB_PATH: colbertOrtDylibPath(),
|
|
6473
|
-
PATH: `${ortDir}${path.delimiter}${process.env.PATH ?? ""}`
|
|
6474
|
+
PATH: `${ortDir}${path$1.delimiter}${process.env.PATH ?? ""}`
|
|
6474
6475
|
},
|
|
6475
6476
|
startupTimeoutMs: 12e4
|
|
6476
6477
|
});
|
|
@@ -6487,7 +6488,7 @@ async function ensureServer(opts = {}) {
|
|
|
6487
6488
|
}
|
|
6488
6489
|
}
|
|
6489
6490
|
function serviceMetaPath(workspace) {
|
|
6490
|
-
return path.join(PATHS.COLBERT_META_DIR, `svc-${metaHash(workspace)}.json`);
|
|
6491
|
+
return path$1.join(PATHS.COLBERT_META_DIR, `svc-${metaHash(workspace)}.json`);
|
|
6491
6492
|
}
|
|
6492
6493
|
function metaHash(workspace) {
|
|
6493
6494
|
const canonical = canonicalWorkspace(workspace);
|
|
@@ -6600,7 +6601,7 @@ async function hashFile(absPath) {
|
|
|
6600
6601
|
async function hashFilesParallel(relPaths, workspace, signal, onProgress) {
|
|
6601
6602
|
let cpus = 4;
|
|
6602
6603
|
try {
|
|
6603
|
-
cpus = os.cpus().length;
|
|
6604
|
+
cpus = os$1.cpus().length;
|
|
6604
6605
|
} catch {}
|
|
6605
6606
|
const concurrency = Math.max(1, Math.min(16, cpus, relPaths.length));
|
|
6606
6607
|
const out = {};
|
|
@@ -6613,7 +6614,7 @@ async function hashFilesParallel(relPaths, workspace, signal, onProgress) {
|
|
|
6613
6614
|
next += 1;
|
|
6614
6615
|
if (i >= relPaths.length) break;
|
|
6615
6616
|
const rel = relPaths[i];
|
|
6616
|
-
const hash = await hashFile(path.join(workspace, rel));
|
|
6617
|
+
const hash = await hashFile(path$1.join(workspace, rel));
|
|
6617
6618
|
if (hash !== void 0) out[rel] = hash;
|
|
6618
6619
|
scanned += 1;
|
|
6619
6620
|
onProgress?.(scanned, relPaths.length);
|
|
@@ -6624,7 +6625,7 @@ async function hashFilesParallel(relPaths, workspace, signal, onProgress) {
|
|
|
6624
6625
|
}
|
|
6625
6626
|
/** Fire-and-forget per-workspace populate (single-flight). Never throws. */
|
|
6626
6627
|
function kickServiceIndex(workspace) {
|
|
6627
|
-
const key = path.resolve(workspace);
|
|
6628
|
+
const key = path$1.resolve(workspace);
|
|
6628
6629
|
if (_populateInFlight.has(key)) return;
|
|
6629
6630
|
_populateInFlight.add(key);
|
|
6630
6631
|
const p = populateWorkspace(workspace).catch((err) => {
|
|
@@ -6681,7 +6682,7 @@ async function enumerateSourceFiles(rgPath, workspace, signal) {
|
|
|
6681
6682
|
while ((idx = buf.indexOf(0)) >= 0 && files.length < POPULATE_MAX_FILES) {
|
|
6682
6683
|
const rel = buf.subarray(0, idx).toString("utf8");
|
|
6683
6684
|
buf = buf.subarray(idx + 1);
|
|
6684
|
-
if (rel.length > 0 && !path.isAbsolute(rel)) files.push(rel.replace(/\\/g, "/"));
|
|
6685
|
+
if (rel.length > 0 && !path$1.isAbsolute(rel)) files.push(rel.replace(/\\/g, "/"));
|
|
6685
6686
|
}
|
|
6686
6687
|
if (files.length >= POPULATE_MAX_FILES) finish(files);
|
|
6687
6688
|
});
|
|
@@ -6904,7 +6905,7 @@ async function populateWorkspace(workspace, opts = {}) {
|
|
|
6904
6905
|
}
|
|
6905
6906
|
let cpus = 4;
|
|
6906
6907
|
try {
|
|
6907
|
-
cpus = os.cpus().length;
|
|
6908
|
+
cpus = os$1.cpus().length;
|
|
6908
6909
|
} catch {}
|
|
6909
6910
|
const parseConcurrency = opts.foreground === true ? Math.max(4, Math.min(16, cpus)) : POPULATE_PARSE_CONCURRENCY;
|
|
6910
6911
|
let units = [];
|
|
@@ -6934,7 +6935,7 @@ async function populateWorkspace(workspace, opts = {}) {
|
|
|
6934
6935
|
if (i >= changed.length) break;
|
|
6935
6936
|
const rel = changed[i];
|
|
6936
6937
|
try {
|
|
6937
|
-
const r = await extractUnits(path.join(canonical, rel), rel, signal);
|
|
6938
|
+
const r = await extractUnits(path$1.join(canonical, rel), rel, signal);
|
|
6938
6939
|
fileUnitCounts[rel] = r.units.length;
|
|
6939
6940
|
for (const u of r.units) {
|
|
6940
6941
|
units.push({
|
|
@@ -7082,7 +7083,6 @@ function buildSnippet(h) {
|
|
|
7082
7083
|
const sig = typeof meta.signature === "string" ? meta.signature : "";
|
|
7083
7084
|
return sig.length > 0 ? `${sig}\n${h.file}:${h.line}` : `${h.file}:${h.line}`;
|
|
7084
7085
|
}
|
|
7085
|
-
//#endregion
|
|
7086
7086
|
export { validateWorkspace as A, provisionColbert as C, colbertPlatformSupported as D, extractZipMember as E, outlineFile as F, provisionTreeSitterAssets as I, withInstallLock as L, isSensitivePath as M, recommendedRgThreads as N, resolveRipgrep as O, warmTreeSitterPool as P, colbertSmokeOk as S, extractTarGzMember as T, gitState as _, semanticBackend as a, validateIndexIntegrity as b, serviceFreshness as c, runSemanticSearch as d, startupKickAllowed as f, freshnessVerdict as g, completedIndexOnDisk as h, selectServerVariant as i, confineToWorkspaceResult as j, searchCode as k, stopServiceServer as l, colbertProjectDir as m, populateWorkspace as n, serviceBackendEnabled as o, waitForInit as p, runServiceSearch as r, serviceBackendProvisionable as s, ensureServerForeground as t, kickBackgroundInit as u, indexDirSignature as v, provisionNextPlaidServer as w, colbertArtifactsPresent as x, readColbertMeta as y };
|
|
7087
7087
|
|
|
7088
|
-
//# sourceMappingURL=service-backend-
|
|
7088
|
+
//# sourceMappingURL=service-backend-Ce6b2XEe.js.map
|