oh-my-opencode-medium 0.8.2 → 0.8.3

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.
@@ -109,6 +109,7 @@ export type BackgroundTaskConfig = z.infer<typeof BackgroundTaskConfigSchema>;
109
109
  export declare const FailoverConfigSchema: z.ZodObject<{
110
110
  enabled: z.ZodDefault<z.ZodBoolean>;
111
111
  timeoutMs: z.ZodDefault<z.ZodNumber>;
112
+ retryDelayMs: z.ZodDefault<z.ZodNumber>;
112
113
  chains: z.ZodDefault<z.ZodObject<{
113
114
  orchestrator: z.ZodOptional<z.ZodArray<z.ZodString>>;
114
115
  oracle: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -121,6 +122,7 @@ export declare const FailoverConfigSchema: z.ZodObject<{
121
122
  export type FailoverConfig = z.infer<typeof FailoverConfigSchema>;
122
123
  export declare const PluginConfigSchema: z.ZodObject<{
123
124
  preset: z.ZodOptional<z.ZodString>;
125
+ setDefaultAgent: z.ZodOptional<z.ZodBoolean>;
124
126
  scoringEngineVersion: z.ZodOptional<z.ZodEnum<{
125
127
  v1: "v1";
126
128
  "v2-shadow": "v2-shadow";
@@ -203,6 +205,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
203
205
  fallback: z.ZodOptional<z.ZodObject<{
204
206
  enabled: z.ZodDefault<z.ZodBoolean>;
205
207
  timeoutMs: z.ZodDefault<z.ZodNumber>;
208
+ retryDelayMs: z.ZodDefault<z.ZodNumber>;
206
209
  chains: z.ZodDefault<z.ZodObject<{
207
210
  orchestrator: z.ZodOptional<z.ZodArray<z.ZodString>>;
208
211
  oracle: z.ZodOptional<z.ZodArray<z.ZodString>>;
package/dist/index.js CHANGED
@@ -3377,11 +3377,11 @@ var SUBAGENT_DELEGATION_RULES = {
3377
3377
  };
3378
3378
  var DEFAULT_MODELS = {
3379
3379
  orchestrator: undefined,
3380
- oracle: "openai/gpt-5.2-codex",
3381
- librarian: "openai/gpt-5.1-codex-mini",
3382
- explorer: "openai/gpt-5.1-codex-mini",
3380
+ oracle: "openai/gpt-5.4",
3381
+ librarian: "openai/gpt-5-codex",
3382
+ explorer: "openai/gpt-5-codex",
3383
3383
  designer: "kimi-for-coding/k2p5",
3384
- fixer: "openai/gpt-5.1-codex-mini"
3384
+ fixer: "openai/gpt-5-codex"
3385
3385
  };
3386
3386
  var POLL_INTERVAL_BACKGROUND_MS = 2000;
3387
3387
  var DEFAULT_TIMEOUT_MS = 2 * 60 * 1000;
@@ -17049,10 +17049,12 @@ var BackgroundTaskConfigSchema = exports_external.object({
17049
17049
  var FailoverConfigSchema = exports_external.object({
17050
17050
  enabled: exports_external.boolean().default(true),
17051
17051
  timeoutMs: exports_external.number().min(0).default(15000),
17052
+ retryDelayMs: exports_external.number().min(0).default(500),
17052
17053
  chains: FallbackChainsSchema.default({})
17053
17054
  });
17054
17055
  var PluginConfigSchema = exports_external.object({
17055
17056
  preset: exports_external.string().optional(),
17057
+ setDefaultAgent: exports_external.boolean().optional(),
17056
17058
  scoringEngineVersion: exports_external.enum(["v1", "v2-shadow", "v2"]).optional(),
17057
17059
  balanceProviderUsage: exports_external.boolean().optional(),
17058
17060
  manualPlan: ManualPlanSchema.optional(),
@@ -17826,7 +17828,7 @@ function parseFrontmatter(content) {
17826
17828
  };
17827
17829
  }
17828
17830
  // src/utils/internal-initiator.ts
17829
- var SLIM_INTERNAL_INITIATOR_MARKER = "<!-- SLIM_INTERNAL_INITIATOR -->";
17831
+ var MEDIUM_INTERNAL_INITIATOR_MARKER = "<!-- MEDIUM_INTERNAL_INITIATOR -->";
17830
17832
  function isRecord(value) {
17831
17833
  return typeof value === "object" && value !== null;
17832
17834
  }
@@ -17834,7 +17836,7 @@ function createInternalAgentTextPart(text) {
17834
17836
  return {
17835
17837
  type: "text",
17836
17838
  text: `${text}
17837
- ${SLIM_INTERNAL_INITIATOR_MARKER}`
17839
+ ${MEDIUM_INTERNAL_INITIATOR_MARKER}`
17838
17840
  };
17839
17841
  }
17840
17842
  function hasInternalInitiatorMarker(part) {
@@ -17844,7 +17846,7 @@ function hasInternalInitiatorMarker(part) {
17844
17846
  if (typeof part.text !== "string") {
17845
17847
  return false;
17846
17848
  }
17847
- return part.text.includes(SLIM_INTERNAL_INITIATOR_MARKER);
17849
+ return part.text.includes(MEDIUM_INTERNAL_INITIATOR_MARKER);
17848
17850
  }
17849
17851
  // src/utils/tmux.ts
17850
17852
  var {spawn } = globalThis.Bun;
@@ -18277,14 +18279,23 @@ class BackgroundTaskManager {
18277
18279
  await this.client.session.prompt(args);
18278
18280
  return;
18279
18281
  }
18280
- await Promise.race([
18281
- this.client.session.prompt(args),
18282
- new Promise((_, reject) => {
18283
- setTimeout(() => {
18284
- reject(new Error(`Prompt timed out after ${timeoutMs}ms`));
18285
- }, timeoutMs);
18286
- })
18287
- ]);
18282
+ const sessionId = args.path.id;
18283
+ let timer;
18284
+ try {
18285
+ const promptPromise = this.client.session.prompt(args);
18286
+ promptPromise.catch(() => {});
18287
+ await Promise.race([
18288
+ promptPromise,
18289
+ new Promise((_, reject) => {
18290
+ timer = setTimeout(() => {
18291
+ this.client.session.abort({ path: { id: sessionId } }).catch(() => {});
18292
+ reject(new Error(`Prompt timed out after ${timeoutMs}ms`));
18293
+ }, timeoutMs);
18294
+ })
18295
+ ]);
18296
+ } finally {
18297
+ clearTimeout(timer);
18298
+ }
18288
18299
  }
18289
18300
  calculateToolPermissions(agentName) {
18290
18301
  const allowedSubagents = this.getSubagentRules(agentName);
@@ -18328,11 +18339,15 @@ class BackgroundTaskManager {
18328
18339
  });
18329
18340
  const fallbackEnabled = this.config?.fallback?.enabled ?? true;
18330
18341
  const timeoutMs = fallbackEnabled ? this.config?.fallback?.timeoutMs ?? FALLBACK_FAILOVER_TIMEOUT_MS : 0;
18342
+ const retryDelayMs = this.config?.fallback?.retryDelayMs ?? 500;
18331
18343
  const chain = fallbackEnabled ? this.resolveFallbackChain(task.agent) : [];
18332
18344
  const attemptModels = chain.length > 0 ? chain : [undefined];
18333
18345
  const errors3 = [];
18334
18346
  let succeeded = false;
18335
- for (const model of attemptModels) {
18347
+ const sessionId = session.data.id;
18348
+ for (let i = 0;i < attemptModels.length; i++) {
18349
+ const model = attemptModels[i];
18350
+ const modelLabel = model ?? "default-model";
18336
18351
  try {
18337
18352
  const body = {
18338
18353
  ...basePromptBody,
@@ -18345,8 +18360,11 @@ class BackgroundTaskManager {
18345
18360
  }
18346
18361
  body.model = ref;
18347
18362
  }
18363
+ if (i > 0) {
18364
+ log(`[background-manager] fallback attempt ${i + 1}/${attemptModels.length}: ${modelLabel}`, { taskId: task.id });
18365
+ }
18348
18366
  await this.promptWithTimeout({
18349
- path: { id: session.data.id },
18367
+ path: { id: sessionId },
18350
18368
  body,
18351
18369
  query: promptQuery
18352
18370
  }, timeoutMs);
@@ -18354,10 +18372,17 @@ class BackgroundTaskManager {
18354
18372
  break;
18355
18373
  } catch (error48) {
18356
18374
  const msg = error48 instanceof Error ? error48.message : String(error48);
18357
- if (model) {
18358
- errors3.push(`${model}: ${msg}`);
18359
- } else {
18360
- errors3.push(`default-model: ${msg}`);
18375
+ errors3.push(`${modelLabel}: ${msg}`);
18376
+ log(`[background-manager] model failed: ${modelLabel} \u2014 ${msg}`, {
18377
+ taskId: task.id
18378
+ });
18379
+ if (i < attemptModels.length - 1) {
18380
+ try {
18381
+ await this.client.session.abort({
18382
+ path: { id: sessionId }
18383
+ });
18384
+ await new Promise((r) => setTimeout(r, retryDelayMs));
18385
+ } catch {}
18361
18386
  }
18362
18387
  }
18363
18388
  }
@@ -19357,7 +19382,7 @@ function createPhaseReminderHook() {
19357
19382
  return;
19358
19383
  }
19359
19384
  const originalText = lastUserMessage.parts[textPartIndex].text ?? "";
19360
- if (originalText.includes(SLIM_INTERNAL_INITIATOR_MARKER)) {
19385
+ if (originalText.includes(MEDIUM_INTERNAL_INITIATOR_MARKER)) {
19361
19386
  return;
19362
19387
  }
19363
19388
  lastUserMessage.parts[textPartIndex].text = `${PHASE_REMINDER}
@@ -31988,11 +32013,11 @@ function getCacheDir2() {
31988
32013
  if (process.platform === "win32") {
31989
32014
  const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
31990
32015
  const base2 = localAppData || join8(homedir5(), "AppData", "Local");
31991
- return join8(base2, "oh-my-opencode-slim", "bin");
32016
+ return join8(base2, "oh-my-opencode-medium", "bin");
31992
32017
  }
31993
32018
  const xdgCache = process.env.XDG_CACHE_HOME;
31994
32019
  const base = xdgCache || join8(homedir5(), ".cache");
31995
- return join8(base, "oh-my-opencode-slim", "bin");
32020
+ return join8(base, "oh-my-opencode-medium", "bin");
31996
32021
  }
31997
32022
  function getBinaryName() {
31998
32023
  return process.platform === "win32" ? "sg.exe" : "sg";
@@ -32628,7 +32653,7 @@ import {
32628
32653
  import { join as join10 } from "path";
32629
32654
  function getInstallDir() {
32630
32655
  const homeDir = process.env.HOME || process.env.USERPROFILE || ".";
32631
- return join10(homeDir, ".cache", "oh-my-opencode-slim", "bin");
32656
+ return join10(homeDir, ".cache", "oh-my-opencode-medium", "bin");
32632
32657
  }
32633
32658
  function getRgPath() {
32634
32659
  const isWindows = process.platform === "win32";
@@ -33877,44 +33902,71 @@ var OhMyOpenCodeLite = async (ctx) => {
33877
33902
  mcp: mcps,
33878
33903
  config: async (opencodeConfig) => {
33879
33904
  const loadedSkills = await discoverAllSkills(ctx.directory);
33880
- opencodeConfig.default_agent = "orchestrator";
33905
+ if (config3.setDefaultAgent !== false && !opencodeConfig.default_agent) {
33906
+ opencodeConfig.default_agent = "orchestrator";
33907
+ }
33881
33908
  mergeSkillCommands(opencodeConfig, loadedSkills);
33882
33909
  if (!opencodeConfig.agent) {
33883
33910
  opencodeConfig.agent = { ...agents };
33884
33911
  } else {
33885
- Object.assign(opencodeConfig.agent, agents);
33912
+ for (const [name, pluginAgent] of Object.entries(agents)) {
33913
+ const existing = opencodeConfig.agent[name];
33914
+ if (existing) {
33915
+ opencodeConfig.agent[name] = {
33916
+ ...pluginAgent,
33917
+ ...existing
33918
+ };
33919
+ } else {
33920
+ opencodeConfig.agent[name] = {
33921
+ ...pluginAgent
33922
+ };
33923
+ }
33924
+ }
33886
33925
  }
33887
33926
  const configAgent = opencodeConfig.agent;
33888
33927
  if (Object.keys(modelArrayMap).length > 0) {
33889
33928
  const providerConfig = opencodeConfig.provider ?? {};
33890
- const configuredProviders = Object.keys(providerConfig);
33929
+ const hasProviderConfig = Object.keys(providerConfig).length > 0;
33891
33930
  for (const [agentName, modelArray] of Object.entries(modelArrayMap)) {
33892
33931
  let resolved = false;
33893
- for (const modelEntry of modelArray) {
33894
- const slashIdx = modelEntry.id.indexOf("/");
33895
- if (slashIdx === -1)
33896
- continue;
33897
- const providerID = modelEntry.id.slice(0, slashIdx);
33898
- if (configuredProviders.includes(providerID)) {
33899
- const entry = configAgent[agentName];
33900
- if (entry) {
33901
- entry.model = modelEntry.id;
33902
- if (modelEntry.variant) {
33903
- entry.variant = modelEntry.variant;
33932
+ if (hasProviderConfig) {
33933
+ const configuredProviders = Object.keys(providerConfig);
33934
+ for (const modelEntry of modelArray) {
33935
+ const slashIdx = modelEntry.id.indexOf("/");
33936
+ if (slashIdx === -1)
33937
+ continue;
33938
+ const providerID = modelEntry.id.slice(0, slashIdx);
33939
+ if (configuredProviders.includes(providerID)) {
33940
+ const entry = configAgent[agentName];
33941
+ if (entry) {
33942
+ entry.model = modelEntry.id;
33943
+ if (modelEntry.variant) {
33944
+ entry.variant = modelEntry.variant;
33945
+ }
33904
33946
  }
33947
+ log("[plugin] resolved model fallback", {
33948
+ agent: agentName,
33949
+ model: modelEntry.id,
33950
+ variant: modelEntry.variant
33951
+ });
33952
+ resolved = true;
33953
+ break;
33905
33954
  }
33906
- log("[plugin] resolved model fallback", {
33907
- agent: agentName,
33908
- model: modelEntry.id,
33909
- variant: modelEntry.variant
33910
- });
33911
- resolved = true;
33912
- break;
33913
33955
  }
33914
33956
  }
33915
33957
  if (!resolved) {
33916
- log("[plugin] no provider match for model array", {
33917
- agent: agentName
33958
+ const firstModel = modelArray[0];
33959
+ const entry = configAgent[agentName];
33960
+ if (entry) {
33961
+ entry.model = firstModel.id;
33962
+ if (firstModel.variant) {
33963
+ entry.variant = firstModel.variant;
33964
+ }
33965
+ }
33966
+ log("[plugin] resolved model from array (no provider config)", {
33967
+ agent: agentName,
33968
+ model: firstModel.id,
33969
+ variant: firstModel.variant
33918
33970
  });
33919
33971
  }
33920
33972
  }
@@ -1,4 +1,4 @@
1
- export declare const SLIM_INTERNAL_INITIATOR_MARKER = "<!-- SLIM_INTERNAL_INITIATOR -->";
1
+ export declare const MEDIUM_INTERNAL_INITIATOR_MARKER = "<!-- MEDIUM_INTERNAL_INITIATOR -->";
2
2
  export declare function createInternalAgentTextPart(text: string): {
3
3
  type: 'text';
4
4
  text: string;