oh-my-opencode 3.17.1 → 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/dist/index.js CHANGED
@@ -6981,37 +6981,37 @@ var require_dataType = __commonJS((exports) => {
6981
6981
  DataType2[DataType2["Wrong"] = 1] = "Wrong";
6982
6982
  })(DataType || (exports.DataType = DataType = {}));
6983
6983
  function getSchemaTypes(schema2) {
6984
- const types22 = getJSONTypes(schema2.type);
6985
- const hasNull = types22.includes("null");
6984
+ const types23 = getJSONTypes(schema2.type);
6985
+ const hasNull = types23.includes("null");
6986
6986
  if (hasNull) {
6987
6987
  if (schema2.nullable === false)
6988
6988
  throw new Error("type: null contradicts nullable: false");
6989
6989
  } else {
6990
- if (!types22.length && schema2.nullable !== undefined) {
6990
+ if (!types23.length && schema2.nullable !== undefined) {
6991
6991
  throw new Error('"nullable" cannot be used without "type"');
6992
6992
  }
6993
6993
  if (schema2.nullable === true)
6994
- types22.push("null");
6994
+ types23.push("null");
6995
6995
  }
6996
- return types22;
6996
+ return types23;
6997
6997
  }
6998
6998
  exports.getSchemaTypes = getSchemaTypes;
6999
6999
  function getJSONTypes(ts) {
7000
- const types22 = Array.isArray(ts) ? ts : ts ? [ts] : [];
7001
- if (types22.every(rules_1.isJSONType))
7002
- return types22;
7003
- throw new Error("type must be JSONType or JSONType[]: " + types22.join(","));
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(","));
7004
7004
  }
7005
7005
  exports.getJSONTypes = getJSONTypes;
7006
- function coerceAndCheckDataType(it, types22) {
7006
+ function coerceAndCheckDataType(it, types23) {
7007
7007
  const { gen, data, opts } = it;
7008
- const coerceTo = coerceToTypes(types22, opts.coerceTypes);
7009
- const checkTypes = types22.length > 0 && !(coerceTo.length === 0 && types22.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types22[0]));
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]));
7010
7010
  if (checkTypes) {
7011
- const wrongType = checkDataTypes(types22, data, opts.strictNumbers, DataType.Wrong);
7011
+ const wrongType = checkDataTypes(types23, data, opts.strictNumbers, DataType.Wrong);
7012
7012
  gen.if(wrongType, () => {
7013
7013
  if (coerceTo.length)
7014
- coerceData(it, types22, coerceTo);
7014
+ coerceData(it, types23, coerceTo);
7015
7015
  else
7016
7016
  reportTypeError(it);
7017
7017
  });
@@ -7020,15 +7020,15 @@ var require_dataType = __commonJS((exports) => {
7020
7020
  }
7021
7021
  exports.coerceAndCheckDataType = coerceAndCheckDataType;
7022
7022
  var COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]);
7023
- function coerceToTypes(types22, coerceTypes) {
7024
- return coerceTypes ? types22.filter((t) => COERCIBLE.has(t) || coerceTypes === "array" && t === "array") : [];
7023
+ function coerceToTypes(types23, coerceTypes) {
7024
+ return coerceTypes ? types23.filter((t) => COERCIBLE.has(t) || coerceTypes === "array" && t === "array") : [];
7025
7025
  }
7026
- function coerceData(it, types22, coerceTo) {
7026
+ function coerceData(it, types23, coerceTo) {
7027
7027
  const { gen, data, opts } = it;
7028
7028
  const dataType = gen.let("dataType", (0, codegen_1._)`typeof ${data}`);
7029
7029
  const coerced = gen.let("coerced", (0, codegen_1._)`undefined`);
7030
7030
  if (opts.coerceTypes === "array") {
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(types22, data, opts.strictNumbers), () => gen.assign(coerced, data)));
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)));
7032
7032
  }
7033
7033
  gen.if((0, codegen_1._)`${coerced} !== undefined`);
7034
7034
  for (const t of coerceTo) {
@@ -7104,19 +7104,19 @@ var require_dataType = __commonJS((exports) => {
7104
7104
  return checkDataType(dataTypes[0], data, strictNums, correct);
7105
7105
  }
7106
7106
  let cond;
7107
- const types22 = (0, util_1.toHash)(dataTypes);
7108
- if (types22.array && types22.object) {
7107
+ const types23 = (0, util_1.toHash)(dataTypes);
7108
+ if (types23.array && types23.object) {
7109
7109
  const notObj = (0, codegen_1._)`typeof ${data} != "object"`;
7110
- cond = types22.null ? notObj : (0, codegen_1._)`!${data} || ${notObj}`;
7111
- delete types22.null;
7112
- delete types22.array;
7113
- delete types22.object;
7110
+ cond = types23.null ? notObj : (0, codegen_1._)`!${data} || ${notObj}`;
7111
+ delete types23.null;
7112
+ delete types23.array;
7113
+ delete types23.object;
7114
7114
  } else {
7115
7115
  cond = codegen_1.nil;
7116
7116
  }
7117
- if (types22.number)
7118
- delete types22.integer;
7119
- for (const t in types22)
7117
+ if (types23.number)
7118
+ delete types23.integer;
7119
+ for (const t in types23)
7120
7120
  cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct));
7121
7121
  return cond;
7122
7122
  }
@@ -7904,9 +7904,9 @@ var require_validate = __commonJS((exports) => {
7904
7904
  function typeAndKeywords(it, errsCount) {
7905
7905
  if (it.opts.jtd)
7906
7906
  return schemaKeywords(it, [], false, errsCount);
7907
- const types22 = (0, dataType_1.getSchemaTypes)(it.schema);
7908
- const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types22);
7909
- schemaKeywords(it, types22, !checkedTypes, errsCount);
7907
+ const types23 = (0, dataType_1.getSchemaTypes)(it.schema);
7908
+ const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types23);
7909
+ schemaKeywords(it, types23, !checkedTypes, errsCount);
7910
7910
  }
7911
7911
  function checkRefsAndKeywords(it) {
7912
7912
  const { schema: schema2, errSchemaPath, opts, self } = it;
@@ -7956,7 +7956,7 @@ var require_validate = __commonJS((exports) => {
7956
7956
  if (items instanceof codegen_1.Name)
7957
7957
  gen.assign((0, codegen_1._)`${evaluated}.items`, items);
7958
7958
  }
7959
- function schemaKeywords(it, types22, typeErrors, errsCount) {
7959
+ function schemaKeywords(it, types23, typeErrors, errsCount) {
7960
7960
  const { gen, schema: schema2, data, allErrors, opts, self } = it;
7961
7961
  const { RULES } = self;
7962
7962
  if (schema2.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema2, RULES))) {
@@ -7964,7 +7964,7 @@ var require_validate = __commonJS((exports) => {
7964
7964
  return;
7965
7965
  }
7966
7966
  if (!opts.jtd)
7967
- checkStrictTypes(it, types22);
7967
+ checkStrictTypes(it, types23);
7968
7968
  gen.block(() => {
7969
7969
  for (const group of RULES.rules)
7970
7970
  groupKeywords(group);
@@ -7976,7 +7976,7 @@ var require_validate = __commonJS((exports) => {
7976
7976
  if (group.type) {
7977
7977
  gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
7978
7978
  iterateKeywords(it, group);
7979
- if (types22.length === 1 && types22[0] === group.type && typeErrors) {
7979
+ if (types23.length === 1 && types23[0] === group.type && typeErrors) {
7980
7980
  gen.else();
7981
7981
  (0, dataType_2.reportTypeError)(it);
7982
7982
  }
@@ -8000,27 +8000,27 @@ var require_validate = __commonJS((exports) => {
8000
8000
  }
8001
8001
  });
8002
8002
  }
8003
- function checkStrictTypes(it, types22) {
8003
+ function checkStrictTypes(it, types23) {
8004
8004
  if (it.schemaEnv.meta || !it.opts.strictTypes)
8005
8005
  return;
8006
- checkContextTypes(it, types22);
8006
+ checkContextTypes(it, types23);
8007
8007
  if (!it.opts.allowUnionTypes)
8008
- checkMultipleTypes(it, types22);
8008
+ checkMultipleTypes(it, types23);
8009
8009
  checkKeywordTypes(it, it.dataTypes);
8010
8010
  }
8011
- function checkContextTypes(it, types22) {
8012
- if (!types22.length)
8011
+ function checkContextTypes(it, types23) {
8012
+ if (!types23.length)
8013
8013
  return;
8014
8014
  if (!it.dataTypes.length) {
8015
- it.dataTypes = types22;
8015
+ it.dataTypes = types23;
8016
8016
  return;
8017
8017
  }
8018
- types22.forEach((t) => {
8018
+ types23.forEach((t) => {
8019
8019
  if (!includesType(it.dataTypes, t)) {
8020
8020
  strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
8021
8021
  }
8022
8022
  });
8023
- narrowSchemaTypes(it, types22);
8023
+ narrowSchemaTypes(it, types23);
8024
8024
  }
8025
8025
  function checkMultipleTypes(it, ts) {
8026
8026
  if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
@@ -15665,7 +15665,7 @@ function resolveActualContextLimit(providerID, modelID, modelCacheState) {
15665
15665
 
15666
15666
  // src/shared/normalize-sdk-response.ts
15667
15667
  function normalizeSDKResponse(response, fallback, options) {
15668
- if (response === null || response === undefined) {
15668
+ if (response == null) {
15669
15669
  return fallback;
15670
15670
  }
15671
15671
  if (Array.isArray(response)) {
@@ -15673,7 +15673,7 @@ function normalizeSDKResponse(response, fallback, options) {
15673
15673
  }
15674
15674
  if (typeof response === "object" && "data" in response) {
15675
15675
  const data = response.data;
15676
- if (data !== null && data !== undefined) {
15676
+ if (data != null) {
15677
15677
  return data;
15678
15678
  }
15679
15679
  if (options?.preferResponseOnMissingData === true) {
@@ -17286,20 +17286,26 @@ var AGENT_NAME_MAP = {
17286
17286
  omo: "sisyphus",
17287
17287
  OmO: "sisyphus",
17288
17288
  Sisyphus: "sisyphus",
17289
+ "Sisyphus (Ultraworker)": "sisyphus",
17289
17290
  sisyphus: "sisyphus",
17291
+ "Hephaestus (Deep Agent)": "hephaestus",
17290
17292
  "OmO-Plan": "prometheus",
17291
17293
  "omo-plan": "prometheus",
17292
17294
  "Planner-Sisyphus": "prometheus",
17293
17295
  "planner-sisyphus": "prometheus",
17294
17296
  "Prometheus - Plan Builder": "prometheus",
17297
+ "Prometheus (Plan Builder)": "prometheus",
17295
17298
  prometheus: "prometheus",
17296
17299
  "orchestrator-sisyphus": "atlas",
17297
17300
  Atlas: "atlas",
17301
+ "Atlas (Plan Executor)": "atlas",
17298
17302
  atlas: "atlas",
17299
17303
  "plan-consultant": "metis",
17300
17304
  "Metis - Plan Consultant": "metis",
17305
+ "Metis (Plan Consultant)": "metis",
17301
17306
  metis: "metis",
17302
17307
  "Momus - Plan Critic": "momus",
17308
+ "Momus (Plan Critic)": "momus",
17303
17309
  momus: "momus",
17304
17310
  "Sisyphus-Junior": "sisyphus-junior",
17305
17311
  "sisyphus-junior": "sisyphus-junior",
@@ -17400,7 +17406,7 @@ init_logger();
17400
17406
  import * as fs4 from "fs";
17401
17407
 
17402
17408
  // src/shared/write-file-atomically.ts
17403
- import { closeSync, fsyncSync, openSync, renameSync, writeFileSync } from "fs";
17409
+ import { closeSync, fsyncSync, openSync, renameSync, unlinkSync, writeFileSync } from "fs";
17404
17410
  function writeFileAtomically(filePath, content) {
17405
17411
  const tempPath = `${filePath}.tmp`;
17406
17412
  writeFileSync(tempPath, content, "utf-8");
@@ -17410,7 +17416,18 @@ function writeFileAtomically(filePath, content) {
17410
17416
  } finally {
17411
17417
  closeSync(tempFileDescriptor);
17412
17418
  }
17413
- renameSync(tempPath, filePath);
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
+ }
17414
17431
  }
17415
17432
 
17416
17433
  // src/shared/migration/migrations-sidecar.ts
@@ -18315,7 +18332,7 @@ async function listZipEntries(archivePath) {
18315
18332
  throw new Error("zip entry listing requires either python3 or zipinfo to inspect the archive safely");
18316
18333
  }
18317
18334
  // src/shared/binary-downloader.ts
18318
- 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";
18319
18336
  import * as path5 from "path";
18320
18337
  var {spawn: spawn8 } = globalThis.Bun;
18321
18338
  function isTarTraversalErrorOutput(output) {
@@ -18361,7 +18378,7 @@ async function extractZipArchive(archivePath, destDir) {
18361
18378
  }
18362
18379
  function cleanupArchive(archivePath) {
18363
18380
  if (existsSync9(archivePath)) {
18364
- unlinkSync(archivePath);
18381
+ unlinkSync2(archivePath);
18365
18382
  }
18366
18383
  }
18367
18384
  function ensureExecutable(binaryPath) {
@@ -18415,11 +18432,11 @@ var AGENT_MODEL_REQUIREMENTS = {
18415
18432
  sisyphus: {
18416
18433
  fallbackChain: [
18417
18434
  {
18418
- providers: ["anthropic", "github-copilot", "opencode"],
18435
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18419
18436
  model: "claude-opus-4-6",
18420
18437
  variant: "max"
18421
18438
  },
18422
- { providers: ["opencode-go"], model: "kimi-k2.5" },
18439
+ { providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
18423
18440
  { providers: ["kimi-for-coding"], model: "k2p5" },
18424
18441
  {
18425
18442
  providers: [
@@ -18428,12 +18445,13 @@ var AGENT_MODEL_REQUIREMENTS = {
18428
18445
  "moonshotai-cn",
18429
18446
  "firmware",
18430
18447
  "ollama-cloud",
18431
- "aihubmix"
18448
+ "aihubmix",
18449
+ "vercel"
18432
18450
  ],
18433
18451
  model: "kimi-k2.5"
18434
18452
  },
18435
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
18436
- { 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" },
18437
18455
  { providers: ["opencode"], model: "big-pickle" }
18438
18456
  ],
18439
18457
  requiresAnyModel: true
@@ -18441,73 +18459,73 @@ var AGENT_MODEL_REQUIREMENTS = {
18441
18459
  hephaestus: {
18442
18460
  fallbackChain: [
18443
18461
  {
18444
- providers: ["openai", "github-copilot", "venice", "opencode"],
18462
+ providers: ["openai", "github-copilot", "venice", "opencode", "vercel"],
18445
18463
  model: "gpt-5.4",
18446
18464
  variant: "medium"
18447
18465
  }
18448
18466
  ],
18449
- requiresProvider: ["openai", "github-copilot", "venice", "opencode"]
18467
+ requiresProvider: ["openai", "github-copilot", "venice", "opencode", "vercel"]
18450
18468
  },
18451
18469
  oracle: {
18452
18470
  fallbackChain: [
18453
18471
  {
18454
- providers: ["openai", "github-copilot", "opencode"],
18472
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
18455
18473
  model: "gpt-5.4",
18456
18474
  variant: "high"
18457
18475
  },
18458
18476
  {
18459
- providers: ["google", "github-copilot", "opencode"],
18477
+ providers: ["google", "github-copilot", "opencode", "vercel"],
18460
18478
  model: "gemini-3.1-pro",
18461
18479
  variant: "high"
18462
18480
  },
18463
18481
  {
18464
- providers: ["anthropic", "github-copilot", "opencode"],
18482
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18465
18483
  model: "claude-opus-4-6",
18466
18484
  variant: "max"
18467
18485
  },
18468
- { providers: ["opencode-go"], model: "glm-5" }
18486
+ { providers: ["opencode-go", "vercel"], model: "glm-5" }
18469
18487
  ]
18470
18488
  },
18471
18489
  librarian: {
18472
18490
  fallbackChain: [
18473
- { providers: ["opencode-go"], model: "minimax-m2.7" },
18474
- { providers: ["opencode"], model: "minimax-m2.7-highspeed" },
18475
- { providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
18476
- { 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" }
18477
18495
  ]
18478
18496
  },
18479
18497
  explore: {
18480
18498
  fallbackChain: [
18481
- { providers: ["github-copilot", "xai"], model: "grok-code-fast-1" },
18482
- { providers: ["opencode-go"], model: "minimax-m2.7-highspeed" },
18483
- { providers: ["opencode"], model: "minimax-m2.7" },
18484
- { providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
18485
- { 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" }
18486
18504
  ]
18487
18505
  },
18488
18506
  "multimodal-looker": {
18489
18507
  fallbackChain: [
18490
- { providers: ["openai", "opencode"], model: "gpt-5.4", variant: "medium" },
18491
- { providers: ["opencode-go"], model: "kimi-k2.5" },
18492
- { providers: ["zai-coding-plan"], model: "glm-4.6v" },
18493
- { 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" }
18494
18512
  ]
18495
18513
  },
18496
18514
  prometheus: {
18497
18515
  fallbackChain: [
18498
18516
  {
18499
- providers: ["anthropic", "github-copilot", "opencode"],
18517
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18500
18518
  model: "claude-opus-4-6",
18501
18519
  variant: "max"
18502
18520
  },
18503
18521
  {
18504
- providers: ["openai", "github-copilot", "opencode"],
18522
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
18505
18523
  model: "gpt-5.4",
18506
18524
  variant: "high"
18507
18525
  },
18508
- { providers: ["opencode-go"], model: "glm-5" },
18526
+ { providers: ["opencode-go", "vercel"], model: "glm-5" },
18509
18527
  {
18510
- providers: ["google", "github-copilot", "opencode"],
18528
+ providers: ["google", "github-copilot", "opencode", "vercel"],
18511
18529
  model: "gemini-3.1-pro"
18512
18530
  }
18513
18531
  ]
@@ -18515,61 +18533,61 @@ var AGENT_MODEL_REQUIREMENTS = {
18515
18533
  metis: {
18516
18534
  fallbackChain: [
18517
18535
  {
18518
- providers: ["anthropic", "github-copilot", "opencode"],
18536
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18519
18537
  model: "claude-opus-4-6",
18520
18538
  variant: "max"
18521
18539
  },
18522
18540
  {
18523
- providers: ["openai", "github-copilot", "opencode"],
18541
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
18524
18542
  model: "gpt-5.4",
18525
18543
  variant: "high"
18526
18544
  },
18527
- { providers: ["opencode-go"], model: "glm-5" },
18545
+ { providers: ["opencode-go", "vercel"], model: "glm-5" },
18528
18546
  { providers: ["kimi-for-coding"], model: "k2p5" }
18529
18547
  ]
18530
18548
  },
18531
18549
  momus: {
18532
18550
  fallbackChain: [
18533
18551
  {
18534
- providers: ["openai", "github-copilot", "opencode"],
18552
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
18535
18553
  model: "gpt-5.4",
18536
18554
  variant: "xhigh"
18537
18555
  },
18538
18556
  {
18539
- providers: ["anthropic", "github-copilot", "opencode"],
18557
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18540
18558
  model: "claude-opus-4-6",
18541
18559
  variant: "max"
18542
18560
  },
18543
18561
  {
18544
- providers: ["google", "github-copilot", "opencode"],
18562
+ providers: ["google", "github-copilot", "opencode", "vercel"],
18545
18563
  model: "gemini-3.1-pro",
18546
18564
  variant: "high"
18547
18565
  },
18548
- { providers: ["opencode-go"], model: "glm-5" }
18566
+ { providers: ["opencode-go", "vercel"], model: "glm-5" }
18549
18567
  ]
18550
18568
  },
18551
18569
  atlas: {
18552
18570
  fallbackChain: [
18553
- { providers: ["anthropic", "github-copilot", "opencode"], model: "claude-sonnet-4-6" },
18554
- { 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" },
18555
18573
  {
18556
- providers: ["openai", "github-copilot", "opencode"],
18574
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
18557
18575
  model: "gpt-5.4",
18558
18576
  variant: "medium"
18559
18577
  },
18560
- { providers: ["opencode-go"], model: "minimax-m2.7" }
18578
+ { providers: ["opencode-go", "vercel"], model: "minimax-m2.7" }
18561
18579
  ]
18562
18580
  },
18563
18581
  "sisyphus-junior": {
18564
18582
  fallbackChain: [
18565
- { providers: ["anthropic", "github-copilot", "opencode"], model: "claude-sonnet-4-6" },
18566
- { 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" },
18567
18585
  {
18568
- providers: ["openai", "github-copilot", "opencode"],
18586
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
18569
18587
  model: "gpt-5.4",
18570
18588
  variant: "medium"
18571
18589
  },
18572
- { providers: ["opencode-go"], model: "minimax-m2.7" },
18590
+ { providers: ["opencode-go", "vercel"], model: "minimax-m2.7" },
18573
18591
  { providers: ["opencode"], model: "big-pickle" }
18574
18592
  ]
18575
18593
  }
@@ -18578,54 +18596,54 @@ var CATEGORY_MODEL_REQUIREMENTS = {
18578
18596
  "visual-engineering": {
18579
18597
  fallbackChain: [
18580
18598
  {
18581
- providers: ["google", "github-copilot", "opencode"],
18599
+ providers: ["google", "github-copilot", "opencode", "vercel"],
18582
18600
  model: "gemini-3.1-pro",
18583
18601
  variant: "high"
18584
18602
  },
18585
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
18603
+ { providers: ["zai-coding-plan", "opencode", "vercel"], model: "glm-5" },
18586
18604
  {
18587
- providers: ["anthropic", "github-copilot", "opencode"],
18605
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18588
18606
  model: "claude-opus-4-6",
18589
18607
  variant: "max"
18590
18608
  },
18591
- { providers: ["opencode-go"], model: "glm-5" },
18609
+ { providers: ["opencode-go", "vercel"], model: "glm-5" },
18592
18610
  { providers: ["kimi-for-coding"], model: "k2p5" }
18593
18611
  ]
18594
18612
  },
18595
18613
  ultrabrain: {
18596
18614
  fallbackChain: [
18597
18615
  {
18598
- providers: ["openai", "opencode"],
18616
+ providers: ["openai", "opencode", "vercel"],
18599
18617
  model: "gpt-5.4",
18600
18618
  variant: "xhigh"
18601
18619
  },
18602
18620
  {
18603
- providers: ["google", "github-copilot", "opencode"],
18621
+ providers: ["google", "github-copilot", "opencode", "vercel"],
18604
18622
  model: "gemini-3.1-pro",
18605
18623
  variant: "high"
18606
18624
  },
18607
18625
  {
18608
- providers: ["anthropic", "github-copilot", "opencode"],
18626
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18609
18627
  model: "claude-opus-4-6",
18610
18628
  variant: "max"
18611
18629
  },
18612
- { providers: ["opencode-go"], model: "glm-5" }
18630
+ { providers: ["opencode-go", "vercel"], model: "glm-5" }
18613
18631
  ]
18614
18632
  },
18615
18633
  deep: {
18616
18634
  fallbackChain: [
18617
18635
  {
18618
- providers: ["openai", "github-copilot", "venice", "opencode"],
18636
+ providers: ["openai", "github-copilot", "venice", "opencode", "vercel"],
18619
18637
  model: "gpt-5.4",
18620
18638
  variant: "medium"
18621
18639
  },
18622
18640
  {
18623
- providers: ["anthropic", "github-copilot", "opencode"],
18641
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18624
18642
  model: "claude-opus-4-6",
18625
18643
  variant: "max"
18626
18644
  },
18627
18645
  {
18628
- providers: ["google", "github-copilot", "opencode"],
18646
+ providers: ["google", "github-copilot", "opencode", "vercel"],
18629
18647
  model: "gemini-3.1-pro",
18630
18648
  variant: "high"
18631
18649
  }
@@ -18634,72 +18652,72 @@ var CATEGORY_MODEL_REQUIREMENTS = {
18634
18652
  artistry: {
18635
18653
  fallbackChain: [
18636
18654
  {
18637
- providers: ["google", "github-copilot", "opencode"],
18655
+ providers: ["google", "github-copilot", "opencode", "vercel"],
18638
18656
  model: "gemini-3.1-pro",
18639
18657
  variant: "high"
18640
18658
  },
18641
18659
  {
18642
- providers: ["anthropic", "github-copilot", "opencode"],
18660
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18643
18661
  model: "claude-opus-4-6",
18644
18662
  variant: "max"
18645
18663
  },
18646
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4" }
18664
+ { providers: ["openai", "github-copilot", "opencode", "vercel"], model: "gpt-5.4" }
18647
18665
  ],
18648
18666
  requiresModel: "gemini-3.1-pro"
18649
18667
  },
18650
18668
  quick: {
18651
18669
  fallbackChain: [
18652
18670
  {
18653
- providers: ["openai", "github-copilot", "opencode"],
18671
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
18654
18672
  model: "gpt-5.4-mini"
18655
18673
  },
18656
18674
  {
18657
- providers: ["anthropic", "github-copilot", "opencode"],
18675
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18658
18676
  model: "claude-haiku-4-5"
18659
18677
  },
18660
18678
  {
18661
- providers: ["google", "github-copilot", "opencode"],
18679
+ providers: ["google", "github-copilot", "opencode", "vercel"],
18662
18680
  model: "gemini-3-flash"
18663
18681
  },
18664
- { providers: ["opencode-go"], model: "minimax-m2.7" },
18665
- { providers: ["opencode"], model: "gpt-5-nano" }
18682
+ { providers: ["opencode-go", "vercel"], model: "minimax-m2.7" },
18683
+ { providers: ["opencode", "vercel"], model: "gpt-5-nano" }
18666
18684
  ]
18667
18685
  },
18668
18686
  "unspecified-low": {
18669
18687
  fallbackChain: [
18670
18688
  {
18671
- providers: ["anthropic", "github-copilot", "opencode"],
18689
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18672
18690
  model: "claude-sonnet-4-6"
18673
18691
  },
18674
18692
  {
18675
- providers: ["openai", "opencode"],
18693
+ providers: ["openai", "opencode", "vercel"],
18676
18694
  model: "gpt-5.3-codex",
18677
18695
  variant: "medium"
18678
18696
  },
18679
- { providers: ["opencode-go"], model: "kimi-k2.5" },
18697
+ { providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
18680
18698
  {
18681
- providers: ["google", "github-copilot", "opencode"],
18699
+ providers: ["google", "github-copilot", "opencode", "vercel"],
18682
18700
  model: "gemini-3-flash"
18683
18701
  },
18684
- { providers: ["opencode-go"], model: "minimax-m2.7" }
18702
+ { providers: ["opencode-go", "vercel"], model: "minimax-m2.7" }
18685
18703
  ]
18686
18704
  },
18687
18705
  "unspecified-high": {
18688
18706
  fallbackChain: [
18689
18707
  {
18690
- providers: ["anthropic", "github-copilot", "opencode"],
18708
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18691
18709
  model: "claude-opus-4-6",
18692
18710
  variant: "max"
18693
18711
  },
18694
18712
  {
18695
- providers: ["openai", "github-copilot", "opencode"],
18713
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
18696
18714
  model: "gpt-5.4",
18697
18715
  variant: "high"
18698
18716
  },
18699
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
18717
+ { providers: ["zai-coding-plan", "opencode", "vercel"], model: "glm-5" },
18700
18718
  { providers: ["kimi-for-coding"], model: "k2p5" },
18701
- { providers: ["opencode-go"], model: "glm-5" },
18702
- { providers: ["opencode"], model: "kimi-k2.5" },
18719
+ { providers: ["opencode-go", "vercel"], model: "glm-5" },
18720
+ { providers: ["opencode", "vercel"], model: "kimi-k2.5" },
18703
18721
  {
18704
18722
  providers: [
18705
18723
  "opencode",
@@ -18707,7 +18725,8 @@ var CATEGORY_MODEL_REQUIREMENTS = {
18707
18725
  "moonshotai-cn",
18708
18726
  "firmware",
18709
18727
  "ollama-cloud",
18710
- "aihubmix"
18728
+ "aihubmix",
18729
+ "vercel"
18711
18730
  ],
18712
18731
  model: "kimi-k2.5"
18713
18732
  }
@@ -18716,15 +18735,15 @@ var CATEGORY_MODEL_REQUIREMENTS = {
18716
18735
  writing: {
18717
18736
  fallbackChain: [
18718
18737
  {
18719
- providers: ["google", "github-copilot", "opencode"],
18738
+ providers: ["google", "github-copilot", "opencode", "vercel"],
18720
18739
  model: "gemini-3-flash"
18721
18740
  },
18722
- { providers: ["opencode-go"], model: "kimi-k2.5" },
18741
+ { providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
18723
18742
  {
18724
- providers: ["anthropic", "github-copilot", "opencode"],
18743
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
18725
18744
  model: "claude-sonnet-4-6"
18726
18745
  },
18727
- { providers: ["opencode-go"], model: "minimax-m2.7" }
18746
+ { providers: ["opencode-go", "vercel"], model: "minimax-m2.7" }
18728
18747
  ]
18729
18748
  }
18730
18749
  };
@@ -18805,6 +18824,19 @@ function restoreMessageCursor(sessionID, cursor) {
18805
18824
  sessionCursors.set(sessionID, cloneCursorState(cursor));
18806
18825
  }
18807
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
+ }
18808
18840
  function shellEscape(value, shellType) {
18809
18841
  if (value === "") {
18810
18842
  return shellType === "cmd" ? '""' : "''";
@@ -19336,12 +19368,54 @@ function isModelCacheAvailable() {
19336
19368
  }
19337
19369
 
19338
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
+ }
19339
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
+ }
19340
19411
  if (provider === "github-copilot") {
19341
- return model.replace("claude-opus-4-6", "claude-opus-4.6").replace("claude-sonnet-4-6", "claude-sonnet-4.6").replace("claude-sonnet-4-5", "claude-sonnet-4.5").replace("claude-haiku-4-5", "claude-haiku-4.5").replace("claude-sonnet-4", "claude-sonnet-4").replace(/gemini-3\.1-pro(?!-)/g, "gemini-3.1-pro-preview").replace(/gemini-3-flash(?!-)/g, "gemini-3-flash-preview");
19412
+ return claudeVersionDot(model).replace(GEMINI_31_PRO_PREVIEW, "gemini-3.1-pro-preview").replace(GEMINI_3_FLASH_PREVIEW, "gemini-3-flash-preview");
19342
19413
  }
19343
19414
  if (provider === "google") {
19344
- return model.replace(/gemini-3\.1-pro(?!-)/g, "gemini-3.1-pro-preview").replace(/gemini-3-flash(?!-)/g, "gemini-3-flash-preview");
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);
19345
19419
  }
19346
19420
  return model;
19347
19421
  }
@@ -60844,7 +60918,7 @@ function resolveCompatibleModelSettings(input) {
60844
60918
  topP = undefined;
60845
60919
  }
60846
60920
  let maxTokens = input.desired.maxTokens;
60847
- 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) {
60848
60922
  changes.push({
60849
60923
  field: "maxTokens",
60850
60924
  from: String(maxTokens),
@@ -62750,7 +62824,7 @@ function looksLikeFilePath(path6) {
62750
62824
  }
62751
62825
  function resolveSkillPathReferences(content, basePath) {
62752
62826
  const normalizedBase = basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
62753
- 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) => {
62754
62828
  if (!looksLikeFilePath(relativePath))
62755
62829
  return match;
62756
62830
  const resolvedPath = resolve6(normalizedBase, relativePath);
@@ -62999,7 +63073,7 @@ function expandEnvVars(value, options = {}) {
62999
63073
  });
63000
63074
  }
63001
63075
  function expandEnvVarsInObject(obj, options = {}) {
63002
- if (obj === null || obj === undefined)
63076
+ if (obj == null)
63003
63077
  return obj;
63004
63078
  if (typeof obj === "string")
63005
63079
  return expandEnvVars(obj, options);
@@ -63072,7 +63146,7 @@ function resolvePluginPath(path6, pluginRoot) {
63072
63146
  return path6.replace(CLAUDE_PLUGIN_ROOT_VAR, pluginRoot);
63073
63147
  }
63074
63148
  function resolvePluginPaths(obj, pluginRoot) {
63075
- if (obj === null || obj === undefined)
63149
+ if (obj == null)
63076
63150
  return obj;
63077
63151
  if (typeof obj === "string") {
63078
63152
  return resolvePluginPath(obj, pluginRoot);
@@ -65786,7 +65860,7 @@ async function prependThinkingPartAsync(client, sessionID, messageID, deps = thi
65786
65860
  }
65787
65861
  }
65788
65862
  // src/hooks/session-recovery/storage/thinking-strip.ts
65789
- import { existsSync as existsSync30, readdirSync as readdirSync10, readFileSync as readFileSync21, unlinkSync as unlinkSync2 } from "fs";
65863
+ import { existsSync as existsSync30, readdirSync as readdirSync10, readFileSync as readFileSync21, unlinkSync as unlinkSync3 } from "fs";
65790
65864
  import { join as join31 } from "path";
65791
65865
  function stripThinkingParts(messageID) {
65792
65866
  if (isSqliteBackend()) {
@@ -65805,7 +65879,7 @@ function stripThinkingParts(messageID) {
65805
65879
  const content = readFileSync21(filePath, "utf-8");
65806
65880
  const part = JSON.parse(content);
65807
65881
  if (THINKING_TYPES.has(part.type)) {
65808
- unlinkSync2(filePath);
65882
+ unlinkSync3(filePath);
65809
65883
  anyRemoved = true;
65810
65884
  }
65811
65885
  } catch {
@@ -80422,7 +80496,7 @@ import {
80422
80496
  existsSync as existsSync35,
80423
80497
  mkdirSync as mkdirSync9,
80424
80498
  readFileSync as readFileSync22,
80425
- unlinkSync as unlinkSync3,
80499
+ unlinkSync as unlinkSync4,
80426
80500
  writeFileSync as writeFileSync9
80427
80501
  } from "fs";
80428
80502
  import { join as join37 } from "path";
@@ -80454,7 +80528,7 @@ function createInjectedPathsStorage(storageDir) {
80454
80528
  const clearInjectedPaths = (sessionID) => {
80455
80529
  const filePath = getStoragePath(sessionID);
80456
80530
  if (existsSync35(filePath)) {
80457
- unlinkSync3(filePath);
80531
+ unlinkSync4(filePath);
80458
80532
  }
80459
80533
  };
80460
80534
  return {
@@ -80527,7 +80601,6 @@ function createDirectoryAgentsInjectorHook(ctx, modelCacheState) {
80527
80601
  return;
80528
80602
  }
80529
80603
  };
80530
- const toolExecuteBefore = async (input, output) => {};
80531
80604
  const eventHandler = async ({ event }) => {
80532
80605
  const props = event.properties;
80533
80606
  if (event.type === "session.deleted") {
@@ -80546,7 +80619,6 @@ function createDirectoryAgentsInjectorHook(ctx, modelCacheState) {
80546
80619
  }
80547
80620
  };
80548
80621
  return {
80549
- "tool.execute.before": toolExecuteBefore,
80550
80622
  "tool.execute.after": toolExecuteAfter,
80551
80623
  event: eventHandler
80552
80624
  };
@@ -80655,7 +80727,6 @@ function createDirectoryReadmeInjectorHook(ctx, modelCacheState) {
80655
80727
  return;
80656
80728
  }
80657
80729
  };
80658
- const toolExecuteBefore = async (input, output) => {};
80659
80730
  const eventHandler = async ({ event }) => {
80660
80731
  const props = event.properties;
80661
80732
  if (event.type === "session.deleted") {
@@ -80674,7 +80745,6 @@ function createDirectoryReadmeInjectorHook(ctx, modelCacheState) {
80674
80745
  }
80675
80746
  };
80676
80747
  return {
80677
- "tool.execute.before": toolExecuteBefore,
80678
80748
  "tool.execute.after": toolExecuteAfter,
80679
80749
  event: eventHandler
80680
80750
  };
@@ -82697,7 +82767,12 @@ function getNextReachableFallback(sessionID, state3) {
82697
82767
  return {
82698
82768
  providerID,
82699
82769
  modelID,
82700
- 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
82701
82776
  };
82702
82777
  }
82703
82778
  return null;
@@ -83186,7 +83261,7 @@ ${USER_PROMPT_SUBMIT_TAG_CLOSE}`);
83186
83261
 
83187
83262
  // src/hooks/claude-code-hooks/transcript.ts
83188
83263
  import { join as join45 } from "path";
83189
- import { mkdirSync as mkdirSync10, appendFileSync as appendFileSync5, existsSync as existsSync42, writeFileSync as writeFileSync11, unlinkSync as unlinkSync4 } from "fs";
83264
+ import { mkdirSync as mkdirSync10, appendFileSync as appendFileSync5, existsSync as existsSync42, writeFileSync as writeFileSync11, unlinkSync as unlinkSync5 } from "fs";
83190
83265
  import { tmpdir as tmpdir6 } from "os";
83191
83266
  import { randomUUID } from "crypto";
83192
83267
  var TRANSCRIPT_DIR = join45(getClaudeConfigDir(), "transcripts");
@@ -83212,7 +83287,7 @@ function clearTranscriptCache(sessionId) {
83212
83287
  const entry = transcriptCache.get(sessionId);
83213
83288
  if (entry?.tempPath) {
83214
83289
  try {
83215
- unlinkSync4(entry.tempPath);
83290
+ unlinkSync5(entry.tempPath);
83216
83291
  } catch (error48) {
83217
83292
  log("[transcript] failed to clean up cached temp transcript", { error: error48 });
83218
83293
  }
@@ -83222,7 +83297,7 @@ function clearTranscriptCache(sessionId) {
83222
83297
  for (const [, entry] of transcriptCache) {
83223
83298
  if (entry.tempPath) {
83224
83299
  try {
83225
- unlinkSync4(entry.tempPath);
83300
+ unlinkSync5(entry.tempPath);
83226
83301
  } catch (error48) {
83227
83302
  log("[transcript] failed to clean up cached temp transcript", { error: error48 });
83228
83303
  }
@@ -83293,7 +83368,7 @@ async function buildTranscriptFromSession(client, sessionId, directory, currentT
83293
83368
  baseEntries = Array.isArray(messages) ? parseMessagesToEntries(messages) : [];
83294
83369
  if (cached2?.tempPath) {
83295
83370
  try {
83296
- unlinkSync4(cached2.tempPath);
83371
+ unlinkSync5(cached2.tempPath);
83297
83372
  } catch (error48) {
83298
83373
  log("[transcript] failed to clean up stale temp transcript", { error: error48 });
83299
83374
  }
@@ -83307,7 +83382,7 @@ async function buildTranscriptFromSession(client, sessionId, directory, currentT
83307
83382
  const allEntries = [...baseEntries, buildCurrentEntry(currentToolName, currentToolInput)];
83308
83383
  if (previousTempPath) {
83309
83384
  try {
83310
- unlinkSync4(previousTempPath);
83385
+ unlinkSync5(previousTempPath);
83311
83386
  } catch (error48) {
83312
83387
  log("[transcript] failed to clean up previous temp transcript", { error: error48 });
83313
83388
  }
@@ -83340,7 +83415,7 @@ function deleteTempTranscript(path6) {
83340
83415
  if (!path6)
83341
83416
  return;
83342
83417
  try {
83343
- unlinkSync4(path6);
83418
+ unlinkSync5(path6);
83344
83419
  } catch (error48) {
83345
83420
  log("[transcript] failed to delete temp transcript", { error: error48 });
83346
83421
  }
@@ -84226,7 +84301,7 @@ import {
84226
84301
  mkdirSync as mkdirSync11,
84227
84302
  readFileSync as readFileSync28,
84228
84303
  writeFileSync as writeFileSync12,
84229
- unlinkSync as unlinkSync5
84304
+ unlinkSync as unlinkSync6
84230
84305
  } from "fs";
84231
84306
  import { join as join48 } from "path";
84232
84307
 
@@ -84289,7 +84364,7 @@ function saveInjectedRules(sessionID, data) {
84289
84364
  function clearInjectedRules(sessionID) {
84290
84365
  const filePath = getStoragePath(sessionID);
84291
84366
  if (existsSync43(filePath)) {
84292
- unlinkSync5(filePath);
84367
+ unlinkSync6(filePath);
84293
84368
  }
84294
84369
  }
84295
84370
 
@@ -85205,7 +85280,7 @@ function migrateLegacyConfigFile(legacyPath) {
85205
85280
  to: canonicalPath,
85206
85281
  archivedLegacyConfig
85207
85282
  });
85208
- return archivedLegacyConfig;
85283
+ return true;
85209
85284
  } catch (error48) {
85210
85285
  log("[migrateLegacyConfigFile] Failed to migrate legacy config file", { legacyPath, error: error48 });
85211
85286
  return false;
@@ -85805,7 +85880,7 @@ import {
85805
85880
  mkdirSync as mkdirSync13,
85806
85881
  readFileSync as readFileSync38,
85807
85882
  writeFileSync as writeFileSync15,
85808
- unlinkSync as unlinkSync8
85883
+ unlinkSync as unlinkSync9
85809
85884
  } from "fs";
85810
85885
  import { join as join61 } from "path";
85811
85886
 
@@ -85880,7 +85955,7 @@ function saveAgentUsageState(state3) {
85880
85955
  function clearAgentUsageState(sessionID) {
85881
85956
  const filePath = getStoragePath2(sessionID);
85882
85957
  if (existsSync56(filePath)) {
85883
- unlinkSync8(filePath);
85958
+ unlinkSync9(filePath);
85884
85959
  }
85885
85960
  }
85886
85961
 
@@ -87140,7 +87215,7 @@ function createNonInteractiveEnvHook(_ctx) {
87140
87215
  if (!isGitCommand) {
87141
87216
  return;
87142
87217
  }
87143
- const shellType = process.platform === "win32" ? "powershell" : "unix";
87218
+ const shellType = detectShellType();
87144
87219
  const envPrefix = buildEnvPrefix(NON_INTERACTIVE_ENV, shellType);
87145
87220
  if (command.trim().startsWith(envPrefix.trim())) {
87146
87221
  return;
@@ -87159,7 +87234,7 @@ import {
87159
87234
  mkdirSync as mkdirSync14,
87160
87235
  readFileSync as readFileSync39,
87161
87236
  writeFileSync as writeFileSync16,
87162
- unlinkSync as unlinkSync9
87237
+ unlinkSync as unlinkSync10
87163
87238
  } from "fs";
87164
87239
  import { join as join63 } from "path";
87165
87240
 
@@ -87210,7 +87285,7 @@ function saveInteractiveBashSessionState(state3) {
87210
87285
  function clearInteractiveBashSessionState(sessionID) {
87211
87286
  const filePath = getStoragePath3(sessionID);
87212
87287
  if (existsSync57(filePath)) {
87213
- unlinkSync9(filePath);
87288
+ unlinkSync10(filePath);
87214
87289
  }
87215
87290
  }
87216
87291
 
@@ -87719,7 +87794,7 @@ var ULTRAWORK_MAX_ITERATIONS = 500;
87719
87794
  var DEFAULT_COMPLETION_PROMISE = "DONE";
87720
87795
  var ULTRAWORK_VERIFICATION_PROMISE = "VERIFIED";
87721
87796
  // src/hooks/ralph-loop/storage.ts
87722
- import { existsSync as existsSync58, readFileSync as readFileSync40, writeFileSync as writeFileSync17, unlinkSync as unlinkSync10, mkdirSync as mkdirSync15 } from "fs";
87797
+ import { existsSync as existsSync58, readFileSync as readFileSync40, writeFileSync as writeFileSync17, unlinkSync as unlinkSync11, mkdirSync as mkdirSync15 } from "fs";
87723
87798
  import { dirname as dirname17, join as join64 } from "path";
87724
87799
  function getStateFilePath(directory, customPath) {
87725
87800
  return customPath ? join64(directory, customPath) : join64(directory, DEFAULT_STATE_FILE);
@@ -87811,7 +87886,7 @@ function clearState(directory, customPath) {
87811
87886
  const filePath = getStateFilePath(directory, customPath);
87812
87887
  try {
87813
87888
  if (existsSync58(filePath)) {
87814
- unlinkSync10(filePath);
87889
+ unlinkSync11(filePath);
87815
87890
  }
87816
87891
  return true;
87817
87892
  } catch {
@@ -95364,8 +95439,8 @@ function clearBoulderState(directory) {
95364
95439
  const filePath = getBoulderFilePath(directory);
95365
95440
  try {
95366
95441
  if (existsSync62(filePath)) {
95367
- const { unlinkSync: unlinkSync11 } = __require("fs");
95368
- unlinkSync11(filePath);
95442
+ const { unlinkSync: unlinkSync12 } = __require("fs");
95443
+ unlinkSync12(filePath);
95369
95444
  }
95370
95445
  return true;
95371
95446
  } catch {
@@ -95885,8 +95960,8 @@ Ask the user which plan to work on.`;
95885
95960
  return `
95886
95961
  ## Plan Not Found
95887
95962
 
95888
- Could not find a plan matching "${explicitPlanName}".
95889
- No incomplete plans available. Create a new plan with: /plan "your task"`;
95963
+ Could not find a plan matching "${explicitPlanName}".
95964
+ No incomplete plans available. Create a new plan using the Prometheus agent.`;
95890
95965
  }
95891
95966
  function buildExplicitPlanContext(params) {
95892
95967
  const { explicitPlanName, existingState, sessionId, timestamp: timestamp2, activeAgent, worktreePath, worktreeBlock, directory } = params;
@@ -95901,8 +95976,8 @@ function buildExplicitPlanContext(params) {
95901
95976
  return `
95902
95977
  ## Plan Already Complete
95903
95978
 
95904
- The requested plan "${getPlanName(matchedPlan)}" has been completed.
95905
- All ${progress.total} tasks are done. Create a new plan with: /plan "your task"`;
95979
+ The requested plan "${getPlanName(matchedPlan)}" has been completed.
95980
+ All ${progress.total} tasks are done. Create a new plan using the Prometheus agent.`;
95906
95981
  }
95907
95982
  if (existingState) {
95908
95983
  clearBoulderState(directory);
@@ -95967,15 +96042,15 @@ function buildPlanDiscoveryContext(params) {
95967
96042
  return contextInfo + `
95968
96043
  ## No Plans Found
95969
96044
 
95970
- No Prometheus plan files found at .sisyphus/plans/
95971
- Use Prometheus to create a work plan first: /plan "your task"`;
96045
+ No Prometheus plan files found in the .sisyphus plans directory.
96046
+ Use the Prometheus agent to create a work plan first.`;
95972
96047
  }
95973
96048
  if (incompletePlans.length === 0) {
95974
96049
  return contextInfo + `
95975
96050
 
95976
96051
  ## All Plans Complete
95977
96052
 
95978
- All ${plans.length} plan(s) are complete. Create a new plan with: /plan "your task"`;
96053
+ All ${plans.length} plan(s) are complete. Create a new plan using the Prometheus agent.`;
95979
96054
  }
95980
96055
  if (incompletePlans.length === 1) {
95981
96056
  return contextInfo + buildAutoSelectedPlanContext({
@@ -96307,7 +96382,7 @@ Assume the work is broken until YOU prove otherwise.
96307
96382
 
96308
96383
  Do NOT run tests yet. Read the code FIRST so you know what you're testing.
96309
96384
 
96310
- 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.
96311
96386
  2. \`Read\` EVERY changed file - no exceptions, no skimming.
96312
96387
  3. For EACH file, critically ask:
96313
96388
  - Does this code ACTUALLY do what the task required? (Re-read the task, compare line by line)
@@ -99035,6 +99110,22 @@ init_logger();
99035
99110
  import * as fs19 from "fs";
99036
99111
  import * as path12 from "path";
99037
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
+ }
99038
99129
  var PARTIAL_STRING_ARRAY_KEYS = new Set([
99039
99130
  "disabled_mcps",
99040
99131
  "disabled_agents",
@@ -99193,11 +99284,24 @@ function loadPluginConfig(directory, ctx) {
99193
99284
  }
99194
99285
  }
99195
99286
  const userConfig = loadConfigFromPath2(userConfigPath, ctx);
99287
+ const userGitMasterOverrides = loadExplicitGitMasterOverrides(userConfigPath);
99196
99288
  let config2 = userConfig ?? OhMyOpenCodeConfigSchema.parse({});
99289
+ const defaultGitMaster = OhMyOpenCodeConfigSchema.parse({}).git_master;
99197
99290
  const projectConfig = loadConfigFromPath2(projectConfigPath, ctx);
99291
+ const projectGitMasterOverrides = loadExplicitGitMasterOverrides(projectConfigPath);
99198
99292
  if (projectConfig) {
99199
99293
  config2 = mergeConfigs(config2, projectConfig);
99200
99294
  }
99295
+ if (userGitMasterOverrides || projectGitMasterOverrides) {
99296
+ config2 = {
99297
+ ...config2,
99298
+ git_master: {
99299
+ ...defaultGitMaster,
99300
+ ...userGitMasterOverrides ?? {},
99301
+ ...projectGitMasterOverrides ?? {}
99302
+ }
99303
+ };
99304
+ }
99201
99305
  config2 = {
99202
99306
  ...config2,
99203
99307
  mcp_env_allowlist: userConfig?.mcp_env_allowlist ?? []
@@ -102095,6 +102199,8 @@ function createAnthropicEffortHook() {
102095
102199
  return;
102096
102200
  if (!isClaudeProvider(model.providerID, model.modelID))
102097
102201
  return;
102202
+ if (model.providerID === "github-copilot")
102203
+ return;
102098
102204
  if (shouldSkipForInternalAgent(agent?.name))
102099
102205
  return;
102100
102206
  if (output.options.effort !== undefined)
@@ -117695,7 +117801,7 @@ Skills and commands provide specialized knowledge and step-by-step guidance.
117695
117801
  Use this when a task matches an available skill's or command's description.
117696
117802
 
117697
117803
  **How to use:**
117698
- - Call with a skill name: name='code-review'
117804
+ - Call with a skill name: name='review-work'
117699
117805
  - Call with a command name (without leading slash): name='publish'
117700
117806
  - The tool will return detailed instructions with your context applied.
117701
117807
  `;
@@ -118105,7 +118211,7 @@ function createSkillTool(options = {}) {
118105
118211
  return cachedDescription ?? TOOL_DESCRIPTION_PREFIX;
118106
118212
  },
118107
118213
  args: {
118108
- name: tool.schema.string().describe("The skill or command name (e.g., 'code-review' or 'publish'). Use without leading slash for commands."),
118214
+ name: tool.schema.string().describe("The skill or command name (e.g., 'review-work' or 'publish'). Use without leading slash for commands."),
118109
118215
  user_message: tool.schema.string().optional().describe("Optional arguments or context for command invocation. Example: name='publish', user_message='patch'")
118110
118216
  },
118111
118217
  async execute(args, ctx) {
@@ -118115,6 +118221,14 @@ function createSkillTool(options = {}) {
118115
118221
  const requestedName = args.name.replace(/^\//, "");
118116
118222
  const matchedSkill = matchSkillByName(skills2, requestedName);
118117
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
+ });
118118
118232
  if (matchedSkill.definition.agent && (!ctx?.agent || matchedSkill.definition.agent !== ctx.agent)) {
118119
118233
  throw new Error(`Skill "${matchedSkill.name}" is restricted to agent "${matchedSkill.definition.agent}"`);
118120
118234
  }
@@ -120699,7 +120813,7 @@ async function resolveMultimodalLookerAgentMetadata(ctx) {
120699
120813
 
120700
120814
  // src/tools/look-at/image-converter.ts
120701
120815
  import * as childProcess from "child_process";
120702
- import { existsSync as existsSync81, mkdtempSync, readFileSync as readFileSync54, rmSync as rmSync4, unlinkSync as unlinkSync11, writeFileSync as writeFileSync20 } from "fs";
120816
+ import { existsSync as existsSync81, mkdtempSync, readFileSync as readFileSync54, rmSync as rmSync4, unlinkSync as unlinkSync12, writeFileSync as writeFileSync20 } from "fs";
120703
120817
  import { tmpdir as tmpdir7 } from "os";
120704
120818
  import { dirname as dirname28, join as join86 } from "path";
120705
120819
  var SUPPORTED_FORMATS = new Set([
@@ -120782,7 +120896,7 @@ function convertImageToJpeg(inputPath, mimeType) {
120782
120896
  } catch (error92) {
120783
120897
  try {
120784
120898
  if (existsSync81(outputPath)) {
120785
- unlinkSync11(outputPath);
120899
+ unlinkSync12(outputPath);
120786
120900
  }
120787
120901
  } catch {}
120788
120902
  if (error92 instanceof Error) {
@@ -120796,7 +120910,7 @@ function cleanupConvertedImage(filePath) {
120796
120910
  try {
120797
120911
  const tempDirectory = dirname28(filePath);
120798
120912
  if (existsSync81(filePath)) {
120799
- unlinkSync11(filePath);
120913
+ unlinkSync12(filePath);
120800
120914
  log(`[image-converter] Cleaned up temporary file: ${filePath}`);
120801
120915
  }
120802
120916
  if (existsSync81(tempDirectory)) {
@@ -120827,7 +120941,7 @@ function convertBase64ImageToJpeg(base64Data, mimeType) {
120827
120941
  tempFiles.forEach((file3) => {
120828
120942
  try {
120829
120943
  if (existsSync81(file3))
120830
- unlinkSync11(file3);
120944
+ unlinkSync12(file3);
120831
120945
  } catch {}
120832
120946
  });
120833
120947
  throw error92;
@@ -121416,6 +121530,11 @@ function abortSyncSession(client2, sessionID, reason) {
121416
121530
  log("[task] Failed to abort sync session", { sessionID, reason, error: String(error92) });
121417
121531
  });
121418
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
+ }
121419
121538
  function isSessionComplete(messages) {
121420
121539
  let lastUser;
121421
121540
  let lastAssistant;
@@ -121451,6 +121570,19 @@ async function pollSyncSession(ctx, client2, input, timeoutMs) {
121451
121570
  log("[task] Starting poll loop", { sessionID: input.sessionID, agentToUse: input.agentToUse, maxTurns });
121452
121571
  while (Date.now() - pollStart < maxPollTimeMs) {
121453
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
+ }
121454
121586
  log("[task] Aborted by user", { sessionID: input.sessionID });
121455
121587
  abortSyncSession(client2, input.sessionID, "parent_abort");
121456
121588
  if (input.toastManager && input.taskId)
@@ -121481,23 +121613,21 @@ Session ID: ${input.sessionID}`;
121481
121613
  if (sessionStatus && sessionStatus.type !== "idle") {
121482
121614
  continue;
121483
121615
  }
121484
- let messagesResult;
121616
+ let messages;
121485
121617
  try {
121486
- messagesResult = await client2.session.messages({ path: { id: input.sessionID } });
121618
+ messages = await fetchSessionMessages(client2, input.sessionID);
121487
121619
  } catch (error92) {
121488
121620
  log("[task] Poll messages fetch failed, retrying", { sessionID: input.sessionID, error: String(error92) });
121489
121621
  continue;
121490
121622
  }
121491
- const rawData = messagesResult?.data ?? messagesResult;
121492
- const msgs = Array.isArray(rawData) ? rawData : [];
121493
- if (input.anchorMessageCount !== undefined && msgs.length <= input.anchorMessageCount) {
121623
+ if (input.anchorMessageCount !== undefined && messages.length <= input.anchorMessageCount) {
121494
121624
  continue;
121495
121625
  }
121496
- if (isSessionComplete(msgs)) {
121626
+ if (isSessionComplete(messages)) {
121497
121627
  log("[task] Poll complete - terminal finish detected", { sessionID: input.sessionID, pollCount });
121498
121628
  break;
121499
121629
  }
121500
- const lastAssistant = [...msgs].reverse().find((m) => m.info?.role === "assistant");
121630
+ const lastAssistant = [...messages].reverse().find((m) => m.info?.role === "assistant");
121501
121631
  if (lastAssistant?.info?.id && lastAssistant.info.id !== lastSeenAssistantId) {
121502
121632
  lastSeenAssistantId = lastAssistant.info.id;
121503
121633
  assistantTurnCount++;
@@ -121513,7 +121643,7 @@ Session ID: ${input.sessionID}`;
121513
121643
  return `Task aborted: subagent exceeded ${maxTurns} assistant turns without completing. This usually indicates an infinite tool-call loop. Session ID: ${input.sessionID}`;
121514
121644
  }
121515
121645
  }
121516
- const hasAssistantText = msgs.some((m) => {
121646
+ const hasAssistantText = messages.some((m) => {
121517
121647
  if (m.info?.role !== "assistant")
121518
121648
  return false;
121519
121649
  const parts = m.parts ?? [];
@@ -122196,6 +122326,58 @@ var syncTaskDeps = {
122196
122326
  fetchSyncResult
122197
122327
  };
122198
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
+
122199
122381
  // src/tools/delegate-task/sync-task.ts
122200
122382
  async function executeSyncTask(args, ctx, executorCtx, parentContext, agentToUse, categoryModel, systemContent, modelInfo, fallbackChain, deps = syncTaskDeps) {
122201
122383
  const { manager, client: client2, directory, onSyncSessionCreated, syncPollTimeoutMs } = executorCtx;
@@ -122286,18 +122468,41 @@ async function executeSyncTask(args, ctx, executorCtx, parentContext, agentToUse
122286
122468
  if (callID) {
122287
122469
  storeToolMetadata(ctx.sessionID, callID, syncTaskMeta);
122288
122470
  }
122289
- const promptError = await deps.sendSyncPrompt(client2, {
122471
+ let effectiveCategoryModel = categoryModel;
122472
+ let promptError = await deps.sendSyncPrompt(client2, {
122290
122473
  sessionID,
122291
122474
  agentToUse,
122292
122475
  args,
122293
122476
  systemContent,
122294
- categoryModel,
122477
+ categoryModel: effectiveCategoryModel,
122295
122478
  toastManager,
122296
122479
  taskId,
122297
122480
  sisyphusAgentConfig: executorCtx.sisyphusAgentConfig
122298
122481
  });
122299
122482
  if (promptError) {
122300
- return promptError;
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
+ }
122301
122506
  }
122302
122507
  try {
122303
122508
  const pollError = await deps.pollSyncSession(ctx, client2, {
@@ -122314,7 +122519,7 @@ async function executeSyncTask(args, ctx, executorCtx, parentContext, agentToUse
122314
122519
  return result.error;
122315
122520
  }
122316
122521
  const duration5 = formatDuration2(startTime);
122317
- const actualModelStr = categoryModel ? `${categoryModel.providerID}/${categoryModel.modelID}` : undefined;
122522
+ const actualModelStr = effectiveCategoryModel ? `${effectiveCategoryModel.providerID}/${effectiveCategoryModel.modelID}` : undefined;
122318
122523
  const parentModelStr = parentContext.model ? `${parentContext.model.providerID}/${parentContext.model.modelID}` : undefined;
122319
122524
  const modelRoutingNote = actualModelStr && parentModelStr && actualModelStr !== parentModelStr ? `
122320
122525
  \u26A0\uFE0F Model routing: parent used ${parentModelStr}, this subagent used ${actualModelStr} (via category: ${args.category ?? "unknown"})` : actualModelStr ? `
@@ -122801,8 +123006,8 @@ Available categories: ${categoryNames.join(", ")}`
122801
123006
  }
122802
123007
  // src/tools/delegate-task/subagent-resolver.ts
122803
123008
  init_constants();
122804
- init_agent_display_names();
122805
- init_logger();
123009
+
123010
+ // src/tools/delegate-task/delegated-model-config.ts
122806
123011
  function applyCategoryParams2(base, config4) {
122807
123012
  if (!config4) {
122808
123013
  return base;
@@ -122816,12 +123021,171 @@ function applyCategoryParams2(base, config4) {
122816
123021
  ...config4.thinking !== undefined ? { thinking: config4.thinking } : {}
122817
123022
  };
122818
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();
122819
123183
  async function resolveSubagentExecution(args, executorCtx, parentAgent, categoryExamples) {
122820
123184
  const { client: client2, agentOverrides, userCategories } = executorCtx;
122821
123185
  if (!args.subagent_type?.trim()) {
122822
123186
  return { agentToUse: "", categoryModel: undefined, error: `Agent name cannot be empty.` };
122823
123187
  }
122824
- const agentName = args.subagent_type.trim().replace(/^[\\\/"']+|[\\\/"']+$/g, "").trim();
123188
+ const agentName = sanitizeSubagentType(args.subagent_type);
122825
123189
  if (agentName.toLowerCase() === SISYPHUS_JUNIOR_AGENT2.toLowerCase()) {
122826
123190
  return {
122827
123191
  agentToUse: "",
@@ -122848,19 +123212,21 @@ Create the work plan directly - that's your job as the planning agent.`
122848
123212
  const agents = normalizeSDKResponse(agentsResult, [], {
122849
123213
  preferResponseOnMissingData: true
122850
123214
  });
122851
- const callableAgents = agents.filter((agent) => isTaskCallableAgentMode(agent.mode));
122852
- const resolvedDisplayName = stripAgentListSortPrefix(getAgentDisplayName(agentToUse));
122853
- const normalizedAgentToUse = stripAgentListSortPrefix(agentToUse);
122854
- const matchedAgent = callableAgents.find((agent) => {
122855
- const normalizedListedAgentName = stripAgentListSortPrefix(agent.name);
122856
- return normalizedListedAgentName.toLowerCase() === normalizedAgentToUse.toLowerCase() || normalizedListedAgentName.toLowerCase() === resolvedDisplayName.toLowerCase();
122857
- });
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);
122858
123225
  if (!matchedAgent) {
122859
- const availableAgents = callableAgents.map((a) => stripAgentListSortPrefix(a.name)).sort().join(", ");
122860
123226
  return {
122861
123227
  agentToUse: "",
122862
123228
  categoryModel: undefined,
122863
- error: `Unknown agent: "${agentToUse}". Available agents: ${availableAgents}`
123229
+ error: `Unknown agent: "${agentToUse}". Available agents: ${listCallableAgentNames(mergedAgents)}`
122864
123230
  };
122865
123231
  }
122866
123232
  agentToUse = stripAgentListSortPrefix(matchedAgent.name);
@@ -122905,19 +123271,17 @@ Create the work plan directly - that's your job as the planning agent.`
122905
123271
  const defaultProviderID = categoryModel?.providerID ?? normalizedMatchedModel?.providerID ?? "opencode";
122906
123272
  const configuredFallbackChain = buildFallbackChainFromModels(normalizedAgentFallbackModels, defaultProviderID);
122907
123273
  fallbackChain = configuredFallbackChain ?? (resolutionSkipped ? undefined : agentRequirement?.fallbackChain);
122908
- const resolvedFallbackEntry = resolution && !("skipped" in resolution) ? resolution.fallbackEntry : undefined;
122909
- const matchedFallback = resolution && !("skipped" in resolution) ? resolution.matchedFallback === true : false;
122910
- const effectiveEntry = matchedFallback && categoryModel ? resolvedFallbackEntry ?? (configuredFallbackChain ? findMostSpecificFallbackEntry(categoryModel.providerID, categoryModel.modelID, configuredFallbackChain) : undefined) : undefined;
123274
+ const effectiveEntry = resolveEffectiveFallbackEntry({
123275
+ categoryModel,
123276
+ configuredFallbackChain,
123277
+ resolution
123278
+ });
122911
123279
  if (categoryModel && effectiveEntry) {
122912
- categoryModel = {
122913
- ...categoryModel,
122914
- variant: agentOverride?.variant ?? effectiveEntry.variant ?? categoryModel.variant,
122915
- reasoningEffort: effectiveEntry.reasoningEffort ?? categoryModel.reasoningEffort,
122916
- temperature: effectiveEntry.temperature ?? categoryModel.temperature,
122917
- top_p: effectiveEntry.top_p ?? categoryModel.top_p,
122918
- maxTokens: effectiveEntry.maxTokens ?? categoryModel.maxTokens,
122919
- thinking: effectiveEntry.thinking ?? categoryModel.thinking
122920
- };
123280
+ categoryModel = applyFallbackEntrySettings({
123281
+ categoryModel,
123282
+ effectiveEntry,
123283
+ variantOverride: agentOverride?.variant
123284
+ });
122921
123285
  }
122922
123286
  }
122923
123287
  if (!categoryModel && matchedAgent.model) {
@@ -122949,9 +123313,6 @@ Create the work plan directly - that's your job as the planning agent.`
122949
123313
  }
122950
123314
  return { agentToUse, categoryModel, fallbackChain };
122951
123315
  }
122952
- function isTaskCallableAgentMode(mode) {
122953
- return mode === "all" || mode === "subagent";
122954
- }
122955
123316
  // src/tools/delegate-task/tools.ts
122956
123317
  function createDelegateTask(options) {
122957
123318
  const { userCategories } = options;
@@ -123165,7 +123526,7 @@ function createDelegateTask(options) {
123165
123526
  // src/tools/delegate-task/index.ts
123166
123527
  init_constants();
123167
123528
  // src/tools/task/task-create.ts
123168
- import { join as join88 } from "path";
123529
+ import { join as join89 } from "path";
123169
123530
 
123170
123531
  // src/tools/task/types.ts
123171
123532
  var TaskStatusSchema = exports_external.enum(["pending", "in_progress", "completed", "deleted"]);
@@ -123219,18 +123580,18 @@ var TaskDeleteInputSchema = exports_external.object({
123219
123580
  });
123220
123581
 
123221
123582
  // src/features/claude-tasks/storage.ts
123222
- import { join as join87, dirname as dirname29, basename as basename13, isAbsolute as isAbsolute11 } from "path";
123223
- import { existsSync as existsSync82, mkdirSync as mkdirSync17, readFileSync as readFileSync55, writeFileSync as writeFileSync21, renameSync as renameSync5, unlinkSync as unlinkSync12, readdirSync as readdirSync22 } from "fs";
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";
123224
123585
  import { randomUUID as randomUUID3 } from "crypto";
123225
123586
  function getTaskDir(config4 = {}) {
123226
123587
  const tasksConfig = config4.sisyphus?.tasks;
123227
123588
  const storagePath = tasksConfig?.storage_path;
123228
123589
  if (storagePath) {
123229
- return isAbsolute11(storagePath) ? storagePath : join87(process.cwd(), storagePath);
123590
+ return isAbsolute11(storagePath) ? storagePath : join88(process.cwd(), storagePath);
123230
123591
  }
123231
123592
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
123232
123593
  const listId = resolveTaskListId(config4);
123233
- return join87(configDir, "tasks", listId);
123594
+ return join88(configDir, "tasks", listId);
123234
123595
  }
123235
123596
  function sanitizePathSegment(value) {
123236
123597
  return value.replace(/[^a-zA-Z0-9_-]/g, "-") || "default";
@@ -123245,19 +123606,19 @@ function resolveTaskListId(config4 = {}) {
123245
123606
  const configId = config4.sisyphus?.tasks?.task_list_id?.trim();
123246
123607
  if (configId)
123247
123608
  return sanitizePathSegment(configId);
123248
- return sanitizePathSegment(basename13(process.cwd()));
123609
+ return sanitizePathSegment(basename14(process.cwd()));
123249
123610
  }
123250
123611
  function ensureDir(dirPath) {
123251
- if (!existsSync82(dirPath)) {
123612
+ if (!existsSync83(dirPath)) {
123252
123613
  mkdirSync17(dirPath, { recursive: true });
123253
123614
  }
123254
123615
  }
123255
123616
  function readJsonSafe(filePath, schema2) {
123256
123617
  try {
123257
- if (!existsSync82(filePath)) {
123618
+ if (!existsSync83(filePath)) {
123258
123619
  return null;
123259
123620
  }
123260
- const content = readFileSync55(filePath, "utf-8");
123621
+ const content = readFileSync56(filePath, "utf-8");
123261
123622
  const parsed = JSON.parse(content);
123262
123623
  const result = schema2.safeParse(parsed);
123263
123624
  if (!result.success) {
@@ -123277,8 +123638,8 @@ function writeJsonAtomic(filePath, data) {
123277
123638
  renameSync5(tempPath, filePath);
123278
123639
  } catch (error92) {
123279
123640
  try {
123280
- if (existsSync82(tempPath)) {
123281
- unlinkSync12(tempPath);
123641
+ if (existsSync83(tempPath)) {
123642
+ unlinkSync13(tempPath);
123282
123643
  }
123283
123644
  } catch {}
123284
123645
  throw error92;
@@ -123289,7 +123650,7 @@ function generateTaskId() {
123289
123650
  return `T-${randomUUID3()}`;
123290
123651
  }
123291
123652
  function acquireLock(dirPath) {
123292
- const lockPath = join87(dirPath, ".lock");
123653
+ const lockPath = join88(dirPath, ".lock");
123293
123654
  const lockId = randomUUID3();
123294
123655
  const createLock = (timestamp2) => {
123295
123656
  writeFileSync21(lockPath, JSON.stringify({ id: lockId, timestamp: timestamp2 }), {
@@ -123299,7 +123660,7 @@ function acquireLock(dirPath) {
123299
123660
  };
123300
123661
  const isStale = () => {
123301
123662
  try {
123302
- const lockContent = readFileSync55(lockPath, "utf-8");
123663
+ const lockContent = readFileSync56(lockPath, "utf-8");
123303
123664
  const lockData = JSON.parse(lockContent);
123304
123665
  const lockAge = Date.now() - lockData.timestamp;
123305
123666
  return lockAge > STALE_LOCK_THRESHOLD_MS;
@@ -123323,7 +123684,7 @@ function acquireLock(dirPath) {
123323
123684
  let acquired = tryAcquire();
123324
123685
  if (!acquired && isStale()) {
123325
123686
  try {
123326
- unlinkSync12(lockPath);
123687
+ unlinkSync13(lockPath);
123327
123688
  } catch {}
123328
123689
  acquired = tryAcquire();
123329
123690
  }
@@ -123337,13 +123698,13 @@ function acquireLock(dirPath) {
123337
123698
  acquired: true,
123338
123699
  release: () => {
123339
123700
  try {
123340
- if (!existsSync82(lockPath))
123701
+ if (!existsSync83(lockPath))
123341
123702
  return;
123342
- const lockContent = readFileSync55(lockPath, "utf-8");
123703
+ const lockContent = readFileSync56(lockPath, "utf-8");
123343
123704
  const lockData = JSON.parse(lockContent);
123344
123705
  if (lockData.id !== lockId)
123345
123706
  return;
123346
- unlinkSync12(lockPath);
123707
+ unlinkSync13(lockPath);
123347
123708
  } catch {}
123348
123709
  }
123349
123710
  };
@@ -123394,8 +123755,8 @@ function syncTaskToTodo(task) {
123394
123755
  }
123395
123756
  async function resolveTodoWriter2() {
123396
123757
  try {
123397
- const loader4 = "opencode/session/todo";
123398
- const mod = await import(loader4);
123758
+ const loader5 = "opencode/session/todo";
123759
+ const mod = await import(loader5);
123399
123760
  const update = mod.Todo?.update;
123400
123761
  if (typeof update === "function") {
123401
123762
  return update;
@@ -123502,7 +123863,7 @@ async function handleCreate(args, config4, ctx, context) {
123502
123863
  threadID: context.sessionID
123503
123864
  };
123504
123865
  const validatedTask = TaskObjectSchema.parse(task);
123505
- writeJsonAtomic(join88(taskDir, `${taskId}.json`), validatedTask);
123866
+ writeJsonAtomic(join89(taskDir, `${taskId}.json`), validatedTask);
123506
123867
  await syncTaskTodoUpdate(ctx, validatedTask, context.sessionID);
123507
123868
  return JSON.stringify({
123508
123869
  task: {
@@ -123524,7 +123885,7 @@ async function handleCreate(args, config4, ctx, context) {
123524
123885
  }
123525
123886
  }
123526
123887
  // src/tools/task/task-get.ts
123527
- import { join as join89 } from "path";
123888
+ import { join as join90 } from "path";
123528
123889
  var TASK_ID_PATTERN = /^T-[A-Za-z0-9-]+$/;
123529
123890
  function parseTaskId(id) {
123530
123891
  if (!TASK_ID_PATTERN.test(id))
@@ -123549,7 +123910,7 @@ Returns null if the task does not exist or the file is invalid.`,
123549
123910
  return JSON.stringify({ error: "invalid_task_id" });
123550
123911
  }
123551
123912
  const taskDir = getTaskDir(config4);
123552
- const taskPath = join89(taskDir, `${taskId}.json`);
123913
+ const taskPath = join90(taskDir, `${taskId}.json`);
123553
123914
  const task = readJsonSafe(taskPath, TaskObjectSchema);
123554
123915
  return JSON.stringify({ task: task ?? null });
123555
123916
  } catch (error92) {
@@ -123562,8 +123923,8 @@ Returns null if the task does not exist or the file is invalid.`,
123562
123923
  });
123563
123924
  }
123564
123925
  // src/tools/task/task-list.ts
123565
- import { join as join90 } from "path";
123566
- import { existsSync as existsSync83, readdirSync as readdirSync23 } from "fs";
123926
+ import { join as join91 } from "path";
123927
+ import { existsSync as existsSync84, readdirSync as readdirSync24 } from "fs";
123567
123928
  function createTaskList(config4) {
123568
123929
  return tool({
123569
123930
  description: `List all active tasks with summary information.
@@ -123574,16 +123935,16 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
123574
123935
  args: {},
123575
123936
  execute: async () => {
123576
123937
  const taskDir = getTaskDir(config4);
123577
- if (!existsSync83(taskDir)) {
123938
+ if (!existsSync84(taskDir)) {
123578
123939
  return JSON.stringify({ tasks: [] });
123579
123940
  }
123580
- const files = readdirSync23(taskDir).filter((f) => f.endsWith(".json") && f.startsWith("T-")).map((f) => f.replace(".json", ""));
123941
+ const files = readdirSync24(taskDir).filter((f) => f.endsWith(".json") && f.startsWith("T-")).map((f) => f.replace(".json", ""));
123581
123942
  if (files.length === 0) {
123582
123943
  return JSON.stringify({ tasks: [] });
123583
123944
  }
123584
123945
  const allTasks = [];
123585
123946
  for (const fileId of files) {
123586
- const task = readJsonSafe(join90(taskDir, `${fileId}.json`), TaskObjectSchema);
123947
+ const task = readJsonSafe(join91(taskDir, `${fileId}.json`), TaskObjectSchema);
123587
123948
  if (task) {
123588
123949
  allTasks.push(task);
123589
123950
  }
@@ -123611,7 +123972,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
123611
123972
  });
123612
123973
  }
123613
123974
  // src/tools/task/task-update.ts
123614
- import { join as join91 } from "path";
123975
+ import { join as join92 } from "path";
123615
123976
  var TASK_ID_PATTERN2 = /^T-[A-Za-z0-9-]+$/;
123616
123977
  function parseTaskId2(id) {
123617
123978
  if (!TASK_ID_PATTERN2.test(id))
@@ -123659,7 +124020,7 @@ async function handleUpdate(args, config4, ctx, context) {
123659
124020
  return JSON.stringify({ error: "task_lock_unavailable" });
123660
124021
  }
123661
124022
  try {
123662
- const taskPath = join91(taskDir, `${taskId}.json`);
124023
+ const taskPath = join92(taskDir, `${taskId}.json`);
123663
124024
  const task = readJsonSafe(taskPath, TaskObjectSchema);
123664
124025
  if (!task) {
123665
124026
  return JSON.stringify({ error: "task_not_found" });
@@ -126405,8 +126766,8 @@ function unregisterManagerForCleanup(manager) {
126405
126766
  }
126406
126767
 
126407
126768
  // src/features/background-agent/compaction-aware-message-resolver.ts
126408
- import { readdirSync as readdirSync24, readFileSync as readFileSync56 } from "fs";
126409
- import { join as join92 } from "path";
126769
+ import { readdirSync as readdirSync25, readFileSync as readFileSync57 } from "fs";
126770
+ import { join as join93 } from "path";
126410
126771
  function hasFullAgentAndModel(message) {
126411
126772
  return !!message.agent && !isCompactionAgent(message.agent) && !!message.model?.providerID && !!message.model?.modelID;
126412
126773
  }
@@ -126481,11 +126842,11 @@ function resolvePromptContextFromSessionMessages(messages, sessionID) {
126481
126842
  }
126482
126843
  function findNearestMessageExcludingCompaction(messageDir, sessionID) {
126483
126844
  try {
126484
- const files = readdirSync24(messageDir).filter((name) => name.endsWith(".json")).sort().reverse();
126845
+ const files = readdirSync25(messageDir).filter((name) => name.endsWith(".json")).sort().reverse();
126485
126846
  const messages = [];
126486
126847
  for (const file3 of files) {
126487
126848
  try {
126488
- const content = readFileSync56(join92(messageDir, file3), "utf-8");
126849
+ const content = readFileSync57(join93(messageDir, file3), "utf-8");
126489
126850
  const parsed = JSON.parse(content);
126490
126851
  if (hasCompactionPartInStorage(parsed.id) || isCompactionAgent(parsed.agent)) {
126491
126852
  continue;
@@ -126575,7 +126936,7 @@ function handleSessionIdleBackgroundEvent(args) {
126575
126936
  }
126576
126937
 
126577
126938
  // src/features/background-agent/manager.ts
126578
- import { join as join93 } from "path";
126939
+ import { join as join94 } from "path";
126579
126940
 
126580
126941
  // src/features/background-agent/task-poller.ts
126581
126942
  init_plugin_identity();
@@ -126615,9 +126976,12 @@ function isSessionNotFoundError(error92) {
126615
126976
  }
126616
126977
  return message.includes("not found") || message.includes("missing");
126617
126978
  }
126618
- async function verifySessionExists(client2, sessionID) {
126979
+ async function verifySessionExists(client2, sessionID, directory) {
126619
126980
  try {
126620
- const response = await client2.session.get({ path: { id: sessionID } });
126981
+ const response = await client2.session.get({
126982
+ path: { id: sessionID },
126983
+ ...directory ? { query: { directory } } : {}
126984
+ });
126621
126985
  if (response.error !== undefined && response.error !== null) {
126622
126986
  return !isSessionNotFoundError(response.error);
126623
126987
  }
@@ -126707,6 +127071,7 @@ async function checkAndInterruptStaleTasks(args) {
126707
127071
  const {
126708
127072
  tasks,
126709
127073
  client: client2,
127074
+ directory,
126710
127075
  config: config4,
126711
127076
  concurrencyManager,
126712
127077
  notifyParentSession,
@@ -126743,7 +127108,7 @@ async function checkAndInterruptStaleTasks(args) {
126743
127108
  const effectiveTimeout = sessionGone ? sessionGoneTimeoutMs : messageStalenessMs;
126744
127109
  if (runtime <= effectiveTimeout)
126745
127110
  continue;
126746
- if (sessionGone && await verifySessionExists(client2, sessionID)) {
127111
+ if (sessionGone && await verifySessionExists(client2, sessionID, directory)) {
126747
127112
  task.consecutiveMissedPolls = 0;
126748
127113
  continue;
126749
127114
  }
@@ -126776,7 +127141,7 @@ async function checkAndInterruptStaleTasks(args) {
126776
127141
  continue;
126777
127142
  if (task.status !== "running")
126778
127143
  continue;
126779
- if (sessionGone && await verifySessionExists(client2, sessionID)) {
127144
+ if (sessionGone && await verifySessionExists(client2, sessionID, directory)) {
126780
127145
  task.consecutiveMissedPolls = 0;
126781
127146
  continue;
126782
127147
  }
@@ -126812,7 +127177,7 @@ function resolveCircuitBreakerSettings(config4) {
126812
127177
  };
126813
127178
  }
126814
127179
  function recordToolCall(window, toolName, settings, toolInput) {
126815
- if (toolInput === undefined || toolInput === null) {
127180
+ if (toolInput == null) {
126816
127181
  return {
126817
127182
  lastSignature: `${toolName}::__unknown-input__`,
126818
127183
  consecutiveCount: 1,
@@ -126834,7 +127199,7 @@ function recordToolCall(window, toolName, settings, toolInput) {
126834
127199
  };
126835
127200
  }
126836
127201
  function sortObject2(obj) {
126837
- if (obj === null || obj === undefined)
127202
+ if (obj == null)
126838
127203
  return obj;
126839
127204
  if (typeof obj !== "object")
126840
127205
  return obj;
@@ -126848,7 +127213,7 @@ function sortObject2(obj) {
126848
127213
  return sorted;
126849
127214
  }
126850
127215
  function createToolCallSignature(toolName, toolInput) {
126851
- if (toolInput === undefined || toolInput === null) {
127216
+ if (toolInput == null) {
126852
127217
  return toolName;
126853
127218
  }
126854
127219
  if (Object.keys(toolInput).length === 0) {
@@ -126876,7 +127241,7 @@ function getMaxSubagentDepth(config4) {
126876
127241
  function getMaxRootSessionSpawnBudget(config4) {
126877
127242
  return config4?.maxDescendants ?? DEFAULT_MAX_ROOT_SESSION_SPAWN_BUDGET;
126878
127243
  }
126879
- async function resolveSubagentSpawnContext(client2, parentSessionID) {
127244
+ async function resolveSubagentSpawnContext(client2, parentSessionID, directory) {
126880
127245
  const visitedSessionIDs = new Set;
126881
127246
  let rootSessionID = parentSessionID;
126882
127247
  let currentSessionID = parentSessionID;
@@ -126889,7 +127254,8 @@ async function resolveSubagentSpawnContext(client2, parentSessionID) {
126889
127254
  let nextParentSessionID;
126890
127255
  try {
126891
127256
  const response = await client2.session.get({
126892
- path: { id: currentSessionID }
127257
+ path: { id: currentSessionID },
127258
+ ...directory ? { query: { directory } } : {}
126893
127259
  });
126894
127260
  if (response.error) {
126895
127261
  throw new Error(String(response.error));
@@ -126993,7 +127359,7 @@ class BackgroundManager {
126993
127359
  }
126994
127360
  }
126995
127361
  async assertCanSpawn(parentSessionID) {
126996
- const spawnContext = await resolveSubagentSpawnContext(this.client, parentSessionID);
127362
+ const spawnContext = await resolveSubagentSpawnContext(this.client, parentSessionID, this.directory);
126997
127363
  const maxDepth = getMaxSubagentDepth(this.config);
126998
127364
  if (spawnContext.childDepth > maxDepth) {
126999
127365
  throw createSubagentDepthLimitError({
@@ -127185,7 +127551,8 @@ class BackgroundManager {
127185
127551
  });
127186
127552
  const concurrencyKey = this.getConcurrencyKeyFromInput(input);
127187
127553
  const parentSession = await this.client.session.get({
127188
- path: { id: input.parentSessionID }
127554
+ path: { id: input.parentSessionID },
127555
+ query: { directory: this.directory }
127189
127556
  }).catch((err) => {
127190
127557
  log(`[background-agent] Failed to get parent session: ${err}`);
127191
127558
  return null;
@@ -127674,7 +128041,8 @@ class BackgroundManager {
127674
128041
  }
127675
128042
  task.progress.toolCalls += 1;
127676
128043
  task.progress.lastTool = partInfo.tool;
127677
- const circuitBreaker = this.cachedCircuitBreakerSettings ?? (this.cachedCircuitBreakerSettings = resolveCircuitBreakerSettings(this.config));
128044
+ const circuitBreaker = this.cachedCircuitBreakerSettings ?? resolveCircuitBreakerSettings(this.config);
128045
+ this.cachedCircuitBreakerSettings = circuitBreaker;
127678
128046
  if (partInfo.tool) {
127679
128047
  task.progress.toolCallWindow = recordToolCall(task.progress.toolCallWindow, partInfo.tool, circuitBreaker, partInfo.state?.input);
127680
128048
  if (circuitBreaker.enabled) {
@@ -128244,7 +128612,7 @@ ${originalText}`;
128244
128612
  parentSessionID: task.parentSessionID
128245
128613
  });
128246
128614
  }
128247
- const messageDir = join93(MESSAGE_STORAGE, task.parentSessionID);
128615
+ const messageDir = join94(MESSAGE_STORAGE, task.parentSessionID);
128248
128616
  const currentMessage = messageDir ? findNearestMessageExcludingCompaction(messageDir, task.parentSessionID) : null;
128249
128617
  agent = currentMessage?.agent ?? task.parentAgent;
128250
128618
  model = currentMessage?.model?.providerID && currentMessage?.model?.modelID ? { providerID: currentMessage.model.providerID, modelID: currentMessage.model.modelID } : undefined;
@@ -128360,6 +128728,7 @@ ${originalText}`;
128360
128728
  await checkAndInterruptStaleTasks({
128361
128729
  tasks: this.tasks.values(),
128362
128730
  client: this.client,
128731
+ directory: this.directory,
128363
128732
  config: this.config,
128364
128733
  concurrencyManager: this.concurrencyManager,
128365
128734
  notifyParentSession: (task) => this.enqueueNotificationForParent(task.parentSessionID, () => this.notifyParentSession(task)),
@@ -128367,7 +128736,7 @@ ${originalText}`;
128367
128736
  });
128368
128737
  }
128369
128738
  async verifySessionExists(sessionID) {
128370
- return verifySessionExists(this.client, sessionID);
128739
+ return verifySessionExists(this.client, sessionID, this.directory);
128371
128740
  }
128372
128741
  async failCrashedTask(task, errorMessage) {
128373
128742
  task.status = "error";
@@ -128574,11 +128943,11 @@ ${originalText}`;
128574
128943
  }
128575
128944
  }
128576
128945
  // src/features/mcp-oauth/storage.ts
128577
- import { chmodSync as chmodSync2, existsSync as existsSync84, mkdirSync as mkdirSync18, readFileSync as readFileSync57, renameSync as renameSync6, unlinkSync as unlinkSync13, writeFileSync as writeFileSync22 } from "fs";
128578
- import { dirname as dirname30, join as join94 } from "path";
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";
128579
128948
  var STORAGE_FILE_NAME = "mcp-oauth.json";
128580
128949
  function getMcpOauthStoragePath() {
128581
- return join94(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
128950
+ return join95(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
128582
128951
  }
128583
128952
  function normalizeHost(serverHost) {
128584
128953
  let host = serverHost.trim();
@@ -128615,11 +128984,11 @@ function buildKey(serverHost, resource) {
128615
128984
  }
128616
128985
  function readStore() {
128617
128986
  const filePath = getMcpOauthStoragePath();
128618
- if (!existsSync84(filePath)) {
128987
+ if (!existsSync85(filePath)) {
128619
128988
  return null;
128620
128989
  }
128621
128990
  try {
128622
- const content = readFileSync57(filePath, "utf-8");
128991
+ const content = readFileSync58(filePath, "utf-8");
128623
128992
  return JSON.parse(content);
128624
128993
  } catch {
128625
128994
  return null;
@@ -128629,7 +128998,7 @@ function writeStore(store2) {
128629
128998
  const filePath = getMcpOauthStoragePath();
128630
128999
  try {
128631
129000
  const dir = dirname30(filePath);
128632
- if (!existsSync84(dir)) {
129001
+ if (!existsSync85(dir)) {
128633
129002
  mkdirSync18(dir, { recursive: true });
128634
129003
  }
128635
129004
  const tempPath = `${filePath}.tmp.${Date.now()}`;
@@ -135265,7 +135634,7 @@ class TmuxSessionManager {
135265
135634
  var SESSION_TIMEOUT_MS3 = 10 * 60 * 1000;
135266
135635
  var MIN_STABILITY_TIME_MS4 = 10 * 1000;
135267
135636
  // src/openclaw/index.ts
135268
- import { basename as basename14 } from "path";
135637
+ import { basename as basename15 } from "path";
135269
135638
 
135270
135639
  // src/openclaw/gateway-url-validation.ts
135271
135640
  function validateGatewayUrl(url3) {
@@ -135566,26 +135935,26 @@ async function isTmuxAvailable() {
135566
135935
  }
135567
135936
 
135568
135937
  // src/openclaw/reply-listener.ts
135569
- import { dirname as dirname32, join as join97 } from "path";
135938
+ import { dirname as dirname32, join as join98 } from "path";
135570
135939
 
135571
135940
  // src/openclaw/session-registry.ts
135572
135941
  import {
135573
- existsSync as existsSync85,
135942
+ existsSync as existsSync86,
135574
135943
  mkdirSync as mkdirSync19,
135575
- readFileSync as readFileSync58,
135944
+ readFileSync as readFileSync59,
135576
135945
  writeFileSync as writeFileSync23,
135577
135946
  openSync as openSync3,
135578
135947
  closeSync as closeSync3,
135579
135948
  writeSync,
135580
- unlinkSync as unlinkSync14,
135949
+ unlinkSync as unlinkSync15,
135581
135950
  statSync as statSync11,
135582
135951
  constants as constants20
135583
135952
  } from "fs";
135584
- import { join as join95, dirname as dirname31 } from "path";
135953
+ import { join as join96, dirname as dirname31 } from "path";
135585
135954
  import { randomUUID as randomUUID4 } from "crypto";
135586
- var OPENCLAW_STORAGE_DIR = join95(getOpenCodeStorageDir(), "openclaw");
135587
- var REGISTRY_PATH = join95(OPENCLAW_STORAGE_DIR, "reply-session-registry.jsonl");
135588
- var REGISTRY_LOCK_PATH = join95(OPENCLAW_STORAGE_DIR, "reply-session-registry.lock");
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");
135589
135958
  var SECURE_FILE_MODE = 384;
135590
135959
  var MAX_AGE_MS = 24 * 60 * 60 * 1000;
135591
135960
  var LOCK_TIMEOUT_MS = 2000;
@@ -135594,7 +135963,7 @@ var LOCK_RETRY_MS = 20;
135594
135963
  var LOCK_STALE_MS = 1e4;
135595
135964
  function ensureRegistryDir() {
135596
135965
  const registryDir = dirname31(REGISTRY_PATH);
135597
- if (!existsSync85(registryDir)) {
135966
+ if (!existsSync86(registryDir)) {
135598
135967
  mkdirSync19(registryDir, { recursive: true, mode: 448 });
135599
135968
  }
135600
135969
  }
@@ -135613,9 +135982,9 @@ function isPidAlive(pid) {
135613
135982
  }
135614
135983
  function readLockSnapshot() {
135615
135984
  try {
135616
- if (!existsSync85(REGISTRY_LOCK_PATH))
135985
+ if (!existsSync86(REGISTRY_LOCK_PATH))
135617
135986
  return null;
135618
- const raw = readFileSync58(REGISTRY_LOCK_PATH, "utf-8");
135987
+ const raw = readFileSync59(REGISTRY_LOCK_PATH, "utf-8");
135619
135988
  const trimmed = raw.trim();
135620
135989
  if (!trimmed)
135621
135990
  return { raw, pid: null, token: null };
@@ -135639,12 +136008,12 @@ function readLockSnapshot() {
135639
136008
  }
135640
136009
  function removeLockIfUnchanged(snapshot) {
135641
136010
  try {
135642
- if (!existsSync85(REGISTRY_LOCK_PATH))
136011
+ if (!existsSync86(REGISTRY_LOCK_PATH))
135643
136012
  return false;
135644
- const currentRaw = readFileSync58(REGISTRY_LOCK_PATH, "utf-8");
136013
+ const currentRaw = readFileSync59(REGISTRY_LOCK_PATH, "utf-8");
135645
136014
  if (currentRaw !== snapshot.raw)
135646
136015
  return false;
135647
- unlinkSync14(REGISTRY_LOCK_PATH);
136016
+ unlinkSync15(REGISTRY_LOCK_PATH);
135648
136017
  return true;
135649
136018
  } catch {
135650
136019
  return false;
@@ -135669,7 +136038,7 @@ function acquireRegistryLock() {
135669
136038
  closeSync3(fd);
135670
136039
  } catch {}
135671
136040
  try {
135672
- unlinkSync14(REGISTRY_LOCK_PATH);
136041
+ unlinkSync15(REGISTRY_LOCK_PATH);
135673
136042
  } catch {}
135674
136043
  throw writeError;
135675
136044
  }
@@ -135745,10 +136114,10 @@ function withRegistryLock(onLocked, onLockUnavailable) {
135745
136114
  }
135746
136115
  }
135747
136116
  function readAllMappingsUnsafe() {
135748
- if (!existsSync85(REGISTRY_PATH))
136117
+ if (!existsSync86(REGISTRY_PATH))
135749
136118
  return [];
135750
136119
  try {
135751
- const content = readFileSync58(REGISTRY_PATH, "utf-8");
136120
+ const content = readFileSync59(REGISTRY_PATH, "utf-8");
135752
136121
  return content.split(`
135753
136122
  `).filter((line) => line.trim()).map((line) => {
135754
136123
  try {
@@ -135803,39 +136172,39 @@ function removeSession(sessionId) {
135803
136172
  import {
135804
136173
  appendFileSync as appendFileSync6,
135805
136174
  chmodSync as chmodSync3,
135806
- existsSync as existsSync87,
136175
+ existsSync as existsSync88,
135807
136176
  renameSync as renameSync7,
135808
136177
  statSync as statSync12,
135809
- unlinkSync as unlinkSync15,
136178
+ unlinkSync as unlinkSync16,
135810
136179
  writeFileSync as writeFileSync24
135811
136180
  } from "fs";
135812
136181
 
135813
136182
  // src/openclaw/reply-listener-paths.ts
135814
- import { existsSync as existsSync86, mkdirSync as mkdirSync20 } from "fs";
136183
+ import { existsSync as existsSync87, mkdirSync as mkdirSync20 } from "fs";
135815
136184
  import { homedir as homedir16 } from "os";
135816
- import { join as join96 } from "path";
136185
+ import { join as join97 } from "path";
135817
136186
  var REPLY_LISTENER_SECURE_FILE_MODE = 384;
135818
136187
  function resolveReplyListenerHomeDir() {
135819
136188
  return process.env.HOME ?? process.env.USERPROFILE ?? homedir16();
135820
136189
  }
135821
136190
  function getReplyListenerStateDir() {
135822
- return join96(resolveReplyListenerHomeDir(), ".omx", "state");
136191
+ return join97(resolveReplyListenerHomeDir(), ".omx", "state");
135823
136192
  }
135824
136193
  function getReplyListenerPidFilePath() {
135825
- return join96(getReplyListenerStateDir(), "reply-listener.pid");
136194
+ return join97(getReplyListenerStateDir(), "reply-listener.pid");
135826
136195
  }
135827
136196
  function getReplyListenerStateFilePath() {
135828
- return join96(getReplyListenerStateDir(), "reply-listener-state.json");
136197
+ return join97(getReplyListenerStateDir(), "reply-listener-state.json");
135829
136198
  }
135830
136199
  function getReplyListenerConfigFilePath() {
135831
- return join96(getReplyListenerStateDir(), "reply-listener-config.json");
136200
+ return join97(getReplyListenerStateDir(), "reply-listener-config.json");
135832
136201
  }
135833
136202
  function getReplyListenerLogFilePath() {
135834
- return join96(getReplyListenerStateDir(), "reply-listener.log");
136203
+ return join97(getReplyListenerStateDir(), "reply-listener.log");
135835
136204
  }
135836
136205
  function ensureReplyListenerStateDir() {
135837
136206
  const stateDir = getReplyListenerStateDir();
135838
- if (!existsSync86(stateDir)) {
136207
+ if (!existsSync87(stateDir)) {
135839
136208
  mkdirSync20(stateDir, { recursive: true, mode: 448 });
135840
136209
  }
135841
136210
  }
@@ -135851,14 +136220,14 @@ function writeSecureReplyListenerFile(filePath, content) {
135851
136220
  }
135852
136221
  function rotateReplyListenerLogIfNeeded(logPath) {
135853
136222
  try {
135854
- if (!existsSync87(logPath))
136223
+ if (!existsSync88(logPath))
135855
136224
  return;
135856
136225
  const stats = statSync12(logPath);
135857
136226
  if (stats.size <= MAX_REPLY_LISTENER_LOG_SIZE_BYTES)
135858
136227
  return;
135859
136228
  const backupPath = `${logPath}.old`;
135860
- if (existsSync87(backupPath)) {
135861
- unlinkSync15(backupPath);
136229
+ if (existsSync88(backupPath)) {
136230
+ unlinkSync16(backupPath);
135862
136231
  }
135863
136232
  renameSync7(logPath, backupPath);
135864
136233
  } catch {}
@@ -135898,7 +136267,7 @@ class ReplyListenerRateLimiter {
135898
136267
  }
135899
136268
 
135900
136269
  // src/openclaw/reply-listener-state.ts
135901
- import { existsSync as existsSync88, readFileSync as readFileSync59, unlinkSync as unlinkSync16 } from "fs";
136270
+ import { existsSync as existsSync89, readFileSync as readFileSync60, unlinkSync as unlinkSync17 } from "fs";
135902
136271
  var REPLY_LISTENER_STARTUP_TOKEN_ENV = "OMO_OPENCLAW_REPLY_LISTENER_STARTUP_TOKEN";
135903
136272
  function createDefaultReplyListenerState() {
135904
136273
  return {
@@ -135960,9 +136329,9 @@ function createPendingReplyListenerState(startupToken) {
135960
136329
  function readReplyListenerDaemonState() {
135961
136330
  try {
135962
136331
  const stateFilePath = getReplyListenerStateFilePath();
135963
- if (!existsSync88(stateFilePath))
136332
+ if (!existsSync89(stateFilePath))
135964
136333
  return null;
135965
- return normalizeReplyListenerState(JSON.parse(readFileSync59(stateFilePath, "utf-8")));
136334
+ return normalizeReplyListenerState(JSON.parse(readFileSync60(stateFilePath, "utf-8")));
135966
136335
  } catch {
135967
136336
  return null;
135968
136337
  }
@@ -135977,9 +136346,9 @@ function writeReplyListenerDaemonState(state3) {
135977
136346
  function readReplyListenerDaemonConfig() {
135978
136347
  try {
135979
136348
  const configFilePath = getReplyListenerConfigFilePath();
135980
- if (!existsSync88(configFilePath))
136349
+ if (!existsSync89(configFilePath))
135981
136350
  return null;
135982
- return JSON.parse(readFileSync59(configFilePath, "utf-8"));
136351
+ return JSON.parse(readFileSync60(configFilePath, "utf-8"));
135983
136352
  } catch {
135984
136353
  return null;
135985
136354
  }
@@ -135990,9 +136359,9 @@ function writeReplyListenerDaemonConfig(config4) {
135990
136359
  function readReplyListenerPid() {
135991
136360
  try {
135992
136361
  const pidFilePath = getReplyListenerPidFilePath();
135993
- if (!existsSync88(pidFilePath))
136362
+ if (!existsSync89(pidFilePath))
135994
136363
  return null;
135995
- const pid = Number.parseInt(readFileSync59(pidFilePath, "utf-8").trim(), 10);
136364
+ const pid = Number.parseInt(readFileSync60(pidFilePath, "utf-8").trim(), 10);
135996
136365
  return Number.isNaN(pid) ? null : pid;
135997
136366
  } catch {
135998
136367
  return null;
@@ -136003,8 +136372,8 @@ function writeReplyListenerPid(pid) {
136003
136372
  }
136004
136373
  function removeReplyListenerPid() {
136005
136374
  const pidFilePath = getReplyListenerPidFilePath();
136006
- if (existsSync88(pidFilePath)) {
136007
- unlinkSync16(pidFilePath);
136375
+ if (existsSync89(pidFilePath)) {
136376
+ unlinkSync17(pidFilePath);
136008
136377
  }
136009
136378
  }
136010
136379
  function markReplyListenerStopped(state3, error92) {
@@ -136019,7 +136388,7 @@ function markReplyListenerStopped(state3, error92) {
136019
136388
  }
136020
136389
 
136021
136390
  // src/openclaw/reply-listener-process.ts
136022
- import { readFileSync as readFileSync60 } from "fs";
136391
+ import { readFileSync as readFileSync61 } from "fs";
136023
136392
  var {spawn: spawn25 } = globalThis.Bun;
136024
136393
  var REPLY_LISTENER_DAEMON_IDENTITY_MARKER = "--openclaw-reply-listener-daemon";
136025
136394
  var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
@@ -136075,7 +136444,7 @@ function isReplyListenerProcessRunning(pid) {
136075
136444
  async function isReplyListenerDaemonProcess(pid) {
136076
136445
  try {
136077
136446
  if (process.platform === "linux") {
136078
- const cmdline = readFileSync60(`/proc/${pid}/cmdline`, "utf-8");
136447
+ const cmdline = readFileSync61(`/proc/${pid}/cmdline`, "utf-8");
136079
136448
  return cmdline.includes(REPLY_LISTENER_DAEMON_IDENTITY_MARKER);
136080
136449
  }
136081
136450
  const processInfo = spawn25(["ps", "-p", String(pid), "-o", "args="], {
@@ -136237,7 +136606,7 @@ async function startReplyListener(config4) {
136237
136606
  pendingState.configSignature = getReplyListenerRuntimeSignature(normalizedConfig);
136238
136607
  writeReplyListenerDaemonState(pendingState);
136239
136608
  const currentFile = import.meta.url;
136240
- const daemonScript = currentFile.endsWith(".ts") ? join97(dirname32(new URL(currentFile).pathname), "daemon.ts") : join97(dirname32(new URL(currentFile).pathname), "daemon.js");
136609
+ const daemonScript = currentFile.endsWith(".ts") ? join98(dirname32(new URL(currentFile).pathname), "daemon.ts") : join98(dirname32(new URL(currentFile).pathname), "daemon.js");
136241
136610
  try {
136242
136611
  const processInfo = spawnReplyListenerDaemon(daemonScript, startupToken);
136243
136612
  processInfo.unref();
@@ -136385,7 +136754,7 @@ async function wakeOpenClaw(config4, event, context) {
136385
136754
  const variables = {
136386
136755
  sessionId: enrichedContext.sessionId,
136387
136756
  projectPath: enrichedContext.projectPath,
136388
- projectName: enrichedContext.projectPath ? basename14(enrichedContext.projectPath) : undefined,
136757
+ projectName: enrichedContext.projectPath ? basename15(enrichedContext.projectPath) : undefined,
136389
136758
  tmuxSession,
136390
136759
  prompt: enrichedContext.prompt,
136391
136760
  contextSummary: enrichedContext.contextSummary,
@@ -136411,7 +136780,7 @@ async function wakeOpenClaw(config4, event, context) {
136411
136780
  timestamp: now,
136412
136781
  sessionId: enrichedContext.sessionId,
136413
136782
  projectPath: enrichedContext.projectPath,
136414
- projectName: enrichedContext.projectPath ? basename14(enrichedContext.projectPath) : undefined,
136783
+ projectName: enrichedContext.projectPath ? basename15(enrichedContext.projectPath) : undefined,
136415
136784
  tmuxSession,
136416
136785
  tmuxTail,
136417
136786
  ...replyChannel !== undefined && { channel: replyChannel },
@@ -136508,22 +136877,22 @@ async function dispatchOpenClawEvent(params) {
136508
136877
  return result;
136509
136878
  }
136510
136879
  // src/features/claude-code-mcp-loader/loader.ts
136511
- import { existsSync as existsSync89, readFileSync as readFileSync61 } from "fs";
136512
- import { join as join98 } from "path";
136880
+ import { existsSync as existsSync90, readFileSync as readFileSync62 } from "fs";
136881
+ import { join as join99 } from "path";
136513
136882
  import { homedir as homedir17 } from "os";
136514
136883
  init_logger();
136515
136884
  function getMcpConfigPaths() {
136516
136885
  const claudeConfigDir = getClaudeConfigDir();
136517
136886
  const cwd = process.cwd();
136518
136887
  return [
136519
- { path: join98(homedir17(), ".claude.json"), scope: "user" },
136520
- { path: join98(claudeConfigDir, ".mcp.json"), scope: "user" },
136521
- { path: join98(cwd, ".mcp.json"), scope: "project" },
136522
- { path: join98(cwd, ".claude", ".mcp.json"), scope: "local" }
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" }
136523
136892
  ];
136524
136893
  }
136525
136894
  async function loadMcpConfigFile(filePath) {
136526
- if (!existsSync89(filePath)) {
136895
+ if (!existsSync90(filePath)) {
136527
136896
  return null;
136528
136897
  }
136529
136898
  try {
@@ -136539,10 +136908,10 @@ function getSystemMcpServerNames() {
136539
136908
  const paths = getMcpConfigPaths();
136540
136909
  const cwd = process.cwd();
136541
136910
  for (const { path: path14 } of paths) {
136542
- if (!existsSync89(path14))
136911
+ if (!existsSync90(path14))
136543
136912
  continue;
136544
136913
  try {
136545
- const content = readFileSync61(path14, "utf-8");
136914
+ const content = readFileSync62(path14, "utf-8");
136546
136915
  const config4 = JSON.parse(content);
136547
136916
  if (!config4?.mcpServers)
136548
136917
  continue;
@@ -138938,7 +139307,7 @@ How you work:
138938
139307
  3. Return ONLY the relevant extracted information
138939
139308
  4. The main agent never processes the raw file - you save context tokens
138940
139309
 
138941
- 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
138942
139311
  For images: describe layouts, UI elements, text, diagrams, charts
138943
139312
  For diagrams: explain relationships, flows, architecture depicted
138944
139313
 
@@ -141937,7 +142306,7 @@ function createHephaestusAgent2(model, availableAgents, availableToolNames, avai
141937
142306
  }
141938
142307
  createHephaestusAgent2.mode = MODE10;
141939
142308
  // src/agents/builtin-agents/resolve-file-uri.ts
141940
- import { existsSync as existsSync90, readFileSync as readFileSync62 } from "fs";
142309
+ import { existsSync as existsSync91, readFileSync as readFileSync63 } from "fs";
141941
142310
  import { homedir as homedir18 } from "os";
141942
142311
  import { isAbsolute as isAbsolute12, resolve as resolve20 } from "path";
141943
142312
  init_logger();
@@ -141962,11 +142331,11 @@ function resolvePromptAppend(promptAppend, configDir) {
141962
142331
  });
141963
142332
  return `[WARNING: Path rejected: ${promptAppend}]`;
141964
142333
  }
141965
- if (!existsSync90(filePath)) {
142334
+ if (!existsSync91(filePath)) {
141966
142335
  return `[WARNING: Could not resolve file URI: ${promptAppend}]`;
141967
142336
  }
141968
142337
  try {
141969
- return readFileSync62(filePath, "utf8");
142338
+ return readFileSync63(filePath, "utf8");
141970
142339
  } catch {
141971
142340
  return `[WARNING: Could not read file: ${promptAppend}]`;
141972
142341
  }
@@ -143208,80 +143577,7 @@ async function createBuiltinAgents(disabledAgents = [], agentOverrides = {}, dir
143208
143577
  }
143209
143578
  // src/plugin-handlers/agent-config-handler.ts
143210
143579
  init_agent_display_names();
143211
- // src/features/claude-code-agent-loader/loader.ts
143212
- import { existsSync as existsSync91, readdirSync as readdirSync25, readFileSync as readFileSync63 } from "fs";
143213
- import { join as join99, basename as basename15 } from "path";
143214
- function parseToolsConfig2(toolsStr) {
143215
- if (!toolsStr)
143216
- return;
143217
- const tools = toolsStr.split(",").map((t) => t.trim()).filter(Boolean);
143218
- if (tools.length === 0)
143219
- return;
143220
- const result = {};
143221
- for (const tool3 of tools) {
143222
- result[tool3.toLowerCase()] = true;
143223
- }
143224
- return result;
143225
- }
143226
- function loadAgentsFromDir(agentsDir, scope) {
143227
- if (!existsSync91(agentsDir)) {
143228
- return [];
143229
- }
143230
- const entries = readdirSync25(agentsDir, { withFileTypes: true });
143231
- const agents = [];
143232
- for (const entry of entries) {
143233
- if (!isMarkdownFile(entry))
143234
- continue;
143235
- const agentPath = join99(agentsDir, entry.name);
143236
- const agentName = basename15(entry.name, ".md");
143237
- try {
143238
- const content = readFileSync63(agentPath, "utf-8");
143239
- const { data, body } = parseFrontmatter(content);
143240
- const name = data.name || agentName;
143241
- const originalDescription = data.description || "";
143242
- const formattedDescription = `(${scope}) ${originalDescription}`;
143243
- const mappedModelOverride = mapClaudeModelToOpenCode(data.model);
143244
- const modelString = mappedModelOverride ? `${mappedModelOverride.providerID}/${mappedModelOverride.modelID}` : undefined;
143245
- const config4 = {
143246
- description: formattedDescription,
143247
- mode: data.mode || "subagent",
143248
- prompt: body.trim(),
143249
- ...modelString ? { model: modelString } : {}
143250
- };
143251
- const toolsConfig = parseToolsConfig2(data.tools);
143252
- if (toolsConfig) {
143253
- config4.tools = toolsConfig;
143254
- }
143255
- agents.push({
143256
- name,
143257
- path: agentPath,
143258
- config: config4,
143259
- scope
143260
- });
143261
- } catch {
143262
- continue;
143263
- }
143264
- }
143265
- return agents;
143266
- }
143267
- function loadUserAgents() {
143268
- const userAgentsDir = join99(getClaudeConfigDir(), "agents");
143269
- const agents = loadAgentsFromDir(userAgentsDir, "user");
143270
- const result = {};
143271
- for (const agent of agents) {
143272
- result[agent.name] = agent.config;
143273
- }
143274
- return result;
143275
- }
143276
- function loadProjectAgents(directory) {
143277
- const projectAgentsDir = join99(directory ?? process.cwd(), ".claude", "agents");
143278
- const agents = loadAgentsFromDir(projectAgentsDir, "project");
143279
- const result = {};
143280
- for (const agent of agents) {
143281
- result[agent.name] = agent.config;
143282
- }
143283
- return result;
143284
- }
143580
+
143285
143581
  // src/plugin-handlers/agent-priority-order.ts
143286
143582
  init_agent_display_names();
143287
143583
  var CANONICAL_CORE_AGENT_ORDER = [
@@ -145574,7 +145870,7 @@ async function buildPrometheusAgentConfig(params) {
145574
145870
  const base = {
145575
145871
  ...resolvedModel ? { model: resolvedModel } : {},
145576
145872
  ...variantToUse ? { variant: variantToUse } : {},
145577
- mode: "all",
145873
+ mode: "primary",
145578
145874
  prompt: getPrometheusPrompt(resolvedModel, params.disabledTools),
145579
145875
  permission: PROMETHEUS_PERMISSION,
145580
145876
  description: `${params.configAgentPlan?.description ?? "Plan agent"} (Prometheus - OhMyOpenCode)`,
@@ -146740,7 +147036,6 @@ function buildChatParamsInput(raw) {
146740
147036
  const providerID = model.providerID;
146741
147037
  const modelID = typeof model.modelID === "string" ? model.modelID : typeof model.id === "string" ? model.id : undefined;
146742
147038
  const providerId = provider.id;
146743
- const variant = message.variant;
146744
147039
  if (typeof providerID !== "string")
146745
147040
  return null;
146746
147041
  if (typeof modelID !== "string")
@@ -146753,8 +147048,7 @@ function buildChatParamsInput(raw) {
146753
147048
  model: { providerID, modelID },
146754
147049
  provider: { id: providerId },
146755
147050
  message,
146756
- rawMessage: message,
146757
- ...typeof variant === "string" ? {} : {}
147051
+ rawMessage: message
146758
147052
  };
146759
147053
  }
146760
147054
  function isChatParamsOutput(raw) {
@@ -147706,7 +148000,6 @@ function createEventHandler2(args) {
147706
148000
  const emittedAt = recentSyntheticIdles.get(sessionID);
147707
148001
  if (emittedAt && Date.now() - emittedAt < DEDUP_WINDOW_MS) {
147708
148002
  recentSyntheticIdles.delete(sessionID);
147709
- return;
147710
148003
  }
147711
148004
  recentRealIdles.set(sessionID, Date.now());
147712
148005
  }
@@ -152844,7 +153137,7 @@ class PostHog extends PostHogBackendClient {
152844
153137
  // package.json
152845
153138
  var package_default = {
152846
153139
  name: "oh-my-opencode",
152847
- version: "3.17.1",
153140
+ version: "3.17.2",
152848
153141
  description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
152849
153142
  main: "./dist/index.js",
152850
153143
  types: "dist/index.d.ts",
@@ -152923,17 +153216,17 @@ var package_default = {
152923
153216
  typescript: "^5.7.3"
152924
153217
  },
152925
153218
  optionalDependencies: {
152926
- "oh-my-opencode-darwin-arm64": "3.17.1",
152927
- "oh-my-opencode-darwin-x64": "3.17.1",
152928
- "oh-my-opencode-darwin-x64-baseline": "3.17.1",
152929
- "oh-my-opencode-linux-arm64": "3.17.1",
152930
- "oh-my-opencode-linux-arm64-musl": "3.17.1",
152931
- "oh-my-opencode-linux-x64": "3.17.1",
152932
- "oh-my-opencode-linux-x64-baseline": "3.17.1",
152933
- "oh-my-opencode-linux-x64-musl": "3.17.1",
152934
- "oh-my-opencode-linux-x64-musl-baseline": "3.17.1",
152935
- "oh-my-opencode-windows-x64": "3.17.1",
152936
- "oh-my-opencode-windows-x64-baseline": "3.17.1"
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"
152937
153230
  },
152938
153231
  overrides: {},
152939
153232
  trustedDependencies: [
@@ -153079,11 +153372,16 @@ function createPostHogClient(source, options) {
153079
153372
  if (shouldDisablePostHog() || !hasPostHogApiKey()) {
153080
153373
  return NO_OP_POSTHOG;
153081
153374
  }
153082
- const configuredClient = new PostHog(getPostHogApiKey(), {
153083
- ...options,
153084
- host: getPostHogHost(),
153085
- disableGeoip: false
153086
- });
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
+ }
153087
153385
  const sharedProperties = getSharedProperties(source);
153088
153386
  return {
153089
153387
  capture: (message) => {