replicas-cli 0.3.474 → 0.3.475

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.
Files changed (2) hide show
  1. package/dist/index.cjs +58 -5
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -22721,7 +22721,10 @@ var init_v1 = __esm({
22721
22721
  createChatRequestSchema = createChatFields.refine((request) => !request.sideChat || request.forkSourceChatId !== void 0 && request.parentChatId === request.forkSourceChatId, {
22722
22722
  message: "A side chat must fork its parent chat"
22723
22723
  });
22724
- createHarnessChatRequestSchema = createChatFields.pick({ id: true, title: true }).extend({ provider: external_exports.literal(AGENT.REPLICAS) });
22724
+ createHarnessChatRequestSchema = createChatFields.pick({ id: true, title: true, parentChatId: true, forkSourceChatId: true, sideChat: true }).extend({ provider: external_exports.literal(AGENT.REPLICAS) }).refine(
22725
+ (request) => !request.parentChatId && !request.forkSourceChatId && !request.sideChat || request.sideChat === true && request.parentChatId !== void 0 && request.forkSourceChatId === request.parentChatId,
22726
+ { message: "A Replicas side chat must fork its parent chat." }
22727
+ );
22725
22728
  spawnSubagentRequestSchema = external_exports.object({
22726
22729
  provider: external_exports.enum(ENGINE_AGENT_PROVIDERS),
22727
22730
  prompt: external_exports.string().min(1),
@@ -37673,6 +37676,16 @@ function toolCallMessage(id, name, args, timestamp, result) {
37673
37676
  if (name === "web_search" && typeof args.query === "string") {
37674
37677
  return { id, type: "web_search", query: args.query, status, timestamp };
37675
37678
  }
37679
+ if (name === "spawn_agent") {
37680
+ const spawned = result?.output ? (() => {
37681
+ try {
37682
+ return JSON.parse(result.output);
37683
+ } catch {
37684
+ return null;
37685
+ }
37686
+ })() : null;
37687
+ 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 };
37688
+ }
37676
37689
  return createCallDisplayMessage({ id, server: "replicas", tool: name, input: args, output: result?.output, status, timestamp });
37677
37690
  }
37678
37691
  function parseReplicasEvents(events) {
@@ -37692,13 +37705,24 @@ function parseReplicasEvents(events) {
37692
37705
  messages.push({ id: getUserMessageId(event) ?? `replicas-pending-${timestamp}`, type: "user", content: payload.message, ...images ? { images } : {}, timestamp });
37693
37706
  return;
37694
37707
  }
37708
+ case `${HARNESS_EVENT_TYPE_PREFIX}cancelled_message`:
37695
37709
  case `${HARNESS_EVENT_TYPE_PREFIX}user_message`: {
37710
+ if (isRecord(payload.agentOutcome)) {
37711
+ 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 });
37712
+ for (const item of messages) {
37713
+ if (item.type === "subagent" && item.receiverThreadIds?.includes(String(payload.agentOutcome.agentId))) {
37714
+ item.status = payload.agentOutcome.status === "completed" ? "completed" : payload.agentOutcome.status === "help" ? "in_progress" : "failed";
37715
+ item.output = typeof payload.agentOutcome.response === "string" ? payload.agentOutcome.response : void 0;
37716
+ }
37717
+ }
37718
+ return;
37719
+ }
37696
37720
  const images = blockImages(contentBlocks(message2.content));
37697
37721
  const messageId = payload[USER_MESSAGE_ID_PAYLOAD_KEY];
37698
37722
  messages.push({
37699
37723
  id: typeof messageId === "string" ? messageId : `replicas-user-${String(payload.seq)}`,
37700
37724
  type: "user",
37701
- content: extractToolResultText(message2.content),
37725
+ content: `${event.type === `${HARNESS_EVENT_TYPE_PREFIX}cancelled_message` ? "[Cancelled before it started]\n\n" : ""}${extractToolResultText(message2.content)}`,
37702
37726
  ...images.length ? { images } : {},
37703
37727
  timestamp
37704
37728
  });
@@ -39460,7 +39484,7 @@ var init_organizations = __esm({
39460
39484
  });
39461
39485
 
39462
39486
  // ../shared/src/harness/types.ts
39463
- var HARNESS_THREAD_STATUSES, textSchema, imageSchema, userMessageSchema, assistantMessageSchema, toolResultMessageSchema, harnessInboxPayloadSchemas, harnessEventBodySchema, harnessLiveMessageSchema;
39487
+ var HARNESS_THREAD_STATUSES, textSchema, imageSchema, userMessageSchema, assistantMessageSchema, toolResultMessageSchema, harnessAgentOutcomeSchema, HARNESS_AGENT_TYPES, harnessThreadOriginSchema, harnessInboxPayloadSchemas, harnessEventBodySchema, harnessLiveMessageSchema;
39464
39488
  var init_types8 = __esm({
39465
39489
  "../shared/src/harness/types.ts"() {
39466
39490
  "use strict";
@@ -39504,11 +39528,26 @@ var init_types8 = __esm({
39504
39528
  isError: external_exports.boolean(),
39505
39529
  timestamp: external_exports.number()
39506
39530
  });
39531
+ harnessAgentOutcomeSchema = external_exports.object({
39532
+ agentId: external_exports.string().uuid(),
39533
+ assignmentId: external_exports.string(),
39534
+ status: external_exports.enum(["completed", "cancelled", "error", "help"]),
39535
+ response: external_exports.string()
39536
+ });
39537
+ HARNESS_AGENT_TYPES = ["general", "explore", "execute"];
39538
+ harnessThreadOriginSchema = external_exports.object({
39539
+ kind: external_exports.enum(["side_chat", "subagent"]),
39540
+ agentType: external_exports.enum(HARNESS_AGENT_TYPES).optional(),
39541
+ parentThreadId: external_exports.string().uuid(),
39542
+ depth: external_exports.number().int().nonnegative(),
39543
+ message: userMessageSchema
39544
+ });
39507
39545
  harnessInboxPayloadSchemas = {
39508
39546
  message: external_exports.looseObject({
39509
39547
  message: userMessageSchema,
39510
39548
  userId: external_exports.string().nullable(),
39511
39549
  messageId: external_exports.string().optional(),
39550
+ agentOutcome: harnessAgentOutcomeSchema.optional(),
39512
39551
  model: external_exports.string().optional(),
39513
39552
  thinkingLevel: external_exports.enum(VALID_THINKING_LEVELS).optional(),
39514
39553
  instructionsHash: external_exports.string().optional(),
@@ -39517,10 +39556,14 @@ var init_types8 = __esm({
39517
39556
  instructions: external_exports.object({ environmentSystemPrompt: external_exports.string().optional(), customInstructions: external_exports.string().optional() }).optional(),
39518
39557
  errorNotificationTarget: integrationErrorNotificationTargetSchema.optional()
39519
39558
  }),
39520
- interrupt: external_exports.looseObject({ userId: external_exports.string().nullable() })
39559
+ interrupt: external_exports.looseObject({ userId: external_exports.string().nullable(), messageId: external_exports.string().optional(), cancelQueued: external_exports.boolean().optional() })
39521
39560
  };
39522
39561
  harnessEventBodySchema = external_exports.discriminatedUnion("type", [
39562
+ external_exports.object({ type: external_exports.literal("thread_origin"), payload: harnessThreadOriginSchema }),
39563
+ external_exports.object({ type: external_exports.literal("agent_outcome"), payload: harnessAgentOutcomeSchema }),
39523
39564
  external_exports.object({ type: external_exports.literal("user_message"), payload: harnessInboxPayloadSchemas.message }),
39565
+ external_exports.object({ type: external_exports.literal("cancelled_message"), payload: harnessInboxPayloadSchemas.message }),
39566
+ external_exports.object({ type: external_exports.literal("interrupt"), payload: harnessInboxPayloadSchemas.interrupt }),
39524
39567
  /** Saved before its tool calls run. */
39525
39568
  external_exports.object({ type: external_exports.literal("assistant_message"), payload: external_exports.looseObject({ message: assistantMessageSchema }) }),
39526
39569
  external_exports.object({ type: external_exports.literal("tool_result"), payload: external_exports.looseObject({ message: toolResultMessageSchema }) }),
@@ -39554,6 +39597,15 @@ var init_types8 = __esm({
39554
39597
  }
39555
39598
  });
39556
39599
 
39600
+ // ../shared/src/harness/context.ts
39601
+ var MAX_REFERENCE_IMAGE_BYTES;
39602
+ var init_context = __esm({
39603
+ "../shared/src/harness/context.ts"() {
39604
+ "use strict";
39605
+ MAX_REFERENCE_IMAGE_BYTES = 8 * 1024 * 1024;
39606
+ }
39607
+ });
39608
+
39557
39609
  // ../shared/src/harness/worker-routes.ts
39558
39610
  var harnessWorkerEngineRequestSchema, harnessWorkerEngineResponseSchema, harnessWorkerCredentialRequestSchema, harnessWorkerCredentialResponseSchema, harnessWorkerTurnCompleteRequestSchema;
39559
39611
  var init_worker_routes = __esm({
@@ -39648,7 +39700,7 @@ var CLI_VERSION;
39648
39700
  var init_cli_version = __esm({
39649
39701
  "../shared/src/cli-version.ts"() {
39650
39702
  "use strict";
39651
- CLI_VERSION = "0.3.474";
39703
+ CLI_VERSION = "0.3.475";
39652
39704
  }
39653
39705
  });
39654
39706
 
@@ -50663,6 +50715,7 @@ var init_src = __esm({
50663
50715
  init_replicas_mcp();
50664
50716
  init_subagent_mcp();
50665
50717
  init_types8();
50718
+ init_context();
50666
50719
  init_worker_routes();
50667
50720
  init_headless_agent();
50668
50721
  init_errors3();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.474",
3
+ "version": "0.3.475",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {