replicas-engine 0.1.1452 → 0.1.1454
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/src/{asp-host-DPVDBSV3.js → asp-host-FYKFATT5.js} +5 -5
- package/dist/src/{chunk-4TVRVNJ7.js → chunk-DGOWHV5K.js} +2 -2
- package/dist/src/{chunk-I46ERFFW.js → chunk-ETZA25S4.js} +5 -0
- package/dist/src/{chunk-AE7B6TBT.js → chunk-FTBDQ4MM.js} +2 -2
- package/dist/src/{chunk-RVRPVO62.js → chunk-IZE5GUZU.js} +6 -6
- package/dist/src/{chunk-RT656HSI.js → chunk-LZBE7IID.js} +1 -1
- package/dist/src/{chunk-6HRL6XD5.js → chunk-QE5WPWS6.js} +2 -2
- package/dist/src/{chunk-5FFOJDHU.js → chunk-SOS3XGPH.js} +1 -1
- package/dist/src/{chunk-3NVDZQDZ.js → chunk-XXJWYAG3.js} +3 -3
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +4 -4
- package/dist/src/index.js +39 -20
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
listCodexModelsForDetails,
|
|
9
9
|
restartCodexAspHost,
|
|
10
10
|
restartCodexAspHostIfRunning
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-IZE5GUZU.js";
|
|
12
|
+
import "./chunk-DGOWHV5K.js";
|
|
13
|
+
import "./chunk-XXJWYAG3.js";
|
|
14
|
+
import "./chunk-LZBE7IID.js";
|
|
15
15
|
import "./chunk-UZSNFLDQ.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-ETZA25S4.js";
|
|
17
17
|
import "./chunk-VEQXQN22.js";
|
|
18
18
|
export {
|
|
19
19
|
CODEX_ULTRAFAST_SERVICE_TIER,
|
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
SUBPROCESS_MAX_BUFFER,
|
|
6
6
|
execFileAsync
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LZBE7IID.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord as isRecord2
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
provisionedDeviceSchema,
|
|
22
22
|
readReplicasRuntimeEnv,
|
|
23
23
|
serializePosixEnvFile
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-ETZA25S4.js";
|
|
25
25
|
|
|
26
26
|
// src/runtime-env-loader.ts
|
|
27
27
|
import { readFileSync } from "fs";
|
|
@@ -11103,6 +11103,7 @@ var sendChatMessageResponseSchema = z5.object({
|
|
|
11103
11103
|
chatId: z5.string().optional(),
|
|
11104
11104
|
steered: z5.boolean().optional()
|
|
11105
11105
|
});
|
|
11106
|
+
var interruptChatRequestSchema = z5.object({ stoppedAt: z5.string().datetime().optional() });
|
|
11106
11107
|
var respondToolInputRequestSchema = z5.object({
|
|
11107
11108
|
requestId: z5.string().min(1),
|
|
11108
11109
|
selectionId: z5.string().min(1),
|
|
@@ -15072,6 +15073,7 @@ var USER_MESSAGE_MATCH_GRACE_PERIOD_MS = 3e4;
|
|
|
15072
15073
|
var COMPACTION_CONTENT = "Context compacted";
|
|
15073
15074
|
var GOAL_TOOL_NAME = "goal";
|
|
15074
15075
|
var CLAUDE_SUBAGENT_TOOL_NAMES = /* @__PURE__ */ new Set(["Task", "Agent"]);
|
|
15076
|
+
var CLAUDE_STOPPED_TOOL_RESULT = "The user doesn't want to proceed with this tool use. The tool use was rejected (eg. if it was a file edit, the new_string was NOT written to the file). STOP what you are doing";
|
|
15075
15077
|
|
|
15076
15078
|
// ../shared/src/user-message-parser/chat-fork.ts
|
|
15077
15079
|
var OPEN_MARKER = "<!-- replicas:chat-fork ";
|
|
@@ -17918,6 +17920,7 @@ function extractToolResult(event) {
|
|
|
17918
17920
|
const toolResult = normalizeContentBlocks(event.payload.message?.content).find((c) => c.type === "tool_result");
|
|
17919
17921
|
if (!toolResult?.tool_use_id) return void 0;
|
|
17920
17922
|
const output = extractToolResultText(toolResult.content);
|
|
17923
|
+
if (toolResult.is_error && (output.startsWith(CLAUDE_STOPPED_TOOL_RESULT) || output.startsWith("The user doesn't want to take this action right now"))) return void 0;
|
|
17921
17924
|
const exitCode = output.match(/exit code:?\s*(\d+)/i)?.[1];
|
|
17922
17925
|
return {
|
|
17923
17926
|
toolResult,
|
|
@@ -21292,6 +21295,7 @@ export {
|
|
|
21292
21295
|
codexTurnFromEvent,
|
|
21293
21296
|
codexTranscriptToEvents,
|
|
21294
21297
|
steerQueuedInOrder,
|
|
21298
|
+
interruptChatRequestSchema,
|
|
21295
21299
|
respondToolInputRequestSchema,
|
|
21296
21300
|
isLatestChatHistoryPage,
|
|
21297
21301
|
getChatHistoryPageSenders,
|
|
@@ -21347,6 +21351,7 @@ export {
|
|
|
21347
21351
|
truncateMothershipEventResponse,
|
|
21348
21352
|
formatMothershipEvents,
|
|
21349
21353
|
coerceBackgroundTaskPayload,
|
|
21354
|
+
CLAUDE_STOPPED_TOOL_RESULT,
|
|
21350
21355
|
CHAT_FORK_EXCERPT_OMITTED_NOTICE,
|
|
21351
21356
|
formatChatForkHandoffMessage,
|
|
21352
21357
|
formatChatForkUpdateMessage,
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
AspClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XXJWYAG3.js";
|
|
7
7
|
import {
|
|
8
8
|
ASTER_BASE_URL,
|
|
9
9
|
ASTER_PROVIDER,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
isRecord,
|
|
16
16
|
readOllamaAuthEnv,
|
|
17
17
|
readOpenAICompatibleAuthEnv
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ETZA25S4.js";
|
|
19
19
|
|
|
20
20
|
// src/managers/codex-asp/notification-dispatch.ts
|
|
21
21
|
var TURN_STARTED_METHOD = "turn/started";
|
|
@@ -11,15 +11,15 @@ import {
|
|
|
11
11
|
resolveDiffBase,
|
|
12
12
|
runGitCommand,
|
|
13
13
|
setAgentCredentialSnapshot
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DGOWHV5K.js";
|
|
15
15
|
import {
|
|
16
16
|
AppServerProcess,
|
|
17
17
|
buildCodexAgentEnv
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-XXJWYAG3.js";
|
|
19
19
|
import {
|
|
20
20
|
SUBPROCESS_MAX_BUFFER,
|
|
21
21
|
execFileAsync
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-LZBE7IID.js";
|
|
23
23
|
import {
|
|
24
24
|
isRecord
|
|
25
25
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
resolveOpenAICompatibleModelsUrl,
|
|
58
58
|
splitMothershipInstructions,
|
|
59
59
|
withTimeout
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-ETZA25S4.js";
|
|
61
61
|
|
|
62
62
|
// src/managers/codex-token-manager.ts
|
|
63
63
|
import { promises as fs } from "fs";
|
|
@@ -320,7 +320,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
320
320
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
321
321
|
await this.applyCredentialsResponse(data);
|
|
322
322
|
setAgentCredentialSnapshot("codex", data);
|
|
323
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
323
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-FYKFATT5.js");
|
|
324
324
|
await restartCodexAspHostIfRunning2();
|
|
325
325
|
});
|
|
326
326
|
await this.start(true);
|
|
@@ -342,7 +342,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
342
342
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
343
343
|
await this.applyCredentialsResponse(data);
|
|
344
344
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
345
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
345
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-FYKFATT5.js");
|
|
346
346
|
await restartCodexAspHostIfRunning2();
|
|
347
347
|
}
|
|
348
348
|
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-
|
|
6
|
+
} from "./chunk-ETZA25S4.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getOriginDefaultBranch,
|
|
7
7
|
monolithRequest,
|
|
8
8
|
runGitCommand
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DGOWHV5K.js";
|
|
10
10
|
import {
|
|
11
11
|
extractCommandProtectionCommandText,
|
|
12
12
|
findCommandProtectionGitLookups,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
findPrMergeSignals,
|
|
15
15
|
findScoutRepoWriteSignals,
|
|
16
16
|
parseCommandProtectionRequest
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ETZA25S4.js";
|
|
18
18
|
|
|
19
19
|
// src/services/command-protection-service.ts
|
|
20
20
|
import { readFile, stat } from "fs/promises";
|
|
@@ -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-
|
|
6
|
+
} from "./chunk-LZBE7IID.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ETZA25S4.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.
|
|
243
|
+
var ENGINE_PACKAGE_VERSION = "0.1.1454";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -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-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-QE5WPWS6.js";
|
|
7
|
+
import "./chunk-DGOWHV5K.js";
|
|
8
|
+
import "./chunk-LZBE7IID.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-ETZA25S4.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
recoverCompletedTurn,
|
|
15
15
|
spawnMuseMsp,
|
|
16
16
|
startMuseSession
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FTBDQ4MM.js";
|
|
18
18
|
import {
|
|
19
19
|
AppServerProcess,
|
|
20
20
|
buildCodexAgentEnv
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-XXJWYAG3.js";
|
|
22
|
+
import "./chunk-LZBE7IID.js";
|
|
23
23
|
import {
|
|
24
24
|
AGENT,
|
|
25
25
|
OPENCODE_GO_PROVIDER,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
headlessAgentUsagePath,
|
|
30
30
|
isRecord,
|
|
31
31
|
withTimeout
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-ETZA25S4.js";
|
|
33
33
|
import "./chunk-VEQXQN22.js";
|
|
34
34
|
|
|
35
35
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
evaluateCommandProtection,
|
|
28
28
|
extractToolCommand,
|
|
29
29
|
reportCommandProtectionBlock
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-QE5WPWS6.js";
|
|
31
31
|
import {
|
|
32
32
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
33
33
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -65,10 +65,10 @@ import {
|
|
|
65
65
|
spawnMuseMsp,
|
|
66
66
|
startMuseSession,
|
|
67
67
|
uuidV7
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-FTBDQ4MM.js";
|
|
69
69
|
import {
|
|
70
70
|
publishedPullRequestUrls
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-SOS3XGPH.js";
|
|
72
72
|
import {
|
|
73
73
|
ACCOUNT_RATE_LIMITS_READ_METHOD,
|
|
74
74
|
AsyncLock,
|
|
@@ -143,7 +143,7 @@ import {
|
|
|
143
143
|
timestampFromSeconds,
|
|
144
144
|
upsertCredentialFileLines,
|
|
145
145
|
writeSecureCredentialFile
|
|
146
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-IZE5GUZU.js";
|
|
147
147
|
import {
|
|
148
148
|
ENGINE_ENV,
|
|
149
149
|
UNQUOTED_PATHS_CONFIG,
|
|
@@ -154,15 +154,15 @@ import {
|
|
|
154
154
|
resolveDiffBase,
|
|
155
155
|
setAgentCredentialSnapshot,
|
|
156
156
|
setLinearSessionId
|
|
157
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-DGOWHV5K.js";
|
|
158
158
|
import {
|
|
159
159
|
getCodexModelProvider
|
|
160
|
-
} from "./chunk-
|
|
160
|
+
} from "./chunk-XXJWYAG3.js";
|
|
161
161
|
import {
|
|
162
162
|
SUBPROCESS_MAX_BUFFER,
|
|
163
163
|
execAsync,
|
|
164
164
|
execFileAsync
|
|
165
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-LZBE7IID.js";
|
|
166
166
|
import {
|
|
167
167
|
isRecord as isRecord2
|
|
168
168
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -191,6 +191,7 @@ import {
|
|
|
191
191
|
CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE,
|
|
192
192
|
CLAUDE_PEER_MESSAGE_EVENT_TYPE,
|
|
193
193
|
CLAUDE_SONNET_5_BEDROCK_MODEL,
|
|
194
|
+
CLAUDE_STOPPED_TOOL_RESULT,
|
|
194
195
|
CODEX_ASP_ITEM_ID_PAYLOAD_KEY,
|
|
195
196
|
CODEX_HISTORY_FORMAT_EVENT_TYPE,
|
|
196
197
|
CODEX_ITEM_EVENT_TYPE,
|
|
@@ -344,6 +345,7 @@ import {
|
|
|
344
345
|
hasChatStarted,
|
|
345
346
|
hasGeneratedChatTitle,
|
|
346
347
|
imageContentToUserMessageImages,
|
|
348
|
+
interruptChatRequestSchema,
|
|
347
349
|
isAgentChatMcpActivityRecord,
|
|
348
350
|
isAgentChatSkillActivityRecord,
|
|
349
351
|
isAgentChatTurnActivityRecord,
|
|
@@ -435,7 +437,7 @@ import {
|
|
|
435
437
|
workspaceTokenRequestSchema,
|
|
436
438
|
workspaceTokenResponseSchema,
|
|
437
439
|
wrapInTag
|
|
438
|
-
} from "./chunk-
|
|
440
|
+
} from "./chunk-ETZA25S4.js";
|
|
439
441
|
import {
|
|
440
442
|
cloneMcpConfig,
|
|
441
443
|
ensureCompatibilityImports,
|
|
@@ -11782,6 +11784,7 @@ Native subagent tools are disabled in this workspace. To delegate work to a suba
|
|
|
11782
11784
|
// src/managers/coding-agent-manager.ts
|
|
11783
11785
|
var MAX_INTERRUPT_QUEUE_ITEMS = 1e3;
|
|
11784
11786
|
var MAX_INTERRUPT_QUEUE_CHARS = 2e5;
|
|
11787
|
+
var MAX_REQUESTED_STOP_AGE_MS = 1e4;
|
|
11785
11788
|
function toQueuedMessageInfo(message) {
|
|
11786
11789
|
return {
|
|
11787
11790
|
id: message.id,
|
|
@@ -11999,8 +12002,10 @@ ${request.message}` }, senderKey };
|
|
|
11999
12002
|
if (!history?.appendDurably) throw new Error("Chat history is unavailable");
|
|
12000
12003
|
await history.appendDurably(event);
|
|
12001
12004
|
}
|
|
12002
|
-
async interrupt(persistRemoval) {
|
|
12003
|
-
const
|
|
12005
|
+
async interrupt(persistRemoval, requestedStoppedAt) {
|
|
12006
|
+
const now = Date.now();
|
|
12007
|
+
const requested = requestedStoppedAt ? Date.parse(requestedStoppedAt) : NaN;
|
|
12008
|
+
const stoppedAt = new Date(requested <= now && requested > now - MAX_REQUESTED_STOP_AGE_MS ? requested : now).toISOString();
|
|
12004
12009
|
const queuedMessages = this.messageQueue.drainQueue();
|
|
12005
12010
|
const unreadSteers = [...this.unreadSteers.values()];
|
|
12006
12011
|
const earlySteers = this.earlySteers.splice(0);
|
|
@@ -12011,7 +12016,7 @@ ${request.message}` }, senderKey };
|
|
|
12011
12016
|
const isProcessing = this.isProcessing() || (this.hasActiveBackgroundTasks?.() ?? false);
|
|
12012
12017
|
if (isProcessing) {
|
|
12013
12018
|
try {
|
|
12014
|
-
await this.interruptActiveTurn();
|
|
12019
|
+
await this.interruptActiveTurn(stoppedAt);
|
|
12015
12020
|
} catch (error) {
|
|
12016
12021
|
for (const steer of unreadSteers) this.unreadSteers.set(steer.message.id, steer);
|
|
12017
12022
|
for (const steer of earlySteers) this.withdrawnSteers.delete(steer);
|
|
@@ -13085,7 +13090,6 @@ var COMMAND_PROTECTION_SAFE_TOOLS = /* @__PURE__ */ new Set([
|
|
|
13085
13090
|
"WebFetch",
|
|
13086
13091
|
"LS"
|
|
13087
13092
|
]);
|
|
13088
|
-
var CLAUDE_STOPPED_TOOL_RESULT = "The user doesn't want to proceed with this tool use. The tool use was rejected (eg. if it was a file edit, the new_string was NOT written to the file). STOP what you are doing";
|
|
13089
13093
|
var CLAUDE_PARTIAL_MESSAGE_FLUSH_MS = 80;
|
|
13090
13094
|
var CLAUDE_SLASH_COMMANDS_CACHE_MS = 6e4;
|
|
13091
13095
|
var CLAUDE_SLASH_COMMANDS_DISCOVERY_TIMEOUT_MS = 3e4;
|
|
@@ -13260,6 +13264,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13260
13264
|
sessionActivity = createClaudeSessionActivity();
|
|
13261
13265
|
backgroundContinuationTimer = null;
|
|
13262
13266
|
pendingInterrupt = false;
|
|
13267
|
+
stoppedAtMs = Infinity;
|
|
13263
13268
|
// A turn started before a stop's teardown would run on the process being stopped and end with it.
|
|
13264
13269
|
stopping = null;
|
|
13265
13270
|
// Claude Code emits a stopped turn's partial reply only after acknowledging the interrupt, so teardown waits for the turn to end.
|
|
@@ -13312,8 +13317,9 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13312
13317
|
getHistorySink() {
|
|
13313
13318
|
return this.historyFile;
|
|
13314
13319
|
}
|
|
13315
|
-
async interruptActiveTurn() {
|
|
13320
|
+
async interruptActiveTurn(stoppedAt) {
|
|
13316
13321
|
this.pendingInterrupt = true;
|
|
13322
|
+
this.stoppedAtMs = stoppedAt ? Date.parse(stoppedAt) : Date.now();
|
|
13317
13323
|
const stopping = (async () => {
|
|
13318
13324
|
await this.abortAllPendingToolInputs();
|
|
13319
13325
|
const query2 = this.activeQuery;
|
|
@@ -14214,8 +14220,18 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
14214
14220
|
}
|
|
14215
14221
|
}
|
|
14216
14222
|
if (this.pendingInterrupt) {
|
|
14217
|
-
if (msg.type === "
|
|
14218
|
-
else if (msg.type === "
|
|
14223
|
+
if (msg.type === "user") await this.recordEvent(msg);
|
|
14224
|
+
else if (msg.type === "assistant") {
|
|
14225
|
+
const stream = this.partialMessageStreams.get(`${msg.session_id}:${msg.parent_tool_use_id ?? "root"}`);
|
|
14226
|
+
let streamed = stream?.streamId === msg.message.id ? stream.flushes.findLast(({ at }) => at <= this.stoppedAtMs)?.length ?? 0 : Infinity;
|
|
14227
|
+
const content = msg.message.content.map((block) => {
|
|
14228
|
+
if (block.type !== "text") return block;
|
|
14229
|
+
const text = block.text.slice(0, streamed);
|
|
14230
|
+
streamed -= text.length;
|
|
14231
|
+
return { ...block, text };
|
|
14232
|
+
}).filter((block) => block.type !== "text" || block.text);
|
|
14233
|
+
await this.recordEvent({ ...msg, message: { ...msg.message, content } });
|
|
14234
|
+
} else if (msg.type === "result") this.stoppedTurnEnded?.resolve();
|
|
14219
14235
|
continue;
|
|
14220
14236
|
}
|
|
14221
14237
|
if (msg.type === "assistant" && msg.error === "invalid_request" && msg.message.model === "<synthetic>") {
|
|
@@ -14620,6 +14636,7 @@ ${msg.result}` } : { ...msg, errors: [loginFailure, ...msg.errors] } : msg);
|
|
|
14620
14636
|
this.clearPartialMessageFlush(key);
|
|
14621
14637
|
const stream = this.partialMessageStreams.get(key);
|
|
14622
14638
|
if (!stream || !stream.text && !stream.thinking && !stream.tool) return;
|
|
14639
|
+
stream.flushes.push({ at: Date.now(), length: stream.text.length });
|
|
14623
14640
|
this.onEvent({
|
|
14624
14641
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14625
14642
|
type: CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE,
|
|
@@ -14649,6 +14666,7 @@ ${msg.result}` } : { ...msg, errors: [loginFailure, ...msg.errors] } : msg);
|
|
|
14649
14666
|
streamId: streamEvent.message.id || key,
|
|
14650
14667
|
parent_tool_use_id: message.parent_tool_use_id,
|
|
14651
14668
|
text: "",
|
|
14669
|
+
flushes: [],
|
|
14652
14670
|
thinking: ""
|
|
14653
14671
|
});
|
|
14654
14672
|
return;
|
|
@@ -14990,11 +15008,11 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
14990
15008
|
async subagentMcpForTurn(enabled) {
|
|
14991
15009
|
return this.currentThreadId ? existsSync6(join12(SUBAGENT_MCP_THREADS_DIR, this.currentThreadId)) : enabled;
|
|
14992
15010
|
}
|
|
14993
|
-
async interrupt(persistRemoval) {
|
|
15011
|
+
async interrupt(persistRemoval, requestedStoppedAt) {
|
|
14994
15012
|
if (this.currentGoal?.status === "active") {
|
|
14995
15013
|
await this.updateGoal({ status: "paused" });
|
|
14996
15014
|
}
|
|
14997
|
-
return super.interrupt(persistRemoval);
|
|
15015
|
+
return super.interrupt(persistRemoval, requestedStoppedAt);
|
|
14998
15016
|
}
|
|
14999
15017
|
async keepStoppedRequest(request) {
|
|
15000
15018
|
if (!canSteerMessage("codex", request)) return false;
|
|
@@ -61017,9 +61035,9 @@ ${decisions}` };
|
|
|
61017
61035
|
return [];
|
|
61018
61036
|
});
|
|
61019
61037
|
}
|
|
61020
|
-
async interrupt(chatId) {
|
|
61038
|
+
async interrupt(chatId, stoppedAt) {
|
|
61021
61039
|
const chat = this.requireChat(chatId);
|
|
61022
|
-
const result = await chat.provider.interrupt((messageIds) => this.forgetPendingMessages(chat, messageIds));
|
|
61040
|
+
const result = await chat.provider.interrupt((messageIds) => this.forgetPendingMessages(chat, messageIds), stoppedAt);
|
|
61023
61041
|
this.endTrackedTurn(chat);
|
|
61024
61042
|
chat.hasActiveTurn = false;
|
|
61025
61043
|
chat.activeMessageId = null;
|
|
@@ -63696,7 +63714,8 @@ function createV1Routes(deps) {
|
|
|
63696
63714
|
});
|
|
63697
63715
|
app2.post("/chats/:chatId/interrupt", async (c) => {
|
|
63698
63716
|
try {
|
|
63699
|
-
const
|
|
63717
|
+
const { stoppedAt } = interruptChatRequestSchema.catch({}).parse(await c.req.json().catch(() => ({})));
|
|
63718
|
+
const result = await deps.chatService.interrupt(c.req.param("chatId"), stoppedAt);
|
|
63700
63719
|
const response = result;
|
|
63701
63720
|
return c.json(response);
|
|
63702
63721
|
} catch (error) {
|
|
@@ -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-
|
|
6
|
+
} from "./chunk-SOS3XGPH.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
9
|
} from "./chunk-UZSNFLDQ.js";
|
|
10
10
|
import {
|
|
11
11
|
shouldRefreshPullRequests
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ETZA25S4.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/services/post-tool-pr-notifier.ts
|
package/dist/src/subagent-mcp.js
CHANGED