haansi 0.1.35 → 0.1.41
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/haansi.js +1048 -639
- package/package.json +1 -1
package/dist/haansi.js
CHANGED
|
@@ -95,7 +95,7 @@ var require_package = __commonJS({
|
|
|
95
95
|
"package.json"(exports2, module2) {
|
|
96
96
|
module2.exports = {
|
|
97
97
|
name: "haansi",
|
|
98
|
-
version: "0.1.
|
|
98
|
+
version: "0.1.41",
|
|
99
99
|
description: "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
|
|
100
100
|
bin: {
|
|
101
101
|
haansi: "./dist/haansi.js"
|
|
@@ -149,9 +149,11 @@ async function authLogin() {
|
|
|
149
149
|
body: JSON.stringify({ client_type: "cli" })
|
|
150
150
|
});
|
|
151
151
|
if (!initiateRes.ok) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
throw Object.assign(
|
|
153
|
+
new Error(`Failed to start auth session (${initiateRes.status})`),
|
|
154
|
+
{
|
|
155
|
+
publicMessage: `Could not start sign-in (${initiateRes.status}). Please try again.`
|
|
156
|
+
}
|
|
155
157
|
);
|
|
156
158
|
}
|
|
157
159
|
const { session_id, auth_url: vsCodeAuthUrl } = await initiateRes.json();
|
|
@@ -209,9 +211,11 @@ If the browser didn't open, visit this URL:
|
|
|
209
211
|
body: JSON.stringify({ name: "CLI (haansi auth login)" })
|
|
210
212
|
});
|
|
211
213
|
if (!tokenRes.ok) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
throw Object.assign(
|
|
215
|
+
new Error(`Failed to create CLI token (${tokenRes.status})`),
|
|
216
|
+
{
|
|
217
|
+
publicMessage: `Could not create a CLI token (${tokenRes.status}). Please try again.`
|
|
218
|
+
}
|
|
215
219
|
);
|
|
216
220
|
}
|
|
217
221
|
const { token: hskToken } = await tokenRes.json();
|
|
@@ -272,9 +276,11 @@ async function validateToken(token, apiUrl2) {
|
|
|
272
276
|
}
|
|
273
277
|
);
|
|
274
278
|
if (!response.ok) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
279
|
+
throw Object.assign(
|
|
280
|
+
new Error(`Token validation failed (${response.status})`),
|
|
281
|
+
{
|
|
282
|
+
publicMessage: response.status === 401 || response.status === 403 ? "That token was rejected. Check it and try again." : `Could not validate the token (${response.status}).`
|
|
283
|
+
}
|
|
278
284
|
);
|
|
279
285
|
}
|
|
280
286
|
}
|
|
@@ -396,7 +402,7 @@ var require_package2 = __commonJS({
|
|
|
396
402
|
var require_main = __commonJS({
|
|
397
403
|
"../../node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
398
404
|
var fs = require("fs");
|
|
399
|
-
var
|
|
405
|
+
var path2 = require("path");
|
|
400
406
|
var os = require("os");
|
|
401
407
|
var crypto8 = require("crypto");
|
|
402
408
|
var packageJson = require_package2();
|
|
@@ -512,7 +518,7 @@ var require_main = __commonJS({
|
|
|
512
518
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
513
519
|
}
|
|
514
520
|
} else {
|
|
515
|
-
possibleVaultPath =
|
|
521
|
+
possibleVaultPath = path2.resolve(process.cwd(), ".env.vault");
|
|
516
522
|
}
|
|
517
523
|
if (fs.existsSync(possibleVaultPath)) {
|
|
518
524
|
return possibleVaultPath;
|
|
@@ -520,7 +526,7 @@ var require_main = __commonJS({
|
|
|
520
526
|
return null;
|
|
521
527
|
}
|
|
522
528
|
function _resolveHome(envPath) {
|
|
523
|
-
return envPath[0] === "~" ?
|
|
529
|
+
return envPath[0] === "~" ? path2.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
524
530
|
}
|
|
525
531
|
function _configVault(options) {
|
|
526
532
|
const debug = Boolean(options && options.debug);
|
|
@@ -537,7 +543,7 @@ var require_main = __commonJS({
|
|
|
537
543
|
return { parsed };
|
|
538
544
|
}
|
|
539
545
|
function configDotenv(options) {
|
|
540
|
-
const dotenvPath =
|
|
546
|
+
const dotenvPath = path2.resolve(process.cwd(), ".env");
|
|
541
547
|
let encoding = "utf8";
|
|
542
548
|
const debug = Boolean(options && options.debug);
|
|
543
549
|
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
@@ -561,13 +567,13 @@ var require_main = __commonJS({
|
|
|
561
567
|
}
|
|
562
568
|
let lastError;
|
|
563
569
|
const parsedAll = {};
|
|
564
|
-
for (const
|
|
570
|
+
for (const path3 of optionPaths) {
|
|
565
571
|
try {
|
|
566
|
-
const parsed = DotenvModule.parse(fs.readFileSync(
|
|
572
|
+
const parsed = DotenvModule.parse(fs.readFileSync(path3, { encoding }));
|
|
567
573
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
568
574
|
} catch (e) {
|
|
569
575
|
if (debug) {
|
|
570
|
-
_debug(`Failed to load ${
|
|
576
|
+
_debug(`Failed to load ${path3} ${e.message}`);
|
|
571
577
|
}
|
|
572
578
|
lastError = e;
|
|
573
579
|
}
|
|
@@ -582,7 +588,7 @@ var require_main = __commonJS({
|
|
|
582
588
|
const shortPaths = [];
|
|
583
589
|
for (const filePath of optionPaths) {
|
|
584
590
|
try {
|
|
585
|
-
const relative =
|
|
591
|
+
const relative = path2.relative(process.cwd(), filePath);
|
|
586
592
|
shortPaths.push(relative);
|
|
587
593
|
} catch (e) {
|
|
588
594
|
if (debug) {
|
|
@@ -905,10 +911,10 @@ var init_bootstrap = __esm({
|
|
|
905
911
|
});
|
|
906
912
|
|
|
907
913
|
// ../../packages/@company/cloud/src/storage-uri.ts
|
|
908
|
-
function storageUri(bucket,
|
|
914
|
+
function storageUri(bucket, path2) {
|
|
909
915
|
const provider = cloudRegistry.provider;
|
|
910
916
|
const scheme = provider === "aws" ? "s3" : provider === "gcp" ? "gs" : "file";
|
|
911
|
-
return `${scheme}://${bucket}/${
|
|
917
|
+
return `${scheme}://${bucket}/${path2}`;
|
|
912
918
|
}
|
|
913
919
|
var init_storage_uri = __esm({
|
|
914
920
|
"../../packages/@company/cloud/src/storage-uri.ts"() {
|
|
@@ -1974,6 +1980,13 @@ var init_middleware = __esm({
|
|
|
1974
1980
|
}
|
|
1975
1981
|
});
|
|
1976
1982
|
|
|
1983
|
+
// ../../packages/@company/observability/src/public-error.ts
|
|
1984
|
+
var init_public_error = __esm({
|
|
1985
|
+
"../../packages/@company/observability/src/public-error.ts"() {
|
|
1986
|
+
"use strict";
|
|
1987
|
+
}
|
|
1988
|
+
});
|
|
1989
|
+
|
|
1977
1990
|
// ../../packages/@company/observability/src/health.ts
|
|
1978
1991
|
var init_health = __esm({
|
|
1979
1992
|
"../../packages/@company/observability/src/health.ts"() {
|
|
@@ -2000,6 +2013,7 @@ var init_src2 = __esm({
|
|
|
2000
2013
|
init_metrics();
|
|
2001
2014
|
init_scaling_metrics();
|
|
2002
2015
|
init_middleware();
|
|
2016
|
+
init_public_error();
|
|
2003
2017
|
init_health();
|
|
2004
2018
|
init_degradation();
|
|
2005
2019
|
init_types();
|
|
@@ -2139,12 +2153,213 @@ var init_hmac = __esm({
|
|
|
2139
2153
|
}
|
|
2140
2154
|
});
|
|
2141
2155
|
|
|
2156
|
+
// ../../node_modules/wink-porter2-stemmer/src/wink-porter2-stemmer.js
|
|
2157
|
+
var require_wink_porter2_stemmer = __commonJS({
|
|
2158
|
+
"../../node_modules/wink-porter2-stemmer/src/wink-porter2-stemmer.js"(exports2, module2) {
|
|
2159
|
+
var rgxDouble = /(bb|dd|ff|gg|mm|nn|pp|rr|tt)$/;
|
|
2160
|
+
var rgxSFXsses = /(.+)(sses)$/;
|
|
2161
|
+
var rgxSFXiedORies2 = /(.{2,})(ied|ies)$/;
|
|
2162
|
+
var rgxSFXiedORies1 = /(.{1})(ied|ies)$/;
|
|
2163
|
+
var rgxSFXusORss = /(.+)(us|ss)$/;
|
|
2164
|
+
var rgxSFXs = /(.+)(s)$/;
|
|
2165
|
+
var rgxSFXeedlyOReed = /(.*)(eedly|eed)$/;
|
|
2166
|
+
var rgxSFXedORedlyORinglyORing = /([aeiouy].*)(ed|edly|ingly|ing)$/;
|
|
2167
|
+
var rgxSFXatORblORiz = /(at|bl|iz)$/;
|
|
2168
|
+
var rgxSFXyOR3 = /(.+[^aeiouy])([y3])$/;
|
|
2169
|
+
var rgxSFXstep2 = /(ization|ational|fulness|ousness|iveness|tional|biliti|lessli|entli|ation|alism|aliti|ousli|iviti|fulli|enci|anci|abli|izer|ator|alli|bli|ogi|li)$/;
|
|
2170
|
+
var rgxSFXstep2WithReplacements = [
|
|
2171
|
+
// Length 7.
|
|
2172
|
+
{ rgx: /ational$/, replacement: "ate" },
|
|
2173
|
+
{ rgx: /ization$/, replacement: "ize" },
|
|
2174
|
+
{ rgx: /fulness$/, replacement: "ful" },
|
|
2175
|
+
{ rgx: /ousness$/, replacement: "ous" },
|
|
2176
|
+
{ rgx: /iveness$/, replacement: "ive" },
|
|
2177
|
+
// Length 6.
|
|
2178
|
+
{ rgx: /tional$/, replacement: "tion" },
|
|
2179
|
+
{ rgx: /biliti$/, replacement: "ble" },
|
|
2180
|
+
{ rgx: /lessli$/, replacement: "less" },
|
|
2181
|
+
// Length 5.
|
|
2182
|
+
{ rgx: /iviti$/, replacement: "ive" },
|
|
2183
|
+
{ rgx: /ousli$/, replacement: "ous" },
|
|
2184
|
+
{ rgx: /ation$/, replacement: "ate" },
|
|
2185
|
+
{ rgx: /entli$/, replacement: "ent" },
|
|
2186
|
+
{ rgx: /(.*)(alism|aliti)$/, replacement: "$1al" },
|
|
2187
|
+
{ rgx: /fulli$/, replacement: "ful" },
|
|
2188
|
+
// Length 4.
|
|
2189
|
+
{ rgx: /alli$/, replacement: "al" },
|
|
2190
|
+
{ rgx: /ator$/, replacement: "ate" },
|
|
2191
|
+
{ rgx: /izer$/, replacement: "ize" },
|
|
2192
|
+
{ rgx: /enci$/, replacement: "ence" },
|
|
2193
|
+
{ rgx: /anci$/, replacement: "ance" },
|
|
2194
|
+
{ rgx: /abli$/, replacement: "able" },
|
|
2195
|
+
// Length 3.
|
|
2196
|
+
{ rgx: /bli$/, replacement: "ble" },
|
|
2197
|
+
{ rgx: /(.*)(l)(ogi)$/, replacement: "$1$2og" },
|
|
2198
|
+
// Length 2.
|
|
2199
|
+
{ rgx: /(.*)([cdeghkmnrt])(li)$/, replacement: "$1$2" }
|
|
2200
|
+
];
|
|
2201
|
+
var rgxSFXstep3 = /(ational|tional|alize|icate|iciti|ative|ical|ness|ful)$/;
|
|
2202
|
+
var rgxSFXstep3WithReplacements = [
|
|
2203
|
+
{ rgx: /ational$/, replacement: "ate" },
|
|
2204
|
+
{ rgx: /tional$/, replacement: "tion" },
|
|
2205
|
+
{ rgx: /alize$/, replacement: "al" },
|
|
2206
|
+
{ rgx: /(.*)(icate|iciti|ical)$/, replacement: "$1ic" },
|
|
2207
|
+
{ rgx: /(ness|ful)$/, replacement: "" }
|
|
2208
|
+
];
|
|
2209
|
+
var rgxSFXstep4 = /(ement|ance|ence|able|ible|ment|ant|ent|ism|ate|iti|ous|ive|ize|al|er|ic)$/;
|
|
2210
|
+
var rgxSFXstep4Full = /(ement|ance|ence|able|ible|ment|ant|ent|ism|ate|iti|ous|ive|ize|ion|al|er|ic)$/;
|
|
2211
|
+
var rgxSFXstep4ion = /(.*)(s|t)(ion)$/;
|
|
2212
|
+
var exceptions1 = /* @__PURE__ */ Object.create(null);
|
|
2213
|
+
exceptions1.skis = "ski";
|
|
2214
|
+
exceptions1.skies = "sky";
|
|
2215
|
+
exceptions1.dying = "die";
|
|
2216
|
+
exceptions1.lying = "lie";
|
|
2217
|
+
exceptions1.tying = "tie";
|
|
2218
|
+
exceptions1.idly = "idl";
|
|
2219
|
+
exceptions1.gently = "gentl";
|
|
2220
|
+
exceptions1.ugly = "ugli";
|
|
2221
|
+
exceptions1.early = "earli";
|
|
2222
|
+
exceptions1.only = "onli";
|
|
2223
|
+
exceptions1.singly = "singl";
|
|
2224
|
+
exceptions1.sky = "sky";
|
|
2225
|
+
exceptions1.news = "news";
|
|
2226
|
+
exceptions1.atlas = "atlas";
|
|
2227
|
+
exceptions1.cosmos = "cosmos";
|
|
2228
|
+
exceptions1.bias = "bias";
|
|
2229
|
+
exceptions1.andes = "andes";
|
|
2230
|
+
var rgxException2 = /^(inning|outing|canning|herring|proceed|exceed|succeed|earring)$/;
|
|
2231
|
+
var prelude = function(s) {
|
|
2232
|
+
return s.replace(/^y/, "3").replace(/([aeiou])y/, "$13").replace(/\’s$|\'s$/, "").replace(/s\’$|s\'$/, "").replace(/[\’\']$/, "");
|
|
2233
|
+
};
|
|
2234
|
+
var isShort = function(s) {
|
|
2235
|
+
return /[^aeiouy][aeiouy][^aeiouywx3]$/.test(s) || /^[aeiouy][^aeiouy]{0,1}$/.test(s);
|
|
2236
|
+
};
|
|
2237
|
+
var markRegions = function(s) {
|
|
2238
|
+
var m1, m2;
|
|
2239
|
+
var rgxRegions = /[aeiouy]+([^aeiouy]{1}.+)/;
|
|
2240
|
+
m1 = rgxRegions.exec(s);
|
|
2241
|
+
if (!m1) return { r1: "", r2: "" };
|
|
2242
|
+
m1 = m1[1].slice(1);
|
|
2243
|
+
m1 = /^(gener|commun|arsen)/.test(s) ? s.replace(/^(gener|commun|arsen)(.*)/, "$2") : m1;
|
|
2244
|
+
m2 = rgxRegions.exec(m1);
|
|
2245
|
+
if (!m2) return { r1: m1, r2: "" };
|
|
2246
|
+
m2 = m2[1].slice(1);
|
|
2247
|
+
return { r1: m1, r2: m2 };
|
|
2248
|
+
};
|
|
2249
|
+
var step1a = function(s) {
|
|
2250
|
+
var wordPart;
|
|
2251
|
+
if (rgxSFXsses.test(s)) return s.replace(rgxSFXsses, "$1ss");
|
|
2252
|
+
if (rgxSFXiedORies2.test(s)) return s.replace(rgxSFXiedORies2, "$1i");
|
|
2253
|
+
if (rgxSFXiedORies1.test(s)) return s.replace(rgxSFXiedORies1, "$1ie");
|
|
2254
|
+
if (rgxSFXusORss.test(s)) return s;
|
|
2255
|
+
wordPart = s.replace(rgxSFXs, "$1");
|
|
2256
|
+
if (/[aeiuouy](.+)$/.test(wordPart)) return s.replace(rgxSFXs, "$1");
|
|
2257
|
+
return s;
|
|
2258
|
+
};
|
|
2259
|
+
var step1b = function(s) {
|
|
2260
|
+
var rgn = markRegions(s), sd;
|
|
2261
|
+
if (rgxSFXeedlyOReed.test(s))
|
|
2262
|
+
return rgxSFXeedlyOReed.test(rgn.r1) ? s.replace(rgxSFXeedlyOReed, "$1ee") : s;
|
|
2263
|
+
if (rgxSFXedORedlyORinglyORing.test(s)) {
|
|
2264
|
+
sd = s.replace(rgxSFXedORedlyORinglyORing, "$1");
|
|
2265
|
+
rgn = markRegions(sd);
|
|
2266
|
+
return rgxSFXatORblORiz.test(sd) ? sd + "e" : (
|
|
2267
|
+
// or
|
|
2268
|
+
rgxDouble.test(sd) ? sd.replace(/.$/, "") : (
|
|
2269
|
+
// or
|
|
2270
|
+
isShort(sd) && rgn.r1 === "" ? sd + "e" : (
|
|
2271
|
+
// or
|
|
2272
|
+
sd
|
|
2273
|
+
)
|
|
2274
|
+
)
|
|
2275
|
+
);
|
|
2276
|
+
}
|
|
2277
|
+
return s;
|
|
2278
|
+
};
|
|
2279
|
+
var step1c = function(s) {
|
|
2280
|
+
return s.replace(rgxSFXyOR3, "$1i");
|
|
2281
|
+
};
|
|
2282
|
+
var step2 = function(s) {
|
|
2283
|
+
var i, imax, rgn = markRegions(s), us;
|
|
2284
|
+
var match = s.match(rgxSFXstep2);
|
|
2285
|
+
match = match === null ? "$$$$$" : match[1];
|
|
2286
|
+
if (rgn.r1.indexOf(match) !== -1) {
|
|
2287
|
+
for (i = 0, imax = rgxSFXstep2WithReplacements.length; i < imax; i += 1) {
|
|
2288
|
+
us = s.replace(rgxSFXstep2WithReplacements[i].rgx, rgxSFXstep2WithReplacements[i].replacement);
|
|
2289
|
+
if (s !== us) return us;
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
return s;
|
|
2293
|
+
};
|
|
2294
|
+
var step3 = function(s) {
|
|
2295
|
+
var i, imax, rgn = markRegions(s), us;
|
|
2296
|
+
var match = s.match(rgxSFXstep3);
|
|
2297
|
+
match = match === null ? "$$$$$" : match[1];
|
|
2298
|
+
if (rgn.r1.indexOf(match) !== -1) {
|
|
2299
|
+
for (i = 0, imax = rgxSFXstep3WithReplacements.length; i < imax; i += 1) {
|
|
2300
|
+
us = s.replace(rgxSFXstep3WithReplacements[i].rgx, rgxSFXstep3WithReplacements[i].replacement);
|
|
2301
|
+
if (s !== us) return us;
|
|
2302
|
+
}
|
|
2303
|
+
if (/ative/.test(rgn.r2)) return s.replace(/ative$/, "");
|
|
2304
|
+
}
|
|
2305
|
+
return s;
|
|
2306
|
+
};
|
|
2307
|
+
var step4 = function(s) {
|
|
2308
|
+
var rgn = markRegions(s);
|
|
2309
|
+
var match = s.match(rgxSFXstep4Full);
|
|
2310
|
+
match = match === null ? "$$$$$" : match[1];
|
|
2311
|
+
if (rgxSFXstep4Full.test(s) && rgn.r2.indexOf(match) !== -1) {
|
|
2312
|
+
return rgxSFXstep4.test(s) ? s.replace(rgxSFXstep4, "") : rgxSFXstep4ion.test(s) ? s.replace(rgxSFXstep4ion, "$1$2") : s;
|
|
2313
|
+
}
|
|
2314
|
+
return s;
|
|
2315
|
+
};
|
|
2316
|
+
var step5 = function(s) {
|
|
2317
|
+
var preceding, rgn;
|
|
2318
|
+
rgn = markRegions(s);
|
|
2319
|
+
if (/e$/i.test(s)) {
|
|
2320
|
+
preceding = s.replace(/e$/, "");
|
|
2321
|
+
return (
|
|
2322
|
+
// Found: delete if in R2, or in R1 and not preceded by a short syllable
|
|
2323
|
+
/e/.test(rgn.r2) || /e/.test(rgn.r1) && !isShort(preceding) ? preceding : s
|
|
2324
|
+
);
|
|
2325
|
+
}
|
|
2326
|
+
if (/l$/.test(s)) {
|
|
2327
|
+
rgn = markRegions(s);
|
|
2328
|
+
return rgn.r2 && /l$/.test(rgn.r2) ? s.replace(/ll$/, "l") : s;
|
|
2329
|
+
}
|
|
2330
|
+
return s;
|
|
2331
|
+
};
|
|
2332
|
+
var stem2 = function(word) {
|
|
2333
|
+
var str = word.toLowerCase();
|
|
2334
|
+
if (str.length < 3) return str;
|
|
2335
|
+
if (exceptions1[str]) return exceptions1[str];
|
|
2336
|
+
str = prelude(str);
|
|
2337
|
+
str = step1a(str);
|
|
2338
|
+
if (!rgxException2.test(str)) {
|
|
2339
|
+
str = step1b(str);
|
|
2340
|
+
str = step1c(str);
|
|
2341
|
+
str = step2(str);
|
|
2342
|
+
str = step3(str);
|
|
2343
|
+
str = step4(str);
|
|
2344
|
+
str = step5(str);
|
|
2345
|
+
}
|
|
2346
|
+
str = str.replace(/3/g, "y");
|
|
2347
|
+
return str;
|
|
2348
|
+
};
|
|
2349
|
+
module2.exports = stem2;
|
|
2350
|
+
}
|
|
2351
|
+
});
|
|
2352
|
+
|
|
2142
2353
|
// ../../packages/@company/encryption/src/search-tokens.ts
|
|
2354
|
+
var import_wink_porter2_stemmer, SEARCH_TOKEN_VERSION, SEARCH_TOKEN_PREFIX;
|
|
2143
2355
|
var init_search_tokens = __esm({
|
|
2144
2356
|
"../../packages/@company/encryption/src/search-tokens.ts"() {
|
|
2145
2357
|
"use strict";
|
|
2146
2358
|
init_hmac();
|
|
2147
2359
|
init_org_keys();
|
|
2360
|
+
import_wink_porter2_stemmer = __toESM(require_wink_porter2_stemmer());
|
|
2361
|
+
SEARCH_TOKEN_VERSION = 2;
|
|
2362
|
+
SEARCH_TOKEN_PREFIX = `h${SEARCH_TOKEN_VERSION}`;
|
|
2148
2363
|
}
|
|
2149
2364
|
});
|
|
2150
2365
|
|
|
@@ -19676,7 +19891,7 @@ var require_split2 = __commonJS({
|
|
|
19676
19891
|
var require_helper = __commonJS({
|
|
19677
19892
|
"../../node_modules/pgpass/lib/helper.js"(exports2, module2) {
|
|
19678
19893
|
"use strict";
|
|
19679
|
-
var
|
|
19894
|
+
var path2 = require("path");
|
|
19680
19895
|
var Stream = require("stream").Stream;
|
|
19681
19896
|
var split = require_split2();
|
|
19682
19897
|
var util2 = require("util");
|
|
@@ -19715,7 +19930,7 @@ var require_helper = __commonJS({
|
|
|
19715
19930
|
};
|
|
19716
19931
|
module2.exports.getFileName = function(rawEnv) {
|
|
19717
19932
|
var env = rawEnv || process.env;
|
|
19718
|
-
var file2 = env.PGPASSFILE || (isWin ?
|
|
19933
|
+
var file2 = env.PGPASSFILE || (isWin ? path2.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path2.join(env.HOME || "./", ".pgpass"));
|
|
19719
19934
|
return file2;
|
|
19720
19935
|
};
|
|
19721
19936
|
module2.exports.usePgPass = function(stats, fname) {
|
|
@@ -19847,7 +20062,7 @@ var require_helper = __commonJS({
|
|
|
19847
20062
|
var require_lib2 = __commonJS({
|
|
19848
20063
|
"../../node_modules/pgpass/lib/index.js"(exports2, module2) {
|
|
19849
20064
|
"use strict";
|
|
19850
|
-
var
|
|
20065
|
+
var path2 = require("path");
|
|
19851
20066
|
var fs = require("fs");
|
|
19852
20067
|
var helper = require_helper();
|
|
19853
20068
|
module2.exports = function(connInfo, cb) {
|
|
@@ -21325,6 +21540,19 @@ var init_client = __esm({
|
|
|
21325
21540
|
}
|
|
21326
21541
|
});
|
|
21327
21542
|
|
|
21543
|
+
// ../../packages/@company/db/src/byod/routed-pool.ts
|
|
21544
|
+
var logger, ROUTED_TENANT_CONTEXT, ROUTED_TENANT_RAW_POOL, ADMITTED_TENANT_CONTEXT;
|
|
21545
|
+
var init_routed_pool = __esm({
|
|
21546
|
+
"../../packages/@company/db/src/byod/routed-pool.ts"() {
|
|
21547
|
+
"use strict";
|
|
21548
|
+
init_src2();
|
|
21549
|
+
logger = createLogger("db-byod-routed-pool");
|
|
21550
|
+
ROUTED_TENANT_CONTEXT = Symbol.for("haansi.db.routedTenantContext");
|
|
21551
|
+
ROUTED_TENANT_RAW_POOL = Symbol.for("haansi.db.routedTenantRawPool");
|
|
21552
|
+
ADMITTED_TENANT_CONTEXT = Symbol.for("haansi.db.admittedTenantContext");
|
|
21553
|
+
}
|
|
21554
|
+
});
|
|
21555
|
+
|
|
21328
21556
|
// ../../packages/@company/db/src/org-context.ts
|
|
21329
21557
|
var observability3, DECRYPTING_CLIENT;
|
|
21330
21558
|
var init_org_context = __esm({
|
|
@@ -21332,16 +21560,299 @@ var init_org_context = __esm({
|
|
|
21332
21560
|
"use strict";
|
|
21333
21561
|
init_src4();
|
|
21334
21562
|
init_src2();
|
|
21563
|
+
init_routed_pool();
|
|
21335
21564
|
observability3 = createObservabilityService("db-org-context");
|
|
21336
21565
|
DECRYPTING_CLIENT = Symbol.for("haansi.db.decryptingClient");
|
|
21337
21566
|
}
|
|
21338
21567
|
});
|
|
21339
21568
|
|
|
21569
|
+
// ../../packages/@company/types/src/timeline.ts
|
|
21570
|
+
var init_timeline = __esm({
|
|
21571
|
+
"../../packages/@company/types/src/timeline.ts"() {
|
|
21572
|
+
"use strict";
|
|
21573
|
+
}
|
|
21574
|
+
});
|
|
21575
|
+
|
|
21576
|
+
// ../../packages/@company/types/src/artifact.ts
|
|
21577
|
+
var init_artifact = __esm({
|
|
21578
|
+
"../../packages/@company/types/src/artifact.ts"() {
|
|
21579
|
+
"use strict";
|
|
21580
|
+
}
|
|
21581
|
+
});
|
|
21582
|
+
|
|
21583
|
+
// ../../packages/@company/types/src/taxonomy.ts
|
|
21584
|
+
function normalizeSessionType(raw) {
|
|
21585
|
+
if (!raw) return "general";
|
|
21586
|
+
const lower = raw.toLowerCase().trim();
|
|
21587
|
+
if (lower in SESSION_TYPES) return lower;
|
|
21588
|
+
if (lower in SESSION_TYPE_ALIASES) return SESSION_TYPE_ALIASES[lower];
|
|
21589
|
+
return "general";
|
|
21590
|
+
}
|
|
21591
|
+
function normalizeComplexity(raw) {
|
|
21592
|
+
if (!raw) return "moderate";
|
|
21593
|
+
const lower = raw.toLowerCase().trim();
|
|
21594
|
+
if (lower in COMPLEXITIES) return lower;
|
|
21595
|
+
return "moderate";
|
|
21596
|
+
}
|
|
21597
|
+
function isReservedArtifactType(id) {
|
|
21598
|
+
const meta3 = ARTIFACT_TYPES[id];
|
|
21599
|
+
return meta3?.reserved === true;
|
|
21600
|
+
}
|
|
21601
|
+
var SESSION_TYPES, SESSION_TYPE_ALIASES, COMPLEXITIES, ARTIFACT_TYPES, __seenAliases, ALIAS_REVERSE_MAP, ARTIFACT_TYPE_IDS, AUTO_APPROVED_ARTIFACT_TYPES, GENERIC_WRITABLE_ARTIFACT_TYPE_IDS;
|
|
21602
|
+
var init_taxonomy = __esm({
|
|
21603
|
+
"../../packages/@company/types/src/taxonomy.ts"() {
|
|
21604
|
+
"use strict";
|
|
21605
|
+
SESSION_TYPES = {
|
|
21606
|
+
debugging: {
|
|
21607
|
+
label: "Debugging",
|
|
21608
|
+
description: "Investigating and fixing bugs or errors"
|
|
21609
|
+
},
|
|
21610
|
+
feature_implementation: {
|
|
21611
|
+
label: "Feature Implementation",
|
|
21612
|
+
description: "Building new functionality or features"
|
|
21613
|
+
},
|
|
21614
|
+
code_review: {
|
|
21615
|
+
label: "Code Review",
|
|
21616
|
+
description: "Reviewing code for quality, correctness, or style"
|
|
21617
|
+
},
|
|
21618
|
+
deployment: {
|
|
21619
|
+
label: "Deployment",
|
|
21620
|
+
description: "Deploying, releasing, or provisioning infrastructure"
|
|
21621
|
+
},
|
|
21622
|
+
refactoring: {
|
|
21623
|
+
label: "Refactoring",
|
|
21624
|
+
description: "Restructuring existing code without changing behavior"
|
|
21625
|
+
},
|
|
21626
|
+
configuration: {
|
|
21627
|
+
label: "Configuration",
|
|
21628
|
+
description: "Setting up or modifying project/tool configuration"
|
|
21629
|
+
},
|
|
21630
|
+
question_answer: {
|
|
21631
|
+
label: "Question & Answer",
|
|
21632
|
+
description: "Asking or answering questions about code or systems"
|
|
21633
|
+
},
|
|
21634
|
+
general: {
|
|
21635
|
+
label: "General",
|
|
21636
|
+
description: "General-purpose session not fitting other categories"
|
|
21637
|
+
}
|
|
21638
|
+
};
|
|
21639
|
+
SESSION_TYPE_ALIASES = {
|
|
21640
|
+
bug_fix: "debugging",
|
|
21641
|
+
feature: "feature_implementation",
|
|
21642
|
+
refactor: "refactoring",
|
|
21643
|
+
config: "configuration"
|
|
21644
|
+
};
|
|
21645
|
+
COMPLEXITIES = {
|
|
21646
|
+
simple: {
|
|
21647
|
+
label: "Simple",
|
|
21648
|
+
description: "Straightforward task with few steps"
|
|
21649
|
+
},
|
|
21650
|
+
moderate: {
|
|
21651
|
+
label: "Moderate",
|
|
21652
|
+
description: "Multi-step task requiring some investigation"
|
|
21653
|
+
},
|
|
21654
|
+
complex: {
|
|
21655
|
+
label: "Complex",
|
|
21656
|
+
description: "Involved task with many steps or deep analysis"
|
|
21657
|
+
}
|
|
21658
|
+
};
|
|
21659
|
+
ARTIFACT_TYPES = {
|
|
21660
|
+
report_incident: {
|
|
21661
|
+
category: "report",
|
|
21662
|
+
label: "Incident Report",
|
|
21663
|
+
description: "Production-incident record + post-incident writeup: detection, timeline, root cause, resolution, follow-ups.",
|
|
21664
|
+
icon: "AlertTriangle",
|
|
21665
|
+
aliases: ["incident_summary", "incident", "postmortem", "post-mortem"],
|
|
21666
|
+
autoApproved: false,
|
|
21667
|
+
producedBy: [
|
|
21668
|
+
"POST /api/v1/memory/processes/incidents",
|
|
21669
|
+
"POST /api/v1/memory/reports/incident",
|
|
21670
|
+
"POST /api/v1/memory/processes/incidents/:id/postmortem"
|
|
21671
|
+
]
|
|
21672
|
+
},
|
|
21673
|
+
report_decision: {
|
|
21674
|
+
category: "report",
|
|
21675
|
+
label: "Decision Record",
|
|
21676
|
+
description: "Architectural / product decision record with context, options considered, decision, and rationale.",
|
|
21677
|
+
icon: "Scale",
|
|
21678
|
+
aliases: ["decision_record", "decision-record", "adr"],
|
|
21679
|
+
autoApproved: false,
|
|
21680
|
+
producedBy: ["POST /api/v1/memory"]
|
|
21681
|
+
},
|
|
21682
|
+
report_work: {
|
|
21683
|
+
category: "report",
|
|
21684
|
+
label: "Work Report",
|
|
21685
|
+
description: "Periodic or one-off work-progress report \u2014 status updates, weekly digests, project rollups, team-activity summaries.",
|
|
21686
|
+
icon: "CalendarDays",
|
|
21687
|
+
aliases: ["weekly_digest", "weekly-digest", "status_report"],
|
|
21688
|
+
autoApproved: true,
|
|
21689
|
+
producedBy: ["POST /api/v1/memory", "POST /api/v1/memory/reports/work"]
|
|
21690
|
+
},
|
|
21691
|
+
report_sop: {
|
|
21692
|
+
category: "report",
|
|
21693
|
+
label: "Standard Operating Procedure",
|
|
21694
|
+
description: "Reusable step-by-step procedure or runbook. Placeholder \u2014 surface not yet specialized; written via generic POST /memory until a dedicated producer ships.",
|
|
21695
|
+
icon: "FileText",
|
|
21696
|
+
aliases: ["sop", "runbook"],
|
|
21697
|
+
autoApproved: false,
|
|
21698
|
+
producedBy: ["POST /api/v1/memory"]
|
|
21699
|
+
},
|
|
21700
|
+
report_onboarding: {
|
|
21701
|
+
category: "report",
|
|
21702
|
+
label: "Onboarding Packet",
|
|
21703
|
+
description: "Onboarding guide assembled from team knowledge, scoped to a project or role.",
|
|
21704
|
+
icon: "GraduationCap",
|
|
21705
|
+
aliases: ["onboarding_packet", "onboarding-packet"],
|
|
21706
|
+
autoApproved: false,
|
|
21707
|
+
producedBy: ["POST /api/v1/memory/reports/onboarding"]
|
|
21708
|
+
},
|
|
21709
|
+
report_pr: {
|
|
21710
|
+
category: "report",
|
|
21711
|
+
label: "PR Context",
|
|
21712
|
+
description: "Enriched pull-request description with linked Jira/Slack context, recent decisions, and reviewer hints.",
|
|
21713
|
+
icon: "GitPullRequest",
|
|
21714
|
+
aliases: ["pr_context", "pr-context"],
|
|
21715
|
+
autoApproved: true,
|
|
21716
|
+
producedBy: ["POST /api/v1/memory/reports/pr"]
|
|
21717
|
+
},
|
|
21718
|
+
expert: {
|
|
21719
|
+
category: "expert",
|
|
21720
|
+
label: "Expert Profile",
|
|
21721
|
+
description: "Per-person expertise profile across platforms \u2014 areas of focus, recent contributions, identity links.",
|
|
21722
|
+
icon: "Users",
|
|
21723
|
+
aliases: ["expert_profile", "expert-profile"],
|
|
21724
|
+
autoApproved: false,
|
|
21725
|
+
// No longer produced: expert profiles are versioned in expert_profiles
|
|
21726
|
+
// (Expert Profiles v2). Snapshots saved earlier stay readable.
|
|
21727
|
+
producedBy: []
|
|
21728
|
+
},
|
|
21729
|
+
solution_mined: {
|
|
21730
|
+
category: "solution",
|
|
21731
|
+
label: "Mined Solution",
|
|
21732
|
+
description: "Problem + solution mined automatically from a developer coding session (the distilled-path pipeline).",
|
|
21733
|
+
icon: "Lightbulb",
|
|
21734
|
+
aliases: ["solution", "mined_solution", "distilled_path"],
|
|
21735
|
+
autoApproved: true,
|
|
21736
|
+
producedBy: ["POST /api/v1/memory/solutions/mined"]
|
|
21737
|
+
},
|
|
21738
|
+
solution_qna: {
|
|
21739
|
+
category: "solution",
|
|
21740
|
+
label: "Q&A Solution",
|
|
21741
|
+
description: "Q&A answer marked verified by a user and distilled into reusable knowledge \u2014 promoted out of a conversation thread.",
|
|
21742
|
+
icon: "ThumbsUp",
|
|
21743
|
+
aliases: ["verified_answer", "verified-answer"],
|
|
21744
|
+
autoApproved: true,
|
|
21745
|
+
producedBy: ["POST /api/v1/memory/recall/messages/:id/feedback"]
|
|
21746
|
+
},
|
|
21747
|
+
digest_entry: {
|
|
21748
|
+
category: "digest",
|
|
21749
|
+
label: "Digest Entry",
|
|
21750
|
+
description: "One period of a member's (or the organization's) work journal. Private to its subject and to owners/admins; written only by the digest service.",
|
|
21751
|
+
icon: "Mail",
|
|
21752
|
+
aliases: [],
|
|
21753
|
+
autoApproved: true,
|
|
21754
|
+
producedBy: [],
|
|
21755
|
+
reserved: true
|
|
21756
|
+
}
|
|
21757
|
+
};
|
|
21758
|
+
__seenAliases = /* @__PURE__ */ new Set();
|
|
21759
|
+
for (const [id, meta3] of Object.entries(ARTIFACT_TYPES)) {
|
|
21760
|
+
for (const a of meta3.aliases) {
|
|
21761
|
+
if (__seenAliases.has(a)) {
|
|
21762
|
+
throw new Error(
|
|
21763
|
+
`[taxonomy] alias "${a}" declared on multiple artifact types; last seen on "${id}"`
|
|
21764
|
+
);
|
|
21765
|
+
}
|
|
21766
|
+
__seenAliases.add(a);
|
|
21767
|
+
}
|
|
21768
|
+
}
|
|
21769
|
+
ALIAS_REVERSE_MAP = Object.freeze(
|
|
21770
|
+
Object.fromEntries(
|
|
21771
|
+
Object.entries(ARTIFACT_TYPES).flatMap(
|
|
21772
|
+
([id, meta3]) => meta3.aliases.map((a) => [a, id])
|
|
21773
|
+
)
|
|
21774
|
+
)
|
|
21775
|
+
);
|
|
21776
|
+
ARTIFACT_TYPE_IDS = Object.keys(
|
|
21777
|
+
ARTIFACT_TYPES
|
|
21778
|
+
);
|
|
21779
|
+
AUTO_APPROVED_ARTIFACT_TYPES = ARTIFACT_TYPE_IDS.filter((id) => ARTIFACT_TYPES[id].autoApproved);
|
|
21780
|
+
GENERIC_WRITABLE_ARTIFACT_TYPE_IDS = ARTIFACT_TYPE_IDS.filter((id) => !isReservedArtifactType(id));
|
|
21781
|
+
}
|
|
21782
|
+
});
|
|
21783
|
+
|
|
21784
|
+
// ../../packages/@company/types/src/embedding.ts
|
|
21785
|
+
var EMBEDDING_DEFAULTS, EMBEDDING_COLUMN, SUMMARY_EMBEDDING_COLUMN;
|
|
21786
|
+
var init_embedding = __esm({
|
|
21787
|
+
"../../packages/@company/types/src/embedding.ts"() {
|
|
21788
|
+
"use strict";
|
|
21789
|
+
EMBEDDING_DEFAULTS = {
|
|
21790
|
+
// `as const` gives a literal string type for the provider field, which
|
|
21791
|
+
// is assignable to llm-client's LLMProvider union without forcing
|
|
21792
|
+
// @company/types to import that union (which would re-introduce the
|
|
21793
|
+
// dependency edge we want to keep absent).
|
|
21794
|
+
// CUTOVER (2026-07-17): in-house model is now the active config. Reads +
|
|
21795
|
+
// writes + backfills all target the local-768 columns. The old OpenAI 1536
|
|
21796
|
+
// columns (`embedding` / `summary_embedding`) are retained but dormant —
|
|
21797
|
+
// roll back by flipping this whole object back to
|
|
21798
|
+
// { provider:"openai", model:"text-embedding-3-small", dimensions:1536,
|
|
21799
|
+
// column:"embedding", summaryColumn:"summary_embedding" }
|
|
21800
|
+
// (a later contract migration drops the dormant columns). Readers alias
|
|
21801
|
+
// `<column> AS embedding` so result-row field names stay stable.
|
|
21802
|
+
provider: "local",
|
|
21803
|
+
model: "Alibaba-NLP/gte-base-en-v1.5",
|
|
21804
|
+
dimensions: 768,
|
|
21805
|
+
// The ACTIVE dense-vector column that every reader + writer + backfill targets.
|
|
21806
|
+
column: "embedding_v2",
|
|
21807
|
+
// The active summary-embedding column (process_registry's second vector,
|
|
21808
|
+
// used by the process matcher).
|
|
21809
|
+
summaryColumn: "summary_embedding_v2"
|
|
21810
|
+
};
|
|
21811
|
+
EMBEDDING_COLUMN = EMBEDDING_DEFAULTS.column;
|
|
21812
|
+
SUMMARY_EMBEDDING_COLUMN = EMBEDDING_DEFAULTS.summaryColumn;
|
|
21813
|
+
}
|
|
21814
|
+
});
|
|
21815
|
+
|
|
21816
|
+
// ../../packages/@company/types/src/repo-file-url.ts
|
|
21817
|
+
var init_repo_file_url = __esm({
|
|
21818
|
+
"../../packages/@company/types/src/repo-file-url.ts"() {
|
|
21819
|
+
"use strict";
|
|
21820
|
+
}
|
|
21821
|
+
});
|
|
21822
|
+
|
|
21823
|
+
// ../../packages/@company/types/src/query-dialect.ts
|
|
21824
|
+
var init_query_dialect = __esm({
|
|
21825
|
+
"../../packages/@company/types/src/query-dialect.ts"() {
|
|
21826
|
+
"use strict";
|
|
21827
|
+
}
|
|
21828
|
+
});
|
|
21829
|
+
|
|
21830
|
+
// ../../packages/@company/types/src/report-template.ts
|
|
21831
|
+
var init_report_template = __esm({
|
|
21832
|
+
"../../packages/@company/types/src/report-template.ts"() {
|
|
21833
|
+
"use strict";
|
|
21834
|
+
}
|
|
21835
|
+
});
|
|
21836
|
+
|
|
21837
|
+
// ../../packages/@company/types/src/index.ts
|
|
21838
|
+
var init_src5 = __esm({
|
|
21839
|
+
"../../packages/@company/types/src/index.ts"() {
|
|
21840
|
+
init_timeline();
|
|
21841
|
+
init_artifact();
|
|
21842
|
+
init_taxonomy();
|
|
21843
|
+
init_embedding();
|
|
21844
|
+
init_repo_file_url();
|
|
21845
|
+
init_query_dialect();
|
|
21846
|
+
init_report_template();
|
|
21847
|
+
}
|
|
21848
|
+
});
|
|
21849
|
+
|
|
21340
21850
|
// ../../packages/@company/db/src/search-vector-write.ts
|
|
21341
21851
|
var KNOWLEDGE_ARTIFACT_VECTOR_NULLS, PROCESS_REGISTRY_VECTOR_NULLS;
|
|
21342
21852
|
var init_search_vector_write = __esm({
|
|
21343
21853
|
"../../packages/@company/db/src/search-vector-write.ts"() {
|
|
21344
21854
|
"use strict";
|
|
21855
|
+
init_src5();
|
|
21345
21856
|
init_src4();
|
|
21346
21857
|
init_org_context();
|
|
21347
21858
|
KNOWLEDGE_ARTIFACT_VECTOR_NULLS = (KNOWLEDGE_ARTIFACTS_SEARCH_VECTOR.weights ?? []).map(() => null);
|
|
@@ -21387,6 +21898,37 @@ var init_integration_purge = __esm({
|
|
|
21387
21898
|
}
|
|
21388
21899
|
});
|
|
21389
21900
|
|
|
21901
|
+
// ../../packages/@company/db/src/person-source-identities.ts
|
|
21902
|
+
var init_person_source_identities = __esm({
|
|
21903
|
+
"../../packages/@company/db/src/person-source-identities.ts"() {
|
|
21904
|
+
"use strict";
|
|
21905
|
+
init_org_context();
|
|
21906
|
+
}
|
|
21907
|
+
});
|
|
21908
|
+
|
|
21909
|
+
// ../../packages/@company/db/src/expert-evidence-availability.ts
|
|
21910
|
+
var init_expert_evidence_availability = __esm({
|
|
21911
|
+
"../../packages/@company/db/src/expert-evidence-availability.ts"() {
|
|
21912
|
+
"use strict";
|
|
21913
|
+
init_org_context();
|
|
21914
|
+
}
|
|
21915
|
+
});
|
|
21916
|
+
|
|
21917
|
+
// ../../packages/@company/db/src/activity-title.ts
|
|
21918
|
+
var init_activity_title = __esm({
|
|
21919
|
+
"../../packages/@company/db/src/activity-title.ts"() {
|
|
21920
|
+
"use strict";
|
|
21921
|
+
}
|
|
21922
|
+
});
|
|
21923
|
+
|
|
21924
|
+
// ../../packages/@company/db/src/expert-areas.ts
|
|
21925
|
+
var init_expert_areas = __esm({
|
|
21926
|
+
"../../packages/@company/db/src/expert-areas.ts"() {
|
|
21927
|
+
"use strict";
|
|
21928
|
+
init_src4();
|
|
21929
|
+
}
|
|
21930
|
+
});
|
|
21931
|
+
|
|
21390
21932
|
// ../../packages/@company/db/src/exchange-context.ts
|
|
21391
21933
|
var observability6;
|
|
21392
21934
|
var init_exchange_context = __esm({
|
|
@@ -21409,6 +21951,7 @@ var init_organization_data_access = __esm({
|
|
|
21409
21951
|
"../../packages/@company/db/src/data-access/organization-data-access.ts"() {
|
|
21410
21952
|
"use strict";
|
|
21411
21953
|
init_src4();
|
|
21954
|
+
init_org_context();
|
|
21412
21955
|
}
|
|
21413
21956
|
});
|
|
21414
21957
|
|
|
@@ -21450,11 +21993,26 @@ var init_config_cache = __esm({
|
|
|
21450
21993
|
}
|
|
21451
21994
|
});
|
|
21452
21995
|
|
|
21996
|
+
// ../../packages/@company/db/src/byod/control-plane-residency.ts
|
|
21997
|
+
var init_control_plane_residency = __esm({
|
|
21998
|
+
"../../packages/@company/db/src/byod/control-plane-residency.ts"() {
|
|
21999
|
+
"use strict";
|
|
22000
|
+
}
|
|
22001
|
+
});
|
|
22002
|
+
|
|
22003
|
+
// ../../packages/@company/db/src/byod/org-db-resolver.ts
|
|
22004
|
+
var init_org_db_resolver = __esm({
|
|
22005
|
+
"../../packages/@company/db/src/byod/org-db-resolver.ts"() {
|
|
22006
|
+
"use strict";
|
|
22007
|
+
init_pool_manager();
|
|
22008
|
+
init_routed_pool();
|
|
22009
|
+
}
|
|
22010
|
+
});
|
|
22011
|
+
|
|
21453
22012
|
// ../../packages/@company/db/src/byod/source-events-routing.ts
|
|
21454
22013
|
var init_source_events_routing = __esm({
|
|
21455
22014
|
"../../packages/@company/db/src/byod/source-events-routing.ts"() {
|
|
21456
22015
|
"use strict";
|
|
21457
|
-
init_pool_manager();
|
|
21458
22016
|
}
|
|
21459
22017
|
});
|
|
21460
22018
|
|
|
@@ -21464,24 +22022,17 @@ var init_integration_storage = __esm({
|
|
|
21464
22022
|
"use strict";
|
|
21465
22023
|
init_config_cache();
|
|
21466
22024
|
init_pool_manager();
|
|
22025
|
+
init_org_db_resolver();
|
|
21467
22026
|
init_source_events_routing();
|
|
21468
22027
|
}
|
|
21469
22028
|
});
|
|
21470
22029
|
|
|
21471
|
-
// ../../packages/@company/db/src/byod/org-db-resolver.ts
|
|
21472
|
-
var init_org_db_resolver = __esm({
|
|
21473
|
-
"../../packages/@company/db/src/byod/org-db-resolver.ts"() {
|
|
21474
|
-
"use strict";
|
|
21475
|
-
init_pool_manager();
|
|
21476
|
-
}
|
|
21477
|
-
});
|
|
21478
|
-
|
|
21479
22030
|
// ../../packages/@company/db/src/byod/query-helper.ts
|
|
21480
22031
|
var init_query_helper = __esm({
|
|
21481
22032
|
"../../packages/@company/db/src/byod/query-helper.ts"() {
|
|
21482
22033
|
"use strict";
|
|
21483
|
-
init_src4();
|
|
21484
22034
|
init_org_context();
|
|
22035
|
+
init_org_db_resolver();
|
|
21485
22036
|
}
|
|
21486
22037
|
});
|
|
21487
22038
|
|
|
@@ -21494,8 +22045,15 @@ function entry(database, dbName, table, orgScoping, opts = {}) {
|
|
|
21494
22045
|
orgScoping,
|
|
21495
22046
|
scopingColumn: opts.scopingColumn,
|
|
21496
22047
|
hasVectorColumn: opts.hasVectorColumn ?? false,
|
|
21497
|
-
|
|
21498
|
-
|
|
22048
|
+
mergePolicy: opts.mergePolicy,
|
|
22049
|
+
reconciliation: opts.reconciliation ?? (opts.mergePolicy?.identityKey ? {
|
|
22050
|
+
...DEFAULT_RECONCILIATION,
|
|
22051
|
+
identity: {
|
|
22052
|
+
kind: "columns",
|
|
22053
|
+
columns: opts.mergePolicy.identityKey,
|
|
22054
|
+
version: 1
|
|
22055
|
+
}
|
|
22056
|
+
} : DEFAULT_RECONCILIATION)
|
|
21499
22057
|
};
|
|
21500
22058
|
}
|
|
21501
22059
|
function standardIntegrationTables(database, dbName) {
|
|
@@ -21533,58 +22091,17 @@ function standardIntegrationTables(database, dbName) {
|
|
|
21533
22091
|
})
|
|
21534
22092
|
];
|
|
21535
22093
|
}
|
|
21536
|
-
var
|
|
22094
|
+
var DEFAULT_RECONCILIATION, INTELLIGENCE_DB, intelligenceTables, INTEGRATIONS_DB, integrationTables, TABLE_REGISTRY;
|
|
21537
22095
|
var init_table_registry = __esm({
|
|
21538
22096
|
"../../packages/@company/db/src/byod/table-registry.ts"() {
|
|
21539
22097
|
"use strict";
|
|
21540
|
-
|
|
21541
|
-
"
|
|
21542
|
-
"
|
|
21543
|
-
"
|
|
21544
|
-
|
|
21545
|
-
"
|
|
21546
|
-
|
|
21547
|
-
"process_registry",
|
|
21548
|
-
"process_activity_facts",
|
|
21549
|
-
"process_anchor_entities",
|
|
21550
|
-
"activity_graph_edges",
|
|
21551
|
-
"process_assignment_predictions",
|
|
21552
|
-
"process_assignment_audit",
|
|
21553
|
-
"process_feedback_events",
|
|
21554
|
-
"training_pair_labels",
|
|
21555
|
-
"training_event_splits",
|
|
21556
|
-
"model_evaluation_runs",
|
|
21557
|
-
"model_evaluation_scores",
|
|
21558
|
-
"training_runs",
|
|
21559
|
-
"model_versions",
|
|
21560
|
-
"process_discovery_candidates",
|
|
21561
|
-
"activity_backfill_checkpoints",
|
|
21562
|
-
"user_workstream_state",
|
|
21563
|
-
// Identity/graph audit + override + derived-index tables written by the same
|
|
21564
|
-
// routed mining object-graph path (audit round 3 coverage sweep).
|
|
21565
|
-
"identity_audit_log",
|
|
21566
|
-
"merge_operations",
|
|
21567
|
-
"user_graph_overrides",
|
|
21568
|
-
"event_feature_index",
|
|
21569
|
-
// Sparse-index IDF derived from objects.search_vector — follows the object
|
|
21570
|
-
// graph's residency (migration object-graph/043).
|
|
21571
|
-
"org_term_df",
|
|
21572
|
-
"org_corpus_stats",
|
|
21573
|
-
// Per-identity keyword profile (migration object-graph/044).
|
|
21574
|
-
"identity_keywords",
|
|
21575
|
-
"org_mining_state",
|
|
21576
|
-
"org_active_integrations",
|
|
21577
|
-
// Object-graph correction/audit log (old/new JSONB + actor + trigger event),
|
|
21578
|
-
// written by the routed mining object-graph path (lifecycle-engine →
|
|
21579
|
-
// logCorrection). Rides to BYOD with the graph — audit round 4 (#2).
|
|
21580
|
-
"object_corrections",
|
|
21581
|
-
// Graph-enrichment bookkeeping: per-(org,platform) watermark + deadletter over
|
|
21582
|
-
// process_activity_facts (deadletter FKs into it). The enrichment tick now runs
|
|
21583
|
-
// per-org on the object-graph pool, so these ride to BYOD with the graph —
|
|
21584
|
-
// audit round 4 (#3).
|
|
21585
|
-
"graph_enrichment_state",
|
|
21586
|
-
"graph_enrichment_deadletter"
|
|
21587
|
-
]);
|
|
22098
|
+
DEFAULT_RECONCILIATION = {
|
|
22099
|
+
identity: { kind: "primary_key" },
|
|
22100
|
+
class: "authoritative",
|
|
22101
|
+
conflictPolicy: "source_wins",
|
|
22102
|
+
deleteDestinationOrphans: true,
|
|
22103
|
+
destinationManagedColumns: ["updated_at"]
|
|
22104
|
+
};
|
|
21588
22105
|
INTELLIGENCE_DB = "haansi_intelligence_prod";
|
|
21589
22106
|
intelligenceTables = [
|
|
21590
22107
|
entry("intelligence", INTELLIGENCE_DB, "haansi_schema_version", "global"),
|
|
@@ -21673,21 +22190,78 @@ var init_table_registry = __esm({
|
|
|
21673
22190
|
entry("intelligence", INTELLIGENCE_DB, "identity_links", "direct", {
|
|
21674
22191
|
scopingColumn: "organization_id"
|
|
21675
22192
|
}),
|
|
21676
|
-
|
|
21677
|
-
// objects.search_vector — rides to BYOD with the object graph.
|
|
21678
|
-
entry("intelligence", INTELLIGENCE_DB, "org_term_df", "direct", {
|
|
22193
|
+
entry("intelligence", INTELLIGENCE_DB, "event_object_links", "direct", {
|
|
21679
22194
|
scopingColumn: "organization_id"
|
|
21680
22195
|
}),
|
|
21681
|
-
entry("intelligence", INTELLIGENCE_DB, "
|
|
22196
|
+
entry("intelligence", INTELLIGENCE_DB, "process_activity_facts", "direct", {
|
|
21682
22197
|
scopingColumn: "organization_id"
|
|
21683
22198
|
}),
|
|
21684
|
-
|
|
22199
|
+
// Role-aware attribution (object-graph/093): durable per-platform identities
|
|
22200
|
+
// and (activity, identity, role) rows. Graph data — rides with PAF.
|
|
22201
|
+
entry("intelligence", INTELLIGENCE_DB, "person_source_identities", "direct", {
|
|
21685
22202
|
scopingColumn: "organization_id"
|
|
21686
22203
|
}),
|
|
21687
|
-
entry("intelligence", INTELLIGENCE_DB, "
|
|
22204
|
+
entry("intelligence", INTELLIGENCE_DB, "activity_participants", "direct", {
|
|
21688
22205
|
scopingColumn: "organization_id"
|
|
21689
22206
|
}),
|
|
21690
|
-
|
|
22207
|
+
// Expert profile change ledger (object-graph/094): pending recompute work,
|
|
22208
|
+
// derived from graph writes. Rides with the object graph.
|
|
22209
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_dirty_queue", "direct", {
|
|
22210
|
+
scopingColumn: "organization_id"
|
|
22211
|
+
}),
|
|
22212
|
+
// Member ↔ person-object links and precomputed expert facts (object-graph/095).
|
|
22213
|
+
entry("intelligence", INTELLIGENCE_DB, "member_identity_links", "direct", {
|
|
22214
|
+
scopingColumn: "organization_id"
|
|
22215
|
+
}),
|
|
22216
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_profile_facts", "direct", {
|
|
22217
|
+
scopingColumn: "organization_id"
|
|
22218
|
+
}),
|
|
22219
|
+
// Expert profile synthesis (object-graph/096).
|
|
22220
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_evidence_refs", "direct", {
|
|
22221
|
+
scopingColumn: "organization_id"
|
|
22222
|
+
}),
|
|
22223
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_profiles", "direct", {
|
|
22224
|
+
scopingColumn: "organization_id"
|
|
22225
|
+
}),
|
|
22226
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_profile_citations", "direct", {
|
|
22227
|
+
scopingColumn: "organization_id"
|
|
22228
|
+
}),
|
|
22229
|
+
entry("intelligence", INTELLIGENCE_DB, "org_expertise_areas", "direct", {
|
|
22230
|
+
scopingColumn: "organization_id"
|
|
22231
|
+
}),
|
|
22232
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_areas", "direct", {
|
|
22233
|
+
scopingColumn: "organization_id"
|
|
22234
|
+
}),
|
|
22235
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_synthesis_claims", "direct", {
|
|
22236
|
+
scopingColumn: "organization_id"
|
|
22237
|
+
}),
|
|
22238
|
+
// Org-level expertise grouping (object-graph/100).
|
|
22239
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_grouping_state", "direct", {
|
|
22240
|
+
scopingColumn: "organization_id"
|
|
22241
|
+
}),
|
|
22242
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_area_merge_log", "direct", {
|
|
22243
|
+
scopingColumn: "organization_id"
|
|
22244
|
+
}),
|
|
22245
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_profile_curation", "direct", {
|
|
22246
|
+
scopingColumn: "organization_id"
|
|
22247
|
+
}),
|
|
22248
|
+
entry(
|
|
22249
|
+
"intelligence",
|
|
22250
|
+
INTELLIGENCE_DB,
|
|
22251
|
+
"expert_profile_curation_log",
|
|
22252
|
+
"direct",
|
|
22253
|
+
{ scopingColumn: "organization_id" }
|
|
22254
|
+
),
|
|
22255
|
+
// Digests (migrations/digests/002): the generation queue, what each entry
|
|
22256
|
+
// cites, and the audit log of explicit cross-member access. They ride with
|
|
22257
|
+
// knowledge_artifacts, where digest entries live.
|
|
22258
|
+
entry("intelligence", INTELLIGENCE_DB, "digest_generation_queue", "direct", {
|
|
22259
|
+
scopingColumn: "organization_id"
|
|
22260
|
+
}),
|
|
22261
|
+
entry("intelligence", INTELLIGENCE_DB, "digest_evidence_refs", "direct", {
|
|
22262
|
+
scopingColumn: "organization_id"
|
|
22263
|
+
}),
|
|
22264
|
+
entry("intelligence", INTELLIGENCE_DB, "digest_access_log", "direct", {
|
|
21691
22265
|
scopingColumn: "organization_id"
|
|
21692
22266
|
}),
|
|
21693
22267
|
entry("intelligence", INTELLIGENCE_DB, "activity_graph_edges", "direct", {
|
|
@@ -21768,12 +22342,12 @@ var init_table_registry = __esm({
|
|
|
21768
22342
|
scopingColumn: "organization_id"
|
|
21769
22343
|
}),
|
|
21770
22344
|
// Artifact-domain, always-BYOD (read/written via getUserdataPool like the rest
|
|
21771
|
-
// of the artifacts).
|
|
22345
|
+
// of the artifacts).
|
|
21772
22346
|
entry("intelligence", INTELLIGENCE_DB, "artifact_corrections", "direct", {
|
|
21773
22347
|
scopingColumn: "organization_id"
|
|
21774
22348
|
}),
|
|
21775
22349
|
// Object-graph identity/merge/override/audit + derived feature index + per-org
|
|
21776
|
-
// mining state
|
|
22350
|
+
// mining state — written by the
|
|
21777
22351
|
// routed mining object-graph path, so they ride to BYOD with the graph.
|
|
21778
22352
|
entry("intelligence", INTELLIGENCE_DB, "identity_audit_log", "direct", {
|
|
21779
22353
|
scopingColumn: "organization_id"
|
|
@@ -21793,7 +22367,7 @@ var init_table_registry = __esm({
|
|
|
21793
22367
|
entry("intelligence", INTELLIGENCE_DB, "org_active_integrations", "direct", {
|
|
21794
22368
|
scopingColumn: "organization_id"
|
|
21795
22369
|
}),
|
|
21796
|
-
// Object-graph correction/audit log
|
|
22370
|
+
// Object-graph correction/audit log,
|
|
21797
22371
|
// written by the routed object-graph path (lifecycle-engine → logCorrection),
|
|
21798
22372
|
// so it rides to BYOD with the graph. audit round 4 (#2).
|
|
21799
22373
|
entry("intelligence", INTELLIGENCE_DB, "object_corrections", "direct", {
|
|
@@ -21801,7 +22375,7 @@ var init_table_registry = __esm({
|
|
|
21801
22375
|
}),
|
|
21802
22376
|
// Trending similarity clusters — derived from, FK-bound to, and JOINed against
|
|
21803
22377
|
// knowledge_artifacts (always-BYOD via getUserdataPool), so they follow the
|
|
21804
|
-
// artifacts to BYOD
|
|
22378
|
+
// artifacts to BYOD. The trending tick +
|
|
21805
22379
|
// read route resolve the org's userdata pool. audit round 4 (#3).
|
|
21806
22380
|
entry("intelligence", INTELLIGENCE_DB, "artifact_clusters", "direct", {
|
|
21807
22381
|
scopingColumn: "organization_id"
|
|
@@ -21809,8 +22383,8 @@ var init_table_registry = __esm({
|
|
|
21809
22383
|
entry("intelligence", INTELLIGENCE_DB, "artifact_cluster_members", "direct", {
|
|
21810
22384
|
scopingColumn: "organization_id"
|
|
21811
22385
|
}),
|
|
21812
|
-
// Graph-enrichment watermark + deadletter
|
|
21813
|
-
//
|
|
22386
|
+
// Graph-enrichment watermark + deadletter ride to BYOD with the object graph
|
|
22387
|
+
// they walk. audit round 4 (#3).
|
|
21814
22388
|
entry("intelligence", INTELLIGENCE_DB, "graph_enrichment_state", "direct", {
|
|
21815
22389
|
scopingColumn: "organization_id"
|
|
21816
22390
|
}),
|
|
@@ -21833,18 +22407,14 @@ var init_table_registry = __esm({
|
|
|
21833
22407
|
entry("integrations", INTEGRATIONS_DB, "schema_migrations", "global")
|
|
21834
22408
|
];
|
|
21835
22409
|
TABLE_REGISTRY = [
|
|
21836
|
-
|
|
21837
|
-
// OBJECT_GRAPH_TABLES) so migration gates them on byod_object_graph.
|
|
21838
|
-
...intelligenceTables.map(
|
|
21839
|
-
(t) => OBJECT_GRAPH_TABLES.has(t.table) ? { ...t, flagGated: true } : t
|
|
21840
|
-
),
|
|
22410
|
+
...intelligenceTables,
|
|
21841
22411
|
...integrationTables
|
|
21842
22412
|
];
|
|
21843
22413
|
}
|
|
21844
22414
|
});
|
|
21845
22415
|
|
|
21846
22416
|
// ../../packages/@company/db/src/byod/schema-provisioner.ts
|
|
21847
|
-
var path, SCHEMAS_DIR,
|
|
22417
|
+
var path, SCHEMAS_DIR, logger2;
|
|
21848
22418
|
var init_schema_provisioner = __esm({
|
|
21849
22419
|
"../../packages/@company/db/src/byod/schema-provisioner.ts"() {
|
|
21850
22420
|
"use strict";
|
|
@@ -21854,7 +22424,7 @@ var init_schema_provisioner = __esm({
|
|
|
21854
22424
|
init_pool_manager();
|
|
21855
22425
|
init_table_registry();
|
|
21856
22426
|
SCHEMAS_DIR = path.join(__dirname, "schemas");
|
|
21857
|
-
|
|
22427
|
+
logger2 = createLogger("db-byod-schema-provisioner");
|
|
21858
22428
|
}
|
|
21859
22429
|
});
|
|
21860
22430
|
|
|
@@ -22737,10 +23307,10 @@ var require_pg_copy_streams = __commonJS({
|
|
|
22737
23307
|
var CopyToQueryStream = require_copy_to();
|
|
22738
23308
|
var CopyFromQueryStream = require_copy_from();
|
|
22739
23309
|
var CopyBothQueryStream = require_copy_both();
|
|
22740
|
-
exports2.to = function
|
|
23310
|
+
exports2.to = function copyTo3(txt, options) {
|
|
22741
23311
|
return new CopyToQueryStream(txt, options);
|
|
22742
23312
|
};
|
|
22743
|
-
exports2.from = function
|
|
23313
|
+
exports2.from = function copyFrom3(txt, options) {
|
|
22744
23314
|
return new CopyFromQueryStream(txt, options);
|
|
22745
23315
|
};
|
|
22746
23316
|
exports2.both = function copyBoth(txt, options) {
|
|
@@ -22750,18 +23320,44 @@ var require_pg_copy_streams = __commonJS({
|
|
|
22750
23320
|
});
|
|
22751
23321
|
|
|
22752
23322
|
// ../../packages/@company/db/src/byod/migration-utils.ts
|
|
22753
|
-
var import_pg_copy_streams, import_pg_copy_streams2,
|
|
23323
|
+
var import_pg_copy_streams, import_pg_copy_streams2, logger3, COPY_TIMEOUT_MS;
|
|
22754
23324
|
var init_migration_utils = __esm({
|
|
22755
23325
|
"../../packages/@company/db/src/byod/migration-utils.ts"() {
|
|
22756
23326
|
"use strict";
|
|
22757
23327
|
import_pg_copy_streams = __toESM(require_pg_copy_streams());
|
|
22758
23328
|
import_pg_copy_streams2 = __toESM(require_pg_copy_streams());
|
|
22759
23329
|
init_src2();
|
|
22760
|
-
|
|
23330
|
+
logger3 = createLogger("db-byod-migration-utils");
|
|
22761
23331
|
COPY_TIMEOUT_MS = Number(process.env.BYOD_COPY_TIMEOUT_MS ?? 30 * 6e4);
|
|
22762
23332
|
}
|
|
22763
23333
|
});
|
|
22764
23334
|
|
|
23335
|
+
// ../../packages/@company/db/src/byod/partition-helpers.ts
|
|
23336
|
+
var PARTITIONABLE_TENANT_TABLES, PARTITIONABLE_TENANT_TABLE_SET;
|
|
23337
|
+
var init_partition_helpers = __esm({
|
|
23338
|
+
"../../packages/@company/db/src/byod/partition-helpers.ts"() {
|
|
23339
|
+
"use strict";
|
|
23340
|
+
PARTITIONABLE_TENANT_TABLES = ["object_relationships"];
|
|
23341
|
+
PARTITIONABLE_TENANT_TABLE_SET = new Set(
|
|
23342
|
+
PARTITIONABLE_TENANT_TABLES
|
|
23343
|
+
);
|
|
23344
|
+
}
|
|
23345
|
+
});
|
|
23346
|
+
|
|
23347
|
+
// ../../packages/@company/db/src/byod/reconciliation.ts
|
|
23348
|
+
var import_pg_copy_streams3, import_pg_copy_streams4, logger4;
|
|
23349
|
+
var init_reconciliation = __esm({
|
|
23350
|
+
"../../packages/@company/db/src/byod/reconciliation.ts"() {
|
|
23351
|
+
"use strict";
|
|
23352
|
+
init_src2();
|
|
23353
|
+
init_migration_utils();
|
|
23354
|
+
init_partition_helpers();
|
|
23355
|
+
import_pg_copy_streams3 = __toESM(require_pg_copy_streams());
|
|
23356
|
+
import_pg_copy_streams4 = __toESM(require_pg_copy_streams());
|
|
23357
|
+
logger4 = createLogger("db-byod-reconciliation");
|
|
23358
|
+
}
|
|
23359
|
+
});
|
|
23360
|
+
|
|
22765
23361
|
// ../../packages/@company/db/src/byod/migration-service.ts
|
|
22766
23362
|
var obs3, STALE_MIGRATION_MS;
|
|
22767
23363
|
var init_migration_service = __esm({
|
|
@@ -22770,24 +23366,22 @@ var init_migration_service = __esm({
|
|
|
22770
23366
|
init_esm();
|
|
22771
23367
|
init_pool_manager();
|
|
22772
23368
|
init_org_context();
|
|
23369
|
+
init_client();
|
|
22773
23370
|
init_src2();
|
|
23371
|
+
init_control_plane_residency();
|
|
22774
23372
|
init_table_registry();
|
|
22775
23373
|
init_migration_utils();
|
|
23374
|
+
init_partition_helpers();
|
|
23375
|
+
init_reconciliation();
|
|
22776
23376
|
obs3 = createObservabilityService("byod-migration");
|
|
22777
23377
|
STALE_MIGRATION_MS = 10 * 60 * 1e3;
|
|
22778
23378
|
}
|
|
22779
23379
|
});
|
|
22780
23380
|
|
|
22781
|
-
// ../../packages/@company/db/src/byod/
|
|
22782
|
-
var
|
|
22783
|
-
|
|
22784
|
-
"../../packages/@company/db/src/byod/schema-sync.ts"() {
|
|
23381
|
+
// ../../packages/@company/db/src/byod/reconciliation-limits.ts
|
|
23382
|
+
var init_reconciliation_limits = __esm({
|
|
23383
|
+
"../../packages/@company/db/src/byod/reconciliation-limits.ts"() {
|
|
22785
23384
|
"use strict";
|
|
22786
|
-
init_esm();
|
|
22787
|
-
path2 = __toESM(require("path"));
|
|
22788
|
-
init_pool_manager();
|
|
22789
|
-
init_schema_provisioner();
|
|
22790
|
-
SCHEMAS_DIR2 = path2.join(__dirname, "schemas");
|
|
22791
23385
|
}
|
|
22792
23386
|
});
|
|
22793
23387
|
|
|
@@ -22795,6 +23389,8 @@ var init_schema_sync = __esm({
|
|
|
22795
23389
|
var init_object_graph_pool = __esm({
|
|
22796
23390
|
"../../packages/@company/db/src/byod/object-graph-pool.ts"() {
|
|
22797
23391
|
"use strict";
|
|
23392
|
+
init_org_db_resolver();
|
|
23393
|
+
init_routed_pool();
|
|
22798
23394
|
}
|
|
22799
23395
|
});
|
|
22800
23396
|
|
|
@@ -22804,17 +23400,20 @@ var init_byod = __esm({
|
|
|
22804
23400
|
"use strict";
|
|
22805
23401
|
init_pool_manager();
|
|
22806
23402
|
init_config_cache();
|
|
23403
|
+
init_control_plane_residency();
|
|
22807
23404
|
init_integration_storage();
|
|
22808
23405
|
init_source_events_routing();
|
|
22809
23406
|
init_org_db_resolver();
|
|
23407
|
+
init_routed_pool();
|
|
22810
23408
|
init_query_helper();
|
|
22811
23409
|
init_schema_provisioner();
|
|
22812
23410
|
init_host_resolver();
|
|
22813
23411
|
init_active_orgs();
|
|
22814
23412
|
init_migration_service();
|
|
22815
23413
|
init_degradation2();
|
|
22816
|
-
|
|
22817
|
-
|
|
23414
|
+
init_partition_helpers();
|
|
23415
|
+
init_reconciliation();
|
|
23416
|
+
init_reconciliation_limits();
|
|
22818
23417
|
init_object_graph_pool();
|
|
22819
23418
|
init_table_registry();
|
|
22820
23419
|
}
|
|
@@ -22829,7 +23428,7 @@ var init_report_generation_jobs = __esm({
|
|
|
22829
23428
|
});
|
|
22830
23429
|
|
|
22831
23430
|
// ../../packages/@company/db/src/index.ts
|
|
22832
|
-
var
|
|
23431
|
+
var init_src6 = __esm({
|
|
22833
23432
|
"../../packages/@company/db/src/index.ts"() {
|
|
22834
23433
|
init_client();
|
|
22835
23434
|
init_org_context();
|
|
@@ -22837,6 +23436,10 @@ var init_src5 = __esm({
|
|
|
22837
23436
|
init_org_purge();
|
|
22838
23437
|
init_org_orphan_scan();
|
|
22839
23438
|
init_integration_purge();
|
|
23439
|
+
init_person_source_identities();
|
|
23440
|
+
init_expert_evidence_availability();
|
|
23441
|
+
init_activity_title();
|
|
23442
|
+
init_expert_areas();
|
|
22840
23443
|
init_exchange_context();
|
|
22841
23444
|
init_data_access();
|
|
22842
23445
|
init_byod();
|
|
@@ -22850,7 +23453,7 @@ var init_dictionary = __esm({
|
|
|
22850
23453
|
"../../packages/@company/pii/src/dictionary.ts"() {
|
|
22851
23454
|
"use strict";
|
|
22852
23455
|
init_src4();
|
|
22853
|
-
|
|
23456
|
+
init_src6();
|
|
22854
23457
|
init_src2();
|
|
22855
23458
|
init_spans();
|
|
22856
23459
|
obs4 = createObservabilityService("org-pii-dictionary");
|
|
@@ -22858,18 +23461,25 @@ var init_dictionary = __esm({
|
|
|
22858
23461
|
}
|
|
22859
23462
|
});
|
|
22860
23463
|
|
|
23464
|
+
// ../../packages/@company/pii/src/pii-redaction-setting.ts
|
|
23465
|
+
var init_pii_redaction_setting = __esm({
|
|
23466
|
+
"../../packages/@company/pii/src/pii-redaction-setting.ts"() {
|
|
23467
|
+
"use strict";
|
|
23468
|
+
}
|
|
23469
|
+
});
|
|
23470
|
+
|
|
22861
23471
|
// ../../packages/@company/pii/src/path-policy.ts
|
|
22862
23472
|
function normalizeRoot(root) {
|
|
22863
23473
|
return root.replace(/[\\/]+$/u, "");
|
|
22864
23474
|
}
|
|
22865
|
-
function pathSeparator(
|
|
22866
|
-
if (
|
|
22867
|
-
return
|
|
23475
|
+
function pathSeparator(path2) {
|
|
23476
|
+
if (path2.includes("\\\\")) return "\\\\";
|
|
23477
|
+
return path2.includes("\\") ? "\\" : "/";
|
|
22868
23478
|
}
|
|
22869
|
-
function matchingRepositoryRoot(
|
|
22870
|
-
const separator = pathSeparator(
|
|
23479
|
+
function matchingRepositoryRoot(path2, roots) {
|
|
23480
|
+
const separator = pathSeparator(path2);
|
|
22871
23481
|
const windows = separator !== "/";
|
|
22872
|
-
const comparablePath = windows ?
|
|
23482
|
+
const comparablePath = windows ? path2.toLowerCase() : path2;
|
|
22873
23483
|
return [...roots].map((root) => normalizeRoot(root).replace(/[\\/]/gu, separator)).filter(Boolean).sort((a, b) => b.length - a.length).find((root) => {
|
|
22874
23484
|
const comparableRoot = windows ? root.toLowerCase() : root;
|
|
22875
23485
|
return comparablePath === comparableRoot || comparablePath.startsWith(`${comparableRoot}${separator}`);
|
|
@@ -23040,10 +23650,11 @@ var init_presidio_adapter = __esm({
|
|
|
23040
23650
|
});
|
|
23041
23651
|
|
|
23042
23652
|
// ../../packages/@company/pii/src/index.ts
|
|
23043
|
-
var
|
|
23653
|
+
var init_src7 = __esm({
|
|
23044
23654
|
"../../packages/@company/pii/src/index.ts"() {
|
|
23045
23655
|
init_spans();
|
|
23046
23656
|
init_dictionary();
|
|
23657
|
+
init_pii_redaction_setting();
|
|
23047
23658
|
init_deterministic();
|
|
23048
23659
|
init_engine();
|
|
23049
23660
|
init_jsonl_scalars();
|
|
@@ -23359,7 +23970,7 @@ function extractGitInfo(projectDir, sessionTimestamp, sessionBranch) {
|
|
|
23359
23970
|
};
|
|
23360
23971
|
const gitBin = resolveGitBin();
|
|
23361
23972
|
if (!gitBin) {
|
|
23362
|
-
|
|
23973
|
+
logger5.warn("Git metadata skipped \u2014 git binary not found", {
|
|
23363
23974
|
projectDir,
|
|
23364
23975
|
reason: "git-not-on-path",
|
|
23365
23976
|
tried: GIT_BIN_CANDIDATES
|
|
@@ -23377,7 +23988,7 @@ function extractGitInfo(projectDir, sessionTimestamp, sessionBranch) {
|
|
|
23377
23988
|
try {
|
|
23378
23989
|
git(["rev-parse", "--is-inside-work-tree"]);
|
|
23379
23990
|
} catch (err) {
|
|
23380
|
-
|
|
23991
|
+
logger5.warn("Git metadata skipped \u2014 cwd not a resolvable git repo", {
|
|
23381
23992
|
projectDir,
|
|
23382
23993
|
resolvedDir: dir,
|
|
23383
23994
|
reason: err?.code === "ENOENT" ? "cwd-missing" : err?.status === 128 ? "not-a-git-repo" : "git-check-failed",
|
|
@@ -23429,7 +24040,7 @@ function resolveToken2() {
|
|
|
23429
24040
|
const creds = JSON.parse((0, import_fs3.readFileSync)(CREDENTIALS_FILE4, "utf-8"));
|
|
23430
24041
|
if (creds.token) return creds.token;
|
|
23431
24042
|
} catch {
|
|
23432
|
-
|
|
24043
|
+
logger5.warn("Could not parse credentials file", {
|
|
23433
24044
|
file: CREDENTIALS_FILE4
|
|
23434
24045
|
});
|
|
23435
24046
|
}
|
|
@@ -23454,7 +24065,7 @@ function discoverSessions(agentIds) {
|
|
|
23454
24065
|
try {
|
|
23455
24066
|
discovered = agent.discoverSessions();
|
|
23456
24067
|
} catch (err) {
|
|
23457
|
-
|
|
24068
|
+
logger5.warn(`Discovery failed for ${agent.displayName}`, {
|
|
23458
24069
|
err: err?.message
|
|
23459
24070
|
});
|
|
23460
24071
|
continue;
|
|
@@ -23465,8 +24076,8 @@ function discoverSessions(agentIds) {
|
|
|
23465
24076
|
}
|
|
23466
24077
|
return sessions;
|
|
23467
24078
|
}
|
|
23468
|
-
async function apiGet(
|
|
23469
|
-
const response = await fetch(`${apiUrl2}/api/v1${
|
|
24079
|
+
async function apiGet(path2, apiUrl2, token) {
|
|
24080
|
+
const response = await fetch(`${apiUrl2}/api/v1${path2}`, {
|
|
23470
24081
|
headers: { Authorization: `Bearer ${token}` }
|
|
23471
24082
|
});
|
|
23472
24083
|
if (!response.ok) {
|
|
@@ -23491,7 +24102,7 @@ async function getUploadedSessions(apiUrl2, token) {
|
|
|
23491
24102
|
}
|
|
23492
24103
|
return map2;
|
|
23493
24104
|
} catch (err) {
|
|
23494
|
-
void
|
|
24105
|
+
void logger5.warn(
|
|
23495
24106
|
"Could not fetch uploaded sessions list \u2014 skipping this run rather than re-uploading everything",
|
|
23496
24107
|
{ error: err?.message ?? String(err) }
|
|
23497
24108
|
);
|
|
@@ -23530,6 +24141,9 @@ async function uploadSession(sessionId, content, apiUrl2, token, agentSource, gi
|
|
|
23530
24141
|
if (response.status === 429) {
|
|
23531
24142
|
err.rateLimited = true;
|
|
23532
24143
|
}
|
|
24144
|
+
if (response.status === 409 && text.includes("mining_disabled")) {
|
|
24145
|
+
err.miningDisabled = true;
|
|
24146
|
+
}
|
|
23533
24147
|
throw err;
|
|
23534
24148
|
}
|
|
23535
24149
|
}
|
|
@@ -23560,7 +24174,7 @@ function acquireRunLock() {
|
|
|
23560
24174
|
}
|
|
23561
24175
|
continue;
|
|
23562
24176
|
}
|
|
23563
|
-
void
|
|
24177
|
+
void logger5.warn(
|
|
23564
24178
|
"Another collector run is in progress \u2014 skipping this run",
|
|
23565
24179
|
{
|
|
23566
24180
|
holderPid: holder
|
|
@@ -23599,11 +24213,11 @@ async function collectLocked(options) {
|
|
|
23599
24213
|
}
|
|
23600
24214
|
const agentIds = resolveAgentIds(options.agents);
|
|
23601
24215
|
const localSessions = discoverSessions(agentIds);
|
|
23602
|
-
|
|
24216
|
+
logger5.info(`Found ${localSessions.length} session files on disk`, {
|
|
23603
24217
|
agents: agentIds.join(",")
|
|
23604
24218
|
});
|
|
23605
24219
|
if (localSessions.length === 0) {
|
|
23606
|
-
return { uploaded: 0, skipped: 0, errors: 0 };
|
|
24220
|
+
return { uploaded: 0, skipped: 0, errors: 0, deferred: 0 };
|
|
23607
24221
|
}
|
|
23608
24222
|
let uploaded = 0;
|
|
23609
24223
|
let skipped = 0;
|
|
@@ -23611,11 +24225,16 @@ async function collectLocked(options) {
|
|
|
23611
24225
|
let deferred = 0;
|
|
23612
24226
|
const remoteMap = options.forceAll ? /* @__PURE__ */ new Map() : await getUploadedSessions(apiUrl2, token);
|
|
23613
24227
|
if (remoteMap === null) {
|
|
23614
|
-
void
|
|
24228
|
+
void logger5.warn("Skipping collection: server inventory unavailable", {
|
|
23615
24229
|
localSessions: localSessions.length,
|
|
23616
24230
|
hint: "re-authenticate with `haansi auth login` if this persists"
|
|
23617
24231
|
});
|
|
23618
|
-
return {
|
|
24232
|
+
return {
|
|
24233
|
+
uploaded: 0,
|
|
24234
|
+
skipped: localSessions.length,
|
|
24235
|
+
errors: 0,
|
|
24236
|
+
deferred: 0
|
|
24237
|
+
};
|
|
23619
24238
|
}
|
|
23620
24239
|
const toUpload = [];
|
|
23621
24240
|
for (const session of localSessions) {
|
|
@@ -23630,7 +24249,7 @@ async function collectLocked(options) {
|
|
|
23630
24249
|
}
|
|
23631
24250
|
const batch = options.limit ? toUpload.slice(0, options.limit) : toUpload;
|
|
23632
24251
|
skipped += toUpload.length - batch.length;
|
|
23633
|
-
|
|
24252
|
+
logger5.info(
|
|
23634
24253
|
`Uploading ${batch.length} session(s), skipping ${skipped} unchanged`
|
|
23635
24254
|
);
|
|
23636
24255
|
for (const session of batch) {
|
|
@@ -23657,7 +24276,7 @@ async function collectLocked(options) {
|
|
|
23657
24276
|
session.gitBranch ?? void 0
|
|
23658
24277
|
);
|
|
23659
24278
|
} else {
|
|
23660
|
-
|
|
24279
|
+
logger5.warn("Git metadata skipped \u2014 no cwd resolved for session", {
|
|
23661
24280
|
sessionId: shortId,
|
|
23662
24281
|
agentSource: session.agentId
|
|
23663
24282
|
});
|
|
@@ -23672,7 +24291,7 @@ async function collectLocked(options) {
|
|
|
23672
24291
|
normalizeLocalPathsForUpload(rawContent, gitInfo.gitRoot)
|
|
23673
24292
|
);
|
|
23674
24293
|
if (options.dryRun) {
|
|
23675
|
-
|
|
24294
|
+
logger5.info(
|
|
23676
24295
|
`[dry-run] Would upload ${shortId} (${session.agentId}, ${session.lineCount} lines)`,
|
|
23677
24296
|
{
|
|
23678
24297
|
agentSource: session.agentId,
|
|
@@ -23693,7 +24312,7 @@ async function collectLocked(options) {
|
|
|
23693
24312
|
gitInfo
|
|
23694
24313
|
);
|
|
23695
24314
|
uploaded++;
|
|
23696
|
-
|
|
24315
|
+
logger5.info(
|
|
23697
24316
|
`Uploaded ${shortId} (${session.agentId}, ${session.lineCount} lines)`,
|
|
23698
24317
|
{
|
|
23699
24318
|
agentSource: session.agentId,
|
|
@@ -23703,17 +24322,23 @@ async function collectLocked(options) {
|
|
|
23703
24322
|
}
|
|
23704
24323
|
);
|
|
23705
24324
|
} catch (err) {
|
|
24325
|
+
if (err?.miningDisabled) {
|
|
24326
|
+
void logger5.info(
|
|
24327
|
+
"Mining is disabled for this organization \u2014 nothing is being collected. An owner or admin can enable it in Settings \u2192 Connections \u2192 Coding Sessions."
|
|
24328
|
+
);
|
|
24329
|
+
break;
|
|
24330
|
+
}
|
|
23706
24331
|
if (err?.rateLimited) {
|
|
23707
24332
|
deferred++;
|
|
23708
|
-
void
|
|
24333
|
+
void logger5.info(`Rate limited, will retry next run: ${shortId}`);
|
|
23709
24334
|
} else {
|
|
23710
24335
|
errors++;
|
|
23711
|
-
|
|
24336
|
+
logger5.error(`Failed to upload ${shortId}`, { err: err.message });
|
|
23712
24337
|
}
|
|
23713
24338
|
}
|
|
23714
24339
|
}
|
|
23715
24340
|
if (deferred > 0) {
|
|
23716
|
-
void
|
|
24341
|
+
void logger5.info(
|
|
23717
24342
|
`${deferred} session(s) deferred by the upload rate limit \u2014 they remain queued`,
|
|
23718
24343
|
{ deferred, uploaded }
|
|
23719
24344
|
);
|
|
@@ -23725,7 +24350,7 @@ async function main() {
|
|
|
23725
24350
|
const dryRun = process.argv.includes("--dry-run");
|
|
23726
24351
|
const limitIdx = process.argv.indexOf("--limit");
|
|
23727
24352
|
const limit = limitIdx !== -1 ? parseInt(process.argv[limitIdx + 1], 10) : void 0;
|
|
23728
|
-
|
|
24353
|
+
logger5.info("Collector starting", { forceAll, dryRun });
|
|
23729
24354
|
const {
|
|
23730
24355
|
uploaded: _uploaded,
|
|
23731
24356
|
skipped: _skipped,
|
|
@@ -23740,14 +24365,14 @@ async function main() {
|
|
|
23740
24365
|
async function collect(options) {
|
|
23741
24366
|
if (options.dryRun) return collectLocked(options);
|
|
23742
24367
|
const lock = acquireRunLock();
|
|
23743
|
-
if (lock === null) return { uploaded: 0, skipped: 0, errors: 0 };
|
|
24368
|
+
if (lock === null) return { uploaded: 0, skipped: 0, errors: 0, deferred: 0 };
|
|
23744
24369
|
try {
|
|
23745
24370
|
return await collectLocked(options);
|
|
23746
24371
|
} finally {
|
|
23747
24372
|
releaseRunLock(lock);
|
|
23748
24373
|
}
|
|
23749
24374
|
}
|
|
23750
|
-
var import_dotenv, import_path3, import_fs3, import_os3, import_zlib, import_child_process,
|
|
24375
|
+
var import_dotenv, import_path3, import_fs3, import_os3, import_zlib, import_child_process, logger5, DEFAULT_API_URL2, CREDENTIALS_FILE4, LOCK_FILE, MIN_LINES, EDGE_SCRUB_PATTERNS, GIT_BIN_CANDIDATES, resolvedGitBin, UPLOAD_RATE_LIMIT_RETRIES, DEFAULT_RATE_LIMIT_WAIT_MS;
|
|
23751
24376
|
var init_collector = __esm({
|
|
23752
24377
|
"../service-capture/agent-sessions/collector.ts"() {
|
|
23753
24378
|
"use strict";
|
|
@@ -23759,10 +24384,10 @@ var init_collector = __esm({
|
|
|
23759
24384
|
import_child_process = require("child_process");
|
|
23760
24385
|
init_src2();
|
|
23761
24386
|
init_service_urls();
|
|
23762
|
-
|
|
24387
|
+
init_src7();
|
|
23763
24388
|
init_agents();
|
|
23764
24389
|
(0, import_dotenv.config)({ path: (0, import_path3.resolve)(__dirname, "../../../.env") });
|
|
23765
|
-
|
|
24390
|
+
logger5 = createLogger("session-collector");
|
|
23766
24391
|
DEFAULT_API_URL2 = SERVICE_URL_DEFAULTS.haansiApiBaseUrl;
|
|
23767
24392
|
CREDENTIALS_FILE4 = (0, import_path3.join)((0, import_os3.homedir)(), ".haansi", "credentials.json");
|
|
23768
24393
|
LOCK_FILE = (0, import_path3.join)((0, import_os3.homedir)(), ".haansi", "collector.lock");
|
|
@@ -23816,7 +24441,7 @@ var init_collector = __esm({
|
|
|
23816
24441
|
DEFAULT_RATE_LIMIT_WAIT_MS = 6e4;
|
|
23817
24442
|
if (require.main === module) {
|
|
23818
24443
|
main().catch((err) => {
|
|
23819
|
-
|
|
24444
|
+
logger5.error("Collector failed", err);
|
|
23820
24445
|
process.exit(1);
|
|
23821
24446
|
});
|
|
23822
24447
|
}
|
|
@@ -24725,7 +25350,7 @@ var require_scheduled_task = __commonJS({
|
|
|
24725
25350
|
var require_background_scheduled_task = __commonJS({
|
|
24726
25351
|
"../../node_modules/node-cron/src/background-scheduled-task/index.js"(exports2, module2) {
|
|
24727
25352
|
var EventEmitter = require("events");
|
|
24728
|
-
var
|
|
25353
|
+
var path2 = require("path");
|
|
24729
25354
|
var { fork } = require("child_process");
|
|
24730
25355
|
var uuid3 = (init_esm_node2(), __toCommonJS(esm_node_exports));
|
|
24731
25356
|
var daemonPath = `${__dirname}/daemon.js`;
|
|
@@ -24760,7 +25385,7 @@ var require_background_scheduled_task = __commonJS({
|
|
|
24760
25385
|
options.scheduled = true;
|
|
24761
25386
|
this.forkProcess.send({
|
|
24762
25387
|
type: "register",
|
|
24763
|
-
path:
|
|
25388
|
+
path: path2.resolve(this.taskPath),
|
|
24764
25389
|
cron: this.cronExpression,
|
|
24765
25390
|
options
|
|
24766
25391
|
});
|
|
@@ -24906,7 +25531,7 @@ function getOnDiskVersion() {
|
|
|
24906
25531
|
function trimLog() {
|
|
24907
25532
|
const { rotated, sizeBefore, tailKept } = rotateLogIfLarge(LOG_FILE);
|
|
24908
25533
|
if (rotated) {
|
|
24909
|
-
|
|
25534
|
+
void logger6.info("Rotated daemon log", {
|
|
24910
25535
|
sizeBefore,
|
|
24911
25536
|
tailKept,
|
|
24912
25537
|
previous: `${LOG_FILE}.1`
|
|
@@ -24916,22 +25541,24 @@ function trimLog() {
|
|
|
24916
25541
|
async function run() {
|
|
24917
25542
|
trimLog();
|
|
24918
25543
|
const agents = resolveAgentsEnv();
|
|
24919
|
-
|
|
25544
|
+
void logger6.info("Collect run starting", {
|
|
25545
|
+
agents: agents?.join(",") ?? "all"
|
|
25546
|
+
});
|
|
24920
25547
|
const start = Date.now();
|
|
24921
25548
|
try {
|
|
24922
25549
|
const { uploaded, skipped, errors } = await collect({ agents });
|
|
24923
25550
|
const elapsed = ((Date.now() - start) / 1e3).toFixed(1);
|
|
24924
|
-
|
|
25551
|
+
void logger6.info(`Collect run complete in ${elapsed}s`, {
|
|
24925
25552
|
uploaded,
|
|
24926
25553
|
skipped,
|
|
24927
25554
|
errors
|
|
24928
25555
|
});
|
|
24929
25556
|
} catch (err) {
|
|
24930
|
-
|
|
25557
|
+
void logger6.error("Collect run failed", { err: err.message });
|
|
24931
25558
|
}
|
|
24932
25559
|
}
|
|
24933
25560
|
async function main2() {
|
|
24934
|
-
|
|
25561
|
+
void logger6.info("Collector daemon starting", {
|
|
24935
25562
|
schedule: SCHEDULE,
|
|
24936
25563
|
version: IN_MEMORY_VERSION
|
|
24937
25564
|
});
|
|
@@ -24939,24 +25566,26 @@ async function main2() {
|
|
|
24939
25566
|
import_node_cron.default.schedule(SCHEDULE, async () => {
|
|
24940
25567
|
const diskVersion = getOnDiskVersion();
|
|
24941
25568
|
if (diskVersion && diskVersion !== IN_MEMORY_VERSION) {
|
|
24942
|
-
|
|
25569
|
+
void logger6.info("Version mismatch detected \u2014 restarting", {
|
|
24943
25570
|
inMemory: IN_MEMORY_VERSION,
|
|
24944
25571
|
onDisk: diskVersion
|
|
24945
25572
|
});
|
|
24946
25573
|
process.exit(0);
|
|
24947
25574
|
}
|
|
24948
|
-
|
|
25575
|
+
void logger6.info("Scheduled collect run triggered");
|
|
24949
25576
|
await run();
|
|
24950
25577
|
});
|
|
24951
|
-
|
|
25578
|
+
void logger6.info(
|
|
25579
|
+
`Daemon running. Next run scheduled per cron: "${SCHEDULE}"`
|
|
25580
|
+
);
|
|
24952
25581
|
const shutdown = async (signal) => {
|
|
24953
|
-
|
|
25582
|
+
void logger6.info(`Received ${signal}, shutting down`);
|
|
24954
25583
|
process.exit(0);
|
|
24955
25584
|
};
|
|
24956
25585
|
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
24957
25586
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
24958
25587
|
}
|
|
24959
|
-
var import_dotenv2, import_fs5, import_path4, import_os4, import_node_cron,
|
|
25588
|
+
var import_dotenv2, import_fs5, import_path4, import_os4, import_node_cron, logger6, IN_MEMORY_VERSION, SCHEDULE, LOG_FILE;
|
|
24960
25589
|
var init_collector_daemon = __esm({
|
|
24961
25590
|
"../service-capture/agent-sessions/collector-daemon.ts"() {
|
|
24962
25591
|
"use strict";
|
|
@@ -24969,13 +25598,13 @@ var init_collector_daemon = __esm({
|
|
|
24969
25598
|
init_src2();
|
|
24970
25599
|
init_log_rotation();
|
|
24971
25600
|
(0, import_dotenv2.config)({ path: (0, import_path4.resolve)(__dirname, "../../../.env") });
|
|
24972
|
-
|
|
25601
|
+
logger6 = createLogger("collector-daemon");
|
|
24973
25602
|
IN_MEMORY_VERSION = // eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
24974
25603
|
require_package().version;
|
|
24975
25604
|
SCHEDULE = process.env.HAANSI_COLLECT_SCHEDULE ?? process.env.CLAUDE_COLLECT_SCHEDULE ?? "*/30 * * * *";
|
|
24976
25605
|
LOG_FILE = (0, import_path4.join)((0, import_os4.homedir)(), ".haansi", "daemon.log");
|
|
24977
25606
|
main2().catch((err) => {
|
|
24978
|
-
|
|
25607
|
+
void logger6.error("Daemon failed to start", err);
|
|
24979
25608
|
process.exit(1);
|
|
24980
25609
|
});
|
|
24981
25610
|
}
|
|
@@ -24997,246 +25626,6 @@ var init_http_timeout = __esm({
|
|
|
24997
25626
|
}
|
|
24998
25627
|
});
|
|
24999
25628
|
|
|
25000
|
-
// ../../packages/@company/types/src/timeline.ts
|
|
25001
|
-
var init_timeline = __esm({
|
|
25002
|
-
"../../packages/@company/types/src/timeline.ts"() {
|
|
25003
|
-
"use strict";
|
|
25004
|
-
}
|
|
25005
|
-
});
|
|
25006
|
-
|
|
25007
|
-
// ../../packages/@company/types/src/artifact.ts
|
|
25008
|
-
var init_artifact = __esm({
|
|
25009
|
-
"../../packages/@company/types/src/artifact.ts"() {
|
|
25010
|
-
"use strict";
|
|
25011
|
-
}
|
|
25012
|
-
});
|
|
25013
|
-
|
|
25014
|
-
// ../../packages/@company/types/src/taxonomy.ts
|
|
25015
|
-
function normalizeSessionType(raw) {
|
|
25016
|
-
if (!raw) return "general";
|
|
25017
|
-
const lower = raw.toLowerCase().trim();
|
|
25018
|
-
if (lower in SESSION_TYPES) return lower;
|
|
25019
|
-
if (lower in SESSION_TYPE_ALIASES) return SESSION_TYPE_ALIASES[lower];
|
|
25020
|
-
return "general";
|
|
25021
|
-
}
|
|
25022
|
-
function normalizeComplexity(raw) {
|
|
25023
|
-
if (!raw) return "moderate";
|
|
25024
|
-
const lower = raw.toLowerCase().trim();
|
|
25025
|
-
if (lower in COMPLEXITIES) return lower;
|
|
25026
|
-
return "moderate";
|
|
25027
|
-
}
|
|
25028
|
-
var SESSION_TYPES, SESSION_TYPE_ALIASES, COMPLEXITIES, ARTIFACT_TYPES, __seenAliases, ALIAS_REVERSE_MAP, ARTIFACT_TYPE_IDS, AUTO_APPROVED_ARTIFACT_TYPES;
|
|
25029
|
-
var init_taxonomy = __esm({
|
|
25030
|
-
"../../packages/@company/types/src/taxonomy.ts"() {
|
|
25031
|
-
"use strict";
|
|
25032
|
-
SESSION_TYPES = {
|
|
25033
|
-
debugging: {
|
|
25034
|
-
label: "Debugging",
|
|
25035
|
-
description: "Investigating and fixing bugs or errors"
|
|
25036
|
-
},
|
|
25037
|
-
feature_implementation: {
|
|
25038
|
-
label: "Feature Implementation",
|
|
25039
|
-
description: "Building new functionality or features"
|
|
25040
|
-
},
|
|
25041
|
-
code_review: {
|
|
25042
|
-
label: "Code Review",
|
|
25043
|
-
description: "Reviewing code for quality, correctness, or style"
|
|
25044
|
-
},
|
|
25045
|
-
deployment: {
|
|
25046
|
-
label: "Deployment",
|
|
25047
|
-
description: "Deploying, releasing, or provisioning infrastructure"
|
|
25048
|
-
},
|
|
25049
|
-
refactoring: {
|
|
25050
|
-
label: "Refactoring",
|
|
25051
|
-
description: "Restructuring existing code without changing behavior"
|
|
25052
|
-
},
|
|
25053
|
-
configuration: {
|
|
25054
|
-
label: "Configuration",
|
|
25055
|
-
description: "Setting up or modifying project/tool configuration"
|
|
25056
|
-
},
|
|
25057
|
-
question_answer: {
|
|
25058
|
-
label: "Question & Answer",
|
|
25059
|
-
description: "Asking or answering questions about code or systems"
|
|
25060
|
-
},
|
|
25061
|
-
general: {
|
|
25062
|
-
label: "General",
|
|
25063
|
-
description: "General-purpose session not fitting other categories"
|
|
25064
|
-
}
|
|
25065
|
-
};
|
|
25066
|
-
SESSION_TYPE_ALIASES = {
|
|
25067
|
-
bug_fix: "debugging",
|
|
25068
|
-
feature: "feature_implementation",
|
|
25069
|
-
refactor: "refactoring",
|
|
25070
|
-
config: "configuration"
|
|
25071
|
-
};
|
|
25072
|
-
COMPLEXITIES = {
|
|
25073
|
-
simple: {
|
|
25074
|
-
label: "Simple",
|
|
25075
|
-
description: "Straightforward task with few steps"
|
|
25076
|
-
},
|
|
25077
|
-
moderate: {
|
|
25078
|
-
label: "Moderate",
|
|
25079
|
-
description: "Multi-step task requiring some investigation"
|
|
25080
|
-
},
|
|
25081
|
-
complex: {
|
|
25082
|
-
label: "Complex",
|
|
25083
|
-
description: "Involved task with many steps or deep analysis"
|
|
25084
|
-
}
|
|
25085
|
-
};
|
|
25086
|
-
ARTIFACT_TYPES = {
|
|
25087
|
-
report_incident: {
|
|
25088
|
-
category: "report",
|
|
25089
|
-
label: "Incident Report",
|
|
25090
|
-
description: "Production-incident record + post-incident writeup: detection, timeline, root cause, resolution, follow-ups.",
|
|
25091
|
-
icon: "AlertTriangle",
|
|
25092
|
-
aliases: ["incident_summary", "incident", "postmortem", "post-mortem"],
|
|
25093
|
-
autoApproved: false,
|
|
25094
|
-
producedBy: [
|
|
25095
|
-
"POST /api/v1/memory/processes/incidents",
|
|
25096
|
-
"POST /api/v1/memory/reports/incident",
|
|
25097
|
-
"POST /api/v1/memory/processes/incidents/:id/postmortem"
|
|
25098
|
-
]
|
|
25099
|
-
},
|
|
25100
|
-
report_decision: {
|
|
25101
|
-
category: "report",
|
|
25102
|
-
label: "Decision Record",
|
|
25103
|
-
description: "Architectural / product decision record with context, options considered, decision, and rationale.",
|
|
25104
|
-
icon: "Scale",
|
|
25105
|
-
aliases: ["decision_record", "decision-record", "adr"],
|
|
25106
|
-
autoApproved: false,
|
|
25107
|
-
producedBy: ["POST /api/v1/memory"]
|
|
25108
|
-
},
|
|
25109
|
-
report_work: {
|
|
25110
|
-
category: "report",
|
|
25111
|
-
label: "Work Report",
|
|
25112
|
-
description: "Periodic or one-off work-progress report \u2014 status updates, weekly digests, project rollups, team-activity summaries.",
|
|
25113
|
-
icon: "CalendarDays",
|
|
25114
|
-
aliases: ["weekly_digest", "weekly-digest", "status_report"],
|
|
25115
|
-
autoApproved: true,
|
|
25116
|
-
producedBy: ["POST /api/v1/memory", "POST /api/v1/memory/reports/work"]
|
|
25117
|
-
},
|
|
25118
|
-
report_sop: {
|
|
25119
|
-
category: "report",
|
|
25120
|
-
label: "Standard Operating Procedure",
|
|
25121
|
-
description: "Reusable step-by-step procedure or runbook. Placeholder \u2014 surface not yet specialized; written via generic POST /memory until a dedicated producer ships.",
|
|
25122
|
-
icon: "FileText",
|
|
25123
|
-
aliases: ["sop", "runbook"],
|
|
25124
|
-
autoApproved: false,
|
|
25125
|
-
producedBy: ["POST /api/v1/memory"]
|
|
25126
|
-
},
|
|
25127
|
-
report_onboarding: {
|
|
25128
|
-
category: "report",
|
|
25129
|
-
label: "Onboarding Packet",
|
|
25130
|
-
description: "Onboarding guide assembled from team knowledge, scoped to a project or role.",
|
|
25131
|
-
icon: "GraduationCap",
|
|
25132
|
-
aliases: ["onboarding_packet", "onboarding-packet"],
|
|
25133
|
-
autoApproved: false,
|
|
25134
|
-
producedBy: ["POST /api/v1/memory/reports/onboarding"]
|
|
25135
|
-
},
|
|
25136
|
-
report_pr: {
|
|
25137
|
-
category: "report",
|
|
25138
|
-
label: "PR Context",
|
|
25139
|
-
description: "Enriched pull-request description with linked Jira/Slack context, recent decisions, and reviewer hints.",
|
|
25140
|
-
icon: "GitPullRequest",
|
|
25141
|
-
aliases: ["pr_context", "pr-context"],
|
|
25142
|
-
autoApproved: true,
|
|
25143
|
-
producedBy: ["POST /api/v1/memory/reports/pr"]
|
|
25144
|
-
},
|
|
25145
|
-
expert: {
|
|
25146
|
-
category: "expert",
|
|
25147
|
-
label: "Expert Profile",
|
|
25148
|
-
description: "Per-person expertise profile across platforms \u2014 areas of focus, recent contributions, identity links.",
|
|
25149
|
-
icon: "Users",
|
|
25150
|
-
aliases: ["expert_profile", "expert-profile"],
|
|
25151
|
-
autoApproved: false,
|
|
25152
|
-
producedBy: ["POST /api/v1/memory/experts"]
|
|
25153
|
-
},
|
|
25154
|
-
solution_mined: {
|
|
25155
|
-
category: "solution",
|
|
25156
|
-
label: "Mined Solution",
|
|
25157
|
-
description: "Problem + solution mined automatically from a developer coding session (the distilled-path pipeline).",
|
|
25158
|
-
icon: "Lightbulb",
|
|
25159
|
-
aliases: ["solution", "mined_solution", "distilled_path"],
|
|
25160
|
-
autoApproved: true,
|
|
25161
|
-
producedBy: ["POST /api/v1/memory/solutions/mined"]
|
|
25162
|
-
},
|
|
25163
|
-
solution_qna: {
|
|
25164
|
-
category: "solution",
|
|
25165
|
-
label: "Q&A Solution",
|
|
25166
|
-
description: "Q&A answer marked verified by a user and distilled into reusable knowledge \u2014 promoted out of a conversation thread.",
|
|
25167
|
-
icon: "ThumbsUp",
|
|
25168
|
-
aliases: ["verified_answer", "verified-answer"],
|
|
25169
|
-
autoApproved: true,
|
|
25170
|
-
producedBy: ["POST /api/v1/memory/recall/messages/:id/feedback"]
|
|
25171
|
-
}
|
|
25172
|
-
};
|
|
25173
|
-
__seenAliases = /* @__PURE__ */ new Set();
|
|
25174
|
-
for (const [id, meta3] of Object.entries(ARTIFACT_TYPES)) {
|
|
25175
|
-
for (const a of meta3.aliases) {
|
|
25176
|
-
if (__seenAliases.has(a)) {
|
|
25177
|
-
throw new Error(
|
|
25178
|
-
`[taxonomy] alias "${a}" declared on multiple artifact types; last seen on "${id}"`
|
|
25179
|
-
);
|
|
25180
|
-
}
|
|
25181
|
-
__seenAliases.add(a);
|
|
25182
|
-
}
|
|
25183
|
-
}
|
|
25184
|
-
ALIAS_REVERSE_MAP = Object.freeze(
|
|
25185
|
-
Object.fromEntries(
|
|
25186
|
-
Object.entries(ARTIFACT_TYPES).flatMap(
|
|
25187
|
-
([id, meta3]) => meta3.aliases.map((a) => [a, id])
|
|
25188
|
-
)
|
|
25189
|
-
)
|
|
25190
|
-
);
|
|
25191
|
-
ARTIFACT_TYPE_IDS = Object.keys(
|
|
25192
|
-
ARTIFACT_TYPES
|
|
25193
|
-
);
|
|
25194
|
-
AUTO_APPROVED_ARTIFACT_TYPES = ARTIFACT_TYPE_IDS.filter((id) => ARTIFACT_TYPES[id].autoApproved);
|
|
25195
|
-
}
|
|
25196
|
-
});
|
|
25197
|
-
|
|
25198
|
-
// ../../packages/@company/types/src/embedding.ts
|
|
25199
|
-
var EMBEDDING_DEFAULTS, EMBEDDING_COLUMN, SUMMARY_EMBEDDING_COLUMN;
|
|
25200
|
-
var init_embedding = __esm({
|
|
25201
|
-
"../../packages/@company/types/src/embedding.ts"() {
|
|
25202
|
-
"use strict";
|
|
25203
|
-
EMBEDDING_DEFAULTS = {
|
|
25204
|
-
// `as const` gives a literal string type for the provider field, which
|
|
25205
|
-
// is assignable to llm-client's LLMProvider union without forcing
|
|
25206
|
-
// @company/types to import that union (which would re-introduce the
|
|
25207
|
-
// dependency edge we want to keep absent).
|
|
25208
|
-
// CUTOVER (2026-07-17): in-house model is now the active config. Reads +
|
|
25209
|
-
// writes + backfills all target the local-768 columns. The old OpenAI 1536
|
|
25210
|
-
// columns (`embedding` / `summary_embedding`) are retained but dormant —
|
|
25211
|
-
// roll back by flipping this whole object back to
|
|
25212
|
-
// { provider:"openai", model:"text-embedding-3-small", dimensions:1536,
|
|
25213
|
-
// column:"embedding", summaryColumn:"summary_embedding" }
|
|
25214
|
-
// (a later contract migration drops the dormant columns). Readers alias
|
|
25215
|
-
// `<column> AS embedding` so result-row field names stay stable.
|
|
25216
|
-
provider: "local",
|
|
25217
|
-
model: "Alibaba-NLP/gte-base-en-v1.5",
|
|
25218
|
-
dimensions: 768,
|
|
25219
|
-
// The ACTIVE dense-vector column that every reader + writer + backfill targets.
|
|
25220
|
-
column: "embedding_v2",
|
|
25221
|
-
// The active summary-embedding column (process_registry's second vector,
|
|
25222
|
-
// used by the process matcher).
|
|
25223
|
-
summaryColumn: "summary_embedding_v2"
|
|
25224
|
-
};
|
|
25225
|
-
EMBEDDING_COLUMN = EMBEDDING_DEFAULTS.column;
|
|
25226
|
-
SUMMARY_EMBEDDING_COLUMN = EMBEDDING_DEFAULTS.summaryColumn;
|
|
25227
|
-
}
|
|
25228
|
-
});
|
|
25229
|
-
|
|
25230
|
-
// ../../packages/@company/types/src/index.ts
|
|
25231
|
-
var init_src7 = __esm({
|
|
25232
|
-
"../../packages/@company/types/src/index.ts"() {
|
|
25233
|
-
init_timeline();
|
|
25234
|
-
init_artifact();
|
|
25235
|
-
init_taxonomy();
|
|
25236
|
-
init_embedding();
|
|
25237
|
-
}
|
|
25238
|
-
});
|
|
25239
|
-
|
|
25240
25629
|
// ../../node_modules/zod/v3/helpers/util.js
|
|
25241
25630
|
var util, objectUtil, ZodParsedType, getParsedType;
|
|
25242
25631
|
var init_util = __esm({
|
|
@@ -25642,8 +26031,8 @@ var init_parseUtil = __esm({
|
|
|
25642
26031
|
init_errors();
|
|
25643
26032
|
init_en();
|
|
25644
26033
|
makeIssue = (params) => {
|
|
25645
|
-
const { data, path:
|
|
25646
|
-
const fullPath = [...
|
|
26034
|
+
const { data, path: path2, errorMaps, issueData } = params;
|
|
26035
|
+
const fullPath = [...path2, ...issueData.path || []];
|
|
25647
26036
|
const fullIssue = {
|
|
25648
26037
|
...issueData,
|
|
25649
26038
|
path: fullPath
|
|
@@ -25923,11 +26312,11 @@ var init_types3 = __esm({
|
|
|
25923
26312
|
init_parseUtil();
|
|
25924
26313
|
init_util();
|
|
25925
26314
|
ParseInputLazyPath = class {
|
|
25926
|
-
constructor(parent, value,
|
|
26315
|
+
constructor(parent, value, path2, key) {
|
|
25927
26316
|
this._cachedPath = [];
|
|
25928
26317
|
this.parent = parent;
|
|
25929
26318
|
this.data = value;
|
|
25930
|
-
this._path =
|
|
26319
|
+
this._path = path2;
|
|
25931
26320
|
this._key = key;
|
|
25932
26321
|
}
|
|
25933
26322
|
get path() {
|
|
@@ -29433,10 +29822,10 @@ function mergeDefs(...defs) {
|
|
|
29433
29822
|
function cloneDef(schema) {
|
|
29434
29823
|
return mergeDefs(schema._zod.def);
|
|
29435
29824
|
}
|
|
29436
|
-
function getElementAtPath(obj,
|
|
29437
|
-
if (!
|
|
29825
|
+
function getElementAtPath(obj, path2) {
|
|
29826
|
+
if (!path2)
|
|
29438
29827
|
return obj;
|
|
29439
|
-
return
|
|
29828
|
+
return path2.reduce((acc, key) => acc?.[key], obj);
|
|
29440
29829
|
}
|
|
29441
29830
|
function promiseAllObject(promisesObj) {
|
|
29442
29831
|
const keys = Object.keys(promisesObj);
|
|
@@ -29748,11 +30137,11 @@ function aborted(x, startIndex = 0) {
|
|
|
29748
30137
|
}
|
|
29749
30138
|
return false;
|
|
29750
30139
|
}
|
|
29751
|
-
function prefixIssues(
|
|
30140
|
+
function prefixIssues(path2, issues) {
|
|
29752
30141
|
return issues.map((iss) => {
|
|
29753
30142
|
var _a2;
|
|
29754
30143
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
29755
|
-
iss.path.unshift(
|
|
30144
|
+
iss.path.unshift(path2);
|
|
29756
30145
|
return iss;
|
|
29757
30146
|
});
|
|
29758
30147
|
}
|
|
@@ -44242,8 +44631,8 @@ var require_utils5 = __commonJS({
|
|
|
44242
44631
|
}
|
|
44243
44632
|
return ind;
|
|
44244
44633
|
}
|
|
44245
|
-
function removeDotSegments(
|
|
44246
|
-
let input =
|
|
44634
|
+
function removeDotSegments(path2) {
|
|
44635
|
+
let input = path2;
|
|
44247
44636
|
const output = [];
|
|
44248
44637
|
let nextSlash = -1;
|
|
44249
44638
|
let len = 0;
|
|
@@ -44442,8 +44831,8 @@ var require_schemes = __commonJS({
|
|
|
44442
44831
|
wsComponent.secure = void 0;
|
|
44443
44832
|
}
|
|
44444
44833
|
if (wsComponent.resourceName) {
|
|
44445
|
-
const [
|
|
44446
|
-
wsComponent.path =
|
|
44834
|
+
const [path2, query] = wsComponent.resourceName.split("?");
|
|
44835
|
+
wsComponent.path = path2 && path2 !== "/" ? path2 : void 0;
|
|
44447
44836
|
wsComponent.query = query;
|
|
44448
44837
|
wsComponent.resourceName = void 0;
|
|
44449
44838
|
}
|
|
@@ -45384,13 +45773,13 @@ var require_core = __commonJS({
|
|
|
45384
45773
|
}, warn() {
|
|
45385
45774
|
}, error() {
|
|
45386
45775
|
} };
|
|
45387
|
-
function getLogger(
|
|
45388
|
-
if (
|
|
45776
|
+
function getLogger(logger7) {
|
|
45777
|
+
if (logger7 === false)
|
|
45389
45778
|
return noLogs;
|
|
45390
|
-
if (
|
|
45779
|
+
if (logger7 === void 0)
|
|
45391
45780
|
return console;
|
|
45392
|
-
if (
|
|
45393
|
-
return
|
|
45781
|
+
if (logger7.log && logger7.warn && logger7.error)
|
|
45782
|
+
return logger7;
|
|
45394
45783
|
throw new Error("logger must implement log, warn and error methods");
|
|
45395
45784
|
}
|
|
45396
45785
|
var KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
@@ -51282,13 +51671,13 @@ var require_core3 = __commonJS({
|
|
|
51282
51671
|
}, warn() {
|
|
51283
51672
|
}, error() {
|
|
51284
51673
|
} };
|
|
51285
|
-
function getLogger(
|
|
51286
|
-
if (
|
|
51674
|
+
function getLogger(logger7) {
|
|
51675
|
+
if (logger7 === false)
|
|
51287
51676
|
return noLogs;
|
|
51288
|
-
if (
|
|
51677
|
+
if (logger7 === void 0)
|
|
51289
51678
|
return console;
|
|
51290
|
-
if (
|
|
51291
|
-
return
|
|
51679
|
+
if (logger7.log && logger7.warn && logger7.error)
|
|
51680
|
+
return logger7;
|
|
51292
51681
|
throw new Error("logger must implement log, warn and error methods");
|
|
51293
51682
|
}
|
|
51294
51683
|
var KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
@@ -69610,11 +69999,11 @@ var require_mime_types = __commonJS({
|
|
|
69610
69999
|
}
|
|
69611
70000
|
return exts[0];
|
|
69612
70001
|
}
|
|
69613
|
-
function lookup(
|
|
69614
|
-
if (!
|
|
70002
|
+
function lookup(path2) {
|
|
70003
|
+
if (!path2 || typeof path2 !== "string") {
|
|
69615
70004
|
return false;
|
|
69616
70005
|
}
|
|
69617
|
-
var extension2 = extname("x." +
|
|
70006
|
+
var extension2 = extname("x." + path2).toLowerCase().slice(1);
|
|
69618
70007
|
if (!extension2) {
|
|
69619
70008
|
return false;
|
|
69620
70009
|
}
|
|
@@ -73052,13 +73441,13 @@ var require_view = __commonJS({
|
|
|
73052
73441
|
"../service-capture/node_modules/express/lib/view.js"(exports2, module2) {
|
|
73053
73442
|
"use strict";
|
|
73054
73443
|
var debug = require_src()("express:view");
|
|
73055
|
-
var
|
|
73444
|
+
var path2 = require("node:path");
|
|
73056
73445
|
var fs = require("node:fs");
|
|
73057
|
-
var dirname3 =
|
|
73058
|
-
var basename4 =
|
|
73059
|
-
var extname =
|
|
73060
|
-
var
|
|
73061
|
-
var resolve4 =
|
|
73446
|
+
var dirname3 = path2.dirname;
|
|
73447
|
+
var basename4 = path2.basename;
|
|
73448
|
+
var extname = path2.extname;
|
|
73449
|
+
var join14 = path2.join;
|
|
73450
|
+
var resolve4 = path2.resolve;
|
|
73062
73451
|
module2.exports = View;
|
|
73063
73452
|
function View(name, options) {
|
|
73064
73453
|
var opts = options || {};
|
|
@@ -73087,17 +73476,17 @@ var require_view = __commonJS({
|
|
|
73087
73476
|
this.path = this.lookup(fileName);
|
|
73088
73477
|
}
|
|
73089
73478
|
View.prototype.lookup = function lookup(name) {
|
|
73090
|
-
var
|
|
73479
|
+
var path3;
|
|
73091
73480
|
var roots = [].concat(this.root);
|
|
73092
73481
|
debug('lookup "%s"', name);
|
|
73093
|
-
for (var i = 0; i < roots.length && !
|
|
73482
|
+
for (var i = 0; i < roots.length && !path3; i++) {
|
|
73094
73483
|
var root = roots[i];
|
|
73095
73484
|
var loc = resolve4(root, name);
|
|
73096
73485
|
var dir = dirname3(loc);
|
|
73097
73486
|
var file2 = basename4(loc);
|
|
73098
|
-
|
|
73487
|
+
path3 = this.resolve(dir, file2);
|
|
73099
73488
|
}
|
|
73100
|
-
return
|
|
73489
|
+
return path3;
|
|
73101
73490
|
};
|
|
73102
73491
|
View.prototype.render = function render(options, callback) {
|
|
73103
73492
|
var sync = true;
|
|
@@ -73119,21 +73508,21 @@ var require_view = __commonJS({
|
|
|
73119
73508
|
};
|
|
73120
73509
|
View.prototype.resolve = function resolve5(dir, file2) {
|
|
73121
73510
|
var ext = this.ext;
|
|
73122
|
-
var
|
|
73123
|
-
var stat = tryStat(
|
|
73511
|
+
var path3 = join14(dir, file2);
|
|
73512
|
+
var stat = tryStat(path3);
|
|
73124
73513
|
if (stat && stat.isFile()) {
|
|
73125
|
-
return
|
|
73514
|
+
return path3;
|
|
73126
73515
|
}
|
|
73127
|
-
|
|
73128
|
-
stat = tryStat(
|
|
73516
|
+
path3 = join14(dir, basename4(file2, ext), "index" + ext);
|
|
73517
|
+
stat = tryStat(path3);
|
|
73129
73518
|
if (stat && stat.isFile()) {
|
|
73130
|
-
return
|
|
73519
|
+
return path3;
|
|
73131
73520
|
}
|
|
73132
73521
|
};
|
|
73133
|
-
function tryStat(
|
|
73134
|
-
debug('stat "%s"',
|
|
73522
|
+
function tryStat(path3) {
|
|
73523
|
+
debug('stat "%s"', path3);
|
|
73135
73524
|
try {
|
|
73136
|
-
return fs.statSync(
|
|
73525
|
+
return fs.statSync(path3);
|
|
73137
73526
|
} catch (e) {
|
|
73138
73527
|
return void 0;
|
|
73139
73528
|
}
|
|
@@ -74331,15 +74720,15 @@ var require_dist3 = __commonJS({
|
|
|
74331
74720
|
if (token.type === endType)
|
|
74332
74721
|
break;
|
|
74333
74722
|
if (token.type === "char" || token.type === "escape") {
|
|
74334
|
-
let
|
|
74723
|
+
let path2 = token.value;
|
|
74335
74724
|
let cur = tokens[pos];
|
|
74336
74725
|
while (cur.type === "char" || cur.type === "escape") {
|
|
74337
|
-
|
|
74726
|
+
path2 += cur.value;
|
|
74338
74727
|
cur = tokens[++pos];
|
|
74339
74728
|
}
|
|
74340
74729
|
output.push({
|
|
74341
74730
|
type: "text",
|
|
74342
|
-
value: encodePath(
|
|
74731
|
+
value: encodePath(path2)
|
|
74343
74732
|
});
|
|
74344
74733
|
continue;
|
|
74345
74734
|
}
|
|
@@ -74363,16 +74752,16 @@ var require_dist3 = __commonJS({
|
|
|
74363
74752
|
}
|
|
74364
74753
|
return new TokenData(consumeUntil("end"), str);
|
|
74365
74754
|
}
|
|
74366
|
-
function compile(
|
|
74755
|
+
function compile(path2, options = {}) {
|
|
74367
74756
|
const { encode: encode3 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
74368
|
-
const data = typeof
|
|
74757
|
+
const data = typeof path2 === "object" ? path2 : parse4(path2, options);
|
|
74369
74758
|
const fn = tokensToFunction(data.tokens, delimiter, encode3);
|
|
74370
|
-
return function
|
|
74371
|
-
const [
|
|
74759
|
+
return function path3(params = {}) {
|
|
74760
|
+
const [path4, ...missing] = fn(params);
|
|
74372
74761
|
if (missing.length) {
|
|
74373
74762
|
throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
|
|
74374
74763
|
}
|
|
74375
|
-
return
|
|
74764
|
+
return path4;
|
|
74376
74765
|
};
|
|
74377
74766
|
}
|
|
74378
74767
|
function tokensToFunction(tokens, delimiter, encode3) {
|
|
@@ -74428,9 +74817,9 @@ var require_dist3 = __commonJS({
|
|
|
74428
74817
|
return [encodeValue(value)];
|
|
74429
74818
|
};
|
|
74430
74819
|
}
|
|
74431
|
-
function match(
|
|
74820
|
+
function match(path2, options = {}) {
|
|
74432
74821
|
const { decode: decode3 = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
74433
|
-
const { regexp, keys } = pathToRegexp(
|
|
74822
|
+
const { regexp, keys } = pathToRegexp(path2, options);
|
|
74434
74823
|
const decoders = keys.map((key) => {
|
|
74435
74824
|
if (decode3 === false)
|
|
74436
74825
|
return NOOP_VALUE;
|
|
@@ -74442,7 +74831,7 @@ var require_dist3 = __commonJS({
|
|
|
74442
74831
|
const m = regexp.exec(input);
|
|
74443
74832
|
if (!m)
|
|
74444
74833
|
return false;
|
|
74445
|
-
const
|
|
74834
|
+
const path3 = m[0];
|
|
74446
74835
|
const params = /* @__PURE__ */ Object.create(null);
|
|
74447
74836
|
for (let i = 1; i < m.length; i++) {
|
|
74448
74837
|
if (m[i] === void 0)
|
|
@@ -74451,15 +74840,15 @@ var require_dist3 = __commonJS({
|
|
|
74451
74840
|
const decoder = decoders[i - 1];
|
|
74452
74841
|
params[key.name] = decoder(m[i]);
|
|
74453
74842
|
}
|
|
74454
|
-
return { path:
|
|
74843
|
+
return { path: path3, params };
|
|
74455
74844
|
};
|
|
74456
74845
|
}
|
|
74457
|
-
function pathToRegexp(
|
|
74846
|
+
function pathToRegexp(path2, options = {}) {
|
|
74458
74847
|
const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
|
|
74459
74848
|
const keys = [];
|
|
74460
74849
|
const flags = sensitive ? "" : "i";
|
|
74461
74850
|
const sources = [];
|
|
74462
|
-
for (const input of pathsToArray(
|
|
74851
|
+
for (const input of pathsToArray(path2, [])) {
|
|
74463
74852
|
const data = typeof input === "object" ? input : parse4(input, options);
|
|
74464
74853
|
for (const tokens of flatten(data.tokens, 0, [])) {
|
|
74465
74854
|
sources.push(toRegExpSource(tokens, delimiter, keys, data.originalPath));
|
|
@@ -74589,18 +74978,18 @@ var require_layer = __commonJS({
|
|
|
74589
74978
|
var TRAILING_SLASH_REGEXP = /\/+$/;
|
|
74590
74979
|
var MATCHING_GROUP_REGEXP = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
74591
74980
|
module2.exports = Layer;
|
|
74592
|
-
function Layer(
|
|
74981
|
+
function Layer(path2, options, fn) {
|
|
74593
74982
|
if (!(this instanceof Layer)) {
|
|
74594
|
-
return new Layer(
|
|
74983
|
+
return new Layer(path2, options, fn);
|
|
74595
74984
|
}
|
|
74596
|
-
debug("new %o",
|
|
74985
|
+
debug("new %o", path2);
|
|
74597
74986
|
const opts = options || {};
|
|
74598
74987
|
this.handle = fn;
|
|
74599
74988
|
this.keys = [];
|
|
74600
74989
|
this.name = fn.name || "<anonymous>";
|
|
74601
74990
|
this.params = void 0;
|
|
74602
74991
|
this.path = void 0;
|
|
74603
|
-
this.slash =
|
|
74992
|
+
this.slash = path2 === "/" && opts.end === false;
|
|
74604
74993
|
function matcher(_path) {
|
|
74605
74994
|
if (_path instanceof RegExp) {
|
|
74606
74995
|
const keys = [];
|
|
@@ -74639,7 +75028,7 @@ var require_layer = __commonJS({
|
|
|
74639
75028
|
decode: decodeParam
|
|
74640
75029
|
});
|
|
74641
75030
|
}
|
|
74642
|
-
this.matchers = Array.isArray(
|
|
75031
|
+
this.matchers = Array.isArray(path2) ? path2.map(matcher) : [matcher(path2)];
|
|
74643
75032
|
}
|
|
74644
75033
|
Layer.prototype.handleError = function handleError(error2, req, res, next) {
|
|
74645
75034
|
const fn = this.handle;
|
|
@@ -74679,9 +75068,9 @@ var require_layer = __commonJS({
|
|
|
74679
75068
|
next(err);
|
|
74680
75069
|
}
|
|
74681
75070
|
};
|
|
74682
|
-
Layer.prototype.match = function match(
|
|
75071
|
+
Layer.prototype.match = function match(path2) {
|
|
74683
75072
|
let match2;
|
|
74684
|
-
if (
|
|
75073
|
+
if (path2 != null) {
|
|
74685
75074
|
if (this.slash) {
|
|
74686
75075
|
this.params = {};
|
|
74687
75076
|
this.path = "";
|
|
@@ -74689,7 +75078,7 @@ var require_layer = __commonJS({
|
|
|
74689
75078
|
}
|
|
74690
75079
|
let i = 0;
|
|
74691
75080
|
while (!match2 && i < this.matchers.length) {
|
|
74692
|
-
match2 = this.matchers[i](
|
|
75081
|
+
match2 = this.matchers[i](path2);
|
|
74693
75082
|
i++;
|
|
74694
75083
|
}
|
|
74695
75084
|
}
|
|
@@ -74717,13 +75106,13 @@ var require_layer = __commonJS({
|
|
|
74717
75106
|
throw err;
|
|
74718
75107
|
}
|
|
74719
75108
|
}
|
|
74720
|
-
function loosen(
|
|
74721
|
-
if (
|
|
74722
|
-
return
|
|
75109
|
+
function loosen(path2) {
|
|
75110
|
+
if (path2 instanceof RegExp || path2 === "/") {
|
|
75111
|
+
return path2;
|
|
74723
75112
|
}
|
|
74724
|
-
return Array.isArray(
|
|
75113
|
+
return Array.isArray(path2) ? path2.map(function(p) {
|
|
74725
75114
|
return loosen(p);
|
|
74726
|
-
}) : String(
|
|
75115
|
+
}) : String(path2).replace(TRAILING_SLASH_REGEXP, "");
|
|
74727
75116
|
}
|
|
74728
75117
|
}
|
|
74729
75118
|
});
|
|
@@ -74739,9 +75128,9 @@ var require_route = __commonJS({
|
|
|
74739
75128
|
var flatten = Array.prototype.flat;
|
|
74740
75129
|
var methods = METHODS.map((method) => method.toLowerCase());
|
|
74741
75130
|
module2.exports = Route;
|
|
74742
|
-
function Route(
|
|
74743
|
-
debug("new %o",
|
|
74744
|
-
this.path =
|
|
75131
|
+
function Route(path2) {
|
|
75132
|
+
debug("new %o", path2);
|
|
75133
|
+
this.path = path2;
|
|
74745
75134
|
this.stack = [];
|
|
74746
75135
|
this.methods = /* @__PURE__ */ Object.create(null);
|
|
74747
75136
|
}
|
|
@@ -74949,8 +75338,8 @@ var require_router = __commonJS({
|
|
|
74949
75338
|
if (++sync > 100) {
|
|
74950
75339
|
return setImmediate(next, err);
|
|
74951
75340
|
}
|
|
74952
|
-
const
|
|
74953
|
-
if (
|
|
75341
|
+
const path2 = getPathname(req);
|
|
75342
|
+
if (path2 == null) {
|
|
74954
75343
|
return done(layerError);
|
|
74955
75344
|
}
|
|
74956
75345
|
let layer;
|
|
@@ -74958,7 +75347,7 @@ var require_router = __commonJS({
|
|
|
74958
75347
|
let route;
|
|
74959
75348
|
while (match !== true && idx < stack.length) {
|
|
74960
75349
|
layer = stack[idx++];
|
|
74961
|
-
match = matchLayer(layer,
|
|
75350
|
+
match = matchLayer(layer, path2);
|
|
74962
75351
|
route = layer.route;
|
|
74963
75352
|
if (typeof match !== "boolean") {
|
|
74964
75353
|
layerError = layerError || match;
|
|
@@ -74996,18 +75385,18 @@ var require_router = __commonJS({
|
|
|
74996
75385
|
} else if (route) {
|
|
74997
75386
|
layer.handleRequest(req, res, next);
|
|
74998
75387
|
} else {
|
|
74999
|
-
trimPrefix(layer, layerError, layerPath,
|
|
75388
|
+
trimPrefix(layer, layerError, layerPath, path2);
|
|
75000
75389
|
}
|
|
75001
75390
|
sync = 0;
|
|
75002
75391
|
});
|
|
75003
75392
|
}
|
|
75004
|
-
function trimPrefix(layer, layerError, layerPath,
|
|
75393
|
+
function trimPrefix(layer, layerError, layerPath, path2) {
|
|
75005
75394
|
if (layerPath.length !== 0) {
|
|
75006
|
-
if (layerPath !==
|
|
75395
|
+
if (layerPath !== path2.substring(0, layerPath.length)) {
|
|
75007
75396
|
next(layerError);
|
|
75008
75397
|
return;
|
|
75009
75398
|
}
|
|
75010
|
-
const c =
|
|
75399
|
+
const c = path2[layerPath.length];
|
|
75011
75400
|
if (c && c !== "/") {
|
|
75012
75401
|
next(layerError);
|
|
75013
75402
|
return;
|
|
@@ -75031,7 +75420,7 @@ var require_router = __commonJS({
|
|
|
75031
75420
|
};
|
|
75032
75421
|
Router.prototype.use = function use(handler) {
|
|
75033
75422
|
let offset = 0;
|
|
75034
|
-
let
|
|
75423
|
+
let path2 = "/";
|
|
75035
75424
|
if (typeof handler !== "function") {
|
|
75036
75425
|
let arg = handler;
|
|
75037
75426
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -75039,7 +75428,7 @@ var require_router = __commonJS({
|
|
|
75039
75428
|
}
|
|
75040
75429
|
if (typeof arg !== "function") {
|
|
75041
75430
|
offset = 1;
|
|
75042
|
-
|
|
75431
|
+
path2 = handler;
|
|
75043
75432
|
}
|
|
75044
75433
|
}
|
|
75045
75434
|
const callbacks = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -75051,8 +75440,8 @@ var require_router = __commonJS({
|
|
|
75051
75440
|
if (typeof fn !== "function") {
|
|
75052
75441
|
throw new TypeError("argument handler must be a function");
|
|
75053
75442
|
}
|
|
75054
|
-
debug("use %o %s",
|
|
75055
|
-
const layer = new Layer(
|
|
75443
|
+
debug("use %o %s", path2, fn.name || "<anonymous>");
|
|
75444
|
+
const layer = new Layer(path2, {
|
|
75056
75445
|
sensitive: this.caseSensitive,
|
|
75057
75446
|
strict: false,
|
|
75058
75447
|
end: false
|
|
@@ -75062,9 +75451,9 @@ var require_router = __commonJS({
|
|
|
75062
75451
|
}
|
|
75063
75452
|
return this;
|
|
75064
75453
|
};
|
|
75065
|
-
Router.prototype.route = function route(
|
|
75066
|
-
const route2 = new Route(
|
|
75067
|
-
const layer = new Layer(
|
|
75454
|
+
Router.prototype.route = function route(path2) {
|
|
75455
|
+
const route2 = new Route(path2);
|
|
75456
|
+
const layer = new Layer(path2, {
|
|
75068
75457
|
sensitive: this.caseSensitive,
|
|
75069
75458
|
strict: this.strict,
|
|
75070
75459
|
end: true
|
|
@@ -75077,8 +75466,8 @@ var require_router = __commonJS({
|
|
|
75077
75466
|
return route2;
|
|
75078
75467
|
};
|
|
75079
75468
|
methods.concat("all").forEach(function(method) {
|
|
75080
|
-
Router.prototype[method] = function(
|
|
75081
|
-
const route = this.route(
|
|
75469
|
+
Router.prototype[method] = function(path2) {
|
|
75470
|
+
const route = this.route(path2);
|
|
75082
75471
|
route[method].apply(route, slice.call(arguments, 1));
|
|
75083
75472
|
return this;
|
|
75084
75473
|
};
|
|
@@ -75107,9 +75496,9 @@ var require_router = __commonJS({
|
|
|
75107
75496
|
const fqdnIndex = url2.substring(0, pathLength).indexOf("://");
|
|
75108
75497
|
return fqdnIndex !== -1 ? url2.substring(0, url2.indexOf("/", 3 + fqdnIndex)) : void 0;
|
|
75109
75498
|
}
|
|
75110
|
-
function matchLayer(layer,
|
|
75499
|
+
function matchLayer(layer, path2) {
|
|
75111
75500
|
try {
|
|
75112
|
-
return layer.match(
|
|
75501
|
+
return layer.match(path2);
|
|
75113
75502
|
} catch (err) {
|
|
75114
75503
|
return err;
|
|
75115
75504
|
}
|
|
@@ -75337,7 +75726,7 @@ var require_application = __commonJS({
|
|
|
75337
75726
|
};
|
|
75338
75727
|
app.use = function use(fn) {
|
|
75339
75728
|
var offset = 0;
|
|
75340
|
-
var
|
|
75729
|
+
var path2 = "/";
|
|
75341
75730
|
if (typeof fn !== "function") {
|
|
75342
75731
|
var arg = fn;
|
|
75343
75732
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -75345,7 +75734,7 @@ var require_application = __commonJS({
|
|
|
75345
75734
|
}
|
|
75346
75735
|
if (typeof arg !== "function") {
|
|
75347
75736
|
offset = 1;
|
|
75348
|
-
|
|
75737
|
+
path2 = fn;
|
|
75349
75738
|
}
|
|
75350
75739
|
}
|
|
75351
75740
|
var fns = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -75355,12 +75744,12 @@ var require_application = __commonJS({
|
|
|
75355
75744
|
var router = this.router;
|
|
75356
75745
|
fns.forEach(function(fn2) {
|
|
75357
75746
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
75358
|
-
return router.use(
|
|
75747
|
+
return router.use(path2, fn2);
|
|
75359
75748
|
}
|
|
75360
|
-
debug(".use app under %s",
|
|
75361
|
-
fn2.mountpath =
|
|
75749
|
+
debug(".use app under %s", path2);
|
|
75750
|
+
fn2.mountpath = path2;
|
|
75362
75751
|
fn2.parent = this;
|
|
75363
|
-
router.use(
|
|
75752
|
+
router.use(path2, function mounted_app(req, res, next) {
|
|
75364
75753
|
var orig = req.app;
|
|
75365
75754
|
fn2.handle(req, res, function(err) {
|
|
75366
75755
|
Object.setPrototypeOf(req, orig.request);
|
|
@@ -75372,8 +75761,8 @@ var require_application = __commonJS({
|
|
|
75372
75761
|
}, this);
|
|
75373
75762
|
return this;
|
|
75374
75763
|
};
|
|
75375
|
-
app.route = function route(
|
|
75376
|
-
return this.router.route(
|
|
75764
|
+
app.route = function route(path2) {
|
|
75765
|
+
return this.router.route(path2);
|
|
75377
75766
|
};
|
|
75378
75767
|
app.engine = function engine(ext, fn) {
|
|
75379
75768
|
if (typeof fn !== "function") {
|
|
@@ -75416,7 +75805,7 @@ var require_application = __commonJS({
|
|
|
75416
75805
|
}
|
|
75417
75806
|
return this;
|
|
75418
75807
|
};
|
|
75419
|
-
app.path = function
|
|
75808
|
+
app.path = function path2() {
|
|
75420
75809
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
75421
75810
|
};
|
|
75422
75811
|
app.enabled = function enabled(setting) {
|
|
@@ -75432,17 +75821,17 @@ var require_application = __commonJS({
|
|
|
75432
75821
|
return this.set(setting, false);
|
|
75433
75822
|
};
|
|
75434
75823
|
methods.forEach(function(method) {
|
|
75435
|
-
app[method] = function(
|
|
75824
|
+
app[method] = function(path2) {
|
|
75436
75825
|
if (method === "get" && arguments.length === 1) {
|
|
75437
|
-
return this.set(
|
|
75826
|
+
return this.set(path2);
|
|
75438
75827
|
}
|
|
75439
|
-
var route = this.route(
|
|
75828
|
+
var route = this.route(path2);
|
|
75440
75829
|
route[method].apply(route, slice.call(arguments, 1));
|
|
75441
75830
|
return this;
|
|
75442
75831
|
};
|
|
75443
75832
|
});
|
|
75444
|
-
app.all = function all(
|
|
75445
|
-
var route = this.route(
|
|
75833
|
+
app.all = function all(path2) {
|
|
75834
|
+
var route = this.route(path2);
|
|
75446
75835
|
var args = slice.call(arguments, 1);
|
|
75447
75836
|
for (var i = 0; i < methods.length; i++) {
|
|
75448
75837
|
route[methods[i]].apply(route, args);
|
|
@@ -76352,7 +76741,7 @@ var require_request = __commonJS({
|
|
|
76352
76741
|
var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
|
|
76353
76742
|
return subdomains2.slice(offset);
|
|
76354
76743
|
});
|
|
76355
|
-
defineGetter(req, "path", function
|
|
76744
|
+
defineGetter(req, "path", function path2() {
|
|
76356
76745
|
return parse4(this).pathname;
|
|
76357
76746
|
});
|
|
76358
76747
|
defineGetter(req, "host", function host() {
|
|
@@ -76764,27 +77153,27 @@ var require_send = __commonJS({
|
|
|
76764
77153
|
var ms = require_ms();
|
|
76765
77154
|
var onFinished = require_on_finished();
|
|
76766
77155
|
var parseRange = require_range_parser();
|
|
76767
|
-
var
|
|
77156
|
+
var path2 = require("path");
|
|
76768
77157
|
var statuses = require_statuses();
|
|
76769
77158
|
var Stream = require("stream");
|
|
76770
77159
|
var util2 = require("util");
|
|
76771
|
-
var extname =
|
|
76772
|
-
var
|
|
76773
|
-
var normalize =
|
|
76774
|
-
var resolve4 =
|
|
76775
|
-
var sep =
|
|
77160
|
+
var extname = path2.extname;
|
|
77161
|
+
var join14 = path2.join;
|
|
77162
|
+
var normalize = path2.normalize;
|
|
77163
|
+
var resolve4 = path2.resolve;
|
|
77164
|
+
var sep = path2.sep;
|
|
76776
77165
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
76777
77166
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
76778
77167
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
76779
77168
|
module2.exports = send;
|
|
76780
|
-
function send(req,
|
|
76781
|
-
return new SendStream(req,
|
|
77169
|
+
function send(req, path3, options) {
|
|
77170
|
+
return new SendStream(req, path3, options);
|
|
76782
77171
|
}
|
|
76783
|
-
function SendStream(req,
|
|
77172
|
+
function SendStream(req, path3, options) {
|
|
76784
77173
|
Stream.call(this);
|
|
76785
77174
|
var opts = options || {};
|
|
76786
77175
|
this.options = opts;
|
|
76787
|
-
this.path =
|
|
77176
|
+
this.path = path3;
|
|
76788
77177
|
this.req = req;
|
|
76789
77178
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
76790
77179
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -76898,10 +77287,10 @@ var require_send = __commonJS({
|
|
|
76898
77287
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
76899
77288
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
76900
77289
|
};
|
|
76901
|
-
SendStream.prototype.redirect = function redirect(
|
|
77290
|
+
SendStream.prototype.redirect = function redirect(path3) {
|
|
76902
77291
|
var res = this.res;
|
|
76903
77292
|
if (hasListeners(this, "directory")) {
|
|
76904
|
-
this.emit("directory", res,
|
|
77293
|
+
this.emit("directory", res, path3);
|
|
76905
77294
|
return;
|
|
76906
77295
|
}
|
|
76907
77296
|
if (this.hasTrailingSlash()) {
|
|
@@ -76921,38 +77310,38 @@ var require_send = __commonJS({
|
|
|
76921
77310
|
SendStream.prototype.pipe = function pipe2(res) {
|
|
76922
77311
|
var root = this._root;
|
|
76923
77312
|
this.res = res;
|
|
76924
|
-
var
|
|
76925
|
-
if (
|
|
77313
|
+
var path3 = decode3(this.path);
|
|
77314
|
+
if (path3 === -1) {
|
|
76926
77315
|
this.error(400);
|
|
76927
77316
|
return res;
|
|
76928
77317
|
}
|
|
76929
|
-
if (~
|
|
77318
|
+
if (~path3.indexOf("\0")) {
|
|
76930
77319
|
this.error(400);
|
|
76931
77320
|
return res;
|
|
76932
77321
|
}
|
|
76933
77322
|
var parts;
|
|
76934
77323
|
if (root !== null) {
|
|
76935
|
-
if (
|
|
76936
|
-
|
|
77324
|
+
if (path3) {
|
|
77325
|
+
path3 = normalize("." + sep + path3);
|
|
76937
77326
|
}
|
|
76938
|
-
if (UP_PATH_REGEXP.test(
|
|
76939
|
-
debug('malicious path "%s"',
|
|
77327
|
+
if (UP_PATH_REGEXP.test(path3)) {
|
|
77328
|
+
debug('malicious path "%s"', path3);
|
|
76940
77329
|
this.error(403);
|
|
76941
77330
|
return res;
|
|
76942
77331
|
}
|
|
76943
|
-
parts =
|
|
76944
|
-
|
|
77332
|
+
parts = path3.split(sep);
|
|
77333
|
+
path3 = normalize(join14(root, path3));
|
|
76945
77334
|
} else {
|
|
76946
|
-
if (UP_PATH_REGEXP.test(
|
|
76947
|
-
debug('malicious path "%s"',
|
|
77335
|
+
if (UP_PATH_REGEXP.test(path3)) {
|
|
77336
|
+
debug('malicious path "%s"', path3);
|
|
76948
77337
|
this.error(403);
|
|
76949
77338
|
return res;
|
|
76950
77339
|
}
|
|
76951
|
-
parts = normalize(
|
|
76952
|
-
|
|
77340
|
+
parts = normalize(path3).split(sep);
|
|
77341
|
+
path3 = resolve4(path3);
|
|
76953
77342
|
}
|
|
76954
77343
|
if (containsDotFile(parts)) {
|
|
76955
|
-
debug('%s dotfile "%s"', this._dotfiles,
|
|
77344
|
+
debug('%s dotfile "%s"', this._dotfiles, path3);
|
|
76956
77345
|
switch (this._dotfiles) {
|
|
76957
77346
|
case "allow":
|
|
76958
77347
|
break;
|
|
@@ -76966,13 +77355,13 @@ var require_send = __commonJS({
|
|
|
76966
77355
|
}
|
|
76967
77356
|
}
|
|
76968
77357
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
76969
|
-
this.sendIndex(
|
|
77358
|
+
this.sendIndex(path3);
|
|
76970
77359
|
return res;
|
|
76971
77360
|
}
|
|
76972
|
-
this.sendFile(
|
|
77361
|
+
this.sendFile(path3);
|
|
76973
77362
|
return res;
|
|
76974
77363
|
};
|
|
76975
|
-
SendStream.prototype.send = function send2(
|
|
77364
|
+
SendStream.prototype.send = function send2(path3, stat) {
|
|
76976
77365
|
var len = stat.size;
|
|
76977
77366
|
var options = this.options;
|
|
76978
77367
|
var opts = {};
|
|
@@ -76984,9 +77373,9 @@ var require_send = __commonJS({
|
|
|
76984
77373
|
this.headersAlreadySent();
|
|
76985
77374
|
return;
|
|
76986
77375
|
}
|
|
76987
|
-
debug('pipe "%s"',
|
|
76988
|
-
this.setHeader(
|
|
76989
|
-
this.type(
|
|
77376
|
+
debug('pipe "%s"', path3);
|
|
77377
|
+
this.setHeader(path3, stat);
|
|
77378
|
+
this.type(path3);
|
|
76990
77379
|
if (this.isConditionalGET()) {
|
|
76991
77380
|
if (this.isPreconditionFailure()) {
|
|
76992
77381
|
this.error(412);
|
|
@@ -77035,28 +77424,28 @@ var require_send = __commonJS({
|
|
|
77035
77424
|
res.end();
|
|
77036
77425
|
return;
|
|
77037
77426
|
}
|
|
77038
|
-
this.stream(
|
|
77427
|
+
this.stream(path3, opts);
|
|
77039
77428
|
};
|
|
77040
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
77429
|
+
SendStream.prototype.sendFile = function sendFile(path3) {
|
|
77041
77430
|
var i = 0;
|
|
77042
77431
|
var self = this;
|
|
77043
|
-
debug('stat "%s"',
|
|
77044
|
-
fs.stat(
|
|
77045
|
-
var pathEndsWithSep =
|
|
77046
|
-
if (err && err.code === "ENOENT" && !extname(
|
|
77432
|
+
debug('stat "%s"', path3);
|
|
77433
|
+
fs.stat(path3, function onstat(err, stat) {
|
|
77434
|
+
var pathEndsWithSep = path3[path3.length - 1] === sep;
|
|
77435
|
+
if (err && err.code === "ENOENT" && !extname(path3) && !pathEndsWithSep) {
|
|
77047
77436
|
return next(err);
|
|
77048
77437
|
}
|
|
77049
77438
|
if (err) return self.onStatError(err);
|
|
77050
|
-
if (stat.isDirectory()) return self.redirect(
|
|
77439
|
+
if (stat.isDirectory()) return self.redirect(path3);
|
|
77051
77440
|
if (pathEndsWithSep) return self.error(404);
|
|
77052
|
-
self.emit("file",
|
|
77053
|
-
self.send(
|
|
77441
|
+
self.emit("file", path3, stat);
|
|
77442
|
+
self.send(path3, stat);
|
|
77054
77443
|
});
|
|
77055
77444
|
function next(err) {
|
|
77056
77445
|
if (self._extensions.length <= i) {
|
|
77057
77446
|
return err ? self.onStatError(err) : self.error(404);
|
|
77058
77447
|
}
|
|
77059
|
-
var p =
|
|
77448
|
+
var p = path3 + "." + self._extensions[i++];
|
|
77060
77449
|
debug('stat "%s"', p);
|
|
77061
77450
|
fs.stat(p, function(err2, stat) {
|
|
77062
77451
|
if (err2) return next(err2);
|
|
@@ -77066,7 +77455,7 @@ var require_send = __commonJS({
|
|
|
77066
77455
|
});
|
|
77067
77456
|
}
|
|
77068
77457
|
};
|
|
77069
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
77458
|
+
SendStream.prototype.sendIndex = function sendIndex(path3) {
|
|
77070
77459
|
var i = -1;
|
|
77071
77460
|
var self = this;
|
|
77072
77461
|
function next(err) {
|
|
@@ -77074,7 +77463,7 @@ var require_send = __commonJS({
|
|
|
77074
77463
|
if (err) return self.onStatError(err);
|
|
77075
77464
|
return self.error(404);
|
|
77076
77465
|
}
|
|
77077
|
-
var p =
|
|
77466
|
+
var p = join14(path3, self._index[i]);
|
|
77078
77467
|
debug('stat "%s"', p);
|
|
77079
77468
|
fs.stat(p, function(err2, stat) {
|
|
77080
77469
|
if (err2) return next(err2);
|
|
@@ -77085,10 +77474,10 @@ var require_send = __commonJS({
|
|
|
77085
77474
|
}
|
|
77086
77475
|
next();
|
|
77087
77476
|
};
|
|
77088
|
-
SendStream.prototype.stream = function stream(
|
|
77477
|
+
SendStream.prototype.stream = function stream(path3, options) {
|
|
77089
77478
|
var self = this;
|
|
77090
77479
|
var res = this.res;
|
|
77091
|
-
var stream2 = fs.createReadStream(
|
|
77480
|
+
var stream2 = fs.createReadStream(path3, options);
|
|
77092
77481
|
this.emit("stream", stream2);
|
|
77093
77482
|
stream2.pipe(res);
|
|
77094
77483
|
function cleanup() {
|
|
@@ -77103,17 +77492,17 @@ var require_send = __commonJS({
|
|
|
77103
77492
|
self.emit("end");
|
|
77104
77493
|
});
|
|
77105
77494
|
};
|
|
77106
|
-
SendStream.prototype.type = function type(
|
|
77495
|
+
SendStream.prototype.type = function type(path3) {
|
|
77107
77496
|
var res = this.res;
|
|
77108
77497
|
if (res.getHeader("Content-Type")) return;
|
|
77109
|
-
var ext = extname(
|
|
77498
|
+
var ext = extname(path3);
|
|
77110
77499
|
var type2 = mime.contentType(ext) || "application/octet-stream";
|
|
77111
77500
|
debug("content-type %s", type2);
|
|
77112
77501
|
res.setHeader("Content-Type", type2);
|
|
77113
77502
|
};
|
|
77114
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
77503
|
+
SendStream.prototype.setHeader = function setHeader(path3, stat) {
|
|
77115
77504
|
var res = this.res;
|
|
77116
|
-
this.emit("headers", res,
|
|
77505
|
+
this.emit("headers", res, path3, stat);
|
|
77117
77506
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
77118
77507
|
debug("accept ranges");
|
|
77119
77508
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -77171,9 +77560,9 @@ var require_send = __commonJS({
|
|
|
77171
77560
|
}
|
|
77172
77561
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
77173
77562
|
}
|
|
77174
|
-
function decode3(
|
|
77563
|
+
function decode3(path3) {
|
|
77175
77564
|
try {
|
|
77176
|
-
return decodeURIComponent(
|
|
77565
|
+
return decodeURIComponent(path3);
|
|
77177
77566
|
} catch (err) {
|
|
77178
77567
|
return -1;
|
|
77179
77568
|
}
|
|
@@ -77317,7 +77706,7 @@ var require_response = __commonJS({
|
|
|
77317
77706
|
var http = require("node:http");
|
|
77318
77707
|
var onFinished = require_on_finished();
|
|
77319
77708
|
var mime = require_mime_types();
|
|
77320
|
-
var
|
|
77709
|
+
var path2 = require("node:path");
|
|
77321
77710
|
var pathIsAbsolute = require("node:path").isAbsolute;
|
|
77322
77711
|
var statuses = require_statuses();
|
|
77323
77712
|
var sign = require_cookie_signature().sign;
|
|
@@ -77326,8 +77715,8 @@ var require_response = __commonJS({
|
|
|
77326
77715
|
var setCharset = require_utils8().setCharset;
|
|
77327
77716
|
var cookie = require_cookie();
|
|
77328
77717
|
var send = require_send();
|
|
77329
|
-
var extname =
|
|
77330
|
-
var resolve4 =
|
|
77718
|
+
var extname = path2.extname;
|
|
77719
|
+
var resolve4 = path2.resolve;
|
|
77331
77720
|
var vary = require_vary();
|
|
77332
77721
|
var { Buffer: Buffer2 } = require("node:buffer");
|
|
77333
77722
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -77473,26 +77862,26 @@ var require_response = __commonJS({
|
|
|
77473
77862
|
this.type("txt");
|
|
77474
77863
|
return this.send(body);
|
|
77475
77864
|
};
|
|
77476
|
-
res.sendFile = function sendFile(
|
|
77865
|
+
res.sendFile = function sendFile(path3, options, callback) {
|
|
77477
77866
|
var done = callback;
|
|
77478
77867
|
var req = this.req;
|
|
77479
77868
|
var res2 = this;
|
|
77480
77869
|
var next = req.next;
|
|
77481
77870
|
var opts = options || {};
|
|
77482
|
-
if (!
|
|
77871
|
+
if (!path3) {
|
|
77483
77872
|
throw new TypeError("path argument is required to res.sendFile");
|
|
77484
77873
|
}
|
|
77485
|
-
if (typeof
|
|
77874
|
+
if (typeof path3 !== "string") {
|
|
77486
77875
|
throw new TypeError("path must be a string to res.sendFile");
|
|
77487
77876
|
}
|
|
77488
77877
|
if (typeof options === "function") {
|
|
77489
77878
|
done = options;
|
|
77490
77879
|
opts = {};
|
|
77491
77880
|
}
|
|
77492
|
-
if (!opts.root && !pathIsAbsolute(
|
|
77881
|
+
if (!opts.root && !pathIsAbsolute(path3)) {
|
|
77493
77882
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
77494
77883
|
}
|
|
77495
|
-
var pathname = encodeURI(
|
|
77884
|
+
var pathname = encodeURI(path3);
|
|
77496
77885
|
opts.etag = this.app.enabled("etag");
|
|
77497
77886
|
var file2 = send(req, pathname, opts);
|
|
77498
77887
|
sendfile(res2, file2, opts, function(err) {
|
|
@@ -77503,7 +77892,7 @@ var require_response = __commonJS({
|
|
|
77503
77892
|
}
|
|
77504
77893
|
});
|
|
77505
77894
|
};
|
|
77506
|
-
res.download = function download(
|
|
77895
|
+
res.download = function download(path3, filename, options, callback) {
|
|
77507
77896
|
var done = callback;
|
|
77508
77897
|
var name = filename;
|
|
77509
77898
|
var opts = options || null;
|
|
@@ -77520,7 +77909,7 @@ var require_response = __commonJS({
|
|
|
77520
77909
|
opts = filename;
|
|
77521
77910
|
}
|
|
77522
77911
|
var headers = {
|
|
77523
|
-
"Content-Disposition": contentDisposition(name ||
|
|
77912
|
+
"Content-Disposition": contentDisposition(name || path3)
|
|
77524
77913
|
};
|
|
77525
77914
|
if (opts && opts.headers) {
|
|
77526
77915
|
var keys = Object.keys(opts.headers);
|
|
@@ -77533,7 +77922,7 @@ var require_response = __commonJS({
|
|
|
77533
77922
|
}
|
|
77534
77923
|
opts = Object.create(opts);
|
|
77535
77924
|
opts.headers = headers;
|
|
77536
|
-
var fullPath = !opts.root ? resolve4(
|
|
77925
|
+
var fullPath = !opts.root ? resolve4(path3) : path3;
|
|
77537
77926
|
return this.sendFile(fullPath, opts, done);
|
|
77538
77927
|
};
|
|
77539
77928
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -77816,11 +78205,11 @@ var require_serve_static = __commonJS({
|
|
|
77816
78205
|
}
|
|
77817
78206
|
var forwardError = !fallthrough;
|
|
77818
78207
|
var originalUrl = parseUrl.original(req);
|
|
77819
|
-
var
|
|
77820
|
-
if (
|
|
77821
|
-
|
|
78208
|
+
var path2 = parseUrl(req).pathname;
|
|
78209
|
+
if (path2 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
78210
|
+
path2 = "";
|
|
77822
78211
|
}
|
|
77823
|
-
var stream = send(req,
|
|
78212
|
+
var stream = send(req, path2, opts);
|
|
77824
78213
|
stream.on("directory", onDirectory);
|
|
77825
78214
|
if (setHeaders) {
|
|
77826
78215
|
stream.on("headers", setHeaders);
|
|
@@ -79195,12 +79584,12 @@ function maybeCollect() {
|
|
|
79195
79584
|
triggerCollectInBackground();
|
|
79196
79585
|
}
|
|
79197
79586
|
}
|
|
79198
|
-
async function apiGet2(
|
|
79587
|
+
async function apiGet2(path2, options) {
|
|
79199
79588
|
const headers = {
|
|
79200
79589
|
Authorization: `Bearer ${TOKEN}`,
|
|
79201
79590
|
...options?.extraHeaders
|
|
79202
79591
|
};
|
|
79203
|
-
const response = await fetchWithTimeout(`${API_URL}/api/v1${
|
|
79592
|
+
const response = await fetchWithTimeout(`${API_URL}/api/v1${path2}`, {
|
|
79204
79593
|
headers
|
|
79205
79594
|
});
|
|
79206
79595
|
if (!response.ok) {
|
|
@@ -79209,13 +79598,13 @@ async function apiGet2(path3, options) {
|
|
|
79209
79598
|
}
|
|
79210
79599
|
return response.json();
|
|
79211
79600
|
}
|
|
79212
|
-
async function apiPost(
|
|
79601
|
+
async function apiPost(path2, body, options) {
|
|
79213
79602
|
const headers = {
|
|
79214
79603
|
Authorization: `Bearer ${TOKEN}`,
|
|
79215
79604
|
"Content-Type": "application/json",
|
|
79216
79605
|
...options?.extraHeaders
|
|
79217
79606
|
};
|
|
79218
|
-
const response = await fetchWithTimeout(`${API_URL}/api/v1${
|
|
79607
|
+
const response = await fetchWithTimeout(`${API_URL}/api/v1${path2}`, {
|
|
79219
79608
|
method: "POST",
|
|
79220
79609
|
headers,
|
|
79221
79610
|
body: JSON.stringify(body)
|
|
@@ -79269,7 +79658,7 @@ var init_mcp_server2 = __esm({
|
|
|
79269
79658
|
init_collector();
|
|
79270
79659
|
init_http_timeout();
|
|
79271
79660
|
init_service_urls();
|
|
79272
|
-
|
|
79661
|
+
init_src5();
|
|
79273
79662
|
init_mcp();
|
|
79274
79663
|
init_stdio2();
|
|
79275
79664
|
init_types4();
|
|
@@ -79559,8 +79948,9 @@ var init_mcp_server2 = __esm({
|
|
|
79559
79948
|
throw new Error(`Unknown tool: ${name}`);
|
|
79560
79949
|
}
|
|
79561
79950
|
} catch (err) {
|
|
79951
|
+
console.error(`[MCP] agent-sessions tool failed:`, err?.message ?? err);
|
|
79562
79952
|
return {
|
|
79563
|
-
content: [{ type: "text", text:
|
|
79953
|
+
content: [{ type: "text", text: "An internal error occurred." }],
|
|
79564
79954
|
isError: true
|
|
79565
79955
|
};
|
|
79566
79956
|
}
|
|
@@ -79622,17 +80012,20 @@ var init_codex_config = __esm({
|
|
|
79622
80012
|
// src/commands/setup-mcp.ts
|
|
79623
80013
|
var setup_mcp_exports = {};
|
|
79624
80014
|
__export(setup_mcp_exports, {
|
|
80015
|
+
HTTP_SERVERS: () => HTTP_SERVERS,
|
|
80016
|
+
parseTarget: () => parseTarget,
|
|
79625
80017
|
setupMcp: () => setupMcp
|
|
79626
80018
|
});
|
|
79627
80019
|
function parseTarget(arg) {
|
|
79628
80020
|
if (!arg || arg === "all") return "all";
|
|
79629
|
-
if (arg === "solutions" || arg === "exchange"
|
|
80021
|
+
if (arg === "solutions" || arg === "exchange" || arg === "digests")
|
|
80022
|
+
return arg;
|
|
79630
80023
|
throw new Error(
|
|
79631
|
-
`Unknown target: ${arg}. Use one of: solutions, exchange, all (default).`
|
|
80024
|
+
`Unknown target: ${arg}. Use one of: solutions, exchange, digests, all (default).`
|
|
79632
80025
|
);
|
|
79633
80026
|
}
|
|
79634
|
-
function
|
|
79635
|
-
return `${apiUrl().replace(/\/+$/, "")}
|
|
80027
|
+
function httpServerUrl(path2) {
|
|
80028
|
+
return `${apiUrl().replace(/\/+$/, "")}${path2}`;
|
|
79636
80029
|
}
|
|
79637
80030
|
function setupClaudeMcp(target) {
|
|
79638
80031
|
let config6 = {};
|
|
@@ -79657,21 +80050,22 @@ function setupClaudeMcp(target) {
|
|
|
79657
80050
|
};
|
|
79658
80051
|
installed.push(`haansi-solutions (stdio \u2192 ${haansiBin} mcp-server)`);
|
|
79659
80052
|
}
|
|
79660
|
-
|
|
80053
|
+
for (const http of HTTP_SERVERS) {
|
|
80054
|
+
if (target !== "all" && target !== http.target) continue;
|
|
79661
80055
|
const token = resolveToken();
|
|
79662
80056
|
if (!token) {
|
|
79663
80057
|
warnings.push(
|
|
79664
|
-
|
|
80058
|
+
`${http.name} not registered: no token found. Run \`haansi auth login\` first, or set HAANSI_TOKEN.`
|
|
79665
80059
|
);
|
|
79666
|
-
|
|
79667
|
-
const url2 = exchangeUrl();
|
|
79668
|
-
config6.mcpServers["haansi-exchange"] = {
|
|
79669
|
-
type: "http",
|
|
79670
|
-
url: url2,
|
|
79671
|
-
headers: { Authorization: `Bearer ${token}` }
|
|
79672
|
-
};
|
|
79673
|
-
installed.push(`haansi-exchange (http \u2192 ${url2})`);
|
|
80060
|
+
continue;
|
|
79674
80061
|
}
|
|
80062
|
+
const url2 = httpServerUrl(http.path);
|
|
80063
|
+
config6.mcpServers[http.name] = {
|
|
80064
|
+
type: "http",
|
|
80065
|
+
url: url2,
|
|
80066
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
80067
|
+
};
|
|
80068
|
+
installed.push(`${http.name} (http \u2192 ${url2})`);
|
|
79675
80069
|
}
|
|
79676
80070
|
(0, import_node_fs5.writeFileSync)(CLAUDE_JSON, JSON.stringify(config6, null, 2) + "\n", "utf-8");
|
|
79677
80071
|
console.log(`
|
|
@@ -79702,20 +80096,21 @@ function setupCodexMcp(target) {
|
|
|
79702
80096
|
});
|
|
79703
80097
|
installed.push(`haansi-solutions (stdio \u2192 ${haansiBin} mcp-server)`);
|
|
79704
80098
|
}
|
|
79705
|
-
|
|
80099
|
+
for (const http of HTTP_SERVERS) {
|
|
80100
|
+
if (target !== "all" && target !== http.target) continue;
|
|
79706
80101
|
const token = resolveToken();
|
|
79707
80102
|
if (!token) {
|
|
79708
80103
|
warnings.push(
|
|
79709
|
-
|
|
80104
|
+
`${http.name} not registered: no token found. Run \`haansi auth login\` first, or set HAANSI_TOKEN.`
|
|
79710
80105
|
);
|
|
79711
|
-
|
|
79712
|
-
const url2 = exchangeUrl();
|
|
79713
|
-
content = upsertTomlTable(content, "mcp_servers.haansi-exchange", {
|
|
79714
|
-
url: tomlString(url2),
|
|
79715
|
-
http_headers: tomlInlineTable({ Authorization: `Bearer ${token}` })
|
|
79716
|
-
});
|
|
79717
|
-
installed.push(`haansi-exchange (http \u2192 ${url2})`);
|
|
80106
|
+
continue;
|
|
79718
80107
|
}
|
|
80108
|
+
const url2 = httpServerUrl(http.path);
|
|
80109
|
+
content = upsertTomlTable(content, `mcp_servers.${http.name}`, {
|
|
80110
|
+
url: tomlString(url2),
|
|
80111
|
+
http_headers: tomlInlineTable({ Authorization: `Bearer ${token}` })
|
|
80112
|
+
});
|
|
80113
|
+
installed.push(`${http.name} (http \u2192 ${url2})`);
|
|
79719
80114
|
}
|
|
79720
80115
|
(0, import_node_fs5.mkdirSync)(CODEX_HOME, { recursive: true });
|
|
79721
80116
|
(0, import_node_fs5.writeFileSync)(CODEX_CONFIG, content, "utf-8");
|
|
@@ -79736,7 +80131,7 @@ async function setupMcp(targetArg, agentFlag) {
|
|
|
79736
80131
|
console.log(`
|
|
79737
80132
|
Restart ${restart} to activate the changes.`);
|
|
79738
80133
|
}
|
|
79739
|
-
var import_node_fs5, import_node_path4, import_node_os4, CLAUDE_JSON, CODEX_HOME, CODEX_CONFIG, WRITERS;
|
|
80134
|
+
var import_node_fs5, import_node_path4, import_node_os4, CLAUDE_JSON, CODEX_HOME, CODEX_CONFIG, HTTP_SERVERS, WRITERS;
|
|
79740
80135
|
var init_setup_mcp = __esm({
|
|
79741
80136
|
"src/commands/setup-mcp.ts"() {
|
|
79742
80137
|
"use strict";
|
|
@@ -79749,6 +80144,18 @@ var init_setup_mcp = __esm({
|
|
|
79749
80144
|
CLAUDE_JSON = (0, import_node_path4.join)((0, import_node_os4.homedir)(), ".claude.json");
|
|
79750
80145
|
CODEX_HOME = process.env.CODEX_HOME || (0, import_node_path4.join)((0, import_node_os4.homedir)(), ".codex");
|
|
79751
80146
|
CODEX_CONFIG = (0, import_node_path4.join)(CODEX_HOME, "config.toml");
|
|
80147
|
+
HTTP_SERVERS = [
|
|
80148
|
+
{
|
|
80149
|
+
target: "exchange",
|
|
80150
|
+
name: "haansi-exchange",
|
|
80151
|
+
path: "/api/v1/memory/exchange/mcp"
|
|
80152
|
+
},
|
|
80153
|
+
{
|
|
80154
|
+
target: "digests",
|
|
80155
|
+
name: "haansi-digests",
|
|
80156
|
+
path: "/api/v1/memory/digests/mcp"
|
|
80157
|
+
}
|
|
80158
|
+
];
|
|
79752
80159
|
WRITERS = {
|
|
79753
80160
|
"claude-code": setupClaudeMcp,
|
|
79754
80161
|
codex: setupCodexMcp
|
|
@@ -79795,7 +80202,7 @@ function warnIfStaleDevBundle(haansiPath) {
|
|
|
79795
80202
|
}
|
|
79796
80203
|
function buildPlist(haansiPath) {
|
|
79797
80204
|
const binDir = haansiPath.replace(/\/[^/]+$/, "");
|
|
79798
|
-
const
|
|
80205
|
+
const path2 = `${binDir}:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`;
|
|
79799
80206
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
79800
80207
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
79801
80208
|
<plist version="1.0">
|
|
@@ -79810,7 +80217,7 @@ function buildPlist(haansiPath) {
|
|
|
79810
80217
|
<key>EnvironmentVariables</key>
|
|
79811
80218
|
<dict>
|
|
79812
80219
|
<key>PATH</key>
|
|
79813
|
-
<string>${
|
|
80220
|
+
<string>${path2}</string>
|
|
79814
80221
|
</dict>
|
|
79815
80222
|
<key>RunAtLoad</key>
|
|
79816
80223
|
<true/>
|
|
@@ -79831,8 +80238,8 @@ async function setupDaemon(uninstall) {
|
|
|
79831
80238
|
}
|
|
79832
80239
|
try {
|
|
79833
80240
|
(0, import_node_child_process3.spawnSync)("launchctl", ["unload", PLIST_PATH], { stdio: "pipe" });
|
|
79834
|
-
} catch
|
|
79835
|
-
console.error("Failed to unload daemon
|
|
80241
|
+
} catch {
|
|
80242
|
+
console.error("Failed to unload daemon.");
|
|
79836
80243
|
}
|
|
79837
80244
|
(0, import_node_fs6.unlinkSync)(PLIST_PATH);
|
|
79838
80245
|
console.log("Daemon stopped and removed.");
|
|
@@ -79844,8 +80251,8 @@ async function setupDaemon(uninstall) {
|
|
|
79844
80251
|
(0, import_node_fs6.writeFileSync)(PLIST_PATH, buildPlist(haansiPath), "utf-8");
|
|
79845
80252
|
try {
|
|
79846
80253
|
(0, import_node_child_process3.spawnSync)("launchctl", ["unload", PLIST_PATH], { stdio: "pipe" });
|
|
79847
|
-
} catch
|
|
79848
|
-
console.error("Failed to unload previous daemon
|
|
80254
|
+
} catch {
|
|
80255
|
+
console.error("Failed to unload previous daemon.");
|
|
79849
80256
|
}
|
|
79850
80257
|
(0, import_node_child_process3.spawnSync)("launchctl", ["load", PLIST_PATH], { stdio: "inherit" });
|
|
79851
80258
|
console.log("Daemon installed and started.");
|
|
@@ -79885,8 +80292,10 @@ function resolveToken4() {
|
|
|
79885
80292
|
try {
|
|
79886
80293
|
const creds = JSON.parse((0, import_node_fs7.readFileSync)(CREDENTIALS_FILE6, "utf-8"));
|
|
79887
80294
|
if (creds.token) return creds.token;
|
|
79888
|
-
} catch
|
|
79889
|
-
console.error(
|
|
80295
|
+
} catch {
|
|
80296
|
+
console.error(
|
|
80297
|
+
"Failed to read credentials file. Run `haansi init` to recreate it."
|
|
80298
|
+
);
|
|
79890
80299
|
}
|
|
79891
80300
|
}
|
|
79892
80301
|
return null;
|
|
@@ -79911,10 +80320,7 @@ async function config5(args) {
|
|
|
79911
80320
|
}
|
|
79912
80321
|
);
|
|
79913
80322
|
if (!response.ok) {
|
|
79914
|
-
|
|
79915
|
-
console.error(
|
|
79916
|
-
`Error fetching preferences (${response.status}): ${body.slice(0, 200)}`
|
|
79917
|
-
);
|
|
80323
|
+
console.error(`Error fetching preferences (${response.status}).`);
|
|
79918
80324
|
process.exit(1);
|
|
79919
80325
|
return;
|
|
79920
80326
|
}
|
|
@@ -79963,10 +80369,7 @@ async function config5(args) {
|
|
|
79963
80369
|
}
|
|
79964
80370
|
);
|
|
79965
80371
|
if (!response.ok) {
|
|
79966
|
-
|
|
79967
|
-
console.error(
|
|
79968
|
-
`Error updating preferences (${response.status}): ${body.slice(0, 200)}`
|
|
79969
|
-
);
|
|
80372
|
+
console.error(`Error updating preferences (${response.status}).`);
|
|
79970
80373
|
process.exit(1);
|
|
79971
80374
|
return;
|
|
79972
80375
|
}
|
|
@@ -80007,24 +80410,27 @@ function resolveToken5() {
|
|
|
80007
80410
|
try {
|
|
80008
80411
|
const creds = JSON.parse((0, import_node_fs8.readFileSync)(CREDENTIALS_FILE7, "utf-8"));
|
|
80009
80412
|
if (creds.token) return creds.token;
|
|
80010
|
-
} catch
|
|
80011
|
-
console.error(
|
|
80413
|
+
} catch {
|
|
80414
|
+
console.error(
|
|
80415
|
+
"Failed to read credentials file. Run `haansi init` to recreate it."
|
|
80416
|
+
);
|
|
80012
80417
|
}
|
|
80013
80418
|
}
|
|
80014
80419
|
throw new Error("No token found. Run `haansi init` first.");
|
|
80015
80420
|
}
|
|
80016
|
-
async function apiGet3(
|
|
80017
|
-
const response = await fetch(`${apiUrl2}/api/v1${
|
|
80421
|
+
async function apiGet3(path2, token, apiUrl2) {
|
|
80422
|
+
const response = await fetch(`${apiUrl2}/api/v1${path2}`, {
|
|
80018
80423
|
headers: { Authorization: `Bearer ${token}` }
|
|
80019
80424
|
});
|
|
80020
80425
|
if (!response.ok) {
|
|
80021
|
-
|
|
80022
|
-
|
|
80426
|
+
throw Object.assign(new Error(`API error ${response.status}`), {
|
|
80427
|
+
publicMessage: `The request failed (${response.status}).`
|
|
80428
|
+
});
|
|
80023
80429
|
}
|
|
80024
80430
|
return response.json();
|
|
80025
80431
|
}
|
|
80026
|
-
async function apiPost2(
|
|
80027
|
-
const response = await fetch(`${apiUrl2}/api/v1${
|
|
80432
|
+
async function apiPost2(path2, body, token, apiUrl2) {
|
|
80433
|
+
const response = await fetch(`${apiUrl2}/api/v1${path2}`, {
|
|
80028
80434
|
method: "POST",
|
|
80029
80435
|
headers: {
|
|
80030
80436
|
Authorization: `Bearer ${token}`,
|
|
@@ -80033,8 +80439,9 @@ async function apiPost2(path3, body, token, apiUrl2) {
|
|
|
80033
80439
|
body: JSON.stringify(body)
|
|
80034
80440
|
});
|
|
80035
80441
|
if (!response.ok) {
|
|
80036
|
-
|
|
80037
|
-
|
|
80442
|
+
throw Object.assign(new Error(`API error ${response.status}`), {
|
|
80443
|
+
publicMessage: `The request failed (${response.status}).`
|
|
80444
|
+
});
|
|
80038
80445
|
}
|
|
80039
80446
|
return response.json();
|
|
80040
80447
|
}
|
|
@@ -80347,7 +80754,9 @@ Environment variables:
|
|
|
80347
80754
|
`);
|
|
80348
80755
|
}
|
|
80349
80756
|
run2().catch((err) => {
|
|
80350
|
-
|
|
80757
|
+
const publicMessage = typeof err === "object" && err !== null && "publicMessage" in err ? String(err.publicMessage) : void 0;
|
|
80758
|
+
console.error("Error:", publicMessage ?? "The command failed.");
|
|
80759
|
+
if (process.env.HAANSI_DEBUG) console.error(err);
|
|
80351
80760
|
process.exit(1);
|
|
80352
80761
|
});
|
|
80353
80762
|
/*! Bundled license information:
|