@massa-ai/mcp-client 1.59.0 → 1.60.1
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 +657 -433
- package/dist/index.js +701 -477
- package/package.json +3 -3
package/dist/config-cli.js
CHANGED
|
@@ -505,13 +505,33 @@ var init_inference_providers = __esm(() => {
|
|
|
505
505
|
},
|
|
506
506
|
knownDimensions: {
|
|
507
507
|
"text-embedding-nomic-embed-text-v1.5": 768,
|
|
508
|
-
"text-embedding-qwen3-embedding-0.6b": 1024
|
|
508
|
+
"text-embedding-qwen3-embedding-0.6b": 1024,
|
|
509
|
+
"qwen3-embedding-0.6b-dwq": 1024
|
|
509
510
|
},
|
|
510
511
|
defaultModels: {
|
|
511
512
|
embedding: "text-embedding-qwen3-embedding-0.6b",
|
|
512
513
|
instruct: "qwen3-vl-8b-instruct",
|
|
513
514
|
coding: "qwen2.5-coder-7b-instruct"
|
|
514
515
|
},
|
|
516
|
+
mlxModels: {
|
|
517
|
+
embedding: {
|
|
518
|
+
repo: "mlx-community/Qwen3-Embedding-0.6B-4bit-DWQ",
|
|
519
|
+
model: "qwen3-embedding-0.6b-dwq"
|
|
520
|
+
},
|
|
521
|
+
instruct: {
|
|
522
|
+
repo: "mlx-community/Qwen3-VL-8B-Instruct-4bit",
|
|
523
|
+
model: "qwen3-vl-8b-instruct"
|
|
524
|
+
},
|
|
525
|
+
coding: {
|
|
526
|
+
repo: "mlx-community/Qwen2.5-Coder-7B-Instruct-4bit",
|
|
527
|
+
model: "qwen2.5-coder-7b-instruct"
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
ggufRepos: {
|
|
531
|
+
embedding: "Qwen/Qwen3-Embedding-0.6B-GGUF",
|
|
532
|
+
instruct: "lmstudio-community/Qwen3-VL-8B-Instruct-GGUF",
|
|
533
|
+
coding: "lmstudio-community/Qwen2.5-Coder-7B-Instruct-GGUF"
|
|
534
|
+
},
|
|
515
535
|
appliesContextPerRequest: false,
|
|
516
536
|
embedBatchSize: 64,
|
|
517
537
|
supportsOllamaVersionProbe: false,
|
|
@@ -2659,12 +2679,13 @@ function selectRecord(records) {
|
|
|
2659
2679
|
}
|
|
2660
2680
|
return best ?? pool[pool.length - 1];
|
|
2661
2681
|
}
|
|
2662
|
-
function
|
|
2682
|
+
function resolveClaudeMarketplaceInstall(opts = {}) {
|
|
2663
2683
|
const targetHome = opts.targetHome ?? os5.homedir();
|
|
2664
2684
|
const pluginKey = opts.pluginKey ?? DEFAULT_PLUGIN_KEY;
|
|
2665
2685
|
const directoryResult = resolveDirectorySourceRoot(targetHome, pluginKey);
|
|
2666
|
-
if (directoryResult !== undefined)
|
|
2667
|
-
return directoryResult;
|
|
2686
|
+
if (directoryResult !== undefined) {
|
|
2687
|
+
return directoryResult === null ? null : { root: directoryResult, route: "directory-source" };
|
|
2688
|
+
}
|
|
2668
2689
|
const registryPath = path9.join(targetHome, ".claude", "plugins", "installed_plugins.json");
|
|
2669
2690
|
let records;
|
|
2670
2691
|
try {
|
|
@@ -2686,15 +2707,197 @@ function resolveClaudeMarketplaceRoot(opts = {}) {
|
|
|
2686
2707
|
} catch {
|
|
2687
2708
|
return null;
|
|
2688
2709
|
}
|
|
2689
|
-
return installPath;
|
|
2710
|
+
return { root: installPath, route: "registry-cache" };
|
|
2711
|
+
}
|
|
2712
|
+
function resolveClaudeMarketplaceRoot(opts = {}) {
|
|
2713
|
+
return resolveClaudeMarketplaceInstall(opts)?.root ?? null;
|
|
2714
|
+
}
|
|
2715
|
+
function readInstalledPluginVersion(opts = {}) {
|
|
2716
|
+
const targetHome = opts.targetHome ?? os5.homedir();
|
|
2717
|
+
const pluginKey = opts.pluginKey ?? DEFAULT_PLUGIN_KEY;
|
|
2718
|
+
const registryPath = path9.join(targetHome, ".claude", "plugins", "installed_plugins.json");
|
|
2719
|
+
let records;
|
|
2720
|
+
try {
|
|
2721
|
+
const parsed = JSON.parse(fs5.readFileSync(registryPath, "utf8"));
|
|
2722
|
+
records = parsed?.plugins?.[pluginKey];
|
|
2723
|
+
} catch {
|
|
2724
|
+
return null;
|
|
2725
|
+
}
|
|
2726
|
+
if (!Array.isArray(records) || records.length === 0)
|
|
2727
|
+
return null;
|
|
2728
|
+
return selectRecord(records)?.version ?? null;
|
|
2690
2729
|
}
|
|
2691
2730
|
var DEFAULT_PLUGIN_KEY = "massa-ai@massa-ai";
|
|
2692
2731
|
var init_claude_marketplace = () => {};
|
|
2693
2732
|
|
|
2694
|
-
// ../../packages/shared/dist/profile-switch/
|
|
2733
|
+
// ../../packages/shared/dist/profile-switch/frontmatter.js
|
|
2734
|
+
function parseFrontmatter(raw2) {
|
|
2735
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/.exec(raw2);
|
|
2736
|
+
if (!match) {
|
|
2737
|
+
throw new Error("charter missing YAML frontmatter (--- ... ---) block");
|
|
2738
|
+
}
|
|
2739
|
+
const yamlText = match[1] ?? "";
|
|
2740
|
+
const body = (match[2] ?? "").replace(/^\r?\n/, "");
|
|
2741
|
+
const frontmatter = parseSimpleYaml(yamlText);
|
|
2742
|
+
return { frontmatter, body };
|
|
2743
|
+
}
|
|
2744
|
+
function parseSimpleYaml(text) {
|
|
2745
|
+
const result = {};
|
|
2746
|
+
const lines = text.split(/\r?\n/);
|
|
2747
|
+
let i = 0;
|
|
2748
|
+
while (i < lines.length) {
|
|
2749
|
+
const line = lines[i] ?? "";
|
|
2750
|
+
if (line.trim() === "" || line.trim().startsWith("#")) {
|
|
2751
|
+
i++;
|
|
2752
|
+
continue;
|
|
2753
|
+
}
|
|
2754
|
+
const m = /^([A-Za-z_][A-Za-z0-9_]*):\s*(.*)$/.exec(line);
|
|
2755
|
+
if (!m) {
|
|
2756
|
+
i++;
|
|
2757
|
+
continue;
|
|
2758
|
+
}
|
|
2759
|
+
const key = m[1];
|
|
2760
|
+
const rest = (m[2] ?? "").trim();
|
|
2761
|
+
if (rest !== "") {
|
|
2762
|
+
result[key] = unquoteScalar(rest);
|
|
2763
|
+
i++;
|
|
2764
|
+
continue;
|
|
2765
|
+
}
|
|
2766
|
+
const nested = {};
|
|
2767
|
+
i++;
|
|
2768
|
+
while (i < lines.length) {
|
|
2769
|
+
const nestedLine = lines[i] ?? "";
|
|
2770
|
+
if (/^\s{2,}\S/.test(nestedLine) === false)
|
|
2771
|
+
break;
|
|
2772
|
+
const nm = /^\s{2,}([A-Za-z_][A-Za-z0-9_]*):\s*(.*)$/.exec(nestedLine);
|
|
2773
|
+
if (!nm)
|
|
2774
|
+
break;
|
|
2775
|
+
nested[nm[1]] = unquoteScalar((nm[2] ?? "").trim());
|
|
2776
|
+
i++;
|
|
2777
|
+
}
|
|
2778
|
+
result[key] = nested;
|
|
2779
|
+
}
|
|
2780
|
+
return result;
|
|
2781
|
+
}
|
|
2782
|
+
function unquoteScalar(s) {
|
|
2783
|
+
if (s.startsWith('"') && s.endsWith('"') || s.startsWith("'") && s.endsWith("'")) {
|
|
2784
|
+
return s.slice(1, -1);
|
|
2785
|
+
}
|
|
2786
|
+
return s;
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
// ../../packages/shared/dist/profile-switch/doctor.js
|
|
2695
2790
|
import fs6 from "fs";
|
|
2696
|
-
import path10 from "path";
|
|
2697
2791
|
import os6 from "os";
|
|
2792
|
+
import path10 from "path";
|
|
2793
|
+
function readTextFile(filePath) {
|
|
2794
|
+
try {
|
|
2795
|
+
return fs6.readFileSync(filePath, "utf8");
|
|
2796
|
+
} catch {
|
|
2797
|
+
return null;
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
function readJsonFile(filePath) {
|
|
2801
|
+
const raw2 = readTextFile(filePath);
|
|
2802
|
+
if (raw2 === null)
|
|
2803
|
+
return null;
|
|
2804
|
+
try {
|
|
2805
|
+
return JSON.parse(raw2);
|
|
2806
|
+
} catch {
|
|
2807
|
+
return null;
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
function readPluginVersion(pluginRoot) {
|
|
2811
|
+
const manifest = readJsonFile(path10.join(pluginRoot, ".claude-plugin", "plugin.json"));
|
|
2812
|
+
return typeof manifest?.version === "string" ? manifest.version : null;
|
|
2813
|
+
}
|
|
2814
|
+
function detectEnvOverride(env) {
|
|
2815
|
+
for (const name of ENV_OVERRIDE_VARS) {
|
|
2816
|
+
const value = env[name];
|
|
2817
|
+
if (typeof value === "string" && value.trim()) {
|
|
2818
|
+
return { name, value: value.trim() };
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
return null;
|
|
2822
|
+
}
|
|
2823
|
+
function readRoles(liveRoot, activeProfile) {
|
|
2824
|
+
const agentsDir = path10.join(liveRoot, "agents");
|
|
2825
|
+
let entries;
|
|
2826
|
+
try {
|
|
2827
|
+
entries = fs6.readdirSync(agentsDir, { withFileTypes: true });
|
|
2828
|
+
} catch {
|
|
2829
|
+
return [];
|
|
2830
|
+
}
|
|
2831
|
+
const roles = [];
|
|
2832
|
+
for (const entry of entries) {
|
|
2833
|
+
if (!entry.isFile() || !entry.name.startsWith("massa-ai-") || !entry.name.endsWith(".md")) {
|
|
2834
|
+
continue;
|
|
2835
|
+
}
|
|
2836
|
+
const activeRaw = readTextFile(path10.join(agentsDir, entry.name));
|
|
2837
|
+
let model = null;
|
|
2838
|
+
let effort = null;
|
|
2839
|
+
if (activeRaw !== null) {
|
|
2840
|
+
try {
|
|
2841
|
+
const { frontmatter } = parseFrontmatter(activeRaw);
|
|
2842
|
+
model = typeof frontmatter.model === "string" ? frontmatter.model : null;
|
|
2843
|
+
effort = typeof frontmatter.effort === "string" ? frontmatter.effort : null;
|
|
2844
|
+
} catch {}
|
|
2845
|
+
}
|
|
2846
|
+
let staleVariant = false;
|
|
2847
|
+
if (activeProfile && activeRaw !== null) {
|
|
2848
|
+
const variantRaw = readTextFile(path10.join(liveRoot, "agent-profiles", activeProfile, entry.name));
|
|
2849
|
+
if (variantRaw !== null) {
|
|
2850
|
+
staleVariant = variantRaw !== activeRaw;
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
roles.push({ name: entry.name, model, effort, staleVariant });
|
|
2854
|
+
}
|
|
2855
|
+
return roles.sort((a, b) => a.name.localeCompare(b.name));
|
|
2856
|
+
}
|
|
2857
|
+
function runtimeDriftReport(opts = {}) {
|
|
2858
|
+
const targetHome = opts.targetHome ?? os6.homedir();
|
|
2859
|
+
const stateFilePath = opts.stateFilePath ?? path10.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
2860
|
+
let state = opts.state ?? null;
|
|
2861
|
+
if (state === null) {
|
|
2862
|
+
try {
|
|
2863
|
+
state = readInstallState(stateFilePath);
|
|
2864
|
+
} catch {
|
|
2865
|
+
state = null;
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
const platform = state?.platforms?.claude;
|
|
2869
|
+
const stateVersion = typeof platform?.plugin?.version === "string" ? platform.plugin.version : null;
|
|
2870
|
+
const activeProfile = platform?.modelProfile?.profile ?? null;
|
|
2871
|
+
const install = resolveClaudeMarketplaceInstall({ targetHome, pluginKey: opts.pluginKey });
|
|
2872
|
+
const liveRoot = install?.root ?? null;
|
|
2873
|
+
const sourceVersion = liveRoot === null ? null : readPluginVersion(liveRoot);
|
|
2874
|
+
const pinnedVersion = readInstalledPluginVersion({ targetHome, pluginKey: opts.pluginKey });
|
|
2875
|
+
const roles = liveRoot === null ? [] : readRoles(liveRoot, activeProfile);
|
|
2876
|
+
return {
|
|
2877
|
+
host: "claude",
|
|
2878
|
+
route: install?.route ?? "unresolved",
|
|
2879
|
+
liveRoot,
|
|
2880
|
+
sourceVersion,
|
|
2881
|
+
stateVersion,
|
|
2882
|
+
pinnedVersion,
|
|
2883
|
+
activeProfile,
|
|
2884
|
+
roles,
|
|
2885
|
+
envOverride: detectEnvOverride(opts.env ?? process.env),
|
|
2886
|
+
versionDrift: sourceVersion !== null && stateVersion !== null && sourceVersion !== stateVersion,
|
|
2887
|
+
profileMaterialized: roles.some((role) => role.staleVariant)
|
|
2888
|
+
};
|
|
2889
|
+
}
|
|
2890
|
+
var ENV_OVERRIDE_VARS;
|
|
2891
|
+
var init_doctor = __esm(() => {
|
|
2892
|
+
init_claude_marketplace();
|
|
2893
|
+
init_state();
|
|
2894
|
+
ENV_OVERRIDE_VARS = ["CLAUDE_CODE_SUBAGENT_MODEL"];
|
|
2895
|
+
});
|
|
2896
|
+
|
|
2897
|
+
// ../../packages/shared/dist/profile-switch/engine.js
|
|
2898
|
+
import fs7 from "fs";
|
|
2899
|
+
import path11 from "path";
|
|
2900
|
+
import os7 from "os";
|
|
2698
2901
|
import crypto4 from "crypto";
|
|
2699
2902
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
2700
2903
|
function namedError3(name, message) {
|
|
@@ -2703,10 +2906,10 @@ function namedError3(name, message) {
|
|
|
2703
2906
|
return err;
|
|
2704
2907
|
}
|
|
2705
2908
|
function defaultStatePath(targetHome) {
|
|
2706
|
-
return
|
|
2909
|
+
return path11.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
2707
2910
|
}
|
|
2708
2911
|
function resolveCommon(opts) {
|
|
2709
|
-
const targetHome = opts.targetHome ??
|
|
2912
|
+
const targetHome = opts.targetHome ?? os7.homedir();
|
|
2710
2913
|
const stateFilePath = opts.stateFilePath ?? defaultStatePath(targetHome);
|
|
2711
2914
|
return { targetHome, stateFilePath };
|
|
2712
2915
|
}
|
|
@@ -2714,7 +2917,7 @@ function marketplaceRoots(targetHome, state) {
|
|
|
2714
2917
|
return state.platforms.claude?.installRoute === "marketplace" ? { claude: resolveClaudeMarketplaceRoot({ targetHome }) ?? undefined } : {};
|
|
2715
2918
|
}
|
|
2716
2919
|
function claudeMarketplaceUnresolvedReason(targetHome) {
|
|
2717
|
-
const registryPath =
|
|
2920
|
+
const registryPath = path11.join(targetHome, ".claude", "plugins", "installed_plugins.json");
|
|
2718
2921
|
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";
|
|
2719
2922
|
}
|
|
2720
2923
|
function listProfiles(opts = {}) {
|
|
@@ -2722,6 +2925,12 @@ function listProfiles(opts = {}) {
|
|
|
2722
2925
|
const state = readInstallState(stateFilePath);
|
|
2723
2926
|
const roots = marketplaceRoots(targetHome, state);
|
|
2724
2927
|
const universe = opts.hosts ?? HOSTS;
|
|
2928
|
+
const claudeDrift = universe.includes("claude") ? runtimeDriftReport({ targetHome, stateFilePath, state, env: opts.env }) : null;
|
|
2929
|
+
const claudeDriftFields = (host) => host === "claude" && claudeDrift !== null ? {
|
|
2930
|
+
liveRoot: claudeDrift.liveRoot,
|
|
2931
|
+
sourceVersion: claudeDrift.sourceVersion,
|
|
2932
|
+
envOverride: claudeDrift.envOverride ? `${claudeDrift.envOverride.name}=${claudeDrift.envOverride.value}` : null
|
|
2933
|
+
} : { liveRoot: null, sourceVersion: null, envOverride: null };
|
|
2725
2934
|
const hosts = universe.map((host) => {
|
|
2726
2935
|
if (host === "claude" && state.platforms.claude?.installRoute === "marketplace" && roots.claude === undefined) {
|
|
2727
2936
|
const platform2 = state.platforms.claude;
|
|
@@ -2732,7 +2941,8 @@ function listProfiles(opts = {}) {
|
|
|
2732
2941
|
skipReason: null,
|
|
2733
2942
|
activeProfile: platform2.modelProfile?.profile ?? opts.hostDefaults?.[host] ?? "balanced",
|
|
2734
2943
|
bundleVersion: platform2.plugin?.version ?? null,
|
|
2735
|
-
availableProfiles: []
|
|
2944
|
+
availableProfiles: [],
|
|
2945
|
+
...claudeDriftFields(host)
|
|
2736
2946
|
};
|
|
2737
2947
|
}
|
|
2738
2948
|
const layout = resolveHostLayout(host, { targetHome, projectRoot: opts.projectRoot, marketplaceRoot: roots });
|
|
@@ -2744,10 +2954,11 @@ function listProfiles(opts = {}) {
|
|
|
2744
2954
|
skipReason: layout.reason,
|
|
2745
2955
|
activeProfile: null,
|
|
2746
2956
|
bundleVersion: null,
|
|
2747
|
-
availableProfiles: []
|
|
2957
|
+
availableProfiles: [],
|
|
2958
|
+
...claudeDriftFields(host)
|
|
2748
2959
|
};
|
|
2749
2960
|
}
|
|
2750
|
-
const installed =
|
|
2961
|
+
const installed = fs7.existsSync(layout.activeDir);
|
|
2751
2962
|
const availableProfiles = listVariantProfiles(layout);
|
|
2752
2963
|
const platform = state.platforms[host];
|
|
2753
2964
|
return {
|
|
@@ -2757,15 +2968,16 @@ function listProfiles(opts = {}) {
|
|
|
2757
2968
|
skipReason: null,
|
|
2758
2969
|
activeProfile: platform?.modelProfile?.profile ?? opts.hostDefaults?.[host] ?? "balanced",
|
|
2759
2970
|
bundleVersion: platform?.plugin?.version ?? null,
|
|
2760
|
-
availableProfiles
|
|
2971
|
+
availableProfiles,
|
|
2972
|
+
...claudeDriftFields(host)
|
|
2761
2973
|
};
|
|
2762
2974
|
});
|
|
2763
2975
|
return { hosts };
|
|
2764
2976
|
}
|
|
2765
2977
|
function listVariantProfiles(layout) {
|
|
2766
|
-
if (!
|
|
2978
|
+
if (!fs7.existsSync(layout.variantsRoot))
|
|
2767
2979
|
return [];
|
|
2768
|
-
return
|
|
2980
|
+
return fs7.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
2769
2981
|
}
|
|
2770
2982
|
function matchesGlob(filename, glob) {
|
|
2771
2983
|
const starIdx = glob.indexOf("*");
|
|
@@ -2776,7 +2988,7 @@ function matchesGlob(filename, glob) {
|
|
|
2776
2988
|
return filename.length >= prefix.length + suffix.length && filename.startsWith(prefix) && filename.endsWith(suffix);
|
|
2777
2989
|
}
|
|
2778
2990
|
function matchingFileNames(dir, glob) {
|
|
2779
|
-
return
|
|
2991
|
+
return fs7.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && matchesGlob(e.name, glob)).map((e) => e.name);
|
|
2780
2992
|
}
|
|
2781
2993
|
function detectGitAvailability(dir) {
|
|
2782
2994
|
try {
|
|
@@ -2802,7 +3014,7 @@ function gitTrackedFileNames(dir, filenames) {
|
|
|
2802
3014
|
}
|
|
2803
3015
|
}
|
|
2804
3016
|
function checkTrackedPathGuard(activeDir, filenames) {
|
|
2805
|
-
if (filenames.length === 0 || !
|
|
3017
|
+
if (filenames.length === 0 || !fs7.existsSync(activeDir))
|
|
2806
3018
|
return GUARD_PASS;
|
|
2807
3019
|
const availability = detectGitAvailability(activeDir);
|
|
2808
3020
|
if (availability === "no-git")
|
|
@@ -2813,53 +3025,53 @@ function checkTrackedPathGuard(activeDir, filenames) {
|
|
|
2813
3025
|
if (tracked.size === 0)
|
|
2814
3026
|
return GUARD_PASS;
|
|
2815
3027
|
const offending = filenames.find((name) => tracked.has(name));
|
|
2816
|
-
return { blocked: true, path:
|
|
3028
|
+
return { blocked: true, path: path11.join(activeDir, offending), unchecked: false };
|
|
2817
3029
|
}
|
|
2818
3030
|
function assertStateWritable(stateFilePath) {
|
|
2819
|
-
const dir =
|
|
3031
|
+
const dir = path11.dirname(stateFilePath);
|
|
2820
3032
|
try {
|
|
2821
|
-
|
|
3033
|
+
fs7.mkdirSync(dir, { recursive: true });
|
|
2822
3034
|
} catch (err) {
|
|
2823
3035
|
throw UnwritableInstallStateError(stateFilePath, err.message);
|
|
2824
3036
|
}
|
|
2825
|
-
const checkPath =
|
|
3037
|
+
const checkPath = fs7.existsSync(stateFilePath) ? stateFilePath : dir;
|
|
2826
3038
|
try {
|
|
2827
|
-
|
|
3039
|
+
fs7.accessSync(checkPath, fs7.constants.W_OK);
|
|
2828
3040
|
} catch (err) {
|
|
2829
3041
|
throw UnwritableInstallStateError(stateFilePath, err.message);
|
|
2830
3042
|
}
|
|
2831
3043
|
}
|
|
2832
3044
|
function copyFileRouteVariant(layout, variantDir) {
|
|
2833
|
-
|
|
3045
|
+
fs7.mkdirSync(layout.activeDir, { recursive: true });
|
|
2834
3046
|
let changed = 0;
|
|
2835
|
-
for (const entry of
|
|
3047
|
+
for (const entry of fs7.readdirSync(variantDir, { withFileTypes: true })) {
|
|
2836
3048
|
if (!entry.isFile() || !matchesGlob(entry.name, layout.activeGlob))
|
|
2837
3049
|
continue;
|
|
2838
|
-
|
|
3050
|
+
fs7.copyFileSync(path11.join(variantDir, entry.name), path11.join(layout.activeDir, entry.name));
|
|
2839
3051
|
changed++;
|
|
2840
3052
|
}
|
|
2841
3053
|
return changed;
|
|
2842
3054
|
}
|
|
2843
3055
|
function repointOpencodeVariant(layout, variantDir) {
|
|
2844
|
-
|
|
3056
|
+
fs7.mkdirSync(layout.activeDir, { recursive: true });
|
|
2845
3057
|
let changed = 0;
|
|
2846
|
-
for (const entry of
|
|
3058
|
+
for (const entry of fs7.readdirSync(variantDir, { withFileTypes: true })) {
|
|
2847
3059
|
if (!entry.isFile() || !matchesGlob(entry.name, layout.activeGlob))
|
|
2848
3060
|
continue;
|
|
2849
|
-
const dest =
|
|
2850
|
-
const target =
|
|
3061
|
+
const dest = path11.join(layout.activeDir, entry.name);
|
|
3062
|
+
const target = path11.resolve(path11.join(variantDir, entry.name));
|
|
2851
3063
|
let destExists = true;
|
|
2852
3064
|
let destIsSymlink = false;
|
|
2853
3065
|
try {
|
|
2854
|
-
destIsSymlink =
|
|
3066
|
+
destIsSymlink = fs7.lstatSync(dest).isSymbolicLink();
|
|
2855
3067
|
} catch {
|
|
2856
3068
|
destExists = false;
|
|
2857
3069
|
}
|
|
2858
3070
|
if (destExists && !destIsSymlink)
|
|
2859
3071
|
continue;
|
|
2860
3072
|
const tmp = `${dest}.massa-ai-switch.${crypto4.randomUUID()}`;
|
|
2861
|
-
|
|
2862
|
-
|
|
3073
|
+
fs7.symlinkSync(target, tmp);
|
|
3074
|
+
fs7.renameSync(tmp, dest);
|
|
2863
3075
|
changed++;
|
|
2864
3076
|
}
|
|
2865
3077
|
return changed;
|
|
@@ -2899,13 +3111,13 @@ function switchProfile(opts) {
|
|
|
2899
3111
|
if (fileHosts.length === 0) {
|
|
2900
3112
|
return { profile: opts.profile, dryRun, hosts: orderRows(universe, skipRows), restartRequired: false };
|
|
2901
3113
|
}
|
|
2902
|
-
const installedFileHosts = fileHosts.filter((h) =>
|
|
3114
|
+
const installedFileHosts = fileHosts.filter((h) => fs7.existsSync(h.layout.activeDir));
|
|
2903
3115
|
if (installedFileHosts.length === 0)
|
|
2904
3116
|
throw NoHostsDetectedError();
|
|
2905
3117
|
const withAvailability = fileHosts.map((h) => {
|
|
2906
|
-
const variantsRootExists =
|
|
3118
|
+
const variantsRootExists = fs7.existsSync(h.layout.variantsRoot);
|
|
2907
3119
|
const variantDir = h.layout.variantDir(opts.profile);
|
|
2908
|
-
const available = variantsRootExists &&
|
|
3120
|
+
const available = variantsRootExists && fs7.existsSync(variantDir) && fs7.statSync(variantDir).isDirectory();
|
|
2909
3121
|
return { ...h, variantsRootExists, variantDir, available };
|
|
2910
3122
|
});
|
|
2911
3123
|
if (!withAvailability.some((h) => h.available)) {
|
|
@@ -2941,7 +3153,7 @@ function switchProfile(opts) {
|
|
|
2941
3153
|
continue;
|
|
2942
3154
|
}
|
|
2943
3155
|
if (dryRun) {
|
|
2944
|
-
rows.push({ host: h.host, status: "
|
|
3156
|
+
rows.push({ host: h.host, status: "would-switch" });
|
|
2945
3157
|
continue;
|
|
2946
3158
|
}
|
|
2947
3159
|
const candidateNames = matchingFileNames(h.variantDir, h.layout.activeGlob);
|
|
@@ -2986,6 +3198,7 @@ var init_engine = __esm(() => {
|
|
|
2986
3198
|
init_state();
|
|
2987
3199
|
init_lock();
|
|
2988
3200
|
init_claude_marketplace();
|
|
3201
|
+
init_doctor();
|
|
2989
3202
|
SwitchEngineError = class SwitchEngineError extends Error {
|
|
2990
3203
|
constructor(message) {
|
|
2991
3204
|
super(message);
|
|
@@ -2998,29 +3211,29 @@ var init_engine = __esm(() => {
|
|
|
2998
3211
|
|
|
2999
3212
|
// ../../packages/shared/dist/profile-switch/report.js
|
|
3000
3213
|
function reportSucceeded(report) {
|
|
3001
|
-
return report.hosts.every((h) => h.status === "switched" || h.status === "skipped");
|
|
3214
|
+
return report.hosts.every((h) => h.status === "switched" || h.status === "would-switch" || h.status === "skipped");
|
|
3002
3215
|
}
|
|
3003
3216
|
|
|
3004
3217
|
// ../../packages/shared/dist/profile-switch/variant-sync.js
|
|
3005
|
-
import
|
|
3006
|
-
import
|
|
3007
|
-
import
|
|
3218
|
+
import fs8 from "fs";
|
|
3219
|
+
import path12 from "path";
|
|
3220
|
+
import os8 from "os";
|
|
3008
3221
|
import crypto5 from "crypto";
|
|
3009
3222
|
function defaultStatePath2(targetHome) {
|
|
3010
|
-
return
|
|
3223
|
+
return path12.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
3011
3224
|
}
|
|
3012
3225
|
function marketplaceRoots2(targetHome, state) {
|
|
3013
3226
|
return state.platforms.claude?.installRoute === "marketplace" ? { claude: resolveClaudeMarketplaceRoot({ targetHome }) ?? undefined } : {};
|
|
3014
3227
|
}
|
|
3015
3228
|
function writeFileIntoDirAtomically(destDir, destName, content) {
|
|
3016
3229
|
const unique = `${process.pid}.${++tempFileCounter2}.${crypto5.randomBytes(6).toString("hex")}`;
|
|
3017
|
-
const tempFile =
|
|
3230
|
+
const tempFile = path12.join(destDir, `.${destName}.${unique}.tmp`);
|
|
3018
3231
|
try {
|
|
3019
|
-
|
|
3020
|
-
|
|
3232
|
+
fs8.writeFileSync(tempFile, content);
|
|
3233
|
+
fs8.renameSync(tempFile, path12.join(destDir, destName));
|
|
3021
3234
|
} catch (error) {
|
|
3022
3235
|
try {
|
|
3023
|
-
|
|
3236
|
+
fs8.unlinkSync(tempFile);
|
|
3024
3237
|
} catch {}
|
|
3025
3238
|
throw error;
|
|
3026
3239
|
}
|
|
@@ -3028,20 +3241,20 @@ function writeFileIntoDirAtomically(destDir, destName, content) {
|
|
|
3028
3241
|
function isSafeDirName(name) {
|
|
3029
3242
|
if (name === "." || name === "..")
|
|
3030
3243
|
return false;
|
|
3031
|
-
if (name.includes("/") || name.includes("\\") || name.includes(
|
|
3244
|
+
if (name.includes("/") || name.includes("\\") || name.includes(path12.sep))
|
|
3032
3245
|
return false;
|
|
3033
|
-
return
|
|
3246
|
+
return path12.basename(name) === name;
|
|
3034
3247
|
}
|
|
3035
3248
|
function syncHost(host, sourceRoot, targetHome, marketplaceRoot) {
|
|
3036
3249
|
const layout = resolveHostLayout(host, { targetHome, marketplaceRoot });
|
|
3037
3250
|
if (layout.route === "skip") {
|
|
3038
3251
|
return { host, status: "skipped", profiles: [], retained: [], files: 0, reason: layout.reason };
|
|
3039
3252
|
}
|
|
3040
|
-
const srcDir =
|
|
3041
|
-
if (!
|
|
3253
|
+
const srcDir = path12.join(sourceRoot, "apps", `${host}-plugin`, "agent-profiles");
|
|
3254
|
+
if (!fs8.existsSync(srcDir) || !fs8.statSync(srcDir).isDirectory()) {
|
|
3042
3255
|
return { host, status: "skipped", profiles: [], retained: [], files: 0, reason: "no generated variants for this host" };
|
|
3043
3256
|
}
|
|
3044
|
-
if (!
|
|
3257
|
+
if (!fs8.existsSync(layout.variantsRoot)) {
|
|
3045
3258
|
return {
|
|
3046
3259
|
host,
|
|
3047
3260
|
status: "skipped",
|
|
@@ -3053,24 +3266,24 @@ function syncHost(host, sourceRoot, targetHome, marketplaceRoot) {
|
|
|
3053
3266
|
}
|
|
3054
3267
|
const profiles = [];
|
|
3055
3268
|
let files = 0;
|
|
3056
|
-
for (const entry of
|
|
3269
|
+
for (const entry of fs8.readdirSync(srcDir, { withFileTypes: true })) {
|
|
3057
3270
|
if (!entry.isDirectory())
|
|
3058
3271
|
continue;
|
|
3059
3272
|
if (!isSafeDirName(entry.name))
|
|
3060
3273
|
continue;
|
|
3061
|
-
const srcProfileDir =
|
|
3062
|
-
const destProfileDir =
|
|
3063
|
-
|
|
3064
|
-
for (const fileEntry of
|
|
3274
|
+
const srcProfileDir = path12.join(srcDir, entry.name);
|
|
3275
|
+
const destProfileDir = path12.join(layout.variantsRoot, entry.name);
|
|
3276
|
+
fs8.mkdirSync(destProfileDir, { recursive: true });
|
|
3277
|
+
for (const fileEntry of fs8.readdirSync(srcProfileDir, { withFileTypes: true })) {
|
|
3065
3278
|
if (!fileEntry.isFile())
|
|
3066
3279
|
continue;
|
|
3067
|
-
const content =
|
|
3280
|
+
const content = fs8.readFileSync(path12.join(srcProfileDir, fileEntry.name));
|
|
3068
3281
|
writeFileIntoDirAtomically(destProfileDir, fileEntry.name, content);
|
|
3069
3282
|
files++;
|
|
3070
3283
|
}
|
|
3071
3284
|
profiles.push(entry.name);
|
|
3072
3285
|
}
|
|
3073
|
-
const retained =
|
|
3286
|
+
const retained = fs8.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory() && !profiles.includes(e.name)).map((e) => e.name).sort();
|
|
3074
3287
|
return { host, status: "synced", profiles: profiles.sort(), retained, files };
|
|
3075
3288
|
}
|
|
3076
3289
|
function syncGeneratedVariants(opts) {
|
|
@@ -3086,7 +3299,7 @@ function syncGeneratedVariants(opts) {
|
|
|
3086
3299
|
}));
|
|
3087
3300
|
}
|
|
3088
3301
|
const sourceRoot = opts.sourceRoot;
|
|
3089
|
-
const targetHome = opts.targetHome ??
|
|
3302
|
+
const targetHome = opts.targetHome ?? os8.homedir();
|
|
3090
3303
|
const state = readInstallState(defaultStatePath2(targetHome));
|
|
3091
3304
|
const roots = marketplaceRoots2(targetHome, state);
|
|
3092
3305
|
return hosts.map((host) => {
|
|
@@ -3105,14 +3318,14 @@ var init_variant_sync = __esm(() => {
|
|
|
3105
3318
|
});
|
|
3106
3319
|
|
|
3107
3320
|
// ../../packages/shared/dist/profile-switch/repo-root.js
|
|
3108
|
-
import
|
|
3109
|
-
import
|
|
3321
|
+
import fs9 from "fs";
|
|
3322
|
+
import path13 from "path";
|
|
3110
3323
|
function findRepoRootWithMarker(startDir, marker, maxLevels) {
|
|
3111
3324
|
let dir = startDir;
|
|
3112
3325
|
for (let i = 0;i <= maxLevels; i++) {
|
|
3113
|
-
if (
|
|
3326
|
+
if (fs9.existsSync(path13.join(dir, marker)))
|
|
3114
3327
|
return dir;
|
|
3115
|
-
const parent =
|
|
3328
|
+
const parent = path13.dirname(dir);
|
|
3116
3329
|
if (parent === dir)
|
|
3117
3330
|
break;
|
|
3118
3331
|
dir = parent;
|
|
@@ -3210,7 +3423,7 @@ var init_rules = __esm(() => {
|
|
|
3210
3423
|
});
|
|
3211
3424
|
|
|
3212
3425
|
// ../../packages/shared/dist/bootstrap/state.js
|
|
3213
|
-
import
|
|
3426
|
+
import fs10 from "fs";
|
|
3214
3427
|
function isPlainObject2(value) {
|
|
3215
3428
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3216
3429
|
}
|
|
@@ -3241,7 +3454,7 @@ function resolveBootstrapState(doc) {
|
|
|
3241
3454
|
}
|
|
3242
3455
|
function readConfigBytes() {
|
|
3243
3456
|
try {
|
|
3244
|
-
return
|
|
3457
|
+
return fs10.readFileSync(getConfigPath(), "utf-8");
|
|
3245
3458
|
} catch (error) {
|
|
3246
3459
|
if (error?.code === "ENOENT")
|
|
3247
3460
|
return "";
|
|
@@ -3296,7 +3509,7 @@ var init_state2 = __esm(() => {
|
|
|
3296
3509
|
});
|
|
3297
3510
|
|
|
3298
3511
|
// ../../packages/shared/dist/bootstrap/render.js
|
|
3299
|
-
import
|
|
3512
|
+
import path14 from "path";
|
|
3300
3513
|
function wrapBootstrapBlock(body) {
|
|
3301
3514
|
return `${BOOTSTRAP_BLOCK_START}
|
|
3302
3515
|
${body.replace(/\n+$/, "")}
|
|
@@ -3309,19 +3522,19 @@ function ruleMarker(id, suffix) {
|
|
|
3309
3522
|
function resolveHostRoot(host, targetHome, hostRoot) {
|
|
3310
3523
|
requireAbsoluteTargetHome(targetHome);
|
|
3311
3524
|
if (hostRoot === undefined)
|
|
3312
|
-
return
|
|
3313
|
-
const relative =
|
|
3314
|
-
if (!
|
|
3525
|
+
return path14.join(targetHome, ...HOST_CONFIG_DIR[host]);
|
|
3526
|
+
const relative = path14.relative(targetHome, hostRoot);
|
|
3527
|
+
if (!path14.isAbsolute(hostRoot) || relative === "" || relative.startsWith("..") || path14.isAbsolute(relative)) {
|
|
3315
3528
|
throw new BootstrapRenderError("HostRootOutsideTargetHomeError", `hostRoot must be an absolute directory inside targetHome, got "${hostRoot}" for targetHome "${targetHome}"`, [hostRoot, targetHome]);
|
|
3316
3529
|
}
|
|
3317
3530
|
return hostRoot;
|
|
3318
3531
|
}
|
|
3319
3532
|
function bootstrapContractPath(host, targetHome, hostRoot) {
|
|
3320
|
-
return
|
|
3533
|
+
return path14.join(resolveHostRoot(host, targetHome, hostRoot), CONTRACT_FILENAME);
|
|
3321
3534
|
}
|
|
3322
3535
|
function bootstrapStateFilePath(targetHome) {
|
|
3323
3536
|
requireAbsoluteTargetHome(targetHome);
|
|
3324
|
-
return
|
|
3537
|
+
return path14.join(targetHome, ".config", "massa-ai", "config.json");
|
|
3325
3538
|
}
|
|
3326
3539
|
function renderBootstrap(options) {
|
|
3327
3540
|
const { source, state, host, targetHome, hostRoot } = options;
|
|
@@ -3344,7 +3557,7 @@ ${body}`;
|
|
|
3344
3557
|
return { contract, pointer };
|
|
3345
3558
|
}
|
|
3346
3559
|
function requireAbsoluteTargetHome(targetHome) {
|
|
3347
|
-
if (!
|
|
3560
|
+
if (!path14.isAbsolute(targetHome)) {
|
|
3348
3561
|
throw new BootstrapRenderError("TargetHomeNotAbsoluteError", `targetHome must be an absolute path, got "${targetHome}"`, [targetHome]);
|
|
3349
3562
|
}
|
|
3350
3563
|
}
|
|
@@ -3521,14 +3734,14 @@ var init_report = __esm(() => {
|
|
|
3521
3734
|
});
|
|
3522
3735
|
|
|
3523
3736
|
// ../../packages/shared/dist/bootstrap/engine.js
|
|
3524
|
-
import
|
|
3525
|
-
import
|
|
3737
|
+
import fs11 from "fs";
|
|
3738
|
+
import path15 from "path";
|
|
3526
3739
|
function applyBootstrapState(options) {
|
|
3527
3740
|
const { targetHome } = options;
|
|
3528
3741
|
const dryRun = options.dryRun ?? false;
|
|
3529
3742
|
const warn = options.onWarning ?? ((message) => console.warn(message));
|
|
3530
3743
|
const configPath = bootstrapStateFilePath(targetHome);
|
|
3531
|
-
const installStatePath =
|
|
3744
|
+
const installStatePath = path15.join(path15.dirname(configPath), INSTALL_STATE_FILENAME);
|
|
3532
3745
|
const { platforms } = readInstallState(installStatePath);
|
|
3533
3746
|
const installed = HOSTS.filter((host) => platforms[host] !== undefined);
|
|
3534
3747
|
if (installed.length === 0) {
|
|
@@ -3621,22 +3834,22 @@ function applyHost(input) {
|
|
|
3621
3834
|
}
|
|
3622
3835
|
function wiringArtifact(host, targetHome, hostRoot) {
|
|
3623
3836
|
const root = resolveHostRoot(host, targetHome, hostRoot);
|
|
3624
|
-
const contractPath =
|
|
3837
|
+
const contractPath = path15.join(root, CONTRACT_FILENAME);
|
|
3625
3838
|
switch (host) {
|
|
3626
3839
|
case "claude":
|
|
3627
|
-
return { file:
|
|
3840
|
+
return { file: path15.join(root, "CLAUDE.md"), token: `@${CONTRACT_FILENAME}` };
|
|
3628
3841
|
case "codex":
|
|
3629
3842
|
case "cursor":
|
|
3630
|
-
return { file:
|
|
3843
|
+
return { file: path15.join(root, "AGENTS.md"), token: contractPath };
|
|
3631
3844
|
case "opencode":
|
|
3632
3845
|
return { file: openCodeConfigPath(root), token: `"${contractPath}"` };
|
|
3633
3846
|
}
|
|
3634
3847
|
}
|
|
3635
3848
|
function openCodeConfigPath(root) {
|
|
3636
|
-
const json =
|
|
3637
|
-
if (
|
|
3849
|
+
const json = path15.join(root, "opencode.json");
|
|
3850
|
+
if (fs11.existsSync(json))
|
|
3638
3851
|
return json;
|
|
3639
|
-
return
|
|
3852
|
+
return path15.join(root, "opencode.jsonc");
|
|
3640
3853
|
}
|
|
3641
3854
|
function isWired(host, targetHome, hostRoot) {
|
|
3642
3855
|
const artifact = wiringArtifact(host, targetHome, hostRoot);
|
|
@@ -3649,7 +3862,7 @@ function notWiredReason(host, targetHome, hostRoot) {
|
|
|
3649
3862
|
}
|
|
3650
3863
|
function readFileOrNull(filePath) {
|
|
3651
3864
|
try {
|
|
3652
|
-
return
|
|
3865
|
+
return fs11.readFileSync(filePath, "utf-8");
|
|
3653
3866
|
} catch {
|
|
3654
3867
|
return null;
|
|
3655
3868
|
}
|
|
@@ -5255,7 +5468,7 @@ var import_brace_expansion, minimatch = (p, pattern, options = {}) => {
|
|
|
5255
5468
|
}, qmarksTestNoExtDot = ([$0]) => {
|
|
5256
5469
|
const len = $0.length;
|
|
5257
5470
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
5258
|
-
}, defaultPlatform,
|
|
5471
|
+
}, defaultPlatform, path16, 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) => {
|
|
5259
5472
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
5260
5473
|
return minimatch;
|
|
5261
5474
|
}
|
|
@@ -5313,11 +5526,11 @@ var init_esm = __esm(() => {
|
|
|
5313
5526
|
starRE = /^\*+$/;
|
|
5314
5527
|
qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
5315
5528
|
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
5316
|
-
|
|
5529
|
+
path16 = {
|
|
5317
5530
|
win32: { sep: "\\" },
|
|
5318
5531
|
posix: { sep: "/" }
|
|
5319
5532
|
};
|
|
5320
|
-
sep = defaultPlatform === "win32" ?
|
|
5533
|
+
sep = defaultPlatform === "win32" ? path16.win32.sep : path16.posix.sep;
|
|
5321
5534
|
minimatch.sep = sep;
|
|
5322
5535
|
GLOBSTAR = Symbol("globstar **");
|
|
5323
5536
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -7283,12 +7496,12 @@ var init_esm4 = __esm(() => {
|
|
|
7283
7496
|
childrenCache() {
|
|
7284
7497
|
return this.#children;
|
|
7285
7498
|
}
|
|
7286
|
-
resolve(
|
|
7287
|
-
if (!
|
|
7499
|
+
resolve(path17) {
|
|
7500
|
+
if (!path17) {
|
|
7288
7501
|
return this;
|
|
7289
7502
|
}
|
|
7290
|
-
const rootPath = this.getRootString(
|
|
7291
|
-
const dir =
|
|
7503
|
+
const rootPath = this.getRootString(path17);
|
|
7504
|
+
const dir = path17.substring(rootPath.length);
|
|
7292
7505
|
const dirParts = dir.split(this.splitSep);
|
|
7293
7506
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
7294
7507
|
return result;
|
|
@@ -7816,8 +8029,8 @@ var init_esm4 = __esm(() => {
|
|
|
7816
8029
|
newChild(name, type = UNKNOWN, opts = {}) {
|
|
7817
8030
|
return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
|
|
7818
8031
|
}
|
|
7819
|
-
getRootString(
|
|
7820
|
-
return win32.parse(
|
|
8032
|
+
getRootString(path17) {
|
|
8033
|
+
return win32.parse(path17).root;
|
|
7821
8034
|
}
|
|
7822
8035
|
getRoot(rootPath) {
|
|
7823
8036
|
rootPath = uncToDrive(rootPath.toUpperCase());
|
|
@@ -7842,8 +8055,8 @@ var init_esm4 = __esm(() => {
|
|
|
7842
8055
|
constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
|
|
7843
8056
|
super(name, type, root, roots, nocase, children, opts);
|
|
7844
8057
|
}
|
|
7845
|
-
getRootString(
|
|
7846
|
-
return
|
|
8058
|
+
getRootString(path17) {
|
|
8059
|
+
return path17.startsWith("/") ? "/" : "";
|
|
7847
8060
|
}
|
|
7848
8061
|
getRoot(_rootPath) {
|
|
7849
8062
|
return this.root;
|
|
@@ -7862,8 +8075,8 @@ var init_esm4 = __esm(() => {
|
|
|
7862
8075
|
#children;
|
|
7863
8076
|
nocase;
|
|
7864
8077
|
#fs;
|
|
7865
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
7866
|
-
this.#fs = fsFromOption(
|
|
8078
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs12 = defaultFS } = {}) {
|
|
8079
|
+
this.#fs = fsFromOption(fs12);
|
|
7867
8080
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
7868
8081
|
cwd = fileURLToPath(cwd);
|
|
7869
8082
|
}
|
|
@@ -7899,11 +8112,11 @@ var init_esm4 = __esm(() => {
|
|
|
7899
8112
|
}
|
|
7900
8113
|
this.cwd = prev;
|
|
7901
8114
|
}
|
|
7902
|
-
depth(
|
|
7903
|
-
if (typeof
|
|
7904
|
-
|
|
8115
|
+
depth(path17 = this.cwd) {
|
|
8116
|
+
if (typeof path17 === "string") {
|
|
8117
|
+
path17 = this.cwd.resolve(path17);
|
|
7905
8118
|
}
|
|
7906
|
-
return
|
|
8119
|
+
return path17.depth();
|
|
7907
8120
|
}
|
|
7908
8121
|
childrenCache() {
|
|
7909
8122
|
return this.#children;
|
|
@@ -8319,9 +8532,9 @@ var init_esm4 = __esm(() => {
|
|
|
8319
8532
|
process2();
|
|
8320
8533
|
return results;
|
|
8321
8534
|
}
|
|
8322
|
-
chdir(
|
|
8535
|
+
chdir(path17 = this.cwd) {
|
|
8323
8536
|
const oldCwd = this.cwd;
|
|
8324
|
-
this.cwd = typeof
|
|
8537
|
+
this.cwd = typeof path17 === "string" ? this.cwd.resolve(path17) : path17;
|
|
8325
8538
|
this.cwd[setAsCwd](oldCwd);
|
|
8326
8539
|
}
|
|
8327
8540
|
};
|
|
@@ -8338,8 +8551,8 @@ var init_esm4 = __esm(() => {
|
|
|
8338
8551
|
parseRootPath(dir) {
|
|
8339
8552
|
return win32.parse(dir).root.toUpperCase();
|
|
8340
8553
|
}
|
|
8341
|
-
newRoot(
|
|
8342
|
-
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
8554
|
+
newRoot(fs12) {
|
|
8555
|
+
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs12 });
|
|
8343
8556
|
}
|
|
8344
8557
|
isAbsolute(p) {
|
|
8345
8558
|
return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p);
|
|
@@ -8355,8 +8568,8 @@ var init_esm4 = __esm(() => {
|
|
|
8355
8568
|
parseRootPath(_dir) {
|
|
8356
8569
|
return "/";
|
|
8357
8570
|
}
|
|
8358
|
-
newRoot(
|
|
8359
|
-
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
8571
|
+
newRoot(fs12) {
|
|
8572
|
+
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs12 });
|
|
8360
8573
|
}
|
|
8361
8574
|
isAbsolute(p) {
|
|
8362
8575
|
return p.startsWith("/");
|
|
@@ -8613,8 +8826,8 @@ class MatchRecord {
|
|
|
8613
8826
|
this.store.set(target, current === undefined ? n : n & current);
|
|
8614
8827
|
}
|
|
8615
8828
|
entries() {
|
|
8616
|
-
return [...this.store.entries()].map(([
|
|
8617
|
-
|
|
8829
|
+
return [...this.store.entries()].map(([path17, n]) => [
|
|
8830
|
+
path17,
|
|
8618
8831
|
!!(n & 2),
|
|
8619
8832
|
!!(n & 1)
|
|
8620
8833
|
]);
|
|
@@ -8818,9 +9031,9 @@ class GlobUtil {
|
|
|
8818
9031
|
signal;
|
|
8819
9032
|
maxDepth;
|
|
8820
9033
|
includeChildMatches;
|
|
8821
|
-
constructor(patterns,
|
|
9034
|
+
constructor(patterns, path17, opts) {
|
|
8822
9035
|
this.patterns = patterns;
|
|
8823
|
-
this.path =
|
|
9036
|
+
this.path = path17;
|
|
8824
9037
|
this.opts = opts;
|
|
8825
9038
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
8826
9039
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -8839,11 +9052,11 @@ class GlobUtil {
|
|
|
8839
9052
|
});
|
|
8840
9053
|
}
|
|
8841
9054
|
}
|
|
8842
|
-
#ignored(
|
|
8843
|
-
return this.seen.has(
|
|
9055
|
+
#ignored(path17) {
|
|
9056
|
+
return this.seen.has(path17) || !!this.#ignore?.ignored?.(path17);
|
|
8844
9057
|
}
|
|
8845
|
-
#childrenIgnored(
|
|
8846
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
9058
|
+
#childrenIgnored(path17) {
|
|
9059
|
+
return !!this.#ignore?.childrenIgnored?.(path17);
|
|
8847
9060
|
}
|
|
8848
9061
|
pause() {
|
|
8849
9062
|
this.paused = true;
|
|
@@ -9060,8 +9273,8 @@ var init_walker = __esm(() => {
|
|
|
9060
9273
|
init_processor();
|
|
9061
9274
|
GlobWalker = class GlobWalker extends GlobUtil {
|
|
9062
9275
|
matches = new Set;
|
|
9063
|
-
constructor(patterns,
|
|
9064
|
-
super(patterns,
|
|
9276
|
+
constructor(patterns, path17, opts) {
|
|
9277
|
+
super(patterns, path17, opts);
|
|
9065
9278
|
}
|
|
9066
9279
|
matchEmit(e) {
|
|
9067
9280
|
this.matches.add(e);
|
|
@@ -9098,8 +9311,8 @@ var init_walker = __esm(() => {
|
|
|
9098
9311
|
};
|
|
9099
9312
|
GlobStream = class GlobStream extends GlobUtil {
|
|
9100
9313
|
results;
|
|
9101
|
-
constructor(patterns,
|
|
9102
|
-
super(patterns,
|
|
9314
|
+
constructor(patterns, path17, opts) {
|
|
9315
|
+
super(patterns, path17, opts);
|
|
9103
9316
|
this.results = new Minipass({
|
|
9104
9317
|
signal: this.signal,
|
|
9105
9318
|
objectMode: true
|
|
@@ -9527,20 +9740,20 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
9527
9740
|
var throwError = (message, Ctor) => {
|
|
9528
9741
|
throw new Ctor(message);
|
|
9529
9742
|
};
|
|
9530
|
-
var checkPath = (
|
|
9531
|
-
if (!isString(
|
|
9743
|
+
var checkPath = (path17, originalPath, doThrow) => {
|
|
9744
|
+
if (!isString(path17)) {
|
|
9532
9745
|
return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
9533
9746
|
}
|
|
9534
|
-
if (!
|
|
9747
|
+
if (!path17) {
|
|
9535
9748
|
return doThrow(`path must not be empty`, TypeError);
|
|
9536
9749
|
}
|
|
9537
|
-
if (checkPath.isNotRelative(
|
|
9750
|
+
if (checkPath.isNotRelative(path17)) {
|
|
9538
9751
|
const r = "`path.relative()`d";
|
|
9539
9752
|
return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
|
|
9540
9753
|
}
|
|
9541
9754
|
return true;
|
|
9542
9755
|
};
|
|
9543
|
-
var isNotRelative = (
|
|
9756
|
+
var isNotRelative = (path17) => REGEX_TEST_INVALID_PATH.test(path17);
|
|
9544
9757
|
checkPath.isNotRelative = isNotRelative;
|
|
9545
9758
|
checkPath.convert = (p) => p;
|
|
9546
9759
|
|
|
@@ -9583,7 +9796,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
9583
9796
|
addPattern(pattern) {
|
|
9584
9797
|
return this.add(pattern);
|
|
9585
9798
|
}
|
|
9586
|
-
_testOne(
|
|
9799
|
+
_testOne(path17, checkUnignored) {
|
|
9587
9800
|
let ignored = false;
|
|
9588
9801
|
let unignored = false;
|
|
9589
9802
|
this._rules.forEach((rule) => {
|
|
@@ -9591,7 +9804,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
9591
9804
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
9592
9805
|
return;
|
|
9593
9806
|
}
|
|
9594
|
-
const matched = rule.regex.test(
|
|
9807
|
+
const matched = rule.regex.test(path17);
|
|
9595
9808
|
if (matched) {
|
|
9596
9809
|
ignored = !negative;
|
|
9597
9810
|
unignored = negative;
|
|
@@ -9603,39 +9816,39 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
9603
9816
|
};
|
|
9604
9817
|
}
|
|
9605
9818
|
_test(originalPath, cache, checkUnignored, slices) {
|
|
9606
|
-
const
|
|
9607
|
-
checkPath(
|
|
9608
|
-
return this._t(
|
|
9819
|
+
const path17 = originalPath && checkPath.convert(originalPath);
|
|
9820
|
+
checkPath(path17, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
|
9821
|
+
return this._t(path17, cache, checkUnignored, slices);
|
|
9609
9822
|
}
|
|
9610
|
-
_t(
|
|
9611
|
-
if (
|
|
9612
|
-
return cache[
|
|
9823
|
+
_t(path17, cache, checkUnignored, slices) {
|
|
9824
|
+
if (path17 in cache) {
|
|
9825
|
+
return cache[path17];
|
|
9613
9826
|
}
|
|
9614
9827
|
if (!slices) {
|
|
9615
|
-
slices =
|
|
9828
|
+
slices = path17.split(SLASH2);
|
|
9616
9829
|
}
|
|
9617
9830
|
slices.pop();
|
|
9618
9831
|
if (!slices.length) {
|
|
9619
|
-
return cache[
|
|
9832
|
+
return cache[path17] = this._testOne(path17, checkUnignored);
|
|
9620
9833
|
}
|
|
9621
9834
|
const parent = this._t(slices.join(SLASH2) + SLASH2, cache, checkUnignored, slices);
|
|
9622
|
-
return cache[
|
|
9835
|
+
return cache[path17] = parent.ignored ? parent : this._testOne(path17, checkUnignored);
|
|
9623
9836
|
}
|
|
9624
|
-
ignores(
|
|
9625
|
-
return this._test(
|
|
9837
|
+
ignores(path17) {
|
|
9838
|
+
return this._test(path17, this._ignoreCache, false).ignored;
|
|
9626
9839
|
}
|
|
9627
9840
|
createFilter() {
|
|
9628
|
-
return (
|
|
9841
|
+
return (path17) => !this.ignores(path17);
|
|
9629
9842
|
}
|
|
9630
9843
|
filter(paths) {
|
|
9631
9844
|
return makeArray(paths).filter(this.createFilter());
|
|
9632
9845
|
}
|
|
9633
|
-
test(
|
|
9634
|
-
return this._test(
|
|
9846
|
+
test(path17) {
|
|
9847
|
+
return this._test(path17, this._testCache, true);
|
|
9635
9848
|
}
|
|
9636
9849
|
}
|
|
9637
9850
|
var factory = (options) => new Ignore2(options);
|
|
9638
|
-
var isPathValid = (
|
|
9851
|
+
var isPathValid = (path17) => checkPath(path17 && checkPath.convert(path17), path17, RETURN_FALSE);
|
|
9639
9852
|
factory.isPathValid = isPathValid;
|
|
9640
9853
|
factory.default = factory;
|
|
9641
9854
|
module.exports = factory;
|
|
@@ -9643,7 +9856,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
9643
9856
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
9644
9857
|
checkPath.convert = makePosix;
|
|
9645
9858
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
9646
|
-
checkPath.isNotRelative = (
|
|
9859
|
+
checkPath.isNotRelative = (path17) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path17) || isNotRelative(path17);
|
|
9647
9860
|
}
|
|
9648
9861
|
});
|
|
9649
9862
|
|
|
@@ -9705,13 +9918,13 @@ function validatePolicy(policy, opts = {}) {
|
|
|
9705
9918
|
}
|
|
9706
9919
|
}
|
|
9707
9920
|
}
|
|
9708
|
-
function matchesGlob2(
|
|
9921
|
+
function matchesGlob2(path17, pattern) {
|
|
9709
9922
|
let re = regexCache.get(pattern);
|
|
9710
9923
|
if (!re) {
|
|
9711
9924
|
re = globToRegex(pattern);
|
|
9712
9925
|
regexCache.set(pattern, re);
|
|
9713
9926
|
}
|
|
9714
|
-
return re.test(
|
|
9927
|
+
return re.test(path17);
|
|
9715
9928
|
}
|
|
9716
9929
|
var DEFAULT_POLICY, applyPolicy = (filePath, policy) => {
|
|
9717
9930
|
const normalized = filePath.trim();
|
|
@@ -9728,8 +9941,8 @@ var init_capture_policy = __esm(() => {
|
|
|
9728
9941
|
});
|
|
9729
9942
|
|
|
9730
9943
|
// ../../packages/core/dist/services/search/ignore-patterns.js
|
|
9731
|
-
import
|
|
9732
|
-
import
|
|
9944
|
+
import fs12 from "fs/promises";
|
|
9945
|
+
import path17 from "path";
|
|
9733
9946
|
function buildExtensionGlob(extensions) {
|
|
9734
9947
|
return extensions.map((ext2) => `**/*${ext2}`);
|
|
9735
9948
|
}
|
|
@@ -9752,8 +9965,8 @@ async function loadProjectIgnore(projectPath) {
|
|
|
9752
9965
|
const ig = ignore();
|
|
9753
9966
|
ig.add(DEFAULT_IGNORES);
|
|
9754
9967
|
try {
|
|
9755
|
-
const gitignorePath =
|
|
9756
|
-
const gitignoreContent = await
|
|
9968
|
+
const gitignorePath = path17.join(projectPath, ".gitignore");
|
|
9969
|
+
const gitignoreContent = await fs12.readFile(gitignorePath, "utf8");
|
|
9757
9970
|
const rules = gitignoreContent.split(`
|
|
9758
9971
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
9759
9972
|
ig.add(rules);
|
|
@@ -11352,15 +11565,15 @@ var require_pg_connection_string = __commonJS((exports, module) => {
|
|
|
11352
11565
|
if (config2.sslnegotiation === "direct" && config2.ssl === undefined) {
|
|
11353
11566
|
config2.ssl = true;
|
|
11354
11567
|
}
|
|
11355
|
-
const
|
|
11568
|
+
const fs13 = config2.sslcert || config2.sslkey || config2.sslrootcert ? __require("fs") : null;
|
|
11356
11569
|
if (config2.sslcert) {
|
|
11357
|
-
config2.ssl.cert =
|
|
11570
|
+
config2.ssl.cert = fs13.readFileSync(config2.sslcert).toString();
|
|
11358
11571
|
}
|
|
11359
11572
|
if (config2.sslkey) {
|
|
11360
|
-
config2.ssl.key =
|
|
11573
|
+
config2.ssl.key = fs13.readFileSync(config2.sslkey).toString();
|
|
11361
11574
|
}
|
|
11362
11575
|
if (config2.sslrootcert) {
|
|
11363
|
-
config2.ssl.ca =
|
|
11576
|
+
config2.ssl.ca = fs13.readFileSync(config2.sslrootcert).toString();
|
|
11364
11577
|
}
|
|
11365
11578
|
if (options.useLibpqCompat && config2.uselibpqcompat) {
|
|
11366
11579
|
throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
|
|
@@ -13074,7 +13287,7 @@ var require_split2 = __commonJS((exports, module) => {
|
|
|
13074
13287
|
|
|
13075
13288
|
// ../../node_modules/pgpass/lib/helper.js
|
|
13076
13289
|
var require_helper = __commonJS((exports, module) => {
|
|
13077
|
-
var
|
|
13290
|
+
var path18 = __require("path");
|
|
13078
13291
|
var Stream2 = __require("stream").Stream;
|
|
13079
13292
|
var split = require_split2();
|
|
13080
13293
|
var util = __require("util");
|
|
@@ -13114,7 +13327,7 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
13114
13327
|
};
|
|
13115
13328
|
exports.getFileName = function(rawEnv) {
|
|
13116
13329
|
var env = rawEnv || process.env;
|
|
13117
|
-
var file = env.PGPASSFILE || (isWin ?
|
|
13330
|
+
var file = env.PGPASSFILE || (isWin ? path18.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path18.join(env.HOME || "./", ".pgpass"));
|
|
13118
13331
|
return file;
|
|
13119
13332
|
};
|
|
13120
13333
|
exports.usePgPass = function(stats, fname) {
|
|
@@ -13238,16 +13451,16 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
13238
13451
|
|
|
13239
13452
|
// ../../node_modules/pgpass/lib/index.js
|
|
13240
13453
|
var require_lib = __commonJS((exports, module) => {
|
|
13241
|
-
var
|
|
13242
|
-
var
|
|
13454
|
+
var path18 = __require("path");
|
|
13455
|
+
var fs13 = __require("fs");
|
|
13243
13456
|
var helper = require_helper();
|
|
13244
13457
|
module.exports = function(connInfo, cb) {
|
|
13245
13458
|
var file = helper.getFileName();
|
|
13246
|
-
|
|
13459
|
+
fs13.stat(file, function(err, stat) {
|
|
13247
13460
|
if (err || !helper.usePgPass(stat, file)) {
|
|
13248
13461
|
return cb(undefined);
|
|
13249
13462
|
}
|
|
13250
|
-
var st =
|
|
13463
|
+
var st = fs13.createReadStream(file);
|
|
13251
13464
|
helper.getPassword(connInfo, st, cb);
|
|
13252
13465
|
});
|
|
13253
13466
|
};
|
|
@@ -14946,8 +15159,8 @@ var init_alias_resolver = __esm(() => {
|
|
|
14946
15159
|
});
|
|
14947
15160
|
|
|
14948
15161
|
// ../../packages/core/dist/services/search/index-manager.js
|
|
14949
|
-
import
|
|
14950
|
-
import
|
|
15162
|
+
import fs13 from "fs";
|
|
15163
|
+
import path18 from "path";
|
|
14951
15164
|
|
|
14952
15165
|
class IndexManager {
|
|
14953
15166
|
metadataCache = new Map;
|
|
@@ -15040,9 +15253,9 @@ class IndexManager {
|
|
|
15040
15253
|
const fileMetadata = {};
|
|
15041
15254
|
let totalSize = 0;
|
|
15042
15255
|
for (const filePath of indexedFiles) {
|
|
15043
|
-
const fullPath =
|
|
15256
|
+
const fullPath = path18.join(projectPath, filePath);
|
|
15044
15257
|
try {
|
|
15045
|
-
const stat = await
|
|
15258
|
+
const stat = await fs13.promises.stat(fullPath);
|
|
15046
15259
|
fileMetadata[filePath] = {
|
|
15047
15260
|
path: filePath,
|
|
15048
15261
|
mtime: stat.mtimeMs,
|
|
@@ -15093,9 +15306,9 @@ class IndexManager {
|
|
|
15093
15306
|
if (ig.ignores(match2)) {
|
|
15094
15307
|
continue;
|
|
15095
15308
|
}
|
|
15096
|
-
const fullPath =
|
|
15309
|
+
const fullPath = path18.join(projectPath, match2);
|
|
15097
15310
|
try {
|
|
15098
|
-
const stat = await
|
|
15311
|
+
const stat = await fs13.promises.stat(fullPath);
|
|
15099
15312
|
files.set(match2, {
|
|
15100
15313
|
path: match2,
|
|
15101
15314
|
mtime: stat.mtimeMs,
|
|
@@ -15546,10 +15759,10 @@ function mergeDefs(...defs) {
|
|
|
15546
15759
|
function cloneDef(schema) {
|
|
15547
15760
|
return mergeDefs(schema._zod.def);
|
|
15548
15761
|
}
|
|
15549
|
-
function getElementAtPath(obj,
|
|
15550
|
-
if (!
|
|
15762
|
+
function getElementAtPath(obj, path19) {
|
|
15763
|
+
if (!path19)
|
|
15551
15764
|
return obj;
|
|
15552
|
-
return
|
|
15765
|
+
return path19.reduce((acc, key) => acc?.[key], obj);
|
|
15553
15766
|
}
|
|
15554
15767
|
function promiseAllObject(promisesObj) {
|
|
15555
15768
|
const keys = Object.keys(promisesObj);
|
|
@@ -15877,11 +16090,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
15877
16090
|
}
|
|
15878
16091
|
return false;
|
|
15879
16092
|
}
|
|
15880
|
-
function prefixIssues(
|
|
16093
|
+
function prefixIssues(path19, issues) {
|
|
15881
16094
|
return issues.map((iss) => {
|
|
15882
16095
|
var _a3;
|
|
15883
16096
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
15884
|
-
iss.path.unshift(
|
|
16097
|
+
iss.path.unshift(path19);
|
|
15885
16098
|
return iss;
|
|
15886
16099
|
});
|
|
15887
16100
|
}
|
|
@@ -16094,16 +16307,16 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
|
16094
16307
|
}
|
|
16095
16308
|
function formatError(error, mapper = (issue2) => issue2.message) {
|
|
16096
16309
|
const fieldErrors = { _errors: [] };
|
|
16097
|
-
const processError = (error2,
|
|
16310
|
+
const processError = (error2, path19 = []) => {
|
|
16098
16311
|
for (const issue2 of error2.issues) {
|
|
16099
16312
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
16100
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
16313
|
+
issue2.errors.map((issues) => processError({ issues }, [...path19, ...issue2.path]));
|
|
16101
16314
|
} else if (issue2.code === "invalid_key") {
|
|
16102
|
-
processError({ issues: issue2.issues }, [...
|
|
16315
|
+
processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
|
|
16103
16316
|
} else if (issue2.code === "invalid_element") {
|
|
16104
|
-
processError({ issues: issue2.issues }, [...
|
|
16317
|
+
processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
|
|
16105
16318
|
} else {
|
|
16106
|
-
const fullpath = [...
|
|
16319
|
+
const fullpath = [...path19, ...issue2.path];
|
|
16107
16320
|
if (fullpath.length === 0) {
|
|
16108
16321
|
fieldErrors._errors.push(mapper(issue2));
|
|
16109
16322
|
} else {
|
|
@@ -16130,17 +16343,17 @@ function formatError(error, mapper = (issue2) => issue2.message) {
|
|
|
16130
16343
|
}
|
|
16131
16344
|
function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
16132
16345
|
const result = { errors: [] };
|
|
16133
|
-
const processError = (error2,
|
|
16346
|
+
const processError = (error2, path19 = []) => {
|
|
16134
16347
|
var _a3, _b;
|
|
16135
16348
|
for (const issue2 of error2.issues) {
|
|
16136
16349
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
16137
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
16350
|
+
issue2.errors.map((issues) => processError({ issues }, [...path19, ...issue2.path]));
|
|
16138
16351
|
} else if (issue2.code === "invalid_key") {
|
|
16139
|
-
processError({ issues: issue2.issues }, [...
|
|
16352
|
+
processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
|
|
16140
16353
|
} else if (issue2.code === "invalid_element") {
|
|
16141
|
-
processError({ issues: issue2.issues }, [...
|
|
16354
|
+
processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
|
|
16142
16355
|
} else {
|
|
16143
|
-
const fullpath = [...
|
|
16356
|
+
const fullpath = [...path19, ...issue2.path];
|
|
16144
16357
|
if (fullpath.length === 0) {
|
|
16145
16358
|
result.errors.push(mapper(issue2));
|
|
16146
16359
|
continue;
|
|
@@ -16172,8 +16385,8 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
|
16172
16385
|
}
|
|
16173
16386
|
function toDotPath(_path) {
|
|
16174
16387
|
const segs = [];
|
|
16175
|
-
const
|
|
16176
|
-
for (const seg of
|
|
16388
|
+
const path19 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
16389
|
+
for (const seg of path19) {
|
|
16177
16390
|
if (typeof seg === "number")
|
|
16178
16391
|
segs.push(`[${seg}]`);
|
|
16179
16392
|
else if (typeof seg === "symbol")
|
|
@@ -29176,13 +29389,13 @@ function resolveRef(ref, ctx) {
|
|
|
29176
29389
|
if (!ref.startsWith("#")) {
|
|
29177
29390
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
29178
29391
|
}
|
|
29179
|
-
const
|
|
29180
|
-
if (
|
|
29392
|
+
const path19 = ref.slice(1).split("/").filter(Boolean);
|
|
29393
|
+
if (path19.length === 0) {
|
|
29181
29394
|
return ctx.rootSchema;
|
|
29182
29395
|
}
|
|
29183
29396
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
29184
|
-
if (
|
|
29185
|
-
const key =
|
|
29397
|
+
if (path19[0] === defsKey) {
|
|
29398
|
+
const key = path19[1];
|
|
29186
29399
|
if (!key || !ctx.defs[key]) {
|
|
29187
29400
|
throw new Error(`Reference not found: ${ref}`);
|
|
29188
29401
|
}
|
|
@@ -30671,8 +30884,8 @@ class ParseStatus {
|
|
|
30671
30884
|
}
|
|
30672
30885
|
}
|
|
30673
30886
|
var makeIssue = (params) => {
|
|
30674
|
-
const { data, path:
|
|
30675
|
-
const fullPath = [...
|
|
30887
|
+
const { data, path: path19, errorMaps, issueData } = params;
|
|
30888
|
+
const fullPath = [...path19, ...issueData.path || []];
|
|
30676
30889
|
const fullIssue = {
|
|
30677
30890
|
...issueData,
|
|
30678
30891
|
path: fullPath
|
|
@@ -30717,11 +30930,11 @@ var init_errorUtil = __esm(() => {
|
|
|
30717
30930
|
|
|
30718
30931
|
// ../../node_modules/zod/v3/types.js
|
|
30719
30932
|
class ParseInputLazyPath {
|
|
30720
|
-
constructor(parent, value,
|
|
30933
|
+
constructor(parent, value, path19, key) {
|
|
30721
30934
|
this._cachedPath = [];
|
|
30722
30935
|
this.parent = parent;
|
|
30723
30936
|
this.data = value;
|
|
30724
|
-
this._path =
|
|
30937
|
+
this._path = path19;
|
|
30725
30938
|
this._key = key;
|
|
30726
30939
|
}
|
|
30727
30940
|
get path() {
|
|
@@ -36786,23 +36999,23 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
36786
36999
|
writeAuthConfig: () => writeAuthConfig
|
|
36787
37000
|
});
|
|
36788
37001
|
module.exports = __toCommonJS2(auth_config_exports);
|
|
36789
|
-
var
|
|
36790
|
-
var
|
|
37002
|
+
var fs14 = __toESM2(__require("fs"));
|
|
37003
|
+
var path19 = __toESM2(__require("path"));
|
|
36791
37004
|
var import_token_util = require_token_util();
|
|
36792
37005
|
function getAuthConfigPath() {
|
|
36793
37006
|
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
36794
37007
|
if (!dataDir) {
|
|
36795
37008
|
throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
|
|
36796
37009
|
}
|
|
36797
|
-
return
|
|
37010
|
+
return path19.join(dataDir, "auth.json");
|
|
36798
37011
|
}
|
|
36799
37012
|
function readAuthConfig() {
|
|
36800
37013
|
try {
|
|
36801
37014
|
const authPath = getAuthConfigPath();
|
|
36802
|
-
if (!
|
|
37015
|
+
if (!fs14.existsSync(authPath)) {
|
|
36803
37016
|
return null;
|
|
36804
37017
|
}
|
|
36805
|
-
const content =
|
|
37018
|
+
const content = fs14.readFileSync(authPath, "utf8");
|
|
36806
37019
|
if (!content) {
|
|
36807
37020
|
return null;
|
|
36808
37021
|
}
|
|
@@ -36813,11 +37026,11 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
36813
37026
|
}
|
|
36814
37027
|
function writeAuthConfig(config3) {
|
|
36815
37028
|
const authPath = getAuthConfigPath();
|
|
36816
|
-
const authDir =
|
|
36817
|
-
if (!
|
|
36818
|
-
|
|
37029
|
+
const authDir = path19.dirname(authPath);
|
|
37030
|
+
if (!fs14.existsSync(authDir)) {
|
|
37031
|
+
fs14.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
36819
37032
|
}
|
|
36820
|
-
|
|
37033
|
+
fs14.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
|
|
36821
37034
|
}
|
|
36822
37035
|
function isValidAccessToken(authConfig, expirationBufferMs = 0) {
|
|
36823
37036
|
if (!authConfig.token)
|
|
@@ -36992,8 +37205,8 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
36992
37205
|
saveToken: () => saveToken
|
|
36993
37206
|
});
|
|
36994
37207
|
module.exports = __toCommonJS2(token_util_exports);
|
|
36995
|
-
var
|
|
36996
|
-
var
|
|
37208
|
+
var path19 = __toESM2(__require("path"));
|
|
37209
|
+
var fs14 = __toESM2(__require("fs"));
|
|
36997
37210
|
var import_token_error = require_token_error();
|
|
36998
37211
|
var import_token_io = require_token_io();
|
|
36999
37212
|
var import_auth_config = require_auth_config();
|
|
@@ -37005,7 +37218,7 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
37005
37218
|
if (!dataDir) {
|
|
37006
37219
|
return null;
|
|
37007
37220
|
}
|
|
37008
|
-
return
|
|
37221
|
+
return path19.join(dataDir, vercelFolder);
|
|
37009
37222
|
}
|
|
37010
37223
|
async function getVercelToken2(options) {
|
|
37011
37224
|
const authConfig = (0, import_auth_config.readAuthConfig)();
|
|
@@ -37073,11 +37286,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
37073
37286
|
if (!dir) {
|
|
37074
37287
|
throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
|
|
37075
37288
|
}
|
|
37076
|
-
const prjPath =
|
|
37077
|
-
if (!
|
|
37289
|
+
const prjPath = path19.join(dir, ".vercel", "project.json");
|
|
37290
|
+
if (!fs14.existsSync(prjPath)) {
|
|
37078
37291
|
throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
|
|
37079
37292
|
}
|
|
37080
|
-
const prj = JSON.parse(
|
|
37293
|
+
const prj = JSON.parse(fs14.readFileSync(prjPath, "utf8"));
|
|
37081
37294
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
37082
37295
|
throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
|
|
37083
37296
|
}
|
|
@@ -37088,11 +37301,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
37088
37301
|
if (!dir) {
|
|
37089
37302
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
37090
37303
|
}
|
|
37091
|
-
const tokenPath =
|
|
37304
|
+
const tokenPath = path19.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
37092
37305
|
const tokenJson = JSON.stringify(token);
|
|
37093
|
-
|
|
37094
|
-
|
|
37095
|
-
|
|
37306
|
+
fs14.mkdirSync(path19.dirname(tokenPath), { mode: 504, recursive: true });
|
|
37307
|
+
fs14.writeFileSync(tokenPath, tokenJson);
|
|
37308
|
+
fs14.chmodSync(tokenPath, 432);
|
|
37096
37309
|
return;
|
|
37097
37310
|
}
|
|
37098
37311
|
function loadToken(projectId) {
|
|
@@ -37100,11 +37313,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
37100
37313
|
if (!dir) {
|
|
37101
37314
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
37102
37315
|
}
|
|
37103
|
-
const tokenPath =
|
|
37104
|
-
if (!
|
|
37316
|
+
const tokenPath = path19.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
37317
|
+
if (!fs14.existsSync(tokenPath)) {
|
|
37105
37318
|
return null;
|
|
37106
37319
|
}
|
|
37107
|
-
const token = JSON.parse(
|
|
37320
|
+
const token = JSON.parse(fs14.readFileSync(tokenPath, "utf8"));
|
|
37108
37321
|
assertVercelOidcTokenResponse(token);
|
|
37109
37322
|
return token;
|
|
37110
37323
|
}
|
|
@@ -47946,37 +48159,37 @@ function createOpenAI(options = {}) {
|
|
|
47946
48159
|
}, `ai-sdk/openai/${VERSION4}`);
|
|
47947
48160
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
47948
48161
|
provider: `${providerName}.chat`,
|
|
47949
|
-
url: ({ path:
|
|
48162
|
+
url: ({ path: path19 }) => `${baseURL}${path19}`,
|
|
47950
48163
|
headers: getHeaders,
|
|
47951
48164
|
fetch: options.fetch
|
|
47952
48165
|
});
|
|
47953
48166
|
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
47954
48167
|
provider: `${providerName}.completion`,
|
|
47955
|
-
url: ({ path:
|
|
48168
|
+
url: ({ path: path19 }) => `${baseURL}${path19}`,
|
|
47956
48169
|
headers: getHeaders,
|
|
47957
48170
|
fetch: options.fetch
|
|
47958
48171
|
});
|
|
47959
48172
|
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
47960
48173
|
provider: `${providerName}.embedding`,
|
|
47961
|
-
url: ({ path:
|
|
48174
|
+
url: ({ path: path19 }) => `${baseURL}${path19}`,
|
|
47962
48175
|
headers: getHeaders,
|
|
47963
48176
|
fetch: options.fetch
|
|
47964
48177
|
});
|
|
47965
48178
|
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
47966
48179
|
provider: `${providerName}.image`,
|
|
47967
|
-
url: ({ path:
|
|
48180
|
+
url: ({ path: path19 }) => `${baseURL}${path19}`,
|
|
47968
48181
|
headers: getHeaders,
|
|
47969
48182
|
fetch: options.fetch
|
|
47970
48183
|
});
|
|
47971
48184
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
47972
48185
|
provider: `${providerName}.transcription`,
|
|
47973
|
-
url: ({ path:
|
|
48186
|
+
url: ({ path: path19 }) => `${baseURL}${path19}`,
|
|
47974
48187
|
headers: getHeaders,
|
|
47975
48188
|
fetch: options.fetch
|
|
47976
48189
|
});
|
|
47977
48190
|
const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
|
|
47978
48191
|
provider: `${providerName}.speech`,
|
|
47979
|
-
url: ({ path:
|
|
48192
|
+
url: ({ path: path19 }) => `${baseURL}${path19}`,
|
|
47980
48193
|
headers: getHeaders,
|
|
47981
48194
|
fetch: options.fetch
|
|
47982
48195
|
});
|
|
@@ -47989,7 +48202,7 @@ function createOpenAI(options = {}) {
|
|
|
47989
48202
|
const createResponsesModel = (modelId) => {
|
|
47990
48203
|
return new OpenAIResponsesLanguageModel(modelId, {
|
|
47991
48204
|
provider: `${providerName}.responses`,
|
|
47992
|
-
url: ({ path:
|
|
48205
|
+
url: ({ path: path19 }) => `${baseURL}${path19}`,
|
|
47993
48206
|
headers: getHeaders,
|
|
47994
48207
|
fetch: options.fetch,
|
|
47995
48208
|
fileIdPrefixes: ["file-"]
|
|
@@ -64601,26 +64814,26 @@ var require_process = __commonJS((exports, module) => {
|
|
|
64601
64814
|
|
|
64602
64815
|
// ../../node_modules/detect-libc/lib/filesystem.js
|
|
64603
64816
|
var require_filesystem = __commonJS((exports, module) => {
|
|
64604
|
-
var
|
|
64817
|
+
var fs14 = __require("fs");
|
|
64605
64818
|
var LDD_PATH = "/usr/bin/ldd";
|
|
64606
64819
|
var SELF_PATH = "/proc/self/exe";
|
|
64607
64820
|
var MAX_LENGTH = 2048;
|
|
64608
|
-
var readFileSync2 = (
|
|
64609
|
-
const fd =
|
|
64821
|
+
var readFileSync2 = (path19) => {
|
|
64822
|
+
const fd = fs14.openSync(path19, "r");
|
|
64610
64823
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
64611
|
-
const bytesRead =
|
|
64612
|
-
|
|
64824
|
+
const bytesRead = fs14.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
64825
|
+
fs14.close(fd, () => {});
|
|
64613
64826
|
return buffer.subarray(0, bytesRead);
|
|
64614
64827
|
};
|
|
64615
|
-
var readFile = (
|
|
64616
|
-
|
|
64828
|
+
var readFile = (path19) => new Promise((resolve4, reject) => {
|
|
64829
|
+
fs14.open(path19, "r", (err, fd) => {
|
|
64617
64830
|
if (err) {
|
|
64618
64831
|
reject(err);
|
|
64619
64832
|
} else {
|
|
64620
64833
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
64621
|
-
|
|
64834
|
+
fs14.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
|
|
64622
64835
|
resolve4(buffer.subarray(0, bytesRead));
|
|
64623
|
-
|
|
64836
|
+
fs14.close(fd, () => {});
|
|
64624
64837
|
});
|
|
64625
64838
|
}
|
|
64626
64839
|
});
|
|
@@ -64725,11 +64938,11 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
64725
64938
|
}
|
|
64726
64939
|
return null;
|
|
64727
64940
|
};
|
|
64728
|
-
var familyFromInterpreterPath = (
|
|
64729
|
-
if (
|
|
64730
|
-
if (
|
|
64941
|
+
var familyFromInterpreterPath = (path19) => {
|
|
64942
|
+
if (path19) {
|
|
64943
|
+
if (path19.includes("/ld-musl-")) {
|
|
64731
64944
|
return MUSL;
|
|
64732
|
-
} else if (
|
|
64945
|
+
} else if (path19.includes("/ld-linux-")) {
|
|
64733
64946
|
return GLIBC;
|
|
64734
64947
|
}
|
|
64735
64948
|
}
|
|
@@ -64774,8 +64987,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
64774
64987
|
cachedFamilyInterpreter = null;
|
|
64775
64988
|
try {
|
|
64776
64989
|
const selfContent = await readFile(SELF_PATH);
|
|
64777
|
-
const
|
|
64778
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
64990
|
+
const path19 = interpreterPath(selfContent);
|
|
64991
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path19);
|
|
64779
64992
|
} catch (e) {}
|
|
64780
64993
|
return cachedFamilyInterpreter;
|
|
64781
64994
|
};
|
|
@@ -64786,8 +64999,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
64786
64999
|
cachedFamilyInterpreter = null;
|
|
64787
65000
|
try {
|
|
64788
65001
|
const selfContent = readFileSync2(SELF_PATH);
|
|
64789
|
-
const
|
|
64790
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
65002
|
+
const path19 = interpreterPath(selfContent);
|
|
65003
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path19);
|
|
64791
65004
|
} catch (e) {}
|
|
64792
65005
|
return cachedFamilyInterpreter;
|
|
64793
65006
|
};
|
|
@@ -66449,18 +66662,18 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
66449
66662
|
`@img/sharp-${runtimePlatform}/sharp.node`,
|
|
66450
66663
|
"@img/sharp-wasm32/sharp.node"
|
|
66451
66664
|
];
|
|
66452
|
-
var
|
|
66665
|
+
var path19;
|
|
66453
66666
|
var sharp;
|
|
66454
66667
|
var errors4 = [];
|
|
66455
|
-
for (
|
|
66668
|
+
for (path19 of paths) {
|
|
66456
66669
|
try {
|
|
66457
|
-
sharp = __require(
|
|
66670
|
+
sharp = __require(path19);
|
|
66458
66671
|
break;
|
|
66459
66672
|
} catch (err) {
|
|
66460
66673
|
errors4.push(err);
|
|
66461
66674
|
}
|
|
66462
66675
|
}
|
|
66463
|
-
if (sharp &&
|
|
66676
|
+
if (sharp && path19.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
|
|
66464
66677
|
const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
|
|
66465
66678
|
err.code = "Unsupported CPU";
|
|
66466
66679
|
errors4.push(err);
|
|
@@ -66469,7 +66682,7 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
66469
66682
|
if (sharp) {
|
|
66470
66683
|
module.exports = sharp;
|
|
66471
66684
|
} else {
|
|
66472
|
-
const [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((
|
|
66685
|
+
const [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((os9) => runtimePlatform.startsWith(os9));
|
|
66473
66686
|
const help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
|
|
66474
66687
|
errors4.forEach((err) => {
|
|
66475
66688
|
if (err.code !== "MODULE_NOT_FOUND") {
|
|
@@ -66482,9 +66695,9 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
66482
66695
|
const { found, expected } = isUnsupportedNodeRuntime();
|
|
66483
66696
|
help.push("- Please upgrade Node.js:", ` Found ${found}`, ` Requires ${expected}`);
|
|
66484
66697
|
} else if (prebuiltPlatforms.includes(runtimePlatform)) {
|
|
66485
|
-
const [
|
|
66486
|
-
const libc =
|
|
66487
|
-
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=${
|
|
66698
|
+
const [os9, cpu] = runtimePlatform.split("-");
|
|
66699
|
+
const libc = os9.endsWith("musl") ? " --libc=musl" : "";
|
|
66700
|
+
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=${os9.replace("musl", "")}${libc} --cpu=${cpu} sharp`);
|
|
66488
66701
|
} else {
|
|
66489
66702
|
help.push(`- Manually install libvips >= ${minimumLibvipsVersion}`, "- Add experimental WebAssembly-based dependencies:", " npm install --cpu=wasm32 sharp", " npm install @img/sharp-wasm32");
|
|
66490
66703
|
}
|
|
@@ -69322,15 +69535,15 @@ var require_color = __commonJS((exports, module) => {
|
|
|
69322
69535
|
};
|
|
69323
69536
|
}
|
|
69324
69537
|
function wrapConversion(toModel, graph) {
|
|
69325
|
-
const
|
|
69538
|
+
const path19 = [graph[toModel].parent, toModel];
|
|
69326
69539
|
let fn = conversions_default[graph[toModel].parent][toModel];
|
|
69327
69540
|
let cur = graph[toModel].parent;
|
|
69328
69541
|
while (graph[cur].parent) {
|
|
69329
|
-
|
|
69542
|
+
path19.unshift(graph[cur].parent);
|
|
69330
69543
|
fn = link(conversions_default[graph[cur].parent][cur], fn);
|
|
69331
69544
|
cur = graph[cur].parent;
|
|
69332
69545
|
}
|
|
69333
|
-
fn.conversion =
|
|
69546
|
+
fn.conversion = path19;
|
|
69334
69547
|
return fn;
|
|
69335
69548
|
}
|
|
69336
69549
|
function route(fromModel) {
|
|
@@ -69935,7 +70148,7 @@ var require_output = __commonJS((exports, module) => {
|
|
|
69935
70148
|
Copyright 2013 Lovell Fuller and others.
|
|
69936
70149
|
SPDX-License-Identifier: Apache-2.0
|
|
69937
70150
|
*/
|
|
69938
|
-
var
|
|
70151
|
+
var path19 = __require("path");
|
|
69939
70152
|
var is = require_is();
|
|
69940
70153
|
var sharp = require_sharp();
|
|
69941
70154
|
var formats = new Map([
|
|
@@ -69966,9 +70179,9 @@ var require_output = __commonJS((exports, module) => {
|
|
|
69966
70179
|
let err;
|
|
69967
70180
|
if (!is.string(fileOut)) {
|
|
69968
70181
|
err = new Error("Missing output file path");
|
|
69969
|
-
} else if (is.string(this.options.input.file) &&
|
|
70182
|
+
} else if (is.string(this.options.input.file) && path19.resolve(this.options.input.file) === path19.resolve(fileOut)) {
|
|
69970
70183
|
err = new Error("Cannot use same file for input and output");
|
|
69971
|
-
} else if (jp2Regex.test(
|
|
70184
|
+
} else if (jp2Regex.test(path19.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
|
|
69972
70185
|
err = errJp2Save();
|
|
69973
70186
|
}
|
|
69974
70187
|
if (err) {
|
|
@@ -77215,11 +77428,11 @@ var init_transformers_node = __esm(() => {
|
|
|
77215
77428
|
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}).`);
|
|
77216
77429
|
}
|
|
77217
77430
|
for (let i = 0;i < num_chunks; ++i) {
|
|
77218
|
-
const
|
|
77219
|
-
const fullPath = `${options.subfolder ?? ""}/${
|
|
77431
|
+
const path19 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
|
|
77432
|
+
const fullPath = `${options.subfolder ?? ""}/${path19}`;
|
|
77220
77433
|
externalDataPromises.push(new Promise(async (resolve4, reject) => {
|
|
77221
77434
|
const data = await (0, _utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelFile)(pretrained_model_name_or_path, fullPath, true, options, return_path);
|
|
77222
|
-
resolve4(data instanceof Uint8Array ? { path:
|
|
77435
|
+
resolve4(data instanceof Uint8Array ? { path: path19, data } : path19);
|
|
77223
77436
|
}));
|
|
77224
77437
|
}
|
|
77225
77438
|
} else if (session_options.externalData !== undefined) {
|
|
@@ -90283,7 +90496,7 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
90283
90496
|
const blob = new Blob([wav], { type: "audio/wav" });
|
|
90284
90497
|
return blob;
|
|
90285
90498
|
}
|
|
90286
|
-
async save(
|
|
90499
|
+
async save(path19) {
|
|
90287
90500
|
let fn;
|
|
90288
90501
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_BROWSER_ENV) {
|
|
90289
90502
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_WEBWORKER_ENV) {
|
|
@@ -90291,14 +90504,14 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
90291
90504
|
}
|
|
90292
90505
|
fn = _core_js__WEBPACK_IMPORTED_MODULE_2__.saveBlob;
|
|
90293
90506
|
} else if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_FS_AVAILABLE) {
|
|
90294
|
-
fn = async (
|
|
90507
|
+
fn = async (path20, blob) => {
|
|
90295
90508
|
let buffer = await blob.arrayBuffer();
|
|
90296
|
-
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(
|
|
90509
|
+
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path20, Buffer.from(buffer));
|
|
90297
90510
|
};
|
|
90298
90511
|
} else {
|
|
90299
90512
|
throw new Error("Unable to save because filesystem is disabled in this environment.");
|
|
90300
90513
|
}
|
|
90301
|
-
await fn(
|
|
90514
|
+
await fn(path19, this.toBlob());
|
|
90302
90515
|
}
|
|
90303
90516
|
}
|
|
90304
90517
|
},
|
|
@@ -90394,11 +90607,11 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
90394
90607
|
function calculateReflectOffset(i, w) {
|
|
90395
90608
|
return Math.abs((i + w) % (2 * w) - w);
|
|
90396
90609
|
}
|
|
90397
|
-
function saveBlob(
|
|
90610
|
+
function saveBlob(path19, blob) {
|
|
90398
90611
|
const dataURL = URL.createObjectURL(blob);
|
|
90399
90612
|
const downloadLink = document.createElement("a");
|
|
90400
90613
|
downloadLink.href = dataURL;
|
|
90401
|
-
downloadLink.download =
|
|
90614
|
+
downloadLink.download = path19;
|
|
90402
90615
|
downloadLink.click();
|
|
90403
90616
|
downloadLink.remove();
|
|
90404
90617
|
URL.revokeObjectURL(dataURL);
|
|
@@ -90999,8 +91212,8 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
90999
91212
|
}
|
|
91000
91213
|
|
|
91001
91214
|
class FileCache {
|
|
91002
|
-
constructor(
|
|
91003
|
-
this.path =
|
|
91215
|
+
constructor(path19) {
|
|
91216
|
+
this.path = path19;
|
|
91004
91217
|
}
|
|
91005
91218
|
async match(request) {
|
|
91006
91219
|
let filePath = node_path__WEBPACK_IMPORTED_MODULE_1__["default"].join(this.path, request);
|
|
@@ -91756,20 +91969,20 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
91756
91969
|
}
|
|
91757
91970
|
return this;
|
|
91758
91971
|
}
|
|
91759
|
-
async save(
|
|
91972
|
+
async save(path19) {
|
|
91760
91973
|
if (IS_BROWSER_OR_WEBWORKER) {
|
|
91761
91974
|
if (_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_WEBWORKER_ENV) {
|
|
91762
91975
|
throw new Error("Unable to save an image from a Web Worker.");
|
|
91763
91976
|
}
|
|
91764
|
-
const extension =
|
|
91977
|
+
const extension = path19.split(".").pop().toLowerCase();
|
|
91765
91978
|
const mime = CONTENT_TYPE_MAP.get(extension) ?? "image/png";
|
|
91766
91979
|
const blob = await this.toBlob(mime);
|
|
91767
|
-
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(
|
|
91980
|
+
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path19, blob);
|
|
91768
91981
|
} else if (!_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_FS_AVAILABLE) {
|
|
91769
91982
|
throw new Error("Unable to save the image because filesystem is disabled in this environment.");
|
|
91770
91983
|
} else {
|
|
91771
91984
|
const img = this.toSharp();
|
|
91772
|
-
return await img.toFile(
|
|
91985
|
+
return await img.toFile(path19);
|
|
91773
91986
|
}
|
|
91774
91987
|
}
|
|
91775
91988
|
toSharp() {
|
|
@@ -100998,7 +101211,7 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
|
|
|
100998
101211
|
function ns(e = Yo, t = Yo) {
|
|
100999
101212
|
return (r) => e(t(r));
|
|
101000
101213
|
}
|
|
101001
|
-
function
|
|
101214
|
+
function os9({ dataPath: e, modelName: t, args: r, runtimeDataModel: n }) {
|
|
101002
101215
|
let i = { modelName: t, args: r ?? {} }, o = dp(e);
|
|
101003
101216
|
if (!o || o.length === 0)
|
|
101004
101217
|
return i;
|
|
@@ -101303,10 +101516,10 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
|
|
|
101303
101516
|
super(t, "P2023", r);
|
|
101304
101517
|
}
|
|
101305
101518
|
};
|
|
101306
|
-
var
|
|
101519
|
+
var fs14 = new WeakMap;
|
|
101307
101520
|
function Ep(e) {
|
|
101308
|
-
let t =
|
|
101309
|
-
return t || (t = Object.entries(e),
|
|
101521
|
+
let t = fs14.get(e);
|
|
101522
|
+
return t || (t = Object.entries(e), fs14.set(e, t)), t;
|
|
101310
101523
|
}
|
|
101311
101524
|
function hs(e, t, r) {
|
|
101312
101525
|
switch (t.type) {
|
|
@@ -104871,7 +105084,7 @@ new PrismaClient({
|
|
|
104871
105084
|
let m = await es(this, d);
|
|
104872
105085
|
if (!d.model)
|
|
104873
105086
|
return m;
|
|
104874
|
-
let g =
|
|
105087
|
+
let g = os9({ dataPath: d.dataPath, modelName: d.model, args: d.args, runtimeDataModel: this._runtimeDataModel });
|
|
104875
105088
|
return Wo({ result: m, modelName: g.modelName, args: g.args, extensions: this._extensions, runtimeDataModel: this._runtimeDataModel, globalOmit: this._globalOmit });
|
|
104876
105089
|
};
|
|
104877
105090
|
return this._tracingHelper.runInChildSpan(s.operation, () => new zl.AsyncResource("prisma-client-request").runInAsyncScope(() => a(o)));
|
|
@@ -105274,7 +105487,7 @@ var require_prisma = __commonJS((exports) => {
|
|
|
105274
105487
|
Prisma.JsonNull = JsonNull2;
|
|
105275
105488
|
Prisma.AnyNull = AnyNull2;
|
|
105276
105489
|
Prisma.NullTypes = NullTypes2;
|
|
105277
|
-
var
|
|
105490
|
+
var path19 = __require("path");
|
|
105278
105491
|
exports.Prisma.TransactionIsolationLevel = makeStrictEnum2({
|
|
105279
105492
|
ReadUncommitted: "ReadUncommitted",
|
|
105280
105493
|
ReadCommitted: "ReadCommitted",
|
|
@@ -116972,10 +117185,10 @@ var init_chunker_code = __esm(() => {
|
|
|
116972
117185
|
});
|
|
116973
117186
|
|
|
116974
117187
|
// ../../packages/core/dist/services/search/smart-chunker.js
|
|
116975
|
-
import
|
|
117188
|
+
import path19 from "path";
|
|
116976
117189
|
function smartChunk(content, filePath, config3 = {}) {
|
|
116977
117190
|
const cfg = { ...DEFAULT_CONFIG, ...config3 };
|
|
116978
|
-
const ext2 =
|
|
117191
|
+
const ext2 = path19.extname(filePath).toLowerCase();
|
|
116979
117192
|
const relativePath = filePath;
|
|
116980
117193
|
const fileImports = isCodeFile(ext2) ? extractFileImports(content, ext2) : undefined;
|
|
116981
117194
|
let chunks;
|
|
@@ -117313,8 +117526,8 @@ var init_embedding_freshness = __esm(() => {
|
|
|
117313
117526
|
});
|
|
117314
117527
|
|
|
117315
117528
|
// ../../packages/core/dist/services/search/project-indexer.js
|
|
117316
|
-
import
|
|
117317
|
-
import
|
|
117529
|
+
import fs14 from "fs/promises";
|
|
117530
|
+
import path20 from "path";
|
|
117318
117531
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
117319
117532
|
async function runWithIndexLock(lockMap, projectId, work) {
|
|
117320
117533
|
const prevLock = lockMap.get(projectId);
|
|
@@ -117357,7 +117570,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
117357
117570
|
dot: false
|
|
117358
117571
|
});
|
|
117359
117572
|
const filteredFiles = files.filter((file2) => {
|
|
117360
|
-
const relativePath =
|
|
117573
|
+
const relativePath = path20.relative(projectPath, file2);
|
|
117361
117574
|
const shouldIgnore = ig.ignores(relativePath);
|
|
117362
117575
|
if (shouldIgnore) {
|
|
117363
117576
|
logger.debug("Ignoring file per .gitignore during indexing", {
|
|
@@ -117397,7 +117610,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
117397
117610
|
});
|
|
117398
117611
|
}
|
|
117399
117612
|
}
|
|
117400
|
-
const indexedFilesList = filteredFiles.map((f) =>
|
|
117613
|
+
const indexedFilesList = filteredFiles.map((f) => path20.relative(projectPath, f));
|
|
117401
117614
|
await deps.indexManager.updateIndexMetadata(projectId, projectPath, indexedFilesList);
|
|
117402
117615
|
logger.info("Project indexing completed", {
|
|
117403
117616
|
projectId,
|
|
@@ -117527,7 +117740,7 @@ async function ensureFreshIndex(deps, projectId, projectPath, options = {}) {
|
|
|
117527
117740
|
let errors4 = 0;
|
|
117528
117741
|
for (const relativeFilePath of filesToReindex) {
|
|
117529
117742
|
try {
|
|
117530
|
-
const fullPath =
|
|
117743
|
+
const fullPath = path20.join(projectPath, relativeFilePath);
|
|
117531
117744
|
const result = await deps.indexFile(fullPath, projectId, projectPath, centralityMap);
|
|
117532
117745
|
filesIndexed++;
|
|
117533
117746
|
chunksIndexed += result.chunks;
|
|
@@ -117587,8 +117800,8 @@ async function checkSearchAdmission(deps, projectId, projectPath) {
|
|
|
117587
117800
|
}
|
|
117588
117801
|
async function indexFile(deps, filePath, projectId, projectRoot, centralityMap) {
|
|
117589
117802
|
projectId = await getProjectIdentityAliasResolver().resolve(projectId);
|
|
117590
|
-
const content = await
|
|
117591
|
-
const relativePath =
|
|
117803
|
+
const content = await fs14.readFile(filePath, "utf-8");
|
|
117804
|
+
const relativePath = path20.relative(projectRoot, filePath);
|
|
117592
117805
|
const maxFileSize = config.get("security").maxFileSize || 1024 * 1024;
|
|
117593
117806
|
if (content.length > maxFileSize) {
|
|
117594
117807
|
logger.warn("File too large, skipping", {
|
|
@@ -117608,7 +117821,7 @@ async function indexFile(deps, filePath, projectId, projectRoot, centralityMap)
|
|
|
117608
117821
|
chunkIndex: i,
|
|
117609
117822
|
totalChunks: chunks.length,
|
|
117610
117823
|
type: chunk.type,
|
|
117611
|
-
language:
|
|
117824
|
+
language: path20.extname(filePath).slice(1),
|
|
117612
117825
|
lineStart: chunk.lineStart,
|
|
117613
117826
|
lineEnd: chunk.lineEnd,
|
|
117614
117827
|
label: chunk.label,
|
|
@@ -122159,16 +122372,16 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
122159
122372
|
const seen = new Set;
|
|
122160
122373
|
const out = [];
|
|
122161
122374
|
for (const e of httpEdges) {
|
|
122162
|
-
const
|
|
122163
|
-
if (!
|
|
122375
|
+
const path21 = e.route;
|
|
122376
|
+
if (!path21)
|
|
122164
122377
|
continue;
|
|
122165
122378
|
const method = (e.method ?? "ANY").toUpperCase();
|
|
122166
|
-
const key = method + " " +
|
|
122379
|
+
const key = method + " " + path21;
|
|
122167
122380
|
if (seen.has(key))
|
|
122168
122381
|
continue;
|
|
122169
122382
|
seen.add(key);
|
|
122170
122383
|
out.push({
|
|
122171
|
-
path:
|
|
122384
|
+
path: path21,
|
|
122172
122385
|
method: e.method,
|
|
122173
122386
|
file: e.fromFile,
|
|
122174
122387
|
handler: e.targetFqn ?? e.symbolName
|
|
@@ -122179,12 +122392,12 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
122179
122392
|
continue;
|
|
122180
122393
|
const parsed = parseRouteName(d.name);
|
|
122181
122394
|
const method = parsed?.method ?? "ANY";
|
|
122182
|
-
const
|
|
122183
|
-
const key = method + " " +
|
|
122395
|
+
const path21 = parsed?.path ?? d.name;
|
|
122396
|
+
const key = method + " " + path21;
|
|
122184
122397
|
if (seen.has(key))
|
|
122185
122398
|
continue;
|
|
122186
122399
|
seen.add(key);
|
|
122187
|
-
out.push({ path:
|
|
122400
|
+
out.push({ path: path21, method: parsed?.method, file: d.filePath, handler: d.name });
|
|
122188
122401
|
}
|
|
122189
122402
|
for (const d of defs) {
|
|
122190
122403
|
const parsed = parseRouteName(d.name);
|
|
@@ -122405,8 +122618,8 @@ __export(exports_symbol_graph_service, {
|
|
|
122405
122618
|
symbolGraphService: () => symbolGraphService,
|
|
122406
122619
|
SymbolGraphService: () => SymbolGraphService
|
|
122407
122620
|
});
|
|
122408
|
-
import
|
|
122409
|
-
import
|
|
122621
|
+
import path21 from "path";
|
|
122622
|
+
import fs15 from "fs/promises";
|
|
122410
122623
|
|
|
122411
122624
|
class SymbolGraphService {
|
|
122412
122625
|
identityLookup;
|
|
@@ -122734,7 +122947,7 @@ class SymbolGraphService {
|
|
|
122734
122947
|
async readSnippet(relativePath, lineStart, lineEnd, projectId) {
|
|
122735
122948
|
try {
|
|
122736
122949
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
122737
|
-
const content = await
|
|
122950
|
+
const content = await fs15.readFile(absolutePath, "utf-8");
|
|
122738
122951
|
const lines = content.split(`
|
|
122739
122952
|
`);
|
|
122740
122953
|
return lines.slice(Math.max(0, lineStart - 1), Math.min(lines.length, lineEnd)).join(`
|
|
@@ -122746,7 +122959,7 @@ class SymbolGraphService {
|
|
|
122746
122959
|
async readContext(relativePath, lineNumber, contextLines, projectId) {
|
|
122747
122960
|
try {
|
|
122748
122961
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
122749
|
-
const content = await
|
|
122962
|
+
const content = await fs15.readFile(absolutePath, "utf-8");
|
|
122750
122963
|
const lines = content.split(`
|
|
122751
122964
|
`);
|
|
122752
122965
|
const start = Math.max(0, lineNumber - contextLines - 1);
|
|
@@ -122759,7 +122972,7 @@ class SymbolGraphService {
|
|
|
122759
122972
|
}
|
|
122760
122973
|
async resolveToAbsolute(relativePath, projectId) {
|
|
122761
122974
|
const root = await this.getProjectRoot(projectId);
|
|
122762
|
-
return root ?
|
|
122975
|
+
return root ? path21.resolve(root, relativePath) : relativePath;
|
|
122763
122976
|
}
|
|
122764
122977
|
async getProjectRoot(projectId) {
|
|
122765
122978
|
const cached2 = this.projectRootCache.get(projectId);
|
|
@@ -124537,31 +124750,31 @@ class TracePathService {
|
|
|
124537
124750
|
const chains = [];
|
|
124538
124751
|
const seen = new Set;
|
|
124539
124752
|
let walks = 0;
|
|
124540
|
-
const walk = (fqn,
|
|
124753
|
+
const walk = (fqn, path22) => {
|
|
124541
124754
|
if (chains.length >= CHAIN_CAP)
|
|
124542
124755
|
return;
|
|
124543
124756
|
if (walks >= MAX_WALKS)
|
|
124544
124757
|
return;
|
|
124545
124758
|
walks++;
|
|
124546
|
-
const key =
|
|
124759
|
+
const key = path22.join("\u2192");
|
|
124547
124760
|
if (seen.has(key))
|
|
124548
124761
|
return;
|
|
124549
124762
|
seen.add(key);
|
|
124550
124763
|
const next = adj.get(fqn);
|
|
124551
124764
|
if (!next || next.length === 0 || !whoHasChild.has(fqn)) {
|
|
124552
|
-
if (
|
|
124553
|
-
chains.push(
|
|
124765
|
+
if (path22.length > 1)
|
|
124766
|
+
chains.push(path22.map((n) => this.fqnToName(n)).join(" \u2192 "));
|
|
124554
124767
|
return;
|
|
124555
124768
|
}
|
|
124556
124769
|
for (const child of next) {
|
|
124557
124770
|
if (chains.length >= CHAIN_CAP || walks >= MAX_WALKS)
|
|
124558
124771
|
return;
|
|
124559
|
-
if (
|
|
124560
|
-
const cycled = [...
|
|
124772
|
+
if (path22.includes(child)) {
|
|
124773
|
+
const cycled = [...path22, `${this.fqnToName(child)}\u21BA`];
|
|
124561
124774
|
chains.push(cycled.map((n) => n).join(" \u2192 "));
|
|
124562
124775
|
continue;
|
|
124563
124776
|
}
|
|
124564
|
-
walk(child, [...
|
|
124777
|
+
walk(child, [...path22, child]);
|
|
124565
124778
|
}
|
|
124566
124779
|
};
|
|
124567
124780
|
for (const seed of seeds) {
|
|
@@ -126584,9 +126797,9 @@ var init_inference_probe = __esm(() => {
|
|
|
126584
126797
|
});
|
|
126585
126798
|
|
|
126586
126799
|
// ../../packages/core/dist/services/health/local-health-checker.js
|
|
126587
|
-
import
|
|
126800
|
+
import fs16 from "fs/promises";
|
|
126588
126801
|
import { existsSync as existsSync3 } from "fs";
|
|
126589
|
-
import
|
|
126802
|
+
import path22 from "path";
|
|
126590
126803
|
|
|
126591
126804
|
class LocalHealthChecker {
|
|
126592
126805
|
dataDir = config.get("dataDir");
|
|
@@ -126664,10 +126877,10 @@ class LocalHealthChecker {
|
|
|
126664
126877
|
const start = Date.now();
|
|
126665
126878
|
try {
|
|
126666
126879
|
if (!existsSync3(this.dataDir))
|
|
126667
|
-
await
|
|
126668
|
-
const probe =
|
|
126669
|
-
await
|
|
126670
|
-
await
|
|
126880
|
+
await fs16.mkdir(this.dataDir, { recursive: true });
|
|
126881
|
+
const probe = path22.join(this.dataDir, ".health-check-test");
|
|
126882
|
+
await fs16.writeFile(probe, "ok");
|
|
126883
|
+
await fs16.unlink(probe);
|
|
126671
126884
|
return { available: true, latency: Date.now() - start, details: { path: this.dataDir, writable: true } };
|
|
126672
126885
|
} catch (error51) {
|
|
126673
126886
|
return { available: false, latency: Date.now() - start, error: `Data directory error: ${error51.message}` };
|
|
@@ -128350,6 +128563,7 @@ class PgObservationStore {
|
|
|
128350
128563
|
mirror = new Map;
|
|
128351
128564
|
hydrated = false;
|
|
128352
128565
|
hydrating = null;
|
|
128566
|
+
inflight = new Map;
|
|
128353
128567
|
hydrateFailedAt = 0;
|
|
128354
128568
|
static HYDRATE_RETRY_MS = 30000;
|
|
128355
128569
|
getClient() {
|
|
@@ -128401,46 +128615,53 @@ class PgObservationStore {
|
|
|
128401
128615
|
const cachedCanonical = getProjectIdentityAliasResolver().resolveCached(obs.projectId);
|
|
128402
128616
|
this.mirror.set(obs.id, cachedCanonical && cachedCanonical !== obs.projectId ? { ...obs, projectId: cachedCanonical } : obs);
|
|
128403
128617
|
this.ensureHydrated();
|
|
128404
|
-
(async () => {
|
|
128405
|
-
|
|
128406
|
-
|
|
128407
|
-
|
|
128408
|
-
|
|
128409
|
-
this.mirror.set(obs.id, { ...obs, projectId: canonicalProjectId });
|
|
128410
|
-
}
|
|
128411
|
-
await prisma2.$executeRaw`
|
|
128412
|
-
INSERT INTO observations (
|
|
128413
|
-
id, project_id, session_id, source, category, payload_json, importance, created_at, agent_id, attribution_source
|
|
128414
|
-
) VALUES (
|
|
128415
|
-
${obs.id},
|
|
128416
|
-
${canonicalProjectId},
|
|
128417
|
-
${obs.sessionId},
|
|
128418
|
-
${obs.source},
|
|
128419
|
-
${obs.category ?? null},
|
|
128420
|
-
${obs.payloadJson},
|
|
128421
|
-
${obs.importance},
|
|
128422
|
-
${obs.createdAt}::bigint,
|
|
128423
|
-
${obs.agentId ?? null},
|
|
128424
|
-
${obs.attributionSource ?? null}
|
|
128425
|
-
)
|
|
128426
|
-
ON CONFLICT (id) DO UPDATE SET
|
|
128427
|
-
project_id = EXCLUDED.project_id,
|
|
128428
|
-
session_id = EXCLUDED.session_id,
|
|
128429
|
-
source = EXCLUDED.source,
|
|
128430
|
-
category = EXCLUDED.category,
|
|
128431
|
-
payload_json = EXCLUDED.payload_json,
|
|
128432
|
-
importance = EXCLUDED.importance,
|
|
128433
|
-
created_at = EXCLUDED.created_at,
|
|
128434
|
-
agent_id = EXCLUDED.agent_id,
|
|
128435
|
-
attribution_source = EXCLUDED.attribution_source
|
|
128436
|
-
`;
|
|
128437
|
-
} catch (e) {
|
|
128438
|
-
logger.warn("PgObservationStore.insert failed (best-effort)", {
|
|
128439
|
-
id: obs.id,
|
|
128440
|
-
error: e.message
|
|
128441
|
-
});
|
|
128618
|
+
this.chainWrite(obs.id, async () => {
|
|
128619
|
+
const prisma2 = this.getClient();
|
|
128620
|
+
const canonicalProjectId = await getProjectIdentityAliasResolver().resolve(obs.projectId);
|
|
128621
|
+
if (canonicalProjectId !== obs.projectId) {
|
|
128622
|
+
this.mirror.set(obs.id, { ...obs, projectId: canonicalProjectId });
|
|
128442
128623
|
}
|
|
128443
|
-
|
|
128624
|
+
await prisma2.$executeRaw`
|
|
128625
|
+
INSERT INTO observations (
|
|
128626
|
+
id, project_id, session_id, source, category, payload_json, importance, created_at, agent_id, attribution_source
|
|
128627
|
+
) VALUES (
|
|
128628
|
+
${obs.id},
|
|
128629
|
+
${canonicalProjectId},
|
|
128630
|
+
${obs.sessionId},
|
|
128631
|
+
${obs.source},
|
|
128632
|
+
${obs.category ?? null},
|
|
128633
|
+
${obs.payloadJson},
|
|
128634
|
+
${obs.importance},
|
|
128635
|
+
${obs.createdAt}::bigint,
|
|
128636
|
+
${obs.agentId ?? null},
|
|
128637
|
+
${obs.attributionSource ?? null}
|
|
128638
|
+
)
|
|
128639
|
+
ON CONFLICT (id) DO UPDATE SET
|
|
128640
|
+
project_id = EXCLUDED.project_id,
|
|
128641
|
+
session_id = EXCLUDED.session_id,
|
|
128642
|
+
source = EXCLUDED.source,
|
|
128643
|
+
category = EXCLUDED.category,
|
|
128644
|
+
payload_json = EXCLUDED.payload_json,
|
|
128645
|
+
importance = EXCLUDED.importance,
|
|
128646
|
+
created_at = EXCLUDED.created_at,
|
|
128647
|
+
agent_id = EXCLUDED.agent_id,
|
|
128648
|
+
attribution_source = EXCLUDED.attribution_source
|
|
128649
|
+
`;
|
|
128650
|
+
});
|
|
128651
|
+
}
|
|
128652
|
+
chainWrite(key, fn) {
|
|
128653
|
+
const prev = this.inflight.get(key) ?? Promise.resolve();
|
|
128654
|
+
const next = prev.then(fn).catch((e) => {
|
|
128655
|
+
logger.warn("PgObservationStore.insert failed (best-effort)", {
|
|
128656
|
+
id: key,
|
|
128657
|
+
error: e.message
|
|
128658
|
+
});
|
|
128659
|
+
});
|
|
128660
|
+
this.inflight.set(key, next);
|
|
128661
|
+
next.then(() => {
|
|
128662
|
+
if (this.inflight.get(key) === next)
|
|
128663
|
+
this.inflight.delete(key);
|
|
128664
|
+
});
|
|
128444
128665
|
}
|
|
128445
128666
|
listRecent(projectId, limit) {
|
|
128446
128667
|
this.ensureHydrated();
|
|
@@ -128467,6 +128688,9 @@ class PgObservationStore {
|
|
|
128467
128688
|
await this.ensureHydrated();
|
|
128468
128689
|
}
|
|
128469
128690
|
async __drain() {
|
|
128691
|
+
const pending = Array.from(this.inflight.values());
|
|
128692
|
+
if (pending.length > 0)
|
|
128693
|
+
await Promise.allSettled(pending);
|
|
128470
128694
|
await new Promise((r) => setTimeout(r, 10));
|
|
128471
128695
|
}
|
|
128472
128696
|
}
|
|
@@ -129947,9 +130171,9 @@ var init_scheduler2 = __esm(() => {
|
|
|
129947
130171
|
});
|
|
129948
130172
|
|
|
129949
130173
|
// ../../packages/core/dist/services/pricing/models-dev-client.js
|
|
129950
|
-
import
|
|
130174
|
+
import fs17 from "fs/promises";
|
|
129951
130175
|
import { existsSync as existsSync4 } from "fs";
|
|
129952
|
-
import
|
|
130176
|
+
import path23 from "path";
|
|
129953
130177
|
function getModelsDevClient() {
|
|
129954
130178
|
if (!clientInstance) {
|
|
129955
130179
|
clientInstance = new ModelsDevClient;
|
|
@@ -129969,7 +130193,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
129969
130193
|
memoryCacheTimestamp = 0;
|
|
129970
130194
|
getLocalCachePath() {
|
|
129971
130195
|
const dataDir = config.get("dataDir");
|
|
129972
|
-
return
|
|
130196
|
+
return path23.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
|
|
129973
130197
|
}
|
|
129974
130198
|
async loadLocalCache() {
|
|
129975
130199
|
const cachePath = this.getLocalCachePath();
|
|
@@ -129977,7 +130201,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
129977
130201
|
if (!existsSync4(cachePath)) {
|
|
129978
130202
|
return null;
|
|
129979
130203
|
}
|
|
129980
|
-
const content = await
|
|
130204
|
+
const content = await fs17.readFile(cachePath, "utf-8");
|
|
129981
130205
|
const data = JSON.parse(content);
|
|
129982
130206
|
const age = Date.now() - data.timestamp;
|
|
129983
130207
|
if (age > ModelsDevClient.LOCAL_CACHE_TTL) {
|
|
@@ -130004,14 +130228,14 @@ var init_models_dev_client = __esm(() => {
|
|
|
130004
130228
|
async saveLocalCache(models) {
|
|
130005
130229
|
const cachePath = this.getLocalCachePath();
|
|
130006
130230
|
try {
|
|
130007
|
-
const dir =
|
|
130008
|
-
await
|
|
130231
|
+
const dir = path23.dirname(cachePath);
|
|
130232
|
+
await fs17.mkdir(dir, { recursive: true });
|
|
130009
130233
|
const data = {
|
|
130010
130234
|
timestamp: Date.now(),
|
|
130011
130235
|
version: "1.0.0",
|
|
130012
130236
|
models: Object.fromEntries(models)
|
|
130013
130237
|
};
|
|
130014
|
-
await
|
|
130238
|
+
await fs17.writeFile(cachePath, JSON.stringify(data), "utf-8");
|
|
130015
130239
|
logger.debug("Saved pricing to local cache", {
|
|
130016
130240
|
models: models.size,
|
|
130017
130241
|
path: cachePath
|
|
@@ -130340,7 +130564,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
130340
130564
|
const cachePath = this.getLocalCachePath();
|
|
130341
130565
|
try {
|
|
130342
130566
|
if (existsSync4(cachePath)) {
|
|
130343
|
-
await
|
|
130567
|
+
await fs17.unlink(cachePath);
|
|
130344
130568
|
logger.debug("Local pricing cache file deleted");
|
|
130345
130569
|
}
|
|
130346
130570
|
} catch (error51) {
|
|
@@ -130943,8 +131167,8 @@ function stripNul(content) {
|
|
|
130943
131167
|
}
|
|
130944
131168
|
|
|
130945
131169
|
// ../../packages/core/dist/services/etl/stages/discover.js
|
|
130946
|
-
import
|
|
130947
|
-
import
|
|
131170
|
+
import fs18 from "fs/promises";
|
|
131171
|
+
import path24 from "path";
|
|
130948
131172
|
import { createHash as createHash8 } from "crypto";
|
|
130949
131173
|
|
|
130950
131174
|
class DiscoverStage {
|
|
@@ -130970,7 +131194,7 @@ class DiscoverStage {
|
|
|
130970
131194
|
dot: false,
|
|
130971
131195
|
absolute: false
|
|
130972
131196
|
});
|
|
130973
|
-
relPaths = found.map((p) =>
|
|
131197
|
+
relPaths = found.map((p) => path24.isAbsolute(p) ? path24.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
|
|
130974
131198
|
}
|
|
130975
131199
|
if (ctx.resumeCursor?.path) {
|
|
130976
131200
|
const cursorPath = ctx.resumeCursor.path;
|
|
@@ -131029,10 +131253,10 @@ class DiscoverStage {
|
|
|
131029
131253
|
return discovered;
|
|
131030
131254
|
}
|
|
131031
131255
|
async processFile(ctx, relativePath, forceReindex) {
|
|
131032
|
-
const absolutePath =
|
|
131256
|
+
const absolutePath = path24.join(ctx.projectPath, relativePath);
|
|
131033
131257
|
try {
|
|
131034
|
-
const stat = await
|
|
131035
|
-
const content = stripNul(await
|
|
131258
|
+
const stat = await fs18.stat(absolutePath);
|
|
131259
|
+
const content = stripNul(await fs18.readFile(absolutePath, "utf-8"));
|
|
131036
131260
|
const contentHash = createHash8("sha256").update(content).digest("hex");
|
|
131037
131261
|
let needsReparse = forceReindex;
|
|
131038
131262
|
if (!forceReindex) {
|
|
@@ -131075,8 +131299,8 @@ class DiscoverStage {
|
|
|
131075
131299
|
ig.add(pattern);
|
|
131076
131300
|
}
|
|
131077
131301
|
try {
|
|
131078
|
-
const gitignorePath =
|
|
131079
|
-
const gitignoreContent = await
|
|
131302
|
+
const gitignorePath = path24.join(projectPath, ".gitignore");
|
|
131303
|
+
const gitignoreContent = await fs18.readFile(gitignorePath, "utf8");
|
|
131080
131304
|
const rules = gitignoreContent.split(`
|
|
131081
131305
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
131082
131306
|
ig.add(rules);
|
|
@@ -132431,8 +132655,8 @@ function rustUseLeaves(node, source, prefix = []) {
|
|
|
132431
132655
|
}
|
|
132432
132656
|
if (node.type === "use_wildcard")
|
|
132433
132657
|
return [{ path: [...prefix, "*"], glob: true }];
|
|
132434
|
-
const
|
|
132435
|
-
return
|
|
132658
|
+
const path25 = rustPathSegments(node, source);
|
|
132659
|
+
return path25.length ? [{ path: [...prefix, ...path25] }] : [];
|
|
132436
132660
|
}
|
|
132437
132661
|
function functionalCaptures(captures, source, family) {
|
|
132438
132662
|
if (family !== "clojure")
|
|
@@ -133404,8 +133628,8 @@ var init_structural_runtime = __esm(() => {
|
|
|
133404
133628
|
});
|
|
133405
133629
|
|
|
133406
133630
|
// ../../packages/core/dist/services/etl/stages/parse.js
|
|
133407
|
-
import
|
|
133408
|
-
import
|
|
133631
|
+
import path25 from "path";
|
|
133632
|
+
import fs19 from "fs/promises";
|
|
133409
133633
|
function resolveChunkerMaxChars() {
|
|
133410
133634
|
const global2 = Number(process.env.EMBEDDING_MAX_CHARS);
|
|
133411
133635
|
if (Number.isFinite(global2) && global2 > 0)
|
|
@@ -133433,8 +133657,8 @@ class ParseStage {
|
|
|
133433
133657
|
const results = new Map;
|
|
133434
133658
|
let processed = 0;
|
|
133435
133659
|
const phases = [
|
|
133436
|
-
files.filter((file2) =>
|
|
133437
|
-
files.filter((file2) =>
|
|
133660
|
+
files.filter((file2) => path25.extname(file2.relativePath).toLowerCase() !== ".h"),
|
|
133661
|
+
files.filter((file2) => path25.extname(file2.relativePath).toLowerCase() === ".h")
|
|
133438
133662
|
];
|
|
133439
133663
|
const batches = phases.flatMap((phase) => Array.from({ length: Math.ceil(phase.length / BATCH_SIZE) }, (_, index) => phase.slice(index * BATCH_SIZE, (index + 1) * BATCH_SIZE)));
|
|
133440
133664
|
for (const batch of batches) {
|
|
@@ -133472,19 +133696,19 @@ class ParseStage {
|
|
|
133472
133696
|
return files.map((file2) => results.get(file2.relativePath));
|
|
133473
133697
|
}
|
|
133474
133698
|
recordHeaderImporterEvidence(ctx, files, parsedFiles) {
|
|
133475
|
-
const knownHeaders = new Set(files.filter((file2) =>
|
|
133699
|
+
const knownHeaders = new Set(files.filter((file2) => path25.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path25.posix.normalize(file2.relativePath)));
|
|
133476
133700
|
const mutable = {
|
|
133477
133701
|
...ctx.structuralHeaderEvidenceByFile
|
|
133478
133702
|
};
|
|
133479
133703
|
for (const parsed of parsedFiles) {
|
|
133480
|
-
const extension =
|
|
133704
|
+
const extension = path25.extname(parsed.file.relativePath).toLowerCase();
|
|
133481
133705
|
const key = extension === ".c" ? "cImporters" : [".cpp", ".hpp"].includes(extension) ? "cppImporters" : undefined;
|
|
133482
133706
|
if (!key)
|
|
133483
133707
|
continue;
|
|
133484
133708
|
for (const imported of parsed.rawImports) {
|
|
133485
133709
|
if (!["c_include", "cpp_include"].includes(imported.form) || imported.specifier.startsWith("<"))
|
|
133486
133710
|
continue;
|
|
133487
|
-
const header =
|
|
133711
|
+
const header = path25.posix.normalize(path25.posix.join(path25.posix.dirname(parsed.file.relativePath), imported.specifier));
|
|
133488
133712
|
if (!knownHeaders.has(header))
|
|
133489
133713
|
continue;
|
|
133490
133714
|
const existing = mutable[header] ?? {};
|
|
@@ -133495,9 +133719,9 @@ class ParseStage {
|
|
|
133495
133719
|
}
|
|
133496
133720
|
async parseFile(ctx, file2) {
|
|
133497
133721
|
if (!file2.needsReparse) {
|
|
133498
|
-
const extension =
|
|
133722
|
+
const extension = path25.extname(file2.relativePath).toLowerCase();
|
|
133499
133723
|
if ([".c", ".cpp", ".hpp"].includes(extension)) {
|
|
133500
|
-
const content = file2.snapshotContent ?? await
|
|
133724
|
+
const content = file2.snapshotContent ?? await fs19.readFile(file2.absolutePath, "utf8");
|
|
133501
133725
|
const outcome = await this.runtime.parse({ extension, source: Buffer.from(content) });
|
|
133502
133726
|
if (outcome.status === "failed")
|
|
133503
133727
|
throw new StructuralEtlParseError(file2.relativePath, outcome.failureKind, `Structural evidence parse failed (${outcome.failureKind})`, outcome.diagnosticCount, outcome.diagnostics.slice(0, 10));
|
|
@@ -133509,8 +133733,8 @@ class ParseStage {
|
|
|
133509
133733
|
return { file: file2, chunks: [], symbols: [], rawImports: [], rawEdges: [] };
|
|
133510
133734
|
}
|
|
133511
133735
|
try {
|
|
133512
|
-
const content = file2.snapshotContent ?? await
|
|
133513
|
-
const ext2 =
|
|
133736
|
+
const content = file2.snapshotContent ?? await fs19.readFile(file2.absolutePath, "utf-8");
|
|
133737
|
+
const ext2 = path25.extname(file2.relativePath).toLowerCase();
|
|
133514
133738
|
const chunkerMaxChars = resolveChunkerMaxChars();
|
|
133515
133739
|
const chunks = smartChunk(content, file2.relativePath, chunkerMaxChars ? { maxChunkChars: chunkerMaxChars } : {});
|
|
133516
133740
|
let symbols;
|
|
@@ -134064,7 +134288,7 @@ var init_resolver = __esm(() => {
|
|
|
134064
134288
|
});
|
|
134065
134289
|
|
|
134066
134290
|
// ../../packages/core/dist/services/structural/resolvers/typescript.js
|
|
134067
|
-
import
|
|
134291
|
+
import path26 from "path";
|
|
134068
134292
|
function candidates(identities) {
|
|
134069
134293
|
return Object.freeze(identities.map((identity) => Object.freeze({
|
|
134070
134294
|
fqn: identity.fqn,
|
|
@@ -134159,7 +134383,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
134159
134383
|
const bases = /\.[cm]?jsx?$/u.test(base) ? [base.replace(/\.[cm]?jsx?$/u, ".ts"), base.replace(/\.[cm]?jsx?$/u, ".tsx"), base] : [base];
|
|
134160
134384
|
for (const candidateBase of bases)
|
|
134161
134385
|
for (const suffix of DIALECT_PROBES[dialect] ?? [""]) {
|
|
134162
|
-
const value =
|
|
134386
|
+
const value = path26.posix.normalize(`${candidateBase}${suffix}`);
|
|
134163
134387
|
if (!value.startsWith("../") && value !== ".." && known.has(value))
|
|
134164
134388
|
return value;
|
|
134165
134389
|
}
|
|
@@ -134168,7 +134392,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
134168
134392
|
function resolveStructuralSpecifier(specifier, fromFile, build, dialect = "typescript") {
|
|
134169
134393
|
const known = new Set(build.knownFiles.map(normalizeStructuralFile));
|
|
134170
134394
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
134171
|
-
return probe(
|
|
134395
|
+
return probe(path26.posix.join(path26.posix.dirname(fromFile), specifier), known, dialect);
|
|
134172
134396
|
}
|
|
134173
134397
|
const aliases = build.pathAliasesByFile?.[normalizeStructuralFile(fromFile)] ?? build.pathAliases ?? [];
|
|
134174
134398
|
for (const alias of aliases) {
|
|
@@ -134432,7 +134656,7 @@ var init_scripting2 = __esm(() => {
|
|
|
134432
134656
|
});
|
|
134433
134657
|
|
|
134434
134658
|
// ../../packages/core/dist/services/structural/resolvers/systems.js
|
|
134435
|
-
import
|
|
134659
|
+
import path27 from "path";
|
|
134436
134660
|
var DIALECTS, SYSTEMS_LANGUAGE_RESOLVER;
|
|
134437
134661
|
var init_systems2 = __esm(() => {
|
|
134438
134662
|
init_typescript2();
|
|
@@ -134451,7 +134675,7 @@ var init_systems2 = __esm(() => {
|
|
|
134451
134675
|
const bindings = item.bindings.map((binding) => binding.imported === "*" && binding.local === "*" && unresolvedTarget && !unresolvedTarget.qualifier ? { ...binding, imported: unresolvedTarget.name, local: unresolvedTarget.name } : binding);
|
|
134452
134676
|
if (item.specifier === "crate" || item.specifier.startsWith("crate/")) {
|
|
134453
134677
|
const crateRoot = file2.file.startsWith("src/") ? "src" : "";
|
|
134454
|
-
return { ...item, bindings, specifier: `./${
|
|
134678
|
+
return { ...item, bindings, specifier: `./${path27.posix.relative(path27.posix.dirname(file2.file), path27.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
|
|
134455
134679
|
}
|
|
134456
134680
|
if (item.specifier === "self" || item.specifier.startsWith("self/"))
|
|
134457
134681
|
return { ...item, bindings, specifier: `./${item.specifier.replace(/^self\/?/u, "")}` };
|
|
@@ -134549,8 +134773,8 @@ var init_data_document2 = __esm(() => {
|
|
|
134549
134773
|
});
|
|
134550
134774
|
|
|
134551
134775
|
// ../../packages/core/dist/services/etl/stages/resolve.js
|
|
134552
|
-
import
|
|
134553
|
-
import
|
|
134776
|
+
import path28 from "path";
|
|
134777
|
+
import fs20 from "fs";
|
|
134554
134778
|
|
|
134555
134779
|
class ResolveStage {
|
|
134556
134780
|
symbolRepository;
|
|
@@ -134574,7 +134798,7 @@ class ResolveStage {
|
|
|
134574
134798
|
const structuralDocuments = files.flatMap((file2) => {
|
|
134575
134799
|
if (!file2.structure)
|
|
134576
134800
|
return [];
|
|
134577
|
-
const language = resolveStructuralLanguage(
|
|
134801
|
+
const language = resolveStructuralLanguage(path28.extname(file2.file.relativePath));
|
|
134578
134802
|
if (language.status !== "supported")
|
|
134579
134803
|
throw new Error(`structural_manifest_missing:${file2.file.relativePath}`);
|
|
134580
134804
|
return [{
|
|
@@ -134586,13 +134810,13 @@ class ResolveStage {
|
|
|
134586
134810
|
}];
|
|
134587
134811
|
});
|
|
134588
134812
|
const currentStructuralFiles = new Set(structuralDocuments.map((document2) => document2.file));
|
|
134589
|
-
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
134813
|
+
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path28.extname(item.file.relativePath).toLowerCase())).map((item) => item.file.relativePath));
|
|
134590
134814
|
const pathAliasesByFile = Object.fromEntries([...knownRelPaths].map((file2) => [
|
|
134591
134815
|
file2,
|
|
134592
134816
|
this.structuralAliasesFor(file2, rootAliases, monorepoPackages)
|
|
134593
134817
|
]));
|
|
134594
134818
|
const buildMetadata = { knownFiles: [...knownRelPaths], pathAliasesByFile };
|
|
134595
|
-
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(
|
|
134819
|
+
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(path28.extname(definition.file_path).toLowerCase())).filter((definition) => knownRelPaths.has(definition.file_path) && skippedStructuralFiles.has(definition.file_path)).filter((definition) => !currentStructuralFiles.has(definition.file_path));
|
|
134596
134820
|
const seedIds = new Set;
|
|
134597
134821
|
for (const definition of seedRows) {
|
|
134598
134822
|
if (seedIds.has(definition.id))
|
|
@@ -134685,7 +134909,7 @@ class ResolveStage {
|
|
|
134685
134909
|
if (parsed.file !== definition.file_path) {
|
|
134686
134910
|
throw new Error(`structural_repository_seed_file_mismatch:${definition.id}`);
|
|
134687
134911
|
}
|
|
134688
|
-
const language = resolveStructuralLanguage(
|
|
134912
|
+
const language = resolveStructuralLanguage(path28.extname(definition.file_path));
|
|
134689
134913
|
if (language.status !== "supported")
|
|
134690
134914
|
throw new Error(`structural_repository_seed_language:${definition.id}`);
|
|
134691
134915
|
let identity;
|
|
@@ -134737,7 +134961,7 @@ class ResolveStage {
|
|
|
134737
134961
|
});
|
|
134738
134962
|
}
|
|
134739
134963
|
resolveFile(parsed, projectPath, knownRelPaths, rootAliases, monorepoPackages, symbolIndex, knownFqns) {
|
|
134740
|
-
const fromDir =
|
|
134964
|
+
const fromDir = path28.dirname(path28.join(projectPath, parsed.file.relativePath));
|
|
134741
134965
|
const packageAliases = this.getPackageAliases(parsed.file.relativePath, monorepoPackages);
|
|
134742
134966
|
const allAliases = [...packageAliases, ...rootAliases];
|
|
134743
134967
|
const resolvedImports = parsed.rawImports.map((raw2) => {
|
|
@@ -134808,7 +135032,7 @@ class ResolveStage {
|
|
|
134808
135032
|
index.set(def.name, `${def.file_path}#${def.name}`);
|
|
134809
135033
|
}
|
|
134810
135034
|
} catch (err) {
|
|
134811
|
-
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
135035
|
+
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path28.extname(file2.file.relativePath).toLowerCase()));
|
|
134812
135036
|
if (skippedStructural)
|
|
134813
135037
|
throw new Error("structural_repository_seed_failed", { cause: err });
|
|
134814
135038
|
logger.warn("buildSymbolIndex: repo seed failed, in-batch only", {
|
|
@@ -134832,7 +135056,7 @@ class ResolveStage {
|
|
|
134832
135056
|
}
|
|
134833
135057
|
resolveSpecifier(specifier, fromDir, projectPath, knownRelPaths, aliases) {
|
|
134834
135058
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
134835
|
-
const resolved = this.probeExtensions(
|
|
135059
|
+
const resolved = this.probeExtensions(path28.resolve(fromDir, specifier), projectPath, knownRelPaths);
|
|
134836
135060
|
return { resolvedPath: resolved, external: false };
|
|
134837
135061
|
}
|
|
134838
135062
|
for (const alias of aliases) {
|
|
@@ -134840,8 +135064,8 @@ class ResolveStage {
|
|
|
134840
135064
|
const suffix = specifier.slice(alias.prefix.length);
|
|
134841
135065
|
for (const target of alias.targets) {
|
|
134842
135066
|
const cleanTarget = target.replace(/\/\*$/, "");
|
|
134843
|
-
const basePath = alias.packagePath ?
|
|
134844
|
-
const absPath =
|
|
135067
|
+
const basePath = alias.packagePath ? path28.join(projectPath, alias.packagePath) : projectPath;
|
|
135068
|
+
const absPath = path28.join(basePath, cleanTarget + suffix);
|
|
134845
135069
|
const resolved = this.probeExtensions(absPath, projectPath, knownRelPaths);
|
|
134846
135070
|
if (resolved)
|
|
134847
135071
|
return { resolvedPath: resolved, external: false };
|
|
@@ -134857,7 +135081,7 @@ class ResolveStage {
|
|
|
134857
135081
|
...TS_EXTENSIONS.map((ext2) => absPath.replace(/\.[^.]+$/, ext2))
|
|
134858
135082
|
];
|
|
134859
135083
|
for (const candidate2 of candidates2) {
|
|
134860
|
-
const rel =
|
|
135084
|
+
const rel = path28.relative(projectPath, candidate2).replace(/\\/g, "/");
|
|
134861
135085
|
if (knownRelPaths.has(rel))
|
|
134862
135086
|
return rel;
|
|
134863
135087
|
}
|
|
@@ -134865,9 +135089,9 @@ class ResolveStage {
|
|
|
134865
135089
|
}
|
|
134866
135090
|
loadTsConfigPaths(projectPath, packageBase) {
|
|
134867
135091
|
const aliases = [];
|
|
134868
|
-
const tsconfigPath =
|
|
135092
|
+
const tsconfigPath = path28.join(projectPath, "tsconfig.json");
|
|
134869
135093
|
try {
|
|
134870
|
-
const raw2 =
|
|
135094
|
+
const raw2 = fs20.readFileSync(tsconfigPath, "utf-8");
|
|
134871
135095
|
const stripped = raw2.replace(/\/\/[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
134872
135096
|
const tsconfig = JSON.parse(stripped);
|
|
134873
135097
|
const paths = tsconfig?.compilerOptions?.paths ?? {};
|
|
@@ -134896,7 +135120,7 @@ class ResolveStage {
|
|
|
134896
135120
|
}
|
|
134897
135121
|
}
|
|
134898
135122
|
for (const packageRelPath of packagePaths) {
|
|
134899
|
-
const absPackagePath =
|
|
135123
|
+
const absPackagePath = path28.join(projectPath, packageRelPath);
|
|
134900
135124
|
const aliases = this.loadTsConfigPaths(absPackagePath, packageRelPath);
|
|
134901
135125
|
if (aliases.length > 0) {
|
|
134902
135126
|
packages.push({
|
|
@@ -134926,7 +135150,7 @@ class ResolveStage {
|
|
|
134926
135150
|
structuralAliasesFor(filePath, rootAliases, packages) {
|
|
134927
135151
|
return [...this.getPackageAliases(filePath, packages), ...rootAliases].map((alias) => ({
|
|
134928
135152
|
pattern: alias.prefix + (alias.targets.some((target) => target.includes("*")) ? "/*" : ""),
|
|
134929
|
-
targets: alias.targets.map((target) => alias.packagePath ?
|
|
135153
|
+
targets: alias.targets.map((target) => alias.packagePath ? path28.posix.join(alias.packagePath, target) : target)
|
|
134930
135154
|
}));
|
|
134931
135155
|
}
|
|
134932
135156
|
}
|
|
@@ -134990,7 +135214,7 @@ var init_with_deadlock_retry = __esm(() => {
|
|
|
134990
135214
|
});
|
|
134991
135215
|
|
|
134992
135216
|
// ../../packages/core/dist/services/etl/stages/load.js
|
|
134993
|
-
import
|
|
135217
|
+
import path29 from "path";
|
|
134994
135218
|
function formatDuration(ms) {
|
|
134995
135219
|
const totalSec = Math.max(0, Math.round(ms / 1000));
|
|
134996
135220
|
if (totalSec < 60)
|
|
@@ -135267,7 +135491,7 @@ class LoadStage {
|
|
|
135267
135491
|
const filePath = file2.file.relativePath;
|
|
135268
135492
|
const batch = buildSymbolPersistenceBatch(ctx.projectId, file2);
|
|
135269
135493
|
if (ctx.graphGenerationLease) {
|
|
135270
|
-
const manifest = getLanguageManifestEntry(
|
|
135494
|
+
const manifest = getLanguageManifestEntry(path29.extname(filePath));
|
|
135271
135495
|
const diagnostics2 = (file2.structuralDiagnostics ?? []).slice(0, 10).map((diagnostic2) => ({
|
|
135272
135496
|
code: diagnostic2.code,
|
|
135273
135497
|
severity: diagnostic2.severity,
|
|
@@ -135724,9 +135948,9 @@ var init_graph_generation_coordinator = __esm(() => {
|
|
|
135724
135948
|
// ../../packages/core/dist/services/etl/pipeline.js
|
|
135725
135949
|
import { createHash as createHash10 } from "crypto";
|
|
135726
135950
|
import { setTimeout as delay2 } from "timers/promises";
|
|
135727
|
-
import
|
|
135951
|
+
import path30 from "path";
|
|
135728
135952
|
function buildHeaderLanguageEvidence(files) {
|
|
135729
|
-
const headers = new Set(files.filter((file2) =>
|
|
135953
|
+
const headers = new Set(files.filter((file2) => path30.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path30.posix.normalize(file2.relativePath)));
|
|
135730
135954
|
const mutable = new Map;
|
|
135731
135955
|
const entry2 = (header) => {
|
|
135732
135956
|
let value = mutable.get(header);
|
|
@@ -135737,7 +135961,7 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
135737
135961
|
return value;
|
|
135738
135962
|
};
|
|
135739
135963
|
for (const file2 of files) {
|
|
135740
|
-
if (
|
|
135964
|
+
if (path30.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
|
|
135741
135965
|
continue;
|
|
135742
135966
|
let commands;
|
|
135743
135967
|
try {
|
|
@@ -135753,11 +135977,11 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
135753
135977
|
const record2 = command;
|
|
135754
135978
|
if (typeof record2.file !== "string")
|
|
135755
135979
|
continue;
|
|
135756
|
-
const projectRoot =
|
|
135757
|
-
const commandDirectory = typeof record2.directory === "string" ?
|
|
135758
|
-
const absoluteInput =
|
|
135759
|
-
const relative3 =
|
|
135760
|
-
const header =
|
|
135980
|
+
const projectRoot = path30.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
|
|
135981
|
+
const commandDirectory = typeof record2.directory === "string" ? path30.resolve(projectRoot, record2.directory) : projectRoot;
|
|
135982
|
+
const absoluteInput = path30.resolve(commandDirectory, record2.file);
|
|
135983
|
+
const relative3 = path30.relative(projectRoot, absoluteInput);
|
|
135984
|
+
const header = path30.posix.normalize(relative3.replaceAll(path30.sep, "/"));
|
|
135761
135985
|
if (!headers.has(header))
|
|
135762
135986
|
continue;
|
|
135763
135987
|
const invocation = typeof record2.command === "string" ? record2.command : Array.isArray(record2.arguments) ? record2.arguments.join(" ") : "";
|
|
@@ -141639,33 +141863,33 @@ var require_URL = __commonJS((exports, module) => {
|
|
|
141639
141863
|
else
|
|
141640
141864
|
return basepath.substring(0, lastslash + 1) + refpath;
|
|
141641
141865
|
}
|
|
141642
|
-
function remove_dot_segments(
|
|
141643
|
-
if (!
|
|
141644
|
-
return
|
|
141866
|
+
function remove_dot_segments(path31) {
|
|
141867
|
+
if (!path31)
|
|
141868
|
+
return path31;
|
|
141645
141869
|
var output = "";
|
|
141646
|
-
while (
|
|
141647
|
-
if (
|
|
141648
|
-
|
|
141870
|
+
while (path31.length > 0) {
|
|
141871
|
+
if (path31 === "." || path31 === "..") {
|
|
141872
|
+
path31 = "";
|
|
141649
141873
|
break;
|
|
141650
141874
|
}
|
|
141651
|
-
var twochars =
|
|
141652
|
-
var threechars =
|
|
141653
|
-
var fourchars =
|
|
141875
|
+
var twochars = path31.substring(0, 2);
|
|
141876
|
+
var threechars = path31.substring(0, 3);
|
|
141877
|
+
var fourchars = path31.substring(0, 4);
|
|
141654
141878
|
if (threechars === "../") {
|
|
141655
|
-
|
|
141879
|
+
path31 = path31.substring(3);
|
|
141656
141880
|
} else if (twochars === "./") {
|
|
141657
|
-
|
|
141881
|
+
path31 = path31.substring(2);
|
|
141658
141882
|
} else if (threechars === "/./") {
|
|
141659
|
-
|
|
141660
|
-
} else if (twochars === "/." &&
|
|
141661
|
-
|
|
141662
|
-
} else if (fourchars === "/../" || threechars === "/.." &&
|
|
141663
|
-
|
|
141883
|
+
path31 = "/" + path31.substring(3);
|
|
141884
|
+
} else if (twochars === "/." && path31.length === 2) {
|
|
141885
|
+
path31 = "/";
|
|
141886
|
+
} else if (fourchars === "/../" || threechars === "/.." && path31.length === 3) {
|
|
141887
|
+
path31 = "/" + path31.substring(4);
|
|
141664
141888
|
output = output.replace(/\/?[^\/]*$/, "");
|
|
141665
141889
|
} else {
|
|
141666
|
-
var segment =
|
|
141890
|
+
var segment = path31.match(/(\/?([^\/]*))/)[0];
|
|
141667
141891
|
output += segment;
|
|
141668
|
-
|
|
141892
|
+
path31 = path31.substring(segment.length);
|
|
141669
141893
|
}
|
|
141670
141894
|
}
|
|
141671
141895
|
return output;
|
|
@@ -153735,21 +153959,21 @@ function jsonToKeyPathChunks(value, label = "$") {
|
|
|
153735
153959
|
walk(value, label, out);
|
|
153736
153960
|
return out;
|
|
153737
153961
|
}
|
|
153738
|
-
function walk(val,
|
|
153962
|
+
function walk(val, path31, out) {
|
|
153739
153963
|
if (val === null || val === undefined)
|
|
153740
153964
|
return;
|
|
153741
153965
|
if (Array.isArray(val)) {
|
|
153742
153966
|
if (val.length === 0) {
|
|
153743
|
-
out.push({ path:
|
|
153967
|
+
out.push({ path: path31, content: `**${path31}** = _[]_` });
|
|
153744
153968
|
return;
|
|
153745
153969
|
}
|
|
153746
153970
|
if (val.every((v) => v !== null && typeof v === "object")) {
|
|
153747
|
-
val.forEach((v, i) => walk(v, `${
|
|
153971
|
+
val.forEach((v, i) => walk(v, `${path31}[${i}]`, out));
|
|
153748
153972
|
return;
|
|
153749
153973
|
}
|
|
153750
153974
|
const items = val.map((v) => `- \`${String(v)}\``).join(`
|
|
153751
153975
|
`);
|
|
153752
|
-
out.push({ path:
|
|
153976
|
+
out.push({ path: path31, content: `**${path31}**
|
|
153753
153977
|
|
|
153754
153978
|
${items}` });
|
|
153755
153979
|
return;
|
|
@@ -153757,16 +153981,16 @@ ${items}` });
|
|
|
153757
153981
|
if (typeof val === "object") {
|
|
153758
153982
|
const entries = Object.entries(val);
|
|
153759
153983
|
if (entries.length === 0) {
|
|
153760
|
-
out.push({ path:
|
|
153984
|
+
out.push({ path: path31, content: `**${path31}** = _{}_` });
|
|
153761
153985
|
return;
|
|
153762
153986
|
}
|
|
153763
153987
|
for (const [k, v] of entries) {
|
|
153764
153988
|
const safeKey = /^[A-Za-z_$][\w$]*$/.test(k) ? k : JSON.stringify(k);
|
|
153765
|
-
walk(v, `${
|
|
153989
|
+
walk(v, `${path31}.${safeKey}`, out);
|
|
153766
153990
|
}
|
|
153767
153991
|
return;
|
|
153768
153992
|
}
|
|
153769
|
-
out.push({ path:
|
|
153993
|
+
out.push({ path: path31, content: `**${path31}** = \`${String(val)}\`` });
|
|
153770
153994
|
}
|
|
153771
153995
|
var gfm, STRIP_SELECTORS, tdCache = null;
|
|
153772
153996
|
var init_html_to_md = __esm(() => {
|
|
@@ -154191,8 +154415,8 @@ var init_recover_project = __esm(() => {
|
|
|
154191
154415
|
init_config();
|
|
154192
154416
|
init_dist();
|
|
154193
154417
|
init_inference_providers();
|
|
154194
|
-
import
|
|
154195
|
-
import
|
|
154418
|
+
import os9 from "os";
|
|
154419
|
+
import path31 from "path";
|
|
154196
154420
|
var WRITABLE_PROVIDERS = ["ollama", "lmstudio", "mistral", "openai", "google", "cohere"];
|
|
154197
154421
|
var GENERATOR_MARKER = "scripts/generate-subagent-artifacts.ts";
|
|
154198
154422
|
var GENERATOR_MARKER_MAX_LEVELS = 6;
|
|
@@ -154554,9 +154778,9 @@ Using defaults:`);
|
|
|
154554
154778
|
return 1;
|
|
154555
154779
|
}
|
|
154556
154780
|
const targetOpt = typeof options.target === "string" ? options.target : undefined;
|
|
154557
|
-
const targetHome = targetOpt === undefined ?
|
|
154558
|
-
if (targetHome !==
|
|
154559
|
-
console.error(`Error: --target ${targetHome} is not your home (${
|
|
154781
|
+
const targetHome = targetOpt === undefined ? os9.homedir() : path31.resolve(targetOpt);
|
|
154782
|
+
if (targetHome !== os9.homedir() && options.yes !== true) {
|
|
154783
|
+
console.error(`Error: --target ${targetHome} is not your home (${os9.homedir()}) \u2014 pass --yes to confirm writing there`);
|
|
154560
154784
|
return 1;
|
|
154561
154785
|
}
|
|
154562
154786
|
const dryRun = options["dry-run"] === true;
|
|
@@ -154574,7 +154798,7 @@ Using defaults:`);
|
|
|
154574
154798
|
const report = applyBootstrapState({
|
|
154575
154799
|
targetHome,
|
|
154576
154800
|
dryRun,
|
|
154577
|
-
sourcePath: repoRoot === null ? undefined :
|
|
154801
|
+
sourcePath: repoRoot === null ? undefined : path31.join(repoRoot, "skills", "AGENTS.md")
|
|
154578
154802
|
});
|
|
154579
154803
|
console.log(formatBootstrapReport(report));
|
|
154580
154804
|
return bootstrapReportSucceeded(report) ? 0 : 1;
|