@massa-ai/mcp-client 1.54.1 → 1.56.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 +1067 -318
- package/dist/index.js +1044 -367
- package/package.json +3 -3
package/dist/config-cli.js
CHANGED
|
@@ -601,15 +601,18 @@ var init_massa_ai_config = __esm(() => {
|
|
|
601
601
|
security: {
|
|
602
602
|
corsOrigins: []
|
|
603
603
|
},
|
|
604
|
-
scheduler: DEFAULT_SCHEDULER_CONFIG
|
|
604
|
+
scheduler: DEFAULT_SCHEDULER_CONFIG,
|
|
605
|
+
bootstrap: { rules: {} }
|
|
605
606
|
};
|
|
606
607
|
});
|
|
607
608
|
|
|
608
609
|
// ../../packages/shared/dist/config/config-loader.js
|
|
609
610
|
var exports_config_loader = {};
|
|
610
611
|
__export(exports_config_loader, {
|
|
612
|
+
writeRawConfig: () => writeRawConfig,
|
|
611
613
|
writeFileAtomically: () => writeFileAtomically,
|
|
612
614
|
saveConfig: () => saveConfig,
|
|
615
|
+
readRawConfigStrict: () => readRawConfigStrict,
|
|
613
616
|
migrateDataDirOnce: () => migrateDataDirOnce,
|
|
614
617
|
mergeSchedulerSection: () => mergeSchedulerSection,
|
|
615
618
|
loadRawUserConfig: () => loadRawUserConfig,
|
|
@@ -620,12 +623,23 @@ __export(exports_config_loader, {
|
|
|
620
623
|
getConfigForEnv: () => getConfigForEnv,
|
|
621
624
|
getConfigDir: () => getConfigDir,
|
|
622
625
|
configExists: () => configExists,
|
|
623
|
-
__resetMigrationForTests: () => __resetMigrationForTests
|
|
626
|
+
__resetMigrationForTests: () => __resetMigrationForTests,
|
|
627
|
+
ConfigWriteConflictError: () => ConfigWriteConflictError,
|
|
628
|
+
ConfigParseError: () => ConfigParseError
|
|
624
629
|
});
|
|
625
630
|
import fs from "fs";
|
|
626
631
|
import path3 from "path";
|
|
627
632
|
import os2 from "os";
|
|
628
633
|
import crypto2 from "crypto";
|
|
634
|
+
function readConfigFileOrEmpty() {
|
|
635
|
+
try {
|
|
636
|
+
return fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
637
|
+
} catch (error) {
|
|
638
|
+
if (error?.code === "ENOENT")
|
|
639
|
+
return "";
|
|
640
|
+
throw error;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
629
643
|
function getConfigDir() {
|
|
630
644
|
return CONFIG_DIR;
|
|
631
645
|
}
|
|
@@ -692,6 +706,21 @@ function loadRawUserConfig() {
|
|
|
692
706
|
return {};
|
|
693
707
|
}
|
|
694
708
|
}
|
|
709
|
+
function readRawConfigStrict() {
|
|
710
|
+
const raw2 = readConfigFileOrEmpty();
|
|
711
|
+
if (raw2 === "")
|
|
712
|
+
return {};
|
|
713
|
+
let parsed;
|
|
714
|
+
try {
|
|
715
|
+
parsed = JSON.parse(raw2);
|
|
716
|
+
} catch (error) {
|
|
717
|
+
throw new ConfigParseError(CONFIG_FILE, error);
|
|
718
|
+
}
|
|
719
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
720
|
+
throw new ConfigParseError(CONFIG_FILE, new Error("parsed value is not a JSON object"));
|
|
721
|
+
}
|
|
722
|
+
return parsed;
|
|
723
|
+
}
|
|
695
724
|
function loadConfigSafe() {
|
|
696
725
|
try {
|
|
697
726
|
return loadConfig();
|
|
@@ -746,6 +775,43 @@ function writeFileAtomically(targetPath, content) {
|
|
|
746
775
|
function saveConfig(config) {
|
|
747
776
|
writeFileAtomically(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
748
777
|
}
|
|
778
|
+
function writeRawConfig(doc, opts) {
|
|
779
|
+
const onDiskAtStart = readConfigFileOrEmpty();
|
|
780
|
+
if (onDiskAtStart === opts.expectedBytes) {
|
|
781
|
+
writeFileAtomically(CONFIG_FILE, JSON.stringify(doc, null, 2));
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
let original;
|
|
785
|
+
let current;
|
|
786
|
+
try {
|
|
787
|
+
original = opts.expectedBytes === "" ? {} : JSON.parse(opts.expectedBytes);
|
|
788
|
+
} catch (error) {
|
|
789
|
+
throw new ConfigParseError(`${CONFIG_FILE} (caller-supplied expectedBytes)`, error);
|
|
790
|
+
}
|
|
791
|
+
try {
|
|
792
|
+
current = onDiskAtStart === "" ? {} : JSON.parse(onDiskAtStart);
|
|
793
|
+
} catch (error) {
|
|
794
|
+
throw new ConfigParseError(CONFIG_FILE, error);
|
|
795
|
+
}
|
|
796
|
+
const reapplied = { ...current };
|
|
797
|
+
const touchedKeys = new Set([...Object.keys(original), ...Object.keys(doc)]);
|
|
798
|
+
for (const key of touchedKeys) {
|
|
799
|
+
const before = JSON.stringify(original[key]);
|
|
800
|
+
const after = JSON.stringify(doc[key]);
|
|
801
|
+
if (before === after)
|
|
802
|
+
continue;
|
|
803
|
+
if (Object.prototype.hasOwnProperty.call(doc, key)) {
|
|
804
|
+
reapplied[key] = doc[key];
|
|
805
|
+
} else {
|
|
806
|
+
delete reapplied[key];
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
const onDiskImmediatelyBeforeWrite = readConfigFileOrEmpty();
|
|
810
|
+
if (onDiskImmediatelyBeforeWrite !== onDiskAtStart) {
|
|
811
|
+
throw new ConfigWriteConflictError(CONFIG_FILE);
|
|
812
|
+
}
|
|
813
|
+
writeFileAtomically(CONFIG_FILE, JSON.stringify(reapplied, null, 2));
|
|
814
|
+
}
|
|
749
815
|
function initConfig() {
|
|
750
816
|
if (!fs.existsSync(CONFIG_FILE)) {
|
|
751
817
|
saveConfig(defaultMassaAiConfig);
|
|
@@ -772,12 +838,25 @@ function getConfigForEnv() {
|
|
|
772
838
|
env.ENABLE_METRICS = String(config.logging.enableMetrics);
|
|
773
839
|
return env;
|
|
774
840
|
}
|
|
775
|
-
var CONFIG_DIR, CONFIG_FILE, migrationAttempted = false, tempFileCounter = 0;
|
|
841
|
+
var CONFIG_DIR, CONFIG_FILE, ConfigParseError, ConfigWriteConflictError, migrationAttempted = false, tempFileCounter = 0;
|
|
776
842
|
var init_config_loader = __esm(() => {
|
|
777
843
|
init_massa_ai_config();
|
|
778
844
|
init_xdg();
|
|
779
845
|
CONFIG_DIR = configDir("massa-ai");
|
|
780
846
|
CONFIG_FILE = path3.join(CONFIG_DIR, "config.json");
|
|
847
|
+
ConfigParseError = class ConfigParseError extends Error {
|
|
848
|
+
constructor(filePath, cause) {
|
|
849
|
+
const reason = cause instanceof Error ? cause.message : String(cause);
|
|
850
|
+
super(`Failed to parse ${filePath}: ${reason}`);
|
|
851
|
+
this.name = "ConfigParseError";
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
ConfigWriteConflictError = class ConfigWriteConflictError extends Error {
|
|
855
|
+
constructor(filePath) {
|
|
856
|
+
super(`${filePath} changed on disk twice while writing \u2014 refusing to overwrite a ` + `concurrent update. Re-read the file and retry.`);
|
|
857
|
+
this.name = "ConfigWriteConflictError";
|
|
858
|
+
}
|
|
859
|
+
};
|
|
781
860
|
});
|
|
782
861
|
|
|
783
862
|
// ../../packages/shared/dist/env.js
|
|
@@ -2910,6 +2989,608 @@ function findRepoRootWithMarker(startDir, marker, maxLevels) {
|
|
|
2910
2989
|
}
|
|
2911
2990
|
var init_repo_root = () => {};
|
|
2912
2991
|
|
|
2992
|
+
// ../../packages/shared/dist/bootstrap/rules.js
|
|
2993
|
+
function isBootstrapRuleId(value) {
|
|
2994
|
+
return typeof value === "string" && BOOTSTRAP_RULE_IDS.includes(value);
|
|
2995
|
+
}
|
|
2996
|
+
function bootstrapRuleDefaults() {
|
|
2997
|
+
const defaults = {};
|
|
2998
|
+
for (const rule of BOOTSTRAP_RULES)
|
|
2999
|
+
defaults[rule.id] = rule.defaultEnabled;
|
|
3000
|
+
return defaults;
|
|
3001
|
+
}
|
|
3002
|
+
function namedError4(name, message) {
|
|
3003
|
+
const err = new BootstrapRuleError(message);
|
|
3004
|
+
err.name = name;
|
|
3005
|
+
return err;
|
|
3006
|
+
}
|
|
3007
|
+
function assertKnownRuleId(id) {
|
|
3008
|
+
if (!isBootstrapRuleId(id))
|
|
3009
|
+
throw UnknownRuleError(id, BOOTSTRAP_RULE_IDS);
|
|
3010
|
+
}
|
|
3011
|
+
var BOOTSTRAP_RULE_IDS, BOOTSTRAP_RULES, RULES_BY_ID, BootstrapRuleError, UnknownRuleError = (id, known = BOOTSTRAP_RULE_IDS) => namedError4("UnknownRuleError", `unknown bootstrap rule "${id}" \u2014 valid ids: ${known.join(", ")}`);
|
|
3012
|
+
var init_rules = __esm(() => {
|
|
3013
|
+
BOOTSTRAP_RULE_IDS = [
|
|
3014
|
+
"caveman",
|
|
3015
|
+
"massa-ai-router",
|
|
3016
|
+
"persona-router",
|
|
3017
|
+
"dedupe-guardrails",
|
|
3018
|
+
"plan-challenge",
|
|
3019
|
+
"conversation-feedback",
|
|
3020
|
+
"indexing-hygiene",
|
|
3021
|
+
"english-code",
|
|
3022
|
+
"code-comments"
|
|
3023
|
+
];
|
|
3024
|
+
BOOTSTRAP_RULES = [
|
|
3025
|
+
{
|
|
3026
|
+
id: "caveman",
|
|
3027
|
+
defaultEnabled: true,
|
|
3028
|
+
description: "Keep communication compressed while preserving technical accuracy."
|
|
3029
|
+
},
|
|
3030
|
+
{
|
|
3031
|
+
id: "massa-ai-router",
|
|
3032
|
+
defaultEnabled: true,
|
|
3033
|
+
description: "Load the massa-ai skill as the workflow router before substantive work."
|
|
3034
|
+
},
|
|
3035
|
+
{
|
|
3036
|
+
id: "persona-router",
|
|
3037
|
+
defaultEnabled: true,
|
|
3038
|
+
description: "Select one cataloged specialist persona after massa-ai context is available."
|
|
3039
|
+
},
|
|
3040
|
+
{
|
|
3041
|
+
id: "dedupe-guardrails",
|
|
3042
|
+
defaultEnabled: true,
|
|
3043
|
+
description: "Reuse already-loaded massa-ai context instead of bulk-loading workflows or references."
|
|
3044
|
+
},
|
|
3045
|
+
{
|
|
3046
|
+
id: "plan-challenge",
|
|
3047
|
+
defaultEnabled: true,
|
|
3048
|
+
description: "Run The Fool as a post-plan challenge gate per the configured policy."
|
|
3049
|
+
},
|
|
3050
|
+
{
|
|
3051
|
+
id: "conversation-feedback",
|
|
3052
|
+
defaultEnabled: true,
|
|
3053
|
+
description: "Emit chat-visible status updates for massa-ai workflow progress."
|
|
3054
|
+
},
|
|
3055
|
+
{
|
|
3056
|
+
id: "indexing-hygiene",
|
|
3057
|
+
defaultEnabled: true,
|
|
3058
|
+
description: "Ignore build output, dependency, and secret paths during indexing and context loading."
|
|
3059
|
+
},
|
|
3060
|
+
{
|
|
3061
|
+
id: "english-code",
|
|
3062
|
+
defaultEnabled: true,
|
|
3063
|
+
description: "Write generated code, identifiers, comments, and commit-facing artifacts in English regardless of conversational language."
|
|
3064
|
+
},
|
|
3065
|
+
{
|
|
3066
|
+
id: "code-comments",
|
|
3067
|
+
defaultEnabled: false,
|
|
3068
|
+
description: "Require API doc blocks and rationale comments on generated code, per code-annotation.md \xA71/\xA72."
|
|
3069
|
+
}
|
|
3070
|
+
];
|
|
3071
|
+
RULES_BY_ID = new Map(BOOTSTRAP_RULES.map((rule) => [rule.id, rule]));
|
|
3072
|
+
BootstrapRuleError = class BootstrapRuleError extends Error {
|
|
3073
|
+
constructor(message) {
|
|
3074
|
+
super(message);
|
|
3075
|
+
this.name = "BootstrapRuleError";
|
|
3076
|
+
}
|
|
3077
|
+
};
|
|
3078
|
+
});
|
|
3079
|
+
|
|
3080
|
+
// ../../packages/shared/dist/bootstrap/state.js
|
|
3081
|
+
import fs9 from "fs";
|
|
3082
|
+
function isPlainObject2(value) {
|
|
3083
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3084
|
+
}
|
|
3085
|
+
function resolveBootstrapState(doc) {
|
|
3086
|
+
const document2 = doc ?? readRawConfigStrict();
|
|
3087
|
+
const state = bootstrapRuleDefaults();
|
|
3088
|
+
const ignored = [];
|
|
3089
|
+
const bootstrap = document2[BOOTSTRAP_STATE_KEY];
|
|
3090
|
+
if (bootstrap === undefined)
|
|
3091
|
+
return { state, ignoredStateKeys: [] };
|
|
3092
|
+
if (!isPlainObject2(bootstrap)) {
|
|
3093
|
+
return { state, ignoredStateKeys: [BOOTSTRAP_STATE_KEY] };
|
|
3094
|
+
}
|
|
3095
|
+
const rules = bootstrap[BOOTSTRAP_RULES_KEY];
|
|
3096
|
+
if (rules === undefined)
|
|
3097
|
+
return { state, ignoredStateKeys: [] };
|
|
3098
|
+
if (!isPlainObject2(rules)) {
|
|
3099
|
+
return { state, ignoredStateKeys: [BOOTSTRAP_STATE_PATH] };
|
|
3100
|
+
}
|
|
3101
|
+
for (const [key, value] of Object.entries(rules)) {
|
|
3102
|
+
if (!isBootstrapRuleId(key) || typeof value !== "boolean") {
|
|
3103
|
+
ignored.push(key);
|
|
3104
|
+
continue;
|
|
3105
|
+
}
|
|
3106
|
+
state[key] = value;
|
|
3107
|
+
}
|
|
3108
|
+
return { state, ignoredStateKeys: ignored.sort() };
|
|
3109
|
+
}
|
|
3110
|
+
function readConfigBytes() {
|
|
3111
|
+
try {
|
|
3112
|
+
return fs9.readFileSync(getConfigPath(), "utf-8");
|
|
3113
|
+
} catch (error) {
|
|
3114
|
+
if (error?.code === "ENOENT")
|
|
3115
|
+
return "";
|
|
3116
|
+
throw error;
|
|
3117
|
+
}
|
|
3118
|
+
}
|
|
3119
|
+
function setBootstrapRuleEnabled(id, enabled) {
|
|
3120
|
+
assertKnownRuleId(id);
|
|
3121
|
+
const expectedBytes = readConfigBytes();
|
|
3122
|
+
let document2;
|
|
3123
|
+
if (expectedBytes === "") {
|
|
3124
|
+
document2 = {};
|
|
3125
|
+
} else {
|
|
3126
|
+
let parsed;
|
|
3127
|
+
try {
|
|
3128
|
+
parsed = JSON.parse(expectedBytes);
|
|
3129
|
+
} catch (error) {
|
|
3130
|
+
throw new ConfigParseError(getConfigPath(), error);
|
|
3131
|
+
}
|
|
3132
|
+
if (!isPlainObject2(parsed)) {
|
|
3133
|
+
throw new ConfigParseError(getConfigPath(), new Error("parsed value is not a JSON object"));
|
|
3134
|
+
}
|
|
3135
|
+
document2 = parsed;
|
|
3136
|
+
}
|
|
3137
|
+
const before = resolveBootstrapState(document2);
|
|
3138
|
+
const bootstrap = document2[BOOTSTRAP_STATE_KEY];
|
|
3139
|
+
const bootstrapSubtree = isPlainObject2(bootstrap) ? bootstrap : {};
|
|
3140
|
+
const rules = bootstrapSubtree[BOOTSTRAP_RULES_KEY];
|
|
3141
|
+
const rulesSubtree = isPlainObject2(rules) ? rules : {};
|
|
3142
|
+
const next = {
|
|
3143
|
+
...document2,
|
|
3144
|
+
[BOOTSTRAP_STATE_KEY]: {
|
|
3145
|
+
...bootstrapSubtree,
|
|
3146
|
+
[BOOTSTRAP_RULES_KEY]: { ...rulesSubtree, [id]: enabled }
|
|
3147
|
+
}
|
|
3148
|
+
};
|
|
3149
|
+
writeRawConfig(next, { expectedBytes });
|
|
3150
|
+
const after = resolveBootstrapState(next);
|
|
3151
|
+
return {
|
|
3152
|
+
id,
|
|
3153
|
+
enabled,
|
|
3154
|
+
changed: before.state[id] !== enabled,
|
|
3155
|
+
state: after.state,
|
|
3156
|
+
ignoredStateKeys: after.ignoredStateKeys
|
|
3157
|
+
};
|
|
3158
|
+
}
|
|
3159
|
+
var BOOTSTRAP_STATE_KEY = "bootstrap", BOOTSTRAP_RULES_KEY = "rules", BOOTSTRAP_STATE_PATH;
|
|
3160
|
+
var init_state2 = __esm(() => {
|
|
3161
|
+
init_config_loader();
|
|
3162
|
+
init_rules();
|
|
3163
|
+
BOOTSTRAP_STATE_PATH = `${BOOTSTRAP_STATE_KEY}.${BOOTSTRAP_RULES_KEY}`;
|
|
3164
|
+
});
|
|
3165
|
+
|
|
3166
|
+
// ../../packages/shared/dist/bootstrap/render.js
|
|
3167
|
+
import path13 from "path";
|
|
3168
|
+
function wrapBootstrapBlock(body) {
|
|
3169
|
+
return `${BOOTSTRAP_BLOCK_START}
|
|
3170
|
+
${body.replace(/\n+$/, "")}
|
|
3171
|
+
${BOOTSTRAP_BLOCK_END}
|
|
3172
|
+
`;
|
|
3173
|
+
}
|
|
3174
|
+
function ruleMarker(id, suffix) {
|
|
3175
|
+
return `<!-- massa-ai:rule:${id}:${suffix} -->`;
|
|
3176
|
+
}
|
|
3177
|
+
function resolveHostRoot(host, targetHome, hostRoot) {
|
|
3178
|
+
requireAbsoluteTargetHome(targetHome);
|
|
3179
|
+
if (hostRoot === undefined)
|
|
3180
|
+
return path13.join(targetHome, ...HOST_CONFIG_DIR[host]);
|
|
3181
|
+
const relative = path13.relative(targetHome, hostRoot);
|
|
3182
|
+
if (!path13.isAbsolute(hostRoot) || relative === "" || relative.startsWith("..") || path13.isAbsolute(relative)) {
|
|
3183
|
+
throw new BootstrapRenderError("HostRootOutsideTargetHomeError", `hostRoot must be an absolute directory inside targetHome, got "${hostRoot}" for targetHome "${targetHome}"`, [hostRoot, targetHome]);
|
|
3184
|
+
}
|
|
3185
|
+
return hostRoot;
|
|
3186
|
+
}
|
|
3187
|
+
function bootstrapContractPath(host, targetHome, hostRoot) {
|
|
3188
|
+
return path13.join(resolveHostRoot(host, targetHome, hostRoot), CONTRACT_FILENAME);
|
|
3189
|
+
}
|
|
3190
|
+
function bootstrapStateFilePath(targetHome) {
|
|
3191
|
+
requireAbsoluteTargetHome(targetHome);
|
|
3192
|
+
return path13.join(targetHome, ".config", "massa-ai", "config.json");
|
|
3193
|
+
}
|
|
3194
|
+
function renderBootstrap(options) {
|
|
3195
|
+
const { source, state, host, targetHome, hostRoot } = options;
|
|
3196
|
+
requireAbsoluteTargetHome(targetHome);
|
|
3197
|
+
requireTotalState(state);
|
|
3198
|
+
const body = applyRuleState(extractBootstrapBlock(source), state);
|
|
3199
|
+
const contract = `${renderHeader(state, targetHome)}
|
|
3200
|
+
|
|
3201
|
+
${body}`;
|
|
3202
|
+
const pointer = renderPointer(host, targetHome, hostRoot);
|
|
3203
|
+
const emitted = [
|
|
3204
|
+
...contract.split(`
|
|
3205
|
+
`).filter((line) => ANY_MASSA_AI_MARKER.test(line)),
|
|
3206
|
+
...pointer.split(`
|
|
3207
|
+
`).filter((line) => ANY_MASSA_AI_MARKER.test(line))
|
|
3208
|
+
].map((line) => line.trim());
|
|
3209
|
+
if (emitted.length > 0) {
|
|
3210
|
+
throw new BootstrapRenderError("MarkerInInterpolatedPathError", `rendered output carries a massa-ai marker, which can only have come from an interpolated path: ${emitted.join(", ")}`, emitted);
|
|
3211
|
+
}
|
|
3212
|
+
return { contract, pointer };
|
|
3213
|
+
}
|
|
3214
|
+
function requireAbsoluteTargetHome(targetHome) {
|
|
3215
|
+
if (!path13.isAbsolute(targetHome)) {
|
|
3216
|
+
throw new BootstrapRenderError("TargetHomeNotAbsoluteError", `targetHome must be an absolute path, got "${targetHome}"`, [targetHome]);
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
function requireTotalState(state) {
|
|
3220
|
+
const missing = BOOTSTRAP_RULES.filter((rule) => typeof state[rule.id] !== "boolean").map((rule) => rule.id);
|
|
3221
|
+
if (missing.length > 0) {
|
|
3222
|
+
throw new BootstrapRenderError("IncompleteBootstrapStateError", `bootstrap state is missing a boolean for: ${missing.join(", ")} \u2014 pass a state resolved by resolveBootstrapState`, missing);
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
function extractBootstrapBlock(source) {
|
|
3226
|
+
const startCount = countOccurrences(source, BOOTSTRAP_BLOCK_START);
|
|
3227
|
+
const endCount = countOccurrences(source, BOOTSTRAP_BLOCK_END);
|
|
3228
|
+
const startIndex = source.indexOf(BOOTSTRAP_BLOCK_START);
|
|
3229
|
+
const endIndex = source.indexOf(BOOTSTRAP_BLOCK_END);
|
|
3230
|
+
if (startCount !== 1 || endCount !== 1 || startIndex > endIndex) {
|
|
3231
|
+
throw new BootstrapRenderError("BootstrapSourceError", `source must contain exactly one well-formed bootstrap block \u2014 found ${startCount} start and ${endCount} end marker(s)`, [`start=${startCount}`, `end=${endCount}`]);
|
|
3232
|
+
}
|
|
3233
|
+
return source.slice(startIndex + BOOTSTRAP_BLOCK_START.length, endIndex);
|
|
3234
|
+
}
|
|
3235
|
+
function findMarker(lines, marker) {
|
|
3236
|
+
let index = -1;
|
|
3237
|
+
let count = 0;
|
|
3238
|
+
for (let i = 0;i < lines.length; i++) {
|
|
3239
|
+
if (lines[i]?.trim() === marker) {
|
|
3240
|
+
if (count === 0)
|
|
3241
|
+
index = i;
|
|
3242
|
+
count++;
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
return { index, count };
|
|
3246
|
+
}
|
|
3247
|
+
function countOccurrences(haystack, needle) {
|
|
3248
|
+
let count = 0;
|
|
3249
|
+
let from = 0;
|
|
3250
|
+
for (;; ) {
|
|
3251
|
+
const at = haystack.indexOf(needle, from);
|
|
3252
|
+
if (at === -1)
|
|
3253
|
+
return count;
|
|
3254
|
+
count++;
|
|
3255
|
+
from = at + needle.length;
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
function splitOffSpan(inner, id) {
|
|
3259
|
+
const offStart = findMarker(inner, ruleMarker(id, "off"));
|
|
3260
|
+
const offEnd = findMarker(inner, ruleMarker(id, "off-end"));
|
|
3261
|
+
if (offStart.count === 0 && offEnd.count === 0)
|
|
3262
|
+
return { on: inner, off: [] };
|
|
3263
|
+
if (offStart.count !== 1 || offEnd.count !== 1 || offStart.index > offEnd.index) {
|
|
3264
|
+
throw new BootstrapRenderError("MalformedOffSpanError", `rule "${id}" has a malformed off-text span \u2014 found ${offStart.count} ":off" and ${offEnd.count} ":off-end" marker(s)`, [id]);
|
|
3265
|
+
}
|
|
3266
|
+
return {
|
|
3267
|
+
on: [...inner.slice(0, offStart.index), ...inner.slice(offEnd.index + 1)],
|
|
3268
|
+
off: inner.slice(offStart.index + 1, offEnd.index)
|
|
3269
|
+
};
|
|
3270
|
+
}
|
|
3271
|
+
function applyRuleState(block, state) {
|
|
3272
|
+
const lines = block.split(`
|
|
3273
|
+
`);
|
|
3274
|
+
const missingSpans = [];
|
|
3275
|
+
for (const rule of BOOTSTRAP_RULES) {
|
|
3276
|
+
const start = findMarker(lines, ruleMarker(rule.id, "start"));
|
|
3277
|
+
const end = findMarker(lines, ruleMarker(rule.id, "end"));
|
|
3278
|
+
if (start.count !== 1 || end.count !== 1 || start.index > end.index) {
|
|
3279
|
+
missingSpans.push(rule.id);
|
|
3280
|
+
continue;
|
|
3281
|
+
}
|
|
3282
|
+
const span = splitOffSpan(lines.slice(start.index + 1, end.index), rule.id);
|
|
3283
|
+
const replacement = state[rule.id] ? span.on : span.off;
|
|
3284
|
+
lines.splice(start.index, end.index - start.index + 1, ...replacement);
|
|
3285
|
+
}
|
|
3286
|
+
if (missingSpans.length > 0) {
|
|
3287
|
+
throw new BootstrapRenderError("MissingRuleSpanError", `source has no well-formed span for rule(s): ${missingSpans.join(", ")}`, missingSpans);
|
|
3288
|
+
}
|
|
3289
|
+
const leftovers = lines.filter((line) => ANY_MASSA_AI_MARKER.test(line)).map((line) => line.trim());
|
|
3290
|
+
if (leftovers.length > 0) {
|
|
3291
|
+
throw new BootstrapRenderError("UnknownRuleMarkerError", `source carries marker(s) no registry rule consumed: ${leftovers.join(", ")}`, leftovers);
|
|
3292
|
+
}
|
|
3293
|
+
return normalizeBlankLines(lines);
|
|
3294
|
+
}
|
|
3295
|
+
function normalizeBlankLines(lines) {
|
|
3296
|
+
const out = [];
|
|
3297
|
+
let inFence = false;
|
|
3298
|
+
for (const line of lines) {
|
|
3299
|
+
if (line.trimStart().startsWith("```")) {
|
|
3300
|
+
inFence = !inFence;
|
|
3301
|
+
out.push(line);
|
|
3302
|
+
continue;
|
|
3303
|
+
}
|
|
3304
|
+
if (inFence) {
|
|
3305
|
+
out.push(line);
|
|
3306
|
+
continue;
|
|
3307
|
+
}
|
|
3308
|
+
const previous = out[out.length - 1];
|
|
3309
|
+
const isBlank = line.trim() === "";
|
|
3310
|
+
if (isBlank && (previous === undefined || previous.trim() === ""))
|
|
3311
|
+
continue;
|
|
3312
|
+
if (/^#{1,6} /.test(line) && previous !== undefined && previous.trim() !== "")
|
|
3313
|
+
out.push("");
|
|
3314
|
+
out.push(line);
|
|
3315
|
+
}
|
|
3316
|
+
return `${out.join(`
|
|
3317
|
+
`).trimEnd()}
|
|
3318
|
+
`;
|
|
3319
|
+
}
|
|
3320
|
+
function renderHeader(state, targetHome) {
|
|
3321
|
+
const lines = [
|
|
3322
|
+
"> Generated by massa-ai from `skills/AGENTS.md`. Edits made here are lost on",
|
|
3323
|
+
"> the next `scripts/install-skills.sh --apply` or",
|
|
3324
|
+
"> `massa-ai-config bootstrap enable|disable <rule-id>` run.",
|
|
3325
|
+
">",
|
|
3326
|
+
`> Rule state lives in \`${bootstrapStateFilePath(targetHome)}\` under the`,
|
|
3327
|
+
`> \`${BOOTSTRAP_STATE_PATH}\` key. List every rule and its state with`,
|
|
3328
|
+
"> `massa-ai-config bootstrap list`; switch one back on with",
|
|
3329
|
+
"> `massa-ai-config bootstrap enable <rule-id>`. That command is a binary and",
|
|
3330
|
+
"> not a rule, so it keeps working with every rule below disabled \u2014",
|
|
3331
|
+
"> `massa-ai-config bootstrap enable massa-ai-router` is the way back when the",
|
|
3332
|
+
"> router rule itself is off."
|
|
3333
|
+
];
|
|
3334
|
+
if (BOOTSTRAP_RULES.every((rule) => !state[rule.id])) {
|
|
3335
|
+
lines.push("", "**Every massa-ai bootstrap rule is disabled.** The contract below carries no", "rule to activate, and nothing in this file changes agent behavior until at", "least one rule is enabled again.");
|
|
3336
|
+
}
|
|
3337
|
+
return lines.join(`
|
|
3338
|
+
`);
|
|
3339
|
+
}
|
|
3340
|
+
function renderPointer(host, targetHome, hostRoot) {
|
|
3341
|
+
return [
|
|
3342
|
+
"## massa-ai Startup Contract",
|
|
3343
|
+
"",
|
|
3344
|
+
"Before substantive work in this session, read",
|
|
3345
|
+
`\`${bootstrapContractPath(host, targetHome, hostRoot)}\``,
|
|
3346
|
+
"with your Read tool and follow it. This block is a pointer only: it states no",
|
|
3347
|
+
"rule of its own, and massa-ai overwrites it on the next install.",
|
|
3348
|
+
""
|
|
3349
|
+
].join(`
|
|
3350
|
+
`);
|
|
3351
|
+
}
|
|
3352
|
+
var BOOTSTRAP_BLOCK_START = "<!-- massa-ai:bootstrap:start -->", BOOTSTRAP_BLOCK_END = "<!-- massa-ai:bootstrap:end -->", CONTRACT_FILENAME = "MASSA-AI.md", ANY_MASSA_AI_MARKER, BootstrapRenderError, HOST_CONFIG_DIR;
|
|
3353
|
+
var init_render = __esm(() => {
|
|
3354
|
+
init_rules();
|
|
3355
|
+
init_state2();
|
|
3356
|
+
ANY_MASSA_AI_MARKER = /<!--\s*massa-ai:(?:rule|bootstrap):[^>]*-->/;
|
|
3357
|
+
BootstrapRenderError = class BootstrapRenderError extends Error {
|
|
3358
|
+
details;
|
|
3359
|
+
constructor(name, message, details = []) {
|
|
3360
|
+
super(message);
|
|
3361
|
+
this.name = name;
|
|
3362
|
+
this.details = details;
|
|
3363
|
+
}
|
|
3364
|
+
};
|
|
3365
|
+
HOST_CONFIG_DIR = {
|
|
3366
|
+
claude: [".claude"],
|
|
3367
|
+
codex: [".codex"],
|
|
3368
|
+
cursor: [".cursor"],
|
|
3369
|
+
opencode: [".config", "opencode"]
|
|
3370
|
+
};
|
|
3371
|
+
});
|
|
3372
|
+
|
|
3373
|
+
// ../../packages/shared/dist/bootstrap/report.js
|
|
3374
|
+
function bootstrapReportSucceeded(report) {
|
|
3375
|
+
return report.rows.every((row) => CLEAN_STATUSES.has(row.status));
|
|
3376
|
+
}
|
|
3377
|
+
function buildBootstrapReport(input) {
|
|
3378
|
+
const restartRequired = !input.dryRun && input.rows.some((row) => row.status === "written");
|
|
3379
|
+
return {
|
|
3380
|
+
rows: input.rows,
|
|
3381
|
+
restartRequired,
|
|
3382
|
+
dryRun: input.dryRun,
|
|
3383
|
+
ignoredStateKeys: input.ignoredStateKeys
|
|
3384
|
+
};
|
|
3385
|
+
}
|
|
3386
|
+
var CLEAN_STATUSES;
|
|
3387
|
+
var init_report = __esm(() => {
|
|
3388
|
+
CLEAN_STATUSES = new Set(["written", "skipped"]);
|
|
3389
|
+
});
|
|
3390
|
+
|
|
3391
|
+
// ../../packages/shared/dist/bootstrap/engine.js
|
|
3392
|
+
import fs10 from "fs";
|
|
3393
|
+
import path14 from "path";
|
|
3394
|
+
function applyBootstrapState(options) {
|
|
3395
|
+
const { targetHome } = options;
|
|
3396
|
+
const dryRun = options.dryRun ?? false;
|
|
3397
|
+
const warn = options.onWarning ?? ((message) => console.warn(message));
|
|
3398
|
+
const configPath = bootstrapStateFilePath(targetHome);
|
|
3399
|
+
const installStatePath = path14.join(path14.dirname(configPath), INSTALL_STATE_FILENAME);
|
|
3400
|
+
const { platforms } = readInstallState(installStatePath);
|
|
3401
|
+
const installed = HOSTS.filter((host) => platforms[host] !== undefined);
|
|
3402
|
+
if (installed.length === 0) {
|
|
3403
|
+
return buildBootstrapReport({ rows: [], dryRun, ignoredStateKeys: [] });
|
|
3404
|
+
}
|
|
3405
|
+
const resolved = resolveRuleState(configPath, warn);
|
|
3406
|
+
const source = readSource(options);
|
|
3407
|
+
const rows = installed.map((host) => applyHost({
|
|
3408
|
+
host,
|
|
3409
|
+
source,
|
|
3410
|
+
state: resolved.state,
|
|
3411
|
+
targetHome,
|
|
3412
|
+
hostRoot: recordedHostRoot(platforms[host]),
|
|
3413
|
+
dryRun
|
|
3414
|
+
}));
|
|
3415
|
+
return buildBootstrapReport({
|
|
3416
|
+
rows,
|
|
3417
|
+
dryRun,
|
|
3418
|
+
ignoredStateKeys: resolved.ignoredStateKeys
|
|
3419
|
+
});
|
|
3420
|
+
}
|
|
3421
|
+
function recordedHostRoot(record) {
|
|
3422
|
+
const root = record?.root;
|
|
3423
|
+
return typeof root === "string" && root.length > 0 ? root : undefined;
|
|
3424
|
+
}
|
|
3425
|
+
function resolveRuleState(configPath, warn) {
|
|
3426
|
+
const raw2 = readFileOrNull(configPath);
|
|
3427
|
+
if (raw2 === null)
|
|
3428
|
+
return resolveBootstrapState({});
|
|
3429
|
+
let parsed;
|
|
3430
|
+
try {
|
|
3431
|
+
parsed = JSON.parse(raw2);
|
|
3432
|
+
} catch (error) {
|
|
3433
|
+
warn(degradeWarning(configPath, error));
|
|
3434
|
+
return resolveBootstrapState({});
|
|
3435
|
+
}
|
|
3436
|
+
if (!isPlainObject3(parsed)) {
|
|
3437
|
+
warn(degradeWarning(configPath, new Error("parsed value is not a JSON object")));
|
|
3438
|
+
return resolveBootstrapState({});
|
|
3439
|
+
}
|
|
3440
|
+
return resolveBootstrapState(parsed);
|
|
3441
|
+
}
|
|
3442
|
+
function degradeWarning(configPath, cause) {
|
|
3443
|
+
const error = new ConfigParseError(configPath, cause);
|
|
3444
|
+
return `${error.name}: ${error.message} \u2014 rendering the registry bootstrap defaults; ${configPath} was not written`;
|
|
3445
|
+
}
|
|
3446
|
+
function readSource(options) {
|
|
3447
|
+
if (options.source !== undefined)
|
|
3448
|
+
return options.source;
|
|
3449
|
+
if (options.sourcePath !== undefined) {
|
|
3450
|
+
const text = readFileOrNull(options.sourcePath);
|
|
3451
|
+
if (text === null) {
|
|
3452
|
+
throw new BootstrapEngineError("BootstrapSourceUnreadableError", `could not read the bootstrap source at ${options.sourcePath}`, [options.sourcePath]);
|
|
3453
|
+
}
|
|
3454
|
+
return text;
|
|
3455
|
+
}
|
|
3456
|
+
throw new BootstrapEngineError("BootstrapSourceUnavailableError", "no bootstrap source given \u2014 pass `source` (the skills/AGENTS.md text) or `sourcePath`", ["source", "sourcePath"]);
|
|
3457
|
+
}
|
|
3458
|
+
function applyHost(input) {
|
|
3459
|
+
const { host, source, state, targetHome, hostRoot, dryRun } = input;
|
|
3460
|
+
let contractPath;
|
|
3461
|
+
let document2;
|
|
3462
|
+
try {
|
|
3463
|
+
contractPath = bootstrapContractPath(host, targetHome, hostRoot);
|
|
3464
|
+
document2 = wrapBootstrapBlock(renderBootstrap({ source, state, host, targetHome, hostRoot }).contract);
|
|
3465
|
+
} catch (error) {
|
|
3466
|
+
return { host, status: "failed", reason: error.message };
|
|
3467
|
+
}
|
|
3468
|
+
const wired = isWired(host, targetHome, hostRoot);
|
|
3469
|
+
const notWired = () => ({
|
|
3470
|
+
host,
|
|
3471
|
+
status: "written-not-wired",
|
|
3472
|
+
reason: notWiredReason(host, targetHome, hostRoot)
|
|
3473
|
+
});
|
|
3474
|
+
if (readFileOrNull(contractPath) === document2) {
|
|
3475
|
+
return wired ? { host, status: "skipped", reason: `${contractPath} is already up to date` } : notWired();
|
|
3476
|
+
}
|
|
3477
|
+
if (!dryRun) {
|
|
3478
|
+
try {
|
|
3479
|
+
writeFileAtomically(contractPath, document2);
|
|
3480
|
+
} catch (error) {
|
|
3481
|
+
return {
|
|
3482
|
+
host,
|
|
3483
|
+
status: "failed",
|
|
3484
|
+
reason: `could not write ${contractPath}: ${error.message}`
|
|
3485
|
+
};
|
|
3486
|
+
}
|
|
3487
|
+
}
|
|
3488
|
+
return wired ? { host, status: "written" } : notWired();
|
|
3489
|
+
}
|
|
3490
|
+
function wiringArtifact(host, targetHome, hostRoot) {
|
|
3491
|
+
const root = resolveHostRoot(host, targetHome, hostRoot);
|
|
3492
|
+
const contractPath = path14.join(root, CONTRACT_FILENAME);
|
|
3493
|
+
switch (host) {
|
|
3494
|
+
case "claude":
|
|
3495
|
+
return { file: path14.join(root, "CLAUDE.md"), token: `@${CONTRACT_FILENAME}` };
|
|
3496
|
+
case "codex":
|
|
3497
|
+
case "cursor":
|
|
3498
|
+
return { file: path14.join(root, "AGENTS.md"), token: contractPath };
|
|
3499
|
+
case "opencode":
|
|
3500
|
+
return { file: openCodeConfigPath(root), token: `"${contractPath}"` };
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3503
|
+
function openCodeConfigPath(root) {
|
|
3504
|
+
const json = path14.join(root, "opencode.json");
|
|
3505
|
+
if (fs10.existsSync(json))
|
|
3506
|
+
return json;
|
|
3507
|
+
return path14.join(root, "opencode.jsonc");
|
|
3508
|
+
}
|
|
3509
|
+
function isWired(host, targetHome, hostRoot) {
|
|
3510
|
+
const artifact = wiringArtifact(host, targetHome, hostRoot);
|
|
3511
|
+
const text = readFileOrNull(artifact.file);
|
|
3512
|
+
return text !== null && text.includes(artifact.token);
|
|
3513
|
+
}
|
|
3514
|
+
function notWiredReason(host, targetHome, hostRoot) {
|
|
3515
|
+
const artifact = wiringArtifact(host, targetHome, hostRoot);
|
|
3516
|
+
return `contract written, but ${host} has no artifact that loads it \u2014 expected ${artifact.token} in ${artifact.file}; run ${WIRING_REMEDY} to add the wiring`;
|
|
3517
|
+
}
|
|
3518
|
+
function readFileOrNull(filePath) {
|
|
3519
|
+
try {
|
|
3520
|
+
return fs10.readFileSync(filePath, "utf-8");
|
|
3521
|
+
} catch {
|
|
3522
|
+
return null;
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
function isPlainObject3(value) {
|
|
3526
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3527
|
+
}
|
|
3528
|
+
var INSTALL_STATE_FILENAME = "install-state.json", WIRING_REMEDY = "scripts/install-skills.sh --apply", BootstrapEngineError;
|
|
3529
|
+
var init_engine2 = __esm(() => {
|
|
3530
|
+
init_config_loader();
|
|
3531
|
+
init_hosts();
|
|
3532
|
+
init_state();
|
|
3533
|
+
init_render();
|
|
3534
|
+
init_report();
|
|
3535
|
+
init_state2();
|
|
3536
|
+
BootstrapEngineError = class BootstrapEngineError extends Error {
|
|
3537
|
+
details;
|
|
3538
|
+
constructor(name, message, details = []) {
|
|
3539
|
+
super(message);
|
|
3540
|
+
this.name = name;
|
|
3541
|
+
this.details = details;
|
|
3542
|
+
}
|
|
3543
|
+
};
|
|
3544
|
+
});
|
|
3545
|
+
|
|
3546
|
+
// ../../packages/shared/dist/bootstrap/format.js
|
|
3547
|
+
function enabledWord(enabled) {
|
|
3548
|
+
return enabled ? "enabled" : "disabled";
|
|
3549
|
+
}
|
|
3550
|
+
function formatBootstrapInventory(state) {
|
|
3551
|
+
return BOOTSTRAP_RULES.map((rule) => {
|
|
3552
|
+
const current = enabledWord(state[rule.id]);
|
|
3553
|
+
const fallback = enabledWord(rule.defaultEnabled);
|
|
3554
|
+
return ` ${rule.id}: ${current} (default: ${fallback}) \u2014 ${rule.description}`;
|
|
3555
|
+
}).join(`
|
|
3556
|
+
`);
|
|
3557
|
+
}
|
|
3558
|
+
function formatBootstrapReport(report) {
|
|
3559
|
+
const dryRunSuffix = report.dryRun ? " (dry run \u2014 no files changed)" : "";
|
|
3560
|
+
const lines = [];
|
|
3561
|
+
if (report.rows.length === 0) {
|
|
3562
|
+
lines.push(`bootstrap: no host installed${dryRunSuffix}`);
|
|
3563
|
+
} else {
|
|
3564
|
+
lines.push(`bootstrap: ${report.rows.length} host(s)${dryRunSuffix}`);
|
|
3565
|
+
for (const row of report.rows) {
|
|
3566
|
+
const detail = row.reason ? `: ${row.reason}` : "";
|
|
3567
|
+
lines.push(` ${row.host}: ${row.status}${detail}`);
|
|
3568
|
+
}
|
|
3569
|
+
}
|
|
3570
|
+
if (report.ignoredStateKeys.length > 0) {
|
|
3571
|
+
lines.push("", `Ignored persisted rule state: ${report.ignoredStateKeys.join(", ")} \u2014 not a known rule id with a boolean value.`);
|
|
3572
|
+
}
|
|
3573
|
+
if (report.restartRequired) {
|
|
3574
|
+
lines.push("", "A host session restart is required for the change to take effect.");
|
|
3575
|
+
}
|
|
3576
|
+
return lines.join(`
|
|
3577
|
+
`);
|
|
3578
|
+
}
|
|
3579
|
+
var init_format = __esm(() => {
|
|
3580
|
+
init_rules();
|
|
3581
|
+
});
|
|
3582
|
+
|
|
3583
|
+
// ../../packages/shared/dist/bootstrap/index.js
|
|
3584
|
+
var init_bootstrap = __esm(() => {
|
|
3585
|
+
init_rules();
|
|
3586
|
+
init_state2();
|
|
3587
|
+
init_render();
|
|
3588
|
+
init_report();
|
|
3589
|
+
init_engine2();
|
|
3590
|
+
init_format();
|
|
3591
|
+
init_config_loader();
|
|
3592
|
+
});
|
|
3593
|
+
|
|
2913
3594
|
// ../../packages/shared/dist/index.js
|
|
2914
3595
|
var init_dist = __esm(() => {
|
|
2915
3596
|
init_env();
|
|
@@ -2920,6 +3601,7 @@ var init_dist = __esm(() => {
|
|
|
2920
3601
|
init_engine();
|
|
2921
3602
|
init_variant_sync();
|
|
2922
3603
|
init_repo_root();
|
|
3604
|
+
init_bootstrap();
|
|
2923
3605
|
init_types();
|
|
2924
3606
|
init_interfaces();
|
|
2925
3607
|
init_utils();
|
|
@@ -4441,7 +5123,7 @@ var import_brace_expansion, minimatch = (p, pattern, options = {}) => {
|
|
|
4441
5123
|
}, qmarksTestNoExtDot = ([$0]) => {
|
|
4442
5124
|
const len = $0.length;
|
|
4443
5125
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
4444
|
-
}, defaultPlatform,
|
|
5126
|
+
}, defaultPlatform, path15, 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) => {
|
|
4445
5127
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
4446
5128
|
return minimatch;
|
|
4447
5129
|
}
|
|
@@ -4499,11 +5181,11 @@ var init_esm = __esm(() => {
|
|
|
4499
5181
|
starRE = /^\*+$/;
|
|
4500
5182
|
qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
4501
5183
|
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
4502
|
-
|
|
5184
|
+
path15 = {
|
|
4503
5185
|
win32: { sep: "\\" },
|
|
4504
5186
|
posix: { sep: "/" }
|
|
4505
5187
|
};
|
|
4506
|
-
sep = defaultPlatform === "win32" ?
|
|
5188
|
+
sep = defaultPlatform === "win32" ? path15.win32.sep : path15.posix.sep;
|
|
4507
5189
|
minimatch.sep = sep;
|
|
4508
5190
|
GLOBSTAR = Symbol("globstar **");
|
|
4509
5191
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -6469,12 +7151,12 @@ var init_esm4 = __esm(() => {
|
|
|
6469
7151
|
childrenCache() {
|
|
6470
7152
|
return this.#children;
|
|
6471
7153
|
}
|
|
6472
|
-
resolve(
|
|
6473
|
-
if (!
|
|
7154
|
+
resolve(path16) {
|
|
7155
|
+
if (!path16) {
|
|
6474
7156
|
return this;
|
|
6475
7157
|
}
|
|
6476
|
-
const rootPath = this.getRootString(
|
|
6477
|
-
const dir =
|
|
7158
|
+
const rootPath = this.getRootString(path16);
|
|
7159
|
+
const dir = path16.substring(rootPath.length);
|
|
6478
7160
|
const dirParts = dir.split(this.splitSep);
|
|
6479
7161
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
6480
7162
|
return result;
|
|
@@ -7002,8 +7684,8 @@ var init_esm4 = __esm(() => {
|
|
|
7002
7684
|
newChild(name, type = UNKNOWN, opts = {}) {
|
|
7003
7685
|
return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
|
|
7004
7686
|
}
|
|
7005
|
-
getRootString(
|
|
7006
|
-
return win32.parse(
|
|
7687
|
+
getRootString(path16) {
|
|
7688
|
+
return win32.parse(path16).root;
|
|
7007
7689
|
}
|
|
7008
7690
|
getRoot(rootPath) {
|
|
7009
7691
|
rootPath = uncToDrive(rootPath.toUpperCase());
|
|
@@ -7028,8 +7710,8 @@ var init_esm4 = __esm(() => {
|
|
|
7028
7710
|
constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
|
|
7029
7711
|
super(name, type, root, roots, nocase, children, opts);
|
|
7030
7712
|
}
|
|
7031
|
-
getRootString(
|
|
7032
|
-
return
|
|
7713
|
+
getRootString(path16) {
|
|
7714
|
+
return path16.startsWith("/") ? "/" : "";
|
|
7033
7715
|
}
|
|
7034
7716
|
getRoot(_rootPath) {
|
|
7035
7717
|
return this.root;
|
|
@@ -7048,8 +7730,8 @@ var init_esm4 = __esm(() => {
|
|
|
7048
7730
|
#children;
|
|
7049
7731
|
nocase;
|
|
7050
7732
|
#fs;
|
|
7051
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
7052
|
-
this.#fs = fsFromOption(
|
|
7733
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs11 = defaultFS } = {}) {
|
|
7734
|
+
this.#fs = fsFromOption(fs11);
|
|
7053
7735
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
7054
7736
|
cwd = fileURLToPath(cwd);
|
|
7055
7737
|
}
|
|
@@ -7085,11 +7767,11 @@ var init_esm4 = __esm(() => {
|
|
|
7085
7767
|
}
|
|
7086
7768
|
this.cwd = prev;
|
|
7087
7769
|
}
|
|
7088
|
-
depth(
|
|
7089
|
-
if (typeof
|
|
7090
|
-
|
|
7770
|
+
depth(path16 = this.cwd) {
|
|
7771
|
+
if (typeof path16 === "string") {
|
|
7772
|
+
path16 = this.cwd.resolve(path16);
|
|
7091
7773
|
}
|
|
7092
|
-
return
|
|
7774
|
+
return path16.depth();
|
|
7093
7775
|
}
|
|
7094
7776
|
childrenCache() {
|
|
7095
7777
|
return this.#children;
|
|
@@ -7505,9 +8187,9 @@ var init_esm4 = __esm(() => {
|
|
|
7505
8187
|
process2();
|
|
7506
8188
|
return results;
|
|
7507
8189
|
}
|
|
7508
|
-
chdir(
|
|
8190
|
+
chdir(path16 = this.cwd) {
|
|
7509
8191
|
const oldCwd = this.cwd;
|
|
7510
|
-
this.cwd = typeof
|
|
8192
|
+
this.cwd = typeof path16 === "string" ? this.cwd.resolve(path16) : path16;
|
|
7511
8193
|
this.cwd[setAsCwd](oldCwd);
|
|
7512
8194
|
}
|
|
7513
8195
|
};
|
|
@@ -7524,8 +8206,8 @@ var init_esm4 = __esm(() => {
|
|
|
7524
8206
|
parseRootPath(dir) {
|
|
7525
8207
|
return win32.parse(dir).root.toUpperCase();
|
|
7526
8208
|
}
|
|
7527
|
-
newRoot(
|
|
7528
|
-
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
8209
|
+
newRoot(fs11) {
|
|
8210
|
+
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs11 });
|
|
7529
8211
|
}
|
|
7530
8212
|
isAbsolute(p) {
|
|
7531
8213
|
return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p);
|
|
@@ -7541,8 +8223,8 @@ var init_esm4 = __esm(() => {
|
|
|
7541
8223
|
parseRootPath(_dir) {
|
|
7542
8224
|
return "/";
|
|
7543
8225
|
}
|
|
7544
|
-
newRoot(
|
|
7545
|
-
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
8226
|
+
newRoot(fs11) {
|
|
8227
|
+
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs11 });
|
|
7546
8228
|
}
|
|
7547
8229
|
isAbsolute(p) {
|
|
7548
8230
|
return p.startsWith("/");
|
|
@@ -7799,8 +8481,8 @@ class MatchRecord {
|
|
|
7799
8481
|
this.store.set(target, current === undefined ? n : n & current);
|
|
7800
8482
|
}
|
|
7801
8483
|
entries() {
|
|
7802
|
-
return [...this.store.entries()].map(([
|
|
7803
|
-
|
|
8484
|
+
return [...this.store.entries()].map(([path16, n]) => [
|
|
8485
|
+
path16,
|
|
7804
8486
|
!!(n & 2),
|
|
7805
8487
|
!!(n & 1)
|
|
7806
8488
|
]);
|
|
@@ -8004,9 +8686,9 @@ class GlobUtil {
|
|
|
8004
8686
|
signal;
|
|
8005
8687
|
maxDepth;
|
|
8006
8688
|
includeChildMatches;
|
|
8007
|
-
constructor(patterns,
|
|
8689
|
+
constructor(patterns, path16, opts) {
|
|
8008
8690
|
this.patterns = patterns;
|
|
8009
|
-
this.path =
|
|
8691
|
+
this.path = path16;
|
|
8010
8692
|
this.opts = opts;
|
|
8011
8693
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
8012
8694
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -8025,11 +8707,11 @@ class GlobUtil {
|
|
|
8025
8707
|
});
|
|
8026
8708
|
}
|
|
8027
8709
|
}
|
|
8028
|
-
#ignored(
|
|
8029
|
-
return this.seen.has(
|
|
8710
|
+
#ignored(path16) {
|
|
8711
|
+
return this.seen.has(path16) || !!this.#ignore?.ignored?.(path16);
|
|
8030
8712
|
}
|
|
8031
|
-
#childrenIgnored(
|
|
8032
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
8713
|
+
#childrenIgnored(path16) {
|
|
8714
|
+
return !!this.#ignore?.childrenIgnored?.(path16);
|
|
8033
8715
|
}
|
|
8034
8716
|
pause() {
|
|
8035
8717
|
this.paused = true;
|
|
@@ -8246,8 +8928,8 @@ var init_walker = __esm(() => {
|
|
|
8246
8928
|
init_processor();
|
|
8247
8929
|
GlobWalker = class GlobWalker extends GlobUtil {
|
|
8248
8930
|
matches = new Set;
|
|
8249
|
-
constructor(patterns,
|
|
8250
|
-
super(patterns,
|
|
8931
|
+
constructor(patterns, path16, opts) {
|
|
8932
|
+
super(patterns, path16, opts);
|
|
8251
8933
|
}
|
|
8252
8934
|
matchEmit(e) {
|
|
8253
8935
|
this.matches.add(e);
|
|
@@ -8284,8 +8966,8 @@ var init_walker = __esm(() => {
|
|
|
8284
8966
|
};
|
|
8285
8967
|
GlobStream = class GlobStream extends GlobUtil {
|
|
8286
8968
|
results;
|
|
8287
|
-
constructor(patterns,
|
|
8288
|
-
super(patterns,
|
|
8969
|
+
constructor(patterns, path16, opts) {
|
|
8970
|
+
super(patterns, path16, opts);
|
|
8289
8971
|
this.results = new Minipass({
|
|
8290
8972
|
signal: this.signal,
|
|
8291
8973
|
objectMode: true
|
|
@@ -8713,20 +9395,20 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
8713
9395
|
var throwError = (message, Ctor) => {
|
|
8714
9396
|
throw new Ctor(message);
|
|
8715
9397
|
};
|
|
8716
|
-
var checkPath = (
|
|
8717
|
-
if (!isString(
|
|
9398
|
+
var checkPath = (path16, originalPath, doThrow) => {
|
|
9399
|
+
if (!isString(path16)) {
|
|
8718
9400
|
return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
8719
9401
|
}
|
|
8720
|
-
if (!
|
|
9402
|
+
if (!path16) {
|
|
8721
9403
|
return doThrow(`path must not be empty`, TypeError);
|
|
8722
9404
|
}
|
|
8723
|
-
if (checkPath.isNotRelative(
|
|
9405
|
+
if (checkPath.isNotRelative(path16)) {
|
|
8724
9406
|
const r = "`path.relative()`d";
|
|
8725
9407
|
return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
|
|
8726
9408
|
}
|
|
8727
9409
|
return true;
|
|
8728
9410
|
};
|
|
8729
|
-
var isNotRelative = (
|
|
9411
|
+
var isNotRelative = (path16) => REGEX_TEST_INVALID_PATH.test(path16);
|
|
8730
9412
|
checkPath.isNotRelative = isNotRelative;
|
|
8731
9413
|
checkPath.convert = (p) => p;
|
|
8732
9414
|
|
|
@@ -8769,7 +9451,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
8769
9451
|
addPattern(pattern) {
|
|
8770
9452
|
return this.add(pattern);
|
|
8771
9453
|
}
|
|
8772
|
-
_testOne(
|
|
9454
|
+
_testOne(path16, checkUnignored) {
|
|
8773
9455
|
let ignored = false;
|
|
8774
9456
|
let unignored = false;
|
|
8775
9457
|
this._rules.forEach((rule) => {
|
|
@@ -8777,7 +9459,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
8777
9459
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
8778
9460
|
return;
|
|
8779
9461
|
}
|
|
8780
|
-
const matched = rule.regex.test(
|
|
9462
|
+
const matched = rule.regex.test(path16);
|
|
8781
9463
|
if (matched) {
|
|
8782
9464
|
ignored = !negative;
|
|
8783
9465
|
unignored = negative;
|
|
@@ -8789,39 +9471,39 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
8789
9471
|
};
|
|
8790
9472
|
}
|
|
8791
9473
|
_test(originalPath, cache, checkUnignored, slices) {
|
|
8792
|
-
const
|
|
8793
|
-
checkPath(
|
|
8794
|
-
return this._t(
|
|
9474
|
+
const path16 = originalPath && checkPath.convert(originalPath);
|
|
9475
|
+
checkPath(path16, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
|
9476
|
+
return this._t(path16, cache, checkUnignored, slices);
|
|
8795
9477
|
}
|
|
8796
|
-
_t(
|
|
8797
|
-
if (
|
|
8798
|
-
return cache[
|
|
9478
|
+
_t(path16, cache, checkUnignored, slices) {
|
|
9479
|
+
if (path16 in cache) {
|
|
9480
|
+
return cache[path16];
|
|
8799
9481
|
}
|
|
8800
9482
|
if (!slices) {
|
|
8801
|
-
slices =
|
|
9483
|
+
slices = path16.split(SLASH);
|
|
8802
9484
|
}
|
|
8803
9485
|
slices.pop();
|
|
8804
9486
|
if (!slices.length) {
|
|
8805
|
-
return cache[
|
|
9487
|
+
return cache[path16] = this._testOne(path16, checkUnignored);
|
|
8806
9488
|
}
|
|
8807
9489
|
const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
|
|
8808
|
-
return cache[
|
|
9490
|
+
return cache[path16] = parent.ignored ? parent : this._testOne(path16, checkUnignored);
|
|
8809
9491
|
}
|
|
8810
|
-
ignores(
|
|
8811
|
-
return this._test(
|
|
9492
|
+
ignores(path16) {
|
|
9493
|
+
return this._test(path16, this._ignoreCache, false).ignored;
|
|
8812
9494
|
}
|
|
8813
9495
|
createFilter() {
|
|
8814
|
-
return (
|
|
9496
|
+
return (path16) => !this.ignores(path16);
|
|
8815
9497
|
}
|
|
8816
9498
|
filter(paths) {
|
|
8817
9499
|
return makeArray(paths).filter(this.createFilter());
|
|
8818
9500
|
}
|
|
8819
|
-
test(
|
|
8820
|
-
return this._test(
|
|
9501
|
+
test(path16) {
|
|
9502
|
+
return this._test(path16, this._testCache, true);
|
|
8821
9503
|
}
|
|
8822
9504
|
}
|
|
8823
9505
|
var factory = (options) => new Ignore2(options);
|
|
8824
|
-
var isPathValid = (
|
|
9506
|
+
var isPathValid = (path16) => checkPath(path16 && checkPath.convert(path16), path16, RETURN_FALSE);
|
|
8825
9507
|
factory.isPathValid = isPathValid;
|
|
8826
9508
|
factory.default = factory;
|
|
8827
9509
|
module.exports = factory;
|
|
@@ -8829,7 +9511,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
8829
9511
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
8830
9512
|
checkPath.convert = makePosix;
|
|
8831
9513
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
8832
|
-
checkPath.isNotRelative = (
|
|
9514
|
+
checkPath.isNotRelative = (path16) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path16) || isNotRelative(path16);
|
|
8833
9515
|
}
|
|
8834
9516
|
});
|
|
8835
9517
|
|
|
@@ -8891,13 +9573,13 @@ function validatePolicy(policy, opts = {}) {
|
|
|
8891
9573
|
}
|
|
8892
9574
|
}
|
|
8893
9575
|
}
|
|
8894
|
-
function matchesGlob2(
|
|
9576
|
+
function matchesGlob2(path16, pattern) {
|
|
8895
9577
|
let re = regexCache.get(pattern);
|
|
8896
9578
|
if (!re) {
|
|
8897
9579
|
re = globToRegex(pattern);
|
|
8898
9580
|
regexCache.set(pattern, re);
|
|
8899
9581
|
}
|
|
8900
|
-
return re.test(
|
|
9582
|
+
return re.test(path16);
|
|
8901
9583
|
}
|
|
8902
9584
|
var DEFAULT_POLICY, applyPolicy = (filePath, policy) => {
|
|
8903
9585
|
const normalized = filePath.trim();
|
|
@@ -8914,8 +9596,8 @@ var init_capture_policy = __esm(() => {
|
|
|
8914
9596
|
});
|
|
8915
9597
|
|
|
8916
9598
|
// ../../packages/core/dist/services/search/ignore-patterns.js
|
|
8917
|
-
import
|
|
8918
|
-
import
|
|
9599
|
+
import fs11 from "fs/promises";
|
|
9600
|
+
import path16 from "path";
|
|
8919
9601
|
function buildExtensionGlob(extensions) {
|
|
8920
9602
|
return extensions.map((ext2) => `**/*${ext2}`);
|
|
8921
9603
|
}
|
|
@@ -8938,8 +9620,8 @@ async function loadProjectIgnore(projectPath) {
|
|
|
8938
9620
|
const ig = ignore();
|
|
8939
9621
|
ig.add(DEFAULT_IGNORES);
|
|
8940
9622
|
try {
|
|
8941
|
-
const gitignorePath =
|
|
8942
|
-
const gitignoreContent = await
|
|
9623
|
+
const gitignorePath = path16.join(projectPath, ".gitignore");
|
|
9624
|
+
const gitignoreContent = await fs11.readFile(gitignorePath, "utf8");
|
|
8943
9625
|
const rules = gitignoreContent.split(`
|
|
8944
9626
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
8945
9627
|
ig.add(rules);
|
|
@@ -10535,15 +11217,15 @@ var require_pg_connection_string = __commonJS((exports, module) => {
|
|
|
10535
11217
|
if (config2.sslnegotiation === "direct" && config2.ssl === undefined) {
|
|
10536
11218
|
config2.ssl = true;
|
|
10537
11219
|
}
|
|
10538
|
-
const
|
|
11220
|
+
const fs12 = config2.sslcert || config2.sslkey || config2.sslrootcert ? __require("fs") : null;
|
|
10539
11221
|
if (config2.sslcert) {
|
|
10540
|
-
config2.ssl.cert =
|
|
11222
|
+
config2.ssl.cert = fs12.readFileSync(config2.sslcert).toString();
|
|
10541
11223
|
}
|
|
10542
11224
|
if (config2.sslkey) {
|
|
10543
|
-
config2.ssl.key =
|
|
11225
|
+
config2.ssl.key = fs12.readFileSync(config2.sslkey).toString();
|
|
10544
11226
|
}
|
|
10545
11227
|
if (config2.sslrootcert) {
|
|
10546
|
-
config2.ssl.ca =
|
|
11228
|
+
config2.ssl.ca = fs12.readFileSync(config2.sslrootcert).toString();
|
|
10547
11229
|
}
|
|
10548
11230
|
if (options.useLibpqCompat && config2.uselibpqcompat) {
|
|
10549
11231
|
throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
|
|
@@ -12257,7 +12939,7 @@ var require_split2 = __commonJS((exports, module) => {
|
|
|
12257
12939
|
|
|
12258
12940
|
// ../../node_modules/pgpass/lib/helper.js
|
|
12259
12941
|
var require_helper = __commonJS((exports, module) => {
|
|
12260
|
-
var
|
|
12942
|
+
var path17 = __require("path");
|
|
12261
12943
|
var Stream2 = __require("stream").Stream;
|
|
12262
12944
|
var split = require_split2();
|
|
12263
12945
|
var util = __require("util");
|
|
@@ -12297,7 +12979,7 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
12297
12979
|
};
|
|
12298
12980
|
exports.getFileName = function(rawEnv) {
|
|
12299
12981
|
var env = rawEnv || process.env;
|
|
12300
|
-
var file = env.PGPASSFILE || (isWin ?
|
|
12982
|
+
var file = env.PGPASSFILE || (isWin ? path17.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path17.join(env.HOME || "./", ".pgpass"));
|
|
12301
12983
|
return file;
|
|
12302
12984
|
};
|
|
12303
12985
|
exports.usePgPass = function(stats, fname) {
|
|
@@ -12421,16 +13103,16 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
12421
13103
|
|
|
12422
13104
|
// ../../node_modules/pgpass/lib/index.js
|
|
12423
13105
|
var require_lib = __commonJS((exports, module) => {
|
|
12424
|
-
var
|
|
12425
|
-
var
|
|
13106
|
+
var path17 = __require("path");
|
|
13107
|
+
var fs12 = __require("fs");
|
|
12426
13108
|
var helper = require_helper();
|
|
12427
13109
|
module.exports = function(connInfo, cb) {
|
|
12428
13110
|
var file = helper.getFileName();
|
|
12429
|
-
|
|
13111
|
+
fs12.stat(file, function(err, stat) {
|
|
12430
13112
|
if (err || !helper.usePgPass(stat, file)) {
|
|
12431
13113
|
return cb(undefined);
|
|
12432
13114
|
}
|
|
12433
|
-
var st =
|
|
13115
|
+
var st = fs12.createReadStream(file);
|
|
12434
13116
|
helper.getPassword(connInfo, st, cb);
|
|
12435
13117
|
});
|
|
12436
13118
|
};
|
|
@@ -14129,8 +14811,8 @@ var init_alias_resolver = __esm(() => {
|
|
|
14129
14811
|
});
|
|
14130
14812
|
|
|
14131
14813
|
// ../../packages/core/dist/services/search/index-manager.js
|
|
14132
|
-
import
|
|
14133
|
-
import
|
|
14814
|
+
import fs12 from "fs";
|
|
14815
|
+
import path17 from "path";
|
|
14134
14816
|
|
|
14135
14817
|
class IndexManager {
|
|
14136
14818
|
metadataCache = new Map;
|
|
@@ -14223,9 +14905,9 @@ class IndexManager {
|
|
|
14223
14905
|
const fileMetadata = {};
|
|
14224
14906
|
let totalSize = 0;
|
|
14225
14907
|
for (const filePath of indexedFiles) {
|
|
14226
|
-
const fullPath =
|
|
14908
|
+
const fullPath = path17.join(projectPath, filePath);
|
|
14227
14909
|
try {
|
|
14228
|
-
const stat = await
|
|
14910
|
+
const stat = await fs12.promises.stat(fullPath);
|
|
14229
14911
|
fileMetadata[filePath] = {
|
|
14230
14912
|
path: filePath,
|
|
14231
14913
|
mtime: stat.mtimeMs,
|
|
@@ -14276,9 +14958,9 @@ class IndexManager {
|
|
|
14276
14958
|
if (ig.ignores(match2)) {
|
|
14277
14959
|
continue;
|
|
14278
14960
|
}
|
|
14279
|
-
const fullPath =
|
|
14961
|
+
const fullPath = path17.join(projectPath, match2);
|
|
14280
14962
|
try {
|
|
14281
|
-
const stat = await
|
|
14963
|
+
const stat = await fs12.promises.stat(fullPath);
|
|
14282
14964
|
files.set(match2, {
|
|
14283
14965
|
path: match2,
|
|
14284
14966
|
mtime: stat.mtimeMs,
|
|
@@ -14597,7 +15279,7 @@ __export(exports_util, {
|
|
|
14597
15279
|
jsonStringifyReplacer: () => jsonStringifyReplacer,
|
|
14598
15280
|
joinValues: () => joinValues,
|
|
14599
15281
|
issue: () => issue,
|
|
14600
|
-
isPlainObject: () =>
|
|
15282
|
+
isPlainObject: () => isPlainObject4,
|
|
14601
15283
|
isObject: () => isObject,
|
|
14602
15284
|
hexToUint8Array: () => hexToUint8Array,
|
|
14603
15285
|
getSizableOrigin: () => getSizableOrigin,
|
|
@@ -14729,10 +15411,10 @@ function mergeDefs(...defs) {
|
|
|
14729
15411
|
function cloneDef(schema) {
|
|
14730
15412
|
return mergeDefs(schema._zod.def);
|
|
14731
15413
|
}
|
|
14732
|
-
function getElementAtPath(obj,
|
|
14733
|
-
if (!
|
|
15414
|
+
function getElementAtPath(obj, path18) {
|
|
15415
|
+
if (!path18)
|
|
14734
15416
|
return obj;
|
|
14735
|
-
return
|
|
15417
|
+
return path18.reduce((acc, key) => acc?.[key], obj);
|
|
14736
15418
|
}
|
|
14737
15419
|
function promiseAllObject(promisesObj) {
|
|
14738
15420
|
const keys = Object.keys(promisesObj);
|
|
@@ -14762,7 +15444,7 @@ function slugify(input) {
|
|
|
14762
15444
|
function isObject(data) {
|
|
14763
15445
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
14764
15446
|
}
|
|
14765
|
-
function
|
|
15447
|
+
function isPlainObject4(o) {
|
|
14766
15448
|
if (isObject(o) === false)
|
|
14767
15449
|
return false;
|
|
14768
15450
|
const ctor = o.constructor;
|
|
@@ -14779,7 +15461,7 @@ function isPlainObject2(o) {
|
|
|
14779
15461
|
return true;
|
|
14780
15462
|
}
|
|
14781
15463
|
function shallowClone(o) {
|
|
14782
|
-
if (
|
|
15464
|
+
if (isPlainObject4(o))
|
|
14783
15465
|
return { ...o };
|
|
14784
15466
|
if (Array.isArray(o))
|
|
14785
15467
|
return [...o];
|
|
@@ -14919,7 +15601,7 @@ function omit(schema, mask) {
|
|
|
14919
15601
|
return clone(schema, def);
|
|
14920
15602
|
}
|
|
14921
15603
|
function extend(schema, shape) {
|
|
14922
|
-
if (!
|
|
15604
|
+
if (!isPlainObject4(shape)) {
|
|
14923
15605
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
14924
15606
|
}
|
|
14925
15607
|
const checks = schema._zod.def.checks;
|
|
@@ -14942,7 +15624,7 @@ function extend(schema, shape) {
|
|
|
14942
15624
|
return clone(schema, def);
|
|
14943
15625
|
}
|
|
14944
15626
|
function safeExtend(schema, shape) {
|
|
14945
|
-
if (!
|
|
15627
|
+
if (!isPlainObject4(shape)) {
|
|
14946
15628
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
14947
15629
|
}
|
|
14948
15630
|
const def = mergeDefs(schema._zod.def, {
|
|
@@ -15060,11 +15742,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
15060
15742
|
}
|
|
15061
15743
|
return false;
|
|
15062
15744
|
}
|
|
15063
|
-
function prefixIssues(
|
|
15745
|
+
function prefixIssues(path18, issues) {
|
|
15064
15746
|
return issues.map((iss) => {
|
|
15065
15747
|
var _a3;
|
|
15066
15748
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
15067
|
-
iss.path.unshift(
|
|
15749
|
+
iss.path.unshift(path18);
|
|
15068
15750
|
return iss;
|
|
15069
15751
|
});
|
|
15070
15752
|
}
|
|
@@ -15277,16 +15959,16 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
|
15277
15959
|
}
|
|
15278
15960
|
function formatError(error, mapper = (issue2) => issue2.message) {
|
|
15279
15961
|
const fieldErrors = { _errors: [] };
|
|
15280
|
-
const processError = (error2,
|
|
15962
|
+
const processError = (error2, path18 = []) => {
|
|
15281
15963
|
for (const issue2 of error2.issues) {
|
|
15282
15964
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
15283
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
15965
|
+
issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
|
|
15284
15966
|
} else if (issue2.code === "invalid_key") {
|
|
15285
|
-
processError({ issues: issue2.issues }, [...
|
|
15967
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
15286
15968
|
} else if (issue2.code === "invalid_element") {
|
|
15287
|
-
processError({ issues: issue2.issues }, [...
|
|
15969
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
15288
15970
|
} else {
|
|
15289
|
-
const fullpath = [...
|
|
15971
|
+
const fullpath = [...path18, ...issue2.path];
|
|
15290
15972
|
if (fullpath.length === 0) {
|
|
15291
15973
|
fieldErrors._errors.push(mapper(issue2));
|
|
15292
15974
|
} else {
|
|
@@ -15313,17 +15995,17 @@ function formatError(error, mapper = (issue2) => issue2.message) {
|
|
|
15313
15995
|
}
|
|
15314
15996
|
function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
15315
15997
|
const result = { errors: [] };
|
|
15316
|
-
const processError = (error2,
|
|
15998
|
+
const processError = (error2, path18 = []) => {
|
|
15317
15999
|
var _a3, _b;
|
|
15318
16000
|
for (const issue2 of error2.issues) {
|
|
15319
16001
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
15320
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
16002
|
+
issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
|
|
15321
16003
|
} else if (issue2.code === "invalid_key") {
|
|
15322
|
-
processError({ issues: issue2.issues }, [...
|
|
16004
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
15323
16005
|
} else if (issue2.code === "invalid_element") {
|
|
15324
|
-
processError({ issues: issue2.issues }, [...
|
|
16006
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
15325
16007
|
} else {
|
|
15326
|
-
const fullpath = [...
|
|
16008
|
+
const fullpath = [...path18, ...issue2.path];
|
|
15327
16009
|
if (fullpath.length === 0) {
|
|
15328
16010
|
result.errors.push(mapper(issue2));
|
|
15329
16011
|
continue;
|
|
@@ -15355,8 +16037,8 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
|
15355
16037
|
}
|
|
15356
16038
|
function toDotPath(_path) {
|
|
15357
16039
|
const segs = [];
|
|
15358
|
-
const
|
|
15359
|
-
for (const seg of
|
|
16040
|
+
const path18 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
16041
|
+
for (const seg of path18) {
|
|
15360
16042
|
if (typeof seg === "number")
|
|
15361
16043
|
segs.push(`[${seg}]`);
|
|
15362
16044
|
else if (typeof seg === "symbol")
|
|
@@ -16425,7 +17107,7 @@ function mergeValues(a, b) {
|
|
|
16425
17107
|
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
16426
17108
|
return { valid: true, data: a };
|
|
16427
17109
|
}
|
|
16428
|
-
if (
|
|
17110
|
+
if (isPlainObject4(a) && isPlainObject4(b)) {
|
|
16429
17111
|
const bKeys = Object.keys(b);
|
|
16430
17112
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
16431
17113
|
const newObj = { ...a, ...b };
|
|
@@ -17682,7 +18364,7 @@ var init_schemas = __esm(() => {
|
|
|
17682
18364
|
$ZodType.init(inst, def);
|
|
17683
18365
|
inst._zod.parse = (payload, ctx) => {
|
|
17684
18366
|
const input = payload.value;
|
|
17685
|
-
if (!
|
|
18367
|
+
if (!isPlainObject4(input)) {
|
|
17686
18368
|
payload.issues.push({
|
|
17687
18369
|
expected: "record",
|
|
17688
18370
|
code: "invalid_type",
|
|
@@ -28359,13 +29041,13 @@ function resolveRef(ref, ctx) {
|
|
|
28359
29041
|
if (!ref.startsWith("#")) {
|
|
28360
29042
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
28361
29043
|
}
|
|
28362
|
-
const
|
|
28363
|
-
if (
|
|
29044
|
+
const path18 = ref.slice(1).split("/").filter(Boolean);
|
|
29045
|
+
if (path18.length === 0) {
|
|
28364
29046
|
return ctx.rootSchema;
|
|
28365
29047
|
}
|
|
28366
29048
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
28367
|
-
if (
|
|
28368
|
-
const key =
|
|
29049
|
+
if (path18[0] === defsKey) {
|
|
29050
|
+
const key = path18[1];
|
|
28369
29051
|
if (!key || !ctx.defs[key]) {
|
|
28370
29052
|
throw new Error(`Reference not found: ${ref}`);
|
|
28371
29053
|
}
|
|
@@ -29854,8 +30536,8 @@ class ParseStatus {
|
|
|
29854
30536
|
}
|
|
29855
30537
|
}
|
|
29856
30538
|
var makeIssue = (params) => {
|
|
29857
|
-
const { data, path:
|
|
29858
|
-
const fullPath = [...
|
|
30539
|
+
const { data, path: path18, errorMaps, issueData } = params;
|
|
30540
|
+
const fullPath = [...path18, ...issueData.path || []];
|
|
29859
30541
|
const fullIssue = {
|
|
29860
30542
|
...issueData,
|
|
29861
30543
|
path: fullPath
|
|
@@ -29900,11 +30582,11 @@ var init_errorUtil = __esm(() => {
|
|
|
29900
30582
|
|
|
29901
30583
|
// ../../node_modules/zod/v3/types.js
|
|
29902
30584
|
class ParseInputLazyPath {
|
|
29903
|
-
constructor(parent, value,
|
|
30585
|
+
constructor(parent, value, path18, key) {
|
|
29904
30586
|
this._cachedPath = [];
|
|
29905
30587
|
this.parent = parent;
|
|
29906
30588
|
this.data = value;
|
|
29907
|
-
this._path =
|
|
30589
|
+
this._path = path18;
|
|
29908
30590
|
this._key = key;
|
|
29909
30591
|
}
|
|
29910
30592
|
get path() {
|
|
@@ -35901,19 +36583,19 @@ var require_token_io = __commonJS((exports, module) => {
|
|
|
35901
36583
|
getUserDataDir: () => getUserDataDir
|
|
35902
36584
|
});
|
|
35903
36585
|
module.exports = __toCommonJS2(token_io_exports);
|
|
35904
|
-
var
|
|
35905
|
-
var
|
|
36586
|
+
var import_path11 = __toESM2(__require("path"));
|
|
36587
|
+
var import_fs8 = __toESM2(__require("fs"));
|
|
35906
36588
|
var import_os3 = __toESM2(__require("os"));
|
|
35907
36589
|
var import_token_error = require_token_error();
|
|
35908
36590
|
function findRootDir() {
|
|
35909
36591
|
try {
|
|
35910
36592
|
let dir = process.cwd();
|
|
35911
|
-
while (dir !==
|
|
35912
|
-
const pkgPath =
|
|
35913
|
-
if (
|
|
36593
|
+
while (dir !== import_path11.default.dirname(dir)) {
|
|
36594
|
+
const pkgPath = import_path11.default.join(dir, ".vercel");
|
|
36595
|
+
if (import_fs8.default.existsSync(pkgPath)) {
|
|
35914
36596
|
return dir;
|
|
35915
36597
|
}
|
|
35916
|
-
dir =
|
|
36598
|
+
dir = import_path11.default.dirname(dir);
|
|
35917
36599
|
}
|
|
35918
36600
|
} catch (e) {
|
|
35919
36601
|
throw new import_token_error.VercelOidcTokenError("Token refresh only supported in node server environments");
|
|
@@ -35926,9 +36608,9 @@ var require_token_io = __commonJS((exports, module) => {
|
|
|
35926
36608
|
}
|
|
35927
36609
|
switch (import_os3.default.platform()) {
|
|
35928
36610
|
case "darwin":
|
|
35929
|
-
return
|
|
36611
|
+
return import_path11.default.join(import_os3.default.homedir(), "Library/Application Support");
|
|
35930
36612
|
case "linux":
|
|
35931
|
-
return
|
|
36613
|
+
return import_path11.default.join(import_os3.default.homedir(), ".local/share");
|
|
35932
36614
|
case "win32":
|
|
35933
36615
|
if (process.env.LOCALAPPDATA) {
|
|
35934
36616
|
return process.env.LOCALAPPDATA;
|
|
@@ -35969,23 +36651,23 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
35969
36651
|
writeAuthConfig: () => writeAuthConfig
|
|
35970
36652
|
});
|
|
35971
36653
|
module.exports = __toCommonJS2(auth_config_exports);
|
|
35972
|
-
var
|
|
35973
|
-
var
|
|
36654
|
+
var fs13 = __toESM2(__require("fs"));
|
|
36655
|
+
var path18 = __toESM2(__require("path"));
|
|
35974
36656
|
var import_token_util = require_token_util();
|
|
35975
36657
|
function getAuthConfigPath() {
|
|
35976
36658
|
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
35977
36659
|
if (!dataDir) {
|
|
35978
36660
|
throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
|
|
35979
36661
|
}
|
|
35980
|
-
return
|
|
36662
|
+
return path18.join(dataDir, "auth.json");
|
|
35981
36663
|
}
|
|
35982
36664
|
function readAuthConfig() {
|
|
35983
36665
|
try {
|
|
35984
36666
|
const authPath = getAuthConfigPath();
|
|
35985
|
-
if (!
|
|
36667
|
+
if (!fs13.existsSync(authPath)) {
|
|
35986
36668
|
return null;
|
|
35987
36669
|
}
|
|
35988
|
-
const content =
|
|
36670
|
+
const content = fs13.readFileSync(authPath, "utf8");
|
|
35989
36671
|
if (!content) {
|
|
35990
36672
|
return null;
|
|
35991
36673
|
}
|
|
@@ -35996,11 +36678,11 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
35996
36678
|
}
|
|
35997
36679
|
function writeAuthConfig(config3) {
|
|
35998
36680
|
const authPath = getAuthConfigPath();
|
|
35999
|
-
const authDir =
|
|
36000
|
-
if (!
|
|
36001
|
-
|
|
36681
|
+
const authDir = path18.dirname(authPath);
|
|
36682
|
+
if (!fs13.existsSync(authDir)) {
|
|
36683
|
+
fs13.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
36002
36684
|
}
|
|
36003
|
-
|
|
36685
|
+
fs13.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
|
|
36004
36686
|
}
|
|
36005
36687
|
function isValidAccessToken(authConfig, expirationBufferMs = 0) {
|
|
36006
36688
|
if (!authConfig.token)
|
|
@@ -36175,8 +36857,8 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
36175
36857
|
saveToken: () => saveToken
|
|
36176
36858
|
});
|
|
36177
36859
|
module.exports = __toCommonJS2(token_util_exports);
|
|
36178
|
-
var
|
|
36179
|
-
var
|
|
36860
|
+
var path18 = __toESM2(__require("path"));
|
|
36861
|
+
var fs13 = __toESM2(__require("fs"));
|
|
36180
36862
|
var import_token_error = require_token_error();
|
|
36181
36863
|
var import_token_io = require_token_io();
|
|
36182
36864
|
var import_auth_config = require_auth_config();
|
|
@@ -36188,7 +36870,7 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
36188
36870
|
if (!dataDir) {
|
|
36189
36871
|
return null;
|
|
36190
36872
|
}
|
|
36191
|
-
return
|
|
36873
|
+
return path18.join(dataDir, vercelFolder);
|
|
36192
36874
|
}
|
|
36193
36875
|
async function getVercelToken2(options) {
|
|
36194
36876
|
const authConfig = (0, import_auth_config.readAuthConfig)();
|
|
@@ -36256,11 +36938,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
36256
36938
|
if (!dir) {
|
|
36257
36939
|
throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
|
|
36258
36940
|
}
|
|
36259
|
-
const prjPath =
|
|
36260
|
-
if (!
|
|
36941
|
+
const prjPath = path18.join(dir, ".vercel", "project.json");
|
|
36942
|
+
if (!fs13.existsSync(prjPath)) {
|
|
36261
36943
|
throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
|
|
36262
36944
|
}
|
|
36263
|
-
const prj = JSON.parse(
|
|
36945
|
+
const prj = JSON.parse(fs13.readFileSync(prjPath, "utf8"));
|
|
36264
36946
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
36265
36947
|
throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
|
|
36266
36948
|
}
|
|
@@ -36271,11 +36953,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
36271
36953
|
if (!dir) {
|
|
36272
36954
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
36273
36955
|
}
|
|
36274
|
-
const tokenPath =
|
|
36956
|
+
const tokenPath = path18.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
36275
36957
|
const tokenJson = JSON.stringify(token);
|
|
36276
|
-
|
|
36277
|
-
|
|
36278
|
-
|
|
36958
|
+
fs13.mkdirSync(path18.dirname(tokenPath), { mode: 504, recursive: true });
|
|
36959
|
+
fs13.writeFileSync(tokenPath, tokenJson);
|
|
36960
|
+
fs13.chmodSync(tokenPath, 432);
|
|
36279
36961
|
return;
|
|
36280
36962
|
}
|
|
36281
36963
|
function loadToken(projectId) {
|
|
@@ -36283,11 +36965,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
36283
36965
|
if (!dir) {
|
|
36284
36966
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
36285
36967
|
}
|
|
36286
|
-
const tokenPath =
|
|
36287
|
-
if (!
|
|
36968
|
+
const tokenPath = path18.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
36969
|
+
if (!fs13.existsSync(tokenPath)) {
|
|
36288
36970
|
return null;
|
|
36289
36971
|
}
|
|
36290
|
-
const token = JSON.parse(
|
|
36972
|
+
const token = JSON.parse(fs13.readFileSync(tokenPath, "utf8"));
|
|
36291
36973
|
assertVercelOidcTokenResponse(token);
|
|
36292
36974
|
return token;
|
|
36293
36975
|
}
|
|
@@ -47129,37 +47811,37 @@ function createOpenAI(options = {}) {
|
|
|
47129
47811
|
}, `ai-sdk/openai/${VERSION4}`);
|
|
47130
47812
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
47131
47813
|
provider: `${providerName}.chat`,
|
|
47132
|
-
url: ({ path:
|
|
47814
|
+
url: ({ path: path18 }) => `${baseURL}${path18}`,
|
|
47133
47815
|
headers: getHeaders,
|
|
47134
47816
|
fetch: options.fetch
|
|
47135
47817
|
});
|
|
47136
47818
|
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
47137
47819
|
provider: `${providerName}.completion`,
|
|
47138
|
-
url: ({ path:
|
|
47820
|
+
url: ({ path: path18 }) => `${baseURL}${path18}`,
|
|
47139
47821
|
headers: getHeaders,
|
|
47140
47822
|
fetch: options.fetch
|
|
47141
47823
|
});
|
|
47142
47824
|
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
47143
47825
|
provider: `${providerName}.embedding`,
|
|
47144
|
-
url: ({ path:
|
|
47826
|
+
url: ({ path: path18 }) => `${baseURL}${path18}`,
|
|
47145
47827
|
headers: getHeaders,
|
|
47146
47828
|
fetch: options.fetch
|
|
47147
47829
|
});
|
|
47148
47830
|
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
47149
47831
|
provider: `${providerName}.image`,
|
|
47150
|
-
url: ({ path:
|
|
47832
|
+
url: ({ path: path18 }) => `${baseURL}${path18}`,
|
|
47151
47833
|
headers: getHeaders,
|
|
47152
47834
|
fetch: options.fetch
|
|
47153
47835
|
});
|
|
47154
47836
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
47155
47837
|
provider: `${providerName}.transcription`,
|
|
47156
|
-
url: ({ path:
|
|
47838
|
+
url: ({ path: path18 }) => `${baseURL}${path18}`,
|
|
47157
47839
|
headers: getHeaders,
|
|
47158
47840
|
fetch: options.fetch
|
|
47159
47841
|
});
|
|
47160
47842
|
const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
|
|
47161
47843
|
provider: `${providerName}.speech`,
|
|
47162
|
-
url: ({ path:
|
|
47844
|
+
url: ({ path: path18 }) => `${baseURL}${path18}`,
|
|
47163
47845
|
headers: getHeaders,
|
|
47164
47846
|
fetch: options.fetch
|
|
47165
47847
|
});
|
|
@@ -47172,7 +47854,7 @@ function createOpenAI(options = {}) {
|
|
|
47172
47854
|
const createResponsesModel = (modelId) => {
|
|
47173
47855
|
return new OpenAIResponsesLanguageModel(modelId, {
|
|
47174
47856
|
provider: `${providerName}.responses`,
|
|
47175
|
-
url: ({ path:
|
|
47857
|
+
url: ({ path: path18 }) => `${baseURL}${path18}`,
|
|
47176
47858
|
headers: getHeaders,
|
|
47177
47859
|
fetch: options.fetch,
|
|
47178
47860
|
fileIdPrefixes: ["file-"]
|
|
@@ -63717,26 +64399,26 @@ var require_process = __commonJS((exports, module) => {
|
|
|
63717
64399
|
|
|
63718
64400
|
// ../../node_modules/detect-libc/lib/filesystem.js
|
|
63719
64401
|
var require_filesystem = __commonJS((exports, module) => {
|
|
63720
|
-
var
|
|
64402
|
+
var fs13 = __require("fs");
|
|
63721
64403
|
var LDD_PATH = "/usr/bin/ldd";
|
|
63722
64404
|
var SELF_PATH = "/proc/self/exe";
|
|
63723
64405
|
var MAX_LENGTH = 2048;
|
|
63724
|
-
var readFileSync2 = (
|
|
63725
|
-
const fd =
|
|
64406
|
+
var readFileSync2 = (path18) => {
|
|
64407
|
+
const fd = fs13.openSync(path18, "r");
|
|
63726
64408
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
63727
|
-
const bytesRead =
|
|
63728
|
-
|
|
64409
|
+
const bytesRead = fs13.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
64410
|
+
fs13.close(fd, () => {});
|
|
63729
64411
|
return buffer.subarray(0, bytesRead);
|
|
63730
64412
|
};
|
|
63731
|
-
var readFile = (
|
|
63732
|
-
|
|
64413
|
+
var readFile = (path18) => new Promise((resolve4, reject) => {
|
|
64414
|
+
fs13.open(path18, "r", (err, fd) => {
|
|
63733
64415
|
if (err) {
|
|
63734
64416
|
reject(err);
|
|
63735
64417
|
} else {
|
|
63736
64418
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
63737
|
-
|
|
64419
|
+
fs13.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
|
|
63738
64420
|
resolve4(buffer.subarray(0, bytesRead));
|
|
63739
|
-
|
|
64421
|
+
fs13.close(fd, () => {});
|
|
63740
64422
|
});
|
|
63741
64423
|
}
|
|
63742
64424
|
});
|
|
@@ -63841,11 +64523,11 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
63841
64523
|
}
|
|
63842
64524
|
return null;
|
|
63843
64525
|
};
|
|
63844
|
-
var familyFromInterpreterPath = (
|
|
63845
|
-
if (
|
|
63846
|
-
if (
|
|
64526
|
+
var familyFromInterpreterPath = (path18) => {
|
|
64527
|
+
if (path18) {
|
|
64528
|
+
if (path18.includes("/ld-musl-")) {
|
|
63847
64529
|
return MUSL;
|
|
63848
|
-
} else if (
|
|
64530
|
+
} else if (path18.includes("/ld-linux-")) {
|
|
63849
64531
|
return GLIBC;
|
|
63850
64532
|
}
|
|
63851
64533
|
}
|
|
@@ -63890,8 +64572,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
63890
64572
|
cachedFamilyInterpreter = null;
|
|
63891
64573
|
try {
|
|
63892
64574
|
const selfContent = await readFile(SELF_PATH);
|
|
63893
|
-
const
|
|
63894
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
64575
|
+
const path18 = interpreterPath(selfContent);
|
|
64576
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path18);
|
|
63895
64577
|
} catch (e) {}
|
|
63896
64578
|
return cachedFamilyInterpreter;
|
|
63897
64579
|
};
|
|
@@ -63902,8 +64584,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
63902
64584
|
cachedFamilyInterpreter = null;
|
|
63903
64585
|
try {
|
|
63904
64586
|
const selfContent = readFileSync2(SELF_PATH);
|
|
63905
|
-
const
|
|
63906
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
64587
|
+
const path18 = interpreterPath(selfContent);
|
|
64588
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path18);
|
|
63907
64589
|
} catch (e) {}
|
|
63908
64590
|
return cachedFamilyInterpreter;
|
|
63909
64591
|
};
|
|
@@ -65565,18 +66247,18 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
65565
66247
|
`@img/sharp-${runtimePlatform}/sharp.node`,
|
|
65566
66248
|
"@img/sharp-wasm32/sharp.node"
|
|
65567
66249
|
];
|
|
65568
|
-
var
|
|
66250
|
+
var path18;
|
|
65569
66251
|
var sharp;
|
|
65570
66252
|
var errors4 = [];
|
|
65571
|
-
for (
|
|
66253
|
+
for (path18 of paths) {
|
|
65572
66254
|
try {
|
|
65573
|
-
sharp = __require(
|
|
66255
|
+
sharp = __require(path18);
|
|
65574
66256
|
break;
|
|
65575
66257
|
} catch (err) {
|
|
65576
66258
|
errors4.push(err);
|
|
65577
66259
|
}
|
|
65578
66260
|
}
|
|
65579
|
-
if (sharp &&
|
|
66261
|
+
if (sharp && path18.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
|
|
65580
66262
|
const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
|
|
65581
66263
|
err.code = "Unsupported CPU";
|
|
65582
66264
|
errors4.push(err);
|
|
@@ -68438,15 +69120,15 @@ var require_color = __commonJS((exports, module) => {
|
|
|
68438
69120
|
};
|
|
68439
69121
|
}
|
|
68440
69122
|
function wrapConversion(toModel, graph) {
|
|
68441
|
-
const
|
|
69123
|
+
const path18 = [graph[toModel].parent, toModel];
|
|
68442
69124
|
let fn = conversions_default[graph[toModel].parent][toModel];
|
|
68443
69125
|
let cur = graph[toModel].parent;
|
|
68444
69126
|
while (graph[cur].parent) {
|
|
68445
|
-
|
|
69127
|
+
path18.unshift(graph[cur].parent);
|
|
68446
69128
|
fn = link(conversions_default[graph[cur].parent][cur], fn);
|
|
68447
69129
|
cur = graph[cur].parent;
|
|
68448
69130
|
}
|
|
68449
|
-
fn.conversion =
|
|
69131
|
+
fn.conversion = path18;
|
|
68450
69132
|
return fn;
|
|
68451
69133
|
}
|
|
68452
69134
|
function route(fromModel) {
|
|
@@ -69051,7 +69733,7 @@ var require_output = __commonJS((exports, module) => {
|
|
|
69051
69733
|
Copyright 2013 Lovell Fuller and others.
|
|
69052
69734
|
SPDX-License-Identifier: Apache-2.0
|
|
69053
69735
|
*/
|
|
69054
|
-
var
|
|
69736
|
+
var path18 = __require("path");
|
|
69055
69737
|
var is = require_is();
|
|
69056
69738
|
var sharp = require_sharp();
|
|
69057
69739
|
var formats = new Map([
|
|
@@ -69082,9 +69764,9 @@ var require_output = __commonJS((exports, module) => {
|
|
|
69082
69764
|
let err;
|
|
69083
69765
|
if (!is.string(fileOut)) {
|
|
69084
69766
|
err = new Error("Missing output file path");
|
|
69085
|
-
} else if (is.string(this.options.input.file) &&
|
|
69767
|
+
} else if (is.string(this.options.input.file) && path18.resolve(this.options.input.file) === path18.resolve(fileOut)) {
|
|
69086
69768
|
err = new Error("Cannot use same file for input and output");
|
|
69087
|
-
} else if (jp2Regex.test(
|
|
69769
|
+
} else if (jp2Regex.test(path18.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
|
|
69088
69770
|
err = errJp2Save();
|
|
69089
69771
|
}
|
|
69090
69772
|
if (err) {
|
|
@@ -76331,11 +77013,11 @@ var init_transformers_node = __esm(() => {
|
|
|
76331
77013
|
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}).`);
|
|
76332
77014
|
}
|
|
76333
77015
|
for (let i = 0;i < num_chunks; ++i) {
|
|
76334
|
-
const
|
|
76335
|
-
const fullPath = `${options.subfolder ?? ""}/${
|
|
77016
|
+
const path18 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
|
|
77017
|
+
const fullPath = `${options.subfolder ?? ""}/${path18}`;
|
|
76336
77018
|
externalDataPromises.push(new Promise(async (resolve4, reject) => {
|
|
76337
77019
|
const data = await (0, _utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelFile)(pretrained_model_name_or_path, fullPath, true, options, return_path);
|
|
76338
|
-
resolve4(data instanceof Uint8Array ? { path:
|
|
77020
|
+
resolve4(data instanceof Uint8Array ? { path: path18, data } : path18);
|
|
76339
77021
|
}));
|
|
76340
77022
|
}
|
|
76341
77023
|
} else if (session_options.externalData !== undefined) {
|
|
@@ -89399,7 +90081,7 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
89399
90081
|
const blob = new Blob([wav], { type: "audio/wav" });
|
|
89400
90082
|
return blob;
|
|
89401
90083
|
}
|
|
89402
|
-
async save(
|
|
90084
|
+
async save(path18) {
|
|
89403
90085
|
let fn;
|
|
89404
90086
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_BROWSER_ENV) {
|
|
89405
90087
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_WEBWORKER_ENV) {
|
|
@@ -89407,14 +90089,14 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
89407
90089
|
}
|
|
89408
90090
|
fn = _core_js__WEBPACK_IMPORTED_MODULE_2__.saveBlob;
|
|
89409
90091
|
} else if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_FS_AVAILABLE) {
|
|
89410
|
-
fn = async (
|
|
90092
|
+
fn = async (path19, blob) => {
|
|
89411
90093
|
let buffer = await blob.arrayBuffer();
|
|
89412
|
-
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(
|
|
90094
|
+
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path19, Buffer.from(buffer));
|
|
89413
90095
|
};
|
|
89414
90096
|
} else {
|
|
89415
90097
|
throw new Error("Unable to save because filesystem is disabled in this environment.");
|
|
89416
90098
|
}
|
|
89417
|
-
await fn(
|
|
90099
|
+
await fn(path18, this.toBlob());
|
|
89418
90100
|
}
|
|
89419
90101
|
}
|
|
89420
90102
|
},
|
|
@@ -89510,11 +90192,11 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
89510
90192
|
function calculateReflectOffset(i, w) {
|
|
89511
90193
|
return Math.abs((i + w) % (2 * w) - w);
|
|
89512
90194
|
}
|
|
89513
|
-
function saveBlob(
|
|
90195
|
+
function saveBlob(path18, blob) {
|
|
89514
90196
|
const dataURL = URL.createObjectURL(blob);
|
|
89515
90197
|
const downloadLink = document.createElement("a");
|
|
89516
90198
|
downloadLink.href = dataURL;
|
|
89517
|
-
downloadLink.download =
|
|
90199
|
+
downloadLink.download = path18;
|
|
89518
90200
|
downloadLink.click();
|
|
89519
90201
|
downloadLink.remove();
|
|
89520
90202
|
URL.revokeObjectURL(dataURL);
|
|
@@ -90115,8 +90797,8 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
90115
90797
|
}
|
|
90116
90798
|
|
|
90117
90799
|
class FileCache {
|
|
90118
|
-
constructor(
|
|
90119
|
-
this.path =
|
|
90800
|
+
constructor(path18) {
|
|
90801
|
+
this.path = path18;
|
|
90120
90802
|
}
|
|
90121
90803
|
async match(request) {
|
|
90122
90804
|
let filePath = node_path__WEBPACK_IMPORTED_MODULE_1__["default"].join(this.path, request);
|
|
@@ -90872,20 +91554,20 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
90872
91554
|
}
|
|
90873
91555
|
return this;
|
|
90874
91556
|
}
|
|
90875
|
-
async save(
|
|
91557
|
+
async save(path18) {
|
|
90876
91558
|
if (IS_BROWSER_OR_WEBWORKER) {
|
|
90877
91559
|
if (_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_WEBWORKER_ENV) {
|
|
90878
91560
|
throw new Error("Unable to save an image from a Web Worker.");
|
|
90879
91561
|
}
|
|
90880
|
-
const extension =
|
|
91562
|
+
const extension = path18.split(".").pop().toLowerCase();
|
|
90881
91563
|
const mime = CONTENT_TYPE_MAP.get(extension) ?? "image/png";
|
|
90882
91564
|
const blob = await this.toBlob(mime);
|
|
90883
|
-
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(
|
|
91565
|
+
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path18, blob);
|
|
90884
91566
|
} else if (!_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_FS_AVAILABLE) {
|
|
90885
91567
|
throw new Error("Unable to save the image because filesystem is disabled in this environment.");
|
|
90886
91568
|
} else {
|
|
90887
91569
|
const img = this.toSharp();
|
|
90888
|
-
return await img.toFile(
|
|
91570
|
+
return await img.toFile(path18);
|
|
90889
91571
|
}
|
|
90890
91572
|
}
|
|
90891
91573
|
toSharp() {
|
|
@@ -100416,10 +101098,10 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
|
|
|
100416
101098
|
super(t, "P2023", r);
|
|
100417
101099
|
}
|
|
100418
101100
|
};
|
|
100419
|
-
var
|
|
101101
|
+
var fs13 = new WeakMap;
|
|
100420
101102
|
function Ep(e) {
|
|
100421
|
-
let t =
|
|
100422
|
-
return t || (t = Object.entries(e),
|
|
101103
|
+
let t = fs13.get(e);
|
|
101104
|
+
return t || (t = Object.entries(e), fs13.set(e, t)), t;
|
|
100423
101105
|
}
|
|
100424
101106
|
function hs(e, t, r) {
|
|
100425
101107
|
switch (t.type) {
|
|
@@ -104387,7 +105069,7 @@ var require_prisma = __commonJS((exports) => {
|
|
|
104387
105069
|
Prisma.JsonNull = JsonNull2;
|
|
104388
105070
|
Prisma.AnyNull = AnyNull2;
|
|
104389
105071
|
Prisma.NullTypes = NullTypes2;
|
|
104390
|
-
var
|
|
105072
|
+
var path18 = __require("path");
|
|
104391
105073
|
exports.Prisma.TransactionIsolationLevel = makeStrictEnum2({
|
|
104392
105074
|
ReadUncommitted: "ReadUncommitted",
|
|
104393
105075
|
ReadCommitted: "ReadCommitted",
|
|
@@ -117260,10 +117942,10 @@ var init_chunker_code = __esm(() => {
|
|
|
117260
117942
|
});
|
|
117261
117943
|
|
|
117262
117944
|
// ../../packages/core/dist/services/search/smart-chunker.js
|
|
117263
|
-
import
|
|
117945
|
+
import path18 from "path";
|
|
117264
117946
|
function smartChunk(content, filePath, config3 = {}) {
|
|
117265
117947
|
const cfg = { ...DEFAULT_CONFIG, ...config3 };
|
|
117266
|
-
const ext2 =
|
|
117948
|
+
const ext2 = path18.extname(filePath).toLowerCase();
|
|
117267
117949
|
const relativePath = filePath;
|
|
117268
117950
|
const fileImports = isCodeFile(ext2) ? extractFileImports(content, ext2) : undefined;
|
|
117269
117951
|
let chunks;
|
|
@@ -117570,8 +118252,8 @@ var init_managed_run_repository_pg = __esm(() => {
|
|
|
117570
118252
|
});
|
|
117571
118253
|
|
|
117572
118254
|
// ../../packages/core/dist/services/search/project-indexer.js
|
|
117573
|
-
import
|
|
117574
|
-
import
|
|
118255
|
+
import fs13 from "fs/promises";
|
|
118256
|
+
import path19 from "path";
|
|
117575
118257
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
117576
118258
|
async function runWithIndexLock(lockMap, projectId, work) {
|
|
117577
118259
|
const prevLock = lockMap.get(projectId);
|
|
@@ -117614,7 +118296,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
117614
118296
|
dot: false
|
|
117615
118297
|
});
|
|
117616
118298
|
const filteredFiles = files.filter((file2) => {
|
|
117617
|
-
const relativePath =
|
|
118299
|
+
const relativePath = path19.relative(projectPath, file2);
|
|
117618
118300
|
const shouldIgnore = ig.ignores(relativePath);
|
|
117619
118301
|
if (shouldIgnore) {
|
|
117620
118302
|
logger.debug("Ignoring file per .gitignore during indexing", {
|
|
@@ -117654,7 +118336,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
117654
118336
|
});
|
|
117655
118337
|
}
|
|
117656
118338
|
}
|
|
117657
|
-
const indexedFilesList = filteredFiles.map((f) =>
|
|
118339
|
+
const indexedFilesList = filteredFiles.map((f) => path19.relative(projectPath, f));
|
|
117658
118340
|
await deps.indexManager.updateIndexMetadata(projectId, projectPath, indexedFilesList);
|
|
117659
118341
|
logger.info("Project indexing completed", {
|
|
117660
118342
|
projectId,
|
|
@@ -117779,7 +118461,7 @@ async function ensureFreshIndex(deps, projectId, projectPath, options = {}) {
|
|
|
117779
118461
|
let errors4 = 0;
|
|
117780
118462
|
for (const relativeFilePath of filesToReindex) {
|
|
117781
118463
|
try {
|
|
117782
|
-
const fullPath =
|
|
118464
|
+
const fullPath = path19.join(projectPath, relativeFilePath);
|
|
117783
118465
|
const result = await deps.indexFile(fullPath, projectId, projectPath, centralityMap);
|
|
117784
118466
|
filesIndexed++;
|
|
117785
118467
|
chunksIndexed += result.chunks;
|
|
@@ -117830,8 +118512,8 @@ async function checkSearchAdmission(deps, projectId, projectPath) {
|
|
|
117830
118512
|
}
|
|
117831
118513
|
async function indexFile(deps, filePath, projectId, projectRoot, centralityMap) {
|
|
117832
118514
|
projectId = await getProjectIdentityAliasResolver().resolve(projectId);
|
|
117833
|
-
const content = await
|
|
117834
|
-
const relativePath =
|
|
118515
|
+
const content = await fs13.readFile(filePath, "utf-8");
|
|
118516
|
+
const relativePath = path19.relative(projectRoot, filePath);
|
|
117835
118517
|
const maxFileSize = config.get("security").maxFileSize || 1024 * 1024;
|
|
117836
118518
|
if (content.length > maxFileSize) {
|
|
117837
118519
|
logger.warn("File too large, skipping", {
|
|
@@ -117851,7 +118533,7 @@ async function indexFile(deps, filePath, projectId, projectRoot, centralityMap)
|
|
|
117851
118533
|
chunkIndex: i,
|
|
117852
118534
|
totalChunks: chunks.length,
|
|
117853
118535
|
type: chunk.type,
|
|
117854
|
-
language:
|
|
118536
|
+
language: path19.extname(filePath).slice(1),
|
|
117855
118537
|
lineStart: chunk.lineStart,
|
|
117856
118538
|
lineEnd: chunk.lineEnd,
|
|
117857
118539
|
label: chunk.label,
|
|
@@ -121182,16 +121864,16 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
121182
121864
|
const seen = new Set;
|
|
121183
121865
|
const out = [];
|
|
121184
121866
|
for (const e of httpEdges) {
|
|
121185
|
-
const
|
|
121186
|
-
if (!
|
|
121867
|
+
const path20 = e.route;
|
|
121868
|
+
if (!path20)
|
|
121187
121869
|
continue;
|
|
121188
121870
|
const method = (e.method ?? "ANY").toUpperCase();
|
|
121189
|
-
const key = method + " " +
|
|
121871
|
+
const key = method + " " + path20;
|
|
121190
121872
|
if (seen.has(key))
|
|
121191
121873
|
continue;
|
|
121192
121874
|
seen.add(key);
|
|
121193
121875
|
out.push({
|
|
121194
|
-
path:
|
|
121876
|
+
path: path20,
|
|
121195
121877
|
method: e.method,
|
|
121196
121878
|
file: e.fromFile,
|
|
121197
121879
|
handler: e.targetFqn ?? e.symbolName
|
|
@@ -121202,12 +121884,12 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
121202
121884
|
continue;
|
|
121203
121885
|
const parsed = parseRouteName(d.name);
|
|
121204
121886
|
const method = parsed?.method ?? "ANY";
|
|
121205
|
-
const
|
|
121206
|
-
const key = method + " " +
|
|
121887
|
+
const path20 = parsed?.path ?? d.name;
|
|
121888
|
+
const key = method + " " + path20;
|
|
121207
121889
|
if (seen.has(key))
|
|
121208
121890
|
continue;
|
|
121209
121891
|
seen.add(key);
|
|
121210
|
-
out.push({ path:
|
|
121892
|
+
out.push({ path: path20, method: parsed?.method, file: d.filePath, handler: d.name });
|
|
121211
121893
|
}
|
|
121212
121894
|
for (const d of defs) {
|
|
121213
121895
|
const parsed = parseRouteName(d.name);
|
|
@@ -121428,8 +122110,8 @@ __export(exports_symbol_graph_service, {
|
|
|
121428
122110
|
symbolGraphService: () => symbolGraphService,
|
|
121429
122111
|
SymbolGraphService: () => SymbolGraphService
|
|
121430
122112
|
});
|
|
121431
|
-
import
|
|
121432
|
-
import
|
|
122113
|
+
import path20 from "path";
|
|
122114
|
+
import fs14 from "fs/promises";
|
|
121433
122115
|
|
|
121434
122116
|
class SymbolGraphService {
|
|
121435
122117
|
identityLookup;
|
|
@@ -121757,7 +122439,7 @@ class SymbolGraphService {
|
|
|
121757
122439
|
async readSnippet(relativePath, lineStart, lineEnd, projectId) {
|
|
121758
122440
|
try {
|
|
121759
122441
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
121760
|
-
const content = await
|
|
122442
|
+
const content = await fs14.readFile(absolutePath, "utf-8");
|
|
121761
122443
|
const lines = content.split(`
|
|
121762
122444
|
`);
|
|
121763
122445
|
return lines.slice(Math.max(0, lineStart - 1), Math.min(lines.length, lineEnd)).join(`
|
|
@@ -121769,7 +122451,7 @@ class SymbolGraphService {
|
|
|
121769
122451
|
async readContext(relativePath, lineNumber, contextLines, projectId) {
|
|
121770
122452
|
try {
|
|
121771
122453
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
121772
|
-
const content = await
|
|
122454
|
+
const content = await fs14.readFile(absolutePath, "utf-8");
|
|
121773
122455
|
const lines = content.split(`
|
|
121774
122456
|
`);
|
|
121775
122457
|
const start = Math.max(0, lineNumber - contextLines - 1);
|
|
@@ -121782,7 +122464,7 @@ class SymbolGraphService {
|
|
|
121782
122464
|
}
|
|
121783
122465
|
async resolveToAbsolute(relativePath, projectId) {
|
|
121784
122466
|
const root = await this.getProjectRoot(projectId);
|
|
121785
|
-
return root ?
|
|
122467
|
+
return root ? path20.resolve(root, relativePath) : relativePath;
|
|
121786
122468
|
}
|
|
121787
122469
|
async getProjectRoot(projectId) {
|
|
121788
122470
|
const cached2 = this.projectRootCache.get(projectId);
|
|
@@ -123560,31 +124242,31 @@ class TracePathService {
|
|
|
123560
124242
|
const chains = [];
|
|
123561
124243
|
const seen = new Set;
|
|
123562
124244
|
let walks = 0;
|
|
123563
|
-
const walk = (fqn,
|
|
124245
|
+
const walk = (fqn, path21) => {
|
|
123564
124246
|
if (chains.length >= CHAIN_CAP)
|
|
123565
124247
|
return;
|
|
123566
124248
|
if (walks >= MAX_WALKS)
|
|
123567
124249
|
return;
|
|
123568
124250
|
walks++;
|
|
123569
|
-
const key =
|
|
124251
|
+
const key = path21.join("\u2192");
|
|
123570
124252
|
if (seen.has(key))
|
|
123571
124253
|
return;
|
|
123572
124254
|
seen.add(key);
|
|
123573
124255
|
const next = adj.get(fqn);
|
|
123574
124256
|
if (!next || next.length === 0 || !whoHasChild.has(fqn)) {
|
|
123575
|
-
if (
|
|
123576
|
-
chains.push(
|
|
124257
|
+
if (path21.length > 1)
|
|
124258
|
+
chains.push(path21.map((n) => this.fqnToName(n)).join(" \u2192 "));
|
|
123577
124259
|
return;
|
|
123578
124260
|
}
|
|
123579
124261
|
for (const child of next) {
|
|
123580
124262
|
if (chains.length >= CHAIN_CAP || walks >= MAX_WALKS)
|
|
123581
124263
|
return;
|
|
123582
|
-
if (
|
|
123583
|
-
const cycled = [...
|
|
124264
|
+
if (path21.includes(child)) {
|
|
124265
|
+
const cycled = [...path21, `${this.fqnToName(child)}\u21BA`];
|
|
123584
124266
|
chains.push(cycled.map((n) => n).join(" \u2192 "));
|
|
123585
124267
|
continue;
|
|
123586
124268
|
}
|
|
123587
|
-
walk(child, [...
|
|
124269
|
+
walk(child, [...path21, child]);
|
|
123588
124270
|
}
|
|
123589
124271
|
};
|
|
123590
124272
|
for (const seed of seeds) {
|
|
@@ -125578,9 +126260,9 @@ var init_l1_memory_cache = __esm(() => {
|
|
|
125578
126260
|
});
|
|
125579
126261
|
|
|
125580
126262
|
// ../../packages/core/dist/services/health/local-health-checker.js
|
|
125581
|
-
import
|
|
126263
|
+
import fs15 from "fs/promises";
|
|
125582
126264
|
import { existsSync as existsSync3 } from "fs";
|
|
125583
|
-
import
|
|
126265
|
+
import path21 from "path";
|
|
125584
126266
|
|
|
125585
126267
|
class LocalHealthChecker {
|
|
125586
126268
|
ollamaBaseUrl = process.env.OLLAMA_BASE_URL || "http://localhost:11434";
|
|
@@ -125614,10 +126296,10 @@ class LocalHealthChecker {
|
|
|
125614
126296
|
const start = Date.now();
|
|
125615
126297
|
try {
|
|
125616
126298
|
if (!existsSync3(this.dataDir))
|
|
125617
|
-
await
|
|
125618
|
-
const probe =
|
|
125619
|
-
await
|
|
125620
|
-
await
|
|
126299
|
+
await fs15.mkdir(this.dataDir, { recursive: true });
|
|
126300
|
+
const probe = path21.join(this.dataDir, ".health-check-test");
|
|
126301
|
+
await fs15.writeFile(probe, "ok");
|
|
126302
|
+
await fs15.unlink(probe);
|
|
125621
126303
|
return { available: true, latency: Date.now() - start, details: { path: this.dataDir, writable: true } };
|
|
125622
126304
|
} catch (error51) {
|
|
125623
126305
|
return { available: false, latency: Date.now() - start, error: `Data directory error: ${error51.message}` };
|
|
@@ -128895,9 +129577,9 @@ var init_scheduler2 = __esm(() => {
|
|
|
128895
129577
|
});
|
|
128896
129578
|
|
|
128897
129579
|
// ../../packages/core/dist/services/pricing/models-dev-client.js
|
|
128898
|
-
import
|
|
129580
|
+
import fs16 from "fs/promises";
|
|
128899
129581
|
import { existsSync as existsSync4 } from "fs";
|
|
128900
|
-
import
|
|
129582
|
+
import path22 from "path";
|
|
128901
129583
|
function getModelsDevClient() {
|
|
128902
129584
|
if (!clientInstance) {
|
|
128903
129585
|
clientInstance = new ModelsDevClient;
|
|
@@ -128917,7 +129599,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
128917
129599
|
memoryCacheTimestamp = 0;
|
|
128918
129600
|
getLocalCachePath() {
|
|
128919
129601
|
const dataDir = config.get("dataDir");
|
|
128920
|
-
return
|
|
129602
|
+
return path22.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
|
|
128921
129603
|
}
|
|
128922
129604
|
async loadLocalCache() {
|
|
128923
129605
|
const cachePath = this.getLocalCachePath();
|
|
@@ -128925,7 +129607,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
128925
129607
|
if (!existsSync4(cachePath)) {
|
|
128926
129608
|
return null;
|
|
128927
129609
|
}
|
|
128928
|
-
const content = await
|
|
129610
|
+
const content = await fs16.readFile(cachePath, "utf-8");
|
|
128929
129611
|
const data = JSON.parse(content);
|
|
128930
129612
|
const age = Date.now() - data.timestamp;
|
|
128931
129613
|
if (age > ModelsDevClient.LOCAL_CACHE_TTL) {
|
|
@@ -128952,14 +129634,14 @@ var init_models_dev_client = __esm(() => {
|
|
|
128952
129634
|
async saveLocalCache(models) {
|
|
128953
129635
|
const cachePath = this.getLocalCachePath();
|
|
128954
129636
|
try {
|
|
128955
|
-
const dir =
|
|
128956
|
-
await
|
|
129637
|
+
const dir = path22.dirname(cachePath);
|
|
129638
|
+
await fs16.mkdir(dir, { recursive: true });
|
|
128957
129639
|
const data = {
|
|
128958
129640
|
timestamp: Date.now(),
|
|
128959
129641
|
version: "1.0.0",
|
|
128960
129642
|
models: Object.fromEntries(models)
|
|
128961
129643
|
};
|
|
128962
|
-
await
|
|
129644
|
+
await fs16.writeFile(cachePath, JSON.stringify(data), "utf-8");
|
|
128963
129645
|
logger.debug("Saved pricing to local cache", {
|
|
128964
129646
|
models: models.size,
|
|
128965
129647
|
path: cachePath
|
|
@@ -129288,7 +129970,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
129288
129970
|
const cachePath = this.getLocalCachePath();
|
|
129289
129971
|
try {
|
|
129290
129972
|
if (existsSync4(cachePath)) {
|
|
129291
|
-
await
|
|
129973
|
+
await fs16.unlink(cachePath);
|
|
129292
129974
|
logger.debug("Local pricing cache file deleted");
|
|
129293
129975
|
}
|
|
129294
129976
|
} catch (error51) {
|
|
@@ -129891,8 +130573,8 @@ function stripNul(content) {
|
|
|
129891
130573
|
}
|
|
129892
130574
|
|
|
129893
130575
|
// ../../packages/core/dist/services/etl/stages/discover.js
|
|
129894
|
-
import
|
|
129895
|
-
import
|
|
130576
|
+
import fs17 from "fs/promises";
|
|
130577
|
+
import path23 from "path";
|
|
129896
130578
|
import { createHash as createHash8 } from "crypto";
|
|
129897
130579
|
|
|
129898
130580
|
class DiscoverStage {
|
|
@@ -129918,7 +130600,7 @@ class DiscoverStage {
|
|
|
129918
130600
|
dot: false,
|
|
129919
130601
|
absolute: false
|
|
129920
130602
|
});
|
|
129921
|
-
relPaths = found.map((p) =>
|
|
130603
|
+
relPaths = found.map((p) => path23.isAbsolute(p) ? path23.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
|
|
129922
130604
|
}
|
|
129923
130605
|
if (ctx.resumeCursor?.path) {
|
|
129924
130606
|
const cursorPath = ctx.resumeCursor.path;
|
|
@@ -129977,10 +130659,10 @@ class DiscoverStage {
|
|
|
129977
130659
|
return discovered;
|
|
129978
130660
|
}
|
|
129979
130661
|
async processFile(ctx, relativePath, forceReindex) {
|
|
129980
|
-
const absolutePath =
|
|
130662
|
+
const absolutePath = path23.join(ctx.projectPath, relativePath);
|
|
129981
130663
|
try {
|
|
129982
|
-
const stat = await
|
|
129983
|
-
const content = stripNul(await
|
|
130664
|
+
const stat = await fs17.stat(absolutePath);
|
|
130665
|
+
const content = stripNul(await fs17.readFile(absolutePath, "utf-8"));
|
|
129984
130666
|
const contentHash = createHash8("sha256").update(content).digest("hex");
|
|
129985
130667
|
let needsReparse = forceReindex;
|
|
129986
130668
|
if (!forceReindex) {
|
|
@@ -130023,8 +130705,8 @@ class DiscoverStage {
|
|
|
130023
130705
|
ig.add(pattern);
|
|
130024
130706
|
}
|
|
130025
130707
|
try {
|
|
130026
|
-
const gitignorePath =
|
|
130027
|
-
const gitignoreContent = await
|
|
130708
|
+
const gitignorePath = path23.join(projectPath, ".gitignore");
|
|
130709
|
+
const gitignoreContent = await fs17.readFile(gitignorePath, "utf8");
|
|
130028
130710
|
const rules = gitignoreContent.split(`
|
|
130029
130711
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
130030
130712
|
ig.add(rules);
|
|
@@ -131379,8 +132061,8 @@ function rustUseLeaves(node, source, prefix = []) {
|
|
|
131379
132061
|
}
|
|
131380
132062
|
if (node.type === "use_wildcard")
|
|
131381
132063
|
return [{ path: [...prefix, "*"], glob: true }];
|
|
131382
|
-
const
|
|
131383
|
-
return
|
|
132064
|
+
const path24 = rustPathSegments(node, source);
|
|
132065
|
+
return path24.length ? [{ path: [...prefix, ...path24] }] : [];
|
|
131384
132066
|
}
|
|
131385
132067
|
function functionalCaptures(captures, source, family) {
|
|
131386
132068
|
if (family !== "clojure")
|
|
@@ -132352,8 +133034,8 @@ var init_structural_runtime = __esm(() => {
|
|
|
132352
133034
|
});
|
|
132353
133035
|
|
|
132354
133036
|
// ../../packages/core/dist/services/etl/stages/parse.js
|
|
132355
|
-
import
|
|
132356
|
-
import
|
|
133037
|
+
import path24 from "path";
|
|
133038
|
+
import fs18 from "fs/promises";
|
|
132357
133039
|
function resolveChunkerMaxChars() {
|
|
132358
133040
|
const global2 = Number(process.env.EMBEDDING_MAX_CHARS);
|
|
132359
133041
|
if (Number.isFinite(global2) && global2 > 0)
|
|
@@ -132381,8 +133063,8 @@ class ParseStage {
|
|
|
132381
133063
|
const results = new Map;
|
|
132382
133064
|
let processed = 0;
|
|
132383
133065
|
const phases = [
|
|
132384
|
-
files.filter((file2) =>
|
|
132385
|
-
files.filter((file2) =>
|
|
133066
|
+
files.filter((file2) => path24.extname(file2.relativePath).toLowerCase() !== ".h"),
|
|
133067
|
+
files.filter((file2) => path24.extname(file2.relativePath).toLowerCase() === ".h")
|
|
132386
133068
|
];
|
|
132387
133069
|
const batches = phases.flatMap((phase) => Array.from({ length: Math.ceil(phase.length / BATCH_SIZE) }, (_, index) => phase.slice(index * BATCH_SIZE, (index + 1) * BATCH_SIZE)));
|
|
132388
133070
|
for (const batch of batches) {
|
|
@@ -132420,19 +133102,19 @@ class ParseStage {
|
|
|
132420
133102
|
return files.map((file2) => results.get(file2.relativePath));
|
|
132421
133103
|
}
|
|
132422
133104
|
recordHeaderImporterEvidence(ctx, files, parsedFiles) {
|
|
132423
|
-
const knownHeaders = new Set(files.filter((file2) =>
|
|
133105
|
+
const knownHeaders = new Set(files.filter((file2) => path24.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path24.posix.normalize(file2.relativePath)));
|
|
132424
133106
|
const mutable = {
|
|
132425
133107
|
...ctx.structuralHeaderEvidenceByFile
|
|
132426
133108
|
};
|
|
132427
133109
|
for (const parsed of parsedFiles) {
|
|
132428
|
-
const extension =
|
|
133110
|
+
const extension = path24.extname(parsed.file.relativePath).toLowerCase();
|
|
132429
133111
|
const key = extension === ".c" ? "cImporters" : [".cpp", ".hpp"].includes(extension) ? "cppImporters" : undefined;
|
|
132430
133112
|
if (!key)
|
|
132431
133113
|
continue;
|
|
132432
133114
|
for (const imported of parsed.rawImports) {
|
|
132433
133115
|
if (!["c_include", "cpp_include"].includes(imported.form) || imported.specifier.startsWith("<"))
|
|
132434
133116
|
continue;
|
|
132435
|
-
const header =
|
|
133117
|
+
const header = path24.posix.normalize(path24.posix.join(path24.posix.dirname(parsed.file.relativePath), imported.specifier));
|
|
132436
133118
|
if (!knownHeaders.has(header))
|
|
132437
133119
|
continue;
|
|
132438
133120
|
const existing = mutable[header] ?? {};
|
|
@@ -132443,9 +133125,9 @@ class ParseStage {
|
|
|
132443
133125
|
}
|
|
132444
133126
|
async parseFile(ctx, file2) {
|
|
132445
133127
|
if (!file2.needsReparse) {
|
|
132446
|
-
const extension =
|
|
133128
|
+
const extension = path24.extname(file2.relativePath).toLowerCase();
|
|
132447
133129
|
if ([".c", ".cpp", ".hpp"].includes(extension)) {
|
|
132448
|
-
const content = file2.snapshotContent ?? await
|
|
133130
|
+
const content = file2.snapshotContent ?? await fs18.readFile(file2.absolutePath, "utf8");
|
|
132449
133131
|
const outcome = await this.runtime.parse({ extension, source: Buffer.from(content) });
|
|
132450
133132
|
if (outcome.status === "failed")
|
|
132451
133133
|
throw new StructuralEtlParseError(file2.relativePath, outcome.failureKind, `Structural evidence parse failed (${outcome.failureKind})`, outcome.diagnosticCount, outcome.diagnostics.slice(0, 10));
|
|
@@ -132457,8 +133139,8 @@ class ParseStage {
|
|
|
132457
133139
|
return { file: file2, chunks: [], symbols: [], rawImports: [], rawEdges: [] };
|
|
132458
133140
|
}
|
|
132459
133141
|
try {
|
|
132460
|
-
const content = file2.snapshotContent ?? await
|
|
132461
|
-
const ext2 =
|
|
133142
|
+
const content = file2.snapshotContent ?? await fs18.readFile(file2.absolutePath, "utf-8");
|
|
133143
|
+
const ext2 = path24.extname(file2.relativePath).toLowerCase();
|
|
132462
133144
|
const chunkerMaxChars = resolveChunkerMaxChars();
|
|
132463
133145
|
const chunks = smartChunk(content, file2.relativePath, chunkerMaxChars ? { maxChunkChars: chunkerMaxChars } : {});
|
|
132464
133146
|
let symbols;
|
|
@@ -133012,7 +133694,7 @@ var init_resolver = __esm(() => {
|
|
|
133012
133694
|
});
|
|
133013
133695
|
|
|
133014
133696
|
// ../../packages/core/dist/services/structural/resolvers/typescript.js
|
|
133015
|
-
import
|
|
133697
|
+
import path25 from "path";
|
|
133016
133698
|
function candidates(identities) {
|
|
133017
133699
|
return Object.freeze(identities.map((identity) => Object.freeze({
|
|
133018
133700
|
fqn: identity.fqn,
|
|
@@ -133107,7 +133789,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
133107
133789
|
const bases = /\.[cm]?jsx?$/u.test(base) ? [base.replace(/\.[cm]?jsx?$/u, ".ts"), base.replace(/\.[cm]?jsx?$/u, ".tsx"), base] : [base];
|
|
133108
133790
|
for (const candidateBase of bases)
|
|
133109
133791
|
for (const suffix of DIALECT_PROBES[dialect] ?? [""]) {
|
|
133110
|
-
const value =
|
|
133792
|
+
const value = path25.posix.normalize(`${candidateBase}${suffix}`);
|
|
133111
133793
|
if (!value.startsWith("../") && value !== ".." && known.has(value))
|
|
133112
133794
|
return value;
|
|
133113
133795
|
}
|
|
@@ -133116,7 +133798,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
133116
133798
|
function resolveStructuralSpecifier(specifier, fromFile, build, dialect = "typescript") {
|
|
133117
133799
|
const known = new Set(build.knownFiles.map(normalizeStructuralFile));
|
|
133118
133800
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
133119
|
-
return probe(
|
|
133801
|
+
return probe(path25.posix.join(path25.posix.dirname(fromFile), specifier), known, dialect);
|
|
133120
133802
|
}
|
|
133121
133803
|
const aliases = build.pathAliasesByFile?.[normalizeStructuralFile(fromFile)] ?? build.pathAliases ?? [];
|
|
133122
133804
|
for (const alias of aliases) {
|
|
@@ -133380,7 +134062,7 @@ var init_scripting2 = __esm(() => {
|
|
|
133380
134062
|
});
|
|
133381
134063
|
|
|
133382
134064
|
// ../../packages/core/dist/services/structural/resolvers/systems.js
|
|
133383
|
-
import
|
|
134065
|
+
import path26 from "path";
|
|
133384
134066
|
var DIALECTS, SYSTEMS_LANGUAGE_RESOLVER;
|
|
133385
134067
|
var init_systems2 = __esm(() => {
|
|
133386
134068
|
init_typescript2();
|
|
@@ -133399,7 +134081,7 @@ var init_systems2 = __esm(() => {
|
|
|
133399
134081
|
const bindings = item.bindings.map((binding) => binding.imported === "*" && binding.local === "*" && unresolvedTarget && !unresolvedTarget.qualifier ? { ...binding, imported: unresolvedTarget.name, local: unresolvedTarget.name } : binding);
|
|
133400
134082
|
if (item.specifier === "crate" || item.specifier.startsWith("crate/")) {
|
|
133401
134083
|
const crateRoot = file2.file.startsWith("src/") ? "src" : "";
|
|
133402
|
-
return { ...item, bindings, specifier: `./${
|
|
134084
|
+
return { ...item, bindings, specifier: `./${path26.posix.relative(path26.posix.dirname(file2.file), path26.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
|
|
133403
134085
|
}
|
|
133404
134086
|
if (item.specifier === "self" || item.specifier.startsWith("self/"))
|
|
133405
134087
|
return { ...item, bindings, specifier: `./${item.specifier.replace(/^self\/?/u, "")}` };
|
|
@@ -133497,8 +134179,8 @@ var init_data_document2 = __esm(() => {
|
|
|
133497
134179
|
});
|
|
133498
134180
|
|
|
133499
134181
|
// ../../packages/core/dist/services/etl/stages/resolve.js
|
|
133500
|
-
import
|
|
133501
|
-
import
|
|
134182
|
+
import path27 from "path";
|
|
134183
|
+
import fs19 from "fs";
|
|
133502
134184
|
|
|
133503
134185
|
class ResolveStage {
|
|
133504
134186
|
symbolRepository;
|
|
@@ -133522,7 +134204,7 @@ class ResolveStage {
|
|
|
133522
134204
|
const structuralDocuments = files.flatMap((file2) => {
|
|
133523
134205
|
if (!file2.structure)
|
|
133524
134206
|
return [];
|
|
133525
|
-
const language = resolveStructuralLanguage(
|
|
134207
|
+
const language = resolveStructuralLanguage(path27.extname(file2.file.relativePath));
|
|
133526
134208
|
if (language.status !== "supported")
|
|
133527
134209
|
throw new Error(`structural_manifest_missing:${file2.file.relativePath}`);
|
|
133528
134210
|
return [{
|
|
@@ -133534,13 +134216,13 @@ class ResolveStage {
|
|
|
133534
134216
|
}];
|
|
133535
134217
|
});
|
|
133536
134218
|
const currentStructuralFiles = new Set(structuralDocuments.map((document2) => document2.file));
|
|
133537
|
-
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
134219
|
+
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path27.extname(item.file.relativePath).toLowerCase())).map((item) => item.file.relativePath));
|
|
133538
134220
|
const pathAliasesByFile = Object.fromEntries([...knownRelPaths].map((file2) => [
|
|
133539
134221
|
file2,
|
|
133540
134222
|
this.structuralAliasesFor(file2, rootAliases, monorepoPackages)
|
|
133541
134223
|
]));
|
|
133542
134224
|
const buildMetadata = { knownFiles: [...knownRelPaths], pathAliasesByFile };
|
|
133543
|
-
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(
|
|
134225
|
+
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(path27.extname(definition.file_path).toLowerCase())).filter((definition) => knownRelPaths.has(definition.file_path) && skippedStructuralFiles.has(definition.file_path)).filter((definition) => !currentStructuralFiles.has(definition.file_path));
|
|
133544
134226
|
const seedIds = new Set;
|
|
133545
134227
|
for (const definition of seedRows) {
|
|
133546
134228
|
if (seedIds.has(definition.id))
|
|
@@ -133633,7 +134315,7 @@ class ResolveStage {
|
|
|
133633
134315
|
if (parsed.file !== definition.file_path) {
|
|
133634
134316
|
throw new Error(`structural_repository_seed_file_mismatch:${definition.id}`);
|
|
133635
134317
|
}
|
|
133636
|
-
const language = resolveStructuralLanguage(
|
|
134318
|
+
const language = resolveStructuralLanguage(path27.extname(definition.file_path));
|
|
133637
134319
|
if (language.status !== "supported")
|
|
133638
134320
|
throw new Error(`structural_repository_seed_language:${definition.id}`);
|
|
133639
134321
|
let identity;
|
|
@@ -133685,7 +134367,7 @@ class ResolveStage {
|
|
|
133685
134367
|
});
|
|
133686
134368
|
}
|
|
133687
134369
|
resolveFile(parsed, projectPath, knownRelPaths, rootAliases, monorepoPackages, symbolIndex, knownFqns) {
|
|
133688
|
-
const fromDir =
|
|
134370
|
+
const fromDir = path27.dirname(path27.join(projectPath, parsed.file.relativePath));
|
|
133689
134371
|
const packageAliases = this.getPackageAliases(parsed.file.relativePath, monorepoPackages);
|
|
133690
134372
|
const allAliases = [...packageAliases, ...rootAliases];
|
|
133691
134373
|
const resolvedImports = parsed.rawImports.map((raw2) => {
|
|
@@ -133756,7 +134438,7 @@ class ResolveStage {
|
|
|
133756
134438
|
index.set(def.name, `${def.file_path}#${def.name}`);
|
|
133757
134439
|
}
|
|
133758
134440
|
} catch (err) {
|
|
133759
|
-
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
134441
|
+
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path27.extname(file2.file.relativePath).toLowerCase()));
|
|
133760
134442
|
if (skippedStructural)
|
|
133761
134443
|
throw new Error("structural_repository_seed_failed", { cause: err });
|
|
133762
134444
|
logger.warn("buildSymbolIndex: repo seed failed, in-batch only", {
|
|
@@ -133780,7 +134462,7 @@ class ResolveStage {
|
|
|
133780
134462
|
}
|
|
133781
134463
|
resolveSpecifier(specifier, fromDir, projectPath, knownRelPaths, aliases) {
|
|
133782
134464
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
133783
|
-
const resolved = this.probeExtensions(
|
|
134465
|
+
const resolved = this.probeExtensions(path27.resolve(fromDir, specifier), projectPath, knownRelPaths);
|
|
133784
134466
|
return { resolvedPath: resolved, external: false };
|
|
133785
134467
|
}
|
|
133786
134468
|
for (const alias of aliases) {
|
|
@@ -133788,8 +134470,8 @@ class ResolveStage {
|
|
|
133788
134470
|
const suffix = specifier.slice(alias.prefix.length);
|
|
133789
134471
|
for (const target of alias.targets) {
|
|
133790
134472
|
const cleanTarget = target.replace(/\/\*$/, "");
|
|
133791
|
-
const basePath = alias.packagePath ?
|
|
133792
|
-
const absPath =
|
|
134473
|
+
const basePath = alias.packagePath ? path27.join(projectPath, alias.packagePath) : projectPath;
|
|
134474
|
+
const absPath = path27.join(basePath, cleanTarget + suffix);
|
|
133793
134475
|
const resolved = this.probeExtensions(absPath, projectPath, knownRelPaths);
|
|
133794
134476
|
if (resolved)
|
|
133795
134477
|
return { resolvedPath: resolved, external: false };
|
|
@@ -133805,7 +134487,7 @@ class ResolveStage {
|
|
|
133805
134487
|
...TS_EXTENSIONS.map((ext2) => absPath.replace(/\.[^.]+$/, ext2))
|
|
133806
134488
|
];
|
|
133807
134489
|
for (const candidate2 of candidates2) {
|
|
133808
|
-
const rel =
|
|
134490
|
+
const rel = path27.relative(projectPath, candidate2).replace(/\\/g, "/");
|
|
133809
134491
|
if (knownRelPaths.has(rel))
|
|
133810
134492
|
return rel;
|
|
133811
134493
|
}
|
|
@@ -133813,9 +134495,9 @@ class ResolveStage {
|
|
|
133813
134495
|
}
|
|
133814
134496
|
loadTsConfigPaths(projectPath, packageBase) {
|
|
133815
134497
|
const aliases = [];
|
|
133816
|
-
const tsconfigPath =
|
|
134498
|
+
const tsconfigPath = path27.join(projectPath, "tsconfig.json");
|
|
133817
134499
|
try {
|
|
133818
|
-
const raw2 =
|
|
134500
|
+
const raw2 = fs19.readFileSync(tsconfigPath, "utf-8");
|
|
133819
134501
|
const stripped = raw2.replace(/\/\/[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
133820
134502
|
const tsconfig = JSON.parse(stripped);
|
|
133821
134503
|
const paths = tsconfig?.compilerOptions?.paths ?? {};
|
|
@@ -133844,7 +134526,7 @@ class ResolveStage {
|
|
|
133844
134526
|
}
|
|
133845
134527
|
}
|
|
133846
134528
|
for (const packageRelPath of packagePaths) {
|
|
133847
|
-
const absPackagePath =
|
|
134529
|
+
const absPackagePath = path27.join(projectPath, packageRelPath);
|
|
133848
134530
|
const aliases = this.loadTsConfigPaths(absPackagePath, packageRelPath);
|
|
133849
134531
|
if (aliases.length > 0) {
|
|
133850
134532
|
packages.push({
|
|
@@ -133874,7 +134556,7 @@ class ResolveStage {
|
|
|
133874
134556
|
structuralAliasesFor(filePath, rootAliases, packages) {
|
|
133875
134557
|
return [...this.getPackageAliases(filePath, packages), ...rootAliases].map((alias) => ({
|
|
133876
134558
|
pattern: alias.prefix + (alias.targets.some((target) => target.includes("*")) ? "/*" : ""),
|
|
133877
|
-
targets: alias.targets.map((target) => alias.packagePath ?
|
|
134559
|
+
targets: alias.targets.map((target) => alias.packagePath ? path27.posix.join(alias.packagePath, target) : target)
|
|
133878
134560
|
}));
|
|
133879
134561
|
}
|
|
133880
134562
|
}
|
|
@@ -133938,7 +134620,7 @@ var init_with_deadlock_retry = __esm(() => {
|
|
|
133938
134620
|
});
|
|
133939
134621
|
|
|
133940
134622
|
// ../../packages/core/dist/services/etl/stages/load.js
|
|
133941
|
-
import
|
|
134623
|
+
import path28 from "path";
|
|
133942
134624
|
function formatDuration(ms) {
|
|
133943
134625
|
const totalSec = Math.max(0, Math.round(ms / 1000));
|
|
133944
134626
|
if (totalSec < 60)
|
|
@@ -134215,7 +134897,7 @@ class LoadStage {
|
|
|
134215
134897
|
const filePath = file2.file.relativePath;
|
|
134216
134898
|
const batch = buildSymbolPersistenceBatch(ctx.projectId, file2);
|
|
134217
134899
|
if (ctx.graphGenerationLease) {
|
|
134218
|
-
const manifest = getLanguageManifestEntry(
|
|
134900
|
+
const manifest = getLanguageManifestEntry(path28.extname(filePath));
|
|
134219
134901
|
const diagnostics2 = (file2.structuralDiagnostics ?? []).slice(0, 10).map((diagnostic2) => ({
|
|
134220
134902
|
code: diagnostic2.code,
|
|
134221
134903
|
severity: diagnostic2.severity,
|
|
@@ -134672,9 +135354,9 @@ var init_graph_generation_coordinator = __esm(() => {
|
|
|
134672
135354
|
// ../../packages/core/dist/services/etl/pipeline.js
|
|
134673
135355
|
import { createHash as createHash10 } from "crypto";
|
|
134674
135356
|
import { setTimeout as delay2 } from "timers/promises";
|
|
134675
|
-
import
|
|
135357
|
+
import path29 from "path";
|
|
134676
135358
|
function buildHeaderLanguageEvidence(files) {
|
|
134677
|
-
const headers = new Set(files.filter((file2) =>
|
|
135359
|
+
const headers = new Set(files.filter((file2) => path29.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path29.posix.normalize(file2.relativePath)));
|
|
134678
135360
|
const mutable = new Map;
|
|
134679
135361
|
const entry2 = (header) => {
|
|
134680
135362
|
let value = mutable.get(header);
|
|
@@ -134685,7 +135367,7 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
134685
135367
|
return value;
|
|
134686
135368
|
};
|
|
134687
135369
|
for (const file2 of files) {
|
|
134688
|
-
if (
|
|
135370
|
+
if (path29.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
|
|
134689
135371
|
continue;
|
|
134690
135372
|
let commands;
|
|
134691
135373
|
try {
|
|
@@ -134701,11 +135383,11 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
134701
135383
|
const record2 = command;
|
|
134702
135384
|
if (typeof record2.file !== "string")
|
|
134703
135385
|
continue;
|
|
134704
|
-
const projectRoot =
|
|
134705
|
-
const commandDirectory = typeof record2.directory === "string" ?
|
|
134706
|
-
const absoluteInput =
|
|
134707
|
-
const relative3 =
|
|
134708
|
-
const header =
|
|
135386
|
+
const projectRoot = path29.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
|
|
135387
|
+
const commandDirectory = typeof record2.directory === "string" ? path29.resolve(projectRoot, record2.directory) : projectRoot;
|
|
135388
|
+
const absoluteInput = path29.resolve(commandDirectory, record2.file);
|
|
135389
|
+
const relative3 = path29.relative(projectRoot, absoluteInput);
|
|
135390
|
+
const header = path29.posix.normalize(relative3.replaceAll(path29.sep, "/"));
|
|
134709
135391
|
if (!headers.has(header))
|
|
134710
135392
|
continue;
|
|
134711
135393
|
const invocation = typeof record2.command === "string" ? record2.command : Array.isArray(record2.arguments) ? record2.arguments.join(" ") : "";
|
|
@@ -140571,33 +141253,33 @@ var require_URL = __commonJS((exports, module) => {
|
|
|
140571
141253
|
else
|
|
140572
141254
|
return basepath.substring(0, lastslash + 1) + refpath;
|
|
140573
141255
|
}
|
|
140574
|
-
function remove_dot_segments(
|
|
140575
|
-
if (!
|
|
140576
|
-
return
|
|
141256
|
+
function remove_dot_segments(path30) {
|
|
141257
|
+
if (!path30)
|
|
141258
|
+
return path30;
|
|
140577
141259
|
var output = "";
|
|
140578
|
-
while (
|
|
140579
|
-
if (
|
|
140580
|
-
|
|
141260
|
+
while (path30.length > 0) {
|
|
141261
|
+
if (path30 === "." || path30 === "..") {
|
|
141262
|
+
path30 = "";
|
|
140581
141263
|
break;
|
|
140582
141264
|
}
|
|
140583
|
-
var twochars =
|
|
140584
|
-
var threechars =
|
|
140585
|
-
var fourchars =
|
|
141265
|
+
var twochars = path30.substring(0, 2);
|
|
141266
|
+
var threechars = path30.substring(0, 3);
|
|
141267
|
+
var fourchars = path30.substring(0, 4);
|
|
140586
141268
|
if (threechars === "../") {
|
|
140587
|
-
|
|
141269
|
+
path30 = path30.substring(3);
|
|
140588
141270
|
} else if (twochars === "./") {
|
|
140589
|
-
|
|
141271
|
+
path30 = path30.substring(2);
|
|
140590
141272
|
} else if (threechars === "/./") {
|
|
140591
|
-
|
|
140592
|
-
} else if (twochars === "/." &&
|
|
140593
|
-
|
|
140594
|
-
} else if (fourchars === "/../" || threechars === "/.." &&
|
|
140595
|
-
|
|
141273
|
+
path30 = "/" + path30.substring(3);
|
|
141274
|
+
} else if (twochars === "/." && path30.length === 2) {
|
|
141275
|
+
path30 = "/";
|
|
141276
|
+
} else if (fourchars === "/../" || threechars === "/.." && path30.length === 3) {
|
|
141277
|
+
path30 = "/" + path30.substring(4);
|
|
140596
141278
|
output = output.replace(/\/?[^\/]*$/, "");
|
|
140597
141279
|
} else {
|
|
140598
|
-
var segment =
|
|
141280
|
+
var segment = path30.match(/(\/?([^\/]*))/)[0];
|
|
140599
141281
|
output += segment;
|
|
140600
|
-
|
|
141282
|
+
path30 = path30.substring(segment.length);
|
|
140601
141283
|
}
|
|
140602
141284
|
}
|
|
140603
141285
|
return output;
|
|
@@ -152667,21 +153349,21 @@ function jsonToKeyPathChunks(value, label = "$") {
|
|
|
152667
153349
|
walk(value, label, out);
|
|
152668
153350
|
return out;
|
|
152669
153351
|
}
|
|
152670
|
-
function walk(val,
|
|
153352
|
+
function walk(val, path30, out) {
|
|
152671
153353
|
if (val === null || val === undefined)
|
|
152672
153354
|
return;
|
|
152673
153355
|
if (Array.isArray(val)) {
|
|
152674
153356
|
if (val.length === 0) {
|
|
152675
|
-
out.push({ path:
|
|
153357
|
+
out.push({ path: path30, content: `**${path30}** = _[]_` });
|
|
152676
153358
|
return;
|
|
152677
153359
|
}
|
|
152678
153360
|
if (val.every((v) => v !== null && typeof v === "object")) {
|
|
152679
|
-
val.forEach((v, i) => walk(v, `${
|
|
153361
|
+
val.forEach((v, i) => walk(v, `${path30}[${i}]`, out));
|
|
152680
153362
|
return;
|
|
152681
153363
|
}
|
|
152682
153364
|
const items = val.map((v) => `- \`${String(v)}\``).join(`
|
|
152683
153365
|
`);
|
|
152684
|
-
out.push({ path:
|
|
153366
|
+
out.push({ path: path30, content: `**${path30}**
|
|
152685
153367
|
|
|
152686
153368
|
${items}` });
|
|
152687
153369
|
return;
|
|
@@ -152689,16 +153371,16 @@ ${items}` });
|
|
|
152689
153371
|
if (typeof val === "object") {
|
|
152690
153372
|
const entries = Object.entries(val);
|
|
152691
153373
|
if (entries.length === 0) {
|
|
152692
|
-
out.push({ path:
|
|
153374
|
+
out.push({ path: path30, content: `**${path30}** = _{}_` });
|
|
152693
153375
|
return;
|
|
152694
153376
|
}
|
|
152695
153377
|
for (const [k, v] of entries) {
|
|
152696
153378
|
const safeKey = /^[A-Za-z_$][\w$]*$/.test(k) ? k : JSON.stringify(k);
|
|
152697
|
-
walk(v, `${
|
|
153379
|
+
walk(v, `${path30}.${safeKey}`, out);
|
|
152698
153380
|
}
|
|
152699
153381
|
return;
|
|
152700
153382
|
}
|
|
152701
|
-
out.push({ path:
|
|
153383
|
+
out.push({ path: path30, content: `**${path30}** = \`${String(val)}\`` });
|
|
152702
153384
|
}
|
|
152703
153385
|
var gfm, STRIP_SELECTORS, tdCache = null;
|
|
152704
153386
|
var init_html_to_md = __esm(() => {
|
|
@@ -153122,6 +153804,8 @@ var init_recover_project = __esm(() => {
|
|
|
153122
153804
|
// src/config-cli.ts
|
|
153123
153805
|
init_config();
|
|
153124
153806
|
init_dist();
|
|
153807
|
+
import os8 from "os";
|
|
153808
|
+
import path30 from "path";
|
|
153125
153809
|
var GENERATOR_MARKER = "scripts/generate-subagent-artifacts.ts";
|
|
153126
153810
|
var GENERATOR_MARKER_MAX_LEVELS = 6;
|
|
153127
153811
|
function formatVariantSync(results) {
|
|
@@ -153161,6 +153845,13 @@ Commands:
|
|
|
153161
153845
|
profile set <name> [--host <h>] [--dry-run]
|
|
153162
153846
|
Switch installed agents to a profile (restart required after)
|
|
153163
153847
|
|
|
153848
|
+
bootstrap list List every startup-contract rule: state, default, description
|
|
153849
|
+
bootstrap show Same as 'bootstrap list'
|
|
153850
|
+
bootstrap enable <rule-id> [--target <dir> --yes] [--dry-run]
|
|
153851
|
+
bootstrap disable <rule-id> [--target <dir> --yes] [--dry-run]
|
|
153852
|
+
Toggle one rule and re-render MASSA-AI.md for every
|
|
153853
|
+
recorded host (restart required after)
|
|
153854
|
+
|
|
153164
153855
|
Examples:
|
|
153165
153856
|
massa-ai-config init
|
|
153166
153857
|
massa-ai-config init --mistral your-api-key
|
|
@@ -153169,6 +153860,8 @@ Examples:
|
|
|
153169
153860
|
massa-ai-config set embedding.dimensions 1024
|
|
153170
153861
|
massa-ai-config recover my-project --path /home/user/renamed-dir
|
|
153171
153862
|
massa-ai-config profile set work --dry-run
|
|
153863
|
+
massa-ai-config bootstrap list
|
|
153864
|
+
massa-ai-config bootstrap disable caveman
|
|
153172
153865
|
`);
|
|
153173
153866
|
}
|
|
153174
153867
|
function parseOptions(args) {
|
|
@@ -153392,6 +154085,62 @@ Using defaults:`);
|
|
|
153392
154085
|
console.error("Usage: massa-ai-config profile <list|show|set> ...");
|
|
153393
154086
|
return 1;
|
|
153394
154087
|
}
|
|
154088
|
+
case "bootstrap": {
|
|
154089
|
+
const subcommand = args[1];
|
|
154090
|
+
if (subcommand === "list" || subcommand === "show") {
|
|
154091
|
+
try {
|
|
154092
|
+
console.log(formatBootstrapInventory(resolveBootstrapState().state));
|
|
154093
|
+
} catch (e) {
|
|
154094
|
+
console.error(`Error: ${e.message}`);
|
|
154095
|
+
return 1;
|
|
154096
|
+
}
|
|
154097
|
+
return 0;
|
|
154098
|
+
}
|
|
154099
|
+
if (subcommand === "enable" || subcommand === "disable") {
|
|
154100
|
+
const ruleId = args[2];
|
|
154101
|
+
if (!ruleId) {
|
|
154102
|
+
console.error("Usage: massa-ai-config bootstrap <enable|disable> <rule-id> [--target <dir> --yes] [--dry-run]");
|
|
154103
|
+
return 1;
|
|
154104
|
+
}
|
|
154105
|
+
try {
|
|
154106
|
+
assertKnownRuleId(ruleId);
|
|
154107
|
+
} catch (e) {
|
|
154108
|
+
console.error(`Error: ${e.message}`);
|
|
154109
|
+
return 1;
|
|
154110
|
+
}
|
|
154111
|
+
const targetOpt = typeof options.target === "string" ? options.target : undefined;
|
|
154112
|
+
const targetHome = targetOpt === undefined ? os8.homedir() : path30.resolve(targetOpt);
|
|
154113
|
+
if (targetHome !== os8.homedir() && options.yes !== true) {
|
|
154114
|
+
console.error(`Error: --target ${targetHome} is not your home (${os8.homedir()}) \u2014 pass --yes to confirm writing there`);
|
|
154115
|
+
return 1;
|
|
154116
|
+
}
|
|
154117
|
+
const dryRun = options["dry-run"] === true;
|
|
154118
|
+
try {
|
|
154119
|
+
if (dryRun) {
|
|
154120
|
+
console.log(`bootstrap ${subcommand} ${ruleId}: dry run \u2014 ${getConfigPath()} was not written`);
|
|
154121
|
+
} else {
|
|
154122
|
+
setBootstrapRuleEnabled(ruleId, subcommand === "enable");
|
|
154123
|
+
}
|
|
154124
|
+
const stateFile = bootstrapStateFilePath(targetHome);
|
|
154125
|
+
if (stateFile !== getConfigPath()) {
|
|
154126
|
+
console.error(`Warning: the rule state is persisted to ${getConfigPath()}, but --target renders from ${stateFile} \u2014 set XDG_CONFIG_HOME to move the persisted state`);
|
|
154127
|
+
}
|
|
154128
|
+
const repoRoot = findRepoRootWithMarker(import.meta.dirname, GENERATOR_MARKER, GENERATOR_MARKER_MAX_LEVELS);
|
|
154129
|
+
const report = applyBootstrapState({
|
|
154130
|
+
targetHome,
|
|
154131
|
+
dryRun,
|
|
154132
|
+
sourcePath: repoRoot === null ? undefined : path30.join(repoRoot, "skills", "AGENTS.md")
|
|
154133
|
+
});
|
|
154134
|
+
console.log(formatBootstrapReport(report));
|
|
154135
|
+
return bootstrapReportSucceeded(report) ? 0 : 1;
|
|
154136
|
+
} catch (e) {
|
|
154137
|
+
console.error(`Error: ${e.message}`);
|
|
154138
|
+
return 1;
|
|
154139
|
+
}
|
|
154140
|
+
}
|
|
154141
|
+
console.error("Usage: massa-ai-config bootstrap <list|show|enable|disable> ...");
|
|
154142
|
+
return 1;
|
|
154143
|
+
}
|
|
153395
154144
|
default:
|
|
153396
154145
|
console.error(`Unknown command: ${command}`);
|
|
153397
154146
|
help();
|