replicas-cli 0.2.244 → 0.2.246

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.mjs +39 -14
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -7539,6 +7539,21 @@ function isRecord(value) {
7539
7539
  return typeof value === "object" && value !== null && !Array.isArray(value);
7540
7540
  }
7541
7541
 
7542
+ // ../shared/src/result.ts
7543
+ function createSuccessResult(data) {
7544
+ return { ok: true, data };
7545
+ }
7546
+ function createErrorResult(error) {
7547
+ return {
7548
+ ok: false,
7549
+ error: {
7550
+ message: error.message,
7551
+ code: error.code,
7552
+ details: error.details
7553
+ }
7554
+ };
7555
+ }
7556
+
7542
7557
  // ../shared/src/agent.ts
7543
7558
  var VALID_AGENT_PROVIDERS = ["claude", "codex", "relay"];
7544
7559
  function isValidAgentProvider(value) {
@@ -9142,7 +9157,7 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
9142
9157
  var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
9143
9158
 
9144
9159
  // ../shared/src/cli-version.ts
9145
- var CLI_VERSION = "0.2.244";
9160
+ var CLI_VERSION = "0.2.246";
9146
9161
 
9147
9162
  // ../shared/src/engine/environment.ts
9148
9163
  var DESKTOP_NOVNC_PORT = 6080;
@@ -9276,7 +9291,7 @@ function validateAgentSelection(body, existing) {
9276
9291
  const agentProvider = body.agent_provider;
9277
9292
  if (agentProvider !== void 0 && agentProvider !== null) {
9278
9293
  if (!isValidAgentProvider(agentProvider)) {
9279
- return { ok: false, error: `Invalid agent_provider: must be one of ${VALID_AGENT_PROVIDERS.join(", ")}` };
9294
+ return createErrorResult({ message: `Invalid agent_provider: must be one of ${VALID_AGENT_PROVIDERS.join(", ")}` });
9280
9295
  }
9281
9296
  }
9282
9297
  const effectiveAgent = agentProvider !== void 0 ? agentProvider : existing.agentProvider;
@@ -9287,24 +9302,24 @@ function validateAgentSelection(body, existing) {
9287
9302
  }
9288
9303
  if (model !== void 0 && model !== null) {
9289
9304
  if (typeof model !== "string" || model.trim().length === 0) {
9290
- return { ok: false, error: "model must be a non-empty string" };
9305
+ return createErrorResult({ message: "model must be a non-empty string" });
9291
9306
  }
9292
9307
  model = normalizeClaudeModel(model) ?? model;
9293
9308
  if (!effectiveAgent) {
9294
- return { ok: false, error: "Cannot set model without an agent_provider (the model would be applied against the org default agent and may not be valid for it)" };
9309
+ return createErrorResult({ message: "Cannot set model without an agent_provider (the model would be applied against the org default agent and may not be valid for it)" });
9295
9310
  }
9296
9311
  const allowed = AGENT_MODELS[effectiveAgent];
9297
9312
  if (!allowed.includes(model)) {
9298
- return { ok: false, error: `Invalid model "${model}" for agent ${effectiveAgent}. Valid models: ${allowed.join(", ")}` };
9313
+ return createErrorResult({ message: `Invalid model "${model}" for agent ${effectiveAgent}. Valid models: ${allowed.join(", ")}` });
9299
9314
  }
9300
9315
  }
9301
9316
  const thinkingLevel = body.thinking_level;
9302
9317
  if (thinkingLevel !== void 0 && thinkingLevel !== null) {
9303
9318
  if (!isValidThinkingLevel(thinkingLevel)) {
9304
- return { ok: false, error: `Invalid thinking_level: must be one of ${VALID_THINKING_LEVELS.join(", ")}` };
9319
+ return createErrorResult({ message: `Invalid thinking_level: must be one of ${VALID_THINKING_LEVELS.join(", ")}` });
9305
9320
  }
9306
9321
  }
9307
- return { ok: true, selection: { agentProvider, model, thinkingLevel } };
9322
+ return createSuccessResult({ agentProvider, model, thinkingLevel });
9308
9323
  }
9309
9324
 
9310
9325
  // ../shared/src/automations/github/index.ts
@@ -9676,6 +9691,12 @@ function extractToolResultText(content, separator = "\n") {
9676
9691
  }
9677
9692
  return texts.join(separator);
9678
9693
  }
9694
+ function normalizeContentBlocks(content) {
9695
+ if (typeof content === "string") {
9696
+ return content ? [{ type: "text", text: content }] : [];
9697
+ }
9698
+ return content ?? [];
9699
+ }
9679
9700
  function parseStringField(value) {
9680
9701
  if (typeof value !== "string") return null;
9681
9702
  const trimmed = value.trim();
@@ -9786,6 +9807,7 @@ function parseMcpToolName(name) {
9786
9807
  }
9787
9808
 
9788
9809
  // ../shared/src/display-message/parsers/claude-parser.ts
9810
+ var LOCAL_COMMAND_ECHO_REGEX = /^<(?:command-name|command-message|local-command-stdout|local-command-stderr)>/;
9789
9811
  function parseClaudeEvents(events, parentToolUseId) {
9790
9812
  const messages = [];
9791
9813
  const filterValue = parentToolUseId !== void 0 ? parentToolUseId : null;
@@ -9803,7 +9825,7 @@ function parseClaudeEvents(events, parentToolUseId) {
9803
9825
  }));
9804
9826
  filteredEvents.forEach((event) => {
9805
9827
  if (event.type === "claude-user") {
9806
- const content = event.payload.message?.content || [];
9828
+ const content = normalizeContentBlocks(event.payload.message?.content);
9807
9829
  const toolResult = content.find((c) => c.type === "tool_result");
9808
9830
  if (toolResult && toolResult.tool_use_id) {
9809
9831
  if (!toolResult.is_error) {
@@ -9815,6 +9837,9 @@ function parseClaudeEvents(events, parentToolUseId) {
9815
9837
  return;
9816
9838
  }
9817
9839
  const textContent = content.filter((c) => c.type === "text").map((c) => c.text || "").join("\n");
9840
+ if (LOCAL_COMMAND_ECHO_REGEX.test(textContent.trim())) {
9841
+ return;
9842
+ }
9818
9843
  const images = content.filter((c) => c.type === "image" && c.source).map((c) => {
9819
9844
  const source = c.source;
9820
9845
  return {
@@ -9834,7 +9859,7 @@ function parseClaudeEvents(events, parentToolUseId) {
9834
9859
  }
9835
9860
  }
9836
9861
  if (event.type === "claude-assistant") {
9837
- const contentBlocks = event.payload.message?.content || [];
9862
+ const contentBlocks = normalizeContentBlocks(event.payload.message?.content);
9838
9863
  contentBlocks.forEach((block) => {
9839
9864
  if (block.type === "text" && block.text) {
9840
9865
  messages.push({
@@ -10079,7 +10104,7 @@ function parseClaudeEvents(events, parentToolUseId) {
10079
10104
  });
10080
10105
  filteredEvents.forEach((event) => {
10081
10106
  if (event.type === "claude-user") {
10082
- const content = event.payload.message?.content || [];
10107
+ const content = normalizeContentBlocks(event.payload.message?.content);
10083
10108
  const toolResult = content.find((c) => c.type === "tool_result");
10084
10109
  if (toolResult && toolResult.tool_use_id) {
10085
10110
  const toolInfo = toolCallMap.get(toolResult.tool_use_id);
@@ -12503,13 +12528,13 @@ function parseModelOption(value) {
12503
12528
  function applyAgentSelection(body, existing) {
12504
12529
  const result = validateAgentSelection(body, existing);
12505
12530
  if (!result.ok) {
12506
- console.log(chalk18.red(result.error));
12531
+ console.log(chalk18.red(result.error.message));
12507
12532
  process.exit(1);
12508
12533
  }
12509
12534
  const out = {};
12510
- if (result.selection.agentProvider !== void 0) out.agent_provider = result.selection.agentProvider;
12511
- if (result.selection.model !== void 0) out.model = result.selection.model;
12512
- if (result.selection.thinkingLevel !== void 0) out.thinking_level = result.selection.thinkingLevel;
12535
+ if (result.data.agentProvider !== void 0) out.agent_provider = result.data.agentProvider;
12536
+ if (result.data.model !== void 0) out.model = result.data.model;
12537
+ if (result.data.thinkingLevel !== void 0) out.thinking_level = result.data.thinkingLevel;
12513
12538
  return out;
12514
12539
  }
12515
12540
  function formatTrigger(trigger) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.244",
3
+ "version": "0.2.246",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.mjs",
6
6
  "bin": {