replicas-engine 0.1.901 → 0.1.903
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-SHWVYO4P.js → asp-host-FPOYHV6O.js} +4 -4
- package/dist/src/{chunk-OHKSLDUI.js → chunk-2ROQAUB6.js} +2 -0
- package/dist/src/{chunk-TTH5SHSN.js → chunk-6YQDDPWU.js} +2 -2
- package/dist/src/{chunk-UDTIPDWQ.js → chunk-D4UQZM5D.js} +2 -2
- package/dist/src/{chunk-REKEHSUU.js → chunk-GAA77UNT.js} +5 -5
- package/dist/src/{chunk-R2F7KPRA.js → chunk-GFIDOFFP.js} +1 -1
- package/dist/src/{chunk-P5ZF2S3V.js → chunk-OBD4D4AW.js} +1 -1
- package/dist/src/{chunk-CDEEK3NH.js → chunk-YICM7VI4.js} +2 -2
- 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 +81 -76
- 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-GAA77UNT.js";
|
|
9
|
+
import "./chunk-OBD4D4AW.js";
|
|
10
|
+
import "./chunk-6YQDDPWU.js";
|
|
11
11
|
import "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-2ROQAUB6.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
export {
|
|
15
15
|
getCodexAspHost,
|
|
@@ -8109,6 +8109,7 @@ function normalizeChatTranscriptMetadata(value) {
|
|
|
8109
8109
|
relayBaseProvider,
|
|
8110
8110
|
credential,
|
|
8111
8111
|
title,
|
|
8112
|
+
displayName,
|
|
8112
8113
|
createdAt,
|
|
8113
8114
|
updatedAt,
|
|
8114
8115
|
historyVersion,
|
|
@@ -8128,6 +8129,7 @@ function normalizeChatTranscriptMetadata(value) {
|
|
|
8128
8129
|
const parsedCredential = agentCredentialSnapshotSchema.safeParse(credential);
|
|
8129
8130
|
if (parsedCredential.success) metadata.credential = parsedCredential.data;
|
|
8130
8131
|
if (typeof title === "string") metadata.title = title;
|
|
8132
|
+
if (typeof displayName === "string") metadata.displayName = displayName;
|
|
8131
8133
|
if (typeof createdAt === "string") metadata.createdAt = createdAt;
|
|
8132
8134
|
if (typeof updatedAt === "string") metadata.updatedAt = updatedAt;
|
|
8133
8135
|
if (typeof historyVersion === "string") metadata.historyVersion = historyVersion;
|
|
@@ -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-2ROQAUB6.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.903";
|
|
249
249
|
var INITIALIZE_METHOD = "initialize";
|
|
250
250
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
251
251
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -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-OBD4D4AW.js";
|
|
7
7
|
import {
|
|
8
8
|
extractCommandProtectionCommandText,
|
|
9
9
|
findGitCommitSignals,
|
|
10
10
|
findPrMergeSignals
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2ROQAUB6.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-OBD4D4AW.js";
|
|
9
9
|
import {
|
|
10
10
|
AppServerProcess,
|
|
11
11
|
SUBPROCESS_MAX_BUFFER,
|
|
12
12
|
buildCodexAgentEnv,
|
|
13
13
|
execFileAsync
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6YQDDPWU.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-2ROQAUB6.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-FPOYHV6O.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-FPOYHV6O.js");
|
|
279
279
|
await restartCodexAspHostIfRunning2();
|
|
280
280
|
}
|
|
281
281
|
if (data.scope) {
|
|
@@ -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-GFIDOFFP.js";
|
|
7
7
|
import {
|
|
8
8
|
shouldRefreshPullRequests
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2ROQAUB6.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
|
evaluateCommandProtection
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-D4UQZM5D.js";
|
|
7
|
+
import "./chunk-OBD4D4AW.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-2ROQAUB6.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-D4UQZM5D.js";
|
|
7
7
|
import {
|
|
8
8
|
notifyPostToolUse
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-YICM7VI4.js";
|
|
10
|
+
import "./chunk-GFIDOFFP.js";
|
|
11
|
+
import "./chunk-OBD4D4AW.js";
|
|
12
12
|
import "./chunk-UZSNFLDQ.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-2ROQAUB6.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-6YQDDPWU.js";
|
|
12
12
|
import {
|
|
13
13
|
AGENT,
|
|
14
14
|
getMemoryOutputSafetyViolation,
|
|
15
15
|
headlessAgentRequestSchema
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2ROQAUB6.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-D4UQZM5D.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-GFIDOFFP.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-GAA77UNT.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-OBD4D4AW.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-6YQDDPWU.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-2ROQAUB6.js";
|
|
382
382
|
import {
|
|
383
383
|
__commonJS,
|
|
384
384
|
__export,
|
|
@@ -10917,7 +10917,7 @@ import { join as join37 } from "path";
|
|
|
10917
10917
|
import { randomUUID as randomUUID13 } from "crypto";
|
|
10918
10918
|
|
|
10919
10919
|
// ../shared/src/workspace-chat.ts
|
|
10920
|
-
var WORKSPACE_CHATS_QUERY_SCHEMA_VERSION =
|
|
10920
|
+
var WORKSPACE_CHATS_QUERY_SCHEMA_VERSION = 6;
|
|
10921
10921
|
var WORKSPACE_CHATS_QUERY_ROOT = `workspace-chats:v${WORKSPACE_CHATS_QUERY_SCHEMA_VERSION}`;
|
|
10922
10922
|
function isAcceptedUserMessage(event) {
|
|
10923
10923
|
return getUserMessage(event) !== null && event.payload.source === ACCEPTED_USER_MESSAGE_SOURCE;
|
|
@@ -13179,12 +13179,16 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13179
13179
|
await this.abortAllPendingToolInputs();
|
|
13180
13180
|
await this.tearDownSession(true);
|
|
13181
13181
|
}
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
if (!
|
|
13187
|
-
await this.
|
|
13182
|
+
// Claude Code folds a `next`-priority prompt into the running turn at its next tool boundary.
|
|
13183
|
+
async steerRequest(request) {
|
|
13184
|
+
const pendingTurn = this.pendingTurn;
|
|
13185
|
+
const promptStream = this.activePromptStream;
|
|
13186
|
+
if (!pendingTurn || !promptStream) return false;
|
|
13187
|
+
const userMessage = await this.buildUserMessage(request);
|
|
13188
|
+
if (this.pendingTurn !== pendingTurn || this.activePromptStream !== promptStream) return false;
|
|
13189
|
+
pendingTurn.userMessageUuids.add(userMessage.uuid);
|
|
13190
|
+
await this.recordEvent(userMessage, request.messageId);
|
|
13191
|
+
promptStream.push({ ...userMessage, priority: "next" });
|
|
13188
13192
|
return true;
|
|
13189
13193
|
}
|
|
13190
13194
|
async abortAllPendingToolInputs() {
|
|
@@ -13574,7 +13578,6 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13574
13578
|
message,
|
|
13575
13579
|
model,
|
|
13576
13580
|
customInstructions,
|
|
13577
|
-
images,
|
|
13578
13581
|
planMode,
|
|
13579
13582
|
thinkingLevel,
|
|
13580
13583
|
enableInteractiveTools,
|
|
@@ -13585,36 +13588,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13585
13588
|
}
|
|
13586
13589
|
await this.initialized;
|
|
13587
13590
|
this.pendingInterrupt = false;
|
|
13588
|
-
const
|
|
13589
|
-
{
|
|
13590
|
-
type: "text",
|
|
13591
|
-
text: message
|
|
13592
|
-
}
|
|
13593
|
-
];
|
|
13594
|
-
if (images && images.length > 0) {
|
|
13595
|
-
const normalizedImages = await normalizeImages(images);
|
|
13596
|
-
for (const image of normalizedImages) {
|
|
13597
|
-
content.push({
|
|
13598
|
-
type: "image",
|
|
13599
|
-
source: {
|
|
13600
|
-
type: "base64",
|
|
13601
|
-
media_type: image.source.media_type,
|
|
13602
|
-
data: image.source.data
|
|
13603
|
-
}
|
|
13604
|
-
});
|
|
13605
|
-
}
|
|
13606
|
-
}
|
|
13607
|
-
const userMessageUuid = randomUUID5();
|
|
13608
|
-
const userMessage = {
|
|
13609
|
-
type: "user",
|
|
13610
|
-
uuid: userMessageUuid,
|
|
13611
|
-
message: {
|
|
13612
|
-
role: "user",
|
|
13613
|
-
content
|
|
13614
|
-
},
|
|
13615
|
-
parent_tool_use_id: null,
|
|
13616
|
-
session_id: this.sessionId ?? ""
|
|
13617
|
-
};
|
|
13591
|
+
const userMessage = await this.buildUserMessage(request);
|
|
13618
13592
|
if (!options.skipUserMessageRecord) {
|
|
13619
13593
|
await this.recordEvent(userMessage, request.messageId);
|
|
13620
13594
|
}
|
|
@@ -13653,10 +13627,41 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13653
13627
|
return;
|
|
13654
13628
|
}
|
|
13655
13629
|
await new Promise((resolve8, reject) => {
|
|
13656
|
-
this.pendingTurn = { resolve: resolve8, reject, sawActivity: false,
|
|
13630
|
+
this.pendingTurn = { resolve: resolve8, reject, sawActivity: false, userMessageUuids: /* @__PURE__ */ new Set([userMessage.uuid]) };
|
|
13657
13631
|
promptStream.push(userMessage);
|
|
13658
13632
|
});
|
|
13659
13633
|
}
|
|
13634
|
+
async buildUserMessage({ message, images }) {
|
|
13635
|
+
const content = [
|
|
13636
|
+
{
|
|
13637
|
+
type: "text",
|
|
13638
|
+
text: message
|
|
13639
|
+
}
|
|
13640
|
+
];
|
|
13641
|
+
if (images && images.length > 0) {
|
|
13642
|
+
const normalizedImages = await normalizeImages(images);
|
|
13643
|
+
for (const image of normalizedImages) {
|
|
13644
|
+
content.push({
|
|
13645
|
+
type: "image",
|
|
13646
|
+
source: {
|
|
13647
|
+
type: "base64",
|
|
13648
|
+
media_type: image.source.media_type,
|
|
13649
|
+
data: image.source.data
|
|
13650
|
+
}
|
|
13651
|
+
});
|
|
13652
|
+
}
|
|
13653
|
+
}
|
|
13654
|
+
return {
|
|
13655
|
+
type: "user",
|
|
13656
|
+
uuid: randomUUID5(),
|
|
13657
|
+
message: {
|
|
13658
|
+
role: "user",
|
|
13659
|
+
content
|
|
13660
|
+
},
|
|
13661
|
+
parent_tool_use_id: null,
|
|
13662
|
+
session_id: this.sessionId ?? ""
|
|
13663
|
+
};
|
|
13664
|
+
}
|
|
13660
13665
|
async ensureSession(args) {
|
|
13661
13666
|
const {
|
|
13662
13667
|
signature,
|
|
@@ -13888,7 +13893,11 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13888
13893
|
await this.recordContextUsage(response);
|
|
13889
13894
|
if (this.activeQuery !== response) break;
|
|
13890
13895
|
this.sessionLinearForwarder?.flushThoughtAsResponse();
|
|
13891
|
-
|
|
13896
|
+
const pendingUuids = this.pendingTurn?.userMessageUuids;
|
|
13897
|
+
if (msg.user_message_uuid) {
|
|
13898
|
+
for (const uuid of msg.user_message_uuids ?? [msg.user_message_uuid]) pendingUuids?.delete(uuid);
|
|
13899
|
+
if (pendingUuids?.size === 0) this.resolvePendingTurn();
|
|
13900
|
+
} else if (!msg.origin || msg.origin.kind === "human") {
|
|
13892
13901
|
this.resolvePendingTurn();
|
|
13893
13902
|
}
|
|
13894
13903
|
}
|
|
@@ -61197,7 +61206,18 @@ async function flushAllChatTranscripts(chatsById = /* @__PURE__ */ new Map(), ca
|
|
|
61197
61206
|
await Promise.all(tasks);
|
|
61198
61207
|
return capture ? { flushed, failed, captureSupported: true, revisions } : { flushed, failed };
|
|
61199
61208
|
}
|
|
61200
|
-
|
|
61209
|
+
var uploadsByChatId = /* @__PURE__ */ new Map();
|
|
61210
|
+
function uploadChatTranscript(chatId, filePath, chat, capture) {
|
|
61211
|
+
const upload = (uploadsByChatId.get(chatId) ?? Promise.resolve()).catch(() => {
|
|
61212
|
+
}).then(() => uploadChatTranscriptNow(chatId, filePath, chat, capture));
|
|
61213
|
+
uploadsByChatId.set(chatId, upload);
|
|
61214
|
+
void upload.catch(() => {
|
|
61215
|
+
}).finally(() => {
|
|
61216
|
+
if (uploadsByChatId.get(chatId) === upload) uploadsByChatId.delete(chatId);
|
|
61217
|
+
});
|
|
61218
|
+
return upload;
|
|
61219
|
+
}
|
|
61220
|
+
async function uploadChatTranscriptNow(chatId, filePath, chat, capture) {
|
|
61201
61221
|
const { size } = await stat5(filePath);
|
|
61202
61222
|
if (size === 0) return null;
|
|
61203
61223
|
const metadata = chat ? {
|
|
@@ -61205,6 +61225,7 @@ async function uploadChatTranscript(chatId, filePath, chat, capture) {
|
|
|
61205
61225
|
...chat.relayBaseProvider ? { relayBaseProvider: chat.relayBaseProvider } : {},
|
|
61206
61226
|
credential: ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS[getChatExecutionProvider(chat)],
|
|
61207
61227
|
title: chat.title,
|
|
61228
|
+
displayName: chat.displayName,
|
|
61208
61229
|
createdAt: chat.createdAt,
|
|
61209
61230
|
updatedAt: chat.updatedAt,
|
|
61210
61231
|
parentChatId: chat.parentChatId,
|
|
@@ -62030,6 +62051,7 @@ var ChatService = class {
|
|
|
62030
62051
|
throw error;
|
|
62031
62052
|
}
|
|
62032
62053
|
const summary = this.toSummary(chat);
|
|
62054
|
+
if (hasChatStarted(summary)) this.uploadChatTranscript(chat);
|
|
62033
62055
|
await this.publish({ type: "chat.updated", payload: { chat: summary } });
|
|
62034
62056
|
return summary;
|
|
62035
62057
|
}
|
|
@@ -62124,31 +62146,10 @@ var ChatService = class {
|
|
|
62124
62146
|
}
|
|
62125
62147
|
async steerFromQueue(chatId, messageId) {
|
|
62126
62148
|
const chat = this.requireChat(chatId);
|
|
62127
|
-
const queuedMessageIds = new Set(chat.provider.getQueue().map((message) => message.id));
|
|
62128
|
-
const interruptedMessageId = chat.activeMessageId ?? chat.pendingMessageIds.find((pendingMessageId) => !queuedMessageIds.has(pendingMessageId)) ?? null;
|
|
62129
62149
|
const result = await chat.provider.steerFromQueue(messageId);
|
|
62130
|
-
if (
|
|
62131
|
-
return result;
|
|
62132
|
-
}
|
|
62133
|
-
if (getChatExecutionProvider(chat.persisted) !== "claude") {
|
|
62150
|
+
if (result.success) {
|
|
62134
62151
|
chat.pendingMessageIds = chat.pendingMessageIds.filter((pendingMessageId) => pendingMessageId !== messageId);
|
|
62135
|
-
return result;
|
|
62136
|
-
}
|
|
62137
|
-
chat.pendingMessageIds = [
|
|
62138
|
-
messageId,
|
|
62139
|
-
...chat.pendingMessageIds.filter((pendingMessageId) => pendingMessageId !== messageId && pendingMessageId !== interruptedMessageId)
|
|
62140
|
-
];
|
|
62141
|
-
this.endTrackedTurn(chatId);
|
|
62142
|
-
chat.hasActiveTurn = false;
|
|
62143
|
-
chat.activeMessageId = null;
|
|
62144
|
-
if (interruptedMessageId) {
|
|
62145
|
-
chat.acceptedUserEvents.delete(interruptedMessageId);
|
|
62146
62152
|
}
|
|
62147
|
-
this.touch(chat);
|
|
62148
|
-
await this.publish({
|
|
62149
|
-
type: "chat.interrupted",
|
|
62150
|
-
payload: { chatId, interrupted: true, queue: [] }
|
|
62151
|
-
});
|
|
62152
62153
|
return result;
|
|
62153
62154
|
}
|
|
62154
62155
|
async respondToToolInput(chatId, requestId, selectionId) {
|
|
@@ -62419,6 +62420,16 @@ var ChatService = class {
|
|
|
62419
62420
|
toTranscriptSource(chat) {
|
|
62420
62421
|
return { ...this.toSummary(chat), removedMessageIds: chat.persisted.removedMessageIds };
|
|
62421
62422
|
}
|
|
62423
|
+
uploadChatTranscript(chat) {
|
|
62424
|
+
const chatId = chat.persisted.id;
|
|
62425
|
+
uploadChatTranscript(
|
|
62426
|
+
chatId,
|
|
62427
|
+
join37(HISTORY_DIR_BY_PROVIDER[chat.persisted.provider], `${chatId}.jsonl`),
|
|
62428
|
+
this.toTranscriptSource(chat)
|
|
62429
|
+
).catch((err) => {
|
|
62430
|
+
console.error("[ChatService] Failed to upload chat transcript:", { chatId, err });
|
|
62431
|
+
});
|
|
62432
|
+
}
|
|
62422
62433
|
async flushAllChatTranscripts() {
|
|
62423
62434
|
return flushAllChatTranscripts(new Map(
|
|
62424
62435
|
[...this.chats.entries()].map(([chatId, chat]) => [chatId, this.toTranscriptSource(chat)])
|
|
@@ -62733,13 +62744,7 @@ var ChatService = class {
|
|
|
62733
62744
|
const processing = chat.provider.getQueue().length > 0 || (chat.provider.hasActiveBackgroundTasks?.() ?? false);
|
|
62734
62745
|
const exhaustion = chat.quotaExhaustion;
|
|
62735
62746
|
chat.quotaExhaustion = null;
|
|
62736
|
-
uploadChatTranscript(
|
|
62737
|
-
chatId,
|
|
62738
|
-
join37(HISTORY_DIR_BY_PROVIDER[chat.persisted.provider], `${chatId}.jsonl`),
|
|
62739
|
-
this.toTranscriptSource(chat)
|
|
62740
|
-
).catch((err) => {
|
|
62741
|
-
console.error("[ChatService] Failed to upload chat transcript:", { chatId, err });
|
|
62742
|
-
});
|
|
62747
|
+
this.uploadChatTranscript(chat);
|
|
62743
62748
|
flushAllCanvasItems().catch((err) => {
|
|
62744
62749
|
console.error("[ChatService] Failed to upload canvas items:", { chatId, err });
|
|
62745
62750
|
});
|
|
@@ -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-YICM7VI4.js";
|
|
7
|
+
import "./chunk-GFIDOFFP.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-2ROQAUB6.js";
|
|
12
12
|
import "./chunk-VEQXQN22.js";
|
|
13
13
|
|
|
14
14
|
// src/post-tool-pr-hook.ts
|
package/dist/src/relay-mcp.js
CHANGED