@massa-ai/mcp-client 1.46.0 → 1.48.0
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/config-cli.js +958 -467
- package/dist/index.js +1007 -516
- package/package.json +3 -3
package/dist/config-cli.js
CHANGED
|
@@ -401,9 +401,64 @@ var init_xdg = () => {};
|
|
|
401
401
|
|
|
402
402
|
// ../../packages/shared/dist/config/massa-ai-config.js
|
|
403
403
|
import path2 from "path";
|
|
404
|
-
var defaultMassaAiConfig;
|
|
404
|
+
var SCHEDULER_JOB_KINDS, MAX_MATCH_WORK = 1e5, MAX_IGNORE_PATTERNS = 1024, DEFAULT_CAPTURE_POLICY, DEFAULT_SCHEDULER_CONFIG, defaultMassaAiConfig;
|
|
405
405
|
var init_massa_ai_config = __esm(() => {
|
|
406
406
|
init_xdg();
|
|
407
|
+
SCHEDULER_JOB_KINDS = [
|
|
408
|
+
"memory-consolidation",
|
|
409
|
+
"decay-sweep",
|
|
410
|
+
"auto-improve",
|
|
411
|
+
"observation-bridge",
|
|
412
|
+
"checkpoint-purge"
|
|
413
|
+
];
|
|
414
|
+
DEFAULT_CAPTURE_POLICY = {
|
|
415
|
+
rules: [
|
|
416
|
+
{ pattern: "**/node_modules/**", disposition: "Drop" },
|
|
417
|
+
{ pattern: "**/.git/**", disposition: "Drop" },
|
|
418
|
+
{ pattern: "**/dist/**", disposition: "Drop" },
|
|
419
|
+
{ pattern: "**/build/**", disposition: "Drop" },
|
|
420
|
+
{ pattern: "**/coverage/**", disposition: "Drop" },
|
|
421
|
+
{ pattern: ".env", disposition: "Drop" },
|
|
422
|
+
{ pattern: ".env.*", disposition: "Drop" },
|
|
423
|
+
{ pattern: "**/generated/**", disposition: "Drop" },
|
|
424
|
+
{ pattern: "**/*.generated.*", disposition: "Drop" },
|
|
425
|
+
{ pattern: "**/*.d.ts", disposition: "Drop" },
|
|
426
|
+
{ pattern: "**/__tests__/**", disposition: "Drop" },
|
|
427
|
+
{ pattern: "**/tests/**", disposition: "Drop" },
|
|
428
|
+
{ pattern: "**/*.test.ts", disposition: "Drop" },
|
|
429
|
+
{ pattern: "**/*.test.tsx", disposition: "Drop" },
|
|
430
|
+
{ pattern: "**/*.test.js", disposition: "Drop" },
|
|
431
|
+
{ pattern: "**/*.test.jsx", disposition: "Drop" },
|
|
432
|
+
{ pattern: "**/*.spec.ts", disposition: "Drop" },
|
|
433
|
+
{ pattern: "**/*.spec.tsx", disposition: "Drop" },
|
|
434
|
+
{ pattern: "**/*.spec.js", disposition: "Drop" },
|
|
435
|
+
{ pattern: "**/*.spec.jsx", disposition: "Drop" },
|
|
436
|
+
{ pattern: "**/benchmarks/**", disposition: "Drop" },
|
|
437
|
+
{ pattern: "**/fixtures/**", disposition: "Drop" },
|
|
438
|
+
{ pattern: "**/*.wasm*", disposition: "Drop" },
|
|
439
|
+
{ pattern: "**/*.min.*", disposition: "Drop" },
|
|
440
|
+
{ pattern: "**/*.map", disposition: "Drop" },
|
|
441
|
+
{ pattern: "**/lock.yaml", disposition: "Drop" },
|
|
442
|
+
{ pattern: "**/pnpm-lock.yaml", disposition: "Drop" },
|
|
443
|
+
{ pattern: "**/package-lock.json", disposition: "Drop" },
|
|
444
|
+
{ pattern: "**/bun.lockb", disposition: "Drop" },
|
|
445
|
+
{ pattern: "**/yarn.lock", disposition: "Drop" }
|
|
446
|
+
],
|
|
447
|
+
maxMatchWork: MAX_MATCH_WORK,
|
|
448
|
+
maxIgnorePatterns: MAX_IGNORE_PATTERNS
|
|
449
|
+
};
|
|
450
|
+
DEFAULT_SCHEDULER_CONFIG = {
|
|
451
|
+
enabled: false,
|
|
452
|
+
tickMs: 60000,
|
|
453
|
+
maxConcurrent: 2,
|
|
454
|
+
jobs: {
|
|
455
|
+
"memory-consolidation": { enabled: false, intervalMs: 30 * 60 * 1000 },
|
|
456
|
+
"decay-sweep": { enabled: false, intervalMs: 60 * 60 * 1000 },
|
|
457
|
+
"auto-improve": { enabled: false, intervalMs: 30 * 60 * 1000 },
|
|
458
|
+
"observation-bridge": { enabled: false, intervalMs: 30 * 60 * 1000 },
|
|
459
|
+
"checkpoint-purge": { enabled: false, intervalMs: 60 * 60 * 1000 }
|
|
460
|
+
}
|
|
461
|
+
};
|
|
407
462
|
defaultMassaAiConfig = {
|
|
408
463
|
database: {
|
|
409
464
|
url: ""
|
|
@@ -422,7 +477,7 @@ var init_massa_ai_config = __esm(() => {
|
|
|
422
477
|
impact: {
|
|
423
478
|
bfsCteEnabled: false
|
|
424
479
|
},
|
|
425
|
-
capturePolicy:
|
|
480
|
+
capturePolicy: DEFAULT_CAPTURE_POLICY,
|
|
426
481
|
cache: {
|
|
427
482
|
enabled: true,
|
|
428
483
|
l1MaxSizeMB: 100,
|
|
@@ -545,7 +600,8 @@ var init_massa_ai_config = __esm(() => {
|
|
|
545
600
|
},
|
|
546
601
|
security: {
|
|
547
602
|
corsOrigins: []
|
|
548
|
-
}
|
|
603
|
+
},
|
|
604
|
+
scheduler: DEFAULT_SCHEDULER_CONFIG
|
|
549
605
|
};
|
|
550
606
|
});
|
|
551
607
|
|
|
@@ -555,6 +611,8 @@ __export(exports_config_loader, {
|
|
|
555
611
|
writeFileAtomically: () => writeFileAtomically,
|
|
556
612
|
saveConfig: () => saveConfig,
|
|
557
613
|
migrateDataDirOnce: () => migrateDataDirOnce,
|
|
614
|
+
mergeSchedulerSection: () => mergeSchedulerSection,
|
|
615
|
+
loadRawUserConfig: () => loadRawUserConfig,
|
|
558
616
|
loadConfigSafe: () => loadConfigSafe,
|
|
559
617
|
loadConfig: () => loadConfig,
|
|
560
618
|
initConfig: () => initConfig,
|
|
@@ -577,6 +635,22 @@ function getConfigPath() {
|
|
|
577
635
|
function configExists() {
|
|
578
636
|
return fs.existsSync(CONFIG_FILE);
|
|
579
637
|
}
|
|
638
|
+
function mergeSchedulerJobs(base, incoming) {
|
|
639
|
+
const defaults = defaultMassaAiConfig.scheduler?.jobs ?? {};
|
|
640
|
+
const merged = {};
|
|
641
|
+
for (const kind of Object.keys(defaults)) {
|
|
642
|
+
merged[kind] = { ...defaults[kind], ...base?.[kind], ...incoming?.[kind] };
|
|
643
|
+
}
|
|
644
|
+
return merged;
|
|
645
|
+
}
|
|
646
|
+
function mergeSchedulerSection(base, incoming) {
|
|
647
|
+
return {
|
|
648
|
+
...defaultMassaAiConfig.scheduler,
|
|
649
|
+
...base,
|
|
650
|
+
...incoming,
|
|
651
|
+
jobs: mergeSchedulerJobs(base?.jobs, incoming?.jobs)
|
|
652
|
+
};
|
|
653
|
+
}
|
|
580
654
|
function loadConfig() {
|
|
581
655
|
if (!fs.existsSync(CONFIG_FILE)) {
|
|
582
656
|
return defaultMassaAiConfig;
|
|
@@ -597,13 +671,27 @@ function loadConfig() {
|
|
|
597
671
|
memory: { ...defaultMassaAiConfig.memory, ...userConfig.memory },
|
|
598
672
|
hooks: { ...defaultMassaAiConfig.hooks, ...userConfig.hooks },
|
|
599
673
|
handoffs: { ...defaultMassaAiConfig.handoffs, ...userConfig.handoffs },
|
|
600
|
-
security: { ...defaultMassaAiConfig.security, ...userConfig.security }
|
|
674
|
+
security: { ...defaultMassaAiConfig.security, ...userConfig.security },
|
|
675
|
+
scheduler: mergeSchedulerSection(undefined, userConfig.scheduler),
|
|
676
|
+
capturePolicy: userConfig.capturePolicy ?? defaultMassaAiConfig.capturePolicy
|
|
601
677
|
};
|
|
602
678
|
} catch (error) {
|
|
603
679
|
console.error(`Error loading config from ${CONFIG_FILE}:`, error);
|
|
604
680
|
return defaultMassaAiConfig;
|
|
605
681
|
}
|
|
606
682
|
}
|
|
683
|
+
function loadRawUserConfig() {
|
|
684
|
+
try {
|
|
685
|
+
if (!fs.existsSync(CONFIG_FILE))
|
|
686
|
+
return {};
|
|
687
|
+
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, "utf-8"));
|
|
688
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
689
|
+
return {};
|
|
690
|
+
return parsed;
|
|
691
|
+
} catch {
|
|
692
|
+
return {};
|
|
693
|
+
}
|
|
694
|
+
}
|
|
607
695
|
function loadConfigSafe() {
|
|
608
696
|
try {
|
|
609
697
|
return loadConfig();
|
|
@@ -737,6 +825,7 @@ var init_env = __esm(() => {
|
|
|
737
825
|
// ../../packages/shared/dist/config/config-writer.js
|
|
738
826
|
var init_config_writer = __esm(() => {
|
|
739
827
|
init_config_loader();
|
|
828
|
+
init_massa_ai_config();
|
|
740
829
|
});
|
|
741
830
|
|
|
742
831
|
// ../../packages/shared/dist/config/api-key.js
|
|
@@ -776,6 +865,31 @@ function parsePositiveIntEnv(raw2, defaultValue, opts) {
|
|
|
776
865
|
return Number.isInteger(n) && n >= floor ? n : defaultValue;
|
|
777
866
|
}
|
|
778
867
|
|
|
868
|
+
// ../../packages/shared/dist/config/embedding-dimensions.js
|
|
869
|
+
function knownEmbeddingDimensions(model) {
|
|
870
|
+
if (!model)
|
|
871
|
+
return;
|
|
872
|
+
return KNOWN_EMBEDDING_DIMENSIONS[model.trim()];
|
|
873
|
+
}
|
|
874
|
+
function resolveEmbeddingDimensions(model, configured, envValue) {
|
|
875
|
+
if (envValue !== undefined)
|
|
876
|
+
return { dimensions: envValue };
|
|
877
|
+
const known = knownEmbeddingDimensions(model);
|
|
878
|
+
if (known !== undefined) {
|
|
879
|
+
return configured !== undefined && configured !== known ? { dimensions: known, correctedFrom: configured } : { dimensions: known };
|
|
880
|
+
}
|
|
881
|
+
return { dimensions: configured ?? DEFAULT_EMBEDDING_DIMENSIONS };
|
|
882
|
+
}
|
|
883
|
+
var KNOWN_EMBEDDING_DIMENSIONS, DEFAULT_EMBEDDING_DIMENSIONS = 2560;
|
|
884
|
+
var init_embedding_dimensions = __esm(() => {
|
|
885
|
+
KNOWN_EMBEDDING_DIMENSIONS = {
|
|
886
|
+
"qwen3-embedding:8b": 4096,
|
|
887
|
+
"qwen3-embedding:4b": 2560,
|
|
888
|
+
"qwen3-embedding:0.6b": 1024,
|
|
889
|
+
"bge-m3": 1024
|
|
890
|
+
};
|
|
891
|
+
});
|
|
892
|
+
|
|
779
893
|
// ../../packages/shared/dist/config/index.js
|
|
780
894
|
import path4 from "path";
|
|
781
895
|
function envNum(key, fallback) {
|
|
@@ -807,6 +921,22 @@ function envList(key, fallback) {
|
|
|
807
921
|
const parsed = s.split(",").map((v) => v.trim()).filter((v) => v.length > 0);
|
|
808
922
|
return parsed.length > 0 ? parsed : fallback;
|
|
809
923
|
}
|
|
924
|
+
function readSchedulerConfig(rawFileConfig) {
|
|
925
|
+
try {
|
|
926
|
+
const cfg = rawFileConfig;
|
|
927
|
+
return cfg?.scheduler ?? {};
|
|
928
|
+
} catch {
|
|
929
|
+
return {};
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
function resolveSchedulerJob(kind, fileJobs) {
|
|
933
|
+
const meta = SCHEDULER_JOB_ENV[kind];
|
|
934
|
+
const fileJob = fileJobs?.[kind];
|
|
935
|
+
return {
|
|
936
|
+
enabled: envBool(meta.enabledVar, fileJob?.enabled ?? false),
|
|
937
|
+
intervalMs: envNum(meta.intervalVar, fileJob?.intervalMs ?? meta.defaultIntervalMs)
|
|
938
|
+
};
|
|
939
|
+
}
|
|
810
940
|
function validateCapturePolicyConfig(raw2) {
|
|
811
941
|
if (!raw2 || typeof raw2 !== "object")
|
|
812
942
|
throw new TypeError("capturePolicy must be an object");
|
|
@@ -934,6 +1064,11 @@ class Config {
|
|
|
934
1064
|
rateLimit: { ...defaults.rateLimit, ...overrides.rateLimit },
|
|
935
1065
|
security: { ...defaults.security, ...overrides.security },
|
|
936
1066
|
logging: { ...defaults.logging, ...overrides.logging },
|
|
1067
|
+
scheduler: {
|
|
1068
|
+
...defaults.scheduler,
|
|
1069
|
+
...overrides.scheduler,
|
|
1070
|
+
jobs: { ...defaults.scheduler.jobs, ...overrides.scheduler?.jobs }
|
|
1071
|
+
},
|
|
937
1072
|
synapse: {
|
|
938
1073
|
...defaults.synapse,
|
|
939
1074
|
...overrides.synapse,
|
|
@@ -1002,15 +1137,45 @@ class Config {
|
|
|
1002
1137
|
this.config[key] = value;
|
|
1003
1138
|
}
|
|
1004
1139
|
}
|
|
1005
|
-
var DEFAULT_LLM_MODEL = "qwen2.5:7b-instruct", DEFAULT_LLM_CODE_MODEL = "qwen2.5-coder:7b",
|
|
1140
|
+
var DEFAULT_LLM_MODEL = "qwen2.5:7b-instruct", DEFAULT_LLM_CODE_MODEL = "qwen2.5-coder:7b", SCHEDULER_JOB_ENV, DEFAULT_ALLOWED_EXTENSIONS, fileConfig, fileCacheL1Bytes, fileCacheL2Bytes, resolvedDataDir, defaultConfig, config;
|
|
1006
1141
|
var init_config = __esm(() => {
|
|
1007
1142
|
init_env();
|
|
1008
1143
|
init_config_loader();
|
|
1009
1144
|
init_massa_ai_config();
|
|
1145
|
+
init_massa_ai_config();
|
|
1146
|
+
init_massa_ai_config();
|
|
1010
1147
|
init_config_loader();
|
|
1011
1148
|
init_config_writer();
|
|
1012
1149
|
init_xdg();
|
|
1013
1150
|
init_api_key();
|
|
1151
|
+
init_embedding_dimensions();
|
|
1152
|
+
SCHEDULER_JOB_ENV = {
|
|
1153
|
+
"memory-consolidation": {
|
|
1154
|
+
enabledVar: "MASSA_AI_SCHEDULER_CONSOLIDATION_ENABLED",
|
|
1155
|
+
intervalVar: "MASSA_AI_SCHEDULER_CONSOLIDATION_INTERVAL_MS",
|
|
1156
|
+
defaultIntervalMs: 30 * 60 * 1000
|
|
1157
|
+
},
|
|
1158
|
+
"decay-sweep": {
|
|
1159
|
+
enabledVar: "MASSA_AI_SCHEDULER_DECAY_ENABLED",
|
|
1160
|
+
intervalVar: "MASSA_AI_SCHEDULER_DECAY_INTERVAL_MS",
|
|
1161
|
+
defaultIntervalMs: 60 * 60 * 1000
|
|
1162
|
+
},
|
|
1163
|
+
"auto-improve": {
|
|
1164
|
+
enabledVar: "MASSA_AI_SCHEDULER_AUTO_IMPROVE_ENABLED",
|
|
1165
|
+
intervalVar: "MASSA_AI_SCHEDULER_AUTO_IMPROVE_INTERVAL_MS",
|
|
1166
|
+
defaultIntervalMs: 30 * 60 * 1000
|
|
1167
|
+
},
|
|
1168
|
+
"observation-bridge": {
|
|
1169
|
+
enabledVar: "MASSA_AI_SCHEDULER_OBSERVATION_BRIDGE_ENABLED",
|
|
1170
|
+
intervalVar: "MASSA_AI_SCHEDULER_OBSERVATION_BRIDGE_INTERVAL_MS",
|
|
1171
|
+
defaultIntervalMs: 30 * 60 * 1000
|
|
1172
|
+
},
|
|
1173
|
+
"checkpoint-purge": {
|
|
1174
|
+
enabledVar: "MASSA_AI_SCHEDULER_CHECKPOINT_PURGE_ENABLED",
|
|
1175
|
+
intervalVar: "MASSA_AI_SCHEDULER_CHECKPOINT_PURGE_INTERVAL_MS",
|
|
1176
|
+
defaultIntervalMs: 60 * 60 * 1000
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1014
1179
|
DEFAULT_ALLOWED_EXTENSIONS = [
|
|
1015
1180
|
".ts",
|
|
1016
1181
|
".js",
|
|
@@ -1049,10 +1214,11 @@ var init_config = __esm(() => {
|
|
|
1049
1214
|
fileConfig = loadConfigSafe();
|
|
1050
1215
|
fileCacheL1Bytes = fileConfig.cache?.l1MaxSizeMB ? fileConfig.cache.l1MaxSizeMB * 1024 * 1024 : undefined;
|
|
1051
1216
|
fileCacheL2Bytes = fileConfig.cache?.l2MaxSizeMB ? fileConfig.cache.l2MaxSizeMB * 1024 * 1024 : undefined;
|
|
1217
|
+
resolvedDataDir = getGlobalDataDir();
|
|
1052
1218
|
defaultConfig = {
|
|
1053
1219
|
name: "massa-ai-server",
|
|
1054
1220
|
version: "1.0.0",
|
|
1055
|
-
dataDir:
|
|
1221
|
+
dataDir: resolvedDataDir,
|
|
1056
1222
|
cache: {
|
|
1057
1223
|
l1: {
|
|
1058
1224
|
maxSize: envNum("L1_CACHE_MAX_SIZE", fileCacheL1Bytes ?? 100 * 1024 * 1024),
|
|
@@ -1176,8 +1342,24 @@ var init_config = __esm(() => {
|
|
|
1176
1342
|
logging: {
|
|
1177
1343
|
level: process.env.LOG_LEVEL || fileConfig.logging?.level || "info",
|
|
1178
1344
|
enableMetrics: process.env.ENABLE_METRICS === "true" || process.env.ENABLE_METRICS === undefined && !!fileConfig.logging?.enableMetrics,
|
|
1179
|
-
file: process.env.MASSA_AI_LOG_FILE || fileConfig.logging?.file ||
|
|
1180
|
-
|
|
1345
|
+
file: process.env.MASSA_AI_LOG_FILE || fileConfig.logging?.file || path4.join(resolvedDataDir, "logs", "massa-ai.log"),
|
|
1346
|
+
enableFileSink: envBool("MASSA_AI_LOG_ENABLE_FILE_SINK", fileConfig.logging?.enableFileSink ?? true),
|
|
1347
|
+
bufferSize: envNum("MASSA_AI_LOG_BUFFER_SIZE", fileConfig.logging?.bufferSize ?? 2000),
|
|
1348
|
+
maxFileSizeMb: envNum("MASSA_AI_LOG_MAX_FILE_SIZE_MB", fileConfig.logging?.maxFileSizeMb ?? 32),
|
|
1349
|
+
maxFiles: envNum("MASSA_AI_LOG_MAX_FILES", fileConfig.logging?.maxFiles ?? 5)
|
|
1350
|
+
},
|
|
1351
|
+
scheduler: (() => {
|
|
1352
|
+
const fileScheduler = readSchedulerConfig(fileConfig);
|
|
1353
|
+
return {
|
|
1354
|
+
enabled: envBool("MASSA_AI_SCHEDULER_ENABLED", fileScheduler.enabled ?? false),
|
|
1355
|
+
tickMs: envNum("MASSA_AI_SCHEDULER_TICK_MS", fileScheduler.tickMs ?? 60000),
|
|
1356
|
+
maxConcurrent: envNum("MASSA_AI_SCHEDULER_MAX_CONCURRENT", fileScheduler.maxConcurrent ?? 2),
|
|
1357
|
+
jobs: Object.fromEntries(SCHEDULER_JOB_KINDS.map((kind) => [
|
|
1358
|
+
kind,
|
|
1359
|
+
resolveSchedulerJob(kind, fileScheduler.jobs)
|
|
1360
|
+
]))
|
|
1361
|
+
};
|
|
1362
|
+
})(),
|
|
1181
1363
|
synapse: {
|
|
1182
1364
|
enabled: process.env.SYNAPSE_ENABLED !== "false",
|
|
1183
1365
|
inhibition: {
|
|
@@ -1329,13 +1511,175 @@ var init_types = __esm(() => {
|
|
|
1329
1511
|
// ../../packages/shared/dist/types/interfaces.js
|
|
1330
1512
|
var init_interfaces = () => {};
|
|
1331
1513
|
|
|
1332
|
-
// ../../packages/shared/dist/utils/
|
|
1514
|
+
// ../../packages/shared/dist/utils/log-sink.js
|
|
1333
1515
|
import fs2 from "fs";
|
|
1516
|
+
import path5 from "path";
|
|
1517
|
+
function getState(filePath) {
|
|
1518
|
+
let state = pathState.get(filePath);
|
|
1519
|
+
if (!state) {
|
|
1520
|
+
state = { trackedSize: 0, deltaSinceStat: 0, primed: false };
|
|
1521
|
+
pathState.set(filePath, state);
|
|
1522
|
+
}
|
|
1523
|
+
return state;
|
|
1524
|
+
}
|
|
1525
|
+
function ensureDir(filePath) {
|
|
1526
|
+
const dir = path5.dirname(filePath);
|
|
1527
|
+
if (ensuredDirs.has(dir))
|
|
1528
|
+
return;
|
|
1529
|
+
fs2.mkdirSync(dir, { recursive: true });
|
|
1530
|
+
ensuredDirs.add(dir);
|
|
1531
|
+
}
|
|
1532
|
+
function restat(filePath, state) {
|
|
1533
|
+
try {
|
|
1534
|
+
state.trackedSize = fs2.statSync(filePath).size;
|
|
1535
|
+
} catch {
|
|
1536
|
+
state.trackedSize = 0;
|
|
1537
|
+
}
|
|
1538
|
+
state.deltaSinceStat = 0;
|
|
1539
|
+
state.primed = true;
|
|
1540
|
+
}
|
|
1541
|
+
function rotate(filePath, maxFiles) {
|
|
1542
|
+
if (maxFiles <= 0) {
|
|
1543
|
+
if (fs2.existsSync(filePath))
|
|
1544
|
+
fs2.unlinkSync(filePath);
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
const oldest = `${filePath}.${maxFiles}`;
|
|
1548
|
+
if (fs2.existsSync(oldest))
|
|
1549
|
+
fs2.unlinkSync(oldest);
|
|
1550
|
+
for (let n = maxFiles - 1;n >= 1; n--) {
|
|
1551
|
+
const src = `${filePath}.${n}`;
|
|
1552
|
+
const dest = `${filePath}.${n + 1}`;
|
|
1553
|
+
if (fs2.existsSync(src))
|
|
1554
|
+
fs2.renameSync(src, dest);
|
|
1555
|
+
}
|
|
1556
|
+
if (fs2.existsSync(filePath))
|
|
1557
|
+
fs2.renameSync(filePath, `${filePath}.1`);
|
|
1558
|
+
}
|
|
1559
|
+
function appendLine(opts, line) {
|
|
1560
|
+
const { filePath, maxFileSizeBytes, maxFiles } = opts;
|
|
1561
|
+
try {
|
|
1562
|
+
ensureDir(filePath);
|
|
1563
|
+
const state = getState(filePath);
|
|
1564
|
+
const lineBytes = Buffer.byteLength(line + `
|
|
1565
|
+
`, "utf8");
|
|
1566
|
+
if (!state.primed || state.deltaSinceStat >= STAT_DELTA_THRESHOLD_BYTES || state.trackedSize + state.deltaSinceStat >= maxFileSizeBytes) {
|
|
1567
|
+
restat(filePath, state);
|
|
1568
|
+
}
|
|
1569
|
+
if (maxFileSizeBytes > 0 && state.trackedSize >= maxFileSizeBytes) {
|
|
1570
|
+
rotate(filePath, maxFiles);
|
|
1571
|
+
state.trackedSize = 0;
|
|
1572
|
+
state.deltaSinceStat = 0;
|
|
1573
|
+
state.primed = true;
|
|
1574
|
+
}
|
|
1575
|
+
fs2.appendFileSync(filePath, line + `
|
|
1576
|
+
`);
|
|
1577
|
+
state.trackedSize += lineBytes;
|
|
1578
|
+
state.deltaSinceStat += lineBytes;
|
|
1579
|
+
} catch (err) {
|
|
1580
|
+
lastError = err;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
var STAT_DELTA_THRESHOLD_BYTES, ensuredDirs, pathState, lastError;
|
|
1584
|
+
var init_log_sink = __esm(() => {
|
|
1585
|
+
STAT_DELTA_THRESHOLD_BYTES = 1024 * 1024;
|
|
1586
|
+
ensuredDirs = new Set;
|
|
1587
|
+
pathState = new Map;
|
|
1588
|
+
});
|
|
1589
|
+
|
|
1590
|
+
// ../../packages/shared/dist/utils/log-buffer.js
|
|
1591
|
+
class LogBufferImpl {
|
|
1592
|
+
capacity = DEFAULT_CAPACITY;
|
|
1593
|
+
entries = [];
|
|
1594
|
+
subscribers = new Set;
|
|
1595
|
+
nextSeq = 0;
|
|
1596
|
+
dispatching = false;
|
|
1597
|
+
pending = [];
|
|
1598
|
+
push(entry) {
|
|
1599
|
+
if (this.dispatching) {
|
|
1600
|
+
this.pending.push(entry);
|
|
1601
|
+
return;
|
|
1602
|
+
}
|
|
1603
|
+
this.dispatching = true;
|
|
1604
|
+
try {
|
|
1605
|
+
this.pushOne(entry);
|
|
1606
|
+
while (this.pending.length > 0) {
|
|
1607
|
+
const next = this.pending.shift();
|
|
1608
|
+
this.pushOne(next);
|
|
1609
|
+
}
|
|
1610
|
+
} finally {
|
|
1611
|
+
this.dispatching = false;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
pushOne(entry) {
|
|
1615
|
+
const full = { ...entry, seq: this.nextSeq++ };
|
|
1616
|
+
this.entries.push(full);
|
|
1617
|
+
while (this.entries.length > this.capacity) {
|
|
1618
|
+
this.entries.shift();
|
|
1619
|
+
}
|
|
1620
|
+
for (const fn of this.subscribers) {
|
|
1621
|
+
try {
|
|
1622
|
+
fn(full);
|
|
1623
|
+
} catch {}
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
snapshot(opts) {
|
|
1627
|
+
const from = opts?.from;
|
|
1628
|
+
const to = opts?.to;
|
|
1629
|
+
const level = opts?.level;
|
|
1630
|
+
const q = opts?.q?.toLowerCase();
|
|
1631
|
+
const result = [];
|
|
1632
|
+
for (let i = this.entries.length - 1;i >= 0; i--) {
|
|
1633
|
+
const e = this.entries[i];
|
|
1634
|
+
if (from !== undefined && e.seq < from)
|
|
1635
|
+
continue;
|
|
1636
|
+
if (to !== undefined && e.seq > to)
|
|
1637
|
+
continue;
|
|
1638
|
+
if (level !== undefined && e.level !== level)
|
|
1639
|
+
continue;
|
|
1640
|
+
if (q !== undefined && !e.message.toLowerCase().includes(q))
|
|
1641
|
+
continue;
|
|
1642
|
+
result.push(e);
|
|
1643
|
+
}
|
|
1644
|
+
return result;
|
|
1645
|
+
}
|
|
1646
|
+
subscribe(fn) {
|
|
1647
|
+
this.subscribers.add(fn);
|
|
1648
|
+
return () => {
|
|
1649
|
+
this.subscribers.delete(fn);
|
|
1650
|
+
};
|
|
1651
|
+
}
|
|
1652
|
+
setCapacity(n) {
|
|
1653
|
+
this.capacity = n > 0 ? n : 0;
|
|
1654
|
+
while (this.entries.length > this.capacity) {
|
|
1655
|
+
this.entries.shift();
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
size() {
|
|
1659
|
+
return this.entries.length;
|
|
1660
|
+
}
|
|
1661
|
+
_resetForTesting() {
|
|
1662
|
+
this.entries = [];
|
|
1663
|
+
this.subscribers.clear();
|
|
1664
|
+
this.nextSeq = 0;
|
|
1665
|
+
this.dispatching = false;
|
|
1666
|
+
this.pending = [];
|
|
1667
|
+
this.capacity = DEFAULT_CAPACITY;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
var DEFAULT_CAPACITY = 2000, logBuffer;
|
|
1671
|
+
var init_log_buffer = __esm(() => {
|
|
1672
|
+
logBuffer = new LogBufferImpl;
|
|
1673
|
+
});
|
|
1334
1674
|
|
|
1675
|
+
// ../../packages/shared/dist/utils/logger.js
|
|
1335
1676
|
class Logger {
|
|
1336
1677
|
_level;
|
|
1337
1678
|
_enableMetrics;
|
|
1338
1679
|
_logFilePath;
|
|
1680
|
+
_enableFileSink;
|
|
1681
|
+
_maxFileSizeBytes;
|
|
1682
|
+
_maxFiles;
|
|
1339
1683
|
_initialized = false;
|
|
1340
1684
|
constructor() {}
|
|
1341
1685
|
ensureInitialized() {
|
|
@@ -1345,10 +1689,18 @@ class Logger {
|
|
|
1345
1689
|
this._level = this.parseLogLevel(loggingConfig.level);
|
|
1346
1690
|
this._enableMetrics = loggingConfig.enableMetrics;
|
|
1347
1691
|
this._logFilePath = loggingConfig.file;
|
|
1692
|
+
this._enableFileSink = loggingConfig.enableFileSink;
|
|
1693
|
+
this._maxFileSizeBytes = loggingConfig.maxFileSizeMb * 1024 * 1024;
|
|
1694
|
+
this._maxFiles = loggingConfig.maxFiles;
|
|
1695
|
+
logBuffer.setCapacity(loggingConfig.bufferSize);
|
|
1348
1696
|
} catch {
|
|
1349
1697
|
this._level = LogLevel.INFO;
|
|
1350
1698
|
this._enableMetrics = false;
|
|
1351
1699
|
this._logFilePath = undefined;
|
|
1700
|
+
this._enableFileSink = false;
|
|
1701
|
+
this._maxFileSizeBytes = 32 * 1024 * 1024;
|
|
1702
|
+
this._maxFiles = 5;
|
|
1703
|
+
logBuffer.setCapacity(2000);
|
|
1352
1704
|
}
|
|
1353
1705
|
this._initialized = true;
|
|
1354
1706
|
}
|
|
@@ -1365,6 +1717,18 @@ class Logger {
|
|
|
1365
1717
|
this.ensureInitialized();
|
|
1366
1718
|
return this._logFilePath;
|
|
1367
1719
|
}
|
|
1720
|
+
get enableFileSink() {
|
|
1721
|
+
this.ensureInitialized();
|
|
1722
|
+
return this._enableFileSink;
|
|
1723
|
+
}
|
|
1724
|
+
get maxFileSizeBytes() {
|
|
1725
|
+
this.ensureInitialized();
|
|
1726
|
+
return this._maxFileSizeBytes;
|
|
1727
|
+
}
|
|
1728
|
+
get maxFiles() {
|
|
1729
|
+
this.ensureInitialized();
|
|
1730
|
+
return this._maxFiles;
|
|
1731
|
+
}
|
|
1368
1732
|
parseLogLevel(level) {
|
|
1369
1733
|
const levels = {
|
|
1370
1734
|
debug: LogLevel.DEBUG,
|
|
@@ -1377,34 +1741,40 @@ class Logger {
|
|
|
1377
1741
|
shouldLog(level) {
|
|
1378
1742
|
return level >= this.level;
|
|
1379
1743
|
}
|
|
1380
|
-
formatMessage(level, message, meta) {
|
|
1381
|
-
const timestamp = new Date().toISOString();
|
|
1744
|
+
formatMessage(level, message, meta, timestamp = new Date().toISOString()) {
|
|
1382
1745
|
const metaStr = meta ? ` ${JSON.stringify(meta)}` : "";
|
|
1383
1746
|
return `[${timestamp}] [${level}] ${message}${metaStr}`;
|
|
1384
1747
|
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
const
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1748
|
+
emit(level, message, meta) {
|
|
1749
|
+
const ts = new Date().toISOString();
|
|
1750
|
+
const line = this.formatMessage(LOG_LEVEL_LABELS[level], message, meta, ts);
|
|
1751
|
+
console.error(line);
|
|
1752
|
+
if (this.enableFileSink) {
|
|
1753
|
+
const filePath = this.logFilePath;
|
|
1754
|
+
if (filePath) {
|
|
1755
|
+
appendLine({ filePath, maxFileSizeBytes: this.maxFileSizeBytes, maxFiles: this.maxFiles }, line);
|
|
1756
|
+
}
|
|
1393
1757
|
}
|
|
1758
|
+
logBuffer.push({
|
|
1759
|
+
ts,
|
|
1760
|
+
level: LOG_LEVEL_BUFFER_TAGS[level],
|
|
1761
|
+
message,
|
|
1762
|
+
...meta ? { meta } : {}
|
|
1763
|
+
});
|
|
1394
1764
|
}
|
|
1395
1765
|
debug(message, meta) {
|
|
1396
1766
|
if (this.shouldLog(LogLevel.DEBUG)) {
|
|
1397
|
-
this.
|
|
1767
|
+
this.emit(LogLevel.DEBUG, message, meta);
|
|
1398
1768
|
}
|
|
1399
1769
|
}
|
|
1400
1770
|
info(message, meta) {
|
|
1401
1771
|
if (this.shouldLog(LogLevel.INFO)) {
|
|
1402
|
-
this.
|
|
1772
|
+
this.emit(LogLevel.INFO, message, meta);
|
|
1403
1773
|
}
|
|
1404
1774
|
}
|
|
1405
1775
|
warn(message, meta) {
|
|
1406
1776
|
if (this.shouldLog(LogLevel.WARN)) {
|
|
1407
|
-
this.
|
|
1777
|
+
this.emit(LogLevel.WARN, message, meta);
|
|
1408
1778
|
}
|
|
1409
1779
|
}
|
|
1410
1780
|
error(message, error, meta) {
|
|
@@ -1417,7 +1787,7 @@ class Logger {
|
|
|
1417
1787
|
stack: error.stack
|
|
1418
1788
|
}
|
|
1419
1789
|
} : meta;
|
|
1420
|
-
this.
|
|
1790
|
+
this.emit(LogLevel.ERROR, message, errorMeta);
|
|
1421
1791
|
}
|
|
1422
1792
|
}
|
|
1423
1793
|
metric(name, value, unit) {
|
|
@@ -1446,15 +1816,29 @@ class Logger {
|
|
|
1446
1816
|
return childLogger;
|
|
1447
1817
|
}
|
|
1448
1818
|
}
|
|
1449
|
-
var LogLevel, logger;
|
|
1819
|
+
var LogLevel, LOG_LEVEL_LABELS, LOG_LEVEL_BUFFER_TAGS, logger;
|
|
1450
1820
|
var init_logger = __esm(() => {
|
|
1451
1821
|
init_config();
|
|
1822
|
+
init_log_sink();
|
|
1823
|
+
init_log_buffer();
|
|
1452
1824
|
(function(LogLevel2) {
|
|
1453
1825
|
LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
|
|
1454
1826
|
LogLevel2[LogLevel2["INFO"] = 1] = "INFO";
|
|
1455
1827
|
LogLevel2[LogLevel2["WARN"] = 2] = "WARN";
|
|
1456
1828
|
LogLevel2[LogLevel2["ERROR"] = 3] = "ERROR";
|
|
1457
1829
|
})(LogLevel || (LogLevel = {}));
|
|
1830
|
+
LOG_LEVEL_LABELS = {
|
|
1831
|
+
[LogLevel.DEBUG]: "DEBUG",
|
|
1832
|
+
[LogLevel.INFO]: "INFO",
|
|
1833
|
+
[LogLevel.WARN]: "WARN",
|
|
1834
|
+
[LogLevel.ERROR]: "ERROR"
|
|
1835
|
+
};
|
|
1836
|
+
LOG_LEVEL_BUFFER_TAGS = {
|
|
1837
|
+
[LogLevel.DEBUG]: "debug",
|
|
1838
|
+
[LogLevel.INFO]: "info",
|
|
1839
|
+
[LogLevel.WARN]: "warn",
|
|
1840
|
+
[LogLevel.ERROR]: "error"
|
|
1841
|
+
};
|
|
1458
1842
|
logger = new Logger;
|
|
1459
1843
|
});
|
|
1460
1844
|
|
|
@@ -1737,6 +2121,8 @@ var init_rate_limiter = __esm(() => {
|
|
|
1737
2121
|
// ../../packages/shared/dist/utils/index.js
|
|
1738
2122
|
var init_utils = __esm(() => {
|
|
1739
2123
|
init_logger();
|
|
2124
|
+
init_log_buffer();
|
|
2125
|
+
init_log_sink();
|
|
1740
2126
|
init_sanitizer();
|
|
1741
2127
|
init_metrics();
|
|
1742
2128
|
init_rate_limiter();
|
|
@@ -1744,7 +2130,7 @@ var init_utils = __esm(() => {
|
|
|
1744
2130
|
|
|
1745
2131
|
// ../../packages/shared/dist/profile-switch/hosts.js
|
|
1746
2132
|
import os3 from "os";
|
|
1747
|
-
import
|
|
2133
|
+
import path6 from "path";
|
|
1748
2134
|
function isHost(v) {
|
|
1749
2135
|
return typeof v === "string" && HOSTS.includes(v);
|
|
1750
2136
|
}
|
|
@@ -1755,7 +2141,7 @@ function fileLayout(host, activeDir, activeGlob, variantsRoot) {
|
|
|
1755
2141
|
activeDir,
|
|
1756
2142
|
activeGlob,
|
|
1757
2143
|
variantsRoot,
|
|
1758
|
-
variantDir: (profile) =>
|
|
2144
|
+
variantDir: (profile) => path6.join(variantsRoot, profile)
|
|
1759
2145
|
};
|
|
1760
2146
|
}
|
|
1761
2147
|
function resolveHostLayout(host, opts = {}) {
|
|
@@ -1765,25 +2151,37 @@ function resolveHostLayout(host, opts = {}) {
|
|
|
1765
2151
|
case "cursor":
|
|
1766
2152
|
return { host, route: "skip", reason: CURSOR_SKIP_REASON };
|
|
1767
2153
|
case "claude": {
|
|
1768
|
-
const
|
|
1769
|
-
|
|
2154
|
+
const marketplaceRoot = opts.marketplaceRoot?.claude;
|
|
2155
|
+
if (override === undefined && marketplaceRoot !== undefined) {
|
|
2156
|
+
return fileLayout(host, path6.join(marketplaceRoot, "agents"), "massa-ai-*.md", path6.join(marketplaceRoot, "agent-profiles"));
|
|
2157
|
+
}
|
|
2158
|
+
const root = override ?? path6.join(targetHome, ".claude");
|
|
2159
|
+
return fileLayout(host, path6.join(root, "agents"), "massa-ai-*.md", path6.join(root, "massa-ai", "agent-profiles"));
|
|
1770
2160
|
}
|
|
1771
2161
|
case "codex": {
|
|
1772
|
-
const root = override ??
|
|
1773
|
-
return fileLayout(host,
|
|
2162
|
+
const root = override ?? path6.join(targetHome, ".codex");
|
|
2163
|
+
return fileLayout(host, path6.join(root, "agents"), "massa-ai-*.toml", path6.join(root, "massa-ai", "agent-profiles"));
|
|
1774
2164
|
}
|
|
1775
2165
|
case "opencode": {
|
|
1776
|
-
const root = override ??
|
|
1777
|
-
const pluginsDir =
|
|
1778
|
-
return fileLayout(host,
|
|
2166
|
+
const root = override ?? path6.join(targetHome, ".config", "opencode");
|
|
2167
|
+
const pluginsDir = path6.join(root, "plugins", "massa-ai");
|
|
2168
|
+
return fileLayout(host, path6.join(root, "agents"), "massa-ai-*.md", path6.join(pluginsDir, "agent-profiles"));
|
|
1779
2169
|
}
|
|
1780
2170
|
}
|
|
1781
2171
|
}
|
|
1782
|
-
function detectRoute(platform) {
|
|
2172
|
+
function detectRoute(platform, host) {
|
|
1783
2173
|
const route = platform?.installRoute;
|
|
1784
2174
|
if (route === "file")
|
|
1785
2175
|
return { kind: "proceed" };
|
|
1786
2176
|
if (route === "marketplace") {
|
|
2177
|
+
if (host === "claude")
|
|
2178
|
+
return { kind: "proceed" };
|
|
2179
|
+
if (host === "codex") {
|
|
2180
|
+
return {
|
|
2181
|
+
kind: "refuse",
|
|
2182
|
+
reason: "codex marketplace-route installs are refused (in-place bundle rewrite would dirty a checkout " + "and break the drift gate) \u2014 use the dev path: MASSA_AI_MODEL_PROFILE + regenerate."
|
|
2183
|
+
};
|
|
2184
|
+
}
|
|
1787
2185
|
return {
|
|
1788
2186
|
kind: "refuse",
|
|
1789
2187
|
reason: "claude/codex marketplace-route installs are refused (in-place bundle rewrite would dirty a checkout " + "and break the drift gate) \u2014 use the dev path: MASSA_AI_MODEL_PROFILE + regenerate."
|
|
@@ -1801,7 +2199,7 @@ var init_hosts = __esm(() => {
|
|
|
1801
2199
|
|
|
1802
2200
|
// ../../packages/shared/dist/profile-switch/state.js
|
|
1803
2201
|
import fs3 from "fs";
|
|
1804
|
-
import
|
|
2202
|
+
import path7 from "path";
|
|
1805
2203
|
function namedError(name, message) {
|
|
1806
2204
|
const err = new InstallStateError(message);
|
|
1807
2205
|
err.name = name;
|
|
@@ -1847,7 +2245,7 @@ function writeInstallState(filePath, state) {
|
|
|
1847
2245
|
const text = `${JSON.stringify(validated, null, 2)}
|
|
1848
2246
|
`;
|
|
1849
2247
|
try {
|
|
1850
|
-
fs3.mkdirSync(
|
|
2248
|
+
fs3.mkdirSync(path7.dirname(filePath), { recursive: true });
|
|
1851
2249
|
fs3.writeFileSync(filePath, text);
|
|
1852
2250
|
} catch (err) {
|
|
1853
2251
|
throw UnwritableInstallStateError(filePath, err.message);
|
|
@@ -1876,7 +2274,7 @@ var init_state = __esm(() => {
|
|
|
1876
2274
|
|
|
1877
2275
|
// ../../packages/shared/dist/profile-switch/lock.js
|
|
1878
2276
|
import fs4 from "fs";
|
|
1879
|
-
import
|
|
2277
|
+
import path8 from "path";
|
|
1880
2278
|
import os4 from "os";
|
|
1881
2279
|
import crypto3 from "crypto";
|
|
1882
2280
|
import { execFileSync } from "child_process";
|
|
@@ -1908,7 +2306,7 @@ function releaseIfOwned(lockDir, ownerPath, token) {
|
|
|
1908
2306
|
}
|
|
1909
2307
|
function acquireLock(stateFilePath, options = {}) {
|
|
1910
2308
|
const lockDir = `${stateFilePath}.switch.lock`;
|
|
1911
|
-
const ownerPath =
|
|
2309
|
+
const ownerPath = path8.join(lockDir, "owner.json");
|
|
1912
2310
|
const clock = options.clock ?? DEFAULT_CLOCK;
|
|
1913
2311
|
const identity = options.identity ?? DEFAULT_IDENTITY;
|
|
1914
2312
|
const staleAfterMs = options.staleAfterMs ?? DEFAULT_STALE_AFTER_MS;
|
|
@@ -1928,7 +2326,7 @@ function acquireLock(stateFilePath, options = {}) {
|
|
|
1928
2326
|
token,
|
|
1929
2327
|
timestamp: clock.now()
|
|
1930
2328
|
};
|
|
1931
|
-
fs4.mkdirSync(
|
|
2329
|
+
fs4.mkdirSync(path8.dirname(ownerPath), { recursive: true });
|
|
1932
2330
|
fs4.writeFileSync(ownerPath, JSON.stringify(record));
|
|
1933
2331
|
return { lockDir, release: () => releaseIfOwned(lockDir, ownerPath, token) };
|
|
1934
2332
|
};
|
|
@@ -1981,10 +2379,59 @@ var init_lock = __esm(() => {
|
|
|
1981
2379
|
};
|
|
1982
2380
|
});
|
|
1983
2381
|
|
|
1984
|
-
// ../../packages/shared/dist/profile-switch/
|
|
2382
|
+
// ../../packages/shared/dist/profile-switch/claude-marketplace.js
|
|
1985
2383
|
import fs5 from "fs";
|
|
1986
|
-
import path8 from "path";
|
|
1987
2384
|
import os5 from "os";
|
|
2385
|
+
import path9 from "path";
|
|
2386
|
+
function selectRecord(records) {
|
|
2387
|
+
if (records.length === 0)
|
|
2388
|
+
return;
|
|
2389
|
+
const userScoped = records.filter((r) => r.scope === "user");
|
|
2390
|
+
const pool = userScoped.length > 0 ? userScoped : records;
|
|
2391
|
+
let best;
|
|
2392
|
+
let bestTime = -Infinity;
|
|
2393
|
+
for (const record of pool) {
|
|
2394
|
+
const parsed = record.lastUpdated ? Date.parse(record.lastUpdated) : NaN;
|
|
2395
|
+
if (Number.isFinite(parsed) && parsed >= bestTime) {
|
|
2396
|
+
best = record;
|
|
2397
|
+
bestTime = parsed;
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
return best ?? pool[pool.length - 1];
|
|
2401
|
+
}
|
|
2402
|
+
function resolveClaudeMarketplaceRoot(opts = {}) {
|
|
2403
|
+
const targetHome = opts.targetHome ?? os5.homedir();
|
|
2404
|
+
const pluginKey = opts.pluginKey ?? DEFAULT_PLUGIN_KEY;
|
|
2405
|
+
const registryPath = path9.join(targetHome, ".claude", "plugins", "installed_plugins.json");
|
|
2406
|
+
let records;
|
|
2407
|
+
try {
|
|
2408
|
+
const raw2 = fs5.readFileSync(registryPath, "utf8");
|
|
2409
|
+
const parsed = JSON.parse(raw2);
|
|
2410
|
+
records = parsed?.plugins?.[pluginKey];
|
|
2411
|
+
} catch {
|
|
2412
|
+
return null;
|
|
2413
|
+
}
|
|
2414
|
+
if (!Array.isArray(records) || records.length === 0)
|
|
2415
|
+
return null;
|
|
2416
|
+
const selected = selectRecord(records);
|
|
2417
|
+
const installPath = selected?.installPath;
|
|
2418
|
+
if (!installPath)
|
|
2419
|
+
return null;
|
|
2420
|
+
try {
|
|
2421
|
+
if (!fs5.existsSync(installPath))
|
|
2422
|
+
return null;
|
|
2423
|
+
} catch {
|
|
2424
|
+
return null;
|
|
2425
|
+
}
|
|
2426
|
+
return installPath;
|
|
2427
|
+
}
|
|
2428
|
+
var DEFAULT_PLUGIN_KEY = "massa-ai@massa-ai";
|
|
2429
|
+
var init_claude_marketplace = () => {};
|
|
2430
|
+
|
|
2431
|
+
// ../../packages/shared/dist/profile-switch/engine.js
|
|
2432
|
+
import fs6 from "fs";
|
|
2433
|
+
import path10 from "path";
|
|
2434
|
+
import os6 from "os";
|
|
1988
2435
|
import crypto4 from "crypto";
|
|
1989
2436
|
function namedError3(name, message) {
|
|
1990
2437
|
const err = new SwitchEngineError(message);
|
|
@@ -1992,19 +2439,39 @@ function namedError3(name, message) {
|
|
|
1992
2439
|
return err;
|
|
1993
2440
|
}
|
|
1994
2441
|
function defaultStatePath(targetHome) {
|
|
1995
|
-
return
|
|
2442
|
+
return path10.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
1996
2443
|
}
|
|
1997
2444
|
function resolveCommon(opts) {
|
|
1998
|
-
const targetHome = opts.targetHome ??
|
|
2445
|
+
const targetHome = opts.targetHome ?? os6.homedir();
|
|
1999
2446
|
const stateFilePath = opts.stateFilePath ?? defaultStatePath(targetHome);
|
|
2000
2447
|
return { targetHome, stateFilePath };
|
|
2001
2448
|
}
|
|
2449
|
+
function marketplaceRoots(targetHome, state) {
|
|
2450
|
+
return state.platforms.claude?.installRoute === "marketplace" ? { claude: resolveClaudeMarketplaceRoot({ targetHome }) ?? undefined } : {};
|
|
2451
|
+
}
|
|
2452
|
+
function claudeMarketplaceUnresolvedReason(targetHome) {
|
|
2453
|
+
const registryPath = path10.join(targetHome, ".claude", "plugins", "installed_plugins.json");
|
|
2454
|
+
return `claude installRoute is "marketplace" but no install root could be resolved from ${registryPath} ` + "\u2014 re-run the Claude plugin installer, or verify the plugin registry file";
|
|
2455
|
+
}
|
|
2002
2456
|
function listProfiles(opts = {}) {
|
|
2003
2457
|
const { targetHome, stateFilePath } = resolveCommon(opts);
|
|
2004
2458
|
const state = readInstallState(stateFilePath);
|
|
2459
|
+
const roots = marketplaceRoots(targetHome, state);
|
|
2005
2460
|
const universe = opts.hosts ?? HOSTS;
|
|
2006
2461
|
const hosts = universe.map((host) => {
|
|
2007
|
-
|
|
2462
|
+
if (host === "claude" && state.platforms.claude?.installRoute === "marketplace" && roots.claude === undefined) {
|
|
2463
|
+
const platform2 = state.platforms.claude;
|
|
2464
|
+
return {
|
|
2465
|
+
host,
|
|
2466
|
+
installed: false,
|
|
2467
|
+
skipped: false,
|
|
2468
|
+
skipReason: null,
|
|
2469
|
+
activeProfile: platform2.modelProfile?.profile ?? opts.hostDefaults?.[host] ?? "balanced",
|
|
2470
|
+
bundleVersion: platform2.plugin?.version ?? null,
|
|
2471
|
+
availableProfiles: []
|
|
2472
|
+
};
|
|
2473
|
+
}
|
|
2474
|
+
const layout = resolveHostLayout(host, { targetHome, projectRoot: opts.projectRoot, marketplaceRoot: roots });
|
|
2008
2475
|
if (layout.route === "skip") {
|
|
2009
2476
|
return {
|
|
2010
2477
|
host,
|
|
@@ -2016,7 +2483,7 @@ function listProfiles(opts = {}) {
|
|
|
2016
2483
|
availableProfiles: []
|
|
2017
2484
|
};
|
|
2018
2485
|
}
|
|
2019
|
-
const installed =
|
|
2486
|
+
const installed = fs6.existsSync(layout.activeDir);
|
|
2020
2487
|
const availableProfiles = listVariantProfiles(layout);
|
|
2021
2488
|
const platform = state.platforms[host];
|
|
2022
2489
|
return {
|
|
@@ -2032,9 +2499,9 @@ function listProfiles(opts = {}) {
|
|
|
2032
2499
|
return { hosts };
|
|
2033
2500
|
}
|
|
2034
2501
|
function listVariantProfiles(layout) {
|
|
2035
|
-
if (!
|
|
2502
|
+
if (!fs6.existsSync(layout.variantsRoot))
|
|
2036
2503
|
return [];
|
|
2037
|
-
return
|
|
2504
|
+
return fs6.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
2038
2505
|
}
|
|
2039
2506
|
function matchesGlob(filename, glob) {
|
|
2040
2507
|
const starIdx = glob.indexOf("*");
|
|
@@ -2045,50 +2512,50 @@ function matchesGlob(filename, glob) {
|
|
|
2045
2512
|
return filename.length >= prefix.length + suffix.length && filename.startsWith(prefix) && filename.endsWith(suffix);
|
|
2046
2513
|
}
|
|
2047
2514
|
function assertStateWritable(stateFilePath) {
|
|
2048
|
-
const dir =
|
|
2515
|
+
const dir = path10.dirname(stateFilePath);
|
|
2049
2516
|
try {
|
|
2050
|
-
|
|
2517
|
+
fs6.mkdirSync(dir, { recursive: true });
|
|
2051
2518
|
} catch (err) {
|
|
2052
2519
|
throw UnwritableInstallStateError(stateFilePath, err.message);
|
|
2053
2520
|
}
|
|
2054
|
-
const checkPath =
|
|
2521
|
+
const checkPath = fs6.existsSync(stateFilePath) ? stateFilePath : dir;
|
|
2055
2522
|
try {
|
|
2056
|
-
|
|
2523
|
+
fs6.accessSync(checkPath, fs6.constants.W_OK);
|
|
2057
2524
|
} catch (err) {
|
|
2058
2525
|
throw UnwritableInstallStateError(stateFilePath, err.message);
|
|
2059
2526
|
}
|
|
2060
2527
|
}
|
|
2061
2528
|
function copyFileRouteVariant(layout, variantDir) {
|
|
2062
|
-
|
|
2529
|
+
fs6.mkdirSync(layout.activeDir, { recursive: true });
|
|
2063
2530
|
let changed = 0;
|
|
2064
|
-
for (const entry of
|
|
2531
|
+
for (const entry of fs6.readdirSync(variantDir, { withFileTypes: true })) {
|
|
2065
2532
|
if (!entry.isFile() || !matchesGlob(entry.name, layout.activeGlob))
|
|
2066
2533
|
continue;
|
|
2067
|
-
|
|
2534
|
+
fs6.copyFileSync(path10.join(variantDir, entry.name), path10.join(layout.activeDir, entry.name));
|
|
2068
2535
|
changed++;
|
|
2069
2536
|
}
|
|
2070
2537
|
return changed;
|
|
2071
2538
|
}
|
|
2072
2539
|
function repointOpencodeVariant(layout, variantDir) {
|
|
2073
|
-
|
|
2540
|
+
fs6.mkdirSync(layout.activeDir, { recursive: true });
|
|
2074
2541
|
let changed = 0;
|
|
2075
|
-
for (const entry of
|
|
2542
|
+
for (const entry of fs6.readdirSync(variantDir, { withFileTypes: true })) {
|
|
2076
2543
|
if (!entry.isFile() || !matchesGlob(entry.name, layout.activeGlob))
|
|
2077
2544
|
continue;
|
|
2078
|
-
const dest =
|
|
2079
|
-
const target =
|
|
2545
|
+
const dest = path10.join(layout.activeDir, entry.name);
|
|
2546
|
+
const target = path10.resolve(path10.join(variantDir, entry.name));
|
|
2080
2547
|
let destExists = true;
|
|
2081
2548
|
let destIsSymlink = false;
|
|
2082
2549
|
try {
|
|
2083
|
-
destIsSymlink =
|
|
2550
|
+
destIsSymlink = fs6.lstatSync(dest).isSymbolicLink();
|
|
2084
2551
|
} catch {
|
|
2085
2552
|
destExists = false;
|
|
2086
2553
|
}
|
|
2087
2554
|
if (destExists && !destIsSymlink)
|
|
2088
2555
|
continue;
|
|
2089
2556
|
const tmp = `${dest}.massa-ai-switch.${crypto4.randomUUID()}`;
|
|
2090
|
-
|
|
2091
|
-
|
|
2557
|
+
fs6.symlinkSync(target, tmp);
|
|
2558
|
+
fs6.renameSync(tmp, dest);
|
|
2092
2559
|
changed++;
|
|
2093
2560
|
}
|
|
2094
2561
|
return changed;
|
|
@@ -2104,19 +2571,37 @@ function switchProfile(opts) {
|
|
|
2104
2571
|
const state = readInstallState(stateFilePath);
|
|
2105
2572
|
if (!dryRun)
|
|
2106
2573
|
assertStateWritable(stateFilePath);
|
|
2107
|
-
const
|
|
2108
|
-
const
|
|
2574
|
+
const roots = marketplaceRoots(targetHome, state);
|
|
2575
|
+
const unresolvedRows = [];
|
|
2576
|
+
const resolvableUniverse = universe.filter((host) => {
|
|
2577
|
+
if (host !== "claude")
|
|
2578
|
+
return true;
|
|
2579
|
+
if (state.platforms.claude?.installRoute !== "marketplace")
|
|
2580
|
+
return true;
|
|
2581
|
+
if (roots.claude !== undefined)
|
|
2582
|
+
return true;
|
|
2583
|
+
unresolvedRows.push({ host, status: "failed", reason: claudeMarketplaceUnresolvedReason(targetHome) });
|
|
2584
|
+
return false;
|
|
2585
|
+
});
|
|
2586
|
+
const layouts = resolvableUniverse.map((host) => ({
|
|
2587
|
+
host,
|
|
2588
|
+
layout: resolveHostLayout(host, { targetHome, projectRoot: opts.projectRoot, marketplaceRoot: roots })
|
|
2589
|
+
}));
|
|
2590
|
+
const skipRows = [
|
|
2591
|
+
...unresolvedRows,
|
|
2592
|
+
...layouts.filter((l) => l.layout.route === "skip").map((l) => ({ host: l.host, status: "skipped", reason: l.layout.reason }))
|
|
2593
|
+
];
|
|
2109
2594
|
const fileHosts = layouts.filter((l) => l.layout.route === "files");
|
|
2110
2595
|
if (fileHosts.length === 0) {
|
|
2111
2596
|
return { profile: opts.profile, dryRun, hosts: orderRows(universe, skipRows), restartRequired: false };
|
|
2112
2597
|
}
|
|
2113
|
-
const installedFileHosts = fileHosts.filter((h) =>
|
|
2598
|
+
const installedFileHosts = fileHosts.filter((h) => fs6.existsSync(h.layout.activeDir));
|
|
2114
2599
|
if (installedFileHosts.length === 0)
|
|
2115
2600
|
throw NoHostsDetectedError();
|
|
2116
2601
|
const withAvailability = fileHosts.map((h) => {
|
|
2117
|
-
const variantsRootExists =
|
|
2602
|
+
const variantsRootExists = fs6.existsSync(h.layout.variantsRoot);
|
|
2118
2603
|
const variantDir = h.layout.variantDir(opts.profile);
|
|
2119
|
-
const available = variantsRootExists &&
|
|
2604
|
+
const available = variantsRootExists && fs6.existsSync(variantDir) && fs6.statSync(variantDir).isDirectory();
|
|
2120
2605
|
return { ...h, variantsRootExists, variantDir, available };
|
|
2121
2606
|
});
|
|
2122
2607
|
if (!withAvailability.some((h) => h.available)) {
|
|
@@ -2146,7 +2631,7 @@ function switchProfile(opts) {
|
|
|
2146
2631
|
});
|
|
2147
2632
|
continue;
|
|
2148
2633
|
}
|
|
2149
|
-
const route = detectRoute(state.platforms[h.host]);
|
|
2634
|
+
const route = detectRoute(state.platforms[h.host], h.host);
|
|
2150
2635
|
if (route.kind === "refuse") {
|
|
2151
2636
|
rows.push({ host: h.host, status: "failed", reason: route.reason });
|
|
2152
2637
|
continue;
|
|
@@ -2181,6 +2666,7 @@ var init_engine = __esm(() => {
|
|
|
2181
2666
|
init_hosts();
|
|
2182
2667
|
init_state();
|
|
2183
2668
|
init_lock();
|
|
2669
|
+
init_claude_marketplace();
|
|
2184
2670
|
SwitchEngineError = class SwitchEngineError extends Error {
|
|
2185
2671
|
constructor(message) {
|
|
2186
2672
|
super(message);
|
|
@@ -2195,18 +2681,25 @@ function reportSucceeded(report) {
|
|
|
2195
2681
|
}
|
|
2196
2682
|
|
|
2197
2683
|
// ../../packages/shared/dist/profile-switch/variant-sync.js
|
|
2198
|
-
import
|
|
2199
|
-
import
|
|
2684
|
+
import fs7 from "fs";
|
|
2685
|
+
import path11 from "path";
|
|
2686
|
+
import os7 from "os";
|
|
2200
2687
|
import crypto5 from "crypto";
|
|
2688
|
+
function defaultStatePath2(targetHome) {
|
|
2689
|
+
return path11.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
2690
|
+
}
|
|
2691
|
+
function marketplaceRoots2(targetHome, state) {
|
|
2692
|
+
return state.platforms.claude?.installRoute === "marketplace" ? { claude: resolveClaudeMarketplaceRoot({ targetHome }) ?? undefined } : {};
|
|
2693
|
+
}
|
|
2201
2694
|
function writeFileIntoDirAtomically(destDir, destName, content) {
|
|
2202
2695
|
const unique = `${process.pid}.${++tempFileCounter2}.${crypto5.randomBytes(6).toString("hex")}`;
|
|
2203
|
-
const tempFile =
|
|
2696
|
+
const tempFile = path11.join(destDir, `.${destName}.${unique}.tmp`);
|
|
2204
2697
|
try {
|
|
2205
|
-
|
|
2206
|
-
|
|
2698
|
+
fs7.writeFileSync(tempFile, content);
|
|
2699
|
+
fs7.renameSync(tempFile, path11.join(destDir, destName));
|
|
2207
2700
|
} catch (error) {
|
|
2208
2701
|
try {
|
|
2209
|
-
|
|
2702
|
+
fs7.unlinkSync(tempFile);
|
|
2210
2703
|
} catch {}
|
|
2211
2704
|
throw error;
|
|
2212
2705
|
}
|
|
@@ -2214,20 +2707,20 @@ function writeFileIntoDirAtomically(destDir, destName, content) {
|
|
|
2214
2707
|
function isSafeDirName(name) {
|
|
2215
2708
|
if (name === "." || name === "..")
|
|
2216
2709
|
return false;
|
|
2217
|
-
if (name.includes("/") || name.includes("\\") || name.includes(
|
|
2710
|
+
if (name.includes("/") || name.includes("\\") || name.includes(path11.sep))
|
|
2218
2711
|
return false;
|
|
2219
|
-
return
|
|
2712
|
+
return path11.basename(name) === name;
|
|
2220
2713
|
}
|
|
2221
|
-
function syncHost(host, sourceRoot, targetHome) {
|
|
2222
|
-
const layout = resolveHostLayout(host, { targetHome });
|
|
2714
|
+
function syncHost(host, sourceRoot, targetHome, marketplaceRoot) {
|
|
2715
|
+
const layout = resolveHostLayout(host, { targetHome, marketplaceRoot });
|
|
2223
2716
|
if (layout.route === "skip") {
|
|
2224
2717
|
return { host, status: "skipped", profiles: [], retained: [], files: 0, reason: layout.reason };
|
|
2225
2718
|
}
|
|
2226
|
-
const srcDir =
|
|
2227
|
-
if (!
|
|
2719
|
+
const srcDir = path11.join(sourceRoot, "apps", `${host}-plugin`, "agent-profiles");
|
|
2720
|
+
if (!fs7.existsSync(srcDir) || !fs7.statSync(srcDir).isDirectory()) {
|
|
2228
2721
|
return { host, status: "skipped", profiles: [], retained: [], files: 0, reason: "no generated variants for this host" };
|
|
2229
2722
|
}
|
|
2230
|
-
if (!
|
|
2723
|
+
if (!fs7.existsSync(layout.variantsRoot)) {
|
|
2231
2724
|
return {
|
|
2232
2725
|
host,
|
|
2233
2726
|
status: "skipped",
|
|
@@ -2239,24 +2732,24 @@ function syncHost(host, sourceRoot, targetHome) {
|
|
|
2239
2732
|
}
|
|
2240
2733
|
const profiles = [];
|
|
2241
2734
|
let files = 0;
|
|
2242
|
-
for (const entry of
|
|
2735
|
+
for (const entry of fs7.readdirSync(srcDir, { withFileTypes: true })) {
|
|
2243
2736
|
if (!entry.isDirectory())
|
|
2244
2737
|
continue;
|
|
2245
2738
|
if (!isSafeDirName(entry.name))
|
|
2246
2739
|
continue;
|
|
2247
|
-
const srcProfileDir =
|
|
2248
|
-
const destProfileDir =
|
|
2249
|
-
|
|
2250
|
-
for (const fileEntry of
|
|
2740
|
+
const srcProfileDir = path11.join(srcDir, entry.name);
|
|
2741
|
+
const destProfileDir = path11.join(layout.variantsRoot, entry.name);
|
|
2742
|
+
fs7.mkdirSync(destProfileDir, { recursive: true });
|
|
2743
|
+
for (const fileEntry of fs7.readdirSync(srcProfileDir, { withFileTypes: true })) {
|
|
2251
2744
|
if (!fileEntry.isFile())
|
|
2252
2745
|
continue;
|
|
2253
|
-
const content =
|
|
2746
|
+
const content = fs7.readFileSync(path11.join(srcProfileDir, fileEntry.name));
|
|
2254
2747
|
writeFileIntoDirAtomically(destProfileDir, fileEntry.name, content);
|
|
2255
2748
|
files++;
|
|
2256
2749
|
}
|
|
2257
2750
|
profiles.push(entry.name);
|
|
2258
2751
|
}
|
|
2259
|
-
const retained =
|
|
2752
|
+
const retained = fs7.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory() && !profiles.includes(e.name)).map((e) => e.name).sort();
|
|
2260
2753
|
return { host, status: "synced", profiles: profiles.sort(), retained, files };
|
|
2261
2754
|
}
|
|
2262
2755
|
function syncGeneratedVariants(opts) {
|
|
@@ -2272,9 +2765,12 @@ function syncGeneratedVariants(opts) {
|
|
|
2272
2765
|
}));
|
|
2273
2766
|
}
|
|
2274
2767
|
const sourceRoot = opts.sourceRoot;
|
|
2768
|
+
const targetHome = opts.targetHome ?? os7.homedir();
|
|
2769
|
+
const state = readInstallState(defaultStatePath2(targetHome));
|
|
2770
|
+
const roots = marketplaceRoots2(targetHome, state);
|
|
2275
2771
|
return hosts.map((host) => {
|
|
2276
2772
|
try {
|
|
2277
|
-
return syncHost(host, sourceRoot, opts.targetHome);
|
|
2773
|
+
return syncHost(host, sourceRoot, opts.targetHome, roots);
|
|
2278
2774
|
} catch (err) {
|
|
2279
2775
|
return { host, status: "failed", profiles: [], retained: [], files: 0, error: err.message };
|
|
2280
2776
|
}
|
|
@@ -2283,17 +2779,19 @@ function syncGeneratedVariants(opts) {
|
|
|
2283
2779
|
var tempFileCounter2 = 0;
|
|
2284
2780
|
var init_variant_sync = __esm(() => {
|
|
2285
2781
|
init_hosts();
|
|
2782
|
+
init_state();
|
|
2783
|
+
init_claude_marketplace();
|
|
2286
2784
|
});
|
|
2287
2785
|
|
|
2288
2786
|
// ../../packages/shared/dist/profile-switch/repo-root.js
|
|
2289
|
-
import
|
|
2290
|
-
import
|
|
2787
|
+
import fs8 from "fs";
|
|
2788
|
+
import path12 from "path";
|
|
2291
2789
|
function findRepoRootWithMarker(startDir, marker, maxLevels) {
|
|
2292
2790
|
let dir = startDir;
|
|
2293
2791
|
for (let i = 0;i <= maxLevels; i++) {
|
|
2294
|
-
if (
|
|
2792
|
+
if (fs8.existsSync(path12.join(dir, marker)))
|
|
2295
2793
|
return dir;
|
|
2296
|
-
const parent =
|
|
2794
|
+
const parent = path12.dirname(dir);
|
|
2297
2795
|
if (parent === dir)
|
|
2298
2796
|
break;
|
|
2299
2797
|
dir = parent;
|
|
@@ -3833,7 +4331,7 @@ var import_brace_expansion, minimatch = (p, pattern, options = {}) => {
|
|
|
3833
4331
|
}, qmarksTestNoExtDot = ([$0]) => {
|
|
3834
4332
|
const len = $0.length;
|
|
3835
4333
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
3836
|
-
}, defaultPlatform,
|
|
4334
|
+
}, defaultPlatform, path13, sep, GLOBSTAR, qmark2 = "[^/]", star2, twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?", filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options), ext = (a, b = {}) => Object.assign({}, a, b), defaults = (def) => {
|
|
3837
4335
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
3838
4336
|
return minimatch;
|
|
3839
4337
|
}
|
|
@@ -3891,11 +4389,11 @@ var init_esm = __esm(() => {
|
|
|
3891
4389
|
starRE = /^\*+$/;
|
|
3892
4390
|
qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
3893
4391
|
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
3894
|
-
|
|
4392
|
+
path13 = {
|
|
3895
4393
|
win32: { sep: "\\" },
|
|
3896
4394
|
posix: { sep: "/" }
|
|
3897
4395
|
};
|
|
3898
|
-
sep = defaultPlatform === "win32" ?
|
|
4396
|
+
sep = defaultPlatform === "win32" ? path13.win32.sep : path13.posix.sep;
|
|
3899
4397
|
minimatch.sep = sep;
|
|
3900
4398
|
GLOBSTAR = Symbol("globstar **");
|
|
3901
4399
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -5861,12 +6359,12 @@ var init_esm4 = __esm(() => {
|
|
|
5861
6359
|
childrenCache() {
|
|
5862
6360
|
return this.#children;
|
|
5863
6361
|
}
|
|
5864
|
-
resolve(
|
|
5865
|
-
if (!
|
|
6362
|
+
resolve(path14) {
|
|
6363
|
+
if (!path14) {
|
|
5866
6364
|
return this;
|
|
5867
6365
|
}
|
|
5868
|
-
const rootPath = this.getRootString(
|
|
5869
|
-
const dir =
|
|
6366
|
+
const rootPath = this.getRootString(path14);
|
|
6367
|
+
const dir = path14.substring(rootPath.length);
|
|
5870
6368
|
const dirParts = dir.split(this.splitSep);
|
|
5871
6369
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
5872
6370
|
return result;
|
|
@@ -6394,8 +6892,8 @@ var init_esm4 = __esm(() => {
|
|
|
6394
6892
|
newChild(name, type = UNKNOWN, opts = {}) {
|
|
6395
6893
|
return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
|
|
6396
6894
|
}
|
|
6397
|
-
getRootString(
|
|
6398
|
-
return win32.parse(
|
|
6895
|
+
getRootString(path14) {
|
|
6896
|
+
return win32.parse(path14).root;
|
|
6399
6897
|
}
|
|
6400
6898
|
getRoot(rootPath) {
|
|
6401
6899
|
rootPath = uncToDrive(rootPath.toUpperCase());
|
|
@@ -6420,8 +6918,8 @@ var init_esm4 = __esm(() => {
|
|
|
6420
6918
|
constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
|
|
6421
6919
|
super(name, type, root, roots, nocase, children, opts);
|
|
6422
6920
|
}
|
|
6423
|
-
getRootString(
|
|
6424
|
-
return
|
|
6921
|
+
getRootString(path14) {
|
|
6922
|
+
return path14.startsWith("/") ? "/" : "";
|
|
6425
6923
|
}
|
|
6426
6924
|
getRoot(_rootPath) {
|
|
6427
6925
|
return this.root;
|
|
@@ -6440,8 +6938,8 @@ var init_esm4 = __esm(() => {
|
|
|
6440
6938
|
#children;
|
|
6441
6939
|
nocase;
|
|
6442
6940
|
#fs;
|
|
6443
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
6444
|
-
this.#fs = fsFromOption(
|
|
6941
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs9 = defaultFS } = {}) {
|
|
6942
|
+
this.#fs = fsFromOption(fs9);
|
|
6445
6943
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
6446
6944
|
cwd = fileURLToPath(cwd);
|
|
6447
6945
|
}
|
|
@@ -6477,11 +6975,11 @@ var init_esm4 = __esm(() => {
|
|
|
6477
6975
|
}
|
|
6478
6976
|
this.cwd = prev;
|
|
6479
6977
|
}
|
|
6480
|
-
depth(
|
|
6481
|
-
if (typeof
|
|
6482
|
-
|
|
6978
|
+
depth(path14 = this.cwd) {
|
|
6979
|
+
if (typeof path14 === "string") {
|
|
6980
|
+
path14 = this.cwd.resolve(path14);
|
|
6483
6981
|
}
|
|
6484
|
-
return
|
|
6982
|
+
return path14.depth();
|
|
6485
6983
|
}
|
|
6486
6984
|
childrenCache() {
|
|
6487
6985
|
return this.#children;
|
|
@@ -6897,9 +7395,9 @@ var init_esm4 = __esm(() => {
|
|
|
6897
7395
|
process2();
|
|
6898
7396
|
return results;
|
|
6899
7397
|
}
|
|
6900
|
-
chdir(
|
|
7398
|
+
chdir(path14 = this.cwd) {
|
|
6901
7399
|
const oldCwd = this.cwd;
|
|
6902
|
-
this.cwd = typeof
|
|
7400
|
+
this.cwd = typeof path14 === "string" ? this.cwd.resolve(path14) : path14;
|
|
6903
7401
|
this.cwd[setAsCwd](oldCwd);
|
|
6904
7402
|
}
|
|
6905
7403
|
};
|
|
@@ -6916,8 +7414,8 @@ var init_esm4 = __esm(() => {
|
|
|
6916
7414
|
parseRootPath(dir) {
|
|
6917
7415
|
return win32.parse(dir).root.toUpperCase();
|
|
6918
7416
|
}
|
|
6919
|
-
newRoot(
|
|
6920
|
-
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
7417
|
+
newRoot(fs9) {
|
|
7418
|
+
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs9 });
|
|
6921
7419
|
}
|
|
6922
7420
|
isAbsolute(p) {
|
|
6923
7421
|
return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p);
|
|
@@ -6933,8 +7431,8 @@ var init_esm4 = __esm(() => {
|
|
|
6933
7431
|
parseRootPath(_dir) {
|
|
6934
7432
|
return "/";
|
|
6935
7433
|
}
|
|
6936
|
-
newRoot(
|
|
6937
|
-
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
7434
|
+
newRoot(fs9) {
|
|
7435
|
+
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs9 });
|
|
6938
7436
|
}
|
|
6939
7437
|
isAbsolute(p) {
|
|
6940
7438
|
return p.startsWith("/");
|
|
@@ -7191,8 +7689,8 @@ class MatchRecord {
|
|
|
7191
7689
|
this.store.set(target, current === undefined ? n : n & current);
|
|
7192
7690
|
}
|
|
7193
7691
|
entries() {
|
|
7194
|
-
return [...this.store.entries()].map(([
|
|
7195
|
-
|
|
7692
|
+
return [...this.store.entries()].map(([path14, n]) => [
|
|
7693
|
+
path14,
|
|
7196
7694
|
!!(n & 2),
|
|
7197
7695
|
!!(n & 1)
|
|
7198
7696
|
]);
|
|
@@ -7396,9 +7894,9 @@ class GlobUtil {
|
|
|
7396
7894
|
signal;
|
|
7397
7895
|
maxDepth;
|
|
7398
7896
|
includeChildMatches;
|
|
7399
|
-
constructor(patterns,
|
|
7897
|
+
constructor(patterns, path14, opts) {
|
|
7400
7898
|
this.patterns = patterns;
|
|
7401
|
-
this.path =
|
|
7899
|
+
this.path = path14;
|
|
7402
7900
|
this.opts = opts;
|
|
7403
7901
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
7404
7902
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -7417,11 +7915,11 @@ class GlobUtil {
|
|
|
7417
7915
|
});
|
|
7418
7916
|
}
|
|
7419
7917
|
}
|
|
7420
|
-
#ignored(
|
|
7421
|
-
return this.seen.has(
|
|
7918
|
+
#ignored(path14) {
|
|
7919
|
+
return this.seen.has(path14) || !!this.#ignore?.ignored?.(path14);
|
|
7422
7920
|
}
|
|
7423
|
-
#childrenIgnored(
|
|
7424
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
7921
|
+
#childrenIgnored(path14) {
|
|
7922
|
+
return !!this.#ignore?.childrenIgnored?.(path14);
|
|
7425
7923
|
}
|
|
7426
7924
|
pause() {
|
|
7427
7925
|
this.paused = true;
|
|
@@ -7638,8 +8136,8 @@ var init_walker = __esm(() => {
|
|
|
7638
8136
|
init_processor();
|
|
7639
8137
|
GlobWalker = class GlobWalker extends GlobUtil {
|
|
7640
8138
|
matches = new Set;
|
|
7641
|
-
constructor(patterns,
|
|
7642
|
-
super(patterns,
|
|
8139
|
+
constructor(patterns, path14, opts) {
|
|
8140
|
+
super(patterns, path14, opts);
|
|
7643
8141
|
}
|
|
7644
8142
|
matchEmit(e) {
|
|
7645
8143
|
this.matches.add(e);
|
|
@@ -7676,8 +8174,8 @@ var init_walker = __esm(() => {
|
|
|
7676
8174
|
};
|
|
7677
8175
|
GlobStream = class GlobStream extends GlobUtil {
|
|
7678
8176
|
results;
|
|
7679
|
-
constructor(patterns,
|
|
7680
|
-
super(patterns,
|
|
8177
|
+
constructor(patterns, path14, opts) {
|
|
8178
|
+
super(patterns, path14, opts);
|
|
7681
8179
|
this.results = new Minipass({
|
|
7682
8180
|
signal: this.signal,
|
|
7683
8181
|
objectMode: true
|
|
@@ -8105,20 +8603,20 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
8105
8603
|
var throwError = (message, Ctor) => {
|
|
8106
8604
|
throw new Ctor(message);
|
|
8107
8605
|
};
|
|
8108
|
-
var checkPath = (
|
|
8109
|
-
if (!isString(
|
|
8606
|
+
var checkPath = (path14, originalPath, doThrow) => {
|
|
8607
|
+
if (!isString(path14)) {
|
|
8110
8608
|
return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
8111
8609
|
}
|
|
8112
|
-
if (!
|
|
8610
|
+
if (!path14) {
|
|
8113
8611
|
return doThrow(`path must not be empty`, TypeError);
|
|
8114
8612
|
}
|
|
8115
|
-
if (checkPath.isNotRelative(
|
|
8613
|
+
if (checkPath.isNotRelative(path14)) {
|
|
8116
8614
|
const r = "`path.relative()`d";
|
|
8117
8615
|
return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
|
|
8118
8616
|
}
|
|
8119
8617
|
return true;
|
|
8120
8618
|
};
|
|
8121
|
-
var isNotRelative = (
|
|
8619
|
+
var isNotRelative = (path14) => REGEX_TEST_INVALID_PATH.test(path14);
|
|
8122
8620
|
checkPath.isNotRelative = isNotRelative;
|
|
8123
8621
|
checkPath.convert = (p) => p;
|
|
8124
8622
|
|
|
@@ -8161,7 +8659,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
8161
8659
|
addPattern(pattern) {
|
|
8162
8660
|
return this.add(pattern);
|
|
8163
8661
|
}
|
|
8164
|
-
_testOne(
|
|
8662
|
+
_testOne(path14, checkUnignored) {
|
|
8165
8663
|
let ignored = false;
|
|
8166
8664
|
let unignored = false;
|
|
8167
8665
|
this._rules.forEach((rule) => {
|
|
@@ -8169,7 +8667,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
8169
8667
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
8170
8668
|
return;
|
|
8171
8669
|
}
|
|
8172
|
-
const matched = rule.regex.test(
|
|
8670
|
+
const matched = rule.regex.test(path14);
|
|
8173
8671
|
if (matched) {
|
|
8174
8672
|
ignored = !negative;
|
|
8175
8673
|
unignored = negative;
|
|
@@ -8181,39 +8679,39 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
8181
8679
|
};
|
|
8182
8680
|
}
|
|
8183
8681
|
_test(originalPath, cache, checkUnignored, slices) {
|
|
8184
|
-
const
|
|
8185
|
-
checkPath(
|
|
8186
|
-
return this._t(
|
|
8682
|
+
const path14 = originalPath && checkPath.convert(originalPath);
|
|
8683
|
+
checkPath(path14, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
|
8684
|
+
return this._t(path14, cache, checkUnignored, slices);
|
|
8187
8685
|
}
|
|
8188
|
-
_t(
|
|
8189
|
-
if (
|
|
8190
|
-
return cache[
|
|
8686
|
+
_t(path14, cache, checkUnignored, slices) {
|
|
8687
|
+
if (path14 in cache) {
|
|
8688
|
+
return cache[path14];
|
|
8191
8689
|
}
|
|
8192
8690
|
if (!slices) {
|
|
8193
|
-
slices =
|
|
8691
|
+
slices = path14.split(SLASH);
|
|
8194
8692
|
}
|
|
8195
8693
|
slices.pop();
|
|
8196
8694
|
if (!slices.length) {
|
|
8197
|
-
return cache[
|
|
8695
|
+
return cache[path14] = this._testOne(path14, checkUnignored);
|
|
8198
8696
|
}
|
|
8199
8697
|
const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
|
|
8200
|
-
return cache[
|
|
8698
|
+
return cache[path14] = parent.ignored ? parent : this._testOne(path14, checkUnignored);
|
|
8201
8699
|
}
|
|
8202
|
-
ignores(
|
|
8203
|
-
return this._test(
|
|
8700
|
+
ignores(path14) {
|
|
8701
|
+
return this._test(path14, this._ignoreCache, false).ignored;
|
|
8204
8702
|
}
|
|
8205
8703
|
createFilter() {
|
|
8206
|
-
return (
|
|
8704
|
+
return (path14) => !this.ignores(path14);
|
|
8207
8705
|
}
|
|
8208
8706
|
filter(paths) {
|
|
8209
8707
|
return makeArray(paths).filter(this.createFilter());
|
|
8210
8708
|
}
|
|
8211
|
-
test(
|
|
8212
|
-
return this._test(
|
|
8709
|
+
test(path14) {
|
|
8710
|
+
return this._test(path14, this._testCache, true);
|
|
8213
8711
|
}
|
|
8214
8712
|
}
|
|
8215
8713
|
var factory = (options) => new Ignore2(options);
|
|
8216
|
-
var isPathValid = (
|
|
8714
|
+
var isPathValid = (path14) => checkPath(path14 && checkPath.convert(path14), path14, RETURN_FALSE);
|
|
8217
8715
|
factory.isPathValid = isPathValid;
|
|
8218
8716
|
factory.default = factory;
|
|
8219
8717
|
module.exports = factory;
|
|
@@ -8221,7 +8719,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
8221
8719
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
8222
8720
|
checkPath.convert = makePosix;
|
|
8223
8721
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
8224
|
-
checkPath.isNotRelative = (
|
|
8722
|
+
checkPath.isNotRelative = (path14) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path14) || isNotRelative(path14);
|
|
8225
8723
|
}
|
|
8226
8724
|
});
|
|
8227
8725
|
|
|
@@ -8273,7 +8771,7 @@ function validatePolicy(policy, opts = {}) {
|
|
|
8273
8771
|
if (!Array.isArray(p.rules))
|
|
8274
8772
|
throw new TypeError("policy.rules must be an array");
|
|
8275
8773
|
const dropCount = p.rules.filter((r) => r?.disposition === "Drop").length;
|
|
8276
|
-
const maxIgnore = typeof p.maxIgnorePatterns === "number" ? p.maxIgnorePatterns :
|
|
8774
|
+
const maxIgnore = typeof p.maxIgnorePatterns === "number" ? p.maxIgnorePatterns : MAX_IGNORE_PATTERNS;
|
|
8277
8775
|
if (dropCount > maxIgnore) {
|
|
8278
8776
|
throw new TypeError(`policy: ${dropCount} Drop rules exceed maxIgnorePatterns=${maxIgnore}`);
|
|
8279
8777
|
}
|
|
@@ -8283,15 +8781,15 @@ function validatePolicy(policy, opts = {}) {
|
|
|
8283
8781
|
}
|
|
8284
8782
|
}
|
|
8285
8783
|
}
|
|
8286
|
-
function matchesGlob2(
|
|
8784
|
+
function matchesGlob2(path14, pattern) {
|
|
8287
8785
|
let re = regexCache.get(pattern);
|
|
8288
8786
|
if (!re) {
|
|
8289
8787
|
re = globToRegex(pattern);
|
|
8290
8788
|
regexCache.set(pattern, re);
|
|
8291
8789
|
}
|
|
8292
|
-
return re.test(
|
|
8790
|
+
return re.test(path14);
|
|
8293
8791
|
}
|
|
8294
|
-
var
|
|
8792
|
+
var DEFAULT_POLICY, applyPolicy = (filePath, policy) => {
|
|
8295
8793
|
const normalized = filePath.trim();
|
|
8296
8794
|
for (const rule of policy.rules) {
|
|
8297
8795
|
if (matchesGlob2(normalized, rule.pattern))
|
|
@@ -8300,48 +8798,14 @@ var MAX_MATCH_WORK = 1e5, MAX_IGNORE_PATTERNS2 = 1024, DEFAULT_POLICY, applyPoli
|
|
|
8300
8798
|
return "Keep";
|
|
8301
8799
|
}, regexCache;
|
|
8302
8800
|
var init_capture_policy = __esm(() => {
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
{ pattern: "**/node_modules/**", disposition: "Drop" },
|
|
8306
|
-
{ pattern: "**/.git/**", disposition: "Drop" },
|
|
8307
|
-
{ pattern: "**/dist/**", disposition: "Drop" },
|
|
8308
|
-
{ pattern: "**/build/**", disposition: "Drop" },
|
|
8309
|
-
{ pattern: "**/coverage/**", disposition: "Drop" },
|
|
8310
|
-
{ pattern: ".env", disposition: "Drop" },
|
|
8311
|
-
{ pattern: ".env.*", disposition: "Drop" },
|
|
8312
|
-
{ pattern: "**/generated/**", disposition: "Drop" },
|
|
8313
|
-
{ pattern: "**/*.generated.*", disposition: "Drop" },
|
|
8314
|
-
{ pattern: "**/*.d.ts", disposition: "Drop" },
|
|
8315
|
-
{ pattern: "**/__tests__/**", disposition: "Drop" },
|
|
8316
|
-
{ pattern: "**/tests/**", disposition: "Drop" },
|
|
8317
|
-
{ pattern: "**/*.test.ts", disposition: "Drop" },
|
|
8318
|
-
{ pattern: "**/*.test.tsx", disposition: "Drop" },
|
|
8319
|
-
{ pattern: "**/*.test.js", disposition: "Drop" },
|
|
8320
|
-
{ pattern: "**/*.test.jsx", disposition: "Drop" },
|
|
8321
|
-
{ pattern: "**/*.spec.ts", disposition: "Drop" },
|
|
8322
|
-
{ pattern: "**/*.spec.tsx", disposition: "Drop" },
|
|
8323
|
-
{ pattern: "**/*.spec.js", disposition: "Drop" },
|
|
8324
|
-
{ pattern: "**/*.spec.jsx", disposition: "Drop" },
|
|
8325
|
-
{ pattern: "**/benchmarks/**", disposition: "Drop" },
|
|
8326
|
-
{ pattern: "**/fixtures/**", disposition: "Drop" },
|
|
8327
|
-
{ pattern: "**/*.wasm*", disposition: "Drop" },
|
|
8328
|
-
{ pattern: "**/*.min.*", disposition: "Drop" },
|
|
8329
|
-
{ pattern: "**/*.map", disposition: "Drop" },
|
|
8330
|
-
{ pattern: "**/lock.yaml", disposition: "Drop" },
|
|
8331
|
-
{ pattern: "**/pnpm-lock.yaml", disposition: "Drop" },
|
|
8332
|
-
{ pattern: "**/package-lock.json", disposition: "Drop" },
|
|
8333
|
-
{ pattern: "**/bun.lockb", disposition: "Drop" },
|
|
8334
|
-
{ pattern: "**/yarn.lock", disposition: "Drop" }
|
|
8335
|
-
],
|
|
8336
|
-
maxMatchWork: MAX_MATCH_WORK,
|
|
8337
|
-
maxIgnorePatterns: MAX_IGNORE_PATTERNS2
|
|
8338
|
-
};
|
|
8801
|
+
init_dist();
|
|
8802
|
+
DEFAULT_POLICY = DEFAULT_CAPTURE_POLICY;
|
|
8339
8803
|
regexCache = new Map;
|
|
8340
8804
|
});
|
|
8341
8805
|
|
|
8342
8806
|
// ../../packages/core/dist/services/search/ignore-patterns.js
|
|
8343
|
-
import
|
|
8344
|
-
import
|
|
8807
|
+
import fs9 from "fs/promises";
|
|
8808
|
+
import path14 from "path";
|
|
8345
8809
|
function buildExtensionGlob(extensions) {
|
|
8346
8810
|
return extensions.map((ext2) => `**/*${ext2}`);
|
|
8347
8811
|
}
|
|
@@ -8364,8 +8828,8 @@ async function loadProjectIgnore(projectPath) {
|
|
|
8364
8828
|
const ig = ignore();
|
|
8365
8829
|
ig.add(DEFAULT_IGNORES);
|
|
8366
8830
|
try {
|
|
8367
|
-
const gitignorePath =
|
|
8368
|
-
const gitignoreContent = await
|
|
8831
|
+
const gitignorePath = path14.join(projectPath, ".gitignore");
|
|
8832
|
+
const gitignoreContent = await fs9.readFile(gitignorePath, "utf8");
|
|
8369
8833
|
const rules = gitignoreContent.split(`
|
|
8370
8834
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
8371
8835
|
ig.add(rules);
|
|
@@ -9961,15 +10425,15 @@ var require_pg_connection_string = __commonJS((exports, module) => {
|
|
|
9961
10425
|
if (config2.sslnegotiation === "direct" && config2.ssl === undefined) {
|
|
9962
10426
|
config2.ssl = true;
|
|
9963
10427
|
}
|
|
9964
|
-
const
|
|
10428
|
+
const fs10 = config2.sslcert || config2.sslkey || config2.sslrootcert ? __require("fs") : null;
|
|
9965
10429
|
if (config2.sslcert) {
|
|
9966
|
-
config2.ssl.cert =
|
|
10430
|
+
config2.ssl.cert = fs10.readFileSync(config2.sslcert).toString();
|
|
9967
10431
|
}
|
|
9968
10432
|
if (config2.sslkey) {
|
|
9969
|
-
config2.ssl.key =
|
|
10433
|
+
config2.ssl.key = fs10.readFileSync(config2.sslkey).toString();
|
|
9970
10434
|
}
|
|
9971
10435
|
if (config2.sslrootcert) {
|
|
9972
|
-
config2.ssl.ca =
|
|
10436
|
+
config2.ssl.ca = fs10.readFileSync(config2.sslrootcert).toString();
|
|
9973
10437
|
}
|
|
9974
10438
|
if (options.useLibpqCompat && config2.uselibpqcompat) {
|
|
9975
10439
|
throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
|
|
@@ -11683,7 +12147,7 @@ var require_split2 = __commonJS((exports, module) => {
|
|
|
11683
12147
|
|
|
11684
12148
|
// ../../node_modules/pgpass/lib/helper.js
|
|
11685
12149
|
var require_helper = __commonJS((exports, module) => {
|
|
11686
|
-
var
|
|
12150
|
+
var path15 = __require("path");
|
|
11687
12151
|
var Stream2 = __require("stream").Stream;
|
|
11688
12152
|
var split = require_split2();
|
|
11689
12153
|
var util = __require("util");
|
|
@@ -11723,7 +12187,7 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
11723
12187
|
};
|
|
11724
12188
|
exports.getFileName = function(rawEnv) {
|
|
11725
12189
|
var env = rawEnv || process.env;
|
|
11726
|
-
var file = env.PGPASSFILE || (isWin ?
|
|
12190
|
+
var file = env.PGPASSFILE || (isWin ? path15.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path15.join(env.HOME || "./", ".pgpass"));
|
|
11727
12191
|
return file;
|
|
11728
12192
|
};
|
|
11729
12193
|
exports.usePgPass = function(stats, fname) {
|
|
@@ -11847,16 +12311,16 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
11847
12311
|
|
|
11848
12312
|
// ../../node_modules/pgpass/lib/index.js
|
|
11849
12313
|
var require_lib = __commonJS((exports, module) => {
|
|
11850
|
-
var
|
|
11851
|
-
var
|
|
12314
|
+
var path15 = __require("path");
|
|
12315
|
+
var fs10 = __require("fs");
|
|
11852
12316
|
var helper = require_helper();
|
|
11853
12317
|
module.exports = function(connInfo, cb) {
|
|
11854
12318
|
var file = helper.getFileName();
|
|
11855
|
-
|
|
12319
|
+
fs10.stat(file, function(err, stat) {
|
|
11856
12320
|
if (err || !helper.usePgPass(stat, file)) {
|
|
11857
12321
|
return cb(undefined);
|
|
11858
12322
|
}
|
|
11859
|
-
var st =
|
|
12323
|
+
var st = fs10.createReadStream(file);
|
|
11860
12324
|
helper.getPassword(connInfo, st, cb);
|
|
11861
12325
|
});
|
|
11862
12326
|
};
|
|
@@ -13555,8 +14019,8 @@ var init_alias_resolver = __esm(() => {
|
|
|
13555
14019
|
});
|
|
13556
14020
|
|
|
13557
14021
|
// ../../packages/core/dist/services/search/index-manager.js
|
|
13558
|
-
import
|
|
13559
|
-
import
|
|
14022
|
+
import fs10 from "fs";
|
|
14023
|
+
import path15 from "path";
|
|
13560
14024
|
|
|
13561
14025
|
class IndexManager {
|
|
13562
14026
|
metadataCache = new Map;
|
|
@@ -13649,9 +14113,9 @@ class IndexManager {
|
|
|
13649
14113
|
const fileMetadata = {};
|
|
13650
14114
|
let totalSize = 0;
|
|
13651
14115
|
for (const filePath of indexedFiles) {
|
|
13652
|
-
const fullPath =
|
|
14116
|
+
const fullPath = path15.join(projectPath, filePath);
|
|
13653
14117
|
try {
|
|
13654
|
-
const stat = await
|
|
14118
|
+
const stat = await fs10.promises.stat(fullPath);
|
|
13655
14119
|
fileMetadata[filePath] = {
|
|
13656
14120
|
path: filePath,
|
|
13657
14121
|
mtime: stat.mtimeMs,
|
|
@@ -13702,9 +14166,9 @@ class IndexManager {
|
|
|
13702
14166
|
if (ig.ignores(match2)) {
|
|
13703
14167
|
continue;
|
|
13704
14168
|
}
|
|
13705
|
-
const fullPath =
|
|
14169
|
+
const fullPath = path15.join(projectPath, match2);
|
|
13706
14170
|
try {
|
|
13707
|
-
const stat = await
|
|
14171
|
+
const stat = await fs10.promises.stat(fullPath);
|
|
13708
14172
|
files.set(match2, {
|
|
13709
14173
|
path: match2,
|
|
13710
14174
|
mtime: stat.mtimeMs,
|
|
@@ -14155,10 +14619,10 @@ function mergeDefs(...defs) {
|
|
|
14155
14619
|
function cloneDef(schema) {
|
|
14156
14620
|
return mergeDefs(schema._zod.def);
|
|
14157
14621
|
}
|
|
14158
|
-
function getElementAtPath(obj,
|
|
14159
|
-
if (!
|
|
14622
|
+
function getElementAtPath(obj, path16) {
|
|
14623
|
+
if (!path16)
|
|
14160
14624
|
return obj;
|
|
14161
|
-
return
|
|
14625
|
+
return path16.reduce((acc, key) => acc?.[key], obj);
|
|
14162
14626
|
}
|
|
14163
14627
|
function promiseAllObject(promisesObj) {
|
|
14164
14628
|
const keys = Object.keys(promisesObj);
|
|
@@ -14486,11 +14950,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
14486
14950
|
}
|
|
14487
14951
|
return false;
|
|
14488
14952
|
}
|
|
14489
|
-
function prefixIssues(
|
|
14953
|
+
function prefixIssues(path16, issues) {
|
|
14490
14954
|
return issues.map((iss) => {
|
|
14491
14955
|
var _a3;
|
|
14492
14956
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
14493
|
-
iss.path.unshift(
|
|
14957
|
+
iss.path.unshift(path16);
|
|
14494
14958
|
return iss;
|
|
14495
14959
|
});
|
|
14496
14960
|
}
|
|
@@ -14703,16 +15167,16 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
|
14703
15167
|
}
|
|
14704
15168
|
function formatError(error, mapper = (issue2) => issue2.message) {
|
|
14705
15169
|
const fieldErrors = { _errors: [] };
|
|
14706
|
-
const processError = (error2,
|
|
15170
|
+
const processError = (error2, path16 = []) => {
|
|
14707
15171
|
for (const issue2 of error2.issues) {
|
|
14708
15172
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
14709
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
15173
|
+
issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
|
|
14710
15174
|
} else if (issue2.code === "invalid_key") {
|
|
14711
|
-
processError({ issues: issue2.issues }, [...
|
|
15175
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
14712
15176
|
} else if (issue2.code === "invalid_element") {
|
|
14713
|
-
processError({ issues: issue2.issues }, [...
|
|
15177
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
14714
15178
|
} else {
|
|
14715
|
-
const fullpath = [...
|
|
15179
|
+
const fullpath = [...path16, ...issue2.path];
|
|
14716
15180
|
if (fullpath.length === 0) {
|
|
14717
15181
|
fieldErrors._errors.push(mapper(issue2));
|
|
14718
15182
|
} else {
|
|
@@ -14739,17 +15203,17 @@ function formatError(error, mapper = (issue2) => issue2.message) {
|
|
|
14739
15203
|
}
|
|
14740
15204
|
function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
14741
15205
|
const result = { errors: [] };
|
|
14742
|
-
const processError = (error2,
|
|
15206
|
+
const processError = (error2, path16 = []) => {
|
|
14743
15207
|
var _a3, _b;
|
|
14744
15208
|
for (const issue2 of error2.issues) {
|
|
14745
15209
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
14746
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
15210
|
+
issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
|
|
14747
15211
|
} else if (issue2.code === "invalid_key") {
|
|
14748
|
-
processError({ issues: issue2.issues }, [...
|
|
15212
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
14749
15213
|
} else if (issue2.code === "invalid_element") {
|
|
14750
|
-
processError({ issues: issue2.issues }, [...
|
|
15214
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
14751
15215
|
} else {
|
|
14752
|
-
const fullpath = [...
|
|
15216
|
+
const fullpath = [...path16, ...issue2.path];
|
|
14753
15217
|
if (fullpath.length === 0) {
|
|
14754
15218
|
result.errors.push(mapper(issue2));
|
|
14755
15219
|
continue;
|
|
@@ -14781,8 +15245,8 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
|
14781
15245
|
}
|
|
14782
15246
|
function toDotPath(_path) {
|
|
14783
15247
|
const segs = [];
|
|
14784
|
-
const
|
|
14785
|
-
for (const seg of
|
|
15248
|
+
const path16 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
15249
|
+
for (const seg of path16) {
|
|
14786
15250
|
if (typeof seg === "number")
|
|
14787
15251
|
segs.push(`[${seg}]`);
|
|
14788
15252
|
else if (typeof seg === "symbol")
|
|
@@ -27785,13 +28249,13 @@ function resolveRef(ref, ctx) {
|
|
|
27785
28249
|
if (!ref.startsWith("#")) {
|
|
27786
28250
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
27787
28251
|
}
|
|
27788
|
-
const
|
|
27789
|
-
if (
|
|
28252
|
+
const path16 = ref.slice(1).split("/").filter(Boolean);
|
|
28253
|
+
if (path16.length === 0) {
|
|
27790
28254
|
return ctx.rootSchema;
|
|
27791
28255
|
}
|
|
27792
28256
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
27793
|
-
if (
|
|
27794
|
-
const key =
|
|
28257
|
+
if (path16[0] === defsKey) {
|
|
28258
|
+
const key = path16[1];
|
|
27795
28259
|
if (!key || !ctx.defs[key]) {
|
|
27796
28260
|
throw new Error(`Reference not found: ${ref}`);
|
|
27797
28261
|
}
|
|
@@ -29280,8 +29744,8 @@ class ParseStatus {
|
|
|
29280
29744
|
}
|
|
29281
29745
|
}
|
|
29282
29746
|
var makeIssue = (params) => {
|
|
29283
|
-
const { data, path:
|
|
29284
|
-
const fullPath = [...
|
|
29747
|
+
const { data, path: path16, errorMaps, issueData } = params;
|
|
29748
|
+
const fullPath = [...path16, ...issueData.path || []];
|
|
29285
29749
|
const fullIssue = {
|
|
29286
29750
|
...issueData,
|
|
29287
29751
|
path: fullPath
|
|
@@ -29326,11 +29790,11 @@ var init_errorUtil = __esm(() => {
|
|
|
29326
29790
|
|
|
29327
29791
|
// ../../node_modules/zod/v3/types.js
|
|
29328
29792
|
class ParseInputLazyPath {
|
|
29329
|
-
constructor(parent, value,
|
|
29793
|
+
constructor(parent, value, path16, key) {
|
|
29330
29794
|
this._cachedPath = [];
|
|
29331
29795
|
this.parent = parent;
|
|
29332
29796
|
this.data = value;
|
|
29333
|
-
this._path =
|
|
29797
|
+
this._path = path16;
|
|
29334
29798
|
this._key = key;
|
|
29335
29799
|
}
|
|
29336
29800
|
get path() {
|
|
@@ -35327,19 +35791,19 @@ var require_token_io = __commonJS((exports, module) => {
|
|
|
35327
35791
|
getUserDataDir: () => getUserDataDir
|
|
35328
35792
|
});
|
|
35329
35793
|
module.exports = __toCommonJS2(token_io_exports);
|
|
35330
|
-
var
|
|
35331
|
-
var
|
|
35794
|
+
var import_path9 = __toESM2(__require("path"));
|
|
35795
|
+
var import_fs6 = __toESM2(__require("fs"));
|
|
35332
35796
|
var import_os3 = __toESM2(__require("os"));
|
|
35333
35797
|
var import_token_error = require_token_error();
|
|
35334
35798
|
function findRootDir() {
|
|
35335
35799
|
try {
|
|
35336
35800
|
let dir = process.cwd();
|
|
35337
|
-
while (dir !==
|
|
35338
|
-
const pkgPath =
|
|
35339
|
-
if (
|
|
35801
|
+
while (dir !== import_path9.default.dirname(dir)) {
|
|
35802
|
+
const pkgPath = import_path9.default.join(dir, ".vercel");
|
|
35803
|
+
if (import_fs6.default.existsSync(pkgPath)) {
|
|
35340
35804
|
return dir;
|
|
35341
35805
|
}
|
|
35342
|
-
dir =
|
|
35806
|
+
dir = import_path9.default.dirname(dir);
|
|
35343
35807
|
}
|
|
35344
35808
|
} catch (e) {
|
|
35345
35809
|
throw new import_token_error.VercelOidcTokenError("Token refresh only supported in node server environments");
|
|
@@ -35352,9 +35816,9 @@ var require_token_io = __commonJS((exports, module) => {
|
|
|
35352
35816
|
}
|
|
35353
35817
|
switch (import_os3.default.platform()) {
|
|
35354
35818
|
case "darwin":
|
|
35355
|
-
return
|
|
35819
|
+
return import_path9.default.join(import_os3.default.homedir(), "Library/Application Support");
|
|
35356
35820
|
case "linux":
|
|
35357
|
-
return
|
|
35821
|
+
return import_path9.default.join(import_os3.default.homedir(), ".local/share");
|
|
35358
35822
|
case "win32":
|
|
35359
35823
|
if (process.env.LOCALAPPDATA) {
|
|
35360
35824
|
return process.env.LOCALAPPDATA;
|
|
@@ -35395,23 +35859,23 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
35395
35859
|
writeAuthConfig: () => writeAuthConfig
|
|
35396
35860
|
});
|
|
35397
35861
|
module.exports = __toCommonJS2(auth_config_exports);
|
|
35398
|
-
var
|
|
35399
|
-
var
|
|
35862
|
+
var fs11 = __toESM2(__require("fs"));
|
|
35863
|
+
var path16 = __toESM2(__require("path"));
|
|
35400
35864
|
var import_token_util = require_token_util();
|
|
35401
35865
|
function getAuthConfigPath() {
|
|
35402
35866
|
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
35403
35867
|
if (!dataDir) {
|
|
35404
35868
|
throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
|
|
35405
35869
|
}
|
|
35406
|
-
return
|
|
35870
|
+
return path16.join(dataDir, "auth.json");
|
|
35407
35871
|
}
|
|
35408
35872
|
function readAuthConfig() {
|
|
35409
35873
|
try {
|
|
35410
35874
|
const authPath = getAuthConfigPath();
|
|
35411
|
-
if (!
|
|
35875
|
+
if (!fs11.existsSync(authPath)) {
|
|
35412
35876
|
return null;
|
|
35413
35877
|
}
|
|
35414
|
-
const content =
|
|
35878
|
+
const content = fs11.readFileSync(authPath, "utf8");
|
|
35415
35879
|
if (!content) {
|
|
35416
35880
|
return null;
|
|
35417
35881
|
}
|
|
@@ -35422,11 +35886,11 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
35422
35886
|
}
|
|
35423
35887
|
function writeAuthConfig(config3) {
|
|
35424
35888
|
const authPath = getAuthConfigPath();
|
|
35425
|
-
const authDir =
|
|
35426
|
-
if (!
|
|
35427
|
-
|
|
35889
|
+
const authDir = path16.dirname(authPath);
|
|
35890
|
+
if (!fs11.existsSync(authDir)) {
|
|
35891
|
+
fs11.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
35428
35892
|
}
|
|
35429
|
-
|
|
35893
|
+
fs11.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
|
|
35430
35894
|
}
|
|
35431
35895
|
function isValidAccessToken(authConfig, expirationBufferMs = 0) {
|
|
35432
35896
|
if (!authConfig.token)
|
|
@@ -35601,8 +36065,8 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
35601
36065
|
saveToken: () => saveToken
|
|
35602
36066
|
});
|
|
35603
36067
|
module.exports = __toCommonJS2(token_util_exports);
|
|
35604
|
-
var
|
|
35605
|
-
var
|
|
36068
|
+
var path16 = __toESM2(__require("path"));
|
|
36069
|
+
var fs11 = __toESM2(__require("fs"));
|
|
35606
36070
|
var import_token_error = require_token_error();
|
|
35607
36071
|
var import_token_io = require_token_io();
|
|
35608
36072
|
var import_auth_config = require_auth_config();
|
|
@@ -35614,7 +36078,7 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
35614
36078
|
if (!dataDir) {
|
|
35615
36079
|
return null;
|
|
35616
36080
|
}
|
|
35617
|
-
return
|
|
36081
|
+
return path16.join(dataDir, vercelFolder);
|
|
35618
36082
|
}
|
|
35619
36083
|
async function getVercelToken2(options) {
|
|
35620
36084
|
const authConfig = (0, import_auth_config.readAuthConfig)();
|
|
@@ -35682,11 +36146,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
35682
36146
|
if (!dir) {
|
|
35683
36147
|
throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
|
|
35684
36148
|
}
|
|
35685
|
-
const prjPath =
|
|
35686
|
-
if (!
|
|
36149
|
+
const prjPath = path16.join(dir, ".vercel", "project.json");
|
|
36150
|
+
if (!fs11.existsSync(prjPath)) {
|
|
35687
36151
|
throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
|
|
35688
36152
|
}
|
|
35689
|
-
const prj = JSON.parse(
|
|
36153
|
+
const prj = JSON.parse(fs11.readFileSync(prjPath, "utf8"));
|
|
35690
36154
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
35691
36155
|
throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
|
|
35692
36156
|
}
|
|
@@ -35697,11 +36161,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
35697
36161
|
if (!dir) {
|
|
35698
36162
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
35699
36163
|
}
|
|
35700
|
-
const tokenPath =
|
|
36164
|
+
const tokenPath = path16.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
35701
36165
|
const tokenJson = JSON.stringify(token);
|
|
35702
|
-
|
|
35703
|
-
|
|
35704
|
-
|
|
36166
|
+
fs11.mkdirSync(path16.dirname(tokenPath), { mode: 504, recursive: true });
|
|
36167
|
+
fs11.writeFileSync(tokenPath, tokenJson);
|
|
36168
|
+
fs11.chmodSync(tokenPath, 432);
|
|
35705
36169
|
return;
|
|
35706
36170
|
}
|
|
35707
36171
|
function loadToken(projectId) {
|
|
@@ -35709,11 +36173,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
35709
36173
|
if (!dir) {
|
|
35710
36174
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
35711
36175
|
}
|
|
35712
|
-
const tokenPath =
|
|
35713
|
-
if (!
|
|
36176
|
+
const tokenPath = path16.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
36177
|
+
if (!fs11.existsSync(tokenPath)) {
|
|
35714
36178
|
return null;
|
|
35715
36179
|
}
|
|
35716
|
-
const token = JSON.parse(
|
|
36180
|
+
const token = JSON.parse(fs11.readFileSync(tokenPath, "utf8"));
|
|
35717
36181
|
assertVercelOidcTokenResponse(token);
|
|
35718
36182
|
return token;
|
|
35719
36183
|
}
|
|
@@ -46555,37 +47019,37 @@ function createOpenAI(options = {}) {
|
|
|
46555
47019
|
}, `ai-sdk/openai/${VERSION4}`);
|
|
46556
47020
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
46557
47021
|
provider: `${providerName}.chat`,
|
|
46558
|
-
url: ({ path:
|
|
47022
|
+
url: ({ path: path16 }) => `${baseURL}${path16}`,
|
|
46559
47023
|
headers: getHeaders,
|
|
46560
47024
|
fetch: options.fetch
|
|
46561
47025
|
});
|
|
46562
47026
|
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
46563
47027
|
provider: `${providerName}.completion`,
|
|
46564
|
-
url: ({ path:
|
|
47028
|
+
url: ({ path: path16 }) => `${baseURL}${path16}`,
|
|
46565
47029
|
headers: getHeaders,
|
|
46566
47030
|
fetch: options.fetch
|
|
46567
47031
|
});
|
|
46568
47032
|
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
46569
47033
|
provider: `${providerName}.embedding`,
|
|
46570
|
-
url: ({ path:
|
|
47034
|
+
url: ({ path: path16 }) => `${baseURL}${path16}`,
|
|
46571
47035
|
headers: getHeaders,
|
|
46572
47036
|
fetch: options.fetch
|
|
46573
47037
|
});
|
|
46574
47038
|
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
46575
47039
|
provider: `${providerName}.image`,
|
|
46576
|
-
url: ({ path:
|
|
47040
|
+
url: ({ path: path16 }) => `${baseURL}${path16}`,
|
|
46577
47041
|
headers: getHeaders,
|
|
46578
47042
|
fetch: options.fetch
|
|
46579
47043
|
});
|
|
46580
47044
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
46581
47045
|
provider: `${providerName}.transcription`,
|
|
46582
|
-
url: ({ path:
|
|
47046
|
+
url: ({ path: path16 }) => `${baseURL}${path16}`,
|
|
46583
47047
|
headers: getHeaders,
|
|
46584
47048
|
fetch: options.fetch
|
|
46585
47049
|
});
|
|
46586
47050
|
const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
|
|
46587
47051
|
provider: `${providerName}.speech`,
|
|
46588
|
-
url: ({ path:
|
|
47052
|
+
url: ({ path: path16 }) => `${baseURL}${path16}`,
|
|
46589
47053
|
headers: getHeaders,
|
|
46590
47054
|
fetch: options.fetch
|
|
46591
47055
|
});
|
|
@@ -46598,7 +47062,7 @@ function createOpenAI(options = {}) {
|
|
|
46598
47062
|
const createResponsesModel = (modelId) => {
|
|
46599
47063
|
return new OpenAIResponsesLanguageModel(modelId, {
|
|
46600
47064
|
provider: `${providerName}.responses`,
|
|
46601
|
-
url: ({ path:
|
|
47065
|
+
url: ({ path: path16 }) => `${baseURL}${path16}`,
|
|
46602
47066
|
headers: getHeaders,
|
|
46603
47067
|
fetch: options.fetch,
|
|
46604
47068
|
fileIdPrefixes: ["file-"]
|
|
@@ -63143,26 +63607,26 @@ var require_process = __commonJS((exports, module) => {
|
|
|
63143
63607
|
|
|
63144
63608
|
// ../../node_modules/detect-libc/lib/filesystem.js
|
|
63145
63609
|
var require_filesystem = __commonJS((exports, module) => {
|
|
63146
|
-
var
|
|
63610
|
+
var fs11 = __require("fs");
|
|
63147
63611
|
var LDD_PATH = "/usr/bin/ldd";
|
|
63148
63612
|
var SELF_PATH = "/proc/self/exe";
|
|
63149
63613
|
var MAX_LENGTH = 2048;
|
|
63150
|
-
var readFileSync2 = (
|
|
63151
|
-
const fd =
|
|
63614
|
+
var readFileSync2 = (path16) => {
|
|
63615
|
+
const fd = fs11.openSync(path16, "r");
|
|
63152
63616
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
63153
|
-
const bytesRead =
|
|
63154
|
-
|
|
63617
|
+
const bytesRead = fs11.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
63618
|
+
fs11.close(fd, () => {});
|
|
63155
63619
|
return buffer.subarray(0, bytesRead);
|
|
63156
63620
|
};
|
|
63157
|
-
var readFile = (
|
|
63158
|
-
|
|
63621
|
+
var readFile = (path16) => new Promise((resolve4, reject) => {
|
|
63622
|
+
fs11.open(path16, "r", (err, fd) => {
|
|
63159
63623
|
if (err) {
|
|
63160
63624
|
reject(err);
|
|
63161
63625
|
} else {
|
|
63162
63626
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
63163
|
-
|
|
63627
|
+
fs11.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
|
|
63164
63628
|
resolve4(buffer.subarray(0, bytesRead));
|
|
63165
|
-
|
|
63629
|
+
fs11.close(fd, () => {});
|
|
63166
63630
|
});
|
|
63167
63631
|
}
|
|
63168
63632
|
});
|
|
@@ -63267,11 +63731,11 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
63267
63731
|
}
|
|
63268
63732
|
return null;
|
|
63269
63733
|
};
|
|
63270
|
-
var familyFromInterpreterPath = (
|
|
63271
|
-
if (
|
|
63272
|
-
if (
|
|
63734
|
+
var familyFromInterpreterPath = (path16) => {
|
|
63735
|
+
if (path16) {
|
|
63736
|
+
if (path16.includes("/ld-musl-")) {
|
|
63273
63737
|
return MUSL;
|
|
63274
|
-
} else if (
|
|
63738
|
+
} else if (path16.includes("/ld-linux-")) {
|
|
63275
63739
|
return GLIBC;
|
|
63276
63740
|
}
|
|
63277
63741
|
}
|
|
@@ -63316,8 +63780,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
63316
63780
|
cachedFamilyInterpreter = null;
|
|
63317
63781
|
try {
|
|
63318
63782
|
const selfContent = await readFile(SELF_PATH);
|
|
63319
|
-
const
|
|
63320
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
63783
|
+
const path16 = interpreterPath(selfContent);
|
|
63784
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path16);
|
|
63321
63785
|
} catch (e) {}
|
|
63322
63786
|
return cachedFamilyInterpreter;
|
|
63323
63787
|
};
|
|
@@ -63328,8 +63792,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
63328
63792
|
cachedFamilyInterpreter = null;
|
|
63329
63793
|
try {
|
|
63330
63794
|
const selfContent = readFileSync2(SELF_PATH);
|
|
63331
|
-
const
|
|
63332
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
63795
|
+
const path16 = interpreterPath(selfContent);
|
|
63796
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path16);
|
|
63333
63797
|
} catch (e) {}
|
|
63334
63798
|
return cachedFamilyInterpreter;
|
|
63335
63799
|
};
|
|
@@ -64991,18 +65455,18 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
64991
65455
|
`@img/sharp-${runtimePlatform}/sharp.node`,
|
|
64992
65456
|
"@img/sharp-wasm32/sharp.node"
|
|
64993
65457
|
];
|
|
64994
|
-
var
|
|
65458
|
+
var path16;
|
|
64995
65459
|
var sharp;
|
|
64996
65460
|
var errors4 = [];
|
|
64997
|
-
for (
|
|
65461
|
+
for (path16 of paths) {
|
|
64998
65462
|
try {
|
|
64999
|
-
sharp = __require(
|
|
65463
|
+
sharp = __require(path16);
|
|
65000
65464
|
break;
|
|
65001
65465
|
} catch (err) {
|
|
65002
65466
|
errors4.push(err);
|
|
65003
65467
|
}
|
|
65004
65468
|
}
|
|
65005
|
-
if (sharp &&
|
|
65469
|
+
if (sharp && path16.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
|
|
65006
65470
|
const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
|
|
65007
65471
|
err.code = "Unsupported CPU";
|
|
65008
65472
|
errors4.push(err);
|
|
@@ -65011,7 +65475,7 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
65011
65475
|
if (sharp) {
|
|
65012
65476
|
module.exports = sharp;
|
|
65013
65477
|
} else {
|
|
65014
|
-
const [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((
|
|
65478
|
+
const [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((os8) => runtimePlatform.startsWith(os8));
|
|
65015
65479
|
const help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
|
|
65016
65480
|
errors4.forEach((err) => {
|
|
65017
65481
|
if (err.code !== "MODULE_NOT_FOUND") {
|
|
@@ -65024,9 +65488,9 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
65024
65488
|
const { found, expected } = isUnsupportedNodeRuntime();
|
|
65025
65489
|
help.push("- Please upgrade Node.js:", ` Found ${found}`, ` Requires ${expected}`);
|
|
65026
65490
|
} else if (prebuiltPlatforms.includes(runtimePlatform)) {
|
|
65027
|
-
const [
|
|
65028
|
-
const libc =
|
|
65029
|
-
help.push("- Ensure optional dependencies can be installed:", " npm install --include=optional sharp", "- Ensure your package manager supports multi-platform installation:", " See https://sharp.pixelplumbing.com/install#cross-platform", "- Add platform-specific dependencies:", ` npm install --os=${
|
|
65491
|
+
const [os8, cpu] = runtimePlatform.split("-");
|
|
65492
|
+
const libc = os8.endsWith("musl") ? " --libc=musl" : "";
|
|
65493
|
+
help.push("- Ensure optional dependencies can be installed:", " npm install --include=optional sharp", "- Ensure your package manager supports multi-platform installation:", " See https://sharp.pixelplumbing.com/install#cross-platform", "- Add platform-specific dependencies:", ` npm install --os=${os8.replace("musl", "")}${libc} --cpu=${cpu} sharp`);
|
|
65030
65494
|
} else {
|
|
65031
65495
|
help.push(`- Manually install libvips >= ${minimumLibvipsVersion}`, "- Add experimental WebAssembly-based dependencies:", " npm install --cpu=wasm32 sharp", " npm install @img/sharp-wasm32");
|
|
65032
65496
|
}
|
|
@@ -66286,7 +66750,7 @@ var require_operation = __commonJS((exports, module) => {
|
|
|
66286
66750
|
float: "float",
|
|
66287
66751
|
approximate: "approximate"
|
|
66288
66752
|
};
|
|
66289
|
-
function
|
|
66753
|
+
function rotate2(angle, options) {
|
|
66290
66754
|
if (!is.defined(angle)) {
|
|
66291
66755
|
return this.autoOrient();
|
|
66292
66756
|
}
|
|
@@ -66713,7 +67177,7 @@ var require_operation = __commonJS((exports, module) => {
|
|
|
66713
67177
|
module.exports = (Sharp) => {
|
|
66714
67178
|
Object.assign(Sharp.prototype, {
|
|
66715
67179
|
autoOrient,
|
|
66716
|
-
rotate,
|
|
67180
|
+
rotate: rotate2,
|
|
66717
67181
|
flip,
|
|
66718
67182
|
flop,
|
|
66719
67183
|
affine,
|
|
@@ -67864,15 +68328,15 @@ var require_color = __commonJS((exports, module) => {
|
|
|
67864
68328
|
};
|
|
67865
68329
|
}
|
|
67866
68330
|
function wrapConversion(toModel, graph) {
|
|
67867
|
-
const
|
|
68331
|
+
const path16 = [graph[toModel].parent, toModel];
|
|
67868
68332
|
let fn = conversions_default[graph[toModel].parent][toModel];
|
|
67869
68333
|
let cur = graph[toModel].parent;
|
|
67870
68334
|
while (graph[cur].parent) {
|
|
67871
|
-
|
|
68335
|
+
path16.unshift(graph[cur].parent);
|
|
67872
68336
|
fn = link(conversions_default[graph[cur].parent][cur], fn);
|
|
67873
68337
|
cur = graph[cur].parent;
|
|
67874
68338
|
}
|
|
67875
|
-
fn.conversion =
|
|
68339
|
+
fn.conversion = path16;
|
|
67876
68340
|
return fn;
|
|
67877
68341
|
}
|
|
67878
68342
|
function route(fromModel) {
|
|
@@ -68477,7 +68941,7 @@ var require_output = __commonJS((exports, module) => {
|
|
|
68477
68941
|
Copyright 2013 Lovell Fuller and others.
|
|
68478
68942
|
SPDX-License-Identifier: Apache-2.0
|
|
68479
68943
|
*/
|
|
68480
|
-
var
|
|
68944
|
+
var path16 = __require("path");
|
|
68481
68945
|
var is = require_is();
|
|
68482
68946
|
var sharp = require_sharp();
|
|
68483
68947
|
var formats = new Map([
|
|
@@ -68508,9 +68972,9 @@ var require_output = __commonJS((exports, module) => {
|
|
|
68508
68972
|
let err;
|
|
68509
68973
|
if (!is.string(fileOut)) {
|
|
68510
68974
|
err = new Error("Missing output file path");
|
|
68511
|
-
} else if (is.string(this.options.input.file) &&
|
|
68975
|
+
} else if (is.string(this.options.input.file) && path16.resolve(this.options.input.file) === path16.resolve(fileOut)) {
|
|
68512
68976
|
err = new Error("Cannot use same file for input and output");
|
|
68513
|
-
} else if (jp2Regex.test(
|
|
68977
|
+
} else if (jp2Regex.test(path16.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
|
|
68514
68978
|
err = errJp2Save();
|
|
68515
68979
|
}
|
|
68516
68980
|
if (err) {
|
|
@@ -75757,11 +76221,11 @@ var init_transformers_node = __esm(() => {
|
|
|
75757
76221
|
throw new Error(`The number of external data chunks (${num_chunks}) exceeds the maximum allowed value (${_utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.MAX_EXTERNAL_DATA_CHUNKS}).`);
|
|
75758
76222
|
}
|
|
75759
76223
|
for (let i = 0;i < num_chunks; ++i) {
|
|
75760
|
-
const
|
|
75761
|
-
const fullPath = `${options.subfolder ?? ""}/${
|
|
76224
|
+
const path16 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
|
|
76225
|
+
const fullPath = `${options.subfolder ?? ""}/${path16}`;
|
|
75762
76226
|
externalDataPromises.push(new Promise(async (resolve4, reject) => {
|
|
75763
76227
|
const data = await (0, _utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelFile)(pretrained_model_name_or_path, fullPath, true, options, return_path);
|
|
75764
|
-
resolve4(data instanceof Uint8Array ? { path:
|
|
76228
|
+
resolve4(data instanceof Uint8Array ? { path: path16, data } : path16);
|
|
75765
76229
|
}));
|
|
75766
76230
|
}
|
|
75767
76231
|
} else if (session_options.externalData !== undefined) {
|
|
@@ -88825,7 +89289,7 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
88825
89289
|
const blob = new Blob([wav], { type: "audio/wav" });
|
|
88826
89290
|
return blob;
|
|
88827
89291
|
}
|
|
88828
|
-
async save(
|
|
89292
|
+
async save(path16) {
|
|
88829
89293
|
let fn;
|
|
88830
89294
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_BROWSER_ENV) {
|
|
88831
89295
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_WEBWORKER_ENV) {
|
|
@@ -88833,14 +89297,14 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
88833
89297
|
}
|
|
88834
89298
|
fn = _core_js__WEBPACK_IMPORTED_MODULE_2__.saveBlob;
|
|
88835
89299
|
} else if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_FS_AVAILABLE) {
|
|
88836
|
-
fn = async (
|
|
89300
|
+
fn = async (path17, blob) => {
|
|
88837
89301
|
let buffer = await blob.arrayBuffer();
|
|
88838
|
-
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(
|
|
89302
|
+
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path17, Buffer.from(buffer));
|
|
88839
89303
|
};
|
|
88840
89304
|
} else {
|
|
88841
89305
|
throw new Error("Unable to save because filesystem is disabled in this environment.");
|
|
88842
89306
|
}
|
|
88843
|
-
await fn(
|
|
89307
|
+
await fn(path16, this.toBlob());
|
|
88844
89308
|
}
|
|
88845
89309
|
}
|
|
88846
89310
|
},
|
|
@@ -88936,11 +89400,11 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
88936
89400
|
function calculateReflectOffset(i, w) {
|
|
88937
89401
|
return Math.abs((i + w) % (2 * w) - w);
|
|
88938
89402
|
}
|
|
88939
|
-
function saveBlob(
|
|
89403
|
+
function saveBlob(path16, blob) {
|
|
88940
89404
|
const dataURL = URL.createObjectURL(blob);
|
|
88941
89405
|
const downloadLink = document.createElement("a");
|
|
88942
89406
|
downloadLink.href = dataURL;
|
|
88943
|
-
downloadLink.download =
|
|
89407
|
+
downloadLink.download = path16;
|
|
88944
89408
|
downloadLink.click();
|
|
88945
89409
|
downloadLink.remove();
|
|
88946
89410
|
URL.revokeObjectURL(dataURL);
|
|
@@ -89541,8 +90005,8 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
89541
90005
|
}
|
|
89542
90006
|
|
|
89543
90007
|
class FileCache {
|
|
89544
|
-
constructor(
|
|
89545
|
-
this.path =
|
|
90008
|
+
constructor(path16) {
|
|
90009
|
+
this.path = path16;
|
|
89546
90010
|
}
|
|
89547
90011
|
async match(request) {
|
|
89548
90012
|
let filePath = node_path__WEBPACK_IMPORTED_MODULE_1__["default"].join(this.path, request);
|
|
@@ -90298,20 +90762,20 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
90298
90762
|
}
|
|
90299
90763
|
return this;
|
|
90300
90764
|
}
|
|
90301
|
-
async save(
|
|
90765
|
+
async save(path16) {
|
|
90302
90766
|
if (IS_BROWSER_OR_WEBWORKER) {
|
|
90303
90767
|
if (_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_WEBWORKER_ENV) {
|
|
90304
90768
|
throw new Error("Unable to save an image from a Web Worker.");
|
|
90305
90769
|
}
|
|
90306
|
-
const extension =
|
|
90770
|
+
const extension = path16.split(".").pop().toLowerCase();
|
|
90307
90771
|
const mime = CONTENT_TYPE_MAP.get(extension) ?? "image/png";
|
|
90308
90772
|
const blob = await this.toBlob(mime);
|
|
90309
|
-
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(
|
|
90773
|
+
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path16, blob);
|
|
90310
90774
|
} else if (!_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_FS_AVAILABLE) {
|
|
90311
90775
|
throw new Error("Unable to save the image because filesystem is disabled in this environment.");
|
|
90312
90776
|
} else {
|
|
90313
90777
|
const img = this.toSharp();
|
|
90314
|
-
return await img.toFile(
|
|
90778
|
+
return await img.toFile(path16);
|
|
90315
90779
|
}
|
|
90316
90780
|
}
|
|
90317
90781
|
toSharp() {
|
|
@@ -93838,20 +94302,20 @@ function getRetryDelay(attempt, config3) {
|
|
|
93838
94302
|
return Math.min(delay2, config3.maxDelay);
|
|
93839
94303
|
}
|
|
93840
94304
|
async function withRetry(fn, config3, context2) {
|
|
93841
|
-
let
|
|
94305
|
+
let lastError2;
|
|
93842
94306
|
for (let attempt = 0;attempt <= config3.maxRetries; attempt++) {
|
|
93843
94307
|
try {
|
|
93844
94308
|
return await fn();
|
|
93845
94309
|
} catch (error51) {
|
|
93846
|
-
|
|
94310
|
+
lastError2 = error51;
|
|
93847
94311
|
if (attempt < config3.maxRetries) {
|
|
93848
94312
|
const delay2 = getRetryDelay(attempt, config3);
|
|
93849
|
-
logger.warn(`[EmbeddingProvider] ${context2} failed (attempt ${attempt + 1}/${config3.maxRetries + 1}), retrying in ${delay2}ms`, { error:
|
|
94313
|
+
logger.warn(`[EmbeddingProvider] ${context2} failed (attempt ${attempt + 1}/${config3.maxRetries + 1}), retrying in ${delay2}ms`, { error: lastError2.message });
|
|
93850
94314
|
await sleep(delay2);
|
|
93851
94315
|
}
|
|
93852
94316
|
}
|
|
93853
94317
|
}
|
|
93854
|
-
throw new Error(`${context2} failed after ${config3.maxRetries + 1} attempts: ${
|
|
94318
|
+
throw new Error(`${context2} failed after ${config3.maxRetries + 1} attempts: ${lastError2?.message}`);
|
|
93855
94319
|
}
|
|
93856
94320
|
async function withTimeout(fn, timeoutMs, context2) {
|
|
93857
94321
|
let timeoutId;
|
|
@@ -99537,7 +100001,7 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
|
|
|
99537
100001
|
function ns(e = Yo, t = Yo) {
|
|
99538
100002
|
return (r) => e(t(r));
|
|
99539
100003
|
}
|
|
99540
|
-
function
|
|
100004
|
+
function os8({ dataPath: e, modelName: t, args: r, runtimeDataModel: n }) {
|
|
99541
100005
|
let i = { modelName: t, args: r ?? {} }, o = dp(e);
|
|
99542
100006
|
if (!o || o.length === 0)
|
|
99543
100007
|
return i;
|
|
@@ -99842,10 +100306,10 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
|
|
|
99842
100306
|
super(t, "P2023", r);
|
|
99843
100307
|
}
|
|
99844
100308
|
};
|
|
99845
|
-
var
|
|
100309
|
+
var fs11 = new WeakMap;
|
|
99846
100310
|
function Ep(e) {
|
|
99847
|
-
let t =
|
|
99848
|
-
return t || (t = Object.entries(e),
|
|
100311
|
+
let t = fs11.get(e);
|
|
100312
|
+
return t || (t = Object.entries(e), fs11.set(e, t)), t;
|
|
99849
100313
|
}
|
|
99850
100314
|
function hs(e, t, r) {
|
|
99851
100315
|
switch (t.type) {
|
|
@@ -103410,7 +103874,7 @@ new PrismaClient({
|
|
|
103410
103874
|
let m = await es(this, d);
|
|
103411
103875
|
if (!d.model)
|
|
103412
103876
|
return m;
|
|
103413
|
-
let g =
|
|
103877
|
+
let g = os8({ dataPath: d.dataPath, modelName: d.model, args: d.args, runtimeDataModel: this._runtimeDataModel });
|
|
103414
103878
|
return Wo({ result: m, modelName: g.modelName, args: g.args, extensions: this._extensions, runtimeDataModel: this._runtimeDataModel, globalOmit: this._globalOmit });
|
|
103415
103879
|
};
|
|
103416
103880
|
return this._tracingHelper.runInChildSpan(s.operation, () => new zl.AsyncResource("prisma-client-request").runInAsyncScope(() => a(o)));
|
|
@@ -103813,7 +104277,7 @@ var require_prisma = __commonJS((exports) => {
|
|
|
103813
104277
|
Prisma.JsonNull = JsonNull2;
|
|
103814
104278
|
Prisma.AnyNull = AnyNull2;
|
|
103815
104279
|
Prisma.NullTypes = NullTypes2;
|
|
103816
|
-
var
|
|
104280
|
+
var path16 = __require("path");
|
|
103817
104281
|
exports.Prisma.TransactionIsolationLevel = makeStrictEnum2({
|
|
103818
104282
|
ReadUncommitted: "ReadUncommitted",
|
|
103819
104283
|
ReadCommitted: "ReadCommitted",
|
|
@@ -106781,11 +107245,17 @@ var init_config2 = __esm(() => {
|
|
|
106781
107245
|
ollama: (() => {
|
|
106782
107246
|
const file2 = fileFor("ollama");
|
|
106783
107247
|
const model = process.env.OLLAMA_EMBEDDING_MODEL || file2?.model || "qwen3-embedding:4b";
|
|
107248
|
+
const rawEnvDimensions = Number(process.env.OLLAMA_EMBEDDING_DIMENSIONS);
|
|
107249
|
+
const envDimensions = Number.isInteger(rawEnvDimensions) && rawEnvDimensions > 0 ? rawEnvDimensions : undefined;
|
|
107250
|
+
const resolvedDimensions = resolveEmbeddingDimensions(model, file2?.dimensions, envDimensions);
|
|
107251
|
+
if (resolvedDimensions.correctedFrom !== undefined) {
|
|
107252
|
+
logger.warn(`[ollama] config.json records embedding.dimensions ${resolvedDimensions.correctedFrom} for model ` + `"${model}", which emits ${resolvedDimensions.dimensions}. Using ${resolvedDimensions.dimensions}. ` + "Update embedding.dimensions in config.json (or set OLLAMA_EMBEDDING_DIMENSIONS) to silence this.");
|
|
107253
|
+
}
|
|
106784
107254
|
return {
|
|
106785
107255
|
provider: "ollama",
|
|
106786
107256
|
model,
|
|
106787
107257
|
baseURL: process.env.OLLAMA_BASE_URL || file2?.baseURL || "http://localhost:11434",
|
|
106788
|
-
dimensions:
|
|
107258
|
+
dimensions: resolvedDimensions.dimensions,
|
|
106789
107259
|
priority: selectedProvider === "ollama" ? 1 : 50,
|
|
106790
107260
|
timeout: 300000,
|
|
106791
107261
|
maxRetries: 2,
|
|
@@ -111326,7 +111796,7 @@ async function upsertWorkspace(ws) {
|
|
|
111326
111796
|
}, { timeout: 60000, maxWait: 1e4 });
|
|
111327
111797
|
}
|
|
111328
111798
|
async function updateWorkspaceStatus(projectId, status, opts) {
|
|
111329
|
-
const
|
|
111799
|
+
const lastError2 = typeof opts === "string" ? opts : opts?.lastError ?? null;
|
|
111330
111800
|
const filesCount = typeof opts === "object" ? opts?.filesCount : undefined;
|
|
111331
111801
|
const chunksCount = typeof opts === "object" ? opts?.chunksCount : undefined;
|
|
111332
111802
|
const symbolsCount = typeof opts === "object" ? opts?.symbolsCount : undefined;
|
|
@@ -111336,7 +111806,7 @@ async function updateWorkspaceStatus(projectId, status, opts) {
|
|
|
111336
111806
|
await tx.$executeRaw`
|
|
111337
111807
|
UPDATE workspaces SET
|
|
111338
111808
|
status = ${status},
|
|
111339
|
-
last_error = ${
|
|
111809
|
+
last_error = ${lastError2},
|
|
111340
111810
|
last_indexed_at = ${lastIndexedAt ?? null},
|
|
111341
111811
|
files_count = COALESCE(${filesCount ?? null}, files_count),
|
|
111342
111812
|
chunks_count = COALESCE(${chunksCount ?? null}, chunks_count),
|
|
@@ -116680,10 +117150,10 @@ var init_chunker_code = __esm(() => {
|
|
|
116680
117150
|
});
|
|
116681
117151
|
|
|
116682
117152
|
// ../../packages/core/dist/services/search/smart-chunker.js
|
|
116683
|
-
import
|
|
117153
|
+
import path16 from "path";
|
|
116684
117154
|
function smartChunk(content, filePath, config3 = {}) {
|
|
116685
117155
|
const cfg = { ...DEFAULT_CONFIG, ...config3 };
|
|
116686
|
-
const ext2 =
|
|
117156
|
+
const ext2 = path16.extname(filePath).toLowerCase();
|
|
116687
117157
|
const relativePath = filePath;
|
|
116688
117158
|
const fileImports = isCodeFile(ext2) ? extractFileImports(content, ext2) : undefined;
|
|
116689
117159
|
let chunks;
|
|
@@ -116990,8 +117460,8 @@ var init_managed_run_repository_pg = __esm(() => {
|
|
|
116990
117460
|
});
|
|
116991
117461
|
|
|
116992
117462
|
// ../../packages/core/dist/services/search/project-indexer.js
|
|
116993
|
-
import
|
|
116994
|
-
import
|
|
117463
|
+
import fs11 from "fs/promises";
|
|
117464
|
+
import path17 from "path";
|
|
116995
117465
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
116996
117466
|
async function runWithIndexLock(lockMap, projectId, work) {
|
|
116997
117467
|
const prevLock = lockMap.get(projectId);
|
|
@@ -117034,7 +117504,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
117034
117504
|
dot: false
|
|
117035
117505
|
});
|
|
117036
117506
|
const filteredFiles = files.filter((file2) => {
|
|
117037
|
-
const relativePath =
|
|
117507
|
+
const relativePath = path17.relative(projectPath, file2);
|
|
117038
117508
|
const shouldIgnore = ig.ignores(relativePath);
|
|
117039
117509
|
if (shouldIgnore) {
|
|
117040
117510
|
logger.debug("Ignoring file per .gitignore during indexing", {
|
|
@@ -117074,7 +117544,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
117074
117544
|
});
|
|
117075
117545
|
}
|
|
117076
117546
|
}
|
|
117077
|
-
const indexedFilesList = filteredFiles.map((f) =>
|
|
117547
|
+
const indexedFilesList = filteredFiles.map((f) => path17.relative(projectPath, f));
|
|
117078
117548
|
await deps.indexManager.updateIndexMetadata(projectId, projectPath, indexedFilesList);
|
|
117079
117549
|
logger.info("Project indexing completed", {
|
|
117080
117550
|
projectId,
|
|
@@ -117199,7 +117669,7 @@ async function ensureFreshIndex(deps, projectId, projectPath, options = {}) {
|
|
|
117199
117669
|
let errors4 = 0;
|
|
117200
117670
|
for (const relativeFilePath of filesToReindex) {
|
|
117201
117671
|
try {
|
|
117202
|
-
const fullPath =
|
|
117672
|
+
const fullPath = path17.join(projectPath, relativeFilePath);
|
|
117203
117673
|
const result = await deps.indexFile(fullPath, projectId, projectPath, centralityMap);
|
|
117204
117674
|
filesIndexed++;
|
|
117205
117675
|
chunksIndexed += result.chunks;
|
|
@@ -117250,8 +117720,8 @@ async function checkSearchAdmission(deps, projectId, projectPath) {
|
|
|
117250
117720
|
}
|
|
117251
117721
|
async function indexFile(deps, filePath, projectId, projectRoot, centralityMap) {
|
|
117252
117722
|
projectId = await getProjectIdentityAliasResolver().resolve(projectId);
|
|
117253
|
-
const content = await
|
|
117254
|
-
const relativePath =
|
|
117723
|
+
const content = await fs11.readFile(filePath, "utf-8");
|
|
117724
|
+
const relativePath = path17.relative(projectRoot, filePath);
|
|
117255
117725
|
const maxFileSize = config.get("security").maxFileSize || 1024 * 1024;
|
|
117256
117726
|
if (content.length > maxFileSize) {
|
|
117257
117727
|
logger.warn("File too large, skipping", {
|
|
@@ -117271,7 +117741,7 @@ async function indexFile(deps, filePath, projectId, projectRoot, centralityMap)
|
|
|
117271
117741
|
chunkIndex: i,
|
|
117272
117742
|
totalChunks: chunks.length,
|
|
117273
117743
|
type: chunk.type,
|
|
117274
|
-
language:
|
|
117744
|
+
language: path17.extname(filePath).slice(1),
|
|
117275
117745
|
lineStart: chunk.lineStart,
|
|
117276
117746
|
lineEnd: chunk.lineEnd,
|
|
117277
117747
|
label: chunk.label,
|
|
@@ -120602,16 +121072,16 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
120602
121072
|
const seen = new Set;
|
|
120603
121073
|
const out = [];
|
|
120604
121074
|
for (const e of httpEdges) {
|
|
120605
|
-
const
|
|
120606
|
-
if (!
|
|
121075
|
+
const path18 = e.route;
|
|
121076
|
+
if (!path18)
|
|
120607
121077
|
continue;
|
|
120608
121078
|
const method = (e.method ?? "ANY").toUpperCase();
|
|
120609
|
-
const key = method + " " +
|
|
121079
|
+
const key = method + " " + path18;
|
|
120610
121080
|
if (seen.has(key))
|
|
120611
121081
|
continue;
|
|
120612
121082
|
seen.add(key);
|
|
120613
121083
|
out.push({
|
|
120614
|
-
path:
|
|
121084
|
+
path: path18,
|
|
120615
121085
|
method: e.method,
|
|
120616
121086
|
file: e.fromFile,
|
|
120617
121087
|
handler: e.targetFqn ?? e.symbolName
|
|
@@ -120622,12 +121092,12 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
120622
121092
|
continue;
|
|
120623
121093
|
const parsed = parseRouteName(d.name);
|
|
120624
121094
|
const method = parsed?.method ?? "ANY";
|
|
120625
|
-
const
|
|
120626
|
-
const key = method + " " +
|
|
121095
|
+
const path18 = parsed?.path ?? d.name;
|
|
121096
|
+
const key = method + " " + path18;
|
|
120627
121097
|
if (seen.has(key))
|
|
120628
121098
|
continue;
|
|
120629
121099
|
seen.add(key);
|
|
120630
|
-
out.push({ path:
|
|
121100
|
+
out.push({ path: path18, method: parsed?.method, file: d.filePath, handler: d.name });
|
|
120631
121101
|
}
|
|
120632
121102
|
for (const d of defs) {
|
|
120633
121103
|
const parsed = parseRouteName(d.name);
|
|
@@ -120848,8 +121318,8 @@ __export(exports_symbol_graph_service, {
|
|
|
120848
121318
|
symbolGraphService: () => symbolGraphService,
|
|
120849
121319
|
SymbolGraphService: () => SymbolGraphService
|
|
120850
121320
|
});
|
|
120851
|
-
import
|
|
120852
|
-
import
|
|
121321
|
+
import path18 from "path";
|
|
121322
|
+
import fs12 from "fs/promises";
|
|
120853
121323
|
|
|
120854
121324
|
class SymbolGraphService {
|
|
120855
121325
|
identityLookup;
|
|
@@ -121177,7 +121647,7 @@ class SymbolGraphService {
|
|
|
121177
121647
|
async readSnippet(relativePath, lineStart, lineEnd, projectId) {
|
|
121178
121648
|
try {
|
|
121179
121649
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
121180
|
-
const content = await
|
|
121650
|
+
const content = await fs12.readFile(absolutePath, "utf-8");
|
|
121181
121651
|
const lines = content.split(`
|
|
121182
121652
|
`);
|
|
121183
121653
|
return lines.slice(Math.max(0, lineStart - 1), Math.min(lines.length, lineEnd)).join(`
|
|
@@ -121189,7 +121659,7 @@ class SymbolGraphService {
|
|
|
121189
121659
|
async readContext(relativePath, lineNumber, contextLines, projectId) {
|
|
121190
121660
|
try {
|
|
121191
121661
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
121192
|
-
const content = await
|
|
121662
|
+
const content = await fs12.readFile(absolutePath, "utf-8");
|
|
121193
121663
|
const lines = content.split(`
|
|
121194
121664
|
`);
|
|
121195
121665
|
const start = Math.max(0, lineNumber - contextLines - 1);
|
|
@@ -121202,7 +121672,7 @@ class SymbolGraphService {
|
|
|
121202
121672
|
}
|
|
121203
121673
|
async resolveToAbsolute(relativePath, projectId) {
|
|
121204
121674
|
const root = await this.getProjectRoot(projectId);
|
|
121205
|
-
return root ?
|
|
121675
|
+
return root ? path18.resolve(root, relativePath) : relativePath;
|
|
121206
121676
|
}
|
|
121207
121677
|
async getProjectRoot(projectId) {
|
|
121208
121678
|
const cached2 = this.projectRootCache.get(projectId);
|
|
@@ -122980,31 +123450,31 @@ class TracePathService {
|
|
|
122980
123450
|
const chains = [];
|
|
122981
123451
|
const seen = new Set;
|
|
122982
123452
|
let walks = 0;
|
|
122983
|
-
const walk = (fqn,
|
|
123453
|
+
const walk = (fqn, path19) => {
|
|
122984
123454
|
if (chains.length >= CHAIN_CAP)
|
|
122985
123455
|
return;
|
|
122986
123456
|
if (walks >= MAX_WALKS)
|
|
122987
123457
|
return;
|
|
122988
123458
|
walks++;
|
|
122989
|
-
const key =
|
|
123459
|
+
const key = path19.join("\u2192");
|
|
122990
123460
|
if (seen.has(key))
|
|
122991
123461
|
return;
|
|
122992
123462
|
seen.add(key);
|
|
122993
123463
|
const next = adj.get(fqn);
|
|
122994
123464
|
if (!next || next.length === 0 || !whoHasChild.has(fqn)) {
|
|
122995
|
-
if (
|
|
122996
|
-
chains.push(
|
|
123465
|
+
if (path19.length > 1)
|
|
123466
|
+
chains.push(path19.map((n) => this.fqnToName(n)).join(" \u2192 "));
|
|
122997
123467
|
return;
|
|
122998
123468
|
}
|
|
122999
123469
|
for (const child of next) {
|
|
123000
123470
|
if (chains.length >= CHAIN_CAP || walks >= MAX_WALKS)
|
|
123001
123471
|
return;
|
|
123002
|
-
if (
|
|
123003
|
-
const cycled = [...
|
|
123472
|
+
if (path19.includes(child)) {
|
|
123473
|
+
const cycled = [...path19, `${this.fqnToName(child)}\u21BA`];
|
|
123004
123474
|
chains.push(cycled.map((n) => n).join(" \u2192 "));
|
|
123005
123475
|
continue;
|
|
123006
123476
|
}
|
|
123007
|
-
walk(child, [...
|
|
123477
|
+
walk(child, [...path19, child]);
|
|
123008
123478
|
}
|
|
123009
123479
|
};
|
|
123010
123480
|
for (const seed of seeds) {
|
|
@@ -124998,9 +125468,9 @@ var init_l1_memory_cache = __esm(() => {
|
|
|
124998
125468
|
});
|
|
124999
125469
|
|
|
125000
125470
|
// ../../packages/core/dist/services/health/local-health-checker.js
|
|
125001
|
-
import
|
|
125471
|
+
import fs13 from "fs/promises";
|
|
125002
125472
|
import { existsSync as existsSync3 } from "fs";
|
|
125003
|
-
import
|
|
125473
|
+
import path19 from "path";
|
|
125004
125474
|
|
|
125005
125475
|
class LocalHealthChecker {
|
|
125006
125476
|
ollamaBaseUrl = process.env.OLLAMA_BASE_URL || "http://localhost:11434";
|
|
@@ -125034,10 +125504,10 @@ class LocalHealthChecker {
|
|
|
125034
125504
|
const start = Date.now();
|
|
125035
125505
|
try {
|
|
125036
125506
|
if (!existsSync3(this.dataDir))
|
|
125037
|
-
await
|
|
125038
|
-
const probe =
|
|
125039
|
-
await
|
|
125040
|
-
await
|
|
125507
|
+
await fs13.mkdir(this.dataDir, { recursive: true });
|
|
125508
|
+
const probe = path19.join(this.dataDir, ".health-check-test");
|
|
125509
|
+
await fs13.writeFile(probe, "ok");
|
|
125510
|
+
await fs13.unlink(probe);
|
|
125041
125511
|
return { available: true, latency: Date.now() - start, details: { path: this.dataDir, writable: true } };
|
|
125042
125512
|
} catch (error51) {
|
|
125043
125513
|
return { available: false, latency: Date.now() - start, error: `Data directory error: ${error51.message}` };
|
|
@@ -125985,10 +126455,18 @@ var init_scheduler_store_factory = __esm(() => {
|
|
|
125985
126455
|
});
|
|
125986
126456
|
|
|
125987
126457
|
// ../../packages/core/dist/services/scheduler/scheduler.js
|
|
125988
|
-
function
|
|
126458
|
+
function readEnabledEnv() {
|
|
125989
126459
|
const raw2 = process.env.MASSA_AI_SCHEDULER_ENABLED;
|
|
126460
|
+
if (raw2 === undefined)
|
|
126461
|
+
return;
|
|
125990
126462
|
return raw2 === "true" || raw2 === "1";
|
|
125991
126463
|
}
|
|
126464
|
+
function envPositiveInt(raw2) {
|
|
126465
|
+
if (raw2 === undefined || raw2 === "")
|
|
126466
|
+
return;
|
|
126467
|
+
const parsed = parsePositiveIntEnv(raw2, NaN);
|
|
126468
|
+
return Number.isNaN(parsed) ? undefined : parsed;
|
|
126469
|
+
}
|
|
125992
126470
|
|
|
125993
126471
|
class Scheduler {
|
|
125994
126472
|
store;
|
|
@@ -126002,9 +126480,10 @@ class Scheduler {
|
|
|
126002
126480
|
started = false;
|
|
126003
126481
|
constructor(opts = {}) {
|
|
126004
126482
|
this.store = opts.store ?? getScheduledJobStore();
|
|
126005
|
-
|
|
126006
|
-
this.
|
|
126007
|
-
this.
|
|
126483
|
+
const schedulerConfig = config.get("scheduler");
|
|
126484
|
+
this.tickIntervalMs = opts.tickIntervalMs ?? envPositiveInt(process.env.MASSA_AI_SCHEDULER_TICK_MS) ?? schedulerConfig?.tickMs ?? DEFAULTS.tickMs;
|
|
126485
|
+
this.maxConcurrent = opts.maxConcurrent ?? envPositiveInt(process.env.MASSA_AI_SCHEDULER_MAX_CONCURRENT) ?? schedulerConfig?.maxConcurrent ?? DEFAULTS.maxConcurrent;
|
|
126486
|
+
this.enabled = opts.enabled ?? readEnabledEnv() ?? schedulerConfig?.enabled ?? false;
|
|
126008
126487
|
}
|
|
126009
126488
|
registerHandler(jobKind, handler) {
|
|
126010
126489
|
this.handlers.set(jobKind, handler);
|
|
@@ -127991,21 +128470,31 @@ var init_checkpoint_manager = __esm(() => {
|
|
|
127991
128470
|
});
|
|
127992
128471
|
|
|
127993
128472
|
// ../../packages/core/dist/services/scheduler/scheduler-defaults.js
|
|
127994
|
-
function envBool2(key, fallback) {
|
|
128473
|
+
function envBool2(key, fileValue, fallback) {
|
|
127995
128474
|
const raw2 = process.env[key];
|
|
127996
128475
|
if (raw2 === undefined)
|
|
127997
|
-
return fallback;
|
|
128476
|
+
return fileValue ?? fallback;
|
|
127998
128477
|
return raw2 === "true" || raw2 === "1";
|
|
127999
128478
|
}
|
|
128000
|
-
function envNum2(key, fallback) {
|
|
128479
|
+
function envNum2(key, fileValue, fallback) {
|
|
128001
128480
|
const raw2 = process.env[key];
|
|
128002
|
-
if (raw2
|
|
128003
|
-
|
|
128004
|
-
|
|
128005
|
-
|
|
128481
|
+
if (raw2 !== undefined && raw2 !== "") {
|
|
128482
|
+
const n = Number(raw2);
|
|
128483
|
+
if (Number.isFinite(n) && n > 0)
|
|
128484
|
+
return n;
|
|
128485
|
+
}
|
|
128486
|
+
return fileValue ?? fallback;
|
|
128487
|
+
}
|
|
128488
|
+
function readFileSchedulerJobs() {
|
|
128489
|
+
try {
|
|
128490
|
+
const raw2 = loadRawUserConfig().scheduler?.jobs;
|
|
128491
|
+
return raw2;
|
|
128492
|
+
} catch {
|
|
128493
|
+
return;
|
|
128494
|
+
}
|
|
128006
128495
|
}
|
|
128007
128496
|
function applySafeDefaults(job) {
|
|
128008
|
-
if (!envBool2("MASSA_AI_SCHEDULER_SAFE_DEFAULTS", false)) {
|
|
128497
|
+
if (!envBool2("MASSA_AI_SCHEDULER_SAFE_DEFAULTS", undefined, false)) {
|
|
128009
128498
|
return job;
|
|
128010
128499
|
}
|
|
128011
128500
|
if (job.jobKind === "memory-consolidation") {
|
|
@@ -128052,10 +128541,12 @@ function registerDefaultJobs(scheduler) {
|
|
|
128052
128541
|
const count = CheckpointManager2.getInstance().purgeExpired();
|
|
128053
128542
|
logger.info("Scheduled checkpoint purge completed", { count });
|
|
128054
128543
|
});
|
|
128544
|
+
const fileJobs = readFileSchedulerJobs();
|
|
128055
128545
|
for (const rawDef of DEFAULT_SCHEDULED_JOBS) {
|
|
128056
128546
|
const def = applySafeDefaults(rawDef);
|
|
128057
|
-
const
|
|
128058
|
-
const
|
|
128547
|
+
const fileJob = fileJobs?.[def.jobKind];
|
|
128548
|
+
const enabled = envBool2(def.enableEnvVar, fileJob?.enabled, def.defaultEnabled);
|
|
128549
|
+
const intervalMs = envNum2(def.intervalEnvVar, fileJob?.intervalMs, def.schedule.intervalMs ?? THIRTY_MIN);
|
|
128059
128550
|
const schedule = { type: "interval", intervalMs };
|
|
128060
128551
|
scheduler.registerOrResumeJob({
|
|
128061
128552
|
id: def.id,
|
|
@@ -128136,9 +128627,9 @@ var init_scheduler2 = __esm(() => {
|
|
|
128136
128627
|
});
|
|
128137
128628
|
|
|
128138
128629
|
// ../../packages/core/dist/services/pricing/models-dev-client.js
|
|
128139
|
-
import
|
|
128630
|
+
import fs14 from "fs/promises";
|
|
128140
128631
|
import { existsSync as existsSync4 } from "fs";
|
|
128141
|
-
import
|
|
128632
|
+
import path20 from "path";
|
|
128142
128633
|
function getModelsDevClient() {
|
|
128143
128634
|
if (!clientInstance) {
|
|
128144
128635
|
clientInstance = new ModelsDevClient;
|
|
@@ -128158,7 +128649,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
128158
128649
|
memoryCacheTimestamp = 0;
|
|
128159
128650
|
getLocalCachePath() {
|
|
128160
128651
|
const dataDir = config.get("dataDir");
|
|
128161
|
-
return
|
|
128652
|
+
return path20.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
|
|
128162
128653
|
}
|
|
128163
128654
|
async loadLocalCache() {
|
|
128164
128655
|
const cachePath = this.getLocalCachePath();
|
|
@@ -128166,7 +128657,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
128166
128657
|
if (!existsSync4(cachePath)) {
|
|
128167
128658
|
return null;
|
|
128168
128659
|
}
|
|
128169
|
-
const content = await
|
|
128660
|
+
const content = await fs14.readFile(cachePath, "utf-8");
|
|
128170
128661
|
const data = JSON.parse(content);
|
|
128171
128662
|
const age = Date.now() - data.timestamp;
|
|
128172
128663
|
if (age > ModelsDevClient.LOCAL_CACHE_TTL) {
|
|
@@ -128193,14 +128684,14 @@ var init_models_dev_client = __esm(() => {
|
|
|
128193
128684
|
async saveLocalCache(models) {
|
|
128194
128685
|
const cachePath = this.getLocalCachePath();
|
|
128195
128686
|
try {
|
|
128196
|
-
const dir =
|
|
128197
|
-
await
|
|
128687
|
+
const dir = path20.dirname(cachePath);
|
|
128688
|
+
await fs14.mkdir(dir, { recursive: true });
|
|
128198
128689
|
const data = {
|
|
128199
128690
|
timestamp: Date.now(),
|
|
128200
128691
|
version: "1.0.0",
|
|
128201
128692
|
models: Object.fromEntries(models)
|
|
128202
128693
|
};
|
|
128203
|
-
await
|
|
128694
|
+
await fs14.writeFile(cachePath, JSON.stringify(data), "utf-8");
|
|
128204
128695
|
logger.debug("Saved pricing to local cache", {
|
|
128205
128696
|
models: models.size,
|
|
128206
128697
|
path: cachePath
|
|
@@ -128529,7 +129020,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
128529
129020
|
const cachePath = this.getLocalCachePath();
|
|
128530
129021
|
try {
|
|
128531
129022
|
if (existsSync4(cachePath)) {
|
|
128532
|
-
await
|
|
129023
|
+
await fs14.unlink(cachePath);
|
|
128533
129024
|
logger.debug("Local pricing cache file deleted");
|
|
128534
129025
|
}
|
|
128535
129026
|
} catch (error51) {
|
|
@@ -129132,8 +129623,8 @@ function stripNul(content) {
|
|
|
129132
129623
|
}
|
|
129133
129624
|
|
|
129134
129625
|
// ../../packages/core/dist/services/etl/stages/discover.js
|
|
129135
|
-
import
|
|
129136
|
-
import
|
|
129626
|
+
import fs15 from "fs/promises";
|
|
129627
|
+
import path21 from "path";
|
|
129137
129628
|
import { createHash as createHash8 } from "crypto";
|
|
129138
129629
|
|
|
129139
129630
|
class DiscoverStage {
|
|
@@ -129159,7 +129650,7 @@ class DiscoverStage {
|
|
|
129159
129650
|
dot: false,
|
|
129160
129651
|
absolute: false
|
|
129161
129652
|
});
|
|
129162
|
-
relPaths = found.map((p) =>
|
|
129653
|
+
relPaths = found.map((p) => path21.isAbsolute(p) ? path21.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
|
|
129163
129654
|
}
|
|
129164
129655
|
if (ctx.resumeCursor?.path) {
|
|
129165
129656
|
const cursorPath = ctx.resumeCursor.path;
|
|
@@ -129218,10 +129709,10 @@ class DiscoverStage {
|
|
|
129218
129709
|
return discovered;
|
|
129219
129710
|
}
|
|
129220
129711
|
async processFile(ctx, relativePath, forceReindex) {
|
|
129221
|
-
const absolutePath =
|
|
129712
|
+
const absolutePath = path21.join(ctx.projectPath, relativePath);
|
|
129222
129713
|
try {
|
|
129223
|
-
const stat = await
|
|
129224
|
-
const content = stripNul(await
|
|
129714
|
+
const stat = await fs15.stat(absolutePath);
|
|
129715
|
+
const content = stripNul(await fs15.readFile(absolutePath, "utf-8"));
|
|
129225
129716
|
const contentHash = createHash8("sha256").update(content).digest("hex");
|
|
129226
129717
|
let needsReparse = forceReindex;
|
|
129227
129718
|
if (!forceReindex) {
|
|
@@ -129264,8 +129755,8 @@ class DiscoverStage {
|
|
|
129264
129755
|
ig.add(pattern);
|
|
129265
129756
|
}
|
|
129266
129757
|
try {
|
|
129267
|
-
const gitignorePath =
|
|
129268
|
-
const gitignoreContent = await
|
|
129758
|
+
const gitignorePath = path21.join(projectPath, ".gitignore");
|
|
129759
|
+
const gitignoreContent = await fs15.readFile(gitignorePath, "utf8");
|
|
129269
129760
|
const rules = gitignoreContent.split(`
|
|
129270
129761
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
129271
129762
|
ig.add(rules);
|
|
@@ -130620,8 +131111,8 @@ function rustUseLeaves(node, source, prefix = []) {
|
|
|
130620
131111
|
}
|
|
130621
131112
|
if (node.type === "use_wildcard")
|
|
130622
131113
|
return [{ path: [...prefix, "*"], glob: true }];
|
|
130623
|
-
const
|
|
130624
|
-
return
|
|
131114
|
+
const path22 = rustPathSegments(node, source);
|
|
131115
|
+
return path22.length ? [{ path: [...prefix, ...path22] }] : [];
|
|
130625
131116
|
}
|
|
130626
131117
|
function functionalCaptures(captures, source, family) {
|
|
130627
131118
|
if (family !== "clojure")
|
|
@@ -131593,8 +132084,8 @@ var init_structural_runtime = __esm(() => {
|
|
|
131593
132084
|
});
|
|
131594
132085
|
|
|
131595
132086
|
// ../../packages/core/dist/services/etl/stages/parse.js
|
|
131596
|
-
import
|
|
131597
|
-
import
|
|
132087
|
+
import path22 from "path";
|
|
132088
|
+
import fs16 from "fs/promises";
|
|
131598
132089
|
function resolveChunkerMaxChars() {
|
|
131599
132090
|
const global2 = Number(process.env.EMBEDDING_MAX_CHARS);
|
|
131600
132091
|
if (Number.isFinite(global2) && global2 > 0)
|
|
@@ -131622,8 +132113,8 @@ class ParseStage {
|
|
|
131622
132113
|
const results = new Map;
|
|
131623
132114
|
let processed = 0;
|
|
131624
132115
|
const phases = [
|
|
131625
|
-
files.filter((file2) =>
|
|
131626
|
-
files.filter((file2) =>
|
|
132116
|
+
files.filter((file2) => path22.extname(file2.relativePath).toLowerCase() !== ".h"),
|
|
132117
|
+
files.filter((file2) => path22.extname(file2.relativePath).toLowerCase() === ".h")
|
|
131627
132118
|
];
|
|
131628
132119
|
const batches = phases.flatMap((phase) => Array.from({ length: Math.ceil(phase.length / BATCH_SIZE) }, (_, index) => phase.slice(index * BATCH_SIZE, (index + 1) * BATCH_SIZE)));
|
|
131629
132120
|
for (const batch of batches) {
|
|
@@ -131661,19 +132152,19 @@ class ParseStage {
|
|
|
131661
132152
|
return files.map((file2) => results.get(file2.relativePath));
|
|
131662
132153
|
}
|
|
131663
132154
|
recordHeaderImporterEvidence(ctx, files, parsedFiles) {
|
|
131664
|
-
const knownHeaders = new Set(files.filter((file2) =>
|
|
132155
|
+
const knownHeaders = new Set(files.filter((file2) => path22.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path22.posix.normalize(file2.relativePath)));
|
|
131665
132156
|
const mutable = {
|
|
131666
132157
|
...ctx.structuralHeaderEvidenceByFile
|
|
131667
132158
|
};
|
|
131668
132159
|
for (const parsed of parsedFiles) {
|
|
131669
|
-
const extension =
|
|
132160
|
+
const extension = path22.extname(parsed.file.relativePath).toLowerCase();
|
|
131670
132161
|
const key = extension === ".c" ? "cImporters" : [".cpp", ".hpp"].includes(extension) ? "cppImporters" : undefined;
|
|
131671
132162
|
if (!key)
|
|
131672
132163
|
continue;
|
|
131673
132164
|
for (const imported of parsed.rawImports) {
|
|
131674
132165
|
if (!["c_include", "cpp_include"].includes(imported.form) || imported.specifier.startsWith("<"))
|
|
131675
132166
|
continue;
|
|
131676
|
-
const header =
|
|
132167
|
+
const header = path22.posix.normalize(path22.posix.join(path22.posix.dirname(parsed.file.relativePath), imported.specifier));
|
|
131677
132168
|
if (!knownHeaders.has(header))
|
|
131678
132169
|
continue;
|
|
131679
132170
|
const existing = mutable[header] ?? {};
|
|
@@ -131684,9 +132175,9 @@ class ParseStage {
|
|
|
131684
132175
|
}
|
|
131685
132176
|
async parseFile(ctx, file2) {
|
|
131686
132177
|
if (!file2.needsReparse) {
|
|
131687
|
-
const extension =
|
|
132178
|
+
const extension = path22.extname(file2.relativePath).toLowerCase();
|
|
131688
132179
|
if ([".c", ".cpp", ".hpp"].includes(extension)) {
|
|
131689
|
-
const content = file2.snapshotContent ?? await
|
|
132180
|
+
const content = file2.snapshotContent ?? await fs16.readFile(file2.absolutePath, "utf8");
|
|
131690
132181
|
const outcome = await this.runtime.parse({ extension, source: Buffer.from(content) });
|
|
131691
132182
|
if (outcome.status === "failed")
|
|
131692
132183
|
throw new StructuralEtlParseError(file2.relativePath, outcome.failureKind, `Structural evidence parse failed (${outcome.failureKind})`, outcome.diagnosticCount, outcome.diagnostics.slice(0, 10));
|
|
@@ -131698,8 +132189,8 @@ class ParseStage {
|
|
|
131698
132189
|
return { file: file2, chunks: [], symbols: [], rawImports: [], rawEdges: [] };
|
|
131699
132190
|
}
|
|
131700
132191
|
try {
|
|
131701
|
-
const content = file2.snapshotContent ?? await
|
|
131702
|
-
const ext2 =
|
|
132192
|
+
const content = file2.snapshotContent ?? await fs16.readFile(file2.absolutePath, "utf-8");
|
|
132193
|
+
const ext2 = path22.extname(file2.relativePath).toLowerCase();
|
|
131703
132194
|
const chunkerMaxChars = resolveChunkerMaxChars();
|
|
131704
132195
|
const chunks = smartChunk(content, file2.relativePath, chunkerMaxChars ? { maxChunkChars: chunkerMaxChars } : {});
|
|
131705
132196
|
let symbols;
|
|
@@ -132253,7 +132744,7 @@ var init_resolver = __esm(() => {
|
|
|
132253
132744
|
});
|
|
132254
132745
|
|
|
132255
132746
|
// ../../packages/core/dist/services/structural/resolvers/typescript.js
|
|
132256
|
-
import
|
|
132747
|
+
import path23 from "path";
|
|
132257
132748
|
function candidates(identities) {
|
|
132258
132749
|
return Object.freeze(identities.map((identity) => Object.freeze({
|
|
132259
132750
|
fqn: identity.fqn,
|
|
@@ -132348,7 +132839,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
132348
132839
|
const bases = /\.[cm]?jsx?$/u.test(base) ? [base.replace(/\.[cm]?jsx?$/u, ".ts"), base.replace(/\.[cm]?jsx?$/u, ".tsx"), base] : [base];
|
|
132349
132840
|
for (const candidateBase of bases)
|
|
132350
132841
|
for (const suffix of DIALECT_PROBES[dialect] ?? [""]) {
|
|
132351
|
-
const value =
|
|
132842
|
+
const value = path23.posix.normalize(`${candidateBase}${suffix}`);
|
|
132352
132843
|
if (!value.startsWith("../") && value !== ".." && known.has(value))
|
|
132353
132844
|
return value;
|
|
132354
132845
|
}
|
|
@@ -132357,7 +132848,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
132357
132848
|
function resolveStructuralSpecifier(specifier, fromFile, build, dialect = "typescript") {
|
|
132358
132849
|
const known = new Set(build.knownFiles.map(normalizeStructuralFile));
|
|
132359
132850
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
132360
|
-
return probe(
|
|
132851
|
+
return probe(path23.posix.join(path23.posix.dirname(fromFile), specifier), known, dialect);
|
|
132361
132852
|
}
|
|
132362
132853
|
const aliases = build.pathAliasesByFile?.[normalizeStructuralFile(fromFile)] ?? build.pathAliases ?? [];
|
|
132363
132854
|
for (const alias of aliases) {
|
|
@@ -132621,7 +133112,7 @@ var init_scripting2 = __esm(() => {
|
|
|
132621
133112
|
});
|
|
132622
133113
|
|
|
132623
133114
|
// ../../packages/core/dist/services/structural/resolvers/systems.js
|
|
132624
|
-
import
|
|
133115
|
+
import path24 from "path";
|
|
132625
133116
|
var DIALECTS, SYSTEMS_LANGUAGE_RESOLVER;
|
|
132626
133117
|
var init_systems2 = __esm(() => {
|
|
132627
133118
|
init_typescript2();
|
|
@@ -132640,7 +133131,7 @@ var init_systems2 = __esm(() => {
|
|
|
132640
133131
|
const bindings = item.bindings.map((binding) => binding.imported === "*" && binding.local === "*" && unresolvedTarget && !unresolvedTarget.qualifier ? { ...binding, imported: unresolvedTarget.name, local: unresolvedTarget.name } : binding);
|
|
132641
133132
|
if (item.specifier === "crate" || item.specifier.startsWith("crate/")) {
|
|
132642
133133
|
const crateRoot = file2.file.startsWith("src/") ? "src" : "";
|
|
132643
|
-
return { ...item, bindings, specifier: `./${
|
|
133134
|
+
return { ...item, bindings, specifier: `./${path24.posix.relative(path24.posix.dirname(file2.file), path24.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
|
|
132644
133135
|
}
|
|
132645
133136
|
if (item.specifier === "self" || item.specifier.startsWith("self/"))
|
|
132646
133137
|
return { ...item, bindings, specifier: `./${item.specifier.replace(/^self\/?/u, "")}` };
|
|
@@ -132738,8 +133229,8 @@ var init_data_document2 = __esm(() => {
|
|
|
132738
133229
|
});
|
|
132739
133230
|
|
|
132740
133231
|
// ../../packages/core/dist/services/etl/stages/resolve.js
|
|
132741
|
-
import
|
|
132742
|
-
import
|
|
133232
|
+
import path25 from "path";
|
|
133233
|
+
import fs17 from "fs";
|
|
132743
133234
|
|
|
132744
133235
|
class ResolveStage {
|
|
132745
133236
|
symbolRepository;
|
|
@@ -132763,7 +133254,7 @@ class ResolveStage {
|
|
|
132763
133254
|
const structuralDocuments = files.flatMap((file2) => {
|
|
132764
133255
|
if (!file2.structure)
|
|
132765
133256
|
return [];
|
|
132766
|
-
const language = resolveStructuralLanguage(
|
|
133257
|
+
const language = resolveStructuralLanguage(path25.extname(file2.file.relativePath));
|
|
132767
133258
|
if (language.status !== "supported")
|
|
132768
133259
|
throw new Error(`structural_manifest_missing:${file2.file.relativePath}`);
|
|
132769
133260
|
return [{
|
|
@@ -132775,13 +133266,13 @@ class ResolveStage {
|
|
|
132775
133266
|
}];
|
|
132776
133267
|
});
|
|
132777
133268
|
const currentStructuralFiles = new Set(structuralDocuments.map((document2) => document2.file));
|
|
132778
|
-
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
133269
|
+
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path25.extname(item.file.relativePath).toLowerCase())).map((item) => item.file.relativePath));
|
|
132779
133270
|
const pathAliasesByFile = Object.fromEntries([...knownRelPaths].map((file2) => [
|
|
132780
133271
|
file2,
|
|
132781
133272
|
this.structuralAliasesFor(file2, rootAliases, monorepoPackages)
|
|
132782
133273
|
]));
|
|
132783
133274
|
const buildMetadata = { knownFiles: [...knownRelPaths], pathAliasesByFile };
|
|
132784
|
-
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(
|
|
133275
|
+
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(path25.extname(definition.file_path).toLowerCase())).filter((definition) => knownRelPaths.has(definition.file_path) && skippedStructuralFiles.has(definition.file_path)).filter((definition) => !currentStructuralFiles.has(definition.file_path));
|
|
132785
133276
|
const seedIds = new Set;
|
|
132786
133277
|
for (const definition of seedRows) {
|
|
132787
133278
|
if (seedIds.has(definition.id))
|
|
@@ -132874,7 +133365,7 @@ class ResolveStage {
|
|
|
132874
133365
|
if (parsed.file !== definition.file_path) {
|
|
132875
133366
|
throw new Error(`structural_repository_seed_file_mismatch:${definition.id}`);
|
|
132876
133367
|
}
|
|
132877
|
-
const language = resolveStructuralLanguage(
|
|
133368
|
+
const language = resolveStructuralLanguage(path25.extname(definition.file_path));
|
|
132878
133369
|
if (language.status !== "supported")
|
|
132879
133370
|
throw new Error(`structural_repository_seed_language:${definition.id}`);
|
|
132880
133371
|
let identity;
|
|
@@ -132926,7 +133417,7 @@ class ResolveStage {
|
|
|
132926
133417
|
});
|
|
132927
133418
|
}
|
|
132928
133419
|
resolveFile(parsed, projectPath, knownRelPaths, rootAliases, monorepoPackages, symbolIndex, knownFqns) {
|
|
132929
|
-
const fromDir =
|
|
133420
|
+
const fromDir = path25.dirname(path25.join(projectPath, parsed.file.relativePath));
|
|
132930
133421
|
const packageAliases = this.getPackageAliases(parsed.file.relativePath, monorepoPackages);
|
|
132931
133422
|
const allAliases = [...packageAliases, ...rootAliases];
|
|
132932
133423
|
const resolvedImports = parsed.rawImports.map((raw2) => {
|
|
@@ -132997,7 +133488,7 @@ class ResolveStage {
|
|
|
132997
133488
|
index.set(def.name, `${def.file_path}#${def.name}`);
|
|
132998
133489
|
}
|
|
132999
133490
|
} catch (err) {
|
|
133000
|
-
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
133491
|
+
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path25.extname(file2.file.relativePath).toLowerCase()));
|
|
133001
133492
|
if (skippedStructural)
|
|
133002
133493
|
throw new Error("structural_repository_seed_failed", { cause: err });
|
|
133003
133494
|
logger.warn("buildSymbolIndex: repo seed failed, in-batch only", {
|
|
@@ -133021,7 +133512,7 @@ class ResolveStage {
|
|
|
133021
133512
|
}
|
|
133022
133513
|
resolveSpecifier(specifier, fromDir, projectPath, knownRelPaths, aliases) {
|
|
133023
133514
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
133024
|
-
const resolved = this.probeExtensions(
|
|
133515
|
+
const resolved = this.probeExtensions(path25.resolve(fromDir, specifier), projectPath, knownRelPaths);
|
|
133025
133516
|
return { resolvedPath: resolved, external: false };
|
|
133026
133517
|
}
|
|
133027
133518
|
for (const alias of aliases) {
|
|
@@ -133029,8 +133520,8 @@ class ResolveStage {
|
|
|
133029
133520
|
const suffix = specifier.slice(alias.prefix.length);
|
|
133030
133521
|
for (const target of alias.targets) {
|
|
133031
133522
|
const cleanTarget = target.replace(/\/\*$/, "");
|
|
133032
|
-
const basePath = alias.packagePath ?
|
|
133033
|
-
const absPath =
|
|
133523
|
+
const basePath = alias.packagePath ? path25.join(projectPath, alias.packagePath) : projectPath;
|
|
133524
|
+
const absPath = path25.join(basePath, cleanTarget + suffix);
|
|
133034
133525
|
const resolved = this.probeExtensions(absPath, projectPath, knownRelPaths);
|
|
133035
133526
|
if (resolved)
|
|
133036
133527
|
return { resolvedPath: resolved, external: false };
|
|
@@ -133046,7 +133537,7 @@ class ResolveStage {
|
|
|
133046
133537
|
...TS_EXTENSIONS.map((ext2) => absPath.replace(/\.[^.]+$/, ext2))
|
|
133047
133538
|
];
|
|
133048
133539
|
for (const candidate2 of candidates2) {
|
|
133049
|
-
const rel =
|
|
133540
|
+
const rel = path25.relative(projectPath, candidate2).replace(/\\/g, "/");
|
|
133050
133541
|
if (knownRelPaths.has(rel))
|
|
133051
133542
|
return rel;
|
|
133052
133543
|
}
|
|
@@ -133054,9 +133545,9 @@ class ResolveStage {
|
|
|
133054
133545
|
}
|
|
133055
133546
|
loadTsConfigPaths(projectPath, packageBase) {
|
|
133056
133547
|
const aliases = [];
|
|
133057
|
-
const tsconfigPath =
|
|
133548
|
+
const tsconfigPath = path25.join(projectPath, "tsconfig.json");
|
|
133058
133549
|
try {
|
|
133059
|
-
const raw2 =
|
|
133550
|
+
const raw2 = fs17.readFileSync(tsconfigPath, "utf-8");
|
|
133060
133551
|
const stripped = raw2.replace(/\/\/[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
133061
133552
|
const tsconfig = JSON.parse(stripped);
|
|
133062
133553
|
const paths = tsconfig?.compilerOptions?.paths ?? {};
|
|
@@ -133085,7 +133576,7 @@ class ResolveStage {
|
|
|
133085
133576
|
}
|
|
133086
133577
|
}
|
|
133087
133578
|
for (const packageRelPath of packagePaths) {
|
|
133088
|
-
const absPackagePath =
|
|
133579
|
+
const absPackagePath = path25.join(projectPath, packageRelPath);
|
|
133089
133580
|
const aliases = this.loadTsConfigPaths(absPackagePath, packageRelPath);
|
|
133090
133581
|
if (aliases.length > 0) {
|
|
133091
133582
|
packages.push({
|
|
@@ -133115,7 +133606,7 @@ class ResolveStage {
|
|
|
133115
133606
|
structuralAliasesFor(filePath, rootAliases, packages) {
|
|
133116
133607
|
return [...this.getPackageAliases(filePath, packages), ...rootAliases].map((alias) => ({
|
|
133117
133608
|
pattern: alias.prefix + (alias.targets.some((target) => target.includes("*")) ? "/*" : ""),
|
|
133118
|
-
targets: alias.targets.map((target) => alias.packagePath ?
|
|
133609
|
+
targets: alias.targets.map((target) => alias.packagePath ? path25.posix.join(alias.packagePath, target) : target)
|
|
133119
133610
|
}));
|
|
133120
133611
|
}
|
|
133121
133612
|
}
|
|
@@ -133179,7 +133670,7 @@ var init_with_deadlock_retry = __esm(() => {
|
|
|
133179
133670
|
});
|
|
133180
133671
|
|
|
133181
133672
|
// ../../packages/core/dist/services/etl/stages/load.js
|
|
133182
|
-
import
|
|
133673
|
+
import path26 from "path";
|
|
133183
133674
|
function formatDuration(ms) {
|
|
133184
133675
|
const totalSec = Math.max(0, Math.round(ms / 1000));
|
|
133185
133676
|
if (totalSec < 60)
|
|
@@ -133456,7 +133947,7 @@ class LoadStage {
|
|
|
133456
133947
|
const filePath = file2.file.relativePath;
|
|
133457
133948
|
const batch = buildSymbolPersistenceBatch(ctx.projectId, file2);
|
|
133458
133949
|
if (ctx.graphGenerationLease) {
|
|
133459
|
-
const manifest = getLanguageManifestEntry(
|
|
133950
|
+
const manifest = getLanguageManifestEntry(path26.extname(filePath));
|
|
133460
133951
|
const diagnostics2 = (file2.structuralDiagnostics ?? []).slice(0, 10).map((diagnostic2) => ({
|
|
133461
133952
|
code: diagnostic2.code,
|
|
133462
133953
|
severity: diagnostic2.severity,
|
|
@@ -133913,9 +134404,9 @@ var init_graph_generation_coordinator = __esm(() => {
|
|
|
133913
134404
|
// ../../packages/core/dist/services/etl/pipeline.js
|
|
133914
134405
|
import { createHash as createHash10 } from "crypto";
|
|
133915
134406
|
import { setTimeout as delay2 } from "timers/promises";
|
|
133916
|
-
import
|
|
134407
|
+
import path27 from "path";
|
|
133917
134408
|
function buildHeaderLanguageEvidence(files) {
|
|
133918
|
-
const headers = new Set(files.filter((file2) =>
|
|
134409
|
+
const headers = new Set(files.filter((file2) => path27.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path27.posix.normalize(file2.relativePath)));
|
|
133919
134410
|
const mutable = new Map;
|
|
133920
134411
|
const entry2 = (header) => {
|
|
133921
134412
|
let value = mutable.get(header);
|
|
@@ -133926,7 +134417,7 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
133926
134417
|
return value;
|
|
133927
134418
|
};
|
|
133928
134419
|
for (const file2 of files) {
|
|
133929
|
-
if (
|
|
134420
|
+
if (path27.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
|
|
133930
134421
|
continue;
|
|
133931
134422
|
let commands;
|
|
133932
134423
|
try {
|
|
@@ -133942,11 +134433,11 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
133942
134433
|
const record2 = command;
|
|
133943
134434
|
if (typeof record2.file !== "string")
|
|
133944
134435
|
continue;
|
|
133945
|
-
const projectRoot =
|
|
133946
|
-
const commandDirectory = typeof record2.directory === "string" ?
|
|
133947
|
-
const absoluteInput =
|
|
133948
|
-
const relative3 =
|
|
133949
|
-
const header =
|
|
134436
|
+
const projectRoot = path27.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
|
|
134437
|
+
const commandDirectory = typeof record2.directory === "string" ? path27.resolve(projectRoot, record2.directory) : projectRoot;
|
|
134438
|
+
const absoluteInput = path27.resolve(commandDirectory, record2.file);
|
|
134439
|
+
const relative3 = path27.relative(projectRoot, absoluteInput);
|
|
134440
|
+
const header = path27.posix.normalize(relative3.replaceAll(path27.sep, "/"));
|
|
133950
134441
|
if (!headers.has(header))
|
|
133951
134442
|
continue;
|
|
133952
134443
|
const invocation = typeof record2.command === "string" ? record2.command : Array.isArray(record2.arguments) ? record2.arguments.join(" ") : "";
|
|
@@ -139812,33 +140303,33 @@ var require_URL = __commonJS((exports, module) => {
|
|
|
139812
140303
|
else
|
|
139813
140304
|
return basepath.substring(0, lastslash + 1) + refpath;
|
|
139814
140305
|
}
|
|
139815
|
-
function remove_dot_segments(
|
|
139816
|
-
if (!
|
|
139817
|
-
return
|
|
140306
|
+
function remove_dot_segments(path28) {
|
|
140307
|
+
if (!path28)
|
|
140308
|
+
return path28;
|
|
139818
140309
|
var output = "";
|
|
139819
|
-
while (
|
|
139820
|
-
if (
|
|
139821
|
-
|
|
140310
|
+
while (path28.length > 0) {
|
|
140311
|
+
if (path28 === "." || path28 === "..") {
|
|
140312
|
+
path28 = "";
|
|
139822
140313
|
break;
|
|
139823
140314
|
}
|
|
139824
|
-
var twochars =
|
|
139825
|
-
var threechars =
|
|
139826
|
-
var fourchars =
|
|
140315
|
+
var twochars = path28.substring(0, 2);
|
|
140316
|
+
var threechars = path28.substring(0, 3);
|
|
140317
|
+
var fourchars = path28.substring(0, 4);
|
|
139827
140318
|
if (threechars === "../") {
|
|
139828
|
-
|
|
140319
|
+
path28 = path28.substring(3);
|
|
139829
140320
|
} else if (twochars === "./") {
|
|
139830
|
-
|
|
140321
|
+
path28 = path28.substring(2);
|
|
139831
140322
|
} else if (threechars === "/./") {
|
|
139832
|
-
|
|
139833
|
-
} else if (twochars === "/." &&
|
|
139834
|
-
|
|
139835
|
-
} else if (fourchars === "/../" || threechars === "/.." &&
|
|
139836
|
-
|
|
140323
|
+
path28 = "/" + path28.substring(3);
|
|
140324
|
+
} else if (twochars === "/." && path28.length === 2) {
|
|
140325
|
+
path28 = "/";
|
|
140326
|
+
} else if (fourchars === "/../" || threechars === "/.." && path28.length === 3) {
|
|
140327
|
+
path28 = "/" + path28.substring(4);
|
|
139837
140328
|
output = output.replace(/\/?[^\/]*$/, "");
|
|
139838
140329
|
} else {
|
|
139839
|
-
var segment =
|
|
140330
|
+
var segment = path28.match(/(\/?([^\/]*))/)[0];
|
|
139840
140331
|
output += segment;
|
|
139841
|
-
|
|
140332
|
+
path28 = path28.substring(segment.length);
|
|
139842
140333
|
}
|
|
139843
140334
|
}
|
|
139844
140335
|
return output;
|
|
@@ -151908,21 +152399,21 @@ function jsonToKeyPathChunks(value, label = "$") {
|
|
|
151908
152399
|
walk(value, label, out);
|
|
151909
152400
|
return out;
|
|
151910
152401
|
}
|
|
151911
|
-
function walk(val,
|
|
152402
|
+
function walk(val, path28, out) {
|
|
151912
152403
|
if (val === null || val === undefined)
|
|
151913
152404
|
return;
|
|
151914
152405
|
if (Array.isArray(val)) {
|
|
151915
152406
|
if (val.length === 0) {
|
|
151916
|
-
out.push({ path:
|
|
152407
|
+
out.push({ path: path28, content: `**${path28}** = _[]_` });
|
|
151917
152408
|
return;
|
|
151918
152409
|
}
|
|
151919
152410
|
if (val.every((v) => v !== null && typeof v === "object")) {
|
|
151920
|
-
val.forEach((v, i) => walk(v, `${
|
|
152411
|
+
val.forEach((v, i) => walk(v, `${path28}[${i}]`, out));
|
|
151921
152412
|
return;
|
|
151922
152413
|
}
|
|
151923
152414
|
const items = val.map((v) => `- \`${String(v)}\``).join(`
|
|
151924
152415
|
`);
|
|
151925
|
-
out.push({ path:
|
|
152416
|
+
out.push({ path: path28, content: `**${path28}**
|
|
151926
152417
|
|
|
151927
152418
|
${items}` });
|
|
151928
152419
|
return;
|
|
@@ -151930,16 +152421,16 @@ ${items}` });
|
|
|
151930
152421
|
if (typeof val === "object") {
|
|
151931
152422
|
const entries = Object.entries(val);
|
|
151932
152423
|
if (entries.length === 0) {
|
|
151933
|
-
out.push({ path:
|
|
152424
|
+
out.push({ path: path28, content: `**${path28}** = _{}_` });
|
|
151934
152425
|
return;
|
|
151935
152426
|
}
|
|
151936
152427
|
for (const [k, v] of entries) {
|
|
151937
152428
|
const safeKey = /^[A-Za-z_$][\w$]*$/.test(k) ? k : JSON.stringify(k);
|
|
151938
|
-
walk(v, `${
|
|
152429
|
+
walk(v, `${path28}.${safeKey}`, out);
|
|
151939
152430
|
}
|
|
151940
152431
|
return;
|
|
151941
152432
|
}
|
|
151942
|
-
out.push({ path:
|
|
152433
|
+
out.push({ path: path28, content: `**${path28}** = \`${String(val)}\`` });
|
|
151943
152434
|
}
|
|
151944
152435
|
var gfm, STRIP_SELECTORS, tdCache = null;
|
|
151945
152436
|
var init_html_to_md = __esm(() => {
|