replicas-engine 0.1.1634 → 0.1.1635

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.
@@ -8,12 +8,12 @@ import {
8
8
  listCodexModelsForDetails,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-EGOOQBJL.js";
12
- import "./chunk-257K6ESX.js";
13
- import "./chunk-Y6CIC6GX.js";
14
- import "./chunk-SRIZEJKJ.js";
11
+ } from "./chunk-NVJYLSRW.js";
12
+ import "./chunk-YTJST2VN.js";
13
+ import "./chunk-I5VADKCS.js";
14
+ import "./chunk-CYRN62DZ.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-QLG4YXRT.js";
16
+ import "./chunk-76YCZMMZ.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -11141,7 +11141,10 @@ var createChatFields = z9.object({
11141
11141
  var createChatRequestSchema = createChatFields.refine((request) => !request.sideChat || request.forkSourceChatId !== void 0 && request.parentChatId === request.forkSourceChatId, {
11142
11142
  message: "A side chat must fork its parent chat"
11143
11143
  });
11144
- var createHarnessChatRequestSchema = createChatFields.pick({ id: true, title: true }).extend({ provider: z9.literal(AGENT.REPLICAS) });
11144
+ var createHarnessChatRequestSchema = createChatFields.pick({ id: true, title: true, parentChatId: true, forkSourceChatId: true, sideChat: true }).extend({ provider: z9.literal(AGENT.REPLICAS) }).refine(
11145
+ (request) => !request.parentChatId && !request.forkSourceChatId && !request.sideChat || request.sideChat === true && request.parentChatId !== void 0 && request.forkSourceChatId === request.parentChatId,
11146
+ { message: "A Replicas side chat must fork its parent chat." }
11147
+ );
11145
11148
  var spawnSubagentRequestSchema = z9.object({
11146
11149
  provider: z9.enum(ENGINE_AGENT_PROVIDERS),
11147
11150
  prompt: z9.string().min(1),
@@ -19481,6 +19484,16 @@ function toolCallMessage(id, name, args, timestamp, result) {
19481
19484
  if (name === "web_search" && typeof args.query === "string") {
19482
19485
  return { id, type: "web_search", query: args.query, status, timestamp };
19483
19486
  }
19487
+ if (name === "spawn_agent") {
19488
+ const spawned = result?.output ? (() => {
19489
+ try {
19490
+ return JSON.parse(result.output);
19491
+ } catch {
19492
+ return null;
19493
+ }
19494
+ })() : null;
19495
+ return { id, type: "subagent", toolUseId: id, description: typeof args.title === "string" ? args.title : "Replicas subagent", prompt: typeof args.prompt === "string" ? args.prompt : "", subagentType: "replicas", model: typeof args.model === "string" ? args.model : void 0, receiverThreadIds: isRecord(spawned) && typeof spawned.agentId === "string" ? [spawned.agentId] : void 0, status: result?.isError ? "failed" : "in_progress", nestedEvents: [], timestamp };
19496
+ }
19484
19497
  return createCallDisplayMessage({ id, server: "replicas", tool: name, input: args, output: result?.output, status, timestamp });
19485
19498
  }
19486
19499
  function parseReplicasEvents(events) {
@@ -19500,13 +19513,24 @@ function parseReplicasEvents(events) {
19500
19513
  messages.push({ id: getUserMessageId(event) ?? `replicas-pending-${timestamp}`, type: "user", content: payload.message, ...images ? { images } : {}, timestamp });
19501
19514
  return;
19502
19515
  }
19516
+ case `${HARNESS_EVENT_TYPE_PREFIX}cancelled_message`:
19503
19517
  case `${HARNESS_EVENT_TYPE_PREFIX}user_message`: {
19518
+ if (isRecord(payload.agentOutcome)) {
19519
+ messages.push({ id: `replicas-peer-${String(payload.seq)}`, type: "peer_message", direction: "received", chat: typeof payload.agentOutcome.agentId === "string" ? payload.agentOutcome.agentId : void 0, content: extractToolResultText(message2.content), timestamp });
19520
+ for (const item of messages) {
19521
+ if (item.type === "subagent" && item.receiverThreadIds?.includes(String(payload.agentOutcome.agentId))) {
19522
+ item.status = payload.agentOutcome.status === "completed" ? "completed" : payload.agentOutcome.status === "help" ? "in_progress" : "failed";
19523
+ item.output = typeof payload.agentOutcome.response === "string" ? payload.agentOutcome.response : void 0;
19524
+ }
19525
+ }
19526
+ return;
19527
+ }
19504
19528
  const images = blockImages(contentBlocks(message2.content));
19505
19529
  const messageId = payload[USER_MESSAGE_ID_PAYLOAD_KEY];
19506
19530
  messages.push({
19507
19531
  id: typeof messageId === "string" ? messageId : `replicas-user-${String(payload.seq)}`,
19508
19532
  type: "user",
19509
- content: extractToolResultText(message2.content),
19533
+ content: `${event.type === `${HARNESS_EVENT_TYPE_PREFIX}cancelled_message` ? "[Cancelled before it started]\n\n" : ""}${extractToolResultText(message2.content)}`,
19510
19534
  ...images.length ? { images } : {},
19511
19535
  timestamp
19512
19536
  });
@@ -21133,7 +21157,7 @@ var VOICE_WAVEFORM = {
21133
21157
  };
21134
21158
 
21135
21159
  // ../shared/src/e2b.ts
21136
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-18-v9";
21160
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-18-v10";
21137
21161
 
21138
21162
  // ../shared/src/e2b-retry.ts
21139
21163
  var DEFAULT_BACKOFFS_MS = [2e3, 5e3];
@@ -21750,11 +21774,26 @@ var toolResultMessageSchema = z32.looseObject({
21750
21774
  isError: z32.boolean(),
21751
21775
  timestamp: z32.number()
21752
21776
  });
21777
+ var harnessAgentOutcomeSchema = z32.object({
21778
+ agentId: z32.string().uuid(),
21779
+ assignmentId: z32.string(),
21780
+ status: z32.enum(["completed", "cancelled", "error", "help"]),
21781
+ response: z32.string()
21782
+ });
21783
+ var HARNESS_AGENT_TYPES = ["general", "explore", "execute"];
21784
+ var harnessThreadOriginSchema = z32.object({
21785
+ kind: z32.enum(["side_chat", "subagent"]),
21786
+ agentType: z32.enum(HARNESS_AGENT_TYPES).optional(),
21787
+ parentThreadId: z32.string().uuid(),
21788
+ depth: z32.number().int().nonnegative(),
21789
+ message: userMessageSchema
21790
+ });
21753
21791
  var harnessInboxPayloadSchemas = {
21754
21792
  message: z32.looseObject({
21755
21793
  message: userMessageSchema,
21756
21794
  userId: z32.string().nullable(),
21757
21795
  messageId: z32.string().optional(),
21796
+ agentOutcome: harnessAgentOutcomeSchema.optional(),
21758
21797
  model: z32.string().optional(),
21759
21798
  thinkingLevel: z32.enum(VALID_THINKING_LEVELS).optional(),
21760
21799
  instructionsHash: z32.string().optional(),
@@ -21763,10 +21802,14 @@ var harnessInboxPayloadSchemas = {
21763
21802
  instructions: z32.object({ environmentSystemPrompt: z32.string().optional(), customInstructions: z32.string().optional() }).optional(),
21764
21803
  errorNotificationTarget: integrationErrorNotificationTargetSchema.optional()
21765
21804
  }),
21766
- interrupt: z32.looseObject({ userId: z32.string().nullable() })
21805
+ interrupt: z32.looseObject({ userId: z32.string().nullable(), messageId: z32.string().optional(), cancelQueued: z32.boolean().optional() })
21767
21806
  };
21768
21807
  var harnessEventBodySchema = z32.discriminatedUnion("type", [
21808
+ z32.object({ type: z32.literal("thread_origin"), payload: harnessThreadOriginSchema }),
21809
+ z32.object({ type: z32.literal("agent_outcome"), payload: harnessAgentOutcomeSchema }),
21769
21810
  z32.object({ type: z32.literal("user_message"), payload: harnessInboxPayloadSchemas.message }),
21811
+ z32.object({ type: z32.literal("cancelled_message"), payload: harnessInboxPayloadSchemas.message }),
21812
+ z32.object({ type: z32.literal("interrupt"), payload: harnessInboxPayloadSchemas.interrupt }),
21770
21813
  /** Saved before its tool calls run. */
21771
21814
  z32.object({ type: z32.literal("assistant_message"), payload: z32.looseObject({ message: assistantMessageSchema }) }),
21772
21815
  z32.object({ type: z32.literal("tool_result"), payload: z32.looseObject({ message: toolResultMessageSchema }) }),
@@ -21798,6 +21841,9 @@ var harnessLiveMessageSchema = z32.union([
21798
21841
  z32.object({ type: z32.literal("status"), status: z32.enum(HARNESS_THREAD_STATUSES) })
21799
21842
  ]);
21800
21843
 
21844
+ // ../shared/src/harness/context.ts
21845
+ var MAX_REFERENCE_IMAGE_BYTES = 8 * 1024 * 1024;
21846
+
21801
21847
  // ../shared/src/harness/worker-routes.ts
21802
21848
  import { z as z33 } from "zod";
21803
21849
  var harnessWorkerEngineRequestSchema = z33.object({
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-QLG4YXRT.js";
8
+ } from "./chunk-76YCZMMZ.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES
6
- } from "./chunk-QLG4YXRT.js";
6
+ } from "./chunk-76YCZMMZ.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  execFileAsync
6
- } from "./chunk-SRIZEJKJ.js";
6
+ } from "./chunk-CYRN62DZ.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-QLG4YXRT.js";
9
+ } from "./chunk-76YCZMMZ.js";
10
10
 
11
11
  // src/utils/codex-agent-env.ts
12
12
  function buildCodexAgentEnv(source = process.env) {
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
240
240
  if (method === "foundry") return "azure";
241
241
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
242
242
  }
243
- var ENGINE_PACKAGE_VERSION = "0.1.1634";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1635";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -12,15 +12,15 @@ import {
12
12
  resolveDiffBase,
13
13
  runGitCommand,
14
14
  setAgentCredentialSnapshot
15
- } from "./chunk-257K6ESX.js";
15
+ } from "./chunk-YTJST2VN.js";
16
16
  import {
17
17
  AppServerProcess,
18
18
  buildCodexAgentEnv
19
- } from "./chunk-Y6CIC6GX.js";
19
+ } from "./chunk-I5VADKCS.js";
20
20
  import {
21
21
  SUBPROCESS_MAX_BUFFER,
22
22
  execFileAsync
23
- } from "./chunk-SRIZEJKJ.js";
23
+ } from "./chunk-CYRN62DZ.js";
24
24
  import {
25
25
  isRecord
26
26
  } from "./chunk-UZSNFLDQ.js";
@@ -61,7 +61,7 @@ import {
61
61
  shrunkImageSize,
62
62
  splitMothershipInstructions,
63
63
  withTimeout
64
- } from "./chunk-QLG4YXRT.js";
64
+ } from "./chunk-76YCZMMZ.js";
65
65
 
66
66
  // src/managers/codex-token-manager.ts
67
67
  import { promises as fs } from "fs";
@@ -461,7 +461,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
461
461
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
462
462
  await this.applyCredentialsResponse(data);
463
463
  setAgentCredentialSnapshot("codex", data);
464
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-4YCIAKC4.js");
464
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-FRHDOPWV.js");
465
465
  await restartCodexAspHostIfRunning2();
466
466
  });
467
467
  await this.start(true);
@@ -483,7 +483,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
483
483
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
484
484
  await this.applyCredentialsResponse(data);
485
485
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
486
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-4YCIAKC4.js");
486
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-FRHDOPWV.js");
487
487
  await restartCodexAspHostIfRunning2();
488
488
  }
489
489
  setAgentCredentialSnapshot("codex", data);
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  AspClient
6
- } from "./chunk-Y6CIC6GX.js";
6
+ } from "./chunk-I5VADKCS.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -15,7 +15,7 @@ import {
15
15
  isRecord,
16
16
  readOllamaAuthEnv,
17
17
  readOpenAICompatibleAuthEnv
18
- } from "./chunk-QLG4YXRT.js";
18
+ } from "./chunk-76YCZMMZ.js";
19
19
 
20
20
  // src/managers/codex-asp/notification-dispatch.ts
21
21
  var TURN_STARTED_METHOD = "turn/started";
@@ -5,7 +5,7 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  runGitCommand
8
- } from "./chunk-257K6ESX.js";
8
+ } from "./chunk-YTJST2VN.js";
9
9
  import {
10
10
  COMMAND_PROTECTION_MAX_MESSAGE_FILE_BYTES,
11
11
  COMMAND_PROTECTION_REPO_GIT_ARGS,
@@ -18,7 +18,7 @@ import {
18
18
  parseCommandProtectionRequest,
19
19
  toCommandProtectionRepoState,
20
20
  withE2BRetry
21
- } from "./chunk-QLG4YXRT.js";
21
+ } from "./chunk-76YCZMMZ.js";
22
22
 
23
23
  // src/services/command-protection-service.ts
24
24
  import { readFile, stat } from "fs/promises";
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-SRIZEJKJ.js";
7
+ } from "./chunk-CYRN62DZ.js";
8
8
  import {
9
9
  isRecord as isRecord2
10
10
  } from "./chunk-UZSNFLDQ.js";
@@ -21,7 +21,7 @@ import {
21
21
  provisionedDeviceSchema,
22
22
  readReplicasRuntimeEnv,
23
23
  serializePosixEnvFile
24
- } from "./chunk-QLG4YXRT.js";
24
+ } from "./chunk-76YCZMMZ.js";
25
25
 
26
26
  // src/runtime-env-loader.ts
27
27
  import { readFileSync } from "fs";
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-GR52X6WN.js";
7
- import "./chunk-257K6ESX.js";
8
- import "./chunk-SRIZEJKJ.js";
6
+ } from "./chunk-YONBXWPY.js";
7
+ import "./chunk-YTJST2VN.js";
8
+ import "./chunk-CYRN62DZ.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-QLG4YXRT.js";
12
+ import "./chunk-76YCZMMZ.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -14,12 +14,12 @@ import {
14
14
  recoverCompletedTurn,
15
15
  spawnMuseMsp,
16
16
  startMuseSession
17
- } from "./chunk-SRCQYFAP.js";
17
+ } from "./chunk-W3DI4PWU.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-Y6CIC6GX.js";
22
- import "./chunk-SRIZEJKJ.js";
21
+ } from "./chunk-I5VADKCS.js";
22
+ import "./chunk-CYRN62DZ.js";
23
23
  import {
24
24
  AGENT,
25
25
  OPENCODE_GO_PROVIDER,
@@ -29,7 +29,7 @@ import {
29
29
  headlessAgentUsagePath,
30
30
  isRecord,
31
31
  withTimeout
32
- } from "./chunk-QLG4YXRT.js";
32
+ } from "./chunk-76YCZMMZ.js";
33
33
  import "./chunk-VEQXQN22.js";
34
34
 
35
35
  // 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-GR52X6WN.js";
94
+ } from "./chunk-YONBXWPY.js";
95
95
  import {
96
96
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
97
97
  AGENT_MESSAGE_DELTA_METHOD,
@@ -129,10 +129,10 @@ import {
129
129
  spawnMuseMsp,
130
130
  startMuseSession,
131
131
  uuidV7
132
- } from "./chunk-SRCQYFAP.js";
132
+ } from "./chunk-W3DI4PWU.js";
133
133
  import {
134
134
  publishedPullRequestUrls
135
- } from "./chunk-MEEPXBL4.js";
135
+ } from "./chunk-AMJ2SVUW.js";
136
136
  import {
137
137
  ACCOUNT_RATE_LIMITS_READ_METHOD,
138
138
  AsyncLock,
@@ -212,7 +212,7 @@ import {
212
212
  transcriptSecrets,
213
213
  upsertCredentialFileLines,
214
214
  writeSecureCredentialFile
215
- } from "./chunk-EGOOQBJL.js";
215
+ } from "./chunk-NVJYLSRW.js";
216
216
  import {
217
217
  ENGINE_ENV,
218
218
  UNQUOTED_PATHS_CONFIG,
@@ -223,16 +223,16 @@ import {
223
223
  resolveDiffBase,
224
224
  setAgentCredentialSnapshot,
225
225
  setLinearSessionId
226
- } from "./chunk-257K6ESX.js";
226
+ } from "./chunk-YTJST2VN.js";
227
227
  import {
228
228
  buildCodexAgentEnv,
229
229
  getCodexModelProvider
230
- } from "./chunk-Y6CIC6GX.js";
230
+ } from "./chunk-I5VADKCS.js";
231
231
  import {
232
232
  SUBPROCESS_MAX_BUFFER,
233
233
  execAsync,
234
234
  execFileAsync
235
- } from "./chunk-SRIZEJKJ.js";
235
+ } from "./chunk-CYRN62DZ.js";
236
236
  import {
237
237
  isRecord as isRecord2
238
238
  } from "./chunk-UZSNFLDQ.js";
@@ -529,7 +529,7 @@ import {
529
529
  workspaceTokenRequestSchema,
530
530
  workspaceTokenResponseSchema,
531
531
  wrapInTag
532
- } from "./chunk-QLG4YXRT.js";
532
+ } from "./chunk-76YCZMMZ.js";
533
533
  import {
534
534
  __commonJS,
535
535
  __export,
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  publishedPullRequestUrls
6
- } from "./chunk-MEEPXBL4.js";
6
+ } from "./chunk-AMJ2SVUW.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-QLG4YXRT.js";
12
+ } from "./chunk-76YCZMMZ.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -11,7 +11,7 @@ import {
11
11
  spawnSubagentRequestSchema,
12
12
  subagentResponseSchema,
13
13
  waitSubagentRequestSchema
14
- } from "./chunk-QLG4YXRT.js";
14
+ } from "./chunk-76YCZMMZ.js";
15
15
  import "./chunk-VEQXQN22.js";
16
16
 
17
17
  // src/subagent-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1634",
3
+ "version": "0.1.1635",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",