haansi 0.1.36 → 0.1.42
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 +1043 -645
- package/package.json +4 -6
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.42",
|
|
99
99
|
description: "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
|
|
100
100
|
bin: {
|
|
101
101
|
haansi: "./dist/haansi.js"
|
|
@@ -109,15 +109,13 @@ var require_package = __commonJS({
|
|
|
109
109
|
prepublishOnly: "npm run build"
|
|
110
110
|
},
|
|
111
111
|
devDependencies: {
|
|
112
|
+
"@company/pii": "*",
|
|
113
|
+
"@types/node": "^22.10.1",
|
|
112
114
|
esbuild: "^0.27.0",
|
|
113
|
-
typescript: "^5.7.2"
|
|
114
|
-
"@types/node": "^22.10.1"
|
|
115
|
+
typescript: "^5.7.2"
|
|
115
116
|
},
|
|
116
117
|
engines: {
|
|
117
118
|
node: ">=18.0.0"
|
|
118
|
-
},
|
|
119
|
-
dependencies: {
|
|
120
|
-
"@company/pii": "*"
|
|
121
119
|
}
|
|
122
120
|
};
|
|
123
121
|
}
|
|
@@ -149,9 +147,11 @@ async function authLogin() {
|
|
|
149
147
|
body: JSON.stringify({ client_type: "cli" })
|
|
150
148
|
});
|
|
151
149
|
if (!initiateRes.ok) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
throw Object.assign(
|
|
151
|
+
new Error(`Failed to start auth session (${initiateRes.status})`),
|
|
152
|
+
{
|
|
153
|
+
publicMessage: `Could not start sign-in (${initiateRes.status}). Please try again.`
|
|
154
|
+
}
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
157
|
const { session_id, auth_url: vsCodeAuthUrl } = await initiateRes.json();
|
|
@@ -209,9 +209,11 @@ If the browser didn't open, visit this URL:
|
|
|
209
209
|
body: JSON.stringify({ name: "CLI (haansi auth login)" })
|
|
210
210
|
});
|
|
211
211
|
if (!tokenRes.ok) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
throw Object.assign(
|
|
213
|
+
new Error(`Failed to create CLI token (${tokenRes.status})`),
|
|
214
|
+
{
|
|
215
|
+
publicMessage: `Could not create a CLI token (${tokenRes.status}). Please try again.`
|
|
216
|
+
}
|
|
215
217
|
);
|
|
216
218
|
}
|
|
217
219
|
const { token: hskToken } = await tokenRes.json();
|
|
@@ -272,9 +274,11 @@ async function validateToken(token, apiUrl2) {
|
|
|
272
274
|
}
|
|
273
275
|
);
|
|
274
276
|
if (!response.ok) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
277
|
+
throw Object.assign(
|
|
278
|
+
new Error(`Token validation failed (${response.status})`),
|
|
279
|
+
{
|
|
280
|
+
publicMessage: response.status === 401 || response.status === 403 ? "That token was rejected. Check it and try again." : `Could not validate the token (${response.status}).`
|
|
281
|
+
}
|
|
278
282
|
);
|
|
279
283
|
}
|
|
280
284
|
}
|
|
@@ -396,7 +400,7 @@ var require_package2 = __commonJS({
|
|
|
396
400
|
var require_main = __commonJS({
|
|
397
401
|
"../../node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
398
402
|
var fs = require("fs");
|
|
399
|
-
var
|
|
403
|
+
var path2 = require("path");
|
|
400
404
|
var os = require("os");
|
|
401
405
|
var crypto8 = require("crypto");
|
|
402
406
|
var packageJson = require_package2();
|
|
@@ -512,7 +516,7 @@ var require_main = __commonJS({
|
|
|
512
516
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
513
517
|
}
|
|
514
518
|
} else {
|
|
515
|
-
possibleVaultPath =
|
|
519
|
+
possibleVaultPath = path2.resolve(process.cwd(), ".env.vault");
|
|
516
520
|
}
|
|
517
521
|
if (fs.existsSync(possibleVaultPath)) {
|
|
518
522
|
return possibleVaultPath;
|
|
@@ -520,7 +524,7 @@ var require_main = __commonJS({
|
|
|
520
524
|
return null;
|
|
521
525
|
}
|
|
522
526
|
function _resolveHome(envPath) {
|
|
523
|
-
return envPath[0] === "~" ?
|
|
527
|
+
return envPath[0] === "~" ? path2.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
524
528
|
}
|
|
525
529
|
function _configVault(options) {
|
|
526
530
|
const debug = Boolean(options && options.debug);
|
|
@@ -537,7 +541,7 @@ var require_main = __commonJS({
|
|
|
537
541
|
return { parsed };
|
|
538
542
|
}
|
|
539
543
|
function configDotenv(options) {
|
|
540
|
-
const dotenvPath =
|
|
544
|
+
const dotenvPath = path2.resolve(process.cwd(), ".env");
|
|
541
545
|
let encoding = "utf8";
|
|
542
546
|
const debug = Boolean(options && options.debug);
|
|
543
547
|
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
@@ -561,13 +565,13 @@ var require_main = __commonJS({
|
|
|
561
565
|
}
|
|
562
566
|
let lastError;
|
|
563
567
|
const parsedAll = {};
|
|
564
|
-
for (const
|
|
568
|
+
for (const path3 of optionPaths) {
|
|
565
569
|
try {
|
|
566
|
-
const parsed = DotenvModule.parse(fs.readFileSync(
|
|
570
|
+
const parsed = DotenvModule.parse(fs.readFileSync(path3, { encoding }));
|
|
567
571
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
568
572
|
} catch (e) {
|
|
569
573
|
if (debug) {
|
|
570
|
-
_debug(`Failed to load ${
|
|
574
|
+
_debug(`Failed to load ${path3} ${e.message}`);
|
|
571
575
|
}
|
|
572
576
|
lastError = e;
|
|
573
577
|
}
|
|
@@ -582,7 +586,7 @@ var require_main = __commonJS({
|
|
|
582
586
|
const shortPaths = [];
|
|
583
587
|
for (const filePath of optionPaths) {
|
|
584
588
|
try {
|
|
585
|
-
const relative =
|
|
589
|
+
const relative = path2.relative(process.cwd(), filePath);
|
|
586
590
|
shortPaths.push(relative);
|
|
587
591
|
} catch (e) {
|
|
588
592
|
if (debug) {
|
|
@@ -905,10 +909,10 @@ var init_bootstrap = __esm({
|
|
|
905
909
|
});
|
|
906
910
|
|
|
907
911
|
// ../../packages/@company/cloud/src/storage-uri.ts
|
|
908
|
-
function storageUri(bucket,
|
|
912
|
+
function storageUri(bucket, path2) {
|
|
909
913
|
const provider = cloudRegistry.provider;
|
|
910
914
|
const scheme = provider === "aws" ? "s3" : provider === "gcp" ? "gs" : "file";
|
|
911
|
-
return `${scheme}://${bucket}/${
|
|
915
|
+
return `${scheme}://${bucket}/${path2}`;
|
|
912
916
|
}
|
|
913
917
|
var init_storage_uri = __esm({
|
|
914
918
|
"../../packages/@company/cloud/src/storage-uri.ts"() {
|
|
@@ -1974,6 +1978,13 @@ var init_middleware = __esm({
|
|
|
1974
1978
|
}
|
|
1975
1979
|
});
|
|
1976
1980
|
|
|
1981
|
+
// ../../packages/@company/observability/src/public-error.ts
|
|
1982
|
+
var init_public_error = __esm({
|
|
1983
|
+
"../../packages/@company/observability/src/public-error.ts"() {
|
|
1984
|
+
"use strict";
|
|
1985
|
+
}
|
|
1986
|
+
});
|
|
1987
|
+
|
|
1977
1988
|
// ../../packages/@company/observability/src/health.ts
|
|
1978
1989
|
var init_health = __esm({
|
|
1979
1990
|
"../../packages/@company/observability/src/health.ts"() {
|
|
@@ -2000,6 +2011,7 @@ var init_src2 = __esm({
|
|
|
2000
2011
|
init_metrics();
|
|
2001
2012
|
init_scaling_metrics();
|
|
2002
2013
|
init_middleware();
|
|
2014
|
+
init_public_error();
|
|
2003
2015
|
init_health();
|
|
2004
2016
|
init_degradation();
|
|
2005
2017
|
init_types();
|
|
@@ -2139,12 +2151,213 @@ var init_hmac = __esm({
|
|
|
2139
2151
|
}
|
|
2140
2152
|
});
|
|
2141
2153
|
|
|
2154
|
+
// ../../node_modules/wink-porter2-stemmer/src/wink-porter2-stemmer.js
|
|
2155
|
+
var require_wink_porter2_stemmer = __commonJS({
|
|
2156
|
+
"../../node_modules/wink-porter2-stemmer/src/wink-porter2-stemmer.js"(exports2, module2) {
|
|
2157
|
+
var rgxDouble = /(bb|dd|ff|gg|mm|nn|pp|rr|tt)$/;
|
|
2158
|
+
var rgxSFXsses = /(.+)(sses)$/;
|
|
2159
|
+
var rgxSFXiedORies2 = /(.{2,})(ied|ies)$/;
|
|
2160
|
+
var rgxSFXiedORies1 = /(.{1})(ied|ies)$/;
|
|
2161
|
+
var rgxSFXusORss = /(.+)(us|ss)$/;
|
|
2162
|
+
var rgxSFXs = /(.+)(s)$/;
|
|
2163
|
+
var rgxSFXeedlyOReed = /(.*)(eedly|eed)$/;
|
|
2164
|
+
var rgxSFXedORedlyORinglyORing = /([aeiouy].*)(ed|edly|ingly|ing)$/;
|
|
2165
|
+
var rgxSFXatORblORiz = /(at|bl|iz)$/;
|
|
2166
|
+
var rgxSFXyOR3 = /(.+[^aeiouy])([y3])$/;
|
|
2167
|
+
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)$/;
|
|
2168
|
+
var rgxSFXstep2WithReplacements = [
|
|
2169
|
+
// Length 7.
|
|
2170
|
+
{ rgx: /ational$/, replacement: "ate" },
|
|
2171
|
+
{ rgx: /ization$/, replacement: "ize" },
|
|
2172
|
+
{ rgx: /fulness$/, replacement: "ful" },
|
|
2173
|
+
{ rgx: /ousness$/, replacement: "ous" },
|
|
2174
|
+
{ rgx: /iveness$/, replacement: "ive" },
|
|
2175
|
+
// Length 6.
|
|
2176
|
+
{ rgx: /tional$/, replacement: "tion" },
|
|
2177
|
+
{ rgx: /biliti$/, replacement: "ble" },
|
|
2178
|
+
{ rgx: /lessli$/, replacement: "less" },
|
|
2179
|
+
// Length 5.
|
|
2180
|
+
{ rgx: /iviti$/, replacement: "ive" },
|
|
2181
|
+
{ rgx: /ousli$/, replacement: "ous" },
|
|
2182
|
+
{ rgx: /ation$/, replacement: "ate" },
|
|
2183
|
+
{ rgx: /entli$/, replacement: "ent" },
|
|
2184
|
+
{ rgx: /(.*)(alism|aliti)$/, replacement: "$1al" },
|
|
2185
|
+
{ rgx: /fulli$/, replacement: "ful" },
|
|
2186
|
+
// Length 4.
|
|
2187
|
+
{ rgx: /alli$/, replacement: "al" },
|
|
2188
|
+
{ rgx: /ator$/, replacement: "ate" },
|
|
2189
|
+
{ rgx: /izer$/, replacement: "ize" },
|
|
2190
|
+
{ rgx: /enci$/, replacement: "ence" },
|
|
2191
|
+
{ rgx: /anci$/, replacement: "ance" },
|
|
2192
|
+
{ rgx: /abli$/, replacement: "able" },
|
|
2193
|
+
// Length 3.
|
|
2194
|
+
{ rgx: /bli$/, replacement: "ble" },
|
|
2195
|
+
{ rgx: /(.*)(l)(ogi)$/, replacement: "$1$2og" },
|
|
2196
|
+
// Length 2.
|
|
2197
|
+
{ rgx: /(.*)([cdeghkmnrt])(li)$/, replacement: "$1$2" }
|
|
2198
|
+
];
|
|
2199
|
+
var rgxSFXstep3 = /(ational|tional|alize|icate|iciti|ative|ical|ness|ful)$/;
|
|
2200
|
+
var rgxSFXstep3WithReplacements = [
|
|
2201
|
+
{ rgx: /ational$/, replacement: "ate" },
|
|
2202
|
+
{ rgx: /tional$/, replacement: "tion" },
|
|
2203
|
+
{ rgx: /alize$/, replacement: "al" },
|
|
2204
|
+
{ rgx: /(.*)(icate|iciti|ical)$/, replacement: "$1ic" },
|
|
2205
|
+
{ rgx: /(ness|ful)$/, replacement: "" }
|
|
2206
|
+
];
|
|
2207
|
+
var rgxSFXstep4 = /(ement|ance|ence|able|ible|ment|ant|ent|ism|ate|iti|ous|ive|ize|al|er|ic)$/;
|
|
2208
|
+
var rgxSFXstep4Full = /(ement|ance|ence|able|ible|ment|ant|ent|ism|ate|iti|ous|ive|ize|ion|al|er|ic)$/;
|
|
2209
|
+
var rgxSFXstep4ion = /(.*)(s|t)(ion)$/;
|
|
2210
|
+
var exceptions1 = /* @__PURE__ */ Object.create(null);
|
|
2211
|
+
exceptions1.skis = "ski";
|
|
2212
|
+
exceptions1.skies = "sky";
|
|
2213
|
+
exceptions1.dying = "die";
|
|
2214
|
+
exceptions1.lying = "lie";
|
|
2215
|
+
exceptions1.tying = "tie";
|
|
2216
|
+
exceptions1.idly = "idl";
|
|
2217
|
+
exceptions1.gently = "gentl";
|
|
2218
|
+
exceptions1.ugly = "ugli";
|
|
2219
|
+
exceptions1.early = "earli";
|
|
2220
|
+
exceptions1.only = "onli";
|
|
2221
|
+
exceptions1.singly = "singl";
|
|
2222
|
+
exceptions1.sky = "sky";
|
|
2223
|
+
exceptions1.news = "news";
|
|
2224
|
+
exceptions1.atlas = "atlas";
|
|
2225
|
+
exceptions1.cosmos = "cosmos";
|
|
2226
|
+
exceptions1.bias = "bias";
|
|
2227
|
+
exceptions1.andes = "andes";
|
|
2228
|
+
var rgxException2 = /^(inning|outing|canning|herring|proceed|exceed|succeed|earring)$/;
|
|
2229
|
+
var prelude = function(s) {
|
|
2230
|
+
return s.replace(/^y/, "3").replace(/([aeiou])y/, "$13").replace(/\’s$|\'s$/, "").replace(/s\’$|s\'$/, "").replace(/[\’\']$/, "");
|
|
2231
|
+
};
|
|
2232
|
+
var isShort = function(s) {
|
|
2233
|
+
return /[^aeiouy][aeiouy][^aeiouywx3]$/.test(s) || /^[aeiouy][^aeiouy]{0,1}$/.test(s);
|
|
2234
|
+
};
|
|
2235
|
+
var markRegions = function(s) {
|
|
2236
|
+
var m1, m2;
|
|
2237
|
+
var rgxRegions = /[aeiouy]+([^aeiouy]{1}.+)/;
|
|
2238
|
+
m1 = rgxRegions.exec(s);
|
|
2239
|
+
if (!m1) return { r1: "", r2: "" };
|
|
2240
|
+
m1 = m1[1].slice(1);
|
|
2241
|
+
m1 = /^(gener|commun|arsen)/.test(s) ? s.replace(/^(gener|commun|arsen)(.*)/, "$2") : m1;
|
|
2242
|
+
m2 = rgxRegions.exec(m1);
|
|
2243
|
+
if (!m2) return { r1: m1, r2: "" };
|
|
2244
|
+
m2 = m2[1].slice(1);
|
|
2245
|
+
return { r1: m1, r2: m2 };
|
|
2246
|
+
};
|
|
2247
|
+
var step1a = function(s) {
|
|
2248
|
+
var wordPart;
|
|
2249
|
+
if (rgxSFXsses.test(s)) return s.replace(rgxSFXsses, "$1ss");
|
|
2250
|
+
if (rgxSFXiedORies2.test(s)) return s.replace(rgxSFXiedORies2, "$1i");
|
|
2251
|
+
if (rgxSFXiedORies1.test(s)) return s.replace(rgxSFXiedORies1, "$1ie");
|
|
2252
|
+
if (rgxSFXusORss.test(s)) return s;
|
|
2253
|
+
wordPart = s.replace(rgxSFXs, "$1");
|
|
2254
|
+
if (/[aeiuouy](.+)$/.test(wordPart)) return s.replace(rgxSFXs, "$1");
|
|
2255
|
+
return s;
|
|
2256
|
+
};
|
|
2257
|
+
var step1b = function(s) {
|
|
2258
|
+
var rgn = markRegions(s), sd;
|
|
2259
|
+
if (rgxSFXeedlyOReed.test(s))
|
|
2260
|
+
return rgxSFXeedlyOReed.test(rgn.r1) ? s.replace(rgxSFXeedlyOReed, "$1ee") : s;
|
|
2261
|
+
if (rgxSFXedORedlyORinglyORing.test(s)) {
|
|
2262
|
+
sd = s.replace(rgxSFXedORedlyORinglyORing, "$1");
|
|
2263
|
+
rgn = markRegions(sd);
|
|
2264
|
+
return rgxSFXatORblORiz.test(sd) ? sd + "e" : (
|
|
2265
|
+
// or
|
|
2266
|
+
rgxDouble.test(sd) ? sd.replace(/.$/, "") : (
|
|
2267
|
+
// or
|
|
2268
|
+
isShort(sd) && rgn.r1 === "" ? sd + "e" : (
|
|
2269
|
+
// or
|
|
2270
|
+
sd
|
|
2271
|
+
)
|
|
2272
|
+
)
|
|
2273
|
+
);
|
|
2274
|
+
}
|
|
2275
|
+
return s;
|
|
2276
|
+
};
|
|
2277
|
+
var step1c = function(s) {
|
|
2278
|
+
return s.replace(rgxSFXyOR3, "$1i");
|
|
2279
|
+
};
|
|
2280
|
+
var step2 = function(s) {
|
|
2281
|
+
var i, imax, rgn = markRegions(s), us;
|
|
2282
|
+
var match = s.match(rgxSFXstep2);
|
|
2283
|
+
match = match === null ? "$$$$$" : match[1];
|
|
2284
|
+
if (rgn.r1.indexOf(match) !== -1) {
|
|
2285
|
+
for (i = 0, imax = rgxSFXstep2WithReplacements.length; i < imax; i += 1) {
|
|
2286
|
+
us = s.replace(rgxSFXstep2WithReplacements[i].rgx, rgxSFXstep2WithReplacements[i].replacement);
|
|
2287
|
+
if (s !== us) return us;
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
return s;
|
|
2291
|
+
};
|
|
2292
|
+
var step3 = function(s) {
|
|
2293
|
+
var i, imax, rgn = markRegions(s), us;
|
|
2294
|
+
var match = s.match(rgxSFXstep3);
|
|
2295
|
+
match = match === null ? "$$$$$" : match[1];
|
|
2296
|
+
if (rgn.r1.indexOf(match) !== -1) {
|
|
2297
|
+
for (i = 0, imax = rgxSFXstep3WithReplacements.length; i < imax; i += 1) {
|
|
2298
|
+
us = s.replace(rgxSFXstep3WithReplacements[i].rgx, rgxSFXstep3WithReplacements[i].replacement);
|
|
2299
|
+
if (s !== us) return us;
|
|
2300
|
+
}
|
|
2301
|
+
if (/ative/.test(rgn.r2)) return s.replace(/ative$/, "");
|
|
2302
|
+
}
|
|
2303
|
+
return s;
|
|
2304
|
+
};
|
|
2305
|
+
var step4 = function(s) {
|
|
2306
|
+
var rgn = markRegions(s);
|
|
2307
|
+
var match = s.match(rgxSFXstep4Full);
|
|
2308
|
+
match = match === null ? "$$$$$" : match[1];
|
|
2309
|
+
if (rgxSFXstep4Full.test(s) && rgn.r2.indexOf(match) !== -1) {
|
|
2310
|
+
return rgxSFXstep4.test(s) ? s.replace(rgxSFXstep4, "") : rgxSFXstep4ion.test(s) ? s.replace(rgxSFXstep4ion, "$1$2") : s;
|
|
2311
|
+
}
|
|
2312
|
+
return s;
|
|
2313
|
+
};
|
|
2314
|
+
var step5 = function(s) {
|
|
2315
|
+
var preceding, rgn;
|
|
2316
|
+
rgn = markRegions(s);
|
|
2317
|
+
if (/e$/i.test(s)) {
|
|
2318
|
+
preceding = s.replace(/e$/, "");
|
|
2319
|
+
return (
|
|
2320
|
+
// Found: delete if in R2, or in R1 and not preceded by a short syllable
|
|
2321
|
+
/e/.test(rgn.r2) || /e/.test(rgn.r1) && !isShort(preceding) ? preceding : s
|
|
2322
|
+
);
|
|
2323
|
+
}
|
|
2324
|
+
if (/l$/.test(s)) {
|
|
2325
|
+
rgn = markRegions(s);
|
|
2326
|
+
return rgn.r2 && /l$/.test(rgn.r2) ? s.replace(/ll$/, "l") : s;
|
|
2327
|
+
}
|
|
2328
|
+
return s;
|
|
2329
|
+
};
|
|
2330
|
+
var stem2 = function(word) {
|
|
2331
|
+
var str = word.toLowerCase();
|
|
2332
|
+
if (str.length < 3) return str;
|
|
2333
|
+
if (exceptions1[str]) return exceptions1[str];
|
|
2334
|
+
str = prelude(str);
|
|
2335
|
+
str = step1a(str);
|
|
2336
|
+
if (!rgxException2.test(str)) {
|
|
2337
|
+
str = step1b(str);
|
|
2338
|
+
str = step1c(str);
|
|
2339
|
+
str = step2(str);
|
|
2340
|
+
str = step3(str);
|
|
2341
|
+
str = step4(str);
|
|
2342
|
+
str = step5(str);
|
|
2343
|
+
}
|
|
2344
|
+
str = str.replace(/3/g, "y");
|
|
2345
|
+
return str;
|
|
2346
|
+
};
|
|
2347
|
+
module2.exports = stem2;
|
|
2348
|
+
}
|
|
2349
|
+
});
|
|
2350
|
+
|
|
2142
2351
|
// ../../packages/@company/encryption/src/search-tokens.ts
|
|
2352
|
+
var import_wink_porter2_stemmer, SEARCH_TOKEN_VERSION, SEARCH_TOKEN_PREFIX;
|
|
2143
2353
|
var init_search_tokens = __esm({
|
|
2144
2354
|
"../../packages/@company/encryption/src/search-tokens.ts"() {
|
|
2145
2355
|
"use strict";
|
|
2146
2356
|
init_hmac();
|
|
2147
2357
|
init_org_keys();
|
|
2358
|
+
import_wink_porter2_stemmer = __toESM(require_wink_porter2_stemmer());
|
|
2359
|
+
SEARCH_TOKEN_VERSION = 2;
|
|
2360
|
+
SEARCH_TOKEN_PREFIX = `h${SEARCH_TOKEN_VERSION}`;
|
|
2148
2361
|
}
|
|
2149
2362
|
});
|
|
2150
2363
|
|
|
@@ -19676,7 +19889,7 @@ var require_split2 = __commonJS({
|
|
|
19676
19889
|
var require_helper = __commonJS({
|
|
19677
19890
|
"../../node_modules/pgpass/lib/helper.js"(exports2, module2) {
|
|
19678
19891
|
"use strict";
|
|
19679
|
-
var
|
|
19892
|
+
var path2 = require("path");
|
|
19680
19893
|
var Stream = require("stream").Stream;
|
|
19681
19894
|
var split = require_split2();
|
|
19682
19895
|
var util2 = require("util");
|
|
@@ -19715,7 +19928,7 @@ var require_helper = __commonJS({
|
|
|
19715
19928
|
};
|
|
19716
19929
|
module2.exports.getFileName = function(rawEnv) {
|
|
19717
19930
|
var env = rawEnv || process.env;
|
|
19718
|
-
var file2 = env.PGPASSFILE || (isWin ?
|
|
19931
|
+
var file2 = env.PGPASSFILE || (isWin ? path2.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path2.join(env.HOME || "./", ".pgpass"));
|
|
19719
19932
|
return file2;
|
|
19720
19933
|
};
|
|
19721
19934
|
module2.exports.usePgPass = function(stats, fname) {
|
|
@@ -19847,7 +20060,7 @@ var require_helper = __commonJS({
|
|
|
19847
20060
|
var require_lib2 = __commonJS({
|
|
19848
20061
|
"../../node_modules/pgpass/lib/index.js"(exports2, module2) {
|
|
19849
20062
|
"use strict";
|
|
19850
|
-
var
|
|
20063
|
+
var path2 = require("path");
|
|
19851
20064
|
var fs = require("fs");
|
|
19852
20065
|
var helper = require_helper();
|
|
19853
20066
|
module2.exports = function(connInfo, cb) {
|
|
@@ -21325,6 +21538,19 @@ var init_client = __esm({
|
|
|
21325
21538
|
}
|
|
21326
21539
|
});
|
|
21327
21540
|
|
|
21541
|
+
// ../../packages/@company/db/src/byod/routed-pool.ts
|
|
21542
|
+
var logger, ROUTED_TENANT_CONTEXT, ROUTED_TENANT_RAW_POOL, ADMITTED_TENANT_CONTEXT;
|
|
21543
|
+
var init_routed_pool = __esm({
|
|
21544
|
+
"../../packages/@company/db/src/byod/routed-pool.ts"() {
|
|
21545
|
+
"use strict";
|
|
21546
|
+
init_src2();
|
|
21547
|
+
logger = createLogger("db-byod-routed-pool");
|
|
21548
|
+
ROUTED_TENANT_CONTEXT = Symbol.for("haansi.db.routedTenantContext");
|
|
21549
|
+
ROUTED_TENANT_RAW_POOL = Symbol.for("haansi.db.routedTenantRawPool");
|
|
21550
|
+
ADMITTED_TENANT_CONTEXT = Symbol.for("haansi.db.admittedTenantContext");
|
|
21551
|
+
}
|
|
21552
|
+
});
|
|
21553
|
+
|
|
21328
21554
|
// ../../packages/@company/db/src/org-context.ts
|
|
21329
21555
|
var observability3, DECRYPTING_CLIENT;
|
|
21330
21556
|
var init_org_context = __esm({
|
|
@@ -21332,16 +21558,299 @@ var init_org_context = __esm({
|
|
|
21332
21558
|
"use strict";
|
|
21333
21559
|
init_src4();
|
|
21334
21560
|
init_src2();
|
|
21561
|
+
init_routed_pool();
|
|
21335
21562
|
observability3 = createObservabilityService("db-org-context");
|
|
21336
21563
|
DECRYPTING_CLIENT = Symbol.for("haansi.db.decryptingClient");
|
|
21337
21564
|
}
|
|
21338
21565
|
});
|
|
21339
21566
|
|
|
21567
|
+
// ../../packages/@company/types/src/timeline.ts
|
|
21568
|
+
var init_timeline = __esm({
|
|
21569
|
+
"../../packages/@company/types/src/timeline.ts"() {
|
|
21570
|
+
"use strict";
|
|
21571
|
+
}
|
|
21572
|
+
});
|
|
21573
|
+
|
|
21574
|
+
// ../../packages/@company/types/src/artifact.ts
|
|
21575
|
+
var init_artifact = __esm({
|
|
21576
|
+
"../../packages/@company/types/src/artifact.ts"() {
|
|
21577
|
+
"use strict";
|
|
21578
|
+
}
|
|
21579
|
+
});
|
|
21580
|
+
|
|
21581
|
+
// ../../packages/@company/types/src/taxonomy.ts
|
|
21582
|
+
function normalizeSessionType(raw) {
|
|
21583
|
+
if (!raw) return "general";
|
|
21584
|
+
const lower = raw.toLowerCase().trim();
|
|
21585
|
+
if (lower in SESSION_TYPES) return lower;
|
|
21586
|
+
if (lower in SESSION_TYPE_ALIASES) return SESSION_TYPE_ALIASES[lower];
|
|
21587
|
+
return "general";
|
|
21588
|
+
}
|
|
21589
|
+
function normalizeComplexity(raw) {
|
|
21590
|
+
if (!raw) return "moderate";
|
|
21591
|
+
const lower = raw.toLowerCase().trim();
|
|
21592
|
+
if (lower in COMPLEXITIES) return lower;
|
|
21593
|
+
return "moderate";
|
|
21594
|
+
}
|
|
21595
|
+
function isReservedArtifactType(id) {
|
|
21596
|
+
const meta3 = ARTIFACT_TYPES[id];
|
|
21597
|
+
return meta3?.reserved === true;
|
|
21598
|
+
}
|
|
21599
|
+
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;
|
|
21600
|
+
var init_taxonomy = __esm({
|
|
21601
|
+
"../../packages/@company/types/src/taxonomy.ts"() {
|
|
21602
|
+
"use strict";
|
|
21603
|
+
SESSION_TYPES = {
|
|
21604
|
+
debugging: {
|
|
21605
|
+
label: "Debugging",
|
|
21606
|
+
description: "Investigating and fixing bugs or errors"
|
|
21607
|
+
},
|
|
21608
|
+
feature_implementation: {
|
|
21609
|
+
label: "Feature Implementation",
|
|
21610
|
+
description: "Building new functionality or features"
|
|
21611
|
+
},
|
|
21612
|
+
code_review: {
|
|
21613
|
+
label: "Code Review",
|
|
21614
|
+
description: "Reviewing code for quality, correctness, or style"
|
|
21615
|
+
},
|
|
21616
|
+
deployment: {
|
|
21617
|
+
label: "Deployment",
|
|
21618
|
+
description: "Deploying, releasing, or provisioning infrastructure"
|
|
21619
|
+
},
|
|
21620
|
+
refactoring: {
|
|
21621
|
+
label: "Refactoring",
|
|
21622
|
+
description: "Restructuring existing code without changing behavior"
|
|
21623
|
+
},
|
|
21624
|
+
configuration: {
|
|
21625
|
+
label: "Configuration",
|
|
21626
|
+
description: "Setting up or modifying project/tool configuration"
|
|
21627
|
+
},
|
|
21628
|
+
question_answer: {
|
|
21629
|
+
label: "Question & Answer",
|
|
21630
|
+
description: "Asking or answering questions about code or systems"
|
|
21631
|
+
},
|
|
21632
|
+
general: {
|
|
21633
|
+
label: "General",
|
|
21634
|
+
description: "General-purpose session not fitting other categories"
|
|
21635
|
+
}
|
|
21636
|
+
};
|
|
21637
|
+
SESSION_TYPE_ALIASES = {
|
|
21638
|
+
bug_fix: "debugging",
|
|
21639
|
+
feature: "feature_implementation",
|
|
21640
|
+
refactor: "refactoring",
|
|
21641
|
+
config: "configuration"
|
|
21642
|
+
};
|
|
21643
|
+
COMPLEXITIES = {
|
|
21644
|
+
simple: {
|
|
21645
|
+
label: "Simple",
|
|
21646
|
+
description: "Straightforward task with few steps"
|
|
21647
|
+
},
|
|
21648
|
+
moderate: {
|
|
21649
|
+
label: "Moderate",
|
|
21650
|
+
description: "Multi-step task requiring some investigation"
|
|
21651
|
+
},
|
|
21652
|
+
complex: {
|
|
21653
|
+
label: "Complex",
|
|
21654
|
+
description: "Involved task with many steps or deep analysis"
|
|
21655
|
+
}
|
|
21656
|
+
};
|
|
21657
|
+
ARTIFACT_TYPES = {
|
|
21658
|
+
report_incident: {
|
|
21659
|
+
category: "report",
|
|
21660
|
+
label: "Incident Report",
|
|
21661
|
+
description: "Production-incident record + post-incident writeup: detection, timeline, root cause, resolution, follow-ups.",
|
|
21662
|
+
icon: "AlertTriangle",
|
|
21663
|
+
aliases: ["incident_summary", "incident", "postmortem", "post-mortem"],
|
|
21664
|
+
autoApproved: false,
|
|
21665
|
+
producedBy: [
|
|
21666
|
+
"POST /api/v1/memory/processes/incidents",
|
|
21667
|
+
"POST /api/v1/memory/reports/incident",
|
|
21668
|
+
"POST /api/v1/memory/processes/incidents/:id/postmortem"
|
|
21669
|
+
]
|
|
21670
|
+
},
|
|
21671
|
+
report_decision: {
|
|
21672
|
+
category: "report",
|
|
21673
|
+
label: "Decision Record",
|
|
21674
|
+
description: "Architectural / product decision record with context, options considered, decision, and rationale.",
|
|
21675
|
+
icon: "Scale",
|
|
21676
|
+
aliases: ["decision_record", "decision-record", "adr"],
|
|
21677
|
+
autoApproved: false,
|
|
21678
|
+
producedBy: ["POST /api/v1/memory"]
|
|
21679
|
+
},
|
|
21680
|
+
report_work: {
|
|
21681
|
+
category: "report",
|
|
21682
|
+
label: "Work Report",
|
|
21683
|
+
description: "Periodic or one-off work-progress report \u2014 status updates, weekly digests, project rollups, team-activity summaries.",
|
|
21684
|
+
icon: "CalendarDays",
|
|
21685
|
+
aliases: ["weekly_digest", "weekly-digest", "status_report"],
|
|
21686
|
+
autoApproved: true,
|
|
21687
|
+
producedBy: ["POST /api/v1/memory", "POST /api/v1/memory/reports/work"]
|
|
21688
|
+
},
|
|
21689
|
+
report_sop: {
|
|
21690
|
+
category: "report",
|
|
21691
|
+
label: "Standard Operating Procedure",
|
|
21692
|
+
description: "Reusable step-by-step procedure or runbook. Placeholder \u2014 surface not yet specialized; written via generic POST /memory until a dedicated producer ships.",
|
|
21693
|
+
icon: "FileText",
|
|
21694
|
+
aliases: ["sop", "runbook"],
|
|
21695
|
+
autoApproved: false,
|
|
21696
|
+
producedBy: ["POST /api/v1/memory"]
|
|
21697
|
+
},
|
|
21698
|
+
report_onboarding: {
|
|
21699
|
+
category: "report",
|
|
21700
|
+
label: "Onboarding Packet",
|
|
21701
|
+
description: "Onboarding guide assembled from team knowledge, scoped to a project or role.",
|
|
21702
|
+
icon: "GraduationCap",
|
|
21703
|
+
aliases: ["onboarding_packet", "onboarding-packet"],
|
|
21704
|
+
autoApproved: false,
|
|
21705
|
+
producedBy: ["POST /api/v1/memory/reports/onboarding"]
|
|
21706
|
+
},
|
|
21707
|
+
report_pr: {
|
|
21708
|
+
category: "report",
|
|
21709
|
+
label: "PR Context",
|
|
21710
|
+
description: "Enriched pull-request description with linked Jira/Slack context, recent decisions, and reviewer hints.",
|
|
21711
|
+
icon: "GitPullRequest",
|
|
21712
|
+
aliases: ["pr_context", "pr-context"],
|
|
21713
|
+
autoApproved: true,
|
|
21714
|
+
producedBy: ["POST /api/v1/memory/reports/pr"]
|
|
21715
|
+
},
|
|
21716
|
+
expert: {
|
|
21717
|
+
category: "expert",
|
|
21718
|
+
label: "Expert Profile",
|
|
21719
|
+
description: "Per-person expertise profile across platforms \u2014 areas of focus, recent contributions, identity links.",
|
|
21720
|
+
icon: "Users",
|
|
21721
|
+
aliases: ["expert_profile", "expert-profile"],
|
|
21722
|
+
autoApproved: false,
|
|
21723
|
+
// No longer produced: expert profiles are versioned in expert_profiles
|
|
21724
|
+
// (Expert Profiles v2). Snapshots saved earlier stay readable.
|
|
21725
|
+
producedBy: []
|
|
21726
|
+
},
|
|
21727
|
+
solution_mined: {
|
|
21728
|
+
category: "solution",
|
|
21729
|
+
label: "Mined Solution",
|
|
21730
|
+
description: "Problem + solution mined automatically from a developer coding session (the distilled-path pipeline).",
|
|
21731
|
+
icon: "Lightbulb",
|
|
21732
|
+
aliases: ["solution", "mined_solution", "distilled_path"],
|
|
21733
|
+
autoApproved: true,
|
|
21734
|
+
producedBy: ["POST /api/v1/memory/solutions/mined"]
|
|
21735
|
+
},
|
|
21736
|
+
solution_qna: {
|
|
21737
|
+
category: "solution",
|
|
21738
|
+
label: "Q&A Solution",
|
|
21739
|
+
description: "Q&A answer marked verified by a user and distilled into reusable knowledge \u2014 promoted out of a conversation thread.",
|
|
21740
|
+
icon: "ThumbsUp",
|
|
21741
|
+
aliases: ["verified_answer", "verified-answer"],
|
|
21742
|
+
autoApproved: true,
|
|
21743
|
+
producedBy: ["POST /api/v1/memory/recall/messages/:id/feedback"]
|
|
21744
|
+
},
|
|
21745
|
+
digest_entry: {
|
|
21746
|
+
category: "digest",
|
|
21747
|
+
label: "Digest Entry",
|
|
21748
|
+
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.",
|
|
21749
|
+
icon: "Mail",
|
|
21750
|
+
aliases: [],
|
|
21751
|
+
autoApproved: true,
|
|
21752
|
+
producedBy: [],
|
|
21753
|
+
reserved: true
|
|
21754
|
+
}
|
|
21755
|
+
};
|
|
21756
|
+
__seenAliases = /* @__PURE__ */ new Set();
|
|
21757
|
+
for (const [id, meta3] of Object.entries(ARTIFACT_TYPES)) {
|
|
21758
|
+
for (const a of meta3.aliases) {
|
|
21759
|
+
if (__seenAliases.has(a)) {
|
|
21760
|
+
throw new Error(
|
|
21761
|
+
`[taxonomy] alias "${a}" declared on multiple artifact types; last seen on "${id}"`
|
|
21762
|
+
);
|
|
21763
|
+
}
|
|
21764
|
+
__seenAliases.add(a);
|
|
21765
|
+
}
|
|
21766
|
+
}
|
|
21767
|
+
ALIAS_REVERSE_MAP = Object.freeze(
|
|
21768
|
+
Object.fromEntries(
|
|
21769
|
+
Object.entries(ARTIFACT_TYPES).flatMap(
|
|
21770
|
+
([id, meta3]) => meta3.aliases.map((a) => [a, id])
|
|
21771
|
+
)
|
|
21772
|
+
)
|
|
21773
|
+
);
|
|
21774
|
+
ARTIFACT_TYPE_IDS = Object.keys(
|
|
21775
|
+
ARTIFACT_TYPES
|
|
21776
|
+
);
|
|
21777
|
+
AUTO_APPROVED_ARTIFACT_TYPES = ARTIFACT_TYPE_IDS.filter((id) => ARTIFACT_TYPES[id].autoApproved);
|
|
21778
|
+
GENERIC_WRITABLE_ARTIFACT_TYPE_IDS = ARTIFACT_TYPE_IDS.filter((id) => !isReservedArtifactType(id));
|
|
21779
|
+
}
|
|
21780
|
+
});
|
|
21781
|
+
|
|
21782
|
+
// ../../packages/@company/types/src/embedding.ts
|
|
21783
|
+
var EMBEDDING_DEFAULTS, EMBEDDING_COLUMN, SUMMARY_EMBEDDING_COLUMN;
|
|
21784
|
+
var init_embedding = __esm({
|
|
21785
|
+
"../../packages/@company/types/src/embedding.ts"() {
|
|
21786
|
+
"use strict";
|
|
21787
|
+
EMBEDDING_DEFAULTS = {
|
|
21788
|
+
// `as const` gives a literal string type for the provider field, which
|
|
21789
|
+
// is assignable to llm-client's LLMProvider union without forcing
|
|
21790
|
+
// @company/types to import that union (which would re-introduce the
|
|
21791
|
+
// dependency edge we want to keep absent).
|
|
21792
|
+
// CUTOVER (2026-07-17): in-house model is now the active config. Reads +
|
|
21793
|
+
// writes + backfills all target the local-768 columns. The old OpenAI 1536
|
|
21794
|
+
// columns (`embedding` / `summary_embedding`) are retained but dormant —
|
|
21795
|
+
// roll back by flipping this whole object back to
|
|
21796
|
+
// { provider:"openai", model:"text-embedding-3-small", dimensions:1536,
|
|
21797
|
+
// column:"embedding", summaryColumn:"summary_embedding" }
|
|
21798
|
+
// (a later contract migration drops the dormant columns). Readers alias
|
|
21799
|
+
// `<column> AS embedding` so result-row field names stay stable.
|
|
21800
|
+
provider: "local",
|
|
21801
|
+
model: "Alibaba-NLP/gte-base-en-v1.5",
|
|
21802
|
+
dimensions: 768,
|
|
21803
|
+
// The ACTIVE dense-vector column that every reader + writer + backfill targets.
|
|
21804
|
+
column: "embedding_v2",
|
|
21805
|
+
// The active summary-embedding column (process_registry's second vector,
|
|
21806
|
+
// used by the process matcher).
|
|
21807
|
+
summaryColumn: "summary_embedding_v2"
|
|
21808
|
+
};
|
|
21809
|
+
EMBEDDING_COLUMN = EMBEDDING_DEFAULTS.column;
|
|
21810
|
+
SUMMARY_EMBEDDING_COLUMN = EMBEDDING_DEFAULTS.summaryColumn;
|
|
21811
|
+
}
|
|
21812
|
+
});
|
|
21813
|
+
|
|
21814
|
+
// ../../packages/@company/types/src/repo-file-url.ts
|
|
21815
|
+
var init_repo_file_url = __esm({
|
|
21816
|
+
"../../packages/@company/types/src/repo-file-url.ts"() {
|
|
21817
|
+
"use strict";
|
|
21818
|
+
}
|
|
21819
|
+
});
|
|
21820
|
+
|
|
21821
|
+
// ../../packages/@company/types/src/query-dialect.ts
|
|
21822
|
+
var init_query_dialect = __esm({
|
|
21823
|
+
"../../packages/@company/types/src/query-dialect.ts"() {
|
|
21824
|
+
"use strict";
|
|
21825
|
+
}
|
|
21826
|
+
});
|
|
21827
|
+
|
|
21828
|
+
// ../../packages/@company/types/src/report-template.ts
|
|
21829
|
+
var init_report_template = __esm({
|
|
21830
|
+
"../../packages/@company/types/src/report-template.ts"() {
|
|
21831
|
+
"use strict";
|
|
21832
|
+
}
|
|
21833
|
+
});
|
|
21834
|
+
|
|
21835
|
+
// ../../packages/@company/types/src/index.ts
|
|
21836
|
+
var init_src5 = __esm({
|
|
21837
|
+
"../../packages/@company/types/src/index.ts"() {
|
|
21838
|
+
init_timeline();
|
|
21839
|
+
init_artifact();
|
|
21840
|
+
init_taxonomy();
|
|
21841
|
+
init_embedding();
|
|
21842
|
+
init_repo_file_url();
|
|
21843
|
+
init_query_dialect();
|
|
21844
|
+
init_report_template();
|
|
21845
|
+
}
|
|
21846
|
+
});
|
|
21847
|
+
|
|
21340
21848
|
// ../../packages/@company/db/src/search-vector-write.ts
|
|
21341
21849
|
var KNOWLEDGE_ARTIFACT_VECTOR_NULLS, PROCESS_REGISTRY_VECTOR_NULLS;
|
|
21342
21850
|
var init_search_vector_write = __esm({
|
|
21343
21851
|
"../../packages/@company/db/src/search-vector-write.ts"() {
|
|
21344
21852
|
"use strict";
|
|
21853
|
+
init_src5();
|
|
21345
21854
|
init_src4();
|
|
21346
21855
|
init_org_context();
|
|
21347
21856
|
KNOWLEDGE_ARTIFACT_VECTOR_NULLS = (KNOWLEDGE_ARTIFACTS_SEARCH_VECTOR.weights ?? []).map(() => null);
|
|
@@ -21387,6 +21896,37 @@ var init_integration_purge = __esm({
|
|
|
21387
21896
|
}
|
|
21388
21897
|
});
|
|
21389
21898
|
|
|
21899
|
+
// ../../packages/@company/db/src/person-source-identities.ts
|
|
21900
|
+
var init_person_source_identities = __esm({
|
|
21901
|
+
"../../packages/@company/db/src/person-source-identities.ts"() {
|
|
21902
|
+
"use strict";
|
|
21903
|
+
init_org_context();
|
|
21904
|
+
}
|
|
21905
|
+
});
|
|
21906
|
+
|
|
21907
|
+
// ../../packages/@company/db/src/expert-evidence-availability.ts
|
|
21908
|
+
var init_expert_evidence_availability = __esm({
|
|
21909
|
+
"../../packages/@company/db/src/expert-evidence-availability.ts"() {
|
|
21910
|
+
"use strict";
|
|
21911
|
+
init_org_context();
|
|
21912
|
+
}
|
|
21913
|
+
});
|
|
21914
|
+
|
|
21915
|
+
// ../../packages/@company/db/src/activity-title.ts
|
|
21916
|
+
var init_activity_title = __esm({
|
|
21917
|
+
"../../packages/@company/db/src/activity-title.ts"() {
|
|
21918
|
+
"use strict";
|
|
21919
|
+
}
|
|
21920
|
+
});
|
|
21921
|
+
|
|
21922
|
+
// ../../packages/@company/db/src/expert-areas.ts
|
|
21923
|
+
var init_expert_areas = __esm({
|
|
21924
|
+
"../../packages/@company/db/src/expert-areas.ts"() {
|
|
21925
|
+
"use strict";
|
|
21926
|
+
init_src4();
|
|
21927
|
+
}
|
|
21928
|
+
});
|
|
21929
|
+
|
|
21390
21930
|
// ../../packages/@company/db/src/exchange-context.ts
|
|
21391
21931
|
var observability6;
|
|
21392
21932
|
var init_exchange_context = __esm({
|
|
@@ -21409,6 +21949,7 @@ var init_organization_data_access = __esm({
|
|
|
21409
21949
|
"../../packages/@company/db/src/data-access/organization-data-access.ts"() {
|
|
21410
21950
|
"use strict";
|
|
21411
21951
|
init_src4();
|
|
21952
|
+
init_org_context();
|
|
21412
21953
|
}
|
|
21413
21954
|
});
|
|
21414
21955
|
|
|
@@ -21450,11 +21991,26 @@ var init_config_cache = __esm({
|
|
|
21450
21991
|
}
|
|
21451
21992
|
});
|
|
21452
21993
|
|
|
21994
|
+
// ../../packages/@company/db/src/byod/control-plane-residency.ts
|
|
21995
|
+
var init_control_plane_residency = __esm({
|
|
21996
|
+
"../../packages/@company/db/src/byod/control-plane-residency.ts"() {
|
|
21997
|
+
"use strict";
|
|
21998
|
+
}
|
|
21999
|
+
});
|
|
22000
|
+
|
|
22001
|
+
// ../../packages/@company/db/src/byod/org-db-resolver.ts
|
|
22002
|
+
var init_org_db_resolver = __esm({
|
|
22003
|
+
"../../packages/@company/db/src/byod/org-db-resolver.ts"() {
|
|
22004
|
+
"use strict";
|
|
22005
|
+
init_pool_manager();
|
|
22006
|
+
init_routed_pool();
|
|
22007
|
+
}
|
|
22008
|
+
});
|
|
22009
|
+
|
|
21453
22010
|
// ../../packages/@company/db/src/byod/source-events-routing.ts
|
|
21454
22011
|
var init_source_events_routing = __esm({
|
|
21455
22012
|
"../../packages/@company/db/src/byod/source-events-routing.ts"() {
|
|
21456
22013
|
"use strict";
|
|
21457
|
-
init_pool_manager();
|
|
21458
22014
|
}
|
|
21459
22015
|
});
|
|
21460
22016
|
|
|
@@ -21464,24 +22020,17 @@ var init_integration_storage = __esm({
|
|
|
21464
22020
|
"use strict";
|
|
21465
22021
|
init_config_cache();
|
|
21466
22022
|
init_pool_manager();
|
|
22023
|
+
init_org_db_resolver();
|
|
21467
22024
|
init_source_events_routing();
|
|
21468
22025
|
}
|
|
21469
22026
|
});
|
|
21470
22027
|
|
|
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
22028
|
// ../../packages/@company/db/src/byod/query-helper.ts
|
|
21480
22029
|
var init_query_helper = __esm({
|
|
21481
22030
|
"../../packages/@company/db/src/byod/query-helper.ts"() {
|
|
21482
22031
|
"use strict";
|
|
21483
|
-
init_src4();
|
|
21484
22032
|
init_org_context();
|
|
22033
|
+
init_org_db_resolver();
|
|
21485
22034
|
}
|
|
21486
22035
|
});
|
|
21487
22036
|
|
|
@@ -21494,8 +22043,15 @@ function entry(database, dbName, table, orgScoping, opts = {}) {
|
|
|
21494
22043
|
orgScoping,
|
|
21495
22044
|
scopingColumn: opts.scopingColumn,
|
|
21496
22045
|
hasVectorColumn: opts.hasVectorColumn ?? false,
|
|
21497
|
-
|
|
21498
|
-
|
|
22046
|
+
mergePolicy: opts.mergePolicy,
|
|
22047
|
+
reconciliation: opts.reconciliation ?? (opts.mergePolicy?.identityKey ? {
|
|
22048
|
+
...DEFAULT_RECONCILIATION,
|
|
22049
|
+
identity: {
|
|
22050
|
+
kind: "columns",
|
|
22051
|
+
columns: opts.mergePolicy.identityKey,
|
|
22052
|
+
version: 1
|
|
22053
|
+
}
|
|
22054
|
+
} : DEFAULT_RECONCILIATION)
|
|
21499
22055
|
};
|
|
21500
22056
|
}
|
|
21501
22057
|
function standardIntegrationTables(database, dbName) {
|
|
@@ -21533,58 +22089,17 @@ function standardIntegrationTables(database, dbName) {
|
|
|
21533
22089
|
})
|
|
21534
22090
|
];
|
|
21535
22091
|
}
|
|
21536
|
-
var
|
|
22092
|
+
var DEFAULT_RECONCILIATION, INTELLIGENCE_DB, intelligenceTables, INTEGRATIONS_DB, integrationTables, TABLE_REGISTRY;
|
|
21537
22093
|
var init_table_registry = __esm({
|
|
21538
22094
|
"../../packages/@company/db/src/byod/table-registry.ts"() {
|
|
21539
22095
|
"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
|
-
]);
|
|
22096
|
+
DEFAULT_RECONCILIATION = {
|
|
22097
|
+
identity: { kind: "primary_key" },
|
|
22098
|
+
class: "authoritative",
|
|
22099
|
+
conflictPolicy: "source_wins",
|
|
22100
|
+
deleteDestinationOrphans: true,
|
|
22101
|
+
destinationManagedColumns: ["updated_at"]
|
|
22102
|
+
};
|
|
21588
22103
|
INTELLIGENCE_DB = "haansi_intelligence_prod";
|
|
21589
22104
|
intelligenceTables = [
|
|
21590
22105
|
entry("intelligence", INTELLIGENCE_DB, "haansi_schema_version", "global"),
|
|
@@ -21673,21 +22188,78 @@ var init_table_registry = __esm({
|
|
|
21673
22188
|
entry("intelligence", INTELLIGENCE_DB, "identity_links", "direct", {
|
|
21674
22189
|
scopingColumn: "organization_id"
|
|
21675
22190
|
}),
|
|
21676
|
-
|
|
21677
|
-
// objects.search_vector — rides to BYOD with the object graph.
|
|
21678
|
-
entry("intelligence", INTELLIGENCE_DB, "org_term_df", "direct", {
|
|
22191
|
+
entry("intelligence", INTELLIGENCE_DB, "event_object_links", "direct", {
|
|
21679
22192
|
scopingColumn: "organization_id"
|
|
21680
22193
|
}),
|
|
21681
|
-
entry("intelligence", INTELLIGENCE_DB, "
|
|
22194
|
+
entry("intelligence", INTELLIGENCE_DB, "process_activity_facts", "direct", {
|
|
21682
22195
|
scopingColumn: "organization_id"
|
|
21683
22196
|
}),
|
|
21684
|
-
|
|
22197
|
+
// Role-aware attribution (object-graph/093): durable per-platform identities
|
|
22198
|
+
// and (activity, identity, role) rows. Graph data — rides with PAF.
|
|
22199
|
+
entry("intelligence", INTELLIGENCE_DB, "person_source_identities", "direct", {
|
|
21685
22200
|
scopingColumn: "organization_id"
|
|
21686
22201
|
}),
|
|
21687
|
-
entry("intelligence", INTELLIGENCE_DB, "
|
|
22202
|
+
entry("intelligence", INTELLIGENCE_DB, "activity_participants", "direct", {
|
|
21688
22203
|
scopingColumn: "organization_id"
|
|
21689
22204
|
}),
|
|
21690
|
-
|
|
22205
|
+
// Expert profile change ledger (object-graph/094): pending recompute work,
|
|
22206
|
+
// derived from graph writes. Rides with the object graph.
|
|
22207
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_dirty_queue", "direct", {
|
|
22208
|
+
scopingColumn: "organization_id"
|
|
22209
|
+
}),
|
|
22210
|
+
// Member ↔ person-object links and precomputed expert facts (object-graph/095).
|
|
22211
|
+
entry("intelligence", INTELLIGENCE_DB, "member_identity_links", "direct", {
|
|
22212
|
+
scopingColumn: "organization_id"
|
|
22213
|
+
}),
|
|
22214
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_profile_facts", "direct", {
|
|
22215
|
+
scopingColumn: "organization_id"
|
|
22216
|
+
}),
|
|
22217
|
+
// Expert profile synthesis (object-graph/096).
|
|
22218
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_evidence_refs", "direct", {
|
|
22219
|
+
scopingColumn: "organization_id"
|
|
22220
|
+
}),
|
|
22221
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_profiles", "direct", {
|
|
22222
|
+
scopingColumn: "organization_id"
|
|
22223
|
+
}),
|
|
22224
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_profile_citations", "direct", {
|
|
22225
|
+
scopingColumn: "organization_id"
|
|
22226
|
+
}),
|
|
22227
|
+
entry("intelligence", INTELLIGENCE_DB, "org_expertise_areas", "direct", {
|
|
22228
|
+
scopingColumn: "organization_id"
|
|
22229
|
+
}),
|
|
22230
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_areas", "direct", {
|
|
22231
|
+
scopingColumn: "organization_id"
|
|
22232
|
+
}),
|
|
22233
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_synthesis_claims", "direct", {
|
|
22234
|
+
scopingColumn: "organization_id"
|
|
22235
|
+
}),
|
|
22236
|
+
// Org-level expertise grouping (object-graph/100).
|
|
22237
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_grouping_state", "direct", {
|
|
22238
|
+
scopingColumn: "organization_id"
|
|
22239
|
+
}),
|
|
22240
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_area_merge_log", "direct", {
|
|
22241
|
+
scopingColumn: "organization_id"
|
|
22242
|
+
}),
|
|
22243
|
+
entry("intelligence", INTELLIGENCE_DB, "expert_profile_curation", "direct", {
|
|
22244
|
+
scopingColumn: "organization_id"
|
|
22245
|
+
}),
|
|
22246
|
+
entry(
|
|
22247
|
+
"intelligence",
|
|
22248
|
+
INTELLIGENCE_DB,
|
|
22249
|
+
"expert_profile_curation_log",
|
|
22250
|
+
"direct",
|
|
22251
|
+
{ scopingColumn: "organization_id" }
|
|
22252
|
+
),
|
|
22253
|
+
// Digests (migrations/digests/002): the generation queue, what each entry
|
|
22254
|
+
// cites, and the audit log of explicit cross-member access. They ride with
|
|
22255
|
+
// knowledge_artifacts, where digest entries live.
|
|
22256
|
+
entry("intelligence", INTELLIGENCE_DB, "digest_generation_queue", "direct", {
|
|
22257
|
+
scopingColumn: "organization_id"
|
|
22258
|
+
}),
|
|
22259
|
+
entry("intelligence", INTELLIGENCE_DB, "digest_evidence_refs", "direct", {
|
|
22260
|
+
scopingColumn: "organization_id"
|
|
22261
|
+
}),
|
|
22262
|
+
entry("intelligence", INTELLIGENCE_DB, "digest_access_log", "direct", {
|
|
21691
22263
|
scopingColumn: "organization_id"
|
|
21692
22264
|
}),
|
|
21693
22265
|
entry("intelligence", INTELLIGENCE_DB, "activity_graph_edges", "direct", {
|
|
@@ -21768,12 +22340,12 @@ var init_table_registry = __esm({
|
|
|
21768
22340
|
scopingColumn: "organization_id"
|
|
21769
22341
|
}),
|
|
21770
22342
|
// Artifact-domain, always-BYOD (read/written via getUserdataPool like the rest
|
|
21771
|
-
// of the artifacts).
|
|
22343
|
+
// of the artifacts).
|
|
21772
22344
|
entry("intelligence", INTELLIGENCE_DB, "artifact_corrections", "direct", {
|
|
21773
22345
|
scopingColumn: "organization_id"
|
|
21774
22346
|
}),
|
|
21775
22347
|
// Object-graph identity/merge/override/audit + derived feature index + per-org
|
|
21776
|
-
// mining state
|
|
22348
|
+
// mining state — written by the
|
|
21777
22349
|
// routed mining object-graph path, so they ride to BYOD with the graph.
|
|
21778
22350
|
entry("intelligence", INTELLIGENCE_DB, "identity_audit_log", "direct", {
|
|
21779
22351
|
scopingColumn: "organization_id"
|
|
@@ -21793,7 +22365,7 @@ var init_table_registry = __esm({
|
|
|
21793
22365
|
entry("intelligence", INTELLIGENCE_DB, "org_active_integrations", "direct", {
|
|
21794
22366
|
scopingColumn: "organization_id"
|
|
21795
22367
|
}),
|
|
21796
|
-
// Object-graph correction/audit log
|
|
22368
|
+
// Object-graph correction/audit log,
|
|
21797
22369
|
// written by the routed object-graph path (lifecycle-engine → logCorrection),
|
|
21798
22370
|
// so it rides to BYOD with the graph. audit round 4 (#2).
|
|
21799
22371
|
entry("intelligence", INTELLIGENCE_DB, "object_corrections", "direct", {
|
|
@@ -21801,7 +22373,7 @@ var init_table_registry = __esm({
|
|
|
21801
22373
|
}),
|
|
21802
22374
|
// Trending similarity clusters — derived from, FK-bound to, and JOINed against
|
|
21803
22375
|
// knowledge_artifacts (always-BYOD via getUserdataPool), so they follow the
|
|
21804
|
-
// artifacts to BYOD
|
|
22376
|
+
// artifacts to BYOD. The trending tick +
|
|
21805
22377
|
// read route resolve the org's userdata pool. audit round 4 (#3).
|
|
21806
22378
|
entry("intelligence", INTELLIGENCE_DB, "artifact_clusters", "direct", {
|
|
21807
22379
|
scopingColumn: "organization_id"
|
|
@@ -21809,8 +22381,8 @@ var init_table_registry = __esm({
|
|
|
21809
22381
|
entry("intelligence", INTELLIGENCE_DB, "artifact_cluster_members", "direct", {
|
|
21810
22382
|
scopingColumn: "organization_id"
|
|
21811
22383
|
}),
|
|
21812
|
-
// Graph-enrichment watermark + deadletter
|
|
21813
|
-
//
|
|
22384
|
+
// Graph-enrichment watermark + deadletter ride to BYOD with the object graph
|
|
22385
|
+
// they walk. audit round 4 (#3).
|
|
21814
22386
|
entry("intelligence", INTELLIGENCE_DB, "graph_enrichment_state", "direct", {
|
|
21815
22387
|
scopingColumn: "organization_id"
|
|
21816
22388
|
}),
|
|
@@ -21833,18 +22405,14 @@ var init_table_registry = __esm({
|
|
|
21833
22405
|
entry("integrations", INTEGRATIONS_DB, "schema_migrations", "global")
|
|
21834
22406
|
];
|
|
21835
22407
|
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
|
-
),
|
|
22408
|
+
...intelligenceTables,
|
|
21841
22409
|
...integrationTables
|
|
21842
22410
|
];
|
|
21843
22411
|
}
|
|
21844
22412
|
});
|
|
21845
22413
|
|
|
21846
22414
|
// ../../packages/@company/db/src/byod/schema-provisioner.ts
|
|
21847
|
-
var path, SCHEMAS_DIR,
|
|
22415
|
+
var path, SCHEMAS_DIR, logger2;
|
|
21848
22416
|
var init_schema_provisioner = __esm({
|
|
21849
22417
|
"../../packages/@company/db/src/byod/schema-provisioner.ts"() {
|
|
21850
22418
|
"use strict";
|
|
@@ -21854,7 +22422,7 @@ var init_schema_provisioner = __esm({
|
|
|
21854
22422
|
init_pool_manager();
|
|
21855
22423
|
init_table_registry();
|
|
21856
22424
|
SCHEMAS_DIR = path.join(__dirname, "schemas");
|
|
21857
|
-
|
|
22425
|
+
logger2 = createLogger("db-byod-schema-provisioner");
|
|
21858
22426
|
}
|
|
21859
22427
|
});
|
|
21860
22428
|
|
|
@@ -22737,10 +23305,10 @@ var require_pg_copy_streams = __commonJS({
|
|
|
22737
23305
|
var CopyToQueryStream = require_copy_to();
|
|
22738
23306
|
var CopyFromQueryStream = require_copy_from();
|
|
22739
23307
|
var CopyBothQueryStream = require_copy_both();
|
|
22740
|
-
exports2.to = function
|
|
23308
|
+
exports2.to = function copyTo3(txt, options) {
|
|
22741
23309
|
return new CopyToQueryStream(txt, options);
|
|
22742
23310
|
};
|
|
22743
|
-
exports2.from = function
|
|
23311
|
+
exports2.from = function copyFrom3(txt, options) {
|
|
22744
23312
|
return new CopyFromQueryStream(txt, options);
|
|
22745
23313
|
};
|
|
22746
23314
|
exports2.both = function copyBoth(txt, options) {
|
|
@@ -22750,18 +23318,44 @@ var require_pg_copy_streams = __commonJS({
|
|
|
22750
23318
|
});
|
|
22751
23319
|
|
|
22752
23320
|
// ../../packages/@company/db/src/byod/migration-utils.ts
|
|
22753
|
-
var import_pg_copy_streams, import_pg_copy_streams2,
|
|
23321
|
+
var import_pg_copy_streams, import_pg_copy_streams2, logger3, COPY_TIMEOUT_MS;
|
|
22754
23322
|
var init_migration_utils = __esm({
|
|
22755
23323
|
"../../packages/@company/db/src/byod/migration-utils.ts"() {
|
|
22756
23324
|
"use strict";
|
|
22757
23325
|
import_pg_copy_streams = __toESM(require_pg_copy_streams());
|
|
22758
23326
|
import_pg_copy_streams2 = __toESM(require_pg_copy_streams());
|
|
22759
23327
|
init_src2();
|
|
22760
|
-
|
|
23328
|
+
logger3 = createLogger("db-byod-migration-utils");
|
|
22761
23329
|
COPY_TIMEOUT_MS = Number(process.env.BYOD_COPY_TIMEOUT_MS ?? 30 * 6e4);
|
|
22762
23330
|
}
|
|
22763
23331
|
});
|
|
22764
23332
|
|
|
23333
|
+
// ../../packages/@company/db/src/byod/partition-helpers.ts
|
|
23334
|
+
var PARTITIONABLE_TENANT_TABLES, PARTITIONABLE_TENANT_TABLE_SET;
|
|
23335
|
+
var init_partition_helpers = __esm({
|
|
23336
|
+
"../../packages/@company/db/src/byod/partition-helpers.ts"() {
|
|
23337
|
+
"use strict";
|
|
23338
|
+
PARTITIONABLE_TENANT_TABLES = ["object_relationships"];
|
|
23339
|
+
PARTITIONABLE_TENANT_TABLE_SET = new Set(
|
|
23340
|
+
PARTITIONABLE_TENANT_TABLES
|
|
23341
|
+
);
|
|
23342
|
+
}
|
|
23343
|
+
});
|
|
23344
|
+
|
|
23345
|
+
// ../../packages/@company/db/src/byod/reconciliation.ts
|
|
23346
|
+
var import_pg_copy_streams3, import_pg_copy_streams4, logger4;
|
|
23347
|
+
var init_reconciliation = __esm({
|
|
23348
|
+
"../../packages/@company/db/src/byod/reconciliation.ts"() {
|
|
23349
|
+
"use strict";
|
|
23350
|
+
init_src2();
|
|
23351
|
+
init_migration_utils();
|
|
23352
|
+
init_partition_helpers();
|
|
23353
|
+
import_pg_copy_streams3 = __toESM(require_pg_copy_streams());
|
|
23354
|
+
import_pg_copy_streams4 = __toESM(require_pg_copy_streams());
|
|
23355
|
+
logger4 = createLogger("db-byod-reconciliation");
|
|
23356
|
+
}
|
|
23357
|
+
});
|
|
23358
|
+
|
|
22765
23359
|
// ../../packages/@company/db/src/byod/migration-service.ts
|
|
22766
23360
|
var obs3, STALE_MIGRATION_MS;
|
|
22767
23361
|
var init_migration_service = __esm({
|
|
@@ -22770,24 +23364,22 @@ var init_migration_service = __esm({
|
|
|
22770
23364
|
init_esm();
|
|
22771
23365
|
init_pool_manager();
|
|
22772
23366
|
init_org_context();
|
|
23367
|
+
init_client();
|
|
22773
23368
|
init_src2();
|
|
23369
|
+
init_control_plane_residency();
|
|
22774
23370
|
init_table_registry();
|
|
22775
23371
|
init_migration_utils();
|
|
23372
|
+
init_partition_helpers();
|
|
23373
|
+
init_reconciliation();
|
|
22776
23374
|
obs3 = createObservabilityService("byod-migration");
|
|
22777
23375
|
STALE_MIGRATION_MS = 10 * 60 * 1e3;
|
|
22778
23376
|
}
|
|
22779
23377
|
});
|
|
22780
23378
|
|
|
22781
|
-
// ../../packages/@company/db/src/byod/
|
|
22782
|
-
var
|
|
22783
|
-
|
|
22784
|
-
"../../packages/@company/db/src/byod/schema-sync.ts"() {
|
|
23379
|
+
// ../../packages/@company/db/src/byod/reconciliation-limits.ts
|
|
23380
|
+
var init_reconciliation_limits = __esm({
|
|
23381
|
+
"../../packages/@company/db/src/byod/reconciliation-limits.ts"() {
|
|
22785
23382
|
"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
23383
|
}
|
|
22792
23384
|
});
|
|
22793
23385
|
|
|
@@ -22795,6 +23387,8 @@ var init_schema_sync = __esm({
|
|
|
22795
23387
|
var init_object_graph_pool = __esm({
|
|
22796
23388
|
"../../packages/@company/db/src/byod/object-graph-pool.ts"() {
|
|
22797
23389
|
"use strict";
|
|
23390
|
+
init_org_db_resolver();
|
|
23391
|
+
init_routed_pool();
|
|
22798
23392
|
}
|
|
22799
23393
|
});
|
|
22800
23394
|
|
|
@@ -22804,17 +23398,20 @@ var init_byod = __esm({
|
|
|
22804
23398
|
"use strict";
|
|
22805
23399
|
init_pool_manager();
|
|
22806
23400
|
init_config_cache();
|
|
23401
|
+
init_control_plane_residency();
|
|
22807
23402
|
init_integration_storage();
|
|
22808
23403
|
init_source_events_routing();
|
|
22809
23404
|
init_org_db_resolver();
|
|
23405
|
+
init_routed_pool();
|
|
22810
23406
|
init_query_helper();
|
|
22811
23407
|
init_schema_provisioner();
|
|
22812
23408
|
init_host_resolver();
|
|
22813
23409
|
init_active_orgs();
|
|
22814
23410
|
init_migration_service();
|
|
22815
23411
|
init_degradation2();
|
|
22816
|
-
|
|
22817
|
-
|
|
23412
|
+
init_partition_helpers();
|
|
23413
|
+
init_reconciliation();
|
|
23414
|
+
init_reconciliation_limits();
|
|
22818
23415
|
init_object_graph_pool();
|
|
22819
23416
|
init_table_registry();
|
|
22820
23417
|
}
|
|
@@ -22829,7 +23426,7 @@ var init_report_generation_jobs = __esm({
|
|
|
22829
23426
|
});
|
|
22830
23427
|
|
|
22831
23428
|
// ../../packages/@company/db/src/index.ts
|
|
22832
|
-
var
|
|
23429
|
+
var init_src6 = __esm({
|
|
22833
23430
|
"../../packages/@company/db/src/index.ts"() {
|
|
22834
23431
|
init_client();
|
|
22835
23432
|
init_org_context();
|
|
@@ -22837,6 +23434,10 @@ var init_src5 = __esm({
|
|
|
22837
23434
|
init_org_purge();
|
|
22838
23435
|
init_org_orphan_scan();
|
|
22839
23436
|
init_integration_purge();
|
|
23437
|
+
init_person_source_identities();
|
|
23438
|
+
init_expert_evidence_availability();
|
|
23439
|
+
init_activity_title();
|
|
23440
|
+
init_expert_areas();
|
|
22840
23441
|
init_exchange_context();
|
|
22841
23442
|
init_data_access();
|
|
22842
23443
|
init_byod();
|
|
@@ -22850,7 +23451,7 @@ var init_dictionary = __esm({
|
|
|
22850
23451
|
"../../packages/@company/pii/src/dictionary.ts"() {
|
|
22851
23452
|
"use strict";
|
|
22852
23453
|
init_src4();
|
|
22853
|
-
|
|
23454
|
+
init_src6();
|
|
22854
23455
|
init_src2();
|
|
22855
23456
|
init_spans();
|
|
22856
23457
|
obs4 = createObservabilityService("org-pii-dictionary");
|
|
@@ -22858,18 +23459,25 @@ var init_dictionary = __esm({
|
|
|
22858
23459
|
}
|
|
22859
23460
|
});
|
|
22860
23461
|
|
|
23462
|
+
// ../../packages/@company/pii/src/pii-redaction-setting.ts
|
|
23463
|
+
var init_pii_redaction_setting = __esm({
|
|
23464
|
+
"../../packages/@company/pii/src/pii-redaction-setting.ts"() {
|
|
23465
|
+
"use strict";
|
|
23466
|
+
}
|
|
23467
|
+
});
|
|
23468
|
+
|
|
22861
23469
|
// ../../packages/@company/pii/src/path-policy.ts
|
|
22862
23470
|
function normalizeRoot(root) {
|
|
22863
23471
|
return root.replace(/[\\/]+$/u, "");
|
|
22864
23472
|
}
|
|
22865
|
-
function pathSeparator(
|
|
22866
|
-
if (
|
|
22867
|
-
return
|
|
23473
|
+
function pathSeparator(path2) {
|
|
23474
|
+
if (path2.includes("\\\\")) return "\\\\";
|
|
23475
|
+
return path2.includes("\\") ? "\\" : "/";
|
|
22868
23476
|
}
|
|
22869
|
-
function matchingRepositoryRoot(
|
|
22870
|
-
const separator = pathSeparator(
|
|
23477
|
+
function matchingRepositoryRoot(path2, roots) {
|
|
23478
|
+
const separator = pathSeparator(path2);
|
|
22871
23479
|
const windows = separator !== "/";
|
|
22872
|
-
const comparablePath = windows ?
|
|
23480
|
+
const comparablePath = windows ? path2.toLowerCase() : path2;
|
|
22873
23481
|
return [...roots].map((root) => normalizeRoot(root).replace(/[\\/]/gu, separator)).filter(Boolean).sort((a, b) => b.length - a.length).find((root) => {
|
|
22874
23482
|
const comparableRoot = windows ? root.toLowerCase() : root;
|
|
22875
23483
|
return comparablePath === comparableRoot || comparablePath.startsWith(`${comparableRoot}${separator}`);
|
|
@@ -23040,10 +23648,11 @@ var init_presidio_adapter = __esm({
|
|
|
23040
23648
|
});
|
|
23041
23649
|
|
|
23042
23650
|
// ../../packages/@company/pii/src/index.ts
|
|
23043
|
-
var
|
|
23651
|
+
var init_src7 = __esm({
|
|
23044
23652
|
"../../packages/@company/pii/src/index.ts"() {
|
|
23045
23653
|
init_spans();
|
|
23046
23654
|
init_dictionary();
|
|
23655
|
+
init_pii_redaction_setting();
|
|
23047
23656
|
init_deterministic();
|
|
23048
23657
|
init_engine();
|
|
23049
23658
|
init_jsonl_scalars();
|
|
@@ -23359,7 +23968,7 @@ function extractGitInfo(projectDir, sessionTimestamp, sessionBranch) {
|
|
|
23359
23968
|
};
|
|
23360
23969
|
const gitBin = resolveGitBin();
|
|
23361
23970
|
if (!gitBin) {
|
|
23362
|
-
|
|
23971
|
+
logger5.warn("Git metadata skipped \u2014 git binary not found", {
|
|
23363
23972
|
projectDir,
|
|
23364
23973
|
reason: "git-not-on-path",
|
|
23365
23974
|
tried: GIT_BIN_CANDIDATES
|
|
@@ -23377,7 +23986,7 @@ function extractGitInfo(projectDir, sessionTimestamp, sessionBranch) {
|
|
|
23377
23986
|
try {
|
|
23378
23987
|
git(["rev-parse", "--is-inside-work-tree"]);
|
|
23379
23988
|
} catch (err) {
|
|
23380
|
-
|
|
23989
|
+
logger5.warn("Git metadata skipped \u2014 cwd not a resolvable git repo", {
|
|
23381
23990
|
projectDir,
|
|
23382
23991
|
resolvedDir: dir,
|
|
23383
23992
|
reason: err?.code === "ENOENT" ? "cwd-missing" : err?.status === 128 ? "not-a-git-repo" : "git-check-failed",
|
|
@@ -23429,7 +24038,7 @@ function resolveToken2() {
|
|
|
23429
24038
|
const creds = JSON.parse((0, import_fs3.readFileSync)(CREDENTIALS_FILE4, "utf-8"));
|
|
23430
24039
|
if (creds.token) return creds.token;
|
|
23431
24040
|
} catch {
|
|
23432
|
-
|
|
24041
|
+
logger5.warn("Could not parse credentials file", {
|
|
23433
24042
|
file: CREDENTIALS_FILE4
|
|
23434
24043
|
});
|
|
23435
24044
|
}
|
|
@@ -23454,7 +24063,7 @@ function discoverSessions(agentIds) {
|
|
|
23454
24063
|
try {
|
|
23455
24064
|
discovered = agent.discoverSessions();
|
|
23456
24065
|
} catch (err) {
|
|
23457
|
-
|
|
24066
|
+
logger5.warn(`Discovery failed for ${agent.displayName}`, {
|
|
23458
24067
|
err: err?.message
|
|
23459
24068
|
});
|
|
23460
24069
|
continue;
|
|
@@ -23465,8 +24074,8 @@ function discoverSessions(agentIds) {
|
|
|
23465
24074
|
}
|
|
23466
24075
|
return sessions;
|
|
23467
24076
|
}
|
|
23468
|
-
async function apiGet(
|
|
23469
|
-
const response = await fetch(`${apiUrl2}/api/v1${
|
|
24077
|
+
async function apiGet(path2, apiUrl2, token) {
|
|
24078
|
+
const response = await fetch(`${apiUrl2}/api/v1${path2}`, {
|
|
23470
24079
|
headers: { Authorization: `Bearer ${token}` }
|
|
23471
24080
|
});
|
|
23472
24081
|
if (!response.ok) {
|
|
@@ -23491,7 +24100,7 @@ async function getUploadedSessions(apiUrl2, token) {
|
|
|
23491
24100
|
}
|
|
23492
24101
|
return map2;
|
|
23493
24102
|
} catch (err) {
|
|
23494
|
-
void
|
|
24103
|
+
void logger5.warn(
|
|
23495
24104
|
"Could not fetch uploaded sessions list \u2014 skipping this run rather than re-uploading everything",
|
|
23496
24105
|
{ error: err?.message ?? String(err) }
|
|
23497
24106
|
);
|
|
@@ -23563,7 +24172,7 @@ function acquireRunLock() {
|
|
|
23563
24172
|
}
|
|
23564
24173
|
continue;
|
|
23565
24174
|
}
|
|
23566
|
-
void
|
|
24175
|
+
void logger5.warn(
|
|
23567
24176
|
"Another collector run is in progress \u2014 skipping this run",
|
|
23568
24177
|
{
|
|
23569
24178
|
holderPid: holder
|
|
@@ -23602,11 +24211,11 @@ async function collectLocked(options) {
|
|
|
23602
24211
|
}
|
|
23603
24212
|
const agentIds = resolveAgentIds(options.agents);
|
|
23604
24213
|
const localSessions = discoverSessions(agentIds);
|
|
23605
|
-
|
|
24214
|
+
logger5.info(`Found ${localSessions.length} session files on disk`, {
|
|
23606
24215
|
agents: agentIds.join(",")
|
|
23607
24216
|
});
|
|
23608
24217
|
if (localSessions.length === 0) {
|
|
23609
|
-
return { uploaded: 0, skipped: 0, errors: 0 };
|
|
24218
|
+
return { uploaded: 0, skipped: 0, errors: 0, deferred: 0 };
|
|
23610
24219
|
}
|
|
23611
24220
|
let uploaded = 0;
|
|
23612
24221
|
let skipped = 0;
|
|
@@ -23614,11 +24223,16 @@ async function collectLocked(options) {
|
|
|
23614
24223
|
let deferred = 0;
|
|
23615
24224
|
const remoteMap = options.forceAll ? /* @__PURE__ */ new Map() : await getUploadedSessions(apiUrl2, token);
|
|
23616
24225
|
if (remoteMap === null) {
|
|
23617
|
-
void
|
|
24226
|
+
void logger5.warn("Skipping collection: server inventory unavailable", {
|
|
23618
24227
|
localSessions: localSessions.length,
|
|
23619
24228
|
hint: "re-authenticate with `haansi auth login` if this persists"
|
|
23620
24229
|
});
|
|
23621
|
-
return {
|
|
24230
|
+
return {
|
|
24231
|
+
uploaded: 0,
|
|
24232
|
+
skipped: localSessions.length,
|
|
24233
|
+
errors: 0,
|
|
24234
|
+
deferred: 0
|
|
24235
|
+
};
|
|
23622
24236
|
}
|
|
23623
24237
|
const toUpload = [];
|
|
23624
24238
|
for (const session of localSessions) {
|
|
@@ -23633,7 +24247,7 @@ async function collectLocked(options) {
|
|
|
23633
24247
|
}
|
|
23634
24248
|
const batch = options.limit ? toUpload.slice(0, options.limit) : toUpload;
|
|
23635
24249
|
skipped += toUpload.length - batch.length;
|
|
23636
|
-
|
|
24250
|
+
logger5.info(
|
|
23637
24251
|
`Uploading ${batch.length} session(s), skipping ${skipped} unchanged`
|
|
23638
24252
|
);
|
|
23639
24253
|
for (const session of batch) {
|
|
@@ -23660,7 +24274,7 @@ async function collectLocked(options) {
|
|
|
23660
24274
|
session.gitBranch ?? void 0
|
|
23661
24275
|
);
|
|
23662
24276
|
} else {
|
|
23663
|
-
|
|
24277
|
+
logger5.warn("Git metadata skipped \u2014 no cwd resolved for session", {
|
|
23664
24278
|
sessionId: shortId,
|
|
23665
24279
|
agentSource: session.agentId
|
|
23666
24280
|
});
|
|
@@ -23675,7 +24289,7 @@ async function collectLocked(options) {
|
|
|
23675
24289
|
normalizeLocalPathsForUpload(rawContent, gitInfo.gitRoot)
|
|
23676
24290
|
);
|
|
23677
24291
|
if (options.dryRun) {
|
|
23678
|
-
|
|
24292
|
+
logger5.info(
|
|
23679
24293
|
`[dry-run] Would upload ${shortId} (${session.agentId}, ${session.lineCount} lines)`,
|
|
23680
24294
|
{
|
|
23681
24295
|
agentSource: session.agentId,
|
|
@@ -23696,7 +24310,7 @@ async function collectLocked(options) {
|
|
|
23696
24310
|
gitInfo
|
|
23697
24311
|
);
|
|
23698
24312
|
uploaded++;
|
|
23699
|
-
|
|
24313
|
+
logger5.info(
|
|
23700
24314
|
`Uploaded ${shortId} (${session.agentId}, ${session.lineCount} lines)`,
|
|
23701
24315
|
{
|
|
23702
24316
|
agentSource: session.agentId,
|
|
@@ -23707,22 +24321,22 @@ async function collectLocked(options) {
|
|
|
23707
24321
|
);
|
|
23708
24322
|
} catch (err) {
|
|
23709
24323
|
if (err?.miningDisabled) {
|
|
23710
|
-
void
|
|
24324
|
+
void logger5.info(
|
|
23711
24325
|
"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
24326
|
);
|
|
23713
24327
|
break;
|
|
23714
24328
|
}
|
|
23715
24329
|
if (err?.rateLimited) {
|
|
23716
24330
|
deferred++;
|
|
23717
|
-
void
|
|
24331
|
+
void logger5.info(`Rate limited, will retry next run: ${shortId}`);
|
|
23718
24332
|
} else {
|
|
23719
24333
|
errors++;
|
|
23720
|
-
|
|
24334
|
+
logger5.error(`Failed to upload ${shortId}`, { err: err.message });
|
|
23721
24335
|
}
|
|
23722
24336
|
}
|
|
23723
24337
|
}
|
|
23724
24338
|
if (deferred > 0) {
|
|
23725
|
-
void
|
|
24339
|
+
void logger5.info(
|
|
23726
24340
|
`${deferred} session(s) deferred by the upload rate limit \u2014 they remain queued`,
|
|
23727
24341
|
{ deferred, uploaded }
|
|
23728
24342
|
);
|
|
@@ -23734,7 +24348,7 @@ async function main() {
|
|
|
23734
24348
|
const dryRun = process.argv.includes("--dry-run");
|
|
23735
24349
|
const limitIdx = process.argv.indexOf("--limit");
|
|
23736
24350
|
const limit = limitIdx !== -1 ? parseInt(process.argv[limitIdx + 1], 10) : void 0;
|
|
23737
|
-
|
|
24351
|
+
logger5.info("Collector starting", { forceAll, dryRun });
|
|
23738
24352
|
const {
|
|
23739
24353
|
uploaded: _uploaded,
|
|
23740
24354
|
skipped: _skipped,
|
|
@@ -23749,14 +24363,14 @@ async function main() {
|
|
|
23749
24363
|
async function collect(options) {
|
|
23750
24364
|
if (options.dryRun) return collectLocked(options);
|
|
23751
24365
|
const lock = acquireRunLock();
|
|
23752
|
-
if (lock === null) return { uploaded: 0, skipped: 0, errors: 0 };
|
|
24366
|
+
if (lock === null) return { uploaded: 0, skipped: 0, errors: 0, deferred: 0 };
|
|
23753
24367
|
try {
|
|
23754
24368
|
return await collectLocked(options);
|
|
23755
24369
|
} finally {
|
|
23756
24370
|
releaseRunLock(lock);
|
|
23757
24371
|
}
|
|
23758
24372
|
}
|
|
23759
|
-
var import_dotenv, import_path3, import_fs3, import_os3, import_zlib, import_child_process,
|
|
24373
|
+
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
24374
|
var init_collector = __esm({
|
|
23761
24375
|
"../service-capture/agent-sessions/collector.ts"() {
|
|
23762
24376
|
"use strict";
|
|
@@ -23768,10 +24382,10 @@ var init_collector = __esm({
|
|
|
23768
24382
|
import_child_process = require("child_process");
|
|
23769
24383
|
init_src2();
|
|
23770
24384
|
init_service_urls();
|
|
23771
|
-
|
|
24385
|
+
init_src7();
|
|
23772
24386
|
init_agents();
|
|
23773
24387
|
(0, import_dotenv.config)({ path: (0, import_path3.resolve)(__dirname, "../../../.env") });
|
|
23774
|
-
|
|
24388
|
+
logger5 = createLogger("session-collector");
|
|
23775
24389
|
DEFAULT_API_URL2 = SERVICE_URL_DEFAULTS.haansiApiBaseUrl;
|
|
23776
24390
|
CREDENTIALS_FILE4 = (0, import_path3.join)((0, import_os3.homedir)(), ".haansi", "credentials.json");
|
|
23777
24391
|
LOCK_FILE = (0, import_path3.join)((0, import_os3.homedir)(), ".haansi", "collector.lock");
|
|
@@ -23825,7 +24439,7 @@ var init_collector = __esm({
|
|
|
23825
24439
|
DEFAULT_RATE_LIMIT_WAIT_MS = 6e4;
|
|
23826
24440
|
if (require.main === module) {
|
|
23827
24441
|
main().catch((err) => {
|
|
23828
|
-
|
|
24442
|
+
logger5.error("Collector failed", err);
|
|
23829
24443
|
process.exit(1);
|
|
23830
24444
|
});
|
|
23831
24445
|
}
|
|
@@ -24734,7 +25348,7 @@ var require_scheduled_task = __commonJS({
|
|
|
24734
25348
|
var require_background_scheduled_task = __commonJS({
|
|
24735
25349
|
"../../node_modules/node-cron/src/background-scheduled-task/index.js"(exports2, module2) {
|
|
24736
25350
|
var EventEmitter = require("events");
|
|
24737
|
-
var
|
|
25351
|
+
var path2 = require("path");
|
|
24738
25352
|
var { fork } = require("child_process");
|
|
24739
25353
|
var uuid3 = (init_esm_node2(), __toCommonJS(esm_node_exports));
|
|
24740
25354
|
var daemonPath = `${__dirname}/daemon.js`;
|
|
@@ -24769,7 +25383,7 @@ var require_background_scheduled_task = __commonJS({
|
|
|
24769
25383
|
options.scheduled = true;
|
|
24770
25384
|
this.forkProcess.send({
|
|
24771
25385
|
type: "register",
|
|
24772
|
-
path:
|
|
25386
|
+
path: path2.resolve(this.taskPath),
|
|
24773
25387
|
cron: this.cronExpression,
|
|
24774
25388
|
options
|
|
24775
25389
|
});
|
|
@@ -24915,7 +25529,7 @@ function getOnDiskVersion() {
|
|
|
24915
25529
|
function trimLog() {
|
|
24916
25530
|
const { rotated, sizeBefore, tailKept } = rotateLogIfLarge(LOG_FILE);
|
|
24917
25531
|
if (rotated) {
|
|
24918
|
-
|
|
25532
|
+
void logger6.info("Rotated daemon log", {
|
|
24919
25533
|
sizeBefore,
|
|
24920
25534
|
tailKept,
|
|
24921
25535
|
previous: `${LOG_FILE}.1`
|
|
@@ -24925,22 +25539,24 @@ function trimLog() {
|
|
|
24925
25539
|
async function run() {
|
|
24926
25540
|
trimLog();
|
|
24927
25541
|
const agents = resolveAgentsEnv();
|
|
24928
|
-
|
|
25542
|
+
void logger6.info("Collect run starting", {
|
|
25543
|
+
agents: agents?.join(",") ?? "all"
|
|
25544
|
+
});
|
|
24929
25545
|
const start = Date.now();
|
|
24930
25546
|
try {
|
|
24931
25547
|
const { uploaded, skipped, errors } = await collect({ agents });
|
|
24932
25548
|
const elapsed = ((Date.now() - start) / 1e3).toFixed(1);
|
|
24933
|
-
|
|
25549
|
+
void logger6.info(`Collect run complete in ${elapsed}s`, {
|
|
24934
25550
|
uploaded,
|
|
24935
25551
|
skipped,
|
|
24936
25552
|
errors
|
|
24937
25553
|
});
|
|
24938
25554
|
} catch (err) {
|
|
24939
|
-
|
|
25555
|
+
void logger6.error("Collect run failed", { err: err.message });
|
|
24940
25556
|
}
|
|
24941
25557
|
}
|
|
24942
25558
|
async function main2() {
|
|
24943
|
-
|
|
25559
|
+
void logger6.info("Collector daemon starting", {
|
|
24944
25560
|
schedule: SCHEDULE,
|
|
24945
25561
|
version: IN_MEMORY_VERSION
|
|
24946
25562
|
});
|
|
@@ -24948,24 +25564,26 @@ async function main2() {
|
|
|
24948
25564
|
import_node_cron.default.schedule(SCHEDULE, async () => {
|
|
24949
25565
|
const diskVersion = getOnDiskVersion();
|
|
24950
25566
|
if (diskVersion && diskVersion !== IN_MEMORY_VERSION) {
|
|
24951
|
-
|
|
25567
|
+
void logger6.info("Version mismatch detected \u2014 restarting", {
|
|
24952
25568
|
inMemory: IN_MEMORY_VERSION,
|
|
24953
25569
|
onDisk: diskVersion
|
|
24954
25570
|
});
|
|
24955
25571
|
process.exit(0);
|
|
24956
25572
|
}
|
|
24957
|
-
|
|
25573
|
+
void logger6.info("Scheduled collect run triggered");
|
|
24958
25574
|
await run();
|
|
24959
25575
|
});
|
|
24960
|
-
|
|
25576
|
+
void logger6.info(
|
|
25577
|
+
`Daemon running. Next run scheduled per cron: "${SCHEDULE}"`
|
|
25578
|
+
);
|
|
24961
25579
|
const shutdown = async (signal) => {
|
|
24962
|
-
|
|
25580
|
+
void logger6.info(`Received ${signal}, shutting down`);
|
|
24963
25581
|
process.exit(0);
|
|
24964
25582
|
};
|
|
24965
25583
|
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
24966
25584
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
24967
25585
|
}
|
|
24968
|
-
var import_dotenv2, import_fs5, import_path4, import_os4, import_node_cron,
|
|
25586
|
+
var import_dotenv2, import_fs5, import_path4, import_os4, import_node_cron, logger6, IN_MEMORY_VERSION, SCHEDULE, LOG_FILE;
|
|
24969
25587
|
var init_collector_daemon = __esm({
|
|
24970
25588
|
"../service-capture/agent-sessions/collector-daemon.ts"() {
|
|
24971
25589
|
"use strict";
|
|
@@ -24978,13 +25596,13 @@ var init_collector_daemon = __esm({
|
|
|
24978
25596
|
init_src2();
|
|
24979
25597
|
init_log_rotation();
|
|
24980
25598
|
(0, import_dotenv2.config)({ path: (0, import_path4.resolve)(__dirname, "../../../.env") });
|
|
24981
|
-
|
|
25599
|
+
logger6 = createLogger("collector-daemon");
|
|
24982
25600
|
IN_MEMORY_VERSION = // eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
24983
25601
|
require_package().version;
|
|
24984
25602
|
SCHEDULE = process.env.HAANSI_COLLECT_SCHEDULE ?? process.env.CLAUDE_COLLECT_SCHEDULE ?? "*/30 * * * *";
|
|
24985
25603
|
LOG_FILE = (0, import_path4.join)((0, import_os4.homedir)(), ".haansi", "daemon.log");
|
|
24986
25604
|
main2().catch((err) => {
|
|
24987
|
-
|
|
25605
|
+
void logger6.error("Daemon failed to start", err);
|
|
24988
25606
|
process.exit(1);
|
|
24989
25607
|
});
|
|
24990
25608
|
}
|
|
@@ -25006,246 +25624,6 @@ var init_http_timeout = __esm({
|
|
|
25006
25624
|
}
|
|
25007
25625
|
});
|
|
25008
25626
|
|
|
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
25627
|
// ../../node_modules/zod/v3/helpers/util.js
|
|
25250
25628
|
var util, objectUtil, ZodParsedType, getParsedType;
|
|
25251
25629
|
var init_util = __esm({
|
|
@@ -25651,8 +26029,8 @@ var init_parseUtil = __esm({
|
|
|
25651
26029
|
init_errors();
|
|
25652
26030
|
init_en();
|
|
25653
26031
|
makeIssue = (params) => {
|
|
25654
|
-
const { data, path:
|
|
25655
|
-
const fullPath = [...
|
|
26032
|
+
const { data, path: path2, errorMaps, issueData } = params;
|
|
26033
|
+
const fullPath = [...path2, ...issueData.path || []];
|
|
25656
26034
|
const fullIssue = {
|
|
25657
26035
|
...issueData,
|
|
25658
26036
|
path: fullPath
|
|
@@ -25932,11 +26310,11 @@ var init_types3 = __esm({
|
|
|
25932
26310
|
init_parseUtil();
|
|
25933
26311
|
init_util();
|
|
25934
26312
|
ParseInputLazyPath = class {
|
|
25935
|
-
constructor(parent, value,
|
|
26313
|
+
constructor(parent, value, path2, key) {
|
|
25936
26314
|
this._cachedPath = [];
|
|
25937
26315
|
this.parent = parent;
|
|
25938
26316
|
this.data = value;
|
|
25939
|
-
this._path =
|
|
26317
|
+
this._path = path2;
|
|
25940
26318
|
this._key = key;
|
|
25941
26319
|
}
|
|
25942
26320
|
get path() {
|
|
@@ -29442,10 +29820,10 @@ function mergeDefs(...defs) {
|
|
|
29442
29820
|
function cloneDef(schema) {
|
|
29443
29821
|
return mergeDefs(schema._zod.def);
|
|
29444
29822
|
}
|
|
29445
|
-
function getElementAtPath(obj,
|
|
29446
|
-
if (!
|
|
29823
|
+
function getElementAtPath(obj, path2) {
|
|
29824
|
+
if (!path2)
|
|
29447
29825
|
return obj;
|
|
29448
|
-
return
|
|
29826
|
+
return path2.reduce((acc, key) => acc?.[key], obj);
|
|
29449
29827
|
}
|
|
29450
29828
|
function promiseAllObject(promisesObj) {
|
|
29451
29829
|
const keys = Object.keys(promisesObj);
|
|
@@ -29757,11 +30135,11 @@ function aborted(x, startIndex = 0) {
|
|
|
29757
30135
|
}
|
|
29758
30136
|
return false;
|
|
29759
30137
|
}
|
|
29760
|
-
function prefixIssues(
|
|
30138
|
+
function prefixIssues(path2, issues) {
|
|
29761
30139
|
return issues.map((iss) => {
|
|
29762
30140
|
var _a2;
|
|
29763
30141
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
29764
|
-
iss.path.unshift(
|
|
30142
|
+
iss.path.unshift(path2);
|
|
29765
30143
|
return iss;
|
|
29766
30144
|
});
|
|
29767
30145
|
}
|
|
@@ -44251,8 +44629,8 @@ var require_utils5 = __commonJS({
|
|
|
44251
44629
|
}
|
|
44252
44630
|
return ind;
|
|
44253
44631
|
}
|
|
44254
|
-
function removeDotSegments(
|
|
44255
|
-
let input =
|
|
44632
|
+
function removeDotSegments(path2) {
|
|
44633
|
+
let input = path2;
|
|
44256
44634
|
const output = [];
|
|
44257
44635
|
let nextSlash = -1;
|
|
44258
44636
|
let len = 0;
|
|
@@ -44451,8 +44829,8 @@ var require_schemes = __commonJS({
|
|
|
44451
44829
|
wsComponent.secure = void 0;
|
|
44452
44830
|
}
|
|
44453
44831
|
if (wsComponent.resourceName) {
|
|
44454
|
-
const [
|
|
44455
|
-
wsComponent.path =
|
|
44832
|
+
const [path2, query] = wsComponent.resourceName.split("?");
|
|
44833
|
+
wsComponent.path = path2 && path2 !== "/" ? path2 : void 0;
|
|
44456
44834
|
wsComponent.query = query;
|
|
44457
44835
|
wsComponent.resourceName = void 0;
|
|
44458
44836
|
}
|
|
@@ -45393,13 +45771,13 @@ var require_core = __commonJS({
|
|
|
45393
45771
|
}, warn() {
|
|
45394
45772
|
}, error() {
|
|
45395
45773
|
} };
|
|
45396
|
-
function getLogger(
|
|
45397
|
-
if (
|
|
45774
|
+
function getLogger(logger7) {
|
|
45775
|
+
if (logger7 === false)
|
|
45398
45776
|
return noLogs;
|
|
45399
|
-
if (
|
|
45777
|
+
if (logger7 === void 0)
|
|
45400
45778
|
return console;
|
|
45401
|
-
if (
|
|
45402
|
-
return
|
|
45779
|
+
if (logger7.log && logger7.warn && logger7.error)
|
|
45780
|
+
return logger7;
|
|
45403
45781
|
throw new Error("logger must implement log, warn and error methods");
|
|
45404
45782
|
}
|
|
45405
45783
|
var KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
@@ -51291,13 +51669,13 @@ var require_core3 = __commonJS({
|
|
|
51291
51669
|
}, warn() {
|
|
51292
51670
|
}, error() {
|
|
51293
51671
|
} };
|
|
51294
|
-
function getLogger(
|
|
51295
|
-
if (
|
|
51672
|
+
function getLogger(logger7) {
|
|
51673
|
+
if (logger7 === false)
|
|
51296
51674
|
return noLogs;
|
|
51297
|
-
if (
|
|
51675
|
+
if (logger7 === void 0)
|
|
51298
51676
|
return console;
|
|
51299
|
-
if (
|
|
51300
|
-
return
|
|
51677
|
+
if (logger7.log && logger7.warn && logger7.error)
|
|
51678
|
+
return logger7;
|
|
51301
51679
|
throw new Error("logger must implement log, warn and error methods");
|
|
51302
51680
|
}
|
|
51303
51681
|
var KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
@@ -69619,11 +69997,11 @@ var require_mime_types = __commonJS({
|
|
|
69619
69997
|
}
|
|
69620
69998
|
return exts[0];
|
|
69621
69999
|
}
|
|
69622
|
-
function lookup(
|
|
69623
|
-
if (!
|
|
70000
|
+
function lookup(path2) {
|
|
70001
|
+
if (!path2 || typeof path2 !== "string") {
|
|
69624
70002
|
return false;
|
|
69625
70003
|
}
|
|
69626
|
-
var extension2 = extname("x." +
|
|
70004
|
+
var extension2 = extname("x." + path2).toLowerCase().slice(1);
|
|
69627
70005
|
if (!extension2) {
|
|
69628
70006
|
return false;
|
|
69629
70007
|
}
|
|
@@ -73061,13 +73439,13 @@ var require_view = __commonJS({
|
|
|
73061
73439
|
"../service-capture/node_modules/express/lib/view.js"(exports2, module2) {
|
|
73062
73440
|
"use strict";
|
|
73063
73441
|
var debug = require_src()("express:view");
|
|
73064
|
-
var
|
|
73442
|
+
var path2 = require("node:path");
|
|
73065
73443
|
var fs = require("node:fs");
|
|
73066
|
-
var dirname3 =
|
|
73067
|
-
var basename4 =
|
|
73068
|
-
var extname =
|
|
73069
|
-
var
|
|
73070
|
-
var resolve4 =
|
|
73444
|
+
var dirname3 = path2.dirname;
|
|
73445
|
+
var basename4 = path2.basename;
|
|
73446
|
+
var extname = path2.extname;
|
|
73447
|
+
var join14 = path2.join;
|
|
73448
|
+
var resolve4 = path2.resolve;
|
|
73071
73449
|
module2.exports = View;
|
|
73072
73450
|
function View(name, options) {
|
|
73073
73451
|
var opts = options || {};
|
|
@@ -73096,17 +73474,17 @@ var require_view = __commonJS({
|
|
|
73096
73474
|
this.path = this.lookup(fileName);
|
|
73097
73475
|
}
|
|
73098
73476
|
View.prototype.lookup = function lookup(name) {
|
|
73099
|
-
var
|
|
73477
|
+
var path3;
|
|
73100
73478
|
var roots = [].concat(this.root);
|
|
73101
73479
|
debug('lookup "%s"', name);
|
|
73102
|
-
for (var i = 0; i < roots.length && !
|
|
73480
|
+
for (var i = 0; i < roots.length && !path3; i++) {
|
|
73103
73481
|
var root = roots[i];
|
|
73104
73482
|
var loc = resolve4(root, name);
|
|
73105
73483
|
var dir = dirname3(loc);
|
|
73106
73484
|
var file2 = basename4(loc);
|
|
73107
|
-
|
|
73485
|
+
path3 = this.resolve(dir, file2);
|
|
73108
73486
|
}
|
|
73109
|
-
return
|
|
73487
|
+
return path3;
|
|
73110
73488
|
};
|
|
73111
73489
|
View.prototype.render = function render(options, callback) {
|
|
73112
73490
|
var sync = true;
|
|
@@ -73128,21 +73506,21 @@ var require_view = __commonJS({
|
|
|
73128
73506
|
};
|
|
73129
73507
|
View.prototype.resolve = function resolve5(dir, file2) {
|
|
73130
73508
|
var ext = this.ext;
|
|
73131
|
-
var
|
|
73132
|
-
var stat = tryStat(
|
|
73509
|
+
var path3 = join14(dir, file2);
|
|
73510
|
+
var stat = tryStat(path3);
|
|
73133
73511
|
if (stat && stat.isFile()) {
|
|
73134
|
-
return
|
|
73512
|
+
return path3;
|
|
73135
73513
|
}
|
|
73136
|
-
|
|
73137
|
-
stat = tryStat(
|
|
73514
|
+
path3 = join14(dir, basename4(file2, ext), "index" + ext);
|
|
73515
|
+
stat = tryStat(path3);
|
|
73138
73516
|
if (stat && stat.isFile()) {
|
|
73139
|
-
return
|
|
73517
|
+
return path3;
|
|
73140
73518
|
}
|
|
73141
73519
|
};
|
|
73142
|
-
function tryStat(
|
|
73143
|
-
debug('stat "%s"',
|
|
73520
|
+
function tryStat(path3) {
|
|
73521
|
+
debug('stat "%s"', path3);
|
|
73144
73522
|
try {
|
|
73145
|
-
return fs.statSync(
|
|
73523
|
+
return fs.statSync(path3);
|
|
73146
73524
|
} catch (e) {
|
|
73147
73525
|
return void 0;
|
|
73148
73526
|
}
|
|
@@ -74340,15 +74718,15 @@ var require_dist3 = __commonJS({
|
|
|
74340
74718
|
if (token.type === endType)
|
|
74341
74719
|
break;
|
|
74342
74720
|
if (token.type === "char" || token.type === "escape") {
|
|
74343
|
-
let
|
|
74721
|
+
let path2 = token.value;
|
|
74344
74722
|
let cur = tokens[pos];
|
|
74345
74723
|
while (cur.type === "char" || cur.type === "escape") {
|
|
74346
|
-
|
|
74724
|
+
path2 += cur.value;
|
|
74347
74725
|
cur = tokens[++pos];
|
|
74348
74726
|
}
|
|
74349
74727
|
output.push({
|
|
74350
74728
|
type: "text",
|
|
74351
|
-
value: encodePath(
|
|
74729
|
+
value: encodePath(path2)
|
|
74352
74730
|
});
|
|
74353
74731
|
continue;
|
|
74354
74732
|
}
|
|
@@ -74372,16 +74750,16 @@ var require_dist3 = __commonJS({
|
|
|
74372
74750
|
}
|
|
74373
74751
|
return new TokenData(consumeUntil("end"), str);
|
|
74374
74752
|
}
|
|
74375
|
-
function compile(
|
|
74753
|
+
function compile(path2, options = {}) {
|
|
74376
74754
|
const { encode: encode3 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
74377
|
-
const data = typeof
|
|
74755
|
+
const data = typeof path2 === "object" ? path2 : parse4(path2, options);
|
|
74378
74756
|
const fn = tokensToFunction(data.tokens, delimiter, encode3);
|
|
74379
|
-
return function
|
|
74380
|
-
const [
|
|
74757
|
+
return function path3(params = {}) {
|
|
74758
|
+
const [path4, ...missing] = fn(params);
|
|
74381
74759
|
if (missing.length) {
|
|
74382
74760
|
throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
|
|
74383
74761
|
}
|
|
74384
|
-
return
|
|
74762
|
+
return path4;
|
|
74385
74763
|
};
|
|
74386
74764
|
}
|
|
74387
74765
|
function tokensToFunction(tokens, delimiter, encode3) {
|
|
@@ -74437,9 +74815,9 @@ var require_dist3 = __commonJS({
|
|
|
74437
74815
|
return [encodeValue(value)];
|
|
74438
74816
|
};
|
|
74439
74817
|
}
|
|
74440
|
-
function match(
|
|
74818
|
+
function match(path2, options = {}) {
|
|
74441
74819
|
const { decode: decode3 = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
74442
|
-
const { regexp, keys } = pathToRegexp(
|
|
74820
|
+
const { regexp, keys } = pathToRegexp(path2, options);
|
|
74443
74821
|
const decoders = keys.map((key) => {
|
|
74444
74822
|
if (decode3 === false)
|
|
74445
74823
|
return NOOP_VALUE;
|
|
@@ -74451,7 +74829,7 @@ var require_dist3 = __commonJS({
|
|
|
74451
74829
|
const m = regexp.exec(input);
|
|
74452
74830
|
if (!m)
|
|
74453
74831
|
return false;
|
|
74454
|
-
const
|
|
74832
|
+
const path3 = m[0];
|
|
74455
74833
|
const params = /* @__PURE__ */ Object.create(null);
|
|
74456
74834
|
for (let i = 1; i < m.length; i++) {
|
|
74457
74835
|
if (m[i] === void 0)
|
|
@@ -74460,15 +74838,15 @@ var require_dist3 = __commonJS({
|
|
|
74460
74838
|
const decoder = decoders[i - 1];
|
|
74461
74839
|
params[key.name] = decoder(m[i]);
|
|
74462
74840
|
}
|
|
74463
|
-
return { path:
|
|
74841
|
+
return { path: path3, params };
|
|
74464
74842
|
};
|
|
74465
74843
|
}
|
|
74466
|
-
function pathToRegexp(
|
|
74844
|
+
function pathToRegexp(path2, options = {}) {
|
|
74467
74845
|
const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
|
|
74468
74846
|
const keys = [];
|
|
74469
74847
|
const flags = sensitive ? "" : "i";
|
|
74470
74848
|
const sources = [];
|
|
74471
|
-
for (const input of pathsToArray(
|
|
74849
|
+
for (const input of pathsToArray(path2, [])) {
|
|
74472
74850
|
const data = typeof input === "object" ? input : parse4(input, options);
|
|
74473
74851
|
for (const tokens of flatten(data.tokens, 0, [])) {
|
|
74474
74852
|
sources.push(toRegExpSource(tokens, delimiter, keys, data.originalPath));
|
|
@@ -74598,18 +74976,18 @@ var require_layer = __commonJS({
|
|
|
74598
74976
|
var TRAILING_SLASH_REGEXP = /\/+$/;
|
|
74599
74977
|
var MATCHING_GROUP_REGEXP = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
74600
74978
|
module2.exports = Layer;
|
|
74601
|
-
function Layer(
|
|
74979
|
+
function Layer(path2, options, fn) {
|
|
74602
74980
|
if (!(this instanceof Layer)) {
|
|
74603
|
-
return new Layer(
|
|
74981
|
+
return new Layer(path2, options, fn);
|
|
74604
74982
|
}
|
|
74605
|
-
debug("new %o",
|
|
74983
|
+
debug("new %o", path2);
|
|
74606
74984
|
const opts = options || {};
|
|
74607
74985
|
this.handle = fn;
|
|
74608
74986
|
this.keys = [];
|
|
74609
74987
|
this.name = fn.name || "<anonymous>";
|
|
74610
74988
|
this.params = void 0;
|
|
74611
74989
|
this.path = void 0;
|
|
74612
|
-
this.slash =
|
|
74990
|
+
this.slash = path2 === "/" && opts.end === false;
|
|
74613
74991
|
function matcher(_path) {
|
|
74614
74992
|
if (_path instanceof RegExp) {
|
|
74615
74993
|
const keys = [];
|
|
@@ -74648,7 +75026,7 @@ var require_layer = __commonJS({
|
|
|
74648
75026
|
decode: decodeParam
|
|
74649
75027
|
});
|
|
74650
75028
|
}
|
|
74651
|
-
this.matchers = Array.isArray(
|
|
75029
|
+
this.matchers = Array.isArray(path2) ? path2.map(matcher) : [matcher(path2)];
|
|
74652
75030
|
}
|
|
74653
75031
|
Layer.prototype.handleError = function handleError(error2, req, res, next) {
|
|
74654
75032
|
const fn = this.handle;
|
|
@@ -74688,9 +75066,9 @@ var require_layer = __commonJS({
|
|
|
74688
75066
|
next(err);
|
|
74689
75067
|
}
|
|
74690
75068
|
};
|
|
74691
|
-
Layer.prototype.match = function match(
|
|
75069
|
+
Layer.prototype.match = function match(path2) {
|
|
74692
75070
|
let match2;
|
|
74693
|
-
if (
|
|
75071
|
+
if (path2 != null) {
|
|
74694
75072
|
if (this.slash) {
|
|
74695
75073
|
this.params = {};
|
|
74696
75074
|
this.path = "";
|
|
@@ -74698,7 +75076,7 @@ var require_layer = __commonJS({
|
|
|
74698
75076
|
}
|
|
74699
75077
|
let i = 0;
|
|
74700
75078
|
while (!match2 && i < this.matchers.length) {
|
|
74701
|
-
match2 = this.matchers[i](
|
|
75079
|
+
match2 = this.matchers[i](path2);
|
|
74702
75080
|
i++;
|
|
74703
75081
|
}
|
|
74704
75082
|
}
|
|
@@ -74726,13 +75104,13 @@ var require_layer = __commonJS({
|
|
|
74726
75104
|
throw err;
|
|
74727
75105
|
}
|
|
74728
75106
|
}
|
|
74729
|
-
function loosen(
|
|
74730
|
-
if (
|
|
74731
|
-
return
|
|
75107
|
+
function loosen(path2) {
|
|
75108
|
+
if (path2 instanceof RegExp || path2 === "/") {
|
|
75109
|
+
return path2;
|
|
74732
75110
|
}
|
|
74733
|
-
return Array.isArray(
|
|
75111
|
+
return Array.isArray(path2) ? path2.map(function(p) {
|
|
74734
75112
|
return loosen(p);
|
|
74735
|
-
}) : String(
|
|
75113
|
+
}) : String(path2).replace(TRAILING_SLASH_REGEXP, "");
|
|
74736
75114
|
}
|
|
74737
75115
|
}
|
|
74738
75116
|
});
|
|
@@ -74748,9 +75126,9 @@ var require_route = __commonJS({
|
|
|
74748
75126
|
var flatten = Array.prototype.flat;
|
|
74749
75127
|
var methods = METHODS.map((method) => method.toLowerCase());
|
|
74750
75128
|
module2.exports = Route;
|
|
74751
|
-
function Route(
|
|
74752
|
-
debug("new %o",
|
|
74753
|
-
this.path =
|
|
75129
|
+
function Route(path2) {
|
|
75130
|
+
debug("new %o", path2);
|
|
75131
|
+
this.path = path2;
|
|
74754
75132
|
this.stack = [];
|
|
74755
75133
|
this.methods = /* @__PURE__ */ Object.create(null);
|
|
74756
75134
|
}
|
|
@@ -74958,8 +75336,8 @@ var require_router = __commonJS({
|
|
|
74958
75336
|
if (++sync > 100) {
|
|
74959
75337
|
return setImmediate(next, err);
|
|
74960
75338
|
}
|
|
74961
|
-
const
|
|
74962
|
-
if (
|
|
75339
|
+
const path2 = getPathname(req);
|
|
75340
|
+
if (path2 == null) {
|
|
74963
75341
|
return done(layerError);
|
|
74964
75342
|
}
|
|
74965
75343
|
let layer;
|
|
@@ -74967,7 +75345,7 @@ var require_router = __commonJS({
|
|
|
74967
75345
|
let route;
|
|
74968
75346
|
while (match !== true && idx < stack.length) {
|
|
74969
75347
|
layer = stack[idx++];
|
|
74970
|
-
match = matchLayer(layer,
|
|
75348
|
+
match = matchLayer(layer, path2);
|
|
74971
75349
|
route = layer.route;
|
|
74972
75350
|
if (typeof match !== "boolean") {
|
|
74973
75351
|
layerError = layerError || match;
|
|
@@ -75005,18 +75383,18 @@ var require_router = __commonJS({
|
|
|
75005
75383
|
} else if (route) {
|
|
75006
75384
|
layer.handleRequest(req, res, next);
|
|
75007
75385
|
} else {
|
|
75008
|
-
trimPrefix(layer, layerError, layerPath,
|
|
75386
|
+
trimPrefix(layer, layerError, layerPath, path2);
|
|
75009
75387
|
}
|
|
75010
75388
|
sync = 0;
|
|
75011
75389
|
});
|
|
75012
75390
|
}
|
|
75013
|
-
function trimPrefix(layer, layerError, layerPath,
|
|
75391
|
+
function trimPrefix(layer, layerError, layerPath, path2) {
|
|
75014
75392
|
if (layerPath.length !== 0) {
|
|
75015
|
-
if (layerPath !==
|
|
75393
|
+
if (layerPath !== path2.substring(0, layerPath.length)) {
|
|
75016
75394
|
next(layerError);
|
|
75017
75395
|
return;
|
|
75018
75396
|
}
|
|
75019
|
-
const c =
|
|
75397
|
+
const c = path2[layerPath.length];
|
|
75020
75398
|
if (c && c !== "/") {
|
|
75021
75399
|
next(layerError);
|
|
75022
75400
|
return;
|
|
@@ -75040,7 +75418,7 @@ var require_router = __commonJS({
|
|
|
75040
75418
|
};
|
|
75041
75419
|
Router.prototype.use = function use(handler) {
|
|
75042
75420
|
let offset = 0;
|
|
75043
|
-
let
|
|
75421
|
+
let path2 = "/";
|
|
75044
75422
|
if (typeof handler !== "function") {
|
|
75045
75423
|
let arg = handler;
|
|
75046
75424
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -75048,7 +75426,7 @@ var require_router = __commonJS({
|
|
|
75048
75426
|
}
|
|
75049
75427
|
if (typeof arg !== "function") {
|
|
75050
75428
|
offset = 1;
|
|
75051
|
-
|
|
75429
|
+
path2 = handler;
|
|
75052
75430
|
}
|
|
75053
75431
|
}
|
|
75054
75432
|
const callbacks = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -75060,8 +75438,8 @@ var require_router = __commonJS({
|
|
|
75060
75438
|
if (typeof fn !== "function") {
|
|
75061
75439
|
throw new TypeError("argument handler must be a function");
|
|
75062
75440
|
}
|
|
75063
|
-
debug("use %o %s",
|
|
75064
|
-
const layer = new Layer(
|
|
75441
|
+
debug("use %o %s", path2, fn.name || "<anonymous>");
|
|
75442
|
+
const layer = new Layer(path2, {
|
|
75065
75443
|
sensitive: this.caseSensitive,
|
|
75066
75444
|
strict: false,
|
|
75067
75445
|
end: false
|
|
@@ -75071,9 +75449,9 @@ var require_router = __commonJS({
|
|
|
75071
75449
|
}
|
|
75072
75450
|
return this;
|
|
75073
75451
|
};
|
|
75074
|
-
Router.prototype.route = function route(
|
|
75075
|
-
const route2 = new Route(
|
|
75076
|
-
const layer = new Layer(
|
|
75452
|
+
Router.prototype.route = function route(path2) {
|
|
75453
|
+
const route2 = new Route(path2);
|
|
75454
|
+
const layer = new Layer(path2, {
|
|
75077
75455
|
sensitive: this.caseSensitive,
|
|
75078
75456
|
strict: this.strict,
|
|
75079
75457
|
end: true
|
|
@@ -75086,8 +75464,8 @@ var require_router = __commonJS({
|
|
|
75086
75464
|
return route2;
|
|
75087
75465
|
};
|
|
75088
75466
|
methods.concat("all").forEach(function(method) {
|
|
75089
|
-
Router.prototype[method] = function(
|
|
75090
|
-
const route = this.route(
|
|
75467
|
+
Router.prototype[method] = function(path2) {
|
|
75468
|
+
const route = this.route(path2);
|
|
75091
75469
|
route[method].apply(route, slice.call(arguments, 1));
|
|
75092
75470
|
return this;
|
|
75093
75471
|
};
|
|
@@ -75116,9 +75494,9 @@ var require_router = __commonJS({
|
|
|
75116
75494
|
const fqdnIndex = url2.substring(0, pathLength).indexOf("://");
|
|
75117
75495
|
return fqdnIndex !== -1 ? url2.substring(0, url2.indexOf("/", 3 + fqdnIndex)) : void 0;
|
|
75118
75496
|
}
|
|
75119
|
-
function matchLayer(layer,
|
|
75497
|
+
function matchLayer(layer, path2) {
|
|
75120
75498
|
try {
|
|
75121
|
-
return layer.match(
|
|
75499
|
+
return layer.match(path2);
|
|
75122
75500
|
} catch (err) {
|
|
75123
75501
|
return err;
|
|
75124
75502
|
}
|
|
@@ -75346,7 +75724,7 @@ var require_application = __commonJS({
|
|
|
75346
75724
|
};
|
|
75347
75725
|
app.use = function use(fn) {
|
|
75348
75726
|
var offset = 0;
|
|
75349
|
-
var
|
|
75727
|
+
var path2 = "/";
|
|
75350
75728
|
if (typeof fn !== "function") {
|
|
75351
75729
|
var arg = fn;
|
|
75352
75730
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -75354,7 +75732,7 @@ var require_application = __commonJS({
|
|
|
75354
75732
|
}
|
|
75355
75733
|
if (typeof arg !== "function") {
|
|
75356
75734
|
offset = 1;
|
|
75357
|
-
|
|
75735
|
+
path2 = fn;
|
|
75358
75736
|
}
|
|
75359
75737
|
}
|
|
75360
75738
|
var fns = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -75364,12 +75742,12 @@ var require_application = __commonJS({
|
|
|
75364
75742
|
var router = this.router;
|
|
75365
75743
|
fns.forEach(function(fn2) {
|
|
75366
75744
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
75367
|
-
return router.use(
|
|
75745
|
+
return router.use(path2, fn2);
|
|
75368
75746
|
}
|
|
75369
|
-
debug(".use app under %s",
|
|
75370
|
-
fn2.mountpath =
|
|
75747
|
+
debug(".use app under %s", path2);
|
|
75748
|
+
fn2.mountpath = path2;
|
|
75371
75749
|
fn2.parent = this;
|
|
75372
|
-
router.use(
|
|
75750
|
+
router.use(path2, function mounted_app(req, res, next) {
|
|
75373
75751
|
var orig = req.app;
|
|
75374
75752
|
fn2.handle(req, res, function(err) {
|
|
75375
75753
|
Object.setPrototypeOf(req, orig.request);
|
|
@@ -75381,8 +75759,8 @@ var require_application = __commonJS({
|
|
|
75381
75759
|
}, this);
|
|
75382
75760
|
return this;
|
|
75383
75761
|
};
|
|
75384
|
-
app.route = function route(
|
|
75385
|
-
return this.router.route(
|
|
75762
|
+
app.route = function route(path2) {
|
|
75763
|
+
return this.router.route(path2);
|
|
75386
75764
|
};
|
|
75387
75765
|
app.engine = function engine(ext, fn) {
|
|
75388
75766
|
if (typeof fn !== "function") {
|
|
@@ -75425,7 +75803,7 @@ var require_application = __commonJS({
|
|
|
75425
75803
|
}
|
|
75426
75804
|
return this;
|
|
75427
75805
|
};
|
|
75428
|
-
app.path = function
|
|
75806
|
+
app.path = function path2() {
|
|
75429
75807
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
75430
75808
|
};
|
|
75431
75809
|
app.enabled = function enabled(setting) {
|
|
@@ -75441,17 +75819,17 @@ var require_application = __commonJS({
|
|
|
75441
75819
|
return this.set(setting, false);
|
|
75442
75820
|
};
|
|
75443
75821
|
methods.forEach(function(method) {
|
|
75444
|
-
app[method] = function(
|
|
75822
|
+
app[method] = function(path2) {
|
|
75445
75823
|
if (method === "get" && arguments.length === 1) {
|
|
75446
|
-
return this.set(
|
|
75824
|
+
return this.set(path2);
|
|
75447
75825
|
}
|
|
75448
|
-
var route = this.route(
|
|
75826
|
+
var route = this.route(path2);
|
|
75449
75827
|
route[method].apply(route, slice.call(arguments, 1));
|
|
75450
75828
|
return this;
|
|
75451
75829
|
};
|
|
75452
75830
|
});
|
|
75453
|
-
app.all = function all(
|
|
75454
|
-
var route = this.route(
|
|
75831
|
+
app.all = function all(path2) {
|
|
75832
|
+
var route = this.route(path2);
|
|
75455
75833
|
var args = slice.call(arguments, 1);
|
|
75456
75834
|
for (var i = 0; i < methods.length; i++) {
|
|
75457
75835
|
route[methods[i]].apply(route, args);
|
|
@@ -76361,7 +76739,7 @@ var require_request = __commonJS({
|
|
|
76361
76739
|
var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
|
|
76362
76740
|
return subdomains2.slice(offset);
|
|
76363
76741
|
});
|
|
76364
|
-
defineGetter(req, "path", function
|
|
76742
|
+
defineGetter(req, "path", function path2() {
|
|
76365
76743
|
return parse4(this).pathname;
|
|
76366
76744
|
});
|
|
76367
76745
|
defineGetter(req, "host", function host() {
|
|
@@ -76773,27 +77151,27 @@ var require_send = __commonJS({
|
|
|
76773
77151
|
var ms = require_ms();
|
|
76774
77152
|
var onFinished = require_on_finished();
|
|
76775
77153
|
var parseRange = require_range_parser();
|
|
76776
|
-
var
|
|
77154
|
+
var path2 = require("path");
|
|
76777
77155
|
var statuses = require_statuses();
|
|
76778
77156
|
var Stream = require("stream");
|
|
76779
77157
|
var util2 = require("util");
|
|
76780
|
-
var extname =
|
|
76781
|
-
var
|
|
76782
|
-
var normalize =
|
|
76783
|
-
var resolve4 =
|
|
76784
|
-
var sep =
|
|
77158
|
+
var extname = path2.extname;
|
|
77159
|
+
var join14 = path2.join;
|
|
77160
|
+
var normalize = path2.normalize;
|
|
77161
|
+
var resolve4 = path2.resolve;
|
|
77162
|
+
var sep = path2.sep;
|
|
76785
77163
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
76786
77164
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
76787
77165
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
76788
77166
|
module2.exports = send;
|
|
76789
|
-
function send(req,
|
|
76790
|
-
return new SendStream(req,
|
|
77167
|
+
function send(req, path3, options) {
|
|
77168
|
+
return new SendStream(req, path3, options);
|
|
76791
77169
|
}
|
|
76792
|
-
function SendStream(req,
|
|
77170
|
+
function SendStream(req, path3, options) {
|
|
76793
77171
|
Stream.call(this);
|
|
76794
77172
|
var opts = options || {};
|
|
76795
77173
|
this.options = opts;
|
|
76796
|
-
this.path =
|
|
77174
|
+
this.path = path3;
|
|
76797
77175
|
this.req = req;
|
|
76798
77176
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
76799
77177
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -76907,10 +77285,10 @@ var require_send = __commonJS({
|
|
|
76907
77285
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
76908
77286
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
76909
77287
|
};
|
|
76910
|
-
SendStream.prototype.redirect = function redirect(
|
|
77288
|
+
SendStream.prototype.redirect = function redirect(path3) {
|
|
76911
77289
|
var res = this.res;
|
|
76912
77290
|
if (hasListeners(this, "directory")) {
|
|
76913
|
-
this.emit("directory", res,
|
|
77291
|
+
this.emit("directory", res, path3);
|
|
76914
77292
|
return;
|
|
76915
77293
|
}
|
|
76916
77294
|
if (this.hasTrailingSlash()) {
|
|
@@ -76930,38 +77308,38 @@ var require_send = __commonJS({
|
|
|
76930
77308
|
SendStream.prototype.pipe = function pipe2(res) {
|
|
76931
77309
|
var root = this._root;
|
|
76932
77310
|
this.res = res;
|
|
76933
|
-
var
|
|
76934
|
-
if (
|
|
77311
|
+
var path3 = decode3(this.path);
|
|
77312
|
+
if (path3 === -1) {
|
|
76935
77313
|
this.error(400);
|
|
76936
77314
|
return res;
|
|
76937
77315
|
}
|
|
76938
|
-
if (~
|
|
77316
|
+
if (~path3.indexOf("\0")) {
|
|
76939
77317
|
this.error(400);
|
|
76940
77318
|
return res;
|
|
76941
77319
|
}
|
|
76942
77320
|
var parts;
|
|
76943
77321
|
if (root !== null) {
|
|
76944
|
-
if (
|
|
76945
|
-
|
|
77322
|
+
if (path3) {
|
|
77323
|
+
path3 = normalize("." + sep + path3);
|
|
76946
77324
|
}
|
|
76947
|
-
if (UP_PATH_REGEXP.test(
|
|
76948
|
-
debug('malicious path "%s"',
|
|
77325
|
+
if (UP_PATH_REGEXP.test(path3)) {
|
|
77326
|
+
debug('malicious path "%s"', path3);
|
|
76949
77327
|
this.error(403);
|
|
76950
77328
|
return res;
|
|
76951
77329
|
}
|
|
76952
|
-
parts =
|
|
76953
|
-
|
|
77330
|
+
parts = path3.split(sep);
|
|
77331
|
+
path3 = normalize(join14(root, path3));
|
|
76954
77332
|
} else {
|
|
76955
|
-
if (UP_PATH_REGEXP.test(
|
|
76956
|
-
debug('malicious path "%s"',
|
|
77333
|
+
if (UP_PATH_REGEXP.test(path3)) {
|
|
77334
|
+
debug('malicious path "%s"', path3);
|
|
76957
77335
|
this.error(403);
|
|
76958
77336
|
return res;
|
|
76959
77337
|
}
|
|
76960
|
-
parts = normalize(
|
|
76961
|
-
|
|
77338
|
+
parts = normalize(path3).split(sep);
|
|
77339
|
+
path3 = resolve4(path3);
|
|
76962
77340
|
}
|
|
76963
77341
|
if (containsDotFile(parts)) {
|
|
76964
|
-
debug('%s dotfile "%s"', this._dotfiles,
|
|
77342
|
+
debug('%s dotfile "%s"', this._dotfiles, path3);
|
|
76965
77343
|
switch (this._dotfiles) {
|
|
76966
77344
|
case "allow":
|
|
76967
77345
|
break;
|
|
@@ -76975,13 +77353,13 @@ var require_send = __commonJS({
|
|
|
76975
77353
|
}
|
|
76976
77354
|
}
|
|
76977
77355
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
76978
|
-
this.sendIndex(
|
|
77356
|
+
this.sendIndex(path3);
|
|
76979
77357
|
return res;
|
|
76980
77358
|
}
|
|
76981
|
-
this.sendFile(
|
|
77359
|
+
this.sendFile(path3);
|
|
76982
77360
|
return res;
|
|
76983
77361
|
};
|
|
76984
|
-
SendStream.prototype.send = function send2(
|
|
77362
|
+
SendStream.prototype.send = function send2(path3, stat) {
|
|
76985
77363
|
var len = stat.size;
|
|
76986
77364
|
var options = this.options;
|
|
76987
77365
|
var opts = {};
|
|
@@ -76993,9 +77371,9 @@ var require_send = __commonJS({
|
|
|
76993
77371
|
this.headersAlreadySent();
|
|
76994
77372
|
return;
|
|
76995
77373
|
}
|
|
76996
|
-
debug('pipe "%s"',
|
|
76997
|
-
this.setHeader(
|
|
76998
|
-
this.type(
|
|
77374
|
+
debug('pipe "%s"', path3);
|
|
77375
|
+
this.setHeader(path3, stat);
|
|
77376
|
+
this.type(path3);
|
|
76999
77377
|
if (this.isConditionalGET()) {
|
|
77000
77378
|
if (this.isPreconditionFailure()) {
|
|
77001
77379
|
this.error(412);
|
|
@@ -77044,28 +77422,28 @@ var require_send = __commonJS({
|
|
|
77044
77422
|
res.end();
|
|
77045
77423
|
return;
|
|
77046
77424
|
}
|
|
77047
|
-
this.stream(
|
|
77425
|
+
this.stream(path3, opts);
|
|
77048
77426
|
};
|
|
77049
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
77427
|
+
SendStream.prototype.sendFile = function sendFile(path3) {
|
|
77050
77428
|
var i = 0;
|
|
77051
77429
|
var self = this;
|
|
77052
|
-
debug('stat "%s"',
|
|
77053
|
-
fs.stat(
|
|
77054
|
-
var pathEndsWithSep =
|
|
77055
|
-
if (err && err.code === "ENOENT" && !extname(
|
|
77430
|
+
debug('stat "%s"', path3);
|
|
77431
|
+
fs.stat(path3, function onstat(err, stat) {
|
|
77432
|
+
var pathEndsWithSep = path3[path3.length - 1] === sep;
|
|
77433
|
+
if (err && err.code === "ENOENT" && !extname(path3) && !pathEndsWithSep) {
|
|
77056
77434
|
return next(err);
|
|
77057
77435
|
}
|
|
77058
77436
|
if (err) return self.onStatError(err);
|
|
77059
|
-
if (stat.isDirectory()) return self.redirect(
|
|
77437
|
+
if (stat.isDirectory()) return self.redirect(path3);
|
|
77060
77438
|
if (pathEndsWithSep) return self.error(404);
|
|
77061
|
-
self.emit("file",
|
|
77062
|
-
self.send(
|
|
77439
|
+
self.emit("file", path3, stat);
|
|
77440
|
+
self.send(path3, stat);
|
|
77063
77441
|
});
|
|
77064
77442
|
function next(err) {
|
|
77065
77443
|
if (self._extensions.length <= i) {
|
|
77066
77444
|
return err ? self.onStatError(err) : self.error(404);
|
|
77067
77445
|
}
|
|
77068
|
-
var p =
|
|
77446
|
+
var p = path3 + "." + self._extensions[i++];
|
|
77069
77447
|
debug('stat "%s"', p);
|
|
77070
77448
|
fs.stat(p, function(err2, stat) {
|
|
77071
77449
|
if (err2) return next(err2);
|
|
@@ -77075,7 +77453,7 @@ var require_send = __commonJS({
|
|
|
77075
77453
|
});
|
|
77076
77454
|
}
|
|
77077
77455
|
};
|
|
77078
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
77456
|
+
SendStream.prototype.sendIndex = function sendIndex(path3) {
|
|
77079
77457
|
var i = -1;
|
|
77080
77458
|
var self = this;
|
|
77081
77459
|
function next(err) {
|
|
@@ -77083,7 +77461,7 @@ var require_send = __commonJS({
|
|
|
77083
77461
|
if (err) return self.onStatError(err);
|
|
77084
77462
|
return self.error(404);
|
|
77085
77463
|
}
|
|
77086
|
-
var p =
|
|
77464
|
+
var p = join14(path3, self._index[i]);
|
|
77087
77465
|
debug('stat "%s"', p);
|
|
77088
77466
|
fs.stat(p, function(err2, stat) {
|
|
77089
77467
|
if (err2) return next(err2);
|
|
@@ -77094,10 +77472,10 @@ var require_send = __commonJS({
|
|
|
77094
77472
|
}
|
|
77095
77473
|
next();
|
|
77096
77474
|
};
|
|
77097
|
-
SendStream.prototype.stream = function stream(
|
|
77475
|
+
SendStream.prototype.stream = function stream(path3, options) {
|
|
77098
77476
|
var self = this;
|
|
77099
77477
|
var res = this.res;
|
|
77100
|
-
var stream2 = fs.createReadStream(
|
|
77478
|
+
var stream2 = fs.createReadStream(path3, options);
|
|
77101
77479
|
this.emit("stream", stream2);
|
|
77102
77480
|
stream2.pipe(res);
|
|
77103
77481
|
function cleanup() {
|
|
@@ -77112,17 +77490,17 @@ var require_send = __commonJS({
|
|
|
77112
77490
|
self.emit("end");
|
|
77113
77491
|
});
|
|
77114
77492
|
};
|
|
77115
|
-
SendStream.prototype.type = function type(
|
|
77493
|
+
SendStream.prototype.type = function type(path3) {
|
|
77116
77494
|
var res = this.res;
|
|
77117
77495
|
if (res.getHeader("Content-Type")) return;
|
|
77118
|
-
var ext = extname(
|
|
77496
|
+
var ext = extname(path3);
|
|
77119
77497
|
var type2 = mime.contentType(ext) || "application/octet-stream";
|
|
77120
77498
|
debug("content-type %s", type2);
|
|
77121
77499
|
res.setHeader("Content-Type", type2);
|
|
77122
77500
|
};
|
|
77123
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
77501
|
+
SendStream.prototype.setHeader = function setHeader(path3, stat) {
|
|
77124
77502
|
var res = this.res;
|
|
77125
|
-
this.emit("headers", res,
|
|
77503
|
+
this.emit("headers", res, path3, stat);
|
|
77126
77504
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
77127
77505
|
debug("accept ranges");
|
|
77128
77506
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -77180,9 +77558,9 @@ var require_send = __commonJS({
|
|
|
77180
77558
|
}
|
|
77181
77559
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
77182
77560
|
}
|
|
77183
|
-
function decode3(
|
|
77561
|
+
function decode3(path3) {
|
|
77184
77562
|
try {
|
|
77185
|
-
return decodeURIComponent(
|
|
77563
|
+
return decodeURIComponent(path3);
|
|
77186
77564
|
} catch (err) {
|
|
77187
77565
|
return -1;
|
|
77188
77566
|
}
|
|
@@ -77326,7 +77704,7 @@ var require_response = __commonJS({
|
|
|
77326
77704
|
var http = require("node:http");
|
|
77327
77705
|
var onFinished = require_on_finished();
|
|
77328
77706
|
var mime = require_mime_types();
|
|
77329
|
-
var
|
|
77707
|
+
var path2 = require("node:path");
|
|
77330
77708
|
var pathIsAbsolute = require("node:path").isAbsolute;
|
|
77331
77709
|
var statuses = require_statuses();
|
|
77332
77710
|
var sign = require_cookie_signature().sign;
|
|
@@ -77335,8 +77713,8 @@ var require_response = __commonJS({
|
|
|
77335
77713
|
var setCharset = require_utils8().setCharset;
|
|
77336
77714
|
var cookie = require_cookie();
|
|
77337
77715
|
var send = require_send();
|
|
77338
|
-
var extname =
|
|
77339
|
-
var resolve4 =
|
|
77716
|
+
var extname = path2.extname;
|
|
77717
|
+
var resolve4 = path2.resolve;
|
|
77340
77718
|
var vary = require_vary();
|
|
77341
77719
|
var { Buffer: Buffer2 } = require("node:buffer");
|
|
77342
77720
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -77482,26 +77860,26 @@ var require_response = __commonJS({
|
|
|
77482
77860
|
this.type("txt");
|
|
77483
77861
|
return this.send(body);
|
|
77484
77862
|
};
|
|
77485
|
-
res.sendFile = function sendFile(
|
|
77863
|
+
res.sendFile = function sendFile(path3, options, callback) {
|
|
77486
77864
|
var done = callback;
|
|
77487
77865
|
var req = this.req;
|
|
77488
77866
|
var res2 = this;
|
|
77489
77867
|
var next = req.next;
|
|
77490
77868
|
var opts = options || {};
|
|
77491
|
-
if (!
|
|
77869
|
+
if (!path3) {
|
|
77492
77870
|
throw new TypeError("path argument is required to res.sendFile");
|
|
77493
77871
|
}
|
|
77494
|
-
if (typeof
|
|
77872
|
+
if (typeof path3 !== "string") {
|
|
77495
77873
|
throw new TypeError("path must be a string to res.sendFile");
|
|
77496
77874
|
}
|
|
77497
77875
|
if (typeof options === "function") {
|
|
77498
77876
|
done = options;
|
|
77499
77877
|
opts = {};
|
|
77500
77878
|
}
|
|
77501
|
-
if (!opts.root && !pathIsAbsolute(
|
|
77879
|
+
if (!opts.root && !pathIsAbsolute(path3)) {
|
|
77502
77880
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
77503
77881
|
}
|
|
77504
|
-
var pathname = encodeURI(
|
|
77882
|
+
var pathname = encodeURI(path3);
|
|
77505
77883
|
opts.etag = this.app.enabled("etag");
|
|
77506
77884
|
var file2 = send(req, pathname, opts);
|
|
77507
77885
|
sendfile(res2, file2, opts, function(err) {
|
|
@@ -77512,7 +77890,7 @@ var require_response = __commonJS({
|
|
|
77512
77890
|
}
|
|
77513
77891
|
});
|
|
77514
77892
|
};
|
|
77515
|
-
res.download = function download(
|
|
77893
|
+
res.download = function download(path3, filename, options, callback) {
|
|
77516
77894
|
var done = callback;
|
|
77517
77895
|
var name = filename;
|
|
77518
77896
|
var opts = options || null;
|
|
@@ -77529,7 +77907,7 @@ var require_response = __commonJS({
|
|
|
77529
77907
|
opts = filename;
|
|
77530
77908
|
}
|
|
77531
77909
|
var headers = {
|
|
77532
|
-
"Content-Disposition": contentDisposition(name ||
|
|
77910
|
+
"Content-Disposition": contentDisposition(name || path3)
|
|
77533
77911
|
};
|
|
77534
77912
|
if (opts && opts.headers) {
|
|
77535
77913
|
var keys = Object.keys(opts.headers);
|
|
@@ -77542,7 +77920,7 @@ var require_response = __commonJS({
|
|
|
77542
77920
|
}
|
|
77543
77921
|
opts = Object.create(opts);
|
|
77544
77922
|
opts.headers = headers;
|
|
77545
|
-
var fullPath = !opts.root ? resolve4(
|
|
77923
|
+
var fullPath = !opts.root ? resolve4(path3) : path3;
|
|
77546
77924
|
return this.sendFile(fullPath, opts, done);
|
|
77547
77925
|
};
|
|
77548
77926
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -77825,11 +78203,11 @@ var require_serve_static = __commonJS({
|
|
|
77825
78203
|
}
|
|
77826
78204
|
var forwardError = !fallthrough;
|
|
77827
78205
|
var originalUrl = parseUrl.original(req);
|
|
77828
|
-
var
|
|
77829
|
-
if (
|
|
77830
|
-
|
|
78206
|
+
var path2 = parseUrl(req).pathname;
|
|
78207
|
+
if (path2 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
78208
|
+
path2 = "";
|
|
77831
78209
|
}
|
|
77832
|
-
var stream = send(req,
|
|
78210
|
+
var stream = send(req, path2, opts);
|
|
77833
78211
|
stream.on("directory", onDirectory);
|
|
77834
78212
|
if (setHeaders) {
|
|
77835
78213
|
stream.on("headers", setHeaders);
|
|
@@ -79204,12 +79582,12 @@ function maybeCollect() {
|
|
|
79204
79582
|
triggerCollectInBackground();
|
|
79205
79583
|
}
|
|
79206
79584
|
}
|
|
79207
|
-
async function apiGet2(
|
|
79585
|
+
async function apiGet2(path2, options) {
|
|
79208
79586
|
const headers = {
|
|
79209
79587
|
Authorization: `Bearer ${TOKEN}`,
|
|
79210
79588
|
...options?.extraHeaders
|
|
79211
79589
|
};
|
|
79212
|
-
const response = await fetchWithTimeout(`${API_URL}/api/v1${
|
|
79590
|
+
const response = await fetchWithTimeout(`${API_URL}/api/v1${path2}`, {
|
|
79213
79591
|
headers
|
|
79214
79592
|
});
|
|
79215
79593
|
if (!response.ok) {
|
|
@@ -79218,13 +79596,13 @@ async function apiGet2(path3, options) {
|
|
|
79218
79596
|
}
|
|
79219
79597
|
return response.json();
|
|
79220
79598
|
}
|
|
79221
|
-
async function apiPost(
|
|
79599
|
+
async function apiPost(path2, body, options) {
|
|
79222
79600
|
const headers = {
|
|
79223
79601
|
Authorization: `Bearer ${TOKEN}`,
|
|
79224
79602
|
"Content-Type": "application/json",
|
|
79225
79603
|
...options?.extraHeaders
|
|
79226
79604
|
};
|
|
79227
|
-
const response = await fetchWithTimeout(`${API_URL}/api/v1${
|
|
79605
|
+
const response = await fetchWithTimeout(`${API_URL}/api/v1${path2}`, {
|
|
79228
79606
|
method: "POST",
|
|
79229
79607
|
headers,
|
|
79230
79608
|
body: JSON.stringify(body)
|
|
@@ -79278,7 +79656,7 @@ var init_mcp_server2 = __esm({
|
|
|
79278
79656
|
init_collector();
|
|
79279
79657
|
init_http_timeout();
|
|
79280
79658
|
init_service_urls();
|
|
79281
|
-
|
|
79659
|
+
init_src5();
|
|
79282
79660
|
init_mcp();
|
|
79283
79661
|
init_stdio2();
|
|
79284
79662
|
init_types4();
|
|
@@ -79568,8 +79946,9 @@ var init_mcp_server2 = __esm({
|
|
|
79568
79946
|
throw new Error(`Unknown tool: ${name}`);
|
|
79569
79947
|
}
|
|
79570
79948
|
} catch (err) {
|
|
79949
|
+
console.error(`[MCP] agent-sessions tool failed:`, err?.message ?? err);
|
|
79571
79950
|
return {
|
|
79572
|
-
content: [{ type: "text", text:
|
|
79951
|
+
content: [{ type: "text", text: "An internal error occurred." }],
|
|
79573
79952
|
isError: true
|
|
79574
79953
|
};
|
|
79575
79954
|
}
|
|
@@ -79631,17 +80010,20 @@ var init_codex_config = __esm({
|
|
|
79631
80010
|
// src/commands/setup-mcp.ts
|
|
79632
80011
|
var setup_mcp_exports = {};
|
|
79633
80012
|
__export(setup_mcp_exports, {
|
|
80013
|
+
HTTP_SERVERS: () => HTTP_SERVERS,
|
|
80014
|
+
parseTarget: () => parseTarget,
|
|
79634
80015
|
setupMcp: () => setupMcp
|
|
79635
80016
|
});
|
|
79636
80017
|
function parseTarget(arg) {
|
|
79637
80018
|
if (!arg || arg === "all") return "all";
|
|
79638
|
-
if (arg === "solutions" || arg === "exchange"
|
|
80019
|
+
if (arg === "solutions" || arg === "exchange" || arg === "digests")
|
|
80020
|
+
return arg;
|
|
79639
80021
|
throw new Error(
|
|
79640
|
-
`Unknown target: ${arg}. Use one of: solutions, exchange, all (default).`
|
|
80022
|
+
`Unknown target: ${arg}. Use one of: solutions, exchange, digests, all (default).`
|
|
79641
80023
|
);
|
|
79642
80024
|
}
|
|
79643
|
-
function
|
|
79644
|
-
return `${apiUrl().replace(/\/+$/, "")}
|
|
80025
|
+
function httpServerUrl(path2) {
|
|
80026
|
+
return `${apiUrl().replace(/\/+$/, "")}${path2}`;
|
|
79645
80027
|
}
|
|
79646
80028
|
function setupClaudeMcp(target) {
|
|
79647
80029
|
let config6 = {};
|
|
@@ -79666,21 +80048,22 @@ function setupClaudeMcp(target) {
|
|
|
79666
80048
|
};
|
|
79667
80049
|
installed.push(`haansi-solutions (stdio \u2192 ${haansiBin} mcp-server)`);
|
|
79668
80050
|
}
|
|
79669
|
-
|
|
80051
|
+
for (const http of HTTP_SERVERS) {
|
|
80052
|
+
if (target !== "all" && target !== http.target) continue;
|
|
79670
80053
|
const token = resolveToken();
|
|
79671
80054
|
if (!token) {
|
|
79672
80055
|
warnings.push(
|
|
79673
|
-
|
|
80056
|
+
`${http.name} not registered: no token found. Run \`haansi auth login\` first, or set HAANSI_TOKEN.`
|
|
79674
80057
|
);
|
|
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})`);
|
|
80058
|
+
continue;
|
|
79683
80059
|
}
|
|
80060
|
+
const url2 = httpServerUrl(http.path);
|
|
80061
|
+
config6.mcpServers[http.name] = {
|
|
80062
|
+
type: "http",
|
|
80063
|
+
url: url2,
|
|
80064
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
80065
|
+
};
|
|
80066
|
+
installed.push(`${http.name} (http \u2192 ${url2})`);
|
|
79684
80067
|
}
|
|
79685
80068
|
(0, import_node_fs5.writeFileSync)(CLAUDE_JSON, JSON.stringify(config6, null, 2) + "\n", "utf-8");
|
|
79686
80069
|
console.log(`
|
|
@@ -79711,20 +80094,21 @@ function setupCodexMcp(target) {
|
|
|
79711
80094
|
});
|
|
79712
80095
|
installed.push(`haansi-solutions (stdio \u2192 ${haansiBin} mcp-server)`);
|
|
79713
80096
|
}
|
|
79714
|
-
|
|
80097
|
+
for (const http of HTTP_SERVERS) {
|
|
80098
|
+
if (target !== "all" && target !== http.target) continue;
|
|
79715
80099
|
const token = resolveToken();
|
|
79716
80100
|
if (!token) {
|
|
79717
80101
|
warnings.push(
|
|
79718
|
-
|
|
80102
|
+
`${http.name} not registered: no token found. Run \`haansi auth login\` first, or set HAANSI_TOKEN.`
|
|
79719
80103
|
);
|
|
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})`);
|
|
80104
|
+
continue;
|
|
79727
80105
|
}
|
|
80106
|
+
const url2 = httpServerUrl(http.path);
|
|
80107
|
+
content = upsertTomlTable(content, `mcp_servers.${http.name}`, {
|
|
80108
|
+
url: tomlString(url2),
|
|
80109
|
+
http_headers: tomlInlineTable({ Authorization: `Bearer ${token}` })
|
|
80110
|
+
});
|
|
80111
|
+
installed.push(`${http.name} (http \u2192 ${url2})`);
|
|
79728
80112
|
}
|
|
79729
80113
|
(0, import_node_fs5.mkdirSync)(CODEX_HOME, { recursive: true });
|
|
79730
80114
|
(0, import_node_fs5.writeFileSync)(CODEX_CONFIG, content, "utf-8");
|
|
@@ -79745,7 +80129,7 @@ async function setupMcp(targetArg, agentFlag) {
|
|
|
79745
80129
|
console.log(`
|
|
79746
80130
|
Restart ${restart} to activate the changes.`);
|
|
79747
80131
|
}
|
|
79748
|
-
var import_node_fs5, import_node_path4, import_node_os4, CLAUDE_JSON, CODEX_HOME, CODEX_CONFIG, WRITERS;
|
|
80132
|
+
var import_node_fs5, import_node_path4, import_node_os4, CLAUDE_JSON, CODEX_HOME, CODEX_CONFIG, HTTP_SERVERS, WRITERS;
|
|
79749
80133
|
var init_setup_mcp = __esm({
|
|
79750
80134
|
"src/commands/setup-mcp.ts"() {
|
|
79751
80135
|
"use strict";
|
|
@@ -79758,6 +80142,18 @@ var init_setup_mcp = __esm({
|
|
|
79758
80142
|
CLAUDE_JSON = (0, import_node_path4.join)((0, import_node_os4.homedir)(), ".claude.json");
|
|
79759
80143
|
CODEX_HOME = process.env.CODEX_HOME || (0, import_node_path4.join)((0, import_node_os4.homedir)(), ".codex");
|
|
79760
80144
|
CODEX_CONFIG = (0, import_node_path4.join)(CODEX_HOME, "config.toml");
|
|
80145
|
+
HTTP_SERVERS = [
|
|
80146
|
+
{
|
|
80147
|
+
target: "exchange",
|
|
80148
|
+
name: "haansi-exchange",
|
|
80149
|
+
path: "/api/v1/memory/exchange/mcp"
|
|
80150
|
+
},
|
|
80151
|
+
{
|
|
80152
|
+
target: "digests",
|
|
80153
|
+
name: "haansi-digests",
|
|
80154
|
+
path: "/api/v1/memory/digests/mcp"
|
|
80155
|
+
}
|
|
80156
|
+
];
|
|
79761
80157
|
WRITERS = {
|
|
79762
80158
|
"claude-code": setupClaudeMcp,
|
|
79763
80159
|
codex: setupCodexMcp
|
|
@@ -79804,7 +80200,7 @@ function warnIfStaleDevBundle(haansiPath) {
|
|
|
79804
80200
|
}
|
|
79805
80201
|
function buildPlist(haansiPath) {
|
|
79806
80202
|
const binDir = haansiPath.replace(/\/[^/]+$/, "");
|
|
79807
|
-
const
|
|
80203
|
+
const path2 = `${binDir}:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`;
|
|
79808
80204
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
79809
80205
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
79810
80206
|
<plist version="1.0">
|
|
@@ -79819,7 +80215,7 @@ function buildPlist(haansiPath) {
|
|
|
79819
80215
|
<key>EnvironmentVariables</key>
|
|
79820
80216
|
<dict>
|
|
79821
80217
|
<key>PATH</key>
|
|
79822
|
-
<string>${
|
|
80218
|
+
<string>${path2}</string>
|
|
79823
80219
|
</dict>
|
|
79824
80220
|
<key>RunAtLoad</key>
|
|
79825
80221
|
<true/>
|
|
@@ -79840,8 +80236,8 @@ async function setupDaemon(uninstall) {
|
|
|
79840
80236
|
}
|
|
79841
80237
|
try {
|
|
79842
80238
|
(0, import_node_child_process3.spawnSync)("launchctl", ["unload", PLIST_PATH], { stdio: "pipe" });
|
|
79843
|
-
} catch
|
|
79844
|
-
console.error("Failed to unload daemon
|
|
80239
|
+
} catch {
|
|
80240
|
+
console.error("Failed to unload daemon.");
|
|
79845
80241
|
}
|
|
79846
80242
|
(0, import_node_fs6.unlinkSync)(PLIST_PATH);
|
|
79847
80243
|
console.log("Daemon stopped and removed.");
|
|
@@ -79853,8 +80249,8 @@ async function setupDaemon(uninstall) {
|
|
|
79853
80249
|
(0, import_node_fs6.writeFileSync)(PLIST_PATH, buildPlist(haansiPath), "utf-8");
|
|
79854
80250
|
try {
|
|
79855
80251
|
(0, import_node_child_process3.spawnSync)("launchctl", ["unload", PLIST_PATH], { stdio: "pipe" });
|
|
79856
|
-
} catch
|
|
79857
|
-
console.error("Failed to unload previous daemon
|
|
80252
|
+
} catch {
|
|
80253
|
+
console.error("Failed to unload previous daemon.");
|
|
79858
80254
|
}
|
|
79859
80255
|
(0, import_node_child_process3.spawnSync)("launchctl", ["load", PLIST_PATH], { stdio: "inherit" });
|
|
79860
80256
|
console.log("Daemon installed and started.");
|
|
@@ -79894,8 +80290,10 @@ function resolveToken4() {
|
|
|
79894
80290
|
try {
|
|
79895
80291
|
const creds = JSON.parse((0, import_node_fs7.readFileSync)(CREDENTIALS_FILE6, "utf-8"));
|
|
79896
80292
|
if (creds.token) return creds.token;
|
|
79897
|
-
} catch
|
|
79898
|
-
console.error(
|
|
80293
|
+
} catch {
|
|
80294
|
+
console.error(
|
|
80295
|
+
"Failed to read credentials file. Run `haansi init` to recreate it."
|
|
80296
|
+
);
|
|
79899
80297
|
}
|
|
79900
80298
|
}
|
|
79901
80299
|
return null;
|
|
@@ -79920,10 +80318,7 @@ async function config5(args) {
|
|
|
79920
80318
|
}
|
|
79921
80319
|
);
|
|
79922
80320
|
if (!response.ok) {
|
|
79923
|
-
|
|
79924
|
-
console.error(
|
|
79925
|
-
`Error fetching preferences (${response.status}): ${body.slice(0, 200)}`
|
|
79926
|
-
);
|
|
80321
|
+
console.error(`Error fetching preferences (${response.status}).`);
|
|
79927
80322
|
process.exit(1);
|
|
79928
80323
|
return;
|
|
79929
80324
|
}
|
|
@@ -79972,10 +80367,7 @@ async function config5(args) {
|
|
|
79972
80367
|
}
|
|
79973
80368
|
);
|
|
79974
80369
|
if (!response.ok) {
|
|
79975
|
-
|
|
79976
|
-
console.error(
|
|
79977
|
-
`Error updating preferences (${response.status}): ${body.slice(0, 200)}`
|
|
79978
|
-
);
|
|
80370
|
+
console.error(`Error updating preferences (${response.status}).`);
|
|
79979
80371
|
process.exit(1);
|
|
79980
80372
|
return;
|
|
79981
80373
|
}
|
|
@@ -80016,24 +80408,27 @@ function resolveToken5() {
|
|
|
80016
80408
|
try {
|
|
80017
80409
|
const creds = JSON.parse((0, import_node_fs8.readFileSync)(CREDENTIALS_FILE7, "utf-8"));
|
|
80018
80410
|
if (creds.token) return creds.token;
|
|
80019
|
-
} catch
|
|
80020
|
-
console.error(
|
|
80411
|
+
} catch {
|
|
80412
|
+
console.error(
|
|
80413
|
+
"Failed to read credentials file. Run `haansi init` to recreate it."
|
|
80414
|
+
);
|
|
80021
80415
|
}
|
|
80022
80416
|
}
|
|
80023
80417
|
throw new Error("No token found. Run `haansi init` first.");
|
|
80024
80418
|
}
|
|
80025
|
-
async function apiGet3(
|
|
80026
|
-
const response = await fetch(`${apiUrl2}/api/v1${
|
|
80419
|
+
async function apiGet3(path2, token, apiUrl2) {
|
|
80420
|
+
const response = await fetch(`${apiUrl2}/api/v1${path2}`, {
|
|
80027
80421
|
headers: { Authorization: `Bearer ${token}` }
|
|
80028
80422
|
});
|
|
80029
80423
|
if (!response.ok) {
|
|
80030
|
-
|
|
80031
|
-
|
|
80424
|
+
throw Object.assign(new Error(`API error ${response.status}`), {
|
|
80425
|
+
publicMessage: `The request failed (${response.status}).`
|
|
80426
|
+
});
|
|
80032
80427
|
}
|
|
80033
80428
|
return response.json();
|
|
80034
80429
|
}
|
|
80035
|
-
async function apiPost2(
|
|
80036
|
-
const response = await fetch(`${apiUrl2}/api/v1${
|
|
80430
|
+
async function apiPost2(path2, body, token, apiUrl2) {
|
|
80431
|
+
const response = await fetch(`${apiUrl2}/api/v1${path2}`, {
|
|
80037
80432
|
method: "POST",
|
|
80038
80433
|
headers: {
|
|
80039
80434
|
Authorization: `Bearer ${token}`,
|
|
@@ -80042,8 +80437,9 @@ async function apiPost2(path3, body, token, apiUrl2) {
|
|
|
80042
80437
|
body: JSON.stringify(body)
|
|
80043
80438
|
});
|
|
80044
80439
|
if (!response.ok) {
|
|
80045
|
-
|
|
80046
|
-
|
|
80440
|
+
throw Object.assign(new Error(`API error ${response.status}`), {
|
|
80441
|
+
publicMessage: `The request failed (${response.status}).`
|
|
80442
|
+
});
|
|
80047
80443
|
}
|
|
80048
80444
|
return response.json();
|
|
80049
80445
|
}
|
|
@@ -80356,7 +80752,9 @@ Environment variables:
|
|
|
80356
80752
|
`);
|
|
80357
80753
|
}
|
|
80358
80754
|
run2().catch((err) => {
|
|
80359
|
-
|
|
80755
|
+
const publicMessage = typeof err === "object" && err !== null && "publicMessage" in err ? String(err.publicMessage) : void 0;
|
|
80756
|
+
console.error("Error:", publicMessage ?? "The command failed.");
|
|
80757
|
+
if (process.env.HAANSI_DEBUG) console.error(err);
|
|
80360
80758
|
process.exit(1);
|
|
80361
80759
|
});
|
|
80362
80760
|
/*! Bundled license information:
|