reifyui 0.14.0 → 0.15.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reifyui",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "description": "The open-source rendering & interaction layer for agentic applications. Stream and render any agent's output as polished, application-native UI — model-agnostic, framework-agnostic, design-system-native. The foundation for building generative-UI and agent products.",
5
5
  "keywords": [
6
6
  "react",
@@ -91,7 +91,11 @@ export function commandText(a) {
91
91
  if (c.length >= 3 && /(^|\/)(ba|z)?sh$/.test(String(c[0])) && /^-\w*c$/.test(String(c[1]))) c = c.slice(2).join(' ');
92
92
  else c = c.join(' ');
93
93
  }
94
- return str(c).trim();
94
+ let t = str(c).trim();
95
+ // "/bin/bash -lc 'cat x'" (Codex reports its commands wrapped in a login shell): the inner command
96
+ const m = t.match(/^(?:\/(?:usr\/)?bin\/)?(?:ba|z)?sh\s+-\w*c\s+(['"])([\s\S]*)\1$/);
97
+ if (m) t = m[2].replace(m[1] === "'" ? /'\\''/g : /\\"/g, m[1]);
98
+ return t;
95
99
  }
96
100
 
97
101
  export function lineCount(s) {
@@ -388,7 +388,8 @@ export function turnFromMessage(msg, clock = null, user = null) {
388
388
  const c = s.callId ? byCall[s.callId] : null;
389
389
  const answered = s.result !== undefined;
390
390
  let st = c ? c.status : (answered ? 'done' : (status === 'running' ? 'running' : (status === 'done' ? 'done' : 'stopped')));
391
- if (answered && st === 'running') st = 'done';
391
+ if (s.isError || s.is_error) st = 'failed';
392
+ if (answered && st === 'running') st = (s.isError || s.is_error) ? 'failed' : 'done';
392
393
  // a clock that missed the end (its stream dropped) must not keep a finished turn's call running
393
394
  if (st === 'running' && status !== 'running') st = status === 'done' ? 'done' : 'stopped';
394
395
  items.push({ kind: 'tool', id: s.callId || `call_${bi}_${si}`, itemId: null, name: s.name || 'tool', args: textOf(s.args ?? ''),
@@ -36,6 +36,8 @@ import { Chip } from './Chip.jsx';
36
36
  import { IcMic, IcPanelRight, IcPaperclip, IcSend } from './icons.jsx';
37
37
  import { withReasoning, withResult, withStep, withText } from '../state/blocks.js';
38
38
  import { bytesLabel } from '../format.js';
39
+ import { newTurn, reduceTurn, turnFromMessage } from '../agent-chat/turn.js';
40
+ import { AgentTurnView } from '../agent-chat/components.jsx';
39
41
 
40
42
  // Not props. Every one of the four copies used these exact numbers, so there is nothing to
41
43
  // configure — a knob nobody turns is a knob that only makes the call sites longer.
@@ -52,6 +54,18 @@ const PANEL_STATUS_LABELS = {
52
54
  incomplete: 'The turn hit its limit. Send a follow up to continue.',
53
55
  };
54
56
 
57
+ /** Messages as turns: each answer with the message it answers. */
58
+ function pairTurns(messages) {
59
+ const out = [];
60
+ let user = null;
61
+ for (const m of messages) {
62
+ if (m.role === 'user') { if (user) out.push({ user, asst: null }); user = m; }
63
+ else { out.push({ user, asst: m }); user = null; }
64
+ }
65
+ if (user) out.push({ user, asst: null });
66
+ return out;
67
+ }
68
+
55
69
  export function ChatPanel(props) {
56
70
  const {
57
71
  sessionId,
@@ -85,7 +99,16 @@ export function ChatPanel(props) {
85
99
  userExtras,
86
100
  toolLabels,
87
101
  classNames = {},
102
+ // view="agent" draws each turn with reifyui/agent-chat's AgentTurnView (the live line with the
103
+ // harness's mark, work folded per run of calls, every call openable) instead of ChatMessages.
104
+ // Needs styles/agent-chat.css too. `mark` (a node: the harness's logo) and `motion` (see
105
+ // motionFor) dress the live line; `agentLabels` overrides its words.
106
+ view = 'messages',
107
+ mark,
108
+ motion,
109
+ agentLabels,
88
110
  } = props;
111
+ const agentView = view === 'agent';
89
112
 
90
113
  const [messages, setMessages] = useState([]);
91
114
  const [draft, setDraft] = useState('');
@@ -150,13 +173,16 @@ export function ChatPanel(props) {
150
173
  // ── running a turn ────────────────────────────────────────────────────────
151
174
  const deliver = useCallback(async (text, files = []) => {
152
175
  setBusy(true);
153
- setMessages((m) => [...m, { role: 'assistant', blocks: [], status: 'running' }]);
176
+ // the turn's clock: every event folded in as it arrives (transports that pass onEvent), so the
177
+ // agent view can say when each call started and answered; never set for a replayed history
178
+ setMessages((m) => [...m, { role: 'assistant', blocks: [], status: 'running', clock: newTurn({ startedAt: Date.now() }) }]);
154
179
  try {
155
180
  const out = await api.current.runTurn({
156
181
  sessionId,
157
182
  text,
158
183
  attachments: files,
159
184
  handlers: {
185
+ onEvent: (ev) => updateLastAsst((a) => ({ ...a, clock: reduceTurn(a.clock || newTurn(), ev, Date.now()) })),
160
186
  onSession: (sid) => {
161
187
  // Arm the adopt guard only when the id is genuinely CHANGING: a session reporting
162
188
  // the id it already has is not a rename and must not suppress a later reload.
@@ -165,7 +191,7 @@ export function ChatPanel(props) {
165
191
  },
166
192
  onReasoningDelta: (d) => updateLastAsst((a) => ({ ...a, blocks: withReasoning(a.blocks, d) })),
167
193
  onToolCall: (name, args, callId) => updateLastAsst((a) => ({ ...a, blocks: withStep(a.blocks, { name, args, callId }) })),
168
- onToolResult: (callId, output) => updateLastAsst((a) => ({ ...a, blocks: withResult(a.blocks, callId, output) })),
194
+ onToolResult: (callId, output, isError) => updateLastAsst((a) => ({ ...a, blocks: withResult(a.blocks, callId, output, isError) })),
169
195
  onTextDelta: (d) => updateLastAsst((a) => ({ ...a, blocks: withText(a.blocks, d) })),
170
196
  onDone: (status) => updateLastAsst((a) => ({ ...a, status: status === 'completed' ? 'done' : status })),
171
197
  onError: () => updateLastAsst((a) => ({
@@ -421,6 +447,16 @@ export function ChatPanel(props) {
421
447
  {histLoading ? <ChatMessagesSkeleton />
422
448
  : empty && externalBusy ? (busyState === undefined ? defaultBusyState : busyState)
423
449
  : empty ? emptyState
450
+ : agentView ? (
451
+ <div className="uic-chat-turns">
452
+ {pairTurns(messages).map(({ user, asst }, i) => (
453
+ <AgentTurnView key={i} mark={mark} motion={motion} labels={agentLabels} renderMarkdown={renderMarkdown}
454
+ turn={asst ? turnFromMessage(asst, asst.clock || null, user ? { text: user.text, files: (user.files || []).map((n) => ({ name: n })) } : null)
455
+ : turnFromMessage({ status: 'done', blocks: [] }, null, user ? { text: user.text, files: (user.files || []).map((n) => ({ name: n })) } : null)}
456
+ userExtra={user ? userExtras?.(user, i) : undefined} />
457
+ ))}
458
+ </div>
459
+ )
424
460
  : (
425
461
  <ChatMessages
426
462
  messages={messages}
@@ -52,18 +52,19 @@ export function ToolGroup(props) {
52
52
  }
53
53
 
54
54
  export function ToolRow(props) {
55
- const { step, requestLabel = 'Request', resultLabel = 'Result' } = props;
55
+ const { step, requestLabel = 'Request', resultLabel = 'Result', failedLabel = 'Failed' } = props;
56
56
  const [open, setOpen] = useState(false);
57
57
  const meta = toolMeta(step.name, step.args);
58
58
  const Icon = meta.Icon;
59
59
  const hasDetail = !!(step.args && step.args !== '{}') || step.result !== undefined;
60
60
  return (
61
- <div className="wbx-act">
61
+ <div className={'wbx-act' + (step.isError ? ' is-failed' : '')}>
62
62
  <span className="wbx-act-ic-t"><Icon /></span>
63
63
  <div className="wbx-act-main">
64
64
  <button className={'wbx-act-row' + (open ? ' open' : '')} disabled={!hasDetail} onClick={() => setOpen((v) => !v)}>
65
65
  <span className="wbx-act-k">{meta.label}</span>
66
66
  {meta.chip && <span className="wbx-act-chip">{meta.chip}</span>}
67
+ {step.isError && <span className="wbx-act-failed">{failedLabel}</span>}
67
68
  {hasDetail && <span className="wbx-act-exp"><Chevron dir={open ? 'down' : 'right'} size={12} /></span>}
68
69
  </button>
69
70
  {open && (
@@ -190,7 +190,7 @@ function sessionIdOf(evt) {
190
190
  * person's own sentence instead of our scaffolding.
191
191
  *
192
192
  * handlers: the ReifyUI dispatcher's (onTextDelta, onReasoningDelta, onToolCall, onToolResult,
193
- * onDone, onError) plus onSession(sessionId).
193
+ * onDone, onError) plus onSession(sessionId) and onEvent(event), every event whole as it arrives.
194
194
  *
195
195
  * Returns {ok, sessionId}, or {connecting:true} when the gateway is still coming up (503).
196
196
  */
@@ -236,6 +236,8 @@ export async function streamTurn({ sessionId, harnessId, input, instructions, ha
236
236
  try { evt = JSON.parse(data); } catch { return; } // malformed frame
237
237
  const found = sessionIdOf(evt);
238
238
  if (found && found !== sid) { sid = found; handlers.onSession?.(found); }
239
+ // every event, whole, as it arrives (reifyui/agent-chat folds these into the turn's clock)
240
+ try { handlers.onEvent?.(evt); } catch { /* a view's clock must never break the stream */ }
239
241
  d.dispatch(evt);
240
242
  });
241
243
  } catch {
package/src/index.d.ts CHANGED
@@ -15,10 +15,14 @@ export interface ResponseHandlers {
15
15
  onCreated?(responseId: string): void;
16
16
  /** The server-side session id, for continuing this conversation on the next turn. */
17
17
  onSession?(sessionId: string): void;
18
+ /** Every event whole, as it arrives (streamTurn passes it; ChatPanel's agent view folds it into
19
+ * the turn's clock). */
20
+ onEvent?(event: { type: string; [k: string]: unknown }): void;
18
21
  onReasoningDelta?(text: string): void;
19
22
  onTextDelta?(text: string): void;
20
23
  onToolCall?(name: string, args: string, callId: string): void;
21
- onToolResult?(callId: string, output: string): void;
24
+ /** isError: the result item said the tool failed (`is_error: true`). */
25
+ onToolResult?(callId: string, output: string, isError?: boolean): void;
22
26
  onFile?(file: { container_id: string; file_id: string; filename: string }): void;
23
27
  /** Terminal event. `status` distinguishes completed / incomplete / failed (incl. cancels). */
24
28
  onDone?(status: string, response: unknown): void;
@@ -300,6 +304,14 @@ export interface ChatPanelProps {
300
304
  toolLabels?: Record<string, string>;
301
305
  /** The panel's placement in YOUR layout. Everything it paints inside is the package's. */
302
306
  classNames?: { root?: string };
307
+ /** 'agent' draws each turn with reifyui/agent-chat's AgentTurnView (needs styles/agent-chat.css). */
308
+ view?: 'messages' | 'agent';
309
+ /** The agent view's live-line mark: the harness's logo, as a node. */
310
+ mark?: ReactNode;
311
+ /** The mark's motion (reifyui/agent-chat motionFor(base)). */
312
+ motion?: string;
313
+ /** Overrides for the agent view's words (reifyui/agent-chat DEFAULT_AGENT_LABELS). */
314
+ agentLabels?: Record<string, unknown>;
303
315
  }
304
316
  export const ChatPanel: ComponentType<ChatPanelProps>;
305
317
 
@@ -3,7 +3,7 @@
3
3
  // activity interleaves with prose in real time (never all tools hoisted to the top):
4
4
  // { kind: 'text', text } — streamed prose
5
5
  // { kind: 'tools', reasoning, steps: ToolStep[] } — a contiguous run of tool activity
6
- // ToolStep: { name, args, result?, callId? }
6
+ // ToolStep: { name, args, result?, callId?, isError? } (isError: the tool said it failed)
7
7
 
8
8
  export function withText(blocks, d) {
9
9
  const out = blocks.slice(); const last = out[out.length - 1];
@@ -26,9 +26,10 @@ export function withStep(blocks, step) {
26
26
  return out;
27
27
  }
28
28
 
29
- export function withResult(blocks, callId, output) {
29
+ export function withResult(blocks, callId, output, isError = false) {
30
30
  return blocks.map((b) => (b.kind !== 'tools' ? b
31
- : { ...b, steps: b.steps.map((t) => ((t.callId && t.callId === callId && t.result === undefined) ? { ...t, result: output } : t)) }));
31
+ : { ...b, steps: b.steps.map((t) => ((t.callId && t.callId === callId && t.result === undefined)
32
+ ? { ...t, result: output, ...(isError ? { isError: true } : {}) } : t)) }));
32
33
  }
33
34
 
34
35
  /** All prose of an assistant message joined (for copy-to-clipboard etc.). */
@@ -19,7 +19,9 @@ export function turnsToMessages(turns) {
19
19
  const out = [];
20
20
  for (const t of turns || []) {
21
21
  if (t.user) out.push({ role: 'user', text: t.user });
22
- const steps = (t.tools || []).map((x) => ({ name: x.name, args: x.arguments, result: x.result }));
22
+ // the record names a result `output` (`result` is the older name); is_error marks a call the tool said failed
23
+ const steps = (t.tools || []).map((x) => ({ name: x.name, args: x.arguments, result: x.result ?? x.output,
24
+ ...(x.is_error ? { isError: true } : {}) }));
23
25
  const blocks = [];
24
26
  if (steps.length) blocks.push({ kind: 'tools', reasoning: '', steps });
25
27
  if (t.assistant) blocks.push({ kind: 'text', text: t.assistant });
@@ -15,7 +15,8 @@
15
15
  // onToolCall(name, args, callId) response.function_call_arguments.done (name + call_id
16
16
  // captured from the matching output_item.added, keyed by
17
17
  // output_index — the same pairing HR ships)
18
- // onToolResult(callId, output) function_call_output items
18
+ // onToolResult(callId, output, isError) function_call_output items; isError is true only when
19
+ // the item says the tool failed (`is_error: true`)
19
20
  // onTextDelta(text) response.output_text.delta
20
21
  // onFile({container_id,file_id,filename}) container_file_citation annotations
21
22
  // onDone(status, response) response.completed / .incomplete / .failed (a failed
@@ -47,7 +48,7 @@ export function createResponsesDispatcher(h) {
47
48
  if (item.type === 'function_call') {
48
49
  fnByIdx[ev.output_index] = { name: item.name || 'tool', callId: item.call_id || '' };
49
50
  } else if (item.type === 'function_call_output') {
50
- h.onToolResult?.(item.call_id || '', String(item.output ?? ''));
51
+ h.onToolResult?.(item.call_id || '', String(item.output ?? ''), item.is_error === true);
51
52
  }
52
53
  break;
53
54
  }
package/styles/chat.css CHANGED
@@ -140,6 +140,9 @@
140
140
  .wbx-act-main { min-width: 0; flex: 1; }
141
141
  .wbx-act-row { display: flex; align-items: center; gap: 8px; min-height: 22px; width: 100%; text-align: left; background: transparent; border: none; cursor: pointer; padding: 0; }
142
142
  .wbx-act-row:disabled { cursor: default; }
143
+ /* a call the tool reported as failed: said in words, not only in colour */
144
+ .wbx-act-failed { font-size: 11.5px; font-weight: 600; color: var(--uic-fail-ink, #b91c1c); }
145
+ .wbx-act.is-failed .wbx-act-ic-t { color: var(--uic-fail-ink, #b91c1c); }
143
146
  .wbx-act-k { font-size: 13.5px; font-weight: 600; color: var(--uic-ink, #111317); }
144
147
  .wbx-act-chip { font-size: 11.5px; font-family: var(--uic-mono, ui-monospace, Menlo, monospace); color: var(--uic-ink-2, #3A3D45);
145
148
  background: var(--uic-brand-faint, #EFF3FF); border-radius: 6px; padding: 1px 7px; }
@@ -362,3 +365,8 @@ body.uic-resizing iframe { pointer-events: none; }
362
365
  buttons centered on the grown box, which is the common chat-input behavior. */
363
366
  .uic-composer-line { display: flex; align-items: center; gap: 8px; }
364
367
  .uic-composer-line textarea { flex: 1; min-width: 0; }
368
+
369
+ /* ChatPanel view="agent": the turns of reifyui/agent-chat (its own styles: agent-chat.css) */
370
+ .uic-chat-turns { display: flex; flex-direction: column; gap: 22px; }
371
+ .uic-chat .uac-user-b { font-size: 13.5px; }
372
+ .uic-chat .uac-md { font-size: 13.5px; }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/stream/responses.js","../src/state/turns.js"],"sourcesContent":["// OpenAI Responses SSE event parsing — extracted from HarnessRouter's chat client\n// (harnessrouter/src/lib/chat.ts streamResponse). Transport-agnostic: the caller does the\n// fetch/POST however it likes (BFF, broker, direct) and hands the response body (a\n// ReadableStream) plus a handlers object here.\n//\n// Two layers:\n// readSSEStream(body, onData) — raw SSE framing (blank-line separated, data: lines)\n// createResponsesDispatcher(handlers) — native Responses event -> handler dispatch\n// pumpResponsesStream(body, handlers) — both together; resolves to the response id\n//\n// Handlers (all optional):\n// onCreated(responseId) response.created\n// onSession(sessionId) response.created metadata.session_id (continuation)\n// onReasoningDelta(text) response.reasoning_summary_text.delta\n// onToolCall(name, args, callId) response.function_call_arguments.done (name + call_id\n// captured from the matching output_item.added, keyed by\n// output_index — the same pairing HR ships)\n// onToolResult(callId, output) function_call_output items\n// onTextDelta(text) response.output_text.delta\n// onFile({container_id,file_id,filename}) container_file_citation annotations\n// onDone(status, response) response.completed / .incomplete / .failed (a failed\n// response's own status distinguishes user cancels)\n// onError(message) error events\n\nexport function createResponsesDispatcher(h) {\n // function_call name + call_id live on output_item.added; arguments finalize on .done — key by\n // output_index. function_call_output (the tool result) carries the same call_id → pair them.\n const fnByIdx = {};\n const self = {\n responseId: null,\n dispatch(ev) {\n const t = ev.type;\n switch (t) {\n case 'response.created': {\n const resp = ev.response || {};\n self.responseId = resp.id || self.responseId;\n if (self.responseId) h.onCreated?.(self.responseId);\n const sid = (resp.metadata && resp.metadata.session_id) || '';\n if (sid) h.onSession?.(sid);\n break;\n }\n case 'response.reasoning_summary_text.delta':\n h.onReasoningDelta?.(ev.delta || '');\n break;\n case 'response.output_item.added': {\n const item = ev.item || {};\n if (item.type === 'function_call') {\n fnByIdx[ev.output_index] = { name: item.name || 'tool', callId: item.call_id || '' };\n } else if (item.type === 'function_call_output') {\n h.onToolResult?.(item.call_id || '', String(item.output ?? ''));\n }\n break;\n }\n case 'response.function_call_arguments.done': {\n const fn = fnByIdx[ev.output_index] || { name: 'tool', callId: '' };\n h.onToolCall?.(fn.name, ev.arguments || '', fn.callId);\n break;\n }\n case 'response.output_text.delta':\n h.onTextDelta?.(ev.delta || '');\n break;\n case 'response.output_text.annotation.added': {\n const a = ev.annotation || {};\n if (a.type === 'container_file_citation') {\n h.onFile?.({ container_id: a.container_id, file_id: a.file_id, filename: a.filename });\n }\n break;\n }\n case 'response.completed':\n h.onDone?.('completed', ev.response);\n break;\n case 'response.incomplete':\n h.onDone?.('incomplete', ev.response);\n break;\n case 'response.failed':\n // the response object's own status distinguishes a user cancel ('cancelled')\n // from a real failure — surface it so the UI can badge them differently\n h.onDone?.((ev.response && ev.response.status) || 'failed', ev.response);\n break;\n case 'error':\n h.onError?.(ev.message || 'stream error');\n break;\n default:\n break;\n }\n },\n };\n return self;\n}\n\n/** Read an SSE body stream, calling onData(dataString) per frame (data: lines joined). */\nexport async function readSSEStream(body, onData) {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buf = '';\n for (;;) {\n const { value, done } = await reader.read();\n if (done) break;\n buf += decoder.decode(value, { stream: true });\n let nl;\n // SSE frames are separated by a blank line; each frame has one or more `data:` lines.\n while ((nl = buf.indexOf('\\n\\n')) !== -1) {\n const frame = buf.slice(0, nl);\n buf = buf.slice(nl + 2);\n const data = frame.split('\\n').filter((l) => l.startsWith('data:')).map((l) => l.slice(5).trim()).join('');\n if (!data) continue;\n onData(data);\n }\n }\n}\n\n/**\n * Convenience: parse a Responses SSE body end-to-end, dispatching to handlers.\n * Resolves to the response id (for previous_response_id chaining), or null.\n */\nexport async function pumpResponsesStream(body, handlers) {\n const d = createResponsesDispatcher(handlers);\n await readSSEStream(body, (data) => {\n try { d.dispatch(JSON.parse(data)); } catch { /* ignore malformed frame */ }\n });\n return d.responseId;\n}\n","// Gateway turns -> the message shape ChatMessages renders.\n//\n// This lives in state/ rather than in the transport because it is a pure shape translation with\n// no network in it, and because ChatPanel (a root export) takes ChatMessage[] from its\n// loadHistory: a root consumer must be able to convert history without pulling the whole\n// HarnessRouter fetch layer into its bundle. reifyui/harness re-exports it, so the transport's\n// own callers keep importing it from where the rest of their transport lives.\n//\n// Four apps had each open-coded this function. Three of the four copies were byte-identical and\n// the fourth was the same logic with the status map inlined as a nested ternary.\n\nconst TURN_STATUS = {\n failed: 'failed', error: 'failed', cancelled: 'cancelled',\n incomplete: 'incomplete', max_turns: 'incomplete', timeout: 'incomplete',\n};\n\n/** Gateway turns -> ChatMessages' message shape. */\nexport function turnsToMessages(turns) {\n const out = [];\n for (const t of turns || []) {\n if (t.user) out.push({ role: 'user', text: t.user });\n const steps = (t.tools || []).map((x) => ({ name: x.name, args: x.arguments, result: x.result }));\n const blocks = [];\n if (steps.length) blocks.push({ kind: 'tools', reasoning: '', steps });\n if (t.assistant) blocks.push({ kind: 'text', text: t.assistant });\n const status = TURN_STATUS[t.status] || 'done';\n if (blocks.length || status !== 'done') out.push({ role: 'assistant', blocks, status });\n }\n return out;\n}\n"],"mappings":";AAwBO,SAAS,0BAA0B,GAAG;AAG3C,QAAM,UAAU,CAAC;AACjB,QAAM,OAAO;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,IAAI;AACX,YAAM,IAAI,GAAG;AACb,cAAQ,GAAG;AAAA,QACT,KAAK,oBAAoB;AACvB,gBAAM,OAAO,GAAG,YAAY,CAAC;AAC7B,eAAK,aAAa,KAAK,MAAM,KAAK;AAClC,cAAI,KAAK,WAAY,GAAE,YAAY,KAAK,UAAU;AAClD,gBAAM,MAAO,KAAK,YAAY,KAAK,SAAS,cAAe;AAC3D,cAAI,IAAK,GAAE,YAAY,GAAG;AAC1B;AAAA,QACF;AAAA,QACA,KAAK;AACH,YAAE,mBAAmB,GAAG,SAAS,EAAE;AACnC;AAAA,QACF,KAAK,8BAA8B;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