@massa-ai/mcp-client 1.61.0 → 1.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config-cli.js +498 -416
- package/dist/index.js +542 -460
- package/package.json +3 -3
package/dist/config-cli.js
CHANGED
|
@@ -2449,12 +2449,12 @@ import path6 from "path";
|
|
|
2449
2449
|
function isHost(v) {
|
|
2450
2450
|
return typeof v === "string" && HOSTS.includes(v);
|
|
2451
2451
|
}
|
|
2452
|
-
function fileLayout(host, activeDir,
|
|
2452
|
+
function fileLayout(host, activeDir, activeExt, variantsRoot) {
|
|
2453
2453
|
return {
|
|
2454
2454
|
host,
|
|
2455
2455
|
route: "files",
|
|
2456
2456
|
activeDir,
|
|
2457
|
-
|
|
2457
|
+
activeExt,
|
|
2458
2458
|
variantsRoot,
|
|
2459
2459
|
variantDir: (profile) => path6.join(variantsRoot, profile)
|
|
2460
2460
|
};
|
|
@@ -2468,19 +2468,19 @@ function resolveHostLayout(host, opts = {}) {
|
|
|
2468
2468
|
case "claude": {
|
|
2469
2469
|
const marketplaceRoot = opts.marketplaceRoot?.claude;
|
|
2470
2470
|
if (override === undefined && marketplaceRoot !== undefined) {
|
|
2471
|
-
return fileLayout(host, path6.join(marketplaceRoot, "agents"), "
|
|
2471
|
+
return fileLayout(host, path6.join(marketplaceRoot, "agents"), ".md", path6.join(marketplaceRoot, "agent-profiles"));
|
|
2472
2472
|
}
|
|
2473
2473
|
const root = override ?? path6.join(targetHome, ".claude");
|
|
2474
|
-
return fileLayout(host, path6.join(root, "agents"), "
|
|
2474
|
+
return fileLayout(host, path6.join(root, "agents"), ".md", path6.join(root, "massa-ai", "agent-profiles"));
|
|
2475
2475
|
}
|
|
2476
2476
|
case "codex": {
|
|
2477
2477
|
const root = override ?? path6.join(targetHome, ".codex");
|
|
2478
|
-
return fileLayout(host, path6.join(root, "agents"), "
|
|
2478
|
+
return fileLayout(host, path6.join(root, "agents"), ".toml", path6.join(root, "massa-ai", "agent-profiles"));
|
|
2479
2479
|
}
|
|
2480
2480
|
case "opencode": {
|
|
2481
2481
|
const root = override ?? path6.join(targetHome, ".config", "opencode");
|
|
2482
2482
|
const pluginsDir = path6.join(root, "plugins", "massa-ai");
|
|
2483
|
-
return fileLayout(host, path6.join(root, "agents"), "
|
|
2483
|
+
return fileLayout(host, path6.join(root, "agents"), ".md", path6.join(pluginsDir, "agent-profiles"));
|
|
2484
2484
|
}
|
|
2485
2485
|
}
|
|
2486
2486
|
}
|
|
@@ -2814,6 +2814,90 @@ function readInstalledPluginVersion(opts = {}) {
|
|
|
2814
2814
|
var DEFAULT_PLUGIN_KEY = "massa-ai@massa-ai";
|
|
2815
2815
|
var init_claude_marketplace = () => {};
|
|
2816
2816
|
|
|
2817
|
+
// ../../packages/shared/dist/profile-switch/ownership.js
|
|
2818
|
+
import fs6 from "fs";
|
|
2819
|
+
import path10 from "path";
|
|
2820
|
+
function isLegacyAgentName(fileName) {
|
|
2821
|
+
const base = path10.basename(fileName).replace(/\.[^.]*$/, "");
|
|
2822
|
+
return base.startsWith("massa-ai-") && LEGACY_AGENT_NAMES.includes(base.slice("massa-ai-".length));
|
|
2823
|
+
}
|
|
2824
|
+
function hasOwnedMarker(content) {
|
|
2825
|
+
const lines = content.split(`
|
|
2826
|
+
`);
|
|
2827
|
+
if (lines[0] !== "---")
|
|
2828
|
+
return false;
|
|
2829
|
+
const close = lines.indexOf("---", 1);
|
|
2830
|
+
return close !== -1 && lines[close + 1] === OWNED_MARKER_MD;
|
|
2831
|
+
}
|
|
2832
|
+
function isRegularFile(filePath) {
|
|
2833
|
+
try {
|
|
2834
|
+
return fs6.lstatSync(filePath).isFile();
|
|
2835
|
+
} catch {
|
|
2836
|
+
return false;
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
function isOwnedAgentFile(filePath) {
|
|
2840
|
+
if (!isRegularFile(filePath))
|
|
2841
|
+
return false;
|
|
2842
|
+
if (!filePath.endsWith(".toml") && isLegacyAgentName(filePath))
|
|
2843
|
+
return true;
|
|
2844
|
+
let content;
|
|
2845
|
+
try {
|
|
2846
|
+
content = fs6.readFileSync(filePath, "utf8");
|
|
2847
|
+
} catch {
|
|
2848
|
+
return false;
|
|
2849
|
+
}
|
|
2850
|
+
if (filePath.endsWith(".toml"))
|
|
2851
|
+
return content.split(`
|
|
2852
|
+
`)[0] === OWNED_MARKER_TOML;
|
|
2853
|
+
return hasOwnedMarker(content);
|
|
2854
|
+
}
|
|
2855
|
+
function isOwnedAgentLink(linkPath) {
|
|
2856
|
+
try {
|
|
2857
|
+
if (!fs6.lstatSync(linkPath).isSymbolicLink())
|
|
2858
|
+
return false;
|
|
2859
|
+
} catch {
|
|
2860
|
+
return false;
|
|
2861
|
+
}
|
|
2862
|
+
if (isLegacyAgentName(linkPath))
|
|
2863
|
+
return true;
|
|
2864
|
+
const base = path10.basename(linkPath);
|
|
2865
|
+
const target = fs6.readlinkSync(linkPath);
|
|
2866
|
+
if (target.endsWith(`/opencode-plugin/agents/${base}`))
|
|
2867
|
+
return true;
|
|
2868
|
+
const escaped = base.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2869
|
+
if (new RegExp(`/plugins/massa-ai/agent-profiles/.*/${escaped}$`).test(target))
|
|
2870
|
+
return true;
|
|
2871
|
+
try {
|
|
2872
|
+
return fs6.statSync(linkPath).isFile() && hasOwnedMarker(fs6.readFileSync(linkPath, "utf8"));
|
|
2873
|
+
} catch {
|
|
2874
|
+
return false;
|
|
2875
|
+
}
|
|
2876
|
+
}
|
|
2877
|
+
var OWNED_MARKER_MD = "<!-- massa-ai-owned: true -->", OWNED_MARKER_TOML = "# massa-ai-owned", LEGACY_AGENT_NAMES;
|
|
2878
|
+
var init_ownership = __esm(() => {
|
|
2879
|
+
LEGACY_AGENT_NAMES = [
|
|
2880
|
+
"architecture-specialist",
|
|
2881
|
+
"audit-specialist",
|
|
2882
|
+
"builder",
|
|
2883
|
+
"context-curator",
|
|
2884
|
+
"designer",
|
|
2885
|
+
"documentation-agent",
|
|
2886
|
+
"furps-analyst",
|
|
2887
|
+
"investigator",
|
|
2888
|
+
"judge",
|
|
2889
|
+
"meta-judge",
|
|
2890
|
+
"mobile-specialist",
|
|
2891
|
+
"navigator",
|
|
2892
|
+
"plan-critic",
|
|
2893
|
+
"planner",
|
|
2894
|
+
"requirements-analyst",
|
|
2895
|
+
"reviewer",
|
|
2896
|
+
"test-engineer",
|
|
2897
|
+
"verification-agent"
|
|
2898
|
+
];
|
|
2899
|
+
});
|
|
2900
|
+
|
|
2817
2901
|
// ../../packages/shared/dist/profile-switch/frontmatter.js
|
|
2818
2902
|
function parseFrontmatter(raw2) {
|
|
2819
2903
|
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/.exec(raw2);
|
|
@@ -2871,12 +2955,12 @@ function unquoteScalar(s) {
|
|
|
2871
2955
|
}
|
|
2872
2956
|
|
|
2873
2957
|
// ../../packages/shared/dist/profile-switch/doctor.js
|
|
2874
|
-
import
|
|
2958
|
+
import fs7 from "fs";
|
|
2875
2959
|
import os6 from "os";
|
|
2876
|
-
import
|
|
2960
|
+
import path11 from "path";
|
|
2877
2961
|
function readTextFile(filePath) {
|
|
2878
2962
|
try {
|
|
2879
|
-
return
|
|
2963
|
+
return fs7.readFileSync(filePath, "utf8");
|
|
2880
2964
|
} catch {
|
|
2881
2965
|
return null;
|
|
2882
2966
|
}
|
|
@@ -2892,7 +2976,7 @@ function readJsonFile(filePath) {
|
|
|
2892
2976
|
}
|
|
2893
2977
|
}
|
|
2894
2978
|
function readPluginVersion(pluginRoot) {
|
|
2895
|
-
const manifest = readJsonFile(
|
|
2979
|
+
const manifest = readJsonFile(path11.join(pluginRoot, ".claude-plugin", "plugin.json"));
|
|
2896
2980
|
return typeof manifest?.version === "string" ? manifest.version : null;
|
|
2897
2981
|
}
|
|
2898
2982
|
function detectEnvOverride(env) {
|
|
@@ -2905,19 +2989,19 @@ function detectEnvOverride(env) {
|
|
|
2905
2989
|
return null;
|
|
2906
2990
|
}
|
|
2907
2991
|
function readRoles(liveRoot, activeProfile) {
|
|
2908
|
-
const agentsDir =
|
|
2992
|
+
const agentsDir = path11.join(liveRoot, "agents");
|
|
2909
2993
|
let entries;
|
|
2910
2994
|
try {
|
|
2911
|
-
entries =
|
|
2995
|
+
entries = fs7.readdirSync(agentsDir, { withFileTypes: true });
|
|
2912
2996
|
} catch {
|
|
2913
2997
|
return [];
|
|
2914
2998
|
}
|
|
2915
2999
|
const roles = [];
|
|
2916
3000
|
for (const entry of entries) {
|
|
2917
|
-
if (!entry.
|
|
3001
|
+
if (!entry.name.endsWith(".md") || !isOwnedAgentFile(path11.join(agentsDir, entry.name))) {
|
|
2918
3002
|
continue;
|
|
2919
3003
|
}
|
|
2920
|
-
const activeRaw = readTextFile(
|
|
3004
|
+
const activeRaw = readTextFile(path11.join(agentsDir, entry.name));
|
|
2921
3005
|
let model = null;
|
|
2922
3006
|
let effort = null;
|
|
2923
3007
|
if (activeRaw !== null) {
|
|
@@ -2929,7 +3013,7 @@ function readRoles(liveRoot, activeProfile) {
|
|
|
2929
3013
|
}
|
|
2930
3014
|
let staleVariant = false;
|
|
2931
3015
|
if (activeProfile && activeRaw !== null) {
|
|
2932
|
-
const variantRaw = readTextFile(
|
|
3016
|
+
const variantRaw = readTextFile(path11.join(liveRoot, "agent-profiles", activeProfile, entry.name));
|
|
2933
3017
|
if (variantRaw !== null) {
|
|
2934
3018
|
staleVariant = variantRaw !== activeRaw;
|
|
2935
3019
|
}
|
|
@@ -2941,7 +3025,7 @@ function readRoles(liveRoot, activeProfile) {
|
|
|
2941
3025
|
function runtimeDriftReport(opts = {}) {
|
|
2942
3026
|
const targetHome = opts.targetHome ?? os6.homedir();
|
|
2943
3027
|
const host = opts.host ?? "claude";
|
|
2944
|
-
const stateFilePath = opts.stateFilePath ??
|
|
3028
|
+
const stateFilePath = opts.stateFilePath ?? path11.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
2945
3029
|
let state = opts.state ?? null;
|
|
2946
3030
|
if (state === null) {
|
|
2947
3031
|
try {
|
|
@@ -2990,13 +3074,14 @@ function runtimeDriftReport(opts = {}) {
|
|
|
2990
3074
|
var ENV_OVERRIDE_VARS;
|
|
2991
3075
|
var init_doctor = __esm(() => {
|
|
2992
3076
|
init_claude_marketplace();
|
|
3077
|
+
init_ownership();
|
|
2993
3078
|
init_state();
|
|
2994
3079
|
ENV_OVERRIDE_VARS = ["CLAUDE_CODE_SUBAGENT_MODEL"];
|
|
2995
3080
|
});
|
|
2996
3081
|
|
|
2997
3082
|
// ../../packages/shared/dist/profile-switch/engine.js
|
|
2998
|
-
import
|
|
2999
|
-
import
|
|
3083
|
+
import fs8 from "fs";
|
|
3084
|
+
import path12 from "path";
|
|
3000
3085
|
import os7 from "os";
|
|
3001
3086
|
import crypto4 from "crypto";
|
|
3002
3087
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -3006,7 +3091,7 @@ function namedError3(name, message) {
|
|
|
3006
3091
|
return err;
|
|
3007
3092
|
}
|
|
3008
3093
|
function defaultStatePath(targetHome) {
|
|
3009
|
-
return
|
|
3094
|
+
return path12.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
3010
3095
|
}
|
|
3011
3096
|
function resolveCommon(opts) {
|
|
3012
3097
|
const targetHome = opts.targetHome ?? os7.homedir();
|
|
@@ -3017,7 +3102,7 @@ function marketplaceRoots(targetHome, state) {
|
|
|
3017
3102
|
return state.platforms.claude?.installRoute === "marketplace" ? { claude: resolveClaudeMarketplaceRoot({ targetHome }) ?? undefined } : {};
|
|
3018
3103
|
}
|
|
3019
3104
|
function claudeMarketplaceUnresolvedReason(targetHome) {
|
|
3020
|
-
const registryPath =
|
|
3105
|
+
const registryPath = path12.join(targetHome, ".claude", "plugins", "installed_plugins.json");
|
|
3021
3106
|
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";
|
|
3022
3107
|
}
|
|
3023
3108
|
function listProfiles(opts = {}) {
|
|
@@ -3058,7 +3143,7 @@ function listProfiles(opts = {}) {
|
|
|
3058
3143
|
...claudeDriftFields(host)
|
|
3059
3144
|
};
|
|
3060
3145
|
}
|
|
3061
|
-
const installed =
|
|
3146
|
+
const installed = fs8.existsSync(layout.activeDir);
|
|
3062
3147
|
const availableProfiles = listVariantProfiles(layout);
|
|
3063
3148
|
const platform = state.platforms[host];
|
|
3064
3149
|
return {
|
|
@@ -3075,20 +3160,20 @@ function listProfiles(opts = {}) {
|
|
|
3075
3160
|
return { hosts };
|
|
3076
3161
|
}
|
|
3077
3162
|
function listVariantProfiles(layout) {
|
|
3078
|
-
if (!
|
|
3163
|
+
if (!fs8.existsSync(layout.variantsRoot))
|
|
3079
3164
|
return [];
|
|
3080
|
-
return
|
|
3165
|
+
return fs8.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
3081
3166
|
}
|
|
3082
|
-
function
|
|
3083
|
-
|
|
3084
|
-
if (starIdx === -1)
|
|
3085
|
-
return filename === glob;
|
|
3086
|
-
const prefix = glob.slice(0, starIdx);
|
|
3087
|
-
const suffix = glob.slice(starIdx + 1);
|
|
3088
|
-
return filename.length >= prefix.length + suffix.length && filename.startsWith(prefix) && filename.endsWith(suffix);
|
|
3167
|
+
function matchingFileNames(dir, ext) {
|
|
3168
|
+
return fs8.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(ext) && !isLegacyAgentName(e.name) && isOwnedAgentFile(path12.join(dir, e.name))).map((e) => e.name);
|
|
3089
3169
|
}
|
|
3090
|
-
function
|
|
3091
|
-
|
|
3170
|
+
function destIsAbsent(dest) {
|
|
3171
|
+
try {
|
|
3172
|
+
fs8.lstatSync(dest);
|
|
3173
|
+
return false;
|
|
3174
|
+
} catch {
|
|
3175
|
+
return true;
|
|
3176
|
+
}
|
|
3092
3177
|
}
|
|
3093
3178
|
function detectGitAvailability(dir) {
|
|
3094
3179
|
try {
|
|
@@ -3114,7 +3199,7 @@ function gitTrackedFileNames(dir, filenames) {
|
|
|
3114
3199
|
}
|
|
3115
3200
|
}
|
|
3116
3201
|
function checkTrackedPathGuard(activeDir, filenames) {
|
|
3117
|
-
if (filenames.length === 0 || !
|
|
3202
|
+
if (filenames.length === 0 || !fs8.existsSync(activeDir))
|
|
3118
3203
|
return GUARD_PASS;
|
|
3119
3204
|
const availability = detectGitAvailability(activeDir);
|
|
3120
3205
|
if (availability === "no-git")
|
|
@@ -3125,53 +3210,45 @@ function checkTrackedPathGuard(activeDir, filenames) {
|
|
|
3125
3210
|
if (tracked.size === 0)
|
|
3126
3211
|
return GUARD_PASS;
|
|
3127
3212
|
const offending = filenames.find((name) => tracked.has(name));
|
|
3128
|
-
return { blocked: true, path:
|
|
3213
|
+
return { blocked: true, path: path12.join(activeDir, offending), unchecked: false };
|
|
3129
3214
|
}
|
|
3130
3215
|
function assertStateWritable(stateFilePath) {
|
|
3131
|
-
const dir =
|
|
3216
|
+
const dir = path12.dirname(stateFilePath);
|
|
3132
3217
|
try {
|
|
3133
|
-
|
|
3218
|
+
fs8.mkdirSync(dir, { recursive: true });
|
|
3134
3219
|
} catch (err) {
|
|
3135
3220
|
throw UnwritableInstallStateError(stateFilePath, err.message);
|
|
3136
3221
|
}
|
|
3137
|
-
const checkPath =
|
|
3222
|
+
const checkPath = fs8.existsSync(stateFilePath) ? stateFilePath : dir;
|
|
3138
3223
|
try {
|
|
3139
|
-
|
|
3224
|
+
fs8.accessSync(checkPath, fs8.constants.W_OK);
|
|
3140
3225
|
} catch (err) {
|
|
3141
3226
|
throw UnwritableInstallStateError(stateFilePath, err.message);
|
|
3142
3227
|
}
|
|
3143
3228
|
}
|
|
3144
3229
|
function copyFileRouteVariant(layout, variantDir) {
|
|
3145
|
-
|
|
3230
|
+
fs8.mkdirSync(layout.activeDir, { recursive: true });
|
|
3146
3231
|
let changed = 0;
|
|
3147
|
-
for (const
|
|
3148
|
-
|
|
3232
|
+
for (const name of matchingFileNames(variantDir, layout.activeExt)) {
|
|
3233
|
+
const dest = path12.join(layout.activeDir, name);
|
|
3234
|
+
if (!destIsAbsent(dest) && !isOwnedAgentFile(dest))
|
|
3149
3235
|
continue;
|
|
3150
|
-
|
|
3236
|
+
fs8.copyFileSync(path12.join(variantDir, name), dest);
|
|
3151
3237
|
changed++;
|
|
3152
3238
|
}
|
|
3153
3239
|
return changed;
|
|
3154
3240
|
}
|
|
3155
3241
|
function repointOpencodeVariant(layout, variantDir) {
|
|
3156
|
-
|
|
3242
|
+
fs8.mkdirSync(layout.activeDir, { recursive: true });
|
|
3157
3243
|
let changed = 0;
|
|
3158
|
-
for (const
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
const target = path11.resolve(path11.join(variantDir, entry.name));
|
|
3163
|
-
let destExists = true;
|
|
3164
|
-
let destIsSymlink = false;
|
|
3165
|
-
try {
|
|
3166
|
-
destIsSymlink = fs7.lstatSync(dest).isSymbolicLink();
|
|
3167
|
-
} catch {
|
|
3168
|
-
destExists = false;
|
|
3169
|
-
}
|
|
3170
|
-
if (destExists && !destIsSymlink)
|
|
3244
|
+
for (const name of matchingFileNames(variantDir, layout.activeExt)) {
|
|
3245
|
+
const dest = path12.join(layout.activeDir, name);
|
|
3246
|
+
const target = path12.resolve(path12.join(variantDir, name));
|
|
3247
|
+
if (!destIsAbsent(dest) && !isOwnedAgentLink(dest))
|
|
3171
3248
|
continue;
|
|
3172
3249
|
const tmp = `${dest}.massa-ai-switch.${crypto4.randomUUID()}`;
|
|
3173
|
-
|
|
3174
|
-
|
|
3250
|
+
fs8.symlinkSync(target, tmp);
|
|
3251
|
+
fs8.renameSync(tmp, dest);
|
|
3175
3252
|
changed++;
|
|
3176
3253
|
}
|
|
3177
3254
|
return changed;
|
|
@@ -3211,13 +3288,13 @@ function switchProfile(opts) {
|
|
|
3211
3288
|
if (fileHosts.length === 0) {
|
|
3212
3289
|
return { profile: opts.profile, dryRun, hosts: orderRows(universe, skipRows), restartRequired: false };
|
|
3213
3290
|
}
|
|
3214
|
-
const installedFileHosts = fileHosts.filter((h) =>
|
|
3291
|
+
const installedFileHosts = fileHosts.filter((h) => fs8.existsSync(h.layout.activeDir));
|
|
3215
3292
|
if (installedFileHosts.length === 0)
|
|
3216
3293
|
throw NoHostsDetectedError();
|
|
3217
3294
|
const withAvailability = fileHosts.map((h) => {
|
|
3218
|
-
const variantsRootExists =
|
|
3295
|
+
const variantsRootExists = fs8.existsSync(h.layout.variantsRoot);
|
|
3219
3296
|
const variantDir = h.layout.variantDir(opts.profile);
|
|
3220
|
-
const available = variantsRootExists &&
|
|
3297
|
+
const available = variantsRootExists && fs8.existsSync(variantDir) && fs8.statSync(variantDir).isDirectory();
|
|
3221
3298
|
return { ...h, variantsRootExists, variantDir, available };
|
|
3222
3299
|
});
|
|
3223
3300
|
if (!withAvailability.some((h) => h.available)) {
|
|
@@ -3256,7 +3333,7 @@ function switchProfile(opts) {
|
|
|
3256
3333
|
rows.push({ host: h.host, status: "would-switch" });
|
|
3257
3334
|
continue;
|
|
3258
3335
|
}
|
|
3259
|
-
const candidateNames = matchingFileNames(h.variantDir, h.layout.
|
|
3336
|
+
const candidateNames = matchingFileNames(h.variantDir, h.layout.activeExt);
|
|
3260
3337
|
const guard = checkTrackedPathGuard(h.layout.activeDir, candidateNames);
|
|
3261
3338
|
if (guard.blocked) {
|
|
3262
3339
|
rows.push({
|
|
@@ -3298,6 +3375,7 @@ var init_engine = __esm(() => {
|
|
|
3298
3375
|
init_state();
|
|
3299
3376
|
init_lock();
|
|
3300
3377
|
init_claude_marketplace();
|
|
3378
|
+
init_ownership();
|
|
3301
3379
|
init_doctor();
|
|
3302
3380
|
SwitchEngineError = class SwitchEngineError extends Error {
|
|
3303
3381
|
constructor(message) {
|
|
@@ -3315,25 +3393,25 @@ function reportSucceeded(report) {
|
|
|
3315
3393
|
}
|
|
3316
3394
|
|
|
3317
3395
|
// ../../packages/shared/dist/profile-switch/variant-sync.js
|
|
3318
|
-
import
|
|
3319
|
-
import
|
|
3396
|
+
import fs9 from "fs";
|
|
3397
|
+
import path13 from "path";
|
|
3320
3398
|
import os8 from "os";
|
|
3321
3399
|
import crypto5 from "crypto";
|
|
3322
3400
|
function defaultStatePath2(targetHome) {
|
|
3323
|
-
return
|
|
3401
|
+
return path13.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
3324
3402
|
}
|
|
3325
3403
|
function marketplaceRoots2(targetHome, state) {
|
|
3326
3404
|
return state.platforms.claude?.installRoute === "marketplace" ? { claude: resolveClaudeMarketplaceRoot({ targetHome }) ?? undefined } : {};
|
|
3327
3405
|
}
|
|
3328
3406
|
function writeFileIntoDirAtomically(destDir, destName, content) {
|
|
3329
3407
|
const unique = `${process.pid}.${++tempFileCounter2}.${crypto5.randomBytes(6).toString("hex")}`;
|
|
3330
|
-
const tempFile =
|
|
3408
|
+
const tempFile = path13.join(destDir, `.${destName}.${unique}.tmp`);
|
|
3331
3409
|
try {
|
|
3332
|
-
|
|
3333
|
-
|
|
3410
|
+
fs9.writeFileSync(tempFile, content);
|
|
3411
|
+
fs9.renameSync(tempFile, path13.join(destDir, destName));
|
|
3334
3412
|
} catch (error) {
|
|
3335
3413
|
try {
|
|
3336
|
-
|
|
3414
|
+
fs9.unlinkSync(tempFile);
|
|
3337
3415
|
} catch {}
|
|
3338
3416
|
throw error;
|
|
3339
3417
|
}
|
|
@@ -3341,20 +3419,20 @@ function writeFileIntoDirAtomically(destDir, destName, content) {
|
|
|
3341
3419
|
function isSafeDirName(name) {
|
|
3342
3420
|
if (name === "." || name === "..")
|
|
3343
3421
|
return false;
|
|
3344
|
-
if (name.includes("/") || name.includes("\\") || name.includes(
|
|
3422
|
+
if (name.includes("/") || name.includes("\\") || name.includes(path13.sep))
|
|
3345
3423
|
return false;
|
|
3346
|
-
return
|
|
3424
|
+
return path13.basename(name) === name;
|
|
3347
3425
|
}
|
|
3348
3426
|
function syncHost(host, sourceRoot, targetHome, marketplaceRoot) {
|
|
3349
3427
|
const layout = resolveHostLayout(host, { targetHome, marketplaceRoot });
|
|
3350
3428
|
if (layout.route === "skip") {
|
|
3351
3429
|
return { host, status: "skipped", profiles: [], retained: [], files: 0, reason: layout.reason };
|
|
3352
3430
|
}
|
|
3353
|
-
const srcDir =
|
|
3354
|
-
if (!
|
|
3431
|
+
const srcDir = path13.join(sourceRoot, "apps", `${host}-plugin`, "agent-profiles");
|
|
3432
|
+
if (!fs9.existsSync(srcDir) || !fs9.statSync(srcDir).isDirectory()) {
|
|
3355
3433
|
return { host, status: "skipped", profiles: [], retained: [], files: 0, reason: "no generated variants for this host" };
|
|
3356
3434
|
}
|
|
3357
|
-
if (!
|
|
3435
|
+
if (!fs9.existsSync(layout.variantsRoot)) {
|
|
3358
3436
|
return {
|
|
3359
3437
|
host,
|
|
3360
3438
|
status: "skipped",
|
|
@@ -3366,24 +3444,24 @@ function syncHost(host, sourceRoot, targetHome, marketplaceRoot) {
|
|
|
3366
3444
|
}
|
|
3367
3445
|
const profiles = [];
|
|
3368
3446
|
let files = 0;
|
|
3369
|
-
for (const entry of
|
|
3447
|
+
for (const entry of fs9.readdirSync(srcDir, { withFileTypes: true })) {
|
|
3370
3448
|
if (!entry.isDirectory())
|
|
3371
3449
|
continue;
|
|
3372
3450
|
if (!isSafeDirName(entry.name))
|
|
3373
3451
|
continue;
|
|
3374
|
-
const srcProfileDir =
|
|
3375
|
-
const destProfileDir =
|
|
3376
|
-
|
|
3377
|
-
for (const fileEntry of
|
|
3452
|
+
const srcProfileDir = path13.join(srcDir, entry.name);
|
|
3453
|
+
const destProfileDir = path13.join(layout.variantsRoot, entry.name);
|
|
3454
|
+
fs9.mkdirSync(destProfileDir, { recursive: true });
|
|
3455
|
+
for (const fileEntry of fs9.readdirSync(srcProfileDir, { withFileTypes: true })) {
|
|
3378
3456
|
if (!fileEntry.isFile())
|
|
3379
3457
|
continue;
|
|
3380
|
-
const content =
|
|
3458
|
+
const content = fs9.readFileSync(path13.join(srcProfileDir, fileEntry.name));
|
|
3381
3459
|
writeFileIntoDirAtomically(destProfileDir, fileEntry.name, content);
|
|
3382
3460
|
files++;
|
|
3383
3461
|
}
|
|
3384
3462
|
profiles.push(entry.name);
|
|
3385
3463
|
}
|
|
3386
|
-
const retained =
|
|
3464
|
+
const retained = fs9.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory() && !profiles.includes(e.name)).map((e) => e.name).sort();
|
|
3387
3465
|
return { host, status: "synced", profiles: profiles.sort(), retained, files };
|
|
3388
3466
|
}
|
|
3389
3467
|
function syncGeneratedVariants(opts) {
|
|
@@ -3418,14 +3496,14 @@ var init_variant_sync = __esm(() => {
|
|
|
3418
3496
|
});
|
|
3419
3497
|
|
|
3420
3498
|
// ../../packages/shared/dist/profile-switch/repo-root.js
|
|
3421
|
-
import
|
|
3422
|
-
import
|
|
3499
|
+
import fs10 from "fs";
|
|
3500
|
+
import path14 from "path";
|
|
3423
3501
|
function findRepoRootWithMarker(startDir, marker, maxLevels) {
|
|
3424
3502
|
let dir = startDir;
|
|
3425
3503
|
for (let i = 0;i <= maxLevels; i++) {
|
|
3426
|
-
if (
|
|
3504
|
+
if (fs10.existsSync(path14.join(dir, marker)))
|
|
3427
3505
|
return dir;
|
|
3428
|
-
const parent =
|
|
3506
|
+
const parent = path14.dirname(dir);
|
|
3429
3507
|
if (parent === dir)
|
|
3430
3508
|
break;
|
|
3431
3509
|
dir = parent;
|
|
@@ -3435,6 +3513,9 @@ function findRepoRootWithMarker(startDir, marker, maxLevels) {
|
|
|
3435
3513
|
var init_repo_root = () => {};
|
|
3436
3514
|
|
|
3437
3515
|
// ../../packages/shared/dist/bootstrap/rules.js
|
|
3516
|
+
function isRetiredRuleId(value) {
|
|
3517
|
+
return RETIRED_RULE_IDS.includes(value);
|
|
3518
|
+
}
|
|
3438
3519
|
function isBootstrapRuleId(value) {
|
|
3439
3520
|
return typeof value === "string" && BOOTSTRAP_RULE_IDS.includes(value);
|
|
3440
3521
|
}
|
|
@@ -3453,12 +3534,14 @@ function assertKnownRuleId(id) {
|
|
|
3453
3534
|
if (!isBootstrapRuleId(id))
|
|
3454
3535
|
throw UnknownRuleError(id, BOOTSTRAP_RULE_IDS);
|
|
3455
3536
|
}
|
|
3456
|
-
var BOOTSTRAP_RULE_IDS, BOOTSTRAP_RULES, RULES_BY_ID, BootstrapRuleError, UnknownRuleError = (id, known = BOOTSTRAP_RULE_IDS) =>
|
|
3537
|
+
var BOOTSTRAP_RULE_IDS, RETIRED_RULE_IDS, BOOTSTRAP_RULES, RULES_BY_ID, BootstrapRuleError, UnknownRuleError = (id, known = BOOTSTRAP_RULE_IDS) => {
|
|
3538
|
+
const what = isRetiredRuleId(id) ? `bootstrap rule "${id}" was retired and can no longer be toggled` : `unknown bootstrap rule "${id}"`;
|
|
3539
|
+
return namedError4("UnknownRuleError", `${what} \u2014 valid ids: ${known.join(", ")}`);
|
|
3540
|
+
};
|
|
3457
3541
|
var init_rules = __esm(() => {
|
|
3458
3542
|
BOOTSTRAP_RULE_IDS = [
|
|
3459
3543
|
"caveman",
|
|
3460
3544
|
"massa-ai-router",
|
|
3461
|
-
"persona-router",
|
|
3462
3545
|
"dedupe-guardrails",
|
|
3463
3546
|
"plan-challenge",
|
|
3464
3547
|
"conversation-feedback",
|
|
@@ -3466,6 +3549,7 @@ var init_rules = __esm(() => {
|
|
|
3466
3549
|
"english-code",
|
|
3467
3550
|
"code-comments"
|
|
3468
3551
|
];
|
|
3552
|
+
RETIRED_RULE_IDS = ["persona-router"];
|
|
3469
3553
|
BOOTSTRAP_RULES = [
|
|
3470
3554
|
{
|
|
3471
3555
|
id: "caveman",
|
|
@@ -3477,11 +3561,6 @@ var init_rules = __esm(() => {
|
|
|
3477
3561
|
defaultEnabled: true,
|
|
3478
3562
|
description: "Load the massa-ai skill as the workflow router before substantive work."
|
|
3479
3563
|
},
|
|
3480
|
-
{
|
|
3481
|
-
id: "persona-router",
|
|
3482
|
-
defaultEnabled: true,
|
|
3483
|
-
description: "Select one cataloged specialist persona after massa-ai context is available."
|
|
3484
|
-
},
|
|
3485
3564
|
{
|
|
3486
3565
|
id: "dedupe-guardrails",
|
|
3487
3566
|
defaultEnabled: true,
|
|
@@ -3523,7 +3602,7 @@ var init_rules = __esm(() => {
|
|
|
3523
3602
|
});
|
|
3524
3603
|
|
|
3525
3604
|
// ../../packages/shared/dist/bootstrap/state.js
|
|
3526
|
-
import
|
|
3605
|
+
import fs11 from "fs";
|
|
3527
3606
|
function isPlainObject2(value) {
|
|
3528
3607
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3529
3608
|
}
|
|
@@ -3544,6 +3623,8 @@ function resolveBootstrapState(doc) {
|
|
|
3544
3623
|
return { state, ignoredStateKeys: [BOOTSTRAP_STATE_PATH] };
|
|
3545
3624
|
}
|
|
3546
3625
|
for (const [key, value] of Object.entries(rules)) {
|
|
3626
|
+
if (isRetiredRuleId(key))
|
|
3627
|
+
continue;
|
|
3547
3628
|
if (!isBootstrapRuleId(key) || typeof value !== "boolean") {
|
|
3548
3629
|
ignored.push(key);
|
|
3549
3630
|
continue;
|
|
@@ -3554,7 +3635,7 @@ function resolveBootstrapState(doc) {
|
|
|
3554
3635
|
}
|
|
3555
3636
|
function readConfigBytes() {
|
|
3556
3637
|
try {
|
|
3557
|
-
return
|
|
3638
|
+
return fs11.readFileSync(getConfigPath(), "utf-8");
|
|
3558
3639
|
} catch (error) {
|
|
3559
3640
|
if (error?.code === "ENOENT")
|
|
3560
3641
|
return "";
|
|
@@ -3609,7 +3690,7 @@ var init_state2 = __esm(() => {
|
|
|
3609
3690
|
});
|
|
3610
3691
|
|
|
3611
3692
|
// ../../packages/shared/dist/bootstrap/render.js
|
|
3612
|
-
import
|
|
3693
|
+
import path15 from "path";
|
|
3613
3694
|
function wrapBootstrapBlock(body) {
|
|
3614
3695
|
return `${BOOTSTRAP_BLOCK_START}
|
|
3615
3696
|
${body.replace(/\n+$/, "")}
|
|
@@ -3622,19 +3703,19 @@ function ruleMarker(id, suffix) {
|
|
|
3622
3703
|
function resolveHostRoot(host, targetHome, hostRoot) {
|
|
3623
3704
|
requireAbsoluteTargetHome(targetHome);
|
|
3624
3705
|
if (hostRoot === undefined)
|
|
3625
|
-
return
|
|
3626
|
-
const relative =
|
|
3627
|
-
if (!
|
|
3706
|
+
return path15.join(targetHome, ...HOST_CONFIG_DIR[host]);
|
|
3707
|
+
const relative = path15.relative(targetHome, hostRoot);
|
|
3708
|
+
if (!path15.isAbsolute(hostRoot) || relative === "" || relative.startsWith("..") || path15.isAbsolute(relative)) {
|
|
3628
3709
|
throw new BootstrapRenderError("HostRootOutsideTargetHomeError", `hostRoot must be an absolute directory inside targetHome, got "${hostRoot}" for targetHome "${targetHome}"`, [hostRoot, targetHome]);
|
|
3629
3710
|
}
|
|
3630
3711
|
return hostRoot;
|
|
3631
3712
|
}
|
|
3632
3713
|
function bootstrapContractPath(host, targetHome, hostRoot) {
|
|
3633
|
-
return
|
|
3714
|
+
return path15.join(resolveHostRoot(host, targetHome, hostRoot), CONTRACT_FILENAME);
|
|
3634
3715
|
}
|
|
3635
3716
|
function bootstrapStateFilePath(targetHome) {
|
|
3636
3717
|
requireAbsoluteTargetHome(targetHome);
|
|
3637
|
-
return
|
|
3718
|
+
return path15.join(targetHome, ".config", "massa-ai", "config.json");
|
|
3638
3719
|
}
|
|
3639
3720
|
function renderBootstrap(options) {
|
|
3640
3721
|
const { source, state, host, targetHome, hostRoot } = options;
|
|
@@ -3657,7 +3738,7 @@ ${body}`;
|
|
|
3657
3738
|
return { contract, pointer };
|
|
3658
3739
|
}
|
|
3659
3740
|
function requireAbsoluteTargetHome(targetHome) {
|
|
3660
|
-
if (!
|
|
3741
|
+
if (!path15.isAbsolute(targetHome)) {
|
|
3661
3742
|
throw new BootstrapRenderError("TargetHomeNotAbsoluteError", `targetHome must be an absolute path, got "${targetHome}"`, [targetHome]);
|
|
3662
3743
|
}
|
|
3663
3744
|
}
|
|
@@ -3834,14 +3915,14 @@ var init_report = __esm(() => {
|
|
|
3834
3915
|
});
|
|
3835
3916
|
|
|
3836
3917
|
// ../../packages/shared/dist/bootstrap/engine.js
|
|
3837
|
-
import
|
|
3838
|
-
import
|
|
3918
|
+
import fs12 from "fs";
|
|
3919
|
+
import path16 from "path";
|
|
3839
3920
|
function applyBootstrapState(options) {
|
|
3840
3921
|
const { targetHome } = options;
|
|
3841
3922
|
const dryRun = options.dryRun ?? false;
|
|
3842
3923
|
const warn = options.onWarning ?? ((message) => console.warn(message));
|
|
3843
3924
|
const configPath = bootstrapStateFilePath(targetHome);
|
|
3844
|
-
const installStatePath =
|
|
3925
|
+
const installStatePath = path16.join(path16.dirname(configPath), INSTALL_STATE_FILENAME);
|
|
3845
3926
|
const { platforms } = readInstallState(installStatePath);
|
|
3846
3927
|
const installed = HOSTS.filter((host) => platforms[host] !== undefined);
|
|
3847
3928
|
if (installed.length === 0) {
|
|
@@ -3934,22 +4015,22 @@ function applyHost(input) {
|
|
|
3934
4015
|
}
|
|
3935
4016
|
function wiringArtifact(host, targetHome, hostRoot) {
|
|
3936
4017
|
const root = resolveHostRoot(host, targetHome, hostRoot);
|
|
3937
|
-
const contractPath =
|
|
4018
|
+
const contractPath = path16.join(root, CONTRACT_FILENAME);
|
|
3938
4019
|
switch (host) {
|
|
3939
4020
|
case "claude":
|
|
3940
|
-
return { file:
|
|
4021
|
+
return { file: path16.join(root, "CLAUDE.md"), token: `@${CONTRACT_FILENAME}` };
|
|
3941
4022
|
case "codex":
|
|
3942
4023
|
case "cursor":
|
|
3943
|
-
return { file:
|
|
4024
|
+
return { file: path16.join(root, "AGENTS.md"), token: contractPath };
|
|
3944
4025
|
case "opencode":
|
|
3945
4026
|
return { file: openCodeConfigPath(root), token: `"${contractPath}"` };
|
|
3946
4027
|
}
|
|
3947
4028
|
}
|
|
3948
4029
|
function openCodeConfigPath(root) {
|
|
3949
|
-
const json =
|
|
3950
|
-
if (
|
|
4030
|
+
const json = path16.join(root, "opencode.json");
|
|
4031
|
+
if (fs12.existsSync(json))
|
|
3951
4032
|
return json;
|
|
3952
|
-
return
|
|
4033
|
+
return path16.join(root, "opencode.jsonc");
|
|
3953
4034
|
}
|
|
3954
4035
|
function isWired(host, targetHome, hostRoot) {
|
|
3955
4036
|
const artifact = wiringArtifact(host, targetHome, hostRoot);
|
|
@@ -3962,7 +4043,7 @@ function notWiredReason(host, targetHome, hostRoot) {
|
|
|
3962
4043
|
}
|
|
3963
4044
|
function readFileOrNull(filePath) {
|
|
3964
4045
|
try {
|
|
3965
|
-
return
|
|
4046
|
+
return fs12.readFileSync(filePath, "utf-8");
|
|
3966
4047
|
} catch {
|
|
3967
4048
|
return null;
|
|
3968
4049
|
}
|
|
@@ -4044,6 +4125,7 @@ var init_dist = __esm(() => {
|
|
|
4044
4125
|
init_state();
|
|
4045
4126
|
init_lock();
|
|
4046
4127
|
init_engine();
|
|
4128
|
+
init_ownership();
|
|
4047
4129
|
init_variant_sync();
|
|
4048
4130
|
init_repo_root();
|
|
4049
4131
|
init_doctor();
|
|
@@ -5569,7 +5651,7 @@ var import_brace_expansion, minimatch = (p, pattern, options = {}) => {
|
|
|
5569
5651
|
}, qmarksTestNoExtDot = ([$0]) => {
|
|
5570
5652
|
const len = $0.length;
|
|
5571
5653
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
5572
|
-
}, defaultPlatform,
|
|
5654
|
+
}, defaultPlatform, path17, 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) => {
|
|
5573
5655
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
5574
5656
|
return minimatch;
|
|
5575
5657
|
}
|
|
@@ -5627,11 +5709,11 @@ var init_esm = __esm(() => {
|
|
|
5627
5709
|
starRE = /^\*+$/;
|
|
5628
5710
|
qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
5629
5711
|
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
5630
|
-
|
|
5712
|
+
path17 = {
|
|
5631
5713
|
win32: { sep: "\\" },
|
|
5632
5714
|
posix: { sep: "/" }
|
|
5633
5715
|
};
|
|
5634
|
-
sep = defaultPlatform === "win32" ?
|
|
5716
|
+
sep = defaultPlatform === "win32" ? path17.win32.sep : path17.posix.sep;
|
|
5635
5717
|
minimatch.sep = sep;
|
|
5636
5718
|
GLOBSTAR = Symbol("globstar **");
|
|
5637
5719
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -7597,12 +7679,12 @@ var init_esm4 = __esm(() => {
|
|
|
7597
7679
|
childrenCache() {
|
|
7598
7680
|
return this.#children;
|
|
7599
7681
|
}
|
|
7600
|
-
resolve(
|
|
7601
|
-
if (!
|
|
7682
|
+
resolve(path18) {
|
|
7683
|
+
if (!path18) {
|
|
7602
7684
|
return this;
|
|
7603
7685
|
}
|
|
7604
|
-
const rootPath = this.getRootString(
|
|
7605
|
-
const dir =
|
|
7686
|
+
const rootPath = this.getRootString(path18);
|
|
7687
|
+
const dir = path18.substring(rootPath.length);
|
|
7606
7688
|
const dirParts = dir.split(this.splitSep);
|
|
7607
7689
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
7608
7690
|
return result;
|
|
@@ -8130,8 +8212,8 @@ var init_esm4 = __esm(() => {
|
|
|
8130
8212
|
newChild(name, type = UNKNOWN, opts = {}) {
|
|
8131
8213
|
return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
|
|
8132
8214
|
}
|
|
8133
|
-
getRootString(
|
|
8134
|
-
return win32.parse(
|
|
8215
|
+
getRootString(path18) {
|
|
8216
|
+
return win32.parse(path18).root;
|
|
8135
8217
|
}
|
|
8136
8218
|
getRoot(rootPath) {
|
|
8137
8219
|
rootPath = uncToDrive(rootPath.toUpperCase());
|
|
@@ -8156,8 +8238,8 @@ var init_esm4 = __esm(() => {
|
|
|
8156
8238
|
constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
|
|
8157
8239
|
super(name, type, root, roots, nocase, children, opts);
|
|
8158
8240
|
}
|
|
8159
|
-
getRootString(
|
|
8160
|
-
return
|
|
8241
|
+
getRootString(path18) {
|
|
8242
|
+
return path18.startsWith("/") ? "/" : "";
|
|
8161
8243
|
}
|
|
8162
8244
|
getRoot(_rootPath) {
|
|
8163
8245
|
return this.root;
|
|
@@ -8176,8 +8258,8 @@ var init_esm4 = __esm(() => {
|
|
|
8176
8258
|
#children;
|
|
8177
8259
|
nocase;
|
|
8178
8260
|
#fs;
|
|
8179
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
8180
|
-
this.#fs = fsFromOption(
|
|
8261
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs13 = defaultFS } = {}) {
|
|
8262
|
+
this.#fs = fsFromOption(fs13);
|
|
8181
8263
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
8182
8264
|
cwd = fileURLToPath(cwd);
|
|
8183
8265
|
}
|
|
@@ -8213,11 +8295,11 @@ var init_esm4 = __esm(() => {
|
|
|
8213
8295
|
}
|
|
8214
8296
|
this.cwd = prev;
|
|
8215
8297
|
}
|
|
8216
|
-
depth(
|
|
8217
|
-
if (typeof
|
|
8218
|
-
|
|
8298
|
+
depth(path18 = this.cwd) {
|
|
8299
|
+
if (typeof path18 === "string") {
|
|
8300
|
+
path18 = this.cwd.resolve(path18);
|
|
8219
8301
|
}
|
|
8220
|
-
return
|
|
8302
|
+
return path18.depth();
|
|
8221
8303
|
}
|
|
8222
8304
|
childrenCache() {
|
|
8223
8305
|
return this.#children;
|
|
@@ -8633,9 +8715,9 @@ var init_esm4 = __esm(() => {
|
|
|
8633
8715
|
process2();
|
|
8634
8716
|
return results;
|
|
8635
8717
|
}
|
|
8636
|
-
chdir(
|
|
8718
|
+
chdir(path18 = this.cwd) {
|
|
8637
8719
|
const oldCwd = this.cwd;
|
|
8638
|
-
this.cwd = typeof
|
|
8720
|
+
this.cwd = typeof path18 === "string" ? this.cwd.resolve(path18) : path18;
|
|
8639
8721
|
this.cwd[setAsCwd](oldCwd);
|
|
8640
8722
|
}
|
|
8641
8723
|
};
|
|
@@ -8652,8 +8734,8 @@ var init_esm4 = __esm(() => {
|
|
|
8652
8734
|
parseRootPath(dir) {
|
|
8653
8735
|
return win32.parse(dir).root.toUpperCase();
|
|
8654
8736
|
}
|
|
8655
|
-
newRoot(
|
|
8656
|
-
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
8737
|
+
newRoot(fs13) {
|
|
8738
|
+
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs13 });
|
|
8657
8739
|
}
|
|
8658
8740
|
isAbsolute(p) {
|
|
8659
8741
|
return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p);
|
|
@@ -8669,8 +8751,8 @@ var init_esm4 = __esm(() => {
|
|
|
8669
8751
|
parseRootPath(_dir) {
|
|
8670
8752
|
return "/";
|
|
8671
8753
|
}
|
|
8672
|
-
newRoot(
|
|
8673
|
-
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
8754
|
+
newRoot(fs13) {
|
|
8755
|
+
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs13 });
|
|
8674
8756
|
}
|
|
8675
8757
|
isAbsolute(p) {
|
|
8676
8758
|
return p.startsWith("/");
|
|
@@ -8927,8 +9009,8 @@ class MatchRecord {
|
|
|
8927
9009
|
this.store.set(target, current === undefined ? n : n & current);
|
|
8928
9010
|
}
|
|
8929
9011
|
entries() {
|
|
8930
|
-
return [...this.store.entries()].map(([
|
|
8931
|
-
|
|
9012
|
+
return [...this.store.entries()].map(([path18, n]) => [
|
|
9013
|
+
path18,
|
|
8932
9014
|
!!(n & 2),
|
|
8933
9015
|
!!(n & 1)
|
|
8934
9016
|
]);
|
|
@@ -9132,9 +9214,9 @@ class GlobUtil {
|
|
|
9132
9214
|
signal;
|
|
9133
9215
|
maxDepth;
|
|
9134
9216
|
includeChildMatches;
|
|
9135
|
-
constructor(patterns,
|
|
9217
|
+
constructor(patterns, path18, opts) {
|
|
9136
9218
|
this.patterns = patterns;
|
|
9137
|
-
this.path =
|
|
9219
|
+
this.path = path18;
|
|
9138
9220
|
this.opts = opts;
|
|
9139
9221
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
9140
9222
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -9153,11 +9235,11 @@ class GlobUtil {
|
|
|
9153
9235
|
});
|
|
9154
9236
|
}
|
|
9155
9237
|
}
|
|
9156
|
-
#ignored(
|
|
9157
|
-
return this.seen.has(
|
|
9238
|
+
#ignored(path18) {
|
|
9239
|
+
return this.seen.has(path18) || !!this.#ignore?.ignored?.(path18);
|
|
9158
9240
|
}
|
|
9159
|
-
#childrenIgnored(
|
|
9160
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
9241
|
+
#childrenIgnored(path18) {
|
|
9242
|
+
return !!this.#ignore?.childrenIgnored?.(path18);
|
|
9161
9243
|
}
|
|
9162
9244
|
pause() {
|
|
9163
9245
|
this.paused = true;
|
|
@@ -9374,8 +9456,8 @@ var init_walker = __esm(() => {
|
|
|
9374
9456
|
init_processor();
|
|
9375
9457
|
GlobWalker = class GlobWalker extends GlobUtil {
|
|
9376
9458
|
matches = new Set;
|
|
9377
|
-
constructor(patterns,
|
|
9378
|
-
super(patterns,
|
|
9459
|
+
constructor(patterns, path18, opts) {
|
|
9460
|
+
super(patterns, path18, opts);
|
|
9379
9461
|
}
|
|
9380
9462
|
matchEmit(e) {
|
|
9381
9463
|
this.matches.add(e);
|
|
@@ -9412,8 +9494,8 @@ var init_walker = __esm(() => {
|
|
|
9412
9494
|
};
|
|
9413
9495
|
GlobStream = class GlobStream extends GlobUtil {
|
|
9414
9496
|
results;
|
|
9415
|
-
constructor(patterns,
|
|
9416
|
-
super(patterns,
|
|
9497
|
+
constructor(patterns, path18, opts) {
|
|
9498
|
+
super(patterns, path18, opts);
|
|
9417
9499
|
this.results = new Minipass({
|
|
9418
9500
|
signal: this.signal,
|
|
9419
9501
|
objectMode: true
|
|
@@ -9841,20 +9923,20 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
9841
9923
|
var throwError = (message, Ctor) => {
|
|
9842
9924
|
throw new Ctor(message);
|
|
9843
9925
|
};
|
|
9844
|
-
var checkPath = (
|
|
9845
|
-
if (!isString(
|
|
9926
|
+
var checkPath = (path18, originalPath, doThrow) => {
|
|
9927
|
+
if (!isString(path18)) {
|
|
9846
9928
|
return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
9847
9929
|
}
|
|
9848
|
-
if (!
|
|
9930
|
+
if (!path18) {
|
|
9849
9931
|
return doThrow(`path must not be empty`, TypeError);
|
|
9850
9932
|
}
|
|
9851
|
-
if (checkPath.isNotRelative(
|
|
9933
|
+
if (checkPath.isNotRelative(path18)) {
|
|
9852
9934
|
const r = "`path.relative()`d";
|
|
9853
9935
|
return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
|
|
9854
9936
|
}
|
|
9855
9937
|
return true;
|
|
9856
9938
|
};
|
|
9857
|
-
var isNotRelative = (
|
|
9939
|
+
var isNotRelative = (path18) => REGEX_TEST_INVALID_PATH.test(path18);
|
|
9858
9940
|
checkPath.isNotRelative = isNotRelative;
|
|
9859
9941
|
checkPath.convert = (p) => p;
|
|
9860
9942
|
|
|
@@ -9897,7 +9979,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
9897
9979
|
addPattern(pattern) {
|
|
9898
9980
|
return this.add(pattern);
|
|
9899
9981
|
}
|
|
9900
|
-
_testOne(
|
|
9982
|
+
_testOne(path18, checkUnignored) {
|
|
9901
9983
|
let ignored = false;
|
|
9902
9984
|
let unignored = false;
|
|
9903
9985
|
this._rules.forEach((rule) => {
|
|
@@ -9905,7 +9987,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
9905
9987
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
9906
9988
|
return;
|
|
9907
9989
|
}
|
|
9908
|
-
const matched = rule.regex.test(
|
|
9990
|
+
const matched = rule.regex.test(path18);
|
|
9909
9991
|
if (matched) {
|
|
9910
9992
|
ignored = !negative;
|
|
9911
9993
|
unignored = negative;
|
|
@@ -9917,39 +9999,39 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
9917
9999
|
};
|
|
9918
10000
|
}
|
|
9919
10001
|
_test(originalPath, cache, checkUnignored, slices) {
|
|
9920
|
-
const
|
|
9921
|
-
checkPath(
|
|
9922
|
-
return this._t(
|
|
10002
|
+
const path18 = originalPath && checkPath.convert(originalPath);
|
|
10003
|
+
checkPath(path18, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
|
10004
|
+
return this._t(path18, cache, checkUnignored, slices);
|
|
9923
10005
|
}
|
|
9924
|
-
_t(
|
|
9925
|
-
if (
|
|
9926
|
-
return cache[
|
|
10006
|
+
_t(path18, cache, checkUnignored, slices) {
|
|
10007
|
+
if (path18 in cache) {
|
|
10008
|
+
return cache[path18];
|
|
9927
10009
|
}
|
|
9928
10010
|
if (!slices) {
|
|
9929
|
-
slices =
|
|
10011
|
+
slices = path18.split(SLASH2);
|
|
9930
10012
|
}
|
|
9931
10013
|
slices.pop();
|
|
9932
10014
|
if (!slices.length) {
|
|
9933
|
-
return cache[
|
|
10015
|
+
return cache[path18] = this._testOne(path18, checkUnignored);
|
|
9934
10016
|
}
|
|
9935
10017
|
const parent = this._t(slices.join(SLASH2) + SLASH2, cache, checkUnignored, slices);
|
|
9936
|
-
return cache[
|
|
10018
|
+
return cache[path18] = parent.ignored ? parent : this._testOne(path18, checkUnignored);
|
|
9937
10019
|
}
|
|
9938
|
-
ignores(
|
|
9939
|
-
return this._test(
|
|
10020
|
+
ignores(path18) {
|
|
10021
|
+
return this._test(path18, this._ignoreCache, false).ignored;
|
|
9940
10022
|
}
|
|
9941
10023
|
createFilter() {
|
|
9942
|
-
return (
|
|
10024
|
+
return (path18) => !this.ignores(path18);
|
|
9943
10025
|
}
|
|
9944
10026
|
filter(paths) {
|
|
9945
10027
|
return makeArray(paths).filter(this.createFilter());
|
|
9946
10028
|
}
|
|
9947
|
-
test(
|
|
9948
|
-
return this._test(
|
|
10029
|
+
test(path18) {
|
|
10030
|
+
return this._test(path18, this._testCache, true);
|
|
9949
10031
|
}
|
|
9950
10032
|
}
|
|
9951
10033
|
var factory = (options) => new Ignore2(options);
|
|
9952
|
-
var isPathValid = (
|
|
10034
|
+
var isPathValid = (path18) => checkPath(path18 && checkPath.convert(path18), path18, RETURN_FALSE);
|
|
9953
10035
|
factory.isPathValid = isPathValid;
|
|
9954
10036
|
factory.default = factory;
|
|
9955
10037
|
module.exports = factory;
|
|
@@ -9957,7 +10039,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
9957
10039
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
9958
10040
|
checkPath.convert = makePosix;
|
|
9959
10041
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
9960
|
-
checkPath.isNotRelative = (
|
|
10042
|
+
checkPath.isNotRelative = (path18) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path18) || isNotRelative(path18);
|
|
9961
10043
|
}
|
|
9962
10044
|
});
|
|
9963
10045
|
|
|
@@ -10019,18 +10101,18 @@ function validatePolicy(policy, opts = {}) {
|
|
|
10019
10101
|
}
|
|
10020
10102
|
}
|
|
10021
10103
|
}
|
|
10022
|
-
function
|
|
10104
|
+
function matchesGlob(path18, pattern) {
|
|
10023
10105
|
let re = regexCache.get(pattern);
|
|
10024
10106
|
if (!re) {
|
|
10025
10107
|
re = globToRegex(pattern);
|
|
10026
10108
|
regexCache.set(pattern, re);
|
|
10027
10109
|
}
|
|
10028
|
-
return re.test(
|
|
10110
|
+
return re.test(path18);
|
|
10029
10111
|
}
|
|
10030
10112
|
var DEFAULT_POLICY, applyPolicy = (filePath, policy) => {
|
|
10031
10113
|
const normalized = filePath.trim();
|
|
10032
10114
|
for (const rule of policy.rules) {
|
|
10033
|
-
if (
|
|
10115
|
+
if (matchesGlob(normalized, rule.pattern))
|
|
10034
10116
|
return rule.disposition;
|
|
10035
10117
|
}
|
|
10036
10118
|
return "Keep";
|
|
@@ -10042,8 +10124,8 @@ var init_capture_policy = __esm(() => {
|
|
|
10042
10124
|
});
|
|
10043
10125
|
|
|
10044
10126
|
// ../../packages/core/dist/services/search/ignore-patterns.js
|
|
10045
|
-
import
|
|
10046
|
-
import
|
|
10127
|
+
import fs13 from "fs/promises";
|
|
10128
|
+
import path18 from "path";
|
|
10047
10129
|
function buildExtensionGlob(extensions) {
|
|
10048
10130
|
return extensions.map((ext2) => `**/*${ext2}`);
|
|
10049
10131
|
}
|
|
@@ -10066,8 +10148,8 @@ async function loadProjectIgnore(projectPath) {
|
|
|
10066
10148
|
const ig = ignore();
|
|
10067
10149
|
ig.add(DEFAULT_IGNORES);
|
|
10068
10150
|
try {
|
|
10069
|
-
const gitignorePath =
|
|
10070
|
-
const gitignoreContent = await
|
|
10151
|
+
const gitignorePath = path18.join(projectPath, ".gitignore");
|
|
10152
|
+
const gitignoreContent = await fs13.readFile(gitignorePath, "utf8");
|
|
10071
10153
|
const rules = gitignoreContent.split(`
|
|
10072
10154
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
10073
10155
|
ig.add(rules);
|
|
@@ -11666,15 +11748,15 @@ var require_pg_connection_string = __commonJS((exports, module) => {
|
|
|
11666
11748
|
if (config2.sslnegotiation === "direct" && config2.ssl === undefined) {
|
|
11667
11749
|
config2.ssl = true;
|
|
11668
11750
|
}
|
|
11669
|
-
const
|
|
11751
|
+
const fs14 = config2.sslcert || config2.sslkey || config2.sslrootcert ? __require("fs") : null;
|
|
11670
11752
|
if (config2.sslcert) {
|
|
11671
|
-
config2.ssl.cert =
|
|
11753
|
+
config2.ssl.cert = fs14.readFileSync(config2.sslcert).toString();
|
|
11672
11754
|
}
|
|
11673
11755
|
if (config2.sslkey) {
|
|
11674
|
-
config2.ssl.key =
|
|
11756
|
+
config2.ssl.key = fs14.readFileSync(config2.sslkey).toString();
|
|
11675
11757
|
}
|
|
11676
11758
|
if (config2.sslrootcert) {
|
|
11677
|
-
config2.ssl.ca =
|
|
11759
|
+
config2.ssl.ca = fs14.readFileSync(config2.sslrootcert).toString();
|
|
11678
11760
|
}
|
|
11679
11761
|
if (options.useLibpqCompat && config2.uselibpqcompat) {
|
|
11680
11762
|
throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
|
|
@@ -13388,7 +13470,7 @@ var require_split2 = __commonJS((exports, module) => {
|
|
|
13388
13470
|
|
|
13389
13471
|
// ../../node_modules/pgpass/lib/helper.js
|
|
13390
13472
|
var require_helper = __commonJS((exports, module) => {
|
|
13391
|
-
var
|
|
13473
|
+
var path19 = __require("path");
|
|
13392
13474
|
var Stream2 = __require("stream").Stream;
|
|
13393
13475
|
var split = require_split2();
|
|
13394
13476
|
var util = __require("util");
|
|
@@ -13428,7 +13510,7 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
13428
13510
|
};
|
|
13429
13511
|
exports.getFileName = function(rawEnv) {
|
|
13430
13512
|
var env = rawEnv || process.env;
|
|
13431
|
-
var file = env.PGPASSFILE || (isWin ?
|
|
13513
|
+
var file = env.PGPASSFILE || (isWin ? path19.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path19.join(env.HOME || "./", ".pgpass"));
|
|
13432
13514
|
return file;
|
|
13433
13515
|
};
|
|
13434
13516
|
exports.usePgPass = function(stats, fname) {
|
|
@@ -13552,16 +13634,16 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
13552
13634
|
|
|
13553
13635
|
// ../../node_modules/pgpass/lib/index.js
|
|
13554
13636
|
var require_lib = __commonJS((exports, module) => {
|
|
13555
|
-
var
|
|
13556
|
-
var
|
|
13637
|
+
var path19 = __require("path");
|
|
13638
|
+
var fs14 = __require("fs");
|
|
13557
13639
|
var helper = require_helper();
|
|
13558
13640
|
module.exports = function(connInfo, cb) {
|
|
13559
13641
|
var file = helper.getFileName();
|
|
13560
|
-
|
|
13642
|
+
fs14.stat(file, function(err, stat) {
|
|
13561
13643
|
if (err || !helper.usePgPass(stat, file)) {
|
|
13562
13644
|
return cb(undefined);
|
|
13563
13645
|
}
|
|
13564
|
-
var st =
|
|
13646
|
+
var st = fs14.createReadStream(file);
|
|
13565
13647
|
helper.getPassword(connInfo, st, cb);
|
|
13566
13648
|
});
|
|
13567
13649
|
};
|
|
@@ -15260,8 +15342,8 @@ var init_alias_resolver = __esm(() => {
|
|
|
15260
15342
|
});
|
|
15261
15343
|
|
|
15262
15344
|
// ../../packages/core/dist/services/search/index-manager.js
|
|
15263
|
-
import
|
|
15264
|
-
import
|
|
15345
|
+
import fs14 from "fs";
|
|
15346
|
+
import path19 from "path";
|
|
15265
15347
|
|
|
15266
15348
|
class IndexManager {
|
|
15267
15349
|
metadataCache = new Map;
|
|
@@ -15354,9 +15436,9 @@ class IndexManager {
|
|
|
15354
15436
|
const fileMetadata = {};
|
|
15355
15437
|
let totalSize = 0;
|
|
15356
15438
|
for (const filePath of indexedFiles) {
|
|
15357
|
-
const fullPath =
|
|
15439
|
+
const fullPath = path19.join(projectPath, filePath);
|
|
15358
15440
|
try {
|
|
15359
|
-
const stat = await
|
|
15441
|
+
const stat = await fs14.promises.stat(fullPath);
|
|
15360
15442
|
fileMetadata[filePath] = {
|
|
15361
15443
|
path: filePath,
|
|
15362
15444
|
mtime: stat.mtimeMs,
|
|
@@ -15407,9 +15489,9 @@ class IndexManager {
|
|
|
15407
15489
|
if (ig.ignores(match2)) {
|
|
15408
15490
|
continue;
|
|
15409
15491
|
}
|
|
15410
|
-
const fullPath =
|
|
15492
|
+
const fullPath = path19.join(projectPath, match2);
|
|
15411
15493
|
try {
|
|
15412
|
-
const stat = await
|
|
15494
|
+
const stat = await fs14.promises.stat(fullPath);
|
|
15413
15495
|
files.set(match2, {
|
|
15414
15496
|
path: match2,
|
|
15415
15497
|
mtime: stat.mtimeMs,
|
|
@@ -15860,10 +15942,10 @@ function mergeDefs(...defs) {
|
|
|
15860
15942
|
function cloneDef(schema) {
|
|
15861
15943
|
return mergeDefs(schema._zod.def);
|
|
15862
15944
|
}
|
|
15863
|
-
function getElementAtPath(obj,
|
|
15864
|
-
if (!
|
|
15945
|
+
function getElementAtPath(obj, path20) {
|
|
15946
|
+
if (!path20)
|
|
15865
15947
|
return obj;
|
|
15866
|
-
return
|
|
15948
|
+
return path20.reduce((acc, key) => acc?.[key], obj);
|
|
15867
15949
|
}
|
|
15868
15950
|
function promiseAllObject(promisesObj) {
|
|
15869
15951
|
const keys = Object.keys(promisesObj);
|
|
@@ -16191,11 +16273,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
16191
16273
|
}
|
|
16192
16274
|
return false;
|
|
16193
16275
|
}
|
|
16194
|
-
function prefixIssues(
|
|
16276
|
+
function prefixIssues(path20, issues) {
|
|
16195
16277
|
return issues.map((iss) => {
|
|
16196
16278
|
var _a3;
|
|
16197
16279
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
16198
|
-
iss.path.unshift(
|
|
16280
|
+
iss.path.unshift(path20);
|
|
16199
16281
|
return iss;
|
|
16200
16282
|
});
|
|
16201
16283
|
}
|
|
@@ -16408,16 +16490,16 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
|
16408
16490
|
}
|
|
16409
16491
|
function formatError(error, mapper = (issue2) => issue2.message) {
|
|
16410
16492
|
const fieldErrors = { _errors: [] };
|
|
16411
|
-
const processError = (error2,
|
|
16493
|
+
const processError = (error2, path20 = []) => {
|
|
16412
16494
|
for (const issue2 of error2.issues) {
|
|
16413
16495
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
16414
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
16496
|
+
issue2.errors.map((issues) => processError({ issues }, [...path20, ...issue2.path]));
|
|
16415
16497
|
} else if (issue2.code === "invalid_key") {
|
|
16416
|
-
processError({ issues: issue2.issues }, [...
|
|
16498
|
+
processError({ issues: issue2.issues }, [...path20, ...issue2.path]);
|
|
16417
16499
|
} else if (issue2.code === "invalid_element") {
|
|
16418
|
-
processError({ issues: issue2.issues }, [...
|
|
16500
|
+
processError({ issues: issue2.issues }, [...path20, ...issue2.path]);
|
|
16419
16501
|
} else {
|
|
16420
|
-
const fullpath = [...
|
|
16502
|
+
const fullpath = [...path20, ...issue2.path];
|
|
16421
16503
|
if (fullpath.length === 0) {
|
|
16422
16504
|
fieldErrors._errors.push(mapper(issue2));
|
|
16423
16505
|
} else {
|
|
@@ -16444,17 +16526,17 @@ function formatError(error, mapper = (issue2) => issue2.message) {
|
|
|
16444
16526
|
}
|
|
16445
16527
|
function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
16446
16528
|
const result = { errors: [] };
|
|
16447
|
-
const processError = (error2,
|
|
16529
|
+
const processError = (error2, path20 = []) => {
|
|
16448
16530
|
var _a3, _b;
|
|
16449
16531
|
for (const issue2 of error2.issues) {
|
|
16450
16532
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
16451
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
16533
|
+
issue2.errors.map((issues) => processError({ issues }, [...path20, ...issue2.path]));
|
|
16452
16534
|
} else if (issue2.code === "invalid_key") {
|
|
16453
|
-
processError({ issues: issue2.issues }, [...
|
|
16535
|
+
processError({ issues: issue2.issues }, [...path20, ...issue2.path]);
|
|
16454
16536
|
} else if (issue2.code === "invalid_element") {
|
|
16455
|
-
processError({ issues: issue2.issues }, [...
|
|
16537
|
+
processError({ issues: issue2.issues }, [...path20, ...issue2.path]);
|
|
16456
16538
|
} else {
|
|
16457
|
-
const fullpath = [...
|
|
16539
|
+
const fullpath = [...path20, ...issue2.path];
|
|
16458
16540
|
if (fullpath.length === 0) {
|
|
16459
16541
|
result.errors.push(mapper(issue2));
|
|
16460
16542
|
continue;
|
|
@@ -16486,8 +16568,8 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
|
16486
16568
|
}
|
|
16487
16569
|
function toDotPath(_path) {
|
|
16488
16570
|
const segs = [];
|
|
16489
|
-
const
|
|
16490
|
-
for (const seg of
|
|
16571
|
+
const path20 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
16572
|
+
for (const seg of path20) {
|
|
16491
16573
|
if (typeof seg === "number")
|
|
16492
16574
|
segs.push(`[${seg}]`);
|
|
16493
16575
|
else if (typeof seg === "symbol")
|
|
@@ -29490,13 +29572,13 @@ function resolveRef(ref, ctx) {
|
|
|
29490
29572
|
if (!ref.startsWith("#")) {
|
|
29491
29573
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
29492
29574
|
}
|
|
29493
|
-
const
|
|
29494
|
-
if (
|
|
29575
|
+
const path20 = ref.slice(1).split("/").filter(Boolean);
|
|
29576
|
+
if (path20.length === 0) {
|
|
29495
29577
|
return ctx.rootSchema;
|
|
29496
29578
|
}
|
|
29497
29579
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
29498
|
-
if (
|
|
29499
|
-
const key =
|
|
29580
|
+
if (path20[0] === defsKey) {
|
|
29581
|
+
const key = path20[1];
|
|
29500
29582
|
if (!key || !ctx.defs[key]) {
|
|
29501
29583
|
throw new Error(`Reference not found: ${ref}`);
|
|
29502
29584
|
}
|
|
@@ -30985,8 +31067,8 @@ class ParseStatus {
|
|
|
30985
31067
|
}
|
|
30986
31068
|
}
|
|
30987
31069
|
var makeIssue = (params) => {
|
|
30988
|
-
const { data, path:
|
|
30989
|
-
const fullPath = [...
|
|
31070
|
+
const { data, path: path20, errorMaps, issueData } = params;
|
|
31071
|
+
const fullPath = [...path20, ...issueData.path || []];
|
|
30990
31072
|
const fullIssue = {
|
|
30991
31073
|
...issueData,
|
|
30992
31074
|
path: fullPath
|
|
@@ -31031,11 +31113,11 @@ var init_errorUtil = __esm(() => {
|
|
|
31031
31113
|
|
|
31032
31114
|
// ../../node_modules/zod/v3/types.js
|
|
31033
31115
|
class ParseInputLazyPath {
|
|
31034
|
-
constructor(parent, value,
|
|
31116
|
+
constructor(parent, value, path20, key) {
|
|
31035
31117
|
this._cachedPath = [];
|
|
31036
31118
|
this.parent = parent;
|
|
31037
31119
|
this.data = value;
|
|
31038
|
-
this._path =
|
|
31120
|
+
this._path = path20;
|
|
31039
31121
|
this._key = key;
|
|
31040
31122
|
}
|
|
31041
31123
|
get path() {
|
|
@@ -37100,23 +37182,23 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
37100
37182
|
writeAuthConfig: () => writeAuthConfig
|
|
37101
37183
|
});
|
|
37102
37184
|
module.exports = __toCommonJS2(auth_config_exports);
|
|
37103
|
-
var
|
|
37104
|
-
var
|
|
37185
|
+
var fs15 = __toESM2(__require("fs"));
|
|
37186
|
+
var path20 = __toESM2(__require("path"));
|
|
37105
37187
|
var import_token_util = require_token_util();
|
|
37106
37188
|
function getAuthConfigPath() {
|
|
37107
37189
|
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
37108
37190
|
if (!dataDir) {
|
|
37109
37191
|
throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
|
|
37110
37192
|
}
|
|
37111
|
-
return
|
|
37193
|
+
return path20.join(dataDir, "auth.json");
|
|
37112
37194
|
}
|
|
37113
37195
|
function readAuthConfig() {
|
|
37114
37196
|
try {
|
|
37115
37197
|
const authPath = getAuthConfigPath();
|
|
37116
|
-
if (!
|
|
37198
|
+
if (!fs15.existsSync(authPath)) {
|
|
37117
37199
|
return null;
|
|
37118
37200
|
}
|
|
37119
|
-
const content =
|
|
37201
|
+
const content = fs15.readFileSync(authPath, "utf8");
|
|
37120
37202
|
if (!content) {
|
|
37121
37203
|
return null;
|
|
37122
37204
|
}
|
|
@@ -37127,11 +37209,11 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
37127
37209
|
}
|
|
37128
37210
|
function writeAuthConfig(config3) {
|
|
37129
37211
|
const authPath = getAuthConfigPath();
|
|
37130
|
-
const authDir =
|
|
37131
|
-
if (!
|
|
37132
|
-
|
|
37212
|
+
const authDir = path20.dirname(authPath);
|
|
37213
|
+
if (!fs15.existsSync(authDir)) {
|
|
37214
|
+
fs15.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
37133
37215
|
}
|
|
37134
|
-
|
|
37216
|
+
fs15.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
|
|
37135
37217
|
}
|
|
37136
37218
|
function isValidAccessToken(authConfig, expirationBufferMs = 0) {
|
|
37137
37219
|
if (!authConfig.token)
|
|
@@ -37306,8 +37388,8 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
37306
37388
|
saveToken: () => saveToken
|
|
37307
37389
|
});
|
|
37308
37390
|
module.exports = __toCommonJS2(token_util_exports);
|
|
37309
|
-
var
|
|
37310
|
-
var
|
|
37391
|
+
var path20 = __toESM2(__require("path"));
|
|
37392
|
+
var fs15 = __toESM2(__require("fs"));
|
|
37311
37393
|
var import_token_error = require_token_error();
|
|
37312
37394
|
var import_token_io = require_token_io();
|
|
37313
37395
|
var import_auth_config = require_auth_config();
|
|
@@ -37319,7 +37401,7 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
37319
37401
|
if (!dataDir) {
|
|
37320
37402
|
return null;
|
|
37321
37403
|
}
|
|
37322
|
-
return
|
|
37404
|
+
return path20.join(dataDir, vercelFolder);
|
|
37323
37405
|
}
|
|
37324
37406
|
async function getVercelToken2(options) {
|
|
37325
37407
|
const authConfig = (0, import_auth_config.readAuthConfig)();
|
|
@@ -37387,11 +37469,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
37387
37469
|
if (!dir) {
|
|
37388
37470
|
throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
|
|
37389
37471
|
}
|
|
37390
|
-
const prjPath =
|
|
37391
|
-
if (!
|
|
37472
|
+
const prjPath = path20.join(dir, ".vercel", "project.json");
|
|
37473
|
+
if (!fs15.existsSync(prjPath)) {
|
|
37392
37474
|
throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
|
|
37393
37475
|
}
|
|
37394
|
-
const prj = JSON.parse(
|
|
37476
|
+
const prj = JSON.parse(fs15.readFileSync(prjPath, "utf8"));
|
|
37395
37477
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
37396
37478
|
throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
|
|
37397
37479
|
}
|
|
@@ -37402,11 +37484,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
37402
37484
|
if (!dir) {
|
|
37403
37485
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
37404
37486
|
}
|
|
37405
|
-
const tokenPath =
|
|
37487
|
+
const tokenPath = path20.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
37406
37488
|
const tokenJson = JSON.stringify(token);
|
|
37407
|
-
|
|
37408
|
-
|
|
37409
|
-
|
|
37489
|
+
fs15.mkdirSync(path20.dirname(tokenPath), { mode: 504, recursive: true });
|
|
37490
|
+
fs15.writeFileSync(tokenPath, tokenJson);
|
|
37491
|
+
fs15.chmodSync(tokenPath, 432);
|
|
37410
37492
|
return;
|
|
37411
37493
|
}
|
|
37412
37494
|
function loadToken(projectId) {
|
|
@@ -37414,11 +37496,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
37414
37496
|
if (!dir) {
|
|
37415
37497
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
37416
37498
|
}
|
|
37417
|
-
const tokenPath =
|
|
37418
|
-
if (!
|
|
37499
|
+
const tokenPath = path20.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
37500
|
+
if (!fs15.existsSync(tokenPath)) {
|
|
37419
37501
|
return null;
|
|
37420
37502
|
}
|
|
37421
|
-
const token = JSON.parse(
|
|
37503
|
+
const token = JSON.parse(fs15.readFileSync(tokenPath, "utf8"));
|
|
37422
37504
|
assertVercelOidcTokenResponse(token);
|
|
37423
37505
|
return token;
|
|
37424
37506
|
}
|
|
@@ -48260,37 +48342,37 @@ function createOpenAI(options = {}) {
|
|
|
48260
48342
|
}, `ai-sdk/openai/${VERSION4}`);
|
|
48261
48343
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
48262
48344
|
provider: `${providerName}.chat`,
|
|
48263
|
-
url: ({ path:
|
|
48345
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
48264
48346
|
headers: getHeaders,
|
|
48265
48347
|
fetch: options.fetch
|
|
48266
48348
|
});
|
|
48267
48349
|
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
48268
48350
|
provider: `${providerName}.completion`,
|
|
48269
|
-
url: ({ path:
|
|
48351
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
48270
48352
|
headers: getHeaders,
|
|
48271
48353
|
fetch: options.fetch
|
|
48272
48354
|
});
|
|
48273
48355
|
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
48274
48356
|
provider: `${providerName}.embedding`,
|
|
48275
|
-
url: ({ path:
|
|
48357
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
48276
48358
|
headers: getHeaders,
|
|
48277
48359
|
fetch: options.fetch
|
|
48278
48360
|
});
|
|
48279
48361
|
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
48280
48362
|
provider: `${providerName}.image`,
|
|
48281
|
-
url: ({ path:
|
|
48363
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
48282
48364
|
headers: getHeaders,
|
|
48283
48365
|
fetch: options.fetch
|
|
48284
48366
|
});
|
|
48285
48367
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
48286
48368
|
provider: `${providerName}.transcription`,
|
|
48287
|
-
url: ({ path:
|
|
48369
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
48288
48370
|
headers: getHeaders,
|
|
48289
48371
|
fetch: options.fetch
|
|
48290
48372
|
});
|
|
48291
48373
|
const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
|
|
48292
48374
|
provider: `${providerName}.speech`,
|
|
48293
|
-
url: ({ path:
|
|
48375
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
48294
48376
|
headers: getHeaders,
|
|
48295
48377
|
fetch: options.fetch
|
|
48296
48378
|
});
|
|
@@ -48303,7 +48385,7 @@ function createOpenAI(options = {}) {
|
|
|
48303
48385
|
const createResponsesModel = (modelId) => {
|
|
48304
48386
|
return new OpenAIResponsesLanguageModel(modelId, {
|
|
48305
48387
|
provider: `${providerName}.responses`,
|
|
48306
|
-
url: ({ path:
|
|
48388
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
48307
48389
|
headers: getHeaders,
|
|
48308
48390
|
fetch: options.fetch,
|
|
48309
48391
|
fileIdPrefixes: ["file-"]
|
|
@@ -64958,26 +65040,26 @@ var require_process = __commonJS((exports, module) => {
|
|
|
64958
65040
|
|
|
64959
65041
|
// ../../node_modules/detect-libc/lib/filesystem.js
|
|
64960
65042
|
var require_filesystem = __commonJS((exports, module) => {
|
|
64961
|
-
var
|
|
65043
|
+
var fs15 = __require("fs");
|
|
64962
65044
|
var LDD_PATH = "/usr/bin/ldd";
|
|
64963
65045
|
var SELF_PATH = "/proc/self/exe";
|
|
64964
65046
|
var MAX_LENGTH = 2048;
|
|
64965
|
-
var readFileSync2 = (
|
|
64966
|
-
const fd =
|
|
65047
|
+
var readFileSync2 = (path20) => {
|
|
65048
|
+
const fd = fs15.openSync(path20, "r");
|
|
64967
65049
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
64968
|
-
const bytesRead =
|
|
64969
|
-
|
|
65050
|
+
const bytesRead = fs15.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
65051
|
+
fs15.close(fd, () => {});
|
|
64970
65052
|
return buffer.subarray(0, bytesRead);
|
|
64971
65053
|
};
|
|
64972
|
-
var readFile = (
|
|
64973
|
-
|
|
65054
|
+
var readFile = (path20) => new Promise((resolve4, reject) => {
|
|
65055
|
+
fs15.open(path20, "r", (err, fd) => {
|
|
64974
65056
|
if (err) {
|
|
64975
65057
|
reject(err);
|
|
64976
65058
|
} else {
|
|
64977
65059
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
64978
|
-
|
|
65060
|
+
fs15.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
|
|
64979
65061
|
resolve4(buffer.subarray(0, bytesRead));
|
|
64980
|
-
|
|
65062
|
+
fs15.close(fd, () => {});
|
|
64981
65063
|
});
|
|
64982
65064
|
}
|
|
64983
65065
|
});
|
|
@@ -65082,11 +65164,11 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
65082
65164
|
}
|
|
65083
65165
|
return null;
|
|
65084
65166
|
};
|
|
65085
|
-
var familyFromInterpreterPath = (
|
|
65086
|
-
if (
|
|
65087
|
-
if (
|
|
65167
|
+
var familyFromInterpreterPath = (path20) => {
|
|
65168
|
+
if (path20) {
|
|
65169
|
+
if (path20.includes("/ld-musl-")) {
|
|
65088
65170
|
return MUSL;
|
|
65089
|
-
} else if (
|
|
65171
|
+
} else if (path20.includes("/ld-linux-")) {
|
|
65090
65172
|
return GLIBC;
|
|
65091
65173
|
}
|
|
65092
65174
|
}
|
|
@@ -65131,8 +65213,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
65131
65213
|
cachedFamilyInterpreter = null;
|
|
65132
65214
|
try {
|
|
65133
65215
|
const selfContent = await readFile(SELF_PATH);
|
|
65134
|
-
const
|
|
65135
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
65216
|
+
const path20 = interpreterPath(selfContent);
|
|
65217
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path20);
|
|
65136
65218
|
} catch (e) {}
|
|
65137
65219
|
return cachedFamilyInterpreter;
|
|
65138
65220
|
};
|
|
@@ -65143,8 +65225,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
65143
65225
|
cachedFamilyInterpreter = null;
|
|
65144
65226
|
try {
|
|
65145
65227
|
const selfContent = readFileSync2(SELF_PATH);
|
|
65146
|
-
const
|
|
65147
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
65228
|
+
const path20 = interpreterPath(selfContent);
|
|
65229
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path20);
|
|
65148
65230
|
} catch (e) {}
|
|
65149
65231
|
return cachedFamilyInterpreter;
|
|
65150
65232
|
};
|
|
@@ -66806,18 +66888,18 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
66806
66888
|
`@img/sharp-${runtimePlatform}/sharp.node`,
|
|
66807
66889
|
"@img/sharp-wasm32/sharp.node"
|
|
66808
66890
|
];
|
|
66809
|
-
var
|
|
66891
|
+
var path20;
|
|
66810
66892
|
var sharp;
|
|
66811
66893
|
var errors4 = [];
|
|
66812
|
-
for (
|
|
66894
|
+
for (path20 of paths) {
|
|
66813
66895
|
try {
|
|
66814
|
-
sharp = __require(
|
|
66896
|
+
sharp = __require(path20);
|
|
66815
66897
|
break;
|
|
66816
66898
|
} catch (err) {
|
|
66817
66899
|
errors4.push(err);
|
|
66818
66900
|
}
|
|
66819
66901
|
}
|
|
66820
|
-
if (sharp &&
|
|
66902
|
+
if (sharp && path20.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
|
|
66821
66903
|
const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
|
|
66822
66904
|
err.code = "Unsupported CPU";
|
|
66823
66905
|
errors4.push(err);
|
|
@@ -69679,15 +69761,15 @@ var require_color = __commonJS((exports, module) => {
|
|
|
69679
69761
|
};
|
|
69680
69762
|
}
|
|
69681
69763
|
function wrapConversion(toModel, graph) {
|
|
69682
|
-
const
|
|
69764
|
+
const path20 = [graph[toModel].parent, toModel];
|
|
69683
69765
|
let fn = conversions_default[graph[toModel].parent][toModel];
|
|
69684
69766
|
let cur = graph[toModel].parent;
|
|
69685
69767
|
while (graph[cur].parent) {
|
|
69686
|
-
|
|
69768
|
+
path20.unshift(graph[cur].parent);
|
|
69687
69769
|
fn = link(conversions_default[graph[cur].parent][cur], fn);
|
|
69688
69770
|
cur = graph[cur].parent;
|
|
69689
69771
|
}
|
|
69690
|
-
fn.conversion =
|
|
69772
|
+
fn.conversion = path20;
|
|
69691
69773
|
return fn;
|
|
69692
69774
|
}
|
|
69693
69775
|
function route(fromModel) {
|
|
@@ -70292,7 +70374,7 @@ var require_output = __commonJS((exports, module) => {
|
|
|
70292
70374
|
Copyright 2013 Lovell Fuller and others.
|
|
70293
70375
|
SPDX-License-Identifier: Apache-2.0
|
|
70294
70376
|
*/
|
|
70295
|
-
var
|
|
70377
|
+
var path20 = __require("path");
|
|
70296
70378
|
var is = require_is();
|
|
70297
70379
|
var sharp = require_sharp();
|
|
70298
70380
|
var formats = new Map([
|
|
@@ -70323,9 +70405,9 @@ var require_output = __commonJS((exports, module) => {
|
|
|
70323
70405
|
let err;
|
|
70324
70406
|
if (!is.string(fileOut)) {
|
|
70325
70407
|
err = new Error("Missing output file path");
|
|
70326
|
-
} else if (is.string(this.options.input.file) &&
|
|
70408
|
+
} else if (is.string(this.options.input.file) && path20.resolve(this.options.input.file) === path20.resolve(fileOut)) {
|
|
70327
70409
|
err = new Error("Cannot use same file for input and output");
|
|
70328
|
-
} else if (jp2Regex.test(
|
|
70410
|
+
} else if (jp2Regex.test(path20.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
|
|
70329
70411
|
err = errJp2Save();
|
|
70330
70412
|
}
|
|
70331
70413
|
if (err) {
|
|
@@ -77572,11 +77654,11 @@ var init_transformers_node = __esm(() => {
|
|
|
77572
77654
|
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}).`);
|
|
77573
77655
|
}
|
|
77574
77656
|
for (let i = 0;i < num_chunks; ++i) {
|
|
77575
|
-
const
|
|
77576
|
-
const fullPath = `${options.subfolder ?? ""}/${
|
|
77657
|
+
const path20 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
|
|
77658
|
+
const fullPath = `${options.subfolder ?? ""}/${path20}`;
|
|
77577
77659
|
externalDataPromises.push(new Promise(async (resolve4, reject) => {
|
|
77578
77660
|
const data = await (0, _utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelFile)(pretrained_model_name_or_path, fullPath, true, options, return_path);
|
|
77579
|
-
resolve4(data instanceof Uint8Array ? { path:
|
|
77661
|
+
resolve4(data instanceof Uint8Array ? { path: path20, data } : path20);
|
|
77580
77662
|
}));
|
|
77581
77663
|
}
|
|
77582
77664
|
} else if (session_options.externalData !== undefined) {
|
|
@@ -90640,7 +90722,7 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
90640
90722
|
const blob = new Blob([wav], { type: "audio/wav" });
|
|
90641
90723
|
return blob;
|
|
90642
90724
|
}
|
|
90643
|
-
async save(
|
|
90725
|
+
async save(path20) {
|
|
90644
90726
|
let fn;
|
|
90645
90727
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_BROWSER_ENV) {
|
|
90646
90728
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_WEBWORKER_ENV) {
|
|
@@ -90648,14 +90730,14 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
90648
90730
|
}
|
|
90649
90731
|
fn = _core_js__WEBPACK_IMPORTED_MODULE_2__.saveBlob;
|
|
90650
90732
|
} else if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_FS_AVAILABLE) {
|
|
90651
|
-
fn = async (
|
|
90733
|
+
fn = async (path21, blob) => {
|
|
90652
90734
|
let buffer = await blob.arrayBuffer();
|
|
90653
|
-
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(
|
|
90735
|
+
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path21, Buffer.from(buffer));
|
|
90654
90736
|
};
|
|
90655
90737
|
} else {
|
|
90656
90738
|
throw new Error("Unable to save because filesystem is disabled in this environment.");
|
|
90657
90739
|
}
|
|
90658
|
-
await fn(
|
|
90740
|
+
await fn(path20, this.toBlob());
|
|
90659
90741
|
}
|
|
90660
90742
|
}
|
|
90661
90743
|
},
|
|
@@ -90751,11 +90833,11 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
90751
90833
|
function calculateReflectOffset(i, w) {
|
|
90752
90834
|
return Math.abs((i + w) % (2 * w) - w);
|
|
90753
90835
|
}
|
|
90754
|
-
function saveBlob(
|
|
90836
|
+
function saveBlob(path20, blob) {
|
|
90755
90837
|
const dataURL = URL.createObjectURL(blob);
|
|
90756
90838
|
const downloadLink = document.createElement("a");
|
|
90757
90839
|
downloadLink.href = dataURL;
|
|
90758
|
-
downloadLink.download =
|
|
90840
|
+
downloadLink.download = path20;
|
|
90759
90841
|
downloadLink.click();
|
|
90760
90842
|
downloadLink.remove();
|
|
90761
90843
|
URL.revokeObjectURL(dataURL);
|
|
@@ -91356,8 +91438,8 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
91356
91438
|
}
|
|
91357
91439
|
|
|
91358
91440
|
class FileCache {
|
|
91359
|
-
constructor(
|
|
91360
|
-
this.path =
|
|
91441
|
+
constructor(path20) {
|
|
91442
|
+
this.path = path20;
|
|
91361
91443
|
}
|
|
91362
91444
|
async match(request) {
|
|
91363
91445
|
let filePath = node_path__WEBPACK_IMPORTED_MODULE_1__["default"].join(this.path, request);
|
|
@@ -92113,20 +92195,20 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
92113
92195
|
}
|
|
92114
92196
|
return this;
|
|
92115
92197
|
}
|
|
92116
|
-
async save(
|
|
92198
|
+
async save(path20) {
|
|
92117
92199
|
if (IS_BROWSER_OR_WEBWORKER) {
|
|
92118
92200
|
if (_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_WEBWORKER_ENV) {
|
|
92119
92201
|
throw new Error("Unable to save an image from a Web Worker.");
|
|
92120
92202
|
}
|
|
92121
|
-
const extension =
|
|
92203
|
+
const extension = path20.split(".").pop().toLowerCase();
|
|
92122
92204
|
const mime = CONTENT_TYPE_MAP.get(extension) ?? "image/png";
|
|
92123
92205
|
const blob = await this.toBlob(mime);
|
|
92124
|
-
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(
|
|
92206
|
+
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path20, blob);
|
|
92125
92207
|
} else if (!_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_FS_AVAILABLE) {
|
|
92126
92208
|
throw new Error("Unable to save the image because filesystem is disabled in this environment.");
|
|
92127
92209
|
} else {
|
|
92128
92210
|
const img = this.toSharp();
|
|
92129
|
-
return await img.toFile(
|
|
92211
|
+
return await img.toFile(path20);
|
|
92130
92212
|
}
|
|
92131
92213
|
}
|
|
92132
92214
|
toSharp() {
|
|
@@ -101666,10 +101748,10 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
|
|
|
101666
101748
|
super(t, "P2023", r);
|
|
101667
101749
|
}
|
|
101668
101750
|
};
|
|
101669
|
-
var
|
|
101751
|
+
var fs15 = new WeakMap;
|
|
101670
101752
|
function Ep(e) {
|
|
101671
|
-
let t =
|
|
101672
|
-
return t || (t = Object.entries(e),
|
|
101753
|
+
let t = fs15.get(e);
|
|
101754
|
+
return t || (t = Object.entries(e), fs15.set(e, t)), t;
|
|
101673
101755
|
}
|
|
101674
101756
|
function hs(e, t, r) {
|
|
101675
101757
|
switch (t.type) {
|
|
@@ -105637,7 +105719,7 @@ var require_prisma = __commonJS((exports) => {
|
|
|
105637
105719
|
Prisma.JsonNull = JsonNull2;
|
|
105638
105720
|
Prisma.AnyNull = AnyNull2;
|
|
105639
105721
|
Prisma.NullTypes = NullTypes2;
|
|
105640
|
-
var
|
|
105722
|
+
var path20 = __require("path");
|
|
105641
105723
|
exports.Prisma.TransactionIsolationLevel = makeStrictEnum2({
|
|
105642
105724
|
ReadUncommitted: "ReadUncommitted",
|
|
105643
105725
|
ReadCommitted: "ReadCommitted",
|
|
@@ -117359,10 +117441,10 @@ var init_chunker_code = __esm(() => {
|
|
|
117359
117441
|
});
|
|
117360
117442
|
|
|
117361
117443
|
// ../../packages/core/dist/services/search/smart-chunker.js
|
|
117362
|
-
import
|
|
117444
|
+
import path20 from "path";
|
|
117363
117445
|
function smartChunk(content, filePath, config3 = {}) {
|
|
117364
117446
|
const cfg = { ...DEFAULT_CONFIG, ...config3 };
|
|
117365
|
-
const ext2 =
|
|
117447
|
+
const ext2 = path20.extname(filePath).toLowerCase();
|
|
117366
117448
|
const relativePath = filePath;
|
|
117367
117449
|
const fileImports = isCodeFile(ext2) ? extractFileImports(content, ext2) : undefined;
|
|
117368
117450
|
let chunks;
|
|
@@ -117700,8 +117782,8 @@ var init_embedding_freshness = __esm(() => {
|
|
|
117700
117782
|
});
|
|
117701
117783
|
|
|
117702
117784
|
// ../../packages/core/dist/services/search/project-indexer.js
|
|
117703
|
-
import
|
|
117704
|
-
import
|
|
117785
|
+
import fs15 from "fs/promises";
|
|
117786
|
+
import path21 from "path";
|
|
117705
117787
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
117706
117788
|
async function runWithIndexLock(lockMap, projectId, work) {
|
|
117707
117789
|
const prevLock = lockMap.get(projectId);
|
|
@@ -117744,7 +117826,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
117744
117826
|
dot: false
|
|
117745
117827
|
});
|
|
117746
117828
|
const filteredFiles = files.filter((file2) => {
|
|
117747
|
-
const relativePath =
|
|
117829
|
+
const relativePath = path21.relative(projectPath, file2);
|
|
117748
117830
|
const shouldIgnore = ig.ignores(relativePath);
|
|
117749
117831
|
if (shouldIgnore) {
|
|
117750
117832
|
logger.debug("Ignoring file per .gitignore during indexing", {
|
|
@@ -117784,7 +117866,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
117784
117866
|
});
|
|
117785
117867
|
}
|
|
117786
117868
|
}
|
|
117787
|
-
const indexedFilesList = filteredFiles.map((f) =>
|
|
117869
|
+
const indexedFilesList = filteredFiles.map((f) => path21.relative(projectPath, f));
|
|
117788
117870
|
await deps.indexManager.updateIndexMetadata(projectId, projectPath, indexedFilesList);
|
|
117789
117871
|
logger.info("Project indexing completed", {
|
|
117790
117872
|
projectId,
|
|
@@ -117914,7 +117996,7 @@ async function ensureFreshIndex(deps, projectId, projectPath, options = {}) {
|
|
|
117914
117996
|
let errors4 = 0;
|
|
117915
117997
|
for (const relativeFilePath of filesToReindex) {
|
|
117916
117998
|
try {
|
|
117917
|
-
const fullPath =
|
|
117999
|
+
const fullPath = path21.join(projectPath, relativeFilePath);
|
|
117918
118000
|
const result = await deps.indexFile(fullPath, projectId, projectPath, centralityMap);
|
|
117919
118001
|
filesIndexed++;
|
|
117920
118002
|
chunksIndexed += result.chunks;
|
|
@@ -117974,8 +118056,8 @@ async function checkSearchAdmission(deps, projectId, projectPath) {
|
|
|
117974
118056
|
}
|
|
117975
118057
|
async function indexFile(deps, filePath, projectId, projectRoot, centralityMap) {
|
|
117976
118058
|
projectId = await getProjectIdentityAliasResolver().resolve(projectId);
|
|
117977
|
-
const content = await
|
|
117978
|
-
const relativePath =
|
|
118059
|
+
const content = await fs15.readFile(filePath, "utf-8");
|
|
118060
|
+
const relativePath = path21.relative(projectRoot, filePath);
|
|
117979
118061
|
const maxFileSize = config.get("security").maxFileSize || 1024 * 1024;
|
|
117980
118062
|
if (content.length > maxFileSize) {
|
|
117981
118063
|
logger.warn("File too large, skipping", {
|
|
@@ -117995,7 +118077,7 @@ async function indexFile(deps, filePath, projectId, projectRoot, centralityMap)
|
|
|
117995
118077
|
chunkIndex: i,
|
|
117996
118078
|
totalChunks: chunks.length,
|
|
117997
118079
|
type: chunk.type,
|
|
117998
|
-
language:
|
|
118080
|
+
language: path21.extname(filePath).slice(1),
|
|
117999
118081
|
lineStart: chunk.lineStart,
|
|
118000
118082
|
lineEnd: chunk.lineEnd,
|
|
118001
118083
|
label: chunk.label,
|
|
@@ -122553,16 +122635,16 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
122553
122635
|
const seen = new Set;
|
|
122554
122636
|
const out = [];
|
|
122555
122637
|
for (const e of httpEdges) {
|
|
122556
|
-
const
|
|
122557
|
-
if (!
|
|
122638
|
+
const path22 = e.route;
|
|
122639
|
+
if (!path22)
|
|
122558
122640
|
continue;
|
|
122559
122641
|
const method = (e.method ?? "ANY").toUpperCase();
|
|
122560
|
-
const key = method + " " +
|
|
122642
|
+
const key = method + " " + path22;
|
|
122561
122643
|
if (seen.has(key))
|
|
122562
122644
|
continue;
|
|
122563
122645
|
seen.add(key);
|
|
122564
122646
|
out.push({
|
|
122565
|
-
path:
|
|
122647
|
+
path: path22,
|
|
122566
122648
|
method: e.method,
|
|
122567
122649
|
file: e.fromFile,
|
|
122568
122650
|
handler: e.targetFqn ?? e.symbolName
|
|
@@ -122573,12 +122655,12 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
122573
122655
|
continue;
|
|
122574
122656
|
const parsed = parseRouteName(d.name);
|
|
122575
122657
|
const method = parsed?.method ?? "ANY";
|
|
122576
|
-
const
|
|
122577
|
-
const key = method + " " +
|
|
122658
|
+
const path22 = parsed?.path ?? d.name;
|
|
122659
|
+
const key = method + " " + path22;
|
|
122578
122660
|
if (seen.has(key))
|
|
122579
122661
|
continue;
|
|
122580
122662
|
seen.add(key);
|
|
122581
|
-
out.push({ path:
|
|
122663
|
+
out.push({ path: path22, method: parsed?.method, file: d.filePath, handler: d.name });
|
|
122582
122664
|
}
|
|
122583
122665
|
for (const d of defs) {
|
|
122584
122666
|
const parsed = parseRouteName(d.name);
|
|
@@ -122799,8 +122881,8 @@ __export(exports_symbol_graph_service, {
|
|
|
122799
122881
|
symbolGraphService: () => symbolGraphService,
|
|
122800
122882
|
SymbolGraphService: () => SymbolGraphService
|
|
122801
122883
|
});
|
|
122802
|
-
import
|
|
122803
|
-
import
|
|
122884
|
+
import path22 from "path";
|
|
122885
|
+
import fs16 from "fs/promises";
|
|
122804
122886
|
|
|
122805
122887
|
class SymbolGraphService {
|
|
122806
122888
|
identityLookup;
|
|
@@ -123128,7 +123210,7 @@ class SymbolGraphService {
|
|
|
123128
123210
|
async readSnippet(relativePath, lineStart, lineEnd, projectId) {
|
|
123129
123211
|
try {
|
|
123130
123212
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
123131
|
-
const content = await
|
|
123213
|
+
const content = await fs16.readFile(absolutePath, "utf-8");
|
|
123132
123214
|
const lines = content.split(`
|
|
123133
123215
|
`);
|
|
123134
123216
|
return lines.slice(Math.max(0, lineStart - 1), Math.min(lines.length, lineEnd)).join(`
|
|
@@ -123140,7 +123222,7 @@ class SymbolGraphService {
|
|
|
123140
123222
|
async readContext(relativePath, lineNumber, contextLines, projectId) {
|
|
123141
123223
|
try {
|
|
123142
123224
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
123143
|
-
const content = await
|
|
123225
|
+
const content = await fs16.readFile(absolutePath, "utf-8");
|
|
123144
123226
|
const lines = content.split(`
|
|
123145
123227
|
`);
|
|
123146
123228
|
const start = Math.max(0, lineNumber - contextLines - 1);
|
|
@@ -123153,7 +123235,7 @@ class SymbolGraphService {
|
|
|
123153
123235
|
}
|
|
123154
123236
|
async resolveToAbsolute(relativePath, projectId) {
|
|
123155
123237
|
const root = await this.getProjectRoot(projectId);
|
|
123156
|
-
return root ?
|
|
123238
|
+
return root ? path22.resolve(root, relativePath) : relativePath;
|
|
123157
123239
|
}
|
|
123158
123240
|
async getProjectRoot(projectId) {
|
|
123159
123241
|
const cached2 = this.projectRootCache.get(projectId);
|
|
@@ -124936,31 +125018,31 @@ class TracePathService {
|
|
|
124936
125018
|
const chains = [];
|
|
124937
125019
|
const seen = new Set;
|
|
124938
125020
|
let walks = 0;
|
|
124939
|
-
const walk = (fqn,
|
|
125021
|
+
const walk = (fqn, path23) => {
|
|
124940
125022
|
if (chains.length >= CHAIN_CAP)
|
|
124941
125023
|
return;
|
|
124942
125024
|
if (walks >= MAX_WALKS)
|
|
124943
125025
|
return;
|
|
124944
125026
|
walks++;
|
|
124945
|
-
const key =
|
|
125027
|
+
const key = path23.join("\u2192");
|
|
124946
125028
|
if (seen.has(key))
|
|
124947
125029
|
return;
|
|
124948
125030
|
seen.add(key);
|
|
124949
125031
|
const next = adj.get(fqn);
|
|
124950
125032
|
if (!next || next.length === 0 || !whoHasChild.has(fqn)) {
|
|
124951
|
-
if (
|
|
124952
|
-
chains.push(
|
|
125033
|
+
if (path23.length > 1)
|
|
125034
|
+
chains.push(path23.map((n) => this.fqnToName(n)).join(" \u2192 "));
|
|
124953
125035
|
return;
|
|
124954
125036
|
}
|
|
124955
125037
|
for (const child of next) {
|
|
124956
125038
|
if (chains.length >= CHAIN_CAP || walks >= MAX_WALKS)
|
|
124957
125039
|
return;
|
|
124958
|
-
if (
|
|
124959
|
-
const cycled = [...
|
|
125040
|
+
if (path23.includes(child)) {
|
|
125041
|
+
const cycled = [...path23, `${this.fqnToName(child)}\u21BA`];
|
|
124960
125042
|
chains.push(cycled.map((n) => n).join(" \u2192 "));
|
|
124961
125043
|
continue;
|
|
124962
125044
|
}
|
|
124963
|
-
walk(child, [...
|
|
125045
|
+
walk(child, [...path23, child]);
|
|
124964
125046
|
}
|
|
124965
125047
|
};
|
|
124966
125048
|
for (const seed of seeds) {
|
|
@@ -126983,9 +127065,9 @@ var init_inference_probe = __esm(() => {
|
|
|
126983
127065
|
});
|
|
126984
127066
|
|
|
126985
127067
|
// ../../packages/core/dist/services/health/local-health-checker.js
|
|
126986
|
-
import
|
|
127068
|
+
import fs17 from "fs/promises";
|
|
126987
127069
|
import { existsSync as existsSync3 } from "fs";
|
|
126988
|
-
import
|
|
127070
|
+
import path23 from "path";
|
|
126989
127071
|
|
|
126990
127072
|
class LocalHealthChecker {
|
|
126991
127073
|
dataDir = config.get("dataDir");
|
|
@@ -127063,10 +127145,10 @@ class LocalHealthChecker {
|
|
|
127063
127145
|
const start = Date.now();
|
|
127064
127146
|
try {
|
|
127065
127147
|
if (!existsSync3(this.dataDir))
|
|
127066
|
-
await
|
|
127067
|
-
const probe =
|
|
127068
|
-
await
|
|
127069
|
-
await
|
|
127148
|
+
await fs17.mkdir(this.dataDir, { recursive: true });
|
|
127149
|
+
const probe = path23.join(this.dataDir, ".health-check-test");
|
|
127150
|
+
await fs17.writeFile(probe, "ok");
|
|
127151
|
+
await fs17.unlink(probe);
|
|
127070
127152
|
return { available: true, latency: Date.now() - start, details: { path: this.dataDir, writable: true } };
|
|
127071
127153
|
} catch (error51) {
|
|
127072
127154
|
return { available: false, latency: Date.now() - start, error: `Data directory error: ${error51.message}` };
|
|
@@ -130367,9 +130449,9 @@ var init_scheduler2 = __esm(() => {
|
|
|
130367
130449
|
});
|
|
130368
130450
|
|
|
130369
130451
|
// ../../packages/core/dist/services/pricing/models-dev-client.js
|
|
130370
|
-
import
|
|
130452
|
+
import fs18 from "fs/promises";
|
|
130371
130453
|
import { existsSync as existsSync4 } from "fs";
|
|
130372
|
-
import
|
|
130454
|
+
import path24 from "path";
|
|
130373
130455
|
function getModelsDevClient() {
|
|
130374
130456
|
if (!clientInstance) {
|
|
130375
130457
|
clientInstance = new ModelsDevClient;
|
|
@@ -130389,7 +130471,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
130389
130471
|
memoryCacheTimestamp = 0;
|
|
130390
130472
|
getLocalCachePath() {
|
|
130391
130473
|
const dataDir = config.get("dataDir");
|
|
130392
|
-
return
|
|
130474
|
+
return path24.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
|
|
130393
130475
|
}
|
|
130394
130476
|
async loadLocalCache() {
|
|
130395
130477
|
const cachePath = this.getLocalCachePath();
|
|
@@ -130397,7 +130479,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
130397
130479
|
if (!existsSync4(cachePath)) {
|
|
130398
130480
|
return null;
|
|
130399
130481
|
}
|
|
130400
|
-
const content = await
|
|
130482
|
+
const content = await fs18.readFile(cachePath, "utf-8");
|
|
130401
130483
|
const data = JSON.parse(content);
|
|
130402
130484
|
const age = Date.now() - data.timestamp;
|
|
130403
130485
|
if (age > ModelsDevClient.LOCAL_CACHE_TTL) {
|
|
@@ -130424,14 +130506,14 @@ var init_models_dev_client = __esm(() => {
|
|
|
130424
130506
|
async saveLocalCache(models) {
|
|
130425
130507
|
const cachePath = this.getLocalCachePath();
|
|
130426
130508
|
try {
|
|
130427
|
-
const dir =
|
|
130428
|
-
await
|
|
130509
|
+
const dir = path24.dirname(cachePath);
|
|
130510
|
+
await fs18.mkdir(dir, { recursive: true });
|
|
130429
130511
|
const data = {
|
|
130430
130512
|
timestamp: Date.now(),
|
|
130431
130513
|
version: "1.0.0",
|
|
130432
130514
|
models: Object.fromEntries(models)
|
|
130433
130515
|
};
|
|
130434
|
-
await
|
|
130516
|
+
await fs18.writeFile(cachePath, JSON.stringify(data), "utf-8");
|
|
130435
130517
|
logger.debug("Saved pricing to local cache", {
|
|
130436
130518
|
models: models.size,
|
|
130437
130519
|
path: cachePath
|
|
@@ -130761,7 +130843,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
130761
130843
|
const cachePath = this.getLocalCachePath();
|
|
130762
130844
|
try {
|
|
130763
130845
|
if (existsSync4(cachePath)) {
|
|
130764
|
-
await
|
|
130846
|
+
await fs18.unlink(cachePath);
|
|
130765
130847
|
logger.debug("Local pricing cache file deleted");
|
|
130766
130848
|
}
|
|
130767
130849
|
} catch (error51) {
|
|
@@ -131365,8 +131447,8 @@ function stripNul(content) {
|
|
|
131365
131447
|
}
|
|
131366
131448
|
|
|
131367
131449
|
// ../../packages/core/dist/services/etl/stages/discover.js
|
|
131368
|
-
import
|
|
131369
|
-
import
|
|
131450
|
+
import fs19 from "fs/promises";
|
|
131451
|
+
import path25 from "path";
|
|
131370
131452
|
import { createHash as createHash8 } from "crypto";
|
|
131371
131453
|
|
|
131372
131454
|
class DiscoverStage {
|
|
@@ -131392,7 +131474,7 @@ class DiscoverStage {
|
|
|
131392
131474
|
dot: false,
|
|
131393
131475
|
absolute: false
|
|
131394
131476
|
});
|
|
131395
|
-
relPaths = found.map((p) =>
|
|
131477
|
+
relPaths = found.map((p) => path25.isAbsolute(p) ? path25.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
|
|
131396
131478
|
}
|
|
131397
131479
|
if (ctx.resumeCursor?.path) {
|
|
131398
131480
|
const cursorPath = ctx.resumeCursor.path;
|
|
@@ -131451,10 +131533,10 @@ class DiscoverStage {
|
|
|
131451
131533
|
return discovered;
|
|
131452
131534
|
}
|
|
131453
131535
|
async processFile(ctx, relativePath, forceReindex) {
|
|
131454
|
-
const absolutePath =
|
|
131536
|
+
const absolutePath = path25.join(ctx.projectPath, relativePath);
|
|
131455
131537
|
try {
|
|
131456
|
-
const stat = await
|
|
131457
|
-
const content = stripNul(await
|
|
131538
|
+
const stat = await fs19.stat(absolutePath);
|
|
131539
|
+
const content = stripNul(await fs19.readFile(absolutePath, "utf-8"));
|
|
131458
131540
|
const contentHash = createHash8("sha256").update(content).digest("hex");
|
|
131459
131541
|
let needsReparse = forceReindex;
|
|
131460
131542
|
if (!forceReindex) {
|
|
@@ -131498,8 +131580,8 @@ class DiscoverStage {
|
|
|
131498
131580
|
ig.add(pattern);
|
|
131499
131581
|
}
|
|
131500
131582
|
try {
|
|
131501
|
-
const gitignorePath =
|
|
131502
|
-
const gitignoreContent = await
|
|
131583
|
+
const gitignorePath = path25.join(projectPath, ".gitignore");
|
|
131584
|
+
const gitignoreContent = await fs19.readFile(gitignorePath, "utf8");
|
|
131503
131585
|
const rules = gitignoreContent.split(`
|
|
131504
131586
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
131505
131587
|
ig.add(rules);
|
|
@@ -132854,8 +132936,8 @@ function rustUseLeaves(node, source, prefix = []) {
|
|
|
132854
132936
|
}
|
|
132855
132937
|
if (node.type === "use_wildcard")
|
|
132856
132938
|
return [{ path: [...prefix, "*"], glob: true }];
|
|
132857
|
-
const
|
|
132858
|
-
return
|
|
132939
|
+
const path26 = rustPathSegments(node, source);
|
|
132940
|
+
return path26.length ? [{ path: [...prefix, ...path26] }] : [];
|
|
132859
132941
|
}
|
|
132860
132942
|
function functionalCaptures(captures, source, family) {
|
|
132861
132943
|
if (family !== "clojure")
|
|
@@ -133827,8 +133909,8 @@ var init_structural_runtime = __esm(() => {
|
|
|
133827
133909
|
});
|
|
133828
133910
|
|
|
133829
133911
|
// ../../packages/core/dist/services/etl/stages/parse.js
|
|
133830
|
-
import
|
|
133831
|
-
import
|
|
133912
|
+
import path26 from "path";
|
|
133913
|
+
import fs20 from "fs/promises";
|
|
133832
133914
|
function resolveChunkerMaxChars() {
|
|
133833
133915
|
const global2 = Number(process.env.EMBEDDING_MAX_CHARS);
|
|
133834
133916
|
if (Number.isFinite(global2) && global2 > 0)
|
|
@@ -133856,8 +133938,8 @@ class ParseStage {
|
|
|
133856
133938
|
const results = new Map;
|
|
133857
133939
|
let processed = 0;
|
|
133858
133940
|
const phases = [
|
|
133859
|
-
files.filter((file2) =>
|
|
133860
|
-
files.filter((file2) =>
|
|
133941
|
+
files.filter((file2) => path26.extname(file2.relativePath).toLowerCase() !== ".h"),
|
|
133942
|
+
files.filter((file2) => path26.extname(file2.relativePath).toLowerCase() === ".h")
|
|
133861
133943
|
];
|
|
133862
133944
|
const batches = phases.flatMap((phase) => Array.from({ length: Math.ceil(phase.length / BATCH_SIZE) }, (_, index) => phase.slice(index * BATCH_SIZE, (index + 1) * BATCH_SIZE)));
|
|
133863
133945
|
for (const batch of batches) {
|
|
@@ -133895,19 +133977,19 @@ class ParseStage {
|
|
|
133895
133977
|
return files.map((file2) => results.get(file2.relativePath));
|
|
133896
133978
|
}
|
|
133897
133979
|
recordHeaderImporterEvidence(ctx, files, parsedFiles) {
|
|
133898
|
-
const knownHeaders = new Set(files.filter((file2) =>
|
|
133980
|
+
const knownHeaders = new Set(files.filter((file2) => path26.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path26.posix.normalize(file2.relativePath)));
|
|
133899
133981
|
const mutable = {
|
|
133900
133982
|
...ctx.structuralHeaderEvidenceByFile
|
|
133901
133983
|
};
|
|
133902
133984
|
for (const parsed of parsedFiles) {
|
|
133903
|
-
const extension =
|
|
133985
|
+
const extension = path26.extname(parsed.file.relativePath).toLowerCase();
|
|
133904
133986
|
const key = extension === ".c" ? "cImporters" : [".cpp", ".hpp"].includes(extension) ? "cppImporters" : undefined;
|
|
133905
133987
|
if (!key)
|
|
133906
133988
|
continue;
|
|
133907
133989
|
for (const imported of parsed.rawImports) {
|
|
133908
133990
|
if (!["c_include", "cpp_include"].includes(imported.form) || imported.specifier.startsWith("<"))
|
|
133909
133991
|
continue;
|
|
133910
|
-
const header =
|
|
133992
|
+
const header = path26.posix.normalize(path26.posix.join(path26.posix.dirname(parsed.file.relativePath), imported.specifier));
|
|
133911
133993
|
if (!knownHeaders.has(header))
|
|
133912
133994
|
continue;
|
|
133913
133995
|
const existing = mutable[header] ?? {};
|
|
@@ -133918,9 +134000,9 @@ class ParseStage {
|
|
|
133918
134000
|
}
|
|
133919
134001
|
async parseFile(ctx, file2) {
|
|
133920
134002
|
if (!file2.needsReparse) {
|
|
133921
|
-
const extension =
|
|
134003
|
+
const extension = path26.extname(file2.relativePath).toLowerCase();
|
|
133922
134004
|
if ([".c", ".cpp", ".hpp"].includes(extension)) {
|
|
133923
|
-
const content = file2.snapshotContent ?? await
|
|
134005
|
+
const content = file2.snapshotContent ?? await fs20.readFile(file2.absolutePath, "utf8");
|
|
133924
134006
|
const outcome = await this.runtime.parse({ extension, source: Buffer.from(content) });
|
|
133925
134007
|
if (outcome.status === "failed")
|
|
133926
134008
|
throw new StructuralEtlParseError(file2.relativePath, outcome.failureKind, `Structural evidence parse failed (${outcome.failureKind})`, outcome.diagnosticCount, outcome.diagnostics.slice(0, 10));
|
|
@@ -133932,8 +134014,8 @@ class ParseStage {
|
|
|
133932
134014
|
return { file: file2, chunks: [], symbols: [], rawImports: [], rawEdges: [] };
|
|
133933
134015
|
}
|
|
133934
134016
|
try {
|
|
133935
|
-
const content = file2.snapshotContent ?? await
|
|
133936
|
-
const ext2 =
|
|
134017
|
+
const content = file2.snapshotContent ?? await fs20.readFile(file2.absolutePath, "utf-8");
|
|
134018
|
+
const ext2 = path26.extname(file2.relativePath).toLowerCase();
|
|
133937
134019
|
const chunkerMaxChars = resolveChunkerMaxChars();
|
|
133938
134020
|
const chunks = smartChunk(content, file2.relativePath, chunkerMaxChars ? { maxChunkChars: chunkerMaxChars } : {});
|
|
133939
134021
|
let symbols;
|
|
@@ -134488,7 +134570,7 @@ var init_resolver = __esm(() => {
|
|
|
134488
134570
|
});
|
|
134489
134571
|
|
|
134490
134572
|
// ../../packages/core/dist/services/structural/resolvers/typescript.js
|
|
134491
|
-
import
|
|
134573
|
+
import path27 from "path";
|
|
134492
134574
|
function candidates(identities) {
|
|
134493
134575
|
return Object.freeze(identities.map((identity) => Object.freeze({
|
|
134494
134576
|
fqn: identity.fqn,
|
|
@@ -134583,7 +134665,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
134583
134665
|
const bases = /\.[cm]?jsx?$/u.test(base) ? [base.replace(/\.[cm]?jsx?$/u, ".ts"), base.replace(/\.[cm]?jsx?$/u, ".tsx"), base] : [base];
|
|
134584
134666
|
for (const candidateBase of bases)
|
|
134585
134667
|
for (const suffix of DIALECT_PROBES[dialect] ?? [""]) {
|
|
134586
|
-
const value =
|
|
134668
|
+
const value = path27.posix.normalize(`${candidateBase}${suffix}`);
|
|
134587
134669
|
if (!value.startsWith("../") && value !== ".." && known.has(value))
|
|
134588
134670
|
return value;
|
|
134589
134671
|
}
|
|
@@ -134592,7 +134674,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
134592
134674
|
function resolveStructuralSpecifier(specifier, fromFile, build, dialect = "typescript") {
|
|
134593
134675
|
const known = new Set(build.knownFiles.map(normalizeStructuralFile));
|
|
134594
134676
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
134595
|
-
return probe(
|
|
134677
|
+
return probe(path27.posix.join(path27.posix.dirname(fromFile), specifier), known, dialect);
|
|
134596
134678
|
}
|
|
134597
134679
|
const aliases = build.pathAliasesByFile?.[normalizeStructuralFile(fromFile)] ?? build.pathAliases ?? [];
|
|
134598
134680
|
for (const alias of aliases) {
|
|
@@ -134856,7 +134938,7 @@ var init_scripting2 = __esm(() => {
|
|
|
134856
134938
|
});
|
|
134857
134939
|
|
|
134858
134940
|
// ../../packages/core/dist/services/structural/resolvers/systems.js
|
|
134859
|
-
import
|
|
134941
|
+
import path28 from "path";
|
|
134860
134942
|
var DIALECTS, SYSTEMS_LANGUAGE_RESOLVER;
|
|
134861
134943
|
var init_systems2 = __esm(() => {
|
|
134862
134944
|
init_typescript2();
|
|
@@ -134875,7 +134957,7 @@ var init_systems2 = __esm(() => {
|
|
|
134875
134957
|
const bindings = item.bindings.map((binding) => binding.imported === "*" && binding.local === "*" && unresolvedTarget && !unresolvedTarget.qualifier ? { ...binding, imported: unresolvedTarget.name, local: unresolvedTarget.name } : binding);
|
|
134876
134958
|
if (item.specifier === "crate" || item.specifier.startsWith("crate/")) {
|
|
134877
134959
|
const crateRoot = file2.file.startsWith("src/") ? "src" : "";
|
|
134878
|
-
return { ...item, bindings, specifier: `./${
|
|
134960
|
+
return { ...item, bindings, specifier: `./${path28.posix.relative(path28.posix.dirname(file2.file), path28.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
|
|
134879
134961
|
}
|
|
134880
134962
|
if (item.specifier === "self" || item.specifier.startsWith("self/"))
|
|
134881
134963
|
return { ...item, bindings, specifier: `./${item.specifier.replace(/^self\/?/u, "")}` };
|
|
@@ -134973,8 +135055,8 @@ var init_data_document2 = __esm(() => {
|
|
|
134973
135055
|
});
|
|
134974
135056
|
|
|
134975
135057
|
// ../../packages/core/dist/services/etl/stages/resolve.js
|
|
134976
|
-
import
|
|
134977
|
-
import
|
|
135058
|
+
import path29 from "path";
|
|
135059
|
+
import fs21 from "fs";
|
|
134978
135060
|
|
|
134979
135061
|
class ResolveStage {
|
|
134980
135062
|
symbolRepository;
|
|
@@ -134998,7 +135080,7 @@ class ResolveStage {
|
|
|
134998
135080
|
const structuralDocuments = files.flatMap((file2) => {
|
|
134999
135081
|
if (!file2.structure)
|
|
135000
135082
|
return [];
|
|
135001
|
-
const language = resolveStructuralLanguage(
|
|
135083
|
+
const language = resolveStructuralLanguage(path29.extname(file2.file.relativePath));
|
|
135002
135084
|
if (language.status !== "supported")
|
|
135003
135085
|
throw new Error(`structural_manifest_missing:${file2.file.relativePath}`);
|
|
135004
135086
|
return [{
|
|
@@ -135010,13 +135092,13 @@ class ResolveStage {
|
|
|
135010
135092
|
}];
|
|
135011
135093
|
});
|
|
135012
135094
|
const currentStructuralFiles = new Set(structuralDocuments.map((document2) => document2.file));
|
|
135013
|
-
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
135095
|
+
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path29.extname(item.file.relativePath).toLowerCase())).map((item) => item.file.relativePath));
|
|
135014
135096
|
const pathAliasesByFile = Object.fromEntries([...knownRelPaths].map((file2) => [
|
|
135015
135097
|
file2,
|
|
135016
135098
|
this.structuralAliasesFor(file2, rootAliases, monorepoPackages)
|
|
135017
135099
|
]));
|
|
135018
135100
|
const buildMetadata = { knownFiles: [...knownRelPaths], pathAliasesByFile };
|
|
135019
|
-
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(
|
|
135101
|
+
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(path29.extname(definition.file_path).toLowerCase())).filter((definition) => knownRelPaths.has(definition.file_path) && skippedStructuralFiles.has(definition.file_path)).filter((definition) => !currentStructuralFiles.has(definition.file_path));
|
|
135020
135102
|
const seedIds = new Set;
|
|
135021
135103
|
for (const definition of seedRows) {
|
|
135022
135104
|
if (seedIds.has(definition.id))
|
|
@@ -135109,7 +135191,7 @@ class ResolveStage {
|
|
|
135109
135191
|
if (parsed.file !== definition.file_path) {
|
|
135110
135192
|
throw new Error(`structural_repository_seed_file_mismatch:${definition.id}`);
|
|
135111
135193
|
}
|
|
135112
|
-
const language = resolveStructuralLanguage(
|
|
135194
|
+
const language = resolveStructuralLanguage(path29.extname(definition.file_path));
|
|
135113
135195
|
if (language.status !== "supported")
|
|
135114
135196
|
throw new Error(`structural_repository_seed_language:${definition.id}`);
|
|
135115
135197
|
let identity;
|
|
@@ -135161,7 +135243,7 @@ class ResolveStage {
|
|
|
135161
135243
|
});
|
|
135162
135244
|
}
|
|
135163
135245
|
resolveFile(parsed, projectPath, knownRelPaths, rootAliases, monorepoPackages, symbolIndex, knownFqns) {
|
|
135164
|
-
const fromDir =
|
|
135246
|
+
const fromDir = path29.dirname(path29.join(projectPath, parsed.file.relativePath));
|
|
135165
135247
|
const packageAliases = this.getPackageAliases(parsed.file.relativePath, monorepoPackages);
|
|
135166
135248
|
const allAliases = [...packageAliases, ...rootAliases];
|
|
135167
135249
|
const resolvedImports = parsed.rawImports.map((raw2) => {
|
|
@@ -135232,7 +135314,7 @@ class ResolveStage {
|
|
|
135232
135314
|
index.set(def.name, `${def.file_path}#${def.name}`);
|
|
135233
135315
|
}
|
|
135234
135316
|
} catch (err) {
|
|
135235
|
-
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
135317
|
+
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path29.extname(file2.file.relativePath).toLowerCase()));
|
|
135236
135318
|
if (skippedStructural)
|
|
135237
135319
|
throw new Error("structural_repository_seed_failed", { cause: err });
|
|
135238
135320
|
logger.warn("buildSymbolIndex: repo seed failed, in-batch only", {
|
|
@@ -135256,7 +135338,7 @@ class ResolveStage {
|
|
|
135256
135338
|
}
|
|
135257
135339
|
resolveSpecifier(specifier, fromDir, projectPath, knownRelPaths, aliases) {
|
|
135258
135340
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
135259
|
-
const resolved = this.probeExtensions(
|
|
135341
|
+
const resolved = this.probeExtensions(path29.resolve(fromDir, specifier), projectPath, knownRelPaths);
|
|
135260
135342
|
return { resolvedPath: resolved, external: false };
|
|
135261
135343
|
}
|
|
135262
135344
|
for (const alias of aliases) {
|
|
@@ -135264,8 +135346,8 @@ class ResolveStage {
|
|
|
135264
135346
|
const suffix = specifier.slice(alias.prefix.length);
|
|
135265
135347
|
for (const target of alias.targets) {
|
|
135266
135348
|
const cleanTarget = target.replace(/\/\*$/, "");
|
|
135267
|
-
const basePath = alias.packagePath ?
|
|
135268
|
-
const absPath =
|
|
135349
|
+
const basePath = alias.packagePath ? path29.join(projectPath, alias.packagePath) : projectPath;
|
|
135350
|
+
const absPath = path29.join(basePath, cleanTarget + suffix);
|
|
135269
135351
|
const resolved = this.probeExtensions(absPath, projectPath, knownRelPaths);
|
|
135270
135352
|
if (resolved)
|
|
135271
135353
|
return { resolvedPath: resolved, external: false };
|
|
@@ -135281,7 +135363,7 @@ class ResolveStage {
|
|
|
135281
135363
|
...TS_EXTENSIONS.map((ext2) => absPath.replace(/\.[^.]+$/, ext2))
|
|
135282
135364
|
];
|
|
135283
135365
|
for (const candidate2 of candidates2) {
|
|
135284
|
-
const rel =
|
|
135366
|
+
const rel = path29.relative(projectPath, candidate2).replace(/\\/g, "/");
|
|
135285
135367
|
if (knownRelPaths.has(rel))
|
|
135286
135368
|
return rel;
|
|
135287
135369
|
}
|
|
@@ -135289,9 +135371,9 @@ class ResolveStage {
|
|
|
135289
135371
|
}
|
|
135290
135372
|
loadTsConfigPaths(projectPath, packageBase) {
|
|
135291
135373
|
const aliases = [];
|
|
135292
|
-
const tsconfigPath =
|
|
135374
|
+
const tsconfigPath = path29.join(projectPath, "tsconfig.json");
|
|
135293
135375
|
try {
|
|
135294
|
-
const raw2 =
|
|
135376
|
+
const raw2 = fs21.readFileSync(tsconfigPath, "utf-8");
|
|
135295
135377
|
const stripped = raw2.replace(/\/\/[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
135296
135378
|
const tsconfig = JSON.parse(stripped);
|
|
135297
135379
|
const paths = tsconfig?.compilerOptions?.paths ?? {};
|
|
@@ -135320,7 +135402,7 @@ class ResolveStage {
|
|
|
135320
135402
|
}
|
|
135321
135403
|
}
|
|
135322
135404
|
for (const packageRelPath of packagePaths) {
|
|
135323
|
-
const absPackagePath =
|
|
135405
|
+
const absPackagePath = path29.join(projectPath, packageRelPath);
|
|
135324
135406
|
const aliases = this.loadTsConfigPaths(absPackagePath, packageRelPath);
|
|
135325
135407
|
if (aliases.length > 0) {
|
|
135326
135408
|
packages.push({
|
|
@@ -135350,7 +135432,7 @@ class ResolveStage {
|
|
|
135350
135432
|
structuralAliasesFor(filePath, rootAliases, packages) {
|
|
135351
135433
|
return [...this.getPackageAliases(filePath, packages), ...rootAliases].map((alias) => ({
|
|
135352
135434
|
pattern: alias.prefix + (alias.targets.some((target) => target.includes("*")) ? "/*" : ""),
|
|
135353
|
-
targets: alias.targets.map((target) => alias.packagePath ?
|
|
135435
|
+
targets: alias.targets.map((target) => alias.packagePath ? path29.posix.join(alias.packagePath, target) : target)
|
|
135354
135436
|
}));
|
|
135355
135437
|
}
|
|
135356
135438
|
}
|
|
@@ -135414,7 +135496,7 @@ var init_with_deadlock_retry = __esm(() => {
|
|
|
135414
135496
|
});
|
|
135415
135497
|
|
|
135416
135498
|
// ../../packages/core/dist/services/etl/stages/load.js
|
|
135417
|
-
import
|
|
135499
|
+
import path30 from "path";
|
|
135418
135500
|
function formatDuration(ms) {
|
|
135419
135501
|
const totalSec = Math.max(0, Math.round(ms / 1000));
|
|
135420
135502
|
if (totalSec < 60)
|
|
@@ -135691,7 +135773,7 @@ class LoadStage {
|
|
|
135691
135773
|
const filePath = file2.file.relativePath;
|
|
135692
135774
|
const batch = buildSymbolPersistenceBatch(ctx.projectId, file2);
|
|
135693
135775
|
if (ctx.graphGenerationLease) {
|
|
135694
|
-
const manifest = getLanguageManifestEntry(
|
|
135776
|
+
const manifest = getLanguageManifestEntry(path30.extname(filePath));
|
|
135695
135777
|
const diagnostics2 = (file2.structuralDiagnostics ?? []).slice(0, 10).map((diagnostic2) => ({
|
|
135696
135778
|
code: diagnostic2.code,
|
|
135697
135779
|
severity: diagnostic2.severity,
|
|
@@ -136148,9 +136230,9 @@ var init_graph_generation_coordinator = __esm(() => {
|
|
|
136148
136230
|
// ../../packages/core/dist/services/etl/pipeline.js
|
|
136149
136231
|
import { createHash as createHash10 } from "crypto";
|
|
136150
136232
|
import { setTimeout as delay2 } from "timers/promises";
|
|
136151
|
-
import
|
|
136233
|
+
import path31 from "path";
|
|
136152
136234
|
function buildHeaderLanguageEvidence(files) {
|
|
136153
|
-
const headers = new Set(files.filter((file2) =>
|
|
136235
|
+
const headers = new Set(files.filter((file2) => path31.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path31.posix.normalize(file2.relativePath)));
|
|
136154
136236
|
const mutable = new Map;
|
|
136155
136237
|
const entry2 = (header) => {
|
|
136156
136238
|
let value = mutable.get(header);
|
|
@@ -136161,7 +136243,7 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
136161
136243
|
return value;
|
|
136162
136244
|
};
|
|
136163
136245
|
for (const file2 of files) {
|
|
136164
|
-
if (
|
|
136246
|
+
if (path31.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
|
|
136165
136247
|
continue;
|
|
136166
136248
|
let commands;
|
|
136167
136249
|
try {
|
|
@@ -136177,11 +136259,11 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
136177
136259
|
const record2 = command;
|
|
136178
136260
|
if (typeof record2.file !== "string")
|
|
136179
136261
|
continue;
|
|
136180
|
-
const projectRoot =
|
|
136181
|
-
const commandDirectory = typeof record2.directory === "string" ?
|
|
136182
|
-
const absoluteInput =
|
|
136183
|
-
const relative3 =
|
|
136184
|
-
const header =
|
|
136262
|
+
const projectRoot = path31.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
|
|
136263
|
+
const commandDirectory = typeof record2.directory === "string" ? path31.resolve(projectRoot, record2.directory) : projectRoot;
|
|
136264
|
+
const absoluteInput = path31.resolve(commandDirectory, record2.file);
|
|
136265
|
+
const relative3 = path31.relative(projectRoot, absoluteInput);
|
|
136266
|
+
const header = path31.posix.normalize(relative3.replaceAll(path31.sep, "/"));
|
|
136185
136267
|
if (!headers.has(header))
|
|
136186
136268
|
continue;
|
|
136187
136269
|
const invocation = typeof record2.command === "string" ? record2.command : Array.isArray(record2.arguments) ? record2.arguments.join(" ") : "";
|
|
@@ -136958,7 +137040,7 @@ var TOOL_NAME_NORMALIZE, classifyToolCall = (_source, payload) => {
|
|
|
136958
137040
|
if (lowerPrompt.includes("blocked on") || lowerPrompt.includes("waiting on") || lowerPrompt.includes("can't proceed") || lowerPrompt.includes("stuck on")) {
|
|
136959
137041
|
return "blocked-on";
|
|
136960
137042
|
}
|
|
136961
|
-
if (lowerPrompt.startsWith("
|
|
137043
|
+
if (lowerPrompt.startsWith("act as") || lowerPrompt.startsWith("you are a")) {
|
|
136962
137044
|
return "role";
|
|
136963
137045
|
}
|
|
136964
137046
|
return "user-prompts";
|
|
@@ -142066,33 +142148,33 @@ var require_URL = __commonJS((exports, module) => {
|
|
|
142066
142148
|
else
|
|
142067
142149
|
return basepath.substring(0, lastslash + 1) + refpath;
|
|
142068
142150
|
}
|
|
142069
|
-
function remove_dot_segments(
|
|
142070
|
-
if (!
|
|
142071
|
-
return
|
|
142151
|
+
function remove_dot_segments(path32) {
|
|
142152
|
+
if (!path32)
|
|
142153
|
+
return path32;
|
|
142072
142154
|
var output = "";
|
|
142073
|
-
while (
|
|
142074
|
-
if (
|
|
142075
|
-
|
|
142155
|
+
while (path32.length > 0) {
|
|
142156
|
+
if (path32 === "." || path32 === "..") {
|
|
142157
|
+
path32 = "";
|
|
142076
142158
|
break;
|
|
142077
142159
|
}
|
|
142078
|
-
var twochars =
|
|
142079
|
-
var threechars =
|
|
142080
|
-
var fourchars =
|
|
142160
|
+
var twochars = path32.substring(0, 2);
|
|
142161
|
+
var threechars = path32.substring(0, 3);
|
|
142162
|
+
var fourchars = path32.substring(0, 4);
|
|
142081
142163
|
if (threechars === "../") {
|
|
142082
|
-
|
|
142164
|
+
path32 = path32.substring(3);
|
|
142083
142165
|
} else if (twochars === "./") {
|
|
142084
|
-
|
|
142166
|
+
path32 = path32.substring(2);
|
|
142085
142167
|
} else if (threechars === "/./") {
|
|
142086
|
-
|
|
142087
|
-
} else if (twochars === "/." &&
|
|
142088
|
-
|
|
142089
|
-
} else if (fourchars === "/../" || threechars === "/.." &&
|
|
142090
|
-
|
|
142168
|
+
path32 = "/" + path32.substring(3);
|
|
142169
|
+
} else if (twochars === "/." && path32.length === 2) {
|
|
142170
|
+
path32 = "/";
|
|
142171
|
+
} else if (fourchars === "/../" || threechars === "/.." && path32.length === 3) {
|
|
142172
|
+
path32 = "/" + path32.substring(4);
|
|
142091
142173
|
output = output.replace(/\/?[^\/]*$/, "");
|
|
142092
142174
|
} else {
|
|
142093
|
-
var segment =
|
|
142175
|
+
var segment = path32.match(/(\/?([^\/]*))/)[0];
|
|
142094
142176
|
output += segment;
|
|
142095
|
-
|
|
142177
|
+
path32 = path32.substring(segment.length);
|
|
142096
142178
|
}
|
|
142097
142179
|
}
|
|
142098
142180
|
return output;
|
|
@@ -154162,21 +154244,21 @@ function jsonToKeyPathChunks(value, label = "$") {
|
|
|
154162
154244
|
walk(value, label, out);
|
|
154163
154245
|
return out;
|
|
154164
154246
|
}
|
|
154165
|
-
function walk(val,
|
|
154247
|
+
function walk(val, path32, out) {
|
|
154166
154248
|
if (val === null || val === undefined)
|
|
154167
154249
|
return;
|
|
154168
154250
|
if (Array.isArray(val)) {
|
|
154169
154251
|
if (val.length === 0) {
|
|
154170
|
-
out.push({ path:
|
|
154252
|
+
out.push({ path: path32, content: `**${path32}** = _[]_` });
|
|
154171
154253
|
return;
|
|
154172
154254
|
}
|
|
154173
154255
|
if (val.every((v) => v !== null && typeof v === "object")) {
|
|
154174
|
-
val.forEach((v, i) => walk(v, `${
|
|
154256
|
+
val.forEach((v, i) => walk(v, `${path32}[${i}]`, out));
|
|
154175
154257
|
return;
|
|
154176
154258
|
}
|
|
154177
154259
|
const items = val.map((v) => `- \`${String(v)}\``).join(`
|
|
154178
154260
|
`);
|
|
154179
|
-
out.push({ path:
|
|
154261
|
+
out.push({ path: path32, content: `**${path32}**
|
|
154180
154262
|
|
|
154181
154263
|
${items}` });
|
|
154182
154264
|
return;
|
|
@@ -154184,16 +154266,16 @@ ${items}` });
|
|
|
154184
154266
|
if (typeof val === "object") {
|
|
154185
154267
|
const entries = Object.entries(val);
|
|
154186
154268
|
if (entries.length === 0) {
|
|
154187
|
-
out.push({ path:
|
|
154269
|
+
out.push({ path: path32, content: `**${path32}** = _{}_` });
|
|
154188
154270
|
return;
|
|
154189
154271
|
}
|
|
154190
154272
|
for (const [k, v] of entries) {
|
|
154191
154273
|
const safeKey = /^[A-Za-z_$][\w$]*$/.test(k) ? k : JSON.stringify(k);
|
|
154192
|
-
walk(v, `${
|
|
154274
|
+
walk(v, `${path32}.${safeKey}`, out);
|
|
154193
154275
|
}
|
|
154194
154276
|
return;
|
|
154195
154277
|
}
|
|
154196
|
-
out.push({ path:
|
|
154278
|
+
out.push({ path: path32, content: `**${path32}** = \`${String(val)}\`` });
|
|
154197
154279
|
}
|
|
154198
154280
|
var gfm, STRIP_SELECTORS, tdCache = null;
|
|
154199
154281
|
var init_html_to_md = __esm(() => {
|
|
@@ -154621,7 +154703,7 @@ init_config();
|
|
|
154621
154703
|
init_dist();
|
|
154622
154704
|
init_inference_providers();
|
|
154623
154705
|
import os9 from "os";
|
|
154624
|
-
import
|
|
154706
|
+
import path32 from "path";
|
|
154625
154707
|
var WRITABLE_PROVIDERS = ["ollama", "lmstudio", "mistral", "openai", "google", "cohere"];
|
|
154626
154708
|
var GENERATOR_MARKER = "scripts/generate-subagent-artifacts.ts";
|
|
154627
154709
|
var GENERATOR_MARKER_MAX_LEVELS = 6;
|
|
@@ -155050,7 +155132,7 @@ Using defaults:`);
|
|
|
155050
155132
|
return 1;
|
|
155051
155133
|
}
|
|
155052
155134
|
const targetOpt = typeof options.target === "string" ? options.target : undefined;
|
|
155053
|
-
const targetHome = targetOpt === undefined ? os9.homedir() :
|
|
155135
|
+
const targetHome = targetOpt === undefined ? os9.homedir() : path32.resolve(targetOpt);
|
|
155054
155136
|
if (targetHome !== os9.homedir() && options.yes !== true) {
|
|
155055
155137
|
console.error(`Error: --target ${targetHome} is not your home (${os9.homedir()}) \u2014 pass --yes to confirm writing there`);
|
|
155056
155138
|
return 1;
|
|
@@ -155070,7 +155152,7 @@ Using defaults:`);
|
|
|
155070
155152
|
const report = applyBootstrapState({
|
|
155071
155153
|
targetHome,
|
|
155072
155154
|
dryRun,
|
|
155073
|
-
sourcePath: repoRoot === null ? undefined :
|
|
155155
|
+
sourcePath: repoRoot === null ? undefined : path32.join(repoRoot, "skills", "AGENTS.md")
|
|
155074
155156
|
});
|
|
155075
155157
|
console.log(formatBootstrapReport(report));
|
|
155076
155158
|
return bootstrapReportSucceeded(report) ? 0 : 1;
|