replicas-engine 0.1.955 → 0.1.957

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.
@@ -5,12 +5,12 @@ import {
5
5
  getCodexAspHost,
6
6
  restartCodexAspHost,
7
7
  restartCodexAspHostIfRunning
8
- } from "./chunk-TBGR5YLQ.js";
9
- import "./chunk-2E6P3M5D.js";
10
- import "./chunk-QWWOGPBU.js";
11
- import "./chunk-7QZTRTVH.js";
8
+ } from "./chunk-4TRSKDZK.js";
9
+ import "./chunk-42BR2ZBE.js";
10
+ import "./chunk-RQXIJ3IG.js";
11
+ import "./chunk-CYNWRZYJ.js";
12
12
  import "./chunk-UZSNFLDQ.js";
13
- import "./chunk-G2GE3X7J.js";
13
+ import "./chunk-FK3P6B55.js";
14
14
  import "./chunk-VEQXQN22.js";
15
15
  export {
16
16
  getCodexAspHost,
@@ -15,7 +15,7 @@ import {
15
15
  isValidRelayBaseProvider,
16
16
  parsePosixEnvFile,
17
17
  readReplicasRuntimeEnv
18
- } from "./chunk-G2GE3X7J.js";
18
+ } from "./chunk-FK3P6B55.js";
19
19
 
20
20
  // src/runtime-env-loader.ts
21
21
  import { readFileSync } from "fs";
@@ -116,12 +116,10 @@ function parseAgentCredentialSnapshots(value) {
116
116
  function loadEngineEnv(runtimeEnvValues) {
117
117
  loadRuntimeEnvFile(runtimeEnvValues);
118
118
  const HOME_DIR = homedir2();
119
- const backgroundTaskTimeoutMs = Number(readEnv("REPLICAS_CLAUDE_BACKGROUND_TASK_TIMEOUT_MS"));
120
119
  const env = {
121
120
  // Defined: always available
122
121
  REPLICAS_ENGINE_SECRET: requireDefined(readEnv("REPLICAS_ENGINE_SECRET"), "REPLICAS_ENGINE_SECRET"),
123
122
  REPLICAS_ENGINE_PORT: parsePort(readEnv("REPLICAS_ENGINE_PORT")),
124
- REPLICAS_CLAUDE_BACKGROUND_TASK_TIMEOUT_MS: Number.isInteger(backgroundTaskTimeoutMs) && backgroundTaskTimeoutMs >= 1e3 && backgroundTaskTimeoutMs <= 2147483647 ? backgroundTaskTimeoutMs : 36e5,
125
123
  REPLICAS_MONOLITH_URL: requireValidURL(
126
124
  requireDefined(readReplicasRuntimeEnv(readEnv, REPLICAS_RUNTIME_ENV_ALIASES.monolithUrl), "REPLICAS_MONOLITH_URL"),
127
125
  "REPLICAS_MONOLITH_URL"
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-G2GE3X7J.js";
8
+ } from "./chunk-FK3P6B55.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -5,15 +5,15 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-2E6P3M5D.js";
8
+ } from "./chunk-42BR2ZBE.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  buildCodexAgentEnv
12
- } from "./chunk-QWWOGPBU.js";
12
+ } from "./chunk-RQXIJ3IG.js";
13
13
  import {
14
14
  SUBPROCESS_MAX_BUFFER,
15
15
  execFileAsync
16
- } from "./chunk-7QZTRTVH.js";
16
+ } from "./chunk-CYNWRZYJ.js";
17
17
  import {
18
18
  isRecord
19
19
  } from "./chunk-UZSNFLDQ.js";
@@ -27,7 +27,7 @@ import {
27
27
  listOpenAICompatibleModels,
28
28
  readOllamaAuthEnv,
29
29
  resolveOpenAICompatibleModelsUrl
30
- } from "./chunk-G2GE3X7J.js";
30
+ } from "./chunk-FK3P6B55.js";
31
31
 
32
32
  // src/managers/codex-token-manager.ts
33
33
  import { promises as fs } from "fs";
@@ -260,7 +260,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
260
260
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
261
261
  await this.applyCredentialsResponse(data);
262
262
  setAgentCredentialSnapshot("codex", data);
263
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-MGF7VD4A.js");
263
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-65SEKM3Q.js");
264
264
  await restartCodexAspHostIfRunning2();
265
265
  });
266
266
  await this.start(true);
@@ -280,7 +280,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
280
280
  await this.applyCredentialUpdate(generation, async () => {
281
281
  await this.applyCredentialsResponse(data);
282
282
  if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
283
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-MGF7VD4A.js");
283
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-65SEKM3Q.js");
284
284
  await restartCodexAspHostIfRunning2();
285
285
  }
286
286
  setAgentCredentialSnapshot("codex", data);
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES
6
- } from "./chunk-G2GE3X7J.js";
6
+ } from "./chunk-FK3P6B55.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -4843,6 +4843,7 @@ var DEFAULT_USER_PREFERENCES = {
4843
4843
  auto_draft_prs: false,
4844
4844
  open_prs_in_graphite: false,
4845
4845
  open_links_in_desktop_app: false,
4846
+ mothership_in_dms: false,
4846
4847
  memory_enabled: null,
4847
4848
  default_fast_mode: false,
4848
4849
  agent_defaults: { ...EMPTY_AGENT_DEFAULT_SETTINGS },
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  execFileAsync
6
- } from "./chunk-7QZTRTVH.js";
6
+ } from "./chunk-CYNWRZYJ.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-G2GE3X7J.js";
9
+ } from "./chunk-FK3P6B55.js";
10
10
 
11
11
  // src/utils/codex-agent-env.ts
12
12
  function buildCodexAgentEnv(source = process.env) {
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
240
240
  if (method === "foundry") return "azure";
241
241
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
242
242
  }
243
- var ENGINE_PACKAGE_VERSION = "0.1.955";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.957";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -3,18 +3,18 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  monolithRequest
6
- } from "./chunk-2E6P3M5D.js";
6
+ } from "./chunk-42BR2ZBE.js";
7
7
  import {
8
8
  SUBPROCESS_MAX_BUFFER,
9
9
  execFileAsync
10
- } from "./chunk-7QZTRTVH.js";
10
+ } from "./chunk-CYNWRZYJ.js";
11
11
  import {
12
12
  extractCommandProtectionCommandText,
13
13
  findCommandProtectionGitLookups,
14
14
  findGitCommitSignals,
15
15
  findPrMergeSignals,
16
16
  parseCommandProtectionRequest
17
- } from "./chunk-G2GE3X7J.js";
17
+ } from "./chunk-FK3P6B55.js";
18
18
 
19
19
  // src/services/command-protection-service.ts
20
20
  import { readFile, stat } from "fs/promises";
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  RELAY_MCP_TOOL_NAMES
6
- } from "./chunk-G2GE3X7J.js";
6
+ } from "./chunk-FK3P6B55.js";
7
7
 
8
8
  // src/managers/relay-mcp-config.ts
9
9
  import { existsSync } from "fs";
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-ZMIWCS6O.js";
7
- import "./chunk-2E6P3M5D.js";
8
- import "./chunk-7QZTRTVH.js";
6
+ } from "./chunk-SI6WBUIS.js";
7
+ import "./chunk-42BR2ZBE.js";
8
+ import "./chunk-CYNWRZYJ.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-G2GE3X7J.js";
12
+ import "./chunk-FK3P6B55.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -8,13 +8,13 @@ import {
8
8
  import {
9
9
  AppServerProcess,
10
10
  buildCodexAgentEnv
11
- } from "./chunk-QWWOGPBU.js";
12
- import "./chunk-7QZTRTVH.js";
11
+ } from "./chunk-RQXIJ3IG.js";
12
+ import "./chunk-CYNWRZYJ.js";
13
13
  import {
14
14
  AGENT,
15
15
  getMemoryOutputSafetyViolation,
16
16
  headlessAgentRequestSchema
17
- } from "./chunk-G2GE3X7J.js";
17
+ } from "./chunk-FK3P6B55.js";
18
18
  import "./chunk-VEQXQN22.js";
19
19
 
20
20
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  reportCommandProtectionBlock,
33
33
  resolveDiffBase,
34
34
  runGitCommand
35
- } from "./chunk-ZMIWCS6O.js";
35
+ } from "./chunk-SI6WBUIS.js";
36
36
  import {
37
37
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
38
38
  AGENT_MESSAGE_DELTA_METHOD,
@@ -57,12 +57,12 @@ import {
57
57
  } from "./chunk-FLDA7BX3.js";
58
58
  import {
59
59
  publishedPullRequestUrls
60
- } from "./chunk-3KHBTUNG.js";
60
+ } from "./chunk-4HVJFYXK.js";
61
61
  import {
62
62
  RELAY_MCP_TOOL_TIMEOUT_MS,
63
63
  relayCodexMcpConfig,
64
64
  relayMcpProcessConfig
65
- } from "./chunk-AUCJ3CV7.js";
65
+ } from "./chunk-YUMGTIR3.js";
66
66
  import {
67
67
  BaseRefreshManager,
68
68
  CodexAspAuthMethodChangedError,
@@ -77,7 +77,7 @@ import {
77
77
  refreshDelayMs,
78
78
  restartCodexAspHost,
79
79
  routineRefreshExclusions
80
- } from "./chunk-TBGR5YLQ.js";
80
+ } from "./chunk-4TRSKDZK.js";
81
81
  import {
82
82
  ENGINE_ENV,
83
83
  monolithRequest,
@@ -85,16 +85,16 @@ import {
85
85
  readRuntimeEnvFile,
86
86
  reloadEngineEnv,
87
87
  setAgentCredentialSnapshot
88
- } from "./chunk-2E6P3M5D.js";
88
+ } from "./chunk-42BR2ZBE.js";
89
89
  import {
90
90
  AspClient,
91
91
  getCodexModelProvider
92
- } from "./chunk-QWWOGPBU.js";
92
+ } from "./chunk-RQXIJ3IG.js";
93
93
  import {
94
94
  SUBPROCESS_MAX_BUFFER,
95
95
  execAsync,
96
96
  execFileAsync
97
- } from "./chunk-7QZTRTVH.js";
97
+ } from "./chunk-CYNWRZYJ.js";
98
98
  import {
99
99
  isRecord as isRecord2
100
100
  } from "./chunk-UZSNFLDQ.js";
@@ -327,7 +327,7 @@ import {
327
327
  workspaceCredentialProviderSchema,
328
328
  workspaceTokenRequestSchema,
329
329
  workspaceTokenResponseSchema
330
- } from "./chunk-G2GE3X7J.js";
330
+ } from "./chunk-FK3P6B55.js";
331
331
  import {
332
332
  cloneMcpConfig,
333
333
  ensureCompatibilityImports,
@@ -12954,59 +12954,15 @@ function isClaudeSessionActive(activity) {
12954
12954
 
12955
12955
  // src/managers/claude-background-tasks.ts
12956
12956
  var ClaudeBackgroundTasks = class {
12957
- active = /* @__PURE__ */ new Map();
12958
- persistentMonitors = /* @__PURE__ */ new Set();
12957
+ active = /* @__PURE__ */ new Set();
12959
12958
  reset() {
12960
12959
  this.active.clear();
12961
- this.persistentMonitors.clear();
12962
12960
  }
12963
- update(message, now = Date.now()) {
12964
- if (message.type === "assistant") {
12965
- for (const block of message.message.content) {
12966
- if (block.type === "tool_use" && block.name === "Monitor" && typeof block.input === "object" && block.input !== null && "persistent" in block.input && block.input.persistent === true) {
12967
- this.persistentMonitors.add(block.id);
12968
- }
12969
- }
12970
- return;
12971
- }
12972
- if (message.type !== "system") return;
12973
- if (message.subtype === "background_tasks_changed") {
12974
- const liveIds = /* @__PURE__ */ new Set();
12975
- for (const task2 of message.tasks) {
12976
- if (task2.ambient) continue;
12977
- liveIds.add(task2.task_id);
12978
- const existing = this.active.get(task2.task_id);
12979
- this.active.set(task2.task_id, {
12980
- ...existing,
12981
- description: task2.description,
12982
- startedAt: existing?.startedAt ?? now,
12983
- persistentMonitor: existing?.persistentMonitor || this.persistentMonitors.has(task2.task_id)
12984
- });
12985
- }
12986
- for (const id of this.active.keys()) {
12987
- if (!liveIds.has(id)) {
12988
- this.active.delete(id);
12989
- this.persistentMonitors.delete(id);
12990
- }
12991
- }
12992
- return;
12993
- }
12994
- const payload = coerceBackgroundTaskPayload(message);
12995
- if (!payload) return;
12996
- const toolUseId = "tool_use_id" in message ? message.tool_use_id : void 0;
12997
- if (toolUseId && this.persistentMonitors.has(toolUseId)) {
12998
- this.persistentMonitors.add(payload.taskId);
12999
- this.persistentMonitors.delete(toolUseId);
13000
- }
13001
- const status = payload.subtype === "task_updated" ? payload.patch?.status : payload.status;
13002
- const task = this.active.get(payload.taskId);
13003
- if (!task) return;
13004
- task.description = payload.description ?? payload.patch?.description ?? task.description;
13005
- task.persistentMonitor ||= this.persistentMonitors.has(payload.taskId);
13006
- if (status === "paused") task.pausedAt ??= now;
13007
- else if (status === "running" && task.pausedAt !== void 0) {
13008
- task.startedAt += now - task.pausedAt;
13009
- task.pausedAt = void 0;
12961
+ update(message) {
12962
+ if (message.type !== "system" || message.subtype !== "background_tasks_changed") return;
12963
+ this.active.clear();
12964
+ for (const task of message.tasks) {
12965
+ if (!task.ambient) this.active.add(task.task_id);
13010
12966
  }
13011
12967
  }
13012
12968
  };
@@ -13102,7 +13058,6 @@ var CLAUDE_SLASH_COMMANDS_CACHE_MS = 6e4;
13102
13058
  var CLAUDE_SLASH_COMMANDS_DISCOVERY_TIMEOUT_MS = 3e4;
13103
13059
  var CLAUDE_BACKGROUND_CONTINUATION_GRACE_MS = 1e4;
13104
13060
  var CLAUDE_BACKGROUND_RECOVERY_START_TIMEOUT_MS = 6e4;
13105
- var CLAUDE_BACKGROUND_STOP_TIMEOUT_MS = 5e3;
13106
13061
  function supportsClaudeThinkingDisplay(model) {
13107
13062
  const normalized = (normalizeClaudeModel(model) ?? model).toLowerCase();
13108
13063
  return AGENT_MODELS.claude.includes(normalized) || /^claude-(?:opus|sonnet|haiku)-[4-9]/.test(normalized);
@@ -13263,9 +13218,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13263
13218
  backgroundContinuationTimer = null;
13264
13219
  pendingInterrupt = false;
13265
13220
  backgroundTasks = new ClaudeBackgroundTasks();
13266
- backgroundWatchdogTimer = null;
13267
13221
  backgroundRecoveryAttempted = false;
13268
- backgroundWatchdogTriggered = false;
13269
13222
  // Ultracode workflow child agents never reach the SDK stream (forwardSubagentText
13270
13223
  // covers only Task subagents); their conversations exist solely as
13271
13224
  // agent-<agentId>.jsonl files in the run's transcript directory, keyed by task id.
@@ -13785,7 +13738,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13785
13738
  }
13786
13739
  const combinedInstructions = [
13787
13740
  this.buildCombinedInstructions(customInstructions, true),
13788
- "Background tasks must have a concrete completion condition. Use foreground commands for sequential work and managed workspace services for servers. Reserve persistent Monitor tasks for ongoing watches the user requested. You may end a turn while actual background work continues, but do not promise a later update unless a task was successfully launched. Report completion or failure when its notification arrives; do not restart timed-out work automatically."
13741
+ "Background tasks must have a concrete completion condition. Use foreground commands for sequential work and managed workspace services for servers. Reserve persistent Monitor tasks for ongoing watches the user requested. You may end a turn while actual background work continues, but do not promise a later update unless a task was successfully launched. Report completion or failure when its notification arrives."
13789
13742
  ].filter(Boolean).join("\n\n");
13790
13743
  const resolvedModel = normalizeClaudeModel(model) || (this.claudeAuthMethod() === "ollama" ? DEFAULT_OLLAMA_MODEL : void 0) || DEFAULT_CLAUDE_MODEL;
13791
13744
  const claudeCodeModel = toClaudeCodeModel(resolvedModel, this.turnCredentials ? this.turnCredentials.method === "bedrock" : ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD === "bedrock" || ENGINE_ENV.CLAUDE_CODE_USE_BEDROCK === "1");
@@ -14078,7 +14031,6 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
14078
14031
  updateClaudeSessionActivity(this.sessionActivity, msg);
14079
14032
  const hadActiveBackgroundTasks = this.backgroundTasks.active.size > 0;
14080
14033
  this.backgroundTasks.update(msg);
14081
- this.scheduleBackgroundWatchdog();
14082
14034
  if (hadActiveBackgroundTasks && this.backgroundTasks.active.size === 0) {
14083
14035
  this.startBackgroundContinuationGrace();
14084
14036
  }
@@ -14147,9 +14099,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
14147
14099
  this.clearBackgroundContinuationTimer();
14148
14100
  resetClaudeSessionActivity(this.sessionActivity);
14149
14101
  this.backgroundTasks.reset();
14150
- this.clearBackgroundWatchdog();
14151
14102
  this.backgroundRecoveryAttempted = false;
14152
- this.backgroundWatchdogTriggered = false;
14153
14103
  this.workflowTranscripts.clear();
14154
14104
  this.ambientTaskIds.clear();
14155
14105
  this.pendingBackgroundCompletion = false;
@@ -14165,13 +14115,11 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
14165
14115
  this.pendingTurn = null;
14166
14116
  this.pendingInterrupt = false;
14167
14117
  this.pendingBackgroundCompletion = this.backgroundTasks.active.size > 0 || this.backgroundContinuationTimer !== null;
14168
- if (!this.pendingBackgroundCompletion) this.backgroundWatchdogTriggered = false;
14169
14118
  pending.resolve();
14170
14119
  }
14171
14120
  maybeCompleteBackgroundTurn() {
14172
14121
  if (!this.pendingBackgroundCompletion || this.pendingTurn || this.messageQueue.isProcessing() || this.backgroundTasks.active.size > 0 || this.backgroundContinuationTimer !== null || isClaudeSessionActive(this.sessionActivity)) return;
14173
14122
  this.pendingBackgroundCompletion = false;
14174
- this.backgroundWatchdogTriggered = false;
14175
14123
  this.notifyBackgroundTurnComplete();
14176
14124
  }
14177
14125
  notifyBackgroundTurnComplete(after) {
@@ -14221,77 +14169,11 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
14221
14169
  parent_tool_use_id: null,
14222
14170
  message: {
14223
14171
  role: "user",
14224
- content: `${this.backgroundWatchdogTriggered ? "Replicas cancelled background work because it exceeded its time limit; this was a watchdog cancellation, not a user cancellation. " : ""}Your background tasks have finished. Process their completion notifications and report the actual results. Continue only work that remains from the user request; do not repeat completed actions or restart finished tasks.`
14172
+ content: "Your background tasks have finished. Process their completion notifications and report the actual results. Continue only work that remains from the user request; do not repeat completed actions or restart finished tasks."
14225
14173
  }
14226
14174
  });
14227
14175
  this.backgroundContinuationTimer = setTimeout(() => this.recoverBackgroundContinuation(query2), CLAUDE_BACKGROUND_RECOVERY_START_TIMEOUT_MS);
14228
14176
  }
14229
- clearBackgroundWatchdog() {
14230
- if (this.backgroundWatchdogTimer) clearTimeout(this.backgroundWatchdogTimer);
14231
- this.backgroundWatchdogTimer = null;
14232
- }
14233
- scheduleBackgroundWatchdog() {
14234
- this.clearBackgroundWatchdog();
14235
- const query2 = this.activeQuery;
14236
- if (!query2) return;
14237
- let deadline = Infinity;
14238
- for (const task of this.backgroundTasks.active.values()) {
14239
- if (task.stopRequestedAt !== void 0) {
14240
- deadline = Math.min(deadline, task.stopRequestedAt + CLAUDE_BACKGROUND_STOP_TIMEOUT_MS);
14241
- } else if (task.pausedAt === void 0 && !task.persistentMonitor) {
14242
- deadline = Math.min(deadline, task.startedAt + ENGINE_ENV.REPLICAS_CLAUDE_BACKGROUND_TASK_TIMEOUT_MS);
14243
- }
14244
- }
14245
- if (!Number.isFinite(deadline)) return;
14246
- this.backgroundWatchdogTimer = setTimeout(() => this.checkBackgroundTasks(query2), Math.max(0, deadline - Date.now()));
14247
- }
14248
- checkBackgroundTasks(query2) {
14249
- if (this.activeQuery !== query2) return;
14250
- this.backgroundWatchdogTimer = null;
14251
- const now = Date.now();
14252
- for (const [id, task] of this.backgroundTasks.active) {
14253
- if (task.stopRequestedAt !== void 0) {
14254
- if (now - task.stopRequestedAt >= CLAUDE_BACKGROUND_STOP_TIMEOUT_MS) {
14255
- void this.failBackgroundSession(query2, "A background task did not stop after reaching its time limit. Claude and its remaining tasks were stopped; send a message to continue.");
14256
- return;
14257
- }
14258
- continue;
14259
- }
14260
- if (task.pausedAt !== void 0 || task.persistentMonitor || now - task.startedAt < ENGINE_ENV.REPLICAS_CLAUDE_BACKGROUND_TASK_TIMEOUT_MS) continue;
14261
- if (this.isAwaitingInput() || this.sessionActivity.state === "requires_action") {
14262
- task.startedAt = now;
14263
- continue;
14264
- }
14265
- task.stopRequestedAt = now;
14266
- if (!this.backgroundWatchdogTriggered) {
14267
- this.backgroundWatchdogTriggered = true;
14268
- this.activePromptStream?.push({
14269
- type: "user",
14270
- uuid: randomUUID5(),
14271
- isSynthetic: true,
14272
- shouldQuery: false,
14273
- session_id: this.sessionId ?? "",
14274
- parent_tool_use_id: null,
14275
- message: {
14276
- role: "user",
14277
- content: "Replicas is cancelling background work that exceeded its execution time limit. Report its stop notifications as watchdog timeouts, not user cancellations. Do not restart timed-out work unless the user asks."
14278
- }
14279
- });
14280
- }
14281
- void this.recordEvent({
14282
- type: "system",
14283
- subtype: "task_updated",
14284
- task_id: id,
14285
- uuid: randomUUID5(),
14286
- session_id: this.sessionId ?? "",
14287
- patch: { description: task.description, error: "Background task exceeded its execution time limit. Replicas requested cancellation." }
14288
- });
14289
- void query2.stopTask(id).catch((error) => {
14290
- console.warn("[ClaudeManager] Background task stop failed:", error);
14291
- });
14292
- }
14293
- this.scheduleBackgroundWatchdog();
14294
- }
14295
14177
  async failBackgroundSession(query2, message) {
14296
14178
  if (this.activeQuery !== query2) return;
14297
14179
  await this.emitTerminalErrorResult(message, [message]);
@@ -14333,7 +14215,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
14333
14215
  }
14334
14216
  }
14335
14217
  settleBackgroundTasks(error) {
14336
- for (const taskId of this.backgroundTasks.active.keys()) {
14218
+ for (const taskId of this.backgroundTasks.active) {
14337
14219
  void this.recordEvent({
14338
14220
  type: "system",
14339
14221
  subtype: "task_updated",
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  publishedPullRequestUrls
6
- } from "./chunk-3KHBTUNG.js";
6
+ } from "./chunk-4HVJFYXK.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-G2GE3X7J.js";
12
+ } from "./chunk-FK3P6B55.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
- import "./chunk-AUCJ3CV7.js";
4
+ import "./chunk-YUMGTIR3.js";
5
5
  import {
6
6
  RELAY_MCP_SERVER_NAME,
7
7
  RELAY_MCP_TOOLS,
@@ -10,7 +10,7 @@ import {
10
10
  relaySubagentResponseSchema,
11
11
  spawnRelaySubagentRequestSchema,
12
12
  waitRelaySubagentRequestSchema
13
- } from "./chunk-G2GE3X7J.js";
13
+ } from "./chunk-FK3P6B55.js";
14
14
  import "./chunk-VEQXQN22.js";
15
15
 
16
16
  // src/relay-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.955",
3
+ "version": "0.1.957",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",