evil-omo 3.11.7 → 3.12.2
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/cli/config-manager/bun-install.d.ts +2 -0
- package/dist/cli/index.js +302 -182
- package/dist/config/schema/background-task.d.ts +6 -0
- package/dist/config/schema/evil-omo-config.d.ts +6 -0
- package/dist/config/schema/hooks.d.ts +1 -0
- package/dist/create-hooks.d.ts +1 -0
- package/dist/evil-omo.schema.json +24 -0
- package/dist/features/background-agent/constants.d.ts +5 -1
- package/dist/features/background-agent/loop-detector.d.ts +16 -0
- package/dist/features/background-agent/manager.d.ts +1 -0
- package/dist/features/background-agent/session-status-classifier.d.ts +2 -0
- package/dist/features/background-agent/types.d.ts +7 -0
- package/dist/features/builtin-commands/templates/start-work.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/ralph-loop/pending-verification-handler.d.ts +1 -0
- package/dist/hooks/todo-continuation-enforcer/session-state.d.ts +1 -1
- package/dist/hooks/todo-description-override/description.d.ts +1 -0
- package/dist/hooks/todo-description-override/hook.d.ts +8 -0
- package/dist/hooks/todo-description-override/index.d.ts +1 -0
- package/dist/index.js +988 -509
- package/dist/plugin/hooks/create-core-hooks.d.ts +1 -0
- package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +2 -1
- package/dist/shared/connected-providers-cache.d.ts +26 -29
- package/dist/shared/plugin-identity.d.ts +2 -1
- package/dist/shared/shell-env.d.ts +27 -0
- package/dist/tools/delegate-task/model-selection.d.ts +2 -0
- package/dist/tools/hashline-edit/tool-description.d.ts +1 -1
- package/dist/tools/look-at/constants.d.ts +1 -1
- package/package.json +12 -12
package/dist/cli/index.js
CHANGED
|
@@ -5837,10 +5837,10 @@ function detectManagedConfigFile(directory) {
|
|
|
5837
5837
|
baseName: CONFIG_BASENAME
|
|
5838
5838
|
};
|
|
5839
5839
|
}
|
|
5840
|
-
var PLUGIN_NAME = "evil-omo", ALL_PLUGIN_NAMES, CONFIG_BASENAME = "evil-omo", ALL_CONFIG_BASENAMES, LOG_FILENAME = "evil-omo.log", CACHE_DIR_NAME = "evil-omo", SCHEMA_FILENAME = "evil-omo.schema.json";
|
|
5840
|
+
var PLUGIN_NAME = "evil-omo", LEGACY_PLUGIN_NAME = "oh-my-opencode", ALL_PLUGIN_NAMES, CONFIG_BASENAME = "evil-omo", ALL_CONFIG_BASENAMES, LOG_FILENAME = "evil-omo.log", CACHE_DIR_NAME = "evil-omo", SCHEMA_FILENAME = "evil-omo.schema.json";
|
|
5841
5841
|
var init_plugin_identity = __esm(() => {
|
|
5842
5842
|
init_jsonc_parser();
|
|
5843
|
-
ALL_PLUGIN_NAMES = [PLUGIN_NAME];
|
|
5843
|
+
ALL_PLUGIN_NAMES = [PLUGIN_NAME, LEGACY_PLUGIN_NAME];
|
|
5844
5844
|
ALL_CONFIG_BASENAMES = [CONFIG_BASENAME];
|
|
5845
5845
|
});
|
|
5846
5846
|
|
|
@@ -5903,6 +5903,12 @@ var init_snake_case = __esm(() => {
|
|
|
5903
5903
|
|
|
5904
5904
|
// src/shared/tool-name.ts
|
|
5905
5905
|
var init_tool_name = () => {};
|
|
5906
|
+
|
|
5907
|
+
// src/shared/pattern-matcher.ts
|
|
5908
|
+
var regexCache;
|
|
5909
|
+
var init_pattern_matcher = __esm(() => {
|
|
5910
|
+
regexCache = new Map;
|
|
5911
|
+
});
|
|
5906
5912
|
// src/shared/file-utils.ts
|
|
5907
5913
|
var init_file_utils = () => {};
|
|
5908
5914
|
|
|
@@ -6660,85 +6666,160 @@ var init_agent_tool_restrictions = () => {};
|
|
|
6660
6666
|
// src/shared/connected-providers-cache.ts
|
|
6661
6667
|
import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync } from "fs";
|
|
6662
6668
|
import { join as join5 } from "path";
|
|
6663
|
-
function
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6669
|
+
function createConnectedProvidersCacheStore(getCacheDir2 = getOmoOpenCodeCacheDir) {
|
|
6670
|
+
function getCacheFilePath(filename) {
|
|
6671
|
+
return join5(getCacheDir2(), filename);
|
|
6672
|
+
}
|
|
6673
|
+
let memConnected;
|
|
6674
|
+
let memProviderModels;
|
|
6675
|
+
function ensureCacheDir() {
|
|
6676
|
+
const cacheDir = getCacheDir2();
|
|
6677
|
+
if (!existsSync3(cacheDir)) {
|
|
6678
|
+
mkdirSync(cacheDir, { recursive: true });
|
|
6679
|
+
}
|
|
6680
|
+
}
|
|
6681
|
+
function readConnectedProvidersCache() {
|
|
6682
|
+
if (memConnected !== undefined)
|
|
6683
|
+
return memConnected;
|
|
6684
|
+
const cacheFile = getCacheFilePath(CONNECTED_PROVIDERS_CACHE_FILE);
|
|
6685
|
+
if (!existsSync3(cacheFile)) {
|
|
6686
|
+
log("[connected-providers-cache] Cache file not found", { cacheFile });
|
|
6687
|
+
memConnected = null;
|
|
6688
|
+
return null;
|
|
6689
|
+
}
|
|
6690
|
+
try {
|
|
6691
|
+
const content = readFileSync2(cacheFile, "utf-8");
|
|
6692
|
+
const data = JSON.parse(content);
|
|
6693
|
+
log("[connected-providers-cache] Read cache", { count: data.connected.length, updatedAt: data.updatedAt });
|
|
6694
|
+
memConnected = data.connected;
|
|
6695
|
+
return data.connected;
|
|
6696
|
+
} catch (err) {
|
|
6697
|
+
log("[connected-providers-cache] Error reading cache", { error: String(err) });
|
|
6698
|
+
memConnected = null;
|
|
6699
|
+
return null;
|
|
6700
|
+
}
|
|
6670
6701
|
}
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
const cacheFile = getCacheFilePath(CONNECTED_PROVIDERS_CACHE_FILE);
|
|
6675
|
-
const data = {
|
|
6676
|
-
connected,
|
|
6677
|
-
updatedAt: new Date().toISOString()
|
|
6678
|
-
};
|
|
6679
|
-
try {
|
|
6680
|
-
writeFileSync2(cacheFile, JSON.stringify(data, null, 2));
|
|
6681
|
-
log("[connected-providers-cache] Cache written", { count: connected.length });
|
|
6682
|
-
} catch (err) {
|
|
6683
|
-
log("[connected-providers-cache] Error writing cache", { error: String(err) });
|
|
6702
|
+
function hasConnectedProvidersCache() {
|
|
6703
|
+
const cacheFile = getCacheFilePath(CONNECTED_PROVIDERS_CACHE_FILE);
|
|
6704
|
+
return existsSync3(cacheFile);
|
|
6684
6705
|
}
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
log("[connected-providers-cache] Provider-models cache written", {
|
|
6700
|
-
providerCount: Object.keys(data.models).length
|
|
6701
|
-
});
|
|
6702
|
-
} catch (err) {
|
|
6703
|
-
log("[connected-providers-cache] Error writing provider-models cache", { error: String(err) });
|
|
6706
|
+
function writeConnectedProvidersCache(connected) {
|
|
6707
|
+
ensureCacheDir();
|
|
6708
|
+
const cacheFile = getCacheFilePath(CONNECTED_PROVIDERS_CACHE_FILE);
|
|
6709
|
+
const data = {
|
|
6710
|
+
connected,
|
|
6711
|
+
updatedAt: new Date().toISOString()
|
|
6712
|
+
};
|
|
6713
|
+
try {
|
|
6714
|
+
writeFileSync2(cacheFile, JSON.stringify(data, null, 2));
|
|
6715
|
+
memConnected = connected;
|
|
6716
|
+
log("[connected-providers-cache] Cache written", { count: connected.length });
|
|
6717
|
+
} catch (err) {
|
|
6718
|
+
log("[connected-providers-cache] Error writing cache", { error: String(err) });
|
|
6719
|
+
}
|
|
6704
6720
|
}
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6721
|
+
function readProviderModelsCache() {
|
|
6722
|
+
if (memProviderModels !== undefined)
|
|
6723
|
+
return memProviderModels;
|
|
6724
|
+
const cacheFile = getCacheFilePath(PROVIDER_MODELS_CACHE_FILE);
|
|
6725
|
+
if (!existsSync3(cacheFile)) {
|
|
6726
|
+
log("[connected-providers-cache] Provider-models cache file not found", { cacheFile });
|
|
6727
|
+
memProviderModels = null;
|
|
6728
|
+
return null;
|
|
6729
|
+
}
|
|
6730
|
+
try {
|
|
6731
|
+
const content = readFileSync2(cacheFile, "utf-8");
|
|
6732
|
+
const data = JSON.parse(content);
|
|
6733
|
+
log("[connected-providers-cache] Read provider-models cache", {
|
|
6734
|
+
providerCount: Object.keys(data.models).length,
|
|
6735
|
+
updatedAt: data.updatedAt
|
|
6736
|
+
});
|
|
6737
|
+
memProviderModels = data;
|
|
6738
|
+
return data;
|
|
6739
|
+
} catch (err) {
|
|
6740
|
+
log("[connected-providers-cache] Error reading provider-models cache", { error: String(err) });
|
|
6741
|
+
memProviderModels = null;
|
|
6742
|
+
return null;
|
|
6743
|
+
}
|
|
6710
6744
|
}
|
|
6711
|
-
|
|
6712
|
-
const
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
const
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6745
|
+
function hasProviderModelsCache() {
|
|
6746
|
+
const cacheFile = getCacheFilePath(PROVIDER_MODELS_CACHE_FILE);
|
|
6747
|
+
return existsSync3(cacheFile);
|
|
6748
|
+
}
|
|
6749
|
+
function writeProviderModelsCache(data) {
|
|
6750
|
+
ensureCacheDir();
|
|
6751
|
+
const cacheFile = getCacheFilePath(PROVIDER_MODELS_CACHE_FILE);
|
|
6752
|
+
const cacheData = {
|
|
6753
|
+
...data,
|
|
6754
|
+
updatedAt: new Date().toISOString()
|
|
6755
|
+
};
|
|
6756
|
+
try {
|
|
6757
|
+
writeFileSync2(cacheFile, JSON.stringify(cacheData, null, 2));
|
|
6758
|
+
memProviderModels = cacheData;
|
|
6759
|
+
log("[connected-providers-cache] Provider-models cache written", {
|
|
6760
|
+
providerCount: Object.keys(data.models).length
|
|
6761
|
+
});
|
|
6762
|
+
} catch (err) {
|
|
6763
|
+
log("[connected-providers-cache] Error writing provider-models cache", { error: String(err) });
|
|
6764
|
+
}
|
|
6765
|
+
}
|
|
6766
|
+
async function updateConnectedProvidersCache(client) {
|
|
6767
|
+
if (!client?.provider?.list) {
|
|
6768
|
+
log("[connected-providers-cache] client.provider.list not available");
|
|
6769
|
+
return;
|
|
6770
|
+
}
|
|
6771
|
+
try {
|
|
6772
|
+
const result = await client.provider.list();
|
|
6773
|
+
const connected = result.data?.connected ?? [];
|
|
6774
|
+
log("[connected-providers-cache] Fetched connected providers", {
|
|
6775
|
+
count: connected.length,
|
|
6776
|
+
providers: connected
|
|
6777
|
+
});
|
|
6778
|
+
writeConnectedProvidersCache(connected);
|
|
6779
|
+
const modelsByProvider = {};
|
|
6780
|
+
const allProviders = result.data?.all ?? [];
|
|
6781
|
+
for (const provider of allProviders) {
|
|
6782
|
+
if (provider.models) {
|
|
6783
|
+
const modelIds = Object.keys(provider.models);
|
|
6784
|
+
if (modelIds.length > 0) {
|
|
6785
|
+
modelsByProvider[provider.id] = modelIds;
|
|
6786
|
+
}
|
|
6787
|
+
}
|
|
6788
|
+
}
|
|
6789
|
+
log("[connected-providers-cache] Extracted models from provider list", {
|
|
6790
|
+
providerCount: Object.keys(modelsByProvider).length,
|
|
6791
|
+
totalModels: Object.values(modelsByProvider).reduce((sum, ids) => sum + ids.length, 0)
|
|
6792
|
+
});
|
|
6793
|
+
writeProviderModelsCache({
|
|
6794
|
+
models: modelsByProvider,
|
|
6795
|
+
connected
|
|
6796
|
+
});
|
|
6797
|
+
} catch (err) {
|
|
6798
|
+
log("[connected-providers-cache] Error updating cache", { error: String(err) });
|
|
6799
|
+
}
|
|
6736
6800
|
}
|
|
6801
|
+
return {
|
|
6802
|
+
readConnectedProvidersCache,
|
|
6803
|
+
hasConnectedProvidersCache,
|
|
6804
|
+
readProviderModelsCache,
|
|
6805
|
+
hasProviderModelsCache,
|
|
6806
|
+
writeProviderModelsCache,
|
|
6807
|
+
updateConnectedProvidersCache
|
|
6808
|
+
};
|
|
6737
6809
|
}
|
|
6738
|
-
var CONNECTED_PROVIDERS_CACHE_FILE = "connected-providers.json", PROVIDER_MODELS_CACHE_FILE = "provider-models.json";
|
|
6810
|
+
var CONNECTED_PROVIDERS_CACHE_FILE = "connected-providers.json", PROVIDER_MODELS_CACHE_FILE = "provider-models.json", defaultConnectedProvidersCacheStore, readConnectedProvidersCache, hasConnectedProvidersCache, readProviderModelsCache, hasProviderModelsCache, writeProviderModelsCache, updateConnectedProvidersCache;
|
|
6739
6811
|
var init_connected_providers_cache = __esm(() => {
|
|
6740
6812
|
init_logger();
|
|
6741
6813
|
init_data_path();
|
|
6814
|
+
defaultConnectedProvidersCacheStore = createConnectedProvidersCacheStore(() => getOmoOpenCodeCacheDir());
|
|
6815
|
+
({
|
|
6816
|
+
readConnectedProvidersCache,
|
|
6817
|
+
hasConnectedProvidersCache,
|
|
6818
|
+
readProviderModelsCache,
|
|
6819
|
+
hasProviderModelsCache,
|
|
6820
|
+
writeProviderModelsCache,
|
|
6821
|
+
updateConnectedProvidersCache
|
|
6822
|
+
} = defaultConnectedProvidersCacheStore);
|
|
6742
6823
|
});
|
|
6743
6824
|
|
|
6744
6825
|
// src/shared/model-availability.ts
|
|
@@ -7104,6 +7185,7 @@ var init_shared = __esm(() => {
|
|
|
7104
7185
|
init_logger();
|
|
7105
7186
|
init_snake_case();
|
|
7106
7187
|
init_tool_name();
|
|
7188
|
+
init_pattern_matcher();
|
|
7107
7189
|
init_deep_merge();
|
|
7108
7190
|
init_file_utils();
|
|
7109
7191
|
init_dynamic_truncator();
|
|
@@ -7894,7 +7976,7 @@ function logCapturedOutputOnFailure(outputMode, output) {
|
|
|
7894
7976
|
}
|
|
7895
7977
|
async function runBunInstallWithDetails(options) {
|
|
7896
7978
|
const outputMode = options?.outputMode ?? "pipe";
|
|
7897
|
-
const cacheDir = getOpenCodeCacheDir();
|
|
7979
|
+
const cacheDir = options?.workspaceDir ?? getOpenCodeCacheDir();
|
|
7898
7980
|
const packageJsonPath = `${cacheDir}/package.json`;
|
|
7899
7981
|
if (!existsSync9(packageJsonPath)) {
|
|
7900
7982
|
return {
|
|
@@ -8568,12 +8650,30 @@ var init_update_toasts = __esm(() => {
|
|
|
8568
8650
|
});
|
|
8569
8651
|
|
|
8570
8652
|
// src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
8653
|
+
import { existsSync as existsSync20 } from "fs";
|
|
8654
|
+
import { join as join18 } from "path";
|
|
8571
8655
|
function getPinnedVersionToastMessage(latestVersion) {
|
|
8572
8656
|
return `Update available: ${latestVersion} (version pinned, update manually)`;
|
|
8573
8657
|
}
|
|
8574
|
-
|
|
8658
|
+
function resolveActiveInstallWorkspace() {
|
|
8659
|
+
const configPaths = getOpenCodeConfigPaths({ binary: "opencode" });
|
|
8660
|
+
const cacheDir = getOpenCodeCacheDir();
|
|
8661
|
+
const configInstallPath = join18(configPaths.configDir, "node_modules", PACKAGE_NAME2, "package.json");
|
|
8662
|
+
const cacheInstallPath = join18(cacheDir, "node_modules", PACKAGE_NAME2, "package.json");
|
|
8663
|
+
if (existsSync20(configInstallPath)) {
|
|
8664
|
+
log(`[auto-update-checker] Active workspace: config-dir (${configPaths.configDir})`);
|
|
8665
|
+
return configPaths.configDir;
|
|
8666
|
+
}
|
|
8667
|
+
if (existsSync20(cacheInstallPath)) {
|
|
8668
|
+
log(`[auto-update-checker] Active workspace: cache-dir (${cacheDir})`);
|
|
8669
|
+
return cacheDir;
|
|
8670
|
+
}
|
|
8671
|
+
log(`[auto-update-checker] Active workspace: config-dir (default, no install detected)`);
|
|
8672
|
+
return configPaths.configDir;
|
|
8673
|
+
}
|
|
8674
|
+
async function runBunInstallSafe(workspaceDir) {
|
|
8575
8675
|
try {
|
|
8576
|
-
const result = await runBunInstallWithDetails({ outputMode: "pipe" });
|
|
8676
|
+
const result = await runBunInstallWithDetails({ outputMode: "pipe", workspaceDir });
|
|
8577
8677
|
if (!result.success && result.error) {
|
|
8578
8678
|
log("[auto-update-checker] bun install error:", result.error);
|
|
8579
8679
|
}
|
|
@@ -8624,7 +8724,8 @@ async function runBackgroundUpdateCheck(ctx, autoUpdate, getToastMessage) {
|
|
|
8624
8724
|
return;
|
|
8625
8725
|
}
|
|
8626
8726
|
invalidatePackage(PACKAGE_NAME2);
|
|
8627
|
-
const
|
|
8727
|
+
const activeWorkspace = resolveActiveInstallWorkspace();
|
|
8728
|
+
const installSuccess = await runBunInstallSafe(activeWorkspace);
|
|
8628
8729
|
if (installSuccess) {
|
|
8629
8730
|
await showAutoUpdatedToast(ctx, currentVersion, latestVersion);
|
|
8630
8731
|
log(`[auto-update-checker] Update installed: ${currentVersion} \u2192 ${latestVersion}`);
|
|
@@ -8636,6 +8737,7 @@ async function runBackgroundUpdateCheck(ctx, autoUpdate, getToastMessage) {
|
|
|
8636
8737
|
var init_background_update_check = __esm(() => {
|
|
8637
8738
|
init_config_manager();
|
|
8638
8739
|
init_logger();
|
|
8740
|
+
init_shared();
|
|
8639
8741
|
init_cache();
|
|
8640
8742
|
init_constants3();
|
|
8641
8743
|
init_checker();
|
|
@@ -8865,7 +8967,7 @@ var {
|
|
|
8865
8967
|
// package.json
|
|
8866
8968
|
var package_default = {
|
|
8867
8969
|
name: "evil-omo",
|
|
8868
|
-
version: "3.
|
|
8970
|
+
version: "3.12.2",
|
|
8869
8971
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
8870
8972
|
main: "dist/index.js",
|
|
8871
8973
|
types: "dist/index.d.ts",
|
|
@@ -8941,17 +9043,17 @@ var package_default = {
|
|
|
8941
9043
|
typescript: "^5.7.3"
|
|
8942
9044
|
},
|
|
8943
9045
|
optionalDependencies: {
|
|
8944
|
-
"evil-omo-darwin-arm64": "3.
|
|
8945
|
-
"evil-omo-darwin-x64": "3.
|
|
8946
|
-
"evil-omo-darwin-x64-baseline": "3.
|
|
8947
|
-
"evil-omo-linux-x64": "3.
|
|
8948
|
-
"evil-omo-linux-x64-baseline": "3.
|
|
8949
|
-
"evil-omo-linux-arm64": "3.
|
|
8950
|
-
"evil-omo-linux-x64-musl": "3.
|
|
8951
|
-
"evil-omo-linux-x64-musl-baseline": "3.
|
|
8952
|
-
"evil-omo-linux-arm64-musl": "3.
|
|
8953
|
-
"evil-omo-windows-x64": "3.
|
|
8954
|
-
"evil-omo-windows-x64-baseline": "3.
|
|
9046
|
+
"evil-omo-darwin-arm64": "3.12.2",
|
|
9047
|
+
"evil-omo-darwin-x64": "3.12.2",
|
|
9048
|
+
"evil-omo-darwin-x64-baseline": "3.12.2",
|
|
9049
|
+
"evil-omo-linux-x64": "3.12.2",
|
|
9050
|
+
"evil-omo-linux-x64-baseline": "3.12.2",
|
|
9051
|
+
"evil-omo-linux-arm64": "3.12.2",
|
|
9052
|
+
"evil-omo-linux-x64-musl": "3.12.2",
|
|
9053
|
+
"evil-omo-linux-x64-musl-baseline": "3.12.2",
|
|
9054
|
+
"evil-omo-linux-arm64-musl": "3.12.2",
|
|
9055
|
+
"evil-omo-windows-x64": "3.12.2",
|
|
9056
|
+
"evil-omo-windows-x64-baseline": "3.12.2"
|
|
8955
9057
|
},
|
|
8956
9058
|
overrides: {
|
|
8957
9059
|
"@opencode-ai/sdk": "^1.2.24"
|
|
@@ -10320,24 +10422,24 @@ function writePaddedText(text, atLineStart) {
|
|
|
10320
10422
|
return { output: text, atLineStart: text.endsWith(`
|
|
10321
10423
|
`) };
|
|
10322
10424
|
}
|
|
10323
|
-
|
|
10425
|
+
const parts = [];
|
|
10324
10426
|
let lineStart = atLineStart;
|
|
10325
10427
|
for (let i2 = 0;i2 < text.length; i2++) {
|
|
10326
10428
|
const ch = text[i2];
|
|
10327
10429
|
if (lineStart) {
|
|
10328
|
-
|
|
10430
|
+
parts.push(" ");
|
|
10329
10431
|
lineStart = false;
|
|
10330
10432
|
}
|
|
10331
10433
|
if (ch === `
|
|
10332
10434
|
`) {
|
|
10333
|
-
|
|
10334
|
-
|
|
10435
|
+
parts.push(`
|
|
10436
|
+
`);
|
|
10335
10437
|
lineStart = true;
|
|
10336
10438
|
continue;
|
|
10337
10439
|
}
|
|
10338
|
-
|
|
10440
|
+
parts.push(ch);
|
|
10339
10441
|
}
|
|
10340
|
-
return { output, atLineStart: lineStart };
|
|
10442
|
+
return { output: parts.join(""), atLineStart: lineStart };
|
|
10341
10443
|
}
|
|
10342
10444
|
function colorizeWithProfileColor(text, hexColor) {
|
|
10343
10445
|
if (!hexColor)
|
|
@@ -24329,6 +24431,11 @@ var BabysittingConfigSchema = exports_external.object({
|
|
|
24329
24431
|
timeout_ms: exports_external.number().default(120000)
|
|
24330
24432
|
});
|
|
24331
24433
|
// src/config/schema/background-task.ts
|
|
24434
|
+
var CircuitBreakerConfigSchema = exports_external.object({
|
|
24435
|
+
enabled: exports_external.boolean().optional(),
|
|
24436
|
+
maxToolCalls: exports_external.number().int().min(10).optional(),
|
|
24437
|
+
consecutiveThreshold: exports_external.number().int().min(5).optional()
|
|
24438
|
+
});
|
|
24332
24439
|
var BackgroundTaskConfigSchema = exports_external.object({
|
|
24333
24440
|
defaultConcurrency: exports_external.number().min(1).optional(),
|
|
24334
24441
|
providerConcurrency: exports_external.record(exports_external.string(), exports_external.number().min(0)).optional(),
|
|
@@ -24337,7 +24444,9 @@ var BackgroundTaskConfigSchema = exports_external.object({
|
|
|
24337
24444
|
maxDescendants: exports_external.number().int().min(1).optional(),
|
|
24338
24445
|
staleTimeoutMs: exports_external.number().min(60000).optional(),
|
|
24339
24446
|
messageStalenessTimeoutMs: exports_external.number().min(60000).optional(),
|
|
24340
|
-
syncPollTimeoutMs: exports_external.number().min(60000).optional()
|
|
24447
|
+
syncPollTimeoutMs: exports_external.number().min(60000).optional(),
|
|
24448
|
+
maxToolCalls: exports_external.number().int().min(10).optional(),
|
|
24449
|
+
circuitBreaker: CircuitBreakerConfigSchema.optional()
|
|
24341
24450
|
});
|
|
24342
24451
|
// src/config/schema/browser-automation.ts
|
|
24343
24452
|
var BrowserAutomationProviderSchema = exports_external.enum([
|
|
@@ -24515,7 +24624,8 @@ var HookNameSchema = exports_external.enum([
|
|
|
24515
24624
|
"write-existing-file-guard",
|
|
24516
24625
|
"anthropic-effort",
|
|
24517
24626
|
"hashline-read-enhancer",
|
|
24518
|
-
"read-image-resizer"
|
|
24627
|
+
"read-image-resizer",
|
|
24628
|
+
"todo-description-override"
|
|
24519
24629
|
]);
|
|
24520
24630
|
// src/config/schema/notification.ts
|
|
24521
24631
|
var NotificationConfigSchema = exports_external.object({
|
|
@@ -27154,9 +27264,9 @@ async function run(options) {
|
|
|
27154
27264
|
timestampOutput?.enable();
|
|
27155
27265
|
const pluginConfig = loadPluginConfig(directory, { command: "run" });
|
|
27156
27266
|
const resolvedAgent = resolveRunAgent(options, pluginConfig);
|
|
27157
|
-
const resolvedModel = resolveRunModel(options.model);
|
|
27158
27267
|
const abortController = new AbortController;
|
|
27159
27268
|
try {
|
|
27269
|
+
const resolvedModel = resolveRunModel(options.model);
|
|
27160
27270
|
const { client: client3, cleanup: serverCleanup } = await createServerConnection({
|
|
27161
27271
|
port: options.port,
|
|
27162
27272
|
attach: options.attach,
|
|
@@ -27439,30 +27549,30 @@ var PACKAGE_NAME3 = PLUGIN_NAME;
|
|
|
27439
27549
|
var OPENCODE_BINARIES2 = ["opencode", "opencode-desktop"];
|
|
27440
27550
|
|
|
27441
27551
|
// src/cli/doctor/checks/system.ts
|
|
27442
|
-
import { existsSync as
|
|
27552
|
+
import { existsSync as existsSync24, readFileSync as readFileSync21 } from "fs";
|
|
27443
27553
|
|
|
27444
27554
|
// src/cli/doctor/checks/system-binary.ts
|
|
27445
27555
|
init_spawn_with_windows_hide();
|
|
27446
|
-
import { existsSync as
|
|
27556
|
+
import { existsSync as existsSync21 } from "fs";
|
|
27447
27557
|
import { homedir as homedir5 } from "os";
|
|
27448
|
-
import { join as
|
|
27558
|
+
import { join as join19 } from "path";
|
|
27449
27559
|
function getDesktopAppPaths(platform) {
|
|
27450
27560
|
const home = homedir5();
|
|
27451
27561
|
switch (platform) {
|
|
27452
27562
|
case "darwin":
|
|
27453
27563
|
return [
|
|
27454
27564
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
27455
|
-
|
|
27565
|
+
join19(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
27456
27566
|
];
|
|
27457
27567
|
case "win32": {
|
|
27458
27568
|
const programFiles = process.env.ProgramFiles;
|
|
27459
27569
|
const localAppData = process.env.LOCALAPPDATA;
|
|
27460
27570
|
const paths = [];
|
|
27461
27571
|
if (programFiles) {
|
|
27462
|
-
paths.push(
|
|
27572
|
+
paths.push(join19(programFiles, "OpenCode", "OpenCode.exe"));
|
|
27463
27573
|
}
|
|
27464
27574
|
if (localAppData) {
|
|
27465
|
-
paths.push(
|
|
27575
|
+
paths.push(join19(localAppData, "OpenCode", "OpenCode.exe"));
|
|
27466
27576
|
}
|
|
27467
27577
|
return paths;
|
|
27468
27578
|
}
|
|
@@ -27470,8 +27580,8 @@ function getDesktopAppPaths(platform) {
|
|
|
27470
27580
|
return [
|
|
27471
27581
|
"/usr/bin/opencode",
|
|
27472
27582
|
"/usr/lib/opencode/opencode",
|
|
27473
|
-
|
|
27474
|
-
|
|
27583
|
+
join19(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
27584
|
+
join19(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
27475
27585
|
];
|
|
27476
27586
|
default:
|
|
27477
27587
|
return [];
|
|
@@ -27483,7 +27593,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
27483
27593
|
}
|
|
27484
27594
|
return [binaryPath, "--version"];
|
|
27485
27595
|
}
|
|
27486
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
27596
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync21) {
|
|
27487
27597
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
27488
27598
|
if (checkExists(desktopPath)) {
|
|
27489
27599
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -27530,30 +27640,40 @@ function compareVersions(current, minimum) {
|
|
|
27530
27640
|
}
|
|
27531
27641
|
|
|
27532
27642
|
// src/cli/doctor/checks/system-plugin.ts
|
|
27533
|
-
import { existsSync as existsSync21, readFileSync as readFileSync19 } from "fs";
|
|
27534
27643
|
init_shared();
|
|
27644
|
+
import { existsSync as existsSync22, readFileSync as readFileSync19 } from "fs";
|
|
27535
27645
|
function detectConfigPath() {
|
|
27536
27646
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
27537
|
-
if (
|
|
27647
|
+
if (existsSync22(paths.configJsonc))
|
|
27538
27648
|
return paths.configJsonc;
|
|
27539
|
-
if (
|
|
27649
|
+
if (existsSync22(paths.configJson))
|
|
27540
27650
|
return paths.configJson;
|
|
27541
27651
|
return null;
|
|
27542
27652
|
}
|
|
27543
27653
|
function parsePluginVersion(entry) {
|
|
27544
|
-
if (
|
|
27545
|
-
|
|
27546
|
-
|
|
27547
|
-
|
|
27548
|
-
return
|
|
27549
|
-
|
|
27654
|
+
if (entry.startsWith(`${PLUGIN_NAME}@`)) {
|
|
27655
|
+
const value = entry.slice(PLUGIN_NAME.length + 1);
|
|
27656
|
+
if (!value || value === "latest")
|
|
27657
|
+
return null;
|
|
27658
|
+
return value;
|
|
27659
|
+
}
|
|
27660
|
+
if (entry.startsWith(`${LEGACY_PLUGIN_NAME}@`)) {
|
|
27661
|
+
const value = entry.slice(LEGACY_PLUGIN_NAME.length + 1);
|
|
27662
|
+
if (!value || value === "latest")
|
|
27663
|
+
return null;
|
|
27664
|
+
return value;
|
|
27665
|
+
}
|
|
27666
|
+
return null;
|
|
27550
27667
|
}
|
|
27551
27668
|
function findPluginEntry2(entries) {
|
|
27552
27669
|
for (const entry of entries) {
|
|
27553
|
-
if (entry ===
|
|
27670
|
+
if (entry === PLUGIN_NAME || entry.startsWith(`${PLUGIN_NAME}@`)) {
|
|
27671
|
+
return { entry, isLocalDev: false };
|
|
27672
|
+
}
|
|
27673
|
+
if (entry === LEGACY_PLUGIN_NAME || entry.startsWith(`${LEGACY_PLUGIN_NAME}@`)) {
|
|
27554
27674
|
return { entry, isLocalDev: false };
|
|
27555
27675
|
}
|
|
27556
|
-
if (entry.startsWith("file://") && entry.includes(
|
|
27676
|
+
if (entry.startsWith("file://") && (entry.includes(PLUGIN_NAME) || entry.includes(LEGACY_PLUGIN_NAME))) {
|
|
27557
27677
|
return { entry, isLocalDev: true };
|
|
27558
27678
|
}
|
|
27559
27679
|
}
|
|
@@ -27590,7 +27710,7 @@ function getPluginInfo() {
|
|
|
27590
27710
|
registered: true,
|
|
27591
27711
|
configPath,
|
|
27592
27712
|
entry: pluginEntry.entry,
|
|
27593
|
-
isPinned: pinnedVersion !== null && /^\d+\.\d+\.\d+/.test(pinnedVersion),
|
|
27713
|
+
isPinned: pinnedVersion !== null && /^\d+\.\d+\.\d+/.test(pinnedVersion ?? ""),
|
|
27594
27714
|
pinnedVersion,
|
|
27595
27715
|
isLocalDev: pluginEntry.isLocalDev
|
|
27596
27716
|
};
|
|
@@ -27609,29 +27729,29 @@ function getPluginInfo() {
|
|
|
27609
27729
|
// src/cli/doctor/checks/system-loaded-version.ts
|
|
27610
27730
|
init_checker();
|
|
27611
27731
|
init_auto_update_checker();
|
|
27612
|
-
import { existsSync as
|
|
27732
|
+
import { existsSync as existsSync23, readFileSync as readFileSync20 } from "fs";
|
|
27613
27733
|
import { homedir as homedir6 } from "os";
|
|
27614
|
-
import { join as
|
|
27734
|
+
import { join as join20 } from "path";
|
|
27615
27735
|
init_shared();
|
|
27616
27736
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
27617
27737
|
if (platform === "darwin")
|
|
27618
|
-
return
|
|
27738
|
+
return join20(homedir6(), "Library", "Caches");
|
|
27619
27739
|
if (platform === "win32")
|
|
27620
|
-
return process.env.LOCALAPPDATA ??
|
|
27621
|
-
return
|
|
27740
|
+
return process.env.LOCALAPPDATA ?? join20(homedir6(), "AppData", "Local");
|
|
27741
|
+
return join20(homedir6(), ".cache");
|
|
27622
27742
|
}
|
|
27623
27743
|
function resolveOpenCodeCacheDir() {
|
|
27624
27744
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
27625
27745
|
if (xdgCacheHome)
|
|
27626
|
-
return
|
|
27746
|
+
return join20(xdgCacheHome, "opencode");
|
|
27627
27747
|
const fromShared = getOpenCodeCacheDir();
|
|
27628
|
-
const platformDefault =
|
|
27629
|
-
if (
|
|
27748
|
+
const platformDefault = join20(getPlatformDefaultCacheDir(), "opencode");
|
|
27749
|
+
if (existsSync23(fromShared) || !existsSync23(platformDefault))
|
|
27630
27750
|
return fromShared;
|
|
27631
27751
|
return platformDefault;
|
|
27632
27752
|
}
|
|
27633
27753
|
function readPackageJson(filePath) {
|
|
27634
|
-
if (!
|
|
27754
|
+
if (!existsSync23(filePath))
|
|
27635
27755
|
return null;
|
|
27636
27756
|
try {
|
|
27637
27757
|
const content = readFileSync20(filePath, "utf-8");
|
|
@@ -27653,15 +27773,15 @@ function getLoadedPluginVersion() {
|
|
|
27653
27773
|
{
|
|
27654
27774
|
cacheDir: configPaths.configDir,
|
|
27655
27775
|
cachePackagePath: configPaths.packageJson,
|
|
27656
|
-
installedPackagePath:
|
|
27776
|
+
installedPackagePath: join20(configPaths.configDir, "node_modules", PACKAGE_NAME3, "package.json")
|
|
27657
27777
|
},
|
|
27658
27778
|
{
|
|
27659
27779
|
cacheDir,
|
|
27660
|
-
cachePackagePath:
|
|
27661
|
-
installedPackagePath:
|
|
27780
|
+
cachePackagePath: join20(cacheDir, "package.json"),
|
|
27781
|
+
installedPackagePath: join20(cacheDir, "node_modules", PACKAGE_NAME3, "package.json")
|
|
27662
27782
|
}
|
|
27663
27783
|
];
|
|
27664
|
-
const selectedCandidate = candidates.find((candidate) =>
|
|
27784
|
+
const selectedCandidate = candidates.find((candidate) => existsSync23(candidate.installedPackagePath)) ?? candidates[0];
|
|
27665
27785
|
const { cacheDir: selectedDir, cachePackagePath, installedPackagePath } = selectedCandidate;
|
|
27666
27786
|
const cachePackage = readPackageJson(cachePackagePath);
|
|
27667
27787
|
const installedPackage = readPackageJson(installedPackagePath);
|
|
@@ -27688,7 +27808,7 @@ init_shared();
|
|
|
27688
27808
|
function isConfigValid(configPath) {
|
|
27689
27809
|
if (!configPath)
|
|
27690
27810
|
return true;
|
|
27691
|
-
if (!
|
|
27811
|
+
if (!existsSync24(configPath))
|
|
27692
27812
|
return false;
|
|
27693
27813
|
try {
|
|
27694
27814
|
parseJsonc(readFileSync21(configPath, "utf-8"));
|
|
@@ -27795,24 +27915,24 @@ async function checkSystem() {
|
|
|
27795
27915
|
|
|
27796
27916
|
// src/cli/doctor/checks/config.ts
|
|
27797
27917
|
import { readFileSync as readFileSync24 } from "fs";
|
|
27798
|
-
import { join as
|
|
27918
|
+
import { join as join24 } from "path";
|
|
27799
27919
|
init_shared();
|
|
27800
27920
|
init_plugin_identity();
|
|
27801
27921
|
|
|
27802
27922
|
// src/cli/doctor/checks/model-resolution-cache.ts
|
|
27803
27923
|
init_shared();
|
|
27804
|
-
import { existsSync as
|
|
27924
|
+
import { existsSync as existsSync25, readFileSync as readFileSync22 } from "fs";
|
|
27805
27925
|
import { homedir as homedir7 } from "os";
|
|
27806
|
-
import { join as
|
|
27926
|
+
import { join as join21 } from "path";
|
|
27807
27927
|
function getOpenCodeCacheDir2() {
|
|
27808
27928
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
27809
27929
|
if (xdgCache)
|
|
27810
|
-
return
|
|
27811
|
-
return
|
|
27930
|
+
return join21(xdgCache, "opencode");
|
|
27931
|
+
return join21(homedir7(), ".cache", "opencode");
|
|
27812
27932
|
}
|
|
27813
27933
|
function loadAvailableModelsFromCache() {
|
|
27814
|
-
const cacheFile =
|
|
27815
|
-
if (!
|
|
27934
|
+
const cacheFile = join21(getOpenCodeCacheDir2(), "models.json");
|
|
27935
|
+
if (!existsSync25(cacheFile)) {
|
|
27816
27936
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
27817
27937
|
}
|
|
27818
27938
|
try {
|
|
@@ -27839,9 +27959,9 @@ init_model_requirements();
|
|
|
27839
27959
|
init_shared();
|
|
27840
27960
|
init_plugin_identity();
|
|
27841
27961
|
import { readFileSync as readFileSync23 } from "fs";
|
|
27842
|
-
import { join as
|
|
27962
|
+
import { join as join22 } from "path";
|
|
27843
27963
|
var USER_CONFIG_DIR2 = getOpenCodeConfigPaths({ binary: "opencode", version: null }).configDir;
|
|
27844
|
-
var PROJECT_CONFIG_DIR =
|
|
27964
|
+
var PROJECT_CONFIG_DIR = join22(process.cwd(), ".opencode");
|
|
27845
27965
|
function loadOmoConfig() {
|
|
27846
27966
|
const projectDetected = detectManagedConfigFile(PROJECT_CONFIG_DIR);
|
|
27847
27967
|
if (projectDetected.format !== "none") {
|
|
@@ -27866,7 +27986,7 @@ function loadOmoConfig() {
|
|
|
27866
27986
|
|
|
27867
27987
|
// src/cli/doctor/checks/model-resolution-details.ts
|
|
27868
27988
|
init_shared();
|
|
27869
|
-
import { join as
|
|
27989
|
+
import { join as join23 } from "path";
|
|
27870
27990
|
|
|
27871
27991
|
// src/cli/doctor/checks/model-resolution-variant.ts
|
|
27872
27992
|
function formatModelWithVariant(model, variant) {
|
|
@@ -27905,7 +28025,7 @@ function getCategoryEffectiveVariant(categoryName, requirement, config2) {
|
|
|
27905
28025
|
// src/cli/doctor/checks/model-resolution-details.ts
|
|
27906
28026
|
function buildModelResolutionDetails(options) {
|
|
27907
28027
|
const details = [];
|
|
27908
|
-
const cacheFile =
|
|
28028
|
+
const cacheFile = join23(getOpenCodeCacheDir(), "models.json");
|
|
27909
28029
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
27910
28030
|
details.push("");
|
|
27911
28031
|
if (options.available.cacheExists) {
|
|
@@ -28018,7 +28138,7 @@ async function checkModels() {
|
|
|
28018
28138
|
|
|
28019
28139
|
// src/cli/doctor/checks/config.ts
|
|
28020
28140
|
function findConfigPath() {
|
|
28021
|
-
const projectConfig = detectManagedConfigFile(
|
|
28141
|
+
const projectConfig = detectManagedConfigFile(join24(process.cwd(), ".opencode"));
|
|
28022
28142
|
if (projectConfig.format !== "none")
|
|
28023
28143
|
return projectConfig.path;
|
|
28024
28144
|
const userConfig = detectManagedConfigFile(getOpenCodeConfigDir({ binary: "opencode" }));
|
|
@@ -28136,9 +28256,9 @@ async function checkConfig() {
|
|
|
28136
28256
|
|
|
28137
28257
|
// src/cli/doctor/checks/dependencies.ts
|
|
28138
28258
|
init_spawn_with_windows_hide();
|
|
28139
|
-
import { existsSync as
|
|
28259
|
+
import { existsSync as existsSync26 } from "fs";
|
|
28140
28260
|
import { createRequire } from "module";
|
|
28141
|
-
import { dirname as dirname6, join as
|
|
28261
|
+
import { dirname as dirname6, join as join25 } from "path";
|
|
28142
28262
|
async function checkBinaryExists(binary2) {
|
|
28143
28263
|
try {
|
|
28144
28264
|
const path10 = Bun.which(binary2);
|
|
@@ -28194,15 +28314,15 @@ async function checkAstGrepNapi() {
|
|
|
28194
28314
|
path: null
|
|
28195
28315
|
};
|
|
28196
28316
|
} catch {
|
|
28197
|
-
const { existsSync:
|
|
28198
|
-
const { join:
|
|
28317
|
+
const { existsSync: existsSync27 } = await import("fs");
|
|
28318
|
+
const { join: join26 } = await import("path");
|
|
28199
28319
|
const { homedir: homedir8 } = await import("os");
|
|
28200
28320
|
const pathsToCheck = [
|
|
28201
|
-
|
|
28202
|
-
|
|
28321
|
+
join26(homedir8(), ".config", "opencode", "node_modules", "@ast-grep", "napi"),
|
|
28322
|
+
join26(process.cwd(), "node_modules", "@ast-grep", "napi")
|
|
28203
28323
|
];
|
|
28204
28324
|
for (const napiPath of pathsToCheck) {
|
|
28205
|
-
if (
|
|
28325
|
+
if (existsSync27(napiPath)) {
|
|
28206
28326
|
return {
|
|
28207
28327
|
name: "AST-Grep NAPI",
|
|
28208
28328
|
required: false,
|
|
@@ -28227,8 +28347,8 @@ function findCommentCheckerPackageBinary() {
|
|
|
28227
28347
|
try {
|
|
28228
28348
|
const require2 = createRequire(import.meta.url);
|
|
28229
28349
|
const pkgPath = require2.resolve("@code-yeongyu/comment-checker/package.json");
|
|
28230
|
-
const binaryPath =
|
|
28231
|
-
if (
|
|
28350
|
+
const binaryPath = join25(dirname6(pkgPath), "bin", binaryName);
|
|
28351
|
+
if (existsSync26(binaryPath))
|
|
28232
28352
|
return binaryPath;
|
|
28233
28353
|
} catch {}
|
|
28234
28354
|
return null;
|
|
@@ -28385,13 +28505,13 @@ var BUILTIN_SERVERS = {
|
|
|
28385
28505
|
"kotlin-ls": { command: ["kotlin-lsp"], extensions: [".kt", ".kts"] }
|
|
28386
28506
|
};
|
|
28387
28507
|
// src/tools/lsp/server-config-loader.ts
|
|
28388
|
-
import { existsSync as
|
|
28389
|
-
import { join as
|
|
28508
|
+
import { existsSync as existsSync27, readFileSync as readFileSync25 } from "fs";
|
|
28509
|
+
import { join as join26 } from "path";
|
|
28390
28510
|
init_shared();
|
|
28391
28511
|
init_jsonc_parser();
|
|
28392
28512
|
init_plugin_identity();
|
|
28393
28513
|
function loadJsonFile(path10) {
|
|
28394
|
-
if (!
|
|
28514
|
+
if (!existsSync27(path10))
|
|
28395
28515
|
return null;
|
|
28396
28516
|
try {
|
|
28397
28517
|
return parseJsonc(readFileSync25(path10, "utf-8"));
|
|
@@ -28403,9 +28523,9 @@ function getConfigPaths2() {
|
|
|
28403
28523
|
const cwd = process.cwd();
|
|
28404
28524
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
28405
28525
|
return {
|
|
28406
|
-
project: detectManagedConfigFile(
|
|
28526
|
+
project: detectManagedConfigFile(join26(cwd, ".opencode")).path,
|
|
28407
28527
|
user: detectManagedConfigFile(configDir).path,
|
|
28408
|
-
opencode: detectConfigFile(
|
|
28528
|
+
opencode: detectConfigFile(join26(configDir, "opencode")).path
|
|
28409
28529
|
};
|
|
28410
28530
|
}
|
|
28411
28531
|
function loadAllConfigs() {
|
|
@@ -28474,21 +28594,21 @@ function getMergedServers() {
|
|
|
28474
28594
|
}
|
|
28475
28595
|
|
|
28476
28596
|
// src/tools/lsp/server-installation.ts
|
|
28477
|
-
import { existsSync as
|
|
28478
|
-
import { delimiter as delimiter2, join as
|
|
28597
|
+
import { existsSync as existsSync28 } from "fs";
|
|
28598
|
+
import { delimiter as delimiter2, join as join28 } from "path";
|
|
28479
28599
|
|
|
28480
28600
|
// src/tools/lsp/server-path-bases.ts
|
|
28481
28601
|
init_shared();
|
|
28482
|
-
import { join as
|
|
28602
|
+
import { join as join27 } from "path";
|
|
28483
28603
|
function getLspServerAdditionalPathBases(workingDirectory) {
|
|
28484
28604
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
28485
|
-
const dataDir =
|
|
28605
|
+
const dataDir = join27(getDataDir(), "opencode");
|
|
28486
28606
|
return [
|
|
28487
|
-
|
|
28488
|
-
|
|
28489
|
-
|
|
28490
|
-
|
|
28491
|
-
|
|
28607
|
+
join27(workingDirectory, "node_modules", ".bin"),
|
|
28608
|
+
join27(configDir, "bin"),
|
|
28609
|
+
join27(configDir, "node_modules", ".bin"),
|
|
28610
|
+
join27(dataDir, "bin"),
|
|
28611
|
+
join27(dataDir, "bin", "node_modules", ".bin")
|
|
28492
28612
|
];
|
|
28493
28613
|
}
|
|
28494
28614
|
|
|
@@ -28498,7 +28618,7 @@ function isServerInstalled(command) {
|
|
|
28498
28618
|
return false;
|
|
28499
28619
|
const cmd = command[0];
|
|
28500
28620
|
if (cmd.includes("/") || cmd.includes("\\")) {
|
|
28501
|
-
if (
|
|
28621
|
+
if (existsSync28(cmd))
|
|
28502
28622
|
return true;
|
|
28503
28623
|
}
|
|
28504
28624
|
const isWindows = process.platform === "win32";
|
|
@@ -28519,14 +28639,14 @@ function isServerInstalled(command) {
|
|
|
28519
28639
|
const paths = pathEnv.split(delimiter2);
|
|
28520
28640
|
for (const p2 of paths) {
|
|
28521
28641
|
for (const suffix of exts) {
|
|
28522
|
-
if (
|
|
28642
|
+
if (existsSync28(join28(p2, cmd + suffix))) {
|
|
28523
28643
|
return true;
|
|
28524
28644
|
}
|
|
28525
28645
|
}
|
|
28526
28646
|
}
|
|
28527
28647
|
for (const base of getLspServerAdditionalPathBases(process.cwd())) {
|
|
28528
28648
|
for (const suffix of exts) {
|
|
28529
|
-
if (
|
|
28649
|
+
if (existsSync28(join28(base, cmd + suffix))) {
|
|
28530
28650
|
return true;
|
|
28531
28651
|
}
|
|
28532
28652
|
}
|
|
@@ -28588,21 +28708,21 @@ function getInstalledLspServers() {
|
|
|
28588
28708
|
|
|
28589
28709
|
// src/cli/doctor/checks/tools-mcp.ts
|
|
28590
28710
|
init_shared();
|
|
28591
|
-
import { existsSync as
|
|
28711
|
+
import { existsSync as existsSync29, readFileSync as readFileSync26 } from "fs";
|
|
28592
28712
|
import { homedir as homedir8 } from "os";
|
|
28593
|
-
import { join as
|
|
28713
|
+
import { join as join29 } from "path";
|
|
28594
28714
|
var BUILTIN_MCP_SERVERS = ["context7", "grep_app"];
|
|
28595
28715
|
function getMcpConfigPaths() {
|
|
28596
28716
|
return [
|
|
28597
|
-
|
|
28598
|
-
|
|
28599
|
-
|
|
28717
|
+
join29(homedir8(), ".claude", ".mcp.json"),
|
|
28718
|
+
join29(process.cwd(), ".mcp.json"),
|
|
28719
|
+
join29(process.cwd(), ".claude", ".mcp.json")
|
|
28600
28720
|
];
|
|
28601
28721
|
}
|
|
28602
28722
|
function loadUserMcpConfig() {
|
|
28603
28723
|
const servers = {};
|
|
28604
28724
|
for (const configPath of getMcpConfigPaths()) {
|
|
28605
|
-
if (!
|
|
28725
|
+
if (!existsSync29(configPath))
|
|
28606
28726
|
continue;
|
|
28607
28727
|
try {
|
|
28608
28728
|
const content = readFileSync26(configPath, "utf-8");
|
|
@@ -29028,11 +29148,11 @@ async function doctor(options = { mode: "default" }) {
|
|
|
29028
29148
|
|
|
29029
29149
|
// src/features/mcp-oauth/storage.ts
|
|
29030
29150
|
init_shared();
|
|
29031
|
-
import { chmodSync, existsSync as
|
|
29032
|
-
import { dirname as dirname7, join as
|
|
29151
|
+
import { chmodSync, existsSync as existsSync30, mkdirSync as mkdirSync6, readFileSync as readFileSync27, unlinkSync as unlinkSync4, writeFileSync as writeFileSync10 } from "fs";
|
|
29152
|
+
import { dirname as dirname7, join as join30 } from "path";
|
|
29033
29153
|
var STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
29034
29154
|
function getMcpOauthStoragePath() {
|
|
29035
|
-
return
|
|
29155
|
+
return join30(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
|
|
29036
29156
|
}
|
|
29037
29157
|
function normalizeHost(serverHost) {
|
|
29038
29158
|
let host = serverHost.trim();
|
|
@@ -29069,7 +29189,7 @@ function buildKey(serverHost, resource) {
|
|
|
29069
29189
|
}
|
|
29070
29190
|
function readStore() {
|
|
29071
29191
|
const filePath = getMcpOauthStoragePath();
|
|
29072
|
-
if (!
|
|
29192
|
+
if (!existsSync30(filePath)) {
|
|
29073
29193
|
return null;
|
|
29074
29194
|
}
|
|
29075
29195
|
try {
|
|
@@ -29083,7 +29203,7 @@ function writeStore(store2) {
|
|
|
29083
29203
|
const filePath = getMcpOauthStoragePath();
|
|
29084
29204
|
try {
|
|
29085
29205
|
const dir = dirname7(filePath);
|
|
29086
|
-
if (!
|
|
29206
|
+
if (!existsSync30(dir)) {
|
|
29087
29207
|
mkdirSync6(dir, { recursive: true });
|
|
29088
29208
|
}
|
|
29089
29209
|
writeFileSync10(filePath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
|
|
@@ -29118,7 +29238,7 @@ function deleteToken(serverHost, resource) {
|
|
|
29118
29238
|
if (Object.keys(store2).length === 0) {
|
|
29119
29239
|
try {
|
|
29120
29240
|
const filePath = getMcpOauthStoragePath();
|
|
29121
|
-
if (
|
|
29241
|
+
if (existsSync30(filePath)) {
|
|
29122
29242
|
unlinkSync4(filePath);
|
|
29123
29243
|
}
|
|
29124
29244
|
return true;
|