replicas-engine 0.1.927 → 0.1.929
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,9 +5,9 @@ import {
|
|
|
5
5
|
getCodexAspHost,
|
|
6
6
|
restartCodexAspHost,
|
|
7
7
|
restartCodexAspHostIfRunning
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-T7RXJUHU.js";
|
|
9
9
|
import "./chunk-TD44XVMK.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-FTIUOZ5L.js";
|
|
11
11
|
import "./chunk-UZSNFLDQ.js";
|
|
12
12
|
import "./chunk-NJPKCNNS.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
@@ -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.929";
|
|
249
249
|
var INITIALIZE_METHOD = "initialize";
|
|
250
250
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
251
251
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
SUBPROCESS_MAX_BUFFER,
|
|
12
12
|
buildCodexAgentEnv,
|
|
13
13
|
execFileAsync
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-FTIUOZ5L.js";
|
|
15
15
|
import {
|
|
16
16
|
isRecord
|
|
17
17
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -258,7 +258,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
258
258
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
259
259
|
await this.applyCredentialsResponse(data);
|
|
260
260
|
setAgentCredentialSnapshot("codex", data);
|
|
261
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
261
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-YITBYLVQ.js");
|
|
262
262
|
await restartCodexAspHostIfRunning2();
|
|
263
263
|
});
|
|
264
264
|
await this.start(true);
|
|
@@ -278,7 +278,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
278
278
|
await this.applyCredentialUpdate(generation, async () => {
|
|
279
279
|
await this.applyCredentialsResponse(data);
|
|
280
280
|
if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
|
|
281
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
281
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-YITBYLVQ.js");
|
|
282
282
|
await restartCodexAspHostIfRunning2();
|
|
283
283
|
}
|
|
284
284
|
setAgentCredentialSnapshot("codex", data);
|
package/dist/src/index.js
CHANGED
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
refreshDelayMs,
|
|
75
75
|
restartCodexAspHost,
|
|
76
76
|
routineRefreshExclusions
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-T7RXJUHU.js";
|
|
78
78
|
import {
|
|
79
79
|
ENGINE_ENV,
|
|
80
80
|
monolithRequest,
|
|
@@ -89,7 +89,7 @@ import {
|
|
|
89
89
|
execAsync,
|
|
90
90
|
execFileAsync,
|
|
91
91
|
getCodexModelProvider
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-FTIUOZ5L.js";
|
|
93
93
|
import {
|
|
94
94
|
isRecord as isRecord2
|
|
95
95
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -183,6 +183,7 @@ import {
|
|
|
183
183
|
USER_MESSAGE_ID_PAYLOAD_KEY,
|
|
184
184
|
VALID_AGENT_PROVIDERS,
|
|
185
185
|
WORKSPACE_IDENTITY_AUDIENCE,
|
|
186
|
+
agentCredentialSnapshotSchema,
|
|
186
187
|
agentQuotaExhaustedPayloadSchema,
|
|
187
188
|
areSameUserMessageEvents,
|
|
188
189
|
areUserMessagesWithinMatchWindow,
|
|
@@ -10194,6 +10195,7 @@ var EnvironmentDetailsService = class {
|
|
|
10194
10195
|
details.supportsChatForkMessage = true;
|
|
10195
10196
|
details.supportsDeferredChatForking = true;
|
|
10196
10197
|
details.supportsCredentialSwitching = true;
|
|
10198
|
+
details.supportsChatCredentials = true;
|
|
10197
10199
|
details.agentCredentials = { ...ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS };
|
|
10198
10200
|
details.claudeAuthMethod = detectAgentAuthMethod(AGENT.CLAUDE);
|
|
10199
10201
|
details.codexAuthMethod = detectAgentAuthMethod(AGENT.CODEX);
|
|
@@ -13340,11 +13342,14 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13340
13342
|
goalClear = null;
|
|
13341
13343
|
lastRequest = null;
|
|
13342
13344
|
chatId;
|
|
13345
|
+
onChatCredential;
|
|
13343
13346
|
chatCredentials = null;
|
|
13344
13347
|
turnCredentials = null;
|
|
13345
13348
|
constructor(options) {
|
|
13346
13349
|
super({ ...options, provider: AGENT.CLAUDE });
|
|
13347
13350
|
this.chatId = options.chatId;
|
|
13351
|
+
this.onChatCredential = options.onChatCredential ?? (() => {
|
|
13352
|
+
});
|
|
13348
13353
|
this.historyFilePath = options.historyFilePath ?? join16(homedir11(), ".replicas", "claude", "history.jsonl");
|
|
13349
13354
|
this.historyFile = new CodexHistoryFile(this.historyFilePath);
|
|
13350
13355
|
this.initializeManager(this.processMessageInternal.bind(this));
|
|
@@ -13834,6 +13839,12 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13834
13839
|
const claudeCodeModel = toClaudeCodeModel(resolvedModel, this.turnCredentials ? this.turnCredentials.method === "bedrock" : ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD === "bedrock" || ENGINE_ENV.CLAUDE_CODE_USE_BEDROCK === "1");
|
|
13835
13840
|
const resolvedPermissionMode = planMode ? "plan" : "bypassPermissions";
|
|
13836
13841
|
const resolvedFastMode = Boolean(fastMode && canUseClaudeFastMode(resolvedModel));
|
|
13842
|
+
const chatCredential = this.turnCredentials?.snapshot();
|
|
13843
|
+
this.onChatCredential(chatCredential ? {
|
|
13844
|
+
method: chatCredential.method,
|
|
13845
|
+
scope: chatCredential.scope,
|
|
13846
|
+
...chatCredential.account ? { account: chatCredential.account } : {}
|
|
13847
|
+
} : "workspace");
|
|
13837
13848
|
const signature = {
|
|
13838
13849
|
// Prefixed so a session never carries one side's auth env over to the other.
|
|
13839
13850
|
credential: this.turnCredentials ? `chat:${JSON.stringify(this.turnCredentials.snapshot())}` : JSON.stringify(ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.claude),
|
|
@@ -60568,6 +60579,7 @@ function normalizePersistedChat(chat) {
|
|
|
60568
60579
|
deletedAt: chat.deletedAt ?? null,
|
|
60569
60580
|
fork: coerceChatForkInfo(chat.fork),
|
|
60570
60581
|
pendingForkHandoff: chat.pendingForkHandoff === true,
|
|
60582
|
+
...chat.chatCredential === "workspace" || agentCredentialSnapshotSchema.safeParse(chat.chatCredential).success ? { chatCredential: chat.chatCredential } : {},
|
|
60571
60583
|
removedMessageIds: Array.isArray(chat.removedMessageIds) ? chat.removedMessageIds.filter((id) => typeof id === "string").slice(-MAX_REMOVED_MESSAGE_IDS) : [],
|
|
60572
60584
|
acceptedSendResponses: isRecord2(chat.acceptedSendResponses) ? Object.fromEntries(Object.entries(chat.acceptedSendResponses).filter((entry) => {
|
|
60573
60585
|
const response = entry[1];
|
|
@@ -61485,6 +61497,17 @@ var ChatService = class {
|
|
|
61485
61497
|
this.agentTokenUsageTracker.noteUsage(persisted.id, payload, occurredAt);
|
|
61486
61498
|
};
|
|
61487
61499
|
const onMessageStarted = (message) => this.handleTurnStarted(persisted.id, message);
|
|
61500
|
+
const onChatCredential = (credential) => {
|
|
61501
|
+
if (JSON.stringify(persisted.chatCredential) === JSON.stringify(credential)) return;
|
|
61502
|
+
persisted.chatCredential = credential;
|
|
61503
|
+
void (async () => {
|
|
61504
|
+
await this.persistAllChats();
|
|
61505
|
+
const chat = this.getRuntimeChat(persisted.id);
|
|
61506
|
+
if (chat) await this.publish({ type: "chat.updated", payload: { chat: this.toSummary(chat) } });
|
|
61507
|
+
})().catch((error) => {
|
|
61508
|
+
console.error("[ChatService] Failed to record chat credential:", { chatId: persisted.id, error });
|
|
61509
|
+
});
|
|
61510
|
+
};
|
|
61488
61511
|
const onProcessingChanged = (processing) => {
|
|
61489
61512
|
if (processing) return;
|
|
61490
61513
|
this.handleProcessingStopped(persisted.id);
|
|
@@ -61527,6 +61550,7 @@ var ChatService = class {
|
|
|
61527
61550
|
fallbackContext,
|
|
61528
61551
|
chatId: persisted.id,
|
|
61529
61552
|
onModelSwitched,
|
|
61553
|
+
onChatCredential,
|
|
61530
61554
|
additionalInstructions,
|
|
61531
61555
|
linearSessionId: persisted.parentChatId === null ? ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID : void 0,
|
|
61532
61556
|
...persisted.provider === "relay" ? { relayParentChatId: persisted.id } : {}
|
|
@@ -61601,7 +61625,8 @@ var ChatService = class {
|
|
|
61601
61625
|
parentChatId: chat.persisted.parentChatId,
|
|
61602
61626
|
lastMessageText: chat.persisted.lastMessageText ?? null,
|
|
61603
61627
|
deletedAt: chat.persisted.deletedAt ?? null,
|
|
61604
|
-
fork: chat.persisted.fork ?? null
|
|
61628
|
+
fork: chat.persisted.fork ?? null,
|
|
61629
|
+
...chat.persisted.chatCredential ? { chatCredential: chat.persisted.chatCredential } : {}
|
|
61605
61630
|
};
|
|
61606
61631
|
}
|
|
61607
61632
|
requireChat(chatId) {
|