01
Describe relevant state
Give the recorder a small, serializable view of the application state that matters to the operation.
Add an opt-in session recorder to an agent-callable application without changing its framework or surrendering its state model.
Interleave records what your app can prove: tool calls, semantic human actions, and the state before and after each transition.
Give the recorder a small, serializable view of the application state that matters to the operation.
Record the native WebMCP call and the semantic UI edits that can happen while that call remains pending.
Replay the captured sequence against the behavior your product promises, then export the failure as a regression.
import { SessionRecorder } from '@interleave/recorder';
const recorder = new SessionRecorder({
adapter: { id: 'document-editor', version: 1 },
readState: () => ({
text: editor.text,
revision: editor.revision,
}),
redact: redactForSharing,
});
document.modelContext.registerTool({
name: 'save_document',
description: 'Save the current document.',
inputSchema: saveSchema,
execute: (input, options) =>
recorder.run('save_document', input, 'native', () =>
editor.save(input, options?.signal),
),
});
function editText(text) {
const before = readEditorState();
editor.setText(text);
recorder.stateChange(
'edit_text', { text }, before, readEditorState(), 'manual'
);
}The package supplies trustworthy receipts. Your adapter decides which state matters and what should happen during replay.
npm install https://interleave-webmcp-lab.asaborodaniel.chatgpt.site/interleave-recorder-0.2.0.tgz