@wolfx/oh-my-openagent 3.17.13 → 3.17.14

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.
@@ -84,6 +84,7 @@ export declare class BackgroundManager {
84
84
  private startTask;
85
85
  getTask(id: string): BackgroundTask | undefined;
86
86
  getTasksByParentSession(sessionID: string): BackgroundTask[];
87
+ private updateBackgroundTaskMarker;
87
88
  getAllDescendantTasks(sessionID: string): BackgroundTask[];
88
89
  findBySession(sessionID: string): BackgroundTask | undefined;
89
90
  private resolveTaskAttemptBySession;
@@ -1,3 +1,7 @@
1
+ /** @internal test-only */
2
+ export declare function __disableScheduledForcedExitForTesting(): void;
3
+ /** @internal test-only */
4
+ export declare function __enableScheduledForcedExitForTesting(): void;
1
5
  interface CleanupTarget {
2
6
  shutdown(): void | Promise<void>;
3
7
  }
@@ -1,4 +1,4 @@
1
- export type ContinuationMarkerSource = "todo" | "stop";
1
+ export type ContinuationMarkerSource = "todo" | "stop" | "background-task";
2
2
  export type ContinuationMarkerState = "idle" | "active" | "stopped";
3
3
  export interface ContinuationMarkerSourceEntry {
4
4
  state: ContinuationMarkerState;
@@ -20,6 +20,7 @@ export interface SkillMcpClientInfo {
20
20
  skillName: string;
21
21
  sessionID: string;
22
22
  scope?: SkillScope | "local";
23
+ directory?: string;
23
24
  }
24
25
  export interface SkillMcpServerContext {
25
26
  config: ClaudeCodeMcpServer;
package/dist/index.js CHANGED
@@ -19612,6 +19612,7 @@ function toLogLabel(cacheLabel) {
19612
19612
  }
19613
19613
  function createJsonFileCacheStore(options) {
19614
19614
  let memoryValue;
19615
+ let writtenInCurrentProcess = false;
19615
19616
  function getCacheFilePath() {
19616
19617
  return join10(options.getCacheDir(), options.filename);
19617
19618
  }
@@ -19646,6 +19647,12 @@ function createJsonFileCacheStore(options) {
19646
19647
  }
19647
19648
  }
19648
19649
  function has() {
19650
+ if (memoryValue !== undefined && memoryValue !== null) {
19651
+ return true;
19652
+ }
19653
+ if (writtenInCurrentProcess) {
19654
+ return true;
19655
+ }
19649
19656
  return existsSync10(getCacheFilePath());
19650
19657
  }
19651
19658
  function write(value) {
@@ -19654,6 +19661,7 @@ function createJsonFileCacheStore(options) {
19654
19661
  try {
19655
19662
  writeFileSync2(cacheFile, options.serialize?.(value) ?? JSON.stringify(value, null, 2));
19656
19663
  memoryValue = value;
19664
+ writtenInCurrentProcess = true;
19657
19665
  log(`[${options.logPrefix}] ${options.cacheLabel} written`, options.describe(value));
19658
19666
  } catch (error) {
19659
19667
  log(`[${options.logPrefix}] Error writing ${toLogLabel(options.cacheLabel)}`, {
@@ -19663,6 +19671,7 @@ function createJsonFileCacheStore(options) {
19663
19671
  }
19664
19672
  function resetMemory() {
19665
19673
  memoryValue = undefined;
19674
+ writtenInCurrentProcess = false;
19666
19675
  }
19667
19676
  return {
19668
19677
  read,
@@ -19673,6 +19682,7 @@ function createJsonFileCacheStore(options) {
19673
19682
  }
19674
19683
 
19675
19684
  // src/shared/connected-providers-cache.ts
19685
+ var providerModelsCacheWrittenInCurrentProcess = false;
19676
19686
  var CONNECTED_PROVIDERS_CACHE_FILE = "connected-providers.json";
19677
19687
  var PROVIDER_MODELS_CACHE_FILE = "provider-models.json";
19678
19688
  function isRecord(value) {
@@ -19712,6 +19722,9 @@ function createConnectedProvidersCacheStore(getCacheDir2 = getOmoOpenCodeCacheDi
19712
19722
  return providerModelsCacheStore.read();
19713
19723
  }
19714
19724
  function hasProviderModelsCache() {
19725
+ if (providerModelsCacheWrittenInCurrentProcess) {
19726
+ return true;
19727
+ }
19715
19728
  return providerModelsCacheStore.has();
19716
19729
  }
19717
19730
  function writeProviderModelsCache(data) {
@@ -19719,6 +19732,7 @@ function createConnectedProvidersCacheStore(getCacheDir2 = getOmoOpenCodeCacheDi
19719
19732
  ...data,
19720
19733
  updatedAt: new Date().toISOString()
19721
19734
  });
19735
+ providerModelsCacheWrittenInCurrentProcess = true;
19722
19736
  }
19723
19737
  async function updateConnectedProvidersCache(client) {
19724
19738
  if (!client?.provider?.list) {
@@ -19767,6 +19781,7 @@ function createConnectedProvidersCacheStore(getCacheDir2 = getOmoOpenCodeCacheDi
19767
19781
  function _resetMemCacheForTesting() {
19768
19782
  connectedProvidersCacheStore.resetMemory();
19769
19783
  providerModelsCacheStore.resetMemory();
19784
+ providerModelsCacheWrittenInCurrentProcess = false;
19770
19785
  }
19771
19786
  return {
19772
19787
  readConnectedProvidersCache,
@@ -66659,7 +66674,7 @@ async function injectContinuation(args) {
66659
66674
  log(`[${HOOK_NAME}] Skipped injection: continuation stopped for session`, { sessionID });
66660
66675
  return;
66661
66676
  }
66662
- const hasRunningBgTasks = backgroundManager ? backgroundManager.getTasksByParentSession(sessionID).some((task) => task.status === "running") : false;
66677
+ const hasRunningBgTasks = backgroundManager ? backgroundManager.getTasksByParentSession(sessionID).some((task) => task.status === "running" || task.status === "pending") : false;
66663
66678
  if (hasRunningBgTasks) {
66664
66679
  log(`[${HOOK_NAME}] Skipped injection: background tasks running`, { sessionID });
66665
66680
  return;
@@ -66865,7 +66880,7 @@ async function handleSessionIdle(args) {
66865
66880
  }
66866
66881
  state2.abortDetectedAt = undefined;
66867
66882
  }
66868
- const hasRunningBgTasks = backgroundManager ? backgroundManager.getTasksByParentSession(sessionID).some((task) => task.status === "running") : false;
66883
+ const hasRunningBgTasks = backgroundManager ? backgroundManager.getTasksByParentSession(sessionID).some((task) => task.status === "running" || task.status === "pending") : false;
66869
66884
  if (hasRunningBgTasks) {
66870
66885
  log(`[${HOOK_NAME}] Skipped: background tasks running`, { sessionID });
66871
66886
  return;
@@ -99494,6 +99509,7 @@ async function resolveRecentPromptContextForSession(ctx, sessionID) {
99494
99509
  }
99495
99510
 
99496
99511
  // src/hooks/atlas/boulder-continuation-injector.ts
99512
+ var ACTIVE_BACKGROUND_TASK_STATUSES = new Set(["pending", "running"]);
99497
99513
  async function injectBoulderContinuation(input) {
99498
99514
  const {
99499
99515
  ctx,
@@ -99508,7 +99524,7 @@ async function injectBoulderContinuation(input) {
99508
99524
  backgroundManager,
99509
99525
  sessionState
99510
99526
  } = input;
99511
- const hasRunningBgTasks = backgroundManager ? backgroundManager.getTasksByParentSession(sessionID).some((t) => t.status === "running") : false;
99527
+ const hasRunningBgTasks = backgroundManager ? backgroundManager.getTasksByParentSession(sessionID).some((t) => ACTIVE_BACKGROUND_TASK_STATUSES.has(t.status)) : false;
99512
99528
  if (hasRunningBgTasks) {
99513
99529
  log(`[${HOOK_NAME7}] Skipped injection: background tasks running`, { sessionID });
99514
99530
  return "skipped_background_tasks";
@@ -122078,7 +122094,8 @@ function createSkillMcpTool(options) {
122078
122094
  serverName: args.mcp_name,
122079
122095
  skillName: found.skill.name,
122080
122096
  sessionID,
122081
- scope: found.skill.scope
122097
+ scope: found.skill.scope,
122098
+ directory: toolContext.directory
122082
122099
  };
122083
122100
  const context = {
122084
122101
  config: found.config,
@@ -130091,11 +130108,17 @@ async function tryFallbackRetry(args) {
130091
130108
  }
130092
130109
 
130093
130110
  // src/features/background-agent/process-cleanup.ts
130094
- function scheduleForcedExit(cleanupResult, exitCode) {
130111
+ var _scheduleForcedExitEnabled = true;
130112
+ function scheduleForcedExit(cleanupResult, exitCode, exitAfterCleanup = false) {
130113
+ if (!_scheduleForcedExitEnabled)
130114
+ return;
130095
130115
  process.exitCode = exitCode;
130096
130116
  const exitTimeout = setTimeout(() => process.exit(), 6000);
130097
130117
  Promise.resolve(cleanupResult).finally(() => {
130098
130118
  clearTimeout(exitTimeout);
130119
+ if (exitAfterCleanup) {
130120
+ process.exit(exitCode);
130121
+ }
130099
130122
  });
130100
130123
  }
130101
130124
  function registerProcessSignal(signal, handler, exitAfter) {
@@ -130110,8 +130133,9 @@ function registerProcessSignal(signal, handler, exitAfter) {
130110
130133
  }
130111
130134
  function registerErrorEvent(signal, handler) {
130112
130135
  const listener = (error92) => {
130136
+ process.off(signal, listener);
130113
130137
  log(`[background-agent] ${signal} received during shutdown cleanup:`, error92);
130114
- scheduleForcedExit(handler(error92), 1);
130138
+ scheduleForcedExit(handler(error92), 1, true);
130115
130139
  };
130116
130140
  process.on(signal, listener);
130117
130141
  return listener;
@@ -130950,6 +130974,7 @@ class BackgroundManager {
130950
130974
  }
130951
130975
  spawnReservation.commit();
130952
130976
  this.markPreStartDescendantReservation(task);
130977
+ this.updateBackgroundTaskMarker(input.parentSessionId);
130953
130978
  this.processKey(key);
130954
130979
  return { ...task };
130955
130980
  } catch (error92) {
@@ -130997,6 +131022,7 @@ class BackgroundManager {
130997
131022
  if (item.task.sessionId) {
130998
131023
  await this.abortSessionWithLogging(item.task.sessionId, "startTask error cleanup");
130999
131024
  }
131025
+ this.updateBackgroundTaskMarker(item.task.parentSessionId);
131000
131026
  this.markForNotification(item.task);
131001
131027
  this.enqueueNotificationForParent(item.task.parentSessionId, () => this.notifyParentSession(item.task)).catch((err) => {
131002
131028
  log("[background-agent] Failed to notify on startTask error:", err);
@@ -131251,6 +131277,15 @@ The fallback retry session is now created and can be inspected directly.
131251
131277
  }
131252
131278
  return tasks;
131253
131279
  }
131280
+ updateBackgroundTaskMarker(parentSessionID) {
131281
+ const tasks = this.getTasksByParentSession(parentSessionID);
131282
+ const activeTasks = tasks.filter((t) => t.status === "running" || t.status === "pending");
131283
+ if (activeTasks.length > 0) {
131284
+ setContinuationMarkerSource(this.directory, parentSessionID, "background-task", "active", `${activeTasks.length} background task(s) active`);
131285
+ } else {
131286
+ setContinuationMarkerSource(this.directory, parentSessionID, "background-task", "idle");
131287
+ }
131288
+ }
131254
131289
  getAllDescendantTasks(sessionID) {
131255
131290
  const result = [];
131256
131291
  const directChildren = this.getTasksByParentSession(sessionID);
@@ -131831,6 +131866,9 @@ The fallback retry session is now created and can be inspected directly.
131831
131866
  if (task.sessionId) {
131832
131867
  SessionCategoryRegistry.remove(task.sessionId);
131833
131868
  }
131869
+ if (task.parentSessionId) {
131870
+ this.updateBackgroundTaskMarker(task.parentSessionId);
131871
+ }
131834
131872
  this.markForNotification(task);
131835
131873
  this.enqueueNotificationForParent(task.parentSessionId, () => this.notifyParentSession(task)).catch((err) => {
131836
131874
  log("[background-agent] Error in notifyParentSession for errored task:", { taskId: task.id, error: err });
@@ -132065,6 +132103,9 @@ ${originalText}`;
132065
132103
  SessionCategoryRegistry.remove(task.sessionId);
132066
132104
  }
132067
132105
  removeTaskToastTracking(task.id);
132106
+ if (task.parentSessionId) {
132107
+ this.updateBackgroundTaskMarker(task.parentSessionId);
132108
+ }
132068
132109
  if (options?.skipNotification) {
132069
132110
  this.cleanupPendingByParent(task);
132070
132111
  this.scheduleTaskRemoval(task.id);
@@ -132144,6 +132185,9 @@ ${originalText}`;
132144
132185
  await this.abortSessionWithLogging(task.sessionId, `task completion (${source})`);
132145
132186
  SessionCategoryRegistry.remove(task.sessionId);
132146
132187
  }
132188
+ if (task.parentSessionId) {
132189
+ this.updateBackgroundTaskMarker(task.parentSessionId);
132190
+ }
132147
132191
  try {
132148
132192
  await this.enqueueNotificationForParent(task.parentSessionId, () => this.notifyParentSession(task));
132149
132193
  log(`[background-agent] Task completed via ${source}:`, task.id);
@@ -132327,6 +132371,9 @@ ${originalText}`;
132327
132371
  }
132328
132372
  }
132329
132373
  this.cleanupPendingByParent(task);
132374
+ if (task.parentSessionId) {
132375
+ this.updateBackgroundTaskMarker(task.parentSessionId);
132376
+ }
132330
132377
  this.markForNotification(task);
132331
132378
  this.enqueueNotificationForParent(task.parentSessionId, () => this.notifyParentSession(task)).catch((err) => {
132332
132379
  log("[background-agent] Error in notifyParentSession for stale-pruned task:", { taskId: task.id, error: err });
@@ -132381,6 +132428,9 @@ ${originalText}`;
132381
132428
  if (task.sessionId) {
132382
132429
  SessionCategoryRegistry.remove(task.sessionId);
132383
132430
  }
132431
+ if (task.parentSessionId) {
132432
+ this.updateBackgroundTaskMarker(task.parentSessionId);
132433
+ }
132384
132434
  this.markForNotification(task);
132385
132435
  this.enqueueNotificationForParent(task.parentSessionId, () => this.notifyParentSession(task)).catch((err) => {
132386
132436
  log("[background-agent] Error in notifyParentSession for crashed task:", { taskId: task.id, error: err });
@@ -137489,7 +137539,8 @@ async function createStdioClient(params) {
137489
137539
  command,
137490
137540
  args,
137491
137541
  env: mergedEnv,
137492
- stderr: "ignore"
137542
+ stderr: "ignore",
137543
+ ...info.directory ? { cwd: info.directory } : {}
137493
137544
  });
137494
137545
  const client2 = stdioClientDependencies.createClient({ name: `skill-mcp-${info.skillName}-${info.serverName}`, version: "1.0.0" }, { capabilities: {} });
137495
137546
  try {
@@ -153320,7 +153371,6 @@ init_agent_display_names();
153320
153371
  init_agent_display_names();
153321
153372
 
153322
153373
  // src/plugin/ultrawork-db-model-override.ts
153323
- import { Database } from "bun:sqlite";
153324
153374
  import { join as join101 } from "path";
153325
153375
  import { existsSync as existsSync91 } from "fs";
153326
153376
  function getDbPath() {
@@ -153399,7 +153449,13 @@ function retryViaMicrotask(db, messageId, targetModel, variant, attempt) {
153399
153449
  });
153400
153450
  }
153401
153451
  function scheduleDeferredModelOverride(messageId, targetModel, variant) {
153402
- queueMicrotask(() => {
153452
+ queueMicrotask(async () => {
153453
+ const sqliteModule = await import("bun:sqlite").catch(() => null);
153454
+ const Database = sqliteModule?.Database;
153455
+ if (typeof Database !== "function") {
153456
+ log("[ultrawork-db-override] bun:sqlite unavailable, skipping deferred override", { messageId });
153457
+ return;
153458
+ }
153403
153459
  const dbPath = getDbPath();
153404
153460
  if (!existsSync91(dbPath)) {
153405
153461
  log("[ultrawork-db-override] DB not found, skipping deferred override");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wolfx/oh-my-openagent",
3
- "version": "3.17.13",
3
+ "version": "3.17.14",
4
4
  "description": "A fork of oh-my-openagent",
5
5
  "main": "./dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  "ai",
40
40
  "llm"
41
41
  ],
42
- "author": "wolfx",
42
+ "author": "YeonGyu-Kim",
43
43
  "license": "SUL-1.0",
44
44
  "repository": {
45
45
  "type": "git",