haansi 0.1.36 → 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 +1040 -640
- 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
|
);
|
|
@@ -23563,7 +24174,7 @@ function acquireRunLock() {
|
|
|
23563
24174
|
}
|
|
23564
24175
|
continue;
|
|
23565
24176
|
}
|
|
23566
|
-
void
|
|
24177
|
+
void logger5.warn(
|
|
23567
24178
|
"Another collector run is in progress \u2014 skipping this run",
|
|
23568
24179
|
{
|
|
23569
24180
|
holderPid: holder
|
|
@@ -23602,11 +24213,11 @@ async function collectLocked(options) {
|
|
|
23602
24213
|
}
|
|
23603
24214
|
const agentIds = resolveAgentIds(options.agents);
|
|
23604
24215
|
const localSessions = discoverSessions(agentIds);
|
|
23605
|
-
|
|
24216
|
+
logger5.info(`Found ${localSessions.length} session files on disk`, {
|
|
23606
24217
|
agents: agentIds.join(",")
|
|
23607
24218
|
});
|
|
23608
24219
|
if (localSessions.length === 0) {
|
|
23609
|
-
return { uploaded: 0, skipped: 0, errors: 0 };
|
|
24220
|
+
return { uploaded: 0, skipped: 0, errors: 0, deferred: 0 };
|
|
23610
24221
|
}
|
|
23611
24222
|
let uploaded = 0;
|
|
23612
24223
|
let skipped = 0;
|
|
@@ -23614,11 +24225,16 @@ async function collectLocked(options) {
|
|
|
23614
24225
|
let deferred = 0;
|
|
23615
24226
|
const remoteMap = options.forceAll ? /* @__PURE__ */ new Map() : await getUploadedSessions(apiUrl2, token);
|
|
23616
24227
|
if (remoteMap === null) {
|
|
23617
|
-
void
|
|
24228
|
+
void logger5.warn("Skipping collection: server inventory unavailable", {
|
|
23618
24229
|
localSessions: localSessions.length,
|
|
23619
24230
|
hint: "re-authenticate with `haansi auth login` if this persists"
|
|
23620
24231
|
});
|
|
23621
|
-
return {
|
|
24232
|
+
return {
|
|
24233
|
+
uploaded: 0,
|
|
24234
|
+
skipped: localSessions.length,
|
|
24235
|
+
errors: 0,
|
|
24236
|
+
deferred: 0
|
|
24237
|
+
};
|
|
23622
24238
|
}
|
|
23623
24239
|
const toUpload = [];
|
|
23624
24240
|
for (const session of localSessions) {
|
|
@@ -23633,7 +24249,7 @@ async function collectLocked(options) {
|
|
|
23633
24249
|
}
|
|
23634
24250
|
const batch = options.limit ? toUpload.slice(0, options.limit) : toUpload;
|
|
23635
24251
|
skipped += toUpload.length - batch.length;
|
|
23636
|
-
|
|
24252
|
+
logger5.info(
|
|
23637
24253
|
`Uploading ${batch.length} session(s), skipping ${skipped} unchanged`
|
|
23638
24254
|
);
|
|
23639
24255
|
for (const session of batch) {
|
|
@@ -23660,7 +24276,7 @@ async function collectLocked(options) {
|
|
|
23660
24276
|
session.gitBranch ?? void 0
|
|
23661
24277
|
);
|
|
23662
24278
|
} else {
|
|
23663
|
-
|
|
24279
|
+
logger5.warn("Git metadata skipped \u2014 no cwd resolved for session", {
|
|
23664
24280
|
sessionId: shortId,
|
|
23665
24281
|
agentSource: session.agentId
|
|
23666
24282
|
});
|
|
@@ -23675,7 +24291,7 @@ async function collectLocked(options) {
|
|
|
23675
24291
|
normalizeLocalPathsForUpload(rawContent, gitInfo.gitRoot)
|
|
23676
24292
|
);
|
|
23677
24293
|
if (options.dryRun) {
|
|
23678
|
-
|
|
24294
|
+
logger5.info(
|
|
23679
24295
|
`[dry-run] Would upload ${shortId} (${session.agentId}, ${session.lineCount} lines)`,
|
|
23680
24296
|
{
|
|
23681
24297
|
agentSource: session.agentId,
|
|
@@ -23696,7 +24312,7 @@ async function collectLocked(options) {
|
|
|
23696
24312
|
gitInfo
|
|
23697
24313
|
);
|
|
23698
24314
|
uploaded++;
|
|
23699
|
-
|
|
24315
|
+
logger5.info(
|
|
23700
24316
|
`Uploaded ${shortId} (${session.agentId}, ${session.lineCount} lines)`,
|
|
23701
24317
|
{
|
|
23702
24318
|
agentSource: session.agentId,
|
|
@@ -23707,22 +24323,22 @@ async function collectLocked(options) {
|
|
|
23707
24323
|
);
|
|
23708
24324
|
} catch (err) {
|
|
23709
24325
|
if (err?.miningDisabled) {
|
|
23710
|
-
void
|
|
24326
|
+
void logger5.info(
|
|
23711
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."
|
|
23712
24328
|
);
|
|
23713
24329
|
break;
|
|
23714
24330
|
}
|
|
23715
24331
|
if (err?.rateLimited) {
|
|
23716
24332
|
deferred++;
|
|
23717
|
-
void
|
|
24333
|
+
void logger5.info(`Rate limited, will retry next run: ${shortId}`);
|
|
23718
24334
|
} else {
|
|
23719
24335
|
errors++;
|
|
23720
|
-
|
|
24336
|
+
logger5.error(`Failed to upload ${shortId}`, { err: err.message });
|
|
23721
24337
|
}
|
|
23722
24338
|
}
|
|
23723
24339
|
}
|
|
23724
24340
|
if (deferred > 0) {
|
|
23725
|
-
void
|
|
24341
|
+
void logger5.info(
|
|
23726
24342
|
`${deferred} session(s) deferred by the upload rate limit \u2014 they remain queued`,
|
|
23727
24343
|
{ deferred, uploaded }
|
|
23728
24344
|
);
|
|
@@ -23734,7 +24350,7 @@ async function main() {
|
|
|
23734
24350
|
const dryRun = process.argv.includes("--dry-run");
|
|
23735
24351
|
const limitIdx = process.argv.indexOf("--limit");
|
|
23736
24352
|
const limit = limitIdx !== -1 ? parseInt(process.argv[limitIdx + 1], 10) : void 0;
|
|
23737
|
-
|
|
24353
|
+
logger5.info("Collector starting", { forceAll, dryRun });
|
|
23738
24354
|
const {
|
|
23739
24355
|
uploaded: _uploaded,
|
|
23740
24356
|
skipped: _skipped,
|
|
@@ -23749,14 +24365,14 @@ async function main() {
|
|
|
23749
24365
|
async function collect(options) {
|
|
23750
24366
|
if (options.dryRun) return collectLocked(options);
|
|
23751
24367
|
const lock = acquireRunLock();
|
|
23752
|
-
if (lock === null) return { uploaded: 0, skipped: 0, errors: 0 };
|
|
24368
|
+
if (lock === null) return { uploaded: 0, skipped: 0, errors: 0, deferred: 0 };
|
|
23753
24369
|
try {
|
|
23754
24370
|
return await collectLocked(options);
|
|
23755
24371
|
} finally {
|
|
23756
24372
|
releaseRunLock(lock);
|
|
23757
24373
|
}
|
|
23758
24374
|
}
|
|
23759
|
-
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;
|
|
23760
24376
|
var init_collector = __esm({
|
|
23761
24377
|
"../service-capture/agent-sessions/collector.ts"() {
|
|
23762
24378
|
"use strict";
|
|
@@ -23768,10 +24384,10 @@ var init_collector = __esm({
|
|
|
23768
24384
|
import_child_process = require("child_process");
|
|
23769
24385
|
init_src2();
|
|
23770
24386
|
init_service_urls();
|
|
23771
|
-
|
|
24387
|
+
init_src7();
|
|
23772
24388
|
init_agents();
|
|
23773
24389
|
(0, import_dotenv.config)({ path: (0, import_path3.resolve)(__dirname, "../../../.env") });
|
|
23774
|
-
|
|
24390
|
+
logger5 = createLogger("session-collector");
|
|
23775
24391
|
DEFAULT_API_URL2 = SERVICE_URL_DEFAULTS.haansiApiBaseUrl;
|
|
23776
24392
|
CREDENTIALS_FILE4 = (0, import_path3.join)((0, import_os3.homedir)(), ".haansi", "credentials.json");
|
|
23777
24393
|
LOCK_FILE = (0, import_path3.join)((0, import_os3.homedir)(), ".haansi", "collector.lock");
|
|
@@ -23825,7 +24441,7 @@ var init_collector = __esm({
|
|
|
23825
24441
|
DEFAULT_RATE_LIMIT_WAIT_MS = 6e4;
|
|
23826
24442
|
if (require.main === module) {
|
|
23827
24443
|
main().catch((err) => {
|
|
23828
|
-
|
|
24444
|
+
logger5.error("Collector failed", err);
|
|
23829
24445
|
process.exit(1);
|
|
23830
24446
|
});
|
|
23831
24447
|
}
|
|
@@ -24734,7 +25350,7 @@ var require_scheduled_task = __commonJS({
|
|
|
24734
25350
|
var require_background_scheduled_task = __commonJS({
|
|
24735
25351
|
"../../node_modules/node-cron/src/background-scheduled-task/index.js"(exports2, module2) {
|
|
24736
25352
|
var EventEmitter = require("events");
|
|
24737
|
-
var
|
|
25353
|
+
var path2 = require("path");
|
|
24738
25354
|
var { fork } = require("child_process");
|
|
24739
25355
|
var uuid3 = (init_esm_node2(), __toCommonJS(esm_node_exports));
|
|
24740
25356
|
var daemonPath = `${__dirname}/daemon.js`;
|
|
@@ -24769,7 +25385,7 @@ var require_background_scheduled_task = __commonJS({
|
|
|
24769
25385
|
options.scheduled = true;
|
|
24770
25386
|
this.forkProcess.send({
|
|
24771
25387
|
type: "register",
|
|
24772
|
-
path:
|
|
25388
|
+
path: path2.resolve(this.taskPath),
|
|
24773
25389
|
cron: this.cronExpression,
|
|
24774
25390
|
options
|
|
24775
25391
|
});
|
|
@@ -24915,7 +25531,7 @@ function getOnDiskVersion() {
|
|
|
24915
25531
|
function trimLog() {
|
|
24916
25532
|
const { rotated, sizeBefore, tailKept } = rotateLogIfLarge(LOG_FILE);
|
|
24917
25533
|
if (rotated) {
|
|
24918
|
-
|
|
25534
|
+
void logger6.info("Rotated daemon log", {
|
|
24919
25535
|
sizeBefore,
|
|
24920
25536
|
tailKept,
|
|
24921
25537
|
previous: `${LOG_FILE}.1`
|
|
@@ -24925,22 +25541,24 @@ function trimLog() {
|
|
|
24925
25541
|
async function run() {
|
|
24926
25542
|
trimLog();
|
|
24927
25543
|
const agents = resolveAgentsEnv();
|
|
24928
|
-
|
|
25544
|
+
void logger6.info("Collect run starting", {
|
|
25545
|
+
agents: agents?.join(",") ?? "all"
|
|
25546
|
+
});
|
|
24929
25547
|
const start = Date.now();
|
|
24930
25548
|
try {
|
|
24931
25549
|
const { uploaded, skipped, errors } = await collect({ agents });
|
|
24932
25550
|
const elapsed = ((Date.now() - start) / 1e3).toFixed(1);
|
|
24933
|
-
|
|
25551
|
+
void logger6.info(`Collect run complete in ${elapsed}s`, {
|
|
24934
25552
|
uploaded,
|
|
24935
25553
|
skipped,
|
|
24936
25554
|
errors
|
|
24937
25555
|
});
|
|
24938
25556
|
} catch (err) {
|
|
24939
|
-
|
|
25557
|
+
void logger6.error("Collect run failed", { err: err.message });
|
|
24940
25558
|
}
|
|
24941
25559
|
}
|
|
24942
25560
|
async function main2() {
|
|
24943
|
-
|
|
25561
|
+
void logger6.info("Collector daemon starting", {
|
|
24944
25562
|
schedule: SCHEDULE,
|
|
24945
25563
|
version: IN_MEMORY_VERSION
|
|
24946
25564
|
});
|
|
@@ -24948,24 +25566,26 @@ async function main2() {
|
|
|
24948
25566
|
import_node_cron.default.schedule(SCHEDULE, async () => {
|
|
24949
25567
|
const diskVersion = getOnDiskVersion();
|
|
24950
25568
|
if (diskVersion && diskVersion !== IN_MEMORY_VERSION) {
|
|
24951
|
-
|
|
25569
|
+
void logger6.info("Version mismatch detected \u2014 restarting", {
|
|
24952
25570
|
inMemory: IN_MEMORY_VERSION,
|
|
24953
25571
|
onDisk: diskVersion
|
|
24954
25572
|
});
|
|
24955
25573
|
process.exit(0);
|
|
24956
25574
|
}
|
|
24957
|
-
|
|
25575
|
+
void logger6.info("Scheduled collect run triggered");
|
|
24958
25576
|
await run();
|
|
24959
25577
|
});
|
|
24960
|
-
|
|
25578
|
+
void logger6.info(
|
|
25579
|
+
`Daemon running. Next run scheduled per cron: "${SCHEDULE}"`
|
|
25580
|
+
);
|
|
24961
25581
|
const shutdown = async (signal) => {
|
|
24962
|
-
|
|
25582
|
+
void logger6.info(`Received ${signal}, shutting down`);
|
|
24963
25583
|
process.exit(0);
|
|
24964
25584
|
};
|
|
24965
25585
|
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
24966
25586
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
24967
25587
|
}
|
|
24968
|
-
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;
|
|
24969
25589
|
var init_collector_daemon = __esm({
|
|
24970
25590
|
"../service-capture/agent-sessions/collector-daemon.ts"() {
|
|
24971
25591
|
"use strict";
|
|
@@ -24978,13 +25598,13 @@ var init_collector_daemon = __esm({
|
|
|
24978
25598
|
init_src2();
|
|
24979
25599
|
init_log_rotation();
|
|
24980
25600
|
(0, import_dotenv2.config)({ path: (0, import_path4.resolve)(__dirname, "../../../.env") });
|
|
24981
|
-
|
|
25601
|
+
logger6 = createLogger("collector-daemon");
|
|
24982
25602
|
IN_MEMORY_VERSION = // eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
24983
25603
|
require_package().version;
|
|
24984
25604
|
SCHEDULE = process.env.HAANSI_COLLECT_SCHEDULE ?? process.env.CLAUDE_COLLECT_SCHEDULE ?? "*/30 * * * *";
|
|
24985
25605
|
LOG_FILE = (0, import_path4.join)((0, import_os4.homedir)(), ".haansi", "daemon.log");
|
|
24986
25606
|
main2().catch((err) => {
|
|
24987
|
-
|
|
25607
|
+
void logger6.error("Daemon failed to start", err);
|
|
24988
25608
|
process.exit(1);
|
|
24989
25609
|
});
|
|
24990
25610
|
}
|
|
@@ -25006,246 +25626,6 @@ var init_http_timeout = __esm({
|
|
|
25006
25626
|
}
|
|
25007
25627
|
});
|
|
25008
25628
|
|
|
25009
|
-
// ../../packages/@company/types/src/timeline.ts
|
|
25010
|
-
var init_timeline = __esm({
|
|
25011
|
-
"../../packages/@company/types/src/timeline.ts"() {
|
|
25012
|
-
"use strict";
|
|
25013
|
-
}
|
|
25014
|
-
});
|
|
25015
|
-
|
|
25016
|
-
// ../../packages/@company/types/src/artifact.ts
|
|
25017
|
-
var init_artifact = __esm({
|
|
25018
|
-
"../../packages/@company/types/src/artifact.ts"() {
|
|
25019
|
-
"use strict";
|
|
25020
|
-
}
|
|
25021
|
-
});
|
|
25022
|
-
|
|
25023
|
-
// ../../packages/@company/types/src/taxonomy.ts
|
|
25024
|
-
function normalizeSessionType(raw) {
|
|
25025
|
-
if (!raw) return "general";
|
|
25026
|
-
const lower = raw.toLowerCase().trim();
|
|
25027
|
-
if (lower in SESSION_TYPES) return lower;
|
|
25028
|
-
if (lower in SESSION_TYPE_ALIASES) return SESSION_TYPE_ALIASES[lower];
|
|
25029
|
-
return "general";
|
|
25030
|
-
}
|
|
25031
|
-
function normalizeComplexity(raw) {
|
|
25032
|
-
if (!raw) return "moderate";
|
|
25033
|
-
const lower = raw.toLowerCase().trim();
|
|
25034
|
-
if (lower in COMPLEXITIES) return lower;
|
|
25035
|
-
return "moderate";
|
|
25036
|
-
}
|
|
25037
|
-
var SESSION_TYPES, SESSION_TYPE_ALIASES, COMPLEXITIES, ARTIFACT_TYPES, __seenAliases, ALIAS_REVERSE_MAP, ARTIFACT_TYPE_IDS, AUTO_APPROVED_ARTIFACT_TYPES;
|
|
25038
|
-
var init_taxonomy = __esm({
|
|
25039
|
-
"../../packages/@company/types/src/taxonomy.ts"() {
|
|
25040
|
-
"use strict";
|
|
25041
|
-
SESSION_TYPES = {
|
|
25042
|
-
debugging: {
|
|
25043
|
-
label: "Debugging",
|
|
25044
|
-
description: "Investigating and fixing bugs or errors"
|
|
25045
|
-
},
|
|
25046
|
-
feature_implementation: {
|
|
25047
|
-
label: "Feature Implementation",
|
|
25048
|
-
description: "Building new functionality or features"
|
|
25049
|
-
},
|
|
25050
|
-
code_review: {
|
|
25051
|
-
label: "Code Review",
|
|
25052
|
-
description: "Reviewing code for quality, correctness, or style"
|
|
25053
|
-
},
|
|
25054
|
-
deployment: {
|
|
25055
|
-
label: "Deployment",
|
|
25056
|
-
description: "Deploying, releasing, or provisioning infrastructure"
|
|
25057
|
-
},
|
|
25058
|
-
refactoring: {
|
|
25059
|
-
label: "Refactoring",
|
|
25060
|
-
description: "Restructuring existing code without changing behavior"
|
|
25061
|
-
},
|
|
25062
|
-
configuration: {
|
|
25063
|
-
label: "Configuration",
|
|
25064
|
-
description: "Setting up or modifying project/tool configuration"
|
|
25065
|
-
},
|
|
25066
|
-
question_answer: {
|
|
25067
|
-
label: "Question & Answer",
|
|
25068
|
-
description: "Asking or answering questions about code or systems"
|
|
25069
|
-
},
|
|
25070
|
-
general: {
|
|
25071
|
-
label: "General",
|
|
25072
|
-
description: "General-purpose session not fitting other categories"
|
|
25073
|
-
}
|
|
25074
|
-
};
|
|
25075
|
-
SESSION_TYPE_ALIASES = {
|
|
25076
|
-
bug_fix: "debugging",
|
|
25077
|
-
feature: "feature_implementation",
|
|
25078
|
-
refactor: "refactoring",
|
|
25079
|
-
config: "configuration"
|
|
25080
|
-
};
|
|
25081
|
-
COMPLEXITIES = {
|
|
25082
|
-
simple: {
|
|
25083
|
-
label: "Simple",
|
|
25084
|
-
description: "Straightforward task with few steps"
|
|
25085
|
-
},
|
|
25086
|
-
moderate: {
|
|
25087
|
-
label: "Moderate",
|
|
25088
|
-
description: "Multi-step task requiring some investigation"
|
|
25089
|
-
},
|
|
25090
|
-
complex: {
|
|
25091
|
-
label: "Complex",
|
|
25092
|
-
description: "Involved task with many steps or deep analysis"
|
|
25093
|
-
}
|
|
25094
|
-
};
|
|
25095
|
-
ARTIFACT_TYPES = {
|
|
25096
|
-
report_incident: {
|
|
25097
|
-
category: "report",
|
|
25098
|
-
label: "Incident Report",
|
|
25099
|
-
description: "Production-incident record + post-incident writeup: detection, timeline, root cause, resolution, follow-ups.",
|
|
25100
|
-
icon: "AlertTriangle",
|
|
25101
|
-
aliases: ["incident_summary", "incident", "postmortem", "post-mortem"],
|
|
25102
|
-
autoApproved: false,
|
|
25103
|
-
producedBy: [
|
|
25104
|
-
"POST /api/v1/memory/processes/incidents",
|
|
25105
|
-
"POST /api/v1/memory/reports/incident",
|
|
25106
|
-
"POST /api/v1/memory/processes/incidents/:id/postmortem"
|
|
25107
|
-
]
|
|
25108
|
-
},
|
|
25109
|
-
report_decision: {
|
|
25110
|
-
category: "report",
|
|
25111
|
-
label: "Decision Record",
|
|
25112
|
-
description: "Architectural / product decision record with context, options considered, decision, and rationale.",
|
|
25113
|
-
icon: "Scale",
|
|
25114
|
-
aliases: ["decision_record", "decision-record", "adr"],
|
|
25115
|
-
autoApproved: false,
|
|
25116
|
-
producedBy: ["POST /api/v1/memory"]
|
|
25117
|
-
},
|
|
25118
|
-
report_work: {
|
|
25119
|
-
category: "report",
|
|
25120
|
-
label: "Work Report",
|
|
25121
|
-
description: "Periodic or one-off work-progress report \u2014 status updates, weekly digests, project rollups, team-activity summaries.",
|
|
25122
|
-
icon: "CalendarDays",
|
|
25123
|
-
aliases: ["weekly_digest", "weekly-digest", "status_report"],
|
|
25124
|
-
autoApproved: true,
|
|
25125
|
-
producedBy: ["POST /api/v1/memory", "POST /api/v1/memory/reports/work"]
|
|
25126
|
-
},
|
|
25127
|
-
report_sop: {
|
|
25128
|
-
category: "report",
|
|
25129
|
-
label: "Standard Operating Procedure",
|
|
25130
|
-
description: "Reusable step-by-step procedure or runbook. Placeholder \u2014 surface not yet specialized; written via generic POST /memory until a dedicated producer ships.",
|
|
25131
|
-
icon: "FileText",
|
|
25132
|
-
aliases: ["sop", "runbook"],
|
|
25133
|
-
autoApproved: false,
|
|
25134
|
-
producedBy: ["POST /api/v1/memory"]
|
|
25135
|
-
},
|
|
25136
|
-
report_onboarding: {
|
|
25137
|
-
category: "report",
|
|
25138
|
-
label: "Onboarding Packet",
|
|
25139
|
-
description: "Onboarding guide assembled from team knowledge, scoped to a project or role.",
|
|
25140
|
-
icon: "GraduationCap",
|
|
25141
|
-
aliases: ["onboarding_packet", "onboarding-packet"],
|
|
25142
|
-
autoApproved: false,
|
|
25143
|
-
producedBy: ["POST /api/v1/memory/reports/onboarding"]
|
|
25144
|
-
},
|
|
25145
|
-
report_pr: {
|
|
25146
|
-
category: "report",
|
|
25147
|
-
label: "PR Context",
|
|
25148
|
-
description: "Enriched pull-request description with linked Jira/Slack context, recent decisions, and reviewer hints.",
|
|
25149
|
-
icon: "GitPullRequest",
|
|
25150
|
-
aliases: ["pr_context", "pr-context"],
|
|
25151
|
-
autoApproved: true,
|
|
25152
|
-
producedBy: ["POST /api/v1/memory/reports/pr"]
|
|
25153
|
-
},
|
|
25154
|
-
expert: {
|
|
25155
|
-
category: "expert",
|
|
25156
|
-
label: "Expert Profile",
|
|
25157
|
-
description: "Per-person expertise profile across platforms \u2014 areas of focus, recent contributions, identity links.",
|
|
25158
|
-
icon: "Users",
|
|
25159
|
-
aliases: ["expert_profile", "expert-profile"],
|
|
25160
|
-
autoApproved: false,
|
|
25161
|
-
producedBy: ["POST /api/v1/memory/experts"]
|
|
25162
|
-
},
|
|
25163
|
-
solution_mined: {
|
|
25164
|
-
category: "solution",
|
|
25165
|
-
label: "Mined Solution",
|
|
25166
|
-
description: "Problem + solution mined automatically from a developer coding session (the distilled-path pipeline).",
|
|
25167
|
-
icon: "Lightbulb",
|
|
25168
|
-
aliases: ["solution", "mined_solution", "distilled_path"],
|
|
25169
|
-
autoApproved: true,
|
|
25170
|
-
producedBy: ["POST /api/v1/memory/solutions/mined"]
|
|
25171
|
-
},
|
|
25172
|
-
solution_qna: {
|
|
25173
|
-
category: "solution",
|
|
25174
|
-
label: "Q&A Solution",
|
|
25175
|
-
description: "Q&A answer marked verified by a user and distilled into reusable knowledge \u2014 promoted out of a conversation thread.",
|
|
25176
|
-
icon: "ThumbsUp",
|
|
25177
|
-
aliases: ["verified_answer", "verified-answer"],
|
|
25178
|
-
autoApproved: true,
|
|
25179
|
-
producedBy: ["POST /api/v1/memory/recall/messages/:id/feedback"]
|
|
25180
|
-
}
|
|
25181
|
-
};
|
|
25182
|
-
__seenAliases = /* @__PURE__ */ new Set();
|
|
25183
|
-
for (const [id, meta3] of Object.entries(ARTIFACT_TYPES)) {
|
|
25184
|
-
for (const a of meta3.aliases) {
|
|
25185
|
-
if (__seenAliases.has(a)) {
|
|
25186
|
-
throw new Error(
|
|
25187
|
-
`[taxonomy] alias "${a}" declared on multiple artifact types; last seen on "${id}"`
|
|
25188
|
-
);
|
|
25189
|
-
}
|
|
25190
|
-
__seenAliases.add(a);
|
|
25191
|
-
}
|
|
25192
|
-
}
|
|
25193
|
-
ALIAS_REVERSE_MAP = Object.freeze(
|
|
25194
|
-
Object.fromEntries(
|
|
25195
|
-
Object.entries(ARTIFACT_TYPES).flatMap(
|
|
25196
|
-
([id, meta3]) => meta3.aliases.map((a) => [a, id])
|
|
25197
|
-
)
|
|
25198
|
-
)
|
|
25199
|
-
);
|
|
25200
|
-
ARTIFACT_TYPE_IDS = Object.keys(
|
|
25201
|
-
ARTIFACT_TYPES
|
|
25202
|
-
);
|
|
25203
|
-
AUTO_APPROVED_ARTIFACT_TYPES = ARTIFACT_TYPE_IDS.filter((id) => ARTIFACT_TYPES[id].autoApproved);
|
|
25204
|
-
}
|
|
25205
|
-
});
|
|
25206
|
-
|
|
25207
|
-
// ../../packages/@company/types/src/embedding.ts
|
|
25208
|
-
var EMBEDDING_DEFAULTS, EMBEDDING_COLUMN, SUMMARY_EMBEDDING_COLUMN;
|
|
25209
|
-
var init_embedding = __esm({
|
|
25210
|
-
"../../packages/@company/types/src/embedding.ts"() {
|
|
25211
|
-
"use strict";
|
|
25212
|
-
EMBEDDING_DEFAULTS = {
|
|
25213
|
-
// `as const` gives a literal string type for the provider field, which
|
|
25214
|
-
// is assignable to llm-client's LLMProvider union without forcing
|
|
25215
|
-
// @company/types to import that union (which would re-introduce the
|
|
25216
|
-
// dependency edge we want to keep absent).
|
|
25217
|
-
// CUTOVER (2026-07-17): in-house model is now the active config. Reads +
|
|
25218
|
-
// writes + backfills all target the local-768 columns. The old OpenAI 1536
|
|
25219
|
-
// columns (`embedding` / `summary_embedding`) are retained but dormant —
|
|
25220
|
-
// roll back by flipping this whole object back to
|
|
25221
|
-
// { provider:"openai", model:"text-embedding-3-small", dimensions:1536,
|
|
25222
|
-
// column:"embedding", summaryColumn:"summary_embedding" }
|
|
25223
|
-
// (a later contract migration drops the dormant columns). Readers alias
|
|
25224
|
-
// `<column> AS embedding` so result-row field names stay stable.
|
|
25225
|
-
provider: "local",
|
|
25226
|
-
model: "Alibaba-NLP/gte-base-en-v1.5",
|
|
25227
|
-
dimensions: 768,
|
|
25228
|
-
// The ACTIVE dense-vector column that every reader + writer + backfill targets.
|
|
25229
|
-
column: "embedding_v2",
|
|
25230
|
-
// The active summary-embedding column (process_registry's second vector,
|
|
25231
|
-
// used by the process matcher).
|
|
25232
|
-
summaryColumn: "summary_embedding_v2"
|
|
25233
|
-
};
|
|
25234
|
-
EMBEDDING_COLUMN = EMBEDDING_DEFAULTS.column;
|
|
25235
|
-
SUMMARY_EMBEDDING_COLUMN = EMBEDDING_DEFAULTS.summaryColumn;
|
|
25236
|
-
}
|
|
25237
|
-
});
|
|
25238
|
-
|
|
25239
|
-
// ../../packages/@company/types/src/index.ts
|
|
25240
|
-
var init_src7 = __esm({
|
|
25241
|
-
"../../packages/@company/types/src/index.ts"() {
|
|
25242
|
-
init_timeline();
|
|
25243
|
-
init_artifact();
|
|
25244
|
-
init_taxonomy();
|
|
25245
|
-
init_embedding();
|
|
25246
|
-
}
|
|
25247
|
-
});
|
|
25248
|
-
|
|
25249
25629
|
// ../../node_modules/zod/v3/helpers/util.js
|
|
25250
25630
|
var util, objectUtil, ZodParsedType, getParsedType;
|
|
25251
25631
|
var init_util = __esm({
|
|
@@ -25651,8 +26031,8 @@ var init_parseUtil = __esm({
|
|
|
25651
26031
|
init_errors();
|
|
25652
26032
|
init_en();
|
|
25653
26033
|
makeIssue = (params) => {
|
|
25654
|
-
const { data, path:
|
|
25655
|
-
const fullPath = [...
|
|
26034
|
+
const { data, path: path2, errorMaps, issueData } = params;
|
|
26035
|
+
const fullPath = [...path2, ...issueData.path || []];
|
|
25656
26036
|
const fullIssue = {
|
|
25657
26037
|
...issueData,
|
|
25658
26038
|
path: fullPath
|
|
@@ -25932,11 +26312,11 @@ var init_types3 = __esm({
|
|
|
25932
26312
|
init_parseUtil();
|
|
25933
26313
|
init_util();
|
|
25934
26314
|
ParseInputLazyPath = class {
|
|
25935
|
-
constructor(parent, value,
|
|
26315
|
+
constructor(parent, value, path2, key) {
|
|
25936
26316
|
this._cachedPath = [];
|
|
25937
26317
|
this.parent = parent;
|
|
25938
26318
|
this.data = value;
|
|
25939
|
-
this._path =
|
|
26319
|
+
this._path = path2;
|
|
25940
26320
|
this._key = key;
|
|
25941
26321
|
}
|
|
25942
26322
|
get path() {
|
|
@@ -29442,10 +29822,10 @@ function mergeDefs(...defs) {
|
|
|
29442
29822
|
function cloneDef(schema) {
|
|
29443
29823
|
return mergeDefs(schema._zod.def);
|
|
29444
29824
|
}
|
|
29445
|
-
function getElementAtPath(obj,
|
|
29446
|
-
if (!
|
|
29825
|
+
function getElementAtPath(obj, path2) {
|
|
29826
|
+
if (!path2)
|
|
29447
29827
|
return obj;
|
|
29448
|
-
return
|
|
29828
|
+
return path2.reduce((acc, key) => acc?.[key], obj);
|
|
29449
29829
|
}
|
|
29450
29830
|
function promiseAllObject(promisesObj) {
|
|
29451
29831
|
const keys = Object.keys(promisesObj);
|
|
@@ -29757,11 +30137,11 @@ function aborted(x, startIndex = 0) {
|
|
|
29757
30137
|
}
|
|
29758
30138
|
return false;
|
|
29759
30139
|
}
|
|
29760
|
-
function prefixIssues(
|
|
30140
|
+
function prefixIssues(path2, issues) {
|
|
29761
30141
|
return issues.map((iss) => {
|
|
29762
30142
|
var _a2;
|
|
29763
30143
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
29764
|
-
iss.path.unshift(
|
|
30144
|
+
iss.path.unshift(path2);
|
|
29765
30145
|
return iss;
|
|
29766
30146
|
});
|
|
29767
30147
|
}
|
|
@@ -44251,8 +44631,8 @@ var require_utils5 = __commonJS({
|
|
|
44251
44631
|
}
|
|
44252
44632
|
return ind;
|
|
44253
44633
|
}
|
|
44254
|
-
function removeDotSegments(
|
|
44255
|
-
let input =
|
|
44634
|
+
function removeDotSegments(path2) {
|
|
44635
|
+
let input = path2;
|
|
44256
44636
|
const output = [];
|
|
44257
44637
|
let nextSlash = -1;
|
|
44258
44638
|
let len = 0;
|
|
@@ -44451,8 +44831,8 @@ var require_schemes = __commonJS({
|
|
|
44451
44831
|
wsComponent.secure = void 0;
|
|
44452
44832
|
}
|
|
44453
44833
|
if (wsComponent.resourceName) {
|
|
44454
|
-
const [
|
|
44455
|
-
wsComponent.path =
|
|
44834
|
+
const [path2, query] = wsComponent.resourceName.split("?");
|
|
44835
|
+
wsComponent.path = path2 && path2 !== "/" ? path2 : void 0;
|
|
44456
44836
|
wsComponent.query = query;
|
|
44457
44837
|
wsComponent.resourceName = void 0;
|
|
44458
44838
|
}
|
|
@@ -45393,13 +45773,13 @@ var require_core = __commonJS({
|
|
|
45393
45773
|
}, warn() {
|
|
45394
45774
|
}, error() {
|
|
45395
45775
|
} };
|
|
45396
|
-
function getLogger(
|
|
45397
|
-
if (
|
|
45776
|
+
function getLogger(logger7) {
|
|
45777
|
+
if (logger7 === false)
|
|
45398
45778
|
return noLogs;
|
|
45399
|
-
if (
|
|
45779
|
+
if (logger7 === void 0)
|
|
45400
45780
|
return console;
|
|
45401
|
-
if (
|
|
45402
|
-
return
|
|
45781
|
+
if (logger7.log && logger7.warn && logger7.error)
|
|
45782
|
+
return logger7;
|
|
45403
45783
|
throw new Error("logger must implement log, warn and error methods");
|
|
45404
45784
|
}
|
|
45405
45785
|
var KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
@@ -51291,13 +51671,13 @@ var require_core3 = __commonJS({
|
|
|
51291
51671
|
}, warn() {
|
|
51292
51672
|
}, error() {
|
|
51293
51673
|
} };
|
|
51294
|
-
function getLogger(
|
|
51295
|
-
if (
|
|
51674
|
+
function getLogger(logger7) {
|
|
51675
|
+
if (logger7 === false)
|
|
51296
51676
|
return noLogs;
|
|
51297
|
-
if (
|
|
51677
|
+
if (logger7 === void 0)
|
|
51298
51678
|
return console;
|
|
51299
|
-
if (
|
|
51300
|
-
return
|
|
51679
|
+
if (logger7.log && logger7.warn && logger7.error)
|
|
51680
|
+
return logger7;
|
|
51301
51681
|
throw new Error("logger must implement log, warn and error methods");
|
|
51302
51682
|
}
|
|
51303
51683
|
var KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
@@ -69619,11 +69999,11 @@ var require_mime_types = __commonJS({
|
|
|
69619
69999
|
}
|
|
69620
70000
|
return exts[0];
|
|
69621
70001
|
}
|
|
69622
|
-
function lookup(
|
|
69623
|
-
if (!
|
|
70002
|
+
function lookup(path2) {
|
|
70003
|
+
if (!path2 || typeof path2 !== "string") {
|
|
69624
70004
|
return false;
|
|
69625
70005
|
}
|
|
69626
|
-
var extension2 = extname("x." +
|
|
70006
|
+
var extension2 = extname("x." + path2).toLowerCase().slice(1);
|
|
69627
70007
|
if (!extension2) {
|
|
69628
70008
|
return false;
|
|
69629
70009
|
}
|
|
@@ -73061,13 +73441,13 @@ var require_view = __commonJS({
|
|
|
73061
73441
|
"../service-capture/node_modules/express/lib/view.js"(exports2, module2) {
|
|
73062
73442
|
"use strict";
|
|
73063
73443
|
var debug = require_src()("express:view");
|
|
73064
|
-
var
|
|
73444
|
+
var path2 = require("node:path");
|
|
73065
73445
|
var fs = require("node:fs");
|
|
73066
|
-
var dirname3 =
|
|
73067
|
-
var basename4 =
|
|
73068
|
-
var extname =
|
|
73069
|
-
var
|
|
73070
|
-
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;
|
|
73071
73451
|
module2.exports = View;
|
|
73072
73452
|
function View(name, options) {
|
|
73073
73453
|
var opts = options || {};
|
|
@@ -73096,17 +73476,17 @@ var require_view = __commonJS({
|
|
|
73096
73476
|
this.path = this.lookup(fileName);
|
|
73097
73477
|
}
|
|
73098
73478
|
View.prototype.lookup = function lookup(name) {
|
|
73099
|
-
var
|
|
73479
|
+
var path3;
|
|
73100
73480
|
var roots = [].concat(this.root);
|
|
73101
73481
|
debug('lookup "%s"', name);
|
|
73102
|
-
for (var i = 0; i < roots.length && !
|
|
73482
|
+
for (var i = 0; i < roots.length && !path3; i++) {
|
|
73103
73483
|
var root = roots[i];
|
|
73104
73484
|
var loc = resolve4(root, name);
|
|
73105
73485
|
var dir = dirname3(loc);
|
|
73106
73486
|
var file2 = basename4(loc);
|
|
73107
|
-
|
|
73487
|
+
path3 = this.resolve(dir, file2);
|
|
73108
73488
|
}
|
|
73109
|
-
return
|
|
73489
|
+
return path3;
|
|
73110
73490
|
};
|
|
73111
73491
|
View.prototype.render = function render(options, callback) {
|
|
73112
73492
|
var sync = true;
|
|
@@ -73128,21 +73508,21 @@ var require_view = __commonJS({
|
|
|
73128
73508
|
};
|
|
73129
73509
|
View.prototype.resolve = function resolve5(dir, file2) {
|
|
73130
73510
|
var ext = this.ext;
|
|
73131
|
-
var
|
|
73132
|
-
var stat = tryStat(
|
|
73511
|
+
var path3 = join14(dir, file2);
|
|
73512
|
+
var stat = tryStat(path3);
|
|
73133
73513
|
if (stat && stat.isFile()) {
|
|
73134
|
-
return
|
|
73514
|
+
return path3;
|
|
73135
73515
|
}
|
|
73136
|
-
|
|
73137
|
-
stat = tryStat(
|
|
73516
|
+
path3 = join14(dir, basename4(file2, ext), "index" + ext);
|
|
73517
|
+
stat = tryStat(path3);
|
|
73138
73518
|
if (stat && stat.isFile()) {
|
|
73139
|
-
return
|
|
73519
|
+
return path3;
|
|
73140
73520
|
}
|
|
73141
73521
|
};
|
|
73142
|
-
function tryStat(
|
|
73143
|
-
debug('stat "%s"',
|
|
73522
|
+
function tryStat(path3) {
|
|
73523
|
+
debug('stat "%s"', path3);
|
|
73144
73524
|
try {
|
|
73145
|
-
return fs.statSync(
|
|
73525
|
+
return fs.statSync(path3);
|
|
73146
73526
|
} catch (e) {
|
|
73147
73527
|
return void 0;
|
|
73148
73528
|
}
|
|
@@ -74340,15 +74720,15 @@ var require_dist3 = __commonJS({
|
|
|
74340
74720
|
if (token.type === endType)
|
|
74341
74721
|
break;
|
|
74342
74722
|
if (token.type === "char" || token.type === "escape") {
|
|
74343
|
-
let
|
|
74723
|
+
let path2 = token.value;
|
|
74344
74724
|
let cur = tokens[pos];
|
|
74345
74725
|
while (cur.type === "char" || cur.type === "escape") {
|
|
74346
|
-
|
|
74726
|
+
path2 += cur.value;
|
|
74347
74727
|
cur = tokens[++pos];
|
|
74348
74728
|
}
|
|
74349
74729
|
output.push({
|
|
74350
74730
|
type: "text",
|
|
74351
|
-
value: encodePath(
|
|
74731
|
+
value: encodePath(path2)
|
|
74352
74732
|
});
|
|
74353
74733
|
continue;
|
|
74354
74734
|
}
|
|
@@ -74372,16 +74752,16 @@ var require_dist3 = __commonJS({
|
|
|
74372
74752
|
}
|
|
74373
74753
|
return new TokenData(consumeUntil("end"), str);
|
|
74374
74754
|
}
|
|
74375
|
-
function compile(
|
|
74755
|
+
function compile(path2, options = {}) {
|
|
74376
74756
|
const { encode: encode3 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
74377
|
-
const data = typeof
|
|
74757
|
+
const data = typeof path2 === "object" ? path2 : parse4(path2, options);
|
|
74378
74758
|
const fn = tokensToFunction(data.tokens, delimiter, encode3);
|
|
74379
|
-
return function
|
|
74380
|
-
const [
|
|
74759
|
+
return function path3(params = {}) {
|
|
74760
|
+
const [path4, ...missing] = fn(params);
|
|
74381
74761
|
if (missing.length) {
|
|
74382
74762
|
throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
|
|
74383
74763
|
}
|
|
74384
|
-
return
|
|
74764
|
+
return path4;
|
|
74385
74765
|
};
|
|
74386
74766
|
}
|
|
74387
74767
|
function tokensToFunction(tokens, delimiter, encode3) {
|
|
@@ -74437,9 +74817,9 @@ var require_dist3 = __commonJS({
|
|
|
74437
74817
|
return [encodeValue(value)];
|
|
74438
74818
|
};
|
|
74439
74819
|
}
|
|
74440
|
-
function match(
|
|
74820
|
+
function match(path2, options = {}) {
|
|
74441
74821
|
const { decode: decode3 = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
74442
|
-
const { regexp, keys } = pathToRegexp(
|
|
74822
|
+
const { regexp, keys } = pathToRegexp(path2, options);
|
|
74443
74823
|
const decoders = keys.map((key) => {
|
|
74444
74824
|
if (decode3 === false)
|
|
74445
74825
|
return NOOP_VALUE;
|
|
@@ -74451,7 +74831,7 @@ var require_dist3 = __commonJS({
|
|
|
74451
74831
|
const m = regexp.exec(input);
|
|
74452
74832
|
if (!m)
|
|
74453
74833
|
return false;
|
|
74454
|
-
const
|
|
74834
|
+
const path3 = m[0];
|
|
74455
74835
|
const params = /* @__PURE__ */ Object.create(null);
|
|
74456
74836
|
for (let i = 1; i < m.length; i++) {
|
|
74457
74837
|
if (m[i] === void 0)
|
|
@@ -74460,15 +74840,15 @@ var require_dist3 = __commonJS({
|
|
|
74460
74840
|
const decoder = decoders[i - 1];
|
|
74461
74841
|
params[key.name] = decoder(m[i]);
|
|
74462
74842
|
}
|
|
74463
|
-
return { path:
|
|
74843
|
+
return { path: path3, params };
|
|
74464
74844
|
};
|
|
74465
74845
|
}
|
|
74466
|
-
function pathToRegexp(
|
|
74846
|
+
function pathToRegexp(path2, options = {}) {
|
|
74467
74847
|
const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
|
|
74468
74848
|
const keys = [];
|
|
74469
74849
|
const flags = sensitive ? "" : "i";
|
|
74470
74850
|
const sources = [];
|
|
74471
|
-
for (const input of pathsToArray(
|
|
74851
|
+
for (const input of pathsToArray(path2, [])) {
|
|
74472
74852
|
const data = typeof input === "object" ? input : parse4(input, options);
|
|
74473
74853
|
for (const tokens of flatten(data.tokens, 0, [])) {
|
|
74474
74854
|
sources.push(toRegExpSource(tokens, delimiter, keys, data.originalPath));
|
|
@@ -74598,18 +74978,18 @@ var require_layer = __commonJS({
|
|
|
74598
74978
|
var TRAILING_SLASH_REGEXP = /\/+$/;
|
|
74599
74979
|
var MATCHING_GROUP_REGEXP = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
74600
74980
|
module2.exports = Layer;
|
|
74601
|
-
function Layer(
|
|
74981
|
+
function Layer(path2, options, fn) {
|
|
74602
74982
|
if (!(this instanceof Layer)) {
|
|
74603
|
-
return new Layer(
|
|
74983
|
+
return new Layer(path2, options, fn);
|
|
74604
74984
|
}
|
|
74605
|
-
debug("new %o",
|
|
74985
|
+
debug("new %o", path2);
|
|
74606
74986
|
const opts = options || {};
|
|
74607
74987
|
this.handle = fn;
|
|
74608
74988
|
this.keys = [];
|
|
74609
74989
|
this.name = fn.name || "<anonymous>";
|
|
74610
74990
|
this.params = void 0;
|
|
74611
74991
|
this.path = void 0;
|
|
74612
|
-
this.slash =
|
|
74992
|
+
this.slash = path2 === "/" && opts.end === false;
|
|
74613
74993
|
function matcher(_path) {
|
|
74614
74994
|
if (_path instanceof RegExp) {
|
|
74615
74995
|
const keys = [];
|
|
@@ -74648,7 +75028,7 @@ var require_layer = __commonJS({
|
|
|
74648
75028
|
decode: decodeParam
|
|
74649
75029
|
});
|
|
74650
75030
|
}
|
|
74651
|
-
this.matchers = Array.isArray(
|
|
75031
|
+
this.matchers = Array.isArray(path2) ? path2.map(matcher) : [matcher(path2)];
|
|
74652
75032
|
}
|
|
74653
75033
|
Layer.prototype.handleError = function handleError(error2, req, res, next) {
|
|
74654
75034
|
const fn = this.handle;
|
|
@@ -74688,9 +75068,9 @@ var require_layer = __commonJS({
|
|
|
74688
75068
|
next(err);
|
|
74689
75069
|
}
|
|
74690
75070
|
};
|
|
74691
|
-
Layer.prototype.match = function match(
|
|
75071
|
+
Layer.prototype.match = function match(path2) {
|
|
74692
75072
|
let match2;
|
|
74693
|
-
if (
|
|
75073
|
+
if (path2 != null) {
|
|
74694
75074
|
if (this.slash) {
|
|
74695
75075
|
this.params = {};
|
|
74696
75076
|
this.path = "";
|
|
@@ -74698,7 +75078,7 @@ var require_layer = __commonJS({
|
|
|
74698
75078
|
}
|
|
74699
75079
|
let i = 0;
|
|
74700
75080
|
while (!match2 && i < this.matchers.length) {
|
|
74701
|
-
match2 = this.matchers[i](
|
|
75081
|
+
match2 = this.matchers[i](path2);
|
|
74702
75082
|
i++;
|
|
74703
75083
|
}
|
|
74704
75084
|
}
|
|
@@ -74726,13 +75106,13 @@ var require_layer = __commonJS({
|
|
|
74726
75106
|
throw err;
|
|
74727
75107
|
}
|
|
74728
75108
|
}
|
|
74729
|
-
function loosen(
|
|
74730
|
-
if (
|
|
74731
|
-
return
|
|
75109
|
+
function loosen(path2) {
|
|
75110
|
+
if (path2 instanceof RegExp || path2 === "/") {
|
|
75111
|
+
return path2;
|
|
74732
75112
|
}
|
|
74733
|
-
return Array.isArray(
|
|
75113
|
+
return Array.isArray(path2) ? path2.map(function(p) {
|
|
74734
75114
|
return loosen(p);
|
|
74735
|
-
}) : String(
|
|
75115
|
+
}) : String(path2).replace(TRAILING_SLASH_REGEXP, "");
|
|
74736
75116
|
}
|
|
74737
75117
|
}
|
|
74738
75118
|
});
|
|
@@ -74748,9 +75128,9 @@ var require_route = __commonJS({
|
|
|
74748
75128
|
var flatten = Array.prototype.flat;
|
|
74749
75129
|
var methods = METHODS.map((method) => method.toLowerCase());
|
|
74750
75130
|
module2.exports = Route;
|
|
74751
|
-
function Route(
|
|
74752
|
-
debug("new %o",
|
|
74753
|
-
this.path =
|
|
75131
|
+
function Route(path2) {
|
|
75132
|
+
debug("new %o", path2);
|
|
75133
|
+
this.path = path2;
|
|
74754
75134
|
this.stack = [];
|
|
74755
75135
|
this.methods = /* @__PURE__ */ Object.create(null);
|
|
74756
75136
|
}
|
|
@@ -74958,8 +75338,8 @@ var require_router = __commonJS({
|
|
|
74958
75338
|
if (++sync > 100) {
|
|
74959
75339
|
return setImmediate(next, err);
|
|
74960
75340
|
}
|
|
74961
|
-
const
|
|
74962
|
-
if (
|
|
75341
|
+
const path2 = getPathname(req);
|
|
75342
|
+
if (path2 == null) {
|
|
74963
75343
|
return done(layerError);
|
|
74964
75344
|
}
|
|
74965
75345
|
let layer;
|
|
@@ -74967,7 +75347,7 @@ var require_router = __commonJS({
|
|
|
74967
75347
|
let route;
|
|
74968
75348
|
while (match !== true && idx < stack.length) {
|
|
74969
75349
|
layer = stack[idx++];
|
|
74970
|
-
match = matchLayer(layer,
|
|
75350
|
+
match = matchLayer(layer, path2);
|
|
74971
75351
|
route = layer.route;
|
|
74972
75352
|
if (typeof match !== "boolean") {
|
|
74973
75353
|
layerError = layerError || match;
|
|
@@ -75005,18 +75385,18 @@ var require_router = __commonJS({
|
|
|
75005
75385
|
} else if (route) {
|
|
75006
75386
|
layer.handleRequest(req, res, next);
|
|
75007
75387
|
} else {
|
|
75008
|
-
trimPrefix(layer, layerError, layerPath,
|
|
75388
|
+
trimPrefix(layer, layerError, layerPath, path2);
|
|
75009
75389
|
}
|
|
75010
75390
|
sync = 0;
|
|
75011
75391
|
});
|
|
75012
75392
|
}
|
|
75013
|
-
function trimPrefix(layer, layerError, layerPath,
|
|
75393
|
+
function trimPrefix(layer, layerError, layerPath, path2) {
|
|
75014
75394
|
if (layerPath.length !== 0) {
|
|
75015
|
-
if (layerPath !==
|
|
75395
|
+
if (layerPath !== path2.substring(0, layerPath.length)) {
|
|
75016
75396
|
next(layerError);
|
|
75017
75397
|
return;
|
|
75018
75398
|
}
|
|
75019
|
-
const c =
|
|
75399
|
+
const c = path2[layerPath.length];
|
|
75020
75400
|
if (c && c !== "/") {
|
|
75021
75401
|
next(layerError);
|
|
75022
75402
|
return;
|
|
@@ -75040,7 +75420,7 @@ var require_router = __commonJS({
|
|
|
75040
75420
|
};
|
|
75041
75421
|
Router.prototype.use = function use(handler) {
|
|
75042
75422
|
let offset = 0;
|
|
75043
|
-
let
|
|
75423
|
+
let path2 = "/";
|
|
75044
75424
|
if (typeof handler !== "function") {
|
|
75045
75425
|
let arg = handler;
|
|
75046
75426
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -75048,7 +75428,7 @@ var require_router = __commonJS({
|
|
|
75048
75428
|
}
|
|
75049
75429
|
if (typeof arg !== "function") {
|
|
75050
75430
|
offset = 1;
|
|
75051
|
-
|
|
75431
|
+
path2 = handler;
|
|
75052
75432
|
}
|
|
75053
75433
|
}
|
|
75054
75434
|
const callbacks = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -75060,8 +75440,8 @@ var require_router = __commonJS({
|
|
|
75060
75440
|
if (typeof fn !== "function") {
|
|
75061
75441
|
throw new TypeError("argument handler must be a function");
|
|
75062
75442
|
}
|
|
75063
|
-
debug("use %o %s",
|
|
75064
|
-
const layer = new Layer(
|
|
75443
|
+
debug("use %o %s", path2, fn.name || "<anonymous>");
|
|
75444
|
+
const layer = new Layer(path2, {
|
|
75065
75445
|
sensitive: this.caseSensitive,
|
|
75066
75446
|
strict: false,
|
|
75067
75447
|
end: false
|
|
@@ -75071,9 +75451,9 @@ var require_router = __commonJS({
|
|
|
75071
75451
|
}
|
|
75072
75452
|
return this;
|
|
75073
75453
|
};
|
|
75074
|
-
Router.prototype.route = function route(
|
|
75075
|
-
const route2 = new Route(
|
|
75076
|
-
const layer = new Layer(
|
|
75454
|
+
Router.prototype.route = function route(path2) {
|
|
75455
|
+
const route2 = new Route(path2);
|
|
75456
|
+
const layer = new Layer(path2, {
|
|
75077
75457
|
sensitive: this.caseSensitive,
|
|
75078
75458
|
strict: this.strict,
|
|
75079
75459
|
end: true
|
|
@@ -75086,8 +75466,8 @@ var require_router = __commonJS({
|
|
|
75086
75466
|
return route2;
|
|
75087
75467
|
};
|
|
75088
75468
|
methods.concat("all").forEach(function(method) {
|
|
75089
|
-
Router.prototype[method] = function(
|
|
75090
|
-
const route = this.route(
|
|
75469
|
+
Router.prototype[method] = function(path2) {
|
|
75470
|
+
const route = this.route(path2);
|
|
75091
75471
|
route[method].apply(route, slice.call(arguments, 1));
|
|
75092
75472
|
return this;
|
|
75093
75473
|
};
|
|
@@ -75116,9 +75496,9 @@ var require_router = __commonJS({
|
|
|
75116
75496
|
const fqdnIndex = url2.substring(0, pathLength).indexOf("://");
|
|
75117
75497
|
return fqdnIndex !== -1 ? url2.substring(0, url2.indexOf("/", 3 + fqdnIndex)) : void 0;
|
|
75118
75498
|
}
|
|
75119
|
-
function matchLayer(layer,
|
|
75499
|
+
function matchLayer(layer, path2) {
|
|
75120
75500
|
try {
|
|
75121
|
-
return layer.match(
|
|
75501
|
+
return layer.match(path2);
|
|
75122
75502
|
} catch (err) {
|
|
75123
75503
|
return err;
|
|
75124
75504
|
}
|
|
@@ -75346,7 +75726,7 @@ var require_application = __commonJS({
|
|
|
75346
75726
|
};
|
|
75347
75727
|
app.use = function use(fn) {
|
|
75348
75728
|
var offset = 0;
|
|
75349
|
-
var
|
|
75729
|
+
var path2 = "/";
|
|
75350
75730
|
if (typeof fn !== "function") {
|
|
75351
75731
|
var arg = fn;
|
|
75352
75732
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -75354,7 +75734,7 @@ var require_application = __commonJS({
|
|
|
75354
75734
|
}
|
|
75355
75735
|
if (typeof arg !== "function") {
|
|
75356
75736
|
offset = 1;
|
|
75357
|
-
|
|
75737
|
+
path2 = fn;
|
|
75358
75738
|
}
|
|
75359
75739
|
}
|
|
75360
75740
|
var fns = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -75364,12 +75744,12 @@ var require_application = __commonJS({
|
|
|
75364
75744
|
var router = this.router;
|
|
75365
75745
|
fns.forEach(function(fn2) {
|
|
75366
75746
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
75367
|
-
return router.use(
|
|
75747
|
+
return router.use(path2, fn2);
|
|
75368
75748
|
}
|
|
75369
|
-
debug(".use app under %s",
|
|
75370
|
-
fn2.mountpath =
|
|
75749
|
+
debug(".use app under %s", path2);
|
|
75750
|
+
fn2.mountpath = path2;
|
|
75371
75751
|
fn2.parent = this;
|
|
75372
|
-
router.use(
|
|
75752
|
+
router.use(path2, function mounted_app(req, res, next) {
|
|
75373
75753
|
var orig = req.app;
|
|
75374
75754
|
fn2.handle(req, res, function(err) {
|
|
75375
75755
|
Object.setPrototypeOf(req, orig.request);
|
|
@@ -75381,8 +75761,8 @@ var require_application = __commonJS({
|
|
|
75381
75761
|
}, this);
|
|
75382
75762
|
return this;
|
|
75383
75763
|
};
|
|
75384
|
-
app.route = function route(
|
|
75385
|
-
return this.router.route(
|
|
75764
|
+
app.route = function route(path2) {
|
|
75765
|
+
return this.router.route(path2);
|
|
75386
75766
|
};
|
|
75387
75767
|
app.engine = function engine(ext, fn) {
|
|
75388
75768
|
if (typeof fn !== "function") {
|
|
@@ -75425,7 +75805,7 @@ var require_application = __commonJS({
|
|
|
75425
75805
|
}
|
|
75426
75806
|
return this;
|
|
75427
75807
|
};
|
|
75428
|
-
app.path = function
|
|
75808
|
+
app.path = function path2() {
|
|
75429
75809
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
75430
75810
|
};
|
|
75431
75811
|
app.enabled = function enabled(setting) {
|
|
@@ -75441,17 +75821,17 @@ var require_application = __commonJS({
|
|
|
75441
75821
|
return this.set(setting, false);
|
|
75442
75822
|
};
|
|
75443
75823
|
methods.forEach(function(method) {
|
|
75444
|
-
app[method] = function(
|
|
75824
|
+
app[method] = function(path2) {
|
|
75445
75825
|
if (method === "get" && arguments.length === 1) {
|
|
75446
|
-
return this.set(
|
|
75826
|
+
return this.set(path2);
|
|
75447
75827
|
}
|
|
75448
|
-
var route = this.route(
|
|
75828
|
+
var route = this.route(path2);
|
|
75449
75829
|
route[method].apply(route, slice.call(arguments, 1));
|
|
75450
75830
|
return this;
|
|
75451
75831
|
};
|
|
75452
75832
|
});
|
|
75453
|
-
app.all = function all(
|
|
75454
|
-
var route = this.route(
|
|
75833
|
+
app.all = function all(path2) {
|
|
75834
|
+
var route = this.route(path2);
|
|
75455
75835
|
var args = slice.call(arguments, 1);
|
|
75456
75836
|
for (var i = 0; i < methods.length; i++) {
|
|
75457
75837
|
route[methods[i]].apply(route, args);
|
|
@@ -76361,7 +76741,7 @@ var require_request = __commonJS({
|
|
|
76361
76741
|
var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
|
|
76362
76742
|
return subdomains2.slice(offset);
|
|
76363
76743
|
});
|
|
76364
|
-
defineGetter(req, "path", function
|
|
76744
|
+
defineGetter(req, "path", function path2() {
|
|
76365
76745
|
return parse4(this).pathname;
|
|
76366
76746
|
});
|
|
76367
76747
|
defineGetter(req, "host", function host() {
|
|
@@ -76773,27 +77153,27 @@ var require_send = __commonJS({
|
|
|
76773
77153
|
var ms = require_ms();
|
|
76774
77154
|
var onFinished = require_on_finished();
|
|
76775
77155
|
var parseRange = require_range_parser();
|
|
76776
|
-
var
|
|
77156
|
+
var path2 = require("path");
|
|
76777
77157
|
var statuses = require_statuses();
|
|
76778
77158
|
var Stream = require("stream");
|
|
76779
77159
|
var util2 = require("util");
|
|
76780
|
-
var extname =
|
|
76781
|
-
var
|
|
76782
|
-
var normalize =
|
|
76783
|
-
var resolve4 =
|
|
76784
|
-
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;
|
|
76785
77165
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
76786
77166
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
76787
77167
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
76788
77168
|
module2.exports = send;
|
|
76789
|
-
function send(req,
|
|
76790
|
-
return new SendStream(req,
|
|
77169
|
+
function send(req, path3, options) {
|
|
77170
|
+
return new SendStream(req, path3, options);
|
|
76791
77171
|
}
|
|
76792
|
-
function SendStream(req,
|
|
77172
|
+
function SendStream(req, path3, options) {
|
|
76793
77173
|
Stream.call(this);
|
|
76794
77174
|
var opts = options || {};
|
|
76795
77175
|
this.options = opts;
|
|
76796
|
-
this.path =
|
|
77176
|
+
this.path = path3;
|
|
76797
77177
|
this.req = req;
|
|
76798
77178
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
76799
77179
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -76907,10 +77287,10 @@ var require_send = __commonJS({
|
|
|
76907
77287
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
76908
77288
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
76909
77289
|
};
|
|
76910
|
-
SendStream.prototype.redirect = function redirect(
|
|
77290
|
+
SendStream.prototype.redirect = function redirect(path3) {
|
|
76911
77291
|
var res = this.res;
|
|
76912
77292
|
if (hasListeners(this, "directory")) {
|
|
76913
|
-
this.emit("directory", res,
|
|
77293
|
+
this.emit("directory", res, path3);
|
|
76914
77294
|
return;
|
|
76915
77295
|
}
|
|
76916
77296
|
if (this.hasTrailingSlash()) {
|
|
@@ -76930,38 +77310,38 @@ var require_send = __commonJS({
|
|
|
76930
77310
|
SendStream.prototype.pipe = function pipe2(res) {
|
|
76931
77311
|
var root = this._root;
|
|
76932
77312
|
this.res = res;
|
|
76933
|
-
var
|
|
76934
|
-
if (
|
|
77313
|
+
var path3 = decode3(this.path);
|
|
77314
|
+
if (path3 === -1) {
|
|
76935
77315
|
this.error(400);
|
|
76936
77316
|
return res;
|
|
76937
77317
|
}
|
|
76938
|
-
if (~
|
|
77318
|
+
if (~path3.indexOf("\0")) {
|
|
76939
77319
|
this.error(400);
|
|
76940
77320
|
return res;
|
|
76941
77321
|
}
|
|
76942
77322
|
var parts;
|
|
76943
77323
|
if (root !== null) {
|
|
76944
|
-
if (
|
|
76945
|
-
|
|
77324
|
+
if (path3) {
|
|
77325
|
+
path3 = normalize("." + sep + path3);
|
|
76946
77326
|
}
|
|
76947
|
-
if (UP_PATH_REGEXP.test(
|
|
76948
|
-
debug('malicious path "%s"',
|
|
77327
|
+
if (UP_PATH_REGEXP.test(path3)) {
|
|
77328
|
+
debug('malicious path "%s"', path3);
|
|
76949
77329
|
this.error(403);
|
|
76950
77330
|
return res;
|
|
76951
77331
|
}
|
|
76952
|
-
parts =
|
|
76953
|
-
|
|
77332
|
+
parts = path3.split(sep);
|
|
77333
|
+
path3 = normalize(join14(root, path3));
|
|
76954
77334
|
} else {
|
|
76955
|
-
if (UP_PATH_REGEXP.test(
|
|
76956
|
-
debug('malicious path "%s"',
|
|
77335
|
+
if (UP_PATH_REGEXP.test(path3)) {
|
|
77336
|
+
debug('malicious path "%s"', path3);
|
|
76957
77337
|
this.error(403);
|
|
76958
77338
|
return res;
|
|
76959
77339
|
}
|
|
76960
|
-
parts = normalize(
|
|
76961
|
-
|
|
77340
|
+
parts = normalize(path3).split(sep);
|
|
77341
|
+
path3 = resolve4(path3);
|
|
76962
77342
|
}
|
|
76963
77343
|
if (containsDotFile(parts)) {
|
|
76964
|
-
debug('%s dotfile "%s"', this._dotfiles,
|
|
77344
|
+
debug('%s dotfile "%s"', this._dotfiles, path3);
|
|
76965
77345
|
switch (this._dotfiles) {
|
|
76966
77346
|
case "allow":
|
|
76967
77347
|
break;
|
|
@@ -76975,13 +77355,13 @@ var require_send = __commonJS({
|
|
|
76975
77355
|
}
|
|
76976
77356
|
}
|
|
76977
77357
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
76978
|
-
this.sendIndex(
|
|
77358
|
+
this.sendIndex(path3);
|
|
76979
77359
|
return res;
|
|
76980
77360
|
}
|
|
76981
|
-
this.sendFile(
|
|
77361
|
+
this.sendFile(path3);
|
|
76982
77362
|
return res;
|
|
76983
77363
|
};
|
|
76984
|
-
SendStream.prototype.send = function send2(
|
|
77364
|
+
SendStream.prototype.send = function send2(path3, stat) {
|
|
76985
77365
|
var len = stat.size;
|
|
76986
77366
|
var options = this.options;
|
|
76987
77367
|
var opts = {};
|
|
@@ -76993,9 +77373,9 @@ var require_send = __commonJS({
|
|
|
76993
77373
|
this.headersAlreadySent();
|
|
76994
77374
|
return;
|
|
76995
77375
|
}
|
|
76996
|
-
debug('pipe "%s"',
|
|
76997
|
-
this.setHeader(
|
|
76998
|
-
this.type(
|
|
77376
|
+
debug('pipe "%s"', path3);
|
|
77377
|
+
this.setHeader(path3, stat);
|
|
77378
|
+
this.type(path3);
|
|
76999
77379
|
if (this.isConditionalGET()) {
|
|
77000
77380
|
if (this.isPreconditionFailure()) {
|
|
77001
77381
|
this.error(412);
|
|
@@ -77044,28 +77424,28 @@ var require_send = __commonJS({
|
|
|
77044
77424
|
res.end();
|
|
77045
77425
|
return;
|
|
77046
77426
|
}
|
|
77047
|
-
this.stream(
|
|
77427
|
+
this.stream(path3, opts);
|
|
77048
77428
|
};
|
|
77049
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
77429
|
+
SendStream.prototype.sendFile = function sendFile(path3) {
|
|
77050
77430
|
var i = 0;
|
|
77051
77431
|
var self = this;
|
|
77052
|
-
debug('stat "%s"',
|
|
77053
|
-
fs.stat(
|
|
77054
|
-
var pathEndsWithSep =
|
|
77055
|
-
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) {
|
|
77056
77436
|
return next(err);
|
|
77057
77437
|
}
|
|
77058
77438
|
if (err) return self.onStatError(err);
|
|
77059
|
-
if (stat.isDirectory()) return self.redirect(
|
|
77439
|
+
if (stat.isDirectory()) return self.redirect(path3);
|
|
77060
77440
|
if (pathEndsWithSep) return self.error(404);
|
|
77061
|
-
self.emit("file",
|
|
77062
|
-
self.send(
|
|
77441
|
+
self.emit("file", path3, stat);
|
|
77442
|
+
self.send(path3, stat);
|
|
77063
77443
|
});
|
|
77064
77444
|
function next(err) {
|
|
77065
77445
|
if (self._extensions.length <= i) {
|
|
77066
77446
|
return err ? self.onStatError(err) : self.error(404);
|
|
77067
77447
|
}
|
|
77068
|
-
var p =
|
|
77448
|
+
var p = path3 + "." + self._extensions[i++];
|
|
77069
77449
|
debug('stat "%s"', p);
|
|
77070
77450
|
fs.stat(p, function(err2, stat) {
|
|
77071
77451
|
if (err2) return next(err2);
|
|
@@ -77075,7 +77455,7 @@ var require_send = __commonJS({
|
|
|
77075
77455
|
});
|
|
77076
77456
|
}
|
|
77077
77457
|
};
|
|
77078
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
77458
|
+
SendStream.prototype.sendIndex = function sendIndex(path3) {
|
|
77079
77459
|
var i = -1;
|
|
77080
77460
|
var self = this;
|
|
77081
77461
|
function next(err) {
|
|
@@ -77083,7 +77463,7 @@ var require_send = __commonJS({
|
|
|
77083
77463
|
if (err) return self.onStatError(err);
|
|
77084
77464
|
return self.error(404);
|
|
77085
77465
|
}
|
|
77086
|
-
var p =
|
|
77466
|
+
var p = join14(path3, self._index[i]);
|
|
77087
77467
|
debug('stat "%s"', p);
|
|
77088
77468
|
fs.stat(p, function(err2, stat) {
|
|
77089
77469
|
if (err2) return next(err2);
|
|
@@ -77094,10 +77474,10 @@ var require_send = __commonJS({
|
|
|
77094
77474
|
}
|
|
77095
77475
|
next();
|
|
77096
77476
|
};
|
|
77097
|
-
SendStream.prototype.stream = function stream(
|
|
77477
|
+
SendStream.prototype.stream = function stream(path3, options) {
|
|
77098
77478
|
var self = this;
|
|
77099
77479
|
var res = this.res;
|
|
77100
|
-
var stream2 = fs.createReadStream(
|
|
77480
|
+
var stream2 = fs.createReadStream(path3, options);
|
|
77101
77481
|
this.emit("stream", stream2);
|
|
77102
77482
|
stream2.pipe(res);
|
|
77103
77483
|
function cleanup() {
|
|
@@ -77112,17 +77492,17 @@ var require_send = __commonJS({
|
|
|
77112
77492
|
self.emit("end");
|
|
77113
77493
|
});
|
|
77114
77494
|
};
|
|
77115
|
-
SendStream.prototype.type = function type(
|
|
77495
|
+
SendStream.prototype.type = function type(path3) {
|
|
77116
77496
|
var res = this.res;
|
|
77117
77497
|
if (res.getHeader("Content-Type")) return;
|
|
77118
|
-
var ext = extname(
|
|
77498
|
+
var ext = extname(path3);
|
|
77119
77499
|
var type2 = mime.contentType(ext) || "application/octet-stream";
|
|
77120
77500
|
debug("content-type %s", type2);
|
|
77121
77501
|
res.setHeader("Content-Type", type2);
|
|
77122
77502
|
};
|
|
77123
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
77503
|
+
SendStream.prototype.setHeader = function setHeader(path3, stat) {
|
|
77124
77504
|
var res = this.res;
|
|
77125
|
-
this.emit("headers", res,
|
|
77505
|
+
this.emit("headers", res, path3, stat);
|
|
77126
77506
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
77127
77507
|
debug("accept ranges");
|
|
77128
77508
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -77180,9 +77560,9 @@ var require_send = __commonJS({
|
|
|
77180
77560
|
}
|
|
77181
77561
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
77182
77562
|
}
|
|
77183
|
-
function decode3(
|
|
77563
|
+
function decode3(path3) {
|
|
77184
77564
|
try {
|
|
77185
|
-
return decodeURIComponent(
|
|
77565
|
+
return decodeURIComponent(path3);
|
|
77186
77566
|
} catch (err) {
|
|
77187
77567
|
return -1;
|
|
77188
77568
|
}
|
|
@@ -77326,7 +77706,7 @@ var require_response = __commonJS({
|
|
|
77326
77706
|
var http = require("node:http");
|
|
77327
77707
|
var onFinished = require_on_finished();
|
|
77328
77708
|
var mime = require_mime_types();
|
|
77329
|
-
var
|
|
77709
|
+
var path2 = require("node:path");
|
|
77330
77710
|
var pathIsAbsolute = require("node:path").isAbsolute;
|
|
77331
77711
|
var statuses = require_statuses();
|
|
77332
77712
|
var sign = require_cookie_signature().sign;
|
|
@@ -77335,8 +77715,8 @@ var require_response = __commonJS({
|
|
|
77335
77715
|
var setCharset = require_utils8().setCharset;
|
|
77336
77716
|
var cookie = require_cookie();
|
|
77337
77717
|
var send = require_send();
|
|
77338
|
-
var extname =
|
|
77339
|
-
var resolve4 =
|
|
77718
|
+
var extname = path2.extname;
|
|
77719
|
+
var resolve4 = path2.resolve;
|
|
77340
77720
|
var vary = require_vary();
|
|
77341
77721
|
var { Buffer: Buffer2 } = require("node:buffer");
|
|
77342
77722
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -77482,26 +77862,26 @@ var require_response = __commonJS({
|
|
|
77482
77862
|
this.type("txt");
|
|
77483
77863
|
return this.send(body);
|
|
77484
77864
|
};
|
|
77485
|
-
res.sendFile = function sendFile(
|
|
77865
|
+
res.sendFile = function sendFile(path3, options, callback) {
|
|
77486
77866
|
var done = callback;
|
|
77487
77867
|
var req = this.req;
|
|
77488
77868
|
var res2 = this;
|
|
77489
77869
|
var next = req.next;
|
|
77490
77870
|
var opts = options || {};
|
|
77491
|
-
if (!
|
|
77871
|
+
if (!path3) {
|
|
77492
77872
|
throw new TypeError("path argument is required to res.sendFile");
|
|
77493
77873
|
}
|
|
77494
|
-
if (typeof
|
|
77874
|
+
if (typeof path3 !== "string") {
|
|
77495
77875
|
throw new TypeError("path must be a string to res.sendFile");
|
|
77496
77876
|
}
|
|
77497
77877
|
if (typeof options === "function") {
|
|
77498
77878
|
done = options;
|
|
77499
77879
|
opts = {};
|
|
77500
77880
|
}
|
|
77501
|
-
if (!opts.root && !pathIsAbsolute(
|
|
77881
|
+
if (!opts.root && !pathIsAbsolute(path3)) {
|
|
77502
77882
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
77503
77883
|
}
|
|
77504
|
-
var pathname = encodeURI(
|
|
77884
|
+
var pathname = encodeURI(path3);
|
|
77505
77885
|
opts.etag = this.app.enabled("etag");
|
|
77506
77886
|
var file2 = send(req, pathname, opts);
|
|
77507
77887
|
sendfile(res2, file2, opts, function(err) {
|
|
@@ -77512,7 +77892,7 @@ var require_response = __commonJS({
|
|
|
77512
77892
|
}
|
|
77513
77893
|
});
|
|
77514
77894
|
};
|
|
77515
|
-
res.download = function download(
|
|
77895
|
+
res.download = function download(path3, filename, options, callback) {
|
|
77516
77896
|
var done = callback;
|
|
77517
77897
|
var name = filename;
|
|
77518
77898
|
var opts = options || null;
|
|
@@ -77529,7 +77909,7 @@ var require_response = __commonJS({
|
|
|
77529
77909
|
opts = filename;
|
|
77530
77910
|
}
|
|
77531
77911
|
var headers = {
|
|
77532
|
-
"Content-Disposition": contentDisposition(name ||
|
|
77912
|
+
"Content-Disposition": contentDisposition(name || path3)
|
|
77533
77913
|
};
|
|
77534
77914
|
if (opts && opts.headers) {
|
|
77535
77915
|
var keys = Object.keys(opts.headers);
|
|
@@ -77542,7 +77922,7 @@ var require_response = __commonJS({
|
|
|
77542
77922
|
}
|
|
77543
77923
|
opts = Object.create(opts);
|
|
77544
77924
|
opts.headers = headers;
|
|
77545
|
-
var fullPath = !opts.root ? resolve4(
|
|
77925
|
+
var fullPath = !opts.root ? resolve4(path3) : path3;
|
|
77546
77926
|
return this.sendFile(fullPath, opts, done);
|
|
77547
77927
|
};
|
|
77548
77928
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -77825,11 +78205,11 @@ var require_serve_static = __commonJS({
|
|
|
77825
78205
|
}
|
|
77826
78206
|
var forwardError = !fallthrough;
|
|
77827
78207
|
var originalUrl = parseUrl.original(req);
|
|
77828
|
-
var
|
|
77829
|
-
if (
|
|
77830
|
-
|
|
78208
|
+
var path2 = parseUrl(req).pathname;
|
|
78209
|
+
if (path2 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
78210
|
+
path2 = "";
|
|
77831
78211
|
}
|
|
77832
|
-
var stream = send(req,
|
|
78212
|
+
var stream = send(req, path2, opts);
|
|
77833
78213
|
stream.on("directory", onDirectory);
|
|
77834
78214
|
if (setHeaders) {
|
|
77835
78215
|
stream.on("headers", setHeaders);
|
|
@@ -79204,12 +79584,12 @@ function maybeCollect() {
|
|
|
79204
79584
|
triggerCollectInBackground();
|
|
79205
79585
|
}
|
|
79206
79586
|
}
|
|
79207
|
-
async function apiGet2(
|
|
79587
|
+
async function apiGet2(path2, options) {
|
|
79208
79588
|
const headers = {
|
|
79209
79589
|
Authorization: `Bearer ${TOKEN}`,
|
|
79210
79590
|
...options?.extraHeaders
|
|
79211
79591
|
};
|
|
79212
|
-
const response = await fetchWithTimeout(`${API_URL}/api/v1${
|
|
79592
|
+
const response = await fetchWithTimeout(`${API_URL}/api/v1${path2}`, {
|
|
79213
79593
|
headers
|
|
79214
79594
|
});
|
|
79215
79595
|
if (!response.ok) {
|
|
@@ -79218,13 +79598,13 @@ async function apiGet2(path3, options) {
|
|
|
79218
79598
|
}
|
|
79219
79599
|
return response.json();
|
|
79220
79600
|
}
|
|
79221
|
-
async function apiPost(
|
|
79601
|
+
async function apiPost(path2, body, options) {
|
|
79222
79602
|
const headers = {
|
|
79223
79603
|
Authorization: `Bearer ${TOKEN}`,
|
|
79224
79604
|
"Content-Type": "application/json",
|
|
79225
79605
|
...options?.extraHeaders
|
|
79226
79606
|
};
|
|
79227
|
-
const response = await fetchWithTimeout(`${API_URL}/api/v1${
|
|
79607
|
+
const response = await fetchWithTimeout(`${API_URL}/api/v1${path2}`, {
|
|
79228
79608
|
method: "POST",
|
|
79229
79609
|
headers,
|
|
79230
79610
|
body: JSON.stringify(body)
|
|
@@ -79278,7 +79658,7 @@ var init_mcp_server2 = __esm({
|
|
|
79278
79658
|
init_collector();
|
|
79279
79659
|
init_http_timeout();
|
|
79280
79660
|
init_service_urls();
|
|
79281
|
-
|
|
79661
|
+
init_src5();
|
|
79282
79662
|
init_mcp();
|
|
79283
79663
|
init_stdio2();
|
|
79284
79664
|
init_types4();
|
|
@@ -79568,8 +79948,9 @@ var init_mcp_server2 = __esm({
|
|
|
79568
79948
|
throw new Error(`Unknown tool: ${name}`);
|
|
79569
79949
|
}
|
|
79570
79950
|
} catch (err) {
|
|
79951
|
+
console.error(`[MCP] agent-sessions tool failed:`, err?.message ?? err);
|
|
79571
79952
|
return {
|
|
79572
|
-
content: [{ type: "text", text:
|
|
79953
|
+
content: [{ type: "text", text: "An internal error occurred." }],
|
|
79573
79954
|
isError: true
|
|
79574
79955
|
};
|
|
79575
79956
|
}
|
|
@@ -79631,17 +80012,20 @@ var init_codex_config = __esm({
|
|
|
79631
80012
|
// src/commands/setup-mcp.ts
|
|
79632
80013
|
var setup_mcp_exports = {};
|
|
79633
80014
|
__export(setup_mcp_exports, {
|
|
80015
|
+
HTTP_SERVERS: () => HTTP_SERVERS,
|
|
80016
|
+
parseTarget: () => parseTarget,
|
|
79634
80017
|
setupMcp: () => setupMcp
|
|
79635
80018
|
});
|
|
79636
80019
|
function parseTarget(arg) {
|
|
79637
80020
|
if (!arg || arg === "all") return "all";
|
|
79638
|
-
if (arg === "solutions" || arg === "exchange"
|
|
80021
|
+
if (arg === "solutions" || arg === "exchange" || arg === "digests")
|
|
80022
|
+
return arg;
|
|
79639
80023
|
throw new Error(
|
|
79640
|
-
`Unknown target: ${arg}. Use one of: solutions, exchange, all (default).`
|
|
80024
|
+
`Unknown target: ${arg}. Use one of: solutions, exchange, digests, all (default).`
|
|
79641
80025
|
);
|
|
79642
80026
|
}
|
|
79643
|
-
function
|
|
79644
|
-
return `${apiUrl().replace(/\/+$/, "")}
|
|
80027
|
+
function httpServerUrl(path2) {
|
|
80028
|
+
return `${apiUrl().replace(/\/+$/, "")}${path2}`;
|
|
79645
80029
|
}
|
|
79646
80030
|
function setupClaudeMcp(target) {
|
|
79647
80031
|
let config6 = {};
|
|
@@ -79666,21 +80050,22 @@ function setupClaudeMcp(target) {
|
|
|
79666
80050
|
};
|
|
79667
80051
|
installed.push(`haansi-solutions (stdio \u2192 ${haansiBin} mcp-server)`);
|
|
79668
80052
|
}
|
|
79669
|
-
|
|
80053
|
+
for (const http of HTTP_SERVERS) {
|
|
80054
|
+
if (target !== "all" && target !== http.target) continue;
|
|
79670
80055
|
const token = resolveToken();
|
|
79671
80056
|
if (!token) {
|
|
79672
80057
|
warnings.push(
|
|
79673
|
-
|
|
80058
|
+
`${http.name} not registered: no token found. Run \`haansi auth login\` first, or set HAANSI_TOKEN.`
|
|
79674
80059
|
);
|
|
79675
|
-
|
|
79676
|
-
const url2 = exchangeUrl();
|
|
79677
|
-
config6.mcpServers["haansi-exchange"] = {
|
|
79678
|
-
type: "http",
|
|
79679
|
-
url: url2,
|
|
79680
|
-
headers: { Authorization: `Bearer ${token}` }
|
|
79681
|
-
};
|
|
79682
|
-
installed.push(`haansi-exchange (http \u2192 ${url2})`);
|
|
80060
|
+
continue;
|
|
79683
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})`);
|
|
79684
80069
|
}
|
|
79685
80070
|
(0, import_node_fs5.writeFileSync)(CLAUDE_JSON, JSON.stringify(config6, null, 2) + "\n", "utf-8");
|
|
79686
80071
|
console.log(`
|
|
@@ -79711,20 +80096,21 @@ function setupCodexMcp(target) {
|
|
|
79711
80096
|
});
|
|
79712
80097
|
installed.push(`haansi-solutions (stdio \u2192 ${haansiBin} mcp-server)`);
|
|
79713
80098
|
}
|
|
79714
|
-
|
|
80099
|
+
for (const http of HTTP_SERVERS) {
|
|
80100
|
+
if (target !== "all" && target !== http.target) continue;
|
|
79715
80101
|
const token = resolveToken();
|
|
79716
80102
|
if (!token) {
|
|
79717
80103
|
warnings.push(
|
|
79718
|
-
|
|
80104
|
+
`${http.name} not registered: no token found. Run \`haansi auth login\` first, or set HAANSI_TOKEN.`
|
|
79719
80105
|
);
|
|
79720
|
-
|
|
79721
|
-
const url2 = exchangeUrl();
|
|
79722
|
-
content = upsertTomlTable(content, "mcp_servers.haansi-exchange", {
|
|
79723
|
-
url: tomlString(url2),
|
|
79724
|
-
http_headers: tomlInlineTable({ Authorization: `Bearer ${token}` })
|
|
79725
|
-
});
|
|
79726
|
-
installed.push(`haansi-exchange (http \u2192 ${url2})`);
|
|
80106
|
+
continue;
|
|
79727
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})`);
|
|
79728
80114
|
}
|
|
79729
80115
|
(0, import_node_fs5.mkdirSync)(CODEX_HOME, { recursive: true });
|
|
79730
80116
|
(0, import_node_fs5.writeFileSync)(CODEX_CONFIG, content, "utf-8");
|
|
@@ -79745,7 +80131,7 @@ async function setupMcp(targetArg, agentFlag) {
|
|
|
79745
80131
|
console.log(`
|
|
79746
80132
|
Restart ${restart} to activate the changes.`);
|
|
79747
80133
|
}
|
|
79748
|
-
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;
|
|
79749
80135
|
var init_setup_mcp = __esm({
|
|
79750
80136
|
"src/commands/setup-mcp.ts"() {
|
|
79751
80137
|
"use strict";
|
|
@@ -79758,6 +80144,18 @@ var init_setup_mcp = __esm({
|
|
|
79758
80144
|
CLAUDE_JSON = (0, import_node_path4.join)((0, import_node_os4.homedir)(), ".claude.json");
|
|
79759
80145
|
CODEX_HOME = process.env.CODEX_HOME || (0, import_node_path4.join)((0, import_node_os4.homedir)(), ".codex");
|
|
79760
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
|
+
];
|
|
79761
80159
|
WRITERS = {
|
|
79762
80160
|
"claude-code": setupClaudeMcp,
|
|
79763
80161
|
codex: setupCodexMcp
|
|
@@ -79804,7 +80202,7 @@ function warnIfStaleDevBundle(haansiPath) {
|
|
|
79804
80202
|
}
|
|
79805
80203
|
function buildPlist(haansiPath) {
|
|
79806
80204
|
const binDir = haansiPath.replace(/\/[^/]+$/, "");
|
|
79807
|
-
const
|
|
80205
|
+
const path2 = `${binDir}:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`;
|
|
79808
80206
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
79809
80207
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
79810
80208
|
<plist version="1.0">
|
|
@@ -79819,7 +80217,7 @@ function buildPlist(haansiPath) {
|
|
|
79819
80217
|
<key>EnvironmentVariables</key>
|
|
79820
80218
|
<dict>
|
|
79821
80219
|
<key>PATH</key>
|
|
79822
|
-
<string>${
|
|
80220
|
+
<string>${path2}</string>
|
|
79823
80221
|
</dict>
|
|
79824
80222
|
<key>RunAtLoad</key>
|
|
79825
80223
|
<true/>
|
|
@@ -79840,8 +80238,8 @@ async function setupDaemon(uninstall) {
|
|
|
79840
80238
|
}
|
|
79841
80239
|
try {
|
|
79842
80240
|
(0, import_node_child_process3.spawnSync)("launchctl", ["unload", PLIST_PATH], { stdio: "pipe" });
|
|
79843
|
-
} catch
|
|
79844
|
-
console.error("Failed to unload daemon
|
|
80241
|
+
} catch {
|
|
80242
|
+
console.error("Failed to unload daemon.");
|
|
79845
80243
|
}
|
|
79846
80244
|
(0, import_node_fs6.unlinkSync)(PLIST_PATH);
|
|
79847
80245
|
console.log("Daemon stopped and removed.");
|
|
@@ -79853,8 +80251,8 @@ async function setupDaemon(uninstall) {
|
|
|
79853
80251
|
(0, import_node_fs6.writeFileSync)(PLIST_PATH, buildPlist(haansiPath), "utf-8");
|
|
79854
80252
|
try {
|
|
79855
80253
|
(0, import_node_child_process3.spawnSync)("launchctl", ["unload", PLIST_PATH], { stdio: "pipe" });
|
|
79856
|
-
} catch
|
|
79857
|
-
console.error("Failed to unload previous daemon
|
|
80254
|
+
} catch {
|
|
80255
|
+
console.error("Failed to unload previous daemon.");
|
|
79858
80256
|
}
|
|
79859
80257
|
(0, import_node_child_process3.spawnSync)("launchctl", ["load", PLIST_PATH], { stdio: "inherit" });
|
|
79860
80258
|
console.log("Daemon installed and started.");
|
|
@@ -79894,8 +80292,10 @@ function resolveToken4() {
|
|
|
79894
80292
|
try {
|
|
79895
80293
|
const creds = JSON.parse((0, import_node_fs7.readFileSync)(CREDENTIALS_FILE6, "utf-8"));
|
|
79896
80294
|
if (creds.token) return creds.token;
|
|
79897
|
-
} catch
|
|
79898
|
-
console.error(
|
|
80295
|
+
} catch {
|
|
80296
|
+
console.error(
|
|
80297
|
+
"Failed to read credentials file. Run `haansi init` to recreate it."
|
|
80298
|
+
);
|
|
79899
80299
|
}
|
|
79900
80300
|
}
|
|
79901
80301
|
return null;
|
|
@@ -79920,10 +80320,7 @@ async function config5(args) {
|
|
|
79920
80320
|
}
|
|
79921
80321
|
);
|
|
79922
80322
|
if (!response.ok) {
|
|
79923
|
-
|
|
79924
|
-
console.error(
|
|
79925
|
-
`Error fetching preferences (${response.status}): ${body.slice(0, 200)}`
|
|
79926
|
-
);
|
|
80323
|
+
console.error(`Error fetching preferences (${response.status}).`);
|
|
79927
80324
|
process.exit(1);
|
|
79928
80325
|
return;
|
|
79929
80326
|
}
|
|
@@ -79972,10 +80369,7 @@ async function config5(args) {
|
|
|
79972
80369
|
}
|
|
79973
80370
|
);
|
|
79974
80371
|
if (!response.ok) {
|
|
79975
|
-
|
|
79976
|
-
console.error(
|
|
79977
|
-
`Error updating preferences (${response.status}): ${body.slice(0, 200)}`
|
|
79978
|
-
);
|
|
80372
|
+
console.error(`Error updating preferences (${response.status}).`);
|
|
79979
80373
|
process.exit(1);
|
|
79980
80374
|
return;
|
|
79981
80375
|
}
|
|
@@ -80016,24 +80410,27 @@ function resolveToken5() {
|
|
|
80016
80410
|
try {
|
|
80017
80411
|
const creds = JSON.parse((0, import_node_fs8.readFileSync)(CREDENTIALS_FILE7, "utf-8"));
|
|
80018
80412
|
if (creds.token) return creds.token;
|
|
80019
|
-
} catch
|
|
80020
|
-
console.error(
|
|
80413
|
+
} catch {
|
|
80414
|
+
console.error(
|
|
80415
|
+
"Failed to read credentials file. Run `haansi init` to recreate it."
|
|
80416
|
+
);
|
|
80021
80417
|
}
|
|
80022
80418
|
}
|
|
80023
80419
|
throw new Error("No token found. Run `haansi init` first.");
|
|
80024
80420
|
}
|
|
80025
|
-
async function apiGet3(
|
|
80026
|
-
const response = await fetch(`${apiUrl2}/api/v1${
|
|
80421
|
+
async function apiGet3(path2, token, apiUrl2) {
|
|
80422
|
+
const response = await fetch(`${apiUrl2}/api/v1${path2}`, {
|
|
80027
80423
|
headers: { Authorization: `Bearer ${token}` }
|
|
80028
80424
|
});
|
|
80029
80425
|
if (!response.ok) {
|
|
80030
|
-
|
|
80031
|
-
|
|
80426
|
+
throw Object.assign(new Error(`API error ${response.status}`), {
|
|
80427
|
+
publicMessage: `The request failed (${response.status}).`
|
|
80428
|
+
});
|
|
80032
80429
|
}
|
|
80033
80430
|
return response.json();
|
|
80034
80431
|
}
|
|
80035
|
-
async function apiPost2(
|
|
80036
|
-
const response = await fetch(`${apiUrl2}/api/v1${
|
|
80432
|
+
async function apiPost2(path2, body, token, apiUrl2) {
|
|
80433
|
+
const response = await fetch(`${apiUrl2}/api/v1${path2}`, {
|
|
80037
80434
|
method: "POST",
|
|
80038
80435
|
headers: {
|
|
80039
80436
|
Authorization: `Bearer ${token}`,
|
|
@@ -80042,8 +80439,9 @@ async function apiPost2(path3, body, token, apiUrl2) {
|
|
|
80042
80439
|
body: JSON.stringify(body)
|
|
80043
80440
|
});
|
|
80044
80441
|
if (!response.ok) {
|
|
80045
|
-
|
|
80046
|
-
|
|
80442
|
+
throw Object.assign(new Error(`API error ${response.status}`), {
|
|
80443
|
+
publicMessage: `The request failed (${response.status}).`
|
|
80444
|
+
});
|
|
80047
80445
|
}
|
|
80048
80446
|
return response.json();
|
|
80049
80447
|
}
|
|
@@ -80356,7 +80754,9 @@ Environment variables:
|
|
|
80356
80754
|
`);
|
|
80357
80755
|
}
|
|
80358
80756
|
run2().catch((err) => {
|
|
80359
|
-
|
|
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);
|
|
80360
80760
|
process.exit(1);
|
|
80361
80761
|
});
|
|
80362
80762
|
/*! Bundled license information:
|