@datalayer/agent-runtimes 1.5.25 → 1.5.27

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.
@@ -8,6 +8,7 @@
8
8
  * @module chat/utils
9
9
  */
10
10
  import { QueryClient } from '@tanstack/react-query';
11
+ import { sanitizeAssistantContent } from '../portable/adapterEvents';
11
12
  import { AGUIAdapter, A2AAdapter, VercelAIAdapter, ACPAdapter, BrowserAgentAdapter, } from '../protocols';
12
13
  // ---------------------------------------------------------------------------
13
14
  // Constants
@@ -32,32 +33,8 @@ export const PRIMER_PORTAL_ROOT_ID = '__primerPortalRoot__';
32
33
  export function isToolCallMessage(item) {
33
34
  return 'type' in item && item.type === 'tool-call';
34
35
  }
35
- /**
36
- * Strip low-level protocol/tool-call markup from assistant text content.
37
- *
38
- * Some models occasionally leak internal call formats (for example,
39
- * <calls>...</calls> or <tml:invoke ...>) into natural-language responses.
40
- * Keep user/system text untouched and sanitize assistant-visible text only.
41
- */
42
- export function sanitizeAssistantContent(content) {
43
- if (!content || !content.includes('<')) {
44
- return content;
45
- }
46
- let sanitized = content;
47
- // Remove complete blocks first.
48
- sanitized = sanitized
49
- .replace(/<\s*calls\b[\s\S]*?<\s*\/\s*calls\s*>/gi, '')
50
- .replace(/<\s*(?:an:)?tml:invoke\b[\s\S]*?<\s*\/\s*(?:an:)?tml:invoke\s*>/gi, '')
51
- .replace(/<\s*(?:an:)?tml:parameter\b[\s\S]*?<\s*\/\s*(?:an:)?tml:parameter\s*>/gi, '');
52
- // Remove standalone/open/close tags and malformed tag fragments.
53
- sanitized = sanitized
54
- .replace(/<\s*\/?\s*(?:an:[a-z_]+|tml:[a-z_]+|calls)\b[^>]*>?/gi, '')
55
- .replace(/<\s*\/\s*>/g, '')
56
- .replace(/^[ \t]+$/gm, '')
57
- .replace(/\n{3,}/g, '\n\n')
58
- .trim();
59
- return sanitized;
60
- }
36
+ // What a model leaked of its call markup, taken out: one rule for every client.
37
+ export { sanitizeAssistantContent };
61
38
  /**
62
39
  * Extract text content from a ChatMessage
63
40
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/agent-runtimes",
3
- "version": "1.5.25",
3
+ "version": "1.5.27",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  ".",