replicas-cli 0.3.588 → 0.3.589

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 +28 -3
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -38257,7 +38257,7 @@ function parsePiEvents(events) {
38257
38257
  const messages = [];
38258
38258
  const text3 = /* @__PURE__ */ new Map();
38259
38259
  const thinking = /* @__PURE__ */ new Map();
38260
- let activeMessageId = "assistant";
38260
+ let activeMessageId = null;
38261
38261
  for (const event of events) {
38262
38262
  if (event.type === "event_msg" && event.payload.type === "user_message" && typeof event.payload.message === "string") {
38263
38263
  messages.push({ id: getUserMessageId(event) ?? `pi-user-${event.timestamp}-${messages.length}`, type: "user", content: event.payload.message, timestamp: event.timestamp });
@@ -38277,6 +38277,31 @@ function parsePiEvents(events) {
38277
38277
  continue;
38278
38278
  }
38279
38279
  if (event.type === "pi-message_end") {
38280
+ const message2 = isRecord(event.payload.message) ? event.payload.message : null;
38281
+ if (message2?.role === "assistant") {
38282
+ const id = typeof message2.id === "string" && message2.id ? message2.id : activeMessageId ?? `assistant-${event.timestamp}-${messages.length}`;
38283
+ if (Array.isArray(message2.content)) {
38284
+ const thinkingParts = [];
38285
+ const textParts = [];
38286
+ for (const block of message2.content) {
38287
+ if (!isRecord(block)) continue;
38288
+ if (block.type === "thinking" && typeof block.thinking === "string" && block.thinking) {
38289
+ thinkingParts.push(block.thinking);
38290
+ } else if (block.type === "text" && typeof block.text === "string" && block.text) {
38291
+ textParts.push(block.text);
38292
+ }
38293
+ }
38294
+ if (thinkingParts.length > 0) {
38295
+ const content = thinkingParts.join("\n\n");
38296
+ upsertDisplayMessage(messages, { id: `pi-thinking-${id}`, type: "reasoning", content, status: "completed", timestamp: event.timestamp });
38297
+ }
38298
+ if (textParts.length > 0) {
38299
+ const content = textParts.join("\n\n");
38300
+ upsertDisplayMessage(messages, { id: `pi-${id}`, type: "agent", content, timestamp: event.timestamp });
38301
+ }
38302
+ }
38303
+ activeMessageId = null;
38304
+ }
38280
38305
  const error62 = assistantErrorMessage(event.payload.message);
38281
38306
  if (error62) {
38282
38307
  messages.push({ id: `pi-error-${event.timestamp}-${messages.length}`, type: "error", message: error62, timestamp: event.timestamp });
@@ -38285,7 +38310,7 @@ function parsePiEvents(events) {
38285
38310
  }
38286
38311
  if (event.type === "pi-message_update") {
38287
38312
  const payload = nestedPayload(event);
38288
- const id = typeof payload.id === "string" ? payload.id : activeMessageId;
38313
+ const id = typeof payload.id === "string" ? payload.id : activeMessageId ?? "assistant";
38289
38314
  if (payload.type === "text_delta" && typeof payload.delta === "string") text3.set(id, `${text3.get(id) ?? ""}${payload.delta}`);
38290
38315
  if (payload.type === "thinking_delta" && typeof payload.delta === "string") thinking.set(id, `${thinking.get(id) ?? ""}${payload.delta}`);
38291
38316
  const textContent = text3.get(id);
@@ -40624,7 +40649,7 @@ var CLI_VERSION;
40624
40649
  var init_cli_version = __esm({
40625
40650
  "../shared/src/cli-version.ts"() {
40626
40651
  "use strict";
40627
- CLI_VERSION = "0.3.588";
40652
+ CLI_VERSION = "0.3.589";
40628
40653
  }
40629
40654
  });
40630
40655
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.588",
3
+ "version": "0.3.589",
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": {