replicas-engine 0.1.656 → 0.1.658
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.
|
@@ -329,6 +329,8 @@ var DEFAULT_DEEPSEEK_MODEL = DEFAULT_OPENCODE_MODEL;
|
|
|
329
329
|
var DEFAULT_PI_MODEL = DEFAULT_OPENCODE_MODEL;
|
|
330
330
|
var OPENROUTER_MODELS = [
|
|
331
331
|
DEFAULT_OPENCODE_MODEL,
|
|
332
|
+
"deepseek/deepseek-v4-pro",
|
|
333
|
+
"deepseek/deepseek-v4-flash",
|
|
332
334
|
"minimax/minimax-m3",
|
|
333
335
|
"xiaomi/mimo-v2.5-pro",
|
|
334
336
|
"moonshotai/kimi-k2.6"
|
|
@@ -444,6 +446,8 @@ var MODEL_LABELS = {
|
|
|
444
446
|
[GPT_5_6_LUNA_MODEL]: "GPT-5.6 Luna",
|
|
445
447
|
"gpt-5.5": "GPT-5.5",
|
|
446
448
|
[DEFAULT_OPENCODE_MODEL]: "GLM 5.2 via OpenRouter",
|
|
449
|
+
"deepseek/deepseek-v4-pro": "DeepSeek V4 Pro via OpenRouter",
|
|
450
|
+
"deepseek/deepseek-v4-flash": "DeepSeek V4 Flash via OpenRouter",
|
|
447
451
|
"minimax/minimax-m3": "MiniMax M3 via OpenRouter",
|
|
448
452
|
"xiaomi/mimo-v2.5-pro": "MiMo V2.5 Pro via OpenRouter",
|
|
449
453
|
"moonshotai/kimi-k2.6": "Kimi K2.6 via OpenRouter",
|
|
@@ -4439,11 +4443,14 @@ function parseDeepseekEvents(events) {
|
|
|
4439
4443
|
continue;
|
|
4440
4444
|
}
|
|
4441
4445
|
if (event.type === "tool/result") {
|
|
4442
|
-
const
|
|
4443
|
-
const
|
|
4446
|
+
const message = isRecord(data.message) ? data.message : {};
|
|
4447
|
+
const messageSource = isRecord(message.source) ? message.source : {};
|
|
4448
|
+
const result = Array.isArray(message.content) && isRecord(message.content[0]) ? message.content[0] : {};
|
|
4449
|
+
const callId = typeof messageSource.callId === "string" ? messageSource.callId : typeof data.callId === "string" ? data.callId : String(seq);
|
|
4450
|
+
const existing = messages.find((message2) => message2.id === `deepseek-tool-${callId}` && message2.type === "tool_call");
|
|
4444
4451
|
if (existing?.type === "tool_call") {
|
|
4445
|
-
existing.output = stringifyDisplayValue(
|
|
4446
|
-
existing.status = data.isError === true ? "failed" : "completed";
|
|
4452
|
+
existing.output = stringifyDisplayValue(result.content ?? data.result);
|
|
4453
|
+
existing.status = result.isError === true || data.isError === true ? "failed" : "completed";
|
|
4447
4454
|
}
|
|
4448
4455
|
continue;
|
|
4449
4456
|
}
|
|
@@ -6222,7 +6229,7 @@ var DEFAULT_CODEX_ARGS = [
|
|
|
6222
6229
|
var MIN_CODEX_CLI_VERSION = "0.144.6";
|
|
6223
6230
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
6224
6231
|
var codexCliVersionEnsured = null;
|
|
6225
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
6232
|
+
var ENGINE_PACKAGE_VERSION = "0.1.658";
|
|
6226
6233
|
var INITIALIZE_METHOD = "initialize";
|
|
6227
6234
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
6228
6235
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
package/dist/src/index.js
CHANGED
|
@@ -183,13 +183,13 @@ import {
|
|
|
183
183
|
serializeCanvasContentResponse,
|
|
184
184
|
shellQuotePosix,
|
|
185
185
|
stripAgentDiagnosticErrors
|
|
186
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-OY2CUZJZ.js";
|
|
187
187
|
|
|
188
188
|
// src/index.ts
|
|
189
189
|
import { serve } from "@hono/node-server";
|
|
190
190
|
import { Hono as Hono2 } from "hono";
|
|
191
191
|
import { existsSync as existsSync11 } from "fs";
|
|
192
|
-
import { randomUUID as
|
|
192
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
193
193
|
import { connect } from "net";
|
|
194
194
|
|
|
195
195
|
// src/managers/github-token-manager.ts
|
|
@@ -2742,7 +2742,7 @@ import { existsSync as existsSync8 } from "fs";
|
|
|
2742
2742
|
import { appendFile as appendFile4, copyFile, mkdir as mkdir16, readFile as readFile15, rename as rename3, rm as rm2 } from "fs/promises";
|
|
2743
2743
|
import { homedir as homedir15 } from "os";
|
|
2744
2744
|
import { join as join29 } from "path";
|
|
2745
|
-
import { randomUUID as
|
|
2745
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
2746
2746
|
|
|
2747
2747
|
// src/managers/claude-manager.ts
|
|
2748
2748
|
import {
|
|
@@ -8108,6 +8108,7 @@ ${instructions}
|
|
|
8108
8108
|
|
|
8109
8109
|
// src/managers/deepseek-manager.ts
|
|
8110
8110
|
import { spawn as spawn3 } from "child_process";
|
|
8111
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
8111
8112
|
import { createRequire } from "module";
|
|
8112
8113
|
import { dirname as dirname6, join as join21 } from "path";
|
|
8113
8114
|
import { fileURLToPath } from "url";
|
|
@@ -8117,7 +8118,7 @@ import { z as z2 } from "zod";
|
|
|
8117
8118
|
import WebSocket from "ws";
|
|
8118
8119
|
import { AbstractApiClient } from "@deepseek-ai/dsh-host-apiproxy/client";
|
|
8119
8120
|
import { hostFrameSchema, muxFrameSchema } from "@deepseek-ai/dsh-host-apiproxy/api/events.schema";
|
|
8120
|
-
import { serverRequestSchema } from "@deepseek-ai/dsh-host-apiproxy/api/rpc.schema";
|
|
8121
|
+
import { serverRequestSchema, serverResponseSchema } from "@deepseek-ai/dsh-host-apiproxy/api/rpc.schema";
|
|
8121
8122
|
import { sessionIdSchema } from "@deepseek-ai/dsh-host-apiproxy/api/sessions.schema";
|
|
8122
8123
|
var questionSelectionSchema = z2.record(z2.string(), z2.object({
|
|
8123
8124
|
options: z2.array(z2.string()).optional(),
|
|
@@ -8148,6 +8149,26 @@ var DeepseekApiClient = class extends AbstractApiClient {
|
|
|
8148
8149
|
openHost(_payload, signal, onOpen) {
|
|
8149
8150
|
return this.readWebSocket("/api/events.host", signal, hostFrameSchema, onOpen);
|
|
8150
8151
|
}
|
|
8152
|
+
async executeCommand(sessionId, line) {
|
|
8153
|
+
const rpcId = randomUUID5();
|
|
8154
|
+
const response = await this.doFetch(new URL("/api/commands/execute", this.baseUrl), {
|
|
8155
|
+
method: "POST",
|
|
8156
|
+
headers: { "content-type": "application/json" },
|
|
8157
|
+
body: JSON.stringify({
|
|
8158
|
+
type: "client-request",
|
|
8159
|
+
rpcId,
|
|
8160
|
+
method: "commands/execute",
|
|
8161
|
+
payload: { args: { agentId: sessionId, line } }
|
|
8162
|
+
})
|
|
8163
|
+
});
|
|
8164
|
+
if (!response.ok) throw new Error(`DeepSeek Harness command failed with HTTP ${response.status}.`);
|
|
8165
|
+
const result = serverResponseSchema.parse(await response.json());
|
|
8166
|
+
if (result.rpcId !== rpcId) throw new Error("DeepSeek Harness command response did not match its request.");
|
|
8167
|
+
if (!result.result.ok) throw new Error(result.result.error.message);
|
|
8168
|
+
const execution = z2.object({ result: z2.object({ kind: z2.enum(["success", "error"]), text: z2.string().optional() }) }).safeParse(result.result.value);
|
|
8169
|
+
if (!execution.success) throw new Error(`DeepSeek Harness did not recognize ${line}.`);
|
|
8170
|
+
if (execution.data.result.kind === "error") throw new Error(execution.data.result.text ?? `DeepSeek Harness rejected ${line}.`);
|
|
8171
|
+
}
|
|
8151
8172
|
async *readWebSocket(path6, signal, schema, onOpen) {
|
|
8152
8173
|
const url = new URL(path6, this.baseUrl);
|
|
8153
8174
|
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
@@ -8310,7 +8331,7 @@ var DeepseekManager = class extends CodingAgentManager {
|
|
|
8310
8331
|
DEEPSEEK_API_KEY: apiKey,
|
|
8311
8332
|
DEEPSEEK_BASE_URL: "https://openrouter.ai/api/v1",
|
|
8312
8333
|
DSH_HOME: join21(ENGINE_ENV.HOME_DIR, ".replicas", "deepseek"),
|
|
8313
|
-
DSH_PERMISSION_MODE: "
|
|
8334
|
+
DSH_PERMISSION_MODE: "danger-full-access",
|
|
8314
8335
|
DSH_TELEMETRY_DISABLED: "true"
|
|
8315
8336
|
},
|
|
8316
8337
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -8443,6 +8464,7 @@ var DeepseekManager = class extends CodingAgentManager {
|
|
|
8443
8464
|
this.sessionId = unwrap(await client.sessions.create({ cwd: this.workingDirectory })).sessionId;
|
|
8444
8465
|
await this.onSaveSessionId(this.sessionId);
|
|
8445
8466
|
}
|
|
8467
|
+
await client.executeCommand(this.sessionId, "/permission danger-full-access");
|
|
8446
8468
|
const model = request.model ?? DEFAULT_DEEPSEEK_MODEL;
|
|
8447
8469
|
this.selectedModel = model;
|
|
8448
8470
|
const current = unwrap(await client.sessions.models({ sessionId: this.sessionId })).current;
|
|
@@ -8466,18 +8488,12 @@ ${combinedInstructions}
|
|
|
8466
8488
|
</system_instructions>
|
|
8467
8489
|
|
|
8468
8490
|
${request.message}` : request.message;
|
|
8469
|
-
|
|
8470
|
-
unwrap(await client.sessions.prompt({
|
|
8471
|
-
sessionId: this.sessionId,
|
|
8472
|
-
mode: "queue",
|
|
8473
|
-
content: [{ type: "text", text: "/plan off" }]
|
|
8474
|
-
}));
|
|
8475
|
-
}
|
|
8491
|
+
await client.executeCommand(this.sessionId, request.planMode ? "/plan" : "/plan off");
|
|
8476
8492
|
unwrap(await client.sessions.prompt({
|
|
8477
8493
|
sessionId: this.sessionId,
|
|
8478
8494
|
mode: "queue",
|
|
8479
8495
|
content: [
|
|
8480
|
-
{ type: "text", text:
|
|
8496
|
+
{ type: "text", text: prompt },
|
|
8481
8497
|
...images.map((image) => ({
|
|
8482
8498
|
type: "image",
|
|
8483
8499
|
mediaType: image.source.media_type,
|
|
@@ -10198,7 +10214,7 @@ import {
|
|
|
10198
10214
|
unlink as unlink3
|
|
10199
10215
|
} from "fs/promises";
|
|
10200
10216
|
import { join as join24 } from "path";
|
|
10201
|
-
import { randomUUID as
|
|
10217
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
10202
10218
|
|
|
10203
10219
|
// src/analytics/agent/activity/skill-mcp-call-extractor.ts
|
|
10204
10220
|
var NON_MCP_SERVERS = /* @__PURE__ */ new Set(["claude", "cursor", "deepseek", "opencode", "pi", "custom", "dynamic"]);
|
|
@@ -10419,7 +10435,7 @@ var AgentChatTurnActivityTracker = class {
|
|
|
10419
10435
|
const credential = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS[provider];
|
|
10420
10436
|
this.pendingMessages.delete(messageId);
|
|
10421
10437
|
this.activeTurns.set(chatId, {
|
|
10422
|
-
turnId:
|
|
10438
|
+
turnId: randomUUID6(),
|
|
10423
10439
|
startedAtMs: Date.now(),
|
|
10424
10440
|
provider,
|
|
10425
10441
|
model: attributes.model ?? getDefaultAgentModel(provider),
|
|
@@ -11303,7 +11319,7 @@ var ChatService = class {
|
|
|
11303
11319
|
throw new ChatNotFoundError(parentChatId);
|
|
11304
11320
|
}
|
|
11305
11321
|
const persisted = {
|
|
11306
|
-
id: request.id ??
|
|
11322
|
+
id: request.id ?? randomUUID7(),
|
|
11307
11323
|
provider: request.provider,
|
|
11308
11324
|
title,
|
|
11309
11325
|
createdAt: now,
|
|
@@ -12048,7 +12064,7 @@ var ChatService = class {
|
|
|
12048
12064
|
}
|
|
12049
12065
|
async publish(input) {
|
|
12050
12066
|
const event = {
|
|
12051
|
-
id:
|
|
12067
|
+
id: randomUUID7(),
|
|
12052
12068
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12053
12069
|
...input
|
|
12054
12070
|
};
|
|
@@ -12790,7 +12806,7 @@ ${combinedScript}` : combinedScript;
|
|
|
12790
12806
|
}
|
|
12791
12807
|
|
|
12792
12808
|
// src/services/terminal-service.ts
|
|
12793
|
-
import { randomUUID as
|
|
12809
|
+
import { randomUUID as randomUUID8 } from "crypto";
|
|
12794
12810
|
import { existsSync as existsSync10 } from "fs";
|
|
12795
12811
|
import { spawn as spawn5 } from "node-pty";
|
|
12796
12812
|
var MAX_REPLAY_CHARS = 1024 * 1024;
|
|
@@ -12809,7 +12825,7 @@ var TerminalService = class {
|
|
|
12809
12825
|
code: "limit"
|
|
12810
12826
|
});
|
|
12811
12827
|
}
|
|
12812
|
-
const id =
|
|
12828
|
+
const id = randomUUID8();
|
|
12813
12829
|
const shell = process.env.SHELL && existsSync10(process.env.SHELL) ? process.env.SHELL : "/bin/bash";
|
|
12814
12830
|
const pty = spawn5(shell, ["-l"], {
|
|
12815
12831
|
name: "xterm-256color",
|
|
@@ -14124,7 +14140,7 @@ function startStatusBroadcaster() {
|
|
|
14124
14140
|
if (serialized !== previousRepoStatus) {
|
|
14125
14141
|
previousRepoStatus = serialized;
|
|
14126
14142
|
eventService.publish({
|
|
14127
|
-
id:
|
|
14143
|
+
id: randomUUID9(),
|
|
14128
14144
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14129
14145
|
type: "repo.status.changed",
|
|
14130
14146
|
payload: { repos }
|
|
@@ -14145,7 +14161,7 @@ function startStatusBroadcaster() {
|
|
|
14145
14161
|
if (engineStatusJson !== previousEngineStatus) {
|
|
14146
14162
|
previousEngineStatus = engineStatusJson;
|
|
14147
14163
|
eventService.publish({
|
|
14148
|
-
id:
|
|
14164
|
+
id: randomUUID9(),
|
|
14149
14165
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14150
14166
|
type: "engine.status.changed",
|
|
14151
14167
|
payload: { status: engineStatus }
|
|
@@ -14164,7 +14180,7 @@ function startStatusBroadcaster() {
|
|
|
14164
14180
|
previousHookStatus = hookSnapshot;
|
|
14165
14181
|
if (!lastHooksRunning && hooksRunning) {
|
|
14166
14182
|
eventService.publish({
|
|
14167
|
-
id:
|
|
14183
|
+
id: randomUUID9(),
|
|
14168
14184
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14169
14185
|
type: "hooks.started",
|
|
14170
14186
|
payload: { running: true, completed: false }
|
|
@@ -14173,7 +14189,7 @@ function startStatusBroadcaster() {
|
|
|
14173
14189
|
}
|
|
14174
14190
|
if (hooksRunning) {
|
|
14175
14191
|
eventService.publish({
|
|
14176
|
-
id:
|
|
14192
|
+
id: randomUUID9(),
|
|
14177
14193
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14178
14194
|
type: "hooks.progress",
|
|
14179
14195
|
payload: { running: true, completed: false }
|
|
@@ -14182,7 +14198,7 @@ function startStatusBroadcaster() {
|
|
|
14182
14198
|
}
|
|
14183
14199
|
if (lastHooksRunning && !hooksRunning && hooksCompleted && !hooksFailed) {
|
|
14184
14200
|
eventService.publish({
|
|
14185
|
-
id:
|
|
14201
|
+
id: randomUUID9(),
|
|
14186
14202
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14187
14203
|
type: "hooks.completed",
|
|
14188
14204
|
payload: { running: false, completed: true }
|
|
@@ -14191,7 +14207,7 @@ function startStatusBroadcaster() {
|
|
|
14191
14207
|
}
|
|
14192
14208
|
if (lastHooksRunning && !hooksRunning && hooksFailed) {
|
|
14193
14209
|
eventService.publish({
|
|
14194
|
-
id:
|
|
14210
|
+
id: randomUUID9(),
|
|
14195
14211
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14196
14212
|
type: "hooks.failed",
|
|
14197
14213
|
payload: { running: false, completed: hooksCompleted }
|
|
@@ -14199,7 +14215,7 @@ function startStatusBroadcaster() {
|
|
|
14199
14215
|
});
|
|
14200
14216
|
}
|
|
14201
14217
|
eventService.publish({
|
|
14202
|
-
id:
|
|
14218
|
+
id: randomUUID9(),
|
|
14203
14219
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14204
14220
|
type: "hooks.status",
|
|
14205
14221
|
payload: {
|
|
@@ -14254,20 +14270,20 @@ serve(
|
|
|
14254
14270
|
}
|
|
14255
14271
|
const repos = await gitService.listRepos();
|
|
14256
14272
|
await eventService.publish({
|
|
14257
|
-
id:
|
|
14273
|
+
id: randomUUID9(),
|
|
14258
14274
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14259
14275
|
type: "repo.discovered",
|
|
14260
14276
|
payload: { repos }
|
|
14261
14277
|
});
|
|
14262
14278
|
const repoStatuses = await gitService.listRepos();
|
|
14263
14279
|
await eventService.publish({
|
|
14264
|
-
id:
|
|
14280
|
+
id: randomUUID9(),
|
|
14265
14281
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14266
14282
|
type: "repo.status.changed",
|
|
14267
14283
|
payload: { repos: repoStatuses }
|
|
14268
14284
|
});
|
|
14269
14285
|
await eventService.publish({
|
|
14270
|
-
id:
|
|
14286
|
+
id: randomUUID9(),
|
|
14271
14287
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14272
14288
|
type: "engine.ready",
|
|
14273
14289
|
payload: { version: "v1" }
|