replicas-engine 0.1.903 → 0.1.905
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-FPOYHV6O.js → asp-host-WFPTAICQ.js} +4 -4
- package/dist/src/{chunk-OBD4D4AW.js → chunk-2VZVUDQM.js} +1 -1
- package/dist/src/{chunk-GFIDOFFP.js → chunk-4M3ZD5FV.js} +1 -1
- package/dist/src/{chunk-YICM7VI4.js → chunk-7TNL7LE7.js} +2 -2
- package/dist/src/{chunk-D4UQZM5D.js → chunk-7W5IP2MX.js} +2 -2
- package/dist/src/{chunk-GAA77UNT.js → chunk-BNVUDD7Y.js} +5 -5
- package/dist/src/{chunk-6YQDDPWU.js → chunk-OG4Q4YYI.js} +2 -2
- package/dist/src/{chunk-2ROQAUB6.js → chunk-TPOJS4TI.js} +6 -0
- package/dist/src/command-protection-hook.js +3 -3
- package/dist/src/deepseek-command-protection-plugin.js +5 -5
- package/dist/src/headless-agent.js +2 -2
- package/dist/src/index.js +91 -12
- package/dist/src/post-tool-pr-hook.js +3 -3
- package/dist/src/relay-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
getCodexAspHost,
|
|
6
6
|
restartCodexAspHost,
|
|
7
7
|
restartCodexAspHostIfRunning
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-BNVUDD7Y.js";
|
|
9
|
+
import "./chunk-2VZVUDQM.js";
|
|
10
|
+
import "./chunk-OG4Q4YYI.js";
|
|
11
11
|
import "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-TPOJS4TI.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
export {
|
|
15
15
|
getCodexAspHost,
|
|
@@ -3,10 +3,10 @@ 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-4M3ZD5FV.js";
|
|
7
7
|
import {
|
|
8
8
|
shouldRefreshPullRequests
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TPOJS4TI.js";
|
|
10
10
|
|
|
11
11
|
// src/services/post-tool-pr-notifier.ts
|
|
12
12
|
async function notifyPostToolUse(toolName, toolInput, result) {
|
|
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
monolithRequest
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2VZVUDQM.js";
|
|
7
7
|
import {
|
|
8
8
|
extractCommandProtectionCommandText,
|
|
9
9
|
findGitCommitSignals,
|
|
10
10
|
findPrMergeSignals
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TPOJS4TI.js";
|
|
12
12
|
|
|
13
13
|
// src/services/command-protection-service.ts
|
|
14
14
|
var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
ENGINE_ENV,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
setAgentCredentialSnapshot
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2VZVUDQM.js";
|
|
9
9
|
import {
|
|
10
10
|
AppServerProcess,
|
|
11
11
|
SUBPROCESS_MAX_BUFFER,
|
|
12
12
|
buildCodexAgentEnv,
|
|
13
13
|
execFileAsync
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-OG4Q4YYI.js";
|
|
15
15
|
import {
|
|
16
16
|
isRecord
|
|
17
17
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
listOpenAICompatibleModels,
|
|
26
26
|
readOllamaAuthEnv,
|
|
27
27
|
resolveOpenAICompatibleModelsUrl
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-TPOJS4TI.js";
|
|
29
29
|
|
|
30
30
|
// src/managers/codex-token-manager.ts
|
|
31
31
|
import { promises as fs } from "fs";
|
|
@@ -255,7 +255,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
255
255
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
256
256
|
await this.applyCredentialsResponse(data);
|
|
257
257
|
if (data.scope) setAgentCredentialSnapshot("codex", { method: data.type, scope: data.scope, revision: data.revision });
|
|
258
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
258
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-WFPTAICQ.js");
|
|
259
259
|
await restartCodexAspHostIfRunning2();
|
|
260
260
|
});
|
|
261
261
|
await this.start(true);
|
|
@@ -275,7 +275,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
275
275
|
await this.applyCredentialUpdate(generation, async () => {
|
|
276
276
|
await this.applyCredentialsResponse(data);
|
|
277
277
|
if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
|
|
278
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
278
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-WFPTAICQ.js");
|
|
279
279
|
await restartCodexAspHostIfRunning2();
|
|
280
280
|
}
|
|
281
281
|
if (data.scope) {
|
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
HOOK_EXEC_MAX_BUFFER_BYTES,
|
|
6
6
|
isVersionBelow
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TPOJS4TI.js";
|
|
8
8
|
|
|
9
9
|
// src/utils/codex-agent-env.ts
|
|
10
10
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -245,7 +245,7 @@ function getCodexModelProvider(method) {
|
|
|
245
245
|
if (method === "foundry") return "azure";
|
|
246
246
|
return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
|
|
247
247
|
}
|
|
248
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
248
|
+
var ENGINE_PACKAGE_VERSION = "0.1.905";
|
|
249
249
|
var INITIALIZE_METHOD = "initialize";
|
|
250
250
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
251
251
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -6963,6 +6963,12 @@ var SLASH_COMMANDS = [
|
|
|
6963
6963
|
argumentHint: "<objective | pause | resume | clear>",
|
|
6964
6964
|
providers: ["codex"]
|
|
6965
6965
|
},
|
|
6966
|
+
{
|
|
6967
|
+
command: "/goal",
|
|
6968
|
+
description: "Set or clear a completion condition to keep working toward.",
|
|
6969
|
+
argumentHint: "<condition | clear>",
|
|
6970
|
+
providers: ["claude"]
|
|
6971
|
+
},
|
|
6966
6972
|
{
|
|
6967
6973
|
command: "/compact",
|
|
6968
6974
|
description: "Compact the conversation context.",
|
|
@@ -3,12 +3,12 @@ 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-
|
|
6
|
+
} from "./chunk-7W5IP2MX.js";
|
|
7
|
+
import "./chunk-2VZVUDQM.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-TPOJS4TI.js";
|
|
12
12
|
import "./chunk-VEQXQN22.js";
|
|
13
13
|
|
|
14
14
|
// src/command-protection-hook.ts
|
|
@@ -3,14 +3,14 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
evaluateCommandProtection
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7W5IP2MX.js";
|
|
7
7
|
import {
|
|
8
8
|
notifyPostToolUse
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-7TNL7LE7.js";
|
|
10
|
+
import "./chunk-4M3ZD5FV.js";
|
|
11
|
+
import "./chunk-2VZVUDQM.js";
|
|
12
12
|
import "./chunk-UZSNFLDQ.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-TPOJS4TI.js";
|
|
14
14
|
import "./chunk-VEQXQN22.js";
|
|
15
15
|
|
|
16
16
|
// src/deepseek-command-protection-plugin.ts
|
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
AppServerProcess,
|
|
10
10
|
buildCodexAgentEnv
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-OG4Q4YYI.js";
|
|
12
12
|
import {
|
|
13
13
|
AGENT,
|
|
14
14
|
getMemoryOutputSafetyViolation,
|
|
15
15
|
headlessAgentRequestSchema
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TPOJS4TI.js";
|
|
17
17
|
import "./chunk-VEQXQN22.js";
|
|
18
18
|
|
|
19
19
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
evaluateCommandProtection,
|
|
92
92
|
extractToolCommand,
|
|
93
93
|
reportCommandProtectionBlock
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-7W5IP2MX.js";
|
|
95
95
|
import {
|
|
96
96
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
97
97
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
} from "./chunk-FLDA7BX3.js";
|
|
117
117
|
import {
|
|
118
118
|
publishedPullRequestUrls
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-4M3ZD5FV.js";
|
|
120
120
|
import {
|
|
121
121
|
RELAY_MCP_TOOLS,
|
|
122
122
|
RELAY_MCP_TOOL_NAMES,
|
|
@@ -137,21 +137,21 @@ import {
|
|
|
137
137
|
refreshDelayMs,
|
|
138
138
|
restartCodexAspHost,
|
|
139
139
|
routineRefreshExclusions
|
|
140
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-BNVUDD7Y.js";
|
|
141
141
|
import {
|
|
142
142
|
ENGINE_ENV,
|
|
143
143
|
IS_WARMING_MODE,
|
|
144
144
|
monolithRequest,
|
|
145
145
|
monolithService,
|
|
146
146
|
setAgentCredentialSnapshot
|
|
147
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-2VZVUDQM.js";
|
|
148
148
|
import {
|
|
149
149
|
AspClient,
|
|
150
150
|
SUBPROCESS_MAX_BUFFER,
|
|
151
151
|
execAsync,
|
|
152
152
|
execFileAsync,
|
|
153
153
|
getCodexModelProvider
|
|
154
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-OG4Q4YYI.js";
|
|
155
155
|
import {
|
|
156
156
|
isRecord as isRecord2
|
|
157
157
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -378,7 +378,7 @@ import {
|
|
|
378
378
|
workspaceCredentialProviderSchema,
|
|
379
379
|
workspaceTokenRequestSchema,
|
|
380
380
|
workspaceTokenResponseSchema
|
|
381
|
-
} from "./chunk-
|
|
381
|
+
} from "./chunk-TPOJS4TI.js";
|
|
382
382
|
import {
|
|
383
383
|
__commonJS,
|
|
384
384
|
__export,
|
|
@@ -10140,6 +10140,7 @@ var EnvironmentDetailsService = class {
|
|
|
10140
10140
|
details.engineVersion = ENGINE_ENV.REPLICAS_SANDBOX_IMAGE_VERSION;
|
|
10141
10141
|
details.supportsMidTurnSteering = true;
|
|
10142
10142
|
details.supportsClaudeMidTurnSteering = true;
|
|
10143
|
+
details.supportsClaudeGoals = true;
|
|
10143
10144
|
details.supportsGoalUpdates = true;
|
|
10144
10145
|
details.supportsQueuedMessageEditing = true;
|
|
10145
10146
|
details.supportsChatForking = true;
|
|
@@ -12741,6 +12742,7 @@ var CodexHistoryFile = class {
|
|
|
12741
12742
|
let found = null;
|
|
12742
12743
|
try {
|
|
12743
12744
|
for await (const line of createInterface({ input: createReadStream(this.filePath), crlfDelay: Infinity })) {
|
|
12745
|
+
if (!line.includes(type)) continue;
|
|
12744
12746
|
const event = parseAgentEventJsonlLine(line);
|
|
12745
12747
|
if (event?.type === type) found = event;
|
|
12746
12748
|
}
|
|
@@ -13165,6 +13167,9 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13165
13167
|
slashCommandsDiscoveredAt = 0;
|
|
13166
13168
|
slashCommandsDiscovery = null;
|
|
13167
13169
|
authRetrying = false;
|
|
13170
|
+
currentGoal = null;
|
|
13171
|
+
goalClear = null;
|
|
13172
|
+
lastRequest = null;
|
|
13168
13173
|
constructor(options) {
|
|
13169
13174
|
super({ ...options, provider: AGENT.CLAUDE });
|
|
13170
13175
|
this.historyFilePath = options.historyFilePath ?? join16(homedir11(), ".replicas", "claude", "history.jsonl");
|
|
@@ -13184,6 +13189,11 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13184
13189
|
const pendingTurn = this.pendingTurn;
|
|
13185
13190
|
const promptStream = this.activePromptStream;
|
|
13186
13191
|
if (!pendingTurn || !promptStream) return false;
|
|
13192
|
+
if (getGoalCommand(request.message, request.goalMode)) {
|
|
13193
|
+
this.messageQueue.restoreToQueue(request, 0);
|
|
13194
|
+
await this.interruptActiveTurn();
|
|
13195
|
+
return true;
|
|
13196
|
+
}
|
|
13187
13197
|
const userMessage = await this.buildUserMessage(request);
|
|
13188
13198
|
if (this.pendingTurn !== pendingTurn || this.activePromptStream !== promptStream) return false;
|
|
13189
13199
|
pendingTurn.userMessageUuids.add(userMessage.uuid);
|
|
@@ -13213,6 +13223,35 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13213
13223
|
isProcessing() {
|
|
13214
13224
|
return super.isProcessing() || isClaudeSessionActive(this.sessionActivity) || this.hasActiveBackgroundTasks();
|
|
13215
13225
|
}
|
|
13226
|
+
getGoal() {
|
|
13227
|
+
return this.currentGoal;
|
|
13228
|
+
}
|
|
13229
|
+
async clearGoal(model) {
|
|
13230
|
+
await this.initialized;
|
|
13231
|
+
const previousGoal = this.currentGoal;
|
|
13232
|
+
if (!previousGoal) return null;
|
|
13233
|
+
this.recordGoalChange(null);
|
|
13234
|
+
if (this.sessionId) {
|
|
13235
|
+
this.goalClear = this.executeQuery(
|
|
13236
|
+
{ model, ...this.lastRequest, message: "/goal clear", images: void 0, goalMode: false },
|
|
13237
|
+
{ skipUserMessageRecord: true }
|
|
13238
|
+
).finally(() => {
|
|
13239
|
+
this.goalClear = null;
|
|
13240
|
+
});
|
|
13241
|
+
try {
|
|
13242
|
+
await this.goalClear;
|
|
13243
|
+
} catch (error) {
|
|
13244
|
+
this.recordGoalChange(previousGoal);
|
|
13245
|
+
throw error;
|
|
13246
|
+
}
|
|
13247
|
+
}
|
|
13248
|
+
return null;
|
|
13249
|
+
}
|
|
13250
|
+
recordGoalChange(goal) {
|
|
13251
|
+
if (!goal && !this.currentGoal) return;
|
|
13252
|
+
this.currentGoal = goal;
|
|
13253
|
+
this.recordHistoryEvent(CHAT_GOAL_EVENT_TYPE, { goal }, this.historyFile);
|
|
13254
|
+
}
|
|
13216
13255
|
hasActiveBackgroundTasks() {
|
|
13217
13256
|
return this.backgroundTasks.active.size > 0 || this.pendingBackgroundCompletion && (isClaudeSessionActive(this.sessionActivity) || this.backgroundContinuationTimer !== null) && !this.messageQueue.isProcessing();
|
|
13218
13257
|
}
|
|
@@ -13426,6 +13465,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13426
13465
|
let transientRetries = 0;
|
|
13427
13466
|
let midTurnContinues = 0;
|
|
13428
13467
|
let currentRequest = request;
|
|
13468
|
+
await this.goalClear?.catch(() => {
|
|
13469
|
+
});
|
|
13429
13470
|
try {
|
|
13430
13471
|
while (true) {
|
|
13431
13472
|
const attemptedCredential = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.claude;
|
|
@@ -13483,7 +13524,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13483
13524
|
);
|
|
13484
13525
|
await this.tearDownSession();
|
|
13485
13526
|
await new Promise((resolve8) => setTimeout(resolve8, delayMs));
|
|
13486
|
-
currentRequest = { ...request, message: CLAUDE_MIDTURN_CONTINUE_PROMPT, images: [] };
|
|
13527
|
+
currentRequest = { ...request, message: CLAUDE_MIDTURN_CONTINUE_PROMPT, images: [], goalMode: false };
|
|
13487
13528
|
attempt++;
|
|
13488
13529
|
continue;
|
|
13489
13530
|
}
|
|
@@ -13587,11 +13628,27 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13587
13628
|
throw new Error("Message cannot be empty");
|
|
13588
13629
|
}
|
|
13589
13630
|
await this.initialized;
|
|
13631
|
+
this.lastRequest = request;
|
|
13590
13632
|
this.pendingInterrupt = false;
|
|
13591
13633
|
const userMessage = await this.buildUserMessage(request);
|
|
13592
13634
|
if (!options.skipUserMessageRecord) {
|
|
13593
13635
|
await this.recordEvent(userMessage, request.messageId);
|
|
13594
13636
|
}
|
|
13637
|
+
const goalCommand = getGoalCommand(message, request.goalMode);
|
|
13638
|
+
const goalObjective = goalCommand?.type === "set" ? goalCommand.objective : goalCommand?.type === "resume" ? this.currentGoal?.objective : void 0;
|
|
13639
|
+
if (goalCommand && !options.skipUserMessageRecord) {
|
|
13640
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
13641
|
+
this.recordGoalChange(goalObjective ? {
|
|
13642
|
+
threadId: this.sessionId ?? "",
|
|
13643
|
+
objective: goalObjective,
|
|
13644
|
+
status: "active",
|
|
13645
|
+
tokenBudget: null,
|
|
13646
|
+
tokensUsed: 0,
|
|
13647
|
+
timeUsedSeconds: 0,
|
|
13648
|
+
createdAt: now,
|
|
13649
|
+
updatedAt: now
|
|
13650
|
+
} : null);
|
|
13651
|
+
}
|
|
13595
13652
|
const combinedInstructions = [
|
|
13596
13653
|
this.buildCombinedInstructions(customInstructions, true),
|
|
13597
13654
|
"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."
|
|
@@ -13628,7 +13685,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13628
13685
|
}
|
|
13629
13686
|
await new Promise((resolve8, reject) => {
|
|
13630
13687
|
this.pendingTurn = { resolve: resolve8, reject, sawActivity: false, userMessageUuids: /* @__PURE__ */ new Set([userMessage.uuid]) };
|
|
13631
|
-
promptStream.push(userMessage);
|
|
13688
|
+
promptStream.push(goalCommand ? { ...userMessage, message: { role: "user", content: `/goal ${goalObjective ?? "clear"}` } } : userMessage);
|
|
13632
13689
|
});
|
|
13633
13690
|
}
|
|
13634
13691
|
async buildUserMessage({ message, images }) {
|
|
@@ -14327,6 +14384,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
14327
14384
|
}
|
|
14328
14385
|
async initialize() {
|
|
14329
14386
|
await mkdir10(dirname4(this.historyFilePath), { recursive: true });
|
|
14387
|
+
const goalEvent = await this.historyFile.findLastEventOfType(CHAT_GOAL_EVENT_TYPE);
|
|
14388
|
+
if (goalEvent) this.currentGoal = coerceChatGoalPayload(goalEvent.payload);
|
|
14330
14389
|
if (this.initialSessionId) {
|
|
14331
14390
|
this.sessionId = this.initialSessionId;
|
|
14332
14391
|
console.log(`[ClaudeManager] Restored session ID from persisted state: ${this.sessionId}`);
|
|
@@ -14360,6 +14419,27 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
14360
14419
|
await this.forwardWorkflowAgentTranscripts(message.task_id);
|
|
14361
14420
|
}
|
|
14362
14421
|
await this.recordEvent(message);
|
|
14422
|
+
this.trackGoalProgress(message);
|
|
14423
|
+
}
|
|
14424
|
+
// The SDK doesn't stream goal state, so it is inferred from the evaluator's "not met" feedback and the run's final result.
|
|
14425
|
+
trackGoalProgress(message) {
|
|
14426
|
+
const goal = this.currentGoal;
|
|
14427
|
+
if (!goal) return;
|
|
14428
|
+
if (message.type === "user" && message.isSynthetic) {
|
|
14429
|
+
const content = message.message.content;
|
|
14430
|
+
const text = typeof content === "string" ? content : content[0]?.type === "text" ? content[0].text : "";
|
|
14431
|
+
if (!text.startsWith("Stop hook feedback:")) return;
|
|
14432
|
+
const now = /* @__PURE__ */ new Date();
|
|
14433
|
+
this.recordGoalChange({
|
|
14434
|
+
...goal,
|
|
14435
|
+
timeUsedSeconds: Math.round((now.getTime() - Date.parse(goal.createdAt)) / 1e3),
|
|
14436
|
+
updatedAt: now.toISOString()
|
|
14437
|
+
});
|
|
14438
|
+
return;
|
|
14439
|
+
}
|
|
14440
|
+
if (message.type === "result" && message.subtype === "success" && message.num_turns > 0 && this.backgroundTasks.active.size === 0) {
|
|
14441
|
+
this.recordGoalChange(null);
|
|
14442
|
+
}
|
|
14363
14443
|
}
|
|
14364
14444
|
// Claude Code intercepts /compact and auto-compaction inside the SDK process; we just observe the status messages to mirror state to the UI.
|
|
14365
14445
|
trackNativeCompaction(message) {
|
|
@@ -61556,7 +61636,6 @@ function isPersistedChat(value) {
|
|
|
61556
61636
|
return typeof candidate.id === "string" && typeof candidate.provider === "string" && isValidAgentProvider(candidate.provider) && (candidate.relayBaseProvider === void 0 || candidate.provider === "relay" && typeof candidate.relayBaseProvider === "string" && isValidCodingAgentProvider(candidate.relayBaseProvider)) && typeof candidate.title === "string" && (candidate.displayName === void 0 || typeof candidate.displayName === "string") && typeof candidate.createdAt === "string" && typeof candidate.updatedAt === "string" && (candidate.providerSessionId === null || typeof candidate.providerSessionId === "string") && (candidate.parentChatId === void 0 || candidate.parentChatId === null || typeof candidate.parentChatId === "string") && (candidate.deletedAt === void 0 || candidate.deletedAt === null || typeof candidate.deletedAt === "string");
|
|
61557
61637
|
}
|
|
61558
61638
|
function normalizePersistedChat(chat) {
|
|
61559
|
-
const isLegacyCodexSdkChat = chat.provider === "codex" && (chat.codexBackend === "sdk" || chat.codexBackend === void 0 && chat.providerSessionId !== null);
|
|
61560
61639
|
return {
|
|
61561
61640
|
id: chat.id,
|
|
61562
61641
|
provider: chat.provider,
|
|
@@ -61566,7 +61645,7 @@ function normalizePersistedChat(chat) {
|
|
|
61566
61645
|
...chat.displayName ? { displayName: chat.displayName } : {},
|
|
61567
61646
|
createdAt: chat.createdAt,
|
|
61568
61647
|
updatedAt: chat.updatedAt,
|
|
61569
|
-
providerSessionId:
|
|
61648
|
+
providerSessionId: chat.providerSessionId,
|
|
61570
61649
|
parentChatId: chat.parentChatId ?? null,
|
|
61571
61650
|
lastMessageText: chat.lastMessageText ?? null,
|
|
61572
61651
|
deletedAt: chat.deletedAt ?? null,
|
|
@@ -62010,7 +62089,7 @@ var ChatService = class {
|
|
|
62010
62089
|
chat.activeMessageId = null;
|
|
62011
62090
|
chat.pendingMessageIds = [];
|
|
62012
62091
|
chat.acceptedUserEvents.clear();
|
|
62013
|
-
const goal = await chat.provider.clearGoal();
|
|
62092
|
+
const goal = await chat.provider.clearGoal(chat.persisted.model);
|
|
62014
62093
|
this.touch(chat);
|
|
62015
62094
|
await this.publish({
|
|
62016
62095
|
type: "chat.interrupted",
|
|
@@ -64313,7 +64392,7 @@ function createV1Routes(deps) {
|
|
|
64313
64392
|
if (error instanceof ChatNotFoundError) {
|
|
64314
64393
|
return c.json(jsonError("Failed to clear goal", error.message), 404);
|
|
64315
64394
|
}
|
|
64316
|
-
return c.json(jsonError("Failed to clear goal", error instanceof Error ? error.message : "Unknown error"),
|
|
64395
|
+
return c.json(jsonError("Failed to clear goal", error instanceof Error ? error.message : "Unknown error"), 500);
|
|
64317
64396
|
}
|
|
64318
64397
|
});
|
|
64319
64398
|
app2.post("/chat-transcripts/flush-all", async (c) => {
|
|
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
notifyPostToolUse
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-7TNL7LE7.js";
|
|
7
|
+
import "./chunk-4M3ZD5FV.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-TPOJS4TI.js";
|
|
12
12
|
import "./chunk-VEQXQN22.js";
|
|
13
13
|
|
|
14
14
|
// src/post-tool-pr-hook.ts
|
package/dist/src/relay-mcp.js
CHANGED