evil-omo 3.16.0 → 3.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +82 -82
- package/README.ja.md +353 -353
- package/README.ko.md +347 -347
- package/README.md +51 -51
- package/README.ru.md +374 -374
- package/README.zh-cn.md +352 -352
- package/bin/evil-omo.js +201 -201
- package/bin/platform.d.ts +14 -14
- package/bin/platform.js +82 -82
- package/bin/platform.test.ts +218 -218
- package/dist/cli/index.js +103 -914
- package/dist/index.js +122 -325
- package/package.json +1 -1
- package/postinstall.mjs +133 -133
package/dist/cli/index.js
CHANGED
|
@@ -6042,47 +6042,8 @@ var init_jsonc_parser = __esm(() => {
|
|
|
6042
6042
|
});
|
|
6043
6043
|
|
|
6044
6044
|
// src/shared/migration/agent-names.ts
|
|
6045
|
-
|
|
6046
|
-
const migrated = {};
|
|
6047
|
-
let changed = false;
|
|
6048
|
-
for (const [key, value] of Object.entries(agents)) {
|
|
6049
|
-
const newKey = AGENT_NAME_MAP[key.toLowerCase()] ?? AGENT_NAME_MAP[key] ?? key;
|
|
6050
|
-
if (newKey !== key) {
|
|
6051
|
-
changed = true;
|
|
6052
|
-
}
|
|
6053
|
-
migrated[newKey] = value;
|
|
6054
|
-
}
|
|
6055
|
-
return { migrated, changed };
|
|
6056
|
-
}
|
|
6057
|
-
var AGENT_NAME_MAP, BUILTIN_AGENT_NAMES;
|
|
6045
|
+
var BUILTIN_AGENT_NAMES;
|
|
6058
6046
|
var init_agent_names = __esm(() => {
|
|
6059
|
-
AGENT_NAME_MAP = {
|
|
6060
|
-
omo: "sisyphus",
|
|
6061
|
-
OmO: "sisyphus",
|
|
6062
|
-
Sisyphus: "sisyphus",
|
|
6063
|
-
sisyphus: "sisyphus",
|
|
6064
|
-
"OmO-Plan": "prometheus",
|
|
6065
|
-
"omo-plan": "prometheus",
|
|
6066
|
-
"Planner-Sisyphus": "prometheus",
|
|
6067
|
-
"planner-sisyphus": "prometheus",
|
|
6068
|
-
"Prometheus - Plan Builder": "prometheus",
|
|
6069
|
-
prometheus: "prometheus",
|
|
6070
|
-
"orchestrator-sisyphus": "atlas",
|
|
6071
|
-
Atlas: "atlas",
|
|
6072
|
-
atlas: "atlas",
|
|
6073
|
-
"plan-consultant": "metis",
|
|
6074
|
-
"Metis - Plan Consultant": "metis",
|
|
6075
|
-
metis: "metis",
|
|
6076
|
-
"Momus - Plan Critic": "momus",
|
|
6077
|
-
momus: "momus",
|
|
6078
|
-
"Sisyphus-Junior": "sisyphus-junior",
|
|
6079
|
-
"sisyphus-junior": "sisyphus-junior",
|
|
6080
|
-
build: "build",
|
|
6081
|
-
oracle: "oracle",
|
|
6082
|
-
librarian: "librarian",
|
|
6083
|
-
explore: "explore",
|
|
6084
|
-
"multimodal-looker": "multimodal-looker"
|
|
6085
|
-
};
|
|
6086
6047
|
BUILTIN_AGENT_NAMES = new Set([
|
|
6087
6048
|
"sisyphus",
|
|
6088
6049
|
"oracle",
|
|
@@ -6098,212 +6059,19 @@ var init_agent_names = __esm(() => {
|
|
|
6098
6059
|
});
|
|
6099
6060
|
|
|
6100
6061
|
// src/shared/migration/hook-names.ts
|
|
6101
|
-
|
|
6102
|
-
const migrated = [];
|
|
6103
|
-
const removed = [];
|
|
6104
|
-
let changed = false;
|
|
6105
|
-
for (const hook of hooks) {
|
|
6106
|
-
const mapping = HOOK_NAME_MAP[hook];
|
|
6107
|
-
if (mapping === null) {
|
|
6108
|
-
removed.push(hook);
|
|
6109
|
-
changed = true;
|
|
6110
|
-
continue;
|
|
6111
|
-
}
|
|
6112
|
-
const newHook = mapping ?? hook;
|
|
6113
|
-
if (newHook !== hook) {
|
|
6114
|
-
changed = true;
|
|
6115
|
-
}
|
|
6116
|
-
migrated.push(newHook);
|
|
6117
|
-
}
|
|
6118
|
-
return { migrated, changed, removed };
|
|
6119
|
-
}
|
|
6120
|
-
var HOOK_NAME_MAP;
|
|
6121
|
-
var init_hook_names = __esm(() => {
|
|
6122
|
-
HOOK_NAME_MAP = {
|
|
6123
|
-
"anthropic-auto-compact": "anthropic-context-window-limit-recovery",
|
|
6124
|
-
"sisyphus-orchestrator": "atlas",
|
|
6125
|
-
"sisyphus-gpt-hephaestus-reminder": "no-sisyphus-gpt",
|
|
6126
|
-
"empty-message-sanitizer": null,
|
|
6127
|
-
"delegate-task-english-directive": null,
|
|
6128
|
-
"gpt-permission-continuation": null
|
|
6129
|
-
};
|
|
6130
|
-
});
|
|
6062
|
+
var init_hook_names = () => {};
|
|
6131
6063
|
|
|
6132
6064
|
// src/shared/migration/model-versions.ts
|
|
6133
|
-
|
|
6134
|
-
return `model-version:${oldModel}->${newModel}`;
|
|
6135
|
-
}
|
|
6136
|
-
function migrateModelVersions(configs, appliedMigrations) {
|
|
6137
|
-
const migrated = {};
|
|
6138
|
-
let changed = false;
|
|
6139
|
-
const newMigrations = [];
|
|
6140
|
-
for (const [key, value] of Object.entries(configs)) {
|
|
6141
|
-
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
6142
|
-
const config = value;
|
|
6143
|
-
if (typeof config.model === "string" && MODEL_VERSION_MAP[config.model]) {
|
|
6144
|
-
const oldModel = config.model;
|
|
6145
|
-
const newModel = MODEL_VERSION_MAP[oldModel];
|
|
6146
|
-
const mKey = migrationKey(oldModel, newModel);
|
|
6147
|
-
if (appliedMigrations?.has(mKey)) {
|
|
6148
|
-
migrated[key] = value;
|
|
6149
|
-
continue;
|
|
6150
|
-
}
|
|
6151
|
-
migrated[key] = { ...config, model: newModel };
|
|
6152
|
-
changed = true;
|
|
6153
|
-
newMigrations.push(mKey);
|
|
6154
|
-
continue;
|
|
6155
|
-
}
|
|
6156
|
-
}
|
|
6157
|
-
migrated[key] = value;
|
|
6158
|
-
}
|
|
6159
|
-
return { migrated, changed, newMigrations };
|
|
6160
|
-
}
|
|
6161
|
-
var MODEL_VERSION_MAP;
|
|
6162
|
-
var init_model_versions = __esm(() => {
|
|
6163
|
-
MODEL_VERSION_MAP = {
|
|
6164
|
-
"anthropic/claude-opus-4-5": "anthropic/claude-opus-4-6",
|
|
6165
|
-
"anthropic/claude-sonnet-4-5": "anthropic/claude-sonnet-4-6",
|
|
6166
|
-
"openai/gpt-5.3-codex": "openai/gpt-5.4"
|
|
6167
|
-
};
|
|
6168
|
-
});
|
|
6065
|
+
var init_model_versions = () => {};
|
|
6169
6066
|
|
|
6170
6067
|
// src/shared/migration/agent-category.ts
|
|
6171
6068
|
var init_agent_category = () => {};
|
|
6172
6069
|
|
|
6173
|
-
// src/shared/write-file-atomically.ts
|
|
6174
|
-
import { closeSync, fsyncSync, openSync, renameSync, writeFileSync } from "fs";
|
|
6175
|
-
function writeFileAtomically(filePath, content) {
|
|
6176
|
-
const tempPath = `${filePath}.tmp`;
|
|
6177
|
-
writeFileSync(tempPath, content, "utf-8");
|
|
6178
|
-
const tempFileDescriptor = openSync(tempPath, "r");
|
|
6179
|
-
try {
|
|
6180
|
-
fsyncSync(tempFileDescriptor);
|
|
6181
|
-
} finally {
|
|
6182
|
-
closeSync(tempFileDescriptor);
|
|
6183
|
-
}
|
|
6184
|
-
renameSync(tempPath, filePath);
|
|
6185
|
-
}
|
|
6186
|
-
var init_write_file_atomically = () => {};
|
|
6187
|
-
|
|
6188
6070
|
// src/shared/migration/config-migration.ts
|
|
6189
|
-
import * as fs2 from "fs";
|
|
6190
|
-
function migrateConfigFile(configPath, rawConfig) {
|
|
6191
|
-
const copy = structuredClone(rawConfig);
|
|
6192
|
-
let needsWrite = false;
|
|
6193
|
-
const existingMigrations = Array.isArray(copy._migrations) ? new Set(copy._migrations) : new Set;
|
|
6194
|
-
const allNewMigrations = [];
|
|
6195
|
-
if (copy.agents && typeof copy.agents === "object") {
|
|
6196
|
-
const { migrated, changed } = migrateAgentNames(copy.agents);
|
|
6197
|
-
if (changed) {
|
|
6198
|
-
copy.agents = migrated;
|
|
6199
|
-
needsWrite = true;
|
|
6200
|
-
}
|
|
6201
|
-
}
|
|
6202
|
-
if (copy.agents && typeof copy.agents === "object") {
|
|
6203
|
-
const { migrated, changed, newMigrations } = migrateModelVersions(copy.agents, existingMigrations);
|
|
6204
|
-
if (changed) {
|
|
6205
|
-
copy.agents = migrated;
|
|
6206
|
-
needsWrite = true;
|
|
6207
|
-
log("Migrated model versions in agents config");
|
|
6208
|
-
}
|
|
6209
|
-
allNewMigrations.push(...newMigrations);
|
|
6210
|
-
}
|
|
6211
|
-
if (copy.categories && typeof copy.categories === "object") {
|
|
6212
|
-
const { migrated, changed, newMigrations } = migrateModelVersions(copy.categories, existingMigrations);
|
|
6213
|
-
if (changed) {
|
|
6214
|
-
copy.categories = migrated;
|
|
6215
|
-
needsWrite = true;
|
|
6216
|
-
log("Migrated model versions in categories config");
|
|
6217
|
-
}
|
|
6218
|
-
allNewMigrations.push(...newMigrations);
|
|
6219
|
-
}
|
|
6220
|
-
if (allNewMigrations.length > 0) {
|
|
6221
|
-
const updatedMigrations = Array.from(existingMigrations);
|
|
6222
|
-
updatedMigrations.push(...allNewMigrations);
|
|
6223
|
-
copy._migrations = updatedMigrations;
|
|
6224
|
-
needsWrite = true;
|
|
6225
|
-
}
|
|
6226
|
-
if (copy.omo_agent) {
|
|
6227
|
-
copy.sisyphus_agent = copy.omo_agent;
|
|
6228
|
-
delete copy.omo_agent;
|
|
6229
|
-
needsWrite = true;
|
|
6230
|
-
}
|
|
6231
|
-
if (copy.experimental && typeof copy.experimental === "object") {
|
|
6232
|
-
const experimental = copy.experimental;
|
|
6233
|
-
if ("hashline_edit" in experimental) {
|
|
6234
|
-
if (copy.hashline_edit === undefined) {
|
|
6235
|
-
copy.hashline_edit = experimental.hashline_edit;
|
|
6236
|
-
}
|
|
6237
|
-
delete experimental.hashline_edit;
|
|
6238
|
-
if (Object.keys(experimental).length === 0) {
|
|
6239
|
-
delete copy.experimental;
|
|
6240
|
-
}
|
|
6241
|
-
needsWrite = true;
|
|
6242
|
-
}
|
|
6243
|
-
}
|
|
6244
|
-
if (copy.disabled_agents && Array.isArray(copy.disabled_agents)) {
|
|
6245
|
-
const migrated = [];
|
|
6246
|
-
let changed = false;
|
|
6247
|
-
for (const agent of copy.disabled_agents) {
|
|
6248
|
-
const newAgent = AGENT_NAME_MAP[agent.toLowerCase()] ?? AGENT_NAME_MAP[agent] ?? agent;
|
|
6249
|
-
if (newAgent !== agent) {
|
|
6250
|
-
changed = true;
|
|
6251
|
-
}
|
|
6252
|
-
migrated.push(newAgent);
|
|
6253
|
-
}
|
|
6254
|
-
if (changed) {
|
|
6255
|
-
copy.disabled_agents = migrated;
|
|
6256
|
-
needsWrite = true;
|
|
6257
|
-
}
|
|
6258
|
-
}
|
|
6259
|
-
if (copy.disabled_hooks && Array.isArray(copy.disabled_hooks)) {
|
|
6260
|
-
const { migrated, changed, removed } = migrateHookNames(copy.disabled_hooks);
|
|
6261
|
-
if (changed) {
|
|
6262
|
-
copy.disabled_hooks = migrated;
|
|
6263
|
-
needsWrite = true;
|
|
6264
|
-
}
|
|
6265
|
-
if (removed.length > 0) {
|
|
6266
|
-
log(`Removed obsolete hooks from disabled_hooks: ${removed.join(", ")} (these hooks no longer exist in v3.0.0)`);
|
|
6267
|
-
}
|
|
6268
|
-
}
|
|
6269
|
-
if (needsWrite) {
|
|
6270
|
-
const timestamp2 = new Date().toISOString().replace(/[:.]/g, "-");
|
|
6271
|
-
const backupPath = `${configPath}.bak.${timestamp2}`;
|
|
6272
|
-
let backupSucceeded = false;
|
|
6273
|
-
try {
|
|
6274
|
-
fs2.copyFileSync(configPath, backupPath);
|
|
6275
|
-
backupSucceeded = true;
|
|
6276
|
-
} catch {
|
|
6277
|
-
backupSucceeded = false;
|
|
6278
|
-
}
|
|
6279
|
-
let writeSucceeded = false;
|
|
6280
|
-
try {
|
|
6281
|
-
writeFileAtomically(configPath, JSON.stringify(copy, null, 2) + `
|
|
6282
|
-
`);
|
|
6283
|
-
writeSucceeded = true;
|
|
6284
|
-
} catch (err) {
|
|
6285
|
-
log(`Failed to write migrated config to ${configPath}:`, err);
|
|
6286
|
-
}
|
|
6287
|
-
for (const key of Object.keys(rawConfig)) {
|
|
6288
|
-
delete rawConfig[key];
|
|
6289
|
-
}
|
|
6290
|
-
Object.assign(rawConfig, copy);
|
|
6291
|
-
if (writeSucceeded) {
|
|
6292
|
-
const backupMessage = backupSucceeded ? ` (backup: ${backupPath})` : "";
|
|
6293
|
-
log(`Migrated config file: ${configPath}${backupMessage}`);
|
|
6294
|
-
} else {
|
|
6295
|
-
const backupMessage = backupSucceeded ? ` (backup: ${backupPath})` : "";
|
|
6296
|
-
log(`Applied migrated config in-memory for: ${configPath}${backupMessage}`);
|
|
6297
|
-
}
|
|
6298
|
-
}
|
|
6299
|
-
return needsWrite;
|
|
6300
|
-
}
|
|
6301
6071
|
var init_config_migration = __esm(() => {
|
|
6302
6072
|
init_logger();
|
|
6303
|
-
init_write_file_atomically();
|
|
6304
6073
|
init_agent_names();
|
|
6305
6074
|
init_hook_names();
|
|
6306
|
-
init_model_versions();
|
|
6307
6075
|
});
|
|
6308
6076
|
|
|
6309
6077
|
// src/shared/migration.ts
|
|
@@ -6524,6 +6292,9 @@ var init_binary_downloader = __esm(() => {
|
|
|
6524
6292
|
init_zip_extractor();
|
|
6525
6293
|
});
|
|
6526
6294
|
|
|
6295
|
+
// src/shared/write-file-atomically.ts
|
|
6296
|
+
var init_write_file_atomically = () => {};
|
|
6297
|
+
|
|
6527
6298
|
// src/shared/model-requirements.ts
|
|
6528
6299
|
var AGENT_MODEL_REQUIREMENTS, CATEGORY_MODEL_REQUIREMENTS;
|
|
6529
6300
|
var init_model_requirements = __esm(() => {
|
|
@@ -6884,7 +6655,7 @@ function normalizeModelID(modelID) {
|
|
|
6884
6655
|
}
|
|
6885
6656
|
|
|
6886
6657
|
// src/shared/json-file-cache-store.ts
|
|
6887
|
-
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync
|
|
6658
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
6888
6659
|
import { join as join7 } from "path";
|
|
6889
6660
|
function toLogLabel(cacheLabel) {
|
|
6890
6661
|
return cacheLabel.toLowerCase();
|
|
@@ -6931,7 +6702,7 @@ function createJsonFileCacheStore(options) {
|
|
|
6931
6702
|
ensureCacheDir();
|
|
6932
6703
|
const cacheFile = getCacheFilePath();
|
|
6933
6704
|
try {
|
|
6934
|
-
|
|
6705
|
+
writeFileSync(cacheFile, options.serialize?.(value) ?? JSON.stringify(value, null, 2));
|
|
6935
6706
|
memoryValue = value;
|
|
6936
6707
|
log(`[${options.logPrefix}] ${options.cacheLabel} written`, options.describe(value));
|
|
6937
6708
|
} catch (error) {
|
|
@@ -49009,7 +48780,7 @@ var init_plugin_name_with_version = __esm(() => {
|
|
|
49009
48780
|
});
|
|
49010
48781
|
|
|
49011
48782
|
// src/cli/config-manager/backup-config.ts
|
|
49012
|
-
import { copyFileSync
|
|
48783
|
+
import { copyFileSync, existsSync as existsSync8, mkdirSync as mkdirSync3 } from "fs";
|
|
49013
48784
|
import { dirname } from "path";
|
|
49014
48785
|
function backupConfigFile(configPath) {
|
|
49015
48786
|
if (!existsSync8(configPath)) {
|
|
@@ -49022,7 +48793,7 @@ function backupConfigFile(configPath) {
|
|
|
49022
48793
|
if (!existsSync8(dir)) {
|
|
49023
48794
|
mkdirSync3(dir, { recursive: true });
|
|
49024
48795
|
}
|
|
49025
|
-
|
|
48796
|
+
copyFileSync(configPath, backupPath);
|
|
49026
48797
|
return { success: true, backupPath };
|
|
49027
48798
|
} catch (err) {
|
|
49028
48799
|
return {
|
|
@@ -49208,7 +48979,7 @@ function extractVersionFromPluginEntry(entry) {
|
|
|
49208
48979
|
}
|
|
49209
48980
|
|
|
49210
48981
|
// src/cli/config-manager/add-plugin-to-opencode-config.ts
|
|
49211
|
-
import { readFileSync as readFileSync6, writeFileSync as
|
|
48982
|
+
import { readFileSync as readFileSync6, writeFileSync as writeFileSync2 } from "fs";
|
|
49212
48983
|
async function addPluginToOpenCodeConfig(currentVersion) {
|
|
49213
48984
|
try {
|
|
49214
48985
|
ensureConfigDirectoryExists();
|
|
@@ -49224,7 +48995,7 @@ async function addPluginToOpenCodeConfig(currentVersion) {
|
|
|
49224
48995
|
try {
|
|
49225
48996
|
if (format2 === "none") {
|
|
49226
48997
|
const config2 = { plugin: [pluginEntry] };
|
|
49227
|
-
|
|
48998
|
+
writeFileSync2(path3, JSON.stringify(config2, null, 2) + `
|
|
49228
48999
|
`);
|
|
49229
49000
|
return { success: true, configPath: path3 };
|
|
49230
49001
|
}
|
|
@@ -49278,14 +49049,14 @@ async function addPluginToOpenCodeConfig(currentVersion) {
|
|
|
49278
49049
|
const newContent = content.replace(pluginArrayRegex, `$1[
|
|
49279
49050
|
${formattedPlugins}
|
|
49280
49051
|
]`);
|
|
49281
|
-
|
|
49052
|
+
writeFileSync2(path3, newContent);
|
|
49282
49053
|
} else {
|
|
49283
49054
|
const newContent = content.replace(/(\{)/, `$1
|
|
49284
49055
|
"plugin": ["${pluginEntry}"],`);
|
|
49285
|
-
|
|
49056
|
+
writeFileSync2(path3, newContent);
|
|
49286
49057
|
}
|
|
49287
49058
|
} else {
|
|
49288
|
-
|
|
49059
|
+
writeFileSync2(path3, JSON.stringify(config, null, 2) + `
|
|
49289
49060
|
`);
|
|
49290
49061
|
}
|
|
49291
49062
|
return { success: true, configPath: path3 };
|
|
@@ -49565,28 +49336,8 @@ var init_generate_omo_config = __esm(() => {
|
|
|
49565
49336
|
init_model_fallback();
|
|
49566
49337
|
});
|
|
49567
49338
|
|
|
49568
|
-
// src/cli/config-manager/deep-merge-record.ts
|
|
49569
|
-
function deepMergeRecord(target, source) {
|
|
49570
|
-
const result = { ...target };
|
|
49571
|
-
for (const key of Object.keys(source)) {
|
|
49572
|
-
if (key === "__proto__" || key === "constructor" || key === "prototype")
|
|
49573
|
-
continue;
|
|
49574
|
-
const sourceValue = source[key];
|
|
49575
|
-
const targetValue = result[key];
|
|
49576
|
-
if (sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) && targetValue !== null && typeof targetValue === "object" && !Array.isArray(targetValue)) {
|
|
49577
|
-
result[key] = deepMergeRecord(targetValue, sourceValue);
|
|
49578
|
-
} else if (sourceValue !== undefined) {
|
|
49579
|
-
result[key] = sourceValue;
|
|
49580
|
-
}
|
|
49581
|
-
}
|
|
49582
|
-
return result;
|
|
49583
|
-
}
|
|
49584
|
-
|
|
49585
49339
|
// src/cli/config-manager/write-omo-config.ts
|
|
49586
|
-
import { existsSync as existsSync11,
|
|
49587
|
-
function isEmptyOrWhitespace2(content) {
|
|
49588
|
-
return content.trim().length === 0;
|
|
49589
|
-
}
|
|
49340
|
+
import { existsSync as existsSync11, writeFileSync as writeFileSync3 } from "fs";
|
|
49590
49341
|
function writeOmoConfig(installConfig) {
|
|
49591
49342
|
try {
|
|
49592
49343
|
ensureConfigDirectoryExists();
|
|
@@ -49601,43 +49352,10 @@ function writeOmoConfig(installConfig) {
|
|
|
49601
49352
|
try {
|
|
49602
49353
|
const newConfig = generateOmoConfig(installConfig);
|
|
49603
49354
|
if (existsSync11(omoConfigPath)) {
|
|
49604
|
-
|
|
49605
|
-
if (!backupResult.success) {
|
|
49606
|
-
return {
|
|
49607
|
-
success: false,
|
|
49608
|
-
configPath: omoConfigPath,
|
|
49609
|
-
error: `Failed to create backup: ${backupResult.error}`
|
|
49610
|
-
};
|
|
49611
|
-
}
|
|
49612
|
-
try {
|
|
49613
|
-
const stat = statSync2(omoConfigPath);
|
|
49614
|
-
const content = readFileSync7(omoConfigPath, "utf-8");
|
|
49615
|
-
if (stat.size === 0 || isEmptyOrWhitespace2(content)) {
|
|
49616
|
-
writeFileSync4(omoConfigPath, JSON.stringify(newConfig, null, 2) + `
|
|
49617
|
-
`);
|
|
49618
|
-
return { success: true, configPath: omoConfigPath };
|
|
49619
|
-
}
|
|
49620
|
-
const existing = parseJsonc(content);
|
|
49621
|
-
if (!existing || typeof existing !== "object" || Array.isArray(existing)) {
|
|
49622
|
-
writeFileSync4(omoConfigPath, JSON.stringify(newConfig, null, 2) + `
|
|
49623
|
-
`);
|
|
49624
|
-
return { success: true, configPath: omoConfigPath };
|
|
49625
|
-
}
|
|
49626
|
-
const merged = deepMergeRecord(newConfig, existing);
|
|
49627
|
-
writeFileSync4(omoConfigPath, JSON.stringify(merged, null, 2) + `
|
|
49628
|
-
`);
|
|
49629
|
-
} catch (parseErr) {
|
|
49630
|
-
if (parseErr instanceof SyntaxError) {
|
|
49631
|
-
writeFileSync4(omoConfigPath, JSON.stringify(newConfig, null, 2) + `
|
|
49632
|
-
`);
|
|
49633
|
-
return { success: true, configPath: omoConfigPath };
|
|
49634
|
-
}
|
|
49635
|
-
throw parseErr;
|
|
49636
|
-
}
|
|
49637
|
-
} else {
|
|
49638
|
-
writeFileSync4(omoConfigPath, JSON.stringify(newConfig, null, 2) + `
|
|
49639
|
-
`);
|
|
49355
|
+
return { success: true, configPath: omoConfigPath };
|
|
49640
49356
|
}
|
|
49357
|
+
writeFileSync3(omoConfigPath, JSON.stringify(newConfig, null, 2) + `
|
|
49358
|
+
`);
|
|
49641
49359
|
return { success: true, configPath: omoConfigPath };
|
|
49642
49360
|
} catch (err) {
|
|
49643
49361
|
return {
|
|
@@ -49648,8 +49366,6 @@ function writeOmoConfig(installConfig) {
|
|
|
49648
49366
|
}
|
|
49649
49367
|
}
|
|
49650
49368
|
var init_write_omo_config = __esm(() => {
|
|
49651
|
-
init_shared();
|
|
49652
|
-
init_backup_config();
|
|
49653
49369
|
init_config_context();
|
|
49654
49370
|
init_ensure_config_directory_exists();
|
|
49655
49371
|
init_generate_omo_config();
|
|
@@ -49752,7 +49468,7 @@ var init_opencode_binary = __esm(() => {
|
|
|
49752
49468
|
});
|
|
49753
49469
|
|
|
49754
49470
|
// src/cli/config-manager/detect-current-config.ts
|
|
49755
|
-
import { existsSync as existsSync12, readFileSync as
|
|
49471
|
+
import { existsSync as existsSync12, readFileSync as readFileSync7 } from "fs";
|
|
49756
49472
|
function detectProvidersFromOmoConfig() {
|
|
49757
49473
|
const omoConfigPath = getOmoConfigPath();
|
|
49758
49474
|
if (!existsSync12(omoConfigPath)) {
|
|
@@ -49765,7 +49481,7 @@ function detectProvidersFromOmoConfig() {
|
|
|
49765
49481
|
};
|
|
49766
49482
|
}
|
|
49767
49483
|
try {
|
|
49768
|
-
const content =
|
|
49484
|
+
const content = readFileSync7(omoConfigPath, "utf-8");
|
|
49769
49485
|
const omoConfig = parseJsonc(content);
|
|
49770
49486
|
if (!omoConfig || typeof omoConfig !== "object") {
|
|
49771
49487
|
return {
|
|
@@ -50015,462 +49731,6 @@ var require_src = __commonJS((exports, module) => {
|
|
|
50015
49731
|
module.exports = { cursor, scroll, erase, beep };
|
|
50016
49732
|
});
|
|
50017
49733
|
|
|
50018
|
-
// node_modules/isexe/windows.js
|
|
50019
|
-
var require_windows = __commonJS((exports, module) => {
|
|
50020
|
-
module.exports = isexe;
|
|
50021
|
-
isexe.sync = sync;
|
|
50022
|
-
var fs4 = __require("fs");
|
|
50023
|
-
function checkPathExt(path4, options) {
|
|
50024
|
-
var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
|
|
50025
|
-
if (!pathext) {
|
|
50026
|
-
return true;
|
|
50027
|
-
}
|
|
50028
|
-
pathext = pathext.split(";");
|
|
50029
|
-
if (pathext.indexOf("") !== -1) {
|
|
50030
|
-
return true;
|
|
50031
|
-
}
|
|
50032
|
-
for (var i2 = 0;i2 < pathext.length; i2++) {
|
|
50033
|
-
var p2 = pathext[i2].toLowerCase();
|
|
50034
|
-
if (p2 && path4.substr(-p2.length).toLowerCase() === p2) {
|
|
50035
|
-
return true;
|
|
50036
|
-
}
|
|
50037
|
-
}
|
|
50038
|
-
return false;
|
|
50039
|
-
}
|
|
50040
|
-
function checkStat(stat, path4, options) {
|
|
50041
|
-
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
50042
|
-
return false;
|
|
50043
|
-
}
|
|
50044
|
-
return checkPathExt(path4, options);
|
|
50045
|
-
}
|
|
50046
|
-
function isexe(path4, options, cb) {
|
|
50047
|
-
fs4.stat(path4, function(er, stat) {
|
|
50048
|
-
cb(er, er ? false : checkStat(stat, path4, options));
|
|
50049
|
-
});
|
|
50050
|
-
}
|
|
50051
|
-
function sync(path4, options) {
|
|
50052
|
-
return checkStat(fs4.statSync(path4), path4, options);
|
|
50053
|
-
}
|
|
50054
|
-
});
|
|
50055
|
-
|
|
50056
|
-
// node_modules/isexe/mode.js
|
|
50057
|
-
var require_mode = __commonJS((exports, module) => {
|
|
50058
|
-
module.exports = isexe;
|
|
50059
|
-
isexe.sync = sync;
|
|
50060
|
-
var fs4 = __require("fs");
|
|
50061
|
-
function isexe(path4, options, cb) {
|
|
50062
|
-
fs4.stat(path4, function(er, stat) {
|
|
50063
|
-
cb(er, er ? false : checkStat(stat, options));
|
|
50064
|
-
});
|
|
50065
|
-
}
|
|
50066
|
-
function sync(path4, options) {
|
|
50067
|
-
return checkStat(fs4.statSync(path4), options);
|
|
50068
|
-
}
|
|
50069
|
-
function checkStat(stat, options) {
|
|
50070
|
-
return stat.isFile() && checkMode(stat, options);
|
|
50071
|
-
}
|
|
50072
|
-
function checkMode(stat, options) {
|
|
50073
|
-
var mod = stat.mode;
|
|
50074
|
-
var uid = stat.uid;
|
|
50075
|
-
var gid = stat.gid;
|
|
50076
|
-
var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
|
|
50077
|
-
var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
|
|
50078
|
-
var u2 = parseInt("100", 8);
|
|
50079
|
-
var g2 = parseInt("010", 8);
|
|
50080
|
-
var o2 = parseInt("001", 8);
|
|
50081
|
-
var ug = u2 | g2;
|
|
50082
|
-
var ret = mod & o2 || mod & g2 && gid === myGid || mod & u2 && uid === myUid || mod & ug && myUid === 0;
|
|
50083
|
-
return ret;
|
|
50084
|
-
}
|
|
50085
|
-
});
|
|
50086
|
-
|
|
50087
|
-
// node_modules/isexe/index.js
|
|
50088
|
-
var require_isexe = __commonJS((exports, module) => {
|
|
50089
|
-
var fs4 = __require("fs");
|
|
50090
|
-
var core3;
|
|
50091
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
50092
|
-
core3 = require_windows();
|
|
50093
|
-
} else {
|
|
50094
|
-
core3 = require_mode();
|
|
50095
|
-
}
|
|
50096
|
-
module.exports = isexe;
|
|
50097
|
-
isexe.sync = sync;
|
|
50098
|
-
function isexe(path4, options, cb) {
|
|
50099
|
-
if (typeof options === "function") {
|
|
50100
|
-
cb = options;
|
|
50101
|
-
options = {};
|
|
50102
|
-
}
|
|
50103
|
-
if (!cb) {
|
|
50104
|
-
if (typeof Promise !== "function") {
|
|
50105
|
-
throw new TypeError("callback not provided");
|
|
50106
|
-
}
|
|
50107
|
-
return new Promise(function(resolve2, reject) {
|
|
50108
|
-
isexe(path4, options || {}, function(er, is) {
|
|
50109
|
-
if (er) {
|
|
50110
|
-
reject(er);
|
|
50111
|
-
} else {
|
|
50112
|
-
resolve2(is);
|
|
50113
|
-
}
|
|
50114
|
-
});
|
|
50115
|
-
});
|
|
50116
|
-
}
|
|
50117
|
-
core3(path4, options || {}, function(er, is) {
|
|
50118
|
-
if (er) {
|
|
50119
|
-
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
50120
|
-
er = null;
|
|
50121
|
-
is = false;
|
|
50122
|
-
}
|
|
50123
|
-
}
|
|
50124
|
-
cb(er, is);
|
|
50125
|
-
});
|
|
50126
|
-
}
|
|
50127
|
-
function sync(path4, options) {
|
|
50128
|
-
try {
|
|
50129
|
-
return core3.sync(path4, options || {});
|
|
50130
|
-
} catch (er) {
|
|
50131
|
-
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
50132
|
-
return false;
|
|
50133
|
-
} else {
|
|
50134
|
-
throw er;
|
|
50135
|
-
}
|
|
50136
|
-
}
|
|
50137
|
-
}
|
|
50138
|
-
});
|
|
50139
|
-
|
|
50140
|
-
// node_modules/which/which.js
|
|
50141
|
-
var require_which = __commonJS((exports, module) => {
|
|
50142
|
-
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
50143
|
-
var path4 = __require("path");
|
|
50144
|
-
var COLON = isWindows ? ";" : ":";
|
|
50145
|
-
var isexe = require_isexe();
|
|
50146
|
-
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
50147
|
-
var getPathInfo = (cmd, opt) => {
|
|
50148
|
-
const colon = opt.colon || COLON;
|
|
50149
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
|
|
50150
|
-
...isWindows ? [process.cwd()] : [],
|
|
50151
|
-
...(opt.path || process.env.PATH || "").split(colon)
|
|
50152
|
-
];
|
|
50153
|
-
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
50154
|
-
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
50155
|
-
if (isWindows) {
|
|
50156
|
-
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
|
|
50157
|
-
pathExt.unshift("");
|
|
50158
|
-
}
|
|
50159
|
-
return {
|
|
50160
|
-
pathEnv,
|
|
50161
|
-
pathExt,
|
|
50162
|
-
pathExtExe
|
|
50163
|
-
};
|
|
50164
|
-
};
|
|
50165
|
-
var which = (cmd, opt, cb) => {
|
|
50166
|
-
if (typeof opt === "function") {
|
|
50167
|
-
cb = opt;
|
|
50168
|
-
opt = {};
|
|
50169
|
-
}
|
|
50170
|
-
if (!opt)
|
|
50171
|
-
opt = {};
|
|
50172
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
50173
|
-
const found = [];
|
|
50174
|
-
const step = (i2) => new Promise((resolve2, reject) => {
|
|
50175
|
-
if (i2 === pathEnv.length)
|
|
50176
|
-
return opt.all && found.length ? resolve2(found) : reject(getNotFoundError(cmd));
|
|
50177
|
-
const ppRaw = pathEnv[i2];
|
|
50178
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
50179
|
-
const pCmd = path4.join(pathPart, cmd);
|
|
50180
|
-
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
50181
|
-
resolve2(subStep(p2, i2, 0));
|
|
50182
|
-
});
|
|
50183
|
-
const subStep = (p2, i2, ii) => new Promise((resolve2, reject) => {
|
|
50184
|
-
if (ii === pathExt.length)
|
|
50185
|
-
return resolve2(step(i2 + 1));
|
|
50186
|
-
const ext = pathExt[ii];
|
|
50187
|
-
isexe(p2 + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
50188
|
-
if (!er && is) {
|
|
50189
|
-
if (opt.all)
|
|
50190
|
-
found.push(p2 + ext);
|
|
50191
|
-
else
|
|
50192
|
-
return resolve2(p2 + ext);
|
|
50193
|
-
}
|
|
50194
|
-
return resolve2(subStep(p2, i2, ii + 1));
|
|
50195
|
-
});
|
|
50196
|
-
});
|
|
50197
|
-
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
50198
|
-
};
|
|
50199
|
-
var whichSync = (cmd, opt) => {
|
|
50200
|
-
opt = opt || {};
|
|
50201
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
50202
|
-
const found = [];
|
|
50203
|
-
for (let i2 = 0;i2 < pathEnv.length; i2++) {
|
|
50204
|
-
const ppRaw = pathEnv[i2];
|
|
50205
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
50206
|
-
const pCmd = path4.join(pathPart, cmd);
|
|
50207
|
-
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
50208
|
-
for (let j2 = 0;j2 < pathExt.length; j2++) {
|
|
50209
|
-
const cur = p2 + pathExt[j2];
|
|
50210
|
-
try {
|
|
50211
|
-
const is = isexe.sync(cur, { pathExt: pathExtExe });
|
|
50212
|
-
if (is) {
|
|
50213
|
-
if (opt.all)
|
|
50214
|
-
found.push(cur);
|
|
50215
|
-
else
|
|
50216
|
-
return cur;
|
|
50217
|
-
}
|
|
50218
|
-
} catch (ex) {}
|
|
50219
|
-
}
|
|
50220
|
-
}
|
|
50221
|
-
if (opt.all && found.length)
|
|
50222
|
-
return found;
|
|
50223
|
-
if (opt.nothrow)
|
|
50224
|
-
return null;
|
|
50225
|
-
throw getNotFoundError(cmd);
|
|
50226
|
-
};
|
|
50227
|
-
module.exports = which;
|
|
50228
|
-
which.sync = whichSync;
|
|
50229
|
-
});
|
|
50230
|
-
|
|
50231
|
-
// node_modules/path-key/index.js
|
|
50232
|
-
var require_path_key = __commonJS((exports, module) => {
|
|
50233
|
-
var pathKey = (options = {}) => {
|
|
50234
|
-
const environment = options.env || process.env;
|
|
50235
|
-
const platform = options.platform || process.platform;
|
|
50236
|
-
if (platform !== "win32") {
|
|
50237
|
-
return "PATH";
|
|
50238
|
-
}
|
|
50239
|
-
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
50240
|
-
};
|
|
50241
|
-
module.exports = pathKey;
|
|
50242
|
-
module.exports.default = pathKey;
|
|
50243
|
-
});
|
|
50244
|
-
|
|
50245
|
-
// node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
50246
|
-
var require_resolveCommand = __commonJS((exports, module) => {
|
|
50247
|
-
var path4 = __require("path");
|
|
50248
|
-
var which = require_which();
|
|
50249
|
-
var getPathKey = require_path_key();
|
|
50250
|
-
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
50251
|
-
const env = parsed.options.env || process.env;
|
|
50252
|
-
const cwd = process.cwd();
|
|
50253
|
-
const hasCustomCwd = parsed.options.cwd != null;
|
|
50254
|
-
const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
|
|
50255
|
-
if (shouldSwitchCwd) {
|
|
50256
|
-
try {
|
|
50257
|
-
process.chdir(parsed.options.cwd);
|
|
50258
|
-
} catch (err) {}
|
|
50259
|
-
}
|
|
50260
|
-
let resolved;
|
|
50261
|
-
try {
|
|
50262
|
-
resolved = which.sync(parsed.command, {
|
|
50263
|
-
path: env[getPathKey({ env })],
|
|
50264
|
-
pathExt: withoutPathExt ? path4.delimiter : undefined
|
|
50265
|
-
});
|
|
50266
|
-
} catch (e2) {} finally {
|
|
50267
|
-
if (shouldSwitchCwd) {
|
|
50268
|
-
process.chdir(cwd);
|
|
50269
|
-
}
|
|
50270
|
-
}
|
|
50271
|
-
if (resolved) {
|
|
50272
|
-
resolved = path4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
50273
|
-
}
|
|
50274
|
-
return resolved;
|
|
50275
|
-
}
|
|
50276
|
-
function resolveCommand(parsed) {
|
|
50277
|
-
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
50278
|
-
}
|
|
50279
|
-
module.exports = resolveCommand;
|
|
50280
|
-
});
|
|
50281
|
-
|
|
50282
|
-
// node_modules/cross-spawn/lib/util/escape.js
|
|
50283
|
-
var require_escape = __commonJS((exports, module) => {
|
|
50284
|
-
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
50285
|
-
function escapeCommand(arg) {
|
|
50286
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
50287
|
-
return arg;
|
|
50288
|
-
}
|
|
50289
|
-
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
50290
|
-
arg = `${arg}`;
|
|
50291
|
-
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
50292
|
-
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
50293
|
-
arg = `"${arg}"`;
|
|
50294
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
50295
|
-
if (doubleEscapeMetaChars) {
|
|
50296
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
50297
|
-
}
|
|
50298
|
-
return arg;
|
|
50299
|
-
}
|
|
50300
|
-
exports.command = escapeCommand;
|
|
50301
|
-
exports.argument = escapeArgument;
|
|
50302
|
-
});
|
|
50303
|
-
|
|
50304
|
-
// node_modules/shebang-regex/index.js
|
|
50305
|
-
var require_shebang_regex = __commonJS((exports, module) => {
|
|
50306
|
-
module.exports = /^#!(.*)/;
|
|
50307
|
-
});
|
|
50308
|
-
|
|
50309
|
-
// node_modules/shebang-command/index.js
|
|
50310
|
-
var require_shebang_command = __commonJS((exports, module) => {
|
|
50311
|
-
var shebangRegex = require_shebang_regex();
|
|
50312
|
-
module.exports = (string4 = "") => {
|
|
50313
|
-
const match = string4.match(shebangRegex);
|
|
50314
|
-
if (!match) {
|
|
50315
|
-
return null;
|
|
50316
|
-
}
|
|
50317
|
-
const [path4, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
50318
|
-
const binary2 = path4.split("/").pop();
|
|
50319
|
-
if (binary2 === "env") {
|
|
50320
|
-
return argument;
|
|
50321
|
-
}
|
|
50322
|
-
return argument ? `${binary2} ${argument}` : binary2;
|
|
50323
|
-
};
|
|
50324
|
-
});
|
|
50325
|
-
|
|
50326
|
-
// node_modules/cross-spawn/lib/util/readShebang.js
|
|
50327
|
-
var require_readShebang = __commonJS((exports, module) => {
|
|
50328
|
-
var fs4 = __require("fs");
|
|
50329
|
-
var shebangCommand = require_shebang_command();
|
|
50330
|
-
function readShebang(command) {
|
|
50331
|
-
const size = 150;
|
|
50332
|
-
const buffer2 = Buffer.alloc(size);
|
|
50333
|
-
let fd;
|
|
50334
|
-
try {
|
|
50335
|
-
fd = fs4.openSync(command, "r");
|
|
50336
|
-
fs4.readSync(fd, buffer2, 0, size, 0);
|
|
50337
|
-
fs4.closeSync(fd);
|
|
50338
|
-
} catch (e2) {}
|
|
50339
|
-
return shebangCommand(buffer2.toString());
|
|
50340
|
-
}
|
|
50341
|
-
module.exports = readShebang;
|
|
50342
|
-
});
|
|
50343
|
-
|
|
50344
|
-
// node_modules/cross-spawn/lib/parse.js
|
|
50345
|
-
var require_parse = __commonJS((exports, module) => {
|
|
50346
|
-
var path4 = __require("path");
|
|
50347
|
-
var resolveCommand = require_resolveCommand();
|
|
50348
|
-
var escape = require_escape();
|
|
50349
|
-
var readShebang = require_readShebang();
|
|
50350
|
-
var isWin = process.platform === "win32";
|
|
50351
|
-
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
50352
|
-
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
50353
|
-
function detectShebang(parsed) {
|
|
50354
|
-
parsed.file = resolveCommand(parsed);
|
|
50355
|
-
const shebang = parsed.file && readShebang(parsed.file);
|
|
50356
|
-
if (shebang) {
|
|
50357
|
-
parsed.args.unshift(parsed.file);
|
|
50358
|
-
parsed.command = shebang;
|
|
50359
|
-
return resolveCommand(parsed);
|
|
50360
|
-
}
|
|
50361
|
-
return parsed.file;
|
|
50362
|
-
}
|
|
50363
|
-
function parseNonShell(parsed) {
|
|
50364
|
-
if (!isWin) {
|
|
50365
|
-
return parsed;
|
|
50366
|
-
}
|
|
50367
|
-
const commandFile = detectShebang(parsed);
|
|
50368
|
-
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
50369
|
-
if (parsed.options.forceShell || needsShell) {
|
|
50370
|
-
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
50371
|
-
parsed.command = path4.normalize(parsed.command);
|
|
50372
|
-
parsed.command = escape.command(parsed.command);
|
|
50373
|
-
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
50374
|
-
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
50375
|
-
parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
|
|
50376
|
-
parsed.command = process.env.comspec || "cmd.exe";
|
|
50377
|
-
parsed.options.windowsVerbatimArguments = true;
|
|
50378
|
-
}
|
|
50379
|
-
return parsed;
|
|
50380
|
-
}
|
|
50381
|
-
function parse7(command, args, options) {
|
|
50382
|
-
if (args && !Array.isArray(args)) {
|
|
50383
|
-
options = args;
|
|
50384
|
-
args = null;
|
|
50385
|
-
}
|
|
50386
|
-
args = args ? args.slice(0) : [];
|
|
50387
|
-
options = Object.assign({}, options);
|
|
50388
|
-
const parsed = {
|
|
50389
|
-
command,
|
|
50390
|
-
args,
|
|
50391
|
-
options,
|
|
50392
|
-
file: undefined,
|
|
50393
|
-
original: {
|
|
50394
|
-
command,
|
|
50395
|
-
args
|
|
50396
|
-
}
|
|
50397
|
-
};
|
|
50398
|
-
return options.shell ? parsed : parseNonShell(parsed);
|
|
50399
|
-
}
|
|
50400
|
-
module.exports = parse7;
|
|
50401
|
-
});
|
|
50402
|
-
|
|
50403
|
-
// node_modules/cross-spawn/lib/enoent.js
|
|
50404
|
-
var require_enoent = __commonJS((exports, module) => {
|
|
50405
|
-
var isWin = process.platform === "win32";
|
|
50406
|
-
function notFoundError(original, syscall) {
|
|
50407
|
-
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
50408
|
-
code: "ENOENT",
|
|
50409
|
-
errno: "ENOENT",
|
|
50410
|
-
syscall: `${syscall} ${original.command}`,
|
|
50411
|
-
path: original.command,
|
|
50412
|
-
spawnargs: original.args
|
|
50413
|
-
});
|
|
50414
|
-
}
|
|
50415
|
-
function hookChildProcess(cp, parsed) {
|
|
50416
|
-
if (!isWin) {
|
|
50417
|
-
return;
|
|
50418
|
-
}
|
|
50419
|
-
const originalEmit = cp.emit;
|
|
50420
|
-
cp.emit = function(name, arg1) {
|
|
50421
|
-
if (name === "exit") {
|
|
50422
|
-
const err = verifyENOENT(arg1, parsed);
|
|
50423
|
-
if (err) {
|
|
50424
|
-
return originalEmit.call(cp, "error", err);
|
|
50425
|
-
}
|
|
50426
|
-
}
|
|
50427
|
-
return originalEmit.apply(cp, arguments);
|
|
50428
|
-
};
|
|
50429
|
-
}
|
|
50430
|
-
function verifyENOENT(status, parsed) {
|
|
50431
|
-
if (isWin && status === 1 && !parsed.file) {
|
|
50432
|
-
return notFoundError(parsed.original, "spawn");
|
|
50433
|
-
}
|
|
50434
|
-
return null;
|
|
50435
|
-
}
|
|
50436
|
-
function verifyENOENTSync(status, parsed) {
|
|
50437
|
-
if (isWin && status === 1 && !parsed.file) {
|
|
50438
|
-
return notFoundError(parsed.original, "spawnSync");
|
|
50439
|
-
}
|
|
50440
|
-
return null;
|
|
50441
|
-
}
|
|
50442
|
-
module.exports = {
|
|
50443
|
-
hookChildProcess,
|
|
50444
|
-
verifyENOENT,
|
|
50445
|
-
verifyENOENTSync,
|
|
50446
|
-
notFoundError
|
|
50447
|
-
};
|
|
50448
|
-
});
|
|
50449
|
-
|
|
50450
|
-
// node_modules/cross-spawn/index.js
|
|
50451
|
-
var require_cross_spawn = __commonJS((exports, module) => {
|
|
50452
|
-
var cp = __require("child_process");
|
|
50453
|
-
var parse7 = require_parse();
|
|
50454
|
-
var enoent = require_enoent();
|
|
50455
|
-
function spawn(command, args, options) {
|
|
50456
|
-
const parsed = parse7(command, args, options);
|
|
50457
|
-
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
50458
|
-
enoent.hookChildProcess(spawned, parsed);
|
|
50459
|
-
return spawned;
|
|
50460
|
-
}
|
|
50461
|
-
function spawnSync(command, args, options) {
|
|
50462
|
-
const parsed = parse7(command, args, options);
|
|
50463
|
-
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
50464
|
-
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
50465
|
-
return result;
|
|
50466
|
-
}
|
|
50467
|
-
module.exports = spawn;
|
|
50468
|
-
module.exports.spawn = spawn;
|
|
50469
|
-
module.exports.sync = spawnSync;
|
|
50470
|
-
module.exports._parse = parse7;
|
|
50471
|
-
module.exports._enoent = enoent;
|
|
50472
|
-
});
|
|
50473
|
-
|
|
50474
49734
|
// src/hooks/auto-update-checker/constants.ts
|
|
50475
49735
|
import * as path4 from "path";
|
|
50476
49736
|
import * as os3 from "os";
|
|
@@ -50537,7 +49797,7 @@ function stripJsonComments(json3) {
|
|
|
50537
49797
|
}
|
|
50538
49798
|
|
|
50539
49799
|
// src/hooks/auto-update-checker/checker/local-dev-path.ts
|
|
50540
|
-
import * as
|
|
49800
|
+
import * as fs3 from "fs";
|
|
50541
49801
|
import { fileURLToPath } from "url";
|
|
50542
49802
|
function isLocalDevMode(directory) {
|
|
50543
49803
|
return getLocalDevPath(directory) !== null;
|
|
@@ -50545,9 +49805,9 @@ function isLocalDevMode(directory) {
|
|
|
50545
49805
|
function getLocalDevPath(directory) {
|
|
50546
49806
|
for (const configPath of getConfigPaths(directory)) {
|
|
50547
49807
|
try {
|
|
50548
|
-
if (!
|
|
49808
|
+
if (!fs3.existsSync(configPath))
|
|
50549
49809
|
continue;
|
|
50550
|
-
const content =
|
|
49810
|
+
const content = fs3.readFileSync(configPath, "utf-8");
|
|
50551
49811
|
const config2 = JSON.parse(stripJsonComments(content));
|
|
50552
49812
|
const plugins = config2.plugin ?? [];
|
|
50553
49813
|
for (const entry of plugins) {
|
|
@@ -50571,17 +49831,17 @@ var init_local_dev_path = __esm(() => {
|
|
|
50571
49831
|
});
|
|
50572
49832
|
|
|
50573
49833
|
// src/hooks/auto-update-checker/checker/package-json-locator.ts
|
|
50574
|
-
import * as
|
|
49834
|
+
import * as fs4 from "fs";
|
|
50575
49835
|
import * as path6 from "path";
|
|
50576
49836
|
function findPackageJsonUp(startPath) {
|
|
50577
49837
|
try {
|
|
50578
|
-
const stat =
|
|
49838
|
+
const stat = fs4.statSync(startPath);
|
|
50579
49839
|
let dir = stat.isDirectory() ? startPath : path6.dirname(startPath);
|
|
50580
49840
|
for (let i2 = 0;i2 < 10; i2++) {
|
|
50581
49841
|
const pkgPath = path6.join(dir, "package.json");
|
|
50582
|
-
if (
|
|
49842
|
+
if (fs4.existsSync(pkgPath)) {
|
|
50583
49843
|
try {
|
|
50584
|
-
const content =
|
|
49844
|
+
const content = fs4.readFileSync(pkgPath, "utf-8");
|
|
50585
49845
|
const pkg = JSON.parse(content);
|
|
50586
49846
|
if (pkg.name === PACKAGE_NAME2)
|
|
50587
49847
|
return pkgPath;
|
|
@@ -50600,7 +49860,7 @@ var init_package_json_locator = __esm(() => {
|
|
|
50600
49860
|
});
|
|
50601
49861
|
|
|
50602
49862
|
// src/hooks/auto-update-checker/checker/local-dev-version.ts
|
|
50603
|
-
import * as
|
|
49863
|
+
import * as fs5 from "fs";
|
|
50604
49864
|
function getLocalDevVersion(directory) {
|
|
50605
49865
|
const localPath = getLocalDevPath(directory);
|
|
50606
49866
|
if (!localPath)
|
|
@@ -50609,7 +49869,7 @@ function getLocalDevVersion(directory) {
|
|
|
50609
49869
|
const pkgPath = findPackageJsonUp(localPath);
|
|
50610
49870
|
if (!pkgPath)
|
|
50611
49871
|
return null;
|
|
50612
|
-
const content =
|
|
49872
|
+
const content = fs5.readFileSync(pkgPath, "utf-8");
|
|
50613
49873
|
const pkg = JSON.parse(content);
|
|
50614
49874
|
return pkg.version ?? null;
|
|
50615
49875
|
} catch {
|
|
@@ -50622,13 +49882,13 @@ var init_local_dev_version = __esm(() => {
|
|
|
50622
49882
|
});
|
|
50623
49883
|
|
|
50624
49884
|
// src/hooks/auto-update-checker/checker/plugin-entry.ts
|
|
50625
|
-
import * as
|
|
49885
|
+
import * as fs6 from "fs";
|
|
50626
49886
|
function findPluginEntry(directory) {
|
|
50627
49887
|
for (const configPath of getConfigPaths(directory)) {
|
|
50628
49888
|
try {
|
|
50629
|
-
if (!
|
|
49889
|
+
if (!fs6.existsSync(configPath))
|
|
50630
49890
|
continue;
|
|
50631
|
-
const content =
|
|
49891
|
+
const content = fs6.readFileSync(configPath, "utf-8");
|
|
50632
49892
|
const config2 = JSON.parse(stripJsonComments(content));
|
|
50633
49893
|
const plugins = config2.plugin ?? [];
|
|
50634
49894
|
for (const entry of plugins) {
|
|
@@ -50659,13 +49919,13 @@ var init_plugin_entry = __esm(() => {
|
|
|
50659
49919
|
});
|
|
50660
49920
|
|
|
50661
49921
|
// src/hooks/auto-update-checker/checker/cached-version.ts
|
|
50662
|
-
import * as
|
|
49922
|
+
import * as fs7 from "fs";
|
|
50663
49923
|
import * as path7 from "path";
|
|
50664
49924
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
50665
49925
|
function getCachedVersion() {
|
|
50666
49926
|
try {
|
|
50667
|
-
if (
|
|
50668
|
-
const content =
|
|
49927
|
+
if (fs7.existsSync(INSTALLED_PACKAGE_JSON)) {
|
|
49928
|
+
const content = fs7.readFileSync(INSTALLED_PACKAGE_JSON, "utf-8");
|
|
50669
49929
|
const pkg = JSON.parse(content);
|
|
50670
49930
|
if (pkg.version)
|
|
50671
49931
|
return pkg.version;
|
|
@@ -50675,7 +49935,7 @@ function getCachedVersion() {
|
|
|
50675
49935
|
const currentDir = path7.dirname(fileURLToPath2(import.meta.url));
|
|
50676
49936
|
const pkgPath = findPackageJsonUp(currentDir);
|
|
50677
49937
|
if (pkgPath) {
|
|
50678
|
-
const content =
|
|
49938
|
+
const content = fs7.readFileSync(pkgPath, "utf-8");
|
|
50679
49939
|
const pkg = JSON.parse(content);
|
|
50680
49940
|
if (pkg.version)
|
|
50681
49941
|
return pkg.version;
|
|
@@ -50684,10 +49944,10 @@ function getCachedVersion() {
|
|
|
50684
49944
|
log("[auto-update-checker] Failed to resolve version from current directory:", err);
|
|
50685
49945
|
}
|
|
50686
49946
|
try {
|
|
50687
|
-
const execDir = path7.dirname(
|
|
49947
|
+
const execDir = path7.dirname(fs7.realpathSync(process.execPath));
|
|
50688
49948
|
const pkgPath = findPackageJsonUp(execDir);
|
|
50689
49949
|
if (pkgPath) {
|
|
50690
|
-
const content =
|
|
49950
|
+
const content = fs7.readFileSync(pkgPath, "utf-8");
|
|
50691
49951
|
const pkg = JSON.parse(content);
|
|
50692
49952
|
if (pkg.version)
|
|
50693
49953
|
return pkg.version;
|
|
@@ -50700,8 +49960,8 @@ function getCachedVersion() {
|
|
|
50700
49960
|
let dir = path7.dirname(currentFile);
|
|
50701
49961
|
for (let i2 = 0;i2 < 10; i2++) {
|
|
50702
49962
|
const pkgPath = path7.join(dir, "package.json");
|
|
50703
|
-
if (
|
|
50704
|
-
const content =
|
|
49963
|
+
if (fs7.existsSync(pkgPath)) {
|
|
49964
|
+
const content = fs7.readFileSync(pkgPath, "utf-8");
|
|
50705
49965
|
const pkg = JSON.parse(content);
|
|
50706
49966
|
if (pkg.version)
|
|
50707
49967
|
return pkg.version;
|
|
@@ -50846,11 +50106,11 @@ var init_check_for_update = __esm(() => {
|
|
|
50846
50106
|
|
|
50847
50107
|
// src/hooks/auto-update-checker/checker/sync-package-json.ts
|
|
50848
50108
|
import * as crypto from "crypto";
|
|
50849
|
-
import * as
|
|
50109
|
+
import * as fs8 from "fs";
|
|
50850
50110
|
import * as path8 from "path";
|
|
50851
50111
|
function safeUnlink(filePath) {
|
|
50852
50112
|
try {
|
|
50853
|
-
|
|
50113
|
+
fs8.unlinkSync(filePath);
|
|
50854
50114
|
} catch (err) {
|
|
50855
50115
|
log(`[auto-update-checker] Failed to cleanup temp file: ${filePath}`, err);
|
|
50856
50116
|
}
|
|
@@ -50864,9 +50124,9 @@ function getIntentVersion(pluginInfo) {
|
|
|
50864
50124
|
function writeCachePackageJson(cachePackageJsonPath, pkgJson) {
|
|
50865
50125
|
const tmpPath = `${cachePackageJsonPath}.${crypto.randomUUID()}`;
|
|
50866
50126
|
try {
|
|
50867
|
-
|
|
50868
|
-
|
|
50869
|
-
|
|
50127
|
+
fs8.mkdirSync(path8.dirname(cachePackageJsonPath), { recursive: true });
|
|
50128
|
+
fs8.writeFileSync(tmpPath, JSON.stringify(pkgJson, null, 2));
|
|
50129
|
+
fs8.renameSync(tmpPath, cachePackageJsonPath);
|
|
50870
50130
|
return { synced: true, error: null };
|
|
50871
50131
|
} catch (err) {
|
|
50872
50132
|
log("[auto-update-checker] Failed to write cache package.json:", err);
|
|
@@ -50877,7 +50137,7 @@ function writeCachePackageJson(cachePackageJsonPath, pkgJson) {
|
|
|
50877
50137
|
function syncCachePackageJsonToIntent(pluginInfo) {
|
|
50878
50138
|
const cachePackageJsonPath = path8.join(CACHE_DIR, "package.json");
|
|
50879
50139
|
const intentVersion = getIntentVersion(pluginInfo);
|
|
50880
|
-
if (!
|
|
50140
|
+
if (!fs8.existsSync(cachePackageJsonPath)) {
|
|
50881
50141
|
log("[auto-update-checker] Cache package.json missing, creating workspace package.json", { intentVersion });
|
|
50882
50142
|
return {
|
|
50883
50143
|
...writeCachePackageJson(cachePackageJsonPath, { dependencies: { [PACKAGE_NAME2]: intentVersion } }),
|
|
@@ -50887,7 +50147,7 @@ function syncCachePackageJsonToIntent(pluginInfo) {
|
|
|
50887
50147
|
let content;
|
|
50888
50148
|
let pkgJson;
|
|
50889
50149
|
try {
|
|
50890
|
-
content =
|
|
50150
|
+
content = fs8.readFileSync(cachePackageJsonPath, "utf-8");
|
|
50891
50151
|
} catch (err) {
|
|
50892
50152
|
log("[auto-update-checker] Failed to read cache package.json:", err);
|
|
50893
50153
|
return { synced: false, error: "parse_error", message: "Failed to read cache package.json" };
|
|
@@ -50950,18 +50210,18 @@ var init_checker = __esm(() => {
|
|
|
50950
50210
|
});
|
|
50951
50211
|
|
|
50952
50212
|
// src/hooks/auto-update-checker/cache.ts
|
|
50953
|
-
import * as
|
|
50213
|
+
import * as fs9 from "fs";
|
|
50954
50214
|
import * as path9 from "path";
|
|
50955
50215
|
function stripTrailingCommas(json3) {
|
|
50956
50216
|
return json3.replace(/,(\s*[}\]])/g, "$1");
|
|
50957
50217
|
}
|
|
50958
50218
|
function removeFromTextBunLock(lockPath, packageName) {
|
|
50959
50219
|
try {
|
|
50960
|
-
const content =
|
|
50220
|
+
const content = fs9.readFileSync(lockPath, "utf-8");
|
|
50961
50221
|
const lock = JSON.parse(stripTrailingCommas(content));
|
|
50962
50222
|
if (lock.packages?.[packageName]) {
|
|
50963
50223
|
delete lock.packages[packageName];
|
|
50964
|
-
|
|
50224
|
+
fs9.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
|
|
50965
50225
|
log(`[auto-update-checker] Removed from bun.lock: ${packageName}`);
|
|
50966
50226
|
return true;
|
|
50967
50227
|
}
|
|
@@ -50972,7 +50232,7 @@ function removeFromTextBunLock(lockPath, packageName) {
|
|
|
50972
50232
|
}
|
|
50973
50233
|
function deleteBinaryBunLock(lockPath) {
|
|
50974
50234
|
try {
|
|
50975
|
-
|
|
50235
|
+
fs9.unlinkSync(lockPath);
|
|
50976
50236
|
log(`[auto-update-checker] Removed bun.lockb to force re-resolution`);
|
|
50977
50237
|
return true;
|
|
50978
50238
|
} catch {
|
|
@@ -50982,10 +50242,10 @@ function deleteBinaryBunLock(lockPath) {
|
|
|
50982
50242
|
function removeFromBunLock(packageName) {
|
|
50983
50243
|
const textLockPath = path9.join(CACHE_DIR, "bun.lock");
|
|
50984
50244
|
const binaryLockPath = path9.join(CACHE_DIR, "bun.lockb");
|
|
50985
|
-
if (
|
|
50245
|
+
if (fs9.existsSync(textLockPath)) {
|
|
50986
50246
|
return removeFromTextBunLock(textLockPath, packageName);
|
|
50987
50247
|
}
|
|
50988
|
-
if (
|
|
50248
|
+
if (fs9.existsSync(binaryLockPath)) {
|
|
50989
50249
|
return deleteBinaryBunLock(binaryLockPath);
|
|
50990
50250
|
}
|
|
50991
50251
|
return false;
|
|
@@ -51000,8 +50260,8 @@ function invalidatePackage(packageName = PACKAGE_NAME2) {
|
|
|
51000
50260
|
let packageRemoved = false;
|
|
51001
50261
|
let lockRemoved = false;
|
|
51002
50262
|
for (const pkgDir of pkgDirs) {
|
|
51003
|
-
if (
|
|
51004
|
-
|
|
50263
|
+
if (fs9.existsSync(pkgDir)) {
|
|
50264
|
+
fs9.rmSync(pkgDir, { recursive: true, force: true });
|
|
51005
50265
|
log(`[auto-update-checker] Package removed: ${pkgDir}`);
|
|
51006
50266
|
packageRemoved = true;
|
|
51007
50267
|
}
|
|
@@ -51455,7 +50715,7 @@ var {
|
|
|
51455
50715
|
// package.json
|
|
51456
50716
|
var package_default = {
|
|
51457
50717
|
name: "evil-omo",
|
|
51458
|
-
version: "3.16.
|
|
50718
|
+
version: "3.16.1",
|
|
51459
50719
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
51460
50720
|
main: "./dist/index.js",
|
|
51461
50721
|
types: "dist/index.d.ts",
|
|
@@ -53316,7 +52576,7 @@ async function processEvents(ctx, stream, state) {
|
|
|
53316
52576
|
}
|
|
53317
52577
|
}
|
|
53318
52578
|
// src/plugin-config.ts
|
|
53319
|
-
import * as
|
|
52579
|
+
import * as fs2 from "fs";
|
|
53320
52580
|
import * as path3 from "path";
|
|
53321
52581
|
|
|
53322
52582
|
// node_modules/zod/v4/classic/external.js
|
|
@@ -67422,10 +66682,9 @@ function parseConfigPartially(rawConfig) {
|
|
|
67422
66682
|
}
|
|
67423
66683
|
function loadConfigFromPath(configPath, _ctx) {
|
|
67424
66684
|
try {
|
|
67425
|
-
if (
|
|
67426
|
-
const content =
|
|
66685
|
+
if (fs2.existsSync(configPath)) {
|
|
66686
|
+
const content = fs2.readFileSync(configPath, "utf-8");
|
|
67427
66687
|
const rawConfig = parseJsonc(content);
|
|
67428
|
-
migrateConfigFile(configPath, rawConfig);
|
|
67429
66688
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
67430
66689
|
if (result.success) {
|
|
67431
66690
|
log(`Config loaded from ${configPath}`, { agents: result.data.agents });
|
|
@@ -68864,31 +68123,6 @@ class OpencodeClient extends _HeyApiClient {
|
|
|
68864
68123
|
}
|
|
68865
68124
|
|
|
68866
68125
|
// node_modules/@opencode-ai/sdk/dist/client.js
|
|
68867
|
-
function pick2(value, fallback) {
|
|
68868
|
-
if (!value)
|
|
68869
|
-
return;
|
|
68870
|
-
if (!fallback)
|
|
68871
|
-
return value;
|
|
68872
|
-
if (value === fallback)
|
|
68873
|
-
return fallback;
|
|
68874
|
-
if (value === encodeURIComponent(fallback))
|
|
68875
|
-
return fallback;
|
|
68876
|
-
return value;
|
|
68877
|
-
}
|
|
68878
|
-
function rewrite(request, directory) {
|
|
68879
|
-
if (request.method !== "GET" && request.method !== "HEAD")
|
|
68880
|
-
return request;
|
|
68881
|
-
const value = pick2(request.headers.get("x-opencode-directory"), directory);
|
|
68882
|
-
if (!value)
|
|
68883
|
-
return request;
|
|
68884
|
-
const url2 = new URL(request.url);
|
|
68885
|
-
if (!url2.searchParams.has("directory")) {
|
|
68886
|
-
url2.searchParams.set("directory", value);
|
|
68887
|
-
}
|
|
68888
|
-
const next = new Request(url2, request);
|
|
68889
|
-
next.headers.delete("x-opencode-directory");
|
|
68890
|
-
return next;
|
|
68891
|
-
}
|
|
68892
68126
|
function createOpencodeClient(config2) {
|
|
68893
68127
|
if (!config2?.fetch) {
|
|
68894
68128
|
const customFetch = (req) => {
|
|
@@ -68907,46 +68141,10 @@ function createOpencodeClient(config2) {
|
|
|
68907
68141
|
};
|
|
68908
68142
|
}
|
|
68909
68143
|
const client2 = createClient(config2);
|
|
68910
|
-
client2.interceptors.request.use((request) => rewrite(request, config2?.directory));
|
|
68911
68144
|
return new OpencodeClient({ client: client2 });
|
|
68912
68145
|
}
|
|
68913
68146
|
// node_modules/@opencode-ai/sdk/dist/server.js
|
|
68914
|
-
|
|
68915
|
-
|
|
68916
|
-
// node_modules/@opencode-ai/sdk/dist/process.js
|
|
68917
|
-
import { spawnSync } from "child_process";
|
|
68918
|
-
function stop(proc) {
|
|
68919
|
-
if (proc.exitCode !== null || proc.signalCode !== null)
|
|
68920
|
-
return;
|
|
68921
|
-
if (process.platform === "win32" && proc.pid) {
|
|
68922
|
-
const out = spawnSync("taskkill", ["/pid", String(proc.pid), "/T", "/F"], { windowsHide: true });
|
|
68923
|
-
if (!out.error && out.status === 0)
|
|
68924
|
-
return;
|
|
68925
|
-
}
|
|
68926
|
-
proc.kill();
|
|
68927
|
-
}
|
|
68928
|
-
function bindAbort(proc, signal, onAbort) {
|
|
68929
|
-
if (!signal)
|
|
68930
|
-
return () => {};
|
|
68931
|
-
const abort = () => {
|
|
68932
|
-
clear();
|
|
68933
|
-
stop(proc);
|
|
68934
|
-
onAbort?.();
|
|
68935
|
-
};
|
|
68936
|
-
const clear = () => {
|
|
68937
|
-
signal.removeEventListener("abort", abort);
|
|
68938
|
-
proc.off("exit", clear);
|
|
68939
|
-
proc.off("error", clear);
|
|
68940
|
-
};
|
|
68941
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
68942
|
-
proc.on("exit", clear);
|
|
68943
|
-
proc.on("error", clear);
|
|
68944
|
-
if (signal.aborted)
|
|
68945
|
-
abort();
|
|
68946
|
-
return clear;
|
|
68947
|
-
}
|
|
68948
|
-
|
|
68949
|
-
// node_modules/@opencode-ai/sdk/dist/server.js
|
|
68147
|
+
import { spawn } from "child_process";
|
|
68950
68148
|
async function createOpencodeServer(options) {
|
|
68951
68149
|
options = Object.assign({
|
|
68952
68150
|
hostname: "127.0.0.1",
|
|
@@ -68956,24 +68154,19 @@ async function createOpencodeServer(options) {
|
|
|
68956
68154
|
const args = [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`];
|
|
68957
68155
|
if (options.config?.logLevel)
|
|
68958
68156
|
args.push(`--log-level=${options.config.logLevel}`);
|
|
68959
|
-
const proc =
|
|
68157
|
+
const proc = spawn(`opencode`, args, {
|
|
68158
|
+
signal: options.signal,
|
|
68960
68159
|
env: {
|
|
68961
68160
|
...process.env,
|
|
68962
68161
|
OPENCODE_CONFIG_CONTENT: JSON.stringify(options.config ?? {})
|
|
68963
68162
|
}
|
|
68964
68163
|
});
|
|
68965
|
-
let clear = () => {};
|
|
68966
68164
|
const url2 = await new Promise((resolve2, reject) => {
|
|
68967
68165
|
const id = setTimeout(() => {
|
|
68968
|
-
clear();
|
|
68969
|
-
stop(proc);
|
|
68970
68166
|
reject(new Error(`Timeout waiting for server to start after ${options.timeout}ms`));
|
|
68971
68167
|
}, options.timeout);
|
|
68972
68168
|
let output = "";
|
|
68973
|
-
let resolved = false;
|
|
68974
68169
|
proc.stdout?.on("data", (chunk) => {
|
|
68975
|
-
if (resolved)
|
|
68976
|
-
return;
|
|
68977
68170
|
output += chunk.toString();
|
|
68978
68171
|
const lines = output.split(`
|
|
68979
68172
|
`);
|
|
@@ -68981,14 +68174,9 @@ async function createOpencodeServer(options) {
|
|
|
68981
68174
|
if (line.startsWith("opencode server listening")) {
|
|
68982
68175
|
const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
|
|
68983
68176
|
if (!match) {
|
|
68984
|
-
|
|
68985
|
-
stop(proc);
|
|
68986
|
-
clearTimeout(id);
|
|
68987
|
-
reject(new Error(`Failed to parse server url from output: ${line}`));
|
|
68988
|
-
return;
|
|
68177
|
+
throw new Error(`Failed to parse server url from output: ${line}`);
|
|
68989
68178
|
}
|
|
68990
68179
|
clearTimeout(id);
|
|
68991
|
-
resolved = true;
|
|
68992
68180
|
resolve2(match[1]);
|
|
68993
68181
|
return;
|
|
68994
68182
|
}
|
|
@@ -69010,16 +68198,17 @@ Server output: ${output}`;
|
|
|
69010
68198
|
clearTimeout(id);
|
|
69011
68199
|
reject(error48);
|
|
69012
68200
|
});
|
|
69013
|
-
|
|
69014
|
-
|
|
69015
|
-
|
|
69016
|
-
|
|
68201
|
+
if (options.signal) {
|
|
68202
|
+
options.signal.addEventListener("abort", () => {
|
|
68203
|
+
clearTimeout(id);
|
|
68204
|
+
reject(new Error("Aborted"));
|
|
68205
|
+
});
|
|
68206
|
+
}
|
|
69017
68207
|
});
|
|
69018
68208
|
return {
|
|
69019
68209
|
url: url2,
|
|
69020
68210
|
close() {
|
|
69021
|
-
|
|
69022
|
-
stop(proc);
|
|
68211
|
+
proc.kill();
|
|
69023
68212
|
}
|
|
69024
68213
|
};
|
|
69025
68214
|
}
|
|
@@ -69449,7 +68638,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
69449
68638
|
var NOTEPAD_DIR = "notepads";
|
|
69450
68639
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
69451
68640
|
// src/features/boulder-state/storage.ts
|
|
69452
|
-
import { existsSync as existsSync15, readFileSync as
|
|
68641
|
+
import { existsSync as existsSync15, readFileSync as readFileSync9, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5, readdirSync as readdirSync3 } from "fs";
|
|
69453
68642
|
import { dirname as dirname3, join as join15, basename } from "path";
|
|
69454
68643
|
var RESERVED_KEYS = new Set(["__proto__", "prototype", "constructor"]);
|
|
69455
68644
|
function getBoulderFilePath(directory) {
|
|
@@ -69461,7 +68650,7 @@ function readBoulderState(directory) {
|
|
|
69461
68650
|
return null;
|
|
69462
68651
|
}
|
|
69463
68652
|
try {
|
|
69464
|
-
const content =
|
|
68653
|
+
const content = readFileSync9(filePath, "utf-8");
|
|
69465
68654
|
const parsed = JSON.parse(content);
|
|
69466
68655
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
69467
68656
|
return null;
|
|
@@ -69498,7 +68687,7 @@ function getPlanProgress(planPath) {
|
|
|
69498
68687
|
return { total: 0, completed: 0, isComplete: true };
|
|
69499
68688
|
}
|
|
69500
68689
|
try {
|
|
69501
|
-
const content =
|
|
68690
|
+
const content = readFileSync9(planPath, "utf-8");
|
|
69502
68691
|
const lines = content.split(/\r?\n/);
|
|
69503
68692
|
const hasStructuredSections = lines.some((line) => TODO_HEADING_PATTERN.test(line) || FINAL_VERIFICATION_HEADING_PATTERN.test(line));
|
|
69504
68693
|
if (hasStructuredSections) {
|
|
@@ -69570,7 +68759,7 @@ function getSessionAgent(sessionID) {
|
|
|
69570
68759
|
// src/features/run-continuation-state/constants.ts
|
|
69571
68760
|
var CONTINUATION_MARKER_DIR = ".sisyphus/run-continuation";
|
|
69572
68761
|
// src/features/run-continuation-state/storage.ts
|
|
69573
|
-
import { existsSync as existsSync16, mkdirSync as mkdirSync6, readFileSync as
|
|
68762
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync6, readFileSync as readFileSync10, rmSync, writeFileSync as writeFileSync5 } from "fs";
|
|
69574
68763
|
import { join as join16 } from "path";
|
|
69575
68764
|
function getMarkerPath(directory, sessionID) {
|
|
69576
68765
|
return join16(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
@@ -69580,7 +68769,7 @@ function readContinuationMarker(directory, sessionID) {
|
|
|
69580
68769
|
if (!existsSync16(markerPath))
|
|
69581
68770
|
return null;
|
|
69582
68771
|
try {
|
|
69583
|
-
const raw =
|
|
68772
|
+
const raw = readFileSync10(markerPath, "utf-8");
|
|
69584
68773
|
const parsed = JSON.parse(raw);
|
|
69585
68774
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
69586
68775
|
return null;
|
|
@@ -69641,13 +68830,13 @@ async function isSessionInBoulderLineage(input) {
|
|
|
69641
68830
|
// src/hooks/atlas/session-last-agent.ts
|
|
69642
68831
|
init_shared();
|
|
69643
68832
|
init_compaction_marker();
|
|
69644
|
-
import { readFileSync as
|
|
68833
|
+
import { readFileSync as readFileSync11, readdirSync as readdirSync4 } from "fs";
|
|
69645
68834
|
import { join as join17 } from "path";
|
|
69646
68835
|
function getLastAgentFromMessageDir(messageDir) {
|
|
69647
68836
|
try {
|
|
69648
68837
|
const messages = readdirSync4(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
69649
68838
|
try {
|
|
69650
|
-
const content =
|
|
68839
|
+
const content = readFileSync11(join17(messageDir, fileName), "utf-8");
|
|
69651
68840
|
const parsed = JSON.parse(content);
|
|
69652
68841
|
return {
|
|
69653
68842
|
fileName,
|
|
@@ -69715,7 +68904,7 @@ init_agent_display_names();
|
|
|
69715
68904
|
|
|
69716
68905
|
// src/hooks/ralph-loop/storage.ts
|
|
69717
68906
|
init_frontmatter();
|
|
69718
|
-
import { existsSync as existsSync17, readFileSync as
|
|
68907
|
+
import { existsSync as existsSync17, readFileSync as readFileSync12, writeFileSync as writeFileSync6, unlinkSync, mkdirSync as mkdirSync7 } from "fs";
|
|
69719
68908
|
import { dirname as dirname4, join as join18 } from "path";
|
|
69720
68909
|
|
|
69721
68910
|
// src/hooks/ralph-loop/constants.ts
|
|
@@ -69733,7 +68922,7 @@ function readState(directory, customPath) {
|
|
|
69733
68922
|
return null;
|
|
69734
68923
|
}
|
|
69735
68924
|
try {
|
|
69736
|
-
const content =
|
|
68925
|
+
const content = readFileSync12(filePath, "utf-8");
|
|
69737
68926
|
const { data, body } = parseFrontmatter(content);
|
|
69738
68927
|
const active = data.active;
|
|
69739
68928
|
const iteration = data.iteration;
|
|
@@ -70435,7 +69624,7 @@ async function getLocalVersion(options = {}) {
|
|
|
70435
69624
|
}
|
|
70436
69625
|
}
|
|
70437
69626
|
// src/cli/doctor/checks/system.ts
|
|
70438
|
-
import { existsSync as existsSync28, readFileSync as
|
|
69627
|
+
import { existsSync as existsSync28, readFileSync as readFileSync22 } from "fs";
|
|
70439
69628
|
|
|
70440
69629
|
// src/cli/doctor/checks/system-binary.ts
|
|
70441
69630
|
init_spawn_with_windows_hide();
|
|
@@ -70527,7 +69716,7 @@ function compareVersions3(current, minimum) {
|
|
|
70527
69716
|
|
|
70528
69717
|
// src/cli/doctor/checks/system-plugin.ts
|
|
70529
69718
|
init_shared();
|
|
70530
|
-
import { existsSync as existsSync26, readFileSync as
|
|
69719
|
+
import { existsSync as existsSync26, readFileSync as readFileSync20 } from "fs";
|
|
70531
69720
|
function detectConfigPath() {
|
|
70532
69721
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
70533
69722
|
if (existsSync26(paths.configJsonc))
|
|
@@ -70578,7 +69767,7 @@ function getPluginInfo() {
|
|
|
70578
69767
|
};
|
|
70579
69768
|
}
|
|
70580
69769
|
try {
|
|
70581
|
-
const content =
|
|
69770
|
+
const content = readFileSync20(configPath, "utf-8");
|
|
70582
69771
|
const parsedConfig = parseJsonc(content);
|
|
70583
69772
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
70584
69773
|
if (!pluginEntry) {
|
|
@@ -70616,7 +69805,7 @@ function getPluginInfo() {
|
|
|
70616
69805
|
init_file_utils();
|
|
70617
69806
|
init_checker();
|
|
70618
69807
|
init_auto_update_checker();
|
|
70619
|
-
import { existsSync as existsSync27, readFileSync as
|
|
69808
|
+
import { existsSync as existsSync27, readFileSync as readFileSync21 } from "fs";
|
|
70620
69809
|
import { homedir as homedir6 } from "os";
|
|
70621
69810
|
import { join as join27 } from "path";
|
|
70622
69811
|
init_shared();
|
|
@@ -70646,7 +69835,7 @@ function readPackageJson(filePath) {
|
|
|
70646
69835
|
if (!existsSync27(filePath))
|
|
70647
69836
|
return null;
|
|
70648
69837
|
try {
|
|
70649
|
-
const content =
|
|
69838
|
+
const content = readFileSync21(filePath, "utf-8");
|
|
70650
69839
|
return parseJsonc(content);
|
|
70651
69840
|
} catch {
|
|
70652
69841
|
return null;
|
|
@@ -70705,7 +69894,7 @@ function isConfigValid(configPath) {
|
|
|
70705
69894
|
if (!existsSync28(configPath))
|
|
70706
69895
|
return false;
|
|
70707
69896
|
try {
|
|
70708
|
-
parseJsonc(
|
|
69897
|
+
parseJsonc(readFileSync22(configPath, "utf-8"));
|
|
70709
69898
|
return true;
|
|
70710
69899
|
} catch {
|
|
70711
69900
|
return false;
|
|
@@ -70821,13 +70010,13 @@ async function checkSystem() {
|
|
|
70821
70010
|
}
|
|
70822
70011
|
|
|
70823
70012
|
// src/cli/doctor/checks/config.ts
|
|
70824
|
-
import { readFileSync as
|
|
70013
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
70825
70014
|
import { join as join31 } from "path";
|
|
70826
70015
|
init_shared();
|
|
70827
70016
|
|
|
70828
70017
|
// src/cli/doctor/checks/model-resolution-cache.ts
|
|
70829
70018
|
init_shared();
|
|
70830
|
-
import { existsSync as existsSync29, readFileSync as
|
|
70019
|
+
import { existsSync as existsSync29, readFileSync as readFileSync23 } from "fs";
|
|
70831
70020
|
import { homedir as homedir7 } from "os";
|
|
70832
70021
|
import { join as join28 } from "path";
|
|
70833
70022
|
function getOpenCodeCacheDir2() {
|
|
@@ -70842,7 +70031,7 @@ function loadAvailableModelsFromCache() {
|
|
|
70842
70031
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
70843
70032
|
}
|
|
70844
70033
|
try {
|
|
70845
|
-
const content =
|
|
70034
|
+
const content = readFileSync23(cacheFile, "utf-8");
|
|
70846
70035
|
const data = parseJsonc(content);
|
|
70847
70036
|
const providers = Object.keys(data);
|
|
70848
70037
|
let modelCount = 0;
|
|
@@ -70864,14 +70053,14 @@ init_model_capabilities();
|
|
|
70864
70053
|
|
|
70865
70054
|
// src/cli/doctor/checks/model-resolution-config.ts
|
|
70866
70055
|
init_shared();
|
|
70867
|
-
import { readFileSync as
|
|
70056
|
+
import { readFileSync as readFileSync24 } from "fs";
|
|
70868
70057
|
import { join as join29 } from "path";
|
|
70869
70058
|
var PROJECT_CONFIG_DIR = join29(process.cwd(), ".opencode");
|
|
70870
70059
|
function loadOmoConfig() {
|
|
70871
70060
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR);
|
|
70872
70061
|
if (projectDetected.format !== "none") {
|
|
70873
70062
|
try {
|
|
70874
|
-
const content =
|
|
70063
|
+
const content = readFileSync24(projectDetected.path, "utf-8");
|
|
70875
70064
|
return parseJsonc(content);
|
|
70876
70065
|
} catch {
|
|
70877
70066
|
return null;
|
|
@@ -70881,7 +70070,7 @@ function loadOmoConfig() {
|
|
|
70881
70070
|
const userDetected = detectPluginConfigFile(userConfigDir);
|
|
70882
70071
|
if (userDetected.format !== "none") {
|
|
70883
70072
|
try {
|
|
70884
|
-
const content =
|
|
70073
|
+
const content = readFileSync24(userDetected.path, "utf-8");
|
|
70885
70074
|
return parseJsonc(content);
|
|
70886
70075
|
} catch {
|
|
70887
70076
|
return null;
|
|
@@ -71106,7 +70295,7 @@ function validateConfig() {
|
|
|
71106
70295
|
return { exists: false, path: null, valid: true, config: null, errors: [] };
|
|
71107
70296
|
}
|
|
71108
70297
|
try {
|
|
71109
|
-
const content =
|
|
70298
|
+
const content = readFileSync25(configPath, "utf-8");
|
|
71110
70299
|
const rawConfig = parseJsonc(content);
|
|
71111
70300
|
const schemaResult = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
71112
70301
|
if (!schemaResult.success) {
|
|
@@ -71459,7 +70648,7 @@ var BUILTIN_SERVERS = {
|
|
|
71459
70648
|
"kotlin-ls": { command: ["kotlin-lsp"], extensions: [".kt", ".kts"] }
|
|
71460
70649
|
};
|
|
71461
70650
|
// src/tools/lsp/server-config-loader.ts
|
|
71462
|
-
import { existsSync as existsSync31, readFileSync as
|
|
70651
|
+
import { existsSync as existsSync31, readFileSync as readFileSync26 } from "fs";
|
|
71463
70652
|
import { join as join33 } from "path";
|
|
71464
70653
|
init_shared();
|
|
71465
70654
|
init_jsonc_parser();
|
|
@@ -71467,7 +70656,7 @@ function loadJsonFile(path10) {
|
|
|
71467
70656
|
if (!existsSync31(path10))
|
|
71468
70657
|
return null;
|
|
71469
70658
|
try {
|
|
71470
|
-
return parseJsonc(
|
|
70659
|
+
return parseJsonc(readFileSync26(path10, "utf-8"));
|
|
71471
70660
|
} catch {
|
|
71472
70661
|
return null;
|
|
71473
70662
|
}
|
|
@@ -71661,7 +70850,7 @@ function getInstalledLspServers() {
|
|
|
71661
70850
|
|
|
71662
70851
|
// src/cli/doctor/checks/tools-mcp.ts
|
|
71663
70852
|
init_shared();
|
|
71664
|
-
import { existsSync as existsSync33, readFileSync as
|
|
70853
|
+
import { existsSync as existsSync33, readFileSync as readFileSync27 } from "fs";
|
|
71665
70854
|
import { homedir as homedir8 } from "os";
|
|
71666
70855
|
import { join as join36 } from "path";
|
|
71667
70856
|
var BUILTIN_MCP_SERVERS = ["context7", "grep_app"];
|
|
@@ -71678,7 +70867,7 @@ function loadUserMcpConfig() {
|
|
|
71678
70867
|
if (!existsSync33(configPath))
|
|
71679
70868
|
continue;
|
|
71680
70869
|
try {
|
|
71681
|
-
const content =
|
|
70870
|
+
const content = readFileSync27(configPath, "utf-8");
|
|
71682
70871
|
const config2 = parseJsonc(content);
|
|
71683
70872
|
if (config2.mcpServers) {
|
|
71684
70873
|
Object.assign(servers, config2.mcpServers);
|
|
@@ -72131,7 +71320,7 @@ async function refreshModelCapabilities(options, deps = {}) {
|
|
|
72131
71320
|
|
|
72132
71321
|
// src/features/mcp-oauth/storage.ts
|
|
72133
71322
|
init_shared();
|
|
72134
|
-
import { chmodSync, existsSync as existsSync34, mkdirSync as mkdirSync9, readFileSync as
|
|
71323
|
+
import { chmodSync, existsSync as existsSync34, mkdirSync as mkdirSync9, readFileSync as readFileSync28, renameSync as renameSync2, unlinkSync as unlinkSync4, writeFileSync as writeFileSync9 } from "fs";
|
|
72135
71324
|
import { dirname as dirname9, join as join37 } from "path";
|
|
72136
71325
|
var STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
72137
71326
|
function getMcpOauthStoragePath() {
|
|
@@ -72176,7 +71365,7 @@ function readStore() {
|
|
|
72176
71365
|
return null;
|
|
72177
71366
|
}
|
|
72178
71367
|
try {
|
|
72179
|
-
const content =
|
|
71368
|
+
const content = readFileSync28(filePath, "utf-8");
|
|
72180
71369
|
return JSON.parse(content);
|
|
72181
71370
|
} catch {
|
|
72182
71371
|
return null;
|
|
@@ -72190,9 +71379,9 @@ function writeStore(store2) {
|
|
|
72190
71379
|
mkdirSync9(dir, { recursive: true });
|
|
72191
71380
|
}
|
|
72192
71381
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
72193
|
-
|
|
71382
|
+
writeFileSync9(tempPath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
|
|
72194
71383
|
chmodSync(tempPath, 384);
|
|
72195
|
-
|
|
71384
|
+
renameSync2(tempPath, filePath);
|
|
72196
71385
|
return true;
|
|
72197
71386
|
} catch {
|
|
72198
71387
|
return false;
|
|
@@ -72413,7 +71602,7 @@ async function findAvailablePort2(startPort = DEFAULT_PORT) {
|
|
|
72413
71602
|
}
|
|
72414
71603
|
|
|
72415
71604
|
// src/features/mcp-oauth/oauth-authorization-flow.ts
|
|
72416
|
-
import { spawn } from "child_process";
|
|
71605
|
+
import { spawn as spawn2 } from "child_process";
|
|
72417
71606
|
import { createHash, randomBytes as randomBytes2 } from "crypto";
|
|
72418
71607
|
import { createServer } from "http";
|
|
72419
71608
|
function generateCodeVerifier() {
|
|
@@ -72494,7 +71683,7 @@ function openBrowser(url2) {
|
|
|
72494
71683
|
args = [url2];
|
|
72495
71684
|
}
|
|
72496
71685
|
try {
|
|
72497
|
-
const child =
|
|
71686
|
+
const child = spawn2(command, args, { stdio: "ignore", detached: true });
|
|
72498
71687
|
child.on("error", () => {});
|
|
72499
71688
|
child.unref();
|
|
72500
71689
|
} catch {}
|