@aiaiai-pt/martha-cli 0.61.1 → 0.61.2

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  All notable changes to `@aiaiai-pt/martha-cli`. Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This project adheres to semver — `0.x` releases may include breaking changes between minor versions.
4
4
 
5
+ ## [0.61.2] — 2026-10-07
6
+
7
+ ### Fixed — `martha chat` no longer prints `{"v": 1}` before every answer (#1601)
8
+
9
+ Since 2026-08-06 every chat stream opens with a named `stream_start` frame
10
+ (`event: stream_start` / `data: {"v": 1}`). The chat parser read only `data:`
11
+ lines, so the frame was printed as answer text. It now parses SSE events
12
+ properly and skips named events. The same fall-through printed structured
13
+ frames as raw JSON: `agent_progress` frames are now ignored, and a
14
+ `handover_placeholder` (a human took over) shows its message.
15
+
5
16
  ## [0.61.1] — 2026-09-25
6
17
 
7
18
  ### Fixed — carries 0.60.2's redirect fix onto the 0.61 line
package/dist/index.js CHANGED
@@ -3528,7 +3528,6 @@ var require_stringify = __commonJS((exports) => {
3528
3528
  nullStr: "null",
3529
3529
  simpleKeys: false,
3530
3530
  singleQuote: null,
3531
- trailingComma: false,
3532
3531
  trueStr: "true",
3533
3532
  verifyAliasOrder: true
3534
3533
  }, doc.schema.toStringOptions, options);
@@ -4037,20 +4036,13 @@ ${indent}${line}` : `
4037
4036
  if (comment)
4038
4037
  reqNewline = true;
4039
4038
  let str = stringify.stringify(item, itemCtx, () => comment = null);
4040
- reqNewline || (reqNewline = lines.length > linesAtValue || str.includes(`
4041
- `));
4042
- if (i < items.length - 1) {
4039
+ if (i < items.length - 1)
4043
4040
  str += ",";
4044
- } else if (ctx.options.trailingComma) {
4045
- if (ctx.options.lineWidth > 0) {
4046
- reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str.length + 2) > ctx.options.lineWidth);
4047
- }
4048
- if (reqNewline) {
4049
- str += ",";
4050
- }
4051
- }
4052
4041
  if (comment)
4053
4042
  str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
4043
+ if (!reqNewline && (lines.length > linesAtValue || str.includes(`
4044
+ `)))
4045
+ reqNewline = true;
4054
4046
  lines.push(str);
4055
4047
  linesAtValue = lines.length;
4056
4048
  }
@@ -6845,22 +6837,17 @@ var require_compose_node = __commonJS((exports) => {
6845
6837
  case "block-map":
6846
6838
  case "block-seq":
6847
6839
  case "flow-collection":
6848
- try {
6849
- node = composeCollection.composeCollection(CN, ctx, token, props, onError);
6850
- if (anchor)
6851
- node.anchor = anchor.source.substring(1);
6852
- } catch (error) {
6853
- const message = error instanceof Error ? error.message : String(error);
6854
- onError(token, "RESOURCE_EXHAUSTION", message);
6855
- }
6840
+ node = composeCollection.composeCollection(CN, ctx, token, props, onError);
6841
+ if (anchor)
6842
+ node.anchor = anchor.source.substring(1);
6856
6843
  break;
6857
6844
  default: {
6858
6845
  const message = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`;
6859
6846
  onError(token, "UNEXPECTED_TOKEN", message);
6847
+ node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);
6860
6848
  isSrcToken = false;
6861
6849
  }
6862
6850
  }
6863
- node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError));
6864
6851
  if (anchor && node.anchor === "")
6865
6852
  onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
6866
6853
  if (atKey && ctx.options.stringKeys && (!identity.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
@@ -9440,41 +9427,15 @@ async function* parseGenericSSE(body) {
9440
9427
  }
9441
9428
  }
9442
9429
  async function* parseSSEStream(body) {
9443
- const reader = body.getReader();
9444
- const decoder = new TextDecoder;
9445
- let buffer = "";
9446
- try {
9447
- while (true) {
9448
- const { done, value } = await reader.read();
9449
- if (done)
9450
- break;
9451
- buffer += decoder.decode(value, { stream: true });
9452
- const lines = buffer.split(`
9453
- `);
9454
- buffer = lines.pop();
9455
- for (const line of lines) {
9456
- const trimmed = line.trim();
9457
- if (!trimmed || trimmed.startsWith(":"))
9458
- continue;
9459
- if (trimmed.startsWith("data: ")) {
9460
- const data = trimmed.slice(6);
9461
- const event = parseDataLine(data);
9462
- if (event) {
9463
- yield event;
9464
- if (event.type === "done" || event.type === "error")
9465
- return;
9466
- }
9467
- }
9468
- }
9469
- }
9470
- if (buffer.trim().startsWith("data: ")) {
9471
- const data = buffer.trim().slice(6);
9472
- const event = parseDataLine(data);
9473
- if (event)
9474
- yield event;
9430
+ for await (const sse of parseGenericSSE(body)) {
9431
+ if (sse.event && sse.event !== "message")
9432
+ continue;
9433
+ const event = parseDataLine(sse.data);
9434
+ if (event) {
9435
+ yield event;
9436
+ if (event.type === "done" || event.type === "error")
9437
+ return;
9475
9438
  }
9476
- } finally {
9477
- reader.releaseLock();
9478
9439
  }
9479
9440
  }
9480
9441
  function parseDataLine(data) {
@@ -9501,6 +9462,12 @@ function parseDataLine(data) {
9501
9462
  if (obj.type === "clear") {
9502
9463
  return { type: "clear", data: "" };
9503
9464
  }
9465
+ if (obj.type === "handover_placeholder") {
9466
+ return { type: "token", data: String(obj.message ?? "") };
9467
+ }
9468
+ if (obj.type === "agent_progress" || obj.type === "widget") {
9469
+ return null;
9470
+ }
9504
9471
  if (obj.type === "done") {
9505
9472
  return {
9506
9473
  type: "done",
@@ -11204,7 +11171,7 @@ init_config();
11204
11171
  init_errors();
11205
11172
 
11206
11173
  // src/version.ts
11207
- var CLI_VERSION = "0.61.1";
11174
+ var CLI_VERSION = "0.61.2";
11208
11175
 
11209
11176
  // src/commands/sessions.ts
11210
11177
  function relativeTime(iso) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiaiai-pt/martha-cli",
3
- "version": "0.61.1",
3
+ "version": "0.61.2",
4
4
  "description": "Terminal-first client for the Martha AI platform",
5
5
  "homepage": "https://docs.martha.nomadriver.co",
6
6
  "repository": {