@co0ontty/wand 1.14.3 → 1.15.0

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.
@@ -42,7 +42,6 @@ export function truncateMessagesForTransport(messages, cardDefaults, streamingTu
42
42
  // Never truncate the currently streaming turn
43
43
  if (turnIndex === streamingTurnIndex)
44
44
  return turn;
45
- // Build tool_use_id → tool_name map from this turn's blocks
46
45
  const toolNameMap = new Map();
47
46
  for (const block of turn.content) {
48
47
  if (block.type === "tool_use") {
@@ -68,7 +67,6 @@ export function truncateMessagesForTransport(messages, cardDefaults, streamingTu
68
67
  ...result,
69
68
  content: contentStr.slice(0, SUMMARY_LENGTH) + "…",
70
69
  _truncated: true,
71
- _originalSize: contentStr.length,
72
70
  };
73
71
  });
74
72
  return changed ? { ...turn, content: truncatedContent } : turn;
@@ -1184,38 +1184,11 @@ export class ProcessManager extends EventEmitter {
1184
1184
  }
1185
1185
  /** Lightweight snapshot for list views — omits output and messages. */
1186
1186
  snapshotSlim(record) {
1187
- const messages = record.ptyBridge?.getMessages() ?? record.messages;
1187
+ const snapshot = this.snapshot(record);
1188
1188
  return {
1189
- id: record.id,
1190
- sessionKind: "pty",
1191
- provider: record.provider,
1192
- runner: "pty",
1193
- command: record.command,
1194
- cwd: record.cwd,
1195
- mode: record.mode,
1196
- worktreeEnabled: record.worktreeEnabled ?? false,
1197
- worktree: record.worktree ?? null,
1198
- autonomyPolicy: record.autonomyPolicy,
1199
- approvalPolicy: record.approvalPolicy,
1200
- allowedScopes: record.allowedScopes,
1201
- status: record.status,
1202
- exitCode: record.exitCode,
1203
- startedAt: record.startedAt,
1204
- endedAt: record.endedAt,
1189
+ ...snapshot,
1205
1190
  output: "",
1206
- archived: record.archived,
1207
- archivedAt: record.archivedAt,
1208
- permissionBlocked: this.isPermissionBlocked(record),
1209
- pendingEscalation: record.pendingEscalation || undefined,
1210
- lastEscalationResult: record.lastEscalationResult || undefined,
1211
- claudeSessionId: record.claudeSessionId || null,
1212
- resumedFromSessionId: record.resumedFromSessionId ?? undefined,
1213
- resumedToSessionId: record.resumedToSessionId ?? undefined,
1214
- autoRecovered: record.autoRecovered ?? false,
1215
- autoApprovePermissions: record.autoApprovePermissions || undefined,
1216
- approvalStats: record.approvalStats.total > 0 ? record.approvalStats : undefined,
1217
- summary: deriveSessionSummary(messages, record.currentTask?.title ?? null),
1218
- currentTaskTitle: record.status === "running" ? record.currentTask?.title ?? undefined : undefined,
1191
+ messages: undefined,
1219
1192
  };
1220
1193
  }
1221
1194
  isPermissionBlocked(record) {
@@ -1481,42 +1454,26 @@ export class ProcessManager extends EventEmitter {
1481
1454
  handleBridgeEvent(record, event) {
1482
1455
  switch (event.type) {
1483
1456
  case "output.raw":
1457
+ case "output.chat": {
1484
1458
  // Sync record.output from bridge before emitting so the event carries fresh data
1485
1459
  record.output = record.ptyBridge?.getRawOutput() ?? record.output;
1486
- {
1487
- const rawMessages = record.ptyBridge?.getMessages() ?? [];
1488
- const messages = truncateMessagesForTransport(rawMessages, this.config.cardDefaults ?? {}, rawMessages.length - 1);
1489
- // Emit output event for terminal view
1490
- this.emitEvent({
1491
- type: "output",
1492
- sessionId: event.sessionId,
1493
- data: {
1494
- chunk: event.data.chunk,
1495
- output: record.output,
1496
- messages,
1497
- permissionBlocked: this.isPermissionBlocked(record),
1498
- },
1499
- });
1500
- }
1501
- break;
1502
- case "output.chat":
1503
- // Sync record.output from bridge before emitting so the event carries fresh data
1504
- record.output = record.ptyBridge?.getRawOutput() ?? record.output;
1505
- {
1506
- const rawMessages = record.ptyBridge?.getMessages() ?? [];
1507
- const messages = truncateMessagesForTransport(rawMessages, this.config.cardDefaults ?? {}, rawMessages.length - 1);
1508
- // Emit output event with updated messages for chat view
1509
- this.emitEvent({
1510
- type: "output",
1511
- sessionId: event.sessionId,
1512
- data: {
1513
- output: record.output,
1514
- messages,
1515
- permissionBlocked: this.isPermissionBlocked(record),
1516
- },
1517
- });
1460
+ const rawMessages = record.ptyBridge?.getMessages() ?? [];
1461
+ const messages = truncateMessagesForTransport(rawMessages, this.config.cardDefaults ?? {}, rawMessages.length - 1);
1462
+ const data = {
1463
+ output: record.output,
1464
+ messages,
1465
+ permissionBlocked: this.isPermissionBlocked(record),
1466
+ };
1467
+ if (event.type === "output.raw") {
1468
+ data.chunk = event.data.chunk;
1518
1469
  }
1470
+ this.emitEvent({
1471
+ type: "output",
1472
+ sessionId: event.sessionId,
1473
+ data,
1474
+ });
1519
1475
  break;
1476
+ }
1520
1477
  case "permission.prompt": {
1521
1478
  const data = event.data;
1522
1479
  record.pendingEscalation = {
package/dist/types.d.ts CHANGED
@@ -191,8 +191,6 @@ export interface ToolResultBlock {
191
191
  is_error?: boolean;
192
192
  /** When true, content has been truncated for transport. Client should fetch full content via API. */
193
193
  _truncated?: boolean;
194
- /** Original content size in bytes, provided when truncated. */
195
- _originalSize?: number;
196
194
  }
197
195
  export type ContentBlock = TextBlock | ThinkingBlock | ToolUseBlock | ToolResultBlock;
198
196
  export interface ConversationTurn {