replicas-engine 0.1.656 → 0.1.657

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",
@@ -6222,7 +6226,7 @@ var DEFAULT_CODEX_ARGS = [
6222
6226
  var MIN_CODEX_CLI_VERSION = "0.144.6";
6223
6227
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
6224
6228
  var codexCliVersionEnsured = null;
6225
- var ENGINE_PACKAGE_VERSION = "0.1.656";
6229
+ var ENGINE_PACKAGE_VERSION = "0.1.657";
6226
6230
  var INITIALIZE_METHOD = "initialize";
6227
6231
  var INITIALIZED_NOTIFICATION = "initialized";
6228
6232
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -7,7 +7,7 @@ import {
7
7
  headlessAgentRequestSchema,
8
8
  putPresignedFile,
9
9
  recoverCompletedTurn
10
- } from "./chunk-KCMDTZ5H.js";
10
+ } from "./chunk-HF62RZGX.js";
11
11
 
12
12
  // src/headless-agent.ts
13
13
  import { createHash } from "crypto";
package/dist/src/index.js CHANGED
@@ -183,13 +183,13 @@ import {
183
183
  serializeCanvasContentResponse,
184
184
  shellQuotePosix,
185
185
  stripAgentDiagnosticErrors
186
- } from "./chunk-KCMDTZ5H.js";
186
+ } from "./chunk-HF62RZGX.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 randomUUID8 } from "crypto";
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 randomUUID6 } from "crypto";
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:";
@@ -8466,18 +8487,12 @@ ${combinedInstructions}
8466
8487
  </system_instructions>
8467
8488
 
8468
8489
  ${request.message}` : request.message;
8469
- if (!request.planMode) {
8470
- unwrap(await client.sessions.prompt({
8471
- sessionId: this.sessionId,
8472
- mode: "queue",
8473
- content: [{ type: "text", text: "/plan off" }]
8474
- }));
8475
- }
8490
+ await client.executeCommand(this.sessionId, request.planMode ? "/plan" : "/plan off");
8476
8491
  unwrap(await client.sessions.prompt({
8477
8492
  sessionId: this.sessionId,
8478
8493
  mode: "queue",
8479
8494
  content: [
8480
- { type: "text", text: request.planMode ? `/plan ${prompt}` : prompt },
8495
+ { type: "text", text: prompt },
8481
8496
  ...images.map((image) => ({
8482
8497
  type: "image",
8483
8498
  mediaType: image.source.media_type,
@@ -10198,7 +10213,7 @@ import {
10198
10213
  unlink as unlink3
10199
10214
  } from "fs/promises";
10200
10215
  import { join as join24 } from "path";
10201
- import { randomUUID as randomUUID5 } from "crypto";
10216
+ import { randomUUID as randomUUID6 } from "crypto";
10202
10217
 
10203
10218
  // src/analytics/agent/activity/skill-mcp-call-extractor.ts
10204
10219
  var NON_MCP_SERVERS = /* @__PURE__ */ new Set(["claude", "cursor", "deepseek", "opencode", "pi", "custom", "dynamic"]);
@@ -10419,7 +10434,7 @@ var AgentChatTurnActivityTracker = class {
10419
10434
  const credential = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS[provider];
10420
10435
  this.pendingMessages.delete(messageId);
10421
10436
  this.activeTurns.set(chatId, {
10422
- turnId: randomUUID5(),
10437
+ turnId: randomUUID6(),
10423
10438
  startedAtMs: Date.now(),
10424
10439
  provider,
10425
10440
  model: attributes.model ?? getDefaultAgentModel(provider),
@@ -11303,7 +11318,7 @@ var ChatService = class {
11303
11318
  throw new ChatNotFoundError(parentChatId);
11304
11319
  }
11305
11320
  const persisted = {
11306
- id: request.id ?? randomUUID6(),
11321
+ id: request.id ?? randomUUID7(),
11307
11322
  provider: request.provider,
11308
11323
  title,
11309
11324
  createdAt: now,
@@ -12048,7 +12063,7 @@ var ChatService = class {
12048
12063
  }
12049
12064
  async publish(input) {
12050
12065
  const event = {
12051
- id: randomUUID6(),
12066
+ id: randomUUID7(),
12052
12067
  ts: (/* @__PURE__ */ new Date()).toISOString(),
12053
12068
  ...input
12054
12069
  };
@@ -12790,7 +12805,7 @@ ${combinedScript}` : combinedScript;
12790
12805
  }
12791
12806
 
12792
12807
  // src/services/terminal-service.ts
12793
- import { randomUUID as randomUUID7 } from "crypto";
12808
+ import { randomUUID as randomUUID8 } from "crypto";
12794
12809
  import { existsSync as existsSync10 } from "fs";
12795
12810
  import { spawn as spawn5 } from "node-pty";
12796
12811
  var MAX_REPLAY_CHARS = 1024 * 1024;
@@ -12809,7 +12824,7 @@ var TerminalService = class {
12809
12824
  code: "limit"
12810
12825
  });
12811
12826
  }
12812
- const id = randomUUID7();
12827
+ const id = randomUUID8();
12813
12828
  const shell = process.env.SHELL && existsSync10(process.env.SHELL) ? process.env.SHELL : "/bin/bash";
12814
12829
  const pty = spawn5(shell, ["-l"], {
12815
12830
  name: "xterm-256color",
@@ -14124,7 +14139,7 @@ function startStatusBroadcaster() {
14124
14139
  if (serialized !== previousRepoStatus) {
14125
14140
  previousRepoStatus = serialized;
14126
14141
  eventService.publish({
14127
- id: randomUUID8(),
14142
+ id: randomUUID9(),
14128
14143
  ts: (/* @__PURE__ */ new Date()).toISOString(),
14129
14144
  type: "repo.status.changed",
14130
14145
  payload: { repos }
@@ -14145,7 +14160,7 @@ function startStatusBroadcaster() {
14145
14160
  if (engineStatusJson !== previousEngineStatus) {
14146
14161
  previousEngineStatus = engineStatusJson;
14147
14162
  eventService.publish({
14148
- id: randomUUID8(),
14163
+ id: randomUUID9(),
14149
14164
  ts: (/* @__PURE__ */ new Date()).toISOString(),
14150
14165
  type: "engine.status.changed",
14151
14166
  payload: { status: engineStatus }
@@ -14164,7 +14179,7 @@ function startStatusBroadcaster() {
14164
14179
  previousHookStatus = hookSnapshot;
14165
14180
  if (!lastHooksRunning && hooksRunning) {
14166
14181
  eventService.publish({
14167
- id: randomUUID8(),
14182
+ id: randomUUID9(),
14168
14183
  ts: (/* @__PURE__ */ new Date()).toISOString(),
14169
14184
  type: "hooks.started",
14170
14185
  payload: { running: true, completed: false }
@@ -14173,7 +14188,7 @@ function startStatusBroadcaster() {
14173
14188
  }
14174
14189
  if (hooksRunning) {
14175
14190
  eventService.publish({
14176
- id: randomUUID8(),
14191
+ id: randomUUID9(),
14177
14192
  ts: (/* @__PURE__ */ new Date()).toISOString(),
14178
14193
  type: "hooks.progress",
14179
14194
  payload: { running: true, completed: false }
@@ -14182,7 +14197,7 @@ function startStatusBroadcaster() {
14182
14197
  }
14183
14198
  if (lastHooksRunning && !hooksRunning && hooksCompleted && !hooksFailed) {
14184
14199
  eventService.publish({
14185
- id: randomUUID8(),
14200
+ id: randomUUID9(),
14186
14201
  ts: (/* @__PURE__ */ new Date()).toISOString(),
14187
14202
  type: "hooks.completed",
14188
14203
  payload: { running: false, completed: true }
@@ -14191,7 +14206,7 @@ function startStatusBroadcaster() {
14191
14206
  }
14192
14207
  if (lastHooksRunning && !hooksRunning && hooksFailed) {
14193
14208
  eventService.publish({
14194
- id: randomUUID8(),
14209
+ id: randomUUID9(),
14195
14210
  ts: (/* @__PURE__ */ new Date()).toISOString(),
14196
14211
  type: "hooks.failed",
14197
14212
  payload: { running: false, completed: hooksCompleted }
@@ -14199,7 +14214,7 @@ function startStatusBroadcaster() {
14199
14214
  });
14200
14215
  }
14201
14216
  eventService.publish({
14202
- id: randomUUID8(),
14217
+ id: randomUUID9(),
14203
14218
  ts: (/* @__PURE__ */ new Date()).toISOString(),
14204
14219
  type: "hooks.status",
14205
14220
  payload: {
@@ -14254,20 +14269,20 @@ serve(
14254
14269
  }
14255
14270
  const repos = await gitService.listRepos();
14256
14271
  await eventService.publish({
14257
- id: randomUUID8(),
14272
+ id: randomUUID9(),
14258
14273
  ts: (/* @__PURE__ */ new Date()).toISOString(),
14259
14274
  type: "repo.discovered",
14260
14275
  payload: { repos }
14261
14276
  });
14262
14277
  const repoStatuses = await gitService.listRepos();
14263
14278
  await eventService.publish({
14264
- id: randomUUID8(),
14279
+ id: randomUUID9(),
14265
14280
  ts: (/* @__PURE__ */ new Date()).toISOString(),
14266
14281
  type: "repo.status.changed",
14267
14282
  payload: { repos: repoStatuses }
14268
14283
  });
14269
14284
  await eventService.publish({
14270
- id: randomUUID8(),
14285
+ id: randomUUID9(),
14271
14286
  ts: (/* @__PURE__ */ new Date()).toISOString(),
14272
14287
  type: "engine.ready",
14273
14288
  payload: { version: "v1" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.656",
3
+ "version": "0.1.657",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",