@aspalagin/openclaw-max 0.8.2 → 0.9.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/src/state.ts CHANGED
@@ -11,7 +11,9 @@
11
11
  import * as fs from 'node:fs/promises';
12
12
  import * as path from 'node:path';
13
13
 
14
- import { readJsonFileWithFallback, writeJsonFileAtomically } from 'openclaw/plugin-sdk/json-store';
14
+ import { writeJsonFileAtomically } from 'openclaw/plugin-sdk/json-store';
15
+
16
+ import { readJsonFileWithFallback } from './json-store-compat.js';
15
17
  import { resolveStateDir } from 'openclaw/plugin-sdk/state-paths';
16
18
 
17
19
  export interface MaxChatRegistryEntry {
@@ -9,6 +9,7 @@
9
9
  import type { ChannelLogSink } from 'openclaw/plugin-sdk/channel-contract';
10
10
 
11
11
  import type { ResolvedMaxAccount } from './accounts.js';
12
+ import { resolveMaxTableMode, toMaxMarkdown } from './format.js';
12
13
  import {
13
14
  deleteMaxMessage,
14
15
  editMaxMessage,
@@ -78,7 +79,11 @@ export function createMaxDraftStream(params: {
78
79
 
79
80
  const draftUpdate = async (text: string) => {
80
81
  if (draftStopped || !text) return;
81
- const trimmed = text.trimEnd();
82
+ // Formatted like the final answer (deliver.ts), so the final edit compares
83
+ // and replaces like with like.
84
+ const trimmed = toMaxMarkdown(text, {
85
+ tableMode: resolveMaxTableMode(account.config),
86
+ }).trimEnd();
82
87
  if (!trimmed || trimmed === draftLastText) return;
83
88
  if (trimmed.length > DRAFT_MAX_CHARS) {
84
89
  draftStopped = true;
@@ -20,7 +20,9 @@
20
20
  import * as fs from 'node:fs/promises';
21
21
  import * as path from 'node:path';
22
22
 
23
- import { readJsonFileWithFallback, writeJsonFileAtomically } from 'openclaw/plugin-sdk/json-store';
23
+ import { writeJsonFileAtomically } from 'openclaw/plugin-sdk/json-store';
24
+
25
+ import { readJsonFileWithFallback } from './json-store-compat.js';
24
26
  import { resolveStateDir } from 'openclaw/plugin-sdk/state-paths';
25
27
 
26
28
  import type { MaxUpdate } from './api.js';