oh-my-opencode 3.17.0 → 3.17.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/README.ja.md +4 -0
- package/README.ko.md +4 -0
- package/README.ru.md +4 -0
- package/README.zh-cn.md +4 -0
- package/dist/cli/doctor/spawn-with-timeout.d.ts +8 -0
- package/dist/cli/index.js +714 -460
- package/dist/cli/install-validators.d.ts +1 -0
- package/dist/cli/model-fallback-types.d.ts +1 -0
- package/dist/cli/provider-model-id-transform.d.ts +1 -1
- package/dist/cli/types.d.ts +3 -0
- package/dist/create-tools.d.ts +2 -1
- package/dist/features/background-agent/session-existence.d.ts +1 -1
- package/dist/features/background-agent/subagent-spawn-limits.d.ts +1 -1
- package/dist/features/background-agent/task-poller.d.ts +1 -0
- package/dist/features/builtin-commands/commands.d.ts +2 -1
- package/dist/hooks/atlas/system-reminder-templates.d.ts +2 -2
- package/dist/hooks/directory-agents-injector/hook.d.ts +7 -7
- package/dist/hooks/directory-readme-injector/hook.d.ts +7 -7
- package/dist/hooks/model-fallback/next-fallback.d.ts +8 -0
- package/dist/index.js +752 -446
- package/dist/openclaw/config.d.ts +1 -1
- package/dist/openclaw/dispatcher.d.ts +0 -1
- package/dist/openclaw/gateway-url-validation.d.ts +1 -0
- package/dist/tools/delegate-task/delegated-model-config.d.ts +3 -0
- package/dist/tools/delegate-task/fallback-entry-resolution.d.ts +12 -0
- package/dist/tools/delegate-task/fallback-entry-settings.d.ts +7 -0
- package/dist/tools/delegate-task/subagent-discovery.d.ts +15 -0
- package/dist/tools/delegate-task/sync-task-fallback.d.ts +12 -0
- package/dist/tools/skill/constants.d.ts +1 -1
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -128,7 +128,7 @@ function getAgentDisplayName(configKey) {
|
|
|
128
128
|
function getAgentListDisplayName(configKey) {
|
|
129
129
|
return getAgentRuntimeName(configKey);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function resolveKnownAgentConfigKey(agentName) {
|
|
132
132
|
const lower = stripAgentListSortPrefix(agentName).trim().toLowerCase();
|
|
133
133
|
const reversed = REVERSE_DISPLAY_NAMES[lower];
|
|
134
134
|
if (reversed !== undefined)
|
|
@@ -138,7 +138,11 @@ function getAgentConfigKey(agentName) {
|
|
|
138
138
|
return legacy;
|
|
139
139
|
if (AGENT_DISPLAY_NAMES[lower] !== undefined)
|
|
140
140
|
return lower;
|
|
141
|
-
return
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
function getAgentConfigKey(agentName) {
|
|
144
|
+
const lower = stripAgentListSortPrefix(agentName).trim().toLowerCase();
|
|
145
|
+
return resolveKnownAgentConfigKey(agentName) ?? lower;
|
|
142
146
|
}
|
|
143
147
|
function normalizeAgentForPromptKey(agentName) {
|
|
144
148
|
if (typeof agentName !== "string") {
|
|
@@ -148,19 +152,7 @@ function normalizeAgentForPromptKey(agentName) {
|
|
|
148
152
|
if (!trimmed) {
|
|
149
153
|
return;
|
|
150
154
|
}
|
|
151
|
-
|
|
152
|
-
const reversed = REVERSE_DISPLAY_NAMES[lower];
|
|
153
|
-
if (reversed !== undefined) {
|
|
154
|
-
return reversed;
|
|
155
|
-
}
|
|
156
|
-
const legacy = LEGACY_DISPLAY_NAMES[lower];
|
|
157
|
-
if (legacy !== undefined) {
|
|
158
|
-
return legacy;
|
|
159
|
-
}
|
|
160
|
-
if (AGENT_DISPLAY_NAMES[lower] !== undefined) {
|
|
161
|
-
return lower;
|
|
162
|
-
}
|
|
163
|
-
return trimmed;
|
|
155
|
+
return resolveKnownAgentConfigKey(trimmed) ?? trimmed;
|
|
164
156
|
}
|
|
165
157
|
var AGENT_DISPLAY_NAMES, AGENT_LIST_SORT_PREFIXES, INVISIBLE_AGENT_CHARACTERS_REGEX, REVERSE_DISPLAY_NAMES, LEGACY_DISPLAY_NAMES;
|
|
166
158
|
var init_agent_display_names = __esm(() => {
|
|
@@ -6989,37 +6981,37 @@ var require_dataType = __commonJS((exports) => {
|
|
|
6989
6981
|
DataType2[DataType2["Wrong"] = 1] = "Wrong";
|
|
6990
6982
|
})(DataType || (exports.DataType = DataType = {}));
|
|
6991
6983
|
function getSchemaTypes(schema2) {
|
|
6992
|
-
const
|
|
6993
|
-
const hasNull =
|
|
6984
|
+
const types23 = getJSONTypes(schema2.type);
|
|
6985
|
+
const hasNull = types23.includes("null");
|
|
6994
6986
|
if (hasNull) {
|
|
6995
6987
|
if (schema2.nullable === false)
|
|
6996
6988
|
throw new Error("type: null contradicts nullable: false");
|
|
6997
6989
|
} else {
|
|
6998
|
-
if (!
|
|
6990
|
+
if (!types23.length && schema2.nullable !== undefined) {
|
|
6999
6991
|
throw new Error('"nullable" cannot be used without "type"');
|
|
7000
6992
|
}
|
|
7001
6993
|
if (schema2.nullable === true)
|
|
7002
|
-
|
|
6994
|
+
types23.push("null");
|
|
7003
6995
|
}
|
|
7004
|
-
return
|
|
6996
|
+
return types23;
|
|
7005
6997
|
}
|
|
7006
6998
|
exports.getSchemaTypes = getSchemaTypes;
|
|
7007
6999
|
function getJSONTypes(ts) {
|
|
7008
|
-
const
|
|
7009
|
-
if (
|
|
7010
|
-
return
|
|
7011
|
-
throw new Error("type must be JSONType or JSONType[]: " +
|
|
7000
|
+
const types23 = Array.isArray(ts) ? ts : ts ? [ts] : [];
|
|
7001
|
+
if (types23.every(rules_1.isJSONType))
|
|
7002
|
+
return types23;
|
|
7003
|
+
throw new Error("type must be JSONType or JSONType[]: " + types23.join(","));
|
|
7012
7004
|
}
|
|
7013
7005
|
exports.getJSONTypes = getJSONTypes;
|
|
7014
|
-
function coerceAndCheckDataType(it,
|
|
7006
|
+
function coerceAndCheckDataType(it, types23) {
|
|
7015
7007
|
const { gen, data, opts } = it;
|
|
7016
|
-
const coerceTo = coerceToTypes(
|
|
7017
|
-
const checkTypes =
|
|
7008
|
+
const coerceTo = coerceToTypes(types23, opts.coerceTypes);
|
|
7009
|
+
const checkTypes = types23.length > 0 && !(coerceTo.length === 0 && types23.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types23[0]));
|
|
7018
7010
|
if (checkTypes) {
|
|
7019
|
-
const wrongType = checkDataTypes(
|
|
7011
|
+
const wrongType = checkDataTypes(types23, data, opts.strictNumbers, DataType.Wrong);
|
|
7020
7012
|
gen.if(wrongType, () => {
|
|
7021
7013
|
if (coerceTo.length)
|
|
7022
|
-
coerceData(it,
|
|
7014
|
+
coerceData(it, types23, coerceTo);
|
|
7023
7015
|
else
|
|
7024
7016
|
reportTypeError(it);
|
|
7025
7017
|
});
|
|
@@ -7028,15 +7020,15 @@ var require_dataType = __commonJS((exports) => {
|
|
|
7028
7020
|
}
|
|
7029
7021
|
exports.coerceAndCheckDataType = coerceAndCheckDataType;
|
|
7030
7022
|
var COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]);
|
|
7031
|
-
function coerceToTypes(
|
|
7032
|
-
return coerceTypes ?
|
|
7023
|
+
function coerceToTypes(types23, coerceTypes) {
|
|
7024
|
+
return coerceTypes ? types23.filter((t) => COERCIBLE.has(t) || coerceTypes === "array" && t === "array") : [];
|
|
7033
7025
|
}
|
|
7034
|
-
function coerceData(it,
|
|
7026
|
+
function coerceData(it, types23, coerceTo) {
|
|
7035
7027
|
const { gen, data, opts } = it;
|
|
7036
7028
|
const dataType = gen.let("dataType", (0, codegen_1._)`typeof ${data}`);
|
|
7037
7029
|
const coerced = gen.let("coerced", (0, codegen_1._)`undefined`);
|
|
7038
7030
|
if (opts.coerceTypes === "array") {
|
|
7039
|
-
gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1._)`${data}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data}`).if(checkDataTypes(
|
|
7031
|
+
gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1._)`${data}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data}`).if(checkDataTypes(types23, data, opts.strictNumbers), () => gen.assign(coerced, data)));
|
|
7040
7032
|
}
|
|
7041
7033
|
gen.if((0, codegen_1._)`${coerced} !== undefined`);
|
|
7042
7034
|
for (const t of coerceTo) {
|
|
@@ -7112,19 +7104,19 @@ var require_dataType = __commonJS((exports) => {
|
|
|
7112
7104
|
return checkDataType(dataTypes[0], data, strictNums, correct);
|
|
7113
7105
|
}
|
|
7114
7106
|
let cond;
|
|
7115
|
-
const
|
|
7116
|
-
if (
|
|
7107
|
+
const types23 = (0, util_1.toHash)(dataTypes);
|
|
7108
|
+
if (types23.array && types23.object) {
|
|
7117
7109
|
const notObj = (0, codegen_1._)`typeof ${data} != "object"`;
|
|
7118
|
-
cond =
|
|
7119
|
-
delete
|
|
7120
|
-
delete
|
|
7121
|
-
delete
|
|
7110
|
+
cond = types23.null ? notObj : (0, codegen_1._)`!${data} || ${notObj}`;
|
|
7111
|
+
delete types23.null;
|
|
7112
|
+
delete types23.array;
|
|
7113
|
+
delete types23.object;
|
|
7122
7114
|
} else {
|
|
7123
7115
|
cond = codegen_1.nil;
|
|
7124
7116
|
}
|
|
7125
|
-
if (
|
|
7126
|
-
delete
|
|
7127
|
-
for (const t in
|
|
7117
|
+
if (types23.number)
|
|
7118
|
+
delete types23.integer;
|
|
7119
|
+
for (const t in types23)
|
|
7128
7120
|
cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct));
|
|
7129
7121
|
return cond;
|
|
7130
7122
|
}
|
|
@@ -7912,9 +7904,9 @@ var require_validate = __commonJS((exports) => {
|
|
|
7912
7904
|
function typeAndKeywords(it, errsCount) {
|
|
7913
7905
|
if (it.opts.jtd)
|
|
7914
7906
|
return schemaKeywords(it, [], false, errsCount);
|
|
7915
|
-
const
|
|
7916
|
-
const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it,
|
|
7917
|
-
schemaKeywords(it,
|
|
7907
|
+
const types23 = (0, dataType_1.getSchemaTypes)(it.schema);
|
|
7908
|
+
const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types23);
|
|
7909
|
+
schemaKeywords(it, types23, !checkedTypes, errsCount);
|
|
7918
7910
|
}
|
|
7919
7911
|
function checkRefsAndKeywords(it) {
|
|
7920
7912
|
const { schema: schema2, errSchemaPath, opts, self } = it;
|
|
@@ -7964,7 +7956,7 @@ var require_validate = __commonJS((exports) => {
|
|
|
7964
7956
|
if (items instanceof codegen_1.Name)
|
|
7965
7957
|
gen.assign((0, codegen_1._)`${evaluated}.items`, items);
|
|
7966
7958
|
}
|
|
7967
|
-
function schemaKeywords(it,
|
|
7959
|
+
function schemaKeywords(it, types23, typeErrors, errsCount) {
|
|
7968
7960
|
const { gen, schema: schema2, data, allErrors, opts, self } = it;
|
|
7969
7961
|
const { RULES } = self;
|
|
7970
7962
|
if (schema2.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema2, RULES))) {
|
|
@@ -7972,7 +7964,7 @@ var require_validate = __commonJS((exports) => {
|
|
|
7972
7964
|
return;
|
|
7973
7965
|
}
|
|
7974
7966
|
if (!opts.jtd)
|
|
7975
|
-
checkStrictTypes(it,
|
|
7967
|
+
checkStrictTypes(it, types23);
|
|
7976
7968
|
gen.block(() => {
|
|
7977
7969
|
for (const group of RULES.rules)
|
|
7978
7970
|
groupKeywords(group);
|
|
@@ -7984,7 +7976,7 @@ var require_validate = __commonJS((exports) => {
|
|
|
7984
7976
|
if (group.type) {
|
|
7985
7977
|
gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
|
|
7986
7978
|
iterateKeywords(it, group);
|
|
7987
|
-
if (
|
|
7979
|
+
if (types23.length === 1 && types23[0] === group.type && typeErrors) {
|
|
7988
7980
|
gen.else();
|
|
7989
7981
|
(0, dataType_2.reportTypeError)(it);
|
|
7990
7982
|
}
|
|
@@ -8008,27 +8000,27 @@ var require_validate = __commonJS((exports) => {
|
|
|
8008
8000
|
}
|
|
8009
8001
|
});
|
|
8010
8002
|
}
|
|
8011
|
-
function checkStrictTypes(it,
|
|
8003
|
+
function checkStrictTypes(it, types23) {
|
|
8012
8004
|
if (it.schemaEnv.meta || !it.opts.strictTypes)
|
|
8013
8005
|
return;
|
|
8014
|
-
checkContextTypes(it,
|
|
8006
|
+
checkContextTypes(it, types23);
|
|
8015
8007
|
if (!it.opts.allowUnionTypes)
|
|
8016
|
-
checkMultipleTypes(it,
|
|
8008
|
+
checkMultipleTypes(it, types23);
|
|
8017
8009
|
checkKeywordTypes(it, it.dataTypes);
|
|
8018
8010
|
}
|
|
8019
|
-
function checkContextTypes(it,
|
|
8020
|
-
if (!
|
|
8011
|
+
function checkContextTypes(it, types23) {
|
|
8012
|
+
if (!types23.length)
|
|
8021
8013
|
return;
|
|
8022
8014
|
if (!it.dataTypes.length) {
|
|
8023
|
-
it.dataTypes =
|
|
8015
|
+
it.dataTypes = types23;
|
|
8024
8016
|
return;
|
|
8025
8017
|
}
|
|
8026
|
-
|
|
8018
|
+
types23.forEach((t) => {
|
|
8027
8019
|
if (!includesType(it.dataTypes, t)) {
|
|
8028
8020
|
strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
|
|
8029
8021
|
}
|
|
8030
8022
|
});
|
|
8031
|
-
narrowSchemaTypes(it,
|
|
8023
|
+
narrowSchemaTypes(it, types23);
|
|
8032
8024
|
}
|
|
8033
8025
|
function checkMultipleTypes(it, ts) {
|
|
8034
8026
|
if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
|
|
@@ -15673,7 +15665,7 @@ function resolveActualContextLimit(providerID, modelID, modelCacheState) {
|
|
|
15673
15665
|
|
|
15674
15666
|
// src/shared/normalize-sdk-response.ts
|
|
15675
15667
|
function normalizeSDKResponse(response, fallback, options) {
|
|
15676
|
-
if (response
|
|
15668
|
+
if (response == null) {
|
|
15677
15669
|
return fallback;
|
|
15678
15670
|
}
|
|
15679
15671
|
if (Array.isArray(response)) {
|
|
@@ -15681,7 +15673,7 @@ function normalizeSDKResponse(response, fallback, options) {
|
|
|
15681
15673
|
}
|
|
15682
15674
|
if (typeof response === "object" && "data" in response) {
|
|
15683
15675
|
const data = response.data;
|
|
15684
|
-
if (data
|
|
15676
|
+
if (data != null) {
|
|
15685
15677
|
return data;
|
|
15686
15678
|
}
|
|
15687
15679
|
if (options?.preferResponseOnMissingData === true) {
|
|
@@ -17294,20 +17286,26 @@ var AGENT_NAME_MAP = {
|
|
|
17294
17286
|
omo: "sisyphus",
|
|
17295
17287
|
OmO: "sisyphus",
|
|
17296
17288
|
Sisyphus: "sisyphus",
|
|
17289
|
+
"Sisyphus (Ultraworker)": "sisyphus",
|
|
17297
17290
|
sisyphus: "sisyphus",
|
|
17291
|
+
"Hephaestus (Deep Agent)": "hephaestus",
|
|
17298
17292
|
"OmO-Plan": "prometheus",
|
|
17299
17293
|
"omo-plan": "prometheus",
|
|
17300
17294
|
"Planner-Sisyphus": "prometheus",
|
|
17301
17295
|
"planner-sisyphus": "prometheus",
|
|
17302
17296
|
"Prometheus - Plan Builder": "prometheus",
|
|
17297
|
+
"Prometheus (Plan Builder)": "prometheus",
|
|
17303
17298
|
prometheus: "prometheus",
|
|
17304
17299
|
"orchestrator-sisyphus": "atlas",
|
|
17305
17300
|
Atlas: "atlas",
|
|
17301
|
+
"Atlas (Plan Executor)": "atlas",
|
|
17306
17302
|
atlas: "atlas",
|
|
17307
17303
|
"plan-consultant": "metis",
|
|
17308
17304
|
"Metis - Plan Consultant": "metis",
|
|
17305
|
+
"Metis (Plan Consultant)": "metis",
|
|
17309
17306
|
metis: "metis",
|
|
17310
17307
|
"Momus - Plan Critic": "momus",
|
|
17308
|
+
"Momus (Plan Critic)": "momus",
|
|
17311
17309
|
momus: "momus",
|
|
17312
17310
|
"Sisyphus-Junior": "sisyphus-junior",
|
|
17313
17311
|
"sisyphus-junior": "sisyphus-junior",
|
|
@@ -17408,7 +17406,7 @@ init_logger();
|
|
|
17408
17406
|
import * as fs4 from "fs";
|
|
17409
17407
|
|
|
17410
17408
|
// src/shared/write-file-atomically.ts
|
|
17411
|
-
import { closeSync, fsyncSync, openSync, renameSync, writeFileSync } from "fs";
|
|
17409
|
+
import { closeSync, fsyncSync, openSync, renameSync, unlinkSync, writeFileSync } from "fs";
|
|
17412
17410
|
function writeFileAtomically(filePath, content) {
|
|
17413
17411
|
const tempPath = `${filePath}.tmp`;
|
|
17414
17412
|
writeFileSync(tempPath, content, "utf-8");
|
|
@@ -17418,7 +17416,18 @@ function writeFileAtomically(filePath, content) {
|
|
|
17418
17416
|
} finally {
|
|
17419
17417
|
closeSync(tempFileDescriptor);
|
|
17420
17418
|
}
|
|
17421
|
-
|
|
17419
|
+
try {
|
|
17420
|
+
renameSync(tempPath, filePath);
|
|
17421
|
+
} catch (error) {
|
|
17422
|
+
const isWindows = process.platform === "win32";
|
|
17423
|
+
const isPermissionError = error instanceof Error && (error.message.includes("EPERM") || error.message.includes("EACCES"));
|
|
17424
|
+
if (isWindows && isPermissionError) {
|
|
17425
|
+
unlinkSync(filePath);
|
|
17426
|
+
renameSync(tempPath, filePath);
|
|
17427
|
+
} else {
|
|
17428
|
+
throw error;
|
|
17429
|
+
}
|
|
17430
|
+
}
|
|
17422
17431
|
}
|
|
17423
17432
|
|
|
17424
17433
|
// src/shared/migration/migrations-sidecar.ts
|
|
@@ -18323,7 +18332,7 @@ async function listZipEntries(archivePath) {
|
|
|
18323
18332
|
throw new Error("zip entry listing requires either python3 or zipinfo to inspect the archive safely");
|
|
18324
18333
|
}
|
|
18325
18334
|
// src/shared/binary-downloader.ts
|
|
18326
|
-
import { chmodSync, existsSync as existsSync9, mkdirSync as mkdirSync3, unlinkSync } from "fs";
|
|
18335
|
+
import { chmodSync, existsSync as existsSync9, mkdirSync as mkdirSync3, unlinkSync as unlinkSync2 } from "fs";
|
|
18327
18336
|
import * as path5 from "path";
|
|
18328
18337
|
var {spawn: spawn8 } = globalThis.Bun;
|
|
18329
18338
|
function isTarTraversalErrorOutput(output) {
|
|
@@ -18369,7 +18378,7 @@ async function extractZipArchive(archivePath, destDir) {
|
|
|
18369
18378
|
}
|
|
18370
18379
|
function cleanupArchive(archivePath) {
|
|
18371
18380
|
if (existsSync9(archivePath)) {
|
|
18372
|
-
|
|
18381
|
+
unlinkSync2(archivePath);
|
|
18373
18382
|
}
|
|
18374
18383
|
}
|
|
18375
18384
|
function ensureExecutable(binaryPath) {
|
|
@@ -18423,11 +18432,11 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
18423
18432
|
sisyphus: {
|
|
18424
18433
|
fallbackChain: [
|
|
18425
18434
|
{
|
|
18426
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18435
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18427
18436
|
model: "claude-opus-4-6",
|
|
18428
18437
|
variant: "max"
|
|
18429
18438
|
},
|
|
18430
|
-
{ providers: ["opencode-go"], model: "kimi-k2.5" },
|
|
18439
|
+
{ providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
|
|
18431
18440
|
{ providers: ["kimi-for-coding"], model: "k2p5" },
|
|
18432
18441
|
{
|
|
18433
18442
|
providers: [
|
|
@@ -18436,12 +18445,13 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
18436
18445
|
"moonshotai-cn",
|
|
18437
18446
|
"firmware",
|
|
18438
18447
|
"ollama-cloud",
|
|
18439
|
-
"aihubmix"
|
|
18448
|
+
"aihubmix",
|
|
18449
|
+
"vercel"
|
|
18440
18450
|
],
|
|
18441
18451
|
model: "kimi-k2.5"
|
|
18442
18452
|
},
|
|
18443
|
-
{ providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
|
|
18444
|
-
{ providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
|
|
18453
|
+
{ providers: ["openai", "github-copilot", "opencode", "vercel"], model: "gpt-5.4", variant: "medium" },
|
|
18454
|
+
{ providers: ["zai-coding-plan", "opencode", "vercel"], model: "glm-5" },
|
|
18445
18455
|
{ providers: ["opencode"], model: "big-pickle" }
|
|
18446
18456
|
],
|
|
18447
18457
|
requiresAnyModel: true
|
|
@@ -18449,73 +18459,73 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
18449
18459
|
hephaestus: {
|
|
18450
18460
|
fallbackChain: [
|
|
18451
18461
|
{
|
|
18452
|
-
providers: ["openai", "github-copilot", "venice", "opencode"],
|
|
18462
|
+
providers: ["openai", "github-copilot", "venice", "opencode", "vercel"],
|
|
18453
18463
|
model: "gpt-5.4",
|
|
18454
18464
|
variant: "medium"
|
|
18455
18465
|
}
|
|
18456
18466
|
],
|
|
18457
|
-
requiresProvider: ["openai", "github-copilot", "venice", "opencode"]
|
|
18467
|
+
requiresProvider: ["openai", "github-copilot", "venice", "opencode", "vercel"]
|
|
18458
18468
|
},
|
|
18459
18469
|
oracle: {
|
|
18460
18470
|
fallbackChain: [
|
|
18461
18471
|
{
|
|
18462
|
-
providers: ["openai", "github-copilot", "opencode"],
|
|
18472
|
+
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
18463
18473
|
model: "gpt-5.4",
|
|
18464
18474
|
variant: "high"
|
|
18465
18475
|
},
|
|
18466
18476
|
{
|
|
18467
|
-
providers: ["google", "github-copilot", "opencode"],
|
|
18477
|
+
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
18468
18478
|
model: "gemini-3.1-pro",
|
|
18469
18479
|
variant: "high"
|
|
18470
18480
|
},
|
|
18471
18481
|
{
|
|
18472
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18482
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18473
18483
|
model: "claude-opus-4-6",
|
|
18474
18484
|
variant: "max"
|
|
18475
18485
|
},
|
|
18476
|
-
{ providers: ["opencode-go"], model: "glm-5" }
|
|
18486
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5" }
|
|
18477
18487
|
]
|
|
18478
18488
|
},
|
|
18479
18489
|
librarian: {
|
|
18480
18490
|
fallbackChain: [
|
|
18481
|
-
{ providers: ["opencode-go"], model: "minimax-m2.7" },
|
|
18482
|
-
{ providers: ["opencode"], model: "minimax-m2.7-highspeed" },
|
|
18483
|
-
{ providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
|
|
18484
|
-
{ providers: ["opencode"], model: "gpt-5-nano" }
|
|
18491
|
+
{ providers: ["opencode-go", "vercel"], model: "minimax-m2.7" },
|
|
18492
|
+
{ providers: ["opencode", "vercel"], model: "minimax-m2.7-highspeed" },
|
|
18493
|
+
{ providers: ["anthropic", "opencode", "vercel"], model: "claude-haiku-4-5" },
|
|
18494
|
+
{ providers: ["opencode", "vercel"], model: "gpt-5-nano" }
|
|
18485
18495
|
]
|
|
18486
18496
|
},
|
|
18487
18497
|
explore: {
|
|
18488
18498
|
fallbackChain: [
|
|
18489
|
-
{ providers: ["github-copilot", "xai"], model: "grok-code-fast-1" },
|
|
18490
|
-
{ providers: ["opencode-go"], model: "minimax-m2.7-highspeed" },
|
|
18491
|
-
{ providers: ["opencode"], model: "minimax-m2.7" },
|
|
18492
|
-
{ providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
|
|
18493
|
-
{ providers: ["opencode"], model: "gpt-5-nano" }
|
|
18499
|
+
{ providers: ["github-copilot", "xai", "vercel"], model: "grok-code-fast-1" },
|
|
18500
|
+
{ providers: ["opencode-go", "vercel"], model: "minimax-m2.7-highspeed" },
|
|
18501
|
+
{ providers: ["opencode", "vercel"], model: "minimax-m2.7" },
|
|
18502
|
+
{ providers: ["anthropic", "opencode", "vercel"], model: "claude-haiku-4-5" },
|
|
18503
|
+
{ providers: ["opencode", "vercel"], model: "gpt-5-nano" }
|
|
18494
18504
|
]
|
|
18495
18505
|
},
|
|
18496
18506
|
"multimodal-looker": {
|
|
18497
18507
|
fallbackChain: [
|
|
18498
|
-
{ providers: ["openai", "opencode"], model: "gpt-5.4", variant: "medium" },
|
|
18499
|
-
{ providers: ["opencode-go"], model: "kimi-k2.5" },
|
|
18500
|
-
{ providers: ["zai-coding-plan"], model: "glm-4.6v" },
|
|
18501
|
-
{ providers: ["openai", "github-copilot", "opencode"], model: "gpt-5-nano" }
|
|
18508
|
+
{ providers: ["openai", "opencode", "vercel"], model: "gpt-5.4", variant: "medium" },
|
|
18509
|
+
{ providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
|
|
18510
|
+
{ providers: ["zai-coding-plan", "vercel"], model: "glm-4.6v" },
|
|
18511
|
+
{ providers: ["openai", "github-copilot", "opencode", "vercel"], model: "gpt-5-nano" }
|
|
18502
18512
|
]
|
|
18503
18513
|
},
|
|
18504
18514
|
prometheus: {
|
|
18505
18515
|
fallbackChain: [
|
|
18506
18516
|
{
|
|
18507
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18517
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18508
18518
|
model: "claude-opus-4-6",
|
|
18509
18519
|
variant: "max"
|
|
18510
18520
|
},
|
|
18511
18521
|
{
|
|
18512
|
-
providers: ["openai", "github-copilot", "opencode"],
|
|
18522
|
+
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
18513
18523
|
model: "gpt-5.4",
|
|
18514
18524
|
variant: "high"
|
|
18515
18525
|
},
|
|
18516
|
-
{ providers: ["opencode-go"], model: "glm-5" },
|
|
18526
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5" },
|
|
18517
18527
|
{
|
|
18518
|
-
providers: ["google", "github-copilot", "opencode"],
|
|
18528
|
+
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
18519
18529
|
model: "gemini-3.1-pro"
|
|
18520
18530
|
}
|
|
18521
18531
|
]
|
|
@@ -18523,61 +18533,61 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
18523
18533
|
metis: {
|
|
18524
18534
|
fallbackChain: [
|
|
18525
18535
|
{
|
|
18526
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18536
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18527
18537
|
model: "claude-opus-4-6",
|
|
18528
18538
|
variant: "max"
|
|
18529
18539
|
},
|
|
18530
18540
|
{
|
|
18531
|
-
providers: ["openai", "github-copilot", "opencode"],
|
|
18541
|
+
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
18532
18542
|
model: "gpt-5.4",
|
|
18533
18543
|
variant: "high"
|
|
18534
18544
|
},
|
|
18535
|
-
{ providers: ["opencode-go"], model: "glm-5" },
|
|
18545
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5" },
|
|
18536
18546
|
{ providers: ["kimi-for-coding"], model: "k2p5" }
|
|
18537
18547
|
]
|
|
18538
18548
|
},
|
|
18539
18549
|
momus: {
|
|
18540
18550
|
fallbackChain: [
|
|
18541
18551
|
{
|
|
18542
|
-
providers: ["openai", "github-copilot", "opencode"],
|
|
18552
|
+
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
18543
18553
|
model: "gpt-5.4",
|
|
18544
18554
|
variant: "xhigh"
|
|
18545
18555
|
},
|
|
18546
18556
|
{
|
|
18547
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18557
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18548
18558
|
model: "claude-opus-4-6",
|
|
18549
18559
|
variant: "max"
|
|
18550
18560
|
},
|
|
18551
18561
|
{
|
|
18552
|
-
providers: ["google", "github-copilot", "opencode"],
|
|
18562
|
+
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
18553
18563
|
model: "gemini-3.1-pro",
|
|
18554
18564
|
variant: "high"
|
|
18555
18565
|
},
|
|
18556
|
-
{ providers: ["opencode-go"], model: "glm-5" }
|
|
18566
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5" }
|
|
18557
18567
|
]
|
|
18558
18568
|
},
|
|
18559
18569
|
atlas: {
|
|
18560
18570
|
fallbackChain: [
|
|
18561
|
-
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-sonnet-4-6" },
|
|
18562
|
-
{ providers: ["opencode-go"], model: "kimi-k2.5" },
|
|
18571
|
+
{ providers: ["anthropic", "github-copilot", "opencode", "vercel"], model: "claude-sonnet-4-6" },
|
|
18572
|
+
{ providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
|
|
18563
18573
|
{
|
|
18564
|
-
providers: ["openai", "github-copilot", "opencode"],
|
|
18574
|
+
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
18565
18575
|
model: "gpt-5.4",
|
|
18566
18576
|
variant: "medium"
|
|
18567
18577
|
},
|
|
18568
|
-
{ providers: ["opencode-go"], model: "minimax-m2.7" }
|
|
18578
|
+
{ providers: ["opencode-go", "vercel"], model: "minimax-m2.7" }
|
|
18569
18579
|
]
|
|
18570
18580
|
},
|
|
18571
18581
|
"sisyphus-junior": {
|
|
18572
18582
|
fallbackChain: [
|
|
18573
|
-
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-sonnet-4-6" },
|
|
18574
|
-
{ providers: ["opencode-go"], model: "kimi-k2.5" },
|
|
18583
|
+
{ providers: ["anthropic", "github-copilot", "opencode", "vercel"], model: "claude-sonnet-4-6" },
|
|
18584
|
+
{ providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
|
|
18575
18585
|
{
|
|
18576
|
-
providers: ["openai", "github-copilot", "opencode"],
|
|
18586
|
+
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
18577
18587
|
model: "gpt-5.4",
|
|
18578
18588
|
variant: "medium"
|
|
18579
18589
|
},
|
|
18580
|
-
{ providers: ["opencode-go"], model: "minimax-m2.7" },
|
|
18590
|
+
{ providers: ["opencode-go", "vercel"], model: "minimax-m2.7" },
|
|
18581
18591
|
{ providers: ["opencode"], model: "big-pickle" }
|
|
18582
18592
|
]
|
|
18583
18593
|
}
|
|
@@ -18586,54 +18596,54 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
18586
18596
|
"visual-engineering": {
|
|
18587
18597
|
fallbackChain: [
|
|
18588
18598
|
{
|
|
18589
|
-
providers: ["google", "github-copilot", "opencode"],
|
|
18599
|
+
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
18590
18600
|
model: "gemini-3.1-pro",
|
|
18591
18601
|
variant: "high"
|
|
18592
18602
|
},
|
|
18593
|
-
{ providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
|
|
18603
|
+
{ providers: ["zai-coding-plan", "opencode", "vercel"], model: "glm-5" },
|
|
18594
18604
|
{
|
|
18595
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18605
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18596
18606
|
model: "claude-opus-4-6",
|
|
18597
18607
|
variant: "max"
|
|
18598
18608
|
},
|
|
18599
|
-
{ providers: ["opencode-go"], model: "glm-5" },
|
|
18609
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5" },
|
|
18600
18610
|
{ providers: ["kimi-for-coding"], model: "k2p5" }
|
|
18601
18611
|
]
|
|
18602
18612
|
},
|
|
18603
18613
|
ultrabrain: {
|
|
18604
18614
|
fallbackChain: [
|
|
18605
18615
|
{
|
|
18606
|
-
providers: ["openai", "opencode"],
|
|
18616
|
+
providers: ["openai", "opencode", "vercel"],
|
|
18607
18617
|
model: "gpt-5.4",
|
|
18608
18618
|
variant: "xhigh"
|
|
18609
18619
|
},
|
|
18610
18620
|
{
|
|
18611
|
-
providers: ["google", "github-copilot", "opencode"],
|
|
18621
|
+
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
18612
18622
|
model: "gemini-3.1-pro",
|
|
18613
18623
|
variant: "high"
|
|
18614
18624
|
},
|
|
18615
18625
|
{
|
|
18616
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18626
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18617
18627
|
model: "claude-opus-4-6",
|
|
18618
18628
|
variant: "max"
|
|
18619
18629
|
},
|
|
18620
|
-
{ providers: ["opencode-go"], model: "glm-5" }
|
|
18630
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5" }
|
|
18621
18631
|
]
|
|
18622
18632
|
},
|
|
18623
18633
|
deep: {
|
|
18624
18634
|
fallbackChain: [
|
|
18625
18635
|
{
|
|
18626
|
-
providers: ["openai", "github-copilot", "venice", "opencode"],
|
|
18636
|
+
providers: ["openai", "github-copilot", "venice", "opencode", "vercel"],
|
|
18627
18637
|
model: "gpt-5.4",
|
|
18628
18638
|
variant: "medium"
|
|
18629
18639
|
},
|
|
18630
18640
|
{
|
|
18631
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18641
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18632
18642
|
model: "claude-opus-4-6",
|
|
18633
18643
|
variant: "max"
|
|
18634
18644
|
},
|
|
18635
18645
|
{
|
|
18636
|
-
providers: ["google", "github-copilot", "opencode"],
|
|
18646
|
+
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
18637
18647
|
model: "gemini-3.1-pro",
|
|
18638
18648
|
variant: "high"
|
|
18639
18649
|
}
|
|
@@ -18642,72 +18652,72 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
18642
18652
|
artistry: {
|
|
18643
18653
|
fallbackChain: [
|
|
18644
18654
|
{
|
|
18645
|
-
providers: ["google", "github-copilot", "opencode"],
|
|
18655
|
+
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
18646
18656
|
model: "gemini-3.1-pro",
|
|
18647
18657
|
variant: "high"
|
|
18648
18658
|
},
|
|
18649
18659
|
{
|
|
18650
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18660
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18651
18661
|
model: "claude-opus-4-6",
|
|
18652
18662
|
variant: "max"
|
|
18653
18663
|
},
|
|
18654
|
-
{ providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4" }
|
|
18664
|
+
{ providers: ["openai", "github-copilot", "opencode", "vercel"], model: "gpt-5.4" }
|
|
18655
18665
|
],
|
|
18656
18666
|
requiresModel: "gemini-3.1-pro"
|
|
18657
18667
|
},
|
|
18658
18668
|
quick: {
|
|
18659
18669
|
fallbackChain: [
|
|
18660
18670
|
{
|
|
18661
|
-
providers: ["openai", "github-copilot", "opencode"],
|
|
18671
|
+
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
18662
18672
|
model: "gpt-5.4-mini"
|
|
18663
18673
|
},
|
|
18664
18674
|
{
|
|
18665
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18675
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18666
18676
|
model: "claude-haiku-4-5"
|
|
18667
18677
|
},
|
|
18668
18678
|
{
|
|
18669
|
-
providers: ["google", "github-copilot", "opencode"],
|
|
18679
|
+
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
18670
18680
|
model: "gemini-3-flash"
|
|
18671
18681
|
},
|
|
18672
|
-
{ providers: ["opencode-go"], model: "minimax-m2.7" },
|
|
18673
|
-
{ providers: ["opencode"], model: "gpt-5-nano" }
|
|
18682
|
+
{ providers: ["opencode-go", "vercel"], model: "minimax-m2.7" },
|
|
18683
|
+
{ providers: ["opencode", "vercel"], model: "gpt-5-nano" }
|
|
18674
18684
|
]
|
|
18675
18685
|
},
|
|
18676
18686
|
"unspecified-low": {
|
|
18677
18687
|
fallbackChain: [
|
|
18678
18688
|
{
|
|
18679
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18689
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18680
18690
|
model: "claude-sonnet-4-6"
|
|
18681
18691
|
},
|
|
18682
18692
|
{
|
|
18683
|
-
providers: ["openai", "opencode"],
|
|
18693
|
+
providers: ["openai", "opencode", "vercel"],
|
|
18684
18694
|
model: "gpt-5.3-codex",
|
|
18685
18695
|
variant: "medium"
|
|
18686
18696
|
},
|
|
18687
|
-
{ providers: ["opencode-go"], model: "kimi-k2.5" },
|
|
18697
|
+
{ providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
|
|
18688
18698
|
{
|
|
18689
|
-
providers: ["google", "github-copilot", "opencode"],
|
|
18699
|
+
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
18690
18700
|
model: "gemini-3-flash"
|
|
18691
18701
|
},
|
|
18692
|
-
{ providers: ["opencode-go"], model: "minimax-m2.7" }
|
|
18702
|
+
{ providers: ["opencode-go", "vercel"], model: "minimax-m2.7" }
|
|
18693
18703
|
]
|
|
18694
18704
|
},
|
|
18695
18705
|
"unspecified-high": {
|
|
18696
18706
|
fallbackChain: [
|
|
18697
18707
|
{
|
|
18698
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18708
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18699
18709
|
model: "claude-opus-4-6",
|
|
18700
18710
|
variant: "max"
|
|
18701
18711
|
},
|
|
18702
18712
|
{
|
|
18703
|
-
providers: ["openai", "github-copilot", "opencode"],
|
|
18713
|
+
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
18704
18714
|
model: "gpt-5.4",
|
|
18705
18715
|
variant: "high"
|
|
18706
18716
|
},
|
|
18707
|
-
{ providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
|
|
18717
|
+
{ providers: ["zai-coding-plan", "opencode", "vercel"], model: "glm-5" },
|
|
18708
18718
|
{ providers: ["kimi-for-coding"], model: "k2p5" },
|
|
18709
|
-
{ providers: ["opencode-go"], model: "glm-5" },
|
|
18710
|
-
{ providers: ["opencode"], model: "kimi-k2.5" },
|
|
18719
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5" },
|
|
18720
|
+
{ providers: ["opencode", "vercel"], model: "kimi-k2.5" },
|
|
18711
18721
|
{
|
|
18712
18722
|
providers: [
|
|
18713
18723
|
"opencode",
|
|
@@ -18715,7 +18725,8 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
18715
18725
|
"moonshotai-cn",
|
|
18716
18726
|
"firmware",
|
|
18717
18727
|
"ollama-cloud",
|
|
18718
|
-
"aihubmix"
|
|
18728
|
+
"aihubmix",
|
|
18729
|
+
"vercel"
|
|
18719
18730
|
],
|
|
18720
18731
|
model: "kimi-k2.5"
|
|
18721
18732
|
}
|
|
@@ -18724,15 +18735,15 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
18724
18735
|
writing: {
|
|
18725
18736
|
fallbackChain: [
|
|
18726
18737
|
{
|
|
18727
|
-
providers: ["google", "github-copilot", "opencode"],
|
|
18738
|
+
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
18728
18739
|
model: "gemini-3-flash"
|
|
18729
18740
|
},
|
|
18730
|
-
{ providers: ["opencode-go"], model: "kimi-k2.5" },
|
|
18741
|
+
{ providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
|
|
18731
18742
|
{
|
|
18732
|
-
providers: ["anthropic", "github-copilot", "opencode"],
|
|
18743
|
+
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
18733
18744
|
model: "claude-sonnet-4-6"
|
|
18734
18745
|
},
|
|
18735
|
-
{ providers: ["opencode-go"], model: "minimax-m2.7" }
|
|
18746
|
+
{ providers: ["opencode-go", "vercel"], model: "minimax-m2.7" }
|
|
18736
18747
|
]
|
|
18737
18748
|
}
|
|
18738
18749
|
};
|
|
@@ -18813,6 +18824,19 @@ function restoreMessageCursor(sessionID, cursor) {
|
|
|
18813
18824
|
sessionCursors.set(sessionID, cloneCursorState(cursor));
|
|
18814
18825
|
}
|
|
18815
18826
|
// src/shared/shell-env.ts
|
|
18827
|
+
function detectShellType() {
|
|
18828
|
+
if (process.env.SHELL) {
|
|
18829
|
+
const shell = process.env.SHELL;
|
|
18830
|
+
if (shell.includes("csh") || shell.includes("tcsh")) {
|
|
18831
|
+
return "csh";
|
|
18832
|
+
}
|
|
18833
|
+
return "unix";
|
|
18834
|
+
}
|
|
18835
|
+
if (process.env.PSModulePath) {
|
|
18836
|
+
return "powershell";
|
|
18837
|
+
}
|
|
18838
|
+
return process.platform === "win32" ? "cmd" : "unix";
|
|
18839
|
+
}
|
|
18816
18840
|
function shellEscape(value, shellType) {
|
|
18817
18841
|
if (value === "") {
|
|
18818
18842
|
return shellType === "cmd" ? '""' : "''";
|
|
@@ -19344,12 +19368,54 @@ function isModelCacheAvailable() {
|
|
|
19344
19368
|
}
|
|
19345
19369
|
|
|
19346
19370
|
// src/shared/provider-model-id-transform.ts
|
|
19371
|
+
function inferSubProvider(model) {
|
|
19372
|
+
if (model.startsWith("claude-"))
|
|
19373
|
+
return "anthropic";
|
|
19374
|
+
if (model.startsWith("gpt-"))
|
|
19375
|
+
return "openai";
|
|
19376
|
+
if (model.startsWith("gemini-"))
|
|
19377
|
+
return "google";
|
|
19378
|
+
if (model.startsWith("grok-"))
|
|
19379
|
+
return "xai";
|
|
19380
|
+
if (model.startsWith("minimax-"))
|
|
19381
|
+
return "minimax";
|
|
19382
|
+
if (model.startsWith("kimi-"))
|
|
19383
|
+
return "moonshotai";
|
|
19384
|
+
if (model.startsWith("glm-"))
|
|
19385
|
+
return "zai";
|
|
19386
|
+
return;
|
|
19387
|
+
}
|
|
19388
|
+
var CLAUDE_VERSION_DOT = /claude-(\w+)-(\d+)-(\d+)/g;
|
|
19389
|
+
var GEMINI_31_PRO_PREVIEW = /gemini-3\.1-pro(?!-)/g;
|
|
19390
|
+
var GEMINI_3_FLASH_PREVIEW = /gemini-3-flash(?!-)/g;
|
|
19391
|
+
function claudeVersionDot(model) {
|
|
19392
|
+
return model.replace(CLAUDE_VERSION_DOT, "claude-$1-$2.$3");
|
|
19393
|
+
}
|
|
19394
|
+
function applyGatewayTransforms(model) {
|
|
19395
|
+
return claudeVersionDot(model).replace(GEMINI_31_PRO_PREVIEW, "gemini-3.1-pro-preview");
|
|
19396
|
+
}
|
|
19347
19397
|
function transformModelForProvider(provider, model) {
|
|
19398
|
+
if (provider === "vercel") {
|
|
19399
|
+
const slashIndex = model.indexOf("/");
|
|
19400
|
+
if (slashIndex !== -1) {
|
|
19401
|
+
const subProvider2 = model.substring(0, slashIndex);
|
|
19402
|
+
const subModel = model.substring(slashIndex + 1);
|
|
19403
|
+
return `${subProvider2}/${applyGatewayTransforms(subModel)}`;
|
|
19404
|
+
}
|
|
19405
|
+
const subProvider = inferSubProvider(model);
|
|
19406
|
+
if (subProvider) {
|
|
19407
|
+
return `${subProvider}/${applyGatewayTransforms(model)}`;
|
|
19408
|
+
}
|
|
19409
|
+
return model;
|
|
19410
|
+
}
|
|
19348
19411
|
if (provider === "github-copilot") {
|
|
19349
|
-
return model
|
|
19412
|
+
return claudeVersionDot(model).replace(GEMINI_31_PRO_PREVIEW, "gemini-3.1-pro-preview").replace(GEMINI_3_FLASH_PREVIEW, "gemini-3-flash-preview");
|
|
19350
19413
|
}
|
|
19351
19414
|
if (provider === "google") {
|
|
19352
|
-
return model.replace(
|
|
19415
|
+
return model.replace(GEMINI_31_PRO_PREVIEW, "gemini-3.1-pro-preview").replace(GEMINI_3_FLASH_PREVIEW, "gemini-3-flash-preview");
|
|
19416
|
+
}
|
|
19417
|
+
if (provider === "anthropic") {
|
|
19418
|
+
return claudeVersionDot(model);
|
|
19353
19419
|
}
|
|
19354
19420
|
return model;
|
|
19355
19421
|
}
|
|
@@ -60852,7 +60918,7 @@ function resolveCompatibleModelSettings(input) {
|
|
|
60852
60918
|
topP = undefined;
|
|
60853
60919
|
}
|
|
60854
60920
|
let maxTokens = input.desired.maxTokens;
|
|
60855
|
-
if (maxTokens !== undefined && input.capabilities?.maxOutputTokens !== undefined && maxTokens > input.capabilities.maxOutputTokens) {
|
|
60921
|
+
if (maxTokens !== undefined && input.capabilities?.maxOutputTokens !== undefined && input.capabilities.maxOutputTokens > 0 && maxTokens > input.capabilities.maxOutputTokens) {
|
|
60856
60922
|
changes.push({
|
|
60857
60923
|
field: "maxTokens",
|
|
60858
60924
|
from: String(maxTokens),
|
|
@@ -62758,7 +62824,7 @@ function looksLikeFilePath(path6) {
|
|
|
62758
62824
|
}
|
|
62759
62825
|
function resolveSkillPathReferences(content, basePath) {
|
|
62760
62826
|
const normalizedBase = basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
|
|
62761
|
-
return content.replace(/(?<![a-zA-Z0-9])@([a-zA-Z0-9_-]+\/[a-zA-Z0-9_.\-\/]*)/g, (match, relativePath) => {
|
|
62827
|
+
return content.replace(/(?<![a-zA-Z0-9="\(])@([a-zA-Z0-9_-]+\/[a-zA-Z0-9_.\-\/]*)/g, (match, relativePath) => {
|
|
62762
62828
|
if (!looksLikeFilePath(relativePath))
|
|
62763
62829
|
return match;
|
|
62764
62830
|
const resolvedPath = resolve6(normalizedBase, relativePath);
|
|
@@ -63007,7 +63073,7 @@ function expandEnvVars(value, options = {}) {
|
|
|
63007
63073
|
});
|
|
63008
63074
|
}
|
|
63009
63075
|
function expandEnvVarsInObject(obj, options = {}) {
|
|
63010
|
-
if (obj
|
|
63076
|
+
if (obj == null)
|
|
63011
63077
|
return obj;
|
|
63012
63078
|
if (typeof obj === "string")
|
|
63013
63079
|
return expandEnvVars(obj, options);
|
|
@@ -63080,7 +63146,7 @@ function resolvePluginPath(path6, pluginRoot) {
|
|
|
63080
63146
|
return path6.replace(CLAUDE_PLUGIN_ROOT_VAR, pluginRoot);
|
|
63081
63147
|
}
|
|
63082
63148
|
function resolvePluginPaths(obj, pluginRoot) {
|
|
63083
|
-
if (obj
|
|
63149
|
+
if (obj == null)
|
|
63084
63150
|
return obj;
|
|
63085
63151
|
if (typeof obj === "string") {
|
|
63086
63152
|
return resolvePluginPath(obj, pluginRoot);
|
|
@@ -65794,7 +65860,7 @@ async function prependThinkingPartAsync(client, sessionID, messageID, deps = thi
|
|
|
65794
65860
|
}
|
|
65795
65861
|
}
|
|
65796
65862
|
// src/hooks/session-recovery/storage/thinking-strip.ts
|
|
65797
|
-
import { existsSync as existsSync30, readdirSync as readdirSync10, readFileSync as readFileSync21, unlinkSync as
|
|
65863
|
+
import { existsSync as existsSync30, readdirSync as readdirSync10, readFileSync as readFileSync21, unlinkSync as unlinkSync3 } from "fs";
|
|
65798
65864
|
import { join as join31 } from "path";
|
|
65799
65865
|
function stripThinkingParts(messageID) {
|
|
65800
65866
|
if (isSqliteBackend()) {
|
|
@@ -65813,7 +65879,7 @@ function stripThinkingParts(messageID) {
|
|
|
65813
65879
|
const content = readFileSync21(filePath, "utf-8");
|
|
65814
65880
|
const part = JSON.parse(content);
|
|
65815
65881
|
if (THINKING_TYPES.has(part.type)) {
|
|
65816
|
-
|
|
65882
|
+
unlinkSync3(filePath);
|
|
65817
65883
|
anyRemoved = true;
|
|
65818
65884
|
}
|
|
65819
65885
|
} catch {
|
|
@@ -80430,7 +80496,7 @@ import {
|
|
|
80430
80496
|
existsSync as existsSync35,
|
|
80431
80497
|
mkdirSync as mkdirSync9,
|
|
80432
80498
|
readFileSync as readFileSync22,
|
|
80433
|
-
unlinkSync as
|
|
80499
|
+
unlinkSync as unlinkSync4,
|
|
80434
80500
|
writeFileSync as writeFileSync9
|
|
80435
80501
|
} from "fs";
|
|
80436
80502
|
import { join as join37 } from "path";
|
|
@@ -80462,7 +80528,7 @@ function createInjectedPathsStorage(storageDir) {
|
|
|
80462
80528
|
const clearInjectedPaths = (sessionID) => {
|
|
80463
80529
|
const filePath = getStoragePath(sessionID);
|
|
80464
80530
|
if (existsSync35(filePath)) {
|
|
80465
|
-
|
|
80531
|
+
unlinkSync4(filePath);
|
|
80466
80532
|
}
|
|
80467
80533
|
};
|
|
80468
80534
|
return {
|
|
@@ -80535,7 +80601,6 @@ function createDirectoryAgentsInjectorHook(ctx, modelCacheState) {
|
|
|
80535
80601
|
return;
|
|
80536
80602
|
}
|
|
80537
80603
|
};
|
|
80538
|
-
const toolExecuteBefore = async (input, output) => {};
|
|
80539
80604
|
const eventHandler = async ({ event }) => {
|
|
80540
80605
|
const props = event.properties;
|
|
80541
80606
|
if (event.type === "session.deleted") {
|
|
@@ -80554,7 +80619,6 @@ function createDirectoryAgentsInjectorHook(ctx, modelCacheState) {
|
|
|
80554
80619
|
}
|
|
80555
80620
|
};
|
|
80556
80621
|
return {
|
|
80557
|
-
"tool.execute.before": toolExecuteBefore,
|
|
80558
80622
|
"tool.execute.after": toolExecuteAfter,
|
|
80559
80623
|
event: eventHandler
|
|
80560
80624
|
};
|
|
@@ -80663,7 +80727,6 @@ function createDirectoryReadmeInjectorHook(ctx, modelCacheState) {
|
|
|
80663
80727
|
return;
|
|
80664
80728
|
}
|
|
80665
80729
|
};
|
|
80666
|
-
const toolExecuteBefore = async (input, output) => {};
|
|
80667
80730
|
const eventHandler = async ({ event }) => {
|
|
80668
80731
|
const props = event.properties;
|
|
80669
80732
|
if (event.type === "session.deleted") {
|
|
@@ -80682,7 +80745,6 @@ function createDirectoryReadmeInjectorHook(ctx, modelCacheState) {
|
|
|
80682
80745
|
}
|
|
80683
80746
|
};
|
|
80684
80747
|
return {
|
|
80685
|
-
"tool.execute.before": toolExecuteBefore,
|
|
80686
80748
|
"tool.execute.after": toolExecuteAfter,
|
|
80687
80749
|
event: eventHandler
|
|
80688
80750
|
};
|
|
@@ -82705,7 +82767,12 @@ function getNextReachableFallback(sessionID, state3) {
|
|
|
82705
82767
|
return {
|
|
82706
82768
|
providerID,
|
|
82707
82769
|
modelID,
|
|
82708
|
-
variant: fallback.variant
|
|
82770
|
+
variant: fallback.variant,
|
|
82771
|
+
reasoningEffort: fallback.reasoningEffort,
|
|
82772
|
+
temperature: fallback.temperature,
|
|
82773
|
+
top_p: fallback.top_p,
|
|
82774
|
+
maxTokens: fallback.maxTokens,
|
|
82775
|
+
thinking: fallback.thinking
|
|
82709
82776
|
};
|
|
82710
82777
|
}
|
|
82711
82778
|
return null;
|
|
@@ -83194,7 +83261,7 @@ ${USER_PROMPT_SUBMIT_TAG_CLOSE}`);
|
|
|
83194
83261
|
|
|
83195
83262
|
// src/hooks/claude-code-hooks/transcript.ts
|
|
83196
83263
|
import { join as join45 } from "path";
|
|
83197
|
-
import { mkdirSync as mkdirSync10, appendFileSync as appendFileSync5, existsSync as existsSync42, writeFileSync as writeFileSync11, unlinkSync as
|
|
83264
|
+
import { mkdirSync as mkdirSync10, appendFileSync as appendFileSync5, existsSync as existsSync42, writeFileSync as writeFileSync11, unlinkSync as unlinkSync5 } from "fs";
|
|
83198
83265
|
import { tmpdir as tmpdir6 } from "os";
|
|
83199
83266
|
import { randomUUID } from "crypto";
|
|
83200
83267
|
var TRANSCRIPT_DIR = join45(getClaudeConfigDir(), "transcripts");
|
|
@@ -83220,7 +83287,7 @@ function clearTranscriptCache(sessionId) {
|
|
|
83220
83287
|
const entry = transcriptCache.get(sessionId);
|
|
83221
83288
|
if (entry?.tempPath) {
|
|
83222
83289
|
try {
|
|
83223
|
-
|
|
83290
|
+
unlinkSync5(entry.tempPath);
|
|
83224
83291
|
} catch (error48) {
|
|
83225
83292
|
log("[transcript] failed to clean up cached temp transcript", { error: error48 });
|
|
83226
83293
|
}
|
|
@@ -83230,7 +83297,7 @@ function clearTranscriptCache(sessionId) {
|
|
|
83230
83297
|
for (const [, entry] of transcriptCache) {
|
|
83231
83298
|
if (entry.tempPath) {
|
|
83232
83299
|
try {
|
|
83233
|
-
|
|
83300
|
+
unlinkSync5(entry.tempPath);
|
|
83234
83301
|
} catch (error48) {
|
|
83235
83302
|
log("[transcript] failed to clean up cached temp transcript", { error: error48 });
|
|
83236
83303
|
}
|
|
@@ -83301,7 +83368,7 @@ async function buildTranscriptFromSession(client, sessionId, directory, currentT
|
|
|
83301
83368
|
baseEntries = Array.isArray(messages) ? parseMessagesToEntries(messages) : [];
|
|
83302
83369
|
if (cached2?.tempPath) {
|
|
83303
83370
|
try {
|
|
83304
|
-
|
|
83371
|
+
unlinkSync5(cached2.tempPath);
|
|
83305
83372
|
} catch (error48) {
|
|
83306
83373
|
log("[transcript] failed to clean up stale temp transcript", { error: error48 });
|
|
83307
83374
|
}
|
|
@@ -83315,7 +83382,7 @@ async function buildTranscriptFromSession(client, sessionId, directory, currentT
|
|
|
83315
83382
|
const allEntries = [...baseEntries, buildCurrentEntry(currentToolName, currentToolInput)];
|
|
83316
83383
|
if (previousTempPath) {
|
|
83317
83384
|
try {
|
|
83318
|
-
|
|
83385
|
+
unlinkSync5(previousTempPath);
|
|
83319
83386
|
} catch (error48) {
|
|
83320
83387
|
log("[transcript] failed to clean up previous temp transcript", { error: error48 });
|
|
83321
83388
|
}
|
|
@@ -83348,7 +83415,7 @@ function deleteTempTranscript(path6) {
|
|
|
83348
83415
|
if (!path6)
|
|
83349
83416
|
return;
|
|
83350
83417
|
try {
|
|
83351
|
-
|
|
83418
|
+
unlinkSync5(path6);
|
|
83352
83419
|
} catch (error48) {
|
|
83353
83420
|
log("[transcript] failed to delete temp transcript", { error: error48 });
|
|
83354
83421
|
}
|
|
@@ -84234,7 +84301,7 @@ import {
|
|
|
84234
84301
|
mkdirSync as mkdirSync11,
|
|
84235
84302
|
readFileSync as readFileSync28,
|
|
84236
84303
|
writeFileSync as writeFileSync12,
|
|
84237
|
-
unlinkSync as
|
|
84304
|
+
unlinkSync as unlinkSync6
|
|
84238
84305
|
} from "fs";
|
|
84239
84306
|
import { join as join48 } from "path";
|
|
84240
84307
|
|
|
@@ -84297,7 +84364,7 @@ function saveInjectedRules(sessionID, data) {
|
|
|
84297
84364
|
function clearInjectedRules(sessionID) {
|
|
84298
84365
|
const filePath = getStoragePath(sessionID);
|
|
84299
84366
|
if (existsSync43(filePath)) {
|
|
84300
|
-
|
|
84367
|
+
unlinkSync6(filePath);
|
|
84301
84368
|
}
|
|
84302
84369
|
}
|
|
84303
84370
|
|
|
@@ -85213,7 +85280,7 @@ function migrateLegacyConfigFile(legacyPath) {
|
|
|
85213
85280
|
to: canonicalPath,
|
|
85214
85281
|
archivedLegacyConfig
|
|
85215
85282
|
});
|
|
85216
|
-
return
|
|
85283
|
+
return true;
|
|
85217
85284
|
} catch (error48) {
|
|
85218
85285
|
log("[migrateLegacyConfigFile] Failed to migrate legacy config file", { legacyPath, error: error48 });
|
|
85219
85286
|
return false;
|
|
@@ -85813,7 +85880,7 @@ import {
|
|
|
85813
85880
|
mkdirSync as mkdirSync13,
|
|
85814
85881
|
readFileSync as readFileSync38,
|
|
85815
85882
|
writeFileSync as writeFileSync15,
|
|
85816
|
-
unlinkSync as
|
|
85883
|
+
unlinkSync as unlinkSync9
|
|
85817
85884
|
} from "fs";
|
|
85818
85885
|
import { join as join61 } from "path";
|
|
85819
85886
|
|
|
@@ -85888,7 +85955,7 @@ function saveAgentUsageState(state3) {
|
|
|
85888
85955
|
function clearAgentUsageState(sessionID) {
|
|
85889
85956
|
const filePath = getStoragePath2(sessionID);
|
|
85890
85957
|
if (existsSync56(filePath)) {
|
|
85891
|
-
|
|
85958
|
+
unlinkSync9(filePath);
|
|
85892
85959
|
}
|
|
85893
85960
|
}
|
|
85894
85961
|
|
|
@@ -87148,7 +87215,7 @@ function createNonInteractiveEnvHook(_ctx) {
|
|
|
87148
87215
|
if (!isGitCommand) {
|
|
87149
87216
|
return;
|
|
87150
87217
|
}
|
|
87151
|
-
const shellType =
|
|
87218
|
+
const shellType = detectShellType();
|
|
87152
87219
|
const envPrefix = buildEnvPrefix(NON_INTERACTIVE_ENV, shellType);
|
|
87153
87220
|
if (command.trim().startsWith(envPrefix.trim())) {
|
|
87154
87221
|
return;
|
|
@@ -87167,7 +87234,7 @@ import {
|
|
|
87167
87234
|
mkdirSync as mkdirSync14,
|
|
87168
87235
|
readFileSync as readFileSync39,
|
|
87169
87236
|
writeFileSync as writeFileSync16,
|
|
87170
|
-
unlinkSync as
|
|
87237
|
+
unlinkSync as unlinkSync10
|
|
87171
87238
|
} from "fs";
|
|
87172
87239
|
import { join as join63 } from "path";
|
|
87173
87240
|
|
|
@@ -87218,7 +87285,7 @@ function saveInteractiveBashSessionState(state3) {
|
|
|
87218
87285
|
function clearInteractiveBashSessionState(sessionID) {
|
|
87219
87286
|
const filePath = getStoragePath3(sessionID);
|
|
87220
87287
|
if (existsSync57(filePath)) {
|
|
87221
|
-
|
|
87288
|
+
unlinkSync10(filePath);
|
|
87222
87289
|
}
|
|
87223
87290
|
}
|
|
87224
87291
|
|
|
@@ -87727,7 +87794,7 @@ var ULTRAWORK_MAX_ITERATIONS = 500;
|
|
|
87727
87794
|
var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
87728
87795
|
var ULTRAWORK_VERIFICATION_PROMISE = "VERIFIED";
|
|
87729
87796
|
// src/hooks/ralph-loop/storage.ts
|
|
87730
|
-
import { existsSync as existsSync58, readFileSync as readFileSync40, writeFileSync as writeFileSync17, unlinkSync as
|
|
87797
|
+
import { existsSync as existsSync58, readFileSync as readFileSync40, writeFileSync as writeFileSync17, unlinkSync as unlinkSync11, mkdirSync as mkdirSync15 } from "fs";
|
|
87731
87798
|
import { dirname as dirname17, join as join64 } from "path";
|
|
87732
87799
|
function getStateFilePath(directory, customPath) {
|
|
87733
87800
|
return customPath ? join64(directory, customPath) : join64(directory, DEFAULT_STATE_FILE);
|
|
@@ -87819,7 +87886,7 @@ function clearState(directory, customPath) {
|
|
|
87819
87886
|
const filePath = getStateFilePath(directory, customPath);
|
|
87820
87887
|
try {
|
|
87821
87888
|
if (existsSync58(filePath)) {
|
|
87822
|
-
|
|
87889
|
+
unlinkSync11(filePath);
|
|
87823
87890
|
}
|
|
87824
87891
|
return true;
|
|
87825
87892
|
} catch {
|
|
@@ -95372,8 +95439,8 @@ function clearBoulderState(directory) {
|
|
|
95372
95439
|
const filePath = getBoulderFilePath(directory);
|
|
95373
95440
|
try {
|
|
95374
95441
|
if (existsSync62(filePath)) {
|
|
95375
|
-
const { unlinkSync:
|
|
95376
|
-
|
|
95442
|
+
const { unlinkSync: unlinkSync12 } = __require("fs");
|
|
95443
|
+
unlinkSync12(filePath);
|
|
95377
95444
|
}
|
|
95378
95445
|
return true;
|
|
95379
95446
|
} catch {
|
|
@@ -95893,8 +95960,8 @@ Ask the user which plan to work on.`;
|
|
|
95893
95960
|
return `
|
|
95894
95961
|
## Plan Not Found
|
|
95895
95962
|
|
|
95896
|
-
Could not find a plan matching "${explicitPlanName}".
|
|
95897
|
-
No incomplete plans available. Create a new plan
|
|
95963
|
+
Could not find a plan matching "${explicitPlanName}".
|
|
95964
|
+
No incomplete plans available. Create a new plan using the Prometheus agent.`;
|
|
95898
95965
|
}
|
|
95899
95966
|
function buildExplicitPlanContext(params) {
|
|
95900
95967
|
const { explicitPlanName, existingState, sessionId, timestamp: timestamp2, activeAgent, worktreePath, worktreeBlock, directory } = params;
|
|
@@ -95909,8 +95976,8 @@ function buildExplicitPlanContext(params) {
|
|
|
95909
95976
|
return `
|
|
95910
95977
|
## Plan Already Complete
|
|
95911
95978
|
|
|
95912
|
-
The requested plan "${getPlanName(matchedPlan)}" has been completed.
|
|
95913
|
-
All ${progress.total} tasks are done. Create a new plan
|
|
95979
|
+
The requested plan "${getPlanName(matchedPlan)}" has been completed.
|
|
95980
|
+
All ${progress.total} tasks are done. Create a new plan using the Prometheus agent.`;
|
|
95914
95981
|
}
|
|
95915
95982
|
if (existingState) {
|
|
95916
95983
|
clearBoulderState(directory);
|
|
@@ -95975,15 +96042,15 @@ function buildPlanDiscoveryContext(params) {
|
|
|
95975
96042
|
return contextInfo + `
|
|
95976
96043
|
## No Plans Found
|
|
95977
96044
|
|
|
95978
|
-
No Prometheus plan files found
|
|
95979
|
-
Use Prometheus to create a work plan first
|
|
96045
|
+
No Prometheus plan files found in the .sisyphus plans directory.
|
|
96046
|
+
Use the Prometheus agent to create a work plan first.`;
|
|
95980
96047
|
}
|
|
95981
96048
|
if (incompletePlans.length === 0) {
|
|
95982
96049
|
return contextInfo + `
|
|
95983
96050
|
|
|
95984
96051
|
## All Plans Complete
|
|
95985
96052
|
|
|
95986
|
-
All ${plans.length} plan(s) are complete. Create a new plan
|
|
96053
|
+
All ${plans.length} plan(s) are complete. Create a new plan using the Prometheus agent.`;
|
|
95987
96054
|
}
|
|
95988
96055
|
if (incompletePlans.length === 1) {
|
|
95989
96056
|
return contextInfo + buildAutoSelectedPlanContext({
|
|
@@ -96315,7 +96382,7 @@ Assume the work is broken until YOU prove otherwise.
|
|
|
96315
96382
|
|
|
96316
96383
|
Do NOT run tests yet. Read the code FIRST so you know what you're testing.
|
|
96317
96384
|
|
|
96318
|
-
1. \`Bash("git diff --stat")\` - see exactly which files changed. Any file outside expected scope = scope creep.
|
|
96385
|
+
1. \`Bash("git diff --stat -- ':!node_modules'")\` - see exactly which files changed. Any file outside expected scope = scope creep.
|
|
96319
96386
|
2. \`Read\` EVERY changed file - no exceptions, no skimming.
|
|
96320
96387
|
3. For EACH file, critically ask:
|
|
96321
96388
|
- Does this code ACTUALLY do what the task required? (Re-read the task, compare line by line)
|
|
@@ -99043,6 +99110,22 @@ init_logger();
|
|
|
99043
99110
|
import * as fs19 from "fs";
|
|
99044
99111
|
import * as path12 from "path";
|
|
99045
99112
|
init_plugin_identity();
|
|
99113
|
+
function loadExplicitGitMasterOverrides(configPath) {
|
|
99114
|
+
try {
|
|
99115
|
+
if (!fs19.existsSync(configPath)) {
|
|
99116
|
+
return;
|
|
99117
|
+
}
|
|
99118
|
+
const content = fs19.readFileSync(configPath, "utf-8");
|
|
99119
|
+
const rawConfig = parseJsonc(content);
|
|
99120
|
+
const gitMaster = rawConfig.git_master;
|
|
99121
|
+
if (gitMaster && typeof gitMaster === "object" && !Array.isArray(gitMaster)) {
|
|
99122
|
+
return gitMaster;
|
|
99123
|
+
}
|
|
99124
|
+
} catch {
|
|
99125
|
+
return;
|
|
99126
|
+
}
|
|
99127
|
+
return;
|
|
99128
|
+
}
|
|
99046
99129
|
var PARTIAL_STRING_ARRAY_KEYS = new Set([
|
|
99047
99130
|
"disabled_mcps",
|
|
99048
99131
|
"disabled_agents",
|
|
@@ -99201,11 +99284,24 @@ function loadPluginConfig(directory, ctx) {
|
|
|
99201
99284
|
}
|
|
99202
99285
|
}
|
|
99203
99286
|
const userConfig = loadConfigFromPath2(userConfigPath, ctx);
|
|
99287
|
+
const userGitMasterOverrides = loadExplicitGitMasterOverrides(userConfigPath);
|
|
99204
99288
|
let config2 = userConfig ?? OhMyOpenCodeConfigSchema.parse({});
|
|
99289
|
+
const defaultGitMaster = OhMyOpenCodeConfigSchema.parse({}).git_master;
|
|
99205
99290
|
const projectConfig = loadConfigFromPath2(projectConfigPath, ctx);
|
|
99291
|
+
const projectGitMasterOverrides = loadExplicitGitMasterOverrides(projectConfigPath);
|
|
99206
99292
|
if (projectConfig) {
|
|
99207
99293
|
config2 = mergeConfigs(config2, projectConfig);
|
|
99208
99294
|
}
|
|
99295
|
+
if (userGitMasterOverrides || projectGitMasterOverrides) {
|
|
99296
|
+
config2 = {
|
|
99297
|
+
...config2,
|
|
99298
|
+
git_master: {
|
|
99299
|
+
...defaultGitMaster,
|
|
99300
|
+
...userGitMasterOverrides ?? {},
|
|
99301
|
+
...projectGitMasterOverrides ?? {}
|
|
99302
|
+
}
|
|
99303
|
+
};
|
|
99304
|
+
}
|
|
99209
99305
|
config2 = {
|
|
99210
99306
|
...config2,
|
|
99211
99307
|
mcp_env_allowlist: userConfig?.mcp_env_allowlist ?? []
|
|
@@ -102103,6 +102199,8 @@ function createAnthropicEffortHook() {
|
|
|
102103
102199
|
return;
|
|
102104
102200
|
if (!isClaudeProvider(model.providerID, model.modelID))
|
|
102105
102201
|
return;
|
|
102202
|
+
if (model.providerID === "github-copilot")
|
|
102203
|
+
return;
|
|
102106
102204
|
if (shouldSkipForInternalAgent(agent?.name))
|
|
102107
102205
|
return;
|
|
102108
102206
|
if (output.options.effort !== undefined)
|
|
@@ -117703,7 +117801,7 @@ Skills and commands provide specialized knowledge and step-by-step guidance.
|
|
|
117703
117801
|
Use this when a task matches an available skill's or command's description.
|
|
117704
117802
|
|
|
117705
117803
|
**How to use:**
|
|
117706
|
-
- Call with a skill name: name='
|
|
117804
|
+
- Call with a skill name: name='review-work'
|
|
117707
117805
|
- Call with a command name (without leading slash): name='publish'
|
|
117708
117806
|
- The tool will return detailed instructions with your context applied.
|
|
117709
117807
|
`;
|
|
@@ -118113,7 +118211,7 @@ function createSkillTool(options = {}) {
|
|
|
118113
118211
|
return cachedDescription ?? TOOL_DESCRIPTION_PREFIX;
|
|
118114
118212
|
},
|
|
118115
118213
|
args: {
|
|
118116
|
-
name: tool.schema.string().describe("The skill or command name (e.g., '
|
|
118214
|
+
name: tool.schema.string().describe("The skill or command name (e.g., 'review-work' or 'publish'). Use without leading slash for commands."),
|
|
118117
118215
|
user_message: tool.schema.string().optional().describe("Optional arguments or context for command invocation. Example: name='publish', user_message='patch'")
|
|
118118
118216
|
},
|
|
118119
118217
|
async execute(args, ctx) {
|
|
@@ -118123,6 +118221,14 @@ function createSkillTool(options = {}) {
|
|
|
118123
118221
|
const requestedName = args.name.replace(/^\//, "");
|
|
118124
118222
|
const matchedSkill = matchSkillByName(skills2, requestedName);
|
|
118125
118223
|
if (matchedSkill) {
|
|
118224
|
+
await ctx?.ask({
|
|
118225
|
+
permission: "skill",
|
|
118226
|
+
patterns: [matchedSkill.name],
|
|
118227
|
+
always: [matchedSkill.name],
|
|
118228
|
+
metadata: {
|
|
118229
|
+
skill: matchedSkill.name
|
|
118230
|
+
}
|
|
118231
|
+
});
|
|
118126
118232
|
if (matchedSkill.definition.agent && (!ctx?.agent || matchedSkill.definition.agent !== ctx.agent)) {
|
|
118127
118233
|
throw new Error(`Skill "${matchedSkill.name}" is restricted to agent "${matchedSkill.definition.agent}"`);
|
|
118128
118234
|
}
|
|
@@ -120707,7 +120813,7 @@ async function resolveMultimodalLookerAgentMetadata(ctx) {
|
|
|
120707
120813
|
|
|
120708
120814
|
// src/tools/look-at/image-converter.ts
|
|
120709
120815
|
import * as childProcess from "child_process";
|
|
120710
|
-
import { existsSync as existsSync81, mkdtempSync, readFileSync as readFileSync54, rmSync as rmSync4, unlinkSync as
|
|
120816
|
+
import { existsSync as existsSync81, mkdtempSync, readFileSync as readFileSync54, rmSync as rmSync4, unlinkSync as unlinkSync12, writeFileSync as writeFileSync20 } from "fs";
|
|
120711
120817
|
import { tmpdir as tmpdir7 } from "os";
|
|
120712
120818
|
import { dirname as dirname28, join as join86 } from "path";
|
|
120713
120819
|
var SUPPORTED_FORMATS = new Set([
|
|
@@ -120790,7 +120896,7 @@ function convertImageToJpeg(inputPath, mimeType) {
|
|
|
120790
120896
|
} catch (error92) {
|
|
120791
120897
|
try {
|
|
120792
120898
|
if (existsSync81(outputPath)) {
|
|
120793
|
-
|
|
120899
|
+
unlinkSync12(outputPath);
|
|
120794
120900
|
}
|
|
120795
120901
|
} catch {}
|
|
120796
120902
|
if (error92 instanceof Error) {
|
|
@@ -120804,7 +120910,7 @@ function cleanupConvertedImage(filePath) {
|
|
|
120804
120910
|
try {
|
|
120805
120911
|
const tempDirectory = dirname28(filePath);
|
|
120806
120912
|
if (existsSync81(filePath)) {
|
|
120807
|
-
|
|
120913
|
+
unlinkSync12(filePath);
|
|
120808
120914
|
log(`[image-converter] Cleaned up temporary file: ${filePath}`);
|
|
120809
120915
|
}
|
|
120810
120916
|
if (existsSync81(tempDirectory)) {
|
|
@@ -120835,7 +120941,7 @@ function convertBase64ImageToJpeg(base64Data, mimeType) {
|
|
|
120835
120941
|
tempFiles.forEach((file3) => {
|
|
120836
120942
|
try {
|
|
120837
120943
|
if (existsSync81(file3))
|
|
120838
|
-
|
|
120944
|
+
unlinkSync12(file3);
|
|
120839
120945
|
} catch {}
|
|
120840
120946
|
});
|
|
120841
120947
|
throw error92;
|
|
@@ -121424,6 +121530,11 @@ function abortSyncSession(client2, sessionID, reason) {
|
|
|
121424
121530
|
log("[task] Failed to abort sync session", { sessionID, reason, error: String(error92) });
|
|
121425
121531
|
});
|
|
121426
121532
|
}
|
|
121533
|
+
async function fetchSessionMessages(client2, sessionID) {
|
|
121534
|
+
const messagesResult = await client2.session.messages({ path: { id: sessionID } });
|
|
121535
|
+
const rawData = messagesResult?.data ?? messagesResult;
|
|
121536
|
+
return Array.isArray(rawData) ? rawData : [];
|
|
121537
|
+
}
|
|
121427
121538
|
function isSessionComplete(messages) {
|
|
121428
121539
|
let lastUser;
|
|
121429
121540
|
let lastAssistant;
|
|
@@ -121459,6 +121570,19 @@ async function pollSyncSession(ctx, client2, input, timeoutMs) {
|
|
|
121459
121570
|
log("[task] Starting poll loop", { sessionID: input.sessionID, agentToUse: input.agentToUse, maxTurns });
|
|
121460
121571
|
while (Date.now() - pollStart < maxPollTimeMs) {
|
|
121461
121572
|
if (ctx.abort?.aborted) {
|
|
121573
|
+
try {
|
|
121574
|
+
const messages2 = await fetchSessionMessages(client2, input.sessionID);
|
|
121575
|
+
const hasNewMessages = input.anchorMessageCount === undefined || messages2.length > input.anchorMessageCount;
|
|
121576
|
+
if (hasNewMessages && isSessionComplete(messages2)) {
|
|
121577
|
+
log("[task] Abort detected after session already completed", { sessionID: input.sessionID });
|
|
121578
|
+
return null;
|
|
121579
|
+
}
|
|
121580
|
+
} catch (error92) {
|
|
121581
|
+
log("[task] Final messages fetch failed after abort, continuing with abort", {
|
|
121582
|
+
sessionID: input.sessionID,
|
|
121583
|
+
error: String(error92)
|
|
121584
|
+
});
|
|
121585
|
+
}
|
|
121462
121586
|
log("[task] Aborted by user", { sessionID: input.sessionID });
|
|
121463
121587
|
abortSyncSession(client2, input.sessionID, "parent_abort");
|
|
121464
121588
|
if (input.toastManager && input.taskId)
|
|
@@ -121489,23 +121613,21 @@ Session ID: ${input.sessionID}`;
|
|
|
121489
121613
|
if (sessionStatus && sessionStatus.type !== "idle") {
|
|
121490
121614
|
continue;
|
|
121491
121615
|
}
|
|
121492
|
-
let
|
|
121616
|
+
let messages;
|
|
121493
121617
|
try {
|
|
121494
|
-
|
|
121618
|
+
messages = await fetchSessionMessages(client2, input.sessionID);
|
|
121495
121619
|
} catch (error92) {
|
|
121496
121620
|
log("[task] Poll messages fetch failed, retrying", { sessionID: input.sessionID, error: String(error92) });
|
|
121497
121621
|
continue;
|
|
121498
121622
|
}
|
|
121499
|
-
|
|
121500
|
-
const msgs = Array.isArray(rawData) ? rawData : [];
|
|
121501
|
-
if (input.anchorMessageCount !== undefined && msgs.length <= input.anchorMessageCount) {
|
|
121623
|
+
if (input.anchorMessageCount !== undefined && messages.length <= input.anchorMessageCount) {
|
|
121502
121624
|
continue;
|
|
121503
121625
|
}
|
|
121504
|
-
if (isSessionComplete(
|
|
121626
|
+
if (isSessionComplete(messages)) {
|
|
121505
121627
|
log("[task] Poll complete - terminal finish detected", { sessionID: input.sessionID, pollCount });
|
|
121506
121628
|
break;
|
|
121507
121629
|
}
|
|
121508
|
-
const lastAssistant = [...
|
|
121630
|
+
const lastAssistant = [...messages].reverse().find((m) => m.info?.role === "assistant");
|
|
121509
121631
|
if (lastAssistant?.info?.id && lastAssistant.info.id !== lastSeenAssistantId) {
|
|
121510
121632
|
lastSeenAssistantId = lastAssistant.info.id;
|
|
121511
121633
|
assistantTurnCount++;
|
|
@@ -121521,7 +121643,7 @@ Session ID: ${input.sessionID}`;
|
|
|
121521
121643
|
return `Task aborted: subagent exceeded ${maxTurns} assistant turns without completing. This usually indicates an infinite tool-call loop. Session ID: ${input.sessionID}`;
|
|
121522
121644
|
}
|
|
121523
121645
|
}
|
|
121524
|
-
const hasAssistantText =
|
|
121646
|
+
const hasAssistantText = messages.some((m) => {
|
|
121525
121647
|
if (m.info?.role !== "assistant")
|
|
121526
121648
|
return false;
|
|
121527
121649
|
const parts = m.parts ?? [];
|
|
@@ -122204,6 +122326,58 @@ var syncTaskDeps = {
|
|
|
122204
122326
|
fetchSyncResult
|
|
122205
122327
|
};
|
|
122206
122328
|
|
|
122329
|
+
// src/tools/delegate-task/sync-task-fallback.ts
|
|
122330
|
+
function toDelegatedModelConfig(fallback) {
|
|
122331
|
+
return {
|
|
122332
|
+
providerID: fallback.providerID,
|
|
122333
|
+
modelID: fallback.modelID,
|
|
122334
|
+
variant: fallback.variant,
|
|
122335
|
+
reasoningEffort: fallback.reasoningEffort,
|
|
122336
|
+
temperature: fallback.temperature,
|
|
122337
|
+
top_p: fallback.top_p,
|
|
122338
|
+
maxTokens: fallback.maxTokens,
|
|
122339
|
+
thinking: fallback.thinking
|
|
122340
|
+
};
|
|
122341
|
+
}
|
|
122342
|
+
async function retrySyncPromptWithFallbacks(input) {
|
|
122343
|
+
const { sessionID, initialError, categoryModel, fallbackChain, sendPrompt } = input;
|
|
122344
|
+
if (!categoryModel || !fallbackChain || fallbackChain.length === 0) {
|
|
122345
|
+
return {
|
|
122346
|
+
promptError: initialError,
|
|
122347
|
+
categoryModel
|
|
122348
|
+
};
|
|
122349
|
+
}
|
|
122350
|
+
const fallbackState = {
|
|
122351
|
+
providerID: categoryModel.providerID,
|
|
122352
|
+
modelID: categoryModel.modelID,
|
|
122353
|
+
fallbackChain,
|
|
122354
|
+
attemptCount: 0,
|
|
122355
|
+
pending: true
|
|
122356
|
+
};
|
|
122357
|
+
let finalError = initialError;
|
|
122358
|
+
while (true) {
|
|
122359
|
+
const nextFallback = getNextReachableFallback(sessionID, fallbackState);
|
|
122360
|
+
if (!nextFallback) {
|
|
122361
|
+
return {
|
|
122362
|
+
promptError: finalError,
|
|
122363
|
+
categoryModel
|
|
122364
|
+
};
|
|
122365
|
+
}
|
|
122366
|
+
const fallbackModel = toDelegatedModelConfig(nextFallback);
|
|
122367
|
+
const promptError = await sendPrompt(fallbackModel);
|
|
122368
|
+
if (!promptError) {
|
|
122369
|
+
return {
|
|
122370
|
+
promptError: null,
|
|
122371
|
+
categoryModel: fallbackModel
|
|
122372
|
+
};
|
|
122373
|
+
}
|
|
122374
|
+
finalError = promptError;
|
|
122375
|
+
fallbackState.providerID = fallbackModel.providerID;
|
|
122376
|
+
fallbackState.modelID = fallbackModel.modelID;
|
|
122377
|
+
fallbackState.pending = true;
|
|
122378
|
+
}
|
|
122379
|
+
}
|
|
122380
|
+
|
|
122207
122381
|
// src/tools/delegate-task/sync-task.ts
|
|
122208
122382
|
async function executeSyncTask(args, ctx, executorCtx, parentContext, agentToUse, categoryModel, systemContent, modelInfo, fallbackChain, deps = syncTaskDeps) {
|
|
122209
122383
|
const { manager, client: client2, directory, onSyncSessionCreated, syncPollTimeoutMs } = executorCtx;
|
|
@@ -122294,18 +122468,41 @@ async function executeSyncTask(args, ctx, executorCtx, parentContext, agentToUse
|
|
|
122294
122468
|
if (callID) {
|
|
122295
122469
|
storeToolMetadata(ctx.sessionID, callID, syncTaskMeta);
|
|
122296
122470
|
}
|
|
122297
|
-
|
|
122471
|
+
let effectiveCategoryModel = categoryModel;
|
|
122472
|
+
let promptError = await deps.sendSyncPrompt(client2, {
|
|
122298
122473
|
sessionID,
|
|
122299
122474
|
agentToUse,
|
|
122300
122475
|
args,
|
|
122301
122476
|
systemContent,
|
|
122302
|
-
categoryModel,
|
|
122477
|
+
categoryModel: effectiveCategoryModel,
|
|
122303
122478
|
toastManager,
|
|
122304
122479
|
taskId,
|
|
122305
122480
|
sisyphusAgentConfig: executorCtx.sisyphusAgentConfig
|
|
122306
122481
|
});
|
|
122307
122482
|
if (promptError) {
|
|
122308
|
-
|
|
122483
|
+
const promptResult = await retrySyncPromptWithFallbacks({
|
|
122484
|
+
sessionID,
|
|
122485
|
+
initialError: promptError,
|
|
122486
|
+
categoryModel: effectiveCategoryModel,
|
|
122487
|
+
fallbackChain,
|
|
122488
|
+
sendPrompt: async (fallbackModel) => {
|
|
122489
|
+
return deps.sendSyncPrompt(client2, {
|
|
122490
|
+
sessionID,
|
|
122491
|
+
agentToUse,
|
|
122492
|
+
args,
|
|
122493
|
+
systemContent,
|
|
122494
|
+
categoryModel: fallbackModel,
|
|
122495
|
+
toastManager,
|
|
122496
|
+
taskId,
|
|
122497
|
+
sisyphusAgentConfig: executorCtx.sisyphusAgentConfig
|
|
122498
|
+
});
|
|
122499
|
+
}
|
|
122500
|
+
});
|
|
122501
|
+
promptError = promptResult.promptError;
|
|
122502
|
+
effectiveCategoryModel = promptResult.categoryModel;
|
|
122503
|
+
if (promptError) {
|
|
122504
|
+
return promptError;
|
|
122505
|
+
}
|
|
122309
122506
|
}
|
|
122310
122507
|
try {
|
|
122311
122508
|
const pollError = await deps.pollSyncSession(ctx, client2, {
|
|
@@ -122322,7 +122519,7 @@ async function executeSyncTask(args, ctx, executorCtx, parentContext, agentToUse
|
|
|
122322
122519
|
return result.error;
|
|
122323
122520
|
}
|
|
122324
122521
|
const duration5 = formatDuration2(startTime);
|
|
122325
|
-
const actualModelStr =
|
|
122522
|
+
const actualModelStr = effectiveCategoryModel ? `${effectiveCategoryModel.providerID}/${effectiveCategoryModel.modelID}` : undefined;
|
|
122326
122523
|
const parentModelStr = parentContext.model ? `${parentContext.model.providerID}/${parentContext.model.modelID}` : undefined;
|
|
122327
122524
|
const modelRoutingNote = actualModelStr && parentModelStr && actualModelStr !== parentModelStr ? `
|
|
122328
122525
|
\u26A0\uFE0F Model routing: parent used ${parentModelStr}, this subagent used ${actualModelStr} (via category: ${args.category ?? "unknown"})` : actualModelStr ? `
|
|
@@ -122809,8 +123006,8 @@ Available categories: ${categoryNames.join(", ")}`
|
|
|
122809
123006
|
}
|
|
122810
123007
|
// src/tools/delegate-task/subagent-resolver.ts
|
|
122811
123008
|
init_constants();
|
|
122812
|
-
|
|
122813
|
-
|
|
123009
|
+
|
|
123010
|
+
// src/tools/delegate-task/delegated-model-config.ts
|
|
122814
123011
|
function applyCategoryParams2(base, config4) {
|
|
122815
123012
|
if (!config4) {
|
|
122816
123013
|
return base;
|
|
@@ -122824,12 +123021,171 @@ function applyCategoryParams2(base, config4) {
|
|
|
122824
123021
|
...config4.thinking !== undefined ? { thinking: config4.thinking } : {}
|
|
122825
123022
|
};
|
|
122826
123023
|
}
|
|
123024
|
+
|
|
123025
|
+
// src/tools/delegate-task/fallback-entry-resolution.ts
|
|
123026
|
+
function resolveEffectiveFallbackEntry(input) {
|
|
123027
|
+
const { categoryModel, configuredFallbackChain, resolution } = input;
|
|
123028
|
+
const resolutionSkipped = resolution && "skipped" in resolution;
|
|
123029
|
+
const resolvedFallbackEntry = resolution && !resolutionSkipped ? resolution.fallbackEntry : undefined;
|
|
123030
|
+
const matchedFallback = resolution && !resolutionSkipped ? resolution.matchedFallback === true : false;
|
|
123031
|
+
if (!matchedFallback || !categoryModel) {
|
|
123032
|
+
return;
|
|
123033
|
+
}
|
|
123034
|
+
return resolvedFallbackEntry ?? (configuredFallbackChain ? findMostSpecificFallbackEntry(categoryModel.providerID, categoryModel.modelID, configuredFallbackChain) : undefined);
|
|
123035
|
+
}
|
|
123036
|
+
|
|
123037
|
+
// src/tools/delegate-task/fallback-entry-settings.ts
|
|
123038
|
+
function applyFallbackEntrySettings(input) {
|
|
123039
|
+
const { categoryModel, effectiveEntry, variantOverride } = input;
|
|
123040
|
+
return {
|
|
123041
|
+
...categoryModel,
|
|
123042
|
+
variant: variantOverride ?? effectiveEntry.variant ?? categoryModel.variant,
|
|
123043
|
+
reasoningEffort: effectiveEntry.reasoningEffort ?? categoryModel.reasoningEffort,
|
|
123044
|
+
temperature: effectiveEntry.temperature ?? categoryModel.temperature,
|
|
123045
|
+
top_p: effectiveEntry.top_p ?? categoryModel.top_p,
|
|
123046
|
+
maxTokens: effectiveEntry.maxTokens ?? categoryModel.maxTokens,
|
|
123047
|
+
thinking: effectiveEntry.thinking ?? categoryModel.thinking
|
|
123048
|
+
};
|
|
123049
|
+
}
|
|
123050
|
+
|
|
123051
|
+
// src/tools/delegate-task/subagent-discovery.ts
|
|
123052
|
+
init_agent_display_names();
|
|
123053
|
+
// src/features/claude-code-agent-loader/loader.ts
|
|
123054
|
+
import { existsSync as existsSync82, readdirSync as readdirSync22, readFileSync as readFileSync55 } from "fs";
|
|
123055
|
+
import { join as join87, basename as basename13 } from "path";
|
|
123056
|
+
function parseToolsConfig2(toolsStr) {
|
|
123057
|
+
if (!toolsStr)
|
|
123058
|
+
return;
|
|
123059
|
+
const tools = toolsStr.split(",").map((t) => t.trim()).filter(Boolean);
|
|
123060
|
+
if (tools.length === 0)
|
|
123061
|
+
return;
|
|
123062
|
+
const result = {};
|
|
123063
|
+
for (const tool3 of tools) {
|
|
123064
|
+
result[tool3.toLowerCase()] = true;
|
|
123065
|
+
}
|
|
123066
|
+
return result;
|
|
123067
|
+
}
|
|
123068
|
+
function loadAgentsFromDir(agentsDir, scope) {
|
|
123069
|
+
if (!existsSync82(agentsDir)) {
|
|
123070
|
+
return [];
|
|
123071
|
+
}
|
|
123072
|
+
const entries = readdirSync22(agentsDir, { withFileTypes: true });
|
|
123073
|
+
const agents = [];
|
|
123074
|
+
for (const entry of entries) {
|
|
123075
|
+
if (!isMarkdownFile(entry))
|
|
123076
|
+
continue;
|
|
123077
|
+
const agentPath = join87(agentsDir, entry.name);
|
|
123078
|
+
const agentName = basename13(entry.name, ".md");
|
|
123079
|
+
try {
|
|
123080
|
+
const content = readFileSync55(agentPath, "utf-8");
|
|
123081
|
+
const { data, body } = parseFrontmatter(content);
|
|
123082
|
+
const name = data.name || agentName;
|
|
123083
|
+
const originalDescription = data.description || "";
|
|
123084
|
+
const formattedDescription = `(${scope}) ${originalDescription}`;
|
|
123085
|
+
const mappedModelOverride = mapClaudeModelToOpenCode(data.model);
|
|
123086
|
+
const modelString = mappedModelOverride ? `${mappedModelOverride.providerID}/${mappedModelOverride.modelID}` : undefined;
|
|
123087
|
+
const config4 = {
|
|
123088
|
+
description: formattedDescription,
|
|
123089
|
+
mode: data.mode || "subagent",
|
|
123090
|
+
prompt: body.trim(),
|
|
123091
|
+
...modelString ? { model: modelString } : {}
|
|
123092
|
+
};
|
|
123093
|
+
const toolsConfig = parseToolsConfig2(data.tools);
|
|
123094
|
+
if (toolsConfig) {
|
|
123095
|
+
config4.tools = toolsConfig;
|
|
123096
|
+
}
|
|
123097
|
+
agents.push({
|
|
123098
|
+
name,
|
|
123099
|
+
path: agentPath,
|
|
123100
|
+
config: config4,
|
|
123101
|
+
scope
|
|
123102
|
+
});
|
|
123103
|
+
} catch {
|
|
123104
|
+
continue;
|
|
123105
|
+
}
|
|
123106
|
+
}
|
|
123107
|
+
return agents;
|
|
123108
|
+
}
|
|
123109
|
+
function loadUserAgents() {
|
|
123110
|
+
const userAgentsDir = join87(getClaudeConfigDir(), "agents");
|
|
123111
|
+
const agents = loadAgentsFromDir(userAgentsDir, "user");
|
|
123112
|
+
const result = {};
|
|
123113
|
+
for (const agent of agents) {
|
|
123114
|
+
result[agent.name] = agent.config;
|
|
123115
|
+
}
|
|
123116
|
+
return result;
|
|
123117
|
+
}
|
|
123118
|
+
function loadProjectAgents(directory) {
|
|
123119
|
+
const projectAgentsDir = join87(directory ?? process.cwd(), ".claude", "agents");
|
|
123120
|
+
const agents = loadAgentsFromDir(projectAgentsDir, "project");
|
|
123121
|
+
const result = {};
|
|
123122
|
+
for (const agent of agents) {
|
|
123123
|
+
result[agent.name] = agent.config;
|
|
123124
|
+
}
|
|
123125
|
+
return result;
|
|
123126
|
+
}
|
|
123127
|
+
// src/tools/delegate-task/subagent-discovery.ts
|
|
123128
|
+
function sanitizeSubagentType(subagentType) {
|
|
123129
|
+
return subagentType.trim().replace(/^[\\\/"']+|[\\\/"']+$/g, "").trim();
|
|
123130
|
+
}
|
|
123131
|
+
function mergeWithClaudeCodeAgents(serverAgents, directory) {
|
|
123132
|
+
const userAgentsRecord = loadUserAgents();
|
|
123133
|
+
const projectAgentsRecord = loadProjectAgents(directory);
|
|
123134
|
+
const toAgentInfoList = (record3) => Object.entries(record3).map(([name, config4]) => ({
|
|
123135
|
+
name,
|
|
123136
|
+
mode: config4.mode,
|
|
123137
|
+
model: config4.model
|
|
123138
|
+
}));
|
|
123139
|
+
const mergedAgentMap = new Map;
|
|
123140
|
+
const addIfAbsent = (agent) => {
|
|
123141
|
+
const key = agent.name.toLowerCase();
|
|
123142
|
+
if (!mergedAgentMap.has(key)) {
|
|
123143
|
+
mergedAgentMap.set(key, agent);
|
|
123144
|
+
}
|
|
123145
|
+
};
|
|
123146
|
+
for (const agent of serverAgents)
|
|
123147
|
+
addIfAbsent(agent);
|
|
123148
|
+
for (const agent of toAgentInfoList(projectAgentsRecord))
|
|
123149
|
+
addIfAbsent(agent);
|
|
123150
|
+
for (const agent of toAgentInfoList(userAgentsRecord))
|
|
123151
|
+
addIfAbsent(agent);
|
|
123152
|
+
return Array.from(mergedAgentMap.values());
|
|
123153
|
+
}
|
|
123154
|
+
function buildComparableNames(agentName) {
|
|
123155
|
+
return new Set([
|
|
123156
|
+
agentName,
|
|
123157
|
+
getAgentDisplayName(agentName),
|
|
123158
|
+
getAgentConfigKey(agentName)
|
|
123159
|
+
].map((name) => stripAgentListSortPrefix(name).trim().toLowerCase()));
|
|
123160
|
+
}
|
|
123161
|
+
function matchesRequestedAgent(agent, requestedAgentName) {
|
|
123162
|
+
const comparableNames = buildComparableNames(requestedAgentName);
|
|
123163
|
+
const listedAgentName = stripAgentListSortPrefix(agent.name).trim().toLowerCase();
|
|
123164
|
+
const listedAgentConfigKey = getAgentConfigKey(agent.name).trim().toLowerCase();
|
|
123165
|
+
return comparableNames.has(listedAgentName) || comparableNames.has(listedAgentConfigKey);
|
|
123166
|
+
}
|
|
123167
|
+
function isTaskCallableAgentMode(mode) {
|
|
123168
|
+
return mode === "all" || mode === "subagent";
|
|
123169
|
+
}
|
|
123170
|
+
function findPrimaryAgentMatch(agents, requestedAgentName) {
|
|
123171
|
+
return agents.find((agent) => agent.mode === "primary" && matchesRequestedAgent(agent, requestedAgentName));
|
|
123172
|
+
}
|
|
123173
|
+
function findCallableAgentMatch(agents, requestedAgentName) {
|
|
123174
|
+
return agents.find((agent) => isTaskCallableAgentMode(agent.mode) && matchesRequestedAgent(agent, requestedAgentName));
|
|
123175
|
+
}
|
|
123176
|
+
function listCallableAgentNames(agents) {
|
|
123177
|
+
return agents.filter((agent) => isTaskCallableAgentMode(agent.mode)).map((agent) => stripAgentListSortPrefix(agent.name)).sort().join(", ");
|
|
123178
|
+
}
|
|
123179
|
+
|
|
123180
|
+
// src/tools/delegate-task/subagent-resolver.ts
|
|
123181
|
+
init_agent_display_names();
|
|
123182
|
+
init_logger();
|
|
122827
123183
|
async function resolveSubagentExecution(args, executorCtx, parentAgent, categoryExamples) {
|
|
122828
123184
|
const { client: client2, agentOverrides, userCategories } = executorCtx;
|
|
122829
123185
|
if (!args.subagent_type?.trim()) {
|
|
122830
123186
|
return { agentToUse: "", categoryModel: undefined, error: `Agent name cannot be empty.` };
|
|
122831
123187
|
}
|
|
122832
|
-
const agentName = args.subagent_type
|
|
123188
|
+
const agentName = sanitizeSubagentType(args.subagent_type);
|
|
122833
123189
|
if (agentName.toLowerCase() === SISYPHUS_JUNIOR_AGENT2.toLowerCase()) {
|
|
122834
123190
|
return {
|
|
122835
123191
|
agentToUse: "",
|
|
@@ -122856,19 +123212,21 @@ Create the work plan directly - that's your job as the planning agent.`
|
|
|
122856
123212
|
const agents = normalizeSDKResponse(agentsResult, [], {
|
|
122857
123213
|
preferResponseOnMissingData: true
|
|
122858
123214
|
});
|
|
122859
|
-
const
|
|
122860
|
-
const
|
|
122861
|
-
|
|
122862
|
-
|
|
122863
|
-
|
|
122864
|
-
|
|
122865
|
-
|
|
123215
|
+
const mergedAgents = mergeWithClaudeCodeAgents(agents, executorCtx.directory);
|
|
123216
|
+
const matchedPrimaryAgent = findPrimaryAgentMatch(mergedAgents, agentToUse);
|
|
123217
|
+
if (matchedPrimaryAgent) {
|
|
123218
|
+
return {
|
|
123219
|
+
agentToUse: "",
|
|
123220
|
+
categoryModel: undefined,
|
|
123221
|
+
error: `Cannot delegate to primary agent "${stripAgentListSortPrefix(matchedPrimaryAgent.name)}" via task. Select that agent directly instead.`
|
|
123222
|
+
};
|
|
123223
|
+
}
|
|
123224
|
+
const matchedAgent = findCallableAgentMatch(mergedAgents, agentToUse);
|
|
122866
123225
|
if (!matchedAgent) {
|
|
122867
|
-
const availableAgents = callableAgents.map((a) => stripAgentListSortPrefix(a.name)).sort().join(", ");
|
|
122868
123226
|
return {
|
|
122869
123227
|
agentToUse: "",
|
|
122870
123228
|
categoryModel: undefined,
|
|
122871
|
-
error: `Unknown agent: "${agentToUse}". Available agents: ${
|
|
123229
|
+
error: `Unknown agent: "${agentToUse}". Available agents: ${listCallableAgentNames(mergedAgents)}`
|
|
122872
123230
|
};
|
|
122873
123231
|
}
|
|
122874
123232
|
agentToUse = stripAgentListSortPrefix(matchedAgent.name);
|
|
@@ -122913,19 +123271,17 @@ Create the work plan directly - that's your job as the planning agent.`
|
|
|
122913
123271
|
const defaultProviderID = categoryModel?.providerID ?? normalizedMatchedModel?.providerID ?? "opencode";
|
|
122914
123272
|
const configuredFallbackChain = buildFallbackChainFromModels(normalizedAgentFallbackModels, defaultProviderID);
|
|
122915
123273
|
fallbackChain = configuredFallbackChain ?? (resolutionSkipped ? undefined : agentRequirement?.fallbackChain);
|
|
122916
|
-
const
|
|
122917
|
-
|
|
122918
|
-
|
|
123274
|
+
const effectiveEntry = resolveEffectiveFallbackEntry({
|
|
123275
|
+
categoryModel,
|
|
123276
|
+
configuredFallbackChain,
|
|
123277
|
+
resolution
|
|
123278
|
+
});
|
|
122919
123279
|
if (categoryModel && effectiveEntry) {
|
|
122920
|
-
categoryModel = {
|
|
122921
|
-
|
|
122922
|
-
|
|
122923
|
-
|
|
122924
|
-
|
|
122925
|
-
top_p: effectiveEntry.top_p ?? categoryModel.top_p,
|
|
122926
|
-
maxTokens: effectiveEntry.maxTokens ?? categoryModel.maxTokens,
|
|
122927
|
-
thinking: effectiveEntry.thinking ?? categoryModel.thinking
|
|
122928
|
-
};
|
|
123280
|
+
categoryModel = applyFallbackEntrySettings({
|
|
123281
|
+
categoryModel,
|
|
123282
|
+
effectiveEntry,
|
|
123283
|
+
variantOverride: agentOverride?.variant
|
|
123284
|
+
});
|
|
122929
123285
|
}
|
|
122930
123286
|
}
|
|
122931
123287
|
if (!categoryModel && matchedAgent.model) {
|
|
@@ -122957,9 +123313,6 @@ Create the work plan directly - that's your job as the planning agent.`
|
|
|
122957
123313
|
}
|
|
122958
123314
|
return { agentToUse, categoryModel, fallbackChain };
|
|
122959
123315
|
}
|
|
122960
|
-
function isTaskCallableAgentMode(mode) {
|
|
122961
|
-
return mode === "all" || mode === "subagent";
|
|
122962
|
-
}
|
|
122963
123316
|
// src/tools/delegate-task/tools.ts
|
|
122964
123317
|
function createDelegateTask(options) {
|
|
122965
123318
|
const { userCategories } = options;
|
|
@@ -123173,7 +123526,7 @@ function createDelegateTask(options) {
|
|
|
123173
123526
|
// src/tools/delegate-task/index.ts
|
|
123174
123527
|
init_constants();
|
|
123175
123528
|
// src/tools/task/task-create.ts
|
|
123176
|
-
import { join as
|
|
123529
|
+
import { join as join89 } from "path";
|
|
123177
123530
|
|
|
123178
123531
|
// src/tools/task/types.ts
|
|
123179
123532
|
var TaskStatusSchema = exports_external.enum(["pending", "in_progress", "completed", "deleted"]);
|
|
@@ -123227,18 +123580,18 @@ var TaskDeleteInputSchema = exports_external.object({
|
|
|
123227
123580
|
});
|
|
123228
123581
|
|
|
123229
123582
|
// src/features/claude-tasks/storage.ts
|
|
123230
|
-
import { join as
|
|
123231
|
-
import { existsSync as
|
|
123583
|
+
import { join as join88, dirname as dirname29, basename as basename14, isAbsolute as isAbsolute11 } from "path";
|
|
123584
|
+
import { existsSync as existsSync83, mkdirSync as mkdirSync17, readFileSync as readFileSync56, writeFileSync as writeFileSync21, renameSync as renameSync5, unlinkSync as unlinkSync13, readdirSync as readdirSync23 } from "fs";
|
|
123232
123585
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
123233
123586
|
function getTaskDir(config4 = {}) {
|
|
123234
123587
|
const tasksConfig = config4.sisyphus?.tasks;
|
|
123235
123588
|
const storagePath = tasksConfig?.storage_path;
|
|
123236
123589
|
if (storagePath) {
|
|
123237
|
-
return isAbsolute11(storagePath) ? storagePath :
|
|
123590
|
+
return isAbsolute11(storagePath) ? storagePath : join88(process.cwd(), storagePath);
|
|
123238
123591
|
}
|
|
123239
123592
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
123240
123593
|
const listId = resolveTaskListId(config4);
|
|
123241
|
-
return
|
|
123594
|
+
return join88(configDir, "tasks", listId);
|
|
123242
123595
|
}
|
|
123243
123596
|
function sanitizePathSegment(value) {
|
|
123244
123597
|
return value.replace(/[^a-zA-Z0-9_-]/g, "-") || "default";
|
|
@@ -123253,19 +123606,19 @@ function resolveTaskListId(config4 = {}) {
|
|
|
123253
123606
|
const configId = config4.sisyphus?.tasks?.task_list_id?.trim();
|
|
123254
123607
|
if (configId)
|
|
123255
123608
|
return sanitizePathSegment(configId);
|
|
123256
|
-
return sanitizePathSegment(
|
|
123609
|
+
return sanitizePathSegment(basename14(process.cwd()));
|
|
123257
123610
|
}
|
|
123258
123611
|
function ensureDir(dirPath) {
|
|
123259
|
-
if (!
|
|
123612
|
+
if (!existsSync83(dirPath)) {
|
|
123260
123613
|
mkdirSync17(dirPath, { recursive: true });
|
|
123261
123614
|
}
|
|
123262
123615
|
}
|
|
123263
123616
|
function readJsonSafe(filePath, schema2) {
|
|
123264
123617
|
try {
|
|
123265
|
-
if (!
|
|
123618
|
+
if (!existsSync83(filePath)) {
|
|
123266
123619
|
return null;
|
|
123267
123620
|
}
|
|
123268
|
-
const content =
|
|
123621
|
+
const content = readFileSync56(filePath, "utf-8");
|
|
123269
123622
|
const parsed = JSON.parse(content);
|
|
123270
123623
|
const result = schema2.safeParse(parsed);
|
|
123271
123624
|
if (!result.success) {
|
|
@@ -123285,8 +123638,8 @@ function writeJsonAtomic(filePath, data) {
|
|
|
123285
123638
|
renameSync5(tempPath, filePath);
|
|
123286
123639
|
} catch (error92) {
|
|
123287
123640
|
try {
|
|
123288
|
-
if (
|
|
123289
|
-
|
|
123641
|
+
if (existsSync83(tempPath)) {
|
|
123642
|
+
unlinkSync13(tempPath);
|
|
123290
123643
|
}
|
|
123291
123644
|
} catch {}
|
|
123292
123645
|
throw error92;
|
|
@@ -123297,7 +123650,7 @@ function generateTaskId() {
|
|
|
123297
123650
|
return `T-${randomUUID3()}`;
|
|
123298
123651
|
}
|
|
123299
123652
|
function acquireLock(dirPath) {
|
|
123300
|
-
const lockPath =
|
|
123653
|
+
const lockPath = join88(dirPath, ".lock");
|
|
123301
123654
|
const lockId = randomUUID3();
|
|
123302
123655
|
const createLock = (timestamp2) => {
|
|
123303
123656
|
writeFileSync21(lockPath, JSON.stringify({ id: lockId, timestamp: timestamp2 }), {
|
|
@@ -123307,7 +123660,7 @@ function acquireLock(dirPath) {
|
|
|
123307
123660
|
};
|
|
123308
123661
|
const isStale = () => {
|
|
123309
123662
|
try {
|
|
123310
|
-
const lockContent =
|
|
123663
|
+
const lockContent = readFileSync56(lockPath, "utf-8");
|
|
123311
123664
|
const lockData = JSON.parse(lockContent);
|
|
123312
123665
|
const lockAge = Date.now() - lockData.timestamp;
|
|
123313
123666
|
return lockAge > STALE_LOCK_THRESHOLD_MS;
|
|
@@ -123331,7 +123684,7 @@ function acquireLock(dirPath) {
|
|
|
123331
123684
|
let acquired = tryAcquire();
|
|
123332
123685
|
if (!acquired && isStale()) {
|
|
123333
123686
|
try {
|
|
123334
|
-
|
|
123687
|
+
unlinkSync13(lockPath);
|
|
123335
123688
|
} catch {}
|
|
123336
123689
|
acquired = tryAcquire();
|
|
123337
123690
|
}
|
|
@@ -123345,13 +123698,13 @@ function acquireLock(dirPath) {
|
|
|
123345
123698
|
acquired: true,
|
|
123346
123699
|
release: () => {
|
|
123347
123700
|
try {
|
|
123348
|
-
if (!
|
|
123701
|
+
if (!existsSync83(lockPath))
|
|
123349
123702
|
return;
|
|
123350
|
-
const lockContent =
|
|
123703
|
+
const lockContent = readFileSync56(lockPath, "utf-8");
|
|
123351
123704
|
const lockData = JSON.parse(lockContent);
|
|
123352
123705
|
if (lockData.id !== lockId)
|
|
123353
123706
|
return;
|
|
123354
|
-
|
|
123707
|
+
unlinkSync13(lockPath);
|
|
123355
123708
|
} catch {}
|
|
123356
123709
|
}
|
|
123357
123710
|
};
|
|
@@ -123402,8 +123755,8 @@ function syncTaskToTodo(task) {
|
|
|
123402
123755
|
}
|
|
123403
123756
|
async function resolveTodoWriter2() {
|
|
123404
123757
|
try {
|
|
123405
|
-
const
|
|
123406
|
-
const mod = await import(
|
|
123758
|
+
const loader5 = "opencode/session/todo";
|
|
123759
|
+
const mod = await import(loader5);
|
|
123407
123760
|
const update = mod.Todo?.update;
|
|
123408
123761
|
if (typeof update === "function") {
|
|
123409
123762
|
return update;
|
|
@@ -123510,7 +123863,7 @@ async function handleCreate(args, config4, ctx, context) {
|
|
|
123510
123863
|
threadID: context.sessionID
|
|
123511
123864
|
};
|
|
123512
123865
|
const validatedTask = TaskObjectSchema.parse(task);
|
|
123513
|
-
writeJsonAtomic(
|
|
123866
|
+
writeJsonAtomic(join89(taskDir, `${taskId}.json`), validatedTask);
|
|
123514
123867
|
await syncTaskTodoUpdate(ctx, validatedTask, context.sessionID);
|
|
123515
123868
|
return JSON.stringify({
|
|
123516
123869
|
task: {
|
|
@@ -123532,7 +123885,7 @@ async function handleCreate(args, config4, ctx, context) {
|
|
|
123532
123885
|
}
|
|
123533
123886
|
}
|
|
123534
123887
|
// src/tools/task/task-get.ts
|
|
123535
|
-
import { join as
|
|
123888
|
+
import { join as join90 } from "path";
|
|
123536
123889
|
var TASK_ID_PATTERN = /^T-[A-Za-z0-9-]+$/;
|
|
123537
123890
|
function parseTaskId(id) {
|
|
123538
123891
|
if (!TASK_ID_PATTERN.test(id))
|
|
@@ -123557,7 +123910,7 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
123557
123910
|
return JSON.stringify({ error: "invalid_task_id" });
|
|
123558
123911
|
}
|
|
123559
123912
|
const taskDir = getTaskDir(config4);
|
|
123560
|
-
const taskPath =
|
|
123913
|
+
const taskPath = join90(taskDir, `${taskId}.json`);
|
|
123561
123914
|
const task = readJsonSafe(taskPath, TaskObjectSchema);
|
|
123562
123915
|
return JSON.stringify({ task: task ?? null });
|
|
123563
123916
|
} catch (error92) {
|
|
@@ -123570,8 +123923,8 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
123570
123923
|
});
|
|
123571
123924
|
}
|
|
123572
123925
|
// src/tools/task/task-list.ts
|
|
123573
|
-
import { join as
|
|
123574
|
-
import { existsSync as
|
|
123926
|
+
import { join as join91 } from "path";
|
|
123927
|
+
import { existsSync as existsSync84, readdirSync as readdirSync24 } from "fs";
|
|
123575
123928
|
function createTaskList(config4) {
|
|
123576
123929
|
return tool({
|
|
123577
123930
|
description: `List all active tasks with summary information.
|
|
@@ -123582,16 +123935,16 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
123582
123935
|
args: {},
|
|
123583
123936
|
execute: async () => {
|
|
123584
123937
|
const taskDir = getTaskDir(config4);
|
|
123585
|
-
if (!
|
|
123938
|
+
if (!existsSync84(taskDir)) {
|
|
123586
123939
|
return JSON.stringify({ tasks: [] });
|
|
123587
123940
|
}
|
|
123588
|
-
const files =
|
|
123941
|
+
const files = readdirSync24(taskDir).filter((f) => f.endsWith(".json") && f.startsWith("T-")).map((f) => f.replace(".json", ""));
|
|
123589
123942
|
if (files.length === 0) {
|
|
123590
123943
|
return JSON.stringify({ tasks: [] });
|
|
123591
123944
|
}
|
|
123592
123945
|
const allTasks = [];
|
|
123593
123946
|
for (const fileId of files) {
|
|
123594
|
-
const task = readJsonSafe(
|
|
123947
|
+
const task = readJsonSafe(join91(taskDir, `${fileId}.json`), TaskObjectSchema);
|
|
123595
123948
|
if (task) {
|
|
123596
123949
|
allTasks.push(task);
|
|
123597
123950
|
}
|
|
@@ -123619,7 +123972,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
123619
123972
|
});
|
|
123620
123973
|
}
|
|
123621
123974
|
// src/tools/task/task-update.ts
|
|
123622
|
-
import { join as
|
|
123975
|
+
import { join as join92 } from "path";
|
|
123623
123976
|
var TASK_ID_PATTERN2 = /^T-[A-Za-z0-9-]+$/;
|
|
123624
123977
|
function parseTaskId2(id) {
|
|
123625
123978
|
if (!TASK_ID_PATTERN2.test(id))
|
|
@@ -123667,7 +124020,7 @@ async function handleUpdate(args, config4, ctx, context) {
|
|
|
123667
124020
|
return JSON.stringify({ error: "task_lock_unavailable" });
|
|
123668
124021
|
}
|
|
123669
124022
|
try {
|
|
123670
|
-
const taskPath =
|
|
124023
|
+
const taskPath = join92(taskDir, `${taskId}.json`);
|
|
123671
124024
|
const task = readJsonSafe(taskPath, TaskObjectSchema);
|
|
123672
124025
|
if (!task) {
|
|
123673
124026
|
return JSON.stringify({ error: "task_not_found" });
|
|
@@ -126413,8 +126766,8 @@ function unregisterManagerForCleanup(manager) {
|
|
|
126413
126766
|
}
|
|
126414
126767
|
|
|
126415
126768
|
// src/features/background-agent/compaction-aware-message-resolver.ts
|
|
126416
|
-
import { readdirSync as
|
|
126417
|
-
import { join as
|
|
126769
|
+
import { readdirSync as readdirSync25, readFileSync as readFileSync57 } from "fs";
|
|
126770
|
+
import { join as join93 } from "path";
|
|
126418
126771
|
function hasFullAgentAndModel(message) {
|
|
126419
126772
|
return !!message.agent && !isCompactionAgent(message.agent) && !!message.model?.providerID && !!message.model?.modelID;
|
|
126420
126773
|
}
|
|
@@ -126489,11 +126842,11 @@ function resolvePromptContextFromSessionMessages(messages, sessionID) {
|
|
|
126489
126842
|
}
|
|
126490
126843
|
function findNearestMessageExcludingCompaction(messageDir, sessionID) {
|
|
126491
126844
|
try {
|
|
126492
|
-
const files =
|
|
126845
|
+
const files = readdirSync25(messageDir).filter((name) => name.endsWith(".json")).sort().reverse();
|
|
126493
126846
|
const messages = [];
|
|
126494
126847
|
for (const file3 of files) {
|
|
126495
126848
|
try {
|
|
126496
|
-
const content =
|
|
126849
|
+
const content = readFileSync57(join93(messageDir, file3), "utf-8");
|
|
126497
126850
|
const parsed = JSON.parse(content);
|
|
126498
126851
|
if (hasCompactionPartInStorage(parsed.id) || isCompactionAgent(parsed.agent)) {
|
|
126499
126852
|
continue;
|
|
@@ -126583,7 +126936,7 @@ function handleSessionIdleBackgroundEvent(args) {
|
|
|
126583
126936
|
}
|
|
126584
126937
|
|
|
126585
126938
|
// src/features/background-agent/manager.ts
|
|
126586
|
-
import { join as
|
|
126939
|
+
import { join as join94 } from "path";
|
|
126587
126940
|
|
|
126588
126941
|
// src/features/background-agent/task-poller.ts
|
|
126589
126942
|
init_plugin_identity();
|
|
@@ -126623,9 +126976,12 @@ function isSessionNotFoundError(error92) {
|
|
|
126623
126976
|
}
|
|
126624
126977
|
return message.includes("not found") || message.includes("missing");
|
|
126625
126978
|
}
|
|
126626
|
-
async function verifySessionExists(client2, sessionID) {
|
|
126979
|
+
async function verifySessionExists(client2, sessionID, directory) {
|
|
126627
126980
|
try {
|
|
126628
|
-
const response = await client2.session.get({
|
|
126981
|
+
const response = await client2.session.get({
|
|
126982
|
+
path: { id: sessionID },
|
|
126983
|
+
...directory ? { query: { directory } } : {}
|
|
126984
|
+
});
|
|
126629
126985
|
if (response.error !== undefined && response.error !== null) {
|
|
126630
126986
|
return !isSessionNotFoundError(response.error);
|
|
126631
126987
|
}
|
|
@@ -126715,6 +127071,7 @@ async function checkAndInterruptStaleTasks(args) {
|
|
|
126715
127071
|
const {
|
|
126716
127072
|
tasks,
|
|
126717
127073
|
client: client2,
|
|
127074
|
+
directory,
|
|
126718
127075
|
config: config4,
|
|
126719
127076
|
concurrencyManager,
|
|
126720
127077
|
notifyParentSession,
|
|
@@ -126751,7 +127108,7 @@ async function checkAndInterruptStaleTasks(args) {
|
|
|
126751
127108
|
const effectiveTimeout = sessionGone ? sessionGoneTimeoutMs : messageStalenessMs;
|
|
126752
127109
|
if (runtime <= effectiveTimeout)
|
|
126753
127110
|
continue;
|
|
126754
|
-
if (sessionGone && await verifySessionExists(client2, sessionID)) {
|
|
127111
|
+
if (sessionGone && await verifySessionExists(client2, sessionID, directory)) {
|
|
126755
127112
|
task.consecutiveMissedPolls = 0;
|
|
126756
127113
|
continue;
|
|
126757
127114
|
}
|
|
@@ -126784,7 +127141,7 @@ async function checkAndInterruptStaleTasks(args) {
|
|
|
126784
127141
|
continue;
|
|
126785
127142
|
if (task.status !== "running")
|
|
126786
127143
|
continue;
|
|
126787
|
-
if (sessionGone && await verifySessionExists(client2, sessionID)) {
|
|
127144
|
+
if (sessionGone && await verifySessionExists(client2, sessionID, directory)) {
|
|
126788
127145
|
task.consecutiveMissedPolls = 0;
|
|
126789
127146
|
continue;
|
|
126790
127147
|
}
|
|
@@ -126820,7 +127177,7 @@ function resolveCircuitBreakerSettings(config4) {
|
|
|
126820
127177
|
};
|
|
126821
127178
|
}
|
|
126822
127179
|
function recordToolCall(window, toolName, settings, toolInput) {
|
|
126823
|
-
if (toolInput
|
|
127180
|
+
if (toolInput == null) {
|
|
126824
127181
|
return {
|
|
126825
127182
|
lastSignature: `${toolName}::__unknown-input__`,
|
|
126826
127183
|
consecutiveCount: 1,
|
|
@@ -126842,7 +127199,7 @@ function recordToolCall(window, toolName, settings, toolInput) {
|
|
|
126842
127199
|
};
|
|
126843
127200
|
}
|
|
126844
127201
|
function sortObject2(obj) {
|
|
126845
|
-
if (obj
|
|
127202
|
+
if (obj == null)
|
|
126846
127203
|
return obj;
|
|
126847
127204
|
if (typeof obj !== "object")
|
|
126848
127205
|
return obj;
|
|
@@ -126856,7 +127213,7 @@ function sortObject2(obj) {
|
|
|
126856
127213
|
return sorted;
|
|
126857
127214
|
}
|
|
126858
127215
|
function createToolCallSignature(toolName, toolInput) {
|
|
126859
|
-
if (toolInput
|
|
127216
|
+
if (toolInput == null) {
|
|
126860
127217
|
return toolName;
|
|
126861
127218
|
}
|
|
126862
127219
|
if (Object.keys(toolInput).length === 0) {
|
|
@@ -126884,7 +127241,7 @@ function getMaxSubagentDepth(config4) {
|
|
|
126884
127241
|
function getMaxRootSessionSpawnBudget(config4) {
|
|
126885
127242
|
return config4?.maxDescendants ?? DEFAULT_MAX_ROOT_SESSION_SPAWN_BUDGET;
|
|
126886
127243
|
}
|
|
126887
|
-
async function resolveSubagentSpawnContext(client2, parentSessionID) {
|
|
127244
|
+
async function resolveSubagentSpawnContext(client2, parentSessionID, directory) {
|
|
126888
127245
|
const visitedSessionIDs = new Set;
|
|
126889
127246
|
let rootSessionID = parentSessionID;
|
|
126890
127247
|
let currentSessionID = parentSessionID;
|
|
@@ -126897,7 +127254,8 @@ async function resolveSubagentSpawnContext(client2, parentSessionID) {
|
|
|
126897
127254
|
let nextParentSessionID;
|
|
126898
127255
|
try {
|
|
126899
127256
|
const response = await client2.session.get({
|
|
126900
|
-
path: { id: currentSessionID }
|
|
127257
|
+
path: { id: currentSessionID },
|
|
127258
|
+
...directory ? { query: { directory } } : {}
|
|
126901
127259
|
});
|
|
126902
127260
|
if (response.error) {
|
|
126903
127261
|
throw new Error(String(response.error));
|
|
@@ -127001,7 +127359,7 @@ class BackgroundManager {
|
|
|
127001
127359
|
}
|
|
127002
127360
|
}
|
|
127003
127361
|
async assertCanSpawn(parentSessionID) {
|
|
127004
|
-
const spawnContext = await resolveSubagentSpawnContext(this.client, parentSessionID);
|
|
127362
|
+
const spawnContext = await resolveSubagentSpawnContext(this.client, parentSessionID, this.directory);
|
|
127005
127363
|
const maxDepth = getMaxSubagentDepth(this.config);
|
|
127006
127364
|
if (spawnContext.childDepth > maxDepth) {
|
|
127007
127365
|
throw createSubagentDepthLimitError({
|
|
@@ -127193,7 +127551,8 @@ class BackgroundManager {
|
|
|
127193
127551
|
});
|
|
127194
127552
|
const concurrencyKey = this.getConcurrencyKeyFromInput(input);
|
|
127195
127553
|
const parentSession = await this.client.session.get({
|
|
127196
|
-
path: { id: input.parentSessionID }
|
|
127554
|
+
path: { id: input.parentSessionID },
|
|
127555
|
+
query: { directory: this.directory }
|
|
127197
127556
|
}).catch((err) => {
|
|
127198
127557
|
log(`[background-agent] Failed to get parent session: ${err}`);
|
|
127199
127558
|
return null;
|
|
@@ -127682,7 +128041,8 @@ class BackgroundManager {
|
|
|
127682
128041
|
}
|
|
127683
128042
|
task.progress.toolCalls += 1;
|
|
127684
128043
|
task.progress.lastTool = partInfo.tool;
|
|
127685
|
-
const circuitBreaker = this.cachedCircuitBreakerSettings ??
|
|
128044
|
+
const circuitBreaker = this.cachedCircuitBreakerSettings ?? resolveCircuitBreakerSettings(this.config);
|
|
128045
|
+
this.cachedCircuitBreakerSettings = circuitBreaker;
|
|
127686
128046
|
if (partInfo.tool) {
|
|
127687
128047
|
task.progress.toolCallWindow = recordToolCall(task.progress.toolCallWindow, partInfo.tool, circuitBreaker, partInfo.state?.input);
|
|
127688
128048
|
if (circuitBreaker.enabled) {
|
|
@@ -128252,7 +128612,7 @@ ${originalText}`;
|
|
|
128252
128612
|
parentSessionID: task.parentSessionID
|
|
128253
128613
|
});
|
|
128254
128614
|
}
|
|
128255
|
-
const messageDir =
|
|
128615
|
+
const messageDir = join94(MESSAGE_STORAGE, task.parentSessionID);
|
|
128256
128616
|
const currentMessage = messageDir ? findNearestMessageExcludingCompaction(messageDir, task.parentSessionID) : null;
|
|
128257
128617
|
agent = currentMessage?.agent ?? task.parentAgent;
|
|
128258
128618
|
model = currentMessage?.model?.providerID && currentMessage?.model?.modelID ? { providerID: currentMessage.model.providerID, modelID: currentMessage.model.modelID } : undefined;
|
|
@@ -128368,6 +128728,7 @@ ${originalText}`;
|
|
|
128368
128728
|
await checkAndInterruptStaleTasks({
|
|
128369
128729
|
tasks: this.tasks.values(),
|
|
128370
128730
|
client: this.client,
|
|
128731
|
+
directory: this.directory,
|
|
128371
128732
|
config: this.config,
|
|
128372
128733
|
concurrencyManager: this.concurrencyManager,
|
|
128373
128734
|
notifyParentSession: (task) => this.enqueueNotificationForParent(task.parentSessionID, () => this.notifyParentSession(task)),
|
|
@@ -128375,7 +128736,7 @@ ${originalText}`;
|
|
|
128375
128736
|
});
|
|
128376
128737
|
}
|
|
128377
128738
|
async verifySessionExists(sessionID) {
|
|
128378
|
-
return verifySessionExists(this.client, sessionID);
|
|
128739
|
+
return verifySessionExists(this.client, sessionID, this.directory);
|
|
128379
128740
|
}
|
|
128380
128741
|
async failCrashedTask(task, errorMessage) {
|
|
128381
128742
|
task.status = "error";
|
|
@@ -128582,11 +128943,11 @@ ${originalText}`;
|
|
|
128582
128943
|
}
|
|
128583
128944
|
}
|
|
128584
128945
|
// src/features/mcp-oauth/storage.ts
|
|
128585
|
-
import { chmodSync as chmodSync2, existsSync as
|
|
128586
|
-
import { dirname as dirname30, join as
|
|
128946
|
+
import { chmodSync as chmodSync2, existsSync as existsSync85, mkdirSync as mkdirSync18, readFileSync as readFileSync58, renameSync as renameSync6, unlinkSync as unlinkSync14, writeFileSync as writeFileSync22 } from "fs";
|
|
128947
|
+
import { dirname as dirname30, join as join95 } from "path";
|
|
128587
128948
|
var STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
128588
128949
|
function getMcpOauthStoragePath() {
|
|
128589
|
-
return
|
|
128950
|
+
return join95(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
|
|
128590
128951
|
}
|
|
128591
128952
|
function normalizeHost(serverHost) {
|
|
128592
128953
|
let host = serverHost.trim();
|
|
@@ -128623,11 +128984,11 @@ function buildKey(serverHost, resource) {
|
|
|
128623
128984
|
}
|
|
128624
128985
|
function readStore() {
|
|
128625
128986
|
const filePath = getMcpOauthStoragePath();
|
|
128626
|
-
if (!
|
|
128987
|
+
if (!existsSync85(filePath)) {
|
|
128627
128988
|
return null;
|
|
128628
128989
|
}
|
|
128629
128990
|
try {
|
|
128630
|
-
const content =
|
|
128991
|
+
const content = readFileSync58(filePath, "utf-8");
|
|
128631
128992
|
return JSON.parse(content);
|
|
128632
128993
|
} catch {
|
|
128633
128994
|
return null;
|
|
@@ -128637,7 +128998,7 @@ function writeStore(store2) {
|
|
|
128637
128998
|
const filePath = getMcpOauthStoragePath();
|
|
128638
128999
|
try {
|
|
128639
129000
|
const dir = dirname30(filePath);
|
|
128640
|
-
if (!
|
|
129001
|
+
if (!existsSync85(dir)) {
|
|
128641
129002
|
mkdirSync18(dir, { recursive: true });
|
|
128642
129003
|
}
|
|
128643
129004
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
@@ -135273,7 +135634,22 @@ class TmuxSessionManager {
|
|
|
135273
135634
|
var SESSION_TIMEOUT_MS3 = 10 * 60 * 1000;
|
|
135274
135635
|
var MIN_STABILITY_TIME_MS4 = 10 * 1000;
|
|
135275
135636
|
// src/openclaw/index.ts
|
|
135276
|
-
import { basename as
|
|
135637
|
+
import { basename as basename15 } from "path";
|
|
135638
|
+
|
|
135639
|
+
// src/openclaw/gateway-url-validation.ts
|
|
135640
|
+
function validateGatewayUrl(url3) {
|
|
135641
|
+
try {
|
|
135642
|
+
const parsed = new URL(url3);
|
|
135643
|
+
if (parsed.protocol === "https:")
|
|
135644
|
+
return true;
|
|
135645
|
+
if (parsed.protocol === "http:" && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1" || parsed.hostname === "::1" || parsed.hostname === "[::1]")) {
|
|
135646
|
+
return true;
|
|
135647
|
+
}
|
|
135648
|
+
return false;
|
|
135649
|
+
} catch {
|
|
135650
|
+
return false;
|
|
135651
|
+
}
|
|
135652
|
+
}
|
|
135277
135653
|
|
|
135278
135654
|
// src/openclaw/config.ts
|
|
135279
135655
|
var DEFAULT_REPLY_POLL_INTERVAL_MS = 3000;
|
|
@@ -135342,19 +135718,6 @@ var DEFAULT_HTTP_TIMEOUT_MS = 1e4;
|
|
|
135342
135718
|
var DEFAULT_COMMAND_TIMEOUT_MS = 5000;
|
|
135343
135719
|
var MIN_COMMAND_TIMEOUT_MS = 100;
|
|
135344
135720
|
var MAX_COMMAND_TIMEOUT_MS = 300000;
|
|
135345
|
-
function validateGatewayUrl(url3) {
|
|
135346
|
-
try {
|
|
135347
|
-
const parsed = new URL(url3);
|
|
135348
|
-
if (parsed.protocol === "https:")
|
|
135349
|
-
return true;
|
|
135350
|
-
if (parsed.protocol === "http:" && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1" || parsed.hostname === "::1" || parsed.hostname === "[::1]")) {
|
|
135351
|
-
return true;
|
|
135352
|
-
}
|
|
135353
|
-
return false;
|
|
135354
|
-
} catch {
|
|
135355
|
-
return false;
|
|
135356
|
-
}
|
|
135357
|
-
}
|
|
135358
135721
|
function interpolateInstruction(template, variables) {
|
|
135359
135722
|
return template.replace(/\{\{(\w+)\}\}/g, (_match, key) => {
|
|
135360
135723
|
return variables[key] ?? "";
|
|
@@ -135572,26 +135935,26 @@ async function isTmuxAvailable() {
|
|
|
135572
135935
|
}
|
|
135573
135936
|
|
|
135574
135937
|
// src/openclaw/reply-listener.ts
|
|
135575
|
-
import { dirname as dirname32, join as
|
|
135938
|
+
import { dirname as dirname32, join as join98 } from "path";
|
|
135576
135939
|
|
|
135577
135940
|
// src/openclaw/session-registry.ts
|
|
135578
135941
|
import {
|
|
135579
|
-
existsSync as
|
|
135942
|
+
existsSync as existsSync86,
|
|
135580
135943
|
mkdirSync as mkdirSync19,
|
|
135581
|
-
readFileSync as
|
|
135944
|
+
readFileSync as readFileSync59,
|
|
135582
135945
|
writeFileSync as writeFileSync23,
|
|
135583
135946
|
openSync as openSync3,
|
|
135584
135947
|
closeSync as closeSync3,
|
|
135585
135948
|
writeSync,
|
|
135586
|
-
unlinkSync as
|
|
135949
|
+
unlinkSync as unlinkSync15,
|
|
135587
135950
|
statSync as statSync11,
|
|
135588
135951
|
constants as constants20
|
|
135589
135952
|
} from "fs";
|
|
135590
|
-
import { join as
|
|
135953
|
+
import { join as join96, dirname as dirname31 } from "path";
|
|
135591
135954
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
135592
|
-
var OPENCLAW_STORAGE_DIR =
|
|
135593
|
-
var REGISTRY_PATH =
|
|
135594
|
-
var REGISTRY_LOCK_PATH =
|
|
135955
|
+
var OPENCLAW_STORAGE_DIR = join96(getOpenCodeStorageDir(), "openclaw");
|
|
135956
|
+
var REGISTRY_PATH = join96(OPENCLAW_STORAGE_DIR, "reply-session-registry.jsonl");
|
|
135957
|
+
var REGISTRY_LOCK_PATH = join96(OPENCLAW_STORAGE_DIR, "reply-session-registry.lock");
|
|
135595
135958
|
var SECURE_FILE_MODE = 384;
|
|
135596
135959
|
var MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
135597
135960
|
var LOCK_TIMEOUT_MS = 2000;
|
|
@@ -135600,7 +135963,7 @@ var LOCK_RETRY_MS = 20;
|
|
|
135600
135963
|
var LOCK_STALE_MS = 1e4;
|
|
135601
135964
|
function ensureRegistryDir() {
|
|
135602
135965
|
const registryDir = dirname31(REGISTRY_PATH);
|
|
135603
|
-
if (!
|
|
135966
|
+
if (!existsSync86(registryDir)) {
|
|
135604
135967
|
mkdirSync19(registryDir, { recursive: true, mode: 448 });
|
|
135605
135968
|
}
|
|
135606
135969
|
}
|
|
@@ -135619,9 +135982,9 @@ function isPidAlive(pid) {
|
|
|
135619
135982
|
}
|
|
135620
135983
|
function readLockSnapshot() {
|
|
135621
135984
|
try {
|
|
135622
|
-
if (!
|
|
135985
|
+
if (!existsSync86(REGISTRY_LOCK_PATH))
|
|
135623
135986
|
return null;
|
|
135624
|
-
const raw =
|
|
135987
|
+
const raw = readFileSync59(REGISTRY_LOCK_PATH, "utf-8");
|
|
135625
135988
|
const trimmed = raw.trim();
|
|
135626
135989
|
if (!trimmed)
|
|
135627
135990
|
return { raw, pid: null, token: null };
|
|
@@ -135645,12 +136008,12 @@ function readLockSnapshot() {
|
|
|
135645
136008
|
}
|
|
135646
136009
|
function removeLockIfUnchanged(snapshot) {
|
|
135647
136010
|
try {
|
|
135648
|
-
if (!
|
|
136011
|
+
if (!existsSync86(REGISTRY_LOCK_PATH))
|
|
135649
136012
|
return false;
|
|
135650
|
-
const currentRaw =
|
|
136013
|
+
const currentRaw = readFileSync59(REGISTRY_LOCK_PATH, "utf-8");
|
|
135651
136014
|
if (currentRaw !== snapshot.raw)
|
|
135652
136015
|
return false;
|
|
135653
|
-
|
|
136016
|
+
unlinkSync15(REGISTRY_LOCK_PATH);
|
|
135654
136017
|
return true;
|
|
135655
136018
|
} catch {
|
|
135656
136019
|
return false;
|
|
@@ -135675,7 +136038,7 @@ function acquireRegistryLock() {
|
|
|
135675
136038
|
closeSync3(fd);
|
|
135676
136039
|
} catch {}
|
|
135677
136040
|
try {
|
|
135678
|
-
|
|
136041
|
+
unlinkSync15(REGISTRY_LOCK_PATH);
|
|
135679
136042
|
} catch {}
|
|
135680
136043
|
throw writeError;
|
|
135681
136044
|
}
|
|
@@ -135751,10 +136114,10 @@ function withRegistryLock(onLocked, onLockUnavailable) {
|
|
|
135751
136114
|
}
|
|
135752
136115
|
}
|
|
135753
136116
|
function readAllMappingsUnsafe() {
|
|
135754
|
-
if (!
|
|
136117
|
+
if (!existsSync86(REGISTRY_PATH))
|
|
135755
136118
|
return [];
|
|
135756
136119
|
try {
|
|
135757
|
-
const content =
|
|
136120
|
+
const content = readFileSync59(REGISTRY_PATH, "utf-8");
|
|
135758
136121
|
return content.split(`
|
|
135759
136122
|
`).filter((line) => line.trim()).map((line) => {
|
|
135760
136123
|
try {
|
|
@@ -135809,39 +136172,39 @@ function removeSession(sessionId) {
|
|
|
135809
136172
|
import {
|
|
135810
136173
|
appendFileSync as appendFileSync6,
|
|
135811
136174
|
chmodSync as chmodSync3,
|
|
135812
|
-
existsSync as
|
|
136175
|
+
existsSync as existsSync88,
|
|
135813
136176
|
renameSync as renameSync7,
|
|
135814
136177
|
statSync as statSync12,
|
|
135815
|
-
unlinkSync as
|
|
136178
|
+
unlinkSync as unlinkSync16,
|
|
135816
136179
|
writeFileSync as writeFileSync24
|
|
135817
136180
|
} from "fs";
|
|
135818
136181
|
|
|
135819
136182
|
// src/openclaw/reply-listener-paths.ts
|
|
135820
|
-
import { existsSync as
|
|
136183
|
+
import { existsSync as existsSync87, mkdirSync as mkdirSync20 } from "fs";
|
|
135821
136184
|
import { homedir as homedir16 } from "os";
|
|
135822
|
-
import { join as
|
|
136185
|
+
import { join as join97 } from "path";
|
|
135823
136186
|
var REPLY_LISTENER_SECURE_FILE_MODE = 384;
|
|
135824
136187
|
function resolveReplyListenerHomeDir() {
|
|
135825
136188
|
return process.env.HOME ?? process.env.USERPROFILE ?? homedir16();
|
|
135826
136189
|
}
|
|
135827
136190
|
function getReplyListenerStateDir() {
|
|
135828
|
-
return
|
|
136191
|
+
return join97(resolveReplyListenerHomeDir(), ".omx", "state");
|
|
135829
136192
|
}
|
|
135830
136193
|
function getReplyListenerPidFilePath() {
|
|
135831
|
-
return
|
|
136194
|
+
return join97(getReplyListenerStateDir(), "reply-listener.pid");
|
|
135832
136195
|
}
|
|
135833
136196
|
function getReplyListenerStateFilePath() {
|
|
135834
|
-
return
|
|
136197
|
+
return join97(getReplyListenerStateDir(), "reply-listener-state.json");
|
|
135835
136198
|
}
|
|
135836
136199
|
function getReplyListenerConfigFilePath() {
|
|
135837
|
-
return
|
|
136200
|
+
return join97(getReplyListenerStateDir(), "reply-listener-config.json");
|
|
135838
136201
|
}
|
|
135839
136202
|
function getReplyListenerLogFilePath() {
|
|
135840
|
-
return
|
|
136203
|
+
return join97(getReplyListenerStateDir(), "reply-listener.log");
|
|
135841
136204
|
}
|
|
135842
136205
|
function ensureReplyListenerStateDir() {
|
|
135843
136206
|
const stateDir = getReplyListenerStateDir();
|
|
135844
|
-
if (!
|
|
136207
|
+
if (!existsSync87(stateDir)) {
|
|
135845
136208
|
mkdirSync20(stateDir, { recursive: true, mode: 448 });
|
|
135846
136209
|
}
|
|
135847
136210
|
}
|
|
@@ -135857,14 +136220,14 @@ function writeSecureReplyListenerFile(filePath, content) {
|
|
|
135857
136220
|
}
|
|
135858
136221
|
function rotateReplyListenerLogIfNeeded(logPath) {
|
|
135859
136222
|
try {
|
|
135860
|
-
if (!
|
|
136223
|
+
if (!existsSync88(logPath))
|
|
135861
136224
|
return;
|
|
135862
136225
|
const stats = statSync12(logPath);
|
|
135863
136226
|
if (stats.size <= MAX_REPLY_LISTENER_LOG_SIZE_BYTES)
|
|
135864
136227
|
return;
|
|
135865
136228
|
const backupPath = `${logPath}.old`;
|
|
135866
|
-
if (
|
|
135867
|
-
|
|
136229
|
+
if (existsSync88(backupPath)) {
|
|
136230
|
+
unlinkSync16(backupPath);
|
|
135868
136231
|
}
|
|
135869
136232
|
renameSync7(logPath, backupPath);
|
|
135870
136233
|
} catch {}
|
|
@@ -135904,7 +136267,7 @@ class ReplyListenerRateLimiter {
|
|
|
135904
136267
|
}
|
|
135905
136268
|
|
|
135906
136269
|
// src/openclaw/reply-listener-state.ts
|
|
135907
|
-
import { existsSync as
|
|
136270
|
+
import { existsSync as existsSync89, readFileSync as readFileSync60, unlinkSync as unlinkSync17 } from "fs";
|
|
135908
136271
|
var REPLY_LISTENER_STARTUP_TOKEN_ENV = "OMO_OPENCLAW_REPLY_LISTENER_STARTUP_TOKEN";
|
|
135909
136272
|
function createDefaultReplyListenerState() {
|
|
135910
136273
|
return {
|
|
@@ -135966,9 +136329,9 @@ function createPendingReplyListenerState(startupToken) {
|
|
|
135966
136329
|
function readReplyListenerDaemonState() {
|
|
135967
136330
|
try {
|
|
135968
136331
|
const stateFilePath = getReplyListenerStateFilePath();
|
|
135969
|
-
if (!
|
|
136332
|
+
if (!existsSync89(stateFilePath))
|
|
135970
136333
|
return null;
|
|
135971
|
-
return normalizeReplyListenerState(JSON.parse(
|
|
136334
|
+
return normalizeReplyListenerState(JSON.parse(readFileSync60(stateFilePath, "utf-8")));
|
|
135972
136335
|
} catch {
|
|
135973
136336
|
return null;
|
|
135974
136337
|
}
|
|
@@ -135983,9 +136346,9 @@ function writeReplyListenerDaemonState(state3) {
|
|
|
135983
136346
|
function readReplyListenerDaemonConfig() {
|
|
135984
136347
|
try {
|
|
135985
136348
|
const configFilePath = getReplyListenerConfigFilePath();
|
|
135986
|
-
if (!
|
|
136349
|
+
if (!existsSync89(configFilePath))
|
|
135987
136350
|
return null;
|
|
135988
|
-
return JSON.parse(
|
|
136351
|
+
return JSON.parse(readFileSync60(configFilePath, "utf-8"));
|
|
135989
136352
|
} catch {
|
|
135990
136353
|
return null;
|
|
135991
136354
|
}
|
|
@@ -135996,9 +136359,9 @@ function writeReplyListenerDaemonConfig(config4) {
|
|
|
135996
136359
|
function readReplyListenerPid() {
|
|
135997
136360
|
try {
|
|
135998
136361
|
const pidFilePath = getReplyListenerPidFilePath();
|
|
135999
|
-
if (!
|
|
136362
|
+
if (!existsSync89(pidFilePath))
|
|
136000
136363
|
return null;
|
|
136001
|
-
const pid = Number.parseInt(
|
|
136364
|
+
const pid = Number.parseInt(readFileSync60(pidFilePath, "utf-8").trim(), 10);
|
|
136002
136365
|
return Number.isNaN(pid) ? null : pid;
|
|
136003
136366
|
} catch {
|
|
136004
136367
|
return null;
|
|
@@ -136009,8 +136372,8 @@ function writeReplyListenerPid(pid) {
|
|
|
136009
136372
|
}
|
|
136010
136373
|
function removeReplyListenerPid() {
|
|
136011
136374
|
const pidFilePath = getReplyListenerPidFilePath();
|
|
136012
|
-
if (
|
|
136013
|
-
|
|
136375
|
+
if (existsSync89(pidFilePath)) {
|
|
136376
|
+
unlinkSync17(pidFilePath);
|
|
136014
136377
|
}
|
|
136015
136378
|
}
|
|
136016
136379
|
function markReplyListenerStopped(state3, error92) {
|
|
@@ -136025,7 +136388,7 @@ function markReplyListenerStopped(state3, error92) {
|
|
|
136025
136388
|
}
|
|
136026
136389
|
|
|
136027
136390
|
// src/openclaw/reply-listener-process.ts
|
|
136028
|
-
import { readFileSync as
|
|
136391
|
+
import { readFileSync as readFileSync61 } from "fs";
|
|
136029
136392
|
var {spawn: spawn25 } = globalThis.Bun;
|
|
136030
136393
|
var REPLY_LISTENER_DAEMON_IDENTITY_MARKER = "--openclaw-reply-listener-daemon";
|
|
136031
136394
|
var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
|
|
@@ -136081,7 +136444,7 @@ function isReplyListenerProcessRunning(pid) {
|
|
|
136081
136444
|
async function isReplyListenerDaemonProcess(pid) {
|
|
136082
136445
|
try {
|
|
136083
136446
|
if (process.platform === "linux") {
|
|
136084
|
-
const cmdline =
|
|
136447
|
+
const cmdline = readFileSync61(`/proc/${pid}/cmdline`, "utf-8");
|
|
136085
136448
|
return cmdline.includes(REPLY_LISTENER_DAEMON_IDENTITY_MARKER);
|
|
136086
136449
|
}
|
|
136087
136450
|
const processInfo = spawn25(["ps", "-p", String(pid), "-o", "args="], {
|
|
@@ -136243,7 +136606,7 @@ async function startReplyListener(config4) {
|
|
|
136243
136606
|
pendingState.configSignature = getReplyListenerRuntimeSignature(normalizedConfig);
|
|
136244
136607
|
writeReplyListenerDaemonState(pendingState);
|
|
136245
136608
|
const currentFile = import.meta.url;
|
|
136246
|
-
const daemonScript = currentFile.endsWith(".ts") ?
|
|
136609
|
+
const daemonScript = currentFile.endsWith(".ts") ? join98(dirname32(new URL(currentFile).pathname), "daemon.ts") : join98(dirname32(new URL(currentFile).pathname), "daemon.js");
|
|
136247
136610
|
try {
|
|
136248
136611
|
const processInfo = spawnReplyListenerDaemon(daemonScript, startupToken);
|
|
136249
136612
|
processInfo.unref();
|
|
@@ -136391,7 +136754,7 @@ async function wakeOpenClaw(config4, event, context) {
|
|
|
136391
136754
|
const variables = {
|
|
136392
136755
|
sessionId: enrichedContext.sessionId,
|
|
136393
136756
|
projectPath: enrichedContext.projectPath,
|
|
136394
|
-
projectName: enrichedContext.projectPath ?
|
|
136757
|
+
projectName: enrichedContext.projectPath ? basename15(enrichedContext.projectPath) : undefined,
|
|
136395
136758
|
tmuxSession,
|
|
136396
136759
|
prompt: enrichedContext.prompt,
|
|
136397
136760
|
contextSummary: enrichedContext.contextSummary,
|
|
@@ -136417,7 +136780,7 @@ async function wakeOpenClaw(config4, event, context) {
|
|
|
136417
136780
|
timestamp: now,
|
|
136418
136781
|
sessionId: enrichedContext.sessionId,
|
|
136419
136782
|
projectPath: enrichedContext.projectPath,
|
|
136420
|
-
projectName: enrichedContext.projectPath ?
|
|
136783
|
+
projectName: enrichedContext.projectPath ? basename15(enrichedContext.projectPath) : undefined,
|
|
136421
136784
|
tmuxSession,
|
|
136422
136785
|
tmuxTail,
|
|
136423
136786
|
...replyChannel !== undefined && { channel: replyChannel },
|
|
@@ -136514,22 +136877,22 @@ async function dispatchOpenClawEvent(params) {
|
|
|
136514
136877
|
return result;
|
|
136515
136878
|
}
|
|
136516
136879
|
// src/features/claude-code-mcp-loader/loader.ts
|
|
136517
|
-
import { existsSync as
|
|
136518
|
-
import { join as
|
|
136880
|
+
import { existsSync as existsSync90, readFileSync as readFileSync62 } from "fs";
|
|
136881
|
+
import { join as join99 } from "path";
|
|
136519
136882
|
import { homedir as homedir17 } from "os";
|
|
136520
136883
|
init_logger();
|
|
136521
136884
|
function getMcpConfigPaths() {
|
|
136522
136885
|
const claudeConfigDir = getClaudeConfigDir();
|
|
136523
136886
|
const cwd = process.cwd();
|
|
136524
136887
|
return [
|
|
136525
|
-
{ path:
|
|
136526
|
-
{ path:
|
|
136527
|
-
{ path:
|
|
136528
|
-
{ path:
|
|
136888
|
+
{ path: join99(homedir17(), ".claude.json"), scope: "user" },
|
|
136889
|
+
{ path: join99(claudeConfigDir, ".mcp.json"), scope: "user" },
|
|
136890
|
+
{ path: join99(cwd, ".mcp.json"), scope: "project" },
|
|
136891
|
+
{ path: join99(cwd, ".claude", ".mcp.json"), scope: "local" }
|
|
136529
136892
|
];
|
|
136530
136893
|
}
|
|
136531
136894
|
async function loadMcpConfigFile(filePath) {
|
|
136532
|
-
if (!
|
|
136895
|
+
if (!existsSync90(filePath)) {
|
|
136533
136896
|
return null;
|
|
136534
136897
|
}
|
|
136535
136898
|
try {
|
|
@@ -136545,10 +136908,10 @@ function getSystemMcpServerNames() {
|
|
|
136545
136908
|
const paths = getMcpConfigPaths();
|
|
136546
136909
|
const cwd = process.cwd();
|
|
136547
136910
|
for (const { path: path14 } of paths) {
|
|
136548
|
-
if (!
|
|
136911
|
+
if (!existsSync90(path14))
|
|
136549
136912
|
continue;
|
|
136550
136913
|
try {
|
|
136551
|
-
const content =
|
|
136914
|
+
const content = readFileSync62(path14, "utf-8");
|
|
136552
136915
|
const config4 = JSON.parse(content);
|
|
136553
136916
|
if (!config4?.mcpServers)
|
|
136554
136917
|
continue;
|
|
@@ -138944,7 +139307,7 @@ How you work:
|
|
|
138944
139307
|
3. Return ONLY the relevant extracted information
|
|
138945
139308
|
4. The main agent never processes the raw file - you save context tokens
|
|
138946
139309
|
|
|
138947
|
-
For PDFs: extract text, structure, tables, data from specific sections
|
|
139310
|
+
For PDFs and documents: Use the Read tool to load the file content first, then extract text, structure, tables, data from specific sections
|
|
138948
139311
|
For images: describe layouts, UI elements, text, diagrams, charts
|
|
138949
139312
|
For diagrams: explain relationships, flows, architecture depicted
|
|
138950
139313
|
|
|
@@ -141943,7 +142306,7 @@ function createHephaestusAgent2(model, availableAgents, availableToolNames, avai
|
|
|
141943
142306
|
}
|
|
141944
142307
|
createHephaestusAgent2.mode = MODE10;
|
|
141945
142308
|
// src/agents/builtin-agents/resolve-file-uri.ts
|
|
141946
|
-
import { existsSync as
|
|
142309
|
+
import { existsSync as existsSync91, readFileSync as readFileSync63 } from "fs";
|
|
141947
142310
|
import { homedir as homedir18 } from "os";
|
|
141948
142311
|
import { isAbsolute as isAbsolute12, resolve as resolve20 } from "path";
|
|
141949
142312
|
init_logger();
|
|
@@ -141968,11 +142331,11 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
141968
142331
|
});
|
|
141969
142332
|
return `[WARNING: Path rejected: ${promptAppend}]`;
|
|
141970
142333
|
}
|
|
141971
|
-
if (!
|
|
142334
|
+
if (!existsSync91(filePath)) {
|
|
141972
142335
|
return `[WARNING: Could not resolve file URI: ${promptAppend}]`;
|
|
141973
142336
|
}
|
|
141974
142337
|
try {
|
|
141975
|
-
return
|
|
142338
|
+
return readFileSync63(filePath, "utf8");
|
|
141976
142339
|
} catch {
|
|
141977
142340
|
return `[WARNING: Could not read file: ${promptAppend}]`;
|
|
141978
142341
|
}
|
|
@@ -143214,80 +143577,7 @@ async function createBuiltinAgents(disabledAgents = [], agentOverrides = {}, dir
|
|
|
143214
143577
|
}
|
|
143215
143578
|
// src/plugin-handlers/agent-config-handler.ts
|
|
143216
143579
|
init_agent_display_names();
|
|
143217
|
-
|
|
143218
|
-
import { existsSync as existsSync91, readdirSync as readdirSync25, readFileSync as readFileSync63 } from "fs";
|
|
143219
|
-
import { join as join99, basename as basename15 } from "path";
|
|
143220
|
-
function parseToolsConfig2(toolsStr) {
|
|
143221
|
-
if (!toolsStr)
|
|
143222
|
-
return;
|
|
143223
|
-
const tools = toolsStr.split(",").map((t) => t.trim()).filter(Boolean);
|
|
143224
|
-
if (tools.length === 0)
|
|
143225
|
-
return;
|
|
143226
|
-
const result = {};
|
|
143227
|
-
for (const tool3 of tools) {
|
|
143228
|
-
result[tool3.toLowerCase()] = true;
|
|
143229
|
-
}
|
|
143230
|
-
return result;
|
|
143231
|
-
}
|
|
143232
|
-
function loadAgentsFromDir(agentsDir, scope) {
|
|
143233
|
-
if (!existsSync91(agentsDir)) {
|
|
143234
|
-
return [];
|
|
143235
|
-
}
|
|
143236
|
-
const entries = readdirSync25(agentsDir, { withFileTypes: true });
|
|
143237
|
-
const agents = [];
|
|
143238
|
-
for (const entry of entries) {
|
|
143239
|
-
if (!isMarkdownFile(entry))
|
|
143240
|
-
continue;
|
|
143241
|
-
const agentPath = join99(agentsDir, entry.name);
|
|
143242
|
-
const agentName = basename15(entry.name, ".md");
|
|
143243
|
-
try {
|
|
143244
|
-
const content = readFileSync63(agentPath, "utf-8");
|
|
143245
|
-
const { data, body } = parseFrontmatter(content);
|
|
143246
|
-
const name = data.name || agentName;
|
|
143247
|
-
const originalDescription = data.description || "";
|
|
143248
|
-
const formattedDescription = `(${scope}) ${originalDescription}`;
|
|
143249
|
-
const mappedModelOverride = mapClaudeModelToOpenCode(data.model);
|
|
143250
|
-
const modelString = mappedModelOverride ? `${mappedModelOverride.providerID}/${mappedModelOverride.modelID}` : undefined;
|
|
143251
|
-
const config4 = {
|
|
143252
|
-
description: formattedDescription,
|
|
143253
|
-
mode: data.mode || "subagent",
|
|
143254
|
-
prompt: body.trim(),
|
|
143255
|
-
...modelString ? { model: modelString } : {}
|
|
143256
|
-
};
|
|
143257
|
-
const toolsConfig = parseToolsConfig2(data.tools);
|
|
143258
|
-
if (toolsConfig) {
|
|
143259
|
-
config4.tools = toolsConfig;
|
|
143260
|
-
}
|
|
143261
|
-
agents.push({
|
|
143262
|
-
name,
|
|
143263
|
-
path: agentPath,
|
|
143264
|
-
config: config4,
|
|
143265
|
-
scope
|
|
143266
|
-
});
|
|
143267
|
-
} catch {
|
|
143268
|
-
continue;
|
|
143269
|
-
}
|
|
143270
|
-
}
|
|
143271
|
-
return agents;
|
|
143272
|
-
}
|
|
143273
|
-
function loadUserAgents() {
|
|
143274
|
-
const userAgentsDir = join99(getClaudeConfigDir(), "agents");
|
|
143275
|
-
const agents = loadAgentsFromDir(userAgentsDir, "user");
|
|
143276
|
-
const result = {};
|
|
143277
|
-
for (const agent of agents) {
|
|
143278
|
-
result[agent.name] = agent.config;
|
|
143279
|
-
}
|
|
143280
|
-
return result;
|
|
143281
|
-
}
|
|
143282
|
-
function loadProjectAgents(directory) {
|
|
143283
|
-
const projectAgentsDir = join99(directory ?? process.cwd(), ".claude", "agents");
|
|
143284
|
-
const agents = loadAgentsFromDir(projectAgentsDir, "project");
|
|
143285
|
-
const result = {};
|
|
143286
|
-
for (const agent of agents) {
|
|
143287
|
-
result[agent.name] = agent.config;
|
|
143288
|
-
}
|
|
143289
|
-
return result;
|
|
143290
|
-
}
|
|
143580
|
+
|
|
143291
143581
|
// src/plugin-handlers/agent-priority-order.ts
|
|
143292
143582
|
init_agent_display_names();
|
|
143293
143583
|
var CANONICAL_CORE_AGENT_ORDER = [
|
|
@@ -145580,7 +145870,7 @@ async function buildPrometheusAgentConfig(params) {
|
|
|
145580
145870
|
const base = {
|
|
145581
145871
|
...resolvedModel ? { model: resolvedModel } : {},
|
|
145582
145872
|
...variantToUse ? { variant: variantToUse } : {},
|
|
145583
|
-
mode: "
|
|
145873
|
+
mode: "primary",
|
|
145584
145874
|
prompt: getPrometheusPrompt(resolvedModel, params.disabledTools),
|
|
145585
145875
|
permission: PROMETHEUS_PERMISSION,
|
|
145586
145876
|
description: `${params.configAgentPlan?.description ?? "Plan agent"} (Prometheus - OhMyOpenCode)`,
|
|
@@ -146746,7 +147036,6 @@ function buildChatParamsInput(raw) {
|
|
|
146746
147036
|
const providerID = model.providerID;
|
|
146747
147037
|
const modelID = typeof model.modelID === "string" ? model.modelID : typeof model.id === "string" ? model.id : undefined;
|
|
146748
147038
|
const providerId = provider.id;
|
|
146749
|
-
const variant = message.variant;
|
|
146750
147039
|
if (typeof providerID !== "string")
|
|
146751
147040
|
return null;
|
|
146752
147041
|
if (typeof modelID !== "string")
|
|
@@ -146759,8 +147048,7 @@ function buildChatParamsInput(raw) {
|
|
|
146759
147048
|
model: { providerID, modelID },
|
|
146760
147049
|
provider: { id: providerId },
|
|
146761
147050
|
message,
|
|
146762
|
-
rawMessage: message
|
|
146763
|
-
...typeof variant === "string" ? {} : {}
|
|
147051
|
+
rawMessage: message
|
|
146764
147052
|
};
|
|
146765
147053
|
}
|
|
146766
147054
|
function isChatParamsOutput(raw) {
|
|
@@ -147712,7 +148000,6 @@ function createEventHandler2(args) {
|
|
|
147712
148000
|
const emittedAt = recentSyntheticIdles.get(sessionID);
|
|
147713
148001
|
if (emittedAt && Date.now() - emittedAt < DEDUP_WINDOW_MS) {
|
|
147714
148002
|
recentSyntheticIdles.delete(sessionID);
|
|
147715
|
-
return;
|
|
147716
148003
|
}
|
|
147717
148004
|
recentRealIdles.set(sessionID, Date.now());
|
|
147718
148005
|
}
|
|
@@ -152850,7 +153137,7 @@ class PostHog extends PostHogBackendClient {
|
|
|
152850
153137
|
// package.json
|
|
152851
153138
|
var package_default = {
|
|
152852
153139
|
name: "oh-my-opencode",
|
|
152853
|
-
version: "3.17.
|
|
153140
|
+
version: "3.17.2",
|
|
152854
153141
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
152855
153142
|
main: "./dist/index.js",
|
|
152856
153143
|
types: "dist/index.d.ts",
|
|
@@ -152929,17 +153216,17 @@ var package_default = {
|
|
|
152929
153216
|
typescript: "^5.7.3"
|
|
152930
153217
|
},
|
|
152931
153218
|
optionalDependencies: {
|
|
152932
|
-
"oh-my-opencode-darwin-arm64": "3.17.
|
|
152933
|
-
"oh-my-opencode-darwin-x64": "3.17.
|
|
152934
|
-
"oh-my-opencode-darwin-x64-baseline": "3.17.
|
|
152935
|
-
"oh-my-opencode-linux-arm64": "3.17.
|
|
152936
|
-
"oh-my-opencode-linux-arm64-musl": "3.17.
|
|
152937
|
-
"oh-my-opencode-linux-x64": "3.17.
|
|
152938
|
-
"oh-my-opencode-linux-x64-baseline": "3.17.
|
|
152939
|
-
"oh-my-opencode-linux-x64-musl": "3.17.
|
|
152940
|
-
"oh-my-opencode-linux-x64-musl-baseline": "3.17.
|
|
152941
|
-
"oh-my-opencode-windows-x64": "3.17.
|
|
152942
|
-
"oh-my-opencode-windows-x64-baseline": "3.17.
|
|
153219
|
+
"oh-my-opencode-darwin-arm64": "3.17.2",
|
|
153220
|
+
"oh-my-opencode-darwin-x64": "3.17.2",
|
|
153221
|
+
"oh-my-opencode-darwin-x64-baseline": "3.17.2",
|
|
153222
|
+
"oh-my-opencode-linux-arm64": "3.17.2",
|
|
153223
|
+
"oh-my-opencode-linux-arm64-musl": "3.17.2",
|
|
153224
|
+
"oh-my-opencode-linux-x64": "3.17.2",
|
|
153225
|
+
"oh-my-opencode-linux-x64-baseline": "3.17.2",
|
|
153226
|
+
"oh-my-opencode-linux-x64-musl": "3.17.2",
|
|
153227
|
+
"oh-my-opencode-linux-x64-musl-baseline": "3.17.2",
|
|
153228
|
+
"oh-my-opencode-windows-x64": "3.17.2",
|
|
153229
|
+
"oh-my-opencode-windows-x64-baseline": "3.17.2"
|
|
152943
153230
|
},
|
|
152944
153231
|
overrides: {},
|
|
152945
153232
|
trustedDependencies: [
|
|
@@ -153065,17 +153352,36 @@ function getSharedProperties(source) {
|
|
|
153065
153352
|
plugin_name: PLUGIN_NAME,
|
|
153066
153353
|
package_version: package_default.version,
|
|
153067
153354
|
runtime: "bun",
|
|
153068
|
-
|
|
153355
|
+
runtime_version: process.versions.bun ?? process.version,
|
|
153356
|
+
source,
|
|
153357
|
+
$os: os6.platform(),
|
|
153358
|
+
$os_version: os6.release(),
|
|
153359
|
+
os_arch: os6.arch(),
|
|
153360
|
+
os_type: os6.type(),
|
|
153361
|
+
cpu_count: os6.cpus().length,
|
|
153362
|
+
cpu_model: os6.cpus()[0]?.model,
|
|
153363
|
+
total_memory_gb: Math.round(os6.totalmem() / 1024 / 1024 / 1024),
|
|
153364
|
+
locale: Intl.DateTimeFormat().resolvedOptions().locale,
|
|
153365
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
153366
|
+
shell: process.env.SHELL,
|
|
153367
|
+
ci: Boolean(process.env.CI),
|
|
153368
|
+
terminal: process.env.TERM_PROGRAM
|
|
153069
153369
|
};
|
|
153070
153370
|
}
|
|
153071
153371
|
function createPostHogClient(source, options) {
|
|
153072
153372
|
if (shouldDisablePostHog() || !hasPostHogApiKey()) {
|
|
153073
153373
|
return NO_OP_POSTHOG;
|
|
153074
153374
|
}
|
|
153075
|
-
|
|
153076
|
-
|
|
153077
|
-
|
|
153078
|
-
|
|
153375
|
+
let configuredClient;
|
|
153376
|
+
try {
|
|
153377
|
+
configuredClient = new PostHog(getPostHogApiKey(), {
|
|
153378
|
+
...options,
|
|
153379
|
+
host: getPostHogHost(),
|
|
153380
|
+
disableGeoip: false
|
|
153381
|
+
});
|
|
153382
|
+
} catch {
|
|
153383
|
+
return NO_OP_POSTHOG;
|
|
153384
|
+
}
|
|
153079
153385
|
const sharedProperties = getSharedProperties(source);
|
|
153080
153386
|
return {
|
|
153081
153387
|
capture: (message) => {
|